org.ipdr.common
Class Descriptor

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

public class Descriptor
extends java.lang.Object

This class will generate an object of CompositeType from schema file. Implements interfaces ContentHandler, XMLReader and ErrorHandler of SAX package of Xerces Parser for Java.


Field Summary
protected  DescriptorContentHandler contentHandler_
          Object of DescriptorContentHandler class.
protected  CompositeDescriptorElement ipdrBaseElement_
          To store the IPDR Base Element.
static java.lang.String MANDATORY
          String containing "Mandatory".
static java.lang.String OPTIONAL
          String containing "Optional".
protected  java.lang.String PARSER_STRING
          String containing the SAX parser class name.
protected  java.lang.String servType_
          To store the Service Type.
protected  boolean setDerivedTypeFlag_
          Flag to indicate parseSchema is called without optional attributes.
protected  java.lang.String targetNameSpace_
          To store the Target NameSpace.
 
Constructor Summary
Descriptor()
           
 
Method Summary
 OpenType[] createOpenTypes(java.util.ArrayList schemaArray)
          This mehtod creates an array of OpenType objects corresponding to the list of schema elements passed to it.
 CompositeType generateDescriptor(java.lang.String[] uriArray)
          This method is used to take the schema whose URL is passed as input parameter and returns a CompositeType object.
 DescriptorContentHandler getContentHandler()
          Method to get the DescriptorContentHandler class
 java.lang.String getIPDRVersion()
          Method to get the IPDR Version
 java.lang.String getServType()
          Method to get the Service Type.
 java.lang.String getTargetNameSpace()
          Method to get the Target NameSpace.
 java.util.ArrayList parseSchema(java.lang.String uri)
          This method is called by descriptorGeneration() method to parse the schema and returns an object of ArrayList.
 java.util.ArrayList parseSchema(java.lang.String uri, java.lang.String[] selectedOptionalAttributes)
          This method is called by descriptorGeneration() method to parse the schema and returns an object of ArrayList.
protected  void registerParser(java.lang.String uri)
          This method is called by parseSchema() method to register SAX API This method returns nothing.
 void setIPDRVersion(java.lang.String ver)
          Method to set the IPDR Version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIONAL

public static final java.lang.String OPTIONAL
String containing "Optional".

See Also:
Constant Field Values

MANDATORY

public static final java.lang.String MANDATORY
String containing "Mandatory".

See Also:
Constant Field Values

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

contentHandler_

protected DescriptorContentHandler contentHandler_
Object of DescriptorContentHandler class.


servType_

protected java.lang.String servType_
To store the Service Type.


targetNameSpace_

protected java.lang.String targetNameSpace_
To store the Target NameSpace.


setDerivedTypeFlag_

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


ipdrBaseElement_

protected CompositeDescriptorElement ipdrBaseElement_
To store the IPDR Base Element.

Constructor Detail

Descriptor

public Descriptor()
Method Detail

getServType

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

Returns:
The Service Type

getTargetNameSpace

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

Returns:
The Target NameSpace

getContentHandler

public DescriptorContentHandler getContentHandler()
Method to get the DescriptorContentHandler class

Returns:
The DescriptorContentHandler

getIPDRVersion

public java.lang.String getIPDRVersion()
Method to get the IPDR Version

Returns:
The IPDR Version

setIPDRVersion

public void setIPDRVersion(java.lang.String ver)
Method to set the IPDR Version

Parameters:
ver - The IPDR Version

generateDescriptor

public CompositeType generateDescriptor(java.lang.String[] uriArray)
                                 throws IPDRException,
                                        org.xml.sax.SAXException,
                                        java.io.IOException,
                                        BadCompositeException
This method is used to take the schema whose URL is passed as input parameter and returns a CompositeType object. parseSchema() method is called and input uri string is passed to this method which in turn returns an object of ArrayList. This Arraylist object is passed to createOpenType() method which returns an array of OpenType objects. By passing this array of OpenType objects to CompositeType constructor, object of CompositeType is returned.

Parameters:
uriArray - URIs of files to parse.
Returns:
The CompositeType Object.
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
BadCompositeException - when an exception occurs during the creation of the Composite Type object

parseSchema

public java.util.ArrayList parseSchema(java.lang.String uri)
                                throws IPDRException,
                                       org.xml.sax.SAXException,
                                       java.io.IOException
This method is called by descriptorGeneration() method to parse the schema and returns an object of ArrayList. Input uri is passed to registerParser() method which parse the schema.

Parameters:
uri - URI of file to parse.
Returns:
ArrayList of Attributes
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

parseSchema

public java.util.ArrayList parseSchema(java.lang.String uri,
                                       java.lang.String[] selectedOptionalAttributes)
                                throws IPDRException,
                                       org.xml.sax.SAXException,
                                       java.io.IOException
This method is called by descriptorGeneration() method to parse the schema and returns an object of ArrayList. Input uri is passed to registerParser() method which parse the schema.

Parameters:
uri - URI of file to parse.
Returns:
ArrayList of Attributes
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 This method returns nothing.

Parameters:
uri - URI of file to parse.
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

createOpenTypes

public OpenType[] createOpenTypes(java.util.ArrayList schemaArray)
                           throws IPDRException,
                                  BadCompositeException
This mehtod creates an array of OpenType objects corresponding to the list of schema elements passed to it.

Parameters:
schemaArray - List of Schema Elements
Returns:
Array of OpenType objects
Throws:
IPDRException - when a IPDR functionality related exception occurs
BadCompositeException - when an exception occurs during the creation of the Composite Type object