public abstract class AbstractXmlCollectionHandler extends Object implements XmlCollectionHandler
All XmlCollectionHandler should extend this class.
| Constructor and Description | 
|---|
AbstractXmlCollectionHandler()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected InputStream | 
applyXsltTransformation(Request request,
                       InputStream is)
Apply XSLT transformation. 
 | 
CollectionSet | 
collect(CollectionAgent agent,
       XmlDataCollection collection,
       Map<String,Object> parameters)
Collect. 
 | 
protected void | 
fillCollectionSet(CollectionAgent agent,
                 CollectionSetBuilder builder,
                 XmlSource source,
                 Document doc)
Fill collection set. 
 | 
protected abstract void | 
fillCollectionSet(String urlString,
                 Request request,
                 CollectionAgent agent,
                 CollectionSetBuilder builder,
                 XmlSource source)
Fill collection set. 
 | 
protected Resource | 
getCollectionResource(CollectionAgent agent,
                     String instance,
                     String resourceType,
                     Date timestamp)
Gets the collection resource. 
 | 
ResourceStorageDao | 
getResourceStorageDao()  | 
RrdRepository | 
getRrdRepository()
Gets the RRD repository. 
 | 
String | 
getServiceName()
Gets the service name. 
 | 
protected Date | 
getTimeStamp(Document doc,
            XPath xpath,
            XmlGroup group)
Gets the time stamp. 
 | 
protected Document | 
getXmlDocument(InputStream is,
              Request request)
Gets the XML document. 
 | 
protected Document | 
getXmlDocument(String urlString,
              Request request)
Gets the XML document. 
 | 
Request | 
parseRequest(NodeDao nodeDao,
            Request unformattedRequest,
            CollectionAgent agent,
            Integer collectionStep,
            Map<String,String> parameters)
Parses the request. 
 | 
protected static String | 
parseString(String reference,
           String unformattedString,
           OnmsNode node,
           String ipAddress,
           Integer collectionStep,
           Map<String,String> parameters)
Parses the string. 
 | 
String | 
parseUrl(NodeDao nodeDao,
        String unformattedUrl,
        CollectionAgent agent,
        Integer collectionStep,
        Map<String,String> parameters)
Parses the URL. 
 | 
protected InputStream | 
preProcessHtml(Request request,
              InputStream is)
Pre-process HTML. 
 | 
protected abstract void | 
processXmlResource(CollectionSetBuilder builder,
                  Resource collectionResource,
                  String resourceTypeName,
                  String group)
Process XML resource. 
 | 
void | 
setResourceStorageDao(ResourceStorageDao resourceStorageDao)  | 
void | 
setRrdRepository(RrdRepository rrdRepository)
Sets the RRD repository. 
 | 
void | 
setServiceName(String serviceName)
Sets the service name associated with this Collection Handler. 
 | 
public ResourceStorageDao getResourceStorageDao()
public void setResourceStorageDao(ResourceStorageDao resourceStorageDao)
public void setServiceName(String serviceName)
XmlCollectionHandlersetServiceName in interface XmlCollectionHandlerserviceName - the new service namepublic void setRrdRepository(RrdRepository rrdRepository)
XmlCollectionHandlersetRrdRepository in interface XmlCollectionHandlerrrdRepository - the new RRD repositorypublic String getServiceName()
public RrdRepository getRrdRepository()
public CollectionSet collect(CollectionAgent agent, XmlDataCollection collection, Map<String,Object> parameters) throws CollectionException
XmlCollectionHandlercollect in interface XmlCollectionHandleragent - the collection agentcollection - the XML collection configurationparameters - the collector parametersCollectionException - the collection exceptionprotected void fillCollectionSet(CollectionAgent agent, CollectionSetBuilder builder, XmlSource source, Document doc) throws XPathExpressionException, ParseException
agent - the agentcollectionSet - the collection setsource - the sourcedoc - the docXPathExpressionException - the x path expression exceptionParseException - the parse exceptionprotected abstract void fillCollectionSet(String urlString, Request request, CollectionAgent agent, CollectionSetBuilder builder, XmlSource source) throws Exception
urlString - the URL stringrequest - the requestagent - the collection agentcollectionSet - the collection setsource - the XML sourceException - the exceptionprotected abstract void processXmlResource(CollectionSetBuilder builder, Resource collectionResource, String resourceTypeName, String group)
collectionResource - the collection resourceattribGroupType - the attribute group typeprotected Resource getCollectionResource(CollectionAgent agent, String instance, String resourceType, Date timestamp)
agent - the collection agentinstance - the resource instanceresourceType - the resource typetimestamp - the timestampprotected Date getTimeStamp(Document doc, XPath xpath, XmlGroup group) throws XPathExpressionException
doc - the docxpath - the xpathgroup - the groupXPathExpressionException - the x path expression exceptionpublic String parseUrl(NodeDao nodeDao, String unformattedUrl, CollectionAgent agent, Integer collectionStep, Map<String,String> parameters) throws IllegalArgumentException
Additional placeholders:
parseUrl in interface XmlCollectionHandlerunformattedUrl - the unformatted URLagent - the collection agentcollectionStep - the collection step (in seconds)parameters - the service parametersIllegalArgumentException - the illegal argument exceptionpublic Request parseRequest(NodeDao nodeDao, Request unformattedRequest, CollectionAgent agent, Integer collectionStep, Map<String,String> parameters) throws IllegalArgumentException
parseRequest in interface XmlCollectionHandlerunformattedRequest - the unformatted requestagent - the agentcollectionStep - the collection stepparameters - the service parametersIllegalArgumentException - the illegal argument exceptionprotected static String parseString(String reference, String unformattedString, OnmsNode node, String ipAddress, Integer collectionStep, Map<String,String> parameters) throws IllegalArgumentException
Valid placeholders are:
reference - the referenceunformattedString - the unformatted stringnode - the nodeipAddress - the IP addresscollectionStep - the collection stepparameters - the service parametersIllegalArgumentException - the illegal argument exceptionprotected Document getXmlDocument(String urlString, Request request) throws Exception
urlString - the URL stringrequest - the requestException - the exceptionprotected Document getXmlDocument(InputStream is, Request request) throws Exception
is - the input streamrequest - the requestException - the exceptionprotected InputStream applyXsltTransformation(Request request, InputStream is) throws Exception
request - the requestis - the input streamException - the exceptionprotected InputStream preProcessHtml(Request request, InputStream is) throws IOException
request - the requestis - the input streamIOException - Signals that an I/O exception has occurred.Copyright © 2021. All rights reserved.