4
|
1 |
/*
|
5555
|
2 |
* Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
|
4
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5555
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
4
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5555
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
4
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5555
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
4
|
24 |
*/
|
|
25 |
|
|
26 |
package com.sun.corba.se.impl.orb ;
|
|
27 |
|
|
28 |
import java.lang.reflect.InvocationTargetException;
|
|
29 |
import java.lang.reflect.Method;
|
|
30 |
import java.net.InetAddress ;
|
|
31 |
import java.security.PrivilegedAction ;
|
|
32 |
import java.security.PrivilegedExceptionAction ;
|
|
33 |
import java.security.AccessController ;
|
|
34 |
import java.util.Collection ;
|
|
35 |
import java.util.Iterator ;
|
|
36 |
|
|
37 |
import org.omg.CORBA.CompletionStatus ;
|
|
38 |
import org.omg.CORBA.portable.ValueFactory ;
|
|
39 |
|
|
40 |
import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ;
|
|
41 |
import com.sun.corba.se.pept.transport.Acceptor;
|
|
42 |
|
|
43 |
import com.sun.corba.se.spi.activation.Locator ;
|
|
44 |
import com.sun.corba.se.spi.activation.Activator ;
|
|
45 |
import com.sun.corba.se.spi.activation.LocatorHelper ;
|
|
46 |
import com.sun.corba.se.spi.activation.ActivatorHelper ;
|
|
47 |
import com.sun.corba.se.spi.activation.EndPointInfo ;
|
|
48 |
|
|
49 |
import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
|
|
50 |
import com.sun.corba.se.spi.copyobject.CopyobjectDefaults ;
|
|
51 |
import com.sun.corba.se.spi.copyobject.CopierManager ;
|
|
52 |
|
|
53 |
import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
|
|
54 |
import com.sun.corba.se.spi.ior.IOR;
|
|
55 |
import com.sun.corba.se.spi.ior.IORFactories ;
|
|
56 |
|
|
57 |
import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
|
|
58 |
|
|
59 |
import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
|
|
60 |
|
|
61 |
import com.sun.corba.se.spi.logging.CORBALogDomains ;
|
|
62 |
|
|
63 |
import com.sun.corba.se.spi.oa.OADefault ;
|
|
64 |
import com.sun.corba.se.spi.oa.ObjectAdapter ;
|
|
65 |
import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
|
|
66 |
|
|
67 |
import com.sun.corba.se.spi.orb.Operation ;
|
|
68 |
import com.sun.corba.se.spi.orb.OperationFactory ;
|
|
69 |
import com.sun.corba.se.spi.orb.ORBData ;
|
|
70 |
import com.sun.corba.se.spi.orb.DataCollector ;
|
|
71 |
import com.sun.corba.se.spi.orb.ORBConfigurator ;
|
|
72 |
import com.sun.corba.se.spi.orb.ParserImplBase ;
|
|
73 |
import com.sun.corba.se.spi.orb.PropertyParser ;
|
|
74 |
import com.sun.corba.se.spi.orb.ORB ;
|
|
75 |
|
|
76 |
import com.sun.corba.se.spi.orbutil.closure.Closure ;
|
|
77 |
import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ;
|
|
78 |
|
|
79 |
import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
|
|
80 |
import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
|
|
81 |
import com.sun.corba.se.spi.protocol.RequestDispatcherDefault ;
|
|
82 |
import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
|
|
83 |
|
|
84 |
import com.sun.corba.se.spi.resolver.LocalResolver ;
|
|
85 |
import com.sun.corba.se.spi.resolver.Resolver ;
|
|
86 |
import com.sun.corba.se.spi.resolver.ResolverDefault ;
|
|
87 |
|
|
88 |
import com.sun.corba.se.spi.transport.CorbaContactInfoList;
|
|
89 |
import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
|
|
90 |
import com.sun.corba.se.spi.transport.SocketInfo;
|
|
91 |
import com.sun.corba.se.spi.transport.TransportDefault ;
|
|
92 |
|
|
93 |
import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
|
|
94 |
import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;
|
|
95 |
|
|
96 |
import com.sun.corba.se.spi.servicecontext.ServiceContext ;
|
|
97 |
import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
|
|
98 |
import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext ;
|
|
99 |
import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext ;
|
|
100 |
import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext ;
|
|
101 |
import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext ;
|
|
102 |
import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext ;
|
|
103 |
import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
|
|
104 |
import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
|
|
105 |
|
|
106 |
// XXX This should go away once we get rid of the port exchange for ORBD
|
|
107 |
import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
|
|
108 |
import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
|
|
109 |
import com.sun.corba.se.impl.legacy.connection.SocketFactoryContactInfoListImpl;
|
|
110 |
import com.sun.corba.se.impl.legacy.connection.USLPort;
|
|
111 |
|
|
112 |
// XXX These should move to SPI
|
|
113 |
import com.sun.corba.se.impl.orbutil.ORBConstants ;
|
|
114 |
|
|
115 |
// XXX This needs an SPI
|
|
116 |
import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl ;
|
|
117 |
|
|
118 |
public class ORBConfiguratorImpl implements ORBConfigurator {
|
|
119 |
private ORBUtilSystemException wrapper ;
|
|
120 |
|
|
121 |
public static class ConfigParser extends ParserImplBase {
|
|
122 |
public Class[] userConfigurators = null ;
|
|
123 |
|
|
124 |
public PropertyParser makeParser()
|
|
125 |
{
|
|
126 |
PropertyParser parser = new PropertyParser() ;
|
|
127 |
Operation action = OperationFactory.compose(
|
|
128 |
OperationFactory.suffixAction(),
|
|
129 |
OperationFactory.classAction()
|
|
130 |
) ;
|
|
131 |
parser.addPrefix( ORBConstants.SUN_PREFIX + "ORBUserConfigurators",
|
|
132 |
action, "userConfigurators", Class.class ) ;
|
|
133 |
return parser ;
|
|
134 |
}
|
|
135 |
}
|
|
136 |
|
|
137 |
public void configure( DataCollector collector, ORB orb )
|
|
138 |
{
|
|
139 |
ORB theOrb = orb ;
|
|
140 |
wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ;
|
|
141 |
|
|
142 |
initObjectCopiers( theOrb ) ;
|
|
143 |
initIORFinders( theOrb ) ;
|
|
144 |
|
|
145 |
theOrb.setClientDelegateFactory(
|
|
146 |
// REVISIT: this should be ProtocolDefault.
|
|
147 |
TransportDefault.makeClientDelegateFactory( theOrb )) ;
|
|
148 |
|
|
149 |
initializeTransport(theOrb) ;
|
|
150 |
|
|
151 |
initializeNaming( theOrb ) ;
|
|
152 |
initServiceContextRegistry( theOrb ) ;
|
|
153 |
initRequestDispatcherRegistry( theOrb ) ;
|
|
154 |
registerInitialReferences( theOrb ) ;
|
|
155 |
|
|
156 |
persistentServerInitialization( theOrb ) ;
|
|
157 |
|
|
158 |
runUserConfigurators( collector, theOrb ) ;
|
|
159 |
}
|
|
160 |
|
|
161 |
private void runUserConfigurators( DataCollector collector, ORB orb )
|
|
162 |
{
|
|
163 |
// Run any pluggable configurators. This is a lot like
|
|
164 |
// ORBInitializers, only it uses the internal ORB and has
|
|
165 |
// access to all data for parsing.
|
|
166 |
ConfigParser parser = new ConfigParser() ;
|
|
167 |
parser.init( collector ) ;
|
|
168 |
if (parser.userConfigurators != null) {
|
|
169 |
for (int ctr=0; ctr<parser.userConfigurators.length; ctr++) {
|
|
170 |
Class cls = parser.userConfigurators[ctr] ;
|
|
171 |
try {
|
|
172 |
ORBConfigurator config = (ORBConfigurator)(cls.newInstance()) ;
|
|
173 |
config.configure( collector, orb ) ;
|
|
174 |
} catch (Exception exc) {
|
|
175 |
// XXX Log this exception
|
|
176 |
// ignore this for now: a bad user configurator does nothing
|
|
177 |
}
|
|
178 |
}
|
|
179 |
}
|
|
180 |
}
|
|
181 |
|
|
182 |
private void persistentServerInitialization( ORB orb )
|
|
183 |
{
|
|
184 |
ORBData data = orb.getORBData() ;
|
|
185 |
|
|
186 |
// determine the ORBD port so that persistent objrefs can be
|
|
187 |
// created.
|
|
188 |
if (data.getServerIsORBActivated()) {
|
|
189 |
try {
|
|
190 |
Locator locator = LocatorHelper.narrow(
|
|
191 |
orb.resolve_initial_references(
|
|
192 |
ORBConstants.SERVER_LOCATOR_NAME )) ;
|
|
193 |
Activator activator = ActivatorHelper.narrow(
|
|
194 |
orb.resolve_initial_references(
|
|
195 |
ORBConstants.SERVER_ACTIVATOR_NAME )) ;
|
|
196 |
Collection serverEndpoints =
|
|
197 |
orb.getCorbaTransportManager().getAcceptors(null, null);
|
|
198 |
EndPointInfo[] endpointList =
|
|
199 |
new EndPointInfo[serverEndpoints.size()];
|
|
200 |
Iterator iterator = serverEndpoints.iterator();
|
|
201 |
int i = 0 ;
|
|
202 |
while (iterator.hasNext()) {
|
|
203 |
Object n = iterator.next();
|
|
204 |
if (! (n instanceof LegacyServerSocketEndPointInfo)) {
|
|
205 |
continue;
|
|
206 |
}
|
|
207 |
LegacyServerSocketEndPointInfo ep =
|
|
208 |
(LegacyServerSocketEndPointInfo) n;
|
|
209 |
// REVISIT - use exception instead of -1.
|
|
210 |
int port = locator.getEndpoint(ep.getType());
|
|
211 |
if (port == -1) {
|
|
212 |
port = locator.getEndpoint(SocketInfo.IIOP_CLEAR_TEXT);
|
|
213 |
if (port == -1) {
|
|
214 |
throw new Exception(
|
|
215 |
"ORBD must support IIOP_CLEAR_TEXT");
|
|
216 |
}
|
|
217 |
}
|
|
218 |
|
|
219 |
ep.setLocatorPort(port);
|
|
220 |
|
|
221 |
endpointList[i++] =
|
|
222 |
new EndPointInfo(ep.getType(), ep.getPort());
|
|
223 |
}
|
|
224 |
|
|
225 |
activator.registerEndpoints(
|
|
226 |
data.getPersistentServerId(), data.getORBId(),
|
|
227 |
endpointList);
|
|
228 |
} catch (Exception ex) {
|
|
229 |
throw wrapper.persistentServerInitError(
|
|
230 |
CompletionStatus.COMPLETED_MAYBE, ex ) ;
|
|
231 |
}
|
|
232 |
}
|
|
233 |
}
|
|
234 |
|
|
235 |
/**
|
|
236 |
* This is made somewhat complex because we are currently supporting
|
|
237 |
* the ContactInfoList/Acceptor *AND* the legacy SocketFactory
|
|
238 |
* transport architecture.
|
|
239 |
*/
|
|
240 |
private void initializeTransport(final ORB orb)
|
|
241 |
{
|
|
242 |
ORBData od = orb.getORBData();
|
|
243 |
|
|
244 |
CorbaContactInfoListFactory contactInfoListFactory =
|
|
245 |
od.getCorbaContactInfoListFactory();
|
|
246 |
Acceptor[] acceptors = od.getAcceptors();
|
|
247 |
|
|
248 |
// BEGIN Legacy
|
|
249 |
ORBSocketFactory legacySocketFactory = od.getLegacySocketFactory();
|
|
250 |
USLPort[] uslPorts = od.getUserSpecifiedListenPorts() ;
|
|
251 |
setLegacySocketFactoryORB(orb, legacySocketFactory);
|
|
252 |
// END Legacy
|
|
253 |
|
|
254 |
//
|
|
255 |
// Check for incorrect configuration.
|
|
256 |
//
|
|
257 |
|
|
258 |
if (legacySocketFactory != null && contactInfoListFactory != null) {
|
|
259 |
throw wrapper.socketFactoryAndContactInfoListAtSameTime();
|
|
260 |
}
|
|
261 |
|
|
262 |
if (acceptors.length != 0 && legacySocketFactory != null) {
|
|
263 |
throw wrapper.acceptorsAndLegacySocketFactoryAtSameTime();
|
|
264 |
}
|
|
265 |
|
|
266 |
|
|
267 |
//
|
|
268 |
// Client and Server side setup.
|
|
269 |
//
|
|
270 |
|
|
271 |
od.getSocketFactory().setORB(orb);
|
|
272 |
|
|
273 |
//
|
|
274 |
// Set up client side.
|
|
275 |
//
|
|
276 |
|
|
277 |
if (legacySocketFactory != null) {
|
|
278 |
// BEGIN Legacy
|
|
279 |
// Since the user specified a legacy socket factory we need to
|
|
280 |
// use a ContactInfoList that will use the legacy socket factory.
|
|
281 |
contactInfoListFactory =
|
|
282 |
new CorbaContactInfoListFactory() {
|
|
283 |
public void setORB(ORB orb) { }
|
|
284 |
public CorbaContactInfoList create( IOR ior ) {
|
|
285 |
return new SocketFactoryContactInfoListImpl(
|
|
286 |
orb, ior);
|
|
287 |
}
|
|
288 |
};
|
|
289 |
// END Legacy
|
|
290 |
} else if (contactInfoListFactory != null) {
|
|
291 |
// The user specified an explicit ContactInfoListFactory.
|
|
292 |
contactInfoListFactory.setORB(orb);
|
|
293 |
} else {
|
|
294 |
// Use the default.
|
|
295 |
contactInfoListFactory =
|
|
296 |
TransportDefault.makeCorbaContactInfoListFactory(orb);
|
|
297 |
}
|
|
298 |
orb.setCorbaContactInfoListFactory(contactInfoListFactory);
|
|
299 |
|
|
300 |
//
|
|
301 |
// Set up server side.
|
|
302 |
//
|
|
303 |
|
|
304 |
//
|
|
305 |
// Maybe allocate the Legacy default listener.
|
|
306 |
//
|
|
307 |
// If old legacy properties set, or there are no explicit
|
|
308 |
// acceptors then register a default listener. Type of
|
|
309 |
// default listener depends on presence of legacy socket factory.
|
|
310 |
//
|
|
311 |
// Note: this must happen *BEFORE* registering explicit acceptors.
|
|
312 |
//
|
|
313 |
|
|
314 |
// BEGIN Legacy
|
|
315 |
int port = -1;
|
|
316 |
if (od.getORBServerPort() != 0) {
|
|
317 |
port = od.getORBServerPort();
|
|
318 |
} else if (od.getPersistentPortInitialized()) {
|
|
319 |
port = od.getPersistentServerPort();
|
|
320 |
} else if (acceptors.length == 0) {
|
|
321 |
port = 0;
|
|
322 |
}
|
|
323 |
if (port != -1) {
|
|
324 |
createAndRegisterAcceptor(orb, legacySocketFactory, port,
|
|
325 |
LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT,
|
|
326 |
SocketInfo.IIOP_CLEAR_TEXT);
|
|
327 |
}
|
|
328 |
// END Legacy
|
|
329 |
|
|
330 |
for (int i = 0; i < acceptors.length; i++) {
|
|
331 |
orb.getCorbaTransportManager().registerAcceptor(acceptors[i]);
|
|
332 |
}
|
|
333 |
|
|
334 |
// BEGIN Legacy
|
|
335 |
// Allocate user listeners.
|
|
336 |
USLPort[] ports = od.getUserSpecifiedListenPorts() ;
|
|
337 |
if (ports != null) {
|
|
338 |
for (int i = 0; i < ports.length; i++) {
|
|
339 |
createAndRegisterAcceptor(
|
|
340 |
orb, legacySocketFactory, ports[i].getPort(),
|
|
341 |
LegacyServerSocketEndPointInfo.NO_NAME,
|
|
342 |
ports[i].getType());
|
|
343 |
}
|
|
344 |
}
|
|
345 |
// END Legacy
|
|
346 |
}
|
|
347 |
|
|
348 |
/*
|
|
349 |
* Legacy: name.
|
|
350 |
*/
|
|
351 |
// REVISIT: see ORBD. make factory in TransportDefault.
|
|
352 |
private void createAndRegisterAcceptor(ORB orb,
|
|
353 |
ORBSocketFactory legacySocketFactory,
|
|
354 |
int port, String name, String type)
|
|
355 |
{
|
|
356 |
Acceptor acceptor;
|
|
357 |
if (legacySocketFactory == null) {
|
|
358 |
acceptor =
|
|
359 |
new SocketOrChannelAcceptorImpl(orb, port, name, type);
|
|
360 |
} else {
|
|
361 |
acceptor =
|
|
362 |
new SocketFactoryAcceptorImpl(orb, port, name, type);
|
|
363 |
}
|
|
364 |
orb.getTransportManager().registerAcceptor(acceptor);
|
|
365 |
}
|
|
366 |
|
|
367 |
private void setLegacySocketFactoryORB(
|
|
368 |
final ORB orb, final ORBSocketFactory legacySocketFactory)
|
|
369 |
{
|
|
370 |
if (legacySocketFactory == null) {
|
|
371 |
return;
|
|
372 |
}
|
|
373 |
|
|
374 |
// Note: the createServerSocket and createSocket methods on the
|
|
375 |
// DefaultSocketFactory need to get data from the ORB but
|
|
376 |
// we cannot change the interface. So set the ORB (if it's ours)
|
|
377 |
// by reflection.
|
|
378 |
|
|
379 |
try {
|
|
380 |
AccessController.doPrivileged(
|
|
381 |
new PrivilegedExceptionAction() {
|
|
382 |
public Object run()
|
|
383 |
throws InstantiationException, IllegalAccessException
|
|
384 |
{
|
|
385 |
try {
|
|
386 |
Class[] params = { ORB.class };
|
|
387 |
Method method =
|
|
388 |
legacySocketFactory.getClass().getMethod(
|
|
389 |
"setORB", params);
|
|
390 |
Object[] args = { orb };
|
|
391 |
method.invoke(legacySocketFactory, args);
|
|
392 |
} catch (NoSuchMethodException e) {
|
|
393 |
// NOTE: If there is no method then it
|
|
394 |
// is not ours - so ignore it.
|
|
395 |
;
|
|
396 |
} catch (IllegalAccessException e) {
|
|
397 |
RuntimeException rte = new RuntimeException();
|
|
398 |
rte.initCause(e);
|
|
399 |
throw rte;
|
|
400 |
} catch (InvocationTargetException e) {
|
|
401 |
RuntimeException rte = new RuntimeException();
|
|
402 |
rte.initCause(e);
|
|
403 |
throw rte;
|
|
404 |
}
|
|
405 |
return null;
|
|
406 |
}
|
|
407 |
}
|
|
408 |
);
|
|
409 |
} catch (Throwable t) {
|
|
410 |
throw wrapper.unableToSetSocketFactoryOrb(t);
|
|
411 |
}
|
|
412 |
}
|
|
413 |
|
|
414 |
private void initializeNaming( ORB orb )
|
|
415 |
{
|
|
416 |
LocalResolver localResolver = ResolverDefault.makeLocalResolver() ;
|
|
417 |
orb.setLocalResolver( localResolver ) ;
|
|
418 |
|
|
419 |
Resolver bootResolver = ResolverDefault.makeBootstrapResolver( orb,
|
|
420 |
orb.getORBData().getORBInitialHost(),
|
|
421 |
orb.getORBData().getORBInitialPort() ) ;
|
|
422 |
|
|
423 |
Operation urlOperation = ResolverDefault.makeINSURLOperation( orb,
|
|
424 |
bootResolver ) ;
|
|
425 |
orb.setURLOperation( urlOperation ) ;
|
|
426 |
|
|
427 |
Resolver irResolver = ResolverDefault.makeORBInitRefResolver( urlOperation,
|
|
428 |
orb.getORBData().getORBInitialReferences() ) ;
|
|
429 |
|
|
430 |
Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver(
|
|
431 |
urlOperation, orb.getORBData().getORBDefaultInitialReference() ) ;
|
|
432 |
|
|
433 |
Resolver resolver =
|
|
434 |
ResolverDefault.makeCompositeResolver( localResolver,
|
|
435 |
ResolverDefault.makeCompositeResolver( irResolver,
|
|
436 |
ResolverDefault.makeCompositeResolver( dirResolver,
|
|
437 |
bootResolver ) ) ) ;
|
|
438 |
orb.setResolver( resolver ) ;
|
|
439 |
}
|
|
440 |
|
|
441 |
private void initServiceContextRegistry( ORB orb )
|
|
442 |
{
|
|
443 |
ServiceContextRegistry scr = orb.getServiceContextRegistry() ;
|
|
444 |
|
|
445 |
scr.register( UEInfoServiceContext.class ) ;
|
|
446 |
scr.register( CodeSetServiceContext.class ) ;
|
|
447 |
scr.register( SendingContextServiceContext.class ) ;
|
|
448 |
scr.register( ORBVersionServiceContext.class ) ;
|
|
449 |
scr.register( MaxStreamFormatVersionServiceContext.class ) ;
|
|
450 |
}
|
|
451 |
|
|
452 |
private void registerInitialReferences( final ORB orb )
|
|
453 |
{
|
|
454 |
// Register the Dynamic Any factory
|
|
455 |
Closure closure = new Closure() {
|
|
456 |
public java.lang.Object evaluate() {
|
|
457 |
return new DynAnyFactoryImpl( orb ) ;
|
|
458 |
}
|
|
459 |
} ;
|
|
460 |
|
|
461 |
Closure future = ClosureFactory.makeFuture( closure ) ;
|
|
462 |
orb.getLocalResolver().register( ORBConstants.DYN_ANY_FACTORY_NAME,
|
|
463 |
future ) ;
|
|
464 |
}
|
|
465 |
|
|
466 |
private static final int ORB_STREAM = 0 ;
|
|
467 |
|
|
468 |
private void initObjectCopiers( ORB orb )
|
|
469 |
{
|
|
470 |
// No optimization or policy selection here.
|
|
471 |
ObjectCopierFactory orbStream =
|
|
472 |
CopyobjectDefaults.makeORBStreamObjectCopierFactory( orb ) ;
|
|
473 |
|
|
474 |
CopierManager cm = orb.getCopierManager() ;
|
|
475 |
cm.setDefaultId( ORB_STREAM ) ;
|
|
476 |
|
|
477 |
cm.registerObjectCopierFactory( orbStream, ORB_STREAM ) ;
|
|
478 |
}
|
|
479 |
|
|
480 |
private void initIORFinders( ORB orb )
|
|
481 |
{
|
|
482 |
IdentifiableFactoryFinder profFinder =
|
|
483 |
orb.getTaggedProfileFactoryFinder() ;
|
|
484 |
profFinder.registerFactory( IIOPFactories.makeIIOPProfileFactory() ) ;
|
|
485 |
|
|
486 |
IdentifiableFactoryFinder profTempFinder =
|
|
487 |
orb.getTaggedProfileTemplateFactoryFinder() ;
|
|
488 |
profTempFinder.registerFactory(
|
|
489 |
IIOPFactories.makeIIOPProfileTemplateFactory() ) ;
|
|
490 |
|
|
491 |
IdentifiableFactoryFinder compFinder =
|
|
492 |
orb.getTaggedComponentFactoryFinder() ;
|
|
493 |
compFinder.registerFactory(
|
|
494 |
IIOPFactories.makeCodeSetsComponentFactory() ) ;
|
|
495 |
compFinder.registerFactory(
|
|
496 |
IIOPFactories.makeJavaCodebaseComponentFactory() ) ;
|
|
497 |
compFinder.registerFactory(
|
|
498 |
IIOPFactories.makeORBTypeComponentFactory() ) ;
|
|
499 |
compFinder.registerFactory(
|
|
500 |
IIOPFactories.makeMaxStreamFormatVersionComponentFactory() ) ;
|
|
501 |
compFinder.registerFactory(
|
|
502 |
IIOPFactories.makeAlternateIIOPAddressComponentFactory() ) ;
|
|
503 |
compFinder.registerFactory(
|
|
504 |
IIOPFactories.makeRequestPartitioningComponentFactory() ) ;
|
|
505 |
compFinder.registerFactory(
|
|
506 |
IIOPFactories.makeJavaSerializationComponentFactory());
|
|
507 |
|
|
508 |
// Register the ValueFactory instances for ORT
|
|
509 |
IORFactories.registerValueFactories( orb ) ;
|
|
510 |
|
|
511 |
// Register an ObjectKeyFactory
|
|
512 |
orb.setObjectKeyFactory( IORFactories.makeObjectKeyFactory(orb) ) ;
|
|
513 |
}
|
|
514 |
|
|
515 |
private void initRequestDispatcherRegistry( ORB orb )
|
|
516 |
{
|
|
517 |
RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
|
|
518 |
|
|
519 |
// register client subcontracts
|
|
520 |
ClientRequestDispatcher csub =
|
|
521 |
RequestDispatcherDefault.makeClientRequestDispatcher() ;
|
|
522 |
scr.registerClientRequestDispatcher( csub,
|
|
523 |
ORBConstants.TOA_SCID ) ;
|
|
524 |
scr.registerClientRequestDispatcher( csub,
|
|
525 |
ORBConstants.TRANSIENT_SCID ) ;
|
|
526 |
scr.registerClientRequestDispatcher( csub,
|
|
527 |
ORBConstants.PERSISTENT_SCID ) ;
|
|
528 |
scr.registerClientRequestDispatcher( csub,
|
|
529 |
ORBConstants.SC_TRANSIENT_SCID ) ;
|
|
530 |
scr.registerClientRequestDispatcher( csub,
|
|
531 |
ORBConstants.SC_PERSISTENT_SCID ) ;
|
|
532 |
scr.registerClientRequestDispatcher( csub,
|
|
533 |
ORBConstants.IISC_TRANSIENT_SCID ) ;
|
|
534 |
scr.registerClientRequestDispatcher( csub,
|
|
535 |
ORBConstants.IISC_PERSISTENT_SCID ) ;
|
|
536 |
scr.registerClientRequestDispatcher( csub,
|
|
537 |
ORBConstants.MINSC_TRANSIENT_SCID ) ;
|
|
538 |
scr.registerClientRequestDispatcher( csub,
|
|
539 |
ORBConstants.MINSC_PERSISTENT_SCID ) ;
|
|
540 |
|
|
541 |
// register server delegates
|
|
542 |
CorbaServerRequestDispatcher sd =
|
|
543 |
RequestDispatcherDefault.makeServerRequestDispatcher( orb );
|
|
544 |
scr.registerServerRequestDispatcher( sd,
|
|
545 |
ORBConstants.TOA_SCID ) ;
|
|
546 |
scr.registerServerRequestDispatcher( sd,
|
|
547 |
ORBConstants.TRANSIENT_SCID ) ;
|
|
548 |
scr.registerServerRequestDispatcher( sd,
|
|
549 |
ORBConstants.PERSISTENT_SCID ) ;
|
|
550 |
scr.registerServerRequestDispatcher( sd,
|
|
551 |
ORBConstants.SC_TRANSIENT_SCID ) ;
|
|
552 |
scr.registerServerRequestDispatcher( sd,
|
|
553 |
ORBConstants.SC_PERSISTENT_SCID ) ;
|
|
554 |
scr.registerServerRequestDispatcher( sd,
|
|
555 |
ORBConstants.IISC_TRANSIENT_SCID ) ;
|
|
556 |
scr.registerServerRequestDispatcher( sd,
|
|
557 |
ORBConstants.IISC_PERSISTENT_SCID ) ;
|
|
558 |
scr.registerServerRequestDispatcher( sd,
|
|
559 |
ORBConstants.MINSC_TRANSIENT_SCID ) ;
|
|
560 |
scr.registerServerRequestDispatcher( sd,
|
|
561 |
ORBConstants.MINSC_PERSISTENT_SCID ) ;
|
|
562 |
|
|
563 |
orb.setINSDelegate(
|
|
564 |
RequestDispatcherDefault.makeINSServerRequestDispatcher( orb ) ) ;
|
|
565 |
|
|
566 |
// register local client subcontracts
|
|
567 |
LocalClientRequestDispatcherFactory lcsf =
|
|
568 |
RequestDispatcherDefault.makeJIDLLocalClientRequestDispatcherFactory(
|
|
569 |
orb ) ;
|
|
570 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
571 |
ORBConstants.TOA_SCID ) ;
|
|
572 |
|
|
573 |
lcsf =
|
|
574 |
RequestDispatcherDefault.makePOALocalClientRequestDispatcherFactory(
|
|
575 |
orb ) ;
|
|
576 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
577 |
ORBConstants.TRANSIENT_SCID ) ;
|
|
578 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
579 |
ORBConstants.PERSISTENT_SCID ) ;
|
|
580 |
|
|
581 |
lcsf = RequestDispatcherDefault.
|
|
582 |
makeFullServantCacheLocalClientRequestDispatcherFactory( orb ) ;
|
|
583 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
584 |
ORBConstants.SC_TRANSIENT_SCID ) ;
|
|
585 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
586 |
ORBConstants.SC_PERSISTENT_SCID ) ;
|
|
587 |
|
|
588 |
lcsf = RequestDispatcherDefault.
|
|
589 |
makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( orb ) ;
|
|
590 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
591 |
ORBConstants.IISC_TRANSIENT_SCID ) ;
|
|
592 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
593 |
ORBConstants.IISC_PERSISTENT_SCID ) ;
|
|
594 |
|
|
595 |
lcsf = RequestDispatcherDefault.
|
|
596 |
makeMinimalServantCacheLocalClientRequestDispatcherFactory( orb ) ;
|
|
597 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
598 |
ORBConstants.MINSC_TRANSIENT_SCID ) ;
|
|
599 |
scr.registerLocalClientRequestDispatcherFactory( lcsf,
|
|
600 |
ORBConstants.MINSC_PERSISTENT_SCID ) ;
|
|
601 |
|
|
602 |
/* Register the server delegate that implements the ancient bootstrap
|
|
603 |
* naming protocol. This takes an object key of either "INIT" or
|
|
604 |
* "TINI" to allow for big or little endian implementations.
|
|
605 |
*/
|
|
606 |
CorbaServerRequestDispatcher bootsd =
|
|
607 |
RequestDispatcherDefault.makeBootstrapServerRequestDispatcher(
|
|
608 |
orb ) ;
|
|
609 |
scr.registerServerRequestDispatcher( bootsd, "INIT" ) ;
|
|
610 |
scr.registerServerRequestDispatcher( bootsd, "TINI" ) ;
|
|
611 |
|
|
612 |
// Register object adapter factories
|
|
613 |
ObjectAdapterFactory oaf = OADefault.makeTOAFactory( orb ) ;
|
|
614 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.TOA_SCID ) ;
|
|
615 |
|
|
616 |
oaf = OADefault.makePOAFactory( orb ) ;
|
|
617 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.TRANSIENT_SCID ) ;
|
|
618 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.PERSISTENT_SCID ) ;
|
|
619 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.SC_TRANSIENT_SCID ) ;
|
|
620 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.SC_PERSISTENT_SCID ) ;
|
|
621 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.IISC_TRANSIENT_SCID ) ;
|
|
622 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.IISC_PERSISTENT_SCID ) ;
|
|
623 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.MINSC_TRANSIENT_SCID ) ;
|
|
624 |
scr.registerObjectAdapterFactory( oaf, ORBConstants.MINSC_PERSISTENT_SCID ) ;
|
|
625 |
}
|
|
626 |
}
|
|
627 |
|
|
628 |
// End of file.
|