KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > invicta > project > ProjectSettings


1 package net.sf.invicta.project;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.List JavaDoc;
5 import java.util.Map JavaDoc;
6
7 import net.sf.invicta.api.Property;
8
9 import org.apache.commons.collections.SequencedHashMap;
10  
11 /**
12  *
13  */

14 public class ProjectSettings {
15     private String JavaDoc name;
16     private String JavaDoc generalComponentName;
17     private Map JavaDoc properties = new SequencedHashMap();
18     private String JavaDoc dir;
19     private String JavaDoc version;
20     private String JavaDoc release;
21     private String JavaDoc globalComponent;
22     
23     /**
24      * Constructor for ProjectSettings.
25      */

26     public ProjectSettings() {
27         super();
28     }
29     
30     /**
31      *
32      * @param property
33      */

34     public void addProperty(PropertyImpl property) {
35         this.properties.put(property.getName(), property);
36     }
37
38     /**
39      *
40      * @param propertyName
41      * @return Property
42      */

43     public Property getProperty(String JavaDoc propertyName) {
44         return (Property)this.properties.get(propertyName);
45     }
46
47     /**
48      *
49      * @param propertyName
50      * @return String
51      */

52     public String JavaDoc getPropertyValue(String JavaDoc propertyName) {
53         Property property = (Property)this.properties.get(propertyName);
54         if (property == null)
55             return null;
56             
57         return property.getValue();
58     }
59     
60     /**
61      *
62      * @return Map
63      */

64     public Map JavaDoc getPropertiesMap() {
65         return this.properties;
66     }
67
68     /**
69      *
70      * @return List
71      */

72     public List JavaDoc getProperties() {
73         return (List JavaDoc)new ArrayList JavaDoc(this.properties.values());
74     }
75         
76     /**
77      *
78      * @param propertyName
79      * @param propertyValue
80      * @param description
81      */

82     public void setProperty(String JavaDoc propertyName, String JavaDoc propertyValue, String JavaDoc description) {
83         this.properties.put(propertyName, new PropertyImpl(propertyName, propertyValue, description));
84     }
85     
86     /**
87      *
88      * @return String
89      */

90     public String JavaDoc getGeneralComponentName() {
91         return this.generalComponentName;
92     }
93     
94     /**
95      * Returns the name.
96      * @return String
97      */

98     public String JavaDoc getName() {
99         return name;
100     }
101
102     /**
103      * Sets the name.
104      * @param name The name to set
105      */

106     public void setName(String JavaDoc name) {
107         setProperty("projectName", name, "Project Name");
108         this.name = name;
109     }
110
111     /**
112      * Returns the home.
113      * @return String
114      */

115     public String JavaDoc getDir() {
116         return dir;
117     }
118
119     /**
120      * Returns the release.
121      * @return String
122      */

123     public String JavaDoc getRelease() {
124         return release;
125     }
126
127     /**
128      * Returns the version.
129      * @return String
130      */

131     public String JavaDoc getVersion() {
132         return version;
133     }
134
135     /**
136      * Sets the home.
137      * @param home The home to set
138      */

139     public void setDir(String JavaDoc dir) {
140         setProperty("dir", dir, "Project Directory");
141         this.dir = dir;
142     }
143
144     /**
145      * Sets the release.
146      * @param release The release to set
147      */

148     public void setRelease(String JavaDoc release) {
149         setProperty("release", release, "Project Release");
150         this.release = release;
151     }
152
153     /**
154      * Sets the version.
155      * @param version The version to set
156      */

157     public void setVersion(String JavaDoc version) {
158         setProperty("version", version, "Project Version");
159         this.version = version;
160     }
161
162     /**
163      * @return
164      */

165     public String JavaDoc getGlobalComponent() {
166         return globalComponent;
167     }
168
169     /**
170      * @param string
171      */

172     public void setGlobalComponent(String JavaDoc string) {
173         globalComponent = string;
174     }
175
176 }
177
Popular Tags