Lightweight Bartering Grid

lbg.examples.hello
Class HelloGrid

java.lang.Object
  extended by lbg.examples.hello.HelloGrid
All Implemented Interfaces:
GridApplication

public class HelloGrid
extends java.lang.Object
implements GridApplication

A 'Hello World' in 2 classes to test the grid. Returned data is the sentence "Hello Grid", along with the input data, "a la" ICMP Echo. In case of error, the exception is returned

Author:
Xavier Dalem

Constructor Summary
HelloGrid()
           
 
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

HelloGrid

public HelloGrid()
Method Detail

setParameters

public void setParameters(java.lang.Object[] parameters)
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.

setSupplier

public void setSupplier(java.lang.String supplier_id)
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

setPlaypen

public void setPlaypen(java.lang.String playpen_dir)
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

setInputData

public void setInputData(GridData[] datas)
Description copied from interface: GridApplication
Sets the Grid application's input data files.

Specified by:
setInputData in interface GridApplication
Parameters:
datas - All input datas

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.