com.virtualweaver.xotics.datamodel
Interface XoFactory


public interface XoFactory

XoFactory is responsible for loading an XoDMInstance object from an XML file, or creating it from scratch, provided the Registry has appropriate definitions and/or a specific XML processing instruction included in the parsed file gives the Data-Model definition file location. For loading or creating DM instance, init options can be specified. These options override those possibly specified in the root element's Data-Model definition. Valid options are :

Version:
4.1

Method Summary
 XoDMInstance createDMInstance(java.lang.String rootnsref, java.lang.String rootnsprefix, java.lang.String rootelement, java.util.Map options, java.lang.Object initObject)
          Creates a new DM instance with param rootelement as root element name, from namespace param rootnsref, with param rootnsprefix as optional prefix.
 XoDMInstance createDMInstance(XoRoot root, java.lang.String rootnsprefix, java.util.Map options, java.lang.Object initObject)
          Creates a new DM instance with param root as root element and param rootnsprefix as optional prefix.
 XoDMInstance loadDMInstance(java.io.InputStream is, java.util.Map options, java.lang.Object initObject)
          Loads a DM instance from an XML document read by param reader.
 XoDMInstance loadDMInstance(java.io.Reader r, java.util.Map options, java.lang.Object initObject)
          Loads a DM instance from an XML document read by param reader.
 XoDMInstance loadDMInstance(java.lang.String xmlDoc, java.util.Map options, java.lang.Object initObject)
          Loads a DM instance from a String argument (xmlDoc) containing an XML document.
 XoDMInstance loadDMInstance(java.net.URL url, java.util.Map options, java.lang.Object initObject)
          Loads a DM instance from an XML file pointed by param url.
 

Method Detail

loadDMInstance

public XoDMInstance loadDMInstance(java.net.URL url,
                                   java.util.Map options,
                                   java.lang.Object initObject)
                            throws XoException
Loads a DM instance from an XML file pointed by param url.

Parameters:
url - URL of XML file.
options - a map containing valid init options, this argument can be null
initObject - an object that can be passed to root element by method XoRoot.xoInitialize(Object)
Returns:
a new DM instance reflecting XML file
Throws:
XoException - if some error occurred during parsing.

loadDMInstance

public XoDMInstance loadDMInstance(java.io.InputStream is,
                                   java.util.Map options,
                                   java.lang.Object initObject)
                            throws XoException
Loads a DM instance from an XML document read by param reader.

Parameters:
is - an InputStream on XML document.
options - a map containing valid init options, this argument can be null
initObject - an object that can be passed to root element by method XoRoot.xoInitialize(Object)
Returns:
a new DM instance representing XML document
Throws:
XoException - if some error occurred during parsing.

loadDMInstance

public XoDMInstance loadDMInstance(java.io.Reader r,
                                   java.util.Map options,
                                   java.lang.Object initObject)
                            throws XoException
Loads a DM instance from an XML document read by param reader.

Parameters:
r - Reader on XML document.
options - a map containing valid init options, this argument can be null
initObject - an object that can be passed to root element by method XoRoot.xoInitialize(Object)
Returns:
a new DM instance representing XML document
Throws:
XoException - if some error occurred during parsing.

loadDMInstance

public XoDMInstance loadDMInstance(java.lang.String xmlDoc,
                                   java.util.Map options,
                                   java.lang.Object initObject)
                            throws XoException
Loads a DM instance from a String argument (xmlDoc) containing an XML document. This method is a facility method, as we could write also loadDMInstance(new StringReader(xmlDoc), options, initObject).

Parameters:
xmlDoc - a string containing an XML document.
options - a map containing valid init options, this argument can be null
initObject - an object that can be passed to root element by method XoRoot.xoInitialize(Object)
Returns:
a new DM instance representing XML document
Throws:
XoException - if some error occurred during parsing.

createDMInstance

public XoDMInstance createDMInstance(XoRoot root,
                                     java.lang.String rootnsprefix,
                                     java.util.Map options,
                                     java.lang.Object initObject)
                              throws XoException
Creates a new DM instance with param root as root element and param rootnsprefix as optional prefix.

Parameters:
root - the root element and its descendants if any
rootnsprefix - optional prefix for root's namespace (or empty string if no prefix)
options - a map containing valid init options, this argument can be null
initObject - an object that can be passed to root element by method XoRoot.xoInitialize(Object)
Returns:
a newly created DM instance
Throws:
XoException - if some error occurred during creation process

createDMInstance

public XoDMInstance createDMInstance(java.lang.String rootnsref,
                                     java.lang.String rootnsprefix,
                                     java.lang.String rootelement,
                                     java.util.Map options,
                                     java.lang.Object initObject)
                              throws XoException
Creates a new DM instance with param rootelement as root element name, from namespace param rootnsref, with param rootnsprefix as optional prefix.

Parameters:
rootnsref - namespace of root element
rootnsprefix - optional prefix for this namespace (or empty string if no prefix)
rootelement - root element name
options - a map containing valid init options, this argument can be null
initObject - an object that can be passed to root element by method XoRoot.xoInitialize(Object)
Returns:
a newly created DM instance
Throws:
XoException - if some error occurred during creation process