Package org.opennms.netmgt.dao.support
Class DefaultServiceTracker
- java.lang.Object
-
- org.opennms.netmgt.dao.support.DefaultServiceTracker
-
- All Implemented Interfaces:
ServiceTracker
public class DefaultServiceTracker extends Object implements ServiceTracker
Maintains sessions for each service being tracked. Most of the work is delegated to theFilterWatcher
: when the results of a filter change, we re-evaluate the state and issue callback accordingly.- Author:
- jwhite
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.opennms.netmgt.dao.api.ServiceTracker
ServiceTracker.ServiceListener
-
-
Constructor Summary
Constructors Constructor Description DefaultServiceTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setFilterWatcher(FilterWatcher filterWatcher)
Closeable
trackService(String serviceName, ServiceTracker.ServiceListener listener)
Issues callbacks to the given listener for services that: 1) Have the given service name Callbacks are expected to be issued immediately for all existing services that match the criteria.Closeable
trackServiceMatchingFilterRule(String serviceName, String filterRule, ServiceTracker.ServiceListener listener)
Issues callbacks to the given listener for services that: 1) Have the given service name 2) Match the given filter rule Callbacks are expected to be issued immediately for all existing services that match the criteria.
-
-
-
Method Detail
-
trackServiceMatchingFilterRule
public Closeable trackServiceMatchingFilterRule(String serviceName, String filterRule, ServiceTracker.ServiceListener listener)
Description copied from interface:ServiceTracker
Issues callbacks to the given listener for services that: 1) Have the given service name 2) Match the given filter rule Callbacks are expected to be issued immediately for all existing services that match the criteria. Additional callback will be made as services are added/removed.- Specified by:
trackServiceMatchingFilterRule
in interfaceServiceTracker
- Parameters:
serviceName
- only interfaces with the given service name attached will be consideredfilterRule
- only interfaces that match the given filter will be considered if null, or empty the filter will match everythinglistener
- used for callbacks- Returns:
- close when done watching
-
trackService
public Closeable trackService(String serviceName, ServiceTracker.ServiceListener listener)
Description copied from interface:ServiceTracker
Issues callbacks to the given listener for services that: 1) Have the given service name Callbacks are expected to be issued immediately for all existing services that match the criteria. Additional callback will be made as services are added/removed.- Specified by:
trackService
in interfaceServiceTracker
- Parameters:
serviceName
- only interfaces with the given service name attached will be consideredlistener
- used for callbacks- Returns:
- close when done watching
-
setFilterWatcher
public void setFilterWatcher(FilterWatcher filterWatcher)
-
-