EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs]

COVERAGE SUMMARY FOR SOURCE FILE [TransferSimulationBundleToDock.java]

nameclass, %method, %block, %line, %
TransferSimulationBundleToDock.java0%   (0/1)0%   (0/4)0%   (0/129)0%   (0/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TransferSimulationBundleToDock0%   (0/1)0%   (0/4)0%   (0/129)0%   (0/35)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
TransferSimulationBundleToDock (AbstractSimulationWorkflowConfiguration, IDeb... 0%   (0/1)0%   (0/20)0%   (0/7)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/99)0%   (0/26)
getName (): String 0%   (0/1)0%   (0/2)0%   (0/1)

1package de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs;
2 
3import org.eclipse.core.runtime.IProgressMonitor;
4 
5import de.uka.ipd.sdq.codegen.simucontroller.SimuControllerPlugin;
6import de.uka.ipd.sdq.codegen.simucontroller.debug.IDebugListener;
7import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.DockModel;
8import de.uka.ipd.sdq.codegen.simucontroller.runconfig.AbstractSimulationWorkflowConfiguration;
9import de.uka.ipd.sdq.simucomframework.simulationdock.SimulationDockService;
10import de.uka.ipd.sdq.simucomframework.simulationdock.SimulationDockServiceImpl;
11import de.uka.ipd.sdq.workflow.IJob;
12import de.uka.ipd.sdq.workflow.IJobWithResult;
13import de.uka.ipd.sdq.workflow.exceptions.JobFailedException;
14import de.uka.ipd.sdq.workflow.exceptions.UserCanceledException;
15import de.uka.ipd.sdq.workflow.launchconfig.extension.AbstractExtendableJob;
16import de.uka.ipd.sdq.workflow.mdsd.blackboard.MDSDBlackboard;
17 
18/**
19 * Installs a Plug-In from the specified location string with use a bundles
20 * context.The context is used to grant access to other methods so that this
21 * bundle can interact with the Framework.
22 */
23public class TransferSimulationBundleToDock extends AbstractExtendableJob<MDSDBlackboard> {
24 
25        /**
26         * This job's parent job which creates a JAR archive of the simulation bundle 
27         */
28        private IJobWithResult<byte[]> myCreatePluginProjectJob;
29        
30        /**
31         * Configuration object for the simulation 
32         */
33        private AbstractSimulationWorkflowConfiguration myConfig;
34 
35        private boolean isDebug;
36 
37        private IDebugListener debugListener;
38 
39        public TransferSimulationBundleToDock(
40                        AbstractSimulationWorkflowConfiguration configuration,
41                        IDebugListener debugListener,
42                        IJobWithResult<byte[]> createPluginJarJob) {
43                super();
44                
45                this.myCreatePluginProjectJob = createPluginJarJob;
46                this.myConfig = configuration;
47                this.debugListener = debugListener;
48                this.isDebug = configuration.isDebug();
49                handleJobExtensions(WorkflowHooks.WORKFLOW_ID_AFTER_DOCK,configuration);
50        }
51 
52        public void execute(IProgressMonitor monitor) throws JobFailedException, UserCanceledException {
53                
54                
55                assert (myCreatePluginProjectJob != null);
56 
57                try {
58                        DockModel dock = SimuControllerPlugin.getDockModel().getBestFreeDock();
59                        SimulationDockService simService = dock.getService();
60                        if (isDebug) {
61                                debugListener.simulationStartsInDock(dock);
62                        }
63                        simService.load(
64                                        myConfig.getSimulationConfiguration(),
65                                        myCreatePluginProjectJob.getResult(),
66                                        dock.isRemote());
67                        
68                        // Execute extension jobs first
69                        // TODO: don't call this here. Put TransferSimulationBundleToDock job logic into a separate job that is nested in a OrderPreservingCompositeJob
70                        // together with the extension jobs
71                        for (IJob extensionJob : myJobs) {
72                                if (extensionJob instanceof AbstractSimuComExtensionJob) {
73                                        ((AbstractSimuComExtensionJob)extensionJob).setSimuComModel(((SimulationDockServiceImpl)simService).getSimuComModel());
74                                }
75                        }
76                        super.execute(monitor);
77                        
78                        
79                        simService.simulate(
80                                        myConfig.getSimulationConfiguration(),
81                                        myCreatePluginProjectJob.getResult(),
82                                        dock.isRemote());
83                } catch (InterruptedException e) {
84                        throw new JobFailedException("Job failed while waiting for a dock to become available",e);
85                }
86                catch (Exception e) {
87                        throw new JobFailedException("Simulation run failed.",e);
88                }
89                finally {
90                        if (isDebug) {
91                                this.debugListener.simulationStoppedInDock();
92                        }
93                }
94        }
95 
96        public String getName() {
97                return "Transfer Plugin to Dock and Simulate";
98        }
99 
100}

[all classes][de.uka.ipd.sdq.codegen.simucontroller.workflow.jobs]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov