KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > pss > runtime > common > lib > ConnectorRegistry


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Christophe Demarey.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.pss.runtime.common.lib;
28
29
30 /**
31  * ConnectorRegistry is used to register Connectors.
32  * It implements the org.omg.CosPersistentState.ConnectorRegistry interface.
33  *
34  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
35  *
36  * @version 0.1
37  */

38
39 public class ConnectorRegistry
40      extends org.omg.CORBA.LocalObject JavaDoc
41   implements org.omg.CosPersistentState.ConnectorRegistry
42 {
43     // ==================================================================
44
//
45
// Internal state.
46
//
47
// ==================================================================
48

49     /**
50      * Registered connectors.
51      */

52     protected java.util.Map JavaDoc _connectors;
53
54     // ==================================================================
55
//
56
// Constructor.
57
//
58
// ==================================================================
59

60     /**
61      * The default constructor.
62      */

63     public ConnectorRegistry()
64     {
65         _connectors = new java.util.HashMap JavaDoc();
66     }
67
68     // ==================================================================
69
//
70
// Internal methods.
71
//
72
// ==================================================================
73

74     // ==================================================================
75
//
76
// Public methods.
77
//
78
// ==================================================================
79

80     // ==================================================================
81
//
82
// Methods for org.omg.CosPersistentState.ConnectorRegistry
83
//
84
// ==================================================================
85

86     /**
87      * Find a previously registered connector.
88      */

89     public org.omg.CosPersistentState.Connector
90     find_connector(String JavaDoc implementation_id)
91     throws org.omg.CosPersistentState.NotFound
92     {
93         org.omg.CosPersistentState.Connector connector = null;
94
95         connector = (org.omg.CosPersistentState.Connector) _connectors.get(implementation_id.toLowerCase());
96         if (connector == null)
97             throw new org.omg.CosPersistentState.NotFound();
98         return connector;
99     }
100
101     /**
102      * Register a connector.
103      */

104     public void
105     register_connector(org.omg.CosPersistentState.Connector c)
106     {
107         _connectors.put(c.implementation_id().toLowerCase(), c);
108     }
109
110     /**
111      * Unregister a connector.
112      */

113     public void
114     unregister_connector(String JavaDoc implementation_id)
115     throws org.omg.CosPersistentState.NotFound
116     {
117         org.omg.CosPersistentState.Connector connector = null;
118
119         connector = (org.omg.CosPersistentState.Connector) _connectors.remove(implementation_id.toLowerCase());
120
121         if (connector == null)
122             throw new org.omg.CosPersistentState.NotFound();
123     }
124 }
125
Popular Tags