org.apache.ws.jaxme.xs.impl
Class XSSchemaImpl

java.lang.Object
  extended by org.apache.ws.jaxme.xs.impl.XSSchemaImpl
All Implemented Interfaces:
XSObject, XSOpenAttrs, XSSchema
Direct Known Subclasses:
JAXBSchemaImpl

public class XSSchemaImpl
extends java.lang.Object
implements XSSchema

Implementation of an XML Schema, as defined by the XSSchema interface.

Author:
Jochen Wiedmann

Constructor Summary
XSSchemaImpl(XSContext pContext, XsESchema pSchema)
          Creates a new logical schema by loading data, which represents the given syntactical schema pSchema and uses the given context pContext for acquiring additional information.
 
Method Summary
 void add(XSAnnotation pAnnotation)
          Adds a new annotation to the schema.
 void add(XSAttribute pAttribute)
          Adds a new attribute to the schema.
 void add(XSAttributeGroup pGroup)
          Adds a new attribute group to the schema.
 void add(XSElement pElement)
          Adds a new element to the schema.
 void add(XSGroup pGroup)
          Adds a new group to the schema.
 void add(XSIdentityConstraint ic)
          Adds a new identity constraint to the schema.
 void add(XSKeyRef rf)
          Adds a new key ref to the schema.
 void add(XSNotation pNotation)
          Adds a new notation to the schema.
 void add(XSType pType)
          Adds a new type to the schema.
protected  void addChild(java.lang.Object pChild)
          Adds a new child to the array returned by getChilds().
 XSAnnotation[] getAnnotations()
          Returns the array of annotations.
 XSAttribute getAttribute(XsQName pQName)
          Returns the attribute with the given name.
 XSAttributeGroup getAttributeGroup(XsQName pName)
          Returns the attribute group with the given name.
 XSAttributeGroup[] getAttributeGroups()
          Returns the array of global attribute groups.
 XSAttribute[] getAttributes()
          Returns the array of global attributes.
 XSType[] getBuiltinTypes()
          Returns the array of builtin types.
 java.lang.Object[] getChilds()
          Returns all the schema annotations, types, groups, attribute groups, elements, and attributes, in the order of declaration.
 XSContext getContext()
          Returns the schemas context.
 XSElement getElement(XsQName pName)
          Returns the element with the given name.
 XSElement[] getElements()
          Returns the array of global elements.
 XSGroup getGroup(XsQName pName)
          Returns the group with the given name.
 XSGroup[] getGroups()
          Returns the array of global groups.
 java.util.Map getIdentityConstraints()
          Returns a map of XSIdentityConstraint objects.
 java.util.Map getKeyRefs()
          Returns a map of XSKeyRef objects.
 org.xml.sax.Locator getLocator()
          Returns the objects location.
 org.xml.sax.Attributes getOpenAttributes()
          Returns the additional attributes, if any, or null.
 XSObject getParentObject()
          Returns either of the following: If the object is the schema itself, returns null.
 XsAnyURI getTargetNamespace()
          Returns the schemas target namespace.
 XSType getType(XsQName pName)
          Returns the type with the given name.
 XSType[] getTypes()
          Returns the array of global types.
protected  XsESchema getXsESchema()
           
 XSObjectFactory getXSObjectFactory()
          Returns the schemas object factory.
 XSSchema getXSSchema()
          Returns the objects schema.
 boolean isTopLevelObject()
          Returns whether the object is a top-level object.
protected  boolean isValidated()
           
 void redefine(XSAttributeGroup pGroup)
          Redefines an existing attribute group in the schema.
 void redefine(XSGroup pGroup)
          Redefines an existing group in the schema.
 void redefine(XSType pType)
          Redefines an existing type in the schema.
protected  void replace(java.lang.Object pOldChild, java.lang.Object pNewChild)
          Replaces the existing child pOldChild with the replacement object pNewChild.
 void validate()
          Validates the objects internal state.
protected  void validate(java.lang.Object pChild)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSSchemaImpl

public XSSchemaImpl(XSContext pContext,
                    XsESchema pSchema)

Creates a new logical schema by loading data, which represents the given syntactical schema pSchema and uses the given context pContext for acquiring additional information.

Method Detail

getContext

public XSContext getContext()
Description copied from interface: XSSchema

Returns the schemas context.

Specified by:
getContext in interface XSSchema

isTopLevelObject

public boolean isTopLevelObject()
Description copied from interface: XSObject

Returns whether the object is a top-level object. This is the case for the XsESchema itself and for all its childs only.

Specified by:
isTopLevelObject in interface XSObject

getParentObject

public XSObject getParentObject()
Description copied from interface: XSObject

Returns either of the following:

Specified by:
getParentObject in interface XSObject

getXSObjectFactory

public XSObjectFactory getXSObjectFactory()
Description copied from interface: XSSchema

Returns the schemas object factory.

Specified by:
getXSObjectFactory in interface XSSchema

getLocator

public org.xml.sax.Locator getLocator()
Description copied from interface: XSObject

Returns the objects location.

Specified by:
getLocator in interface XSObject

getXSSchema

public XSSchema getXSSchema()
Description copied from interface: XSObject

Returns the objects schema.

Specified by:
getXSSchema in interface XSObject

getXsESchema

protected XsESchema getXsESchema()

addChild

protected void addChild(java.lang.Object pChild)

Adds a new child to the array returned by getChilds().


replace

