uk.org.ogsadai.dataresource
Class SimpleXMLDBMetaDataExtractor

java.lang.Object
  |
  +--uk.org.ogsadai.dataresource.MetaDataExtractor
        |
        +--uk.org.ogsadai.dataresource.SimpleXMLDBMetaDataExtractor
All Implemented Interfaces:
PropertyCallback, XMLDBMetaDataExtractor

public class SimpleXMLDBMetaDataExtractor
extends MetaDataExtractor
implements XMLDBMetaDataExtractor

This is a helper class that will assist in the extraction of collection schema from an XMLDB data resource, using an XMLDB collection provider, and the return of this schema in a DOM object.

Author:
The OGSA-DAI Project Team.

Field Summary
static java.lang.String COLLECTION
          Database Schema Element and Attribute Names
static java.lang.String COLLECTION_ATTR_NAME
           
static java.lang.String COLLECTIONS
           
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static DAILogger LOG
          Logger object for logging in this class
private  XMLDBCollectionProvider mCollectionProvider
           
static java.lang.String RESOURCE
           
static java.lang.String RESOURCE_ATTR_ID
           
static java.lang.String RESOURCE_ATTR_TYPE
           
static java.lang.String RESOURCES
           
static java.lang.String SERVICE
           
static java.lang.String SERVICE_ATTR_NAME
           
static java.lang.String SERVICE_ATTR_VERSION
           
static java.lang.String SERVICES
           
 
Fields inherited from class uk.org.ogsadai.dataresource.MetaDataExtractor
mSecurityContext
 
Constructor Summary
SimpleXMLDBMetaDataExtractor()
           
 
Method Summary
private  void addCollections(org.xmldb.api.base.Collection collection, org.w3c.dom.Element elt, org.w3c.dom.Document schema)
          Add to the schema document information on a given collection, recursing on child collections if any.
private  void addResources(org.xmldb.api.base.Collection collection, org.w3c.dom.Element collectionElt, org.w3c.dom.Document schema)
          Add to the schema document information on the resources associated with a given collection.
private  void addServices(org.xmldb.api.base.Collection collection, org.w3c.dom.Element collectionElt, org.w3c.dom.Document schema)
          Add to the schema document information on the services associated with a given collection.
private  java.lang.Object getCollectionSchema(java.lang.String collectionURI, org.xmldb.api.base.Collection collection, javax.xml.namespace.QName name)
          Extracts XMLDB database meta data and places this in a DOM object.
protected  java.lang.Object getMetaData(SecurityContext securityContext, javax.xml.namespace.QName name)
          Gets the meta data using the given security context to access the data resource.
 void setCollectionProvider(XMLDBCollectionProvider collectionProvider)
          Sets the collection provider need to allow the meta data extractor to access the XMLDB collection.
 
Methods inherited from class uk.org.ogsadai.dataresource.MetaDataExtractor
getValue, setSecurityContext, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

LOG

private static DAILogger LOG
Logger object for logging in this class


COLLECTION

public static final java.lang.String COLLECTION
Database Schema Element and Attribute Names

See Also:
Constant Field Values

COLLECTION_ATTR_NAME

public static final java.lang.String COLLECTION_ATTR_NAME
See Also:
Constant Field Values

COLLECTIONS

public static final java.lang.String COLLECTIONS
See Also:
Constant Field Values

SERVICES

public static final java.lang.String SERVICES
See Also:
Constant Field Values

SERVICE

public static final java.lang.String SERVICE
See Also:
Constant Field Values

SERVICE_ATTR_NAME

public static final java.lang.String SERVICE_ATTR_NAME
See Also:
Constant Field Values

SERVICE_ATTR_VERSION

public static final java.lang.String SERVICE_ATTR_VERSION
See Also:
Constant Field Values

RESOURCES

public static final java.lang.String RESOURCES
See Also:
Constant Field Values

RESOURCE

public static final java.lang.String RESOURCE
See Also:
Constant Field Values

RESOURCE_ATTR_ID

public static final java.lang.String RESOURCE_ATTR_ID
See Also:
Constant Field Values

RESOURCE_ATTR_TYPE

public static final java.lang.String RESOURCE_ATTR_TYPE
See Also:
Constant Field Values

mCollectionProvider

private XMLDBCollectionProvider mCollectionProvider
Constructor Detail

SimpleXMLDBMetaDataExtractor

public SimpleXMLDBMetaDataExtractor()
Method Detail

setCollectionProvider

public void setCollectionProvider(XMLDBCollectionProvider collectionProvider)
Description copied from interface: XMLDBMetaDataExtractor
Sets the collection provider need to allow the meta data extractor to access the XMLDB collection.

Specified by:
setCollectionProvider in interface XMLDBMetaDataExtractor
Parameters:
collectionProvider - The XMLDB collection provider.

getMetaData

protected java.lang.Object getMetaData(SecurityContext securityContext,
                                       javax.xml.namespace.QName name)
                                throws MetaDataAuthorizationException,
                                       MetaDataExtractionException
Description copied from class: MetaDataExtractor
Gets the meta data using the given security context to access the data resource.

Specified by:
getMetaData in class MetaDataExtractor
Parameters:
securityContext - User details used to access the data resource.
name - Name of meta data property being sought.
Returns:
an XML serializable object containing the metadata.
Throws:
MetaDataExtractionException - if some problem occurs when extracting the meta data.
MetaDataAuthorizationException - if the user is not authorized to access the data resource meta data.

getCollectionSchema

private java.lang.Object getCollectionSchema(java.lang.String collectionURI,
                                             org.xmldb.api.base.Collection collection,
                                             javax.xml.namespace.QName name)
                                      throws XMLDBCollectionUseException,
                                             ExternalModuleException
Extracts XMLDB database meta data and places this in a DOM object.

Parameters:
collectionURI - URI of base collection.
collection - An object configured to query some database.
name - Qualified name determining the meta-data to be returned.
Returns:
Object a serializable object holding the meta-data (a DOM Element).
Throws:
XMLDBCollectionUseException - if any problems arise in extracting database information.
ExternalModuleException - if a Xerces problem occurs when creating a new DOM document.

addServices

private void addServices(org.xmldb.api.base.Collection collection,
                         org.w3c.dom.Element collectionElt,
                         org.w3c.dom.Document schema)
                  throws org.xmldb.api.base.XMLDBException
Add to the schema document information on the services associated with a given collection.

Parameters:
collection - XMLDB collection.
collectionElt - DOM element to which information is to be added.
schema - Schema document DOM object to which collectionElt belongs.
Throws:
org.xmldb.api.base.XMLDBException - if any problems arise in extracting database information.

addResources

private void addResources(org.xmldb.api.base.Collection collection,
                          org.w3c.dom.Element collectionElt,
                          org.w3c.dom.Document schema)
                   throws org.xmldb.api.base.XMLDBException
Add to the schema document information on the resources associated with a given collection.

Parameters:
collection - XMLDB collection.
collectionElt - DOM element to which information is to be added.
schema - Schema document DOM object to which collectionElt belongs.
Throws:
org.xmldb.api.base.XMLDBException - if any problems arise in extracting database information.

addCollections

private void addCollections(org.xmldb.api.base.Collection collection,
                            org.w3c.dom.Element elt,
                            org.w3c.dom.Document schema)
                     throws org.xmldb.api.base.XMLDBException
Add to the schema document information on a given collection, recursing on child collections if any.

Parameters:
collection - XMLDB collection.
elt - DOM element to which information is to be added.
schema - Schema document DOM object to which elt belongs.
Throws:
org.xmldb.api.base.XMLDBException - if any problems arise in extracting database information.