3 package uk.ac.vamsas.client;
5 import java.io.Serializable;
8 * Uniquely describes a vamsas client application.
11 public class ClientHandle implements Serializable {
12 static final long serialVersionUID = 0;
18 public ClientHandle(String _clientName, String _version) {
20 this.clientName = _clientName;
21 this.version = _version;
22 //this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO: decide on application handle ornthing (used to prefix new ids made by a particular application)
23 this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
26 * (non-unique) human readable vamsas client name
31 * the unambiguous client identifier
32 * This may be rewritten by the Vorba object if
33 * other clients with the same name, version
34 * and user are involved in a session.
40 * version modifier to tag application space
45 * Generates the client Urn from the clientName and version
47 * @param clientName (non-unique) human readable vamsas client name
48 * @param version version modifier
49 * @return a String corresponding to the clientUrn
51 private String generateClientUrn(String _clientName, String _version)
53 return ("vamsas://"+_clientName+":"+_version+"/").intern();
57 * @return Returns the clientUrn.
59 public String getClientUrn() {
60 return this.clientUrn;
64 * May become protected - should only be set by a Vorba object.
66 * The clientUrn to set.
68 public void setClientUrn(String _clientUrn) {
69 this.clientUrn = _clientUrn;
73 * @return Returns the version.
75 public String getVersion() {
83 public void setVersion(String _version) {
84 this.version = _version;
85 this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
90 * @return Returns the clientName.
92 public String getClientName() {
93 return this.clientName;
98 * The clientName to set.
100 public void setClientName(String _clientName) {
101 this.clientName = _clientName;
102 this.setClientUrn(this.generateClientUrn(this.clientName, this.version));
105 public boolean equals(Object that) {
106 if (that instanceof ClientHandle)
107 return this.equals((ClientHandle) that);
110 public boolean equals(ClientHandle that) {
111 return ( (this.clientName == null || this.clientName.equals(that.clientName))
112 && (this.version == null || this.version.equals(that.version))
113 && (this.clientUrn == null || this.clientUrn.equals(that.clientUrn)));