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.user
Class EmbeddedLiveUserAgent

    java.lang.Object
      lbg.user.UserAgent
          lbg.user.LiveUserAgent
              lbg.user.EmbeddedLiveUserAgent

    public class EmbeddedLiveUserAgent

extends LiveUserAgent

An EmbeddedLiveUserAgent is a LiveUserAgent intended to be run within another software.

The User service is immediately created in a separate thread.

Author:
  Cyril Briquet

Constructor Summary
`EmbeddedLiveUserAgent(java.lang.String id, java.lang.String user_hostname, int user_port, UserPeerHandle peer_handle, java.lang.String output_dir)` Creates an EmbeddedLiveUserAgent.

Method Summary
`static java.util.Properties` | `describeEmbeddedJob(int task_count, java.lang.String embedded_task_jar, java.lang.String embedded_task_main, int embedded_task_port, java.lang.String ctrlr_hostname, int ctrlr_port)` Describes, as a Properties and with the target values, a Job to be sumbitted by an EmbeddedLiveUserAgent (convenience method).
`static void` | `main(java.lang.String[] args)`
`static void` | `shutdownUser(EmbeddedLiveUserAgent user)` Gracefully shutdown target EmbeddedLiveUserAgent (convenience method).
`static EmbeddedLiveUserAgent` | `startUser(java.lang.String user_hostname, int user_port, java.lang.String peer_hostname, int peer_port, java.lang.String user_logs_dir)` Creates a new EmbeddedLiveUserAgent (convenience method).
`int` | `submitJob(java.util.Properties jdf_props)` Submits a Job.
`static int` | `submitJobToTheGrid(EmbeddedLiveUserAgent user, java.util.Properties jdf_props)` Makes target EmbeddedLiveUserAgent submit a Job from target JDF (convenience method).
`java.lang.String` | `toString()` String representation of the User.

Methods inherited from class lbg.user.LiveUserAgent
`completedJobs, hasRunningJobs, host, isAlive, notifyCompletedJob, notifyCompletedTask, port, registerListener, service, startService, startService, submitJob, submittedJobs, unRegisterListener`

Methods inherited from class lbg.user.UserAgent
`id, usedPeer`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### EmbeddedLiveUserAgent

    public EmbeddedLiveUserAgent(java.lang.String id,
                                 java.lang.String user_hostname,
                                 int user_port,
                                 UserPeerHandle peer_handle,
                                 java.lang.String output_dir)
                          throws GridException

  Creates an EmbeddedLiveUserAgent.

  Parameters:
    `id` - User id
    `user_hostname` - User hostname
    `user_port` - User port
    `peer_handle` - used Peer
    `output_dir` - path to the directory where log files will be saved
  Throws:
    `GridException` - if a parameter is illegal, or if the used Peer cannot be contacted

Method Detail

### toString

    public java.lang.String toString()

  Description copied from class: `LiveUserAgent`
  String representation of the User.

  Overrides:
    `toString` in class `LiveUserAgent`

### submitJob

    public int submitJob(java.util.Properties jdf_props)
                  throws GridException

  Submits a Job.

  Parameters:
    `jdf_props` - descriptor of the Job to submit, stored as Properties
  Returns:
    submitted job id
  Throws:
    `GridException` - if a Job with the same id has already been sent

### startUser

    public static EmbeddedLiveUserAgent startUser(java.lang.String user_hostname,
                                                  int user_port,
                                                  java.lang.String peer_hostname,
                                                  int peer_port,
                                                  java.lang.String user_logs_dir)

  Creates a new EmbeddedLiveUserAgent (convenience method).

  The User service is immediately created in a separate thread.

  Parameters:
    `user_hostname` - User hostname
    `user_port` - User port
    `peer_hostname` - Peer hostname
    `peer_port` - User port
    `user_logs_dir` - path to the directory where log files will be saved
  Returns:
    EmbeddedLiveUserAgent, or null if one cannot be created

### submitJobToTheGrid

    public static int submitJobToTheGrid(EmbeddedLiveUserAgent user,
                                         java.util.Properties jdf_props)

  Makes target EmbeddedLiveUserAgent submit a Job from target JDF (convenience method).

  Parameters:
    `user` - target User
    `jdf_props` - target JDF
  Returns:
    Job id if Job was successfully submitted, -1 otherwise

### shutdownUser

    public static void shutdownUser(EmbeddedLiveUserAgent user)

  Gracefully shutdown target EmbeddedLiveUserAgent (convenience method).

  Basically, waits for all Jobs to complete cleanly, i.e. that all results are successfully uploaded.

  Parameters:
    `user` - target User

### describeEmbeddedJob

    public static java.util.Properties describeEmbeddedJob(int task_count,
                                                           java.lang.String embedded_task_jar,
                                                           java.lang.String embedded_task_main,
                                                           int embedded_task_port,
                                                           java.lang.String ctrlr_hostname,
                                                           int ctrlr_port)

  Describes, as a Properties and with the target values, a Job to be sumbitted by an EmbeddedLiveUserAgent (convenience method).

  Parameters:
    `task_count` - Task count
    `embedded_task_jar` - path to application jar of embedded Task
    `embedded_task_main` - main class of application jar
    `ctrlr_hostname` - hostname of server to be contacted by embedded Task
    `ctrlr_port` - port of server to be contacted by embedded Task
  Returns:
    embdded BoT description, or null if one or more parameters describing the Job is not legal

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Throws:
    `java.lang.Exception`

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.