Lightweight Bartering Grid

lbg.simulator.event
Class EventFactory

java.lang.Object
  extended by lbg.simulator.event.EventFactory

public class EventFactory
extends java.lang.Object

Event factory.

Author:
Cyril Briquet

Constructor Summary
EventFactory(Scenario sc)
          Creates a new EventFactory.
 
Method Summary
 Event createCompletedTaskEvent(java.lang.String consumer_id, java.lang.String supplier_id, Task t, Resource res)
          Creates a CompletedTaskEvent so that target Task, submitted by target Consumer Peer, is completed by target Resource of target Supplier Peer, after the expected Task runtime from now.
 Event createFailedTaskEvent(java.lang.String consumer_id, java.lang.String supplier_id, Task t, Resource res)
          Creates a FailedTaskEvent so that target Task, submitted by target Consumer Peer, is cancelled by target Resource of target Supplier Peer, between now and the expected Task runtime from now.
 Event createJobEvent(UserAgent user, java.lang.String owner_id)
          Creates a SubmittedJobEvent so that target UserAgent submits, at a legal random time from now, a Job to target Peer.
 Event createJobEvent(UserAgent user, java.lang.String owner_id, long base_time)
          Creates a SubmittedJobEvent so that target UserAgent submits, at a legal random time from target base time, a Job to target Peer.
 Event createSelfEvent()
          Creates a SelfEvent.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventFactory

public EventFactory(Scenario sc)
             throws GridException
Creates a new EventFactory.

Parameters:
sc - target Scenario
Throws:
GridException - if a parameter is illegal
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createJobEvent

public Event createJobEvent(UserAgent user,
                            java.lang.String owner_id)
                     throws GridException
Creates a SubmittedJobEvent so that target UserAgent submits, at a legal random time from now, a Job to target Peer.

Parameters:
user - target UserAgent
owner_id - target Peer id
Returns:
created SubmittedJobEvent
Throws:
GridException - if a parameter is illegal

createJobEvent

public Event createJobEvent(UserAgent user,
                            java.lang.String owner_id,
                            long base_time)
                     throws GridException
Creates a SubmittedJobEvent so that target UserAgent submits, at a legal random time from target base time, a Job to target Peer.

Parameters:
user - target UserAgent
owner_id - target Peer id
base_time - target base time
Returns:
created SubmittedJobEvent
Throws:
GridException - if a parameter is illegal

createCompletedTaskEvent

public Event createCompletedTaskEvent(java.lang.String consumer_id,
                                      java.lang.String supplier_id,
                                      Task t,
                                      Resource res)
                               throws GridException
Creates a CompletedTaskEvent so that target Task, submitted by target Consumer Peer, is completed by target Resource of target Supplier Peer, after the expected Task runtime from now.

Parameters:
consumer_id - target Consumer Peer id
supplier_id - target Supplier Peer id
t - target Task
res - target Resource
Returns:
created CompletedTaskEvent
Throws:
GridException - if a parameter is illegal

createFailedTaskEvent

public Event createFailedTaskEvent(java.lang.String consumer_id,
                                   java.lang.String supplier_id,
                                   Task t,
                                   Resource res)
                            throws GridException
Creates a FailedTaskEvent so that target Task, submitted by target Consumer Peer, is cancelled by target Resource of target Supplier Peer, between now and the expected Task runtime from now.

Parameters:
consumer_id - target Consumer Peer id
supplier_id - target Supplier Peer id
t - target Task
res - target Resource
Returns:
created FailedTaskEvent
Throws:
GridException - if a parameter is illegal

createSelfEvent

public Event createSelfEvent()
                      throws GridException
Creates a SelfEvent.

Returns:
created SelfEvent
Throws:
GridException - if a parameter is illegal

Lightweight Bartering Grid

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