|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.behaviour.BehavioursPoolImpl
The BehavioursPool's class is aimed at providing an internal scheduler of
node's behaviuours. At startup, behaviours are registered to the pool from
Behaviour.properties file, following the next syntax:
Class = Type, Mode, Probability, When, RoleThen, a message interceptor is build up and is ready to invoke behaviours when a message pattern matches to those provided by Behaviour.properties file.
Field Summary | |
protected static int |
ALWAYS_MASK
|
protected static int |
BadRole
Behaviour's Property: Bad modifier for Behaviour's role. |
protected java.util.Vector[][] |
beh
BehavioursPool properties: mapping from |
protected static int |
BEH_MAPPINGS
|
protected int |
behSlots
|
protected Filter |
filter
|
protected static int |
GoodRole
Behaviour's Property: Good modifier for Behaviour's role. |
protected static int |
LocalTraffic
Behaviour's Property: Local modifier applied to a behaviour means it only will be scheduled when a RouteMessage has as destination the local node. |
protected static int |
NEUTRAL_MASK
|
protected java.lang.Class |
nodeClass
|
protected static int |
NULL_MASK
|
protected int |
numberModes
|
protected int |
numberTypes
|
protected static int |
RemoteTraffic
Behaviour's Property: Remote modifier applied to a behaviour means it only will be scheduled when a RouteMessage has as destination a remode node and needs to be rerouted trough the strucutred overlay again. |
Fields inherited from interface planet.behaviour.BehavioursPool |
NumberOfModes, NumberOfTypes |
Constructor Summary | |
BehavioursPoolImpl(java.lang.Class filterClass,
java.util.Vector patterns,
java.lang.Class nodeClass)
|
Method Summary | |
protected void |
build(java.util.Vector patterns)
Given the patterns sorted from more-to-less specific as input, builds a mapping from RouteMessage's patterns to behaviours. |
protected RouteMessage[] |
copyInto(java.util.Vector s)
|
protected void |
copyInto(java.util.Vector copy,
RouteMessage[] source)
|
RouteMessage[] |
onMessage(RouteMessage msg,
Node node)
Given a RouteMessage and a Node as input, onMessage's method intends to invoke some behaviours only if RouteMessage's type and mode fields matches some behaviour's pattern. |
protected void |
prettyPrintAll()
|
protected void |
printMap(int queue)
|
protected void |
setPattern(int queue,
int typePos,
java.lang.String modeOf,
Pattern pattern)
Given the initial position for type on mapping typePos and mode as input, sets the pattern on the mapping taking into account the grammar tree extracted from wildcards semantics. |
protected boolean[] |
whichQueues(int Mask,
int RoleOf,
int WhenTo)
The WhichQueue's method selects for a given pattern what Queues must include a copy of the current behaviour. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector[][] beh
protected static int GoodRole
protected static int BadRole
protected static int LocalTraffic
protected static int RemoteTraffic
protected java.lang.Class nodeClass
protected int numberModes
protected int numberTypes
protected Filter filter
protected int behSlots
protected static final int ALWAYS_MASK
protected static final int NEUTRAL_MASK
protected static final int NULL_MASK
protected static final int BEH_MAPPINGS
Constructor Detail |
public BehavioursPoolImpl(java.lang.Class filterClass, java.util.Vector patterns, java.lang.Class nodeClass) throws InitializationException
Method Detail |
protected boolean[] whichQueues(int Mask, int RoleOf, int WhenTo)
Mask
- The Mask for Pattern.Always and Pattern.Neutral modifiers.RoleOf
- The Behaviour's Role for a Good or Bad peer.WhenTo
- Specifies Behaviour should be activated when incoming messages
refer to the local node or either when refer to a remote.
protected void build(java.util.Vector patterns) throws InitializationException
patterns
- The List of patterns.
InitializationException
protected void setPattern(int queue, int typePos, java.lang.String modeOf, Pattern pattern) throws InitializationException
queue
- Identifies where to be queued the pattern.typePos
- Initial position on behaviours mapping array, i.e, [typePos..typePos + NumberOfModes]modeOf
- Mode of the pattern: Universal wildcard or '*', Complementary wildcard or '?' and Tag.pattern
- Pattern to be treat.
InitializationException
protected void prettyPrintAll()
protected void printMap(int queue)
public RouteMessage[] onMessage(RouteMessage msg, Node node) throws NoSuchBehaviourException, NoBehaviourDispatchedException
onMessage
in interface BehavioursPool
msg
- RoteMessage taken as input.node
- Node taken as input.
NoSuchBehaviourException
- when no behaviour matches RouteMessage's
pattern.
NoBehaviourDispatchedException
protected void copyInto(java.util.Vector copy, RouteMessage[] source)
protected RouteMessage[] copyInto(java.util.Vector s)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |