FreeHEP API
Version v1.1

org.freehep.xml.io
Class XMLIOManager

java.lang.Object
  |
  +--org.freehep.xml.io.XMLIOManager

public class XMLIOManager
extends Object

The XMLIOManager is in charge of saving and restoring any object configuration through XML. It internally assigns objects and unique identification string used for cross-reference among xml nodes.

Version:
1.0
Author:
turri

Constructor Summary
XMLIOManager()
           
XMLIOManager(boolean useId)
          The basic constructor.
XMLIOManager(XMLIORegistry xmlioRegistry, XMLIOStreamManager xmlioFileManager)
           
XMLIOManager(XMLIORegistry xmlioRegistry, XMLIOStreamManager xmlioFileManager, boolean useId)
           
 
Method Summary
protected  XMLIOFactory getXMLIOFactory(Class objClass)
          Get the XMLIOFactory to restore the xml node
protected  XMLIOProxy getXMLIOProxy(Class objClass)
           
 XMLIORegistry getXMLIORegistry()
          Get the XMLIORegistry.
 XMLIOStreamManager getXMLIOStreamManager()
           
 void resetObjId()
          Reset the stored ids
 Object restore(org.jdom.Element nodeEl)
          Restore an object from an xml node.
 Object[] restoreFromXML()
          The main method to restore from xml.
 org.jdom.Element save(Object obj)
           
 org.jdom.Element saveAs(Object obj, Class clazz)
          Save an object to an XML node.
 void saveToXML(Object[] objs, org.jdom.Element nodeEl)
          The main method to save an array of objects to XML.
 void setClassId(Class clName, String id)
          Assign to a Class a string identifier.
protected  void setXMLIORegistry(XMLIORegistry xmlioRegistry)
           
 void setXMLIOStreamManager(XMLIOStreamManager xmlioStreamManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLIOManager

public XMLIOManager(boolean useId)
The basic constructor.


XMLIOManager

public XMLIOManager()

XMLIOManager

public XMLIOManager(XMLIORegistry xmlioRegistry,
                    XMLIOStreamManager xmlioFileManager)

XMLIOManager

public XMLIOManager(XMLIORegistry xmlioRegistry,
                    XMLIOStreamManager xmlioFileManager,
                    boolean useId)
Method Detail

setXMLIORegistry

protected void setXMLIORegistry(XMLIORegistry xmlioRegistry)

getXMLIORegistry

public XMLIORegistry getXMLIORegistry()
Get the XMLIORegistry.

Returns:
the XMLIORegistry

setXMLIOStreamManager

public void setXMLIOStreamManager(XMLIOStreamManager xmlioStreamManager)

getXMLIOStreamManager

public XMLIOStreamManager getXMLIOStreamManager()

restore

public Object restore(org.jdom.Element nodeEl)
Restore an object from an xml node.

Parameters:
nodeEl - The node containing the object's information. This method should be used by the user to restore nested objects within the restore method of an object implementing the XMLIO interface.
Returns:
The restored object. The object is first created by invoking the create method on the corresponding XMLIOFactory. Once created the restore method is invoked either on the object itself (if it implements the XMLIO interface) or on the appropriate XMLIOProxy.

saveAs

public org.jdom.Element saveAs(Object obj,
                               Class clazz)
Save an object to an XML node.

Parameters:
obj - The object to be saved.
Returns:
The jdom Element containing the object's unique identification string (in the attribute "objId") and whose name is the object's identifier. The user will have to append to this node all the attributes and other jdom elemets required to save the object's configuration.

save

public org.jdom.Element save(Object obj)

saveToXML

public void saveToXML(Object[] objs,
                      org.jdom.Element nodeEl)
The main method to save an array of objects to XML.

Parameters:
objs - The array of objects to be saved.

restoreFromXML

public Object[] restoreFromXML()
The main method to restore from xml.

Returns:
The array of the restored objects.

setClassId

public void setClassId(Class clName,
                       String id)
Assign to a Class a string identifier.

Parameters:
clName - The Class.
id - The new identifier for the class.

resetObjId

public void resetObjId()
Reset the stored ids


getXMLIOFactory

protected XMLIOFactory getXMLIOFactory(Class objClass)
Get the XMLIOFactory to restore the xml node

Returns:
the XMLIOFactory

getXMLIOProxy

protected XMLIOProxy getXMLIOProxy(Class objClass)

FreeHEP API
Version v1.1

Copyright © 2000-2002 FreeHEP, All Rights Reserved.