Version: 1.1.1

org.biomoby.shared.data
Class MobyDataObjectSAI

java.lang.Object
  extended by org.biomoby.shared.MobyData
      extended by org.biomoby.shared.MobyPrimaryData
          extended by org.biomoby.shared.MobyPrimaryDataSimple
              extended by org.biomoby.shared.data.MobyDataObject
                  extended by org.biomoby.shared.data.MobyDataObjectSAI
All Implemented Interfaces:
Cloneable, Comparable, MobyDataInstance, MobyDataServiceAssocInstance
Direct Known Subclasses:
MobyDataObjectDeferredSAI, MobyDataXref

public class MobyDataObjectSAI
extends MobyDataObject
implements MobyDataServiceAssocInstance

A convenience class that just associates a set of possible services to run with a data instance. It shadows all of the normal MobyDataObject methods, passing them through to the data instance given in the constructor. This is done rather than unnecessarily cloning potentially large objects. NOTA BENE: This object does not clone the MOBY data passed in, therefore any changes you make to the original MOBY data object later will be reflected here! If you want this object to retain its own copy (e.g. in an intialization loop) call the constructor like this: new MobyDataObjectSAI((MobyDataObject) data.clone(), ...)


Field Summary
 
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance
CENTRAL_XML_MODE, SERVICE_XML_MODE
 
Constructor Summary
MobyDataObjectSAI(MobyDataObject mdsi, MobyService[] services)
          Constructor that takes an existing object and associates services with it.
MobyDataObjectSAI(String namespace, String id, MobyService[] services)
          Constructor for base Objects.
MobyDataObjectSAI(String namespace, String id, MobyService[] services, Registry registry)
           
 
Method Summary
 void addCrossReference(MobyDataObject mobj)
           
 void addNamespace(MobyNamespace ns)
          Add one namespace to already existing ones (but only if a namespace of the same name does not exist yet).
 MobyDataObjectSAI clone()
          Simply calls new constructor with object's existing data type, name and value.
 Collection getCrossReferences()
          Call this method if you would like to modify the cross references, such as removing items, clearing the collection, etc.
 MobyDataObject getDataInstance()
          Returns the underlying data instance we are shadowing
 MobyDataType getDataType()
           
 String getId()
           
 MobyNamespace[] getNamespaces()
          Return all namespaces defined in this data container.
 Object getObject()
          Gives access to the Java object instance underlying the MobyData instance.
 MobyService[] getServices()
           
 Object getUserData()
          Retrieves any application-specific data that may have been stored in association with this Moby object.
 String getValue()
          A lexical (prefereably human readable) representation of the underlying object value (not including the namespace and ID).
 int getXmlMode()
          Report whether toXML will produce Central template or service call instance XML.
 boolean hasCrossReferences()
           
 void setId(String value)
          Used to set the data instance value based on an ID string. i.e. just an Object.
 void setServices(MobyService[] services)
           
 void setUserData(Object data)
          Allows developers to track their application-specific information alongside the Moby functionality.
 void setXmlMode(int mode)
          Determined whether toXML will return a Central template value or a service call instance value.
 String toString()
          Convenience method to get the basic XML representation
 String toXML()
          Produces a full-blown XML fragment that depending on the value of getXmlMode() is either a template for use in MOBY Central services, or a Simple element for use in calling a service instance.
 
Methods inherited from class org.biomoby.shared.data.MobyDataObject
addCrossReferences, addCrossReferences, addProvisionInfo, compareTo, createInstanceFromDOM, createInstanceFromDOM, createInstanceFromString, createInstanceFromString, createInstanceFromXML, equals, getId, getName, getPrimaryNamespace, getProvisionInfo, getTextContents, setName, setPrimaryNamespace, setProvisionInfo
 
Methods inherited from class org.biomoby.shared.MobyPrimaryDataSimple
format, removeNamespace, removeNamespace, setDataType, setNamespaces
 
Methods inherited from class org.biomoby.shared.MobyPrimaryData
isPrimary
 
Methods inherited from class org.biomoby.shared.MobyData
getName
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.data.MobyDataInstance
getName, setName
 

Constructor Detail

MobyDataObjectSAI

public MobyDataObjectSAI(String namespace,
                         String id,
                         MobyService[] services)
Constructor for base Objects.


MobyDataObjectSAI

public MobyDataObjectSAI(String namespace,
                         String id,
                         MobyService[] services,
                         Registry registry)

MobyDataObjectSAI

public MobyDataObjectSAI(MobyDataObject mdsi,
                         MobyService[] services)
Constructor that takes an existing object and associates services with it.

Method Detail

clone

public MobyDataObjectSAI clone()
Description copied from class: MobyDataObject
Simply calls new constructor with object's existing data type, name and value. Subclasses should override this method if more datafields need to be copied for an accurate clone of the Moby Data Instance (i.e. anything but a base object). The subclasses should ensure that they also return a MobyDataObject.

