ants.gnutant
Class GnutantRequestGenerator

java.lang.Object
  |
  +--ants.gnutant.GnutantRequestGenerator
All Implemented Interfaces:
Clearable, RequestGenerator

public class GnutantRequestGenerator
extends Object
implements RequestGenerator

This class implements a generic request generator. To create a request, the generator selects randomly (with uniform probability) a resource from a resource set, creates a generic request for that resource and assign it randomly to one of the nests included in the peernet. The number of requests that are generated for each invocation of method generateRequests can be configured through the NumberOfRequests parameter.

Version:
$Revision: 1.7 $
Author:
Alberto Montresor
, Hein Meling

Field Summary
static String EXPONENTIAL
          If the Selection parameter assumes this value, resources are selected randomly (with exponential distribution) from the resource set.
static String PAR_MEAN
          String name of the parameter used to determine vary the mean of the keyword selection distribution.
static String PAR_NUMBERREQUESTS
          Parameter name used to read the number of requests to be generated
static String PAR_SELECTION
          String name of the parameter used to determine the type of selection you can use.
static String UNIFORM
          If the Selection parameter assumes this value, resources are selected randomly (with uniform distribution) from the resource set.
 
Fields inherited from interface antsim.RequestGenerator
NAME
 
Constructor Summary
GnutantRequestGenerator(Factory factory, String name)
          Constructs a new generic request generator and reads parameter NumberOfRequests from the configuration files.
 
Method Summary
 void clear()
          Restores the object to its initial state.
 void generateRequests()
          Generates a set of requests in the specified P2P network.
 void init(ResourceSet resourceSet, Peernet peernet, ResponseMonitor monitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIFORM

public static final String UNIFORM
If the Selection parameter assumes this value, resources are selected randomly (with uniform distribution) from the resource set.

See Also:
Constant Field Values

EXPONENTIAL

public static final String EXPONENTIAL
If the Selection parameter assumes this value, resources are selected randomly (with exponential distribution) from the resource set.

See Also:
Constant Field Values

PAR_NUMBERREQUESTS

public static final String PAR_NUMBERREQUESTS
Parameter name used to read the number of requests to be generated

See Also:
Constant Field Values

PAR_SELECTION

public static final String PAR_SELECTION
String name of the parameter used to determine the type of selection you can use. The possible values are: "Sequntial", "Uniform", "Exponential"

See Also:
Constant Field Values

PAR_MEAN

public static final String PAR_MEAN
String name of the parameter used to determine vary the mean of the keyword selection distribution.

See Also:
Constant Field Values
Constructor Detail

GnutantRequestGenerator

public GnutantRequestGenerator(Factory factory,
                               String name)
Constructs a new generic request generator and reads parameter NumberOfRequests from the configuration files.

Method Detail

clear

public void clear()
Restores the object to its initial state.

Specified by:
clear in interface Clearable

init

public void init(ResourceSet resourceSet,
                 Peernet peernet,
                 ResponseMonitor monitor)
Specified by:
init in interface RequestGenerator

generateRequests

public void generateRequests()
Generates a set of requests in the specified P2P network. Different implementations may adopt different generation and distribution patterns.

Specified by:
generateRequests in interface RequestGenerator