org.apache.uima.pear.tools
Class InstallationDescriptorHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.uima.pear.tools.InstallationDescriptorHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class InstallationDescriptorHandler
extends org.xml.sax.helpers.DefaultHandler

The InstallationDescriptorHandler class allows parsing XML installation descriptor files, creating instances of the InstallationDescriptor class. The InstallationDescriptorHandler class also allows to save existing InstallationDescriptor objects as XML files.


Field Summary
static java.lang.String ACTION_TAG
           
static java.lang.String ARGUMENT_TAG
           
static java.lang.String CAS_CONSUMER_TAG
           
static java.lang.String CAS_INITIALIZER_DESC_TAG
           
static java.lang.String COLLECTION_ITERATOR_DESC_TAG
           
static java.lang.String COLLECTION_READER_TAG
           
static java.lang.String COMMENTS_TAG
           
static java.lang.String DELEGATE_COMPONENT_TAG
           
static java.lang.String DEPLOYMENT_TAG
           
static java.lang.String DESC_TAG
           
static java.lang.String FILE_TAG
           
static java.lang.String FIND_STRING_TAG
           
static java.lang.String ID_TAG
           
static java.lang.String INSTALLATION_TAG
           
static java.lang.String JDK_VERSION_TAG
           
static java.lang.String NAME_TAG
           
static java.lang.String NETWORK_PARAMETERS_TAG
           
static java.lang.String NETWORK_TAG
           
static java.lang.String OS_TAG
           
static java.lang.String PARAMETERS_TAG
           
static java.lang.String PROCESS_TAG
           
static java.lang.String REPLACE_WITH_TAG
           
static java.lang.String ROOT_TAG
           
static java.lang.String SERVICE_COMMAND_ARGS_TAG
           
static java.lang.String SERVICE_COMMAND_TAG
           
static java.lang.String SERVICE_TAG
           
static java.lang.String SERVICE_WORKING_DIR_TAG
           
static java.lang.String STANDARD_TAG
           
static java.lang.String SUBMITTED_COMPONENT_TAG
           
static java.lang.String TAF_VERSION_TAG
           
static java.lang.String TOOLKITS_TAG
           
static java.lang.String UIMA_FRAMEWORK_TAG
           
static java.lang.String UIMA_VERSION_TAG
           
static java.lang.String VALUE_TAG
           
static java.lang.String VAR_NAME_TAG
           
static java.lang.String VAR_VALUE_TAG
           
static java.lang.String VERSION_TAG
           
protected static java.lang.String XML_HEADER
           
 
Constructor Summary
InstallationDescriptorHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receives notification of character data inside an element.
 void endDocument()
          Receives notification of the end of the document.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Receive notification of the end of an element.
 void error(org.xml.sax.SAXParseException ex)
          XML parser error handler.
 void fatalError(org.xml.sax.SAXParseException ex)
          XML parser fatal error handler.
 InstallationDescriptor getInstallationDescriptor()
           
static java.io.InputStream getInstallationDescriptorAsStream(InstallationDescriptor insdObject)
          Returns the content of the installation descriptor XML file for a given intallation descriptor object as InputStream object (for use in Eclipse plug-in).
 void parse(java.io.File xmlFile)
          Starts parsing a given XML file.
 void parse(java.io.InputStream xmlStream)
          Starts parsing XML content from a given input stream.
 void parseInstallationDescriptor(java.util.jar.JarFile pearFile)
          Parses XML installation descriptor automatically extracting it from a given PEAR (JAR) file.
static void printInstallationDescriptor(InstallationDescriptor insdObject, java.io.PrintWriter oWriter)
          Prints a given InstallationDescriptor object in XML format to a given PrintWriter.
 void saveInstallationDescriptor(java.io.File xmlFile)
          Saves created InstallationDescriptor object to a given XML file.
static void saveInstallationDescriptor(InstallationDescriptor insdObject, java.io.File xmlFile)
          Saves a given InstallationDescriptor object in a given XML file.
 void startDocument()
          Receives notification of the beginning of the document.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          Receives notification of the start of an element.
 void warning(org.xml.sax.SAXParseException ex)
          XML parser warning handler.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_HEADER

protected static final java.lang.String XML_HEADER
See Also:
Constant Field Values

ROOT_TAG

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

OS_TAG

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

NAME_TAG

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

VERSION_TAG

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

TOOLKITS_TAG

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

JDK_VERSION_TAG

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

UIMA_FRAMEWORK_TAG

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

UIMA_VERSION_TAG

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

TAF_VERSION_TAG

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

SUBMITTED_COMPONENT_TAG

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

ID_TAG

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

