Class CollectionResourceWrapper
- java.lang.Object
-
- org.opennms.netmgt.collection.support.CollectionResourceWrapper
-
- All Implemented Interfaces:
CollectionResource
,CollectionVisitable
,Persistable
,ResourceIdentifier
public class CollectionResourceWrapper extends Object implements CollectionResource
Delegates the visit calls to the wrapped resource. Allows individual functions to be intercepted.- Author:
- jwhite
-
-
Field Summary
-
Fields inherited from interface org.opennms.netmgt.collection.api.CollectionResource
RESOURCE_TYPE_IF, RESOURCE_TYPE_LATENCY, RESOURCE_TYPE_NODE
-
-
Constructor Summary
Constructors Constructor Description CollectionResourceWrapper(CollectionResource wrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getInstance()
Returns the name of the instance thisCollectionResource
represents.String
getInterfaceLabel()
Returns a unique label for each resource depending on resource type.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
.String
getResourceTypeName()
Returns a string which indicates what type of resource.TimeKeeper
getTimeKeeper()
Returns a not-nullTimeKeeper
instance when this resource requires to use a special timestamp when updating RRDs/JRBs.String
getUnmodifiedInstance()
Returns the unmodified instance string thisCollectionResource
represents.boolean
rescanNeeded()
rescanNeededboolean
shouldPersist(ServiceParameters params)
Determines whether the attribute should be persisted.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)
-
-
-
Constructor Detail
-
CollectionResourceWrapper
public CollectionResourceWrapper(CollectionResource wrapped)
-
-
Method Detail
-
getOwnerName
public 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.
-
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.
-
shouldPersist
public boolean shouldPersist(ServiceParameters params)
Determines whether the attribute should be persisted.- Specified by:
shouldPersist
in interfacePersistable
- Parameters:
params
- aServiceParameters
object.- Returns:
- a boolean.
-
rescanNeeded
public boolean rescanNeeded()
rescanNeeded
- Specified by:
rescanNeeded
in interfaceCollectionResource
- Returns:
- a boolean.
-
getResourceTypeName
public String getResourceTypeName()
Returns a string which indicates what type of resource. Will be one of "node" for the node level resource "if" for network interface resources "*" for all other resource types defined in the relevant config files, e.g. hrStorage- Specified by:
getResourceTypeName
in interfaceCollectionResource
- Returns:
- a
String
object.
-
getParent
public ResourcePath getParent()
Returns the name of the parent resource.- Specified by:
getParent
in interfaceCollectionResource
- Returns:
- a
String
object.
-
getInstance
public String getInstance()
Returns the name of the instance thisCollectionResource
represents. For node level resources, this will be null to indicate the default instance. For interface level resources, some label unique to the node (ifIndex probably). For Generic resources (e.g. the SNMPGenericIndexResource
), this will be some identifying label, probably the index in the table. This value is used by theStorageStrategy
implementations to figure out the label for the resource which is used in constructing its RRD directory.- Specified by:
getInstance
in interfaceCollectionResource
- Returns:
- a
String
object.
-
getUnmodifiedInstance
public String getUnmodifiedInstance()
Returns the unmodified instance string thisCollectionResource
represents.- Specified by:
getUnmodifiedInstance
in interfaceCollectionResource
- Returns:
- a
String
object.
-
getInterfaceLabel
public String getInterfaceLabel()
Returns a unique label for each resource depending on resource type. This label is the same label used when constructing the resource ID.- Specified by:
getInterfaceLabel
in interfaceCollectionResource
- Returns:
- a
String
object.
-
getTimeKeeper
public TimeKeeper getTimeKeeper()
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:
- a
TimeKeeper
object or null to indicate thatDefaultTimeKeeper
should be used.
-
-