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.
|
XmlCollectionSet |
collect(CollectionAgent agent,
XmlDataCollection collection,
Map<String,Object> parameters)
Collect.
|
protected void |
fillCollectionSet(CollectionAgent agent,
XmlCollectionSet collectionSet,
XmlSource source,
Document doc)
Fill collection set.
|
protected abstract void |
fillCollectionSet(String urlString,
Request request,
CollectionAgent agent,
XmlCollectionSet collectionSet,
XmlSource source)
Fill collection set.
|
protected Map<String,String> |
filterParameters(Map<String,Object> input)
Filter out blacklisted key/values out from an input Map.
|
protected XmlCollectionResource |
getCollectionResource(CollectionAgent agent,
String instance,
String resourceType,
Date timestamp)
Gets the collection resource.
|
NodeDao |
getNodeDao()
Gets the Node DAO.
|
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.
|
protected XmlResourceType |
getXmlResourceType(CollectionAgent agent,
String resourceType)
Gets the XML resource type.
|
protected Request |
parseRequest(Request unformattedRequest,
CollectionAgent agent,
Integer collectionStep,
Map<String,String> parameters)
Parses the request.
|
protected String |
parseString(String reference,
String unformattedString,
OnmsNode node,
String ipAddress,
Integer collectionStep,
Map<String,String> parameters)
Parses the string.
|
protected String |
parseUrl(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(XmlCollectionResource collectionResource,
AttributeGroupType attribGroupType)
Process XML resource.
|
void |
setNodeDao(NodeDao nodeDao)
Sets the Node DAO.
|
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 NodeDao getNodeDao()
public void setNodeDao(NodeDao nodeDao)
nodeDao - the new Node DAOpublic XmlCollectionSet 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, XmlCollectionSet collectionSet, 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, XmlCollectionSet collectionSet, XmlSource source) throws Exception
urlString - the URL stringrequest - the requestagent - the collection agentcollectionSet - the collection setsource - the XML sourceException - the exceptionprotected abstract void processXmlResource(XmlCollectionResource collectionResource, AttributeGroupType attribGroupType)
collectionResource - the collection resourceattribGroupType - the attribute group typeprotected XmlCollectionResource 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 exceptionprotected String parseUrl(String unformattedUrl, CollectionAgent agent, Integer collectionStep, Map<String,String> parameters) throws IllegalArgumentException
Additional placeholders:
unformattedUrl - the unformatted URLagent - the collection agentcollectionStep - the collection step (in seconds)parameters - the service parametersIllegalArgumentException - the illegal argument exceptionprotected Request parseRequest(Request unformattedRequest, CollectionAgent agent, Integer collectionStep, Map<String,String> parameters) throws IllegalArgumentException
unformattedRequest - the unformatted requestagent - the agentcollectionStep - the collection stepparameters - the service parametersIllegalArgumentException - the illegal argument exceptionprotected 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.protected XmlResourceType getXmlResourceType(CollectionAgent agent, String resourceType)
agent - the collection agentresourceType - the resource typeCopyright © 2020. All rights reserved.