orca.shirako.core
Class Authority

java.lang.Object
  extended by orca.shirako.core.Actor
      extended by orca.shirako.core.Authority
All Implemented Interfaces:
IActor, IActorIdentity, IActorPublic, IAuthority, IAuthorityPublic, IBrokerPublic, IInitialize, IRecover, IReservationOperations, ISerialize, IServerActor, IServerPublic, ISliceOperations, ITick

public class Authority
extends Actor
implements IAuthority

Authority is the base implementation for a site authority actor.


Field Summary
 
Fields inherited from class orca.shirako.core.Actor
clock, currentCycle, DefaultDescription, description, firstTick, fromDB, guid, identity, kernel, logger, monitor, policy, PropertyAuthToken, PropertyDescription, PropertyManager, PropertyMapper, PropertyMapperClass, PropertyPlugin, PropertyPluginClass, PropertyType, recovered, spi, stopped, type, wrapper
 
Fields inherited from interface orca.shirako.api.IActor
PropertyClass, PropertyGuid, PropertyName, TypeAll, TypeBroker, TypeServiceManager, TypeSiteAuthority
 
Constructor Summary
Authority()
          Creates a new default instance.
Authority(AuthToken identity, ActorClock clock)
          Creates a new authority with the given identity and clock factory.
 
Method Summary
 void available(ResourceSet resources)
          Informs the actor that the following resources are available for allocation.
 void claim(ResourceReservation reservation, IClientCallbackProxy callback, AuthToken caller)
          Services a request to claim a previously exported ticket.
 void close(ResourceReservation reservation, AuthToken caller)
          Closes the reservation.
protected  void closeExpiring(long cycle)
          Close expiring reservations
 void donate(ReservationClient reservation)
          Accepts ticketed resources to be used for allocation of client requests.
 void donate(ResourceSet resources)
          Accepts concrete resources to be used for allocation of client requests.
 void eject(ResourceSet resources)
          Ejects the specified resources from the inventory.
 void export(BrokerReservation reservation, AuthToken client)
          Exports the resources described by the reservation to the client.
 ReservationID export(ResourceSet resources, Term term, AuthToken authToken)
          Exports the specified resources for the given period of time to the client.
 void extendLease(AuthorityReservation reservation)
          Processes an extend lease request for the reservation.
 void extendLease(ResourceReservation reservation, AuthToken caller)
          Extends a lease.
 void extendTicket(ResourceReservation reservation, AuthToken caller)
          Services an incoming request to extend an existing ticket.
 void freed(ResourceSet resources)
          Informs the actor that the given resources are no longer in use and can be considered as free, regardless of the state of the individual units.
 void initialize()
          Initializes a generic actor.
 void redeem(AuthorityReservation reservation)
          Processes a redeem request for the reservation.
 void redeem(ResourceReservation reservation, IServiceManagerCallbackProxy callback, AuthToken caller)
          Redeems a lease.
 void ticket(ResourceReservation reservation, IClientCallbackProxy callback, AuthToken caller)
          Services an incoming request for a new ticket.
protected  void tickHandler()
          Driven by clock downcalls.
 int unavailable(ResourceSet resources)
          Informs the actor that previously donated resources are no longer available for allocation.
 void updateTicket(IReservation reservation, UpdateData udd, AuthToken caller)
           
 
Methods inherited from class orca.shirako.core.Actor
actorAdded, close, close, close, error, extend, extend, externalTick, getActorClock, getClientSlices, getCurrentCycle, getDescription, getGuid, getIdentity, getInventorySlices, getKernel, getLogger, getName, getName, getPolicy, getReservation, getReservations, getShirakoPlugin, getSlice, getSlices, getType, getType, initializeKeyStore, internalError, isFromDatabase, isRecovered, isStopped, query, recover, register, registerSlice, removeReservation, removeReservation, removeSlice, removeSlice, reregister, reregisterSlice, reset, reset, revisit, save, save, setActorClock, setDescription, setGuid, setIdentity, setLogger, setPolicy, setRecovered, setShirakoPlugin, setStopped, start, stop, toString, unregister, unregister, unregisterSlice, unregisterSlice
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface orca.shirako.api.IActor
actorAdded, getActorClock, getCurrentCycle, getDescription, getLogger, getPolicy, getShirakoPlugin, getType, initializeKeyStore, isFromDatabase, isRecovered, isStopped, recover, setActorClock, setDescription, setGuid, setIdentity, setLogger, setPolicy, setRecovered, setShirakoPlugin, start, stop
 
