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