fixed the User element and the form of the ApplicationData dataType.xsd definition.
[vamsas.git] / src / org / vamsas / client / ClientHandle.java
index 0269af4..76666f9 100644 (file)
@@ -2,11 +2,24 @@
  */
 package org.vamsas.client;
 
+import java.io.Serializable;
+
 /**
  * Uniquely describes a vamsas client application.
  * @author jimp 
  */
-public class ClientHandle {
+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
    */
@@ -14,6 +27,10 @@ public class ClientHandle {
 
   /**
    * 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;
 
@@ -30,6 +47,7 @@ public class ClientHandle {
   }
 
   /**
+   * May become protected - should only be set by a Vorba object.
    * @param clientUrn
    *          The clientUrn to set.
    */
@@ -67,4 +85,13 @@ public class ClientHandle {
   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));
+  }
 }