DESC_TAG

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

DEPLOYMENT_TAG

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

STANDARD_TAG

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

SERVICE_TAG

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

NETWORK_TAG

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

SERVICE_COMMAND_TAG

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

SERVICE_WORKING_DIR_TAG

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

SERVICE_COMMAND_ARGS_TAG

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

ARGUMENT_TAG

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

VALUE_TAG

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

NETWORK_PARAMETERS_TAG

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

COMMENTS_TAG

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

COLLECTION_READER_TAG

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

COLLECTION_ITERATOR_DESC_TAG

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

CAS_INITIALIZER_DESC_TAG

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

CAS_CONSUMER_TAG

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

INSTALLATION_TAG

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

DELEGATE_COMPONENT_TAG

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

PROCESS_TAG

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

ACTION_TAG

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

PARAMETERS_TAG

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

FILE_TAG

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

FIND_STRING_TAG

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

REPLACE_WITH_TAG

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

VAR_NAME_TAG

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

VAR_VALUE_TAG

public static final java.lang.String VAR_VALUE_TAG
See Also:
Constant Field Values
Constructor Detail

InstallationDescriptorHandler

public InstallationDescriptorHandler()
Method Detail

getInstallationDescriptorAsStream

public static java.io.InputStream getInstallationDescriptorAsStream(InstallationDescriptor insdObject)
                                                             throws java.io.IOException
Returns the content of the installation descriptor XML file for a given intallation descriptor object as InputStream object (for use in Eclipse plug-in).

Parameters:
insdObject - The given intallation descriptor object.
Returns:
The InputStream object that contains the content of the installation descriptor XML file.
Throws:
java.io.IOException - if any I/O exception occurred.

printInstallationDescriptor

public static void printInstallationDescriptor(InstallationDescriptor insdObject,
                                               java.io.PrintWriter oWriter)
                                        throws java.io.IOException
Prints a given InstallationDescriptor object in XML format to a given PrintWriter.

Parameters:
insdObject - The given InstallationDescriptor object.
oWriter - The given PrintWriter object.
Throws:
java.io.IOException - if any I/O exception occurred.

saveInstallationDescriptor

public static void saveInstallationDescriptor(InstallationDescriptor insdObject,
                                              java.io.File xmlFile)
                                       throws java.io.IOException
Saves a given InstallationDescriptor object in a given XML file.

Parameters:
insdObject - The given InstallationDescriptor object.
xmlFile - The given XML file.
Throws:
java.io.IOException - if any I/O exception occurred.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receives notification of character data inside an element.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receives notification of the end of the document.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The element URI.
localName - The element type name.
qName - The qualified name of the element.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

error

public void error(org.xml.sax.SAXParseException ex)
           throws org.xml.sax.SAXException
XML parser error handler.

Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException ex)
                throws org.xml.sax.SAXException
XML parser fatal error handler.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

getInstallationDescriptor

public InstallationDescriptor getInstallationDescriptor()
Returns:
InstallationDescriptor object after the installation descriptor file has been loaded, or null, if the file was not loaded.

parse

public void parse(java.io.File xmlFile)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Starts parsing a given XML file. After parsing is completed, the application may access parsing results using convenient methods.

Parameters:
xmlFile - The given XML file.
Throws:
java.io.IOException - Any I/O exception.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

parse

public void parse(java.io.InputStream xmlStream)
           throws java.io.IOException,
                  org.xml.sax.SAXException
Starts parsing XML content from a given input stream.

Parameters:
xmlStream - The given XML input stream.
Throws:
java.io.IOException - if any I/O exception occurred.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

parseInstallationDescriptor

public void parseInstallationDescriptor(java.util.jar.JarFile pearFile)
                                 throws java.io.IOException,
                                        org.xml.sax.SAXException
Parses XML installation descriptor automatically extracting it from a given PEAR (JAR) file.

Parameters:
pearFile - The given PEAR (JAR) file.
Throws:
java.io.IOException - if any I/O exception occurred.
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

saveInstallationDescriptor

public void saveInstallationDescriptor(java.io.File xmlFile)
                                throws java.io.IOException
Saves created InstallationDescriptor object to a given XML file.

Parameters:
xmlFile - The given XML file.
Throws:
java.io.IOException - if any I/O exception occurred.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receives notification of the beginning of the document.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Receives notification of the start of an element.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - The element URI.
localName - The element type name.
qName - The qualified name of the element.
attributes - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

warning

public void warning(org.xml.sax.SAXParseException ex)
             throws org.xml.sax.SAXException
XML parser warning handler.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException


Copyright © 2012. All Rights Reserved.