View Javadoc

1   package net.sf.mmapps.modules.config.implementation;
2   
3   import java.util.Properties;
4   
5   import net.sf.mmapps.modules.config.*;
6   /***
7    *
8    * @author Kees Jongenburger
9    * @version $Id: BasicNodeManagerConfiguration.java,v 1.2 2004/05/18 13:53:51 keesj Exp $
10   */
11  public class BasicNodeManagerConfiguration implements NodeManagerConfiguration {
12      String parentNodeManagerName = "object";
13      FieldConfigurations fieldConfigurations;
14      String name;
15      String maintainer = "mmbase.org";
16      String version = "1";
17      String classFile = null;
18      String searchAge = "360";
19      String status = "active";
20      Properties descriptions = new Properties();
21      Properties singularNames = new Properties();
22      Properties pluralNames = new Properties();
23      Properties properties = new Properties();
24  
25      /*** Creates a new instance of BasicNodeManagerConfiguration */
26      protected BasicNodeManagerConfiguration() {
27          fieldConfigurations = new FieldConfigurations();
28      }
29  
30      public void setName(String name) {
31          this.name = name;
32      }
33  
34      public void setMaintainer(String maintainer) {
35          this.maintainer = maintainer;
36      }
37      public String getMaintainer() {
38          return maintainer;
39      }
40      public void setVersion(String version) {
41          this.version = version;
42      }
43      public String getVersion() {
44          return version;
45      }
46  
47      public void setClassFile(String classFile) {
48          this.classFile = classFile;
49      }
50  
51      public String getClassFile() {
52          return classFile;
53      }
54  
55      public void setSearchAge(String searchAge) {
56          this.searchAge = searchAge;
57      }
58  
59      public String getSearchAge() {
60          return searchAge;
61      }
62  
63      public Properties getDescriptions() {
64          return descriptions;
65      }
66      
67      public void setDescription(String lang, String description) {
68          if (lang == null)
69              throw new RuntimeException("lang is null in builder configuration" + getName());
70          if (description == null)
71              description = "";
72          descriptions.put(lang, description);
73      }
74  
75      public String getDescription(String lang) {
76          if (descriptions.get(lang) == null) {
77              return getName();
78          }
79          return (String)descriptions.get(lang);
80      }
81  
82      public void addFieldConfiguration(FieldConfiguration fieldConfiguration) {
83          fieldConfigurations.add(fieldConfiguration);
84      }
85  
86      public void setExtends(String extendsString) {
87          this.parentNodeManagerName = extendsString;
88      }
89  
90      public String getExtends() {
91          return parentNodeManagerName;
92      }
93  
94      public FieldConfigurations getFieldConfigurations() {
95          return fieldConfigurations;
96      }
97  
98      public String getName() {
99          return name;
100     }
101 
102     public void setProperty(String key, String value) {
103         if (key != null && value != null) {
104             properties.put(key, value);
105         }
106     }
107 
108     public Properties getPropeties() {
109         return properties;
110     }
111 
112     public String getProperty(String key) {
113         return (String)properties.get(key);
114     }
115     public void setPluralGUIName(String lang, String value) {
116         if (lang != null && value != null) {
117             pluralNames.put(lang, value);
118         }
119     }
120 
121     public Properties getPluralGUINames() {
122         return pluralNames;
123     }
124     public String getPluralGUIName(String lang) {
125         if (pluralNames.get(lang) == null) {
126             return getName();
127         }
128         return (String)pluralNames.get(lang);
129     }
130 
131     public void setSingularGUIName(String lang, String value) {
132         if (lang != null && value != null) {
133             singularNames.put(lang, value);
134         }
135     }
136     public Properties getSingularGUINames() {
137         return singularNames;
138     }
139     public String getSingularGUIName(String lang) {
140         if (singularNames.get(lang) == null) {
141             return getName();
142         }
143         return (String)singularNames.get(lang);
144     }
145 
146     public void setStatus(String status) {
147         this.status = status;
148     }
149     public String getStatus() {
150         return status;
151     }
152 }