KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > OpenCCM_DCI > cif > NodeManagementSegImpl


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2002 USTL - LIFL - GOAL
5 Contact: openccm-team@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): Briclet Frederic
23 Contributor(s): ---------------------------------------------
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.OpenCCM_DCI.cif;
28
29 import org.objectweb.openccm.OpenCCM_DCI.*;
30 /**
31  * This is the implementation of the NodeManagement facet provide
32  * by the NodeManager component.
33  *
34  * This class inherits from the skeleton
35  * generated by the OpenCCM's CIF to Java mapping generator.
36  *
37  * @author <a HREF="mailto:Frederic.Briclet@lifl.fr">Briclet Frederic</A>
38  */

39 public class NodeManagementSegImpl
40     extends org.objectweb.openccm
41             .OpenCCM_DCI.DCIManagerSessionComposition
42             .NodeManagementSeg
43     {
44         // ==================================================================
45
//
46
// Internal state.
47
//
48
// ==================================================================
49
// cookie translation table ( TO REWRITE)
50
private java.util.Hashtable JavaDoc nodes;
51         //The main DCI component
52
private org.objectweb.openccm.OpenCCM_DCI.DCIManagerCCM DCI;
53
54         // ==================================================================
55
//
56
// Internal methods.
57
//
58
// ==================================================================
59
// ==================================================================
60
//
61
// Constructor
62
//
63
// ==================================================================
64
public NodeManagementSegImpl(){
65             super();
66             nodes=new java.util.Hashtable JavaDoc();
67         }
68         
69         // ==================================================================
70
//
71
// Public methods.
72
//
73
// ==================================================================
74
/**
75          * Setup the DCI
76          */

77         public void setupDCI(){
78             DCI=(org.objectweb.openccm.OpenCCM_DCI.DCIManagerCCM)
79                 get_context();
80         }
81
82         /**
83          * Add a node manager.
84          *
85          * @param node_name The name of the node manager.
86          * @param node_manager The reference to the node manager.
87          *
88          * @return A cookie.
89          *
90          * WARNING: Need an exception to signal that the node name is already used?
91          */

92         public void
93         register_node(
94                       String JavaDoc node_name,
95                       org.ist.coach.DCI.NodeManager node_manager)
96         {
97             try{
98                 nodes.put(node_name,
99                           ((org.objectweb.openccm.OpenCCM_DCI.DCIManagerCCM)
100                            get_context())
101                           .connect_node_managers(node_manager) );
102             }
103             catch(Exception JavaDoc e){
104                 e.printStackTrace();
105             }
106         }
107
108         /**
109          * Remove a previously added node manager.
110          *
111          * @param cookie The cookie returned when added the node manager.
112          *
113          * @throw ::Components::CookieRequired
114          * Thrown when the provided cookie is invalid.
115          */

116         public void
117         deregister_node( String JavaDoc node_name)
118         throws org.ist.coach.DCI.UnknownNode
119         {
120             try{
121                 
122                 ((org.objectweb.openccm.OpenCCM_DCI.DCIManagerCCM)
123                  get_context())
124                     .disconnect_node_managers((org.omg.Components.Cookie)
125                                               nodes.get(node_name));
126             }
127             catch(Exception JavaDoc e){
128                 e.printStackTrace();
129                 throw new org.ist.coach.DCI.UnknownNode();
130             }
131         }
132                              
133 }
134
Popular Tags