|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.taverna.t2.util.beanable.jaxb.BeanSerialiser
public class BeanSerialiser
Serialise or deserialise a bean (normally produced by a Beanable) as
XML. Code based on
net.sf.taverna.t2.workflowmodel.impl.Tools#beanAsElement(Object).
Currently beans are serialised to XML using JAXB.
| Nested Class Summary | |
|---|---|
class |
BeanSerialiser.RefreshBindingsObserver
|
| Method Summary | ||
|---|---|---|
|
beanableFromXMLElement(org.jdom.Element elem)
Given an XML representation of a beanable entity (see beanableToXMLElement(Beanable)), use the
BeanableFactory to return the beanable |
|
|
beanableFromXMLFile(java.io.File xmlFile)
Given a File containing the XML representation of a
Beanable entity, return the Beanable |
|
|
beanableFromXMLStream(java.io.InputStream inputStream)
Given an InputStream containing an XML representation of a Beanable, return this Beanable |
|
org.jdom.Element |
beanableToXMLElement(Beanable<?> beanable)
Given a beanable entity return as XML with the class name as an element |
|
void |
beanableToXMLFile(Beanable<?> beanable,
java.io.File xmlFile)
Given a Beanable entity store it in a file in XML format |
|
void |
beanableToXMLStream(Beanable<?> beanable,
java.io.OutputStream outputStream)
Given a Beanable entity store it in a stream in XML format |
|
java.lang.Object |
beanFromXMLFile(java.io.File xmlFile)
Deserialise the bean from an XML file |
|
static BeanSerialiser |
getInstance()
Get BeanSerialiser singleton. |
|
void |
refreshBindings()
Refresh the bindings from the BeanableFactoryRegistry, typically
called after a plugin has modified the SPIRegistry. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static BeanSerialiser getInstance()
BeanSerialiser singleton.
Note that to avoid issues at initialisation time of the
SPIRegistry it is not recommended to assign this instance as a
static field in a class. The recommended usage is to assign the instance
to a private field:
public class MyClass {
private BeanSerialiser beanSerialiser = BeanSerialiser.getInstance();
..
}
javax.xml.bind.JAXBException
public void refreshBindings()
throws javax.xml.bind.JAXBException
BeanableFactoryRegistry, typically
called after a plugin has modified the SPIRegistry.
javax.xml.bind.JAXBExceptionpublic <Bean> Beanable<?> beanableFromXMLElement(org.jdom.Element elem)
beanableToXMLElement(Beanable)), use the
BeanableFactory to return the beanable
Bean - elem -
public <Bean> Beanable<?> beanableFromXMLFile(java.io.File xmlFile)
throws RetrievalException,
java.io.FileNotFoundException
File containing the XML representation of a
Beanable entity, return the Beanable
Bean - the bean type used to create the BeanablexmlFile - XML representation of the beanable entity
Beanable recreated from the XML
RetrievalException
java.io.FileNotFoundException
public <Bean> Beanable<?> beanableFromXMLStream(java.io.InputStream inputStream)
throws RetrievalException
Beanable, return this Beanable
Bean - the bean type used to create the BeanableinputStream -
Beanable recreated from the stream
RetrievalException
public org.jdom.Element beanableToXMLElement(Beanable<?> beanable)
throws StorageException
beanable -
StorageException
public void beanableToXMLFile(Beanable<?> beanable,
java.io.File xmlFile)
throws StorageException,
java.io.IOException
Beanable entity store it in a file in XML format
beanable - the Beanable entityxmlFile - a file to serialise the Beanable out to
StorageException
java.io.IOException
public void beanableToXMLStream(Beanable<?> beanable,
java.io.OutputStream outputStream)
throws StorageException
Beanable entity store it in a stream in XML format
beanable - the Beanable entityoutputStream - a stream to serialise the Beanable out to
StorageException
public java.lang.Object beanFromXMLFile(java.io.File xmlFile)
throws RetrievalException,
java.io.FileNotFoundException
xmlFile - file containing XML serialisation of bean
RetrievalException
java.io.FileNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||