Class RulesServiceImpl

    • Constructor Detail

      • RulesServiceImpl

        public RulesServiceImpl()
    • Method Detail

      • setBundleContext

        public void setBundleContext​(org.osgi.framework.BundleContext bundleContext)
      • setPersistenceService

        public void setPersistenceService​(PersistenceService persistenceService)
      • setDefinitionsService

        public void setDefinitionsService​(DefinitionsService definitionsService)
      • setEventService

        public void setEventService​(EventService eventService)
      • setSchedulerService

        public void setSchedulerService​(SchedulerService schedulerService)
      • setActionExecutorDispatcher

        public void setActionExecutorDispatcher​(ActionExecutorDispatcher actionExecutorDispatcher)
      • setRulesRefreshInterval

        public void setRulesRefreshInterval​(Integer rulesRefreshInterval)
      • setRulesStatisticsRefreshInterval

        public void setRulesStatisticsRefreshInterval​(Integer rulesStatisticsRefreshInterval)
      • setOptimizedRulesActivated

        public void setOptimizedRulesActivated​(Boolean optimizedRulesActivated)
      • postConstruct

        public void postConstruct()
      • preDestroy

        public void preDestroy()
      • getMatchingRules

        public Set<Rule> getMatchingRules​(Event event)
        Description copied from interface: RulesService
        Retrieves all the matching rules for a specific event
        Specified by:
        getMatchingRules in interface RulesService
        Parameters:
        event - the event we want to retrieve all the matching rules for
        Returns:
        a set of rules that match the event passed in the parameters
      • refreshRules

        public void refreshRules()
        Description copied from interface: RulesService
        Refresh the rules for this instance by reloading them from the persistence backend
        Specified by:
        refreshRules in interface RulesService
      • getAllRules

        public List<Rule> getAllRules()
        Description copied from interface: RulesService
        Get all rules available in the system. (This is not doing a persistence query to retrieve the rules, it's using the internal in memory cache that is refreshed every second by default but can vary depending on your own configuration)
        Specified by:
        getAllRules in interface RulesService
        Returns:
        all rules available.
      • canHandle

        public boolean canHandle​(Event event)
        Description copied from interface: EventListenerService
        Whether or not this listener can handle the specified event.
        Specified by:
        canHandle in interface EventListenerService
        Parameters:
        event - the event to be handled
        Returns:
        true if this listener can handle the specified event, false otherwise
      • getRuleStatistics

        public RuleStatistics getRuleStatistics​(String ruleId)
        Description copied from interface: RulesService
        Retrieves the statistics for a rule
        Specified by:
        getRuleStatistics in interface RulesService
        Parameters:
        ruleId - the identifier of the rule
        Returns:
        a long representing the number of times the rule was matched and executed.
      • resetAllRuleStatistics

        public void resetAllRuleStatistics()
        Description copied from interface: RulesService
        Resets all the rule statistics to zero, useful when testing or if you want to set a point in time.
        Specified by:
        resetAllRuleStatistics in interface RulesService
      • getRuleMetadatas

        public PartialList<Metadata> getRuleMetadatas​(Query query)
        Description copied from interface: RulesService
        Retrieves rule metadatas for rules matching the specified Query.
        Specified by:
        getRuleMetadatas in interface RulesService
        Parameters:
        query - the query the rules which metadata we want to retrieve must match
        Returns:
        a PartialList of rules metadata for the rules matching the specified query
      • getRuleDetails

        public PartialList<Rule> getRuleDetails​(Query query)
        Description copied from interface: RulesService
        Retrieves rule details for rules matching the specified query.
        Specified by:
        getRuleDetails in interface RulesService
        Parameters:
        query - the query specifying which rules to retrieve
        Returns:
        a PartialList of rule details for the rules matching the specified query
      • getRule

        public Rule getRule​(String ruleId)
        Description copied from interface: RulesService
        Retrieves the rule identified by the specified identifier.
        Specified by:
        getRule in interface RulesService
        Parameters:
        ruleId - the identifier of the rule we want to retrieve
        Returns:
        the rule identified by the specified identifier or null if no such rule exists.
      • setRule

        public void setRule​(Rule rule)
        Description copied from interface: RulesService
        Persists the specified rule to the context server.
        Specified by:
        setRule in interface RulesService
        Parameters:
        rule - the rule to be persisted
      • getTrackedConditions

        public Set<Condition> getTrackedConditions​(Item source)
        Description copied from interface: RulesService
        Retrieves tracked conditions (rules with a condition marked with the trackedCondition tag and which sourceEventCondition matches the specified item) for the specified item.
        Specified by:
        getTrackedConditions in interface RulesService
        Parameters:
        source - the item which tracked conditions we want to retrieve
        Returns:
        the Set of tracked conditions for the specified item
      • removeRule

        public void removeRule​(String ruleId)
        Description copied from interface: RulesService
        Deletes the rule identified by the specified identifier.
        Specified by:
        removeRule in interface RulesService
        Parameters:
        ruleId - the identifier of the rule we want to delete
      • bundleChanged

        public void bundleChanged​(org.osgi.framework.BundleEvent event)
        Specified by:
        bundleChanged in interface org.osgi.framework.BundleListener
      • bind

        public void bind​(org.osgi.framework.ServiceReference<RuleListenerService> serviceReference)
      • unbind

        public void unbind​(org.osgi.framework.ServiceReference<RuleListenerService> serviceReference)
      • fireEvaluate

        public void fireEvaluate​(Rule rule,
                                 Event event)
      • fireExecuteActions

        public void fireExecuteActions​(Rule rule,
                                       Event event)