org.inria.ns.reflex.processor.asl
Class GlobalSchema

java.lang.Object
  extended by org.inria.ns.reflex.processor.asl.GlobalSchema
All Implemented Interfaces:
Schema, Localizable

public class GlobalSchema
extends Object
implements Schema

A GlobalSchema holds all the schema instances of a given namespace URI.

A schema instance is looked up in the catalog if it is unknown of this global schema and if the expected resource has not been found ; the catalog to lookup is those of the processor instance used to build the global schema (adding a catalog can be done with ProcessorInstance.addCatalogReference(String)). In a way, a global schema contains several Schema bound to the same namespace URI, that can be DTD instances,

Active Schema instances, W3C XML Schema instances, Relax NG instances, TREX instances, or whatever can be compiled to a schema.

Author:
Philippe Poulard
See Also:
MasterSchema

Constructor Summary
GlobalSchema(ProcessorInstance pi, Schema schema)
          Create a new global schema.
GlobalSchema(ProcessorInstance pi, String namespaceURI)
          Create a new empty global schema.
 
Method Summary
 AttributeDefinition getAttributeDefinition(Attr attribute)
          Retrieve an attribute definition.
 AttributeDefinition getAttributeDefinition(QName name)
          Retrieve an attribute definition.
 ElementDefinition getElementDefinition(Element element)
          Retrieve an element definition.
 ElementDefinition getElementDefinition(ElementDefinition elementDefinition)
          Retrieve the next element definition that has the same name of the element definition given.
 ElementDefinition getElementDefinition(QName name)
          Retrieve an element definition.
 ElementDefinition getElementDefinition(String namespaceURI)
          Return the fallback element definition.
 Identifiable getIdentifiable(QName id)
          Retrieve an identifiable object.
 XFile getLocation()
          This implementation is not localizable.
 String getTargetNamespaceURI()
          Return the target namespace URI of this schema.
 Type getTypeDefinition(QName name)
          Retrieve a type.
 Type getTypeDefinition(String namespaceURI)
          Return the fallback type.
 Type getTypeDefinition(Type type)
          Retrieve the next type that has the same name of the type given.
 boolean isLocalizable()
          Indicates that this instance is not localizable.
 Schema next(Schema schema)
          Lookup for the next schema instance.
 void setLocation(XFile location)
          This implementation is not localizable.
 void storeSchemaInstance(Schema schema)
          Stores a schema instance in this global schema.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalSchema

public GlobalSchema(ProcessorInstance pi,
                    String namespaceURI)
Create a new empty global schema.

Parameters:
pi - The non-null processor instance that creates this global schema.
namespaceURI - The namespaceURI of this global schema.

GlobalSchema

public GlobalSchema(ProcessorInstance pi,
                    Schema schema)
Create a new global schema.

Parameters:
pi - The non-null processor instance that creates this global schema.
schema - The first schema to store. This global schema endorse the same namespace URI of the first schema.
Method Detail

storeSchemaInstance

public void storeSchemaInstance(Schema schema)
Stores a schema instance in this global schema.

Parameters:
schema - The schema to store. null is ignored.

getTargetNamespaceURI

public String getTargetNamespaceURI()
Return the target namespace URI of this schema.

Specified by:
getTargetNamespaceURI in interface Schema
Returns:
The target namespace URI, that can be the empty string if no namespace URI has been defined.
See Also:
Schema.getTargetNamespaceURI()

getTypeDefinition

public Type getTypeDefinition(Type type)
Retrieve the next type that has the same name of the type given. If the type is not found in the known schema instances, the catalog may be involved to get more instances. The lookup starts from the schema that define the type given. Usefull for <asl:apply-definitions>

Parameters:
type - The non-null>/tt> type from which starting to search. Anonymous type are ignored.
Returns:
The type expected, or null.

getTypeDefinition

public Type getTypeDefinition(QName name)
Retrieve a type. If the type is not found in the known schema instances, the catalog may be involved to get more instances.

Specified by:
getTypeDefinition in interface Schema
Parameters:
name - The name of the type to retrieve.
Returns:
The type expected, or null.
See Also:
Schema.getTypeDefinition(org.inria.ns.reflex.xml.QName)

getTypeDefinition

