com.softwareag.tamino.db.api.accessor
Class TSchemaDefinition3AccessorImpl

java.lang.Object
  extended by com.softwareag.tamino.db.api.accessor.TAbstractAccessor
      extended by com.softwareag.tamino.db.api.accessor.TAbstractSchemaDefinitionAccessor
          extended by com.softwareag.tamino.db.api.accessor.TSchemaDefinition3AccessorImpl
All Implemented Interfaces:
TAccessor, TInvalidatableAccessor, TSchemaDefinition3Accessor
Direct Known Subclasses:
TSchemaDefinition3AccessorTimeLoggingImpl

public class TSchemaDefinition3AccessorImpl
extends TAbstractSchemaDefinitionAccessor
implements TSchemaDefinition3Accessor

TSchemaDefinition3AccessorImpl is the implementation class for TSchemaDefinition3Accessor.

Version:
$Revision: 1.28 $
Author:
Marcus Schreyer

Field Summary
 
Fields inherited from class com.softwareag.tamino.db.api.accessor.TAbstractAccessor
canBeCancelled, clientRequests, requestCounter, SGUAI
 
Constructor Summary
TSchemaDefinition3AccessorImpl(TStreamAccessor streamAccessor, TResponseBuilder responseBuilder)
          Special Constructor.
 
Method Summary
 TResponse define(TXMLObject[] schemaObjects)
          Defines multiple schemas stored in an array of dataObjects.
 TResponse define(TXMLObject[] schemaObjects, TDefineMode defineMode)
          Defines multiple schemas stored in an array of dataObjects.
 TResponse define(TXMLObject schemaObject, boolean asTest)
          Deprecated. Please use the method define( TXMLObject schemaObject, TDefineMode defineMode ) instead.
 TResponse define(TXMLObject schemaObject, TDefineMode defineMode)
          Defines a Tamino schema depending on the defineMode indicator into the current database.
 java.util.Iterator<java.lang.String> getCollectionNames()
          Gets the iterator for the list of all collection names stored within Tamino.
 java.util.Iterator<java.lang.String> getDoctypeNames(java.lang.String collection, java.lang.String schema)
          Gets the iterator for the list of all doctype names that are given for the specified collection and schema.
 java.util.Iterator<java.lang.String> getRootElementNames(java.lang.String collection)
          Gets the root element names within the specified collection.
 TResponse getSchema(java.lang.String collection, java.lang.String schema)
          Gets the schema or multiple schemas for the given collection and schema and hands back the result as a TResponse object.
 java.util.Iterator<java.lang.String> getSchemaNames(java.lang.String collection)
          Gets the iterator for the list of schema names given within the specified collection, or if no collection is given all schema names currently stored under the connected database.
 java.util.Iterator<java.lang.String> getUndefinedRootElementNames(java.lang.String collection)
          Gets the root element names within the specified collection wich do not belong to any defined schema.
 
Methods inherited from class com.softwareag.tamino.db.api.accessor.TAbstractSchemaDefinitionAccessor
cancelRequests, define, getAccessFailureVerifier, getResponseBuilder, getStreamAccessor, setAccessLocation, setCanBeCancelled, setMaximumRequestDuration, undefine, undefine
 
Methods inherited from class com.softwareag.tamino.db.api.accessor.TAbstractAccessor
getAccessCollection, getAccessLocation, getApplicationName, getCanBeCancelled, getDatabaseUri, getInvocation, getLocale, getLockMode, getLockwaitMode, getMaximumRequestDuration, invalidate, invoke, invoke, invoke, setApplicationName, setInvocation, setLockMode, setLockwaitMode
 
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.accessor.TSchemaDefinition3Accessor
define, undefine, undefine
 
Methods inherited from interface com.softwareag.tamino.db.api.accessor.TAccessor
cancelRequests, getAccessLocation, getApplicationName, getCanBeCancelled, getLockMode, getLockwaitMode, getMaximumRequestDuration, setAccessLocation, setApplicationName, setCanBeCancelled, setLockMode, setLockwaitMode, setMaximumRequestDuration
 
