KickJava   Java API By Example, From Geeks To Geeks.

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


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  ** Implementation skeleton class for the ::coachEmsMibComponents::LogicalInterfaceFactoryProvider component.
40  ** Business operations MUST be completed !!!
41  **/

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

55     private CCM_LogicalInterfaceFactoryProvider_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     LogicalInterfaceMgmt facade = null;
62
63     ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null;
64
65
66
67
68     // ==================================================================
69
//
70
// Constructor.
71
//
72
// ===================================================================
73
/**
74      ** The default constructor.
75      **/

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

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

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

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

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

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

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

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

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

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

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

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

323     public org.omg.CosNaming.NameComponent JavaDoc[]
324     create_base(java.lang.String JavaDoc nameBinding,
325             org.omg.CosNaming.NameComponent JavaDoc[] superior,
326             java.lang.String JavaDoc reqId)
327     throws intt.itu.itut_x780.CreateError, intt.itu.itut_x780.ApplicationError
328     {
329         //
330
// DONE : implement
331
//
332
return new NameComponent JavaDoc[0];
333     }
334 }
335
Popular Tags