org.ow2.petals.registry.core
Class AbstractLocalRegistry

java.lang.Object
  extended by org.ow2.petals.registry.core.AbstractRegistry
      extended by org.ow2.petals.registry.core.AbstractLocalRegistry
All Implemented Interfaces:
org.ow2.petals.registry.api.lifecycle.Initializable, org.ow2.petals.registry.api.lifecycle.LifeCycle, org.ow2.petals.registry.api.LocalOperations, org.ow2.petals.registry.api.LocalRegistry, org.ow2.petals.registry.api.Operations, org.ow2.petals.registry.api.Registry
Direct Known Subclasses:
LocalRegistryImpl

public abstract class AbstractLocalRegistry
extends AbstractRegistry
implements org.ow2.petals.registry.api.LocalRegistry

The abstract class which represents a local registry.

Author:
Christophe HAMERLING - eBM WebSourcing, Charles Casadei - eBM WebSourcing

Nested Class Summary
protected  class AbstractLocalRegistry.LocalRegistryLifeCycle
           
protected  class AbstractLocalRegistry.LocalRegistryUncaughtExceptionHandler
           
protected  class AbstractLocalRegistry.LocalRegistryUpdater
           
 
Nested classes/interfaces inherited from interface org.ow2.petals.registry.api.lifecycle.LifeCycle
org.ow2.petals.registry.api.lifecycle.LifeCycle.STATE
 
Field Summary
protected  java.util.concurrent.ScheduledExecutorService executorService
           
protected  org.ow2.petals.registry.api.manager.IncomingManager incomingManager
          The local manager to be used to manage local resources
protected  org.ow2.petals.registry.api.transport.MessageReceiver messageReceiver
          The message receiver is in charge of receiving messages from remote pairs
protected  org.ow2.petals.registry.api.manager.OutgoingManager outgoingManager
          The remote manager is used to handle remote messages and to propagate them or not...
protected  org.ow2.petals.registry.api.manager.RemoteClientManager remoteClientManager
          The remote client manager
protected  org.ow2.petals.registry.api.repository.Repository repository
          The repository to be used to store resources
protected  java.util.concurrent.atomic.AtomicLong revision
          The local revision of the registry.
 
Fields inherited from class org.ow2.petals.registry.core.AbstractRegistry
context, lifeCycle, logger, name
 
Constructor Summary
AbstractLocalRegistry()
           
 
Method Summary
 void clean()
           
 void cleanRemoteData()
          
 boolean doDelete(java.lang.String key, boolean b)
           
 org.ow2.petals.registry.api.Resource doGet(java.lang.String key, boolean b)
           
 java.util.List<org.ow2.petals.registry.api.Resource> doGetAll(java.lang.String key, boolean b)
           
 boolean doPut(java.lang.String key, org.ow2.petals.registry.api.Resource resource, boolean b)
           
 org.ow2.petals.registry.api.manager.IncomingManager getIncomingManager()
           
 org.ow2.petals.registry.api.lifecycle.LifeCycle getLifeCycle()
           
 org.ow2.petals.registry.api.transport.MessageReceiver getMessageReceiver()
           
 java.lang.String getName()
           
 org.ow2.petals.registry.api.manager.OutgoingManager getOutgoingManager()
           
 org.ow2.petals.registry.api.manager.RemoteClientManager getRemoteClientManager()
           
 org.ow2.petals.registry.api.repository.Repository getRepository()
           
 void init()
           
protected  java.util.List<org.ow2.petals.registry.api.Resource> mergeResources(java.util.List<org.ow2.petals.registry.api.Resource> repository, java.util.List<org.ow2.petals.registry.api.Resource> remote)
           
 void pauseReceive()
           
 java.util.List<org.ow2.petals.registry.api.Resource> query(org.ow2.petals.registry.api.Query query, boolean b)
           
 void resumeReceive()
           
 void setIncomingManager(org.ow2.petals.registry.api.manager.IncomingManager incomingManager)
           
 void setMessageReceiver(org.ow2.petals.registry.api.transport.MessageReceiver messageReceiver)
           
 void setOutgoingManager(org.ow2.petals.registry.api.manager.OutgoingManager outgoingManager)
           
 void setRemoteClientManager(org.ow2.petals.registry.api.manager.RemoteClientManager remoteClientManager)
           
 void setRepository(org.ow2.petals.registry.api.repository.Repository repository)
           
 void synchronizeData()
          Recover data from all the registries.
 
