atg.repository.xml
Class AddService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.repository.xml.ModifyService
              extended by atg.repository.xml.AddService
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener, org.xml.sax.ErrorHandler

public class AddService
extends atg.repository.xml.ModifyService

This class will add an item represented by a given instance document to a particular repository. There are different flavors of the addItem() method that can be called to actually perform the work of adding an item.

This class will also keep track of performance statistics via the PerformanceMonitor. The PerformanceMonitor component can be inspected to track how this method performs.


Field Summary
static java.lang.String ADD_SERVICE_OP_NAME
           
static java.lang.String CHECKOUT_TAG
          Tag supplied to the ResourcePools as an identifier for this service.
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
AddService()
           
 
Method Summary
 RepositoryItem addItem(java.io.InputStream pXMLInput)
          This method adds an item to a particular repository.
 RepositoryItem addItem(java.io.InputStream pXMLInput, boolean pIsValidate, boolean pEmptyTagIsNull, boolean pMissingTagIsNull, boolean pIsPersistItem, boolean pIsEmptyTagIsEmptyString)
          This method adds an item to a particular repository.
 RepositoryItem addItem(java.io.Reader pXMLInput)
          This method adds an item to a particular repository.
 RepositoryItem addItem(java.io.Reader pXMLInput, boolean pIsValidate, boolean pEmptyTagIsNull, boolean pMissingTagIsNull, boolean pIsPersistItem, boolean pIsEmptyTagIsEmptyString)
          This method adds an item to a particular repository.
 RepositoryItem addItem(java.io.Reader pXMLInput, boolean pIsValidate, boolean pEmptyTagIsNull, boolean pMissingTagIsNull, boolean pIsPersistItem, boolean pIsEmptyTagIsEmptyString, java.lang.String pTopLevelId)
          This method adds an item to a particular repository.
 RepositoryItem addItem(java.lang.String pXMLInput)
          This method adds an item to a particular repository.
 RepositoryItem addItem(java.lang.String pXMLInput, boolean pIsValidate, boolean pEmptyTagIsNull, boolean pMissingTagIsNull, boolean pIsPersistItem, boolean pIsEmptyTagIsEmptyString)
          This method adds an item to a particular repository.
 atg.repository.xml.ModifyHandlerResourcePool getAddHandlerPool()
          Maintain a pool of ContentHandlers that will be used to process an instance document.
 void setAddHandlerPool(atg.repository.xml.ModifyHandlerResourcePool pAddHandlerPool)
          Set the AddHandlerPool property.
 void setPropertiesOnContentHandler(atg.repository.xml.AddHandler pContentHandler, boolean pEmptyTagIsNull, boolean pMissingTagIsNull, boolean pIsPersistItem, boolean pEmptyTagIsEmptyString)
          This method will set properties on the contentHandler that control how the contentHandler will process a given instance document.
 
Methods inherited from class atg.repository.xml.ModifyService
clearGsaIdCache, error, fatalError, getCache, getCache, getDateFormat, getGsaIdCache, getRepositoryXMLTools, getSAXParserPool, getSchemaManager, getTransactionManager, isEmptyTagIsEmptyString, isEmptyTagIsNull, isLogWarningOnReadOnly, isMissingTagIsNull, isPersistItem, isUseGsaIdCache, isValidate, prepopulateCache, setDateFormat, setEmptyTagIsEmptyString, setEmptyTagIsNull, setFeaturesForXMLReader, setHandlersForXMLReader, setLogWarningOnReadOnly, setMissingTagIsNull, setPersistItem, setRepositoryXMLTools, setSAXParserPool, setSchemaManager, setTransactionManager, setUseGsaIdCache, setValidate, warning
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

CHECKOUT_TAG

public static final java.lang.String CHECKOUT_TAG
Tag supplied to the ResourcePools as an identifier for this service.

See Also:
Constant Field Values

ADD_SERVICE_OP_NAME

public static final java.lang.String ADD_SERVICE_OP_NAME
See Also:
Constant Field Values
Constructor Detail

AddService

public AddService()
Method Detail

