orca.shirako.plugins
Class ShirakoPlugin

java.lang.Object
  extended by orca.shirako.plugins.ShirakoPlugin
All Implemented Interfaces:
IInitialize, IRecover, ISerialize, IShirakoPlugin
Direct Known Subclasses:
CodBasePlugin, ServerPlugin

public class ShirakoPlugin
extends java.lang.Object
implements IShirakoPlugin

The base implementation for actor-specific extensions. All such extensions should inherit from this class.

Author:
aydan

Field Summary
protected  IActor actor
          The actor the plugin is associated with
protected  Config config
          The configuration
protected  IDatabase db
          The database
protected  java.util.Hashtable<java.lang.String,ConcreteSetFactory> factories
          Concrete set factories indexed by protocol
protected  KeystoreManager keystoreManager
          The keystore manager.
protected  LoggingTool logger
          The logger
static java.lang.String PropertyConfig
           
static java.lang.String PropertyConfigClass
           
static java.lang.String PropertyDatabase
           
static java.lang.String PropertyDatabaseClass
           
 
Constructor Summary
ShirakoPlugin()
           
ShirakoPlugin(Actor actor, IDatabase db, Config config)
          Create a new BasePlugin
 
Method Summary
 void actorAdded()
          Performs initialization steps knowing that the actor has beena added to the container.
 void configurationComplete(java.lang.Object token, java.util.Properties properties)
          Configuration callback function.
 Slice createSlice(SliceID id, java.lang.String name, ResourceData properties, java.lang.Object other)
          Slice factory.
 IActor getActor()
          Returns the actor associated with the plugin.
 Config getConfig()
           
 IDatabase getDatabase()
          Obtains the actor's database instance.
 IConcreteSetFactory getFactory(java.lang.String protocol)
          Returns an IConcreteSetFactory for the given communication protocol
 KeystoreManager getKeyStore()
          Returns the actor keystore manager.
 LoggingTool getLogger()
          Returns the logger.
protected  int getResultCode(java.util.Properties properties)
          Returns the status code contained in the properties list.
 void initialize()
          Initialization entry point
 void initializeKeyStore(IActor actor)
          Initializes the actor key store.
protected  void loadFactories()
          Populates the factories list.
protected  void processJoinComplete(java.lang.Object token, java.util.Properties properties)
          Callback handler for a completing join request
protected  void processLeaveComplete(java.lang.Object token, java.util.Properties properties)
          Callback handler for a completing leave request.
protected  void processModifyComplete(java.lang.Object token, java.util.Properties properties)
           
protected  void processProbeComplete(java.lang.Object token, java.util.Properties properties)
          Callback handler for a completing probe request
protected  void processRecoverComplete(java.lang.Object token, java.util.Properties properties)
          Callback handler for a completing recover crequest
 void releaseSlice(Slice slice)
          Releases any resources held by the slice.
 void reset()
          Refreshes the actor
 void reset(java.util.Properties p)
          De-serializes the object from the given properties list.
 void restartConfigurationActions(ResourceReservation r)
          Restarts any pending configuration actions for the specified reservation
 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.
 void revisit(ResourceReservation r)
          Reset/restore interface.
 void revisit(Slice s)
          Reset/restore interface.
 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 setActor(IActor actor)
          Sets the actor.
 void setConfig(Config config)
           
 void setDatabase(IDatabase db)
          Sets the actor's database instance.
 void setLogger(LoggingTool logger)
          Sets the logger.
 boolean validateIncoming(IReservation reservation, AuthToken auth)
          Validates an incoming reservation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PropertyConfig

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

PropertyConfigClass

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

PropertyDatabase

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

PropertyDatabaseClass

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

actor

protected IActor actor
The actor the plugin is associated with


config

protected Config config
The configuration


db

protected IDatabase db
The database


logger

protected LoggingTool logger
The logger


keystoreManager

protected KeystoreManager keystoreManager
The keystore manager.


factories

protected java.util.Hashtable<java.lang.String,ConcreteSetFactory> factories
Concrete set factories indexed by protocol

Constructor Detail

ShirakoPlugin

public ShirakoPlugin()

ShirakoPlugin

public ShirakoPlugin(Actor actor,
                     IDatabase db,
                     Config config)
Create a new BasePlugin

Parameters:
actor - The actor this plugin is related to
db - Database to use
config - Configuration manager to use
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Initialization entry point

Specified by:
initialize in interface IInitialize
Throws:
java.lang.Exception

actorAdded

public void actorAdded()
                throws java.lang.Exception
Description copied from interface: IShirakoPlugin
Performs initialization steps knowing that the actor has beena added to the container.

Specified by:
actorAdded in interface IShirakoPlugin
Throws:
java.lang.Exception

initializeKeyStore

public void initializeKeyStore(IActor actor)
                        throws java.lang.Exception
Description copied from interface: IShirakoPlugin
Initializes the actor key store. Called early in the initialization process.

Specified by:
initializeKeyStore in interface IShirakoPlugin
Throws:
java.lang.Exception

restartConfigurationActions

public void restartConfigurationActions(ResourceReservation r)
                                 throws java.lang.Exception
Description copied from interface: IShirakoPlugin
Restarts any pending configuration actions for the specified reservation

