26dc449cd1c533ea1eb06bf9a0b12ab65067ffb7
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / wot / OwnIdentity.java
1 /*
2  * Sone - OwnIdentity.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.sone.freenet.wot;
19
20 import java.util.Map;
21 import java.util.Set;
22
23 /**
24  * Defines a local identity, an own identity.
25  *
26  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
27  */
28 public interface OwnIdentity extends Identity {
29
30         /**
31          * Returns the insert URI of the identity.
32          *
33          * @return The insert URI of the identity
34          */
35         public String getInsertUri();
36
37         /**
38          * Adds the given context to this identity.
39          * <p>
40          * This method is only called by the {@link IdentityManager}.
41          *
42          * @param context
43          *            The context to add
44          * @throws WebOfTrustException
45          *             if an error occurs
46          */
47         public void addContext(String context) throws WebOfTrustException;
48
49         /**
50          * Sets all contexts of this identity.
51          * <p>
52          * This method is only called by the {@link IdentityManager}.
53          *
54          * @param contexts
55          *            All contexts of the identity
56          * @throws WebOfTrustException
57          *             if an error occurs
58          */
59         public void setContexts(Set<String> contexts) throws WebOfTrustException;
60
61         /**
62          * Removes the given context from this identity.
63          * <p>
64          * This method is only called by the {@link IdentityManager}.
65          *
66          * @param context
67          *            The context to remove
68          * @throws WebOfTrustException
69          *             if an error occurs
70          */
71         public void removeContext(String context) throws WebOfTrustException;
72
73         /**
74          * Sets the property with the given name to the given value.
75          *
76          * @param name
77          *            The name of the property
78          * @param value
79          *            The value of the property
80          * @throws WebOfTrustException
81          *             if an error occurs
82          */
83         public void setProperty(String name, String value) throws WebOfTrustException;
84
85         /**
86          * Sets all properties of this identity.
87          * <p>
88          * This method is only called by the {@link IdentityManager}.
89          *
90          * @param properties
91          *            The new properties of this identity
92          * @throws WebOfTrustException
93          *             if an error occurs
94          */
95         public void setProperties(Map<String, String> properties) throws WebOfTrustException;
96
97         /**
98          * Removes the property with the given name.
99          * <p>
100          * This method is only called by the {@link IdentityManager}.
101          *
102          * @param name
103          *            The name of the property to remove
104          * @throws WebOfTrustException
105          *             if an error occurs
106          */
107         public void removeProperty(String name) throws WebOfTrustException;
108
109         /**
110          * Sets the trust for the given target identity.
111          *
112          * @param target
113          *            The target to set the trust for
114          * @param trustValue
115          *            The new trust value (from {@code -100} or {@code 100})
116          * @param comment
117          *            The comment for the trust assignment
118          * @throws WebOfTrustException
119          *             if an error occurs
120          */
121         public void setTrust(Identity target, int trustValue, String comment) throws WebOfTrustException;
122
123         /**
124          * Removes any trust assignment for the given target identity.
125          *
126          * @param target
127          *            The targe to remove the trust assignment for
128          * @throws WebOfTrustException
129          *             if an error occurs
130          */
131         public void removeTrust(Identity target) throws WebOfTrustException;
132
133 }