Class AbstractCollectionResource
- java.lang.Object
-
- org.opennms.netmgt.collection.support.AbstractCollectionResource
-
- All Implemented Interfaces:
CollectionResource,CollectionVisitable,Persistable,ResourceIdentifier
public abstract class AbstractCollectionResource extends Object implements CollectionResource
A base class forCollectionResourceobjects, 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 CollectionAgentm_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 protectedAbstractCollectionResource(CollectionAgent agent)Constructor for AbstractCollectionResource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(CollectionAttribute attr)Adds the given attribute into the collection for this resourceAttributeGroupgetGroup(AttributeGroupType groupType)Finds, or creates, and returns the AttributeGroup for the given group TypeStringgetInterfaceLabel()getInterfaceLabelStringgetOwnerName()getOwnerNameResourcePathgetParent()Returns the name of the parent resource.ResourcePathgetPath()Retrieves path for the resource, relative to the root of the associatedRrdRepository.TimeKeepergetTimeKeeper()Returns a not-nullTimeKeeperinstance when this resource requires to use a special timestamp when updating RRDs/JRBs.booleanrescanNeeded()rescanNeededbooleanshouldPersist(ServiceParameters params)Resources should be persisted by default.voidvisit(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- aCollectionAgentobject.
-
-
Method Detail
-
getOwnerName
public final String getOwnerName()
getOwnerName
- Specified by:
getOwnerNamein interfaceResourceIdentifier- Returns:
- a
Stringobject.
-
getPath
public ResourcePath getPath()
Retrieves path for the resource, relative to the root of the associatedRrdRepository.- Specified by:
getPathin interfaceResourceIdentifier- Returns:
ResourcePathobject.
-
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- aAttributeGroupTypeobject.- Returns:
- a
AttributeGroupobject.
-
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:
visitin interfaceCollectionVisitable- Parameters:
visitor- aCollectionSetVisitorobject.
-
getParent
public final ResourcePath getParent()
Description copied from interface:CollectionResourceReturns the name of the parent resource.- Specified by:
getParentin interfaceCollectionResource- Returns:
- a
Stringobject.
-
rescanNeeded
public final boolean rescanNeeded()
rescanNeeded
- Specified by:
rescanNeededin interfaceCollectionResource- Returns:
- a boolean.
-
shouldPersist
public boolean shouldPersist(ServiceParameters params)
Resources should be persisted by default. Returns true.- Specified by:
shouldPersistin interfacePersistable- Parameters:
params- aServiceParametersobject.- Returns:
- a boolean.
-
getInterfaceLabel
public String getInterfaceLabel()
getInterfaceLabel
- Specified by:
getInterfaceLabelin interfaceCollectionResource- Returns:
- a
Stringobject.
-
getTimeKeeper
public TimeKeeper getTimeKeeper()
Description copied from interface:CollectionResourceReturns a not-nullTimeKeeperinstance when this resource requires to use a special timestamp when updating RRDs/JRBs. If the resource doesn't need a specialTimeKeeperit should return null.- Specified by:
getTimeKeeperin interfaceCollectionResource- Returns:
- Returns null to indicate that
DefaultTimeKeepershould be used.
-
-