planet.behaviour
Class BehaviourProperties

java.lang.Object
  extended byplanet.behaviour.BehaviourProperties
All Implemented Interfaces:
BehaviourProperties, PropertiesInitializer, java.io.Serializable

public class BehaviourProperties
extends java.lang.Object
implements BehaviourProperties

This class allows to add new behaviours to bad nodes on the overlay. Each behaviour is binded to the type of message exchanged between nodes. The message are defined by a type and mode field. It also allow the use of the wildcard '*', that means, whatever type if is specified in type's field or either whatever mode if is specified in mode's field. Through the method init(), so that their values are initialized.

Author:
Marc Sanchez Date: 10/10/2004
See Also:
Serialized Form

Field Summary
static int CHAIN
          Chain Distribution.
static java.lang.String DEBUG_INFO
          Behaviour.Property: Specifies We Want Debug Or Not Debug Info.
 boolean debugInfo
           
static java.lang.String DEFAULT_FAULTY_NODES
          Behaviour.Property: Default percentatge of malicious nodes
static java.lang.String DEFAULT_MALICIOUS_DISTRIBUTION
          Behaviour.Property: Default malicious node distribution
static java.lang.String[] DISTR
           
static java.lang.String FILTER
          Behaviour.Property: Specifies The Filter For Behaviours Queue.
 java.lang.Class filterClass
           
 int maliciousDistribution
           
 java.util.Vector patterns
           
 float percentageOfMalicious
           
static java.lang.String ROLE_SELECTOR
          Behaviour.Property: Specifies Node's role according to some distribuiton.
 java.lang.Class selectorClass
           
static int UNIFORM
          Uniform Distribution.
 
Constructor Summary
BehaviourProperties()
           
 
Method Summary
protected  void add(Pattern pattern)
          This method add patterns to the vector sorted from more-to-less specific.
 java.lang.Class getFilter()
           
 java.util.Vector getPatterns()
           
 void init(java.lang.String propertiesFile)
          Initialize correctly the behaviours.
protected  boolean isNormalized(double d)
          This method checks wether a double value lies between (0.0, 1.0] range.
protected  void printPatterns()
          Prints sorted patterns from more-to-less specific.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER

public static final java.lang.String FILTER
Behaviour.Property: Specifies The Filter For Behaviours Queue.

See Also:
Constant Field Values

DEBUG_INFO

public static final java.lang.String DEBUG_INFO
Behaviour.Property: Specifies We Want Debug Or Not Debug Info.

See Also:
Constant Field Values

DEFAULT_FAULTY_NODES

public static final java.lang.String DEFAULT_FAULTY_NODES
Behaviour.Property: Default percentatge of malicious nodes

See Also:
Constant Field Values

DEFAULT_MALICIOUS_DISTRIBUTION

public static final java.lang.String DEFAULT_MALICIOUS_DISTRIBUTION
Behaviour.Property: Default malicious node distribution

See Also:
Constant Field Values

ROLE_SELECTOR

public static final java.lang.String ROLE_SELECTOR
Behaviour.Property: Specifies Node's role according to some distribuiton. It allows node's collusion.

See Also:
Constant Field Values

UNIFORM

public static final int UNIFORM
Uniform Distribution.

See Also:
Constant Field Values

CHAIN

public static final int CHAIN
Chain Distribution.

See Also:
Constant Field Values

DISTR

public static final java.lang.String[] DISTR

percentageOfMalicious

public float percentageOfMalicious

maliciousDistribution

public int maliciousDistribution

debugInfo

public boolean debugInfo

selectorClass

public java.lang.Class selectorClass

filterClass

public java.lang.Class filterClass

patterns

public java.util.Vector patterns
Constructor Detail

BehaviourProperties

public BehaviourProperties()
Method Detail

init

public void init(java.lang.String propertiesFile)
          throws InitializationException
Initialize correctly the behaviours.

Specified by:
init in interface PropertiesInitializer
Parameters:
propertiesFile - File with all configuration properties of the concrete Behaviours. This file must follow java.util.Properties scheme.
Throws:
InitializationException - if an error occurs during the initialization of the different properties.

getPatterns

public java.util.Vector getPatterns()
Returns:
Returns a vector with all pattern sorted from more-to-less specific.

getFilter

public java.lang.Class getFilter()
Returns:
Returns the filter class

add

protected void add(Pattern pattern)
This method add patterns to the vector sorted from more-to-less specific. Specific criteria: Type Mode 1) Tag, Tag 2) Tag, ? 3) Tag, * 4) ? , Tag 5) * , Tag 6) ? , * 7) * , ? 8) * , *

Parameters:
pattern - Pattern to insert.

isNormalized

protected boolean isNormalized(double d)
This method checks wether a double value lies between (0.0, 1.0] range.

Parameters:
d - double value to check
Returns:
true if d lies between (0.0, 1.0].

printPatterns

protected void printPatterns()
Prints sorted patterns from more-to-less specific.