First extremely basic, kind-of-working version.
[WoTNS.git] / src / main / java / net / pterodactylus / wotns / freenet / wot / Identity.java
1 /*
2  * Sone - Identity.java - Copyright © 2010 David Roden
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 package net.pterodactylus.wotns.freenet.wot;
19
20 import java.util.Map;
21 import java.util.Set;
22
23 /**
24  * Interface for web of trust identities, defining all functions that can be
25  * performed on an identity. The identity is the main entry point for identity
26  * management.
27  *
28  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29  */
30 public interface Identity {
31
32         /**
33          * Returns the ID of the identity.
34          *
35          * @return The ID of the identity
36          */
37         public String getId();
38
39         /**
40          * Returns the nickname of the identity.
41          *
42          * @return The nickname of the identity
43          */
44         public String getNickname();
45
46         /**
47          * Returns the request URI of the identity.
48          *
49          * @return The request URI of the identity
50          */
51         public String getRequestUri();
52
53         /**
54          * Returns all contexts of this identity.
55          *
56          * @return All contexts of this identity
57          */
58         public Set<String> getContexts();
59
60         /**
61          * Returns whether this identity has the given context.
62          *
63          * @param context
64          *            The context to check for
65          * @return {@code true} if this identity has the given context,
66          *         {@code false} otherwise
67          */
68         public boolean hasContext(String context);
69
70         /**
71          * Returns all properties of this identity.
72          *
73          * @return All properties of this identity
74          */
75         public Map<String, String> getProperties();
76
77         /**
78          * Returns the value of the property with the given name.
79          *
80          * @param name
81          *            The name of the property
82          * @return The value of the property
83          */
84         public String getProperty(String name);
85
86         /**
87          * Retrieves the trust that this identity receives from the given own
88          * identity. If this identity is not in the own identity’s trust tree, a
89          * {@link Trust} is returned that has all its elements set to {@code null}.
90          * If the trust can not be retrieved, {@code null} is returned.
91          *
92          * @param ownIdentity
93          *            The own identity to get the trust for
94          * @return The trust assigned to this identity, or {@code null} if the trust
95          *         could not be retrieved
96          */
97         public Trust getTrust(OwnIdentity ownIdentity);
98
99 }