KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > itut_q816Components > ChannelFinderProviderComposition > adminSegImpl


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

28
29 package ist.coach.itut_q816Components.ChannelFinderProviderComposition;
30
31 import ist.coach.coachEmfCommon.ChannelChangeEventImpl;
32
33 import java.util.Hashtable JavaDoc;
34 import intt.itu.itut_q816.ChannelInfoType;
35 import intt.itu.itut_q816.ChannelModificationType;
36 /**
37  * This is the CIDL-based implementation of the
38  * OMG IDL3 CIDL:coach.ist/itut_q816Components/ChannelFinderProviderComposition/ChannelFinderProviderHome_impl/ChannelFinderProvider_impl/adminSeg:1.0 segment type.
39  *
40  * @author OpenCCM CIF_Jimpl Compiler.
41  */

42 public class adminSegImpl
43      extends ist.coach.itut_q816Components.ChannelFinderProviderComposition.adminSeg
44 {
45     // ==================================================================
46
//
47
// Internal states.
48
//
49
// ==================================================================
50

51     // ==================================================================
52
//
53
// Constructors.
54
//
55
// ==================================================================
56

57     public adminSegImpl()
58     {
59     }
60
61
62     // ==================================================================
63
//
64
// Methods.
65
//
66
// ==================================================================
67

68     /**
69      * Implementation of the ::itut_q816::ChannelFinderComponent::register operation.
70      */

71     public void
72     register(String JavaDoc channelID, String JavaDoc channelClass, String JavaDoc[] eventTypes, String JavaDoc[] excludedEventTypes, String JavaDoc[] sourceClasses, String JavaDoc[] excludedSourceClasses, org.omg.CORBA.Object JavaDoc channel)
73     throws intt.itu.itut_q816.ChannelAlreadyRegistered,
74
75            intt.itu.itut_x780.ApplicationError
76     {
77         //
78
// DONE : implement
79
//
80

81         System.err.println("ChannelFinder> register is called for " +
82                 channelID + " of type " + channelClass);
83
84         if (ChannelFinderProviderImpl.channels.containsKey(channelID)) {
85             System.err.println("ChannelFinder> register found channel already registered..");
86             throw new intt.itu.itut_q816.ChannelAlreadyRegistered();
87         }
88
89         intt.itu.itut_q816.ChannelInfoType channelInfo = new ChannelInfoType(channelID,
90                                                                 channelClass,
91                                                                 eventTypes,
92                                                                 excludedEventTypes,
93                                                                 sourceClasses,
94                                                                 excludedSourceClasses,
95                                                                 channel);
96
97         synchronized(ChannelFinderProviderImpl.channels) {
98           ChannelFinderProviderImpl.channels.put(channelID, channelInfo);
99         }
100
101         get_context().push_channelChange_alarm(new ChannelChangeEventImpl(
102                             ChannelModificationType.ChannelCreate,
103                             channelInfo));
104     }
105
106     /**
107      * Implementation of the ::itut_q816::ChannelFinderComponent::update operation.
108      */

109     public void
110     update(String JavaDoc channelID, String JavaDoc channelClass, String JavaDoc[] eventTypes, String JavaDoc[] excludedEventTypes,
111         String JavaDoc[] sourceClasses, String JavaDoc[] excludedSourceClasses, org.omg.CORBA.Object JavaDoc channel)
112     throws intt.itu.itut_q816.ChannelNotFound,
113         intt.itu.itut_x780.ApplicationError
114     {
115         //
116
// DONE : implement
117
//
118

119         System.err.println("ChannelFinder> update is called for " +
120                 channelID + " of type " + channelClass);
121
122         if (! ChannelFinderProviderImpl.channels.containsKey(channelID)) {
123             System.err.println("ChannelFinder> could not find channel " + channelID + " to be updated.");
124             throw new intt.itu.itut_q816.ChannelNotFound();
125         }
126
127         intt.itu.itut_q816.ChannelInfoType channelInfo = new ChannelInfoType(channelID,
128                                                                 channelClass,
129                                                                 eventTypes,
130                                                                 excludedEventTypes,
131                                                                 sourceClasses,
132                                                                 excludedSourceClasses,
133                                                                 channel);
134           synchronized(ChannelFinderProviderImpl.channels) {
135             ChannelFinderProviderImpl.channels.remove(channelID);
136             ChannelFinderProviderImpl.channels.put(channelID, channelInfo);
137           }
138           get_context().push_channelChange_alarm(new ChannelChangeEventImpl(
139                             ChannelModificationType.ChannelUpdate,
140                             channelInfo));
141     }
142
143     /**
144      * Implementation of the ::itut_q816::ChannelFinderComponent::unregister operation.
145      */

146     public void
147     unregister(String JavaDoc channelID)
148     throws intt.itu.itut_q816.ChannelNotFound,
149            intt.itu.itut_x780.ApplicationError
150     {
151         //
152
// DONE : Implement
153
//
154

155         intt.itu.itut_q816.ChannelInfoType channelInfo;
156         if (ChannelFinderProviderImpl.channels.containsKey(channelID)) {
157
158           synchronized(ChannelFinderProviderImpl.channels) {
159             
160             channelInfo = (intt.itu.itut_q816.ChannelInfoType)
161             ChannelFinderProviderImpl.channels.remove(channelID);
162           }
163         }
164         else
165           throw new intt.itu.itut_q816.ChannelNotFound();
166
167         get_context().push_channelChange_alarm(new ChannelChangeEventImpl(
168                             ChannelModificationType.ChannelDelete,
169                             channelInfo));
170     }
171
172 }
173
Popular Tags