KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
32  * This is the implementation of the OpenCCM_DCI::ComponentServerManager
33  * component type.
34  *
35  * This class inherits from the skeleton
36  * generated by the OpenCCM's CIF to Java mapping generator.
37  *
38  * @author <a HREF="mailto:Frederic.Briclet@lifl.fr">Briclet Frederic</A>
39  */

40
41 public class ComponentServerManagerImpl
42      extends org.objectweb.openccm.OpenCCM_DCI
43              .ComponentServerManagerSessionComposition
44              .ComponentServerManagerImpl
45 {
46
47     // ==================================================================
48
//
49
// Internal state.
50
//
51
// ==================================================================
52
//Configvalues used to configure the Componentserver facet
53
private org.omg.Components.ConfigValue configuration[];
54     //private cookie identifiing parent node connection
55
private org.omg.Components.Cookie cookie;
56     //The component server manager registration interface
57
private org.objectweb.openccm.OpenCCM_DCI
58         .ComponentServerManagerRegistration CSMR;
59     //temporary boolean to marks the ComponentsServer removall will be replace
60
// by design pattern state
61
private boolean removed=false;
62
63     // ==================================================================
64
//
65
// Internal methods.
66
//
67
// ==================================================================
68

69     // ==================================================================
70
//
71
// Public methods.
72
//
73
// ==================================================================
74

75     public void
76     configuration_complete()
77     {
78         //retrieve the ComponentServerManagerRegistration interface
79
CSMR=get_context()
80             .get_connection_component_server_manager_registration();
81         
82         try{
83             org.omg.Components.SessionContext sc=
84                 (org.omg.Components.SessionContext)get_context();
85            
86             ((ComponentServerSegImpl)obtain_executor("component_server"))
87                 .configuration(configuration);
88             
89             cookie= CSMR.register_component_server_manager
90                 (org.objectweb.openccm.
91                  OpenCCM_DCI.ComponentServerManagerHelper
92                  .narrow(sc.get_CCM_object()));
93            
94             ((ComponentServerSegImpl)
95              obtain_executor("component_server")).cookie(cookie);
96                        
97    
98         }
99         catch(Exception JavaDoc e)
100             {
101                 e.printStackTrace();
102             }
103     }
104     
105
106     public void
107     ccm_remove()
108     throws org.omg.Components.CCMException
109     {
110         if(!removed){
111             removed=true;
112             try{
113                 //CSMR.unregister_component_server_manager(cookie);
114
((ComponentServerSegImpl)
115                  obtain_executor("component_server")).remove();
116                 }
117             catch(Exception JavaDoc e )
118                 {
119                     System.out.println("Deconnection ComponentServer/Node impossible");
120                     e.printStackTrace();
121                 }
122         }
123     }
124
125     
126     
127     // ==================================================================
128
//
129
// Accessor methods.
130
//
131
// ==================================================================
132
public
133     org.omg.Components.ConfigValue []
134     config()
135     {
136         return configuration;
137     }
138
139     public
140     void
141     config(org.omg.Components.ConfigValue configuration[]){
142         this.configuration=configuration;
143     }
144     
145 }
146
Popular Tags