orca.shirako.core
Class Ticket

java.lang.Object
  extended by orca.shirako.core.Ticket
All Implemented Interfaces:
IConcreteSet, IRecover, ISerialize

public class Ticket
extends java.lang.Object
implements IConcreteSet


Field Summary
protected  IAuthorityProxy authority
          The authority who owns the resources described in this concrete set
protected  LoggingTool logger
          The logger
protected  int oldUnits
          Units we used to have before the current extend
protected  IShirakoPlugin plugin
          The plugin object
protected  java.util.Properties properties
          Properties set by brokers and delivered to the site
static java.lang.String PropertyAuthority
           
static java.lang.String PropertyDivisible
           
static java.lang.String PropertyIdentifiers
           
static java.lang.String PropertyOldUnits
           
static java.lang.String PropertyProperties
           
static java.lang.String PropertyTerm
           
static java.lang.String PropertyType
           
static java.lang.String PropertyUnits
           
protected  ResourceReservation reservation
          The reservation this TicketStub belongs to
protected  Term term
          The term
protected  ResourceType type
          The resource type
protected  int units
          The number of units
 
Constructor Summary
Ticket()
           
Ticket(IShirakoPlugin plugin, IAuthorityProxy authority, ResourceReservation reservation)
          Creates a new TicketStub
Ticket(IShirakoPlugin plugin, LoggingTool logger, IAuthorityProxy authority, ResourceType type, int units, Term term)
          Creates a new TicketStub with an empty slice name
Ticket(IShirakoPlugin plugin, LoggingTool logger, Ticket cset)
           
Ticket(Ticket cset)
           
 
Method Summary
 void add(IConcreteSet cs, boolean configure)
          Adds the passed set to the current set.
 void change(IConcreteSet cs, Term term, boolean configure)
          Make changes to the resources committed to this concrete set.
 IConcreteSet clone()
          Makes a clone of the concrete set.
 IConcreteSet cloneEmpty()
          Makes an "empty" clone of this concrete set.
 void close()
          Close - empty method
 IConcreteSet collectReleased()
          ConcreteSet operations not meaningful to TicketStub
 void destroy()
          Destroy the reservation
 void extend(Term term)
          Extend the term on the reservation
 IConcreteSet extract(int count, Term t, java.util.Properties properties, AuthToken client)
          Write a new subticket for some subset of the units and some subinterval of the term covered by this ticket.
 LoggingTool getLogger()
           
 java.lang.String getNotices()
          Gets a string of notices or events pertaining to the underlying resources.
 int getOldUnits()
          Returns the previous number of units
 java.util.Properties getProperties()
          Returns the properties
 java.util.Properties getProperties(boolean create)
           
 IAuthorityProxy getSiteProxy()
          Return a proxy for the site authority that controls the resources named in this ticket.
 Term getTerm()
          Returns the ticket term
 ITicket getTicket()
          Returns the physical ticket
 ResourceType getType()
          Returns the resource type of the associated ticket
 int getUnits()
          Returns the number of units
 int holding(java.util.Date slotDate)
          Returns how many units are in the set at the given time instance.
 int holding(Term t)
          Returns how many units will be in the set for the given period of time.
 boolean isActive()
          Active - valid tickets are always "active" if anyone asks.
 void modify(IConcreteSet cs, boolean configure)
          Updates the units in the current set with information contained in the passed set.
 void probe()
          Probe - empty method
 void remove(IConcreteSet cs, boolean configure)
          Removes the passed set from the current set.
 void reset(java.util.Properties properties)
          De-serializes the object from the given properties list.
 void revisit(IActor actor, java.util.Properties p)
          Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to.
 java.util.Properties save()
          Serializes the object into a properties list.
 void save(java.util.Properties p)
          Serializes the object into the given properties list.
 IConcreteSet selectExtract(int count, java.util.Properties p)
           
 void setLogger(LoggingTool logger)
           
 void setProperties(java.util.Properties p)
          Sets the properties
 void setShirakoPlugin(IShirakoPlugin plugin)
           
 void setSiteProxy(IAuthorityProxy site)
          Set the proxy for the site authority
 void setTicket(ITicket ticket)
          Sets the physical ticket
 void setup(ResourceReservation reservation)
          Indicates that we're committing resources to a client (on an an agent).
 java.lang.String toString()
           
 void validateConcrete(ResourceType type, int units, Term t)
          Validate that the concrete set matches the abstract resource set parameters.
 void validateIncoming()
          Validate the incoming ticket and add to the local TicketSet - no-op
 void validateOutgoing()
          Validate the outgoing ticket - no-op
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PropertyType

public static java.lang.String PropertyType

PropertyUnits

public static java.lang.String PropertyUnits

PropertyOldUnits

public static java.lang.String PropertyOldUnits

PropertyAuthority

public static java.lang.String PropertyAuthority

PropertyTerm

public static java.lang.String PropertyTerm

PropertyProperties

public static java.lang.String PropertyProperties

PropertyIdentifiers

public static final java.lang.String PropertyIdentifiers
See Also:
Constant Field Values

PropertyDivisible

public static final java.lang.String PropertyDivisible
See Also:
Constant Field Values

