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 StringgetInstance()Returns the name of the instance thisCollectionResourcerepresents.StringgetInterfaceLabel()Returns a unique label for each resource depending on resource type.StringgetOwnerName()getOwnerNameResourcePathgetParent()Returns the name of the parent resource.ResourcePathgetPath()Retrieves path for the resource, relative to the root of the associatedRrdRepository.StringgetResourceTypeName()Returns a string which indicates what type of resource.TimeKeepergetTimeKeeper()Returns a not-nullTimeKeeperinstance when this resource requires to use a special timestamp when updating RRDs/JRBs.StringgetUnmodifiedInstance()Returns the unmodified instance string thisCollectionResourcerepresents.booleanrescanNeeded()rescanNeededbooleanshouldPersist(ServiceParameters params)Determines whether the attribute should be persisted.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)
-
-
-
Constructor Detail
-
CollectionResourceWrapper
public CollectionResourceWrapper(CollectionResource wrapped)
-
-
Method Detail
-
getOwnerName
public 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.
-
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.
-
shouldPersist
public boolean shouldPersist(ServiceParameters params)
Determines whether the attribute should be persisted.- Specified by:
shouldPersistin interfacePersistable- Parameters:
params- aServiceParametersobject.- Returns:
- a boolean.
-
rescanNeeded
public boolean rescanNeeded()
rescanNeeded
- Specified by:
rescanNeededin 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:
getResourceTypeNamein interfaceCollectionResource- Returns:
- a
Stringobject.
-
getParent
public ResourcePath getParent()
Returns the name of the parent resource.- Specified by:
getParentin interfaceCollectionResource- Returns:
- a
Stringobject.
-
getInstance
public String getInstance()
Returns the name of the instance thisCollectionResourcerepresents. 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 theStorageStrategyimplementations to figure out the label for the resource which is used in constructing its RRD directory.- Specified by:
getInstancein interfaceCollectionResource- Returns:
- a
Stringobject.
-
getUnmodifiedInstance
public String getUnmodifiedInstance()
Returns the unmodified instance string thisCollectionResourcerepresents.- Specified by:
getUnmodifiedInstancein interfaceCollectionResource- Returns:
- a
Stringobject.
-
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:
getInterfaceLabelin interfaceCollectionResource- Returns:
- a
Stringobject.
-
getTimeKeeper
public TimeKeeper getTimeKeeper()
Returns 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:
- a
TimeKeeperobject or null to indicate thatDefaultTimeKeepershould be used.
-
-