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
TheInstallationDescriptorHandler
class allows parsing XML installation descriptor files, creating instances of theInstallationDescriptor
class. TheInstallationDescriptorHandler
class also allows to save existingInstallationDescriptor
objects 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 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 asInputStream
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 givenInstallationDescriptor
object in XML format to a givenPrintWriter
.void
saveInstallationDescriptor(File xmlFile)
Saves createdInstallationDescriptor
object to a given XML file.static void
saveInstallationDescriptor(InstallationDescriptor insdObject, File xmlFile)
Saves a givenInstallationDescriptor
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
-
-
-
-
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 asInputStream
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 givenInstallationDescriptor
object in XML format to a givenPrintWriter
.- Parameters:
insdObject
- The givenInstallationDescriptor
object.oWriter
- The givenPrintWriter
object.- Throws:
IOException
- if any I/O exception occurred.
-
saveInstallationDescriptor
public static void saveInstallationDescriptor(InstallationDescriptor insdObject, File xmlFile) throws IOException
Saves a givenInstallationDescriptor
object in a given XML file.- Parameters:
insdObject
- The givenInstallationDescriptor
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 interfaceContentHandler
- Overrides:
characters
in 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 SAXException
Receives notification of the end of the document.- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in 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:
endElement
in interfaceContentHandler
- Overrides:
endElement
in 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:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
fatalError
public void fatalError(SAXParseException ex) throws SAXException
XML parser fatal error handler.- Specified by:
fatalError
in interfaceErrorHandler
- Overrides:
fatalError
in classDefaultHandler
- Throws:
SAXException
-
getInstallationDescriptor
public InstallationDescriptor getInstallationDescriptor()
- Returns:
InstallationDescriptor
object 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 createdInstallationDescriptor
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 interfaceContentHandler
- Overrides:
startDocument
in 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:
startElement
in interfaceContentHandler
- Overrides:
startElement
in 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:
warning
in interfaceErrorHandler
- Overrides:
warning
in classDefaultHandler
- Throws:
SAXException
-
-