Package org.ow2.clif.server.lib
Class ClifServerImpl
- java.lang.Object
-
- org.ow2.clif.server.lib.ClifServerImpl
-
- All Implemented Interfaces:
ClifServerControl
public class ClifServerImpl extends java.lang.Object implements ClifServerControl
Implementation of a CLIF server, supporting blade creation and removal.- Author:
- Bruno Dillenseger
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<java.lang.String,org.objectweb.fractal.api.Component>bladescontains 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
Constructors Constructor Description ClifServerImpl()Does nothing.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.objectweb.fractal.api.ComponentaddBlade(java.lang.String adlDefinition, java.util.Map adlParams, java.lang.String bladeId, java.lang.String argument)Creates a new blade component managed by this Clif server from an ADL definition.static voidcreate(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 voidmain(java.lang.String[] args)Creates a CLIF server and binds it in the CLIF registry.voidremoveAllBlades()Removes every blade from this CLIF server, and clears the CLIF class loader cache.voidremoveBlade(java.lang.String id)Removes a blade from this Clif server.
-
-
-
Method Detail
-
create
public static void create(java.lang.String name, ClifRegistry registry) throws ClifExceptionCreates 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 overridden by this one.- Parameters:
name- bound name in the registryregistry- registry where to bind this new CLIF server- Throws:
ClifException
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionCreates a CLIF server and binds it in the CLIF registry. Optionally preloads some classes if the class prefetch configuration file is found.- 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- See Also:
ExecutionContext.PREFETCH_FILE
-
addBlade
public org.objectweb.fractal.api.Component addBlade(java.lang.String adlDefinition, java.util.Map adlParams, java.lang.String bladeId, java.lang.String argument) throws ClifExceptionCreates a new blade component managed by this Clif server from an ADL definition. Once the blade component is instantiated, its setId() and setArgument() methods specified by interface BladeControl are then called.- Specified by:
addBladein interfaceClifServerControl- Parameters:
adlDefinition- ADL definition name of a blade implementationadlParams- ADL parameters that will be used for blade instantiation (parameters used by the ADL definition)bladeId- identifier for the new blade (seeBladeControl.setId(String)), also used to name the new blade component with regard to Fractal NameControllerargument- blade argument (used to call method setArgument() in BladeControl- Returns:
- the new Blade component
- Throws:
ClifException
-
removeAllBlades
public void removeAllBlades() throws ClifExceptionRemoves every blade from this CLIF server, and clears the CLIF class loader cache.- Specified by:
removeAllBladesin interfaceClifServerControl- 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(java.lang.String id) throws ClifExceptionRemoves a blade from this Clif server. 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:
removeBladein interfaceClifServerControl- Parameters:
id- blade identifier- Throws:
ClifException- if this blade is unknown by this CLIF server.
-
-