Class SupervisorImpl

  • All Implemented Interfaces:
    org.objectweb.fractal.api.control.BindingController, ActivityControl, SupervisorInfo, TestControl

    public class SupervisorImpl
    extends java.util.Observable
    implements TestControl, SupervisorInfo, org.objectweb.fractal.api.control.BindingController
    Supervisor implementation, used to control a deployed test plan (i.e. a set of blades). This class extends the Observable class in order to provide feedback information about the state of the test plan's blades and the occurrence of alarms.
    Author:
    Julien Buret, Nicolas Droze, Bruno Dillenseger, Joan Chaumont
    See Also:
    AlarmEvent, BladeObservation
    • Constructor Summary

      Constructors 
      Constructor Description
      SupervisorImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void alarm​(java.lang.String bladeId, AlarmEvent alarm)
      Forwards the alarm event to observers
      void bindFc​(java.lang.String clientItfName, java.lang.Object serverItf)  
      void changeParameter​(java.lang.String bladeId, java.lang.String name, java.io.Serializable value)
      Changes a blade parameter value.
      void collect​(java.lang.String[] selBladesId, CollectListener listener)
      Collects latest test data for selected blades
      java.lang.String[] getBladesIds()
      Get the identifiers of all blades that are currently under control (i.e.
      java.util.Map<java.lang.String,​java.io.Serializable> getCurrentParameters​(java.lang.String bladeId)
      Gets a Map of blade parameters and their associated values.
      java.lang.String getCurrentTestId()
      Retrieves current test identifier.
      java.util.Map<java.lang.String,​ClifDeployDefinition> getDefinitions()
      Gets current test plan definition
      BladeState getGlobalState​(java.lang.String[] selBladesId)
      Get global state for some blades.
      java.lang.String[] getStatLabels​(java.lang.String bladeId)
      Gets labels describing statistics delivered by a blade
      long[] getStats​(java.lang.String bladeId)
      Retrieve the execution statistics of a blade.
      void init​(java.io.Serializable testId)
      Initializes a new test for every blade in the deployed test plan.
      void join()
      Waits for the end of activity of all blades of currently deployed test plan.
      void join​(java.lang.String[] selBladesId)
      Waits for the end of execution of a selection of blades from currently deployed test plan.
      java.lang.String[] listFc()  
      java.lang.Object lookupFc​(java.lang.String clientItfName)  
      void resume()
      Resumes all blades of currently deployed test plan.
      void resume​(java.lang.String[] selBladesId)
      Resumes a selection of blades from currently deployed test plan.
      void setBladeState​(java.lang.String id, BladeState state)
      Inform that the state of a blade has changed.
      void setDefinitions​(java.util.Map<java.lang.String,​ClifDeployDefinition> definitions)
      Sets the test plan definition.
      void start()
      Starts all blades of the currently deployed test plan.
      void start​(java.lang.String[] selBladesId)
      Starts a selection of blades of currently deployed test plan.
      void stop()
      Stops all blades of currently deployed test plan.
      void stop​(java.lang.String[] selBladesId)
      Stops a selection of blades from currently deployed test plan.
      void suspend()
      Suspends all blades of currently deployed test plan.
      void suspend​(java.lang.String[] selBladesId)
      Suspends a selection of blades from currently deployed test plan.
      void unbindFc​(java.lang.String clientItfName)  
      void waitEndOfRun​(java.lang.String[] selBladesId)
      Wait until blades are stopped, completed or aborted.
      boolean waitForState​(java.lang.String[] selBladesId, BladeState state)
      Waits until blades are all in a given state.
      void waitStationaryState​(java.lang.String[] selBladesId)
      Waits until blades are all in a stationary state.
      • 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

      • currentTestId

        protected java.io.Serializable currentTestId
        The current test ID
    • Constructor Detail

      • SupervisorImpl

        public SupervisorImpl()
    • Method Detail

      • lookupFc

        public java.lang.Object lookupFc​(java.lang.String clientItfName)
        Specified by:
        lookupFc in interface org.objectweb.fractal.api.control.BindingController
      • bindFc

        public void bindFc​(java.lang.String clientItfName,
                           java.lang.Object serverItf)
        Specified by:
        bindFc in interface org.objectweb.fractal.api.control.BindingController
      • unbindFc

        public void unbindFc​(java.lang.String clientItfName)
        Specified by:
        unbindFc in interface org.objectweb.fractal.api.control.BindingController
      • listFc

        public java.lang.String[] listFc()
        Specified by:
        listFc in interface org.objectweb.fractal.api.control.BindingController
      • getBladesIds

        public java.lang.String[] getBladesIds()
        Get the identifiers of all blades that are currently under control (i.e. deployed).
        Specified by:
        getBladesIds in interface TestControl
        Returns:
        an array containing the identifiers of all blades bound to this supervisor.
      • getStats

        public long[] getStats​(java.lang.String bladeId)
        Retrieve the execution statistics of a blade.
        Specified by:
        getStats in interface TestControl
        Parameters:
        bladeId - The blade identifier to get the statistics from
        Returns:
        An array containing execution statistics for the given blade
        See Also:
        getStatLabels(String)
      • getStatLabels

        public java.lang.String[] getStatLabels​(java.lang.String bladeId)
        Gets labels describing statistics delivered by a blade
        Specified by:
        getStatLabels in interface TestControl
        Parameters:
        bladeId - the blade identifier
        Returns:
        An array of string labels describing the statistics delivered by the designated blade
        See Also:
        getStats(String)
      • getCurrentParameters

        public java.util.Map<java.lang.String,​java.io.Serializable> getCurrentParameters​(java.lang.String bladeId)
        Gets a Map of blade parameters and their associated values.
        Specified by:
        getCurrentParameters in interface TestControl
        Parameters:
        bladeId - the blade identifier
        Returns:
        parameters of the designated blade if found, null otherwise
      • changeParameter

        public void changeParameter​(java.lang.String bladeId,
                                    java.lang.String name,
                                    java.io.Serializable value)
                             throws ClifException
        Changes a blade parameter value.
        Specified by:
        changeParameter in interface TestControl
        Parameters:
        bladeId - the blade identifier
        name - the parameter name
        value - the new parameter value
        Throws:
        ClifException
      • collect

        public void collect​(java.lang.String[] selBladesId,
                            CollectListener listener)
        Collects latest test data for selected blades
        Specified by:
        collect in interface TestControl
        Parameters:
        selBladesId - selected blades identifiers as a String[]
        listener - the listener receives progress information and it is given the opportunity to cancel the collection. Ignored if null.
      • init

        public void init​(java.io.Serializable testId)
                  throws ClifException
        Initializes a new test for every blade in the deployed test plan. setDefinitions(Map) must be called before to test the currently deployed test plan definition.
        Specified by:
        init in interface ActivityControl
        Parameters:
        testId - the new test's name
        Throws:
        ClifException
      • start

        public void start()
        Starts all blades of the currently deployed test plan.
        Specified by:
        start in interface ActivityControl
      • start

        public void start​(java.lang.String[] selBladesId)
        Starts a selection of blades of currently deployed test plan. Does not complain if any blade identifier is not known.
        Specified by:
        start in interface TestControl
        Parameters:
        selBladesId - identifiers of blades to be started, or null for starting all blades.
      • stop

        public void stop()
        Stops all blades of currently deployed test plan.
        Specified by:
        stop in interface ActivityControl
      • stop

        public void stop​(java.lang.String[] selBladesId)
        Stops a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.
        Specified by:
        stop in interface TestControl
        Parameters:
        selBladesId - array of target blades identifiers, or null for designating all blades
      • suspend

        public void suspend()
        Suspends all blades of currently deployed test plan.
        Specified by:
        suspend in interface ActivityControl
      • suspend

        public void suspend​(java.lang.String[] selBladesId)
        Suspends a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.
        Specified by:
        suspend in interface TestControl
        Parameters:
        selBladesId - array of target blades identifiers, or null for designating all blades
      • resume

        public void resume()
        Resumes all blades of currently deployed test plan.
        Specified by:
        resume in interface ActivityControl
      • resume

        public void resume​(java.lang.String[] selBladesId)
        Resumes a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.
        Specified by:
        resume in interface TestControl
        Parameters:
        selBladesId - array of target blades identifiers, or null for designating all blades
      • join

        public void join()
        Waits for the end of activity of all blades of currently deployed test plan.
        Specified by:
        join in interface ActivityControl
      • join

        public void join​(java.lang.String[] selBladesId)
        Waits for the end of execution of a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.
        Specified by:
        join in interface TestControl
        Parameters:
        selBladesId - array of target blades identifiers, or null for designating all blades
      • alarm

        public void alarm​(java.lang.String bladeId,
                          AlarmEvent alarm)
        Forwards the alarm event to observers
        Specified by:
        alarm in interface SupervisorInfo
        Parameters:
        bladeId - blade identifier of the event source
        alarm - alarm event
      • setBladeState

        public void setBladeState​(java.lang.String id,
                                  BladeState state)
        Inform that the state of a blade has changed.
        Specified by:
        setBladeState in interface SupervisorInfo
        Parameters:
        id - the globally unique blade identifier
        state - The new state of the blade
      • waitStationaryState

        public void waitStationaryState​(java.lang.String[] selBladesId)
                                 throws java.lang.InterruptedException
        Waits until blades are all in a stationary state.
        Specified by:
        waitStationaryState in interface SupervisorInfo
        Parameters:
        selBladesId - array of identifiers of target blades, or null for designating all blades of currently deployed test plan.
        Throws:
        java.lang.InterruptedException
      • waitForState

        public boolean waitForState​(java.lang.String[] selBladesId,
                                    BladeState state)
                             throws java.lang.InterruptedException
        Waits until blades are all in a given state.
        Specified by:
        waitForState in interface SupervisorInfo
        Parameters:
        selBladesId - array of identifiers of target blades, or null for designating all blades of currently deployed test plan.
        state - the requested blade state
        Returns:
        true if current state is actually the requested state, false otherwise.
        Throws:
        java.lang.InterruptedException
      • getGlobalState

        public BladeState getGlobalState​(java.lang.String[] selBladesId)
        Get global state for some blades.
        Specified by:
        getGlobalState in interface SupervisorInfo
        Parameters:
        selBladesId - identifiers of target blades, or null for designating all blades
        Returns:
        the global state.
      • waitEndOfRun

        public void waitEndOfRun​(java.lang.String[] selBladesId)
                          throws java.lang.InterruptedException
        Wait until blades are stopped, completed or aborted.
        Specified by:
        waitEndOfRun in interface SupervisorInfo
        Parameters:
        selBladesId - identifiers of target blades, or null for designating all blades
        Throws:
        java.lang.InterruptedException
      • getCurrentTestId

        public java.lang.String getCurrentTestId()
        Retrieves current test identifier.
        Specified by:
        getCurrentTestId in interface TestControl
        Returns:
        A string composed of the test name, and the date and time of its initialization