Class DeferredGenericTypeResource
- java.lang.Object
-
- org.opennms.netmgt.collection.support.builder.AbstractResource
-
- org.opennms.netmgt.collection.support.builder.DeferredGenericTypeResource
-
- All Implemented Interfaces:
Resource
- Direct Known Subclasses:
GenericTypeResource
public class DeferredGenericTypeResource extends AbstractResource
A GenericTypeResource which defers the resource type definition lookup until the collection resource is accessed. This allows generic resources to be constructed on the Minion, by only referring to the type, without having to pass the resource type definitions back and forth.- Author:
- jwhite
-
-
Constructor Summary
Constructors Constructor Description DeferredGenericTypeResource(NodeLevelResource node, String resourceTypeName, String instance)
DeferredGenericTypeResource(NodeLevelResource node, String resourceTypeName, String fallbackResourceTypeName, String instance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getFallbackTypeName()
String
getInstance()
Returns a unique name for the instance of this resource.String
getLabel(CollectionResource resource)
Returns a unique label for the instance of this resource.NodeLevelResource
getParent()
ResourcePath
getPath(CollectionResource resource)
Retrieves the path of the resource, relative to the repository root.String
getTypeName()
Returns the type name associated with the resource.String
getUnmodifiedInstance()
Returns the original unmodified unique name for the instance of this resource.int
hashCode()
Resource
resolve()
Used to lookup additional resource related information that may not have been available when the resource was created, and optionally return a new resource.String
toString()
-
Methods inherited from class org.opennms.netmgt.collection.support.builder.AbstractResource
getTimestamp, setTimestamp
-
-
-
-
Constructor Detail
-
DeferredGenericTypeResource
public DeferredGenericTypeResource(NodeLevelResource node, String resourceTypeName, String instance)
-
DeferredGenericTypeResource
public DeferredGenericTypeResource(NodeLevelResource node, String resourceTypeName, String fallbackResourceTypeName, String instance)
-
-
Method Detail
-
getParent
public NodeLevelResource getParent()
-
getTypeName
public String getTypeName()
Description copied from interface:Resource
Returns the type name associated with the resource. Used for thresholding.- Returns:
- type name
-
getFallbackTypeName
public String getFallbackTypeName()
-
getInstance
public String getInstance()
Description copied from interface:Resource
Returns a unique name for the instance of this resource. Used by theIndexStorageStrategy
- Returns:
- instance name
-
getUnmodifiedInstance
public String getUnmodifiedInstance()
Description copied from interface:Resource
Returns the original unmodified unique name for the instance of this resource. Used by theObjectNameStorageStrategy
- Returns:
- instance name
-
getLabel
public String getLabel(CollectionResource resource)
Description copied from interface:Resource
Returns a unique label for the instance of this resource. This label is used by threshd to generate a unique id on a per resource basis, grouped by node. SeeCollectionResourceWrapper
- Returns:
- a
String
object.
-
getPath
public ResourcePath getPath(CollectionResource resource)
Description copied from interface:Resource
Retrieves the path of the resource, relative to the repository root.- Parameters:
resource
- Used by theGenericTypeResource
in order to determine the instance name.- Returns:
- relative path
-
resolve
public Resource resolve()
Description copied from interface:Resource
Used to lookup additional resource related information that may not have been available when the resource was created, and optionally return a new resource.
See
resolve()
.This method should only be called when running in the context of the OpenNMS JVM (and not the Minion).
- Specified by:
resolve
in interfaceResource
- Overrides:
resolve
in classAbstractResource
- Returns:
- possibly a new resource, or this same instance if no resolving was performed
-
-