org.gcube.common.core.persistence
Class GCUBERIPersistenceManager

java.lang.Object
  extended by org.gcube.common.core.persistence.GCUBERIPersistenceManager
Direct Known Subclasses:
GCUBERIFilePersistenceManager, GCUBERINoPersistenceManager

public abstract class GCUBERIPersistenceManager
extends Object

Partial implementation of remote persistence managers for Running Instances of stateful gCube services.

Author:
Fabio Simeoni (University of Strathclyde) *

Nested Class Summary
protected  class GCUBERIPersistenceManager.StateChangeConsumer
          Consumer of state change events.
 class GCUBERIPersistenceManager.StateNotFoundException
          Signals the lack of remote state.
 
Field Summary
protected  GCUBEServiceContext ctxt
          The context of the service.
protected  List<Pattern> excludes
          List of excludes directives.
protected  GCUBELog logger
          Instance Logger
protected  GCUBERIPersistenceManagerProfile profile
          The configuration profile of the manager.
 
Constructor Summary
GCUBERIPersistenceManager(GCUBEServiceContext ctxt, GCUBERIPersistenceManagerProfile profile)
          Creates a new instance for a given service and from a given configuration profile.
 
Method Summary
protected  void commit()
          Commits the state of the running instance.
protected abstract  void commitState()
          Invoked by commit() to commit the state of the running instance.
 void exclude(String... excludes)
          Add one or more regular expressions as exclude directives.
protected  boolean getCommit()
          Returns the commit flag value.
 void recover()
          Recovers the state of the running instance.
protected abstract  void recoverState()
          Invoked by recover() to recover the state of the running instance.
 void setCommit(boolean value)
          Sets the commit flag.
 void setLogger(GCUBELog logger)
          Sets the instance logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected GCUBELog logger
Instance Logger


ctxt

protected GCUBEServiceContext ctxt
The context of the service.


profile

protected GCUBERIPersistenceManagerProfile profile
The configuration profile of the manager.


excludes

protected List<Pattern> excludes
List of excludes directives.

Constructor Detail

GCUBERIPersistenceManager

public GCUBERIPersistenceManager(GCUBEServiceContext ctxt,
                                 GCUBERIPersistenceManagerProfile profile)
Creates a new instance for a given service and from a given configuration profile.

Parameters:
ctxt - the context of the service.
profile - the configuration profile.
Method Detail

setLogger

public void setLogger(GCUBELog logger)
Sets the instance logger.

Parameters:
logger - the logger.

setCommit

public void setCommit(boolean value)
Sets the commit flag.

Parameters:
value - the flag value.

getCommit

protected boolean getCommit()
Returns the commit flag value.

Returns:
the value.

commit

protected void commit()
               throws Exception
Commits the state of the running instance.

Throws:
Exception - if the state could not be committed.

commitState

protected abstract void commitState()
                             throws Exception
Invoked by commit() to commit the state of the running instance.

Throws:
Exception - if the state could not be committed.

recover

public void recover()
             throws Exception
Recovers the state of the running instance.

Throws:
Exception - if the state could not be recovered.

recoverState

protected abstract void recoverState()
                              throws GCUBERIPersistenceManager.StateNotFoundException,
                                     Exception
Invoked by recover() to recover the state of the running instance.

Throws:
Exception - if the state could not be recovered.
GCUBERIPersistenceManager.StateNotFoundException

exclude

public void exclude(String... excludes)
Add one or more regular expressions as exclude directives.

Parameters:
excludes - the regular expressions.


Copyright © 2012. All Rights Reserved.