1
2
3
4
5
6
7
8
9
10
11 package org.mod4j.dslcommon.openarchitectureware;
12
13 import java.util.Map;
14
15 import org.apache.commons.logging.Log;
16 import org.apache.commons.logging.LogFactory;
17 import org.mod4j.dslcommon.generator.helpers.ModelHelpers;
18 import org.mod4j.dslcommon.io.Files;
19
20 public class OutletDirectoryCleaner {
21
22 org.eclipse.emf.mwe.utils.DirectoryCleaner s;
23 private final Log logger = LogFactory.getLog(getClass());
24
25 private static final String DIRCLEAN_WORKFLOW_FILE = "org/mod4j/dslcommon/workflow/DirectoryClean.oaw";
26
27
28
29
30
31
32
33
34
35
36 public void clean(String workDir, String propertiesFilePath) throws Mod4jWorkflowException {
37
38 Map<String, String> properties = initializeWorkflowProperties(workDir, propertiesFilePath);
39 String wfFile = Files.findFile(DIRCLEAN_WORKFLOW_FILE);
40 wfFile = DIRCLEAN_WORKFLOW_FILE;
41
42 logger.info("Cleaning outlet directories.");
43 new Mod4jWorkflowRunner().runWorkflow(wfFile, properties);
44 }
45
46 protected String directories = null;
47
48 protected Map<String, String> initializeWorkflowProperties(String workDir, String propertiesFilePath) {
49
50 Map<String, String> result = ModelHelpers.getProperties(propertiesFilePath);
51
52 String applicationPath = result.get("applicationPath");
53 String domainModuleName = result.get("domainModuleName");
54 String dataModuleName = result.get("dataModuleName");
55 String businessModuleName = result.get("businessModuleName");
56 String serviceModuleName = result.get("serviceModuleName");
57 String presentationModuleName = result.get("presentationModuleName");
58 String srcGenPath = result.get("srcGenPath");
59 String resourceGenPath = result.get("resourceGenPath");
60 String srcManPath = result.get("srcManPath");
61 String resourceManPath = result.get("srcManPath");
62 String overwriteExtensionpoints = result.get("overwriteExtensionpoints");
63
64
65 String absAppPath = workDir + "/" + applicationPath;
66
67 directories =
68 absAppPath + "/" + dataModuleName + "/" + srcGenPath + ", " +
69 absAppPath + "/" + dataModuleName + "/" + resourceGenPath + ", " +
70 absAppPath + "/" + domainModuleName + "/" + srcGenPath + ", " +
71 absAppPath + "/" + domainModuleName + "/" + resourceGenPath + ", " +
72 absAppPath + "/" + businessModuleName + "/" + srcGenPath + ", " +
73 absAppPath + "/" + businessModuleName + "/" + resourceGenPath + ", " +
74 absAppPath + "/" + serviceModuleName + "/" + srcGenPath + ", " +
75 absAppPath + "/" + serviceModuleName + "/" + resourceGenPath + ", " +
76 absAppPath + "/" + presentationModuleName + "/" + srcGenPath + ", " +
77 absAppPath + "/" + presentationModuleName + "/" + resourceGenPath;
78
79 if ((overwriteExtensionpoints != null) && overwriteExtensionpoints.equals("true")) {
80 logger.info("cleaning extension points");
81 directories = directories + ", " +
82 absAppPath + "/" + dataModuleName + "/" + srcManPath + ", " +
83 absAppPath + "/" + dataModuleName + "/" + resourceManPath + ", " +
84 absAppPath + "/" + domainModuleName + "/" + srcManPath + ", " +
85 absAppPath + "/" + domainModuleName + "/" + resourceManPath + ", " +
86 absAppPath + "/" + businessModuleName + "/" + srcManPath + ", " +
87 absAppPath + "/" + businessModuleName + "/" + resourceManPath + ", " +
88 absAppPath + "/" + serviceModuleName + "/" + srcManPath + ", " +
89 absAppPath + "/" + serviceModuleName + "/" + resourceManPath + ", " +
90 absAppPath + "/" + presentationModuleName + "/" + srcManPath + ", " +
91 absAppPath + "/" + presentationModuleName + "/" + resourceManPath;
92 }
93 result.put("directories", directories);
94 return result;
95 }
96
97 public String getDirectories() {
98 return directories;
99 }
100
101 public void setDirectories(String directories) {
102 this.directories = directories;
103 }
104
105 }