Methods inherited from interface com.softwareag.tamino.db.api.accessor.TInvalidatableAccessor
invalidate
 

Constructor Detail

TSchemaDefinition3AccessorImpl

public TSchemaDefinition3AccessorImpl(TStreamAccessor streamAccessor,
                                      TResponseBuilder responseBuilder)
Special Constructor. Initializes the accessor with the given TXMLStreamAccessor and TResponseBuilder.

Parameters:
streamAccessor, - internally needed for core stream access.
responseBuilder, - needed for building high level response objects.
Method Detail

getCollectionNames

public java.util.Iterator<java.lang.String> getCollectionNames()
                                                        throws TQueryException
Gets the iterator for the list of all collection names stored within Tamino. Please note, that only the collections defined under TSD3 are delivered.

Specified by:
getCollectionNames in interface TSchemaDefinition3Accessor
Returns:
Iterator The iterator over the collection names given as String instances. If none are given, the iterator indicates this with iterator.hasNext() == false.
Throws:
TQueryException - if the query for the collection names fails.

getSchemaNames

public java.util.Iterator<java.lang.String> getSchemaNames(java.lang.String collection)
                                                    throws TQueryException
Gets the iterator for the list of schema names given within the specified collection, or if no collection is given all schema names currently stored under the connected database.

Specified by:
getSchemaNames in interface TSchemaDefinition3Accessor
Parameters:
collection - specifies the collection for which all schema names have to be delivered. If this is not specified all schema names are requested.
Returns:
Iterator The iterator over the schema names within the specified collection. In case no collection is given all schema names stored under Tamino are delivered. If no schema names are found, the iterator indicates this with iterator.hasNext() == false.
Throws:
TQueryException - if the query for the schema names fails.

getDoctypeNames

public java.util.Iterator<java.lang.String> getDoctypeNames(java.lang.String collection,
                                                            java.lang.String schema)
                                                     throws TQueryException
Gets the iterator for the list of all doctype names that are given for the specified collection and schema. Depending on the provided arguments the following results are handed back:
  1. collection != null && schema != null , all doctype names for the given collection and schema.
  2. collection != null && schema == null , all doctype names that can be found for the given collection.
  3. collection == null && schema != null , all doctype names that can be found for the given schema.
  4. colleciton == null && schema == null , all doctype names globally given.

Specified by:
getDoctypeNames in interface TSchemaDefinition3Accessor
Parameters:
collection - specifies the collection for which all doctype names have to be delivered.
schema - specifies the schema for which all doctype names have to be delivered.
Returns:
Iterator The iterator over the doctype names within the specified collection and schema.
Throws:
TQueryException - if the query for the schema names fails.

getSchema

public TResponse getSchema(java.lang.String collection,
                           java.lang.String schema)
                    throws TQueryException
Gets the schema or multiple schemas for the given collection and schema and hands back the result as a TResponse object. Whether a result set is handed back strongly depends on whether the collection and schema information are given. If this is the case only the relevant schema is handed back. Generally depending on the provided arguments the following results are handed back regarding the requested schemas:
  1. collection != null && schema != null , the schema within the specified collection and the given schema name.
  2. collection != null && schema == null , all schemas within the specified collection.
  3. collection == null && schema != null , all schemas with the given schema name.
  4. collection == null && schema == null , all schemas globally given.

Specified by:
getSchema in interface TSchemaDefinition3Accessor
Parameters:
collection - specifies the Tamino collection for which schemas are requested.
schema - specifies the schema name for which schemas are requested.
Returns:
TResponse containing the TXMLObjectIterator for the access to requested schemas. Note, that the first schema instance can also be access by the getFirstXMLObject method provided within TResponse.
Throws:
TQueryException - if the query for the given schema fails.

getRootElementNames

