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.AbstractXMLHandler
de.uni_trier.wi2.procake.data.io.xml.xerces_saxImpl.ObjectHandler
- All Implemented Interfaces:
ObjectTags
,IO
,ContentHandler
ObjectHandler class.
- Author:
- Rainer Maximini
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
ConstantHANDLERNAME="DataObjectContentHandler"
Fields inherited from interface de.uni_trier.wi2.procake.utils.io.IO
DEFAULT_ENCODING, LOG_FILE_NOT_FOUND, LOG_IO_EXCEPTION, LOG_READER_NOT_FOUND, LOG_SAX_EXCEPTION, LOG_UNKNOWN_PARAMETER, 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_ATOMIC_ATTRIBUTE, TAG_ATTRIBUTE, TAG_ATTRIBUTEPATH, TAG_BYTE_ARRAY, TAG_BYTE_ARRAY_CONTENT, 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addID
(DataObject dataObject, Attributes attributes) addID.copy()
overwritten copy-method from Object; use it to copy a complete operatorcreateNewObject
(String className, String attributeName) Creates a new CAKEI-dataobject with the given classname OR based on the type of the given attribute.createNewObject
(Attributes attributes) Creates a new CAKEI-dataobject with the given SAX-parser Tag-attributesvoid
endElement
(String uri, String localName, String qName) protected void
endElementByteArrayContent.protected void
endElementProperty.protected void
finishObject.getName()
Each io component must have a name that is used inIOFactory.newIO(String)
.After parsing the document, this method must be called to get the Object.boolean
isHandlerFor
(Class value) Checks if the io component is capable to perform the operation for objects of this class.boolean
isHandlerFor
(String uri, String localName, String qName, Attributes attributes) Queries the handler for possible handling of the given (SAX-)parametersvoid
startElement
(String uri, String localName, String qName, Attributes attributes) protected AtomicObject
startElementAtomic
(Attributes attributes) startElementAtomic.protected void
startElementAtomicAttribute
(Attributes attributes) startElementAtomicAttribute.protected void
startElementObjectAttribute
(Attributes attributes) startElementObjectAttribute.protected void
startElementProperty
(Attributes attributes) startElementProperty.protected void
startElementVoidAttribute
(Attributes attributes) startElementVoidAttribute.void
subHandlerFinishedWithObject
(Object subHandlerObject) Methods inherited from class de.uni_trier.wi2.procake.data.io.xml.xerces_saxImpl.AbstractXMLHandler
callSubHandlerEnd, callSubHandlerStart, characters, endDocument, endPrefixMapping, getCharacterString, getDocumentLocator, ignorableWhitespace, initiateSubHandler, notifyParentHandler, processingInstruction, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
HANDLER_NAME
ConstantHANDLERNAME="DataObjectContentHandler"
- See Also:
-
-
Constructor Details
-
ObjectHandler
public ObjectHandler()Constructor for ObjectHandler.
-
-
Method Details
-
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
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:
getObject
in classAbstractXMLHandler
-
isHandlerFor
Queries the handler for possible handling of the given (SAX-)parameters- Specified by:
isHandlerFor
in classAbstractXMLHandler
- Returns:
-
isHandlerFor
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:
isHandlerFor
in interfaceIO
- Parameters:
value
- The class that has to be checked.- Returns:
- Results
true
if the class can oeprate with the given class.
-
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:
startElement
in interfaceContentHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Throws:
SAXException
-
createNewObject
public DataObject createNewObject(String className, String attributeName) throws IllegalInstantiationException, ProCAKEInvalidTypeException, ProCAKENoSuchAttributeException, ProCAKEClassNotFoundException 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:
ProCAKEClassNotFoundException
- if any.IllegalInstantiationException
- if any.ProCAKEInvalidTypeException
- if any.ProCAKENoSuchAttributeException
- if any.
-
createNewObject
public DataObject createNewObject(Attributes attributes) throws IllegalInstantiationException, ProCAKEInvalidTypeException, ProCAKENoSuchAttributeException, ProCAKEClassNotFoundException 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
DataObject
object - Throws:
ProCAKEClassNotFoundException
- if any.IllegalInstantiationException
- if any.ProCAKEInvalidTypeException
- if any.ProCAKENoSuchAttributeException
- if any.
-
endElementByteArrayContent
protected void endElementByteArrayContent() throws InvalidNativeValueException, ProCAKEInvalidTypeExceptionendElementByteArrayContent.
- Throws:
InvalidNativeValueException
- if any.ProCAKEInvalidTypeException
- if any.
-
endElementProperty
endElementProperty.
- Throws:
ProCAKENoSuchAttributeException
- if any.
-
finishObject
finishObject.
- Throws:
ProCAKEInvalidTypeException
- if any.
-
startElementAtomic
protected AtomicObject startElementAtomic(Attributes attributes) throws InvalidNativeValueException, IllegalInstantiationException, ProCAKEInvalidTypeException, ProCAKENoSuchAttributeException, ProCAKEClassNotFoundException startElementAtomic.
- Parameters:
attributes
- aAttributes
object- Throws:
InvalidNativeValueException
- if any.ProCAKEClassNotFoundException
- if any.IllegalInstantiationException
- if any.ProCAKEInvalidTypeException
- if any.ProCAKENoSuchAttributeException
- if any.
-
startElementAtomicAttribute
protected void startElementAtomicAttribute(Attributes attributes) throws InvalidNativeValueException, IllegalInstantiationException, ProCAKEInvalidTypeException, ProCAKENoSuchAttributeException, ProCAKEClassNotFoundException startElementAtomicAttribute.
- Parameters:
attributes
- aAttributes
object- Throws:
InvalidNativeValueException
- if any.ProCAKEClassNotFoundException
- if any.IllegalInstantiationException
- if any.ProCAKEInvalidTypeException
- if any.ProCAKENoSuchAttributeException
- if any.
-
startElementVoidAttribute
protected void startElementVoidAttribute(Attributes attributes) throws IllegalInstantiationException, ProCAKEInvalidTypeException, ProCAKENoSuchAttributeException, ProCAKEClassNotFoundException startElementVoidAttribute.
- Parameters:
attributes
- aAttributes
object- Throws:
ProCAKEClassNotFoundException
- if any.IllegalInstantiationException
- if any.ProCAKEInvalidTypeException
- if any.ProCAKENoSuchAttributeException
- if any.
-
startElementObjectAttribute
protected void startElementObjectAttribute(Attributes attributes) throws ProCAKEClassNotFoundException, IllegalInstantiationException, ProCAKEInvalidTypeException, ProCAKENoSuchAttributeException startElementObjectAttribute.
- Parameters:
attributes
- aAttributes
object- Throws:
ProCAKEClassNotFoundException
- if any.IllegalInstantiationException
- if any.ProCAKEInvalidTypeException
- if any.ProCAKENoSuchAttributeException
- if any.
-
startElementProperty
startElementProperty.
- Parameters:
attributes
- aAttributes
object
-
addID
addID.
- Parameters:
dataObject
- aDataObject
objectattributes
- aAttributes
object
-
subHandlerFinishedWithObject
- Specified by:
subHandlerFinishedWithObject
in classAbstractXMLHandler
-