Class AbstractXmlCollectionHandler

    • Constructor Detail

      • AbstractXmlCollectionHandler

        public AbstractXmlCollectionHandler()
    • Method Detail

      • setResourceStorageDao

        public void setResourceStorageDao​(ResourceStorageDao resourceStorageDao)
      • getBlobStore

        public BlobStore getBlobStore()
      • setBlobStore

        public void setBlobStore​(BlobStore blobStore)
      • setServiceName

        public void setServiceName​(java.lang.String serviceName)
        Description copied from interface: XmlCollectionHandler
        Sets the service name associated with this Collection Handler.
        Specified by:
        setServiceName in interface XmlCollectionHandler
        Parameters:
        serviceName - the new service name
      • getServiceName

        public java.lang.String getServiceName()
        Gets the service name.
        Returns:
        the service name
      • getRrdRepository

        public RrdRepository getRrdRepository()
        Gets the RRD repository.
        Returns:
        the RRD repository
      • fillCollectionSet

        protected void fillCollectionSet​(CollectionAgent agent,
                                         CollectionSetBuilder builder,
                                         XmlSource source,
                                         org.w3c.dom.Document doc)
                                  throws javax.xml.xpath.XPathExpressionException,
                                         java.text.ParseException
        Fill collection set.
        Parameters:
        agent - the agent
        collectionSet - the collection set
        source - the source
        doc - the doc
        Throws:
        javax.xml.xpath.XPathExpressionException - the x path expression exception
        java.text.ParseException - the parse exception
      • fillCollectionSet

        protected abstract void fillCollectionSet​(java.lang.String urlString,
                                                  Request request,
                                                  CollectionAgent agent,
                                                  CollectionSetBuilder builder,
                                                  XmlSource source)
                                           throws java.lang.Exception
        Fill collection set.
        Parameters:
        urlString - the URL string
        request - the request
        agent - the collection agent
        collectionSet - the collection set
        source - the XML source
        Throws:
        java.lang.Exception - the exception
      • processXmlResource

        protected abstract void processXmlResource​(CollectionSetBuilder builder,
                                                   Resource collectionResource,
                                                   java.lang.String resourceTypeName,
                                                   java.lang.String group)
        Process XML resource.
        Parameters:
        collectionResource - the collection resource
        attribGroupType - the attribute group type
      • getCollectionResource

        protected Resource getCollectionResource​(CollectionAgent agent,
                                                 java.lang.String instance,
                                                 java.lang.String resourceType,
                                                 java.util.Date timestamp)
        Gets the collection resource.
        Parameters:
        agent - the collection agent
        instance - the resource instance
        resourceType - the resource type
        timestamp - the timestamp
        Returns:
        the collection resource
      • getTimeStamp

        protected java.util.Date getTimeStamp​(org.w3c.dom.Document doc,
                                              javax.xml.xpath.XPath xpath,
                                              XmlGroup group)
                                       throws javax.xml.xpath.XPathExpressionException
        Gets the time stamp.
        Parameters:
        doc - the doc
        xpath - the xpath
        group - the group
        Returns:
        the time stamp
        Throws:
        javax.xml.xpath.XPathExpressionException - the x path expression exception
      • parseUrl

        public java.lang.String parseUrl​(NodeDao nodeDao,
                                         java.lang.String unformattedUrl,
                                         CollectionAgent agent,
                                         java.lang.Integer collectionStep,
                                         java.util.Map<java.lang.String,​java.lang.String> parameters)
                                  throws java.lang.IllegalArgumentException
        Parses the URL.

        Additional placeholders:

        • step, The Collection Step in seconds
        Specified by:
        parseUrl in interface XmlCollectionHandler
        Parameters:
        unformattedUrl - the unformatted URL
        agent - the collection agent
        collectionStep - the collection step (in seconds)
        parameters - the service parameters
        Returns:
        the string
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception
      • parseRequest

        public Request parseRequest​(NodeDao nodeDao,
                                    Request unformattedRequest,
                                    CollectionAgent agent,
                                    java.lang.Integer collectionStep,
                                    java.util.Map<java.lang.String,​java.lang.String> parameters)
                             throws java.lang.IllegalArgumentException
        Parses the request.
        Specified by:
        parseRequest in interface XmlCollectionHandler
        Parameters:
        unformattedRequest - the unformatted request
        agent - the agent
        collectionStep - the collection step
        parameters - the service parameters
        Returns:
        the request
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception
      • parseString

        protected static java.lang.String parseString​(java.lang.String reference,
                                                      java.lang.String unformattedString,
                                                      OnmsNode node,
                                                      java.lang.String ipAddress,
                                                      java.lang.Integer collectionStep,
                                                      java.util.Map<java.lang.String,​java.lang.String> parameters)
                                               throws java.lang.IllegalArgumentException
        Parses the string.

        Valid placeholders are:

        • ipAddr|ipAddress, The Node IP Address
        • step, The Collection Step in seconds
        • nodeId, The Node ID
        • nodeLabel, The Node Label
        • foreignId, The Node Foreign ID
        • foreignSource, The Node Foreign Source
        • Any asset property defined on the node.
        Parameters:
        reference - the reference
        unformattedString - the unformatted string
        node - the node
        ipAddress - the IP address
        collectionStep - the collection step
        parameters - the service parameters
        Returns:
        the string
        Throws:
        java.lang.IllegalArgumentException - the illegal argument exception
      • getXmlDocument

        protected org.w3c.dom.Document getXmlDocument​(java.lang.String urlString,
                                                      Request request)
                                               throws java.lang.Exception
        Gets the XML document.
        Parameters:
        urlString - the URL string
        request - the request
        Returns:
        the XML document
        Throws:
        java.lang.Exception - the exception
      • getXmlDocument

        protected org.w3c.dom.Document getXmlDocument​(java.io.InputStream is,
                                                      Request request)
                                               throws java.lang.Exception
        Gets the XML document.
        Parameters:
        is - the input stream
        request - the request
        Returns:
        the XML document
        Throws:
        java.lang.Exception - the exception
      • applyXsltTransformation

        protected java.io.InputStream applyXsltTransformation​(Request request,
                                                              java.io.InputStream is)
                                                       throws java.lang.Exception
        Apply XSLT transformation.
        Parameters:
        request - the request
        is - the input stream
        Returns:
        the input stream
        Throws:
        java.lang.Exception - the exception
      • preProcessHtml

        protected java.io.InputStream preProcessHtml​(Request request,
                                                     java.io.InputStream is)
                                              throws java.io.IOException
        Pre-process HTML.
        Parameters:
        request - the request
        is - the input stream
        Returns:
        the updated input stream
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.