plugin

protected IShirakoPlugin plugin
The plugin object


logger

protected LoggingTool logger
The logger


reservation

protected ResourceReservation reservation
The reservation this TicketStub belongs to


authority

protected IAuthorityProxy authority
The authority who owns the resources described in this concrete set


type

protected ResourceType type
The resource type


units

protected int units
The number of units


term

protected Term term
The term


oldUnits

protected int oldUnits
Units we used to have before the current extend


properties

protected java.util.Properties properties
Properties set by brokers and delivered to the site

Constructor Detail

Ticket

public Ticket()

Ticket

public Ticket(IShirakoPlugin plugin,
              LoggingTool logger,
              IAuthorityProxy authority,
              ResourceType type,
              int units,
              Term term)
Creates a new TicketStub with an empty slice name


Ticket

public Ticket(IShirakoPlugin plugin,
              IAuthorityProxy authority,
              ResourceReservation reservation)
Creates a new TicketStub


Ticket

public Ticket(IShirakoPlugin plugin,
              LoggingTool logger,
              Ticket cset)

Ticket

public Ticket(Ticket cset)
Method Detail

cloneEmpty

public IConcreteSet cloneEmpty()
Description copied from interface: IConcreteSet
Makes an "empty" clone of this concrete set. An "empty" clone is a copy of a concrete set with the "set" removed from it.

Specified by:
cloneEmpty in interface IConcreteSet
Returns:
an "empty" clone of this concrete set

clone

public IConcreteSet clone()
Description copied from interface: IConcreteSet
Makes a clone of the concrete set. Unlike IConcreteSet.cloneEmpty(), this method preserves the set: the set elements are the same objects as the original IConcreteSet, but the indexing structures are different. That is, adding/removing units to the original should not affect the clone. But modifications to an individual unit should be visible form the original and the clone.

Specified by:
clone in interface IConcreteSet
Overrides:
clone in class java.lang.Object
Returns:
a clone of the concrete set

extract

public IConcreteSet extract(int count,
                            Term t,
                            java.util.Properties properties,
                            AuthToken client)
                     throws java.lang.Exception
Write a new subticket for some subset of the units and some subinterval of the term covered by this ticket. Note that we do not modify the source ticket or its TicketStub. This is because the choice to oversubscribe (or not) is in the mapper rather than way down here.

Specified by:
extract in interface IConcreteSet
Parameters:
count - how many units to extract
t - the subinterval of the new subset of tickets
properties - properties to attach to the extracted resources. If any, these properties will replace any properties contained in the set the resources are being extracted from.
client - the client to extract resources to
Returns:
new IConcreteSet representing the extracted resources.
Throws:
java.lang.Exception - thrown if ticket term does not cover the extract set term or if the ticket has insufficient units

selectExtract

public IConcreteSet selectExtract(int count,
                                  java.util.Properties p)
                           throws java.lang.Exception
Throws:
java.lang.Exception

validateIncoming

public void validateIncoming()
                      throws java.lang.Exception
Validate the incoming ticket and add to the local TicketSet - no-op

Specified by:
validateIncoming in interface IConcreteSet
Throws:
java.lang.Exception

validateOutgoing

public void validateOutgoing()
                      throws java.lang.Exception
Validate the outgoing ticket - no-op

Specified by:
validateOutgoing in interface IConcreteSet
Throws:
java.lang.Exception

validateConcrete

public void validateConcrete(ResourceType type,
                             int units,
                             Term t)
                      throws java.lang.Exception
Description copied from interface: IConcreteSet
Validate that the concrete set matches the abstract resource set parameters.

Specified by:
validateConcrete in interface IConcreteSet
Parameters:
type - abstract resources resource type
units - abstract resources units
t - abstract resources term
Throws:
java.lang.Exception

holding

public int holding(Term t)
Description copied from interface: IConcreteSet
Returns how many units will be in the set for the given period of time.

Specified by:
holding in interface IConcreteSet
Parameters:
t - period of time
Returns:
how many units will be in the set for the given period of time

holding

public int holding(java.util.Date slotDate)
Description copied from interface: IConcreteSet
Returns how many units are in the set at the given time instance.

Specified by:
holding in interface IConcreteSet
Parameters:
slotDate - time instance
Returns:
how many units how many units will be in the set for the given period of time

getSiteProxy

public IAuthorityProxy getSiteProxy()
Return a proxy for the site authority that controls the resources named in this ticket.

Specified by:
getSiteProxy in interface IConcreteSet
Returns:
the authority that controls the resources of the ticket

setSiteProxy

public void setSiteProxy(IAuthorityProxy site)
Set the proxy for the site authority

Specified by:
setSiteProxy in interface IConcreteSet
Parameters:
site - the for this ticket

setup

public void setup(ResourceReservation reservation)
Indicates that we're committing resources to a client (on an an agent). May need to touch TicketSet database since we're committing it. On a client (service manager) this indicates that we have successfully scored a ticket. The ticket has already been validated with validate*().

Specified by:
setup in interface IConcreteSet
Parameters:
sname - the slice for the reservation
rid - the reservation id
term - the reservation term
properties - any properties of the reservation
Throws:
java.lang.Exception

