org.ow2.petals.registry.core.manager
Class GenericOutgoingManagerImpl

java.lang.Object
  extended by org.ow2.petals.registry.core.manager.GenericOutgoingManagerImpl
All Implemented Interfaces:
org.ow2.petals.registry.api.lifecycle.LifeCycle, org.ow2.petals.registry.api.manager.IOManager, org.ow2.petals.registry.api.manager.OutgoingManager, org.ow2.petals.registry.api.RemoteOperations

public class GenericOutgoingManagerImpl
extends java.lang.Object
implements org.ow2.petals.registry.api.manager.OutgoingManager

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

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ow2.petals.registry.api.lifecycle.LifeCycle
org.ow2.petals.registry.api.lifecycle.LifeCycle.STATE
 
Field Summary
protected  org.ow2.petals.registry.api.lifecycle.AbstractLifeCycle lifeCycle
           
protected  java.lang.String name
           
protected  java.util.Map<java.lang.String,org.ow2.petals.registry.api.RemoteRegistry> registries
           
 
Constructor Summary
GenericOutgoingManagerImpl()
          Creates a new instance of OutgoingManager
 
Method Summary
 void addRemoteRegistry(org.ow2.petals.registry.api.RemoteRegistry remoteRegistry)
          Add a remote registry to the manager.
 boolean delete(java.lang.String path, org.ow2.petals.registry.api.Information information)
          Delete the element from the registry.
protected  boolean doDelete(java.lang.String key, org.ow2.petals.registry.api.Information information)
          Delete the element from the registry.
protected  org.ow2.petals.registry.api.Resource doGet(java.lang.String key, org.ow2.petals.registry.api.Information information)
          Get the element from its path only if the path refers to an element.
protected  java.util.List<org.ow2.petals.registry.api.Resource> doGetAll(java.lang.String key, org.ow2.petals.registry.api.Information information)
          Get all the resources in the given path only if the given path is a directory.
protected  boolean doPut(java.lang.String key, org.ow2.petals.registry.api.Resource resource, org.ow2.petals.registry.api.Information information)
          Put a resource in the registry.
protected  java.util.List<org.ow2.petals.registry.api.Resource> doQuery(org.ow2.petals.registry.api.Query query, org.ow2.petals.registry.api.Information information)
           
 org.ow2.petals.registry.api.Resource get(java.lang.String path, org.ow2.petals.registry.api.Information information)
          Get the element from its path only if the path refers to an element.
 java.util.List<org.ow2.petals.registry.api.Resource> getAll(java.lang.String path, org.ow2.petals.registry.api.Information information)
          Get all the resources in the given path only if the given path is a directory.
 org.ow2.petals.registry.api.LocalRegistry getLocalRegistry()
          Get the local registry which is linked to this manager
 org.ow2.petals.registry.api.lifecycle.LifeCycle.STATE getState()
           
 void init(org.ow2.petals.registry.api.context.Context context)
           
 boolean isInitialized()
           
 boolean isNotInitialized()
           
 boolean isRunning()
           
 boolean isStarted()
           
 boolean isStopped()
           
 boolean put(java.lang.String path, org.ow2.petals.registry.api.Resource resource, org.ow2.petals.registry.api.Information information)
          Put a resource in the registry.
 java.util.List<org.ow2.petals.registry.api.Resource> query(org.ow2.petals.registry.api.Query query, org.ow2.petals.registry.api.Information information)
           
protected  void setLifeCycle(org.ow2.petals.registry.api.lifecycle.AbstractLifeCycle lifeCycle)
           
 void setLocalRegistry(org.ow2.petals.registry.api.LocalRegistry localRegistry)
          Set the local registry
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lifeCycle

protected org.ow2.petals.registry.api.lifecycle.AbstractLifeCycle lifeCycle

registries

protected java.util.Map<java.lang.String,org.ow2.petals.registry.api.RemoteRegistry> registries

name

protected java.lang.String name
Constructor Detail

GenericOutgoingManagerImpl

public GenericOutgoingManagerImpl()
Creates a new instance of OutgoingManager

Method Detail

getLocalRegistry

