Class ClifAppFacade

  • All Implemented Interfaces:
    java.util.Observer

    public class ClifAppFacade
    extends java.util.Observable
    implements java.util.Observer
    This class is responsible for creating the initial Clif application. Then, it provides test plan deployment.
    Author:
    Bruno Dillenseger, Joan Chaumont, Florian Francheteau
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.objectweb.fractal.api.Component clifApp  
      protected org.objectweb.fractal.api.control.ContentController clifAppCc  
      protected java.lang.String clifAppDefinition  
      protected java.lang.String clifAppName  
      protected java.util.Map<java.lang.String,​org.objectweb.fractal.api.Component> components
      clif application components indexed by their name (storage, supervisor, analyzer)
      protected java.io.Serializable currentTestId  
      protected org.objectweb.fractal.api.Component storage  
      protected org.objectweb.fractal.api.control.BindingController storageBc  
      protected org.objectweb.fractal.api.Component supervisor  
      protected org.objectweb.fractal.api.control.BindingController supervisorBc  
    • Constructor Summary

      Constructors 
      Constructor Description
      ClifAppFacade​(java.lang.String testName, java.lang.String appDefinition)
      Create new ClifAppFacade with all components of a ClifApplication : supervisor, storage...
      ClifAppFacade​(org.objectweb.fractal.api.Component clifApp, java.lang.String name)
      Constructor for ClifAppFacade.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void changeParameter​(java.lang.String bladeId, java.lang.String name, java.lang.String text)  
      int collect​(java.lang.String[] selBladesId, CollectListener listener)
      Collect selected blades if global state is completed or stopped
      void deploy​(java.util.Map<java.lang.String,​ClifDeployDefinition> definitions, ClifRegistry registry)
      Asynchronously deploys blades among CLIF servers according to the given definitions.
      org.objectweb.fractal.api.Component getClifApp()
      Get clifApp component
      org.objectweb.fractal.api.Component getComponentByName​(java.lang.String name)
      Get a component of the clifApplication by his Fractal name
      java.util.Map<java.lang.String,​java.io.Serializable> getCurrentParameters​(java.lang.String id)  
      java.lang.String getCurrentTestId()
      Retrieves current test identifier.
      BladeState getGlobalState​(java.lang.String[] selBladesId)
      Get global state for these blades.
      BladeState getState​(java.lang.String id)
      Get the state of a blade
      java.lang.String[] getStatLabels​(java.lang.String bladeId)
      Retrieve the ActionStat of a specific host.
      long[] getStats​(java.lang.String bladeId)
      Retrieve the ActionStat of a specific host.
      void init​(java.lang.String testId)
      Init selected blades if global state is deployed
      int join​(java.lang.String[] selBladesId)
      Join selected blades if global state is running
      int resume​(java.lang.String[] selBladesId)
      Resume selected blades if global state is suspended
      int start​(java.lang.String[] selBladesId)
      Start selected blades if global state is initialized
      void startMonitoring​(java.lang.String[] bladesId, long period)
      Start the monitoring of ActionStat of a specific host.
      int stop​(java.lang.String[] selBladesId)
      Stop selected blades if global state is not stopped/completed/aborted
      int suspend​(java.lang.String[] selBladesId)
      Suspend selected blades if global state is running
      void syncDeploy​(java.util.Map<java.lang.String,​ClifDeployDefinition> definitions, ClifRegistry registry)
      Synchronous version of deploy method (returns when deployment is complete).
      void update​(java.util.Observable supervisor, java.lang.Object observation)  
      int waitForState​(java.lang.String[] selBladesId, BladeState state)
      Waits until this state is reached
      • Methods inherited from class java.util.Observable

        addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
      • Methods inherited from class java.lang.Object

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

      • clifAppDefinition

        protected java.lang.String clifAppDefinition
      • clifAppName

        protected java.lang.String clifAppName
      • currentTestId

        protected java.io.Serializable currentTestId
      • clifApp

        protected org.objectweb.fractal.api.Component clifApp
      • storage

        protected org.objectweb.fractal.api.Component storage
      • supervisor

        protected org.objectweb.fractal.api.Component supervisor
      • components

        protected java.util.Map<java.lang.String,​org.objectweb.fractal.api.Component> components
        clif application components indexed by their name (storage, supervisor, analyzer)
      • storageBc

        protected org.objectweb.fractal.api.control.BindingController storageBc
      • supervisorBc

        protected org.objectweb.fractal.api.control.BindingController supervisorBc
      • clifAppCc

        protected org.objectweb.fractal.api.control.ContentController clifAppCc
    • Constructor Detail

      • ClifAppFacade

        public ClifAppFacade​(java.lang.String testName,
                             java.lang.String appDefinition)
        Create new ClifAppFacade with all components of a ClifApplication : supervisor, storage...
        Parameters:
        testName - the name in the Registry to be associated with the resulting Clif Application.
        appDefinition - fully-qualified Fractal ADL definition file of the CLIF application to instantiate.
        Throws:
        java.lang.Error
      • ClifAppFacade

        public ClifAppFacade​(org.objectweb.fractal.api.Component clifApp,
                             java.lang.String name)
        Constructor for ClifAppFacade. Get all sub-components from the clifApp
        Parameters:
        clifApp - the existing Clif application component
    • Method Detail

      • getComponentByName

        public org.objectweb.fractal.api.Component getComponentByName​(java.lang.String name)
        Get a component of the clifApplication by his Fractal name
        Parameters:
        name - the name of the component to find
        Returns:
        the reference of a component contained by the Clif Application whose name equals the String passed as parameter, or null if there is no such component.
      • getClifApp

        public org.objectweb.fractal.api.Component getClifApp()
        Get clifApp component
        Returns:
        Returns the clifApp component.
      • deploy

        public void deploy​(java.util.Map<java.lang.String,​ClifDeployDefinition> definitions,
                           ClifRegistry registry)
                    throws ClifException
        Asynchronously deploys blades among CLIF servers according to the given definitions. First, a new CLIF code server is launched. Then, current CLIF application is stopped, reconfigured and started again. In case the CLIF application is doing wrong (typically one of its distributed parts is no longer available), a new one is instantiated. So, be careful to always call getClifApp() from one deployment to another whenever you need to get the reference to the CLIF application component. Old blades that may have been previously deployed by this supervisor are removed, unless a new CLIF application is instantiated or previous blades became unreachable. DeployObservation objects will be send to Observers to inform about deployment success or failure. BladeObservation objects are also sent to notify blades state changes.
        Parameters:
        definitions - a Map containing test plan definitions, indexed by blades identifiers
        registry - the CLIF registry to be used for getting CLIF servers references
        Throws:
        ClifException - when the CLIF code server could not be started, or when the test plan definition is null
        See Also:
        DeployDefinition, DeployObservation, BladeObservation, syncDeploy(Map, ClifRegistry)
      • init

        public void init​(java.lang.String testId)
                  throws ClifException
        Init selected blades if global state is deployed
        Parameters:
        testId - selected blades ids
        Throws:
        ClifException
      • start

        public int start​(java.lang.String[] selBladesId)
        Start selected blades if global state is initialized
        Parameters:
        selBladesId - selected blades ids
        Returns:
        the int code return for exit info
      • stop

        public int stop​(java.lang.String[] selBladesId)
        Stop selected blades if global state is not stopped/completed/aborted
        Parameters:
        selBladesId - selected blades ids
        Returns:
        the int code return for exit info
      • suspend

        public int suspend​(java.lang.String[] selBladesId)
        Suspend selected blades if global state is running
        Parameters:
        selBladesId - selected blades ids
        Returns:
        the int code return for exit info
      • resume

        public int resume​(java.lang.String[] selBladesId)
        Resume selected blades if global state is suspended
        Parameters:
        selBladesId - selected blades ids
        Returns:
        the int code return for exit info
      • join

        public int join​(java.lang.String[] selBladesId)
        Join selected blades if global state is running
        Parameters:
        selBladesId - selected blades ids
        Returns:
        the int code return for exit info
      • collect

        public int collect​(java.lang.String[] selBladesId,
                           CollectListener listener)
        Collect selected blades if global state is completed or stopped
        Parameters:
        selBladesId - selected blades ids
        Returns:
        the int return code for exit information
      • getGlobalState

        public BladeState getGlobalState​(java.lang.String[] selBladesId)
        Get global state for these blades.
        Parameters:
        selBladesId - the blades ids
        Returns:
        BladeState the global state
      • getState

        public BladeState getState​(java.lang.String id)
        Get the state of a blade
        Parameters:
        id - the bladeId tested
        Returns:
        the blade state
      • waitForState

        public int waitForState​(java.lang.String[] selBladesId,
                                BladeState state)
        Waits until this state is reached
        Parameters:
        selBladesId -
        state -
        Returns:
        int return code
      • getStats

        public long[] getStats​(java.lang.String bladeId)
        Retrieve the ActionStat of a specific host.
        Parameters:
        bladeId - The blade identifier to get the statistical data from
        Returns:
        An array containing some informations about the test for this host
      • getStatLabels

        public java.lang.String[] getStatLabels​(java.lang.String bladeId)
        Retrieve the ActionStat of a specific host.
        Parameters:
        bladeId - The blade identifier to get the statistics labels from
        Returns:
        An array containing some informations about the test for this host
      • startMonitoring

        public void startMonitoring​(java.lang.String[] bladesId,
                                    long period)
        Start the monitoring of ActionStat of a specific host.
        Parameters:
        bladesId - The blade identifier to get the statistical data from (if null, get data for all blade)
        period - The monitoring period
      • getCurrentParameters

        public java.util.Map<java.lang.String,​java.io.Serializable> getCurrentParameters​(java.lang.String id)
      • getCurrentTestId

        public java.lang.String getCurrentTestId()
        Retrieves current test identifier.
        Returns:
        A string composed of the test name, and the date and time of its initialization
      • changeParameter

        public void changeParameter​(java.lang.String bladeId,
                                    java.lang.String name,
                                    java.lang.String text)
                             throws ClifException
        Throws:
        ClifException
      • update

        public void update​(java.util.Observable supervisor,
                           java.lang.Object observation)
        Specified by:
        update in interface java.util.Observer