KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > orb > ORBDataParserImpl


1 /*
2  * @(#)ORBDataParserImpl.java 1.32 05/01/04
3  *
4  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8
9 package com.sun.corba.se.impl.orb ;
10
11 import java.net.URL JavaDoc ;
12
13 import org.omg.CORBA.CompletionStatus JavaDoc ;
14 import org.omg.PortableInterceptor.ORBInitializer JavaDoc ;
15
16 import com.sun.corba.se.pept.transport.Acceptor;
17
18 import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
19 import com.sun.corba.se.spi.logging.CORBALogDomains ;
20 import com.sun.corba.se.spi.orb.DataCollector ;
21 import com.sun.corba.se.spi.orb.ORB ;
22 import com.sun.corba.se.spi.orb.ORBData ;
23 import com.sun.corba.se.spi.orb.ParserImplTableBase ;
24 import com.sun.corba.se.spi.orb.StringPair ;
25 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
26 import com.sun.corba.se.spi.transport.CorbaTransportManager;
27 import com.sun.corba.se.spi.transport.IORToSocketInfo;
28 import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
29 import com.sun.corba.se.spi.transport.ReadTimeouts;
30
31 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
32 import com.sun.corba.se.impl.legacy.connection.USLPort;
33 import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
34 import com.sun.corba.se.impl.orbutil.ORBConstants ;
35 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
36
37
38 public class ORBDataParserImpl extends ParserImplTableBase implements ORBData
39 {
40     private ORB orb ;
41     private ORBUtilSystemException wrapper ;
42     private String JavaDoc ORBInitialHost ;
43     private int ORBInitialPort ;
44     private String JavaDoc ORBServerHost ;
45     private int ORBServerPort ;
46     private String JavaDoc listenOnAllInterfaces;
47     private com.sun.corba.se.spi.legacy.connection.ORBSocketFactory legacySocketFactory ;
48     private com.sun.corba.se.spi.transport.ORBSocketFactory socketFactory;
49     private USLPort[] userSpecifiedListenPorts ;
50     private IORToSocketInfo iorToSocketInfo;
51     private IIOPPrimaryToContactInfo iiopPrimaryToContactInfo;
52     private String JavaDoc orbId ;
53     private boolean orbServerIdPropertySpecified ;
54     private URL JavaDoc servicesURL ;
55     private String JavaDoc propertyInitRef ;
56     private boolean allowLocalOptimization ;
57     private GIOPVersion giopVersion ;
58     private int highWaterMark ;
59     private int lowWaterMark ;
60     private int numberToReclaim ;
61     private int giopFragmentSize ;
62     private int giopBufferSize ;
63     private int giop11BuffMgr ;
64     private int giop12BuffMgr ;
65     private short giopTargetAddressPreference ;
66     private short giopAddressDisposition ;
67     private boolean useByteOrderMarkers ;
68     private boolean useByteOrderMarkersInEncaps ;
69     private boolean alwaysSendCodeSetCtx ;
70     private boolean persistentPortInitialized ;
71     private int persistentServerPort ;
72     private boolean persistentServerIdInitialized ;
73     private int persistentServerId ;
74     private boolean serverIsORBActivated ;
75     private Class JavaDoc badServerIdHandlerClass ;
76     private CodeSetComponentInfo.CodeSetComponent charData ;
77     private CodeSetComponentInfo.CodeSetComponent wcharData ;
78     private ORBInitializer JavaDoc[] orbInitializers ;
79     private StringPair[] orbInitialReferences ;
80     private String JavaDoc defaultInitRef ;
81     private String JavaDoc[] debugFlags ;
82     private Acceptor[] acceptors;
83     private CorbaContactInfoListFactory corbaContactInfoListFactory;
84     private String JavaDoc acceptorSocketType;
85     private boolean acceptorSocketUseSelectThreadToWait;
86     private boolean acceptorSocketUseWorkerThreadForEvent;
87     private String JavaDoc connectionSocketType;
88     private boolean connectionSocketUseSelectThreadToWait;
89     private boolean connectionSocketUseWorkerThreadForEvent;
90     private ReadTimeouts readTimeouts;
91     private boolean disableDirectByteBufferUse;
92     private boolean enableJavaSerialization;
93     private boolean useRepId;
94
95     // This is not initialized from ParserTable.
96
private CodeSetComponentInfo codesets ;
97
98 // Public accessor methods ========================================================================
99

100     public String JavaDoc getORBInitialHost()
101     {
102     return ORBInitialHost;
103     }
104
105     public int getORBInitialPort()
106     {
107     return ORBInitialPort;
108     }
109
110     public String JavaDoc getORBServerHost()
111     {
112     return ORBServerHost;
113     }
114
115     public String JavaDoc getListenOnAllInterfaces()
116     {
117     return listenOnAllInterfaces;
118     }
119
120     public int getORBServerPort()
121     {
122     return ORBServerPort;
123     }
124
125     public com.sun.corba.se.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory()
126     {
127     return legacySocketFactory;
128     }
129
130     public com.sun.corba.se.spi.transport.ORBSocketFactory getSocketFactory()
131     {
132     return socketFactory;
133     }
134
135     public USLPort[] getUserSpecifiedListenPorts ()
136     {
137     return userSpecifiedListenPorts;
138     }
139
140     public IORToSocketInfo getIORToSocketInfo()
141     {
142     return iorToSocketInfo;
143     }
144
145     public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo()
146     {
147     return iiopPrimaryToContactInfo;
148     }
149
150     public String JavaDoc getORBId()
151     {
152     return orbId;
153     }
154
155     public boolean getORBServerIdPropertySpecified()
156     {
157     return orbServerIdPropertySpecified;
158     }
159
160     public boolean isLocalOptimizationAllowed()
161     {
162     return allowLocalOptimization ;
163     }
164
165     public GIOPVersion getGIOPVersion()
166     {
167     return giopVersion;
168     }
169
170     public int getHighWaterMark()
171     {
172     return highWaterMark;
173     }
174
175     public int getLowWaterMark()
176     {
177     return lowWaterMark;
178     }
179
180     public int getNumberToReclaim()
181     {
182     return numberToReclaim;
183     }
184
185     public int getGIOPFragmentSize()
186     {
187     return giopFragmentSize;
188     }
189
190     public int getGIOPBufferSize()
191     {
192     return giopBufferSize;
193     }
194
195     public int getGIOPBuffMgrStrategy(GIOPVersion gv)
196     {
197         if(gv!=null){
198             if (gv.equals(GIOPVersion.V1_0)) return 0; //Always grow for 1.0
199
if (gv.equals(GIOPVersion.V1_1)) return giop11BuffMgr;
200             if (gv.equals(GIOPVersion.V1_2)) return giop12BuffMgr;
201         }
202         //If a "faulty" GIOPVersion is passed, it's going to return 0;
203
return 0;
204     }
205
206     /**
207      * @return the GIOP Target Addressing preference of the ORB.
208      * This ORB by default supports all addressing dispositions unless specified
209      * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING
210      */

211     public short getGIOPTargetAddressPreference()
212     {
213     return giopTargetAddressPreference;
214     }
215
216     public short getGIOPAddressDisposition()
217     {
218     return giopAddressDisposition;
219     }
220
221     public boolean useByteOrderMarkers()
222     {
223     return useByteOrderMarkers;
224     }
225
226     public boolean useByteOrderMarkersInEncapsulations()
227     {
228     return useByteOrderMarkersInEncaps;
229     }
230
231     public boolean alwaysSendCodeSetServiceContext()
232     {
233     return alwaysSendCodeSetCtx;
234     }
235
236     public boolean getPersistentPortInitialized()
237     {
238     return persistentPortInitialized ;
239     }
240
241     //public void setPersistentServerPort(int sp)
242
//{
243
//persistentServerPort = sp;
244
//persistentPortInitialized = true;
245
//}
246

247     public int getPersistentServerPort()
248     {
249     if ( persistentPortInitialized ) // this is a user-activated server
250
return persistentServerPort;
251     else {
252         throw wrapper.persistentServerportNotSet(
253         CompletionStatus.COMPLETED_MAYBE );
254     }
255     }
256
257     public boolean getPersistentServerIdInitialized()
258     {
259     return persistentServerIdInitialized;
260     }
261
262     /** Set the persistent-server-id of this server. This id is the same
263      * across multiple activations of this server. The id can be set to any
264      * integer value other than 0. This id must be set before any persistent
265      * objects can be created.
266      */

