org.ow2.jasmine.deployme.api
Class XmlLoader

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

public class XmlLoader
extends java.lang.Object

Load the xml topology

Author:
Remy Bresson

Constructor Summary
XmlLoader(java.lang.String xml)
          Constructor.
XmlLoader(java.net.URL topologyUrl)
          Constructor.
 
Method Summary
 Topology getTopology()
          Return the loaded topology
static
<T> T
loadSchemaAndFile(java.lang.String xsdPath, java.lang.String xmlns, java.lang.String schemaLocation, java.lang.String xmlRoot, java.lang.Class<T> rootClass, java.lang.String xml)
          Verifies an XML file against an XSD and instantiates it using a given class.
static
<T> T
loadSchemaAndFile(java.lang.String xsdPath, java.lang.String xmlns, java.lang.String schemaLocation, java.lang.String xmlRoot, java.lang.Class<T> rootClass, java.net.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(java.net.URL topologyUrl)
          throws org.xml.sax.SAXException,
                 javax.xml.bind.JAXBException,
                 java.io.IOException
Constructor. Loads the topology

Parameters:
topologyUrl - path to the xml topology file
Throws:
org.xml.sax.SAXException
javax.xml.bind.JAXBException
java.io.IOException

XmlLoader

public XmlLoader(java.lang.String xml)
          throws org.xml.sax.SAXException,
                 javax.xml.bind.JAXBException,
                 java.io.IOException
Constructor. Loads the topology

Parameters:
xml - XML to load.
Throws:
org.xml.sax.SAXException
javax.xml.bind.JAXBException
java.io.IOException
Method Detail

loadSchemaAndFile

public static <T> T loadSchemaAndFile(java.lang.String xsdPath,
                                      java.lang.String xmlns,
                                      java.lang.String schemaLocation,
                                      java.lang.String xmlRoot,
                                      java.lang.Class<T> rootClass,
                                      java.net.URL urlXML)
                           throws org.xml.sax.SAXException,
                                  javax.xml.bind.JAXBException,
                                  java.io.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:
org.xml.sax.SAXException - If creating the schema fails.
java.io.IOException - If fetching the XML fails.
javax.xml.bind.JAXBException - If parsing the XML fails.

loadSchemaAndFile

public static <T> T loadSchemaAndFile(java.lang.String xsdPath,
                                      java.lang.String xmlns,
                                      java.lang.String schemaLocation,
                                      java.lang.String xmlRoot,
                                      java.lang.Class<T> rootClass,
                                      java.lang.String xml)
                           throws org.xml.sax.SAXException,
                                  javax.xml.bind.JAXBException,
                                  java.io.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:
org.xml.sax.SAXException - If creating the schema fails.
java.io.IOException - If fetching the XML fails.
javax.xml.bind.JAXBException - If parsing the XML fails.

getTopology

public Topology getTopology()
Return the loaded topology

Returns:
the topology


Copyright © 2010 OW2 Consortium. All Rights Reserved.