sk.uniba.euromath.document.schema
Class SchemaReferences

java.lang.Object
  extended by sk.uniba.euromath.document.schema.SchemaReferences

public final class SchemaReferences
extends Object

Manages list of Schemas, one for each namespace URI, for a single document. Thread-safe. Class is not intended for subclassing nor instantiating by clients.

Author:
Martin Vysny

Method Summary
 ISchema getSchema(String namespaceURI)
           For given namespace URI returns appropriate Schema object, that validates elements with this namespace URI.
 SchemaAvailabilityEnum getSchemaAvailability(String namespaceURI)
          Determines availability of schema for the namespace.
 ISchema getSchemaNull(String namespaceURI)
           For given namespace URI returns appropriate Schema object, that validates elements with this namespace URI.
 void loadSchema(String namespaceURI)
          Loads schema for given namespace.
 void loadSchemata(Collection<String> namespaces)
          Loads schemas for all given namespaces.
 void preserve(Set<? extends String> namespaces)
          Preserves only the schemas contained in the given set, but unregisters all other schemas.
 void unloadSchema(String namespaceURI)
          Removes the schema from the reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSchema

public ISchema getSchema(String namespaceURI)

For given namespace URI returns appropriate Schema object, that validates elements with this namespace URI.

If no local Schema for given URI exists for given document, then try to get appropriate global Schema (it won't attempt to load the schema if not present).

Parameters:
namespaceURI - namespace URI.
Returns:
Schema
Throws:
IllegalStateException - if Schema with given URI cannot be found.

getSchemaNull

public ISchema getSchemaNull(String namespaceURI)

For given namespace URI returns appropriate Schema object, that validates elements with this namespace URI.

If no local Schema for given URI exists for given document, then try to get appropriate global Schema (it won't attempt to load the schema if not present).

Parameters:
namespaceURI - namespace URI.
Returns:
Schema, or null if no such schema has been loaded.

loadSchemata

public void loadSchemata(Collection<String> namespaces)
                  throws SchemaException,
                         IOException
Loads schemas for all given namespaces. If the schema is already loaded then it is not loaded again. It must be called before the Schema interface is used, to ensure that all schemata are properly loaded.

Parameters:
namespaces - collection of String namespaces.
Throws:
SchemaException - if error happens during loading of schemas.
IOException - if i/o error occurs during the schema files deserialization.

unloadSchema

public void unloadSchema(String namespaceURI)
Removes the schema from the reference. The schema may be still present, but only in a pool - it is not linked to this document anymore.

Parameters:
namespaceURI - the namespace.

loadSchema

public void loadSchema(String namespaceURI)
                throws SchemaException,
                       IOException
Loads schema for given namespace. If the schema is already loaded then it is not loaded again. It must be called before the Schema interface is used, to ensure that all schemata are properly loaded.

Parameters:
namespaceURI - the namespace
Throws:
SchemaException - if error happens during loading of schemas.
IOException - if i/o error occurs during the schema files deserialization.

getSchemaAvailability

public SchemaAvailabilityEnum getSchemaAvailability(String namespaceURI)
Determines availability of schema for the namespace.

Parameters:
namespaceURI - the namespace to check
Returns:
availability code.

preserve

public void preserve(Set<? extends String> namespaces)
Preserves only the schemas contained in the given set, but unregisters all other schemas.

Parameters:
namespaces - set of namespaces that shall be preserved.


Copyright © 2003-2006 null. All Rights Reserved.