Methods inherited from class org.ow2.petals.registry.core.AbstractRegistry
delete, get, getAll, getContext, getState, init, isInitialized, isNotInitialized, isRunning, isStarted, isStopped, put, setContext, setLifeCycle, setName, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ow2.petals.registry.api.LocalRegistry
getContext, setContext
 
Methods inherited from interface org.ow2.petals.registry.api.Registry
setName
 
Methods inherited from interface org.ow2.petals.registry.api.lifecycle.LifeCycle
getState, init, isInitialized, isNotInitialized, isRunning, isStarted, isStopped, start, stop
 
Methods inherited from interface org.ow2.petals.registry.api.Operations
delete, get, getAll, put
 
Methods inherited from interface org.ow2.petals.registry.api.lifecycle.Initializable
isInitialized
 

Field Detail

repository

protected org.ow2.petals.registry.api.repository.Repository repository
The repository to be used to store resources


incomingManager

protected org.ow2.petals.registry.api.manager.IncomingManager incomingManager
The local manager to be used to manage local resources


outgoingManager

protected org.ow2.petals.registry.api.manager.OutgoingManager outgoingManager
The remote manager is used to handle remote messages and to propagate them or not...


messageReceiver

protected org.ow2.petals.registry.api.transport.MessageReceiver messageReceiver
The message receiver is in charge of receiving messages from remote pairs


remoteClientManager

protected org.ow2.petals.registry.api.manager.RemoteClientManager remoteClientManager
The remote client manager


revision

protected java.util.concurrent.atomic.AtomicLong revision
The local revision of the registry. When a resource is added or deleted the revision is incremented. This is used by all the registries to synchronise their visions of the entries.


executorService

protected java.util.concurrent.ScheduledExecutorService executorService
Constructor Detail

AbstractLocalRegistry

public AbstractLocalRegistry()
Method Detail

init

public void init()
          throws org.ow2.petals.registry.api.exception.LifeCycleException
Specified by:
init in interface org.ow2.petals.registry.api.lifecycle.Initializable
Throws:
org.ow2.petals.registry.api.exception.LifeCycleException

getName

public java.lang.String getName()
Specified by:
getName in interface org.ow2.petals.registry.api.Registry
Overrides:
getName in class AbstractRegistry

getLifeCycle

public org.ow2.petals.registry.api.lifecycle.LifeCycle getLifeCycle()

getIncomingManager

public org.ow2.petals.registry.api.manager.IncomingManager getIncomingManager()
Specified by:
getIncomingManager in interface org.ow2.petals.registry.api.LocalRegistry

setIncomingManager

public void setIncomingManager(org.ow2.petals.registry.api.manager.IncomingManager incomingManager)
                        throws org.ow2.petals.registry.api.exception.LifeCycleException
Specified by:
setIncomingManager in interface org.ow2.petals.registry.api.LocalRegistry
Throws:
org.ow2.petals.registry.api.exception.LifeCycleException

getOutgoingManager

public org.ow2.petals.registry.api.manager.OutgoingManager getOutgoingManager()
Specified by:
getOutgoingManager in interface org.ow2.petals.registry.api.LocalRegistry

setOutgoingManager

public void setOutgoingManager(org.ow2.petals.registry.api.manager.OutgoingManager outgoingManager)
                        throws org.ow2.petals.registry.api.exception.LifeCycleException
Specified by:
setOutgoingManager in interface org.ow2.petals.registry.api.LocalRegistry
Throws:
org.ow2.petals.registry.api.exception.LifeCycleException

getRepository

public org.ow2.petals.registry.api.repository.Repository getRepository()
Specified by:
getRepository in interface org.ow2.petals.registry.api.LocalRegistry

