X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FOwnIdentity.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FOwnIdentity.java;h=626c4a847890cf96f281cc19d1efb9812872c0d6;hp=0000000000000000000000000000000000000000;hb=5ac1da7c51270ade6171b9755cc26c9b2385c426;hpb=725d85403a7b5e2bad4cef7369aba9db7b5c0b60
diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/OwnIdentity.java b/src/main/java/net/pterodactylus/sone/freenet/wot/OwnIdentity.java
new file mode 100644
index 0000000..626c4a8
--- /dev/null
+++ b/src/main/java/net/pterodactylus/sone/freenet/wot/OwnIdentity.java
@@ -0,0 +1,97 @@
+/*
+ * Sone - OwnIdentity.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.sone.freenet.wot;
+
+/**
+ * An own identity is an identity that the owner of the node has full control
+ * over.
+ *
+ * @author David âBombeâ Roden
+ */
+public class OwnIdentity extends Identity {
+
+ /** The insert URI of the identity. */
+ private final String insertUri;
+
+ /**
+ * Creates a new own identity.
+ *
+ * @param id
+ * The ID of the identity
+ * @param nickname
+ * The nickname of the identity
+ * @param requestUri
+ * The request URI of the identity
+ * @param insertUri
+ * The insert URI of the identity
+ */
+ public OwnIdentity(String id, String nickname, String requestUri, String insertUri) {
+ super(id, nickname, requestUri);
+ this.insertUri = insertUri;
+ }
+
+ //
+ // ACCESSORS
+ //
+
+ /**
+ * Returns the insert URI of the identity.
+ *
+ * @return The insert URI of the identity
+ */
+ public String getInsertUri() {
+ return insertUri;
+ }
+
+ /**
+ * Adds the given context to this identity.
+ *
+ * @param context
+ * The context to add
+ */
+ public void addContext(String context) {
+ if (contexts.add(context)) {
+ /* TODO - add. */
+ }
+ }
+
+ /**
+ * Removes the given context from this identity.
+ *
+ * @param context
+ * The context to remove
+ */
+ public void removeContext(String context) {
+ if (contexts.remove(context)) {
+ /* TODO - remove */
+ }
+ }
+
+ //
+ // OBJECT METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[id=" + getId() + ",nickname=" + getNickname() + ",requestUri=" + getRequestUri() + ",insertUri=" + insertUri + "]";
+ }
+
+}