com.softwareag.tamino.db.api.objectModel
Class TDataObject

java.lang.Object
  extended by com.softwareag.tamino.db.api.objectModel.TDataObject
All Implemented Interfaces:
TStreamable
Direct Known Subclasses:
TNonXMLObject, TXMLObject

public abstract class TDataObject
extends java.lang.Object
implements TStreamable

TDataObject is the abstraction of all types of documents stored in Tamino. It defines access operations to properties common to all types of Tamino documents. This includes the collection and doctype properties and the ino:id and ino:docname attributes.

Version:
$Revision: 1.14 $
Author:
Marcus Schreyer

Constructor Summary
protected TDataObject()
          Default Constructor.
protected TDataObject(java.util.Locale locale)
          Default Constructor.
protected TDataObject(java.lang.String collection, java.lang.String doctype, java.lang.String contentType)
          Special Constructor.
protected TDataObject(java.lang.String collection, java.lang.String doctype, java.lang.String contentType, java.util.Locale locale)
          Special Constructor.
 
Method Summary
protected abstract  boolean canWriteToOutputStream()
          Indicates if the object's XML content can be currently written to an output stream.
 java.lang.String getCollection()
          Gets the collection of this Tamino document.
 java.lang.String getContentType()
          Gets the contentType of this Tamino document.
abstract  java.lang.String getDocname()
          Gets the ino:docname attribute of this Tamino document.
 java.lang.String getDoctype()
          Gets the doctype of this Tamino document.
abstract  java.lang.String getId()
          Gets the ino:id attribute of this Tamino document.
 java.lang.String getLastModified()
          Gets the 'last modified' attribute, the time a Tamino document was modified last of this Tamino document.
 java.util.Locale getLocale()
          Gets the locale.
 boolean hasCollection()
          Checks whether the collection of this Tamino document is set.
 boolean hasDocname()
          Check whether the ino:docname attribute of this Tamino document is set.
 boolean hasDoctype()
          Check whether the doctype on this Tamino document is set.
 boolean hasId()
          Check whether the ino:id attribute of this Tamino document is set.
protected  void readDocumentStateFrom(java.io.ObjectInputStream in)
          This abstract method serves as a plugin method for readStateFrom.
protected  void readStateFrom(java.io.ObjectInputStream in)
          Reads the adapter's state from the given ObjectOutputStream.
 void setCollection(java.lang.String collection)
          Sets the collection of this Tamino document.
 void setContentType(java.lang.String contentType)
          Sets the contentType of this Tamino document.
abstract  void setDocname(java.lang.String docname)
          Sets the ino:docname attribute of this Tamino document.
 void setDoctype(java.lang.String doctype)
          Sets the doctype of this Tamino document.
abstract  void setId(java.lang.String id)
          Sets the ino:id attribute of this Tamino document.
 void setLastModified(java.lang.String lastModified)
          Sets the 'last modified' attribute, the time a Tamino document was modified last of this Tamino document.
 void setLocale(java.util.Locale locale)
          Sets the locale.
protected  void writeDocumentStateTo(java.io.ObjectOutputStream out)
          This method serves as a plugin method for writeStateTo.
protected  void writeStateTo(java.io.ObjectOutputStream out)
          Writes the current state to the given ObjectOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.softwareag.tamino.db.api.io.TStreamable
readFrom, readFrom, writeTo, writeTo
 

Constructor Detail

TDataObject

protected TDataObject()
Default Constructor.


TDataObject

protected TDataObject(java.util.Locale locale)
Default Constructor.


TDataObject

protected TDataObject(java.lang.String collection,
                      java.lang.String doctype,
                      java.lang.String contentType)
Special Constructor. Initializes the object with the given collection, doctype and content type.

Parameters:
collection - the Tamino collection name.
doctype - the Tamino doctype name.
contentType - the content type.

TDataObject

protected TDataObject(java.lang.String collection,
                      java.lang.String doctype,
                      java.lang.String contentType,
                      java.util.Locale locale)
Special Constructor. Initializes the object with the given collection, doctype and content type.

Parameters:
collection - the Tamino collection name.
doctype - the Tamino doctype name.
contentType - the content type.
Method Detail

setCollection

public void setCollection(java.lang.String collection)
Sets the collection of this Tamino document.

Parameters:
collection - the collection tha contains this TDataObject instance.

setDoctype

public void setDoctype(java.lang.String doctype)
Sets the doctype of this Tamino document.

Parameters:
doctype - the doctype of this TDataObject instance.

setDocname

public abstract void setDocname(java.lang.String docname)
Sets the ino:docname attribute of this Tamino document.

