com.bluestream.xdb.dsobject.content
Interface SchemaMgr


public interface SchemaMgr

An interface for managing schemas. This interface is common for client and server side. Note: uriFullName is the name of the schema including the absolute resource folder path under which the schema is stored. The minimal uriFullName is /SysSchema followed by the schema name. Deeper folder structures can be used and in many cases have to be used when loading groups of schemas that include each other.


Method Summary
 void addSchema(URI uriSrc, URI uriFullName)
          add the named schema into global schema storage and save it's file and supporting files to disk.
 boolean doesExist(URI uriFullName)
          Does this schema exist.
 Vector getBindings(URI uriFullName)
          get the roots which this schema is bound to.
 SchemaInfo getSchemaInfo(URI uriFullName)
          Returns SchemaInfo specified by schemaName.
 Iterator getSchemaNameIterator()
          Return an iterator of the names of schemas.
 void refresh()
          Either loads all the schemas from server or marks them as stale so they will be reloaded when they are subsequently retrieved via getSchemaInfo etc.
 void removeAll()
          Remove all the schemas from XDB.
 void removeSchema(URI uriFullName)
          Removes a schema from the system.
 

Method Detail

addSchema

public void addSchema(URI uriSrc,
                      URI uriFullName)
               throws XDBException
add the named schema into global schema storage and save it's file and supporting files to disk. In the case of Srv, save to resource.

Parameters:
uriSrc - URI of the source file, to be interpretted by the subclass.
uriFullName - URI of the to be saved full name. eg: /SysSchema/foo.xsd. If this URI contains folders that are not created then they will be automatically. If you wish to create folders by hand then use the resource API and create categories under /SysSchema. Schemas with the extension .dtd will be treated as DTDs all others will be treated as W3C Schema documents.
Throws:
XDBException - - EC_DuplicatedSchema: This schema is already added.

getSchemaInfo

public SchemaInfo getSchemaInfo(URI uriFullName)
Returns SchemaInfo specified by schemaName. Any schema info can be got, however some may not be self sufficient or whatever and this will be shown by exceptions when you go si.getSchema.

Parameters:
uriFullName - eg: /SysSchema/foo.xsd. The name of the schema (fullName), as provided when the schema was added.
Returns:
SchemaInfo - The schema info you are looking for.
Throws:
SysException - - SysErr.EC_SchemaNotFound

removeSchema

public void removeSchema(URI uriFullName)
                  throws XDBException
Removes a schema from the system. If the schema is currently attached to a root, then the removal is not possible.

Parameters:
uriFullName - eg: /SysSchema/foo.xsd. The full name of the schema to remove.
Throws:
XDBException - - XDBErr.EC_RootSchemaIntegrity: this schema is bound to any root.

doesExist

public boolean doesExist(URI uriFullName)
Does this schema exist.

Parameters:
uriFullName - eg: /SysSchema/foo.xsd. The full name of the schema.
Returns:
boolean TRUE is returned if the schema 'schemaName' has been defined on the server. Otherwise FALSE is returned.

refresh

public void refresh()
             throws XDBException
Either loads all the schemas from server or marks them as stale so they will be reloaded when they are subsequently retrieved via getSchemaInfo etc.

Throws:
XDBException - thrown if an error occurs during the refresh operation.

removeAll

public void removeAll()
               throws XDBException
Remove all the schemas from XDB. After this call, all schemas will be gone from persistent storage as well as from this schemaMgr. Since schemas are in the resource manager, there cannot be any locks on the long resource locks on any of the schemas or none of them will be deleted. If any of the schemas are currently assigned to a root, then this call fails and throws an exception XDBErr.EC_RootSchemaIntegrity.

Throws:
XDBException - - XDBErr.EC_RootSchemaIntegrity: any schema is bound to any root.

getSchemaNameIterator

public Iterator getSchemaNameIterator()
                               throws XDBException
Return an iterator of the names of schemas. Schemas are returned in string sort ascending order.

Returns:
Iterator
Throws:
XDBException

getBindings

public Vector getBindings(URI uriFullName)
                   throws XDBException
get the roots which this schema is bound to.

Parameters:
uriFullName -
Returns:
Vector - vRootNames. The rootnames(String) which this schema is bound to. null is returned if this schema is not bound to any root.
Throws:
XDBException


Copyright 2006 Bluestream Database Software Corp. All Rights Reserved.