getAddHandlerPool

public atg.repository.xml.ModifyHandlerResourcePool getAddHandlerPool()
Maintain a pool of ContentHandlers that will be used to process an instance document. These objects are pooled to decrease the amount of time it takes to process an instance document.

Returns:
ResourcePool of AddHandler objects that are ContentHandlers for the processing of an instnace document.

setAddHandlerPool

public void setAddHandlerPool(atg.repository.xml.ModifyHandlerResourcePool pAddHandlerPool)
Set the AddHandlerPool property.

Parameters:
pAddHandlerPool -

addItem

public RepositoryItem addItem(java.lang.String pXMLInput)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Whether to validate, treat empty tags as null, missing tags as null and to persist the item to the repository will be controlled by their respective properties on this class.

Parameters:
pXMLInput - the instance document representing a repository item to add.
Returns:
RepositoryItem the created repository item
Throws:
AddException - if an error occurs.

addItem

public RepositoryItem addItem(java.io.InputStream pXMLInput)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Whether to validate, treat empty tags as null, missing tags as null and to persist the item to the repository will be controlled by their respective properties on this class.

Parameters:
pXMLInput - the instance document representing a repository item to add.
Returns:
RepositoryItem the create repository item
Throws:
AddException - if an error occurs.

addItem

public RepositoryItem addItem(java.io.Reader pXMLInput)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Whether to validate, treat empty tags as null, missing tags as null and to persist the item to the repository will be controlled by their respective properties on this class.

Parameters:
pXMLInput - the instance document representing a repository item to add.
Returns:
RepositoryItem the create repository item
Throws:
AddException - if an error occurs.

addItem

public RepositoryItem addItem(java.lang.String pXMLInput,
                              boolean pIsValidate,
                              boolean pEmptyTagIsNull,
                              boolean pMissingTagIsNull,
                              boolean pIsPersistItem,
                              boolean pIsEmptyTagIsEmptyString)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Parameters:
pXMLInput - the instance document representing a repository item to add.
pIsValidate - should the incoming instance document be validated. Setting this to true will ensure safety of the instance documents but will slow down processing
pEmptyTagIsNull - should empty tags be treated as null. For example, if an element appeared in an instance document that looked like <firstName/> this could either result in the firstName property being set to null explicitly on the repository item, or skip setting any value on the property. If this parameter is true, then null is set explicitly, else no property is set.
pMissingTagIsNull - if this property is set to true, then all tags that fail appear in a given instance document will have their corresponding properties set to null on the repository item. For example, if the firstName element had failed to appear in an instance document then if this property was true null would be set for the firstName property.
pIsPersistItem - if this is true, then any item created will also be persisted to the repository by calling the addItem() method.
pIsEmptyTagIsEmptyString - if this is true, then any empty tags will result in setting the empty string assigned to the corresponding property
Returns:
RepositoryItem the create repository item
Throws:
AddException - if an error occurs.

addItem

public RepositoryItem addItem(java.io.InputStream pXMLInput,
                              boolean pIsValidate,
                              boolean pEmptyTagIsNull,
                              boolean pMissingTagIsNull,
                              boolean pIsPersistItem,
                              boolean pIsEmptyTagIsEmptyString)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Parameters:
pXMLInput - the instance document representing a repository item to add.
pIsValidate - should the incoming instance document be validated. Setting this to true will ensure safety of the instance documents but will slow down processing
pEmptyTagIsNull - should empty tags be treated as null. For example, if an element appeared in an instance document that looked like <firstName/> this could either result in the firstName property being set to null explicitly on the repository item, or skip setting any value on the property. If this parameter is true, then null is set explicitly, else no property is set.
pMissingTagIsNull - if this property is set to true, then all tags that fail appear in a given instance document will have their corresponding properties set to null on the repository item. For example, if the firstName element had failed to appear in an instance document then if this property was true null would be set for the firstName property.
pIsPersistItem - if this is true, then any item created will also be persisted to the repository by calling the addItem() method.
pIsEmptyTagIsEmptyString - if this is true, then any empty tags will result in setting the empty string assigned to the corresponding property
Returns:
RepositoryItem the create repository item
Throws:
AddException - if an error occurs.

