KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > IpAddressDataFactoryProviderComposition > IpAddressDataFactoryProviderImpl


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.coachEmsMibComponents.IpAddressDataFactoryProviderComposition;
30
31 import ist.coach.coachEmfCommon.Utils;
32 import ist.coach.coachEmfCommon.CreateController;
33 import ist.coach.coachEmfCommon.CreateBindingInfo;
34 import ist.coach.coachEmfCommon.ExceptionMessages;
35
36 import intt.itu.itut_x780.UIDType;
37 import intt.itu.itut_x780.CreateError;
38 import intt.itu.itut_x780.ApplicationError;
39
40 import intt.itu.itut_m3120.conditionalPackages.*;
41
42 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
43 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
44 import ist.coach.coachEmsMibComponents.IpAddressDataMgmt;
45
46 import ist.coach.coachEmfServices.EmfBasicLog.*;
47
48 /**
49  * This is the CIDL-based implementation of the
50  * OMG IDL3 IDL:coach.ist/coachEmsMibComponents/IpAddressDataFactoryProvider:1.0 component type.
51  *
52  * @author OpenCCM CIF_Jimpl Compiler.
53  */

54 public class IpAddressDataFactoryProviderImpl
55      extends ist.coach.coachEmsMibComponents.IpAddressDataFactoryProviderComposition.IpAddressDataFactoryProvider_impl
56 {
57     // ==================================================================
58
//
59
// Internal states.
60
//
61
// ==================================================================
62
intt.itu.itut_q816.ContainmentComponent c_admin = null;
63     intt.itu.itut_q816.Containment c_query = null;
64     private BasicLog logSupport;
65
66     private static final String JavaDoc FACTORY_CLASS = "IpAddressDataFactory";
67     IpAddressDataMgmt facade = null;
68
69     // ==================================================================
70
//
71
// Constructors.
72
//
73
// ==================================================================
74

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

95     public void
96     configuration_complete()
97     throws org.omg.Components.InvalidConfiguration
98     {
99         //
100
// DONE : implement !!!
101
//
102
if ((facade = get_context().get_connection_facade()) == null)
103             throw new org.omg.Components.InvalidConfiguration();
104
105         if ((c_admin = get_context().get_connection_containment_admin()) == null)
106             throw new org.omg.Components.InvalidConfiguration();
107
108         if ((c_query = get_context().get_connection_containment_query()) == null)
109             throw new org.omg.Components.InvalidConfiguration();
110
111         if ((logSupport = get_context().get_connection_basic_log()) == null)
112             throw new org.omg.Components.InvalidConfiguration();
113
114        System.err.println("IpAddressDataFactoryProvider configuration completed...");
115     }
116     // ==================================================================
117
//
118
// Methods.
119
//
120
// ==================================================================
121

122     /**
123      * Implementation of the ::coachEmsMib::IpAddressDataFactory::create operation.
124      */

125     public org.omg.CosNaming.NameComponent JavaDoc[]
126     create(String JavaDoc nameBindingID,
127           org.omg.CosNaming.NameComponent JavaDoc[] superior,
128           String JavaDoc reqID,
129           String JavaDoc[] packageNameList,
130           byte[] ipAdEntAddress,
131           byte[] mgmtIpAddress,
132           int snmpPort,
133           int supportedSnmpVersions)
134     throws intt.itu.itut_x780.ApplicationError,
135            intt.itu.itut_x780.CreateError
136     {
137         //
138
// DONE : Implement
139
//
140
String JavaDoc nameBinding_str = "ist.coach.coachEmsMib.NameBindings." +
141                 nameBindingID;
142
143 // String objectKind = CreateController.checkNameBinding(nameBinding_str);
144

145         CreateBindingInfo info = CreateController.checkNameBinding(nameBinding_str);
146
147         String JavaDoc objectKind = info.objectKind;
148         short deletePolicy = info.deletePolicy;
149
150         // Check if the parent exists
151
if (! c_query.exists(superior)) {
152             ApplicationErrorInfoTypeImpl error_code = new ApplicationErrorInfoTypeImpl();
153             error_code.error = new UIDType(
154                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
155                 intt.itu.itut_x780.ApplicationErrorConst.objectNotFound.value);
156
157             error_code.details = Utils.name2string(superior) +
158                             ExceptionMessages.parent_object_error;
159
160             throw new ApplicationError(error_code);
161         }
162
163         // The system must have the capability of auto-naming objects
164
String JavaDoc allocatedId = reqID;
165         if (reqID == null || reqID.length() == 0) {
166
167             org.omg.CosNaming.NameComponent JavaDoc[][] siblings =
168                 c_query.getContained(superior);
169
170                 allocatedId = "IPAddress" + CreateController.autoCreateId(siblings);
171         }
172
173         // Construct the name of the new object
174
org.omg.CosNaming.NameComponent JavaDoc[] name = CreateController.createFullName(
175                     superior,
176                     allocatedId,
177                     Utils.name2facade(facade.facade_name()),
178                     objectKind);
179         Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
180           "proceed to create " + Utils.name2string(name));
181 /********************************
182         System.err.println("IpAddressDataFactoryProvider> Before invoking the facade " +
183             Utils.name2facade(facade.facade_name()) + " to create " +
184             Utils.name2string(name));
185 **************************************/

186             facade.create(
187                 name,
188                 objectKind,
189                 packageNameList,
190                 deletePolicy,
191                 intt.itu.itut_x780.SourceIndicatorType.resourceOperation,
192                 superior,
193                 ipAdEntAddress,
194                 mgmtIpAddress,
195                 supportedSnmpVersions,
196                 snmpPort);
197
198             //System.err.println("Before registering to the containment service");
199
c_admin.addName(name, superior);
200
201             //System.err.println("IpAddressDataFactory>create returns for " +
202
// Utils.name2string(name));
203
Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
204           "successfully created " + Utils.name2string(name));
205             return name;
206     }
207
208     /**
209      * Implementation of the ::itut_x780::ManagedObjectFactory::create_base operation.
210      */

211     public org.omg.CosNaming.NameComponent JavaDoc[]
212     create_base(String JavaDoc nameBinding, org.omg.CosNaming.NameComponent JavaDoc[] superior, String JavaDoc reqId)
213     throws intt.itu.itut_x780.CreateError,
214
215            intt.itu.itut_x780.ApplicationError
216     {
217         //
218
// TODO : Implement
219
//
220
return null;
221     }
222
223 }
224
Popular Tags