org.livetribe.slp
Class ServiceType

java.lang.Object
  extended by org.livetribe.slp.ServiceType
All Implemented Interfaces:
Serializable

public class ServiceType
extends Object
implements Serializable

Services that offer the same functionalities are characterized by the same ServiceType. The ServiceType forms the initial part of a ServiceURL, and it is used to both characterize the service and to be used to lookup services that offer particular functionalities. ServiceTypes are represented in this form:

 [service:][<abstract-type>:]<concrete-type>[.<naming-authority>]
 
The service: string can be omitted, though it is normally used to identify service types exposed by SLP.
The abstract-type denotes a type name for a service that can be exposed over a number of different protocols. For example, JMX exposes connector servers (the services) over different protocols, and their service type can be service:jmx:rmi or service:jmx:jmxmp, where rmi and jmxmp are the protocols used for the wire communication.
The concrete-type denotes a type name for the protocol used by the service to expose its functionalities.
The naming-authority denotes the name of an organization that defined the service type.

Version:
$Rev: 258 $ $Date: 2006-08-23 15:45:17 +0200 (Wed, 23 Aug 2006) $
See Also:
ServiceURL, Serialized Form

Constructor Summary
ServiceType(String type)
          Creates a ServiceType parsing the given string.
 
Method Summary
 boolean equals(Object obj)
           
 String getAbstractTypeName()
          Returns the abstract type name of this service type.
 String getConcreteTypeName()
          Returns the concrete type name of this service type.
 String getNamingAuthority()
          Returns the naming authority of this service type.
 String getPrincipleTypeName()
          Returns the protocol type name of this service type.
 int hashCode()
           
 boolean isAbstractType()
          Returns true if this service type is of the form [service:]abstract:concrete.
 boolean isNADefault()
          Returns true if this service type does not specify a naming authority.
 boolean isServiceURL()
          Returns true if this service type begins with the string service:.
 boolean matches(ServiceType serviceType)
          Returns true if this service type matches the given service type, false otherwise.
 String toString()
          Returns the string form of this service type, that can be passed to ServiceType(String) to be parsed.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceType

public ServiceType(String type)
Creates a ServiceType parsing the given string.

Parameters:
type - The string to be parsed
Method Detail

isServiceURL

public boolean isServiceURL()
Returns true if this service type begins with the string service:.


isAbstractType

public boolean isAbstractType()
Returns true if this service type is of the form [service:]abstract:concrete.


isNADefault

public boolean isNADefault()
Returns true if this service type does not specify a naming authority.


getConcreteTypeName

public String getConcreteTypeName()
Returns the concrete type name of this service type. For service types of the form [service:]foo:bar returns bar. For service types of the form [service:]foo returns the empty string.


getPrincipleTypeName

public String getPrincipleTypeName()
Returns the protocol type name of this service type. For service types of the form [service:]foo:bar returns foo. For service types of the form [service:]foo returns foo.


getAbstractTypeName

public String getAbstractTypeName()
Returns the abstract type name of this service type. For service types of the form [service:]foo:bar returns [service:]foo. For service types of the form [service:]foo returns the empty string.


getNamingAuthority

public String getNamingAuthority()
Returns the naming authority of this service type. For service types of the form [service:]foo:bar.baz returns baz. For service types of the form [service:]foo.baz returns baz. For service types of the form [service:][foo:]bar returns the empty string.


matches

public boolean matches(ServiceType serviceType)
Returns true if this service type matches the given service type, false otherwise.
If this service types is equal to the given service type, the service types match.
The service: prefix is not influent in matching, so service:foo:bar matches foo:bar.
service:foo matches service:foo:bar, foo:bar and foo.

Parameters:
serviceType - The service type to match against

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Returns the string form of this service type, that can be passed to ServiceType(String) to be parsed.

Overrides:
toString in class Object


Copyright © 2006-2012 LiveTribe. All Rights Reserved.