org.opennms.protocols.xml.collector
Class AbstractXmlCollectionHandler

java.lang.Object
  extended by org.opennms.protocols.xml.collector.AbstractXmlCollectionHandler
All Implemented Interfaces:
XmlCollectionHandler
Direct Known Subclasses:
DefaultXmlCollectionHandler, Sftp3gppXmlCollectionHandler

public abstract class AbstractXmlCollectionHandler
extends Object
implements XmlCollectionHandler

The Abstract Class XML Collection Handler.

All XmlCollectionHandler should extend this class.

Author:
Alejandro Galue

Constructor Summary
AbstractXmlCollectionHandler()
           
 
Method Summary
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.
 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(String urlString)
          Gets the XML document.
protected  XmlResourceType getXmlResourceType(CollectionAgent agent, String resourceType)
          Gets the XML resource type.
protected  ThreadCategory log()
          Log.
protected  String parseUrl(String unformattedUrl, CollectionAgent agent, Integer collectionStep)
          Parses the URL.
protected abstract  void processXmlResource(XmlCollectionResource collectionResource, AttributeGroupType attribGroupType)
          Process XML resource.
 void setRrdRepository(RrdRepository m_rrdRepository)
          Sets the RRD repository.
 void setServiceName(String serviceName)
          Sets the service name associated with this Collection Handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opennms.protocols.xml.collector.XmlCollectionHandler
collect
 

Constructor Detail

AbstractXmlCollectionHandler

public AbstractXmlCollectionHandler()
Method Detail

setServiceName

public void setServiceName(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

setRrdRepository

public void setRrdRepository(RrdRepository m_rrdRepository)
Description copied from interface: XmlCollectionHandler
Sets the RRD repository.

Specified by:
setRrdRepository in interface XmlCollectionHandler
Parameters:
m_rrdRepository - the new RRD repository

getServiceName

public 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,
                                 XmlCollectionSet collectionSet,
                                 XmlSource source,
                                 Document doc)
                          throws XPathExpressionException,
                                 ParseException
Fill collection set.

Parameters:
agent - the agent
collectionSet - the collection set
source - the source
doc - the doc
Throws:
XPathExpressionException - the x path expression exception
ParseException - the parse exception

processXmlResource

protected abstract void processXmlResource(XmlCollectionResource collectionResource,
                                           AttributeGroupType attribGroupType)
Process XML resource.

Parameters:
collectionResource - the collection resource
attribGroupType - the attribute group type

getCollectionResource

protected XmlCollectionResource getCollectionResource(CollectionAgent agent,
                                                      String instance,
                                                      String resourceType,
                                                      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 Date getTimeStamp(Document doc,
                            XPath xpath,
                            XmlGroup group)
                     throws XPathExpressionException
Gets the time stamp.

Parameters:
doc - the doc
xpath - the xpath
group - the group
Returns:
the time stamp
Throws:
XPathExpressionException - the x path expression exception

parseUrl

protected String parseUrl(String unformattedUrl,
                          CollectionAgent agent,
                          Integer collectionStep)
Parses the URL.

Valid placeholders are:

Parameters:
unformattedUrl - the unformatted URL
agent - the collection agent
collectionStep - the collection step (in seconds)
Returns:
the string

getXmlDocument

protected Document getXmlDocument(String urlString)
Gets the XML document.

Parameters:
urlString - the URL string
Returns:
the XML document

getXmlResourceType

protected XmlResourceType getXmlResourceType(CollectionAgent agent,
                                             String resourceType)
Gets the XML resource type.

Parameters:
agent - the collection agent
resourceType - the resource type
Returns:
the XML resource type

log

protected ThreadCategory log()
Log.

Returns:
the thread category


Copyright © 2011. All Rights Reserved.