add

public void add(IConcreteSet cs,
                boolean configure)
         throws java.lang.Exception
Description copied from interface: IConcreteSet
Adds the passed set to the current set. Optionally triggers configuration actions on all added units. If the lease term for the concrete set has changed, this call must be followed by a call to IConcreteSet.extend(Term).

Specified by:
add in interface IConcreteSet
Parameters:
cs - set to add
configure - if true, configuration actions will be triggered for all added units
Throws:
java.lang.Exception

remove

public void remove(IConcreteSet cs,
                   boolean configure)
            throws java.lang.Exception
Description copied from interface: IConcreteSet
Removes the passed set from the current set. Optionally triggers configuration actions for all removed units. If the lease term for the concrete set has changed, this call must be followed by a call to IConcreteSet.extend(Term).

Specified by:
remove in interface IConcreteSet
Parameters:
cs - set to remove
configure - if true, configuration actions will be triggered for all removed units
Throws:
java.lang.Exception

modify

public void modify(IConcreteSet cs,
                   boolean configure)
            throws java.lang.Exception
Description copied from interface: IConcreteSet
Updates the units in the current set with information contained in the passed set. Note that the passed set may contain only a subset of the units contained in the current set. Optionally triggers configuration actions for all removed units. If the lease term for the concrete set has changed, this call must be followed by a call to IConcreteSet.extend(Term).

Specified by:
modify in interface IConcreteSet
Parameters:
cs - set containing the update data
configure - if true, configuration actions will be triggered for all modified units
Throws:
java.lang.Exception

change

public void change(IConcreteSet cs,
                   Term term,
                   boolean configure)
            throws java.lang.Exception
Make changes to the resources committed to this concrete set.

Specified by:
change in interface IConcreteSet
Parameters:
new - concrete resources
new - term
Throws:
java.lang.Exception - thrown if something is wrong

extend

public void extend(Term term)
            throws java.lang.Exception
Extend the term on the reservation

Specified by:
extend in interface IConcreteSet
Parameters:
term - the revised term
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Destroy the reservation

Specified by:
destroy in interface IConcreteSet
Throws:
java.lang.Exception

collectReleased

public IConcreteSet collectReleased()
                             throws java.lang.Exception
ConcreteSet operations not meaningful to TicketStub

Specified by:
collectReleased in interface IConcreteSet
Returns:
a concrete set containing released and or/failed resources
Throws:
java.lang.Exception - thrown when method is called

probe

public void probe()
           throws java.lang.Exception
Probe - empty method

Specified by:
probe in interface IConcreteSet
Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Close - empty method

Specified by:
close in interface IConcreteSet
Throws:
java.lang.Exception

isActive

public boolean isActive()
Active - valid tickets are always "active" if anyone asks.

Specified by:
isActive in interface IConcreteSet
Returns:
true

save

public java.util.Properties save()
                          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into a properties list.

Specified by:
save in interface ISerialize
Returns:
properties list representing this object
Throws:
java.lang.Exception

save

public void save(java.util.Properties p)
          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into the given properties list.

Specified by:
save in interface ISerialize
Parameters:
p - properties list to serialize the object into
Throws:
java.lang.Exception

reset

public void reset(java.util.Properties properties)
           throws java.lang.Exception
Description copied from interface: ISerialize
De-serializes the object from the given properties list.

Specified by:
reset in interface ISerialize
Parameters:
properties - properties list containing the serialized version of the object
Throws:
java.lang.Exception

revisit

public void revisit(IActor actor,
                    java.util.Properties p)
             throws java.lang.Exception
Description copied from interface: IRecover
Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to. The component can use the actor object to access other objects necessary for its complete recovery.

Specified by:
revisit in interface IRecover
Parameters:
actor - actor object the component belongs to
p - properties list containing configuration data about the component
Throws:
java.lang.Exception

setLogger

public void setLogger(LoggingTool logger)

getLogger

public LoggingTool getLogger()

setShirakoPlugin

public void setShirakoPlugin(IShirakoPlugin plugin)
Specified by:
setShirakoPlugin in interface IConcreteSet

getNotices

public java.lang.String getNotices()
Gets a string of notices or events pertaining to the underlying resources. The event notices are consumed: subsequent calls return only new information. May return null.

Specified by:
getNotices in interface IConcreteSet

toString

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

getType

public ResourceType getType()
Returns the resource type of the associated ticket


getUnits

public int getUnits()
Returns the number of units

Specified by:
getUnits in interface IConcreteSet
Returns:
number of units contained in the set

getOldUnits

public int getOldUnits()
Returns the previous number of units


getTerm

public Term getTerm()
Returns the ticket term


setTicket

public void setTicket(ITicket ticket)
Sets the physical ticket

Parameters:
ticket -

getTicket

public ITicket getTicket()
Returns the physical ticket

Returns:
physical ticket

setProperties

public void setProperties(java.util.Properties p)
Sets the properties

Parameters:
p -

getProperties

public java.util.Properties getProperties()
Returns the properties

Returns:

getProperties

public java.util.Properties getProperties(boolean create)


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