Class 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> blades
      contains blade components of this CLIF server, indexed by their identifier
    • 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.Component addBlade​(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 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()
      Removes every blade from this CLIF server, and clears the CLIF class loader cache.
      void removeBlade​(java.lang.String id)
      Removes a blade from this Clif server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • blades

        protected java.util.HashMap<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()
        Does nothing.
    • 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 overridden 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. 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 ClifException
        Creates 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:
        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 (see BladeControl.setId(String)), also used to name the new blade component with regard to Fractal NameController
        argument - blade argument (used to call method setArgument() in BladeControl
        Returns:
        the new Blade component
        Throws:
        ClifException
      • removeAllBlades

        public void removeAllBlades()
                             throws ClifException
        Removes every blade from 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​(java.lang.String id)
                         throws ClifException
        Removes 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:
        removeBlade in interface ClifServerControl
        Parameters:
        id - blade identifier
        Throws:
        ClifException - if this blade is unknown by this CLIF server.