KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > IpToMACAddressFactoryProviderComposition > IpToMACAddressFactoryProviderImpl


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.IpToMACAddressFactoryProviderComposition;
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.IpToMACAddressMgmt;
45
46 import ist.coach.coachEmfServices.EmfBasicLog.*;
47 /**
48  * This is the CIDL-based implementation of the
49  * OMG IDL3 IDL:coach.ist/coachEmsMibComponents/IpToMACAddressFactoryProvider:1.0 component type.
50  *
51  * @author OpenCCM CIF_Jimpl Compiler.
52  */

53 public class IpToMACAddressFactoryProviderImpl
54      extends ist.coach.coachEmsMibComponents.IpToMACAddressFactoryProviderComposition.IpToMACAddressFactoryProvider_impl
55 {
56     // ==================================================================
57
//
58
// Internal states.
59
//
60
// ==================================================================
61
intt.itu.itut_q816.ContainmentComponent c_admin = null;
62     intt.itu.itut_q816.Containment c_query = null;
63
64     private BasicLog logSupport;
65     private static final String JavaDoc FACTORY_CLASS = "IpToMACAddressFactory";
66     IpToMACAddressMgmt facade = null;
67     // ==================================================================
68
//
69
// Constructors.
70
//
71
// ==================================================================
72

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

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

118     /**
119      * Implementation of the ::coachEmsMib::IpToMACAddressFactory::create operation.
120      */

121     public org.omg.CosNaming.NameComponent JavaDoc[]
122     create(String JavaDoc nameBindingID,
123         org.omg.CosNaming.NameComponent JavaDoc[] superior,
124         String JavaDoc reqID,
125         String JavaDoc[] packageNameList,
126         int ipNetToMediaIfIndex,
127         byte[] ipNetToMediaNetAddress,
128         byte[] mgmtIpAddress,
129         int snmpPort,
130         int supportedSnmpVersions)
131     throws intt.itu.itut_x780.ApplicationError,
132
133            intt.itu.itut_x780.CreateError
134     {
135         //
136
// DONE : Implement
137
//
138
String JavaDoc nameBinding_str = "ist.coach.coachEmsMib.NameBindings." +
139                 nameBindingID;
140
141         CreateBindingInfo info = CreateController.checkNameBinding(nameBinding_str);
142
143         String JavaDoc objectKind = info.objectKind;
144         short deletePolicy = info.deletePolicy;
145
146         // Check if the parent exists
147
if (! c_query.exists(superior)) {
148             ApplicationErrorInfoTypeImpl error_code = new ApplicationErrorInfoTypeImpl();
149             error_code.error = new UIDType(
150                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
151                 intt.itu.itut_x780.ApplicationErrorConst.objectNotFound.value);
152
153             error_code.details = Utils.name2string(superior) +
154                             ExceptionMessages.parent_object_error;
155
156             throw new ApplicationError(error_code);
157         }
158
159         // The system must have the capability of auto-naming objects
160
String JavaDoc allocatedId = reqID;
161         if (reqID == null || reqID.length() == 0) {
162
163             org.omg.CosNaming.NameComponent JavaDoc[][] siblings =
164                 c_query.getContained(superior);
165
166                 allocatedId = "IpToMACAddress" + CreateController.autoCreateId(siblings);
167         }
168
169         // Construct the name of the new object
170
org.omg.CosNaming.NameComponent JavaDoc[] name = CreateController.createFullName(
171                     superior,
172                     allocatedId,
173                     Utils.name2facade(facade.facade_name()),
174                     objectKind);
175 /*****
176
177         System.err.println("IpToMACAddressFactoryProvider> Before invoking the facade " +
178             Utils.name2facade(facade.facade_name()) + " to create " +
179             Utils.name2string(name));
180 ******/

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

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