X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Ffreenet%2Fwot%2FIdentity.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fwotns%2Ffreenet%2Fwot%2FIdentity.java;h=41e28aeacd7a1d86a9d89371d4e62f1df78b46fe;hb=622c4a4d3ebed447d5708a41cf3e1e82e18fa29b;hp=0000000000000000000000000000000000000000;hpb=77869390c46e8e5eff63bf00c7ef44a37ba8f317;p=WoTNS.git diff --git a/src/main/java/net/pterodactylus/wotns/freenet/wot/Identity.java b/src/main/java/net/pterodactylus/wotns/freenet/wot/Identity.java new file mode 100644 index 0000000..41e28ae --- /dev/null +++ b/src/main/java/net/pterodactylus/wotns/freenet/wot/Identity.java @@ -0,0 +1,99 @@ +/* + * Sone - Identity.java - Copyright © 2010 David Roden + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.pterodactylus.wotns.freenet.wot; + +import java.util.Map; +import java.util.Set; + +/** + * Interface for web of trust identities, defining all functions that can be + * performed on an identity. The identity is the main entry point for identity + * management. + * + * @author David ‘Bombe’ Roden + */ +public interface Identity { + + /** + * Returns the ID of the identity. + * + * @return The ID of the identity + */ + public String getId(); + + /** + * Returns the nickname of the identity. + * + * @return The nickname of the identity + */ + public String getNickname(); + + /** + * Returns the request URI of the identity. + * + * @return The request URI of the identity + */ + public String getRequestUri(); + + /** + * Returns all contexts of this identity. + * + * @return All contexts of this identity + */ + public Set getContexts(); + + /** + * Returns whether this identity has the given context. + * + * @param context + * The context to check for + * @return {@code true} if this identity has the given context, + * {@code false} otherwise + */ + public boolean hasContext(String context); + + /** + * Returns all properties of this identity. + * + * @return All properties of this identity + */ + public Map getProperties(); + + /** + * Returns the value of the property with the given name. + * + * @param name + * The name of the property + * @return The value of the property + */ + public String getProperty(String name); + + /** + * Retrieves the trust that this identity receives from the given own + * identity. If this identity is not in the own identity’s trust tree, a + * {@link Trust} is returned that has all its elements set to {@code null}. + * If the trust can not be retrieved, {@code null} is returned. + * + * @param ownIdentity + * The own identity to get the trust for + * @return The trust assigned to this identity, or {@code null} if the trust + * could not be retrieved + */ + public Trust getTrust(OwnIdentity ownIdentity); + +}