Package org.eclipse.ecf.core.identity
Class Namespace
- java.lang.Object
- 
- org.eclipse.ecf.core.identity.Namespace
 
- 
- All Implemented Interfaces:
- Serializable,- org.eclipse.core.runtime.IAdaptable
 - Direct Known Subclasses:
- DnsSdNamespace,- FileTransferNamespace,- GUID.GUIDNamespace,- JSLPNamespace,- LongID.LongNamespace,- R_OSGiNamespace,- R_OSGiRemoteServiceNamespace,- RemoteServiceNamespace,- RemoteServiceNamespace,- RestNamespace,- StringID.StringIDNamespace,- URIID.URIIDNamespace,- UuID.UuIDNamespace,- ZooDiscoveryNamespace
 
 public abstract class Namespace extends Object implements Serializable, org.eclipse.core.runtime.IAdaptable Namespace base class.This class and subclasses define a namespace for the creation and management of ID instances. Creation of ID instances is accomplished via the createInstance(Object[])method, implemented by subclasses of this Namespace superclass.All Namespace instances must have a unique name passed to the Namespace upon construction. Typically Namespace instances are created via plugins that define extensions of the org.eclipse.ecf.namespace extension point. For example, to define a new Namespace subclass XMPPNamespace with name "ecf.xmpp" and add it to the ECF extension registry: <extension point="org.eclipse.ecf.namespace"> <namespace class="XMPPNamespace" name="ecf.xmpp"/> </extension>- See Also:
- ID, Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringSCHEME_SEPARATOR
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract IDcreateInstance(Object[] parameters)Make an instance of this namespace.booleanequals(Object other)Override of Object.equals.ObjectgetAdapter(Class adapter)protected intgetCompareToForObject(BaseID first, BaseID second)The default implementation of this method is to call first.namespaceCompareTo(second).StringgetDescription()Get the description, associated with this Namespace.protected intgetHashCodeForID(BaseID id)The default implementation of this method is to call id.namespaceHashCode().protected StringgetInitStringFromExternalForm(Object[] args)StringgetName()Get the name of this namespace.protected StringgetNameForID(BaseID id)The default implementation of this method is to call id.namespaceGetName().abstract StringgetScheme()Get the primary scheme associated with this namespace.Class<?>[][]getSupportedParameterTypes()Get the supported parameter types for IDs created via subsequent calls tocreateInstance(Object[]).String[]getSupportedSchemes()Get an array of schemes supported by this Namespace instance.inthashCode()Hashcode implementation.booleaninitialize(String n, String desc)protected booleantestIDEquals(BaseID first, BaseID second)Test whether two IDs are equal to one another.protected StringtoExternalForm(BaseID id)The default implementation of this method is to call id.namespaceToExternalForm().StringtoString()
 
- 
- 
- 
Field Detail- 
SCHEME_SEPARATORpublic static final String SCHEME_SEPARATOR - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
equalspublic boolean equals(Object other) Override of Object.equals. This equals method returns true if the provided Object is also a Namespace instance, and the names of the two instances match.
 - 
hashCodepublic int hashCode() Hashcode implementation. Subclasses should not override.
 - 
testIDEqualsprotected boolean testIDEquals(BaseID first, BaseID second) Test whether two IDs are equal to one another.- Parameters:
- first- the first ID. Must not be- null.
- second- the second ID. Must not be- null.
- Returns:
- trueif this ID is equal to the given ID.- falseotherwise.
 
 - 
getNameForIDprotected String getNameForID(BaseID id) The default implementation of this method is to call id.namespaceGetName(). Subclasses may override.- Parameters:
- id- the ID to get the name for. Must not be- null.
- Returns:
- String that is the unique name for the given id within this Namespace.
 
 - 
getCompareToForObjectprotected int getCompareToForObject(BaseID first, BaseID second) The default implementation of this method is to call first.namespaceCompareTo(second). Subclasses may override.- Parameters:
- first- the first id to compare. Must not be- null.
- second- the second id to compare. Must not be- null.
- Returns:
- int as specified by Comparable.
 
 - 
