L - the type of the protocol specific location, typically a subclass of NodeLocationS - the protocol specific Sessionpublic abstract class EndpointService<L,S extends Session<L>> extends Object implements SamplingService<L>
MonitoredEndpoint. This service also owns the single
ResourceManager associated with the given MonitoredEndpoint.| Modifier and Type | Field and Description |
|---|---|
protected ServiceStatus |
status |
| Constructor and Description |
|---|
EndpointService(String feedId,
MonitoredEndpoint<MonitorServiceConfiguration.EndpointConfiguration> endpoint,
ResourceTypeManager<L> resourceTypeManager,
LocationResolver<L> locationResolver,
ProtocolDiagnostics diagnostics) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInventoryListener(InventoryListener listener)
|
void |
discoverAll()
Discovers all resources, puts them in the
resourceManager,
and triggers any listeners listening for new inventory. |
void |
discoverChildren(L parentLocation,
ResourceType<L> childType,
S session)
Discovers child resources of the given
parentLocation, puts them to resourceManager and triggers
InventoryListener.resourcesAdded(InventoryEvent). |
boolean |
equals(Object obj) |
String |
generateMeasurementKey(MeasurementInstance<L,?> instance)
Given a measurement instance, this will generate the key to be used when
storing that measurement instance to storage.
|
ProtocolDiagnostics |
getDiagnostics() |
String |
getFeedId() |
LocationResolver<L> |
getLocationResolver() |
MonitoredEndpoint<MonitorServiceConfiguration.EndpointConfiguration> |
getMonitoredEndpoint() |
ResourceManager<L> |
getResourceManager() |
ResourceTypeManager<L> |
getResourceTypeManager() |
int |
hashCode() |
void |
measureAvails(Collection<MeasurementInstance<L,AvailType<L>>> instances,
Consumer<AvailDataPoint> consumer)
Checks the availabilities defined by
instances and reports them back to the given consumer. |
void |
measureMetrics(Collection<MeasurementInstance<L,MetricType<L>>> instances,
Consumer<MetricDataPoint> consumer)
Collects the metrics defined by
instances and reports them back to the given consumer. |
abstract S |
openSession()
Opens a new protocl specific
Session - do not forget to close it! |
void |
removeInventoryListener(InventoryListener listener)
|
void |
removeResources(L location)
Remove resources matching the given
location and all their direct and indirect descendant resources. |
void |
start() |
void |
stop() |
String |
toString() |
protected volatile ServiceStatus status
public EndpointService(String feedId, MonitoredEndpoint<MonitorServiceConfiguration.EndpointConfiguration> endpoint, ResourceTypeManager<L> resourceTypeManager, LocationResolver<L> locationResolver, ProtocolDiagnostics diagnostics)
public String getFeedId()
public MonitoredEndpoint<MonitorServiceConfiguration.EndpointConfiguration> getMonitoredEndpoint()
getMonitoredEndpoint in interface SamplingService<L>public ResourceManager<L> getResourceManager()
public ResourceTypeManager<L> getResourceTypeManager()
public LocationResolver<L> getLocationResolver()
public ProtocolDiagnostics getDiagnostics()
public void addInventoryListener(InventoryListener listener)
listener - to addpublic void removeInventoryListener(InventoryListener listener)
listener - to removepublic abstract S openSession()
Session - do not forget to close it!Sessionpublic void discoverAll()
resourceManager,
and triggers any listeners listening for new inventory.
This will look for all root resources (resources whose types are that of the root resource types
as defined by ResourceTypeManager.getRootResourceTypes() and then obtain all their
children (recursively down to all descendents). Effectively, this discovers the full
resource hierarchy.public void discoverChildren(L parentLocation, ResourceType<L> childType, S session)
parentLocation, puts them to resourceManager and triggers
InventoryListener.resourcesAdded(InventoryEvent).parentLocation - the location under which the discovery should happenchildType - the resources of this type will be discovered.session - If not null, this session is used; if null one will be created.
If a non-null session is passed in, the caller is responsible for closing it - this method will
not close it. If a null session is passed in, this method will create and close a session itself.public void measureAvails(Collection<MeasurementInstance<L,AvailType<L>>> instances, Consumer<AvailDataPoint> consumer)
SamplingServiceinstances and reports them back to the given consumer.measureAvails in interface SamplingService<L>instances - the availabilities to checkconsumer - the consumer to send the results topublic void measureMetrics(Collection<MeasurementInstance<L,MetricType<L>>> instances, Consumer<MetricDataPoint> consumer)
SamplingServiceinstances and reports them back to the given consumer.measureMetrics in interface SamplingService<L>instances - the metrics to checkconsumer - the consumer to send the results topublic void removeResources(L location)
location and all their direct and indirect descendant resources.location - a location that can contain wildcardspublic final void start()
public void stop()
public String generateMeasurementKey(MeasurementInstance<L,?> instance)
instance - measurement instance whose key is to be returnedCopyright © 2015–2016 Red Hat, Inc.. All rights reserved.