KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > IpRoutingEntryFactoryProviderComposition > IpRoutingEntryFactoryProviderImpl


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

53 public class IpRoutingEntryFactoryProviderImpl
54      extends ist.coach.coachEmsMibComponents.IpRoutingEntryFactoryProviderComposition.IpRoutingEntryFactoryProvider_impl
55 {
56     // ==================================================================
57
//
58
// Internal states.
59
//
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 = "IpRoutingEntryFactory";
67     IpRoutingEntryMgmt facade = null;
68     // ==================================================================
69
//
70
// Constructors.
71
//
72
// ==================================================================
73

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

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

119     /**
120      * Implementation of the ::coachEmsMib::IpRoutingEntryFactory::create operation.
121      */

122     public org.omg.CosNaming.NameComponent JavaDoc[]
123     create(String JavaDoc nameBindingID,
124           org.omg.CosNaming.NameComponent JavaDoc[] superior,
125           String JavaDoc reqID,
126           String JavaDoc[] packageNameList,
127           byte[] ipRouteDest,
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 = "RoutingEntry" + 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         Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
178           "proceed to create " + Utils.name2string(name));
179
180
181 /****
182         System.err.println("IpRoutingEntryFactoryProvider> 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                 ipRouteDest,
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("IpRoutingEntryFactory>create returns for " +
202
// Utils.name2string(name));
203

204           Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
205           "successfully created " + Utils.name2string(name));
206             return name;
207     }
208
209     /**
210      * Implementation of the ::itut_x780::ManagedObjectFactory::create_base operation.
211      */

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