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

java.lang.Object
  extended by com.softwareag.tamino.db.api.objectModel.TXMLObjectModel
Direct Known Subclasses:
TDOMObjectModel, TSAXObjectModel, TStreamObjectModel

public abstract class TXMLObjectModel
extends java.lang.Object

TXMLObjectModel defines operations needed to define a specific XML object model that is supported. Each XML object model is defined by four class instances: an element class, a document class, an adapter class, and an input stream interpreter class. An element class represents either an element or a fragment of the document tree, while a document class represents the complete document. An adapter class adapts the physical object model to TXMLObject. An input stream interpreter class determines for a physical object model the way how to handle response documents returned by Tamino.

Version:
$Revision: 1.15 $
Author:
Marcus Schreyer

Constructor Summary
protected TXMLObjectModel(java.lang.String specifier, java.lang.Class documentClass, java.lang.Class elementClass, java.lang.Class adapterClass, java.lang.Class inputStreamInterpreterClass)
          Initializes the object model with the given specifier, document class, element class, adapter class and input stream interpreter class.
 
Method Summary
static void deregister(java.lang.String specifier)
          Deregisters the specified object model from the API and can thus no longer be used afterwards.
 java.lang.Class getAdapterClass()
          Gets the XML object model's adapter class that implements TXMLObject.
 java.lang.reflect.Constructor getAdapterConstructor(java.lang.Object element)
          Gets the constructor for the adapter that is implicitly given by the element argument ( getRegisteredModel( element ) ).
 java.lang.Class getDocumentClass()
          Gets the XML object model's document class which is the entry point to the physical document representation.
 java.lang.Class getElementClass()
          Gets the XML object model's element class which is the entry point to the physical document representation.
 java.lang.Class getInputStreamInterpreterClass()
          Gets the XML object model's input stream interpreter class that implements TInputStreamInterpreter.
 java.util.Locale getLocale()
          Gets the locale.
 java.lang.Object getProperty(java.lang.String key)
          Gets a generic property by a specified key.
 java.util.Iterator<java.lang.Object> getPropertyIterator()
          Gets the iterator over all the properties.
 java.util.Iterator<java.lang.String> getPropertyKeyIterator()
          Gets the iterator over all the property keys.
static TXMLObjectModel getRegisteredModel(java.lang.Object element)
          Gets the TXMLObjectModel for the given element object.
static TXMLObjectModel getRegisteredModel(java.lang.String specifier)
          Gets the specified TXMLObjectModel.
static java.util.Collection<TXMLObjectModel> getRegisteredModels()
          Gets all the registered TXMLObjectModel instances.
 java.lang.String getSpecifier()
          Gets the specifier for this XML object model implementation.
static boolean isRegistered(java.lang.String specifier)
          Indicates if the specified TXMLObjectModel is registered.
static void register(TXMLObjectModel xmlObjectModel)
          Registers the given TXMLObjectModel instance in the API, if not already registered.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 void setProperty(java.lang.String key, java.lang.Object value)
          Sets a generic key/value pair on the XML object model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TXMLObjectModel

protected TXMLObjectModel(java.lang.String specifier,
                          java.lang.Class documentClass,
                          java.lang.Class elementClass,
                          java.lang.Class adapterClass,
                          java.lang.Class inputStreamInterpreterClass)
Initializes the object model with the given specifier, document class, element class, adapter class and input stream interpreter class.

Parameters:
specifier - identifies the object model.
documentClass - represents the class instance for the object model's physical document.
elementClass - represents the class instance for the object model's physical element.
adapterClass - adapts the physical object model to TXMLObject.
inputStreamInterpreterClass - interprets Tamino responses for the physical object model.
Method Detail

register

public static void register(TXMLObjectModel xmlObjectModel)
Registers the given TXMLObjectModel instance in the API, if not already registered. The object model can be accessed by its specifier.

Parameters:
xmlObjectModel - is a TXMLObjectModel implementation instance.

deregister

public static void deregister(java.lang.String specifier)
Deregisters the specified object model from the API and can thus no longer be used afterwards.

Parameters:
specifier - the TXMLObjectModel.

getRegisteredModel

public static TXMLObjectModel getRegisteredModel(java.lang.String specifier)
Gets the specified TXMLObjectModel.

Returns:
the TXMLObjectModel for the given object model, null if none is given.

getRegisteredModel

public static TXMLObjectModel getRegisteredModel(java.lang.Object element)
Gets the TXMLObjectModel for the given element object.

Returns:
the TXMLObjectModel which provides an element class that is assignment-compatible with the specified element class instance.

getRegisteredModels

public static java.util.Collection<TXMLObjectModel> getRegisteredModels()
Gets all the registered TXMLObjectModel instances.

Returns:
the Collection containing all the registered models.

isRegistered

public static boolean isRegistered(java.lang.String specifier)
Indicates if the specified TXMLObjectModel is registered.

Returns:
true if specified object model is registered, false otherwise.

getDocumentClass

public java.lang.Class getDocumentClass()
Gets the XML object model's document class which is the entry point to the physical document representation. For example, for DOM this is the class org.w3c.dom.Document.

Returns:
class instance for the physical document representation.

getElementClass

public java.lang.Class getElementClass()
Gets the XML object model's element class which is the entry point to the physical document representation. For example, for DOM this is the class org.w3c.dom.Document.

Returns:
class instance for the physical element representation.

getAdapterClass

public java.lang.Class getAdapterClass()
Gets the XML object model's adapter class that implements TXMLObject.

Returns:
the TXMLObject implementing the adapter class instance.

getInputStreamInterpreterClass

public java.lang.Class getInputStreamInterpreterClass()
Gets the XML object model's input stream interpreter class that implements TInputStreamInterpreter.

Returns:
the TResponseBuilder implementing class instance.

getAdapterConstructor

public java.lang.reflect.Constructor getAdapterConstructor(java.lang.Object element)
Gets the constructor for the adapter that is implicitly given by the element argument ( getRegisteredModel( element ) ). The constructor chosen here contains exactly one argument which has the same type as either the matching document or elements class type given by getElementClass or getDocumentClass.

Please note, that this operation needs to be overidden if the adapters constructor contains another argument type. This were the case if the argument type for document or element would be derived from the given document or element class.

This method is only for internal use.

Returns:
constructor with the type-safe argument for elements matching either document or element type, null if none can be found.

getSpecifier

public java.lang.String getSpecifier()
Gets the specifier for this XML object model implementation. This method is only for internal use.

Returns:
the object model specifier.

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Sets a generic key/value pair on the XML object model. This method is only for internal use.

Parameters:
key - for the property.
value - model's property accessible by the given key.

getProperty

public java.lang.Object getProperty(java.lang.String key)
Gets a generic property by a specified key. This method is only for internal use.

Returns:
Object for the given key, null if none is given.

getPropertyKeyIterator

public java.util.Iterator<java.lang.String> getPropertyKeyIterator()
Gets the iterator over all the property keys. This method is only for internal use.


getPropertyIterator

public java.util.Iterator<java.lang.Object> getPropertyIterator()
Gets the iterator over all the properties.


setLocale

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


getLocale

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

Returns:
the locale.


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