public org.ow2.petals.registry.api.LocalRegistry getLocalRegistry()
Get the local registry which is linked to this manager

Specified by:
getLocalRegistry in interface org.ow2.petals.registry.api.manager.IOManager
Returns:
the local registry
See Also:
org.ow2.petals.registry.api.manager#getLocalRegistry();

setLocalRegistry

public void setLocalRegistry(org.ow2.petals.registry.api.LocalRegistry localRegistry)
                      throws org.ow2.petals.registry.api.exception.LifeCycleException
Set the local registry

Specified by:
setLocalRegistry in interface org.ow2.petals.registry.api.manager.IOManager
Parameters:
localRegistry - the local registry
Throws:
org.ow2.petals.registry.api.exception.LifeCycleException
See Also:
org.ow2.petals.registry.api.manager#setLocalRegistry(LocalRegistry localRegistry)

addRemoteRegistry

public void addRemoteRegistry(org.ow2.petals.registry.api.RemoteRegistry remoteRegistry)
                       throws org.ow2.petals.registry.api.exception.RegistryException
Add a remote registry to the manager. If the remote registry is not initialized nor started, call the good lifecycle methods.

Specified by:
addRemoteRegistry in interface org.ow2.petals.registry.api.manager.OutgoingManager
Parameters:
-
Throws:
org.ow2.petals.registry.api.exception.RegistryException
See Also:
org.ow2.petals.registry.api.manager.OutgoingManager#addRemoteRegistry()

setLifeCycle

protected void setLifeCycle(org.ow2.petals.registry.api.lifecycle.AbstractLifeCycle lifeCycle)
Parameters:
lifeCycle -

init

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

start

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

stop

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

isRunning

public boolean isRunning()
Specified by:
isRunning in interface org.ow2.petals.registry.api.lifecycle.LifeCycle

isStarted

public boolean isStarted()
Specified by:
isStarted in interface org.ow2.petals.registry.api.lifecycle.LifeCycle

isStopped

public boolean isStopped()
Specified by:
isStopped in interface org.ow2.petals.registry.api.lifecycle.LifeCycle

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface org.ow2.petals.registry.api.lifecycle.LifeCycle

isNotInitialized

public boolean isNotInitialized()
Specified by:
isNotInitialized in interface org.ow2.petals.registry.api.lifecycle.LifeCycle

getState

public org.ow2.petals.registry.api.lifecycle.LifeCycle.STATE getState()
Specified by:
getState in interface org.ow2.petals.registry.api.lifecycle.LifeCycle

put

public final boolean put(java.lang.String path,
                         org.ow2.petals.registry.api.Resource resource,
                         org.ow2.petals.registry.api.Information information)
                  throws org.ow2.petals.registry.api.exception.RegistryException
Put a resource in the registry.

Specified by:
put in interface org.ow2.petals.registry.api.RemoteOperations
Parameters:
path - The path to store the resource into. Contains the parent directory and the resource identifier (ie : in /path/to/resource/r1 r1 is the resource identifier) if the resource already exists override, create a new one if not.
resource - The resource to put
Throws:
org.ow2.petals.registry.api.exception.RegistryException
See Also:
RemoteOperations.put(String path, Resource resource, Information info)

doPut

protected boolean doPut(java.lang.String key,
                        org.ow2.petals.registry.api.Resource resource,
                        org.ow2.petals.registry.api.Information information)
                 throws org.ow2.petals.registry.api.exception.RegistryException
Put a resource in the registry.

Parameters:
path - The path to store the resource into. Contains the parent directory and the resource identifier (ie : in /path/to/resource/r1 r1 is the resource identifier) if the resource already exists override, create a new one if not.
resource - The resource to put
Throws:
org.ow2.petals.registry.api.exception.RegistryException

get

public final org.ow2.petals.registry.api.Resource get(java.lang.String path,
                                                      org.ow2.petals.registry.api.Information information)
                                               throws org.ow2.petals.registry.api.exception.RegistryException
Get the element from its path only if the path refers to an element. If the path is a directory, it will returns null, please refer to #getAll(String)

