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 void |
fillCollectionSet(CollectionAgent agent,
XmlCollectionSet collectionSet,
XmlSource source,
Document doc)
Fill collection set.
|
protected XmlCollectionResource |
getCollectionResource(CollectionAgent agent,
String instance,
String resourceType,
Date timestamp)
Gets the collection resource.
|
NodeDao |
getNodeDao()
Gets the Node DAO.
|
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 ThreadCategory |
log()
Log.
|
protected Request |
parseRequest(Request unformattedRequest,
CollectionAgent agent)
Parses the request.
|
protected String |
parseString(String reference,
String unformattedString,
OnmsNode node,
String ipAddress)
Parses the string.
|
protected String |
parseUrl(String unformattedUrl,
CollectionAgent agent,
Integer collectionStep)
Parses the URL.
|
protected abstract void |
processXmlResource(XmlCollectionResource collectionResource,
AttributeGroupType attribGroupType)
Process XML resource.
|
void |
setNodeDao(NodeDao nodeDao)
Sets the Node DAO.
|
void |
setRrdRepository(RrdRepository rrdRepository)
Sets the RRD repository.
|
void |
setServiceName(String serviceName)
Sets the service name associated with this Collection Handler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
collect
public void setServiceName(String serviceName)
XmlCollectionHandler
setServiceName
in interface XmlCollectionHandler
serviceName
- the new service namepublic void setRrdRepository(RrdRepository rrdRepository)
XmlCollectionHandler
setRrdRepository
in interface XmlCollectionHandler
rrdRepository
- the new RRD repositorypublic String getServiceName()
public RrdRepository getRrdRepository()
public NodeDao getNodeDao()
public void setNodeDao(NodeDao nodeDao)
nodeDao
- the new Node DAOprotected 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 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) throws IllegalArgumentException
Additional placeholders:
unformattedUrl
- the unformatted URLagent
- the collection agentcollectionStep
- the collection step (in seconds)IllegalArgumentException
- the illegal argument exceptionprotected Request parseRequest(Request unformattedRequest, CollectionAgent agent) throws IllegalArgumentException
unformattedRequest
- the unformatted requestagent
- the agentIllegalArgumentException
- the illegal argument exceptionprotected String parseString(String reference, String unformattedString, OnmsNode node, String ipAddress) throws IllegalArgumentException
Valid placeholders are:
reference
- the referenceunformattedString
- the unformatted stringnode
- the nodeipAddress
- the IP addressIllegalArgumentException
- the illegal argument exceptionprotected Document getXmlDocument(String urlString, Request request)
urlString
- the URL stringrequest
- the requestprotected Document getXmlDocument(InputStream is, Request request)
is
- the input streamrequest
- the requestprotected XmlResourceType getXmlResourceType(CollectionAgent agent, String resourceType)
agent
- the collection agentresourceType
- the resource typeprotected ThreadCategory log()
Copyright © 2015. All Rights Reserved.