org.ow2.clif.server.lib
Class ClifServerImpl

java.lang.Object
  extended by org.ow2.clif.server.lib.ClifServerImpl
All Implemented Interfaces:
ClifServerControl

public class ClifServerImpl
extends java.lang.Object
implements ClifServerControl

Manages blade creation and removal within a given Clif server.

Author:
Bruno Dillenseger

Field Summary
protected  java.util.Map<java.lang.String,org.objectweb.fractal.api.Component> blades
          contains blade components of this CLIF server, indexed by their identifier
 
Fields inherited from interface org.ow2.clif.server.api.ClifServerControl
CLIF_SERVER_CONTROL
 
Constructor Summary
ClifServerImpl()
           
 
Method Summary
 org.objectweb.fractal.api.Component addBlade(org.objectweb.fractal.api.Component clifApp, java.lang.String adlDefinition, java.util.Map adlParams, java.lang.String bladeId)
          Creates a new blade component managed by this Clif server from an ADL definition,
static void create(java.lang.String name, ClifRegistry registry)
          Creates a CLIF server in current/local Fractal environment, and binds it with the given name in the given registry.
static void main(java.lang.String[] args)
          Creates a CLIF server and binds it in the CLIF registry
 void removeAllBlades(org.objectweb.fractal.api.Component clifApp)
          Unbinds and removes every blade managed by this CLIF server, and clears the CLIF class loader cache.
 void removeBlade(org.objectweb.fractal.api.Component clifApp, java.lang.String id)
          Unbinds the SupervisorInfo interface and removes a blade from both this Clif server and the Clif application it belongs to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blades

protected java.util.Map<java.lang.String,org.objectweb.fractal.api.Component> blades
contains blade components of this CLIF server, indexed by their identifier

Constructor Detail

ClifServerImpl

public ClifServerImpl()
Method Detail

create

public static void create(java.lang.String name,
                          ClifRegistry registry)
                   throws ClifException
Creates a CLIF server in current/local Fractal environment, and binds it with the given name in the given registry. If this name is already bound, the existing binding is overriden by this one.

Parameters:
name - bound name in the registry
registry - registry where to bind this new CLIF server
Throws:
ClifException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Creates a CLIF server and binds it in the CLIF registry

Parameters:
args - if no argument is given, the CLIF server is bound to a default name that is the network name of the local environment. Otherwise, the new CLIF server is bound to the name given by the first argument (i.e. args[0]).
Throws:
java.lang.Exception

addBlade

public org.objectweb.fractal.api.Component addBlade(org.objectweb.fractal.api.Component clifApp,
                                                    java.lang.String adlDefinition,
                                                    java.util.Map adlParams,
                                                    java.lang.String bladeId)
                                             throws ClifException
Creates a new blade component managed by this Clif server from an ADL definition,

Specified by:
addBlade in interface ClifServerControl
Parameters:
adlDefinition - ADL definition name of a blade implementation
adlParams - ADL parameters that will be used for blade instantiation (parameters used by the ADL definition)
bladeId - identifier for the new blade (used to name the new blade component with regard to Fractal NameController)
Returns:
the BladeControl interface of the new Blade component
Throws:
ClifException

removeAllBlades

public void removeAllBlades(org.objectweb.fractal.api.Component clifApp)
                     throws ClifException
Unbinds and removes every blade managed by this CLIF server, and clears the CLIF class loader cache.

Specified by:
removeAllBlades in interface ClifServerControl
Throws:
ClifException - if at least one blade could not be removed. Note: all removable blades are removed before throwing the exception, and the CLIF class loader cache is cleared anyway.

removeBlade

public void removeBlade(org.objectweb.fractal.api.Component clifApp,
                        java.lang.String id)
                 throws ClifException
Unbinds the SupervisorInfo interface and removes a blade from both this Clif server and the Clif application it belongs to. Assumes that the blade is stopped. Once this blade is removed, the CLIF class loader cache is cleared if and only if there is no other blade remaining in this CLIF server.

Specified by:
removeBlade in interface ClifServerControl
Parameters:
clifApp - the Clif application distributed component the blade belongs to
id - blade identifier
Throws:
ClifException - if this blade could not be correctly removed, either because it is unknown by this CLIF server, or because a technical problem occurred in the distributed infrastructure management. The exception embedded in the ClifException gives more details about the root cause.