public java.util.Iterator<java.lang.String> getRootElementNames(java.lang.String collection)
                                                         throws TQueryException
Gets the root element names within the specified collection.

Specified by:
getRootElementNames in interface TSchemaDefinition3Accessor
Parameters:
collection - the collection for which all root element names will be retrieved.
Returns:
Iterator an iterator over the returned root element names. If no root element names are found, the iterator indicates this with iterator.hasNext() == false.
Throws:
TQueryException - signals an error while attempting to query for the schemas.

getUndefinedRootElementNames

public java.util.Iterator<java.lang.String> getUndefinedRootElementNames(java.lang.String collection)
                                                                  throws TQueryException
Gets the root element names within the specified collection wich do not belong to any defined schema.

Specified by:
getUndefinedRootElementNames in interface TSchemaDefinition3Accessor
Parameters:
collection - the collection for which all undefined root element names will be retrieved.
Returns:
Iterator an iterator over the returned root element names. If no root element names are found, the iterator indicates this with iterator.hasNext() == false.
Throws:
TQueryException - signals an error while attempting to query for the schemas.

define

public TResponse define(TXMLObject schemaObject,
                        boolean asTest)
                 throws TDefineException
Deprecated. Please use the method define( TXMLObject schemaObject, TDefineMode defineMode ) instead.

Defines a Tamino schema depending on the asTest indicator into the current database. If the asTest parameter is set to true, the define is simply tested on Tamino but not physically defined. If asTest is set to false the behaviour is the same as the define operation without additional parameters. Please note, that using this operation with asTest set to true is for SAG internal use only.

Specified by:
define in interface TSchemaDefinition3Accessor
Parameters:
schemaObject - denotes the schema instance which should be defined on Tamino.
asTest - indicates if define should only be tested. If set to true define is tested otherwise the schema is physically defined.
Returns:
TResponse containing the response information.
Throws:
TDefineException - if the define for the given schema instance fails. This is the case regardless of the value for the asTest parameter.

define

public TResponse define(TXMLObject schemaObject,
                        TDefineMode defineMode)
                 throws TDefineException
Defines a Tamino schema depending on the defineMode indicator into the current database. If defineMode.isTest() is true, Tamino only tests the input schema, but the schema is not defined in the database. If defineMode.isValidate() is true, first structure-based updefine tests are being performed for each doctype. If they fail, all instances of that doctype are validated against the new schema. No validation is being performed for the instances of non-XML doctypes. Please note, that the usage of this method is for SAG internal use only.

Specified by:
define in interface TSchemaDefinition3Accessor
Parameters:
schemaObject - denotes the schema instance which should be defined on Tamino.
defineMode - indicates if the input schema should only be tested and if it should be validated.
Returns:
TResponse containing the response information.
Throws:
TDefineException - if the define for the given schema instance fails. This is the case regardless of the value for the asTest parameter.

define

public TResponse define(TXMLObject[] schemaObjects)
                 throws TDefineException
Defines multiple schemas stored in an array of dataObjects. If the schema already exists in the same collection, Tamino attempts to update the schema, otherwise a new schema is created.

Specified by:
define in interface TSchemaDefinition3Accessor
Parameters:
array - of dataObjects containing the schemas to be defined in Tamino.
Returns:
TInputStream containing the Taminos response document.
Throws:
TDefineException - signals an error while attempting the define operation.

define

public TResponse define(TXMLObject[] schemaObjects,
                        TDefineMode defineMode)
                 throws TDefineException
Defines multiple schemas stored in an array of dataObjects. If the schema already exists in the same collection, Tamino attempts to update the schema, otherwise a new schema is created.

Specified by:
define in interface TSchemaDefinition3Accessor
Parameters:
array - of dataObjects containing the schemas to be defined in Tamino.
defineMode - indicates if the input schema should only be tested and if it should be validated.
Returns:
TInputStream containing the Taminos response document.
Throws:
TDefineException - signals an error while attempting the define operation.


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