uk.ac.bbk.dcs.automed.xml.wrappers
Class XMLWrapperFactory

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedWrapperFactory
      extended by uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapperFactory
Direct Known Subclasses:
DOMWrapperFactory, NXDBWrapperFactory, SAXWrapperFactory

public abstract class XMLWrapperFactory
extends AutoMedWrapperFactory

XMLWrapperFactory class. Contains a switch that tells the wrappers produced by the factory class to validate the XML file against a referenced schema. Nevertheless, this class also contains switches for controlling whitespace if the validating switch is off but whitespace control is still needed.

Author:
Lucas Zamboulis

Field Summary
protected  java.util.logging.Logger _logger
           
private  java.lang.String accompSchemaRootName
           
private  java.lang.String accompSchemaURI
           
private  Construct attribute
           
private  Construct element
           
private  Construct elementRel
           
private static java.lang.String emptyConstraint
           
static int EXTRACT_FROM_DATA_USING_DOM
           
static int EXTRACT_FROM_DATA_USING_SAX
           
static int EXTRACT_FROM_DTD
           
static int EXTRACT_FROM_XML_SCHEMA
           
private static java.lang.String[] featureNames
          Array of feature names, in order such that selecting the first one will imply bit zero of the feature number, the second will imply bit one of the feature number, etc.
private  Construct text
           
private  Model xml
           
protected  int xmldssExtractionMethod
           
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapperFactory
modelDef
 
Constructor Summary
XMLWrapperFactory()
          Creates a new XMLWrapperFactory and sets the model name.
 
Method Summary
 Schema createAutoMedSchema(AutoMedWrapper wrapper, java.lang.String schemaName)
          Create an AutoMed oriented schema from the source oriented schema.
 java.lang.String getAccompanyingSchemaRootName()
           
 java.lang.String getAccompanyingSchemaURI()
           
 Model getAutoMedModel()
          Return the AutoMed oriented Model used to represent the Schema of the datasource.
 java.lang.String[] getFeatureNames()
          Return a string list of features supported by this wrapper, where the first one is bit zero in the feature bit map, second bit one, etc
 Model getModel()
          Return the source oriented Model used to represent the Schema of the datasource.
(package private)  SchemaObject getTextSO(Schema sch)
           
 int getXMLDSSExtractionMethod()
           
(package private)  void insert(org.w3c.dom.Node currentNode, SchemaObject parentElementSO, Schema AMXMLSchema)
          Inserts the XML datasource schema in the repository using the AutoMed XML Model .
(package private)  void insertXMLDSS(XMLWrapper xw)
          Inserts the XML datasource schema in the repository using the AutoMed XML Model.
protected  AutoMedWrapper newAutoMedWrapper()
          Create a new empty wrapper instance that this wrapper factory is then able to populate.
protected  void populateSchema(AutoMedWrapper wrapper)
          Read the metadata from the wrapper connection, and store in existing Schema within the wrapper.
 void setAccompanyingSchemaRootName(java.lang.String rootName)
           
 void setAccompanyingSchemaURI(java.lang.String uri)
           
 void setXMLDSSExtractionMethod(int method)
           
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapperFactory
getAttributeDomains, getModelDefinition, safeIQL, setAttributeDomains, setModelDefinition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected java.util.logging.Logger _logger

element

private Construct element

attribute

private Construct attribute

elementRel

private Construct elementRel

text

private Construct text

xml

private Model xml

accompSchemaURI

private java.lang.String accompSchemaURI

accompSchemaRootName

private java.lang.String accompSchemaRootName

emptyConstraint

private static java.lang.String emptyConstraint

xmldssExtractionMethod

protected int xmldssExtractionMethod

featureNames

private static final java.lang.String[] featureNames
Array of feature names, in order such that selecting the first one will imply bit zero of the feature number, the second will imply bit one of the feature number, etc.


EXTRACT_FROM_DATA_USING_DOM

public static final int EXTRACT_FROM_DATA_USING_DOM
See Also:
Constant Field Values

