Package jadex.platform.service.ecarules
Class RulebaseAgent
- java.lang.Object
-
- jadex.platform.service.ecarules.RulebaseAgent
-
- All Implemented Interfaces:
IRulebaseService
- Direct Known Subclasses:
RuleAgent
public class RulebaseAgent extends java.lang.Object implements IRulebaseService
Agent that encapsulates a rulebase and allows for tracking changes of it. Can be used to distribute rules among different rule engine agents that listen on the changes of the rulebase and do add/remove the same rules locally.
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
agent
The agent.protected java.util.Map<java.lang.Integer,Future<java.lang.Void>>
callfutures
callid -> future .protected java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>>
opencalls
The open calls (callid -> set of event ids that have to be acked.protected java.util.List<SubscriptionIntermediateFuture<IRulebaseEvent>>
rbsubscribers
The subscriptions.protected IRulebase
rulebase
The rulebase.
-
Constructor Summary
Constructors Constructor Description RulebaseAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>
addRule(IRule<?> rule)
Add a new rule.IRulebase
getRulebase()
Get the rulebase.protected void
notifyCurrentState(SubscriptionIntermediateFuture<IRulebaseEvent> sub)
Notify the current state.protected IFuture<java.lang.Void>
notifySubscribers(ARulebaseEvent event, java.util.Set<java.lang.Integer> evs)
Notify all subscribers of an event.IFuture<java.lang.Void>
removeRule(java.lang.String rulename)
Remove a rule.ISubscriptionIntermediateFuture<IRulebaseEvent>
subscribeToRulebase()
Subscribe to rule base changes.
-
-
-
Field Detail
-
agent
protected IInternalAccess agent
The agent.
-
rbsubscribers
protected java.util.List<SubscriptionIntermediateFuture<IRulebaseEvent>> rbsubscribers
The subscriptions.
-
rulebase
protected IRulebase rulebase
The rulebase.
-
opencalls
protected java.util.Map<java.lang.Integer,java.util.Set<java.lang.Integer>> opencalls
The open calls (callid -> set of event ids that have to be acked.
-
callfutures
protected java.util.Map<java.lang.Integer,Future<java.lang.Void>> callfutures
callid -> future .
-
-
Method Detail
-
getRulebase
public IRulebase getRulebase()
Get the rulebase.
-
addRule
public IFuture<java.lang.Void> addRule(IRule<?> rule)
Add a new rule.- Specified by:
addRule
in interfaceIRulebaseService
- Parameters:
rule
- The rule.
-
removeRule
public IFuture<java.lang.Void> removeRule(java.lang.String rulename)
Remove a rule.- Specified by:
removeRule
in interfaceIRulebaseService
- Parameters:
rule
- The rule.
-
subscribeToRulebase
public ISubscriptionIntermediateFuture<IRulebaseEvent> subscribeToRulebase()
Subscribe to rule base changes.- Specified by:
subscribeToRulebase
in interfaceIRulebaseService
-
notifySubscribers
protected IFuture<java.lang.Void> notifySubscribers(ARulebaseEvent event, java.util.Set<java.lang.Integer> evs)
Notify all subscribers of an event.
-
notifyCurrentState
protected void notifyCurrentState(SubscriptionIntermediateFuture<IRulebaseEvent> sub)
Notify the current state.
-
-