KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > LogicalInterfaceFactoryProviderComposition > LogicalInterfaceFactoryProviderImpl


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.LogicalInterfaceFactoryProviderComposition;
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 import ist.coach.coachEmsMibComponents.LogicalInterfaceMgmt;
37
38 import org.omg.CosNaming.NameComponent JavaDoc;
39
40 import ist.coach.coachEmfServices.EmfBasicLog.*;
41 /**
42  * This is the CIDL-based implementation of the
43  * OMG IDL3 IDL:coach.ist/coachEmsMibComponents/LogicalInterfaceFactoryProvider:1.0 component type.
44  *
45  * @author OpenCCM CIF_Jimpl Compiler.
46  */

47 public class LogicalInterfaceFactoryProviderImpl
48      extends ist.coach.coachEmsMibComponents.LogicalInterfaceFactoryProviderComposition.LogicalInterfaceFactoryProvider_impl
49 {
50     // ==================================================================
51
//
52
// Internal State.
53
//
54
// ===================================================================
55
/**
56      ** Context reference.
57      **/

58
59     /* Business logic **/
60     intt.itu.itut_q816.ContainmentComponent c_admin = null;
61     intt.itu.itut_q816.Containment c_query = null;
62     private BasicLog logSupport;
63
64     private static final String JavaDoc FACTORY_CLASS = "LogicalInterfaceFactory";
65     LogicalInterfaceMgmt facade = null;
66
67     ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null;
68
69
70
71
72     // ==================================================================
73
//
74
// Constructor.
75
//
76
// ===================================================================
77
/**
78      ** The default constructor.
79      **/

80     public
81     LogicalInterfaceFactoryProviderImpl()
82     { }
83     // ==================================================================
84
//
85
// Internal methods.
86
//
87
// ===================================================================
88
// ==================================================================
89
//
90
// Public methods.
91
//
92

93     // ==================================================================
94
//
95
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
96
//
97
// ==================================================================
98
//
99
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
100
//
101
/**
102      ** Completes the component configuration.
103      **
104      ** @throws org.omg.Components.InvalidConfiguration
105      ** Thrown if the configuration is invalid.
106      **/

107     public void
108     configuration_complete()
109     throws org.omg.Components.InvalidConfiguration
110     {
111         //
112
// DONE : implement !!!
113
//
114

115         if ((facade = get_context().get_connection_facade()) == null)
116             throw new org.omg.Components.InvalidConfiguration();
117
118         if ((c_admin = get_context().get_connection_containment_admin()) == null)
119             throw new org.omg.Components.InvalidConfiguration();
120
121         if ((c_query = get_context().get_connection_containment_query()) == null)
122             throw new org.omg.Components.InvalidConfiguration();
123
124         if ((connector = get_context().get_connection_connector()) == null)
125             throw new org.omg.Components.InvalidConfiguration();
126
127         if ((logSupport = get_context().get_connection_basic_log()) == null)
128             throw new org.omg.Components.InvalidConfiguration();
129
130         System.err.println("LogicalIntefaceFactoryProvider configuration completed...");
131
132     }
133
134     // ==================================================================
135
//
136
// Public methods for the CCM_LogicalInterfaceFactoryProvider local interface.
137
//
138
// ==================================================================
139
//
140
// IDL:coach.ist/coachEmsMib/LogicalInterfaceFactory/create:1.0
141
//
142
/**
143      ** Implementation of the ::coachEmsMib::LogicalInterfaceFactory::create operation.
144      **/

145     public org.omg.CosNaming.NameComponent JavaDoc[]
146     create(java.lang.String JavaDoc nameBindingID,
147             org.omg.CosNaming.NameComponent JavaDoc[] superior,
148             String JavaDoc reqID,
149             java.lang.String JavaDoc[] packageNameList,
150             int ifIndex,
151             byte [] mgmtIpAddress,
152             int snmpPort,
153             int supportedSnmpVersions,
154             java.lang.String JavaDoc ifDescr)
155     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.CreateError
156     {
157         //
158
// DONE : implement
159
//
160

161         String JavaDoc nameBinding_str = "ist.coach.coachEmsMib.NameBindings." +
162             nameBindingID;
163
164         CreateBindingInfo info = CreateController.checkNameBinding(nameBinding_str);
165
166         String JavaDoc objectKind = info.objectKind;
167         short deletePolicy = info.deletePolicy;
168
169         // Check if the parent exists
170
if (! c_query.exists(superior)) {
171             ApplicationErrorInfoTypeImpl error_code = new ApplicationErrorInfoTypeImpl();
172
173             error_code.error = new UIDType(
174                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
175                 intt.itu.itut_x780.ApplicationErrorConst.objectNotFound.value);
176
177
178             error_code.details = Utils.name2string(superior) +
179                 ExceptionMessages.parent_object_error;
180
181             throw new ApplicationError(error_code);
182         }
183
184         // The system must have the capability to auto-name objects
185

186         String JavaDoc allocatedId = null;
187         if (reqID == null || reqID.length() == 0) {
188             org.omg.CosNaming.NameComponent JavaDoc[][] siblings =
189             c_query.getContained(superior);
190
191             allocatedId = CreateController.autoCreateId(siblings);
192         }
193         else
194             allocatedId = reqID;
195
196         // Construct the name of the new object
197

198         org.omg.CosNaming.NameComponent JavaDoc[] name = CreateController.createFullName(
199                 superior,
200                 allocatedId,
201                 Utils.name2facade(facade.facade_name()),
202                 objectKind);
203
204         // Decide the conditional packages that are supported.
205
String JavaDoc [] supportedConditionalPackages = packageNameList;
206
207         //if (packageNameList.length == 0)
208
// System.err.println("No packages are specified. ");
209
/***
210         System.err.println("LogicalInterfaceFactory> Before invoking the facade " +
211             Utils.name2facade(facade.facade_name()) + " to create " +
212             Utils.name2string(name));
213 *******/

214         Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
215           "proceed to create " + Utils.name2string(name));
216
217             facade.create(
218                 name,
219                 objectKind,
220                 packageNameList,
221                 deletePolicy,
222                 intt.itu.itut_x780.SourceIndicatorType.resourceOperation,
223                 superior,
224                 ifIndex,
225                 mgmtIpAddress,
226                 supportedSnmpVersions,
227                 snmpPort,
228                 ifDescr);
229
230             //System.err.println("Before registering to the containment service");
231
c_admin.addName(name, superior);
232
233             //System.err.println("LogicalInterfaceFactory>create returns for " +
234
// Utils.name2string(name));
235
Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
236           "successfully created " + Utils.name2string(name));
237             return name;
238     }
239
240     //
241
// IDL:itu.intt/itut_x780/ManagedObjectFactory/create_base:1.0
242
//
243
/**
244      ** Implementation of the ::itut_x780::ManagedObjectFactory::create_base operation.
245      **/

246     public org.omg.CosNaming.NameComponent JavaDoc[]
247     create_base(java.lang.String JavaDoc nameBinding,
248             org.omg.CosNaming.NameComponent JavaDoc[] superior,
249             java.lang.String JavaDoc reqId)
250     throws intt.itu.itut_x780.CreateError, intt.itu.itut_x780.ApplicationError
251     {
252         //
253
// DONE : implement
254
//
255
return new NameComponent JavaDoc[0];
256     }
257 }
258
Popular Tags