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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractPCMWorkflowRunConfiguration.java]

nameclass, %method, %block, %line, %
AbstractPCMWorkflowRunConfiguration.java0%   (0/1)0%   (0/28)0%   (0/356)0%   (0/102)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractPCMWorkflowRunConfiguration0%   (0/1)0%   (0/28)0%   (0/356)0%   (0/102)
<static initializer> 0%   (0/1)0%   (0/83)0%   (0/22)
AbstractPCMWorkflowRunConfiguration (): void 0%   (0/1)0%   (0/6)0%   (0/2)
clone (): Object 0%   (0/1)0%   (0/86)0%   (0/15)
getAccuracyInfluenceAnalysisState (): AccuracyInfluenceAnalysisState 0%   (0/1)0%   (0/3)0%   (0/1)
getAccuracyInfluenceIssueReceivingJob (): IIssueReceiver 0%   (0/1)0%   (0/3)0%   (0/1)
getAccuracyInformationModelFile (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getAllocationFiles (): List 0%   (0/1)0%   (0/3)0%   (0/1)
getClone (): AbstractPCMWorkflowRunConfiguration 0%   (0/1)0%   (0/11)0%   (0/4)
getEventMiddlewareFile (): String 0%   (0/1)0%   (0/8)0%   (0/3)
getMiddlewareFile (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPCMModelFiles (): List 0%   (0/1)0%   (0/24)0%   (0/6)
getStoragePluginID (): String 0%   (0/1)0%   (0/26)0%   (0/5)
getUsageModelFile (): String 0%   (0/1)0%   (0/3)0%   (0/1)
isAccuracyInfluenceAnalysisEnabled (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
isDeleteTemporaryDataAfterAnalysis (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
isOverwriteWithoutAsking (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
setAccuracyInfluenceAnalysisEnabled (boolean): void 0%   (0/1)0%   (0/6)0%   (0/3)
setAccuracyInfluenceAnalysisState (AccuracyInfluenceAnalysisState): void 0%   (0/1)0%   (0/4)0%   (0/2)
setAccuracyInfluenceIssueReceivingJob (IIssueReceiver): void 0%   (0/1)0%   (0/4)0%   (0/2)
setAccuracyInformationModelFile (String): void 0%   (0/1)0%   (0/6)0%   (0/3)
setAllocationFiles (List): void 0%   (0/1)0%   (0/6)0%   (0/3)
setDeleteTemporaryDataAfterAnalysis (boolean): void 0%   (0/1)0%   (0/6)0%   (0/3)
setEventMiddlewareFile (String): void 0%   (0/1)0%   (0/6)0%   (0/3)
setMiddlewareFile (String): void 0%   (0/1)0%   (0/6)0%   (0/3)
setOverwriteWithoutAsking (boolean): void 0%   (0/1)0%   (0/4)0%   (0/2)
setStoragePluginID (String): void 0%   (0/1)0%   (0/6)0%   (0/3)
setUsageModelFile (String): void 0%   (0/1)0%   (0/6)0%   (0/3)
validateAndFreeze (): void 0%   (0/1)0%   (0/25)0%   (0/7)

1package de.uka.ipd.sdq.workflow.pcm.configurations;
2 
3import java.util.ArrayList;
4import java.util.List;
5 
6import org.apache.log4j.Logger;
7import org.eclipse.emf.common.util.URI;
8import org.eclipse.emf.ecore.EPackage;
9import org.eclipse.emf.ecore.EcorePackage;
10 
11import de.uka.ipd.sdq.completions.CompletionsPackage;
12import de.uka.ipd.sdq.identifier.IdentifierPackage;
13import de.uka.ipd.sdq.pcm.PcmPackage;
14import de.uka.ipd.sdq.pcm.allocation.AllocationPackage;
15import de.uka.ipd.sdq.pcm.core.CorePackage;
16import de.uka.ipd.sdq.pcm.parameter.ParameterPackage;
17import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.Qos_reliabilityPackage;
18import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage;
19import de.uka.ipd.sdq.pcm.repository.RepositoryPackage;
20import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentPackage;
21import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage;
22import de.uka.ipd.sdq.pcm.seff.SeffPackage;
23import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityPackage;
24import de.uka.ipd.sdq.pcm.system.SystemPackage;
25import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage;
26import de.uka.ipd.sdq.probfunction.ProbfunctionPackage;
27import de.uka.ipd.sdq.stoex.StoexPackage;
28import de.uka.ipd.sdq.units.UnitsPackage;
29import de.uka.ipd.sdq.workflow.exceptions.InvalidWorkflowJobConfiguration;
30import de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedRunConfiguration;
31import de.uka.ipd.sdq.workflow.pcm.ConstantsContainer;
32import de.uka.ipd.sdq.workflow.pcm.jobs.IIssueReceiver;
33import de.uka.ipd.sdq.workflow.pcm.runconfig.AccuracyInfluenceAnalysisState;
34 
35/**
36 * Base class of workflow configuration objects where the workflow has to deal
37 * with a PCM model instance. This configuration class holds the locations of
38 * the PCM model parts, and (for convinience) a static list of EPackages needed
39 * to read the files.
40 *
41 * @author Steffen Becker
42 */
43public abstract class AbstractPCMWorkflowRunConfiguration extends
44                AbstractWorkflowBasedRunConfiguration implements Cloneable {
45        /** Logger for this class. */
46        private static final Logger logger = Logger.getLogger(AbstractPCMWorkflowRunConfiguration.class);
47 
48        /**
49         * Contains All EPackages within or referenced by PCM. Used, e.g., for OAW
50         * template generation.
51         */
52        public static final EPackage[] PCM_EPACKAGES = new EPackage[] {
53                        // Packages needed by QVT Transformations {{
54                        EcorePackage.eINSTANCE,
55                        IdentifierPackage.eINSTANCE,
56                        UnitsPackage.eINSTANCE,
57                        ProbfunctionPackage.eINSTANCE,
58                        PcmPackage.eINSTANCE,
59                        // }}
60                        SeffPackage.eINSTANCE,
61                        RepositoryPackage.eINSTANCE,
62                        ParameterPackage.eINSTANCE,
63                        UsagemodelPackage.eINSTANCE,
64                        SystemPackage.eINSTANCE,
65                        ResourcetypePackage.eINSTANCE,
66                        ResourceenvironmentPackage.eINSTANCE,
67                        AllocationPackage.eINSTANCE,
68                        StoexPackage.eINSTANCE,
69                        CorePackage.eINSTANCE,
70                        CompletionsPackage.eINSTANCE,
71                        ReliabilityPackage.eINSTANCE,
72                        Qos_reliabilityPackage.eINSTANCE,
73                        Seff_reliabilityPackage.eINSTANCE};
74 
75        protected String middlewareFile;
76        protected String eventMiddlewareFile;
77        protected List<String> allocationFiles;
78        protected String usageModelFile;
79 
80        /** Storage for temporary models and code. */
81        protected String temporaryDataLocation;
82        /** State if temporary data (models and/or code) should be deleted after the analysis. */
83        protected boolean deleteTemporaryDataAfterAnalysis;
84 
85        /** Activation state of the accuracy influence analysis. */
86        protected boolean accuracyInfluenceAnalysisEnabled;
87        /** Path to the file containing the accuracy information model. */
88        protected String accuracyInformationModelFile;
89        /** State of the current accuracy influence analysis. */
90        protected AccuracyInfluenceAnalysisState accuracyInfluenceAnalysisState;
91        /** Job receiving the issues occurred during accuracy influence analysis. */
92        protected IIssueReceiver accuracyInfluenceIssueReceivingJob;
93        
94        protected boolean overwriteWithoutAsking = false;
95 
96        /**
97         * @return Returns the receiving job for accuracy influence analysis issues
98         */
99        public IIssueReceiver getAccuracyInfluenceIssueReceivingJob() {
100                return accuracyInfluenceIssueReceivingJob;
101        }
102 
103        /**
104         * @param accuracyInfluenceIssueReceivingJob Sets the receiving job for accuracy influence analysis issues.
105         */
106        public void setAccuracyInfluenceIssueReceivingJob(
107                        IIssueReceiver accuracyInfluenceIssueReceivingJob) {
108                this.accuracyInfluenceIssueReceivingJob = accuracyInfluenceIssueReceivingJob;
109        }
110 
111        /**
112         * @return Returns the current accuracy influence analysis state.
113         */
114        public AccuracyInfluenceAnalysisState getAccuracyInfluenceAnalysisState() {
115                return accuracyInfluenceAnalysisState;
116        }
117 
118        /**Sets the accuracy influence analysis state.
119         * @param accuracyInfluenceAnalysisState The new state.
120         */
121        public void setAccuracyInfluenceAnalysisState(
122                        AccuracyInfluenceAnalysisState accuracyInfluenceAnalysisState) {
123                this.accuracyInfluenceAnalysisState = accuracyInfluenceAnalysisState;
124        }
125 
126        /**
127         * @return if deletion of temporary data after analysis is enabled.
128         */
129        public boolean isDeleteTemporaryDataAfterAnalysis() {
130                return deleteTemporaryDataAfterAnalysis;
131        }
132 
133        /**Sets the activation state for the deletion of temporary data after an analysis.
134         * @param deleteTemporaryDataAfterAnalysis
135         */
136        public void setDeleteTemporaryDataAfterAnalysis(
137                        boolean deleteTemporaryDataAfterAnalysis) {
138                checkFixed();
139                this.deleteTemporaryDataAfterAnalysis = deleteTemporaryDataAfterAnalysis;
140        }
141 
142        /**
143         * @return Returns the activation state of the accuracy influence analysis.
144         */
145        public boolean isAccuracyInfluenceAnalysisEnabled() {
146                return accuracyInfluenceAnalysisEnabled;
147        }
148 
149        /**Set the activation state of the accuracy influence analysis.
150         * @param enabled Activation state.
151         */
152        public void setAccuracyInfluenceAnalysisEnabled(boolean enabled) {
153                checkFixed();
154                this.accuracyInfluenceAnalysisEnabled = enabled;
155        }
156 
157        /**
158         * @return Returns the string representation of the path to the file containing the accuracy information model.
159         */
160        public String getAccuracyInformationModelFile() {
161                return accuracyInformationModelFile;
162        }
163 
164        /**Set the path to the file containing the accuracy information model.
165         * @param accuracyInformationModelFile
166         */
167        public void setAccuracyInformationModelFile(String accuracyInformationModelFile) {
168                checkFixed();
169                this.accuracyInformationModelFile = accuracyInformationModelFile;
170        }
171 
172        /**
173         * @return Returns the ID of the Eclipse plug-in project to be generated as temporary storage for models and, if applicable, code.
174         */
175        public String getStoragePluginID() {
176                StringBuilder sb = new StringBuilder();
177                sb.append(temporaryDataLocation);
178                if (isAccuracyInfluenceAnalysisEnabled()) {
179                        sb.append("_" + accuracyInfluenceAnalysisState);
180                }
181                return sb.toString();
182        }
183 
184        /**
185         * Sets the name of the Eclipse plug-in project which will be generated as temporary storage for models and, if applicable, code.
186         *
187         * @param pluginID
188         *            The name of the project containing the generated code
189         */
190        public void setStoragePluginID(String pluginID) {
191                checkFixed();
192                this.temporaryDataLocation = pluginID;
193        }
194 
195 
196        /**
197         * @return Returns a list of string URIs containing all model files needed
198         *         for a full PCM instance
199         */
200        public List<String> getPCMModelFiles() {
201                ArrayList<String> files = new ArrayList<String>();
202                files.addAll(allocationFiles);
203                files.add(usageModelFile);
204                if (accuracyInfluenceAnalysisEnabled) {
205                        files.add(accuracyInformationModelFile);
206                }
207 
208                return files;
209        }
210 
211        /**
212         * @return Returns the filename of the PCM's middleware completion
213         *         repository
214         */
215        public String getMiddlewareFile() {
216                return middlewareFile;
217        }
218 
219        /**
220         * Sets the filename of the PCM's middleware completion repository
221         *
222         * @param middlewareFile
223         */
224        public void setMiddlewareFile(String middlewareFile) {
225                checkFixed();
226                this.middlewareFile = middlewareFile;
227        }
228 
229        /**
230         * @return Returns the filename of the PCM's middleware completion
231         *         repository. If the repository was not set before, the default file will be returned.
232         */
233        public String getEventMiddlewareFile() {
234                if(eventMiddlewareFile != null){
235                        return eventMiddlewareFile;
236                } else {
237                        return ConstantsContainer.DEFAULT_EVENT_MIDDLEWARE_FILE;
238                }
239        }
240 
241        /**
242         * Sets the filename of the PCM's middleware completion repository
243         *
244         * @param eventMiddlewareFile
245         */
246        public void setEventMiddlewareFile(String eventMiddlewareFile) {
247                checkFixed();
248                this.eventMiddlewareFile = eventMiddlewareFile;
249        }
250 
251        public List<String> getAllocationFiles() {
252                return allocationFiles;
253        }
254 
255        public void setAllocationFiles(List<String> allocationFile) {
256                checkFixed();
257                this.allocationFiles = allocationFile;
258        }
259 
260        public String getUsageModelFile() {
261                return usageModelFile;
262        }
263 
264        public void setUsageModelFile(String usageModelFile) {
265                checkFixed();
266                this.usageModelFile = usageModelFile;
267        }
268        
269 
270        public boolean isOverwriteWithoutAsking() {
271                return overwriteWithoutAsking;
272        }
273 
274        public void setOverwriteWithoutAsking(boolean overwriteWithoutAsking) {
275                this.overwriteWithoutAsking = overwriteWithoutAsking;
276        }
277 
278        /*
279         * (non-Javadoc)
280         *
281         * @see
282         * de.uka.ipd.sdq.workflow.launchconfig.AbstractWorkflowBasedRunConfiguration
283         * #validateAndFreeze()
284         */
285        @Override
286        public void validateAndFreeze() throws InvalidWorkflowJobConfiguration {
287                super.validateAndFreeze();
288                for (String fileURI : getPCMModelFiles()) {
289                        if (fileURI == null)
290                                throw new InvalidWorkflowJobConfiguration(
291                                                "Workflow configuration is invalid, not all PCM models are set");
292                        URI fileLocation = URI.createURI(fileURI);
293                        // TODO: Check whether file exists
294                }
295        }
296 
297        @Override
298        protected Object clone() throws CloneNotSupportedException {
299                AbstractPCMWorkflowRunConfiguration config = (AbstractPCMWorkflowRunConfiguration) super.clone();
300                config.accuracyInfluenceAnalysisEnabled = this.accuracyInfluenceAnalysisEnabled;
301                config.accuracyInfluenceAnalysisState = this.accuracyInfluenceAnalysisState;
302                config.accuracyInformationModelFile = new String(this.accuracyInformationModelFile);
303                ArrayList<String> newAllocationFiles = new ArrayList<String>(this.allocationFiles.size());
304                for (String allocationFile : this.allocationFiles) {
305                        newAllocationFiles.add(new String(allocationFile));
306                }
307                config.allocationFiles = newAllocationFiles;
308                config.deleteTemporaryDataAfterAnalysis = this.deleteTemporaryDataAfterAnalysis;
309                config.eventMiddlewareFile = new String(this.eventMiddlewareFile);
310                config.middlewareFile = new String(this.middlewareFile);
311                config.temporaryDataLocation = new String(temporaryDataLocation);
312                config.usageModelFile = new String(usageModelFile);
313                config.accuracyInfluenceIssueReceivingJob = this.accuracyInfluenceIssueReceivingJob;
314                return config;
315        }
316 
317        public AbstractPCMWorkflowRunConfiguration getClone() {
318                try {
319                        return (AbstractPCMWorkflowRunConfiguration) clone();
320                } catch (CloneNotSupportedException e) {
321                        logger.fatal("Could not clone configuration.", e);
322                        return null;
323                }
324        }
325}

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