com.jaxfront.core.schema.impl
Class XMLSchemaImpl

java.lang.Object
  extended by com.jaxfront.core.schema.impl.XMLSchemaImpl
All Implemented Interfaces:
XMLSchema

public class XMLSchemaImpl
extends java.lang.Object
implements XMLSchema

Represents a W3C XML Schema (wrapping oracles XML Schema: oracle.xml.parser.schema.XMLSchema Every schema is holding the root name, available code tables and all global entities.


Constructor Summary
XMLSchemaImpl(org.apache.xerces.xs.XSModel schema, org.w3c.dom.ls.LSInput schemaInput, java.lang.String rootName, java.util.Hashtable namespaceMapping, java.util.Hashtable schemaRootNodeAttributes)
          Creates an XML Schema based on a oracle XMLSchema, a schemaURL and a root name.
XMLSchemaImpl(org.apache.xerces.xs.XSModel schema, java.net.URL schemaURL, java.lang.String rootName, java.util.Hashtable namespaceMapping, java.util.Hashtable schemaRootNodeAttributes)
          Creates an XML Schema based on a oracle XMLSchema, a schemaURL and a root name.
 
Method Summary
 Type buildType(SchemaNode element)
          Returns the analysed JAXFront type according to my schema element children.
 Type buildType(SchemaNode element, TreeWalkingElementAnalyser analyser)
           
 Document createDocument()
          Returns a new JAXFront Document.
 Document createDocument(java.util.Hashtable params)
          Returns a new JAXFront Document.
 Type createTypeCopy(SchemaNode element)
          Creates a copy of the analysed JAXFront type for the passing element.
static CodeTables getCodes()
          Returns the codeTables.
 CodeTables getCodeTables()
          Returns the codeTables.
 CodeTables getCodeTables(XMLSchema schema, java.lang.String url, java.net.URL xuiURL)
          Returns all loaded code tables for a specific url (e.q. po.codes).
 CodeTables getCodeTables(XMLSchema schema, java.lang.String url, java.net.URL xuiURL, org.apache.xerces.xni.parser.XMLEntityResolver resolver)
          Returns all loaded code tables for a specific url (e.q. po.codes).
 java.lang.String getDefaultNamespace()
          Returns the default namespace of this schema.
 java.lang.String[] getDerivedTypeNames(java.lang.String abstractName)
          Returns all derived type names whith a specific name of a submitted abstract type.
 java.util.Set getDerivedTypes(java.lang.String abstractName, java.lang.String name)
          Returns all derived types whith a specific name of a submitted abstract type.
 java.util.Set getDerivedTypes(java.lang.String abstractName, java.lang.String name, java.util.Set derivedTypes)
           
 Type getEditingType(Type edType)
           
 java.util.Map getEditingTypeCache()
           
 java.util.Map getGlobalElements()
          Returns all global elements of this schema.
 java.util.Map getGlobalEntities()
          Returns all global entities of this schema.
 SchemaNode getGlobalEntity(SchemaNode node)
           
 SchemaNode getGlobalEntity(short type, java.lang.String name)
          Returns a global entity with a specific name.
static org.apache.xerces.xs.XSObject getGlobalXSDInternalTypes(int type)
           
 java.lang.String getGroupName(org.apache.xerces.xs.XSObject modelGroup)
           
 java.lang.String getGroupQName(org.apache.xerces.xs.XSObject modelGroup)
           
 SchemaKey getKey(java.lang.String keyName)
          Returns a schema key.
 SchemaKeyRef getKeyRef(java.lang.String keyName)
          Returns a schema key.
 java.lang.String getLocationPath()
          Returns the absolute filepath that points to the schema.
 java.util.Vector getNamespaceDeclarations(java.lang.String schemaLocation)
          Gets all namespace declarations of this schema.
 java.util.Vector getNamespaceDeclarations(java.lang.String schemaLocation, boolean isXuiDom)
          Gets all namespace declarations of this schema.
 java.util.Hashtable getNamespaceMapping()
           
 java.lang.String getNamespacePrefix(java.lang.String nsURI)
          Gets the prefix of a namespace URI.
 org.apache.xerces.xs.StringList getNamespaceURIs()
          Gets all namespace URIs of this schema.
 SchemaNode getRootElement()
          Returns the root element of this XML schema.
 java.lang.String getRootName()
          Returns the logical XML Schema root name.
 Type getRootType()
          Returns the analysed JAXFront type of the root element.
 Document getSCDom()
           
 java.util.Map getSchemaRootNodeAttributes()
          Returns all attributes defined on schema node.
 java.lang.String getTargetNamespace()
          Returns the target namespace of this schema.
 Type getType(SchemaNode element)
          Get the analysed JAXFront Type from a Schema Element.
 Type getType(SchemaNode element, TreeWalkingElementAnalyser analyser)
           
 java.net.URL getURL()
          Returns the url location of this schema.
 void initializeXSDKeySystem(Document dom)
           
 boolean isDefaultNamespace(java.lang.String ns)
          Returns true if this schema is the xui.xsd.
 boolean isGlobalEntity(short type, java.lang.String name)
          Returns true if a global entity with the given name is registered.
 boolean isSynced()
           
 boolean isXUISchema()
           
 boolean keepInMemory()
          Returns true if this schema shouldnt be released.
 void putEditingTypeCache(Type edType)
           
 void registerEditingType(Type edType)
           
 void registerKey(java.lang.String keyName, SchemaKey element)
          Register a key.
 void registerKeyRef(java.lang.String keyName, SchemaKeyRef element)
          Register a key reference.
 void release()
          Release all allocated global entities and derived types and any other resources added to this schema.
static void releaseCodeTable(java.lang.String id)
           
static void releaseCodeTables()
          Returns the codeTables.
 void releaseGlobalXUIDefinitions()
          Get rid of the global xui definitions in the global schema type entities.
 void setBase(java.net.URL base)
          Set the base url of the XML schema.
 void setKeepInMemory(boolean keep)
           
 void setRootName(java.lang.String rootName)
          Sets the root name for this schema.
 void setRootName(java.lang.String rootName, java.lang.String rootNS)
          Sets the root name for this schema.
 void setSCDom(Document document)
           
 void setSynced(boolean synced)
           
 void setXUISchema(boolean isXUISchema)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLSchemaImpl

public XMLSchemaImpl(org.apache.xerces.xs.XSModel schema,
                     org.w3c.dom.ls.LSInput schemaInput,
                     java.lang.String rootName,
                     java.util.Hashtable namespaceMapping,
                     java.util.Hashtable schemaRootNodeAttributes)
Creates an XML Schema based on a oracle XMLSchema, a schemaURL and a root name.

Parameters:
schema - an oracle XML Schema (from oracle schema parser)
schemaURL - scheme url location
rootName - name of the root node

XMLSchemaImpl

public XMLSchemaImpl(org.apache.xerces.xs.XSModel schema,
                     java.net.URL schemaURL,
                     java.lang.String rootName,
                     java.util.Hashtable namespaceMapping,
                     java.util.Hashtable schemaRootNodeAttributes)
Creates an XML Schema based on a oracle XMLSchema, a schemaURL and a root name.

Parameters:
schema - an oracle XML Schema (from oracle schema parser)
schemaURL - scheme url location
rootName - name of the root node
Method Detail

buildType

public Type buildType(SchemaNode element)
Description copied from interface: XMLSchema
Returns the analysed JAXFront type according to my schema element children.

Specified by:
buildType in interface XMLSchema
See Also:
XMLSchema.buildType(com.jaxfront.core.schema.SchemaNode)

buildType

public Type buildType(SchemaNode element,
                      TreeWalkingElementAnalyser analyser)
See Also:
XMLSchema.buildType(com.jaxfront.core.schema.SchemaNode)

createDocument

public Document createDocument()
Returns a new JAXFront Document.

Specified by:
createDocument in interface XMLSchema

createDocument

public Document createDocument(java.util.Hashtable params)
Returns a new JAXFront Document.

Specified by:
createDocument in interface XMLSchema

createTypeCopy

public Type createTypeCopy(SchemaNode element)
Creates a copy of the analysed JAXFront type for the passing element.

Specified by:
createTypeCopy in interface XMLSchema
Parameters:
element - SchemaNode to create a type copy from

getCodes

public static CodeTables getCodes()
Returns the codeTables.


getCodeTables

public CodeTables getCodeTables()
Returns the codeTables.

Specified by:
getCodeTables in interface XMLSchema

getCodeTables

public CodeTables getCodeTables(XMLSchema schema,
                                java.lang.String url,
                                java.net.URL xuiURL)
Description copied from interface: XMLSchema
Returns all loaded code tables for a specific url (e.q. po.codes).

Specified by:
getCodeTables in interface XMLSchema
url - location of the code table file (e.q. c:\temp\po.codes)

getCodeTables

public CodeTables getCodeTables(XMLSchema schema,
                                java.lang.String url,
                                java.net.URL xuiURL,
                                org.apache.xerces.xni.parser.XMLEntityResolver resolver)
Returns all loaded code tables for a specific url (e.q. po.codes).

Specified by:
getCodeTables in interface XMLSchema
Parameters:
url - location of the code table file (e.q. c:\temp\po.codes)

getDefaultNamespace

public java.lang.String getDefaultNamespace()
Returns the default namespace of this schema.

Specified by:
getDefaultNamespace in interface XMLSchema

getDerivedTypeNames

public java.lang.String[] getDerivedTypeNames(java.lang.String abstractName)
Returns all derived type names whith a specific name of a submitted abstract type.

Specified by:
getDerivedTypeNames in interface XMLSchema
Parameters:
abstractName - abstract schema base type

getDerivedTypes

public java.util.Set getDerivedTypes(java.lang.String abstractName,
                                     java.lang.String name)
Returns all derived types whith a specific name of a submitted abstract type.

Specified by:
getDerivedTypes in interface XMLSchema
Parameters:
schemaType - abstract schema base type
name - derived type name to look for

getDerivedTypes

public java.util.Set getDerivedTypes(java.lang.String abstractName,
                                     java.lang.String name,
                                     java.util.Set derivedTypes)

getEditingType

public Type getEditingType(Type edType)

getEditingTypeCache

public java.util.Map getEditingTypeCache()

getGlobalElements

public java.util.Map getGlobalElements()
Description copied from interface: XMLSchema
Returns all global elements of this schema.

Specified by:
getGlobalElements in interface XMLSchema
See Also:
XMLSchema.getGlobalElements()

getGlobalEntities

public java.util.Map getGlobalEntities()
Returns all global entities of this schema.

Specified by:
getGlobalEntities in interface XMLSchema

getGlobalEntity

public SchemaNode getGlobalEntity(SchemaNode node)
Specified by:
getGlobalEntity in interface XMLSchema

getGlobalEntity

public SchemaNode getGlobalEntity(short type,
                                  java.lang.String name)
Returns a global entity with a specific name.

Specified by:
getGlobalEntity in interface XMLSchema
Parameters:
name - global entity name to look for

getGlobalXSDInternalTypes

public static org.apache.xerces.xs.XSObject getGlobalXSDInternalTypes(int type)

getGroupName

public java.lang.String getGroupName(org.apache.xerces.xs.XSObject modelGroup)

getGroupQName

public java.lang.String getGroupQName(org.apache.xerces.xs.XSObject modelGroup)

getKey

public SchemaKey getKey(java.lang.String keyName)
Returns a schema key.

Specified by:
getKey in interface XMLSchema

getKeyRef

public SchemaKeyRef getKeyRef(java.lang.String keyName)
Returns a schema key.

Specified by:
getKeyRef in interface XMLSchema

getLocationPath

public java.lang.String getLocationPath()
Description copied from interface: XMLSchema
Returns the absolute filepath that points to the schema.

Specified by:
getLocationPath in interface XMLSchema
Returns:
the absolute filepath that points to the schema
See Also:
XMLSchema.getLocationPath()

getNamespaceDeclarations

public java.util.Vector getNamespaceDeclarations(java.lang.String schemaLocation)
Description copied from interface: XMLSchema
Gets all namespace declarations of this schema.

Specified by:
getNamespaceDeclarations in interface XMLSchema
Returns:
all namespace declarations (e.g. xmlns:xsi="http://www.w3org/2001/XMLSchema-instance")
See Also:
com.jaxfront.core.schema.XMLSchema#getAllXmlNS()

getNamespaceDeclarations

public java.util.Vector getNamespaceDeclarations(java.lang.String schemaLocation,
                                                 boolean isXuiDom)
Description copied from interface: XMLSchema
Gets all namespace declarations of this schema.

Specified by:
getNamespaceDeclarations in interface XMLSchema
Returns:
all namespace declarations (e.g. xmlns:xsi="http://www.w3org/2001/XMLSchema-instance")

getNamespaceMapping

public java.util.Hashtable getNamespaceMapping()
Specified by:
getNamespaceMapping in interface XMLSchema

getNamespacePrefix

public java.lang.String getNamespacePrefix(java.lang.String nsURI)
Description copied from interface: XMLSchema
Gets the prefix of a namespace URI.

Specified by:
getNamespacePrefix in interface XMLSchema
Parameters:
nsURI - a namespace URI
Returns:
the associated prefix
See Also:
XMLSchema.getNamespacePrefix(java.lang.String)

getNamespaceURIs

public org.apache.xerces.xs.StringList getNamespaceURIs()
Description copied from interface: XMLSchema
Gets all namespace URIs of this schema.

Specified by:
getNamespaceURIs in interface XMLSchema
Returns:
all namespace URIs
See Also:
XMLSchema.getNamespaceURIs()

getRootElement

public SchemaNode getRootElement()
Returns the root element of this XML schema.

Specified by:
getRootElement in interface XMLSchema

getRootName

public java.lang.String getRootName()
Returns the logical XML Schema root name.

Specified by:
getRootName in interface XMLSchema

getRootType

public Type getRootType()
Returns the analysed JAXFront type of the root element.

Specified by:
getRootType in interface XMLSchema

getSCDom

public Document getSCDom()
Specified by:
getSCDom in interface XMLSchema

getSchemaRootNodeAttributes

public java.util.Map getSchemaRootNodeAttributes()
Description copied from interface: XMLSchema
Returns all attributes defined on schema node.

Specified by:
getSchemaRootNodeAttributes in interface XMLSchema

getTargetNamespace

public java.lang.String getTargetNamespace()
Returns the target namespace of this schema.

Specified by:
getTargetNamespace in interface XMLSchema

getType

public Type getType(SchemaNode element)
Description copied from interface: XMLSchema
Get the analysed JAXFront Type from a Schema Element.

Specified by:
getType in interface XMLSchema
Parameters:
element - Schema Element to get the analysed JAXFront Type from
See Also:
XMLSchema.getType(com.jaxfront.core.schema.SchemaNode)

getType

public Type getType(SchemaNode element,
                    TreeWalkingElementAnalyser analyser)
Specified by:
getType in interface XMLSchema
See Also:
XMLSchema.getType(com.jaxfront.core.schema.SchemaNode)

getURL

public java.net.URL getURL()
Returns the url location of this schema.

Specified by:
getURL in interface XMLSchema

initializeXSDKeySystem

public void initializeXSDKeySystem(Document dom)

isDefaultNamespace

public boolean isDefaultNamespace(java.lang.String ns)
Description copied from interface: XMLSchema
Returns true if this schema is the xui.xsd.

Specified by:
isDefaultNamespace in interface XMLSchema

isGlobalEntity

public boolean isGlobalEntity(short type,
                              java.lang.String name)
Description copied from interface: XMLSchema
Returns true if a global entity with the given name is registered.

Specified by:
isGlobalEntity in interface XMLSchema
name - global entity name to look for

isSynced

public boolean isSynced()
Specified by:
isSynced in interface XMLSchema

isXUISchema

public boolean isXUISchema()
Specified by:
isXUISchema in interface XMLSchema
See Also:
XMLSchema.isXUISchema()

keepInMemory

public boolean keepInMemory()
Description copied from interface: XMLSchema
Returns true if this schema shouldnt be released.

Specified by:
keepInMemory in interface XMLSchema

putEditingTypeCache

public void putEditingTypeCache(Type edType)

registerEditingType

public void registerEditingType(Type edType)

registerKey

public void registerKey(java.lang.String keyName,
                        SchemaKey element)
Description copied from interface: XMLSchema
Register a key.

Specified by:
registerKey in interface XMLSchema
Parameters:
keyName - name of the key
element - holding schema element
See Also:
XMLSchema.registerKey(java.lang.String, com.jaxfront.core.schema.SchemaKey)

registerKeyRef

public void registerKeyRef(java.lang.String keyName,
                           SchemaKeyRef element)
Description copied from interface: XMLSchema
Register a key reference.

Specified by:
registerKeyRef in interface XMLSchema
Parameters:
keyName - name of the key reference
element - holding schema element
See Also:
XMLSchema.registerKeyRef(java.lang.String, com.jaxfront.core.schema.SchemaKeyRef)

release

public void release()
Release all allocated global entities and derived types and any other resources added to this schema.

Specified by:
release in interface XMLSchema

releaseCodeTable

public static void releaseCodeTable(java.lang.String id)

releaseCodeTables

public static void releaseCodeTables()
Returns the codeTables.


releaseGlobalXUIDefinitions

public void releaseGlobalXUIDefinitions()
Description copied from interface: XMLSchema
Get rid of the global xui definitions in the global schema type entities.

Specified by:
releaseGlobalXUIDefinitions in interface XMLSchema
See Also:
XMLSchema.releaseGlobalXUIDefinitions()

setBase

public void setBase(java.net.URL base)
Description copied from interface: XMLSchema
Set the base url of the XML schema.

Specified by:
setBase in interface XMLSchema

setKeepInMemory

public void setKeepInMemory(boolean keep)
Specified by:
setKeepInMemory in interface XMLSchema

setRootName

public void setRootName(java.lang.String rootName)
Description copied from interface: XMLSchema
Sets the root name for this schema.

Specified by:
setRootName in interface XMLSchema

setRootName

public void setRootName(java.lang.String rootName,
                        java.lang.String rootNS)
Sets the root name for this schema.


setSCDom

public void setSCDom(Document document)
Specified by:
setSCDom in interface XMLSchema

setSynced

public void setSynced(boolean synced)
Specified by:
setSynced in interface XMLSchema

setXUISchema

public void setXUISchema(boolean isXUISchema)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object