getHashCodeForIDprotected int getHashCodeForID(BaseID id) The default implementation of this method is to call id.namespaceHashCode(). Subclasses may override.- Parameters:
- id- the id in this Namespace to get the hashcode for. Must not be- null.
- Returns:
- the hashcode for the given id. Returned value must be unique within this process.
 
 - 
toExternalFormprotected String toExternalForm(BaseID id) The default implementation of this method is to call id.namespaceToExternalForm(). Subclasses may override.- Parameters:
- id- the id in this Namespace to convert to external form.
- Returns:
- String that represents the given id in an external form. Note that
         this external form may at some later time be passed to
         createInstance(Object[])as a single String parameter, and should result in a valid ID instance of the appropriate Namespace.
 
 - 
getNamepublic String getName() Get the name of this namespace. Must not returnnull.- Returns:
- String name of Namespace instance. Must not return null, and the returned value should be a globally unique name for this Namespace subclass.
 
 - 
getDescriptionpublic String getDescription() Get the description, associated with this Namespace. The returned value may benull.- Returns:
- the description associated with this Namespace. May be
         null.
 
 - 
createInstancepublic abstract ID createInstance(Object[] parameters) throws IDCreateException Make an instance of this namespace. Namespace subclasses, provided by plugins must implement this method to construct ID instances for the given namespace.
 SeegetSupportedParameterTypes()to get information relevant to deciding what parameter types are expected by this method.- Parameters:
- parameters- an Object[] of parameters for creating ID instances. May be null.
- Returns:
- a non-null ID instance. The class used may extend BaseID or may implement the ID interface directly
- Throws:
- IDCreateException- if construction fails
 
 - 
getSchemepublic abstract String getScheme() Get the primary scheme associated with this namespace. Subclasses must provide an implementation that returns a non-nullscheme identifier. Note that the returned scheme should not contain the Namespace.SCHEME_SEPARATOR (\":\").- Returns:
- a String scheme identifier. Must not be null.
 
 - 
getSupportedSchemespublic String[] getSupportedSchemes() Get an array of schemes supported by this Namespace instance. Subclasses may override to support multiple schemes.- Returns:
- String[] of schemes supported by this Namespace. Will not be
         null, but returned array may be of length 0.
 
 - 
getSupportedParameterTypespublic Class<?>[][] getSupportedParameterTypes() Get the supported parameter types for IDs created via subsequent calls tocreateInstance(Object[]). Callers may use this method to determine the available parameter types, and then create and pass in conforming Object arrays to tocreateInstance(Object[]).
 An empty two-dimensional array (new Class[0][0]) is the default returned by this abstract superclass. This means that the Object [] passed tocreateInstance(Object[])will be ignored.
 Subsclasses should override this method to specify the parameters that they will accept in calls tocreateInstance(Object[]). The rows of the returned Class array are the acceptable types for a given invocation of createInstance.
 Consider the following example:public Class[][] getSupportedParameterTypes() { return new Class[][] { { String.class }, { String.class, String.class } }; }The above means that there are two acceptable values for the Object [] passed intocreateInstance(Object[]): 1) a single String, and 2) two Strings. These would therefore be acceptable as input to createInstance:ID newID1 = namespace.createInstance(new Object[] { "Hello" }); ID newID2 = namespace.createInstance(new Object[] { "Hello", "There"}};- Returns:
- Class [][] an array of class []s. Rows of the returned
         two-dimensional array define the acceptable parameter types for a
         single call to createInstance(Object[]). If zero-length Class arrays are returned (i.e. Class[0][0]), then Object [] parameters tocreateInstance(Object[])will be ignored.
 
 - 
getAdapterpublic Object getAdapter(Class adapter) - Specified by:
- getAdapterin interface- org.eclipse.core.runtime.IAdaptable
 
 - 
getInitStringFromExternalFormprotected String getInitStringFromExternalForm(Object[] args) - Since:
- 3.1
 
 
- 
 
-