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

Thu, 31 Aug 2017 18:10:36 +0800

author
aoqi
date
Thu, 31 Aug 2017 18:10:36 +0800
changeset 748
6845b95cba6b
parent 475
39d15bbb5741
parent 0
7ef37b2cdcad
permissions
-rw-r--r--

merge

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

mercurial