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:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class InstallationDescriptorHandler
extends 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 String ACTION_TAG
           
static String ARGUMENT_TAG
           
static String CAS_CONSUMER_TAG
           
static String CAS_INITIALIZER_DESC_TAG
           
static String COLLECTION_ITERATOR_DESC_TAG
           
static String COLLECTION_READER_TAG
           
static String COMMENTS_TAG
           
static String DELEGATE_COMPONENT_TAG
           
static String DEPLOYMENT_TAG
           
static String DESC_TAG
           
static String FILE_TAG
           
static String FIND_STRING_TAG
           
static String ID_TAG
           
static String INSTALLATION_TAG
           
static String JDK_VERSION_TAG
           
static String NAME_TAG
           
static String NETWORK_PARAMETERS_TAG
           
static String NETWORK_TAG
           
static String OS_TAG
           
static String PARAMETERS_TAG
           
static String PROCESS_TAG
           
static String REPLACE_WITH_TAG
           
static String ROOT_TAG
           
static String SERVICE_COMMAND_ARGS_TAG
           
static String SERVICE_COMMAND_TAG
           
static String SERVICE_TAG
           
static String SERVICE_WORKING_DIR_TAG
           
static String STANDARD_TAG
           
static String SUBMITTED_COMPONENT_TAG
           
static String TAF_VERSION_TAG
           
static String TOOLKITS_TAG
           
static String UIMA_FRAMEWORK_TAG
           
static String UIMA_VERSION_TAG
           
static String VALUE_TAG
           
static String VAR_NAME_TAG
           
static String VAR_VALUE_TAG
           
static String VERSION_TAG
           
protected static 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(String uri, String localName, String qName)
          Receive notification of the end of an element.
 void error(SAXParseException ex)
          XML parser error handler.
 void fatalError(SAXParseException ex)
          XML parser fatal error handler.
 InstallationDescriptor getInstallationDescriptor()
           
static 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(File xmlFile)
          Starts parsing a given XML file.
 void parse(InputStream xmlStream)
          Starts parsing XML content from a given input stream.
 void parseInstallationDescriptor(JarFile pearFile)
          Parses XML installation descriptor automatically extracting it from a given PEAR (JAR) file.
static void printInstallationDescriptor(InstallationDescriptor insdObject, PrintWriter oWriter)
          Prints a given InstallationDescriptor object in XML format to a given PrintWriter.
 void saveInstallationDescriptor(File xmlFile)
          Saves created InstallationDescriptor object to a given XML file.
