/* * @(#)ORBConfiguratorImpl.java 1.60 04/06/21 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package com.sun.corba.se.impl.orb ; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.InetAddress ; import java.security.PrivilegedAction ; import java.security.PrivilegedExceptionAction ; import java.security.AccessController ; import java.util.Collection ; import java.util.Iterator ; import org.omg.CORBA.CompletionStatus ; import org.omg.CORBA.portable.ValueFactory ; import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ; import com.sun.corba.se.pept.transport.Acceptor; import com.sun.corba.se.spi.activation.Locator ; import com.sun.corba.se.spi.activation.Activator ; import com.sun.corba.se.spi.activation.LocatorHelper ; import com.sun.corba.se.spi.activation.ActivatorHelper ; import com.sun.corba.se.spi.activation.EndPointInfo ; import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; import com.sun.corba.se.spi.copyobject.CopyobjectDefaults ; import com.sun.corba.se.spi.copyobject.CopierManager ; import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; import com.sun.corba.se.spi.ior.IOR; import com.sun.corba.se.spi.ior.IORFactories ; import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory; import com.sun.corba.se.spi.logging.CORBALogDomains ; import com.sun.corba.se.spi.oa.OADefault ; import com.sun.corba.se.spi.oa.ObjectAdapter ; import com.sun.corba.se.spi.oa.ObjectAdapterFactory ; import com.sun.corba.se.spi.orb.Operation ; import com.sun.corba.se.spi.orb.OperationFactory ; import com.sun.corba.se.spi.orb.ORBData ; import com.sun.corba.se.spi.orb.DataCollector ; import com.sun.corba.se.spi.orb.ORBConfigurator ; import com.sun.corba.se.spi.orb.ParserImplBase ; import com.sun.corba.se.spi.orb.PropertyParser ; import com.sun.corba.se.spi.orb.ORB ; import com.sun.corba.se.spi.orbutil.closure.Closure ; import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ; import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ; import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; import com.sun.corba.se.spi.protocol.RequestDispatcherDefault ; import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; import com.sun.corba.se.spi.resolver.LocalResolver ; import com.sun.corba.se.spi.resolver.Resolver ; import com.sun.corba.se.spi.resolver.ResolverDefault ; import com.sun.corba.se.spi.transport.CorbaContactInfoList; import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; import com.sun.corba.se.spi.transport.SocketInfo; import com.sun.corba.se.spi.transport.TransportDefault ; import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ; import com.sun.corba.se.spi.servicecontext.ServiceContext ; import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ; import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext ; import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext ; import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext ; import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext ; import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext ; import com.sun.corba.se.impl.logging.ORBUtilSystemException ; import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl; // XXX This should go away once we get rid of the port exchange for ORBD import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl; import com.sun.corba.se.impl.legacy.connection.SocketFactoryContactInfoListImpl; import com.sun.corba.se.impl.legacy.connection.USLPort; // XXX These should move to SPI import com.sun.corba.se.impl.orbutil.ORBConstants ; // XXX This needs an SPI import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl ; public class ORBConfiguratorImpl implements ORBConfigurator { private ORBUtilSystemException wrapper ; public static class ConfigParser extends ParserImplBase { public Class[] userConfigurators = null ; public PropertyParser makeParser() { PropertyParser parser = new PropertyParser() ; Operation action = OperationFactory.compose( OperationFactory.suffixAction(), OperationFactory.classAction() ) ; parser.addPrefix( ORBConstants.SUN_PREFIX + "ORBUserConfigurators", action, "userConfigurators", Class.class ) ; return parser ; } } public void configure( DataCollector collector, ORB orb ) { ORB theOrb = orb ; wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ; initObjectCopiers( theOrb ) ; initIORFinders( theOrb ) ; theOrb.setClientDelegateFactory( // REVISIT: this should be ProtocolDefault. TransportDefault.makeClientDelegateFactory( theOrb )) ; initializeTransport(theOrb) ; initializeNaming( theOrb ) ; initServiceContextRegistry( theOrb ) ; initRequestDispatcherRegistry( theOrb ) ; registerInitialReferences( theOrb ) ; persistentServerInitialization( theOrb ) ; runUserConfigurators( collector, theOrb ) ; } private void runUserConfigurators( DataCollector collector, ORB orb ) { // Run any pluggable configurators. This is a lot like // ORBInitializers, only it uses the internal ORB and has // access to all data for parsing. ConfigParser parser = new ConfigParser() ; parser.init( collector ) ; if (parser.userConfigurators != null) { for (int ctr=0; ctr