public Type getTypeDefinition(String namespaceURI)
Return the fallback type.

Specified by:
getTypeDefinition in interface Schema
Parameters:
namespaceURI - The namespace URI of this global schema.
Returns:
The type expected, or null.
See Also:
Schema.getTypeDefinition(java.lang.String)

getElementDefinition

public ElementDefinition getElementDefinition(ElementDefinition elementDefinition)
Retrieve the next element definition that has the same name of the element definition given. If the element definition is not found in the known schema instances, the catalog may be involved to get more instances. The lookup starts from the schema that define the element definition given. Usefull for <asl:apply-definitions>

Parameters:
elementDefinition - The non-null>/tt> element definition from which starting to search.
Returns:
The element definition expected, or null.

getElementDefinition

public ElementDefinition getElementDefinition(QName name)
Retrieve an element definition. If the element definition is not found in the known schema instances, the catalog may be involved to get more instances.

Specified by:
getElementDefinition in interface Schema
Parameters:
name - The name of the element definition to retrieve.
Returns:
The element definition expected, or null.
See Also:
Schema.getElementDefinition(org.inria.ns.reflex.xml.QName)

getElementDefinition

public ElementDefinition getElementDefinition(Element element)
Retrieve an element definition. If the element definition is not found in the known schema instances, the catalog may be involved to get more instances.

Specified by:
getElementDefinition in interface Schema
Parameters:
name - The name of the element definition to retrieve.
Returns:
The element definition expected, or null.
See Also:
Schema.getElementDefinition(org.w3c.dom.Element)

getElementDefinition

public ElementDefinition getElementDefinition(String namespaceURI)
Return the fallback element definition.

Specified by:
getElementDefinition in interface Schema
Parameters:
namespaceURI - The namespace URI of this global schema.
Returns:
The element definition expected, or null.
See Also:
Schema.getElementDefinition(java.lang.String)

getAttributeDefinition

public AttributeDefinition getAttributeDefinition(QName name)
Retrieve an attribute definition. If the attribute definition is not found in the known schema instances, the catalog may be involved to get more instances.

Specified by:
getAttributeDefinition in interface Schema
Parameters:
name - The name of the attribute definition to retrieve.
Returns:
The attribute definition expected, or null.
See Also:
Schema.getAttributeDefinition(org.inria.ns.reflex.xml.QName)

getAttributeDefinition

public AttributeDefinition getAttributeDefinition(Attr attribute)
Retrieve an attribute definition. If the attribute definition is not found in the known schema instances, the catalog may be involved to get more instances.

Specified by:
getAttributeDefinition in interface Schema
Parameters:
name - The name of the attribute definition to retrieve.
Returns:
The attribute definition expected, or null.
See Also:
Schema.getAttributeDefinition(org.w3c.dom.Attr)

getIdentifiable

public Identifiable getIdentifiable(QName id)
Retrieve an identifiable object. If the identifiable object is not found in the known schema instances, the catalog may be involved to get more instances.

Specified by:
getIdentifiable in interface Schema
Parameters:
id - The ID of the identifiable object to retrieve.
Returns:
The identifiable object expected, or null.
See Also:
Schema.getIdentifiable(org.inria.ns.reflex.xml.QName)

next

public Schema next(Schema schema)
Lookup for the next schema instance. If the given schema is the last known, the catalog is involved to supply the next schema.

Parameters:
schema - The schema that may have a next schema.
Returns:
The next schema expected, or null.

getLocation

public final XFile getLocation()
                        throws UnlocalizableException
This implementation is not localizable.

Specified by:
getLocation in interface Localizable
Returns:
The URI of this component, as an XFile, or null.
Throws:
UnlocalizableException - Always thrown.
See Also:
Localizable.getLocation()

isLocalizable

public boolean isLocalizable()
Indicates that this instance is not localizable.

Specified by:
isLocalizable in interface Localizable
Returns:
false
See Also:
Localizable.isLocalizable()

setLocation

public final void setLocation(XFile location)
                       throws UnlocalizableException
This implementation is not localizable.

Specified by:
setLocation in interface Localizable
Parameters:
location - Not used.
Throws:
UnlocalizableException - Always thrown.
See Also:
Localizable.setLocation(org.inria.ns.reflex.modules.io.XFile)