Package org.apache.uima.pear.tools
Class InstallationDescriptorHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- 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.DefaultHandlerTheInstallationDescriptorHandlerclass allows parsing XML installation descriptor files, creating instances of theInstallationDescriptorclass. TheInstallationDescriptorHandlerclass also allows to save existingInstallationDescriptorobjects as XML files.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACTION_TAGstatic java.lang.StringARGUMENT_TAGstatic java.lang.StringCAS_CONSUMER_TAGstatic java.lang.StringCAS_INITIALIZER_DESC_TAGstatic java.lang.StringCOLLECTION_ITERATOR_DESC_TAGstatic java.lang.StringCOLLECTION_READER_TAGstatic java.lang.StringCOMMENTS_TAGstatic java.lang.StringDELEGATE_COMPONENT_TAGstatic java.lang.StringDEPLOYMENT_TAGstatic java.lang.StringDESC_TAGstatic java.lang.StringFILE_TAGstatic java.lang.StringFIND_STRING_TAGstatic java.lang.StringID_TAGstatic java.lang.StringINSTALLATION_TAGstatic java.lang.StringJDK_VERSION_TAGstatic java.lang.StringNAME_TAGstatic java.lang.StringNETWORK_PARAMETERS_TAGstatic java.lang.StringNETWORK_TAGstatic java.lang.StringOS_TAGstatic java.lang.StringPARAMETERS_TAGstatic java.lang.StringPROCESS_TAGstatic java.lang.StringREPLACE_WITH_TAGstatic java.lang.StringROOT_TAGstatic java.lang.StringSERVICE_COMMAND_ARGS_TAGstatic java.lang.StringSERVICE_COMMAND_TAGstatic java.lang.StringSERVICE_TAGstatic java.lang.StringSERVICE_WORKING_DIR_TAGstatic java.lang.StringSTANDARD_TAGstatic java.lang.StringSUBMITTED_COMPONENT_TAGstatic java.lang.StringTAF_VERSION_TAGstatic java.lang.StringTOOLKITS_TAGstatic java.lang.StringUIMA_FRAMEWORK_TAGstatic java.lang.StringUIMA_VERSION_TAGstatic java.lang.StringVALUE_TAGstatic java.lang.StringVAR_NAME_TAGstatic java.lang.StringVAR_VALUE_TAGstatic java.lang.StringVERSION_TAGprotected static java.lang.StringXML_HEADER
-
Constructor Summary
Constructors Constructor Description InstallationDescriptorHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)Receives notification of character data inside an element.voidendDocument()Receives notification of the end of the document.voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)Receive notification of the end of an element.voiderror(org.xml.sax.SAXParseException ex)XML parser error handler.voidfatalError(org.xml.sax.SAXParseException ex)XML parser fatal error handler.InstallationDescriptorgetInstallationDescriptor()static java.io.InputStreamgetInstallationDescriptorAsStream(InstallationDescriptor insdObject)Returns the content of the installation descriptor XML file for a given intallation descriptor object asInputStreamobject (for use in Eclipse plug-in).voidparse(java.io.File xmlFile)Starts parsing a given XML file.voidparse(java.io.InputStream xmlStream)Starts parsing XML content from a given input stream.voidparseInstallationDescriptor(java.util.jar.JarFile pearFile)Parses XML installation descriptor automatically extracting it from a given PEAR (JAR) file.static voidprintInstallationDescriptor(InstallationDescriptor insdObject, java.io.PrintWriter oWriter)Prints a givenInstallationDescriptorobject in XML format to a givenPrintWriter.voidsaveInstallationDescriptor(java.io.File xmlFile)Saves createdInstallationDescriptorobject to a given XML file.static voidsaveInstallationDescriptor(InstallationDescriptor insdObject, java.io.File xmlFile)Saves a givenInstallationDescriptorobject in a given XML file.voidstartDocument()Receives notification of the beginning of the document.voidstartElement(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.voidwarning(org.xml.sax.SAXParseException ex)XML parser warning handler.
-
-
-
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
-
-
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 asInputStreamobject (for use in Eclipse plug-in).- Parameters:
insdObject- The given intallation descriptor object.- Returns:
- The
InputStreamobject 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 givenInstallationDescriptorobject in XML format to a givenPrintWriter.- Parameters:
insdObject- The givenInstallationDescriptorobject.oWriter- The givenPrintWriterobject.- 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 givenInstallationDescriptorobject in a given XML file.- Parameters:
insdObject- The givenInstallationDescriptorobject.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.SAXExceptionReceives notification of character data inside an element.- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin classorg.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.SAXExceptionReceives notification of the end of the document.- Specified by:
endDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
endDocumentin classorg.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.SAXExceptionReceive notification of the end of an element.- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classorg.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.SAXExceptionXML parser error handler.- Specified by:
errorin interfaceorg.xml.sax.ErrorHandler- Overrides:
errorin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException
-
fatalError
public void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXExceptionXML parser fatal error handler.- Specified by:
fatalErrorin interfaceorg.xml.sax.ErrorHandler- Overrides:
fatalErrorin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException
-
getInstallationDescriptor
public InstallationDescriptor getInstallationDescriptor()
- Returns:
InstallationDescriptorobject after the installation descriptor file has been loaded, ornull, if the file was not loaded.
-
parse
public void parse(java.io.File xmlFile) throws java.io.IOException, org.xml.sax.SAXExceptionStarts 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.SAXExceptionStarts 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.SAXExceptionParses 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.IOExceptionSaves createdInstallationDescriptorobject 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.SAXExceptionReceives notification of the beginning of the document.- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin classorg.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.SAXExceptionReceives notification of the start of an element.- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classorg.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.SAXExceptionXML parser warning handler.- Specified by:
warningin interfaceorg.xml.sax.ErrorHandler- Overrides:
warningin classorg.xml.sax.helpers.DefaultHandler- Throws:
org.xml.sax.SAXException
-
-