Methods inherited from interface orca.shirako.api.ITick
externalTick
 
Methods inherited from interface orca.shirako.api.ISerialize
reset, save, save
 
Methods inherited from interface orca.shirako.api.IRecover
revisit
 
Methods inherited from interface orca.shirako.api.IActorPublic
query
 
Methods inherited from interface orca.shirako.api.IActorIdentity
getGuid, getIdentity, getName
 
Methods inherited from interface orca.shirako.api.ISliceOperations
getClientSlices, getInventorySlices, getSlice, getSlices, registerSlice, removeSlice, removeSlice, reregisterSlice, unregisterSlice, unregisterSlice
 
Methods inherited from interface orca.shirako.api.IReservationOperations
close, close, close, extend, extend, getReservation, getReservations, register, removeReservation, removeReservation, reregister, unregister, unregister
 

Constructor Detail

Authority

public Authority()
Creates a new default instance.


Authority

public Authority(AuthToken identity,
                 ActorClock clock)
Creates a new authority with the given identity and clock factory.

Parameters:
identity - actor identity
clock - clock factory
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from class: Actor
Initializes a generic actor.

Specified by:
initialize in interface IInitialize
Overrides:
initialize in class Actor
Throws:
java.lang.Exception - Throws exception of some required fields are missing.

donate

public void donate(ReservationClient reservation)
            throws java.lang.Exception
Description copied from interface: IServerActor
Accepts ticketed resources to be used for allocation of client requests.

Specified by:
donate in interface IServerActor
Throws:
java.lang.Exception

donate

public void donate(ResourceSet resources)
            throws java.lang.Exception
Description copied from interface: IAuthority
Accepts concrete resources to be used for allocation of client requests.

Specified by:
donate in interface IAuthority
Parameters:
resources - resource set representing resources to be used for allocation
Throws:
java.lang.Exception

freed

public void freed(ResourceSet resources)
           throws java.lang.Exception
Description copied from interface: IAuthority
Informs the actor that the given resources are no longer in use and can be considered as free, regardless of the state of the individual units.

Specified by:
freed in interface IAuthority
Parameters:
resources - resource set representing freed resources
Throws:
java.lang.Exception

eject

public void eject(ResourceSet resources)
           throws java.lang.Exception
Description copied from interface: IAuthority
Ejects the specified resources from the inventory.

Specified by:
eject in interface IAuthority
Throws:
java.lang.Exception

available

public void available(ResourceSet resources)
               throws java.lang.Exception
Description copied from interface: IAuthority
Informs the actor that the following resources are available for allocation.

Specified by:
available in interface IAuthority
Throws:
java.lang.Exception

unavailable

public int unavailable(ResourceSet resources)
                throws java.lang.Exception
Description copied from interface: IAuthority
Informs the actor that previously donated resources are no longer available for allocation.

Specified by:
unavailable in interface IAuthority
Throws:
java.lang.Exception

redeem

public void redeem(AuthorityReservation reservation)
            throws java.lang.Exception
Description copied from interface: IAuthority
Processes a redeem request for the reservation.

Specified by:
redeem in interface IAuthority
Parameters:
reservation - reservation representing a request for a new lease
Throws:
java.lang.Exception

extendLease

public void extendLease(AuthorityReservation reservation)
                 throws java.lang.Exception
Description copied from interface: IAuthority
Processes an extend lease request for the reservation.

