src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java

changeset 0
7ef37b2cdcad
child 748
6845b95cba6b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	Wed Apr 27 01:21:28 2016 +0800
     1.3 @@ -0,0 +1,1110 @@
     1.4 +/*
     1.5 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package com.sun.corba.se.impl.orb ;
    1.30 +
    1.31 +import java.net.URL ;
    1.32 +import java.net.InetSocketAddress;
    1.33 +import java.net.Socket ;
    1.34 +import java.net.ServerSocket ;
    1.35 +
    1.36 +import java.io.IOException ;
    1.37 +
    1.38 +import java.util.HashMap ;
    1.39 +import java.util.List;
    1.40 +import java.util.Map ;
    1.41 +
    1.42 +import java.security.AccessController ;
    1.43 +import java.security.PrivilegedExceptionAction ;
    1.44 +import java.security.PrivilegedActionException ;
    1.45 +
    1.46 +import org.omg.PortableInterceptor.ORBInitializer ;
    1.47 +import org.omg.PortableInterceptor.ORBInitInfo ;
    1.48 +
    1.49 +import com.sun.corba.se.pept.broker.Broker;
    1.50 +import com.sun.corba.se.pept.encoding.InputObject;
    1.51 +import com.sun.corba.se.pept.encoding.OutputObject;
    1.52 +import com.sun.corba.se.pept.protocol.MessageMediator;
    1.53 +import com.sun.corba.se.pept.transport.Acceptor;
    1.54 +import com.sun.corba.se.pept.transport.Connection;
    1.55 +import com.sun.corba.se.pept.transport.ContactInfo;
    1.56 +import com.sun.corba.se.pept.transport.ContactInfoList;
    1.57 +import com.sun.corba.se.pept.transport.EventHandler;
    1.58 +import com.sun.corba.se.pept.transport.InboundConnectionCache;
    1.59 +
    1.60 +import com.sun.corba.se.spi.ior.IOR ;
    1.61 +import com.sun.corba.se.spi.ior.ObjectKey ;
    1.62 +import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
    1.63 +import com.sun.corba.se.spi.logging.CORBALogDomains ;
    1.64 +import com.sun.corba.se.spi.orb.ORB;
    1.65 +import com.sun.corba.se.spi.orb.Operation ;
    1.66 +import com.sun.corba.se.spi.orb.OperationFactory ;
    1.67 +import com.sun.corba.se.spi.orb.ParserData ;
    1.68 +import com.sun.corba.se.spi.orb.ParserDataFactory ;
    1.69 +import com.sun.corba.se.spi.orb.StringPair ;
    1.70 +import com.sun.corba.se.spi.transport.CorbaContactInfoList;
    1.71 +import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
    1.72 +import com.sun.corba.se.spi.transport.CorbaTransportManager;
    1.73 +import com.sun.corba.se.spi.transport.IORToSocketInfo;
    1.74 +import com.sun.corba.se.spi.transport.ReadTimeouts;
    1.75 +import com.sun.corba.se.spi.transport.SocketInfo;
    1.76 +import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
    1.77 +import com.sun.corba.se.spi.transport.TransportDefault;
    1.78 +
    1.79 +import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
    1.80 +import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry ;
    1.81 +import com.sun.corba.se.impl.legacy.connection.USLPort ;
    1.82 +import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
    1.83 +import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
    1.84 +import com.sun.corba.se.impl.orbutil.ORBConstants ;
    1.85 +import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ;
    1.86 +import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ;
    1.87 +import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr ;
    1.88 +import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl;
    1.89 +import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl;
    1.90 +
    1.91 +import sun.corba.SharedSecrets;
    1.92 +
    1.93 +/** Initialize the parser data for the standard ORB parser.  This is used both
    1.94 + * to implement ORBDataParserImpl and to provide the basic testing framework
    1.95 + * for ORBDataParserImpl.
    1.96 + */
    1.97 +public class ParserTable {
    1.98 +    private static String MY_CLASS_NAME = ParserTable.class.getName() ;
    1.99 +
   1.100 +    private static ParserTable myInstance = new ParserTable() ;
   1.101 +
   1.102 +    private ORBUtilSystemException wrapper ;
   1.103 +
   1.104 +    public static ParserTable get()
   1.105 +    {
   1.106 +        return myInstance ;
   1.107 +    }
   1.108 +
   1.109 +    private ParserData[] parserData ;
   1.110 +
   1.111 +    public ParserData[] getParserData()
   1.112 +    {
   1.113 +        ParserData[] parserArray = new ParserData[parserData.length];
   1.114 +        System.arraycopy(parserData, 0, parserArray, 0, parserData.length);
   1.115 +        return parserArray;
   1.116 +    }
   1.117 +
   1.118 +    private ParserTable() {
   1.119 +        wrapper = ORBUtilSystemException.get( CORBALogDomains.ORB_LIFECYCLE ) ;
   1.120 +
   1.121 +        String codeSetTestString =
   1.122 +            OSFCodeSetRegistry.ISO_8859_1_VALUE + "," +
   1.123 +            OSFCodeSetRegistry.UTF_16_VALUE + "," +
   1.124 +            OSFCodeSetRegistry.ISO_646_VALUE ;
   1.125 +
   1.126 +        String[] debugTestData = { "subcontract", "poa", "transport" } ;
   1.127 +
   1.128 +        USLPort[] USLPorts = { new USLPort( "FOO", 2701 ), new USLPort( "BAR", 3333 ) } ;
   1.129 +
   1.130 +        ReadTimeouts readTimeouts =
   1.131 +               TransportDefault.makeReadTimeoutsFactory().create(
   1.132 +                    ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
   1.133 +                    ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
   1.134 +                    ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
   1.135 +                    ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR);
   1.136 +
   1.137 +        ORBInitializer[] TestORBInitializers =
   1.138 +            { null,
   1.139 +              new TestORBInitializer1(),
   1.140 +              new TestORBInitializer2() }  ;
   1.141 +        StringPair[] TestORBInitData = {
   1.142 +            new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
   1.143 +            new StringPair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ),
   1.144 +            new StringPair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ;
   1.145 +
   1.146 +        Acceptor[] TestAcceptors =
   1.147 +            { new TestAcceptor2(),
   1.148 +              new TestAcceptor1(),
   1.149 +              null }  ;
   1.150 +        // REVISIT: The test data gets put into a Properties object where
   1.151 +        // order is not guaranteed.  Thus the above array is in reverse.
   1.152 +        StringPair[] TestAcceptorData = {
   1.153 +            new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
   1.154 +            new StringPair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ),
   1.155 +            new StringPair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ;
   1.156 +
   1.157 +        StringPair[] TestORBInitRefData =
   1.158 +            { new StringPair( "Foo", "ior:930492049394" ),
   1.159 +              new StringPair( "Bar", "ior:3453465785633576" ) } ;
   1.160 +
   1.161 +        URL testServicesURL = null ;
   1.162 +        String testServicesString = "corbaloc::camelot/NameService" ;
   1.163 +
   1.164 +        try {
   1.165 +            testServicesURL = new URL( testServicesString )  ;
   1.166 +        } catch (Exception exc) {
   1.167 +        }
   1.168 +
   1.169 +        // propertyName,
   1.170 +        // operation,
   1.171 +        // fieldName, defaultValue,
   1.172 +        // testValue, testData (string or Pair[])
   1.173 +        ParserData[] pd = {
   1.174 +            ParserDataFactory.make( ORBConstants.DEBUG_PROPERTY,
   1.175 +                OperationFactory.listAction( ",", OperationFactory.stringAction()),
   1.176 +                "debugFlags", new String[0],
   1.177 +                debugTestData, "subcontract,poa,transport" ),
   1.178 +            ParserDataFactory.make( ORBConstants.INITIAL_HOST_PROPERTY,
   1.179 +                OperationFactory.stringAction(),
   1.180 +                "ORBInitialHost", "",
   1.181 +                "Foo", "Foo" ),
   1.182 +            ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY,
   1.183 +                OperationFactory.integerAction(),
   1.184 +                "ORBInitialPort", new Integer( ORBConstants.DEFAULT_INITIAL_PORT ),
   1.185 +                new Integer( 27314 ), "27314" ),
   1.186 +            // Where did this come from?
   1.187 +            //ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY,
   1.188 +                //OperationFactory.booleanAction(),
   1.189 +                //"ORBInitialPortInitialized", Boolean.FALSE,
   1.190 +                //Boolean.TRUE, "27314" ),
   1.191 +            ParserDataFactory.make( ORBConstants.SERVER_HOST_PROPERTY,
   1.192 +                OperationFactory.stringAction(),
   1.193 +                "ORBServerHost", "",
   1.194 +                "camelot", "camelot" ),
   1.195 +            ParserDataFactory.make( ORBConstants.SERVER_PORT_PROPERTY,
   1.196 +                OperationFactory.integerAction(),
   1.197 +                "ORBServerPort", new Integer( 0 ),
   1.198 +                new Integer( 38143 ), "38143" ),
   1.199 +            // NOTE: We are putting SERVER_HOST_NAME configuration info into
   1.200 +            // DataCollectorBase to avoid a security hole.  However, that forces
   1.201 +            // us to also set LISTEN_ON_ALL_INTERFACES at the same time.
   1.202 +            // This all needs to be cleaned up for two reasons: to get configuration
   1.203 +            // out of DataCollectorBase and to correctly support multihoming.
   1.204 +            ParserDataFactory.make( ORBConstants.LISTEN_ON_ALL_INTERFACES,
   1.205 +                OperationFactory.stringAction(),
   1.206 +                "listenOnAllInterfaces", ORBConstants.LISTEN_ON_ALL_INTERFACES,
   1.207 +                "foo", "foo" ),
   1.208 +            ParserDataFactory.make( ORBConstants.ORB_ID_PROPERTY,
   1.209 +                OperationFactory.stringAction(),
   1.210 +                "orbId", "",
   1.211 +                "foo", "foo" ),
   1.212 +            ParserDataFactory.make( ORBConstants.OLD_ORB_ID_PROPERTY,
   1.213 +                OperationFactory.stringAction(),
   1.214 +                "orbId", "",
   1.215 +                "foo", "foo" ),
   1.216 +            ParserDataFactory.make( ORBConstants.ORB_SERVER_ID_PROPERTY,
   1.217 +                OperationFactory.integerAction(),
   1.218 +                "persistentServerId", new Integer(-1),
   1.219 +                new Integer( 1234), "1234" ),
   1.220 +            ParserDataFactory.make(
   1.221 +                ORBConstants.ORB_SERVER_ID_PROPERTY,
   1.222 +                OperationFactory.setFlagAction(),
   1.223 +                "persistentServerIdInitialized", Boolean.FALSE,
   1.224 +                Boolean.TRUE, "1234" ),
   1.225 +            ParserDataFactory.make(
   1.226 +                ORBConstants.ORB_SERVER_ID_PROPERTY,
   1.227 +                OperationFactory.setFlagAction(),
   1.228 +                "orbServerIdPropertySpecified", Boolean.FALSE,
   1.229 +                Boolean.TRUE, "1234" ),
   1.230 +            // REVISIT after switch
   1.231 +            // ParserDataFactory.make( ORBConstants.INITIAL_SERVICES_PROPERTY,
   1.232 +                // OperationFactory.URLAction(),
   1.233 +                // "servicesURL", null,
   1.234 +                // testServicesURL, testServicesString ),
   1.235 +            // ParserDataFactory.make( ORBConstants.DEFAULT_INIT_REF_PROPERTY,
   1.236 +                // OperationFactory.stringAction(),
   1.237 +                // "defaultInitRef", null,
   1.238 +                // "Fooref", "Fooref" ),
   1.239 +            ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY,
   1.240 +                OperationFactory.integerAction(),
   1.241 +                "highWaterMark", new Integer( 240 ),
   1.242 +                new Integer( 3745 ), "3745" ),
   1.243 +            ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY,
   1.244 +                OperationFactory.integerAction(),
   1.245 +                "lowWaterMark", new Integer( 100 ),
   1.246 +                new Integer( 12 ), "12" ),
   1.247 +            ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY,
   1.248 +                OperationFactory.integerAction(),
   1.249 +                "numberToReclaim", new Integer( 5 ),
   1.250 +                new Integer( 231 ), "231" ),
   1.251 +            ParserDataFactory.make( ORBConstants.GIOP_VERSION,
   1.252 +                makeGVOperation(),
   1.253 +                "giopVersion", GIOPVersion.DEFAULT_VERSION,
   1.254 +                new GIOPVersion( 2, 3 ), "2.3" ),
   1.255 +            ParserDataFactory.make( ORBConstants.GIOP_FRAGMENT_SIZE,
   1.256 +                makeFSOperation(), "giopFragmentSize",
   1.257 +                new Integer( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ),
   1.258 +                new Integer( 65536 ), "65536" ),
   1.259 +            ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE,
   1.260 +                OperationFactory.integerAction(),
   1.261 +                "giopBufferSize", new Integer( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ),
   1.262 +                new Integer( 234000 ), "234000" ),
   1.263 +            ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR,
   1.264 +                makeBMGROperation(),
   1.265 +                "giop11BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ),
   1.266 +                new Integer( 1 ), "CLCT" ),
   1.267 +            ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR,
   1.268 +                makeBMGROperation(),
   1.269 +                "giop12BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ),
   1.270 +                new Integer( 0 ), "GROW" ),
   1.271 +
   1.272 +            // Note that the same property is used to set two different
   1.273 +            // fields here.  This requires that both entries use the same test
   1.274 +            // data, or the test will fail.
   1.275 +            ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
   1.276 +                OperationFactory.compose( OperationFactory.integerRangeAction( 0, 3 ),
   1.277 +                    OperationFactory.convertIntegerToShort() ),
   1.278 +                "giopTargetAddressPreference",
   1.279 +                new Short( ORBConstants.ADDR_DISP_HANDLE_ALL ),
   1.280 +                new Short( (short)2 ), "2" ),
   1.281 +            ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
   1.282 +                makeADOperation(),
   1.283 +                "giopAddressDisposition", new Short( KeyAddr.value ),
   1.284 +                new Short( (short)2 ), "2" ),
   1.285 +            ParserDataFactory.make( ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY,
   1.286 +                OperationFactory.booleanAction(),
   1.287 +                "alwaysSendCodeSetCtx", Boolean.TRUE,
   1.288 +                Boolean.FALSE, "false"),
   1.289 +            ParserDataFactory.make( ORBConstants.USE_BOMS,
   1.290 +                OperationFactory.booleanAction(),
   1.291 +                "useByteOrderMarkers",
   1.292 +                    Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS ),
   1.293 +                Boolean.FALSE, "false" ),
   1.294 +            ParserDataFactory.make( ORBConstants.USE_BOMS_IN_ENCAPS,
   1.295 +                OperationFactory.booleanAction(),
   1.296 +                "useByteOrderMarkersInEncaps",
   1.297 +                    Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS ),
   1.298 +                Boolean.FALSE, "false" ),
   1.299 +            ParserDataFactory.make( ORBConstants.CHAR_CODESETS,
   1.300 +                makeCSOperation(),
   1.301 +                "charData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(),
   1.302 +                CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ),
   1.303 +            ParserDataFactory.make( ORBConstants.WCHAR_CODESETS,
   1.304 +                makeCSOperation(),
   1.305 +                "wcharData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(),
   1.306 +                CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ),
   1.307 +            ParserDataFactory.make( ORBConstants.ALLOW_LOCAL_OPTIMIZATION,
   1.308 +                OperationFactory.booleanAction(),
   1.309 +                "allowLocalOptimization", Boolean.FALSE,
   1.310 +                Boolean.TRUE, "true" ),
   1.311 +            ParserDataFactory.make( ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY,
   1.312 +                makeLegacySocketFactoryOperation(),
   1.313 +                // No default - must be set by user if they are using
   1.314 +                // legacy socket factory.
   1.315 +                "legacySocketFactory", null,
   1.316 +                new TestLegacyORBSocketFactory(),
   1.317 +                MY_CLASS_NAME + "$TestLegacyORBSocketFactory" ),
   1.318 +            ParserDataFactory.make( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY,
   1.319 +                makeSocketFactoryOperation(),
   1.320 +                "socketFactory", new DefaultSocketFactoryImpl(),
   1.321 +                new TestORBSocketFactory(),
   1.322 +                MY_CLASS_NAME + "$TestORBSocketFactory" ),
   1.323 +            ParserDataFactory.make( ORBConstants.LISTEN_SOCKET_PROPERTY,
   1.324 +                makeUSLOperation() ,
   1.325 +                "userSpecifiedListenPorts", new USLPort[0],
   1.326 +                USLPorts, "FOO:2701,BAR:3333" ),
   1.327 +            ParserDataFactory.make( ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY,
   1.328 +                makeIORToSocketInfoOperation(),
   1.329 +                "iorToSocketInfo", new DefaultIORToSocketInfoImpl(),
   1.330 +                new TestIORToSocketInfo(),
   1.331 +                MY_CLASS_NAME + "$TestIORToSocketInfo" ),
   1.332 +            ParserDataFactory.make( ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY,
   1.333 +                makeIIOPPrimaryToContactInfoOperation(),
   1.334 +                "iiopPrimaryToContactInfo", null,
   1.335 +                new TestIIOPPrimaryToContactInfo(),
   1.336 +                MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo" ),
   1.337 +            ParserDataFactory.make( ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY,
   1.338 +                makeContactInfoListFactoryOperation(),
   1.339 +                "corbaContactInfoListFactory", null,
   1.340 +                new TestContactInfoListFactory(),
   1.341 +                MY_CLASS_NAME + "$TestContactInfoListFactory" ),
   1.342 +            ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
   1.343 +                OperationFactory.integerAction(),
   1.344 +                "persistentServerPort", new Integer( 0 ),
   1.345 +                new Integer( 2743 ), "2743" ),
   1.346 +            ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
   1.347 +                OperationFactory.setFlagAction(),
   1.348 +                "persistentPortInitialized", Boolean.FALSE,
   1.349 +                Boolean.TRUE, "2743" ),
   1.350 +            ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
   1.351 +                OperationFactory.integerAction(),
   1.352 +                "persistentServerId", new Integer( 0 ),
   1.353 +                new Integer( 294 ), "294" ),
   1.354 +            ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
   1.355 +                OperationFactory.setFlagAction(),
   1.356 +                "persistentServerIdInitialized", Boolean.FALSE,
   1.357 +                Boolean.TRUE, "294" ),
   1.358 +            ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
   1.359 +                OperationFactory.setFlagAction(),
   1.360 +                "orbServerIdPropertySpecified", Boolean.FALSE,
   1.361 +                Boolean.TRUE, "294" ),
   1.362 +            ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY,
   1.363 +                OperationFactory.booleanAction(),
   1.364 +                "serverIsORBActivated", Boolean.FALSE,
   1.365 +                Boolean.TRUE, "true" ),
   1.366 +            ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY,
   1.367 +                OperationFactory.classAction(),
   1.368 +                "badServerIdHandlerClass", null,
   1.369 +                TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler" ),
   1.370 +            ParserDataFactory.make( ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX,
   1.371 +                makeROIOperation(),
   1.372 +                "orbInitializers", new ORBInitializer[0],
   1.373 +                TestORBInitializers, TestORBInitData, ORBInitializer.class ),
   1.374 +            ParserDataFactory.make( ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY,
   1.375 +                makeAcceptorInstantiationOperation(),
   1.376 +                "acceptors", new Acceptor[0],
   1.377 +                TestAcceptors, TestAcceptorData, Acceptor.class ),
   1.378 +
   1.379 +            //
   1.380 +            // Socket/Channel control
   1.381 +            //
   1.382 +
   1.383 +            // Acceptor:
   1.384 +            // useNIOSelector == true
   1.385 +            //   useSelectThreadToWait = true
   1.386 +            //   useWorkerThreadForEvent = false
   1.387 +            // else
   1.388 +            //   useSelectThreadToWait = false
   1.389 +            //   useWorkerThreadForEvent = true
   1.390 +
   1.391 +            // Connection:
   1.392 +            // useNIOSelector == true
   1.393 +            //   useSelectThreadToWait = true
   1.394 +            //   useWorkerThreadForEvent = true
   1.395 +            // else
   1.396 +            //   useSelectThreadToWait = false
   1.397 +            //   useWorkerThreadForEvent = true
   1.398 +
   1.399 +            ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY,
   1.400 +                OperationFactory.stringAction(),
   1.401 +                "acceptorSocketType", ORBConstants.SOCKETCHANNEL,
   1.402 +                "foo", "foo" ),
   1.403 +
   1.404 +            ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY,
   1.405 +                OperationFactory.booleanAction(),
   1.406 +                "acceptorSocketUseSelectThreadToWait", Boolean.TRUE,
   1.407 +                Boolean.TRUE, "true" ),
   1.408 +            ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY,
   1.409 +                OperationFactory.booleanAction(),
   1.410 +                "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE,
   1.411 +                Boolean.TRUE, "true" ),
   1.412 +            ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY,
   1.413 +                OperationFactory.stringAction(),
   1.414 +                "connectionSocketType", ORBConstants.SOCKETCHANNEL,
   1.415 +                "foo", "foo" ),
   1.416 +            ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY,
   1.417 +                OperationFactory.booleanAction(),
   1.418 +                "connectionSocketUseSelectThreadToWait", Boolean.TRUE,
   1.419 +                Boolean.TRUE, "true" ),
   1.420 +            ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY,
   1.421 +                OperationFactory.booleanAction(),
   1.422 +                "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE,
   1.423 +                Boolean.TRUE, "true" ),
   1.424 +            ParserDataFactory.make( ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY,
   1.425 +                OperationFactory.booleanAction(),
   1.426 +                "disableDirectByteBufferUse", Boolean.FALSE,
   1.427 +                Boolean.TRUE, "true" ),
   1.428 +            ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY,
   1.429 +                makeTTCPRTOperation(),
   1.430 +                "readTimeouts",  TransportDefault.makeReadTimeoutsFactory().create(
   1.431 +                    ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
   1.432 +                    ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
   1.433 +                    ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
   1.434 +                    ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR),
   1.435 +                readTimeouts, "100:3000:300:20" ),
   1.436 +            ParserDataFactory.make(
   1.437 +                ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY,
   1.438 +                OperationFactory.booleanAction(),
   1.439 +                "enableJavaSerialization", Boolean.FALSE,
   1.440 +                Boolean.FALSE, "false"),
   1.441 +            ParserDataFactory.make(
   1.442 +                ORBConstants.USE_REP_ID,
   1.443 +                OperationFactory.booleanAction(),
   1.444 +                "useRepId", Boolean.TRUE,
   1.445 +                Boolean.TRUE, "true"),
   1.446 +            ParserDataFactory.make( ORBConstants.ORB_INIT_REF_PROPERTY,
   1.447 +                OperationFactory.identityAction(),
   1.448 +                "orbInitialReferences", new StringPair[0],
   1.449 +                TestORBInitRefData, TestORBInitRefData, StringPair.class )
   1.450 +        } ;
   1.451 +
   1.452 +        parserData = pd ;
   1.453 +    }
   1.454 +
   1.455 +    public final class TestBadServerIdHandler implements BadServerIdHandler
   1.456 +    {
   1.457 +        public boolean equals( Object other )
   1.458 +        {
   1.459 +            return other instanceof TestBadServerIdHandler ;
   1.460 +        }
   1.461 +
   1.462 +        public int hashCode() {
   1.463 +            return 1;
   1.464 +        }
   1.465 +
   1.466 +        public void handle( ObjectKey objectKey )
   1.467 +        {
   1.468 +        }
   1.469 +    }
   1.470 +
   1.471 +    private Operation makeTTCPRTOperation()
   1.472 +    {
   1.473 +        Operation[] fourIop = { OperationFactory.integerAction(),
   1.474 +                                OperationFactory.integerAction(),
   1.475 +                                OperationFactory.integerAction(),
   1.476 +                                OperationFactory.integerAction() } ;
   1.477 +
   1.478 +        Operation op2 = OperationFactory.sequenceAction( ":", fourIop ) ;
   1.479 +
   1.480 +        Operation rtOp = new Operation() {
   1.481 +            public Object operate(Object value)
   1.482 +            {
   1.483 +                Object[] values = (Object[])value ;
   1.484 +                Integer initialTime = (Integer)(values[0]) ;
   1.485 +                Integer maxGIOPHdrTime = (Integer)(values[1]) ;
   1.486 +                Integer maxGIOPBodyTime = (Integer)(values[2]) ;
   1.487 +                Integer backoffPercent = (Integer)(values[3]) ;
   1.488 +                return TransportDefault.makeReadTimeoutsFactory().create(
   1.489 +                                                   initialTime.intValue(),
   1.490 +                                                   maxGIOPHdrTime.intValue(),
   1.491 +                                                   maxGIOPBodyTime.intValue(),
   1.492 +                                                   backoffPercent.intValue());
   1.493 +            }
   1.494 +        } ;
   1.495 +
   1.496 +        Operation ttcprtOp = OperationFactory.compose(op2, rtOp);
   1.497 +        return ttcprtOp;
   1.498 +    }
   1.499 +
   1.500 +    private Operation makeUSLOperation()
   1.501 +    {
   1.502 +        Operation[] siop = { OperationFactory.stringAction(),
   1.503 +            OperationFactory.integerAction() } ;
   1.504 +        Operation op2 = OperationFactory.sequenceAction( ":", siop ) ;
   1.505 +
   1.506 +        Operation uslop = new Operation() {
   1.507 +            public Object operate( Object value )
   1.508 +            {
   1.509 +                Object[] values = (Object[])value ;
   1.510 +                String type = (String)(values[0]) ;
   1.511 +                Integer port = (Integer)(values[1]) ;
   1.512 +                return new USLPort( type, port.intValue() ) ;
   1.513 +            }
   1.514 +        } ;
   1.515 +
   1.516 +        Operation op3 = OperationFactory.compose( op2, uslop ) ;
   1.517 +        Operation listenop = OperationFactory.listAction( ",", op3 ) ;
   1.518 +        return listenop ;
   1.519 +    }
   1.520 +
   1.521 +    public static final class TestLegacyORBSocketFactory
   1.522 +        implements com.sun.corba.se.spi.legacy.connection.ORBSocketFactory
   1.523 +    {
   1.524 +        public boolean equals( Object other )
   1.525 +        {
   1.526 +            return other instanceof TestLegacyORBSocketFactory ;
   1.527 +        }
   1.528 +
   1.529 +        public int hashCode() {
   1.530 +            return 1;
   1.531 +        }
   1.532 +
   1.533 +        public ServerSocket createServerSocket( String type, int port )
   1.534 +        {
   1.535 +            return null ;
   1.536 +        }
   1.537 +
   1.538 +        public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb,
   1.539 +            IOR ior, SocketInfo socketInfo )
   1.540 +        {
   1.541 +            return null ;
   1.542 +        }
   1.543 +
   1.544 +        public Socket createSocket( SocketInfo socketInfo )
   1.545 +        {
   1.546 +            return null ;
   1.547 +        }
   1.548 +    }
   1.549 +
   1.550 +    public static final class TestORBSocketFactory
   1.551 +        implements com.sun.corba.se.spi.transport.ORBSocketFactory
   1.552 +    {
   1.553 +        public boolean equals( Object other )
   1.554 +        {
   1.555 +            return other instanceof TestORBSocketFactory ;
   1.556 +        }
   1.557 +
   1.558 +        public int hashCode() {
   1.559 +            return 1;
   1.560 +        }
   1.561 +
   1.562 +        public void setORB(ORB orb)
   1.563 +        {
   1.564 +        }
   1.565 +
   1.566 +        public ServerSocket createServerSocket( String type, InetSocketAddress a )
   1.567 +        {
   1.568 +            return null ;
   1.569 +        }
   1.570 +
   1.571 +        public Socket createSocket( String type, InetSocketAddress a )
   1.572 +        {
   1.573 +            return null ;
   1.574 +        }
   1.575 +
   1.576 +        public void setAcceptedSocketOptions(Acceptor acceptor,
   1.577 +                                             ServerSocket serverSocket,
   1.578 +                                             Socket socket)
   1.579 +        {
   1.580 +        }
   1.581 +    }
   1.582 +
   1.583 +    public static final class TestIORToSocketInfo
   1.584 +        implements IORToSocketInfo
   1.585 +    {
   1.586 +        public boolean equals( Object other )
   1.587 +        {
   1.588 +            return other instanceof TestIORToSocketInfo;
   1.589 +        }
   1.590 +
   1.591 +        public int hashCode() {
   1.592 +            return 1;
   1.593 +        }
   1.594 +
   1.595 +        public List getSocketInfo(IOR ior)
   1.596 +        {
   1.597 +            return null;
   1.598 +        }
   1.599 +    }
   1.600 +
   1.601 +    public static final class TestIIOPPrimaryToContactInfo
   1.602 +        implements IIOPPrimaryToContactInfo
   1.603 +    {
   1.604 +        public void reset(ContactInfo primary)
   1.605 +        {
   1.606 +        }
   1.607 +
   1.608 +        public boolean hasNext(ContactInfo primary,
   1.609 +                               ContactInfo previous,
   1.610 +                               List contactInfos)
   1.611 +        {
   1.612 +            return true;
   1.613 +        }
   1.614 +
   1.615 +        public ContactInfo next(ContactInfo primary,
   1.616 +                                ContactInfo previous,
   1.617 +                                List contactInfos)
   1.618 +        {
   1.619 +            return null;
   1.620 +        }
   1.621 +    }
   1.622 +
   1.623 +    public static final class TestContactInfoListFactory
   1.624 +        implements CorbaContactInfoListFactory
   1.625 +    {
   1.626 +        public boolean equals( Object other )
   1.627 +        {
   1.628 +            return other instanceof TestContactInfoListFactory;
   1.629 +        }
   1.630 +
   1.631 +        public int hashCode() {
   1.632 +            return 1;
   1.633 +        }
   1.634 +
   1.635 +        public void setORB(ORB orb) { }
   1.636 +
   1.637 +        public CorbaContactInfoList create( IOR ior ) { return null; }
   1.638 +    }
   1.639 +
   1.640 +    private Operation makeMapOperation( final Map map )
   1.641 +    {
   1.642 +        return new Operation() {
   1.643 +            public Object operate( Object value )
   1.644 +            {
   1.645 +                return map.get( value ) ;
   1.646 +            }
   1.647 +        } ;
   1.648 +    }
   1.649 +
   1.650 +    private Operation makeBMGROperation()
   1.651 +    {
   1.652 +        Map map = new HashMap() ;
   1.653 +        map.put( "GROW", new Integer(0) ) ;
   1.654 +        map.put( "CLCT", new Integer(1) ) ;
   1.655 +        map.put( "STRM", new Integer(2) ) ;
   1.656 +        return makeMapOperation( map ) ;
   1.657 +    }
   1.658 +
   1.659 +    private Operation makeLegacySocketFactoryOperation()
   1.660 +    {
   1.661 +        Operation sfop = new Operation() {
   1.662 +            public Object operate( Object value )
   1.663 +            {
   1.664 +                String param = (String)value ;
   1.665 +
   1.666 +                try {
   1.667 +                    Class<?> legacySocketFactoryClass =
   1.668 +                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
   1.669 +                    // For security reasons avoid creating an instance if
   1.670 +                    // this socket factory class is not one that would fail
   1.671 +                    // the class cast anyway.
   1.672 +                    if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
   1.673 +                        return legacySocketFactoryClass.newInstance();
   1.674 +                    } else {
   1.675 +                        throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
   1.676 +                    }
   1.677 +                } catch (Exception ex) {
   1.678 +                    // ClassNotFoundException, IllegalAccessException,
   1.679 +                    // InstantiationException, SecurityException or
   1.680 +                    // ClassCastException
   1.681 +                    throw wrapper.badCustomSocketFactory( ex, param ) ;
   1.682 +                }
   1.683 +            }
   1.684 +        } ;
   1.685 +
   1.686 +        return sfop ;
   1.687 +    }
   1.688 +
   1.689 +    private Operation makeSocketFactoryOperation()
   1.690 +    {
   1.691 +        Operation sfop = new Operation() {
   1.692 +            public Object operate( Object value )
   1.693 +            {
   1.694 +                String param = (String)value ;
   1.695 +
   1.696 +                try {
   1.697 +                    Class<?> socketFactoryClass =
   1.698 +                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
   1.699 +                    // For security reasons avoid creating an instance if
   1.700 +                    // this socket factory class is not one that would fail
   1.701 +                    // the class cast anyway.
   1.702 +                    if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
   1.703 +                        return socketFactoryClass.newInstance();
   1.704 +                    } else {
   1.705 +                        throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
   1.706 +                    }
   1.707 +                } catch (Exception ex) {
   1.708 +                    // ClassNotFoundException, IllegalAccessException,
   1.709 +                    // InstantiationException, SecurityException or
   1.710 +                    // ClassCastException
   1.711 +                    throw wrapper.badCustomSocketFactory( ex, param ) ;
   1.712 +                }
   1.713 +            }
   1.714 +        } ;
   1.715 +
   1.716 +        return sfop ;
   1.717 +    }
   1.718 +
   1.719 +    private Operation makeIORToSocketInfoOperation()
   1.720 +    {
   1.721 +        Operation op = new Operation() {
   1.722 +            public Object operate( Object value )
   1.723 +            {
   1.724 +                String param = (String)value ;
   1.725 +
   1.726 +                try {
   1.727 +                    Class<?> iorToSocketInfoClass =
   1.728 +                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
   1.729 +                    // For security reasons avoid creating an instance if
   1.730 +                    // this socket factory class is not one that would fail
   1.731 +                    // the class cast anyway.
   1.732 +                    if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
   1.733 +                        return iorToSocketInfoClass.newInstance();
   1.734 +                    } else {
   1.735 +                        throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
   1.736 +                    }
   1.737 +                } catch (Exception ex) {
   1.738 +                    // ClassNotFoundException, IllegalAccessException,
   1.739 +                    // InstantiationException, SecurityException or
   1.740 +                    // ClassCastException
   1.741 +                    throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
   1.742 +                }
   1.743 +            }
   1.744 +        } ;
   1.745 +
   1.746 +        return op ;
   1.747 +    }
   1.748 +
   1.749 +    private Operation makeIIOPPrimaryToContactInfoOperation()
   1.750 +    {
   1.751 +        Operation op = new Operation() {
   1.752 +            public Object operate( Object value )
   1.753 +            {
   1.754 +                String param = (String)value ;
   1.755 +
   1.756 +                try {
   1.757 +                    Class<?> iiopPrimaryToContactInfoClass =
   1.758 +                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
   1.759 +                    // For security reasons avoid creating an instance if
   1.760 +                    // this socket factory class is not one that would fail
   1.761 +                    // the class cast anyway.
   1.762 +                    if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
   1.763 +                        return iiopPrimaryToContactInfoClass.newInstance();
   1.764 +                    } else {
   1.765 +                        throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
   1.766 +                    }
   1.767 +                } catch (Exception ex) {
   1.768 +                    // ClassNotFoundException, IllegalAccessException,
   1.769 +                    // InstantiationException, SecurityException or
   1.770 +                    // ClassCastException
   1.771 +                    throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
   1.772 +                }
   1.773 +            }
   1.774 +        } ;
   1.775 +
   1.776 +        return op ;
   1.777 +    }
   1.778 +
   1.779 +    private Operation makeContactInfoListFactoryOperation()
   1.780 +    {
   1.781 +        Operation op = new Operation() {
   1.782 +            public Object operate( Object value )
   1.783 +            {
   1.784 +                String param = (String)value ;
   1.785 +
   1.786 +                try {
   1.787 +                    Class<?> contactInfoListFactoryClass =
   1.788 +                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
   1.789 +                    // For security reasons avoid creating an instance if
   1.790 +                    // this socket factory class is not one that would fail
   1.791 +                    // the class cast anyway.
   1.792 +                    if (CorbaContactInfoListFactory.class.isAssignableFrom(
   1.793 +                        contactInfoListFactoryClass)) {
   1.794 +                        return contactInfoListFactoryClass.newInstance();
   1.795 +                    } else {
   1.796 +                        throw wrapper.illegalContactInfoListFactoryType(
   1.797 +                            contactInfoListFactoryClass.toString() ) ;
   1.798 +                    }
   1.799 +                } catch (Exception ex) {
   1.800 +                    // ClassNotFoundException, IllegalAccessException,
   1.801 +                    // InstantiationException, SecurityException or
   1.802 +                    // ClassCastException
   1.803 +                    throw wrapper.badContactInfoListFactory( ex, param ) ;
   1.804 +                }
   1.805 +            }
   1.806 +        } ;
   1.807 +
   1.808 +        return op ;
   1.809 +    }
   1.810 +
   1.811 +    private Operation makeCSOperation()
   1.812 +    {
   1.813 +        Operation csop = new Operation() {
   1.814 +            public Object operate( Object value )
   1.815 +            {
   1.816 +                String val = (String)value ;
   1.817 +                return CodeSetComponentInfo.createFromString( val ) ;
   1.818 +            }
   1.819 +        } ;
   1.820 +
   1.821 +        return csop ;
   1.822 +    }
   1.823 +
   1.824 +    private Operation makeADOperation()
   1.825 +    {
   1.826 +        Operation admap = new Operation() {
   1.827 +            private Integer[] map = {
   1.828 +                new Integer( KeyAddr.value ),
   1.829 +                new Integer( ProfileAddr.value ),
   1.830 +                new Integer( ReferenceAddr.value ),
   1.831 +                new Integer( KeyAddr.value ) } ;
   1.832 +
   1.833 +            public Object operate( Object value )
   1.834 +            {
   1.835 +                int val = ((Integer)value).intValue() ;
   1.836 +                return map[val] ;
   1.837 +            }
   1.838 +        } ;
   1.839 +
   1.840 +        Operation rangeop = OperationFactory.integerRangeAction( 0, 3 ) ;
   1.841 +        Operation op1 = OperationFactory.compose( rangeop, admap ) ;
   1.842 +        Operation result = OperationFactory.compose( op1, OperationFactory.convertIntegerToShort() ) ;
   1.843 +        return result ;
   1.844 +    }
   1.845 +
   1.846 +    private Operation makeFSOperation() {
   1.847 +        Operation fschecker = new Operation() {
   1.848 +            public Object operate( Object value )
   1.849 +            {
   1.850 +                int giopFragmentSize = ((Integer)value).intValue() ;
   1.851 +                if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){
   1.852 +                    throw wrapper.fragmentSizeMinimum( new Integer( giopFragmentSize ),
   1.853 +                        new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ;
   1.854 +                }
   1.855 +
   1.856 +                if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0)
   1.857 +                    throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ),
   1.858 +                            new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ;
   1.859 +
   1.860 +                return value ;
   1.861 +            }
   1.862 +        } ;
   1.863 +
   1.864 +        Operation result = OperationFactory.compose( OperationFactory.integerAction(),
   1.865 +            fschecker ) ;
   1.866 +        return result ;
   1.867 +    }
   1.868 +
   1.869 +    private Operation makeGVOperation() {
   1.870 +        Operation gvHelper = OperationFactory.listAction( ".",
   1.871 +            OperationFactory.integerAction() ) ;
   1.872 +        Operation gvMain = new Operation() {
   1.873 +            public Object operate( Object value )
   1.874 +            {
   1.875 +                Object[] nums = (Object[])value ;
   1.876 +                int major = ((Integer)(nums[0])).intValue() ;
   1.877 +                int minor = ((Integer)(nums[1])).intValue() ;
   1.878 +
   1.879 +                return new GIOPVersion( major, minor ) ;
   1.880 +            }
   1.881 +        } ;
   1.882 +
   1.883 +        Operation result = OperationFactory.compose( gvHelper, gvMain );
   1.884 +        return result ;
   1.885 +    }
   1.886 +
   1.887 +    public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject
   1.888 +        implements ORBInitializer
   1.889 +    {
   1.890 +        public boolean equals( Object other )
   1.891 +        {
   1.892 +            return other instanceof TestORBInitializer1 ;
   1.893 +        }
   1.894 +
   1.895 +        public int hashCode() {
   1.896 +            return 1;
   1.897 +        }
   1.898 +
   1.899 +        public void pre_init( ORBInitInfo info )
   1.900 +        {
   1.901 +        }
   1.902 +
   1.903 +        public void post_init( ORBInitInfo info )
   1.904 +        {
   1.905 +        }
   1.906 +    }
   1.907 +
   1.908 +    public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject
   1.909 +        implements ORBInitializer
   1.910 +    {
   1.911 +        public boolean equals( Object other )
   1.912 +        {
   1.913 +            return other instanceof TestORBInitializer2 ;
   1.914 +        }
   1.915 +
   1.916 +        public int hashCode() {
   1.917 +            return 1;
   1.918 +        }
   1.919 +
   1.920 +        public void pre_init( ORBInitInfo info )
   1.921 +        {
   1.922 +        }
   1.923 +
   1.924 +        public void post_init( ORBInitInfo info )
   1.925 +        {
   1.926 +        }
   1.927 +    }
   1.928 +
   1.929 +    private Operation makeROIOperation() {
   1.930 +        Operation clsop = OperationFactory.classAction() ;
   1.931 +        Operation indexOp = OperationFactory.suffixAction() ;
   1.932 +        Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
   1.933 +        Operation mop = OperationFactory.maskErrorAction( op1 ) ;
   1.934 +
   1.935 +        Operation mkinst = new Operation() {
   1.936 +            public Object operate( Object value )
   1.937 +            {
   1.938 +                final Class initClass = (Class)value ;
   1.939 +                if (initClass == null)
   1.940 +                    return null ;
   1.941 +
   1.942 +                // For security reasons avoid creating an instance
   1.943 +                // if this class is one that would fail the class cast
   1.944 +                // to ORBInitializer anyway.
   1.945 +                if( org.omg.PortableInterceptor.ORBInitializer.class.isAssignableFrom(
   1.946 +                    initClass ) ) {
   1.947 +                    // Now that we have a class object, instantiate one and
   1.948 +                    // remember it:
   1.949 +                    ORBInitializer initializer = null ;
   1.950 +
   1.951 +                    try {
   1.952 +                        initializer = (ORBInitializer)AccessController.doPrivileged(
   1.953 +                            new PrivilegedExceptionAction() {
   1.954 +                                public Object run()
   1.955 +                                    throws InstantiationException, IllegalAccessException
   1.956 +                                {
   1.957 +                                    return initClass.newInstance() ;
   1.958 +                                }
   1.959 +                            }
   1.960 +                        ) ;
   1.961 +                    } catch (PrivilegedActionException exc) {
   1.962 +                        // Unwrap the exception, as we don't care exc here
   1.963 +                        throw wrapper.orbInitializerFailure( exc.getException(),
   1.964 +                            initClass.getName() ) ;
   1.965 +                    } catch (Exception exc) {
   1.966 +                        throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ;
   1.967 +                    }
   1.968 +
   1.969 +                    return initializer ;
   1.970 +                } else {
   1.971 +                    throw wrapper.orbInitializerType( initClass.getName() ) ;
   1.972 +                }
   1.973 +            }
   1.974 +        } ;
   1.975 +
   1.976 +        Operation result = OperationFactory.compose( mop, mkinst ) ;
   1.977 +
   1.978 +        return result ;
   1.979 +    }
   1.980 +
   1.981 +    public static final class TestAcceptor1
   1.982 +        implements Acceptor
   1.983 +    {
   1.984 +        public boolean equals( Object other )
   1.985 +        {
   1.986 +            return other instanceof TestAcceptor1 ;
   1.987 +        }
   1.988 +
   1.989 +        public int hashCode() { return 1; }
   1.990 +        public boolean initialize() { return true; }
   1.991 +        public boolean initialized() { return true; }
   1.992 +        public String getConnectionCacheType() { return "FOO"; }
   1.993 +        public void setConnectionCache(InboundConnectionCache connectionCache){}
   1.994 +        public InboundConnectionCache getConnectionCache() { return null; }
   1.995 +        public boolean shouldRegisterAcceptEvent() { return true; }
   1.996 +        public void setUseSelectThreadForConnections(boolean x) { }
   1.997 +        public boolean shouldUseSelectThreadForConnections() { return true; }
   1.998 +        public void setUseWorkerThreadForConnections(boolean x) { }
   1.999 +        public boolean shouldUseWorkerThreadForConnections() { return true; }
  1.1000 +        public void accept() { }
  1.1001 +        public void close() { }
  1.1002 +        public EventHandler getEventHandler() { return null; }
  1.1003 +        public MessageMediator createMessageMediator(
  1.1004 +            Broker xbroker, Connection xconnection) { return null; }
  1.1005 +        public MessageMediator finishCreatingMessageMediator(
  1.1006 +            Broker xbroker, Connection xconnection,
  1.1007 +            MessageMediator messageMediator) { return null; }
  1.1008 +        public InputObject createInputObject(
  1.1009 +            Broker broker, MessageMediator messageMediator) { return null; }
  1.1010 +        public OutputObject createOutputObject(
  1.1011 +            Broker broker, MessageMediator messageMediator) { return null; }
  1.1012 +    }
  1.1013 +
  1.1014 +    public static final class TestAcceptor2
  1.1015 +        implements Acceptor
  1.1016 +    {
  1.1017 +        public boolean equals( Object other )
  1.1018 +        {
  1.1019 +            return other instanceof TestAcceptor2 ;
  1.1020 +        }
  1.1021 +        public int hashCode() { return 1; }
  1.1022 +        public boolean initialize() { return true; }
  1.1023 +        public boolean initialized() { return true; }
  1.1024 +        public String getConnectionCacheType() { return "FOO"; }
  1.1025 +        public void setConnectionCache(InboundConnectionCache connectionCache){}
  1.1026 +        public InboundConnectionCache getConnectionCache() { return null; }
  1.1027 +        public boolean shouldRegisterAcceptEvent() { return true; }
  1.1028 +        public void setUseSelectThreadForConnections(boolean x) { }
  1.1029 +        public boolean shouldUseSelectThreadForConnections() { return true; }
  1.1030 +        public void setUseWorkerThreadForConnections(boolean x) { }
  1.1031 +        public boolean shouldUseWorkerThreadForConnections() { return true; }
  1.1032 +        public void accept() { }
  1.1033 +        public void close() { }
  1.1034 +        public EventHandler getEventHandler() { return null; }
  1.1035 +        public MessageMediator createMessageMediator(
  1.1036 +            Broker xbroker, Connection xconnection) { return null; }
  1.1037 +        public MessageMediator finishCreatingMessageMediator(
  1.1038 +            Broker xbroker, Connection xconnection,
  1.1039 +            MessageMediator messageMediator) { return null; }
  1.1040 +        public InputObject createInputObject(
  1.1041 +            Broker broker, MessageMediator messageMediator) { return null; }
  1.1042 +        public OutputObject createOutputObject(
  1.1043 +            Broker broker, MessageMediator messageMediator) { return null; }
  1.1044 +    }
  1.1045 +
  1.1046 +    // REVISIT - this is a cut and paste modification of makeROIOperation.
  1.1047 +    private Operation makeAcceptorInstantiationOperation() {
  1.1048 +        Operation clsop = OperationFactory.classAction() ;
  1.1049 +        Operation indexOp = OperationFactory.suffixAction() ;
  1.1050 +        Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
  1.1051 +        Operation mop = OperationFactory.maskErrorAction( op1 ) ;
  1.1052 +
  1.1053 +        Operation mkinst = new Operation() {
  1.1054 +            public Object operate( Object value )
  1.1055 +            {
  1.1056 +                final Class initClass = (Class)value ;
  1.1057 +                if (initClass == null)
  1.1058 +                    return null ;
  1.1059 +
  1.1060 +                // For security reasons avoid creating an instance
  1.1061 +                // if this class is one that would fail the class cast
  1.1062 +                // to ORBInitializer anyway.
  1.1063 +                if( Acceptor.class.isAssignableFrom( initClass ) ) {
  1.1064 +                    // Now that we have a class object, instantiate one and
  1.1065 +                    // remember it:
  1.1066 +                    Acceptor acceptor = null ;
  1.1067 +
  1.1068 +                    try {
  1.1069 +                        acceptor = (Acceptor)AccessController.doPrivileged(
  1.1070 +                            new PrivilegedExceptionAction() {
  1.1071 +                                public Object run()
  1.1072 +                                    throws InstantiationException, IllegalAccessException
  1.1073 +                                {
  1.1074 +                                    return initClass.newInstance() ;
  1.1075 +                                }
  1.1076 +                            }
  1.1077 +                        ) ;
  1.1078 +                    } catch (PrivilegedActionException exc) {
  1.1079 +                        // Unwrap the exception, as we don't care exc here
  1.1080 +                        throw wrapper.acceptorInstantiationFailure( exc.getException(),
  1.1081 +                            initClass.getName() ) ;
  1.1082 +                    } catch (Exception exc) {
  1.1083 +                        throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ;
  1.1084 +                    }
  1.1085 +
  1.1086 +                    return acceptor ;
  1.1087 +                } else {
  1.1088 +                    throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ;
  1.1089 +                }
  1.1090 +            }
  1.1091 +        } ;
  1.1092 +
  1.1093 +        Operation result = OperationFactory.compose( mop, mkinst ) ;
  1.1094 +
  1.1095 +        return result ;
  1.1096 +    }
  1.1097 +
  1.1098 +    private Operation makeInitRefOperation() {
  1.1099 +        return new Operation() {
  1.1100 +            public Object operate( Object value )
  1.1101 +            {
  1.1102 +                // Object is String[] of length 2.
  1.1103 +                String[] values = (String[])value ;
  1.1104 +                if (values.length != 2)
  1.1105 +                    throw wrapper.orbInitialreferenceSyntax() ;
  1.1106 +
  1.1107 +                return values[0] + "=" + values[1] ;
  1.1108 +            }
  1.1109 +        } ;
  1.1110 +    }
  1.1111 +}
  1.1112 +
  1.1113 +// End of file.

mercurial