refactored org to uk
[vamsas.git] / src / uk / ac / vamsas / client / ClientHandle.java
diff --git a/src/uk/ac/vamsas/client/ClientHandle.java b/src/uk/ac/vamsas/client/ClientHandle.java
new file mode 100644 (file)
index 0000000..6f86bce
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ */
+package uk.ac.vamsas.client;
+
+import java.io.Serializable;
+
+/**
+ * Uniquely describes a vamsas client application.
+ * @author jimp 
+ */
+public class ClientHandle implements Serializable {
+  static final long serialVersionUID = 0;
+  /**
+   * @param clientName
+   * @param version
+   */
+  public ClientHandle(String clientName, String version) {
+    super();
+    this.clientName = clientName;
+    this.version = version;
+    this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO: decide on application handle ornthing (used to prefix new ids made by a particular application)
+  }
+  /**
+   * (non-unique) human readable vamsas client name
+   */
+  String clientName;
+
+  /**
+   * the unambiguous client identifier
+   * This may be rewritten by the Vorba object if
+   * other clients with the same name, version 
+   * and user are involved in a session.
+   * 
+   */
+  String clientUrn;
+
+  /**
+   * version modifier to tag application space
+   */
+  String version;
+
+  /**
+   * @return Returns the clientUrn.
+   */
+  public String getClientUrn() {
+    return clientUrn;
+  }
+
+  /**
+   * May become protected - should only be set by a Vorba object.
+   * @param clientUrn
+   *          The clientUrn to set.
+   */
+  public void setClientUrn(String clientUrn) {
+    this.clientUrn = clientUrn;
+  }
+
+  /**
+   * @return Returns the version.
+   */
+  public String getVersion() {
+    return version;
+  }
+
+  /**
+   * @param version
+   *          The version to set.
+   */
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+
+  /**
+   * @return Returns the clientName.
+   */
+  public String getClientName() {
+    return clientName;
+  }
+
+  /**
+   * @param clientName
+   *          The clientName to set.
+   */
+  public void setClientName(String clientName) {
+    this.clientName = clientName;
+  }
+
+  public boolean equals(Object that) {
+    if (that instanceof ClientHandle)
+      return this.equals((ClientHandle) that); 
+    return false;
+  }
+  public boolean equals(ClientHandle that) {
+    return (clientName.equals(that.clientName) && version.equals(that.version) && clientUrn.equals(that.clientUrn));
+  }
+}