tp.impl
Class ServiceID

java.lang.Object
  extended by tp.impl.ServiceID
All Implemented Interfaces:
Serializable, Comparable<ServiceID>

public final class ServiceID
extends Object
implements Serializable, Comparable<ServiceID>

The class represents a service for Java project. There are three types of services.

The external string representation (toString()) of this identifier is following.

prefix ['-' identifier]

Valid prefix is 'R', 'W', 'T', which correspond to RM, WC, and TM. getName() returns the identifier part. Note that the identifier part is optional.

See Also:
Serialized Form

Field Summary
protected  String addr
          remote address.
static int MAX_NAME_LENGTH
           
protected  String name
           
protected  CSEP545Service.Type type
           
 
Constructor Summary
ServiceID()
           
ServiceID(CSEP545Service.Type type)
           
ServiceID(CSEP545Service.Type type, String name)
           
 
Method Summary
 int compareTo(ServiceID other)
           
 boolean equals(Object o)
           
static ServiceID forRM()
          service id for default RM instance
static ServiceID forRM(String s)
           
static ServiceID forTM()
          service id for default TM instance
static ServiceID forWC()
          service id for default WC instance
static ServiceID forWC(String s)
           
 String getName()
           
 CSEP545Service.Type getType()
          get type of service id
 int hashCode()
           
static ServiceID parse(String s)
          parse external string representation
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_NAME_LENGTH

public static final int MAX_NAME_LENGTH
See Also:
Constant Field Values

type

protected CSEP545Service.Type type

name

protected String name

addr

protected String addr
remote address. does not affect identity test.

Constructor Detail

ServiceID

public ServiceID()

ServiceID

public ServiceID(CSEP545Service.Type type)

ServiceID

public ServiceID(CSEP545Service.Type type,
                 String name)
Method Detail

getType

public CSEP545Service.Type getType()
get type of service id

Returns:
type value of current identifier

getName

public String getName()
Returns:
name of service. An empty string for default service instance.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

forRM

public static ServiceID forRM()
service id for default RM instance

Returns:
default service id

forRM

public static ServiceID forRM(String s)

forWC

public static ServiceID forWC()
service id for default WC instance

Returns:
default service id

forWC

public static ServiceID forWC(String s)

forTM

public static ServiceID forTM()
service id for default TM instance

Returns:
default service id

parse

public static ServiceID parse(String s)
parse external string representation

Parameters:
s - result of toString()
Returns:
newly created resource identifier

compareTo

public int compareTo(ServiceID other)
Specified by:
compareTo in interface Comparable<ServiceID>