Specified by:
extendLease in interface IAuthority
Parameters:
reservation - reservation representing a request for a lease extension
Throws:
java.lang.Exception

export

public ReservationID export(ResourceSet resources,
                            Term term,
                            AuthToken authToken)
                     throws java.lang.Exception
Description copied from interface: IServerActor
Exports the specified resources for the given period of time to the client.

Specified by:
export in interface IServerActor
Parameters:
resources - resources to export
term - period the export will be valid
authToken - identity of the client resources will be exported to
Throws:
java.lang.Exception

export

public void export(BrokerReservation reservation,
                   AuthToken client)
            throws java.lang.Exception
Description copied from interface: IServerActor
Exports the resources described by the reservation to the client.

Specified by:
export in interface IServerActor
Parameters:
reservation - reservation describing resources to export
client - identity of the client resources will be exported to
Throws:
java.lang.Exception

updateTicket

public void updateTicket(IReservation reservation,
                         UpdateData udd,
                         AuthToken caller)
                  throws java.lang.Exception
Throws:
java.lang.Exception

ticket

public void ticket(ResourceReservation reservation,
                   IClientCallbackProxy callback,
                   AuthToken caller)
            throws java.lang.Exception
Description copied from interface: IBrokerPublic
Services an incoming request for a new ticket.

Specified by:
ticket in interface IBrokerPublic
Parameters:
reservation - reservation object describing the requested resources
callback - callback to use for sending the result
caller - caller credentials
Throws:
java.lang.Exception

extendTicket

public void extendTicket(ResourceReservation reservation,
                         AuthToken caller)
                  throws java.lang.Exception
Description copied from interface: IBrokerPublic
Services an incoming request to extend an existing ticket.

Specified by:
extendTicket in interface IBrokerPublic
Parameters:
reservation - reservation object describing the reservation to extend
caller - caller credentials
Throws:
java.lang.Exception

claim

public void claim(ResourceReservation reservation,
                  IClientCallbackProxy callback,
                  AuthToken caller)
           throws java.lang.Exception
Description copied from interface: IBrokerPublic
Services a request to claim a previously exported ticket.

Specified by:
claim in interface IBrokerPublic
Parameters:
reservation - reservation object describing the exported resources
callback - callback to use for sending the result
caller - caller credentials
Throws:
java.lang.Exception

redeem

public void redeem(ResourceReservation reservation,
                   IServiceManagerCallbackProxy callback,
                   AuthToken caller)
            throws java.lang.Exception
Description copied from interface: IAuthorityPublic
Redeems a lease.

Specified by:
redeem in interface IAuthorityPublic
Parameters:
reservation - reservation to redeem
callback - callback object
caller - owner of the reservation
Throws:
java.lang.Exception

extendLease

public void extendLease(ResourceReservation reservation,
                        AuthToken caller)
                 throws java.lang.Exception
Description copied from interface: IAuthorityPublic
Extends a lease.

Specified by:
extendLease in interface IAuthorityPublic
Parameters:
reservation - reservation to extend
caller - owner of the reservation
Throws:
java.lang.Exception

close

public void close(ResourceReservation reservation,
                  AuthToken caller)
           throws java.lang.Exception
Description copied from interface: IAuthorityPublic
Closes the reservation.

Specified by:
close in interface IAuthorityPublic
Parameters:
reservation - the reservation
caller - the slice owner
Throws:
java.lang.Exception

tickHandler

protected void tickHandler()
                    throws java.lang.Exception
Driven by clock downcalls. ManagerLock is not held, and must not be held. All routines should have no side effects where there is nothing to do, i.e., they are idempotent. For now exceptions throw all the way up, so an exception means the housekeeping was only partially done. (could retry) All code in this file is synchronous with externalTick(), except for external queries (e.g., web interface). Actor calls in externalTick() should catch and log/mark all exceptions, so that reservation operations are not interrupted.

Overrides:
tickHandler in class Actor
Throws:
java.lang.Exception

closeExpiring

protected void closeExpiring(long cycle)
Close expiring reservations



Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.