Specified by:
get in interface org.ow2.petals.registry.api.RemoteOperations
Parameters:
path -
Returns:
the resource if found, otherwise it will throw an exception
Throws:
an - exception there is no resource at the given path or if a problem occurs.
org.ow2.petals.registry.api.exception.RegistryException
See Also:
RemoteOperations.get(String path, Information info)

doGet

protected org.ow2.petals.registry.api.Resource doGet(java.lang.String key,
                                                     org.ow2.petals.registry.api.Information information)
                                              throws org.ow2.petals.registry.api.exception.RegistryException
Get the element from its path only if the path refers to an element. If the path is a directory, it will returns null, please refer to #getAll(String)

Parameters:
path -
Returns:
the resource if found, otherwise it will throw an exception
Throws:
an - exception there is no resource at the given path or if a problem occurs.
org.ow2.petals.registry.api.exception.RegistryException

getAll

public final java.util.List<org.ow2.petals.registry.api.Resource> getAll(java.lang.String path,
                                                                         org.ow2.petals.registry.api.Information information)
                                                                  throws org.ow2.petals.registry.api.exception.RegistryException
Get all the resources in the given path only if the given path is a directory. If it is, returns all the children, if not, return null... For single resource retrieval, refer to #get(String). Be carefull on the implementation side when trying to get all the resources of all the registries. The best way is that the getAll implementation just returns the resources of the local registry ie its vision of the resources of the network at the current time.

Specified by:
getAll in interface org.ow2.petals.registry.api.RemoteOperations
Parameters:
path -
Returns:
Throws:
org.ow2.petals.registry.api.exception.RegistryException - if the path is not a directory path...
See Also:
RemoteOperations.getAll(String path, Information info)

doGetAll

protected java.util.List<org.ow2.petals.registry.api.Resource> doGetAll(java.lang.String key,
                                                                        org.ow2.petals.registry.api.Information information)
                                                                 throws org.ow2.petals.registry.api.exception.RegistryException
Get all the resources in the given path only if the given path is a directory. If it is, returns all the children, if not, return null... For single resource retrieval, refer to #get(String). Be carefull on the implementation side when trying to get all the resources of all the registries. The best way is that the getAll implementation just returns the resources of the local registry ie its vision of the resources of the network at the current time.

Parameters:
path -
Returns:
Throws:
org.ow2.petals.registry.api.exception.RegistryException - if the path is not a directory path...

delete

public final boolean delete(java.lang.String path,
                            org.ow2.petals.registry.api.Information information)
                     throws org.ow2.petals.registry.api.exception.RegistryException
Delete the element from the registry. If the path is a directory, delete all the children of the given path (and the path too...)

Specified by:
delete in interface org.ow2.petals.registry.api.RemoteOperations
Parameters:
key -
Returns:
true if the resource has been deleted, false if not of if not found
Throws:
org.ow2.petals.registry.api.exception.RegistryException
See Also:
RemoteOperations.delete(String path, Information information)

doDelete

protected boolean doDelete(java.lang.String key,
                           org.ow2.petals.registry.api.Information information)
                    throws org.ow2.petals.registry.api.exception.RegistryException
Delete the element from the registry. If the path is a directory, delete all the children of the given path (and the path too...)

Parameters:
key -
Returns:
true if the resource has been deleted, false if not of if not found
Throws:
org.ow2.petals.registry.api.exception.RegistryException

query

public final java.util.List<org.ow2.petals.registry.api.Resource> query(org.ow2.petals.registry.api.Query query,
                                                                        org.ow2.petals.registry.api.Information information)
                                                                 throws org.ow2.petals.registry.api.exception.RegistryException
Specified by:
query in interface org.ow2.petals.registry.api.RemoteOperations
Throws:
org.ow2.petals.registry.api.exception.RegistryException
See Also:
RemoteOperations.query(Query query, Information info)

doQuery

protected java.util.List<org.ow2.petals.registry.api.Resource> doQuery(org.ow2.petals.registry.api.Query query,
                                                                       org.ow2.petals.registry.api.Information information)
                                                                throws org.ow2.petals.registry.api.exception.RegistryException
Throws:
org.ow2.petals.registry.api.exception.RegistryException


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