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.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
Fields Modifier and Type Field Description private InstallationDescriptor.ActionInfo
_activeAction
private InstallationDescriptor.ArgInfo
_activeArg
private java.lang.StringBuffer
_activeBuffer
private java.lang.String
_activeComponentId
private java.lang.String
_activeSection
private InstallationDescriptor.ServiceInfo
_activeService
private java.lang.String
_activeSubSection
private boolean
_insdLoaded
private InstallationDescriptor
_insdObject
private java.lang.String
_mainTag
private javax.xml.parsers.SAXParser
_parser
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
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(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 asInputStream
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 givenInstallationDescriptor
object in XML format to a givenPrintWriter
.void
saveInstallationDescriptor(java.io.File xmlFile)
Saves createdInstallationDescriptor
object to a given XML file.static void
saveInstallationDescriptor(InstallationDescriptor insdObject, java.io.File xmlFile)
Saves a givenInstallationDescriptor
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.
-
-
-
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
-
_parser
private javax.xml.parsers.SAXParser _parser
-
_activeBuffer
private java.lang.StringBuffer _activeBuffer
-
_mainTag
private java.lang.String _mainTag
-
_insdObject
private InstallationDescriptor _insdObject
-
_activeSection
private java.lang.String _activeSection
-
_activeSubSection
private java.lang.String _activeSubSection
-
_activeComponentId
private java.lang.String _activeComponentId
-
_activeAction
private InstallationDescriptor.ActionInfo _activeAction
-
_activeService
private InstallationDescriptor.ServiceInfo _activeService
-
_activeArg
private InstallationDescriptor.ArgInfo _activeArg
-
_insdLoaded
private boolean _insdLoaded
-
-
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 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:
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 givenInstallationDescriptor
object in XML format to a givenPrintWriter
.- Parameters:
insdObject
- The givenInstallationDescriptor
object.oWriter
- The givenPrintWriter
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 givenInstallationDescriptor
object in a given XML file.- Parameters:
insdObject
- The givenInstallationDescriptor
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 interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in 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.SAXException
Receives notification of the end of the document.- Specified by:
endDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endDocument
in 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.SAXException
Receive notification of the end of an element.- Specified by:
endElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in 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.SAXException
XML parser error handler.- Specified by:
error
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
error
in classorg.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 interfaceorg.xml.sax.ErrorHandler
- Overrides:
fatalError
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.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(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 createdInstallationDescriptor
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 interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in 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.SAXException
Receives notification of the start of an element.- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in 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.SAXException
XML parser warning handler.- Specified by:
warning
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
warning
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
-