org.ipdr.common
Class Schema

java.lang.Object
  extended by org.ipdr.common.Schema

public class Schema
extends java.lang.Object

This class is added for schema processing, creating schema object. schemaValidationFlag_ is maintained internally by the schema class. Value of this flag can't be changed by the calling application. This will be set to TRUE only when schemaLookup_ is populated properly (with out any exception) using setSchemaData() method.


Field Summary
protected  SchemaContentHandler contentHandler_
          Object of SchemaContentHandler class.
protected  java.lang.String defaultNameSpace_
          This will contain the Default NameSpace as passed in setSchemaData() method.
protected  CompositeSchemaElement ipdrBaseElement_
          To store the IPDR Base Element.
protected  NameSpaceInfo[] otherNameSpaces_
          This will contain the Other NameSpaces as passed in setSchemaData() method.
protected  java.lang.String[] parsedSchemaArray_
          Array to store the parsed Schema URIs.
protected  java.lang.String PARSER_STRING
          String containing the SAX parser class name.
protected  boolean reloadSchemaFlag_
          Flag indicating reload schema.
protected  java.lang.String[] schemaServiceDefURIs_
          This will contain the Service Definition URIs as passed in setSchemaData() method.
protected  boolean schemaValidationFlag_
          This flag will contain "true" or "false" value on the basis of which validateAgainstSchema() method will be called.
protected  java.lang.String schemaVersion_
          String containing the IPDR version obtained from Schema.
protected  java.lang.String servType_
          String contianing the Service Type of Schema.
protected  boolean setDerivedTypeFlag_
          Flag to indicate parseSchema is called without optional attributes.
 boolean settlementDoc_
          Flag indicating Settlement Doc.
protected  java.lang.String targetNameSpace_
          String contianing the Target NameSpace of Schema
 
Constructor Summary
Schema()
          Constructor.
 
Method Summary
 SchemaContentHandler getContentHandler()
          Method to get the object of SchemaContentHandler class.
 java.lang.String getDefaultNameSpaceURI()
          Method to get the Default NameSpace URI.
 CompositeSchemaElement getIPDRBaseElement()
          Method to get the HashMap of element names and their corresponding OpenType objects.
 NameSpaceInfo[] getOtherNameSpaces()
          Method to get the Other NameSpaces.
 boolean getSchemaValidationFlag()
          This method returns the state of Schema Validation Flag.
 java.lang.String getSchemaVersion()
          Method to get the IPDR Version obtained from the schema.
 java.lang.String[] getServiceDefinitionURIs()
          Method to get the schema's Service Definition URIs.
 java.lang.String getServType()
          Method to get the Service Type value.
 java.lang.String getTargetNameSpace()
          Method to get the Target Namespace value.
 boolean isSettlementDoc()
          Method to find out if the base schema is a Settlement Document schema.
 java.util.ArrayList parseSchema(java.lang.String uri)
          This method parses the schema and returns an list of Schema Elements.
protected  void registerParser(java.lang.String uri)
          This method is called by parseSchema() method to register SAX API.
 void setSchemaData(NameSpaceInfo[] otherNameSpaces, java.lang.String[] serviceDefinitionURIs, java.lang.String defaultNameSpaceURI)
          This method populates the Schema Lookups HashMap.
 boolean testURI(java.lang.String[] servDefURI)
          This method checks for presence of current set of URIs in the previous set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSER_STRING

protected final java.lang.String PARSER_STRING
String containing the SAX parser class name. Used while registering the parser.

See Also:
Constant Field Values

schemaValidationFlag_

protected boolean schemaValidationFlag_
This flag will contain "true" or "false" value on the basis of which validateAgainstSchema() method will be called.


ipdrBaseElement_

protected CompositeSchemaElement ipdrBaseElement_
To store the IPDR Base Element.


otherNameSpaces_

protected NameSpaceInfo[] otherNameSpaces_
This will contain the Other NameSpaces as passed in setSchemaData() method.


schemaServiceDefURIs_

protected java.lang.String[] schemaServiceDefURIs_
This will contain the Service Definition URIs as passed in setSchemaData() method.


defaultNameSpace_

protected java.lang.String defaultNameSpace_
This will contain the Default NameSpace as passed in setSchemaData() method.


reloadSchemaFlag_

protected boolean reloadSchemaFlag_
Flag indicating reload schema.


settlementDoc_

public boolean settlementDoc_
Flag indicating Settlement Doc.


parsedSchemaArray_

protected java.lang.String[] parsedSchemaArray_
Array to store the parsed Schema URIs.


