KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > metadata > ServerObjectMetaData


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.metadata;
10
11 import java.util.HashMap JavaDoc;
12 import java.util.HashSet JavaDoc;
13 import java.util.Map JavaDoc;
14 import java.util.Set JavaDoc;
15
16 import org.jboss.portal.common.metadata.MetaData;
17 import org.jboss.portal.common.plugin.PluginMetaData;
18 import org.jboss.portal.server.ServerObjectID;
19
20 /**
21  * Base meta data class for a portal object.
22  *
23  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
24  * @version $Revision: 1.2 $
25  */

26 public class ServerObjectMetaData implements MetaData
27 {
28
29    /** The object id. */
30    protected final ServerObjectID id;
31
32    /** The service ids it depends on. */
33    protected final Set JavaDoc depends;
34
35    /** The object name. */
36    protected final String JavaDoc name;
37
38    /** The plugins. */
39    protected final Map JavaDoc plugins;
40
41    public ServerObjectMetaData(ServerObjectID id, String JavaDoc name)
42    {
43       if (id == null)
44       {
45          throw new IllegalArgumentException JavaDoc("ID must not be null");
46       }
47       if (name == null)
48       {
49          throw new IllegalArgumentException JavaDoc("Name must not be null");
50       }
51       this.id = id;
52       this.depends = new HashSet JavaDoc();
53       this.name = name;
54       this.plugins = new HashMap JavaDoc();
55    }
56
57    public Set JavaDoc getDepends()
58    {
59       return depends;
60    }
61
62    public void addPlugin(String JavaDoc key, PluginMetaData plugin)
63    {
64       plugins.put(key, plugin);
65    }
66
67    public Set JavaDoc getPluginKeySet()
68    {
69       return plugins.keySet();
70    }
71
72    public PluginMetaData getPlugin(String JavaDoc key)
73    {
74       return (PluginMetaData)plugins.get(key);
75    }
76
77    public ServerObjectID getID()
78    {
79       return id;
80    }
81
82    public String JavaDoc getName()
83    {
84       return name;
85    }
86
87    public String JavaDoc toString()
88    {
89       return "PortalObject[" + id + "]";
90    }
91 }
92
Popular Tags