static void saveInstallationDescriptor(InstallationDescriptor insdObject, File xmlFile)
          Saves a given InstallationDescriptor object in a given XML file.
 void startDocument()
          Receives notification of the beginning of the document.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          Receives notification of the start of an element.
 void warning(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 String XML_HEADER
See Also:
Constant Field Values

ROOT_TAG

public static final String ROOT_TAG
See Also:
Constant Field Values

OS_TAG

public static final String OS_TAG
See Also:
Constant Field Values

NAME_TAG

public static final String NAME_TAG
See Also:
Constant Field Values

VERSION_TAG

public static final String VERSION_TAG
See Also:
Constant Field Values

TOOLKITS_TAG

public static final String TOOLKITS_TAG
See Also:
Constant Field Values

JDK_VERSION_TAG

public static final String JDK_VERSION_TAG
See Also:
Constant Field Values

UIMA_FRAMEWORK_TAG

public static final String UIMA_FRAMEWORK_TAG
See Also:
Constant Field Values

UIMA_VERSION_TAG

public static final String UIMA_VERSION_TAG
See Also:
Constant Field Values

TAF_VERSION_TAG

public static final String TAF_VERSION_TAG
See Also:
Constant Field Values

SUBMITTED_COMPONENT_TAG

public static final String SUBMITTED_COMPONENT_TAG
See Also:
Constant Field Values

ID_TAG

public static final String ID_TAG
See Also:
Constant Field Values

DESC_TAG

public static final String DESC_TAG
See Also:
Constant Field Values

DEPLOYMENT_TAG

public static final String DEPLOYMENT_TAG
See Also:
Constant Field Values

STANDARD_TAG

public static final String STANDARD_TAG
See Also:
Constant Field Values

SERVICE_TAG

public static final String SERVICE_TAG
See Also:
Constant Field Values

NETWORK_TAG

public static final String NETWORK_TAG
See Also:
Constant Field Values

SERVICE_COMMAND_TAG

public static final String SERVICE_COMMAND_TAG
See Also:
Constant Field Values

SERVICE_WORKING_DIR_TAG

public static final String SERVICE_WORKING_DIR_TAG
See Also:
Constant Field Values

SERVICE_COMMAND_ARGS_TAG

public static final String SERVICE_COMMAND_ARGS_TAG
See Also:
Constant Field Values

ARGUMENT_TAG

public static final String ARGUMENT_TAG
See Also:
Constant Field Values

VALUE_TAG

public static final String VALUE_TAG
See Also:
Constant Field Values

NETWORK_PARAMETERS_TAG

public static final String NETWORK_PARAMETERS_TAG
See Also:
Constant Field Values

COMMENTS_TAG

public static final String COMMENTS_TAG
See Also:
Constant Field Values

COLLECTION_READER_TAG

public static final String COLLECTION_READER_TAG
See Also:
Constant Field Values

COLLECTION_ITERATOR_DESC_TAG

public static final String COLLECTION_ITERATOR_DESC_TAG
See Also:
Constant Field Values

CAS_INITIALIZER_DESC_TAG

public static final String CAS_INITIALIZER_DESC_TAG
See Also:
Constant Field Values

CAS_CONSUMER_TAG

public static final String CAS_CONSUMER_TAG
See Also:
Constant Field Values

INSTALLATION_TAG

public static final String INSTALLATION_TAG
See Also:
Constant Field Values

DELEGATE_COMPONENT_TAG

public static final String DELEGATE_COMPONENT_TAG
See Also:
Constant Field Values

PROCESS_TAG

public static final String PROCESS_TAG
See Also:
Constant Field Values

ACTION_TAG

public static final String ACTION_TAG
See Also:
Constant Field Values

PARAMETERS_TAG

public static final String PARAMETERS_TAG
See Also:
Constant Field Values

FILE_TAG

public static final String FILE_TAG
See Also:
Constant Field Values

FIND_STRING_TAG

public static final String FIND_STRING_TAG
See Also:
Constant Field Values

REPLACE_WITH_TAG

public static final String REPLACE_WITH_TAG
See Also:
Constant Field Values

VAR_NAME_TAG

public static final String VAR_NAME_TAG
See Also:
Constant Field Values

VAR_VALUE_TAG

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

InstallationDescriptorHandler

public InstallationDescriptorHandler()
Method Detail

getInstallationDescriptorAsStream

public static InputStream getInstallationDescriptorAsStream(InstallationDescriptor insdObject)
                                                     throws 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:
IOException - if any I/O exception occurred.

printInstallationDescriptor

public static void printInstallationDescriptor(InstallationDescriptor insdObject,
                                               PrintWriter oWriter)
                                        throws 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:
IOException - if any I/O exception occurred.

saveInstallationDescriptor

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

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

characters

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

Specified by:
characters in interface ContentHandler
Overrides:
characters in class 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:
SAXException - Any SAX exception, possibly wrapping another exception.

endDocument

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

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

endElement

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

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

error

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

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Throws:
SAXException

fatalError

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

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Throws:
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(File xmlFile)
           throws IOException,
                  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:
IOException - Any I/O exception.
SAXException - Any SAX exception, possibly wrapping another exception.

parse

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

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

parseInstallationDescriptor

public void parseInstallationDescriptor(JarFile pearFile)
                                 throws IOException,
                                        SAXException
Parses XML installation descriptor automatically extracting it from a given PEAR (JAR) file.

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

saveInstallationDescriptor

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

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

startDocument

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

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

startElement

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

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class 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:
SAXException - Any SAX exception, possibly wrapping another exception.

warning

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

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Throws:
SAXException


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.