UNICORE Resource Broker NJS Plugin
1.5α1

org.eurogrid.broker.server
Class TicketManager

java.lang.Object
  |
  +--org.eurogrid.broker.server.TicketManager

public class TicketManager
extends Object

Persistent ticket management engine.

Since:
1.3
Version:
$Revision: 1.4 $, $Date: 2004/02/17 11:32:40 $
Author:
Donal K. Fellows
See Also:
ResourceBroker, Ticket

Field Summary
 int GRACE_PERIOD
          Time from expiry to point when the expired ticket reaper will consider the ticket to be fair game in milliseconds.
 int REAPER_INTERVAL
          Time between runs of the expired ticket reaper in milliseconds.
 
Method Summary
 void associateResources(Ticket ticket, ResourceSet resources)
          Bind a set of resources to the ticket.
static TicketManager getInstance()
          There is one ticket manager per NJS.
 ResourceSet getResources(Ticket ticket)
          Get the set of resources bound to the given ticket.
 Ticket issueTicket(String text, int validity)
          Issue a new unsigned ticket.
 Iterator listTickets()
          List the currently valid tickets that are bound to resources.
 void relinquish(Ticket ticket)
          Tell the ticket manager that the given ticket is definitely no longer interesting and may be deleted from the persistent store immediately.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRACE_PERIOD

public final int GRACE_PERIOD
Time from expiry to point when the expired ticket reaper will consider the ticket to be fair game in milliseconds.

See Also:
Constant Field Values

REAPER_INTERVAL

public final int REAPER_INTERVAL
Time between runs of the expired ticket reaper in milliseconds.

See Also:
Constant Field Values
Method Detail

associateResources

public void associateResources(Ticket ticket,
                               ResourceSet resources)
                        throws ResourceCheckerException
Bind a set of resources to the ticket. This will also sign the ticket with (presumably) the NJS's certificate (if we support ticket signing) and put the ticket under the care of the persistent ticket store management code.

Parameters:
ticket - The ticket to bind
resources - The resource set to associate with the ticket
Throws:
ResourceCheckerException - If the ticket has already been bound.

getInstance

public static TicketManager getInstance()
There is one ticket manager per NJS. Get a handle to it.


getResources

public ResourceSet getResources(Ticket ticket)
                         throws ResourceCheckerException
Get the set of resources bound to the given ticket. This should also check that the ticket is signed by this ticket manager.

Throws:
ResourceCheckerException - If the ticket isn't one we have issued and got bound to a resource set, either because the ticket is unsigned or because the ticket is not in our ticket store. Also thrown if the ticket has expired.

issueTicket

public Ticket issueTicket(String text,
                          int validity)
Issue a new unsigned ticket. The ticket will not become persistent until some resources are attached to it.

Parameters:
text - The text of the ticket
validity - How long the ticket will be valid for, in hours.

listTickets

public Iterator listTickets()
List the currently valid tickets that are bound to resources. Note that this is a snapshot of the store state, and any updates that occur while the iteration is occurring will not be seen. The order of the returned tickets is undefined.


relinquish

public void relinquish(Ticket ticket)
Tell the ticket manager that the given ticket is definitely no longer interesting and may be deleted from the persistent store immediately.


UNICORE Resource Broker NJS Plugin
1.5α1

Submit a bug or feature
Copyright © 2002-2004 University of Manchester, U.K. See license.terms for details.