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

COVERAGE SUMMARY FOR SOURCE FILE [DSELaunch.java]

nameclass, %method, %block, %line, %
DSELaunch.java0%   (0/1)0%   (0/11)0%   (0/183)0%   (0/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DSELaunch0%   (0/1)0%   (0/11)0%   (0/183)0%   (0/36)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/2)
DSELaunch (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createWorkflowJob (DSEWorkflowConfiguration, ILaunch): IJob 0%   (0/1)0%   (0/6)0%   (0/1)
deriveConfiguration (ILaunchConfiguration, String): DSEWorkflowConfiguration 0%   (0/1)0%   (0/28)0%   (0/7)
getNumberOfDSEIterations (ILaunchConfiguration): int 0%   (0/1)0%   (0/17)0%   (0/6)
getOriginalConfiguration (): ILaunchConfiguration 0%   (0/1)0%   (0/3)0%   (0/1)
getOriginalLaunch (): ILaunch 0%   (0/1)0%   (0/3)0%   (0/1)
getProcess (ILaunch): WorkflowProcess 0%   (0/1)0%   (0/12)0%   (0/3)
launch (ILaunchConfiguration, String, ILaunch, IProgressMonitor): void 0%   (0/1)0%   (0/35)0%   (0/7)
resetLoggers (): void 0%   (0/1)0%   (0/1)0%   (0/1)
setupLogging (Level): ArrayList 0%   (0/1)0%   (0/71)0%   (0/7)

1package de.uka.ipd.sdq.dsexplore.launch;
2 
3import java.util.ArrayList;
4 
5import org.apache.log4j.Level;
6import org.apache.log4j.Logger;
7import org.eclipse.core.runtime.CoreException;
8import org.eclipse.core.runtime.IProgressMonitor;
9import org.eclipse.debug.core.ILaunch;
10import org.eclipse.debug.core.ILaunchConfiguration;
11 
12import de.uka.ipd.sdq.workflow.IJob;
13import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedLaunchConfigurationDelegate;
14import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowConfigurationBuilder;
15import de.uka.ipd.sdq.workflow.launchconfig.LoggerAppenderStruct;
16import de.uka.ipd.sdq.workflow.launchconfig.WorkflowProcess;
17import de.uka.ipd.sdq.workflow.pcm.configurations.AbstractPCMLaunchConfigurationDelegate;
18import de.uka.ipd.sdq.workflow.pcm.configurations.PCMWorkflowConfigurationBuilder;
19 
20/**
21 * Launches multiple simulation runs. 
22 * 
23 * TODO: Integrate in Workflow concept. Unify the Tabs for all PCM Solvers. 
24 * Maybe use this common tab for all analyses, so that for reliability, SimCom and LQN,
25 * always only one config with once the model files is needed.   
26 * 
27 * @author Anne
28 *
29 */
30public class DSELaunch extends AbstractPCMLaunchConfigurationDelegate<DSEWorkflowConfiguration>{
31        
32        WorkflowProcess myWorkflowProcess;
33        
34        /**
35         * Logger of this class 
36         */
37        private static Logger logger = Logger.getLogger(DSELaunch.class);
38        
39 
40        private ILaunchConfiguration originalConfiguration;
41        private ILaunch originalLaunch;
42 
43 
44        /**
45         * Test for starting multiple simulations.
46         * @param configuration
47         * @param mode
48         * @param launch
49         * @param monitor
50         */
51        @Override
52        public void launch(ILaunchConfiguration configuration, String mode,
53                        ILaunch launch, IProgressMonitor monitor) throws CoreException {
54                
55                this.originalConfiguration = configuration;
56                this.originalLaunch = launch;
57                
58                int iterations = getNumberOfDSEIterations(configuration);
59                
60                logger.warn("Will start "+iterations+" analysis runs. Only first one may be visible on the console.");
61                for (int i = 0; i < iterations; i++) {
62                        super.launch(configuration, mode, launch, monitor);
63                }
64                
65        }
66 
67        private int getNumberOfDSEIterations(ILaunchConfiguration configuration) {
68                String stringValue;
69                try {
70                        stringValue = configuration.getAttribute(DSEConstantsContainer.DSE_ITERATIONS, "0");
71                        if (!stringValue.equals("")){
72                                int i = Integer.parseInt(stringValue);
73                                return i;
74                        }
75                } catch (Exception e) { /* just use 1 */ }
76                return 1;
77        }
78 
79        /**
80         * Copied from AbstractWorkflowBasedLaunchConfigurationDelegate
81         * Setup logger for the workflow run. May be overridden by clients to configure further logger
82         * for other namespaces than de.uka.ipd.sdq.workflow. Use protected method setupLogger to configure
83         * additional loggers
84         * @param logLevel The apache log4j log level requested by the user as log level
85         * @throws CoreException 
86         */
87        @Override
88        protected ArrayList<LoggerAppenderStruct> setupLogging(Level logLevel) throws CoreException {
89                ArrayList<LoggerAppenderStruct> loggerList = super.setupLogging(logLevel);
90 
91                // Setup SDQ workflow engine logging
92                loggerList.add(setupLogger("de.uka.ipd.sdq.dsexplore", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN));
93                loggerList.add(setupLogger("de.uka.ipd.sdq.reliability.solver", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN));
94                loggerList.add(setupLogger("de.uka.ipd.sdq.pcmsolver", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN));
95                loggerList.add(setupLogger("de.uka.ipd.sdq.simucomframework.variables", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN));
96                loggerList.add(setupLogger("de.uka.ipd.sdq.stoex.analyser", logLevel, Level.DEBUG == logLevel ? DETAILED_LOG_PATTERN : SHORT_LOG_PATTERN));
97                
98                return loggerList;
99        }
100 
101 
102 
103        @Override
104        protected IJob createWorkflowJob(
105                        DSEWorkflowConfiguration config, ILaunch launch)
106                        throws CoreException {
107                return new PerOpteryxJob(config, this);
108        }
109 
110 
111 
112        @Override
113        protected DSEWorkflowConfiguration deriveConfiguration(
114                        ILaunchConfiguration configuration, String mode)
115                        throws CoreException {
116                
117                AbstractWorkflowConfigurationBuilder builder;
118                builder = new PCMWorkflowConfigurationBuilder(configuration, mode);
119                
120                DSEWorkflowConfiguration config = new DSEWorkflowConfiguration();
121                builder.fillConfiguration(config);
122                
123                builder = new DSEWorkflowConfigurationBuilder(configuration, mode, this);
124                builder.fillConfiguration(config);
125                
126                config.setRawConfig(configuration);
127                
128                return config;
129        }
130        
131        /**
132         * FIXME: This is just a workaround to fix the logging. 
133         * There is a problem when the workflows for the Analyses are started. 
134         * Afterwards, the logging is broken. Thus, I reset it here.
135         * Problem: I do not know how much overhead this creates, maybe it is the cause for crashing eclipse after 1600 candidates with LQNS.  
136         * @throws CoreException
137         */
138        public void resetLoggers() throws CoreException{
139                //Logger.getRootLogger().removeAllAppenders();
140                //Logger.getLogger(loggerName);
141//                for (LoggerAppenderStruct logger : this.myLoggerList) {
142//                        this.myWorkflowProcess.addAppender(logger.getAppender());
143//                }
144        }
145 
146        public ILaunch getOriginalLaunch() {
147                return this.originalLaunch;
148        }
149        
150        public ILaunchConfiguration getOriginalConfiguration() {
151                return originalConfiguration;
152        }
153        
154        /** 
155         * Get the Eclipse process used by the workflow engine. When called first, 
156         * instatiate new process. Later return the same. 
157         * 
158         * @param launch The ILaunch passed to this launch by Eclipse
159         * @return The process used to execute this launch
160         */
161        @Override
162        protected WorkflowProcess getProcess(ILaunch launch) {
163                if (this.myWorkflowProcess == null){
164                        this.myWorkflowProcess = new WorkflowProcess(launch);
165                }
166                return this.myWorkflowProcess; 
167        }
168        
169}
170 
171 
172 

[all classes][de.uka.ipd.sdq.dsexplore.launch]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov