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