Class AbstractMain

java.lang.Object
de.uka.ipd.sdq.simucomframework.AbstractMain
All Implemented Interfaces:
ISimulationControl, org.osgi.framework.BundleActivator

public abstract class AbstractMain extends Object implements ISimulationControl, org.osgi.framework.BundleActivator
Base class for simulation instances. It contains a generic simulation start and stop logic as well as basic error handling mechanisms. The code generated for each SimuCom instance contains the class main.SimuComControl that inherits from this one and provides the missing information. Excerpt from main.SimuComControl: public class SimuComControl extends de.uka.ipd.sdq.simucomframework.AbstractMain TODO This class currently serves too many concerns, e.g., creation of execution result calculators and mixing of usage response time calculator creation and handling of stop conditions. Therefore, some refactorings are needed. [Lehrig]
  • Constructor Details

    • AbstractMain

      public AbstractMain()
  • Method Details

    • start

      public void start(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      start in interface org.osgi.framework.BundleActivator
      Throws:
      Exception
    • stop

      public void stop(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      stop in interface org.osgi.framework.BundleActivator
      Throws:
      Exception
    • run

      protected SimulationResult run(IStatusObserver statusObserver, SimuComConfig config, boolean isRemoteRun)
      Run a simulation using the given configuration and report to the given observer
      Parameters:
      statusObserver - Observer to notify about the simulation's progress
      config - Configuration options for the simulation
      isRemoteRun - True if this simulation runs remotely and has no access to the local sensorframework
      Returns:
      A status code indicating success or failure of the simulation
    • stop

      protected void stop()
      Request a simulation stop
    • getModel

      public SimuComModel getModel()
      Returns:
      The simucom model used in this simulation run
    • getErrorThrowable

      public Throwable getErrorThrowable()
      Description copied from interface: ISimulationControl
      Returns an exception which caused the simulation to terminate in case of simulation errors as indicated by the SimuComResult returned by the startSimulation method
      Specified by:
      getErrorThrowable in interface ISimulationControl
      Returns:
      An error object in case an exception occurred during simulation execution
    • prepareSimulation

      public void prepareSimulation(AbstractSimulationConfig config, IStatusObserver observer, boolean isRemoteRun)
      Description copied from interface: ISimulationControl
      Prepare a simulation run
      Specified by:
      prepareSimulation in interface ISimulationControl
      Parameters:
      config - The configuration object which sets many simulation parameters like stop conditions, storage location, etc.
      observer - An observer which gets notifications on the simulation progress
      isRemoteRun - If true, the simulation uses an own, temporary result store instead of the sensorfactory storage passed in the simulation parameter object. Use this for remote simulation docks which do not have access to the local sensor factory storages
    • startSimulation

      public SimulationResult startSimulation(AbstractSimulationConfig config, IStatusObserver observer, boolean isRemoteRun)
      Description copied from interface: ISimulationControl
      Start a simulation run
      Specified by:
      startSimulation in interface ISimulationControl
      Parameters:
      config - The configuration object which sets many simulation parameters like stop conditions, storage location, etc.
      observer - An observer which gets notifications on the simulation progress
      isRemoteRun - If true, the simulation uses an own, temporary result store instead of the sensorfactory storage passed in the simulation parameter object. Use this for remote simulation docks which do not have access to the local sensor factory storages
      Returns:
      The result of the simulation run
    • stopSimulation

      public void stopSimulation()
      Description copied from interface: ISimulationControl
      Cancels a running simulation by disallowing the generation of new simulation events
      Specified by:
      stopSimulation in interface ISimulationControl
    • getWorkloads

      protected abstract IWorkloadDriver[] getWorkloads(SimuComConfig config, de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager)
      Template method pattern. Child classes have to implement this to return workload drivers to use in the simulation. The workload drivers are used to generate the simulated users.
      Parameters:
      config - the simulation configuration data
      Returns:
      Workload drivers to use in the simulation run
    • getResourceContainerFactory

      protected abstract IResourceContainerFactory getResourceContainerFactory()
      Template method to return a factory which can be used to instanciate the simulated resource environment.
      Returns:
      A factory which is used to create the simulated resource environment
    • getStatus

      public SimuComStatus getStatus()
      Description copied from interface: ISimulationControl
      Retrieve an object containing the status of this simulation.
      Specified by:
      getStatus in interface ISimulationControl
      Returns:
      A SimuComStatus object containing the simulation status