Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lbg.protocol.api
Interface GridApplication

All Known Implementing Classes:
  GridHasher, HelloGrid, SimTask

    public interface GridApplication

This interface must be implemented by one class in each Grid application submitted as a Task.
This class must implement:

- A constructor without any arguments
- A method to receive its input parameters
- A method to receive its input data files
- A method to receive the id of the Supplier Peer that controls the Resource running it
- A method to be started
- A method to export its results

These methods will always be called in that order. If your application does not need one or both of the offered inputs, it should still provide the methods, which will be empty. getResult() can be called more than once.

Author:
  Xavier Dalem, Cyril Briquet

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

Method Detail

### setParameters

    void setParameters(java.lang.Object[] parameters)
                       throws GridException

  Sets the Grid application's input parameters.

  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.

### setInputData

    void setInputData(GridData[] datas)
                      throws GridException

  Sets the Grid application's input data files.

  Parameters:
    `datas` - All input datas
  Throws:
    `GridException` - If the data is not what it should be.

### setSupplier

    void setSupplier(java.lang.String supplier_id)
                     throws GridException

  Sets the id of the Supplier Peer that controls the Resource running the Grid application

  Parameters:
    `supplier_id` - Supplier Peer id
  Throws:
    `GridException` - If the Supplier Peer id is not what it should be.

### setPlaypen

    void setPlaypen(java.lang.String playpen_dir)
                    throws GridException

  Sets the playpen directory of the Resource where the Grid application can write and read temporary files.

  Parameters:
    `playpen_dir` - playpen directory
  Throws:
    `GridException` - If the playpen directory is not what it should be.

### getResult

    byte[] getResult()

  Gets computed results.

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

  Returns:
    computed results, or null if a transient error happened

### compute

    void compute()

  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).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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