01: /*
02: * Copyright 2006 Luca Garulli (luca.garulli@assetdata.it)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.romaframework.wizard.properties;
18:
19: import java.io.IOException;
20: import java.util.LinkedHashMap;
21: import java.util.Map;
22:
23: /**
24: * Handle the ROMA project properties. It load and save configuration to PROJECT_HOME/project.properties.
25: *
26: * @author Luca Garulli (luca.garulli@assetdata.it)
27: */
28: public class ProjectProperties extends GenericProperties {
29:
30: public static final String PROJECT_FILE_NAME = "roma-project.xml";
31: public static final String SRC_VAR = "src";
32: public static final String PACKAGE_VAR = "package";
33: public static final String PACKAGE_PATH_VAR = "package-path";
34: public static final String COMPTIME_LIBS_VAR = "compile-time-lib";
35: public static final String RUNTIME_LIBS_VAR = "run-time-lib";
36: public static final String IOC_PATH_VAR = "ioc-path";
37: public static final String IOC_FILE_VAR = "ioc-file";
38: public static final String MODULE_PREFIX_VAR = "module.";
39:
40: private static final String COMMENTS = "ROMA Framework configuration file";
41:
42: public ProjectProperties(String iPath) throws IOException {
43: super (iPath + "/" + PROJECT_FILE_NAME);
44: comments = COMMENTS;
45: }
46:
47: public synchronized Map<String, String> getInstalledModules() {
48: Map<String, String> modules = new LinkedHashMap<String, String>();
49: String moduleName;
50: for (Object key : properties.keySet()) {
51: if (key.toString().startsWith(MODULE_PREFIX_VAR)) {
52: moduleName = ((String) key).substring(MODULE_PREFIX_VAR
53: .length() + 1);
54: modules.put(moduleName, (String) properties.get(key));
55: }
56: }
57: return modules;
58: }
59:
60: public synchronized void addInstalledModule(String iModuleName,
61: String iVersion) {
62: setProperty(MODULE_PREFIX_VAR + iModuleName, iVersion);
63: }
64: }
|