Parameters:
docname - the ino:docname attribute of this TDataObject instance.

setId

public abstract void setId(java.lang.String id)
Sets the ino:id attribute of this Tamino document.

Parameters:
id - the ino:id attribute of this TDataObject instance.

setContentType

public void setContentType(java.lang.String contentType)
Sets the contentType of this Tamino document.

Parameters:
contentType - the MimeType of this TDataObject instance.

setLastModified

public void setLastModified(java.lang.String lastModified)
Sets the 'last modified' attribute, the time a Tamino document was modified last of this Tamino document.

Parameters:
lastModified - time of the last modification as a string.

getCollection

public java.lang.String getCollection()
Gets the collection of this Tamino document.

Returns:
the name of the collection containing this TDataObject instance.

getDoctype

public java.lang.String getDoctype()
Gets the doctype of this Tamino document.

Returns:
the name of the doctype of this TDataObject instance.

getDocname

public abstract java.lang.String getDocname()
Gets the ino:docname attribute of this Tamino document.

Returns:
the ino:docname attribute of this TDataObject instance.

getId

public abstract java.lang.String getId()
Gets the ino:id attribute of this Tamino document.

Returns:
the ino:id attribute of this TDataObject instance.

getContentType

public java.lang.String getContentType()
Gets the contentType of this Tamino document.

Specified by:
getContentType in interface TStreamable
Returns:
the contentType of this TDataObject instance.

getLastModified

public java.lang.String getLastModified()
Gets the 'last modified' attribute, the time a Tamino document was modified last of this Tamino document.

Returns:
the time of the last modification as a string.

hasCollection

public boolean hasCollection()
Checks whether the collection of this Tamino document is set.

Returns:
true if the collection property of this TDataObject instance is set, otherwise false.

hasDoctype

public boolean hasDoctype()
Check whether the doctype on this Tamino document is set.

Returns:
true if the doctype property of this TDataObject instance is set, otherwise false.

hasDocname

public boolean hasDocname()
Check whether the ino:docname attribute of this Tamino document is set.

Returns:
true if the ino:docname attribute of this TDataObject instance is set, otherwise false.

hasId

public boolean hasId()
Check whether the ino:id attribute of this Tamino document is set.

Returns:
true if the ino:id attribute of this TDataObject instance is set, otherwise false.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.


getLocale

public java.util.Locale getLocale()
Gets the locale.

Returns:
the locale.

canWriteToOutputStream

protected abstract boolean canWriteToOutputStream()
Indicates if the object's XML content can be currently written to an output stream. In that case you can invoke TStreamable.writeTo.

Returns:
true if invocation of writeTo is possible, false otherwise.

writeStateTo

protected void writeStateTo(java.io.ObjectOutputStream out)
                     throws java.io.IOException
Writes the current state to the given ObjectOutputStream. Please note, that this operation has a different behaviour than the TStreamable operations which write the XML contents to a data sunk. This operation is for internal purpose only and is generally called when a serializable instance is serialized. It serves as a template method and internally calls the plug-in method writeDocumentStateTo in case XML content is given for serialization.

Parameters:
ObjectOutputStream - instance to which the state is written to.
Throws:
java.io.IOException

writeDocumentStateTo

protected void writeDocumentStateTo(java.io.ObjectOutputStream out)
                             throws java.io.IOException
This method serves as a plugin method for writeStateTo. Each time writeStateTo is called with the writeDocument parameter set to true, this method is invoked at the end of the operation. This method is needed for the implementation of serialization thus only concrete adapters implementing the java.io.Serializable interface need to overwrite this method.

Parameters:
out - the ObjectOutputStream needed for serialization.
Throws:
java.io.IOException

readStateFrom

protected void readStateFrom(java.io.ObjectInputStream in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Reads the adapter's state from the given ObjectOutputStream. Please note, that this operation has a different behaviour than the TStreamable operations which read the XML contents from a data source. This operation is for internal purpose only and is generally called when a serialized instance is deserialized. It serves as a template method and internally calls the plug-in method readDocumentStateFrom in case XML content is given for serialization.

Parameters:
ObjectInputStream - instance from which the state is read.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readDocumentStateFrom

protected void readDocumentStateFrom(java.io.ObjectInputStream in)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
This abstract method serves as a plugin method for readStateFrom. Each time readStateFrom is called this method is invoked at the end of the operation. It is needed for the implementation of deserialization thus only concrete adapters implementing the java.io.Serializable interface need to overwrite this method.

Parameters:
out - the ObjectOutputStream needed for serialization.
Throws:
java.io.IOException
java.lang.ClassNotFoundException


Copyright (c) 2013 Software AG. All Rights Reserved.