ozone core API

org.ozoneDB.core.xml
Class Object2XML

java.lang.Object
  |
  +--org.ozoneDB.core.xml.Object2XML
All Implemented Interfaces:
Consts

public class Object2XML
extends java.lang.Object
implements Consts

This class transform an Object into XML.

Version:
$Revision: 1.1 $
Author:
SMB

Field Summary
private  org.xml.sax.ContentHandler ch
          ...
private  ObjAttsFactory oaf
          Factory for the attributes of the first obj-Tag.
private  java.util.Hashtable objCache
          ObjCache saves the references of the processed objects.
private  boolean serializeTransientFlag
          This flag decides if transient member will be serialized or not.
 
Fields inherited from interface org.ozoneDB.core.xml.Consts
ATTR_ID, ATTR_NAME, ATTR_PROXY_TYPE, ATTR_REF, ATTR_TYPE, ATTR_XLINK_HREF_LOCAL, ATTR_XLINK_HREF_RAW, ATTR_XLINK_NAMESPACE, ATTR_XLINK_TYPE_LOCAL, ATTR_XLINK_TYPE_RAW, ATTR_XLINK_TYPE_VALUE, REMOTE_ID, TAG_MEMBER, TAG_OBJ, TAG_SUPERCLASS, TAG_VALUE, TAG_VALUEARRAY, TAG_VALUEOBJ
 
Constructor Summary
Object2XML(org.xml.sax.ContentHandler contHandler)
           
Object2XML(org.xml.sax.ContentHandler contHandler, boolean serializeTransientFlag)
           
 
Method Summary
protected  java.lang.Integer getID(java.lang.Object obj)
          GetId gets the reference/address of the Object.
protected  void getMember(java.lang.Object obj, java.lang.Class objClass)
          GetMember gets the informations (name/type/value) of all members (private and protected too) !!
protected  void getValue(java.lang.Object value, java.lang.Class valueType)
          GetValue gets the value of the certain member.
protected  void handleOzoneProxyMember(java.lang.String memberName, org.ozoneDB.OzoneProxy proxy)
          This methode handles an OzoneProxy member.
private  void superClass(java.lang.Object obj, java.lang.Class objClass)
          SuperClass gets the informations about the Superclass of the Object.
 void toXML(java.lang.Object obj)
          ToXML(obj) gets an object and serialize this object into XML.
protected  void writeArrayEndTag()
           
protected  void writeArrayStartTag(java.lang.String type, java.lang.Integer id)
           
protected  void writeMemberEndTag()
           
protected  void writeMemberStartTag(java.lang.String name)
           
protected  void writeMemberTagForOzoneProxy(java.lang.String name, java.lang.String proxyType, java.lang.String objectID)
           
protected  void writeObjEndTag()
           
protected  void writeObjRefElement(java.lang.Integer sourceId)
           
protected  void writeObjStartTag(java.lang.String classname, java.lang.Integer id, org.xml.sax.Attributes additionallyAtts)
           
protected  void writeSuperClEndTag()
           
protected  void writeSuperClStartTag(java.lang.String classname)
           
protected  void writeValue(java.lang.String value)
           
protected  void writeValueEndTag()
           
protected  void writeValueObjEndTag()
           
protected  void writeValueObjStartTag(java.lang.String type, java.lang.Integer id)
           
protected  void writeValueStartTag(java.lang.String type, java.lang.Integer id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objCache

private java.util.Hashtable objCache
ObjCache saves the references of the processed objects.


serializeTransientFlag

private boolean serializeTransientFlag
This flag decides if transient member will be serialized or not.


ch

private org.xml.sax.ContentHandler ch
... for making SAX.


oaf

private ObjAttsFactory oaf
Factory for the attributes of the first obj-Tag.

Constructor Detail

Object2XML

public Object2XML(org.xml.sax.ContentHandler contHandler)

Object2XML

public Object2XML(org.xml.sax.ContentHandler contHandler,
                  boolean serializeTransientFlag)
Parameters:
serializeTransientFlag -
Method Detail

toXML

public void toXML(java.lang.Object obj)
           throws org.xml.sax.SAXException
ToXML(obj) gets an object and serialize this object into XML.

Parameters:
obj - (the Object)
org.xml.sax.SAXException

getMember

protected void getMember(java.lang.Object obj,
                         java.lang.Class objClass)
                  throws org.xml.sax.SAXException
GetMember gets the informations (name/type/value) of all members (private and protected too) !!

Parameters:
obj - (the Object)
objClass - (the Class of the Object)
org.xml.sax.SAXException

superClass

private void superClass(java.lang.Object obj,
                        java.lang.Class objClass)
                 throws org.xml.sax.SAXException
SuperClass gets the informations about the Superclass of the Object.

Parameters:
obj - (the Object)
objClass - (the Class of the Object)
org.xml.sax.SAXException

getValue

protected void getValue(java.lang.Object value,
                        java.lang.Class valueType)
                 throws org.xml.sax.SAXException
GetValue gets the value of the certain member.

Parameters:
value - (value of the member)
valueType - (the Class of the certain member)
org.xml.sax.SAXException

handleOzoneProxyMember

protected void handleOzoneProxyMember(java.lang.String memberName,
                                      org.ozoneDB.OzoneProxy proxy)
                               throws org.xml.sax.SAXException
This methode handles an OzoneProxy member.

Parameters:
memberName - (name of the member)
proxy - (the OzoneProxy object)
org.xml.sax.SAXException

getID

protected java.lang.Integer getID(java.lang.Object obj)
GetId gets the reference/address of the Object.

Parameters:
obj - (the Object)
Returns:
id

writeObjStartTag

protected void writeObjStartTag(java.lang.String classname,
                                java.lang.Integer id,
                                org.xml.sax.Attributes additionallyAtts)
                         throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeObjEndTag

protected void writeObjEndTag()
                       throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeSuperClStartTag

protected void writeSuperClStartTag(java.lang.String classname)
                             throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeSuperClEndTag

protected void writeSuperClEndTag()
                           throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeMemberStartTag

protected void writeMemberStartTag(java.lang.String name)
                            throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeMemberEndTag

protected void writeMemberEndTag()
                          throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeMemberTagForOzoneProxy

protected void writeMemberTagForOzoneProxy(java.lang.String name,
                                           java.lang.String proxyType,
                                           java.lang.String objectID)
                                    throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeValue

protected void writeValue(java.lang.String value)
                   throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeValueStartTag

protected void writeValueStartTag(java.lang.String type,
                                  java.lang.Integer id)
                           throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeValueEndTag

protected void writeValueEndTag()
                         throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeValueObjStartTag

protected void writeValueObjStartTag(java.lang.String type,
                                     java.lang.Integer id)
                              throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeValueObjEndTag

protected void writeValueObjEndTag()
                            throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeArrayStartTag

protected void writeArrayStartTag(java.lang.String type,
                                  java.lang.Integer id)
                           throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeArrayEndTag

protected void writeArrayEndTag()
                         throws org.xml.sax.SAXException
org.xml.sax.SAXException

writeObjRefElement

protected void writeObjRefElement(java.lang.Integer sourceId)
                           throws org.xml.sax.SAXException
org.xml.sax.SAXException

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.