KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > plugins > preferences > AbstractPreferenceStore


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.plugins.preferences;
10
11 import java.util.HashMap JavaDoc;
12 import java.util.Map JavaDoc;
13
14 import org.jboss.portal.common.FQN;
15
16 /**
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
18  * @version $Revision: 1.2 $
19  */

20 public class AbstractPreferenceStore implements PreferenceStore
21 {
22
23    private Map JavaDoc sets;
24
25    public AbstractPreferenceStore()
26    {
27       this.sets = new HashMap JavaDoc();
28    }
29
30    public PreferenceSet get(FQN fqn)
31    {
32       PreferenceSet set = (PreferenceSet)sets.get(fqn);
33       if (set == null)
34       {
35          set = newPreferenceSet();
36          sets.put(fqn, set);
37       }
38       return set;
39    }
40
41    public PreferenceSet newPreferenceSet()
42    {
43       return new AbstractPreferenceSet();
44    }
45 }
46
Popular Tags