com.virtualweaver.xotics.datamodel
Interface XoRegistry


public interface XoRegistry

This is the registry holding all XML dialect implementations (Data-Model modules) loaded for an XO environment. It initializes core DM modules and provides many methods to access data useful in creating and handling DM instances.

Version:
4.1

Method Summary
 XoObject createXoObject(java.lang.String nsref, java.lang.String element)
          Creates a new instance of XO object giving its namespace nsref for param element.
 XoCustomizerInfos[] getCustomizers(XoObject xo)
          return specific customizers usable to edit XO object xo.
 XoDMInstance getDataModelDocument(java.lang.String nsref)
          Returns the DMDL document describing Data-Model for namespace nsref
 XoDMInstance[] getDataModelDocuments()
          Returns the DMDL document list of all loaded DM modules
 java.net.URL getDMLocation(java.lang.String nsref)
          Gets the location URL of either a DMDL document describing a DM module or a jar containing the module loaded for namespace nsref
 XdtBidiMap getEntityCatalog(java.lang.String nsref)
          Returns the entities defined in namespace nsref
 XoEnvironment getEnvironment()
          Returns the XO environment owner of this registry.
 java.lang.String getIdName(XoObject xo)
          Returns the ID property name of param xo.
 XoProperty[] getProperties(XoObject xo)
          Returns the list of property wrappers defined for param xo.
 XoProperty getProperty(XoObject xo, java.lang.String pName)
          Returns the wrapper of property named pName for param xo.
 XoProperty getPropertyByXml(XoObject xo, java.lang.String xmlName)
          Returns the wrapper of property whose XML attribute equivalent is named xmlName for param xo.
 int getPropertyCount(XoObject xo)
          Returns the number of properties defined for param xo.
 java.lang.String getType(XoObject xo)
          returns the element type of param xo.
 boolean hasDataModel(java.lang.String nsref)
          Checks whether a data-model module is loaded for namespace nsref.
 java.lang.String loadDataModel(java.net.URL jarUrl)
          Loads the dialect implementation (DM module) in jar format located in URL param jarUrl.
 java.lang.String loadDataModel(XoDMInstance dm)
          Loads the DM module described in param dm in DMDL format.
 void unloadDataModel(java.lang.String nsref)
          Unloads DM module identified by nsref.
 

Method Detail

getEnvironment

public XoEnvironment getEnvironment()
Returns the XO environment owner of this registry. This is a utility method to get environment from this registry object.

Returns:
the current Xotics Environment object

hasDataModel

public boolean hasDataModel(java.lang.String nsref)
Checks whether a data-model module is loaded for namespace nsref.

Returns:
true if a DM definition is associated with nsref

getEntityCatalog

public XdtBidiMap getEntityCatalog(java.lang.String nsref)
                            throws XoException
Returns the entities defined in namespace nsref

Returns:
a bidi-map containing entity references
Throws:
XoException - if no module was loaded for namespace nsref

getType

public java.lang.String getType(XoObject xo)
                         throws XoException
returns the element type of param xo. This string permits to distinguish an implementation from several ones of a single element

Returns:
the effective type string used to identify a particular implementation, or null if doesn't exist.
Throws:
XoException

getCustomizers

public XoCustomizerInfos[] getCustomizers(XoObject xo)
                                   throws XoException
return specific customizers usable to edit XO object xo. In Xotics API, an XO object, as a JavaBean, can have several java.beans.Customizer classes.

Parameters:
xo - XO object whose specific customizers are requested
Returns:
an array of XoCustomizerInfos objects which contains customizer class and associated display label. array is empty if no customizer was specified
Throws:
XoException

loadDataModel

public java.lang.String loadDataModel(java.net.URL jarUrl)
                               throws XoException
Loads the dialect implementation (DM module) in jar format located in URL param jarUrl.

Returns:
the namespace string corresponding to the loaded module
Throws:
XoException - if any error occurred during module loading

loadDataModel

public java.lang.String loadDataModel(XoDMInstance dm)
                               throws XoException
Loads the DM module described in param dm in DMDL format. It is supposed that all classes defined in DMDL document are already accessible by Xotics Environment class loader (XoEnvironment.getClassLoader()).

Returns:
the namespace string corresponding to the loaded module
Throws:
XoException - if any error occurred during module loading, including a DM instance which is not in DMDL format.

unloadDataModel

public void unloadDataModel(java.lang.String nsref)
                     throws XoException
Unloads DM module identified by nsref.

Parameters:
nsref - the namespace of dialect implementation to unload.
Throws:
XoException - if no DM module corresponds to nsref or if Data-Model is not allowed to be unloaded.

createXoObject

public XoObject createXoObject(java.lang.String nsref,
                               java.lang.String element)
                        throws XoException
Creates a new instance of XO object giving its namespace nsref for param element. This method is not mandatory to create a new XO object, but it handles XoPolymorphWrapper for multi-implemented XML elements.

Returns:
an appropriate instance of XO object
Throws:
XoException - if an error occurred during object loading, or if such object doesn't exist

getDataModelDocument

public XoDMInstance getDataModelDocument(java.lang.String nsref)
                                  throws XoException
Returns the DMDL document describing Data-Model for namespace nsref

Returns:
the XoDMInstance object containing the DMDL document
Throws:
XoException - if no module was loaded for namespace nsref

getDataModelDocuments

public XoDMInstance[] getDataModelDocuments()
Returns the DMDL document list of all loaded DM modules

Returns:
the DMDL document list as an array of XoDMInstance

getDMLocation

public java.net.URL getDMLocation(java.lang.String nsref)
                           throws XoException
Gets the location URL of either a DMDL document describing a DM module or a jar containing the module loaded for namespace nsref

Returns:
an URL of either a DMDL document or a jar loaded for nsref
Throws:
XoException

getProperties

public XoProperty[] getProperties(XoObject xo)
                           throws XoException
Returns the list of property wrappers defined for param xo.

Returns:
the list of properties for xo
Throws:
XoException - if xo is null or a polymorph wrapper, or if no module was found for namespace provided by xo

getPropertyCount

public int getPropertyCount(XoObject xo)
                     throws XoException
Returns the number of properties defined for param xo.

Returns:
the property count for xo
Throws:
XoException - if xo is null or a polymorph wrapper, or if no module was found for namespace provided by xo

getProperty

public XoProperty getProperty(XoObject xo,
                              java.lang.String pName)
                       throws XoException
Returns the wrapper of property named pName for param xo.

Returns:
the property or null if not found
Throws:
XoException - if xo is null or a polymorph wrapper, or if no module was found for namespace provided by xo

getIdName

public java.lang.String getIdName(XoObject xo)
Returns the ID property name of param xo.

Returns:
the name of the ID property or null if not found

getPropertyByXml

public XoProperty getPropertyByXml(XoObject xo,
                                   java.lang.String xmlName)
                            throws XoException
Returns the wrapper of property whose XML attribute equivalent is named xmlName for param xo.

Returns:
the property wrapper or null if not found
Throws:
XoException - if xo is null or a polymorph wrapper, or if no module was found for namespace provided by xo