Merge branch 'release-0.4'
[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          * <p>
76          * This method is only called by the {@link IdentityManager}.
77          *
78          * @param name
79          *            The name of the property
80          * @param value
81          *            The value of the property
82          * @throws WebOfTrustException
83          *             if an error occurs
84          */
85         public void setProperty(String name, String value) throws WebOfTrustException;
86
87         /**
88          * Sets all properties of this identity.
89          * <p>
90          * This method is only called by the {@link IdentityManager}.
91          *
92          * @param properties
93          *            The new properties of this identity
94          * @throws WebOfTrustException
95          *             if an error occurs
96          */
97         public void setProperties(Map<String, String> properties) throws WebOfTrustException;
98
99         /**
100          * Removes the property with the given name.
101          * <p>
102          * This method is only called by the {@link IdentityManager}.
103          *
104          * @param name
105          *            The name of the property to remove
106          * @throws WebOfTrustException
107          *             if an error occurs
108          */
109         public void removeProperty(String name) throws WebOfTrustException;
110
111         /**
112          * Sets the trust for the given target identity.
113          *
114          * @param target
115          *            The target to set the trust for
116          * @param trustValue
117          *            The new trust value (from {@code -100} or {@code 100})
118          * @param comment
119          *            The comment for the trust assignment
120          * @throws WebOfTrustException
121          *             if an error occurs
122          */
123         public void setTrust(Identity target, int trustValue, String comment) throws WebOfTrustException;
124
125         /**
126          * Removes any trust assignment for the given target identity.
127          *
128          * @param target
129          *            The targe to remove the trust assignment for
130          * @throws WebOfTrustException
131          *             if an error occurs
132          */
133         public void removeTrust(Identity target) throws WebOfTrustException;
134
135 }