Class 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
    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.
    • Constructor Detail

      • InstallationDescriptorHandler

        public InstallationDescriptorHandler()
    • 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 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:
        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 given InstallationDescriptor object in XML format to a given PrintWriter.
        Parameters:
        insdObject - The given InstallationDescriptor object.
        oWriter - The given PrintWriter 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 given InstallationDescriptor object in a given XML file.
        Parameters:
        insdObject - The given InstallationDescriptor 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 interface org.xml.sax.ContentHandler
        Overrides:
        characters in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        endDocument in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.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 interface org.xml.sax.ErrorHandler
        Overrides:
        error in class org.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 interface org.xml.sax.ErrorHandler
        Overrides:
        fatalError in class org.xml.sax.helpers.DefaultHandler
        Throws:
        org.xml.sax.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​(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 created InstallationDescriptor 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 interface org.xml.sax.ContentHandler
        Overrides:
        startDocument in class org.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 interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.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 interface org.xml.sax.ErrorHandler
        Overrides:
        warning in class org.xml.sax.helpers.DefaultHandler
        Throws:
        org.xml.sax.SAXException