orca.shirako.kernel
Class Slice

java.lang.Object
  extended by orca.shirako.kernel.Slice
All Implemented Interfaces:
java.lang.Cloneable, ISerialize, ISlice
Direct Known Subclasses:
CodSlice

public class Slice
extends java.lang.Object
implements ISlice, java.lang.Cloneable, ISerialize

Slice implementation. A slice has a globally unique identifier, name, description, property list, an owning identity, an access control list, and a set of reservations.

This class is used within the Service Manager, which may hold reservations on many sites; on the Broker, which may have provided tickets to the slice for reservations at many sites; and on the site Authority, where each slice may hold multiple reservations for resources at that site.


Field Summary
protected  IController controller
          Controller associated with the slice.
protected  java.lang.String description
          Description string.
protected  Guard guard
          Access control monitor.
protected  SliceID guid
          Globally unique identifier.
protected  AuthToken owner
          The owner of the slice.
static java.lang.String PropertyClass
           
static java.lang.String PropertyController
           
static java.lang.String PropertyControllerClass
           
static java.lang.String PropertyDescription
           
static java.lang.String PropertyGuard
           
static java.lang.String PropertyGuid
           
static java.lang.String PropertyName
           
static java.lang.String PropertyOwner
           
static java.lang.String PropertyProperties
           
static java.lang.String PropertyResourceType
           
static java.lang.String PropertyType
           
protected  ReservationSet reservations
          The reservations in this slice.
protected  ResourceType resourceType
          Resource type associated with this slice.
protected  ResourceData rsrcdata
          A collection of property lists inherited by each reservation in this slice.
protected  java.lang.String slicename
          Slice name.
protected  java.lang.String type
          The slice type: inventory or client.
 
Constructor Summary
Slice()
          Creates a new "blank" instance.
Slice(SliceID id, java.lang.String name)
          Creates a new slice with the given identifier.
Slice(SliceID id, java.lang.String name, ResourceData rdata)
          Create a new slice with the given name and properties.
Slice(java.lang.String name)
          Creates a new slice with the given name.
Slice(java.lang.String name, ResourceData rdata)
          Create a new slice with the given name and properties.
 
Method Summary
 Slice cloneRequest()
          Makes a minimal clone of this slice object sufficient for cross-actor calls.
static Slice createInstance(java.util.Properties p)
          Creates a slice object from a saved properties list.
 java.util.Properties getConfigurationProperties()
          Returns the slice configuration properties list (byte reference).
 IController getController()
          Returns the slice controller.
 java.lang.String getDescription()
          Returns the slice description.
 java.util.Properties getLocalProperties()
          Returns the slice local properties list (by reference).
 java.lang.String getName()
          Returns the slice name.
static java.lang.String getName(java.util.Properties p)
          Returns the slice name stored in a saved properties list.
 AuthToken getOwner()
          Returns the slice owner.
 java.util.Properties getRequestProperties()
          Returns the slice request properties list (by reference).
protected  ReservationSet getReservations()
          Returns the reservation set.
protected  ResourceReservation[] getReservationsArray()
          Returns the reservation set represented as an array.
 ResourceData getResourceData()
          Returns the slice properties.
 java.util.Properties getResourceProperties()
          Returns the slice resource properties list (by reference).
 ResourceType getResourceType()
          Returns the resource type of the slice.
 SliceID getSliceID()
          Returns the slice identifier.
static SliceID getSliceID(java.util.Properties p)
          Returns the slice identifier stored in a saved properties list.
 Guard Guard()
          Returns the slice guard.
 boolean isBrokerClient()
          Checks if the slice is a broker client slice (a client slice within an authority that represents a broker).
static boolean isBrokerClient(java.util.Properties p)
          Checks if the saved properties list represents a broker client slice.
 boolean isClient()
          Checks if the slice is a client slice.
static boolean isClient(java.util.Properties p)
          Checks if the saved properties list represents a client slice.
protected  boolean isEmpty()
          Checks if the slice is empty.
 boolean isInventory()
          Checks if the slice is an inventory slice.
static boolean isInventory(java.util.Properties p)
          Checks if the saved properties list represents an inventory slice.
protected  void prepare()
          Prepares to register a new slice.
protected  void register(ResourceReservation r)
          Registers a new reservation.
 void reset(java.util.Properties p)
          De-serializes the object from the given properties list.
 void revisit(IActor actor, java.util.Properties p)
           
 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.
 void setBrokerClient()
          Marks the slice as a broker client slice (a client slice within an authority that represents a broker).
 void setClient()
          Marks the slice as a client slice.
 void setController(IController controller)
          Attaches the controller for the slice.
 void setDescription(java.lang.String description)
          Sets the slice description.
 void setGuard(Guard g)
          Sets the slice guard.
 void setInventory(boolean value)
          Controls the inventory flag.
 void setName(java.lang.String name)
          Sets the slice name.
 void setOwner(AuthToken auth)
          Sets the slice owner.
 void setResourceData(ResourceData rsrcdata)
          Sets the slice properties.
 void setResourceType(ResourceType resourceType)
          Sets the slice resource type.