protected void replace(java.lang.Object pOldChild,
                       java.lang.Object pNewChild)

Replaces the existing child pOldChild with the replacement object pNewChild. This method is used from within the various redefine() methods.


getAnnotations

public XSAnnotation[] getAnnotations()
Description copied from interface: XSSchema

Returns the array of annotations.

Specified by:
getAnnotations in interface XSSchema

getTypes

public XSType[] getTypes()
Description copied from interface: XSSchema

Returns the array of global types. This includes simple and complex types. The builtin types are not included.

Specified by:
getTypes in interface XSSchema
See Also:
XSSchema.getType(XsQName)

getBuiltinTypes

public XSType[] getBuiltinTypes()
Description copied from interface: XSSchema

Returns the array of builtin types. This includes simple and complex types.

Specified by:
getBuiltinTypes in interface XSSchema
See Also:
XSSchema.getTypes()

getType

public XSType getType(XsQName pName)
Description copied from interface: XSSchema

Returns the type with the given name. This may be a builtin type or a type defined by the schema.

Specified by:
getType in interface XSSchema

getGroups

public XSGroup[] getGroups()
Description copied from interface: XSSchema

Returns the array of global groups.

Specified by:
getGroups in interface XSSchema

getGroup

public XSGroup getGroup(XsQName pName)
Description copied from interface: XSSchema

Returns the group with the given name.

Specified by:
getGroup in interface XSSchema

getAttributeGroups

public XSAttributeGroup[] getAttributeGroups()
Description copied from interface: XSSchema

Returns the array of global attribute groups.

Specified by:
getAttributeGroups in interface XSSchema

getAttributeGroup

public XSAttributeGroup getAttributeGroup(XsQName pName)
Description copied from interface: XSSchema

Returns the attribute group with the given name.

Specified by:
getAttributeGroup in interface XSSchema

getElements

public XSElement[] getElements()
Description copied from interface: XSSchema

Returns the array of global elements.

Specified by:
getElements in interface XSSchema

getElement

public XSElement getElement(XsQName pName)
Description copied from interface: XSSchema

Returns the element with the given name.

Specified by:
getElement in interface XSSchema

getIdentityConstraints

public java.util.Map getIdentityConstraints()
Description copied from interface: XSSchema

Returns a map of XSIdentityConstraint objects. The key is the constraints name. The map is immutable.

Specified by:
getIdentityConstraints in interface XSSchema

getKeyRefs

public java.util.Map getKeyRefs()
Description copied from interface: XSSchema

Returns a map of XSKeyRef objects. The key is the key refs name. The map is immutable.

Specified by:
getKeyRefs in interface XSSchema

add

public void add(XSIdentityConstraint ic)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new identity constraint to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSKeyRef rf)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new key ref to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

getAttributes

public XSAttribute[] getAttributes()
Description copied from interface: XSSchema

Returns the array of global attributes.

Specified by:
getAttributes in interface XSSchema

getAttribute

public XSAttribute getAttribute(XsQName pQName)
Description copied from interface: XSSchema

Returns the attribute with the given name.

Specified by:
getAttribute in interface XSSchema

add

public void add(XSAnnotation pAnnotation)
Description copied from interface: XSSchema

Adds a new annotation to the schema.

Specified by:
add in interface XSSchema

add

public void add(XSType pType)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new type to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

redefine

public void redefine(XSType pType)
              throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Redefines an existing type in the schema.

Specified by:
redefine in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSGroup pGroup)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new group to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

redefine

public void redefine(XSGroup pGroup)
              throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Redefines an existing group in the schema.

Specified by:
redefine in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSAttributeGroup pGroup)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new attribute group to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

redefine

public void redefine(XSAttributeGroup pGroup)
              throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Redefines an existing attribute group in the schema.

Specified by:
redefine in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSAttribute pAttribute)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new attribute to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSElement pElement)
         throws org.xml.sax.SAXException
Description copied from interface: XSSchema

Adds a new element to the schema.

Specified by:
add in interface XSSchema
Throws:
org.xml.sax.SAXException

add

public void add(XSNotation pNotation)
Description copied from interface: XSSchema

Adds a new notation to the schema.

Specified by:
add in interface XSSchema

getChilds

public java.lang.Object[] getChilds()
Description copied from interface: XSSchema

Returns all the schema annotations, types, groups, attribute groups, elements, and attributes, in the order of declaration.

Specified by:
getChilds in interface XSSchema

validate

protected void validate(java.lang.Object pChild)
                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

isValidated

protected boolean isValidated()

validate

public void validate()
              throws org.xml.sax.SAXException
Description copied from interface: XSObject

Validates the objects internal state.

Specified by:
validate in interface XSObject
Throws:
org.xml.sax.SAXException

getOpenAttributes

public org.xml.sax.Attributes getOpenAttributes()
Description copied from interface: XSOpenAttrs

Returns the additional attributes, if any, or null.

Specified by:
getOpenAttributes in interface XSOpenAttrs

getTargetNamespace

public XsAnyURI getTargetNamespace()
Description copied from interface: XSSchema

Returns the schemas target namespace. Note, that a logical schema can combine elements, attributes, groups, and types of various namespaces by importing other syntactical schemas with different namespaces. Thus the logical schemas target namespace is in fact the target namespace of the outermost syntactical schema.

Specified by:
getTargetNamespace in interface XSSchema
Returns:
Target namespace or null for null (default namespace)