EXTRACT_FROM_DATA_USING_SAX

public static final int EXTRACT_FROM_DATA_USING_SAX
See Also:
Constant Field Values

EXTRACT_FROM_XML_SCHEMA

public static final int EXTRACT_FROM_XML_SCHEMA
See Also:
Constant Field Values

EXTRACT_FROM_DTD

public static final int EXTRACT_FROM_DTD
See Also:
Constant Field Values
Constructor Detail

XMLWrapperFactory

public XMLWrapperFactory()
Creates a new XMLWrapperFactory and sets the model name.

Method Detail

getFeatureNames

public final java.lang.String[] getFeatureNames()
Return a string list of features supported by this wrapper, where the first one is bit zero in the feature bit map, second bit one, etc


setAccompanyingSchemaURI

public void setAccompanyingSchemaURI(java.lang.String uri)

getAccompanyingSchemaURI

public java.lang.String getAccompanyingSchemaURI()

setAccompanyingSchemaRootName

public void setAccompanyingSchemaRootName(java.lang.String rootName)

getAccompanyingSchemaRootName

public java.lang.String getAccompanyingSchemaRootName()

setXMLDSSExtractionMethod

public void setXMLDSSExtractionMethod(int method)

getXMLDSSExtractionMethod

public int getXMLDSSExtractionMethod()

newAutoMedWrapper

protected AutoMedWrapper newAutoMedWrapper()
Description copied from class: AutoMedWrapperFactory
Create a new empty wrapper instance that this wrapper factory is then able to populate.

Specified by:
newAutoMedWrapper in class AutoMedWrapperFactory

getModel

public final Model getModel()
Description copied from class: AutoMedWrapperFactory
Return the source oriented Model used to represent the Schema of the datasource. For some wrappers, this may be the same as AutoMed oriented Model returned by AutoMedWrapperFactory.getAutoMedModel()

Specified by:
getModel in class AutoMedWrapperFactory

getAutoMedModel

public final Model getAutoMedModel()
Description copied from class: AutoMedWrapperFactory
Return the AutoMed oriented Model used to represent the Schema of the datasource.

Specified by:
getAutoMedModel in class AutoMedWrapperFactory

createAutoMedSchema

public final Schema createAutoMedSchema(AutoMedWrapper wrapper,
                                        java.lang.String schemaName)
Description copied from class: AutoMedWrapperFactory
Create an AutoMed oriented schema from the source oriented schema.

Specified by:
createAutoMedSchema in class AutoMedWrapperFactory
Parameters:
wrapper - A wrapper containing the source oriented Schema from which the AutoMed oriented Schema should be produced.
schemaName - name of the new AutoMed construct oriented schema that is to be created from the source oriented schema. This schema must not yet exist.

populateSchema

protected void populateSchema(AutoMedWrapper wrapper)
Description copied from class: AutoMedWrapperFactory
Read the metadata from the wrapper connection, and store in existing Schema within the wrapper. To be called by AutoMedWrapper instances as part of the wrapper creation process.

Specified by:
populateSchema in class AutoMedWrapperFactory

insertXMLDSS

void insertXMLDSS(XMLWrapper xw)
            throws NotFoundException,
                   XMLNotFoundException
Inserts the XML datasource schema in the repository using the AutoMed XML Model. Uses the internal SAX tree that was created by method XMLDSS#extractModel(Node currentNode).

Parameters:
schema - the AutoMed schema in which the XML datasource schema will be inserted via the XML Model constructs
Throws:
NotFoundException
XMLNotFoundException

insert

final void insert(org.w3c.dom.Node currentNode,
                  SchemaObject parentElementSO,
                  Schema AMXMLSchema)
Inserts the XML datasource schema in the repository using the AutoMed XML Model .

Parameters:
currentNode - the root of the XML datasource schema
parentElement - should always be null - used internally for recursion

getTextSO

final SchemaObject getTextSO(Schema sch)