protected  ResourceReservation softLookup(ReservationID rid)
          Looks up a reservation by ID but do not throw error
 java.lang.String toString()
           
protected  void unregister(ResourceReservation r)
          Unregisters the reservation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PropertyControllerClass

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

PropertyController

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

PropertyType

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

PropertyDescription

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

PropertyOwner

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

PropertyGuard

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

PropertyClass

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

PropertyName

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

PropertyProperties

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

PropertyResourceType

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

PropertyGuid

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

guid

protected SliceID guid
Globally unique identifier.


slicename

protected java.lang.String slicename
Slice name. Not required to be globally or locally unique.


description

protected java.lang.String description
Description string. Has only local meaning.


rsrcdata

protected ResourceData rsrcdata
A collection of property lists inherited by each reservation in this slice. Properties defined on the reservation level override properties defined here.


type

protected java.lang.String type
The slice type: inventory or client.


owner

protected AuthToken owner
The owner of the slice.


guard

protected Guard guard
Access control monitor.


reservations

protected ReservationSet reservations
The reservations in this slice.


resourceType

protected ResourceType resourceType
Resource type associated with this slice. Used when the slice is used to represent an inventory pool.


controller

protected IController controller
Controller associated with the slice.

Constructor Detail

Slice

public Slice()
Creates a new "blank" instance. Should be used primarily for recovery purposes.


Slice

public Slice(java.lang.String name)
Creates a new slice with the given name. Generates a new slice identifier.

Parameters:
name - slice name

Slice

public Slice(SliceID id,
             java.lang.String name)
Creates a new slice with the given identifier.

Parameters:
id - slice identifier
name - slice name

Slice

public Slice(java.lang.String name,
             ResourceData rdata)
Create a new slice with the given name and properties. Generates a new slice identifier.

Parameters:
name - slice name
rdata - properties

Slice

public Slice(SliceID id,
             java.lang.String name,
             ResourceData rdata)
Create a new slice with the given name and properties.

Parameters:
id - slice identifier
name - slice name
rdata - properties
Method Detail

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 p)
           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:
p - 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
Throws:
java.lang.Exception

cloneRequest

public Slice cloneRequest()
Description copied from interface: ISlice
Makes a minimal clone of this slice object sufficient for cross-actor calls.

Specified by:
cloneRequest in interface ISlice
Returns:
a slice object to use when making cross-actor calls.

toString

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

prepare

protected void prepare()
                throws java.lang.Exception
Prepares to register a new slice. Check for validity of state specified by client.

Throws:
java.lang.Exception

register

protected void register(ResourceReservation r)
                 throws java.lang.Exception
Registers a new reservation.

Parameters:
r - the new reservation
Throws:
java.lang.Exception

unregister

protected void unregister(ResourceReservation r)
Unregisters the reservation.

Parameters:
r - the reservation
Throws:
java.lang.Exception

softLookup

protected ResourceReservation softLookup(ReservationID rid)
Looks up a reservation by ID but do not throw error

Parameters:
rid - the reservation ID
Returns:
the reservation with that ID
Throws:
java.lang.Exception

isEmpty

protected boolean isEmpty()
Checks if the slice is empty.

Returns:
true if there are no reservations in the slice

getReservations

protected ReservationSet getReservations()
Returns the reservation set.

Returns:
reservation set

getReservationsArray

protected ResourceReservation[] getReservationsArray()
Returns the reservation set represented as an array. Must be called with the kernel lock on to prevent exceptions due to concurrent iteration.

Returns:
an array of reservations included in the array

createInstance

public static Slice createInstance(java.util.Properties p)
                            throws java.lang.Exception
Creates a slice object from a saved properties list.

Parameters:
p - properties list describing a previous slice object instance
Throws:
java.lang.Exception

isInventory

public static boolean isInventory(java.util.Properties p)
Checks if the saved properties list represents an inventory slice.

Parameters:
p - properties list
Returns:
true if the saved properties list represents an inventory slice

isClient

public static boolean isClient(java.util.Properties p)
Checks if the saved properties list represents a client slice.

Parameters:
p - properties list
Returns:
true if the saved properties list represents a client slice.

isBrokerClient

public static boolean isBrokerClient(java.util.Properties p)
Checks if the saved properties list represents a broker client slice.

Parameters:
p - properties list
Returns:
true if the saved properties list represents a broker client slice.

getName

public static java.lang.String getName(java.util.Properties p)
Returns the slice name stored in a saved properties list.

Parameters:
p - properties list
Returns:
slice name

getSliceID