267     //public void setPersistentServerId(int id)
268
//{
269
//persistentServerId = id;
270
//persistentServerIdInitialized = true;
271
//}
272

273     /** Return the persistent-server-id of this server. This id is the same
274      * across multiple activations of this server. This is in contrast to
275      * com.sun.corba.se.impl.iiop.ORB.getTransientServerId() which
276      * returns a transient id that is guaranteed to be different
277      * across multiple activations of
278      * this server. The user/environment is required to supply the
279      * persistent-server-id every time this server is started, in
280      * the ORBServerId parameter, System properties, or other means.
281      * The user is also required to ensure that no two persistent servers
282      * on the same host have the same server-id.
283      */

284     public int getPersistentServerId()
285     {
286         if ( persistentServerIdInitialized ) {
287             return persistentServerId;
288         } else {
289         throw wrapper.persistentServeridNotSet(
290         CompletionStatus.COMPLETED_MAYBE);
291     }
292     }
293
294     public boolean getServerIsORBActivated()
295     {
296     return serverIsORBActivated ;
297     }
298
299     public Class JavaDoc getBadServerIdHandler()
300     {
301     return badServerIdHandlerClass ;
302     }
303
304      /**
305      * Get the prefered code sets for connections. Should the client send the code set service context on every
306      * request?
307      */

308     public CodeSetComponentInfo getCodeSetComponentInfo()
309     {
310     return codesets;
311     }
312
313     public ORBInitializer JavaDoc[] getORBInitializers()
314     {
315     return orbInitializers ;
316     }
317
318     public StringPair[] getORBInitialReferences()
319     {
320     return orbInitialReferences ;
321     }
322
323     public String JavaDoc getORBDefaultInitialReference()
324     {
325     return defaultInitRef ;
326     }
327
328     public String JavaDoc[] getORBDebugFlags()
329     {
330     return debugFlags ;
331     }
332
333     public Acceptor[] getAcceptors()
334     {
335     return acceptors;
336     }
337
338     public CorbaContactInfoListFactory getCorbaContactInfoListFactory()
339     {
340     return corbaContactInfoListFactory;
341     }
342
343     public String JavaDoc acceptorSocketType()
344     {
345     return acceptorSocketType;
346     }
347     public boolean acceptorSocketUseSelectThreadToWait()
348     {
349     return acceptorSocketUseSelectThreadToWait;
350     }
351     public boolean acceptorSocketUseWorkerThreadForEvent()
352     {
353     return acceptorSocketUseWorkerThreadForEvent;
354     }
355     public String JavaDoc connectionSocketType()
356     {
357     return connectionSocketType;
358     }
359     public boolean connectionSocketUseSelectThreadToWait()
360     {
361     return connectionSocketUseSelectThreadToWait;
362     }
363     public boolean connectionSocketUseWorkerThreadForEvent()
364     {
365     return connectionSocketUseWorkerThreadForEvent;
366     }
367     public boolean isJavaSerializationEnabled()
368     {
369     return enableJavaSerialization;
370     }
371     public ReadTimeouts getTransportTCPReadTimeouts()
372     {
373     return readTimeouts;
374     }
375     public boolean disableDirectByteBufferUse()
376     {
377     return disableDirectByteBufferUse ;
378     }
379     public boolean useRepId()
380     {
381     return useRepId;
382     }
383     
384 // Methods for constructing and initializing this object ===========================================
385

386     public ORBDataParserImpl( ORB orb, DataCollector coll )
387     {
388     super( ParserTable.get().getParserData() ) ;
389     this.orb = orb ;
390     wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ;
391     init( coll ) ;
392     complete() ;
393     }
394
395     public void complete()
396     {
397         codesets = new CodeSetComponentInfo(charData, wcharData);
398     }
399 }
400
401 // End of file.
402
Popular Tags