KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > itut_q816Components > ChannelFinderProviderMonolithicImpl


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

21 package ist.coach.itut_q816Components;
22
23 import intt.itu.itut_q816.ChannelInfoType;
24 import org.omg.CosNaming.NameComponent JavaDoc;
25 import java.util.Hashtable JavaDoc;
26
27 /**
28  ** Implementation skeleton class for the ::itut_q816Components::ChannelFinderProvider component.
29  **/

30 public class ChannelFinderProviderMonolithicImpl
31        extends org.omg.CORBA.LocalObject JavaDoc
32        implements CCM_ChannelFinderProvider,
33                   intt.itu.itut_q816.CCM_ChannelFinder,
34                   intt.itu.itut_q816.CCM_ChannelFinderComponent,
35                   org.omg.Components.SessionComponent
36 {
37     // ==================================================================
38
//
39
// Internal State.
40
//
41
// ===================================================================
42
/**
43      ** Context reference.
44      **/

45     private CCM_ChannelFinderProvider_Context the_context_;
46     /** Business logic **/
47     Hashtable JavaDoc channels = null;
48     // ==================================================================
49
//
50
// Constructor.
51
//
52
// ===================================================================
53
/**
54      ** The default constructor.
55      **/

56     public
57     ChannelFinderProviderMonolithicImpl()
58     {
59         the_context_ = null;
60         channels = new Hashtable JavaDoc();
61     }
62     // ==================================================================
63
//
64
// Internal methods.
65
//
66
// ===================================================================
67
// ==================================================================
68
//
69
// Public methods.
70
//
71
// ===================================================================
72
/**
73      ** To obtain the context.
74      **
75      ** @return The context that has been previously set by
76      ** the set_session_context operation.
77      **/

78     public CCM_ChannelFinderProvider_Context
79     getContext()
80     {
81         return the_context_;
82     }
83     // ==================================================================
84
//
85
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
86
//
87
// ==================================================================
88
//
89
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
90
//
91
/**
92      ** Completes the component configuration.
93      **
94      ** @throws org.omg.Components.InvalidConfiguration
95      ** Thrown if the configuration is invalid.
96      **/

97     public void
98     configuration_complete()
99     throws org.omg.Components.InvalidConfiguration
100     {
101         //
102
// DONE : implement !!!
103
//
104
System.err.println("ChannelFinderProvider configuration completed...");
105
106     }
107     // ==================================================================
108
//
109
// Methods for the OMG IDL Components::SessionComponent local interface.
110
//
111
// ==================================================================
112
//
113
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
114
//
115
/**
116      * Called by the container when the component session context will be fixed.
117      *
118      * @param context The session context.
119      *
120      * @throws org.omg.Components.CCMException
121      * Thrown if a system level error occured.
122      */

123     public void
124     set_session_context(org.omg.Components.SessionContext context)
125     throws org.omg.Components.CCMException
126     {
127         the_context_ = (CCM_ChannelFinderProvider_Context)context;
128     }
129     //
130
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
131
//
132
/**
133      *
134      * Called by the container when the component will be activated.
135      *
136      * @throws org.omg.Components.CCMException
137      * Thrown if a system level error occured.
138      */

139     public void
140     ccm_activate()
141     throws org.omg.Components.CCMException
142     {
143         //
144
// Unused by actual OpenCCM containers
145
//
146
}
147     //
148
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
149
//
150
/**
151      *
152      * Called by the container when the component will be passivated.
153      *
154      * @throws org.omg.Components.CCMException
155      * Thrown if a system level error occured.
156      */

157     public void
158     ccm_passivate()
159     throws org.omg.Components.CCMException
160     {
161         //
162
// Unused by actual OpenCCM containers
163
//
164
}
165     //
166
// IDL:omg.org/Components/SessionComponent/ccm_remove:1.0
167
//
168
/**
169      *
170      * Called by the container when the component will be removed.
171      *
172      * @throws org.omg.Components.CCMException
173      * Thrown if a system level error occured.
174      */

175     public void
176     ccm_remove()
177     throws org.omg.Components.CCMException
178     {
179         //
180
// TO DO: implement !!!
181
//
182
}
183     // ==================================================================
184
//
185
// Public methods for the CCM_ChannelFinderProvider local interface.
186
//
187
// ==================================================================
188
//
189
// IDL:coach.ist/itut_q816Components/CCM_ChannelFinderProvider/get_query:1.0
190
//
191
/**
192      ** Implementation of the ::itut_q816Components::CCM_ChannelFinderProvider::get_query operation.
193      **/

194     public intt.itu.itut_q816.CCM_ChannelFinder
195     get_query()
196     {
197         return this;
198     }
199     //
200
// IDL:coach.ist/itut_q816Components/CCM_ChannelFinderProvider/get_admin:1.0
201
//
202
/**
203      ** Implementation of the ::itut_q816Components::CCM_ChannelFinderProvider::get_admin operation.
204      **/

205     public intt.itu.itut_q816.CCM_ChannelFinderComponent
206     get_admin()
207     {
208         return this;
209     }
210     // ==================================================================
211
//
212
// Public methods for the ::itut_q816::CCM_ChannelFinder local interface.
213
//
214
// ==================================================================
215
//
216
// IDL:itu.intt/itut_q816/ChannelFinder/list:1.0
217
//
218
/**
219      ** Implementation of the ::itut_q816::ChannelFinder::list operation.
220      **/

221     public intt.itu.itut_q816.ChannelInfoType[]
222     list()
223     throws intt.itu.itut_x780.ApplicationError
224     {
225         //
226
// DONE : implement
227
//
228
intt.itu.itut_q816.ChannelInfoType[] channelsInfo = new intt.itu.itut_q816.ChannelInfoType[0];
229
230         int c_size = channels.size();
231
232         if (c_size > 0) {
233             channelsInfo = new intt.itu.itut_q816.ChannelInfoType[c_size];
234             channelsInfo =
235                     (ChannelInfoType[]) channels.values().toArray(channelsInfo);
236         }
237
238         return channelsInfo;
239     }
240     // ==================================================================
241
//
242
// Public methods for the ::itut_q816::CCM_ChannelFinderComponent local interface.
243
//
244
// ==================================================================
245
//
246
// IDL:itu.intt/itut_q816/ChannelFinderComponent/register:1.0
247
//
248
/**
249      ** Implementation of the ::itut_q816::ChannelFinderComponent::register operation.
250      **/

251     public void
252     register(java.lang.String JavaDoc channelID,
253             java.lang.String JavaDoc channelClass,
254             java.lang.String JavaDoc[] eventTypes,
255             java.lang.String JavaDoc[] excludedEventTypes,
256             java.lang.String JavaDoc[] sourceClasses,
257             java.lang.String JavaDoc[] excludedSourceClasses,
258             org.omg.CORBA.Object JavaDoc channel)
259     throws intt.itu.itut_q816.ChannelAlreadyRegistered, intt.itu.itut_x780.ApplicationError
260     {
261         //
262
// DONE : implement
263
//
264

265         System.err.println("ChannelFinder> register is called for " +
266                 channelID + " of type " + channelClass);
267
268         if (channels.containsKey(channelID)) {
269             System.err.println("ChannelFinder> register found channel already registered..");
270             throw new intt.itu.itut_q816.ChannelAlreadyRegistered();
271         }
272
273         intt.itu.itut_q816.ChannelInfoType channelInfo = new ChannelInfoType(channelID,
274                                                                 channelClass,
275                                                                 eventTypes,
276                                                                 excludedEventTypes,
277                                                                 sourceClasses,
278                                                                 excludedSourceClasses,
279                                                                 channel);
280
281         channels.put(channelID, channelInfo);
282     }
283     //
284
// IDL:itu.intt/itut_q816/ChannelFinderComponent/unregister:1.0
285
//
286
/**
287      ** Implementation of the ::itut_q816::ChannelFinderComponent::unregister operation.
288      **/

289     public void
290     unregister(java.lang.String JavaDoc channelID)
291     throws intt.itu.itut_q816.ChannelNotFound, intt.itu.itut_x780.ApplicationError
292     {
293         //
294
// TODO : implement
295
//
296

297             if (channels.containsKey(channelID))
298                 channels.remove(channelID);
299             else
300                 throw new intt.itu.itut_q816.ChannelNotFound();
301     }
302 }
303
Popular Tags