setRepository

public void setRepository(org.ow2.petals.registry.api.repository.Repository repository)
                   throws org.ow2.petals.registry.api.exception.LifeCycleException
Specified by:
setRepository in interface org.ow2.petals.registry.api.LocalRegistry
Throws:
org.ow2.petals.registry.api.exception.LifeCycleException

getMessageReceiver

public org.ow2.petals.registry.api.transport.MessageReceiver getMessageReceiver()
Specified by:
getMessageReceiver in interface org.ow2.petals.registry.api.LocalRegistry

setMessageReceiver

public void setMessageReceiver(org.ow2.petals.registry.api.transport.MessageReceiver messageReceiver)
Specified by:
setMessageReceiver in interface org.ow2.petals.registry.api.LocalRegistry

getRemoteClientManager

public org.ow2.petals.registry.api.manager.RemoteClientManager getRemoteClientManager()
Specified by:
getRemoteClientManager in interface org.ow2.petals.registry.api.LocalRegistry

setRemoteClientManager

public void setRemoteClientManager(org.ow2.petals.registry.api.manager.RemoteClientManager remoteClientManager)
                            throws org.ow2.petals.registry.api.exception.LifeCycleException
Specified by:
setRemoteClientManager in interface org.ow2.petals.registry.api.LocalRegistry
Throws:
org.ow2.petals.registry.api.exception.LifeCycleException

pauseReceive

public void pauseReceive()
Specified by:
pauseReceive in interface org.ow2.petals.registry.api.LocalOperations

resumeReceive

public void resumeReceive()
Specified by:
resumeReceive in interface org.ow2.petals.registry.api.LocalOperations

clean

public void clean()
           throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
clean in interface org.ow2.petals.registry.api.LocalOperations
Throws:
org.ow2.petals.registry.api.exception.RegistryException

cleanRemoteData

public void cleanRemoteData()
                     throws org.ow2.petals.registry.api.exception.RegistryException

Specified by:
cleanRemoteData in interface org.ow2.petals.registry.api.LocalOperations
Throws:
org.ow2.petals.registry.api.exception.RegistryException

synchronizeData

public void synchronizeData()
                     throws org.ow2.petals.registry.api.exception.RegistryException
Recover data from all the registries. TODO : SYnchronizing data means that all is totally locked and that all operations are pending!!!

Specified by:
synchronizeData in interface org.ow2.petals.registry.api.LocalOperations
Throws:
org.ow2.petals.registry.api.exception.RegistryException

doGet

public org.ow2.petals.registry.api.Resource doGet(java.lang.String key,
                                                  boolean b)
                                           throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
doGet in class AbstractRegistry
Throws:
org.ow2.petals.registry.api.exception.RegistryException

doGetAll

public java.util.List<org.ow2.petals.registry.api.Resource> doGetAll(java.lang.String key,
                                                                     boolean b)
                                                              throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
doGetAll in class AbstractRegistry
Throws:
org.ow2.petals.registry.api.exception.RegistryException

doPut

public boolean doPut(java.lang.String key,
                     org.ow2.petals.registry.api.Resource resource,
                     boolean b)
              throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
doPut in class AbstractRegistry
Returns:
Throws:
org.ow2.petals.registry.api.exception.RegistryException

doDelete

public boolean doDelete(java.lang.String key,
                        boolean b)
                 throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
doDelete in class AbstractRegistry
Throws:
org.ow2.petals.registry.api.exception.RegistryException

query

public java.util.List<org.ow2.petals.registry.api.Resource> query(org.ow2.petals.registry.api.Query query,
                                                                  boolean b)
                                                           throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
query in interface org.ow2.petals.registry.api.Operations
Throws:
org.ow2.petals.registry.api.exception.RegistryException

mergeResources

protected java.util.List<org.ow2.petals.registry.api.Resource> mergeResources(java.util.List<org.ow2.petals.registry.api.Resource> repository,
                                                                              java.util.List<org.ow2.petals.registry.api.Resource> remote)


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.