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:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
public class InstallationDescriptorHandler extends DefaultHandler
TheInstallationDescriptorHandlerclass allows parsing XML installation descriptor files, creating instances of theInstallationDescriptorclass. TheInstallationDescriptorHandlerclass also allows to save existingInstallationDescriptorobjects as XML files.
-
-
Field Summary
-
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(String uri, String localName, String qName)Receive notification of the end of an element.voiderror(SAXParseException ex)XML parser error handler.voidfatalError(SAXParseException ex)XML parser fatal error handler.InstallationDescriptorgetInstallationDescriptor()static 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(File xmlFile)Starts parsing a given XML file.voidparse(InputStream xmlStream)Starts parsing XML content from a given input stream.voidparseInstallationDescriptor(JarFile pearFile)Parses XML installation descriptor automatically extracting it from a given PEAR (JAR) file.static voidprintInstallationDescriptor(InstallationDescriptor insdObject, PrintWriter oWriter)Prints a givenInstallationDescriptorobject in XML format to a givenPrintWriter.voidsaveInstallationDescriptor(File xmlFile)Saves createdInstallationDescriptorobject to a given XML file.static voidsaveInstallationDescriptor(InstallationDescriptor insdObject, File xmlFile)Saves a givenInstallationDescriptorobject in a given XML file.voidstartDocument()Receives notification of the beginning of the document.voidstartElement(String uri, String localName, String qName, Attributes attributes)Receives notification of the start of an element.voidwarning(SAXParseException ex)XML parser warning handler.-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
-
-
-
-
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
-
-
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 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:
IOException- if any I/O exception occurred.
-
printInstallationDescriptor
public static void printInstallationDescriptor(InstallationDescriptor insdObject, PrintWriter oWriter) throws IOException
Prints a givenInstallationDescriptorobject in XML format to a givenPrintWriter.- Parameters:
insdObject- The givenInstallationDescriptorobject.oWriter- The givenPrintWriterobject.- Throws:
IOException- if any I/O exception occurred.
-
saveInstallationDescriptor
public static void saveInstallationDescriptor(InstallationDescriptor insdObject, File xmlFile) throws IOException
Saves a givenInstallationDescriptorobject in a given XML file.- Parameters:
insdObject- The givenInstallationDescriptorobject.xmlFile- The given XML file.- Throws:
IOException- if any I/O exception occurred.
-
characters
public void characters(char[] ch, int start, int length) throws SAXExceptionReceives notification of character data inside an element.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- 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 SAXExceptionReceives notification of the end of the document.- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- 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:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- 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:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
fatalError
public void fatalError(SAXParseException ex) throws SAXException
XML parser fatal error handler.- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Throws:
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(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 createdInstallationDescriptorobject to a given XML file.- Parameters:
xmlFile- The given XML file.- Throws:
IOException- if any I/O exception occurred.
-
startDocument
public void startDocument() throws SAXExceptionReceives notification of the beginning of the document.- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- 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:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- 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:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Throws:
SAXException
-
-