schemaVersion_

protected java.lang.String schemaVersion_
String containing the IPDR version obtained from Schema.


contentHandler_

protected SchemaContentHandler contentHandler_
Object of SchemaContentHandler class.


servType_

protected java.lang.String servType_
String contianing the Service Type of Schema.


targetNameSpace_

protected java.lang.String targetNameSpace_
String contianing the Target NameSpace of Schema


setDerivedTypeFlag_

protected boolean setDerivedTypeFlag_
Flag to indicate parseSchema is called without optional attributes.

Constructor Detail

Schema

public Schema()
Constructor. This sets the Schema Validation Flag to false and clears the HashMap that stores the Schema Lookups.

Method Detail

getServType

public java.lang.String getServType()
Method to get the Service Type value.

Returns:
The Service Type

getTargetNameSpace

public java.lang.String getTargetNameSpace()
Method to get the Target Namespace value.

Returns:
The Target NameSpace

getContentHandler

public SchemaContentHandler getContentHandler()
Method to get the object of SchemaContentHandler class.

Returns:
The ContentHandler

getOtherNameSpaces

public NameSpaceInfo[] getOtherNameSpaces()
Method to get the Other NameSpaces.

Returns:
The Other NameSpaces

getServiceDefinitionURIs

public java.lang.String[] getServiceDefinitionURIs()
Method to get the schema's Service Definition URIs.

Returns:
The Service Definition URIs

getDefaultNameSpaceURI

public java.lang.String getDefaultNameSpaceURI()
Method to get the Default NameSpace URI.

Returns:
the Default NameSpace URI

getIPDRBaseElement

public CompositeSchemaElement getIPDRBaseElement()
Method to get the HashMap of element names and their corresponding OpenType objects.

Returns:
The Schema Lookup

getSchemaVersion

public java.lang.String getSchemaVersion()
Method to get the IPDR Version obtained from the schema.

Returns:
IPDR Version

isSettlementDoc

public boolean isSettlementDoc()
Method to find out if the base schema is a Settlement Document schema. It returns 'true' if Settlement Doc, else it returns 'false'.

Returns:
'true' if Settlement Doc, else 'false'.

getSchemaValidationFlag

public boolean getSchemaValidationFlag()
This method returns the state of Schema Validation Flag.

Returns:
The Schema Validation Flag

setSchemaData

public void setSchemaData(NameSpaceInfo[] otherNameSpaces,
                          java.lang.String[] serviceDefinitionURIs,
                          java.lang.String defaultNameSpaceURI)
                   throws IPDRException,
                          org.xml.sax.SAXException
This method populates the Schema Lookups HashMap. It sets the values of Other NameSpaces and Service Definition URIs. It parses the Service Definition schemas and store the attribute name, type and presence (required or optional). The attribute name belonging to default namespace will be present as just the attributeName. The attribute names belonging to other namespaces will have nameSpace Id:attributeName stored in the Schema Lookups HashMap. It sets Schema Validation Flag to true after successful completion of its functionality. (this flag will not be exposed to calling application).

Parameters:
otherNameSpaces - array of Other NameSpaces
serviceDefinitionURIs - array of Service Definition URIs
defaultNameSpaceURI - the Default NameSpace URI
Throws:
IPDRException - when a IPDR functionality related exception occurs
org.xml.sax.SAXException - when an exception occurs during parsing

parseSchema

public java.util.ArrayList parseSchema(java.lang.String uri)
                                throws IPDRException,
                                       org.xml.sax.SAXException,
                                       java.io.IOException
This method parses the schema and returns an list of Schema Elements.

Parameters:
uri - URI of file to parse
Returns:
list of Schema Elements
Throws:
IPDRException - when a IPDR functionality related exception occurs
org.xml.sax.SAXException - when an exception occurs during parsing
java.io.IOException - when an exception occurs during IO

registerParser

protected void registerParser(java.lang.String uri)
                       throws IPDRException,
                              org.xml.sax.SAXException,
                              java.io.IOException
This method is called by parseSchema() method to register SAX API.

Parameters:
uri - URI of file to parse
Throws:
IPDRException
org.xml.sax.SAXException
java.io.IOException

testURI

public boolean testURI(java.lang.String[] servDefURI)
                throws IPDRException
This method checks for presence of current set of URIs in the previous set.

Parameters:
servDefURI - String Array of URIs to parse.
Returns:
Reload Schema Flag
Throws:
IPDRException - when a IPDR functionality related exception occurs