public class RulesServiceImpl extends Object implements RulesService, EventListenerService, org.osgi.framework.SynchronousBundleListener
Modifier and Type | Field and Description |
---|---|
static String |
TRACKED_PARAMETER |
Constructor and Description |
---|
RulesServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
bind(org.osgi.framework.ServiceReference<RuleListenerService> serviceReference) |
void |
bundleChanged(org.osgi.framework.BundleEvent event) |
boolean |
canHandle(Event event)
Whether or not this listener can handle the specified event.
|
void |
fireAlreadyRaised(RuleListenerService.AlreadyRaisedFor alreadyRaisedFor,
Rule rule,
Event event) |
void |
fireEvaluate(Rule rule,
Event event) |
void |
fireExecuteActions(Rule rule,
Event event) |
List<Rule> |
getAllRules()
Get all rules available in the system.
|
Map<String,RuleStatistics> |
getAllRuleStatistics()
Retrieves the statistics for all the rules
|
Set<Rule> |
getMatchingRules(Event event)
Retrieves all the matching rules for a specific event
|
Rule |
getRule(String ruleId)
Retrieves the rule identified by the specified identifier.
|
PartialList<Rule> |
getRuleDetails(Query query)
Retrieves rule details for rules matching the specified query.
|
Set<Metadata> |
getRuleMetadatas()
Retrieves the metadata for all known rules.
|
PartialList<Metadata> |
getRuleMetadatas(Query query)
Retrieves rule metadatas for rules matching the specified
Query . |
RuleStatistics |
getRuleStatistics(String ruleId)
Retrieves the statistics for a rule
|
Set<Condition> |
getTrackedConditions(Item source)
Retrieves tracked conditions (rules with a condition marked with the
trackedCondition tag and which sourceEventCondition matches the specified item) for the
specified item. |
int |
onEvent(Event event)
Handles the specified event.
|
void |
postConstruct() |
void |
preDestroy() |
void |
refreshRules()
Refresh the rules for this instance by reloading them from the persistence backend
|
void |
removeRule(String ruleId)
Deletes the rule identified by the specified identifier.
|
void |
resetAllRuleStatistics()
Resets all the rule statistics to zero, useful when testing or if you want to set a point in time.
|
void |
setActionExecutorDispatcher(ActionExecutorDispatcher actionExecutorDispatcher) |
void |
setBundleContext(org.osgi.framework.BundleContext bundleContext) |
void |
setDefinitionsService(DefinitionsService definitionsService) |
void |
setEventService(EventService eventService) |
void |
setOptimizedRulesActivated(Boolean optimizedRulesActivated) |
void |
setPersistenceService(PersistenceService persistenceService) |
void |
setRule(Rule rule)
Persists the specified rule to the context server.
|
void |
setRulesRefreshInterval(Integer rulesRefreshInterval) |
void |
setRulesStatisticsRefreshInterval(Integer rulesStatisticsRefreshInterval) |
void |
setSchedulerService(SchedulerService schedulerService) |
void |
unbind(org.osgi.framework.ServiceReference<RuleListenerService> serviceReference) |
public static final String TRACKED_PARAMETER
public void setBundleContext(org.osgi.framework.BundleContext bundleContext)
public void setPersistenceService(PersistenceService persistenceService)
public void setDefinitionsService(DefinitionsService definitionsService)
public void setEventService(EventService eventService)
public void setSchedulerService(SchedulerService schedulerService)
public void setActionExecutorDispatcher(ActionExecutorDispatcher actionExecutorDispatcher)
public void setRulesRefreshInterval(Integer rulesRefreshInterval)
public void setRulesStatisticsRefreshInterval(Integer rulesStatisticsRefreshInterval)
public void setOptimizedRulesActivated(Boolean optimizedRulesActivated)
public void postConstruct()
public void preDestroy()
public Set<Rule> getMatchingRules(Event event)
RulesService
getMatchingRules
in interface RulesService
event
- the event we want to retrieve all the matching rules forpublic void refreshRules()
RulesService
refreshRules
in interface RulesService
public List<Rule> getAllRules()
RulesService
getAllRules
in interface RulesService
public boolean canHandle(Event event)
EventListenerService
canHandle
in interface EventListenerService
event
- the event to be handledtrue
if this listener can handle the specified event, false
otherwisepublic int onEvent(Event event)
EventListenerService
onEvent
in interface EventListenerService
event
- the event to be handledEventService
flags, to be checked using bitwise AND (&) operatorEventService.NO_CHANGE
,
EventService.PROFILE_UPDATED
,
EventService.SESSION_UPDATED
public RuleStatistics getRuleStatistics(String ruleId)
RulesService
getRuleStatistics
in interface RulesService
ruleId
- the identifier of the rulepublic Map<String,RuleStatistics> getAllRuleStatistics()
RulesService
getAllRuleStatistics
in interface RulesService
public void resetAllRuleStatistics()
RulesService
resetAllRuleStatistics
in interface RulesService
public Set<Metadata> getRuleMetadatas()
RulesService
getRuleMetadatas
in interface RulesService
public PartialList<Metadata> getRuleMetadatas(Query query)
RulesService
Query
.getRuleMetadatas
in interface RulesService
query
- the query the rules which metadata we want to retrieve must matchPartialList
of rules metadata for the rules matching the specified querypublic PartialList<Rule> getRuleDetails(Query query)
RulesService
getRuleDetails
in interface RulesService
query
- the query specifying which rules to retrievePartialList
of rule details for the rules matching the specified querypublic Rule getRule(String ruleId)
RulesService
getRule
in interface RulesService
ruleId
- the identifier of the rule we want to retrievenull
if no such rule exists.public void setRule(Rule rule)
RulesService
setRule
in interface RulesService
rule
- the rule to be persistedpublic Set<Condition> getTrackedConditions(Item source)
RulesService
trackedCondition
tag and which sourceEventCondition
matches the specified item) for the
specified item.getTrackedConditions
in interface RulesService
source
- the item which tracked conditions we want to retrievepublic void removeRule(String ruleId)
RulesService
removeRule
in interface RulesService
ruleId
- the identifier of the rule we want to deletepublic void bundleChanged(org.osgi.framework.BundleEvent event)
bundleChanged
in interface org.osgi.framework.BundleListener
public void bind(org.osgi.framework.ServiceReference<RuleListenerService> serviceReference)
public void unbind(org.osgi.framework.ServiceReference<RuleListenerService> serviceReference)
public void fireAlreadyRaised(RuleListenerService.AlreadyRaisedFor alreadyRaisedFor, Rule rule, Event event)
Copyright © 2014–2023 Apache Software Foundation. All rights reserved.