antsim.impl
Class GenericRequestGenerator

java.lang.Object
  |
  +--antsim.impl.GenericRequestGenerator
All Implemented Interfaces:
Clearable, RequestGenerator

public class GenericRequestGenerator
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.6 $
Author:
Alberto Montresor

Field Summary
static String PAR_NUMBERREQUESTS
          Parameter name used to read the number of requests to be generated
 
Fields inherited from interface antsim.RequestGenerator
NAME
 
Constructor Summary
GenericRequestGenerator(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

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
Constructor Detail

GenericRequestGenerator

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

Parameters:
factory - the factory to be used to read configuration arguments and to create other configurable objects
name - the name that is associated to this instance in the configuration file
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