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

COVERAGE SUMMARY FOR SOURCE FILE [PrepareTransformationsJob.java]

nameclass, %method, %block, %line, %
PrepareTransformationsJob.java0%   (0/1)0%   (0/10)0%   (0/102)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PrepareTransformationsJob0%   (0/1)0%   (0/10)0%   (0/102)0%   (0/24)
PrepareTransformationsJob (CompletionConfiguration): void 0%   (0/1)0%   (0/11)0%   (0/4)
createFolder (IFolder, Logger): IFolder 0%   (0/1)0%   (0/34)0%   (0/7)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/29)0%   (0/5)
getHOTTracesFolder (String): IFolder 0%   (0/1)0%   (0/5)0%   (0/1)
getLogFolder (String): IFolder 0%   (0/1)0%   (0/5)0%   (0/1)
getModelFolder (String): IFolder 0%   (0/1)0%   (0/5)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getProject (String): IProject 0%   (0/1)0%   (0/5)0%   (0/2)
getTracesFolder (String): IFolder 0%   (0/1)0%   (0/5)0%   (0/1)
rollback (IProgressMonitor): void 0%   (0/1)0%   (0/1)0%   (0/1)

1package de.uka.ipd.sdq.cip.workflow.jobs;
2 
3import org.apache.log4j.Logger;
4import org.eclipse.core.resources.IFolder;
5import org.eclipse.core.resources.IProject;
6import org.eclipse.core.resources.ResourcesPlugin;
7import org.eclipse.core.runtime.CoreException;
8import org.eclipse.core.runtime.IProgressMonitor;
9 
10import de.uka.ipd.sdq.cip.ConstantsContainer;
11import de.uka.ipd.sdq.cip.configuration.CompletionConfiguration;
12import de.uka.ipd.sdq.workflow.IJob;
13import de.uka.ipd.sdq.workflow.exceptions.JobFailedException;
14import de.uka.ipd.sdq.workflow.exceptions.RollbackFailedException;
15import de.uka.ipd.sdq.workflow.exceptions.UserCanceledException;
16 
17public class PrepareTransformationsJob implements IJob{
18 
19        /** The logger for this class */
20        private Logger logger = Logger.getLogger(PrepareTransformationsJob.class);
21        
22        /** The project id where to create folders */
23        private String projectID;
24        
25        public PrepareTransformationsJob(CompletionConfiguration configuration) {
26                this.projectID = configuration.getProjectID();
27        }
28        
29        @Override
30        public void execute(IProgressMonitor monitor) throws JobFailedException,
31                        UserCanceledException {
32                
33                // Create necessary folders for completion
34                
35                createFolder(getModelFolder(projectID), logger);
36                createFolder(getTracesFolder(projectID), logger);
37                createFolder(getHOTTracesFolder(projectID), logger);
38                createFolder(getLogFolder(projectID), logger);
39        }
40        
41 
42        /**
43         * returns a new project to be used for the simulation
44         * 
45         * @return a handle to the project to be used for the simulation
46         */
47        protected static IProject getProject(String projectId) {
48                return ResourcesPlugin.getWorkspace().getRoot().getProject(
49                                projectId);
50        }
51        
52        public static IFolder getModelFolder(String projectID) {
53                return getProject(projectID).getFolder(ConstantsContainer.MODELFOLDER);
54        }
55        
56        public static IFolder getTracesFolder(String projectID) {
57                return getProject(projectID).getFolder(ConstantsContainer.TRACESFOLDER);
58        }
59        
60        public static IFolder getHOTTracesFolder(String projectID) {
61                return getProject(projectID).getFolder(ConstantsContainer.HOTTRACESFOLDER);
62        }
63        
64        public static IFolder getLogFolder(String projectID) {
65                return getProject(projectID).getFolder(ConstantsContainer.LOGFOLDER);
66        }
67        
68        public static IFolder createFolder(IFolder folder,Logger logger) throws JobFailedException {
69                if (folder.getProject().isOpen() && !folder.exists()) {
70                        logger.debug("Creating folder " + folder.getName());
71                        try {
72                                folder.create(false, true, null);
73                        } catch (CoreException e) {
74                                logger.error("unable to create model folder");
75                                throw new JobFailedException(e);
76                        }
77                }
78                return folder;
79        }
80 
81        @Override
82        public String getName() {
83                return "Prepare project for completion";
84        }
85 
86        @Override
87        public void rollback(IProgressMonitor monitor)
88                        throws RollbackFailedException {} // nothing to roll back
89 
90 
91}

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