KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > SnmpProtocolMonitorFactoryProviderComposition > SnmpProtocolMonitorFactoryProviderImpl


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.SnmpProtocolMonitorFactoryProviderComposition;
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 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
36 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
37
38 import ist.coach.coachEmsCommon.SnmpUtils;
39 import intt.itu.itut_x780.UIDType;
40 import intt.itu.itut_x780.CreateError;
41 import intt.itu.itut_x780.ApplicationError;
42 import intt.itu.itut_m3120.conditionalPackages.*;
43 import ist.coach.coachEmfServices.EmfBasicLog.*;
44
45 import org.omg.CosNaming.NameComponent JavaDoc;
46 import ist.coach.coachEmsMibComponents.SnmpProtocolMonitorMgmt;
47 /**
48  * This is the CIDL-based implementation of the
49  * OMG IDL3 IDL:coach.ist/coachEmsMibComponents/SnmpProtocolMonitorFactoryProvider:1.0 component type.
50  *
51  * @author OpenCCM CIF_Jimpl Compiler.
52  */

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

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

89     public void
90     configuration_complete()
91     throws org.omg.Components.InvalidConfiguration
92     {
93         //
94
// DONE : implement !!!
95
//
96

97         if ((facade = get_context().get_connection_facade()) == null)
98             throw new org.omg.Components.InvalidConfiguration();
99
100         if ((c_admin = get_context().get_connection_containment_admin()) == null)
101             throw new org.omg.Components.InvalidConfiguration();
102
103         if ((c_query = get_context().get_connection_containment_query()) == null)
104             throw new org.omg.Components.InvalidConfiguration();
105
106         if ((logSupport = get_context().get_connection_basic_log()) == null)
107             throw new org.omg.Components.InvalidConfiguration();
108
109         System.err.println("SnmpProtocolMonitorFactoryProvider configuration completed...");
110
111
112     }
113     // ==================================================================
114
//
115
// Methods.
116
//
117
// ==================================================================
118

119     /**
120      * Implementation of the ::coachEmsMib::SnmpProtocolMonitorFactory::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[] mgmtIpAddress,
128         int snmpPort,
129         int supportedSnmpVersions)
130     throws intt.itu.itut_x780.ApplicationError,
131            intt.itu.itut_x780.CreateError
132     {
133
134         String JavaDoc nameBinding_str = "ist.coach.coachEmsMib.NameBindings." +
135             nameBindingID;
136
137         CreateBindingInfo info = CreateController.checkNameBinding(nameBinding_str);
138
139         String JavaDoc objectKind = info.objectKind;
140         short deletePolicy = info.deletePolicy;
141
142         // Check if the parent exists
143
if (! c_query.exists(superior)) {
144                 ApplicationErrorInfoTypeImpl error_code =
145                         new ApplicationErrorInfoTypeImpl();
146                 error_code.error = new UIDType(
147                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
148                 intt.itu.itut_x780.ApplicationErrorConst.objectNotFound.value);
149
150
151                 error_code.details = Utils.name2string(superior) +
152                 ExceptionMessages.parent_object_error;
153
154             throw new ApplicationError(error_code);
155         }
156
157         // The system must have the capability to auto-name objects
158

159         String JavaDoc allocatedId = null;
160         if (reqID == null || reqID.length() == 0) {
161
162             org.omg.CosNaming.NameComponent JavaDoc[][] siblings =
163             c_query.getContained(superior);
164             allocatedId = CreateController.autoCreateId(siblings);
165         }
166         else
167             allocatedId = reqID;
168
169         // Construct the name of the new object
170

171         org.omg.CosNaming.NameComponent JavaDoc[] name = CreateController.createFullName(
172                 superior,
173                 allocatedId,
174                 Utils.name2facade(facade.facade_name()),
175                 objectKind);
176
177         Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
178           "proceed to create " + Utils.name2string(name));
179
180         facade.create(
181                 name,
182                 objectKind,
183                 packageNameList,
184                 deletePolicy,
185                 intt.itu.itut_x780.SourceIndicatorType.resourceOperation,
186                 superior,
187                 mgmtIpAddress,
188                 supportedSnmpVersions,
189                 snmpPort);
190
191        c_admin.addName(name, superior);
192       //FSET HACK: At some point registration to Snmp Service must also take place!!!
193

194                             // ready to return
195

196         Utils.pretty_log(logSupport, FACTORY_CLASS, "Factory", (short) LogSeverity._Info,
197           "successfully created " + Utils.name2string(name));
198         return name;
199
200     }
201
202     /**
203      * Implementation of the ::itut_x780::ManagedObjectFactory::create_base operation.
204      */

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