KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > ipanema > config > Config


1 /*
2  * Created on Apr 15, 2005
3  * by alex
4  *
5  */

6 package com.nightlabs.ipanema.config;
7
8 import java.io.Serializable JavaDoc;
9 import java.util.HashMap JavaDoc;
10 import java.util.Map JavaDoc;
11
12 /**
13  * @author Alexander Bieber <alex[AT]nightlabs[DOT]de>
14  * @author Niklas Schiffler <nick@nightlabs.de>
15  *
16  * @jdo.persistence-capable
17  * identity-type = "application"
18  * objectid-class = "com.nightlabs.ipanema.config.id.ConfigID"
19  * detachable = "true"
20  *
21  * @jdo.inheritance strategy = "new-table"
22  *
23  */

24 public class Config implements Serializable JavaDoc {
25
26   public static final String JavaDoc FETCH_GROUP_CONFIG_MODULES = "Config.configModules";
27   public static final String JavaDoc FETCH_GROUP_THIS_CONFIG = "Config.this";
28   
29   
30   /**
31    * @jdo.field primary-key="true"
32    * @jdo.column length="100"
33    */

34   protected String JavaDoc organisationID;
35
36   /**
37    * @jdo.field primary-key="true"
38    * @jdo.column length="100"
39    */

40   protected String JavaDoc implementationClassName;
41
42   /**
43    * @jdo.field primary-key="true"
44    * @jdo.column length="100"
45    */

46   protected String JavaDoc configID;
47   
48   
49   /**
50    * key: String ConfigModule.getClass.getName()+ConfigModule.getCgModID()<br/>
51    * value: ConfigModule configModule<br/>
52    * TODO: use mapped-by
53    *
54    * @jdo.field
55    * persistence-modifier="persistent"
56    * collection-type="map"
57    * key-type="java.lang.String"
58    * value-type="ConfigModule"
59    * !mapped-by="userConfig"
60    * !dependent="false"
61    *
62    * @jdo.join
63    * @!jdo.map-vendor-extension vendor-name="jpox" key="key-field" value="cfModKey"
64    */

65   protected Map JavaDoc configModules = new HashMap JavaDoc();
66
67   protected Config() { }
68   
69   public Config(String JavaDoc organisationID, String JavaDoc configID, String JavaDoc implementationClassName)
70   {
71     this.organisationID = organisationID;
72     this.configID = configID;
73     this.implementationClassName = implementationClassName;
74   }
75     
76     public void addConfigModule(ConfigModule cfMod)
77   {
78         configModules.put(cfMod.getCfModKey(), cfMod);
79     }
80     
81     public void removeConfigModule(String JavaDoc cfModKey)
82   {
83         configModules.remove(cfModKey);
84     }
85
86     public void removeConfigModule(ConfigModule cfMod)
87   {
88         configModules.remove(cfMod.getCfModKey());
89     }
90     
91     /**
92      * Returns the defined ConfigModule or null.
93      *
94      * @param cfModClass The ConfigModule class to be retrieved
95      * @param cfModID The cfModID of the ConfigModule to be retrieved
96      * @return The defined ConfigModule or null.
97      */

98     public ConfigModule getConfigModule(Class JavaDoc cfModClass, String JavaDoc cfModID)
99   {
100         String JavaDoc cfModKey = ConfigModule.getCfModKey(cfModClass, cfModID);
101         return null;
102     }
103     
104     /**
105      * Return the ConfigModule of the given Class or null.
106      * @param cfModClass The ConfigModule class to be retrieved
107      * @return The ConfigModule of the given Class or null.
108      */

109     public ConfigModule getConfigModule(Class JavaDoc cfModClass)
110   {
111         return getConfigModule(cfModClass, null);
112     }
113
114     
115     public String JavaDoc getOrganisationID()
116   {
117         return organisationID;
118     }
119     
120     public String JavaDoc getConfigID()
121   {
122         return configID;
123     }
124     
125 }
126
Free Books   Free Magazines  
Popular Tags