public static SliceID getSliceID(java.util.Properties p)
Returns the slice identifier stored in a saved properties list.

Parameters:
p - properties list
Returns:
slice identifier

getLocalProperties

public java.util.Properties getLocalProperties()
Description copied from interface: ISlice
Returns the slice local properties list (by reference).

Specified by:
getLocalProperties in interface ISlice
Returns:
local properties list

getRequestProperties

public java.util.Properties getRequestProperties()
Description copied from interface: ISlice
Returns the slice request properties list (by reference).

Specified by:
getRequestProperties in interface ISlice
Returns:
request properties list

getResourceProperties

public java.util.Properties getResourceProperties()
Description copied from interface: ISlice
Returns the slice resource properties list (by reference).

Specified by:
getResourceProperties in interface ISlice
Returns:
resource properties list

getConfigurationProperties

public java.util.Properties getConfigurationProperties()
Description copied from interface: ISlice
Returns the slice configuration properties list (byte reference).

Specified by:
getConfigurationProperties in interface ISlice
Returns:
configuration properties list

setInventory

public void setInventory(boolean value)
Description copied from interface: ISlice
Controls the inventory flag.

Specified by:
setInventory in interface ISlice
Parameters:
value - inventory status: true, inventory slice, false, client slice

isInventory

public boolean isInventory()
Description copied from interface: ISlice
Checks if the slice is an inventory slice.

Specified by:
isInventory in interface ISlice
Returns:
true if the slice is an inventory slice

isClient

public boolean isClient()
Description copied from interface: ISlice
Checks if the slice is a client slice.

Specified by:
isClient in interface ISlice
Returns:
true if the slice is a client slice

setClient

public void setClient()
Description copied from interface: ISlice
Marks the slice as a client slice.

Specified by:
setClient in interface ISlice

isBrokerClient

public boolean isBrokerClient()
Description copied from interface: ISlice
Checks if the slice is a broker client slice (a client slice within an authority that represents a broker).

Specified by:
isBrokerClient in interface ISlice
Returns:
true if the slice is a broker client slice

setBrokerClient

public void setBrokerClient()
Description copied from interface: ISlice
Marks the slice as a broker client slice (a client slice within an authority that represents a broker).

Specified by:
setBrokerClient in interface ISlice

getName

public java.lang.String getName()
Description copied from interface: ISlice
Returns the slice name.

Specified by:
getName in interface ISlice
Returns:
slice name

setName

public void setName(java.lang.String name)
Description copied from interface: ISlice
Sets the slice name.

Specified by:
setName in interface ISlice
Parameters:
name - slice name to set

setOwner

public void setOwner(AuthToken auth)
Description copied from interface: ISlice
Sets the slice owner.

Specified by:
setOwner in interface ISlice
Parameters:
auth - the slice owner

getOwner

public AuthToken getOwner()
Description copied from interface: ISlice
Returns the slice owner.

Specified by:
getOwner in interface ISlice
Returns:
slice owner

setGuard

public void setGuard(Guard g)
Description copied from interface: ISlice
Sets the slice guard.

Specified by:
setGuard in interface ISlice
Parameters:
g - the guard

Guard

public Guard Guard()
Description copied from interface: ISlice
Returns the slice guard.

Specified by:
Guard in interface ISlice
Returns:
the guard

getResourceData

public ResourceData getResourceData()
Description copied from interface: ISlice
Returns the slice properties.

Specified by:
getResourceData in interface ISlice
Returns:
the properties

setResourceData

public void setResourceData(ResourceData rsrcdata)
Description copied from interface: ISlice
Sets the slice properties.

Specified by:
setResourceData in interface ISlice

getDescription

public java.lang.String getDescription()
Description copied from interface: ISlice
Returns the slice description.

Specified by:
getDescription in interface ISlice
Returns:
the description

setDescription

public void setDescription(java.lang.String description)
Description copied from interface: ISlice
Sets the slice description.

Specified by:
setDescription in interface ISlice
Parameters:
description - the description

setController

public void setController(IController controller)
Description copied from interface: ISlice
Attaches the controller for the slice.

Specified by:
setController in interface ISlice
Parameters:
controller - slice controller

getController

public IController getController()
Description copied from interface: ISlice
Returns the slice controller.

Specified by:
getController in interface ISlice
Returns:
slice controller

getResourceType

public ResourceType getResourceType()
Description copied from interface: ISlice
Returns the resource type of the slice.

Specified by:
getResourceType in interface ISlice
Returns:
slice resource type

setResourceType

public void setResourceType(ResourceType resourceType)
Description copied from interface: ISlice
Sets the slice resource type.

Specified by:
setResourceType in interface ISlice
Parameters:
resourceType - resource type

getSliceID

public SliceID getSliceID()
Description copied from interface: ISlice
Returns the slice identifier.

Specified by:
getSliceID in interface ISlice
Returns:
slice identifier


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