KickJava   Java API By Example, From Geeks To Geeks.

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


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::ContainerManager.
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
40 public class ContainerManagerImpl
41      extends org.objectweb.openccm.OpenCCM_DCI.
42              ContainerManagerSessionComposition.ContainerManagerImpl
43 {
44     // ==================================================================
45
//
46
// Internal state.
47
//
48
// ==================================================================
49
//container configuration
50
private org.omg.Components.ConfigValue configuration[];
51     //cookie identifiing parent node connection
52
private org.omg.Components.Cookie cookie;
53     //Registration interface reference
54
private org.objectweb.openccm
55         .OpenCCM_DCI.ContainerManagerRegistration ContMR;
56     
57     //temporary boolean to marks the ComponentsServer removall will be replace
58
//by design pattern state
59
private boolean removed;
60
61     // ==================================================================
62
//
63
// Internal methods.
64
//
65
// ==================================================================
66
// ==================================================================
67
//
68
// Public methods.
69
//
70
// ==================================================================
71
/**
72      * Configure complete the component.
73      */

74     public void
75     configuration_complete()
76     {
77         //retrieve the reference on the ContainerManagerRegistration interface
78
ContMR=get_context().get_connection_container_manager_registration();
79         
80         try{
81             org.omg.Components.SessionContext sc=
82                 (org.omg.Components.SessionContext)get_context();
83             
84             ((ContainerSegImpl)obtain_executor("container"))
85                 .configuration(configuration);
86             //register the container
87
cookie=ContMR
88                 .register_container_manager(
89                                             org.objectweb.openccm.
90                                             OpenCCM_DCI.ContainerManagerHelper
91                                             .narrow(sc.get_CCM_object()));
92             //setup the cookie
93
((ContainerSegImpl)obtain_executor("container")).cookie(cookie);
94         }
95         catch(Exception JavaDoc e)
96             {
97                 e.printStackTrace();
98             }
99     }
100     
101     
102     public
103     void
104     ccm_remove()
105     throws org.omg.Components.CCMException
106     {
107         if(!removed){
108             removed=true;
109             try
110                 {
111                     //CSMR.unregister_component_server_manager(cookie);
112
((ContainerSegImpl)obtain_executor("container")).remove();
113                 }
114             catch(Exception JavaDoc e )
115                 {
116                     System.out.println("Cannot disconnect ComponentServer/Container");
117                     e.printStackTrace();
118                 }
119           
120         }
121             
122     }
123      // ==================================================================
124
//
125
// Accessor methods.
126
//
127
// ==================================================================
128

129     public
130     org.omg.Components.ConfigValue []
131     config()
132     {
133         return configuration;
134     }
135
136     public
137     void
138     config(org.omg.Components.ConfigValue configuration[]){
139         this.configuration=configuration;
140     }
141     
142 }
143
Popular Tags