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 module properties. It load and save the configuration.
25: *
26: * @author Luca Garulli (luca.garulli@assetdata.it)
27: */
28: public class ModuleProperties extends GenericProperties {
29:
30: public static final String MODULE_FILE_NAME = "roma-module.xml";
31: public static final String NAME_VAR = "name";
32: public static final String VERSION_VAR = "version";
33: public static final String DEPENDS_PREFIX_VAR = "depends.module.";
34:
35: public ModuleProperties(String iPath) throws IOException {
36: super (iPath + "/" + MODULE_FILE_NAME);
37: }
38:
39: public synchronized Map<String, String> getDependencies() {
40: Map<String, String> dependencies = new LinkedHashMap<String, String>();
41: String moduleName;
42: for (Object key : properties.keySet()) {
43: if (key.toString().startsWith(DEPENDS_PREFIX_VAR)) {
44: moduleName = ((String) key)
45: .substring(DEPENDS_PREFIX_VAR.length());
46: dependencies.put(moduleName, (String) properties
47: .get(key));
48: }
49: }
50: return dependencies;
51: }
52: }
|