Specified by:
restartConfigurationActions in interface IShirakoPlugin
Parameters:
r - reservation
Throws:
java.lang.Exception

loadFactories

protected void loadFactories()
                      throws java.lang.Exception
Populates the factories list. Override if different factories

Throws:
java.lang.Exception

getFactory

public IConcreteSetFactory getFactory(java.lang.String protocol)
Returns an IConcreteSetFactory for the given communication protocol

Specified by:
getFactory in interface IShirakoPlugin
Parameters:
protocol - communication protocol. IProxy
Returns:
factory for encoding/decoding IConcreteSet instances

configurationComplete

public void configurationComplete(java.lang.Object token,
                                  java.util.Properties properties)
Configuration callback function. Called when a configuration action completes.

Parameters:
token - Unique opaque token to identify the completed operation
properties - Output properties list produced by the configuration action.

processJoinComplete

protected void processJoinComplete(java.lang.Object token,
                                   java.util.Properties properties)
Callback handler for a completing join request

Parameters:
token -
properties -

processLeaveComplete

protected void processLeaveComplete(java.lang.Object token,
                                    java.util.Properties properties)
Callback handler for a completing leave request.

Parameters:
token -
properties -

processProbeComplete

protected void processProbeComplete(java.lang.Object token,
                                    java.util.Properties properties)
Callback handler for a completing probe request

Parameters:
token -
properties -

processRecoverComplete

protected void processRecoverComplete(java.lang.Object token,
                                      java.util.Properties properties)
Callback handler for a completing recover crequest

Parameters:
token -
properties -

processModifyComplete

protected void processModifyComplete(java.lang.Object token,
                                     java.util.Properties properties)

getResultCode

protected int getResultCode(java.util.Properties properties)
Returns the status code contained in the properties list. To be use in configuration handlers.

Parameters:
properties -
Returns:

createSlice

public Slice createSlice(SliceID id,
                         java.lang.String name,
                         ResourceData properties,
                         java.lang.Object other)
                  throws java.lang.Exception
Slice factory. Called on the server side to create a slice object for a new client.

Specified by:
createSlice in interface IShirakoPlugin
Parameters:
id - guid for the slice
name - name for the slice
properties - properties for the slice
other - other relevant information
Returns:
a slice object
Throws:
java.lang.Exception

releaseSlice

public void releaseSlice(Slice slice)
                  throws java.lang.Exception
Description copied from interface: IShirakoPlugin
Releases any resources held by the slice. Note: the database record will not be removed.

Specified by:
releaseSlice in interface IShirakoPlugin
Parameters:
slice - the slice
Throws:
java.lang.Exception

reset

public void reset()
           throws java.lang.Exception
Refreshes the actor

Specified by:
reset in interface IShirakoPlugin
Throws:
java.lang.Exception

revisit

public void revisit(Slice s)
             throws java.lang.Exception
Reset/restore interface. Rebuild plugin state associated with a restored slice. Called once for each restored slice.

Specified by:
revisit in interface IShirakoPlugin
Parameters:
s - restored slice
Throws:
java.lang.Exception

revisit

public void revisit(ResourceReservation r)
             throws java.lang.Exception
Reset/restore interface. Rebuild plugin state associated with a restored reservation. Called once for each restored reservation.

Specified by:
revisit in interface IShirakoPlugin
Parameters:
r - restored reservation
Throws:
java.lang.Exception

validateIncoming

public boolean validateIncoming(IReservation reservation,
                                AuthToken auth)
Validates an incoming reservation

Specified by:
validateIncoming in interface IShirakoPlugin
Parameters:
reservation - The reservation
auth - AuthToken of the caller
Returns:
True if the validation succeeds

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
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

setActor

public void setActor(IActor actor)
Sets the actor. Obtains and caches the ral.

Specified by:
setActor in interface IShirakoPlugin
Parameters:
actor - the actor

getActor

public IActor getActor()
Description copied from interface: IShirakoPlugin
Returns the actor associated with the plugin.

Specified by:
getActor in interface IShirakoPlugin
Returns:
actor associated with the plugin

setDatabase

public void setDatabase(IDatabase db)
Description copied from interface: IShirakoPlugin
Sets the actor's database instance.

Specified by:
setDatabase in interface IShirakoPlugin
Parameters:
db - database instance

getDatabase

public IDatabase getDatabase()
Description copied from interface: IShirakoPlugin
Obtains the actor's database instance.

Specified by:
getDatabase in interface IShirakoPlugin
Returns:
database instance

setConfig

public void setConfig(Config config)

getConfig

public Config getConfig()

setLogger

public void setLogger(LoggingTool logger)
Description copied from interface: IShirakoPlugin
Sets the logger.

Specified by:
setLogger in interface IShirakoPlugin
Parameters:
logger - instance

getLogger

public LoggingTool getLogger()
Description copied from interface: IShirakoPlugin
Returns the logger.

Specified by:
getLogger in interface IShirakoPlugin
Returns:
logger instance

getKeyStore

public KeystoreManager getKeyStore()
Description copied from interface: IShirakoPlugin
Returns the actor keystore manager.

Specified by:
getKeyStore in interface IShirakoPlugin
Returns:


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