Class AbstractCollectionResource
- java.lang.Object
-
- org.opennms.netmgt.collection.support.AbstractCollectionResource
-
- All Implemented Interfaces:
CollectionResource
,CollectionVisitable
,Persistable
,ResourceIdentifier
public abstract class AbstractCollectionResource extends java.lang.Object implements CollectionResource
A base class forCollectionResource
objects, implementing common features (to reduce repeated code). Typically used by the non-SNMP collectors (SNMP has it's own set of classes for this). Provides a basic set of attributes. Provides support, viaaddAttribute(CollectionAttribute)
andgetGroup(AttributeGroupType)
for basic "groups" of attributes. Also provides a sample "visit" implementation based on those groups, although this may well be overridden by subclasses.
-
-
Field Summary
Fields Modifier and Type Field Description protected CollectionAgent
m_agent
-
Fields inherited from interface org.opennms.netmgt.collection.api.CollectionResource
RESOURCE_TYPE_IF, RESOURCE_TYPE_LATENCY, RESOURCE_TYPE_NODE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCollectionResource(CollectionAgent agent)
Constructor for AbstractCollectionResource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(CollectionAttribute attr)
Adds the given attribute into the collection for this resourceAttributeGroup
getGroup(AttributeGroupType groupType)
Finds, or creates, and returns the AttributeGroup for the given group Typejava.lang.String
getInterfaceLabel()
getInterfaceLabeljava.lang.String
getOwnerName()
getOwnerNameResourcePath
getParent()
Returns the name of the parent resource.ResourcePath
getPath()
Retrieves path for the resource, relative to the root of the associatedRrdRepository
.TimeKeeper
getTimeKeeper()
Returns a not-nullTimeKeeper
instance when this resource requires to use a special timestamp when updating RRDs/JRBs.boolean
rescanNeeded()
rescanNeededboolean
shouldPersist(ServiceParameters params)
Resources should be persisted by default.void
visit(CollectionSetVisitor visitor)
Provide a way to visit all the values in the CollectionSet, for any appropriate purposes (persisting, thresholding, or others) The expectation is that calling this method will ultimately call visitResource, visitGroup and visitAttribute (as appropriate)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.collection.api.CollectionResource
getInstance, getResourceTypeName, getUnmodifiedInstance
-
-
-
-
Field Detail
-
m_agent
protected final CollectionAgent m_agent
-
-
Constructor Detail
-
AbstractCollectionResource
protected AbstractCollectionResource(CollectionAgent agent)
Constructor for AbstractCollectionResource.
- Parameters:
agent
- aCollectionAgent
object.
-
-
Method Detail
-
getOwnerName
public final java.lang.String getOwnerName()
getOwnerName
- Specified by:
getOwnerName
in interfaceResourceIdentifier
- Returns:
- a
String
object.
-
getPath
public ResourcePath getPath()
Retrieves path for the resource, relative to the root of the associatedRrdRepository
.- Specified by:
getPath
in interfaceResourceIdentifier
- Returns:
ResourcePath
object.
-
addAttribute
public final void addAttribute(CollectionAttribute attr)
Adds the given attribute into the collection for this resource- Parameters:
attr
- The Attribute to add
-
getGroup
public final AttributeGroup getGroup(AttributeGroupType groupType)
Finds, or creates, and returns the AttributeGroup for the given group Type- Parameters:
groupType
- aAttributeGroupType
object.- Returns:
- a
AttributeGroup
object.
-
visit
public void visit(CollectionSetVisitor visitor)
Provide a way to visit all the values in the CollectionSet, for any appropriate purposes (persisting, thresholding, or others) The expectation is that calling this method will ultimately call visitResource, visitGroup and visitAttribute (as appropriate)- Specified by:
visit
in interfaceCollectionVisitable
- Parameters:
visitor
- aCollectionSetVisitor
object.
-
getParent
public final ResourcePath getParent()
Description copied from interface:CollectionResource
Returns the name of the parent resource.- Specified by:
getParent
in interfaceCollectionResource
- Returns:
- a
String
object.
-
rescanNeeded
public final boolean rescanNeeded()
rescanNeeded
- Specified by:
rescanNeeded
in interfaceCollectionResource
- Returns:
- a boolean.
-
shouldPersist
public boolean shouldPersist(ServiceParameters params)
Resources should be persisted by default. Returns true.- Specified by:
shouldPersist
in interfacePersistable
- Parameters:
params
- aServiceParameters
object.- Returns:
- a boolean.
-
getInterfaceLabel
public java.lang.String getInterfaceLabel()
getInterfaceLabel
- Specified by:
getInterfaceLabel
in interfaceCollectionResource
- Returns:
- a
String
object.
-
getTimeKeeper
public TimeKeeper getTimeKeeper()
Description copied from interface:CollectionResource
Returns a not-nullTimeKeeper
instance when this resource requires to use a special timestamp when updating RRDs/JRBs. If the resource doesn't need a specialTimeKeeper
it should return null.- Specified by:
getTimeKeeper
in interfaceCollectionResource
- Returns:
- Returns null to indicate that
DefaultTimeKeeper
should be used.
-
-