addItem

public RepositoryItem addItem(java.io.Reader pXMLInput,
                              boolean pIsValidate,
                              boolean pEmptyTagIsNull,
                              boolean pMissingTagIsNull,
                              boolean pIsPersistItem,
                              boolean pIsEmptyTagIsEmptyString)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Parameters:
pXMLInput - the instance document representing a repository item to add.
pIsValidate - should the incoming instance document be validated. Setting this to true will ensure safety of the instance documents but will slow down processing
pEmptyTagIsNull - should empty tags be treated as null. For example, if an element appeared in an instance document that looked like <firstName/> this could either result in the firstName property being set to null explicitly on the repository item, or skip setting any value on the property. If this parameter is true, then null is set explicitly, else no property is set.
pMissingTagIsNull - if this property is set to true, then all tags that fail appear in a given instance document will have their corresponding properties set to null on the repository item. For example, if the firstName element had failed to appear in an instance document then if this property was true null would be set for the firstName property.
pIsPersistItem - if this is true, then any item created will also be persisted to the repository by calling the addItem() method.
pIsEmptyTagIsEmptyString - if this is true, then any empty tags will result in setting the empty string assigned to the corresponding property
Returns:
RepositoryItem the create repository item
Throws:
AddException - if an error occurs.

addItem

public RepositoryItem addItem(java.io.Reader pXMLInput,
                              boolean pIsValidate,
                              boolean pEmptyTagIsNull,
                              boolean pMissingTagIsNull,
                              boolean pIsPersistItem,
                              boolean pIsEmptyTagIsEmptyString,
                              java.lang.String pTopLevelId)
                       throws AddException
This method adds an item to a particular repository. The instance document representing the repository item to be added is specified by the pXMLInput parameter.

Parameters:
pXMLInput - the instance document representing a repository item to add.
pIsValidate - should the incoming instance document be validated. Setting this to true will ensure safety of the instance documents but will slow down processing
pEmptyTagIsNull - should empty tags be treated as null. For example, if an element appeared in an instance document that looked like <firstName/> this could either result in the firstName property being set to null explicitly on the repository item, or skip setting any value on the property. If this parameter is true, then null is set explicitly, else no property is set.
pMissingTagIsNull - if this property is set to true, then all tags that fail appear in a given instance document will have their corresponding properties set to null on the repository item. For example, if the firstName element had failed to appear in an instance document then if this property was true null would be set for the firstName property.
pIsPersistItem - if this is true, then any item created will also be persisted to the repository by calling the addItem() method.
pIsEmptyTagIsEmptyString - if this is true, then any empty tags will result in setting the empty string assigned to the corresponding property
pTopLevelId - the string that, if not null, should be used as the id of the "top level" repository item
Returns:
RepositoryItem the create repository item
Throws:
AddException - if an error occurs.

setPropertiesOnContentHandler

public void setPropertiesOnContentHandler(atg.repository.xml.AddHandler pContentHandler,
                                          boolean pEmptyTagIsNull,
                                          boolean pMissingTagIsNull,
                                          boolean pIsPersistItem,
                                          boolean pEmptyTagIsEmptyString)
                                   throws java.io.IOException,
                                          MappingException,
                                          javax.xml.parsers.ParserConfigurationException,
                                          org.xml.sax.SAXException,
                                          RepositoryException
This method will set properties on the contentHandler that control how the contentHandler will process a given instance document. All parameters are set onto the pContentHandler parameter passed to this method. Additionally, the AddService property is set on the contentHandler, which is set to this AddService object.

Parameters:
pContentHandler - the contentHandler that will have its properties set
pEmptyTagIsNull - are empty tags treated as explicit null
pMissingTagIsNull - are missing tags from the instance document treated as explicit null
pIsPersistItem - should the created item be added to the repository
pEmptyTagIsEmptyString - are empty tags treated as empty String for String properties
Throws:
java.io.IOException
MappingException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
RepositoryException