Overrides:
clone in class MobyDataObject
Returns:
an object of class MobyDataObject

getDataInstance

public MobyDataObject getDataInstance()
Returns the underlying data instance we are shadowing


getServices

public MobyService[] getServices()
Specified by:
getServices in interface MobyDataServiceAssocInstance

getDataType

public MobyDataType getDataType()
Overrides:
getDataType in class MobyPrimaryDataSimple

setServices

public void setServices(MobyService[] services)
Specified by:
setServices in interface MobyDataServiceAssocInstance

getXmlMode

public int getXmlMode()
Description copied from class: MobyDataObject
Report whether toXML will produce Central template or service call instance XML.

Specified by:
getXmlMode in interface MobyDataInstance
Overrides:
getXmlMode in class MobyDataObject
Returns:
one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE

setXmlMode

public void setXmlMode(int mode)
                throws IllegalArgumentException
Description copied from class: MobyDataObject
Determined whether toXML will return a Central template value or a service call instance value.

Specified by:
setXmlMode in interface MobyDataInstance
Overrides:
setXmlMode in class MobyDataObject
Parameters:
mode - one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
Throws:
IllegalArgumentException - if the mode is not one of the specified values

getUserData

public Object getUserData()
Description copied from class: MobyData
Retrieves any application-specific data that may have been stored in association with this Moby object. The returned object has nothing to do with the Moby protocol itself. See setUserData() for more details.

Specified by:
getUserData in interface MobyDataInstance
Overrides:
getUserData in class MobyData

setUserData

public void setUserData(Object data)
Description copied from class: MobyData
Allows developers to track their application-specific information alongside the Moby functionality. Provided for application developers' convenience: data stored using this routine is completely ignore by the Moby core libraries. If you want to store Moby data, use the routines defined in various subclasses of this class (e.g. MobyDataObject).

Specified by:
setUserData in interface MobyDataInstance
Overrides:
setUserData in class MobyData

getValue

public String getValue()
Description copied from class: MobyDataObject
A lexical (prefereably human readable) representation of the underlying object value (not including the namespace and ID). This value is used in sorting, and potentially for user interface elements such as tool tips and comment fields. For base objects, there is no underlying value (just a namespace and id), so the result is always a constant string "[Object]".

Overrides:
getValue in class MobyDataObject

setId

public void setId(String value)
Description copied from class: MobyDataObject
Used to set the data instance value based on an ID string. i.e. just an Object.

Overrides:
setId in class MobyDataObject

getId

public String getId()
Overrides:
getId in class MobyData

addNamespace

public void addNamespace(MobyNamespace ns)
Description copied from class: MobyPrimaryDataSimple
Add one namespace to already existing ones (but only if a namespace of the same name does not exist yet).

Overrides:
addNamespace in class MobyPrimaryDataSimple

getNamespaces

public MobyNamespace[] getNamespaces()
Description copied from class: MobyPrimaryDataSimple
Return all namespaces defined in this data container.

Overrides:
getNamespaces in class MobyPrimaryDataSimple

getObject

public Object getObject()
Description copied from class: MobyDataObject
Gives access to the Java object instance underlying the MobyData instance. For example, to change a MOBY String object, call ((StringBuffer) (data.getObject()).append("extra text to add to the end") In the case of a base Moby Object, there really is no underlying Java equivalent to return, so a java.lang.Object is returned for completeness's sake. possibly useful for notification events and pointer equivalency testing in derived classes such as MobyDataServiceAssocInstance?

Specified by:
getObject in interface MobyDataInstance
Overrides:
getObject in class MobyDataObject

addCrossReference

public void addCrossReference(MobyDataObject mobj)
Overrides:
addCrossReference in class MobyDataObject

getCrossReferences

public Collection getCrossReferences()
Description copied from class: MobyDataObject
Call this method if you would like to modify the cross references, such as removing items, clearing the collection, etc. Be sure only to add MobyDataXref and MobyDataObject to the collecton or you'll have a type casting problem later! When we start requiring Java 1.5, this Collection will have a Generic template applied to it.

Overrides:
getCrossReferences in class MobyDataObject

hasCrossReferences

public boolean hasCrossReferences()
Overrides:
hasCrossReferences in class MobyDataObject

toString

public String toString()
Description copied from class: MobyDataObject
Convenience method to get the basic XML representation

Overrides:
toString in class MobyDataObject
Returns:
the raw XML representation of the object

toXML

public String toXML()
Description copied from class: MobyDataObject
Produces a full-blown XML fragment that depending on the value of getXmlMode() is either a template for use in MOBY Central services, or a Simple element for use in calling a service instance.

Specified by:
toXML in interface MobyDataInstance
Overrides:
toXML in class MobyDataObject
Returns:
the MOBY XML representation of the data instance

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010