org.ow2.jasmine.deployme.api
Class XmlLoader

java.lang.Object
  extended by org.ow2.jasmine.deployme.api.XmlLoader

public class XmlLoader
extends Object

Load the xml topology

Author:
Remy Bresson

Constructor Summary
XmlLoader(String xml, DeploymeVersion deploymeVersion)
          Constructor.
XmlLoader(URL topologyUrl, DeploymeVersion deploymeVersion)
          Constructor.
 
Method Summary
 Object getTopology()
          Return the loaded topology
<T> T
loadSchemaAndFile(String xsdPath, String xmlns, String schemaLocation, String xmlRoot, Class<T> rootClass, String xml)
          Verifies an XML file against an XSD and instantiates it using a given class.
<T> T
loadSchemaAndFile(String xsdPath, String xmlns, String schemaLocation, String xmlRoot, Class<T> rootClass, URL urlXML)
          Verifies an XML file against an XSD and instantiates it using a given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlLoader

public XmlLoader(URL topologyUrl,
                 DeploymeVersion deploymeVersion)
          throws SAXException,
                 javax.xml.bind.JAXBException,
                 IOException
Constructor. Loads the topology

Parameters:
topologyUrl - path to the xml topology file
deploymeVersion - DeploymeVersion
Throws:
SAXException
javax.xml.bind.JAXBException
IOException

XmlLoader

public XmlLoader(String xml,
                 DeploymeVersion deploymeVersion)
          throws SAXException,
                 javax.xml.bind.JAXBException,
                 IOException
Constructor. Loads the topology

Parameters:
xml - XML to load.
deploymeVersion - DeploymeVersion
Throws:
SAXException
javax.xml.bind.JAXBException
IOException
Method Detail

loadSchemaAndFile

public <T> T loadSchemaAndFile(String xsdPath,
                               String xmlns,
                               String schemaLocation,
                               String xmlRoot,
                               Class<T> rootClass,
                               URL urlXML)
                    throws SAXException,
                           javax.xml.bind.JAXBException,
                           IOException
Verifies an XML file against an XSD and instantiates it using a given class.

Parameters:
xsdPath - XSD file path.
xmlns - XML namespace, will be added if non found in the XML
schemaLocation - XML schema location, will be added if non found in the XML
xmlRoot - Root element of the XML (for completing the XML if XSD xmlns is missing)
rootClass - Root class used for instantiating JAXB.
urlXML - XML to load.
Returns:
XML loaded using JAXB and the rootClass.
Throws:
SAXException - If creating the schema fails.
IOException - If fetching the XML fails.
javax.xml.bind.JAXBException - If parsing the XML fails.

loadSchemaAndFile

public <T> T loadSchemaAndFile(String xsdPath,
                               String xmlns,
                               String schemaLocation,
                               String xmlRoot,
                               Class<T> rootClass,
                               String xml)
                    throws SAXException,
                           javax.xml.bind.JAXBException,
                           IOException
Verifies an XML file against an XSD and instantiates it using a given class.

Parameters:
xsdPath - XSD file path.
xmlns - XML namespace, will be added if non found in the XML
schemaLocation - XML schema location, will be added if non found in the XML
xmlRoot - Root element of the XML (for completing the XML if XSD xmlns is missing)
rootClass - Root class used for instantiating JAXB.
xml - XML to load.
Returns:
XML loaded using JAXB and the rootClass.
Throws:
SAXException - If creating the schema fails.
IOException - If fetching the XML fails.
javax.xml.bind.JAXBException - If parsing the XML fails.

getTopology

public Object getTopology()
Return the loaded topology

Returns:
the topology


Copyright © 2012 OW2 Consortium. All Rights Reserved.