Lightweight Bartering Grid

lbg.simulator
Class SimTask

java.lang.Object
  extended by lbg.simulator.SimTask
All Implemented Interfaces:
GridApplication

public class SimTask
extends java.lang.Object
implements GridApplication

A SimTask is a wrapper class enabling the LBG Simulator to be run as a GridApplication.

Particularly useful to run a parameter sweep over multiple scenarios.

Author:
Xavier Dalem, Cyril Briquet

Constructor Summary
SimTask()
           
 
Method Summary
 void compute()
          Runs the Grid application.
 byte[] getResult()
          Gets computed results.
 void setInputData(GridData[] datas)
          Sets the Grid application's input data files.
 void setParameters(java.lang.Object[] parameters)
          Sets the Grid application's input parameters.
 void setPlaypen(java.lang.String playpen_dir)
          Sets the playpen directory of the Resource where the Grid application can write and read temporary files.
 void setSupplier(java.lang.String supplier_id)
          Sets the id of the Supplier Peer that controls the Resource running the Grid application
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimTask

public SimTask()
Method Detail

setInputData

public void setInputData(GridData[] datas)
                  throws GridException
Sets the Grid application's input data files.

Specified by:
setInputData in interface GridApplication
Parameters:
datas - target simulation description file
Throws:
GridException - If the data is not what it should be.

setParameters

public void setParameters(java.lang.Object[] parameters)
                   throws GridException
Description copied from interface: GridApplication
Sets the Grid application's input parameters.

Specified by:
setParameters in interface GridApplication
Parameters:
parameters - An array of parameters as Objects. Can be empty, but never null.
Throws:
GridException - If the parameters are not what they should be.

setSupplier

public void setSupplier(java.lang.String supplier_id)
                 throws GridException
Description copied from interface: GridApplication
Sets the id of the Supplier Peer that controls the Resource running the Grid application

Specified by:
setSupplier in interface GridApplication
Parameters:
supplier_id - Supplier Peer id
Throws:
GridException - If the Supplier Peer id is not what it should be.

setPlaypen

public void setPlaypen(java.lang.String playpen_dir)
                throws GridException
Description copied from interface: GridApplication
Sets the playpen directory of the Resource where the Grid application can write and read temporary files.

Specified by:
setPlaypen in interface GridApplication
Parameters:
playpen_dir - playpen directory
Throws:
GridException - If the playpen directory is not what it should be.

compute

public void compute()
Description copied from interface: GridApplication
Runs the Grid application. As this method cannot throw any exception, one should print his stack traces to stderr in case of error. They will be returned in the logs if the application completes (i.e. doesn't fail elsewhere).

Specified by:
compute in interface GridApplication

getResult

public byte[] getResult()
Description copied from interface: GridApplication
Gets computed results.

Note: if no results are produced, new byte[0] can be used as a legal value.

Specified by:
getResult in interface GridApplication
Returns:
computed results, or null if a transient error happened

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.