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

Wed, 28 Mar 2012 02:50:50 -0700

author
mbankal
date
Wed, 28 Mar 2012 02:50:50 -0700
changeset 371
e324dfb90c9e
parent 158
91006f157c46
child 473
5845df371e25
child 475
39d15bbb5741
permissions
-rw-r--r--

7079902: Refine CORBA data models
Reviewed-by: coffeys

duke@1 1 /*
mbankal@371 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@158 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@158 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@158 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 * or visit www.oracle.com if you need additional information or have any
ohair@158 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.corba.se.impl.orb ;
duke@1 27
duke@1 28 import java.net.URL ;
duke@1 29 import java.net.InetSocketAddress;
duke@1 30 import java.net.Socket ;
duke@1 31 import java.net.ServerSocket ;
duke@1 32
duke@1 33 import java.io.IOException ;
duke@1 34
duke@1 35 import java.util.HashMap ;
duke@1 36 import java.util.List;
duke@1 37 import java.util.Map ;
duke@1 38
duke@1 39 import java.security.AccessController ;
duke@1 40 import java.security.PrivilegedExceptionAction ;
duke@1 41 import java.security.PrivilegedActionException ;
duke@1 42
duke@1 43 import org.omg.PortableInterceptor.ORBInitializer ;
duke@1 44 import org.omg.PortableInterceptor.ORBInitInfo ;
duke@1 45
duke@1 46 import com.sun.corba.se.pept.broker.Broker;
duke@1 47 import com.sun.corba.se.pept.encoding.InputObject;
duke@1 48 import com.sun.corba.se.pept.encoding.OutputObject;
duke@1 49 import com.sun.corba.se.pept.protocol.MessageMediator;
duke@1 50 import com.sun.corba.se.pept.transport.Acceptor;
duke@1 51 import com.sun.corba.se.pept.transport.Connection;
duke@1 52 import com.sun.corba.se.pept.transport.ContactInfo;
duke@1 53 import com.sun.corba.se.pept.transport.ContactInfoList;
duke@1 54 import com.sun.corba.se.pept.transport.EventHandler;
duke@1 55 import com.sun.corba.se.pept.transport.InboundConnectionCache;
duke@1 56
duke@1 57 import com.sun.corba.se.spi.ior.IOR ;
duke@1 58 import com.sun.corba.se.spi.ior.ObjectKey ;
duke@1 59 import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
duke@1 60 import com.sun.corba.se.spi.logging.CORBALogDomains ;
duke@1 61 import com.sun.corba.se.spi.orb.ORB;
duke@1 62 import com.sun.corba.se.spi.orb.Operation ;
duke@1 63 import com.sun.corba.se.spi.orb.OperationFactory ;
duke@1 64 import com.sun.corba.se.spi.orb.ParserData ;
duke@1 65 import com.sun.corba.se.spi.orb.ParserDataFactory ;
duke@1 66 import com.sun.corba.se.spi.orb.StringPair ;
duke@1 67 import com.sun.corba.se.spi.transport.CorbaContactInfoList;
duke@1 68 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
duke@1 69 import com.sun.corba.se.spi.transport.CorbaTransportManager;
duke@1 70 import com.sun.corba.se.spi.transport.IORToSocketInfo;
duke@1 71 import com.sun.corba.se.spi.transport.ReadTimeouts;
duke@1 72 import com.sun.corba.se.spi.transport.SocketInfo;
duke@1 73 import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
duke@1 74 import com.sun.corba.se.spi.transport.TransportDefault;
duke@1 75
duke@1 76 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
duke@1 77 import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry ;
duke@1 78 import com.sun.corba.se.impl.legacy.connection.USLPort ;
duke@1 79 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
duke@1 80 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
duke@1 81 import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
duke@1 82 import com.sun.corba.se.impl.orbutil.ORBConstants ;
duke@1 83 import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ;
duke@1 84 import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ;
duke@1 85 import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr ;
duke@1 86 import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl;
duke@1 87 import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl;
duke@1 88
duke@1 89 /** Initialize the parser data for the standard ORB parser. This is used both
duke@1 90 * to implement ORBDataParserImpl and to provide the basic testing framework
duke@1 91 * for ORBDataParserImpl.
duke@1 92 */
duke@1 93 public class ParserTable {
duke@1 94 private static String MY_CLASS_NAME = ParserTable.class.getName() ;
duke@1 95
duke@1 96 private static ParserTable myInstance = new ParserTable() ;
duke@1 97
duke@1 98 private ORBUtilSystemException wrapper ;
duke@1 99
duke@1 100 public static ParserTable get()
duke@1 101 {
duke@1 102 return myInstance ;
duke@1 103 }
duke@1 104
duke@1 105 private ParserData[] parserData ;
duke@1 106
duke@1 107 public ParserData[] getParserData()
duke@1 108 {
mbankal@371 109 ParserData[] parserArray = new ParserData[parserData.length];
mbankal@371 110 System.arraycopy(parserData, 0, parserArray, 0, parserData.length);
mbankal@371 111 return parserArray;
duke@1 112 }
duke@1 113
duke@1 114 private ParserTable() {
duke@1 115 wrapper = ORBUtilSystemException.get( CORBALogDomains.ORB_LIFECYCLE ) ;
duke@1 116
duke@1 117 String codeSetTestString =
duke@1 118 OSFCodeSetRegistry.ISO_8859_1_VALUE + "," +
duke@1 119 OSFCodeSetRegistry.UTF_16_VALUE + "," +
duke@1 120 OSFCodeSetRegistry.ISO_646_VALUE ;
duke@1 121
duke@1 122 String[] debugTestData = { "subcontract", "poa", "transport" } ;
duke@1 123
duke@1 124 USLPort[] USLPorts = { new USLPort( "FOO", 2701 ), new USLPort( "BAR", 3333 ) } ;
duke@1 125
duke@1 126 ReadTimeouts readTimeouts =
duke@1 127 TransportDefault.makeReadTimeoutsFactory().create(
duke@1 128 ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
duke@1 129 ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
duke@1 130 ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
duke@1 131 ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR);
duke@1 132
duke@1 133 ORBInitializer[] TestORBInitializers =
duke@1 134 { null,
duke@1 135 new TestORBInitializer1(),
duke@1 136 new TestORBInitializer2() } ;
duke@1 137 StringPair[] TestORBInitData = {
duke@1 138 new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
duke@1 139 new StringPair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ),
duke@1 140 new StringPair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ;
duke@1 141
duke@1 142 Acceptor[] TestAcceptors =
duke@1 143 { new TestAcceptor2(),
duke@1 144 new TestAcceptor1(),
duke@1 145 null } ;
duke@1 146 // REVISIT: The test data gets put into a Properties object where
duke@1 147 // order is not guaranteed. Thus the above array is in reverse.
duke@1 148 StringPair[] TestAcceptorData = {
duke@1 149 new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
duke@1 150 new StringPair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ),
duke@1 151 new StringPair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ;
duke@1 152
duke@1 153 StringPair[] TestORBInitRefData =
duke@1 154 { new StringPair( "Foo", "ior:930492049394" ),
duke@1 155 new StringPair( "Bar", "ior:3453465785633576" ) } ;
duke@1 156
duke@1 157 URL testServicesURL = null ;
duke@1 158 String testServicesString = "corbaloc::camelot/NameService" ;
duke@1 159
duke@1 160 try {
duke@1 161 testServicesURL = new URL( testServicesString ) ;
duke@1 162 } catch (Exception exc) {
duke@1 163 }
duke@1 164
duke@1 165 // propertyName,
duke@1 166 // operation,
duke@1 167 // fieldName, defaultValue,
duke@1 168 // testValue, testData (string or Pair[])
duke@1 169 ParserData[] pd = {
duke@1 170 ParserDataFactory.make( ORBConstants.DEBUG_PROPERTY,
duke@1 171 OperationFactory.listAction( ",", OperationFactory.stringAction()),
duke@1 172 "debugFlags", new String[0],
duke@1 173 debugTestData, "subcontract,poa,transport" ),
duke@1 174 ParserDataFactory.make( ORBConstants.INITIAL_HOST_PROPERTY,
duke@1 175 OperationFactory.stringAction(),
duke@1 176 "ORBInitialHost", "",
duke@1 177 "Foo", "Foo" ),
duke@1 178 ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY,
duke@1 179 OperationFactory.integerAction(),
duke@1 180 "ORBInitialPort", new Integer( ORBConstants.DEFAULT_INITIAL_PORT ),
duke@1 181 new Integer( 27314 ), "27314" ),
duke@1 182 // Where did this come from?
duke@1 183 //ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY,
duke@1 184 //OperationFactory.booleanAction(),
duke@1 185 //"ORBInitialPortInitialized", Boolean.FALSE,
duke@1 186 //Boolean.TRUE, "27314" ),
duke@1 187 ParserDataFactory.make( ORBConstants.SERVER_HOST_PROPERTY,
duke@1 188 OperationFactory.stringAction(),
duke@1 189 "ORBServerHost", "",
duke@1 190 "camelot", "camelot" ),
duke@1 191 ParserDataFactory.make( ORBConstants.SERVER_PORT_PROPERTY,
duke@1 192 OperationFactory.integerAction(),
duke@1 193 "ORBServerPort", new Integer( 0 ),
duke@1 194 new Integer( 38143 ), "38143" ),
duke@1 195 // NOTE: We are putting SERVER_HOST_NAME configuration info into
duke@1 196 // DataCollectorBase to avoid a security hole. However, that forces
duke@1 197 // us to also set LISTEN_ON_ALL_INTERFACES at the same time.
duke@1 198 // This all needs to be cleaned up for two reasons: to get configuration
duke@1 199 // out of DataCollectorBase and to correctly support multihoming.
duke@1 200 ParserDataFactory.make( ORBConstants.LISTEN_ON_ALL_INTERFACES,
duke@1 201 OperationFactory.stringAction(),
duke@1 202 "listenOnAllInterfaces", ORBConstants.LISTEN_ON_ALL_INTERFACES,
duke@1 203 "foo", "foo" ),
duke@1 204 ParserDataFactory.make( ORBConstants.ORB_ID_PROPERTY,
duke@1 205 OperationFactory.stringAction(),
duke@1 206 "orbId", "",
duke@1 207 "foo", "foo" ),
duke@1 208 ParserDataFactory.make( ORBConstants.OLD_ORB_ID_PROPERTY,
duke@1 209 OperationFactory.stringAction(),
duke@1 210 "orbId", "",
duke@1 211 "foo", "foo" ),
duke@1 212 ParserDataFactory.make( ORBConstants.ORB_SERVER_ID_PROPERTY,
duke@1 213 OperationFactory.integerAction(),
duke@1 214 "persistentServerId", new Integer(-1),
duke@1 215 new Integer( 1234), "1234" ),
duke@1 216 ParserDataFactory.make(
duke@1 217 ORBConstants.ORB_SERVER_ID_PROPERTY,
duke@1 218 OperationFactory.setFlagAction(),
duke@1 219 "persistentServerIdInitialized", Boolean.FALSE,
duke@1 220 Boolean.TRUE, "1234" ),
duke@1 221 ParserDataFactory.make(
duke@1 222 ORBConstants.ORB_SERVER_ID_PROPERTY,
duke@1 223 OperationFactory.setFlagAction(),
duke@1 224 "orbServerIdPropertySpecified", Boolean.FALSE,
duke@1 225 Boolean.TRUE, "1234" ),
duke@1 226 // REVISIT after switch
duke@1 227 // ParserDataFactory.make( ORBConstants.INITIAL_SERVICES_PROPERTY,
duke@1 228 // OperationFactory.URLAction(),
duke@1 229 // "servicesURL", null,
duke@1 230 // testServicesURL, testServicesString ),
duke@1 231 // ParserDataFactory.make( ORBConstants.DEFAULT_INIT_REF_PROPERTY,
duke@1 232 // OperationFactory.stringAction(),
duke@1 233 // "defaultInitRef", null,
duke@1 234 // "Fooref", "Fooref" ),
duke@1 235 ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY,
duke@1 236 OperationFactory.integerAction(),
duke@1 237 "highWaterMark", new Integer( 240 ),
duke@1 238 new Integer( 3745 ), "3745" ),
duke@1 239 ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY,
duke@1 240 OperationFactory.integerAction(),
duke@1 241 "lowWaterMark", new Integer( 100 ),
duke@1 242 new Integer( 12 ), "12" ),
duke@1 243 ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY,
duke@1 244 OperationFactory.integerAction(),
duke@1 245 "numberToReclaim", new Integer( 5 ),
duke@1 246 new Integer( 231 ), "231" ),
duke@1 247 ParserDataFactory.make( ORBConstants.GIOP_VERSION,
duke@1 248 makeGVOperation(),
duke@1 249 "giopVersion", GIOPVersion.DEFAULT_VERSION,
duke@1 250 new GIOPVersion( 2, 3 ), "2.3" ),
duke@1 251 ParserDataFactory.make( ORBConstants.GIOP_FRAGMENT_SIZE,
duke@1 252 makeFSOperation(), "giopFragmentSize",
duke@1 253 new Integer( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ),
duke@1 254 new Integer( 65536 ), "65536" ),
duke@1 255 ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE,
duke@1 256 OperationFactory.integerAction(),
duke@1 257 "giopBufferSize", new Integer( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ),
duke@1 258 new Integer( 234000 ), "234000" ),
duke@1 259 ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR,
duke@1 260 makeBMGROperation(),
duke@1 261 "giop11BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ),
duke@1 262 new Integer( 1 ), "CLCT" ),
duke@1 263 ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR,
duke@1 264 makeBMGROperation(),
duke@1 265 "giop12BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ),
duke@1 266 new Integer( 0 ), "GROW" ),
duke@1 267
duke@1 268 // Note that the same property is used to set two different
duke@1 269 // fields here. This requires that both entries use the same test
duke@1 270 // data, or the test will fail.
duke@1 271 ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
duke@1 272 OperationFactory.compose( OperationFactory.integerRangeAction( 0, 3 ),
duke@1 273 OperationFactory.convertIntegerToShort() ),
duke@1 274 "giopTargetAddressPreference",
duke@1 275 new Short( ORBConstants.ADDR_DISP_HANDLE_ALL ),
duke@1 276 new Short( (short)2 ), "2" ),
duke@1 277 ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
duke@1 278 makeADOperation(),
duke@1 279 "giopAddressDisposition", new Short( KeyAddr.value ),
duke@1 280 new Short( (short)2 ), "2" ),
duke@1 281 ParserDataFactory.make( ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY,
duke@1 282 OperationFactory.booleanAction(),
duke@1 283 "alwaysSendCodeSetCtx", Boolean.TRUE,
duke@1 284 Boolean.FALSE, "false"),
duke@1 285 ParserDataFactory.make( ORBConstants.USE_BOMS,
duke@1 286 OperationFactory.booleanAction(),
duke@1 287 "useByteOrderMarkers",
duke@1 288 Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS ),
duke@1 289 Boolean.FALSE, "false" ),
duke@1 290 ParserDataFactory.make( ORBConstants.USE_BOMS_IN_ENCAPS,
duke@1 291 OperationFactory.booleanAction(),
duke@1 292 "useByteOrderMarkersInEncaps",
duke@1 293 Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS ),
duke@1 294 Boolean.FALSE, "false" ),
duke@1 295 ParserDataFactory.make( ORBConstants.CHAR_CODESETS,
duke@1 296 makeCSOperation(),
duke@1 297 "charData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(),
duke@1 298 CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ),
duke@1 299 ParserDataFactory.make( ORBConstants.WCHAR_CODESETS,
duke@1 300 makeCSOperation(),
duke@1 301 "wcharData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(),
duke@1 302 CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ),
duke@1 303 ParserDataFactory.make( ORBConstants.ALLOW_LOCAL_OPTIMIZATION,
duke@1 304 OperationFactory.booleanAction(),
duke@1 305 "allowLocalOptimization", Boolean.FALSE,
duke@1 306 Boolean.TRUE, "true" ),
duke@1 307 ParserDataFactory.make( ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY,
duke@1 308 makeLegacySocketFactoryOperation(),
duke@1 309 // No default - must be set by user if they are using
duke@1 310 // legacy socket factory.
duke@1 311 "legacySocketFactory", null,
duke@1 312 new TestLegacyORBSocketFactory(),
duke@1 313 MY_CLASS_NAME + "$TestLegacyORBSocketFactory" ),
duke@1 314 ParserDataFactory.make( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY,
duke@1 315 makeSocketFactoryOperation(),
duke@1 316 "socketFactory", new DefaultSocketFactoryImpl(),
duke@1 317 new TestORBSocketFactory(),
duke@1 318 MY_CLASS_NAME + "$TestORBSocketFactory" ),
duke@1 319 ParserDataFactory.make( ORBConstants.LISTEN_SOCKET_PROPERTY,
duke@1 320 makeUSLOperation() ,
duke@1 321 "userSpecifiedListenPorts", new USLPort[0],
duke@1 322 USLPorts, "FOO:2701,BAR:3333" ),
duke@1 323 ParserDataFactory.make( ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY,
duke@1 324 makeIORToSocketInfoOperation(),
duke@1 325 "iorToSocketInfo", new DefaultIORToSocketInfoImpl(),
duke@1 326 new TestIORToSocketInfo(),
duke@1 327 MY_CLASS_NAME + "$TestIORToSocketInfo" ),
duke@1 328 ParserDataFactory.make( ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY,
duke@1 329 makeIIOPPrimaryToContactInfoOperation(),
duke@1 330 "iiopPrimaryToContactInfo", null,
duke@1 331 new TestIIOPPrimaryToContactInfo(),
duke@1 332 MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo" ),
duke@1 333 ParserDataFactory.make( ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY,
duke@1 334 makeContactInfoListFactoryOperation(),
duke@1 335 "corbaContactInfoListFactory", null,
duke@1 336 new TestContactInfoListFactory(),
duke@1 337 MY_CLASS_NAME + "$TestContactInfoListFactory" ),
duke@1 338 ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
duke@1 339 OperationFactory.integerAction(),
duke@1 340 "persistentServerPort", new Integer( 0 ),
duke@1 341 new Integer( 2743 ), "2743" ),
duke@1 342 ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
duke@1 343 OperationFactory.setFlagAction(),
duke@1 344 "persistentPortInitialized", Boolean.FALSE,
duke@1 345 Boolean.TRUE, "2743" ),
duke@1 346 ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
duke@1 347 OperationFactory.integerAction(),
duke@1 348 "persistentServerId", new Integer( 0 ),
duke@1 349 new Integer( 294 ), "294" ),
duke@1 350 ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
duke@1 351 OperationFactory.setFlagAction(),
duke@1 352 "persistentServerIdInitialized", Boolean.FALSE,
duke@1 353 Boolean.TRUE, "294" ),
duke@1 354 ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
duke@1 355 OperationFactory.setFlagAction(),
duke@1 356 "orbServerIdPropertySpecified", Boolean.FALSE,
duke@1 357 Boolean.TRUE, "294" ),
duke@1 358 ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY,
duke@1 359 OperationFactory.booleanAction(),
duke@1 360 "serverIsORBActivated", Boolean.FALSE,
duke@1 361 Boolean.TRUE, "true" ),
duke@1 362 ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY,
duke@1 363 OperationFactory.classAction(),
duke@1 364 "badServerIdHandlerClass", null,
duke@1 365 TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler" ),
duke@1 366 ParserDataFactory.make( ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX,
duke@1 367 makeROIOperation(),
duke@1 368 "orbInitializers", new ORBInitializer[0],
duke@1 369 TestORBInitializers, TestORBInitData, ORBInitializer.class ),
duke@1 370 ParserDataFactory.make( ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY,
duke@1 371 makeAcceptorInstantiationOperation(),
duke@1 372 "acceptors", new Acceptor[0],
duke@1 373 TestAcceptors, TestAcceptorData, Acceptor.class ),
duke@1 374
duke@1 375 //
duke@1 376 // Socket/Channel control
duke@1 377 //
duke@1 378
duke@1 379 // Acceptor:
duke@1 380 // useNIOSelector == true
duke@1 381 // useSelectThreadToWait = true
duke@1 382 // useWorkerThreadForEvent = false
duke@1 383 // else
duke@1 384 // useSelectThreadToWait = false
duke@1 385 // useWorkerThreadForEvent = true
duke@1 386
duke@1 387 // Connection:
duke@1 388 // useNIOSelector == true
duke@1 389 // useSelectThreadToWait = true
duke@1 390 // useWorkerThreadForEvent = true
duke@1 391 // else
duke@1 392 // useSelectThreadToWait = false
duke@1 393 // useWorkerThreadForEvent = true
duke@1 394
duke@1 395 ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY,
duke@1 396 OperationFactory.stringAction(),
duke@1 397 "acceptorSocketType", ORBConstants.SOCKETCHANNEL,
duke@1 398 "foo", "foo" ),
duke@1 399
duke@1 400 ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY,
duke@1 401 OperationFactory.booleanAction(),
duke@1 402 "acceptorSocketUseSelectThreadToWait", Boolean.TRUE,
duke@1 403 Boolean.TRUE, "true" ),
duke@1 404 ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY,
duke@1 405 OperationFactory.booleanAction(),
duke@1 406 "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE,
duke@1 407 Boolean.TRUE, "true" ),
duke@1 408 ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY,
duke@1 409 OperationFactory.stringAction(),
duke@1 410 "connectionSocketType", ORBConstants.SOCKETCHANNEL,
duke@1 411 "foo", "foo" ),
duke@1 412 ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY,
duke@1 413 OperationFactory.booleanAction(),
duke@1 414 "connectionSocketUseSelectThreadToWait", Boolean.TRUE,
duke@1 415 Boolean.TRUE, "true" ),
duke@1 416 ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY,
duke@1 417 OperationFactory.booleanAction(),
duke@1 418 "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE,
duke@1 419 Boolean.TRUE, "true" ),
duke@1 420 ParserDataFactory.make( ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY,
duke@1 421 OperationFactory.booleanAction(),
duke@1 422 "disableDirectByteBufferUse", Boolean.FALSE,
duke@1 423 Boolean.TRUE, "true" ),
duke@1 424 ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY,
duke@1 425 makeTTCPRTOperation(),
duke@1 426 "readTimeouts", TransportDefault.makeReadTimeoutsFactory().create(
duke@1 427 ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
duke@1 428 ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
duke@1 429 ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
duke@1 430 ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR),
duke@1 431 readTimeouts, "100:3000:300:20" ),
duke@1 432 ParserDataFactory.make(
duke@1 433 ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY,
duke@1 434 OperationFactory.booleanAction(),
duke@1 435 "enableJavaSerialization", Boolean.FALSE,
duke@1 436 Boolean.FALSE, "false"),
duke@1 437 ParserDataFactory.make(
duke@1 438 ORBConstants.USE_REP_ID,
duke@1 439 OperationFactory.booleanAction(),
duke@1 440 "useRepId", Boolean.TRUE,
duke@1 441 Boolean.TRUE, "true"),
duke@1 442 ParserDataFactory.make( ORBConstants.ORB_INIT_REF_PROPERTY,
duke@1 443 OperationFactory.identityAction(),
duke@1 444 "orbInitialReferences", new StringPair[0],
duke@1 445 TestORBInitRefData, TestORBInitRefData, StringPair.class )
duke@1 446 } ;
duke@1 447
duke@1 448 parserData = pd ;
duke@1 449 }
duke@1 450
duke@1 451 public final class TestBadServerIdHandler implements BadServerIdHandler
duke@1 452 {
duke@1 453 public boolean equals( Object other )
duke@1 454 {
duke@1 455 return other instanceof TestBadServerIdHandler ;
duke@1 456 }
duke@1 457
duke@1 458 public void handle( ObjectKey objectKey )
duke@1 459 {
duke@1 460 }
duke@1 461 }
duke@1 462
duke@1 463 private Operation makeTTCPRTOperation()
duke@1 464 {
duke@1 465 Operation[] fourIop = { OperationFactory.integerAction(),
duke@1 466 OperationFactory.integerAction(),
duke@1 467 OperationFactory.integerAction(),
duke@1 468 OperationFactory.integerAction() } ;
duke@1 469
duke@1 470 Operation op2 = OperationFactory.sequenceAction( ":", fourIop ) ;
duke@1 471
duke@1 472 Operation rtOp = new Operation() {
duke@1 473 public Object operate(Object value)
duke@1 474 {
duke@1 475 Object[] values = (Object[])value ;
duke@1 476 Integer initialTime = (Integer)(values[0]) ;
duke@1 477 Integer maxGIOPHdrTime = (Integer)(values[1]) ;
duke@1 478 Integer maxGIOPBodyTime = (Integer)(values[2]) ;
duke@1 479 Integer backoffPercent = (Integer)(values[3]) ;
duke@1 480 return TransportDefault.makeReadTimeoutsFactory().create(
duke@1 481 initialTime.intValue(),
duke@1 482 maxGIOPHdrTime.intValue(),
duke@1 483 maxGIOPBodyTime.intValue(),
duke@1 484 backoffPercent.intValue());
duke@1 485 }
duke@1 486 } ;
duke@1 487
duke@1 488 Operation ttcprtOp = OperationFactory.compose(op2, rtOp);
duke@1 489 return ttcprtOp;
duke@1 490 }
duke@1 491
duke@1 492 private Operation makeUSLOperation()
duke@1 493 {
duke@1 494 Operation[] siop = { OperationFactory.stringAction(),
duke@1 495 OperationFactory.integerAction() } ;
duke@1 496 Operation op2 = OperationFactory.sequenceAction( ":", siop ) ;
duke@1 497
duke@1 498 Operation uslop = new Operation() {
duke@1 499 public Object operate( Object value )
duke@1 500 {
duke@1 501 Object[] values = (Object[])value ;
duke@1 502 String type = (String)(values[0]) ;
duke@1 503 Integer port = (Integer)(values[1]) ;
duke@1 504 return new USLPort( type, port.intValue() ) ;
duke@1 505 }
duke@1 506 } ;
duke@1 507
duke@1 508 Operation op3 = OperationFactory.compose( op2, uslop ) ;
duke@1 509 Operation listenop = OperationFactory.listAction( ",", op3 ) ;
duke@1 510 return listenop ;
duke@1 511 }
duke@1 512
duke@1 513 public static final class TestLegacyORBSocketFactory
duke@1 514 implements com.sun.corba.se.spi.legacy.connection.ORBSocketFactory
duke@1 515 {
duke@1 516 public boolean equals( Object other )
duke@1 517 {
duke@1 518 return other instanceof TestLegacyORBSocketFactory ;
duke@1 519 }
duke@1 520
duke@1 521 public ServerSocket createServerSocket( String type, int port )
duke@1 522 {
duke@1 523 return null ;
duke@1 524 }
duke@1 525
duke@1 526 public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb,
duke@1 527 IOR ior, SocketInfo socketInfo )
duke@1 528 {
duke@1 529 return null ;
duke@1 530 }
duke@1 531
duke@1 532 public Socket createSocket( SocketInfo socketInfo )
duke@1 533 {
duke@1 534 return null ;
duke@1 535 }
duke@1 536 }
duke@1 537
duke@1 538 public static final class TestORBSocketFactory
duke@1 539 implements com.sun.corba.se.spi.transport.ORBSocketFactory
duke@1 540 {
duke@1 541 public boolean equals( Object other )
duke@1 542 {
duke@1 543 return other instanceof TestORBSocketFactory ;
duke@1 544 }
duke@1 545
duke@1 546 public void setORB(ORB orb)
duke@1 547 {
duke@1 548 }
duke@1 549
duke@1 550 public ServerSocket createServerSocket( String type, InetSocketAddress a )
duke@1 551 {
duke@1 552 return null ;
duke@1 553 }
duke@1 554
duke@1 555 public Socket createSocket( String type, InetSocketAddress a )
duke@1 556 {
duke@1 557 return null ;
duke@1 558 }
duke@1 559
duke@1 560 public void setAcceptedSocketOptions(Acceptor acceptor,
duke@1 561 ServerSocket serverSocket,
duke@1 562 Socket socket)
duke@1 563 {
duke@1 564 }
duke@1 565 }
duke@1 566
duke@1 567 public static final class TestIORToSocketInfo
duke@1 568 implements IORToSocketInfo
duke@1 569 {
duke@1 570 public boolean equals( Object other )
duke@1 571 {
duke@1 572 return other instanceof TestIORToSocketInfo;
duke@1 573 }
duke@1 574
duke@1 575 public List getSocketInfo(IOR ior)
duke@1 576 {
duke@1 577 return null;
duke@1 578 }
duke@1 579 }
duke@1 580
duke@1 581 public static final class TestIIOPPrimaryToContactInfo
duke@1 582 implements IIOPPrimaryToContactInfo
duke@1 583 {
duke@1 584 public void reset(ContactInfo primary)
duke@1 585 {
duke@1 586 }
duke@1 587
duke@1 588 public boolean hasNext(ContactInfo primary,
duke@1 589 ContactInfo previous,
duke@1 590 List contactInfos)
duke@1 591 {
duke@1 592 return true;
duke@1 593 }
duke@1 594
duke@1 595 public ContactInfo next(ContactInfo primary,
duke@1 596 ContactInfo previous,
duke@1 597 List contactInfos)
duke@1 598 {
duke@1 599 return null;
duke@1 600 }
duke@1 601 }
duke@1 602
duke@1 603 public static final class TestContactInfoListFactory
duke@1 604 implements CorbaContactInfoListFactory
duke@1 605 {
duke@1 606 public boolean equals( Object other )
duke@1 607 {
duke@1 608 return other instanceof TestContactInfoListFactory;
duke@1 609 }
duke@1 610
duke@1 611 public void setORB(ORB orb) { }
duke@1 612
duke@1 613 public CorbaContactInfoList create( IOR ior ) { return null; }
duke@1 614 }
duke@1 615
duke@1 616 private Operation makeMapOperation( final Map map )
duke@1 617 {
duke@1 618 return new Operation() {
duke@1 619 public Object operate( Object value )
duke@1 620 {
duke@1 621 return map.get( value ) ;
duke@1 622 }
duke@1 623 } ;
duke@1 624 }
duke@1 625
duke@1 626 private Operation makeBMGROperation()
duke@1 627 {
duke@1 628 Map map = new HashMap() ;
duke@1 629 map.put( "GROW", new Integer(0) ) ;
duke@1 630 map.put( "CLCT", new Integer(1) ) ;
duke@1 631 map.put( "STRM", new Integer(2) ) ;
duke@1 632 return makeMapOperation( map ) ;
duke@1 633 }
duke@1 634
duke@1 635 private Operation makeLegacySocketFactoryOperation()
duke@1 636 {
duke@1 637 Operation sfop = new Operation() {
duke@1 638 public Object operate( Object value )
duke@1 639 {
duke@1 640 String param = (String)value ;
duke@1 641
duke@1 642 try {
duke@1 643 Class legacySocketFactoryClass =
duke@1 644 ORBClassLoader.loadClass(param);
duke@1 645 // For security reasons avoid creating an instance if
duke@1 646 // this socket factory class is not one that would fail
duke@1 647 // the class cast anyway.
duke@1 648 if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
duke@1 649 return legacySocketFactoryClass.newInstance();
duke@1 650 } else {
duke@1 651 throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
duke@1 652 }
duke@1 653 } catch (Exception ex) {
duke@1 654 // ClassNotFoundException, IllegalAccessException,
duke@1 655 // InstantiationException, SecurityException or
duke@1 656 // ClassCastException
duke@1 657 throw wrapper.badCustomSocketFactory( ex, param ) ;
duke@1 658 }
duke@1 659 }
duke@1 660 } ;
duke@1 661
duke@1 662 return sfop ;
duke@1 663 }
duke@1 664
duke@1 665 private Operation makeSocketFactoryOperation()
duke@1 666 {
duke@1 667 Operation sfop = new Operation() {
duke@1 668 public Object operate( Object value )
duke@1 669 {
duke@1 670 String param = (String)value ;
duke@1 671
duke@1 672 try {
duke@1 673 Class socketFactoryClass = ORBClassLoader.loadClass(param);
duke@1 674 // For security reasons avoid creating an instance if
duke@1 675 // this socket factory class is not one that would fail
duke@1 676 // the class cast anyway.
duke@1 677 if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
duke@1 678 return socketFactoryClass.newInstance();
duke@1 679 } else {
duke@1 680 throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
duke@1 681 }
duke@1 682 } catch (Exception ex) {
duke@1 683 // ClassNotFoundException, IllegalAccessException,
duke@1 684 // InstantiationException, SecurityException or
duke@1 685 // ClassCastException
duke@1 686 throw wrapper.badCustomSocketFactory( ex, param ) ;
duke@1 687 }
duke@1 688 }
duke@1 689 } ;
duke@1 690
duke@1 691 return sfop ;
duke@1 692 }
duke@1 693
duke@1 694 private Operation makeIORToSocketInfoOperation()
duke@1 695 {
duke@1 696 Operation op = new Operation() {
duke@1 697 public Object operate( Object value )
duke@1 698 {
duke@1 699 String param = (String)value ;
duke@1 700
duke@1 701 try {
duke@1 702 Class iorToSocketInfoClass = ORBClassLoader.loadClass(param);
duke@1 703 // For security reasons avoid creating an instance if
duke@1 704 // this socket factory class is not one that would fail
duke@1 705 // the class cast anyway.
duke@1 706 if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) {
duke@1 707 return iorToSocketInfoClass.newInstance();
duke@1 708 } else {
duke@1 709 throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ;
duke@1 710 }
duke@1 711 } catch (Exception ex) {
duke@1 712 // ClassNotFoundException, IllegalAccessException,
duke@1 713 // InstantiationException, SecurityException or
duke@1 714 // ClassCastException
duke@1 715 throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
duke@1 716 }
duke@1 717 }
duke@1 718 } ;
duke@1 719
duke@1 720 return op ;
duke@1 721 }
duke@1 722
duke@1 723 private Operation makeIIOPPrimaryToContactInfoOperation()
duke@1 724 {
duke@1 725 Operation op = new Operation() {
duke@1 726 public Object operate( Object value )
duke@1 727 {
duke@1 728 String param = (String)value ;
duke@1 729
duke@1 730 try {
duke@1 731 Class iiopPrimaryToContactInfoClass = ORBClassLoader.loadClass(param);
duke@1 732 // For security reasons avoid creating an instance if
duke@1 733 // this socket factory class is not one that would fail
duke@1 734 // the class cast anyway.
duke@1 735 if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) {
duke@1 736 return iiopPrimaryToContactInfoClass.newInstance();
duke@1 737 } else {
duke@1 738 throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
duke@1 739 }
duke@1 740 } catch (Exception ex) {
duke@1 741 // ClassNotFoundException, IllegalAccessException,
duke@1 742 // InstantiationException, SecurityException or
duke@1 743 // ClassCastException
duke@1 744 throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
duke@1 745 }
duke@1 746 }
duke@1 747 } ;
duke@1 748
duke@1 749 return op ;
duke@1 750 }
duke@1 751
duke@1 752 private Operation makeContactInfoListFactoryOperation()
duke@1 753 {
duke@1 754 Operation op = new Operation() {
duke@1 755 public Object operate( Object value )
duke@1 756 {
duke@1 757 String param = (String)value ;
duke@1 758
duke@1 759 try {
duke@1 760 Class contactInfoListFactoryClass =
duke@1 761 ORBClassLoader.loadClass(param);
duke@1 762 // For security reasons avoid creating an instance if
duke@1 763 // this socket factory class is not one that would fail
duke@1 764 // the class cast anyway.
duke@1 765 if (CorbaContactInfoListFactory.class.isAssignableFrom(
duke@1 766 contactInfoListFactoryClass)) {
duke@1 767 return contactInfoListFactoryClass.newInstance();
duke@1 768 } else {
duke@1 769 throw wrapper.illegalContactInfoListFactoryType(
duke@1 770 contactInfoListFactoryClass.toString() ) ;
duke@1 771 }
duke@1 772 } catch (Exception ex) {
duke@1 773 // ClassNotFoundException, IllegalAccessException,
duke@1 774 // InstantiationException, SecurityException or
duke@1 775 // ClassCastException
duke@1 776 throw wrapper.badContactInfoListFactory( ex, param ) ;
duke@1 777 }
duke@1 778 }
duke@1 779 } ;
duke@1 780
duke@1 781 return op ;
duke@1 782 }
duke@1 783
duke@1 784 private Operation makeCSOperation()
duke@1 785 {
duke@1 786 Operation csop = new Operation() {
duke@1 787 public Object operate( Object value )
duke@1 788 {
duke@1 789 String val = (String)value ;
duke@1 790 return CodeSetComponentInfo.createFromString( val ) ;
duke@1 791 }
duke@1 792 } ;
duke@1 793
duke@1 794 return csop ;
duke@1 795 }
duke@1 796
duke@1 797 private Operation makeADOperation()
duke@1 798 {
duke@1 799 Operation admap = new Operation() {
duke@1 800 private Integer[] map = {
duke@1 801 new Integer( KeyAddr.value ),
duke@1 802 new Integer( ProfileAddr.value ),
duke@1 803 new Integer( ReferenceAddr.value ),
duke@1 804 new Integer( KeyAddr.value ) } ;
duke@1 805
duke@1 806 public Object operate( Object value )
duke@1 807 {
duke@1 808 int val = ((Integer)value).intValue() ;
duke@1 809 return map[val] ;
duke@1 810 }
duke@1 811 } ;
duke@1 812
duke@1 813 Operation rangeop = OperationFactory.integerRangeAction( 0, 3 ) ;
duke@1 814 Operation op1 = OperationFactory.compose( rangeop, admap ) ;
duke@1 815 Operation result = OperationFactory.compose( op1, OperationFactory.convertIntegerToShort() ) ;
duke@1 816 return result ;
duke@1 817 }
duke@1 818
duke@1 819 private Operation makeFSOperation() {
duke@1 820 Operation fschecker = new Operation() {
duke@1 821 public Object operate( Object value )
duke@1 822 {
duke@1 823 int giopFragmentSize = ((Integer)value).intValue() ;
duke@1 824 if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){
duke@1 825 throw wrapper.fragmentSizeMinimum( new Integer( giopFragmentSize ),
duke@1 826 new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ;
duke@1 827 }
duke@1 828
duke@1 829 if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0)
duke@1 830 throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ),
duke@1 831 new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ;
duke@1 832
duke@1 833 return value ;
duke@1 834 }
duke@1 835 } ;
duke@1 836
duke@1 837 Operation result = OperationFactory.compose( OperationFactory.integerAction(),
duke@1 838 fschecker ) ;
duke@1 839 return result ;
duke@1 840 }
duke@1 841
duke@1 842 private Operation makeGVOperation() {
duke@1 843 Operation gvHelper = OperationFactory.listAction( ".",
duke@1 844 OperationFactory.integerAction() ) ;
duke@1 845 Operation gvMain = new Operation() {
duke@1 846 public Object operate( Object value )
duke@1 847 {
duke@1 848 Object[] nums = (Object[])value ;
duke@1 849 int major = ((Integer)(nums[0])).intValue() ;
duke@1 850 int minor = ((Integer)(nums[1])).intValue() ;
duke@1 851
duke@1 852 return new GIOPVersion( major, minor ) ;
duke@1 853 }
duke@1 854 } ;
duke@1 855
duke@1 856 Operation result = OperationFactory.compose( gvHelper, gvMain );
duke@1 857 return result ;
duke@1 858 }
duke@1 859
duke@1 860 public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject
duke@1 861 implements ORBInitializer
duke@1 862 {
duke@1 863 public boolean equals( Object other )
duke@1 864 {
duke@1 865 return other instanceof TestORBInitializer1 ;
duke@1 866 }
duke@1 867
duke@1 868 public void pre_init( ORBInitInfo info )
duke@1 869 {
duke@1 870 }
duke@1 871
duke@1 872 public void post_init( ORBInitInfo info )
duke@1 873 {
duke@1 874 }
duke@1 875 }
duke@1 876
duke@1 877 public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject
duke@1 878 implements ORBInitializer
duke@1 879 {
duke@1 880 public boolean equals( Object other )
duke@1 881 {
duke@1 882 return other instanceof TestORBInitializer2 ;
duke@1 883 }
duke@1 884
duke@1 885 public void pre_init( ORBInitInfo info )
duke@1 886 {
duke@1 887 }
duke@1 888
duke@1 889 public void post_init( ORBInitInfo info )
duke@1 890 {
duke@1 891 }
duke@1 892 }
duke@1 893
duke@1 894 private Operation makeROIOperation() {
duke@1 895 Operation clsop = OperationFactory.classAction() ;
duke@1 896 Operation indexOp = OperationFactory.suffixAction() ;
duke@1 897 Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
duke@1 898 Operation mop = OperationFactory.maskErrorAction( op1 ) ;
duke@1 899
duke@1 900 Operation mkinst = new Operation() {
duke@1 901 public Object operate( Object value )
duke@1 902 {
duke@1 903 final Class initClass = (Class)value ;
duke@1 904 if (initClass == null)
duke@1 905 return null ;
duke@1 906
duke@1 907 // For security reasons avoid creating an instance
duke@1 908 // if this class is one that would fail the class cast
duke@1 909 // to ORBInitializer anyway.
duke@1 910 if( org.omg.PortableInterceptor.ORBInitializer.class.isAssignableFrom(
duke@1 911 initClass ) ) {
duke@1 912 // Now that we have a class object, instantiate one and
duke@1 913 // remember it:
duke@1 914 ORBInitializer initializer = null ;
duke@1 915
duke@1 916 try {
duke@1 917 initializer = (ORBInitializer)AccessController.doPrivileged(
duke@1 918 new PrivilegedExceptionAction() {
duke@1 919 public Object run()
duke@1 920 throws InstantiationException, IllegalAccessException
duke@1 921 {
duke@1 922 return initClass.newInstance() ;
duke@1 923 }
duke@1 924 }
duke@1 925 ) ;
duke@1 926 } catch (PrivilegedActionException exc) {
duke@1 927 // Unwrap the exception, as we don't care exc here
duke@1 928 throw wrapper.orbInitializerFailure( exc.getException(),
duke@1 929 initClass.getName() ) ;
duke@1 930 } catch (Exception exc) {
duke@1 931 throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ;
duke@1 932 }
duke@1 933
duke@1 934 return initializer ;
duke@1 935 } else {
duke@1 936 throw wrapper.orbInitializerType( initClass.getName() ) ;
duke@1 937 }
duke@1 938 }
duke@1 939 } ;
duke@1 940
duke@1 941 Operation result = OperationFactory.compose( mop, mkinst ) ;
duke@1 942
duke@1 943 return result ;
duke@1 944 }
duke@1 945
duke@1 946 public static final class TestAcceptor1
duke@1 947 implements Acceptor
duke@1 948 {
duke@1 949 public boolean equals( Object other )
duke@1 950 {
duke@1 951 return other instanceof TestAcceptor1 ;
duke@1 952 }
duke@1 953 public boolean initialize() { return true; }
duke@1 954 public boolean initialized() { return true; }
duke@1 955 public String getConnectionCacheType() { return "FOO"; }
duke@1 956 public void setConnectionCache(InboundConnectionCache connectionCache){}
duke@1 957 public InboundConnectionCache getConnectionCache() { return null; }
duke@1 958 public boolean shouldRegisterAcceptEvent() { return true; }
duke@1 959 public void setUseSelectThreadForConnections(boolean x) { }
duke@1 960 public boolean shouldUseSelectThreadForConnections() { return true; }
duke@1 961 public void setUseWorkerThreadForConnections(boolean x) { }
duke@1 962 public boolean shouldUseWorkerThreadForConnections() { return true; }
duke@1 963 public void accept() { }
duke@1 964 public void close() { }
duke@1 965 public EventHandler getEventHandler() { return null; }
duke@1 966 public MessageMediator createMessageMediator(
duke@1 967 Broker xbroker, Connection xconnection) { return null; }
duke@1 968 public MessageMediator finishCreatingMessageMediator(
duke@1 969 Broker xbroker, Connection xconnection,
duke@1 970 MessageMediator messageMediator) { return null; }
duke@1 971 public InputObject createInputObject(
duke@1 972 Broker broker, MessageMediator messageMediator) { return null; }
duke@1 973 public OutputObject createOutputObject(
duke@1 974 Broker broker, MessageMediator messageMediator) { return null; }
duke@1 975 }
duke@1 976
duke@1 977 public static final class TestAcceptor2
duke@1 978 implements Acceptor
duke@1 979 {
duke@1 980 public boolean equals( Object other )
duke@1 981 {
duke@1 982 return other instanceof TestAcceptor2 ;
duke@1 983 }
duke@1 984 public boolean initialize() { return true; }
duke@1 985 public boolean initialized() { return true; }
duke@1 986 public String getConnectionCacheType() { return "FOO"; }
duke@1 987 public void setConnectionCache(InboundConnectionCache connectionCache){}
duke@1 988 public InboundConnectionCache getConnectionCache() { return null; }
duke@1 989 public boolean shouldRegisterAcceptEvent() { return true; }
duke@1 990 public void setUseSelectThreadForConnections(boolean x) { }
duke@1 991 public boolean shouldUseSelectThreadForConnections() { return true; }
duke@1 992 public void setUseWorkerThreadForConnections(boolean x) { }
duke@1 993 public boolean shouldUseWorkerThreadForConnections() { return true; }
duke@1 994 public void accept() { }
duke@1 995 public void close() { }
duke@1 996 public EventHandler getEventHandler() { return null; }
duke@1 997 public MessageMediator createMessageMediator(
duke@1 998 Broker xbroker, Connection xconnection) { return null; }
duke@1 999 public MessageMediator finishCreatingMessageMediator(
duke@1 1000 Broker xbroker, Connection xconnection,
duke@1 1001 MessageMediator messageMediator) { return null; }
duke@1 1002 public InputObject createInputObject(
duke@1 1003 Broker broker, MessageMediator messageMediator) { return null; }
duke@1 1004 public OutputObject createOutputObject(
duke@1 1005 Broker broker, MessageMediator messageMediator) { return null; }
duke@1 1006 }
duke@1 1007
duke@1 1008 // REVISIT - this is a cut and paste modification of makeROIOperation.
duke@1 1009 private Operation makeAcceptorInstantiationOperation() {
duke@1 1010 Operation clsop = OperationFactory.classAction() ;
duke@1 1011 Operation indexOp = OperationFactory.suffixAction() ;
duke@1 1012 Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
duke@1 1013 Operation mop = OperationFactory.maskErrorAction( op1 ) ;
duke@1 1014
duke@1 1015 Operation mkinst = new Operation() {
duke@1 1016 public Object operate( Object value )
duke@1 1017 {
duke@1 1018 final Class initClass = (Class)value ;
duke@1 1019 if (initClass == null)
duke@1 1020 return null ;
duke@1 1021
duke@1 1022 // For security reasons avoid creating an instance
duke@1 1023 // if this class is one that would fail the class cast
duke@1 1024 // to ORBInitializer anyway.
duke@1 1025 if( Acceptor.class.isAssignableFrom( initClass ) ) {
duke@1 1026 // Now that we have a class object, instantiate one and
duke@1 1027 // remember it:
duke@1 1028 Acceptor acceptor = null ;
duke@1 1029
duke@1 1030 try {
duke@1 1031 acceptor = (Acceptor)AccessController.doPrivileged(
duke@1 1032 new PrivilegedExceptionAction() {
duke@1 1033 public Object run()
duke@1 1034 throws InstantiationException, IllegalAccessException
duke@1 1035 {
duke@1 1036 return initClass.newInstance() ;
duke@1 1037 }
duke@1 1038 }
duke@1 1039 ) ;
duke@1 1040 } catch (PrivilegedActionException exc) {
duke@1 1041 // Unwrap the exception, as we don't care exc here
duke@1 1042 throw wrapper.acceptorInstantiationFailure( exc.getException(),
duke@1 1043 initClass.getName() ) ;
duke@1 1044 } catch (Exception exc) {
duke@1 1045 throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ;
duke@1 1046 }
duke@1 1047
duke@1 1048 return acceptor ;
duke@1 1049 } else {
duke@1 1050 throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ;
duke@1 1051 }
duke@1 1052 }
duke@1 1053 } ;
duke@1 1054
duke@1 1055 Operation result = OperationFactory.compose( mop, mkinst ) ;
duke@1 1056
duke@1 1057 return result ;
duke@1 1058 }
duke@1 1059
duke@1 1060 private Operation makeInitRefOperation() {
duke@1 1061 return new Operation() {
duke@1 1062 public Object operate( Object value )
duke@1 1063 {
duke@1 1064 // Object is String[] of length 2.
duke@1 1065 String[] values = (String[])value ;
duke@1 1066 if (values.length != 2)
duke@1 1067 throw wrapper.orbInitialreferenceSyntax() ;
duke@1 1068
duke@1 1069 return values[0] + "=" + values[1] ;
duke@1 1070 }
duke@1 1071 } ;
duke@1 1072 }
duke@1 1073 }
duke@1 1074
duke@1 1075 // End of file.

mercurial