org.ourgrid.test
Class LocalPeer

java.lang.Object
  extended by org.ourgrid.test.LocalPeer

public class LocalPeer
extends java.lang.Object

LocalPeer provides a instance to create and execute a local peer (that will not join community). Used at MyGrid tests.


Constructor Summary
LocalPeer(int port)
          LocalPeer constructor
 
Method Summary
 java.lang.String generateTempGDF(java.lang.String tempDirectory)
          Creates a temporary GDF file to be used with LocalPeer as GuMP
 PeerSpec getGuMPSpec()
          Get the local peer GuMPSpec
 boolean isRunning()
          Tests if the LocalPeer is running
 boolean setGuMs(java.io.File GuMList)
          Set a list of Gums to be used at peer, also starts the UserAgents
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a configuration property, the peer must not be running.
 void start()
          Starts the peer execution with setted configurations.
 void stop()
          Stops the peer execution
 boolean stopUAs(java.io.File GuMList)
          Stops the UAs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalPeer

public LocalPeer(int port)
LocalPeer constructor

Parameters:
port - Port to be used
Method Detail

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a configuration property, the peer must not be running.

Parameters:
key - Key to be setted
value - Value of the key

getGuMPSpec

public PeerSpec getGuMPSpec()
Get the local peer GuMPSpec

Returns:
The local peer GuMPSpec

start

public void start()
Starts the peer execution with setted configurations. Its assure that peer will start by making a occupied waiting.


stop

public void stop()
Stops the peer execution


generateTempGDF

public java.lang.String generateTempGDF(java.lang.String tempDirectory)
                                 throws java.io.IOException
Creates a temporary GDF file to be used with LocalPeer as GuMP

Parameters:
tempDirectory - tempDirectory to be used
Returns:
Path of temporary GDF File
Throws:
java.io.IOException - If cannot write to file

isRunning

public boolean isRunning()
Tests if the LocalPeer is running

Returns:
True if its running

setGuMs

public boolean setGuMs(java.io.File GuMList)
Set a list of Gums to be used at peer, also starts the UserAgents

Parameters:
GuMList -

stopUAs

public boolean stopUAs(java.io.File GuMList)
Stops the UAs

Parameters:
GuMList - Description file with the GuMs
Returns:
True if it succeds