org.eclipse.ecf.discovery.identity
Class ServiceTypeID

java.lang.Object
  extended by org.eclipse.ecf.core.identity.BaseID
      extended by org.eclipse.ecf.discovery.identity.ServiceTypeID
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, java.security.Principal, org.eclipse.core.runtime.IAdaptable, ID, IServiceTypeID
Direct Known Subclasses:
DnsSdServiceTypeID, JMDNSServiceTypeID, JSLPServiceTypeID, ZooDiscoveryServiceTypeID

public class ServiceTypeID
extends BaseID
implements IServiceTypeID

ServiceTypeID base class.

See Also:
Serialized Form

Field Summary
protected static java.lang.String DELIM
           
protected  java.lang.String namingAuthority
           
protected  java.lang.String[] protocols
           
protected  java.lang.String[] scopes
           
protected  java.lang.String[] services
           
protected  java.lang.String typeName
           
 
Fields inherited from class org.eclipse.ecf.core.identity.BaseID
namespace
 
Fields inherited from interface org.eclipse.ecf.discovery.identity.IServiceTypeID
DEFAULT_NA, DEFAULT_PROTO, DEFAULT_SCOPE
 
Constructor Summary
protected ServiceTypeID(Namespace namespace)
           
protected ServiceTypeID(Namespace ns, IServiceTypeID id)
           
  ServiceTypeID(Namespace namespace, java.lang.String aType)
          Clients should not call this method directly.
protected ServiceTypeID(Namespace namespace, java.lang.String[] services, java.lang.String[] scopes, java.lang.String[] protocols, java.lang.String namingAuthority)
           
 
Method Summary
protected  void createType()
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getInternal()
          Get the internal name of the service type.
 java.lang.String getName()
          Get the unique name of this identity.
 java.lang.String getNamingAuthority()
           
 java.lang.String[] getProtocols()
           
 java.lang.String[] getScopes()
           
 java.lang.String[] getServices()
           
 int hashCode()
           
protected  int namespaceCompareTo(BaseID o)
          Called by Namespace.getCompareToForObject(BaseID, BaseID).
protected  boolean namespaceEquals(BaseID o)
          Called by Namespace.testIDEquals(BaseID, BaseID).
protected  java.lang.String namespaceGetName()
          Called by Namespace.getNameForID(BaseID).
protected  int namespaceHashCode()
          Called by Namespace.getHashCodeForID(BaseID).
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.ecf.core.identity.BaseID
compareTo, getAdapter, getNamespace, namespaceToExternalForm, toExternalForm
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ecf.core.identity.ID
getNamespace, toExternalForm
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

DELIM

protected static final java.lang.String DELIM
See Also:
Constant Field Values

typeName

protected java.lang.String typeName

namingAuthority

protected java.lang.String namingAuthority

protocols

protected java.lang.String[] protocols

scopes

protected java.lang.String[] scopes

services

protected java.lang.String[] services
Constructor Detail

ServiceTypeID

protected ServiceTypeID(Namespace namespace)

ServiceTypeID

protected ServiceTypeID(Namespace namespace,
                        java.lang.String[] services,
                        java.lang.String[] scopes,
                        java.lang.String[] protocols,
                        java.lang.String namingAuthority)

ServiceTypeID

protected ServiceTypeID(Namespace ns,
                        IServiceTypeID id)

ServiceTypeID

public ServiceTypeID(Namespace namespace,
                     java.lang.String aType)
Clients should not call this method directly. Use the Namespace and/or ServiceIDFactory instead.

Parameters:
namespace -
aType -
Method Detail

createType

protected void createType()

getName

public java.lang.String getName()
Description copied from interface: ID
Get the unique name of this identity.

Specified by:
getName in interface java.security.Principal
Specified by:
getName in interface ID
Overrides:
getName in class BaseID
Returns:
String unique name for this identity. Will not be null, and must be a unique String within the Namespace returned by getNamespace()

namespaceCompareTo

protected int namespaceCompareTo(BaseID o)
Description copied from class: BaseID
Called by Namespace.getCompareToForObject(BaseID, BaseID).

Specified by:
namespaceCompareTo in class BaseID
Parameters:
o - the other ID to compare to. Will not be null.
Returns:
the appropriate value as per Comparable contract.

namespaceEquals

protected boolean namespaceEquals(BaseID o)
Description copied from class: BaseID
Called by Namespace.testIDEquals(BaseID, BaseID).

Specified by:
namespaceEquals in class BaseID
Parameters:
o - the other ID to test against. May be null.
Returns:
true if this ID is equal to the given ID. false otherwise.

namespaceGetName

protected java.lang.String namespaceGetName()
Description copied from class: BaseID
Called by Namespace.getNameForID(BaseID).

Specified by:
namespaceGetName in class BaseID
Returns:
String name for this ID. Must not be null. Value returned should be unique within this Namespace.

namespaceHashCode

protected int namespaceHashCode()
Description copied from class: BaseID
Called by Namespace.getHashCodeForID(BaseID).

Specified by:
namespaceHashCode in class BaseID
Returns:
int hashCode for this ID. Returned value must be unique within this process.

toString

public java.lang.String toString()
Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object

getNamingAuthority

public java.lang.String getNamingAuthority()
Specified by:
getNamingAuthority in interface IServiceTypeID
Returns:
String Naming Authority for this ServiceType. Will not be null. If this instance has been created with the provider specific default, this will return IServiceTypeID.DEFAULT_NA instead.

getProtocols

public java.lang.String[] getProtocols()
Specified by:
getProtocols in interface IServiceTypeID
Returns:
String[] of protocols supported. Will not be null, but may be empty array. If this instance has been created with the provider specific default, this will return IServiceTypeID.DEFAULT_PROTO instead.

getScopes

public java.lang.String[] getScopes()
Specified by:
getScopes in interface IServiceTypeID
Returns:
The scopes in which this Service is registered. Will not be null, but may be empty array. If this instance has been created with the provider specific default, this will return IServiceTypeID.DEFAULT_SCOPE instead!

getServices

public java.lang.String[] getServices()
Specified by:
getServices in interface IServiceTypeID
Returns:
The name of the service type. If the underlying discovery mechanism supports naming hierarchies, the hierarchy will be returned flattened as an array. Will not be null, but may be empty array.

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.security.Principal
Specified by:
equals in interface ID
Overrides:
equals in class BaseID

hashCode

public int hashCode()
Specified by:
hashCode in interface java.security.Principal
Specified by:
hashCode in interface ID
Overrides:
hashCode in class BaseID

getInternal

public java.lang.String getInternal()
Description copied from interface: IServiceTypeID
Get the internal name of the service type. Provider implementations may choose to have this return the same value as ID.getName(), or they may return a different, internal value appropriate to the provider.

Specified by:
getInternal in interface IServiceTypeID
Returns:
String internal name for this service type. Will not return null.