Class ObjectHandler
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
-
- de.uni_trier.wi2.procake.data.io.IOImpl
-
- de.uni_trier.wi2.procake.data.io.xml.xerces_saxImpl.XMLReadHandlerImpl
-
- de.uni_trier.wi2.procake.data.io.xml.xerces_saxImpl.ObjectHandler
-
- All Implemented Interfaces:
ObjectTags,ContentHandler,IO,ContentHandler
public class ObjectHandler extends XMLReadHandlerImpl implements ObjectTags
ObjectHandler class.
- Author:
- Rainer Maximini
-
-
Field Summary
Fields Modifier and Type Field Description static StringHANDLERNAMEConstantHANDLERNAME="DataObjectContentHandler"-
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.IO
COMPONENT, COMPONENT_KEY, DEFAULT_ENCODING, LOG_CONTENTHANDLER_NOT_FOUND, LOG_FILE_NOT_FOUND, LOG_IO_EXCEPTION, LOG_READER_NOT_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_PARAMETER, LOG_WRITER_NOT_FOUND, LOG_WRONG_PARAMATER_TYPE, RESOURCE_XML
-
Fields inherited from interface de.uni_trier.wi2.procake.data.io.xml.ObjectTags
ATT_CLASS, ATT_ID, ATT_NAME, ATT_VALUE, PREFIX_CDOL, SCHEMA_LOCATION_CDOL, TAG_AGGREGATE, TAG_ATOMIC, TAG_ATOMICATTRIBUTE, TAG_ATTRIBUTE, TAG_ATTRIBUTEPATH, TAG_BYTEARRAY, TAG_BYTEARRAYCONTENT, TAG_COLLECTION, TAG_INTERVAL, TAG_INTERVAL_LOWER_BOUND, TAG_INTERVAL_UPPER_BOUND, TAG_OBJECT_ATTRIBUTE, TAG_PROPERTY, TAG_QUERY, TAG_VOID, TAG_VOID_ATTRIBUTE, URI_CDOL
-
-
Constructor Summary
Constructors Constructor Description ObjectHandler()Constructor for ObjectHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddID(DataObject dataObject, Attributes attributes)addID.IOcopy()overwritten copy-method from Object; use it to copy a complete operatorDataObjectcreateNewObject(String className, String attributeName)Creates a new CAKEI-dataobject with the given classname OR based on the type of the given attribute.DataObjectcreateNewObject(Attributes attributes)Creates a new CAKEI-dataobject with the given SAX-parser Tag-attributesvoidendElement(String uri, String localName, String qName)protected voidendElementAtomicAttribute()endElementAtomicAttribute.protected voidendElementByteArrayContent()endElementByteArrayContent.protected voidendElementObjectAttribute()endElementObjectAttribute.protected voidendElementProperty()endElementProperty.protected voidendElementVoidAttribute()endElementVoidAttribute.booleanexistParentObject()existParentObject.protected voidfinishObject()finishObject.StringgetDescription()A description of the io component.StringgetName()Each io component must have a name that is used inIOFactory.newIO(String).ObjectgetObject()After parsing the document, this method must be called to get the Object.booleanisHandlerFor(Class value)Checks if the io component is capable to perform the operation for objects of this class.booleanisHandlerFor(String uri, String localName, String qName, Attributes attributes)Queries the handler for possible handling of the given (SAX-)parametersbooleanisIgnoreUnknownAttributes()isIgnoreUnknownAttributes.voidsetIgnoreUnknownAttributes(boolean ignoreAttributes)Setter for the fieldignoreUnknownAttributes.voidstartElement(String uri, String localName, String qName, Attributes attributes)protected voidstartElementAtomic(Attributes attributes)startElementAtomic.protected voidstartElementAtomicAttribute(Attributes attributes)startElementAtomicAttribute.protected voidstartElementAttribute(Attributes attributes)startElementAttribute.protected voidstartElementAttributePath(Attributes attributes)startElementAttributePath.protected voidstartElementByteArrayContent(Attributes attributes)startElementByteArrayContent.protected voidstartElementIntervalAttribute(Attributes attributes)startElementIntervalAttribute.protected voidstartElementObjectAttribute(Attributes attributes)startElementObjectAttribute.protected voidstartElementProperty(Attributes attributes)startElementProperty.protected voidstartElementVoidAttribute(Attributes attributes)startElementVoidAttribute.voidsubHandlerFinishedWithObject(Object subHandlerObject)Callback-method from the subHandler to inform the parentHandler about the finished object-
Methods inherited from class de.uni_trier.wi2.procake.data.io.xml.xerces_saxImpl.XMLReadHandlerImpl
callSubHandlerEnd, callSubHandlerStart, characters, endDocument, endPrefixMapping, getCharacterString, getDocumentLocator, ignorableWhitespace, initiateSubHandler, notifyParentHandler, processingInstruction, resetSubHandler, setCharacterString, setDocumentLocator, setParentHandler, skippedEntity, startDocument, startPrefixMapping
-
Methods inherited from class de.uni_trier.wi2.procake.data.io.IOImpl
getFamily, getParameters, postInit, preInit, setFamily
-
Methods inherited from class de.uni_trier.wi2.procake.utils.composition.FactoryObjectImplementation
getParameter, initParametersBasedOn
-
-
-
-
Field Detail
-
HANDLERNAME
public static final String HANDLERNAME
ConstantHANDLERNAME="DataObjectContentHandler"- See Also:
- Constant Field Values
-
-
Method Detail
-
getDescription
public String getDescription()
A description of the io component. The description should contain the file format and the classes that can be managed.- Specified by:
getDescriptionin interfaceIO- Overrides:
getDescriptionin classIOImpl- Returns:
- a description of the io component
-
getName
public String getName()
Each io component must have a name that is used inIOFactory.newIO(String). The name must be unique thus it is usefull to use a short description or to the class name (this.getClass().getName()).
-
getObject
public Object getObject()
After parsing the document, this method must be called to get the Object. This method can only be called once, because after calling the internal variables are resetted to reuse the object.- Specified by:
getObjectin interfaceContentHandler
-
isHandlerFor
public boolean isHandlerFor(String uri, String localName, String qName, Attributes attributes)
Queries the handler for possible handling of the given (SAX-)parameters- Specified by:
isHandlerForin interfaceContentHandler- Returns:
-
isHandlerFor
public boolean isHandlerFor(Class value)
Checks if the io component is capable to perform the operation for objects of this class.A typical implementation looks like:
public boolean isHandlerFor(Class value) { if (DataObject.class.isAssignableFrom(value)) return true; return false; }- Specified by:
isHandlerForin interfaceIO- Parameters:
value- The class that has to be checked.- Returns:
- Results
trueif the class can oeprate with the given class.
-
copy
public IO copy()
overwritten copy-method from Object; use it to copy a complete operator
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Throws:
SAXException
-
createNewObject
public DataObject createNewObject(String className, String attributeName) throws ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
Creates a new CAKEI-dataobject with the given classname OR based on the type of the given attribute. One of the parameters is only used.- Parameters:
className- Name of the CAKEI-class, which should be instantiated; can be nullattributeName- Name of the attribute of the parent-Aggregrate-class, from which the type should be used to instantiate a new object; can be null- Returns:
- instantiated CAKE1-object.
- Throws:
ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
createNewObject
public DataObject createNewObject(Attributes attributes) throws ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
Creates a new CAKEI-dataobject with the given SAX-parser Tag-attributes- Parameters:
attributes- The attributes either contain "c=" with defining the CAKE1class, which should be instantiated OR contains the "n=", which defines the name of the attribute from the parent-aggregate, to instantiate a CAKE1-Object by the attributes' type- Returns:
- a
DataObjectobject - Throws:
ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
endElementAtomicAttribute
protected void endElementAtomicAttribute() throws InvalidNativeValueException, InvalidTypeExceptionendElementAtomicAttribute.
- Throws:
InvalidNativeValueException- if any.InvalidTypeException- if any.
-
endElementVoidAttribute
protected void endElementVoidAttribute()
endElementVoidAttribute.
-
endElementByteArrayContent
protected void endElementByteArrayContent() throws InvalidNativeValueException, InvalidTypeException, SAXExceptionendElementByteArrayContent.
- Throws:
InvalidNativeValueException- if any.InvalidTypeException- if any.SAXException- if any.
-
endElementObjectAttribute
protected void endElementObjectAttribute()
endElementObjectAttribute.
-
endElementProperty
protected void endElementProperty() throws SAXException, NoSuchAttributeExceptionendElementProperty.
- Throws:
SAXException- if any.NoSuchAttributeException- if any.
-
existParentObject
public boolean existParentObject()
existParentObject.
- Returns:
- a boolean
-
finishObject
protected void finishObject() throws InvalidTypeException, SAXExceptionfinishObject.
- Throws:
InvalidTypeException- if any.SAXException- if any.
-
isIgnoreUnknownAttributes
public boolean isIgnoreUnknownAttributes()
isIgnoreUnknownAttributes.
- Returns:
- a boolean
-
setIgnoreUnknownAttributes
public void setIgnoreUnknownAttributes(boolean ignoreAttributes)
Setter for the field
ignoreUnknownAttributes.- Parameters:
ignoreAttributes- a boolean
-
startElementAtomic
protected void startElementAtomic(Attributes attributes) throws InvalidNativeValueException, ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
startElementAtomic.
- Parameters:
attributes- aAttributesobject- Throws:
InvalidNativeValueException- if any.ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
startElementAtomicAttribute
protected void startElementAtomicAttribute(Attributes attributes) throws InvalidNativeValueException, ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
startElementAtomicAttribute.
- Parameters:
attributes- aAttributesobject- Throws:
InvalidNativeValueException- if any.ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
startElementIntervalAttribute
protected void startElementIntervalAttribute(Attributes attributes)
startElementIntervalAttribute.
- Parameters:
attributes- aAttributesobject
-
startElementVoidAttribute
protected void startElementVoidAttribute(Attributes attributes) throws ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
startElementVoidAttribute.
- Parameters:
attributes- aAttributesobject- Throws:
ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
startElementAttribute
protected void startElementAttribute(Attributes attributes)
startElementAttribute.
- Parameters:
attributes- aAttributesobject
-
startElementAttributePath
protected void startElementAttributePath(Attributes attributes)
startElementAttributePath.
- Parameters:
attributes- aAttributesobject
-
startElementByteArrayContent
protected void startElementByteArrayContent(Attributes attributes) throws InvalidNativeValueException, ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
startElementByteArrayContent.
- Parameters:
attributes- aAttributesobject- Throws:
InvalidNativeValueException- if any.ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
startElementObjectAttribute
protected void startElementObjectAttribute(Attributes attributes) throws ClassNotFoundException, IllegalInstantiationException, InvalidTypeException, NoSuchAttributeException
startElementObjectAttribute.
- Parameters:
attributes- aAttributesobject- Throws:
ClassNotFoundException- if any.IllegalInstantiationException- if any.InvalidTypeException- if any.NoSuchAttributeException- if any.
-
startElementProperty
protected void startElementProperty(Attributes attributes)
startElementProperty.
- Parameters:
attributes- aAttributesobject
-
addID
protected void addID(DataObject dataObject, Attributes attributes)
addID.
- Parameters:
dataObject- aDataObjectobjectattributes- aAttributesobject
-
subHandlerFinishedWithObject
public void subHandlerFinishedWithObject(Object subHandlerObject)
Callback-method from the subHandler to inform the parentHandler about the finished object- Specified by:
subHandlerFinishedWithObjectin interfaceContentHandler- Specified by:
subHandlerFinishedWithObjectin classXMLReadHandlerImpl- Parameters:
subHandlerObject- The object created by the subHandler.
-
-