KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > IpProtocolMonitorFactoryProviderMonolithicImpl


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.coachEmsMibComponents;
22
23 import ist.coach.coachEmfCommon.Utils;
24 import ist.coach.coachEmfCommon.CreateController;
25 import ist.coach.coachEmfCommon.CreateBindingInfo;
26 import ist.coach.coachEmfCommon.ExceptionMessages;
27
28 import intt.itu.itut_x780.UIDType;
29 import intt.itu.itut_x780.CreateError;
30 import intt.itu.itut_x780.ApplicationError;
31
32 import intt.itu.itut_m3120.conditionalPackages.*;
33
34 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
35 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
36
37 import org.omg.CosNaming.NameComponent JavaDoc;
38
39 /**
40  ** Implementation skeleton class for the ::coachEmsMibComponents::IpProtocolMonitorFactoryProvider component.
41  **/

42 public class IpProtocolMonitorFactoryProviderMonolithicImpl
43        extends org.omg.CORBA.LocalObject JavaDoc
44        implements CCM_IpProtocolMonitorFactoryProvider,
45                   org.omg.Components.SessionComponent
46 {
47     // ==================================================================
48
//
49
// Internal State.
50
//
51
// ===================================================================
52
/**
53      ** Context reference.
54      **/

55     private CCM_IpProtocolMonitorFactoryProvider_Context the_context_;
56         /* Business logic **/
57     intt.itu.itut_q816.ContainmentComponent c_admin = null;
58     intt.itu.itut_q816.Containment c_query = null;
59
60     private static final String JavaDoc FACTORY_CLASS = "LogicalInterfaceFactory";
61     IpProtocolMonitorMgmt facade = null;
62
63     ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null;
64
65
66     // ==================================================================
67
//
68
// Constructor.
69
//
70
// ===================================================================
71
/**
72      ** The default constructor.
73      **/

74     public
75     IpProtocolMonitorFactoryProviderMonolithicImpl()
76     {
77         the_context_ = null;
78     }
79     // ==================================================================
80
//
81
// Internal methods.
82
//
83
// ===================================================================
84
// ==================================================================
85
//
86
// Public methods.
87
//
88
// ===================================================================
89
/**
90      ** To obtain the context.
91      **
92      ** @return The context that has been previously set by
93      ** the set_session_context operation.
94      **/

95     public CCM_IpProtocolMonitorFactoryProvider_Context
96     getContext()
97     {
98         return the_context_;
99     }
100     // ==================================================================
101
//
102
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
103
//
104
// ==================================================================
105
//
106
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
107
//
108
/**
109      ** Completes the component configuration.
110      **
111      ** @throws org.omg.Components.InvalidConfiguration
112      ** Thrown if the configuration is invalid.
113      **/

114     public void
115     configuration_complete()
116     throws org.omg.Components.InvalidConfiguration
117     {
118         //
119
// DONE : implement !!!
120
//
121

122         if ((facade = the_context_.get_connection_facade()) == null)
123             throw new org.omg.Components.InvalidConfiguration();
124
125         if ((c_admin = the_context_.get_connection_containment_admin()) == null)
126             throw new org.omg.Components.InvalidConfiguration();
127
128         if ((c_query = the_context_.get_connection_containment_query()) == null)
129             throw new org.omg.Components.InvalidConfiguration();
130
131         if ((connector = the_context_.get_connection_connector()) == null)
132             throw new org.omg.Components.InvalidConfiguration();
133
134         System.err.println("IpProtocolMonitorFactoryProviderconfiguration completed...");
135
136
137     }
138     // ==================================================================
139
//
140
// Methods for the OMG IDL Components::SessionComponent local interface.
141
//
142
// ==================================================================
143
//
144
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
145
//
146
/**
147      * Called by the container when the component session context will be fixed.
148      *
149      * @param context The session context.
150      *
151      * @throws org.omg.Components.CCMException
152      * Thrown if a system level error occured.
153      */

154     public void
155     set_session_context(org.omg.Components.SessionContext context)
156     throws org.omg.Components.CCMException
157     {
158         the_context_ = (CCM_IpProtocolMonitorFactoryProvider_Context)context;
159     }
160     //
161
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
162
//
163
/**
164      *
165      * Called by the container when the component will be activated.
166      *
167      * @throws org.omg.Components.CCMException
168      * Thrown if a system level error occured.
169      */

170     public void
171     ccm_activate()
172     throws org.omg.Components.CCMException
173     {
174         //
175
// Unused by actual OpenCCM containers
176
//
177
}
178     //
179
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
180
//
181
/**
182      *
183      * Called by the container when the component will be passivated.
184      *
185      * @throws org.omg.Components.CCMException
186      * Thrown if a system level error occured.
187      */

188     public void
189     ccm_passivate()
190     throws org.omg.Components.CCMException
191     {
192         //
193
// Unused by actual OpenCCM containers
194
//
195
}
196     //
197
// IDL:omg.org/Components/SessionComponent/ccm_remove:1.0
198
//
199
/**
200      *
201      * Called by the container when the component will be removed.
202      *
203      * @throws org.omg.Components.CCMException
204      * Thrown if a system level error occured.
205      */

206     public void
207     ccm_remove()
208     throws org.omg.Components.CCMException
209     {
210         //
211
// TO DO: implement !!!
212
//
213
}
214     // ==================================================================
215
//
216
// Public methods for the CCM_IpProtocolMonitorFactoryProvider local interface.
217
//
218
// ==================================================================
219
//
220
// IDL:coach.ist/coachEmsMib/IpProtocolMonitorFactory/create:1.0
221
//
222
/**
223      ** Implementation of the ::coachEmsMib::IpProtocolMonitorFactory::create operation.
224      **/

225     public org.omg.CosNaming.NameComponent JavaDoc[]
226     create(java.lang.String JavaDoc nameBindingID,
227             org.omg.CosNaming.NameComponent JavaDoc[] superior,
228             String JavaDoc reqID,
229             String JavaDoc [] packageNameList,
230             byte[] mgmtIpAddress,
231             int snmpPort,
232             int supportedSnmpVersions
233     )
234     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.CreateError
235     {
236         //
237
// TODO : implement
238
//
239

240         String JavaDoc nameBinding_str = "ist.coach.coachEmsMib.NameBindings." +
241             nameBindingID;
242
243         CreateBindingInfo info = CreateController.checkNameBinding(nameBinding_str);
244
245         String JavaDoc objectKind = info.objectKind;
246         short deletePolicy = info.deletePolicy;
247
248         // Check if the parent exists
249
if (! c_query.exists(superior)) {
250                 ApplicationErrorInfoTypeImpl error_code =
251                         new ApplicationErrorInfoTypeImpl();
252                 error_code.error = new UIDType(
253                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
254                 intt.itu.itut_x780.ApplicationErrorConst.objectNotFound.value);
255
256
257                 error_code.details = Utils.name2string(superior) +
258                 ExceptionMessages.parent_object_error;
259
260             throw new ApplicationError(error_code);
261         }
262
263         // The system must have the capability to auto-name objects
264

265         String JavaDoc allocatedId = null;
266         if (reqID == null || reqID.length() == 0) {
267
268             org.omg.CosNaming.NameComponent JavaDoc[][] siblings =
269             c_query.getContained(superior);
270             allocatedId = CreateController.autoCreateId(siblings);
271         }
272         else
273             allocatedId = reqID;
274
275         // Construct the name of the new object
276

277         org.omg.CosNaming.NameComponent JavaDoc[] name = CreateController.createFullName(
278                 superior,
279                 allocatedId,
280                 Utils.name2facade(facade.facade_name()),
281                 objectKind);
282
283         // Decide the conditional packages that are supported.
284
String JavaDoc [] supportedConditionalPackages = packageNameList;
285
286         if (packageNameList.length == 0)
287             System.err.println("No packages are specified. ");
288
289         System.err.println("IpProtocolMonitorFactory> Before invoking the facade " +
290                 Utils.name2facade(facade.facade_name()) + " to create " +
291             Utils.name2string(name));
292
293             facade.create(
294                     name,
295                 objectKind,
296                 packageNameList,
297                 deletePolicy,
298                 intt.itu.itut_x780.SourceIndicatorType.resourceOperation,
299                 superior,
300         mgmtIpAddress,
301                 snmpPort,
302                 supportedSnmpVersions);
303
304             c_admin.addName(name, superior);
305             System.err.println("IpProtocolMonitorFactory>create returns for " +
306                 Utils.name2string(name));
307
308             return name;
309
310     }
311     //
312
// IDL:itu.intt/itut_x780/ManagedObjectFactory/create_base:1.0
313
//
314
/**
315      ** Implementation of the ::itut_x780::ManagedObjectFactory::create_base operation.
316      **/

317     public org.omg.CosNaming.NameComponent JavaDoc[]
318     create_base(java.lang.String JavaDoc nameBinding,
319                     org.omg.CosNaming.NameComponent JavaDoc[] superior,
320                     java.lang.String JavaDoc reqId)
321     throws intt.itu.itut_x780.CreateError, intt.itu.itut_x780.ApplicationError
322     {
323         //
324
// TODO : implement
325
//
326
return new NameComponent JavaDoc[0];
327     }
328 }
329
Popular Tags