Mon, 28 May 2018 10:29:43 +0800
Merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | |
aoqi@0 | 27 | package com.sun.corba.se.impl.orb ; |
aoqi@0 | 28 | |
aoqi@0 | 29 | import java.net.URL ; |
aoqi@0 | 30 | |
aoqi@0 | 31 | import org.omg.CORBA.CompletionStatus ; |
aoqi@0 | 32 | import org.omg.PortableInterceptor.ORBInitializer ; |
aoqi@0 | 33 | |
aoqi@0 | 34 | import com.sun.corba.se.pept.transport.Acceptor; |
aoqi@0 | 35 | |
aoqi@0 | 36 | import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; |
aoqi@0 | 37 | import com.sun.corba.se.spi.logging.CORBALogDomains ; |
aoqi@0 | 38 | import com.sun.corba.se.spi.orb.DataCollector ; |
aoqi@0 | 39 | import com.sun.corba.se.spi.orb.ORB ; |
aoqi@0 | 40 | import com.sun.corba.se.spi.orb.ORBData ; |
aoqi@0 | 41 | import com.sun.corba.se.spi.orb.ParserImplTableBase ; |
aoqi@0 | 42 | import com.sun.corba.se.spi.orb.StringPair ; |
aoqi@0 | 43 | import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; |
aoqi@0 | 44 | import com.sun.corba.se.spi.transport.CorbaTransportManager; |
aoqi@0 | 45 | import com.sun.corba.se.spi.transport.IORToSocketInfo; |
aoqi@0 | 46 | import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo; |
aoqi@0 | 47 | import com.sun.corba.se.spi.transport.ReadTimeouts; |
aoqi@0 | 48 | |
aoqi@0 | 49 | import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; |
aoqi@0 | 50 | import com.sun.corba.se.impl.legacy.connection.USLPort; |
aoqi@0 | 51 | import com.sun.corba.se.impl.orbutil.ORBConstants ; |
aoqi@0 | 52 | import com.sun.corba.se.impl.logging.ORBUtilSystemException ; |
aoqi@0 | 53 | |
aoqi@0 | 54 | |
aoqi@0 | 55 | public class ORBDataParserImpl extends ParserImplTableBase implements ORBData |
aoqi@0 | 56 | { |
aoqi@0 | 57 | private ORB orb ; |
aoqi@0 | 58 | private ORBUtilSystemException wrapper ; |
aoqi@0 | 59 | private String ORBInitialHost ; |
aoqi@0 | 60 | private int ORBInitialPort ; |
aoqi@0 | 61 | private String ORBServerHost ; |
aoqi@0 | 62 | private int ORBServerPort ; |
aoqi@0 | 63 | private String listenOnAllInterfaces; |
aoqi@0 | 64 | private com.sun.corba.se.spi.legacy.connection.ORBSocketFactory legacySocketFactory ; |
aoqi@0 | 65 | private com.sun.corba.se.spi.transport.ORBSocketFactory socketFactory; |
aoqi@0 | 66 | private USLPort[] userSpecifiedListenPorts ; |
aoqi@0 | 67 | private IORToSocketInfo iorToSocketInfo; |
aoqi@0 | 68 | private IIOPPrimaryToContactInfo iiopPrimaryToContactInfo; |
aoqi@0 | 69 | private String orbId ; |
aoqi@0 | 70 | private boolean orbServerIdPropertySpecified ; |
aoqi@0 | 71 | private URL servicesURL ; |
aoqi@0 | 72 | private String propertyInitRef ; |
aoqi@0 | 73 | private boolean allowLocalOptimization ; |
aoqi@0 | 74 | private GIOPVersion giopVersion ; |
aoqi@0 | 75 | private int highWaterMark ; |
aoqi@0 | 76 | private int lowWaterMark ; |
aoqi@0 | 77 | private int numberToReclaim ; |
aoqi@0 | 78 | private int giopFragmentSize ; |
aoqi@0 | 79 | private int giopBufferSize ; |
aoqi@0 | 80 | private int giop11BuffMgr ; |
aoqi@0 | 81 | private int giop12BuffMgr ; |
aoqi@0 | 82 | private short giopTargetAddressPreference ; |
aoqi@0 | 83 | private short giopAddressDisposition ; |
aoqi@0 | 84 | private boolean useByteOrderMarkers ; |
aoqi@0 | 85 | private boolean useByteOrderMarkersInEncaps ; |
aoqi@0 | 86 | private boolean alwaysSendCodeSetCtx ; |
aoqi@0 | 87 | private boolean persistentPortInitialized ; |
aoqi@0 | 88 | private int persistentServerPort ; |
aoqi@0 | 89 | private boolean persistentServerIdInitialized ; |
aoqi@0 | 90 | private int persistentServerId ; |
aoqi@0 | 91 | private boolean serverIsORBActivated ; |
aoqi@0 | 92 | private Class badServerIdHandlerClass ; |
aoqi@0 | 93 | private CodeSetComponentInfo.CodeSetComponent charData ; |
aoqi@0 | 94 | private CodeSetComponentInfo.CodeSetComponent wcharData ; |
aoqi@0 | 95 | private ORBInitializer[] orbInitializers ; |
aoqi@0 | 96 | private StringPair[] orbInitialReferences ; |
aoqi@0 | 97 | private String defaultInitRef ; |
aoqi@0 | 98 | private String[] debugFlags ; |
aoqi@0 | 99 | private Acceptor[] acceptors; |
aoqi@0 | 100 | private CorbaContactInfoListFactory corbaContactInfoListFactory; |
aoqi@0 | 101 | private String acceptorSocketType; |
aoqi@0 | 102 | private boolean acceptorSocketUseSelectThreadToWait; |
aoqi@0 | 103 | private boolean acceptorSocketUseWorkerThreadForEvent; |
aoqi@0 | 104 | private String connectionSocketType; |
aoqi@0 | 105 | private boolean connectionSocketUseSelectThreadToWait; |
aoqi@0 | 106 | private boolean connectionSocketUseWorkerThreadForEvent; |
aoqi@0 | 107 | private ReadTimeouts readTimeouts; |
aoqi@0 | 108 | private boolean disableDirectByteBufferUse; |
aoqi@0 | 109 | private boolean enableJavaSerialization; |
aoqi@0 | 110 | private boolean useRepId; |
aoqi@0 | 111 | |
aoqi@0 | 112 | // This is not initialized from ParserTable. |
aoqi@0 | 113 | private CodeSetComponentInfo codesets ; |
aoqi@0 | 114 | |
aoqi@0 | 115 | // Public accessor methods ======================================================================== |
aoqi@0 | 116 | |
aoqi@0 | 117 | public String getORBInitialHost() |
aoqi@0 | 118 | { |
aoqi@0 | 119 | return ORBInitialHost; |
aoqi@0 | 120 | } |
aoqi@0 | 121 | |
aoqi@0 | 122 | public int getORBInitialPort() |
aoqi@0 | 123 | { |
aoqi@0 | 124 | return ORBInitialPort; |
aoqi@0 | 125 | } |
aoqi@0 | 126 | |
aoqi@0 | 127 | public String getORBServerHost() |
aoqi@0 | 128 | { |
aoqi@0 | 129 | return ORBServerHost; |
aoqi@0 | 130 | } |
aoqi@0 | 131 | |
aoqi@0 | 132 | public String getListenOnAllInterfaces() |
aoqi@0 | 133 | { |
aoqi@0 | 134 | return listenOnAllInterfaces; |
aoqi@0 | 135 | } |
aoqi@0 | 136 | |
aoqi@0 | 137 | public int getORBServerPort() |
aoqi@0 | 138 | { |
aoqi@0 | 139 | return ORBServerPort; |
aoqi@0 | 140 | } |
aoqi@0 | 141 | |
aoqi@0 | 142 | public com.sun.corba.se.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory() |
aoqi@0 | 143 | { |
aoqi@0 | 144 | return legacySocketFactory; |
aoqi@0 | 145 | } |
aoqi@0 | 146 | |
aoqi@0 | 147 | public com.sun.corba.se.spi.transport.ORBSocketFactory getSocketFactory() |
aoqi@0 | 148 | { |
aoqi@0 | 149 | return socketFactory; |
aoqi@0 | 150 | } |
aoqi@0 | 151 | |
aoqi@0 | 152 | public USLPort[] getUserSpecifiedListenPorts () |
aoqi@0 | 153 | { |
aoqi@0 | 154 | return userSpecifiedListenPorts; |
aoqi@0 | 155 | } |
aoqi@0 | 156 | |
aoqi@0 | 157 | public IORToSocketInfo getIORToSocketInfo() |
aoqi@0 | 158 | { |
aoqi@0 | 159 | return iorToSocketInfo; |
aoqi@0 | 160 | } |
aoqi@0 | 161 | |
aoqi@0 | 162 | public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo() |
aoqi@0 | 163 | { |
aoqi@0 | 164 | return iiopPrimaryToContactInfo; |
aoqi@0 | 165 | } |
aoqi@0 | 166 | |
aoqi@0 | 167 | public String getORBId() |
aoqi@0 | 168 | { |
aoqi@0 | 169 | return orbId; |
aoqi@0 | 170 | } |
aoqi@0 | 171 | |
aoqi@0 | 172 | public boolean getORBServerIdPropertySpecified() |
aoqi@0 | 173 | { |
aoqi@0 | 174 | return orbServerIdPropertySpecified; |
aoqi@0 | 175 | } |
aoqi@0 | 176 | |
aoqi@0 | 177 | public boolean isLocalOptimizationAllowed() |
aoqi@0 | 178 | { |
aoqi@0 | 179 | return allowLocalOptimization ; |
aoqi@0 | 180 | } |
aoqi@0 | 181 | |
aoqi@0 | 182 | public GIOPVersion getGIOPVersion() |
aoqi@0 | 183 | { |
aoqi@0 | 184 | return giopVersion; |
aoqi@0 | 185 | } |
aoqi@0 | 186 | |
aoqi@0 | 187 | public int getHighWaterMark() |
aoqi@0 | 188 | { |
aoqi@0 | 189 | return highWaterMark; |
aoqi@0 | 190 | } |
aoqi@0 | 191 | |
aoqi@0 | 192 | public int getLowWaterMark() |
aoqi@0 | 193 | { |
aoqi@0 | 194 | return lowWaterMark; |
aoqi@0 | 195 | } |
aoqi@0 | 196 | |
aoqi@0 | 197 | public int getNumberToReclaim() |
aoqi@0 | 198 | { |
aoqi@0 | 199 | return numberToReclaim; |
aoqi@0 | 200 | } |
aoqi@0 | 201 | |
aoqi@0 | 202 | public int getGIOPFragmentSize() |
aoqi@0 | 203 | { |
aoqi@0 | 204 | return giopFragmentSize; |
aoqi@0 | 205 | } |
aoqi@0 | 206 | |
aoqi@0 | 207 | public int getGIOPBufferSize() |
aoqi@0 | 208 | { |
aoqi@0 | 209 | return giopBufferSize; |
aoqi@0 | 210 | } |
aoqi@0 | 211 | |
aoqi@0 | 212 | public int getGIOPBuffMgrStrategy(GIOPVersion gv) |
aoqi@0 | 213 | { |
aoqi@0 | 214 | if(gv!=null){ |
aoqi@0 | 215 | if (gv.equals(GIOPVersion.V1_0)) return 0; //Always grow for 1.0 |
aoqi@0 | 216 | if (gv.equals(GIOPVersion.V1_1)) return giop11BuffMgr; |
aoqi@0 | 217 | if (gv.equals(GIOPVersion.V1_2)) return giop12BuffMgr; |
aoqi@0 | 218 | } |
aoqi@0 | 219 | //If a "faulty" GIOPVersion is passed, it's going to return 0; |
aoqi@0 | 220 | return 0; |
aoqi@0 | 221 | } |
aoqi@0 | 222 | |
aoqi@0 | 223 | /** |
aoqi@0 | 224 | * @return the GIOP Target Addressing preference of the ORB. |
aoqi@0 | 225 | * This ORB by default supports all addressing dispositions unless specified |
aoqi@0 | 226 | * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING |
aoqi@0 | 227 | */ |
aoqi@0 | 228 | public short getGIOPTargetAddressPreference() |
aoqi@0 | 229 | { |
aoqi@0 | 230 | return giopTargetAddressPreference; |
aoqi@0 | 231 | } |
aoqi@0 | 232 | |
aoqi@0 | 233 | public short getGIOPAddressDisposition() |
aoqi@0 | 234 | { |
aoqi@0 | 235 | return giopAddressDisposition; |
aoqi@0 | 236 | } |
aoqi@0 | 237 | |
aoqi@0 | 238 | public boolean useByteOrderMarkers() |
aoqi@0 | 239 | { |
aoqi@0 | 240 | return useByteOrderMarkers; |
aoqi@0 | 241 | } |
aoqi@0 | 242 | |
aoqi@0 | 243 | public boolean useByteOrderMarkersInEncapsulations() |
aoqi@0 | 244 | { |
aoqi@0 | 245 | return useByteOrderMarkersInEncaps; |
aoqi@0 | 246 | } |
aoqi@0 | 247 | |
aoqi@0 | 248 | public boolean alwaysSendCodeSetServiceContext() |
aoqi@0 | 249 | { |
aoqi@0 | 250 | return alwaysSendCodeSetCtx; |
aoqi@0 | 251 | } |
aoqi@0 | 252 | |
aoqi@0 | 253 | public boolean getPersistentPortInitialized() |
aoqi@0 | 254 | { |
aoqi@0 | 255 | return persistentPortInitialized ; |
aoqi@0 | 256 | } |
aoqi@0 | 257 | |
aoqi@0 | 258 | //public void setPersistentServerPort(int sp) |
aoqi@0 | 259 | //{ |
aoqi@0 | 260 | //persistentServerPort = sp; |
aoqi@0 | 261 | //persistentPortInitialized = true; |
aoqi@0 | 262 | //} |
aoqi@0 | 263 | |
aoqi@0 | 264 | public int getPersistentServerPort() |
aoqi@0 | 265 | { |
aoqi@0 | 266 | if ( persistentPortInitialized ) // this is a user-activated server |
aoqi@0 | 267 | return persistentServerPort; |
aoqi@0 | 268 | else { |
aoqi@0 | 269 | throw wrapper.persistentServerportNotSet( |
aoqi@0 | 270 | CompletionStatus.COMPLETED_MAYBE ); |
aoqi@0 | 271 | } |
aoqi@0 | 272 | } |
aoqi@0 | 273 | |
aoqi@0 | 274 | public boolean getPersistentServerIdInitialized() |
aoqi@0 | 275 | { |
aoqi@0 | 276 | return persistentServerIdInitialized; |
aoqi@0 | 277 | } |
aoqi@0 | 278 | |
aoqi@0 | 279 | /** Set the persistent-server-id of this server. This id is the same |
aoqi@0 | 280 | * across multiple activations of this server. The id can be set to any |
aoqi@0 | 281 | * integer value other than 0. This id must be set before any persistent |
aoqi@0 | 282 | * objects can be created. |
aoqi@0 | 283 | */ |
aoqi@0 | 284 | //public void setPersistentServerId(int id) |
aoqi@0 | 285 | //{ |
aoqi@0 | 286 | //persistentServerId = id; |
aoqi@0 | 287 | //persistentServerIdInitialized = true; |
aoqi@0 | 288 | //} |
aoqi@0 | 289 | |
aoqi@0 | 290 | /** Return the persistent-server-id of this server. This id is the same |
aoqi@0 | 291 | * across multiple activations of this server. This is in contrast to |
aoqi@0 | 292 | * com.sun.corba.se.impl.iiop.ORB.getTransientServerId() which |
aoqi@0 | 293 | * returns a transient id that is guaranteed to be different |
aoqi@0 | 294 | * across multiple activations of |
aoqi@0 | 295 | * this server. The user/environment is required to supply the |
aoqi@0 | 296 | * persistent-server-id every time this server is started, in |
aoqi@0 | 297 | * the ORBServerId parameter, System properties, or other means. |
aoqi@0 | 298 | * The user is also required to ensure that no two persistent servers |
aoqi@0 | 299 | * on the same host have the same server-id. |
aoqi@0 | 300 | */ |
aoqi@0 | 301 | public int getPersistentServerId() |
aoqi@0 | 302 | { |
aoqi@0 | 303 | if ( persistentServerIdInitialized ) { |
aoqi@0 | 304 | return persistentServerId; |
aoqi@0 | 305 | } else { |
aoqi@0 | 306 | throw wrapper.persistentServeridNotSet( |
aoqi@0 | 307 | CompletionStatus.COMPLETED_MAYBE); |
aoqi@0 | 308 | } |
aoqi@0 | 309 | } |
aoqi@0 | 310 | |
aoqi@0 | 311 | public boolean getServerIsORBActivated() |
aoqi@0 | 312 | { |
aoqi@0 | 313 | return serverIsORBActivated ; |
aoqi@0 | 314 | } |
aoqi@0 | 315 | |
aoqi@0 | 316 | public Class getBadServerIdHandler() |
aoqi@0 | 317 | { |
aoqi@0 | 318 | return badServerIdHandlerClass ; |
aoqi@0 | 319 | } |
aoqi@0 | 320 | |
aoqi@0 | 321 | /** |
aoqi@0 | 322 | * Get the prefered code sets for connections. Should the client send the code set service context on every |
aoqi@0 | 323 | * request? |
aoqi@0 | 324 | */ |
aoqi@0 | 325 | public CodeSetComponentInfo getCodeSetComponentInfo() |
aoqi@0 | 326 | { |
aoqi@0 | 327 | return codesets; |
aoqi@0 | 328 | } |
aoqi@0 | 329 | |
aoqi@0 | 330 | public ORBInitializer[] getORBInitializers() |
aoqi@0 | 331 | { |
aoqi@0 | 332 | return orbInitializers ; |
aoqi@0 | 333 | } |
aoqi@0 | 334 | |
aoqi@0 | 335 | public StringPair[] getORBInitialReferences() |
aoqi@0 | 336 | { |
aoqi@0 | 337 | return orbInitialReferences ; |
aoqi@0 | 338 | } |
aoqi@0 | 339 | |
aoqi@0 | 340 | public String getORBDefaultInitialReference() |
aoqi@0 | 341 | { |
aoqi@0 | 342 | return defaultInitRef ; |
aoqi@0 | 343 | } |
aoqi@0 | 344 | |
aoqi@0 | 345 | public String[] getORBDebugFlags() |
aoqi@0 | 346 | { |
aoqi@0 | 347 | return debugFlags ; |
aoqi@0 | 348 | } |
aoqi@0 | 349 | |
aoqi@0 | 350 | public Acceptor[] getAcceptors() |
aoqi@0 | 351 | { |
aoqi@0 | 352 | return acceptors; |
aoqi@0 | 353 | } |
aoqi@0 | 354 | |
aoqi@0 | 355 | public CorbaContactInfoListFactory getCorbaContactInfoListFactory() |
aoqi@0 | 356 | { |
aoqi@0 | 357 | return corbaContactInfoListFactory; |
aoqi@0 | 358 | } |
aoqi@0 | 359 | |
aoqi@0 | 360 | public String acceptorSocketType() |
aoqi@0 | 361 | { |
aoqi@0 | 362 | return acceptorSocketType; |
aoqi@0 | 363 | } |
aoqi@0 | 364 | public boolean acceptorSocketUseSelectThreadToWait() |
aoqi@0 | 365 | { |
aoqi@0 | 366 | return acceptorSocketUseSelectThreadToWait; |
aoqi@0 | 367 | } |
aoqi@0 | 368 | public boolean acceptorSocketUseWorkerThreadForEvent() |
aoqi@0 | 369 | { |
aoqi@0 | 370 | return acceptorSocketUseWorkerThreadForEvent; |
aoqi@0 | 371 | } |
aoqi@0 | 372 | public String connectionSocketType() |
aoqi@0 | 373 | { |
aoqi@0 | 374 | return connectionSocketType; |
aoqi@0 | 375 | } |
aoqi@0 | 376 | public boolean connectionSocketUseSelectThreadToWait() |
aoqi@0 | 377 | { |
aoqi@0 | 378 | return connectionSocketUseSelectThreadToWait; |
aoqi@0 | 379 | } |
aoqi@0 | 380 | public boolean connectionSocketUseWorkerThreadForEvent() |
aoqi@0 | 381 | { |
aoqi@0 | 382 | return connectionSocketUseWorkerThreadForEvent; |
aoqi@0 | 383 | } |
aoqi@0 | 384 | public boolean isJavaSerializationEnabled() |
aoqi@0 | 385 | { |
aoqi@0 | 386 | return enableJavaSerialization; |
aoqi@0 | 387 | } |
aoqi@0 | 388 | public ReadTimeouts getTransportTCPReadTimeouts() |
aoqi@0 | 389 | { |
aoqi@0 | 390 | return readTimeouts; |
aoqi@0 | 391 | } |
aoqi@0 | 392 | public boolean disableDirectByteBufferUse() |
aoqi@0 | 393 | { |
aoqi@0 | 394 | return disableDirectByteBufferUse ; |
aoqi@0 | 395 | } |
aoqi@0 | 396 | public boolean useRepId() |
aoqi@0 | 397 | { |
aoqi@0 | 398 | return useRepId; |
aoqi@0 | 399 | } |
aoqi@0 | 400 | |
aoqi@0 | 401 | // Methods for constructing and initializing this object =========================================== |
aoqi@0 | 402 | |
aoqi@0 | 403 | public ORBDataParserImpl( ORB orb, DataCollector coll ) |
aoqi@0 | 404 | { |
aoqi@0 | 405 | super( ParserTable.get().getParserData() ) ; |
aoqi@0 | 406 | this.orb = orb ; |
aoqi@0 | 407 | wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ; |
aoqi@0 | 408 | init( coll ) ; |
aoqi@0 | 409 | complete() ; |
aoqi@0 | 410 | } |
aoqi@0 | 411 | |
aoqi@0 | 412 | public void complete() |
aoqi@0 | 413 | { |
aoqi@0 | 414 | codesets = new CodeSetComponentInfo(charData, wcharData); |
aoqi@0 | 415 | } |
aoqi@0 | 416 | } |
aoqi@0 | 417 | |
aoqi@0 | 418 | // End of file. |