1
// **********************************************************************
3
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
5
// This copy of Ice is licensed to you under the terms described in the
6
// ICE_LICENSE file included in this distribution.
8
// **********************************************************************
12
final class UnknownEndpointI extends EndpointI
15
UnknownEndpointI(String str)
20
String[] arr = str.split("[ \t\n\r]+");
24
if(arr[i].length() == 0)
30
String option = arr[i++];
31
if(option.length() != 2 || option.charAt(0) != '-')
33
throw new Ice.EndpointParseException("opaque " + str);
36
String argument = null;
37
if(i < arr.length && arr[i].charAt(0) != '-')
42
switch(option.charAt(1))
48
throw new Ice.EndpointParseException("opaque " + str);
54
t = Integer.parseInt(argument);
56
catch(NumberFormatException ex)
58
throw new Ice.EndpointParseException("opaque " + str);
61
if(t < 0 || t > 65535)
63
throw new Ice.EndpointParseException("opaque " + str);
75
throw new Ice.EndpointParseException("opaque " + str);
77
for(int j = 0; j < argument.length(); ++j)
79
if(!IceUtilInternal.Base64.isBase64(argument.charAt(j)))
81
throw new Ice.EndpointParseException("opaque " + str);
84
_rawBytes = IceUtilInternal.Base64.decode(argument);
91
throw new Ice.EndpointParseException("opaque " + str);
96
if(topt != 1 || vopt != 1)
98
throw new Ice.EndpointParseException("opaque " + str);
104
UnknownEndpointI(short type, BasicStream s)
108
int sz = s.getReadEncapsSize();
109
_rawBytes = s.readBlob(sz);
115
// Marshal the endpoint
118
streamWrite(BasicStream s)
121
s.startWriteEncaps();
122
s.writeBlob(_rawBytes);
127
// Convert the endpoint to its string form
132
String val = IceUtilInternal.Base64.encode(_rawBytes);
133
return "opaque -t " + _type + " -v " + val;
137
// Return the endpoint type
146
// Return the timeout for the endpoint in milliseconds. 0 means
147
// non-blocking, -1 means no timeout.
156
// Return a new endpoint with a different timeout value, provided
157
// that timeouts are supported by the endpoint. Otherwise the same
158
// endpoint is returned.
167
// Return a new endpoint with a different connection id.
170
connectionId(String connectionId)
176
// Return true if the endpoints support bzip2 compress, or false
186
// Return a new endpoint with a different compression value,
187
// provided that compression is supported by the
188
// endpoint. Otherwise the same endpoint is returned.
191
compress(boolean compress)
197
// Return true if the endpoint is datagram-based.
206
// Return true if the endpoint is secure.
215
// Return true if the endpoint type is unknown.
224
// Return a server side transceiver for this endpoint, or null if a
225
// transceiver can only be created by an acceptor. In case a
226
// transceiver is created, this operation also returns a new
227
// "effective" endpoint, which might differ from this endpoint,
228
// for example, if a dynamic port number is assigned.
231
transceiver(EndpointIHolder endpoint)
233
endpoint.value = null;
238
// Return connectors for this endpoint, or empty list if no connector
241
public java.util.List<Connector>
244
return new java.util.ArrayList<Connector>();
248
connectors_async(EndpointI_connectors callback)
250
callback.connectors(new java.util.ArrayList<Connector>());
254
// Return an acceptor for this endpoint, or null if no acceptors
255
// is available. In case an acceptor is created, this operation
256
// also returns a new "effective" endpoint, which might differ
257
// from this endpoint, for example, if a dynamic port number is
261
acceptor(EndpointIHolder endpoint, String adapterName)
263
endpoint.value = null;
268
// Expand endpoint out in to separate endpoints for each local
269
// host if listening on INADDR_ANY on server side or if no host
270
// was specified on client side.
272
public java.util.List<EndpointI>
275
java.util.List<EndpointI> endps = new java.util.ArrayList<EndpointI>();
281
// Check whether the endpoint is equivalent to another one.
284
equivalent(EndpointI endpoint)
296
// Compare endpoints for sorting purposes
299
equals(java.lang.Object obj)
303
return compareTo((EndpointI)obj) == 0;
305
catch(ClassCastException ee)
313
compareTo(EndpointI obj) // From java.lang.Comparable
315
UnknownEndpointI p = null;
319
p = (UnknownEndpointI)obj;
321
catch(ClassCastException ex)
335
else if(p._type < _type)
340
if(_rawBytes.length < p._rawBytes.length)
344
else if(p._rawBytes.length < _rawBytes.length)
348
for(int i = 0; i < _rawBytes.length; i++)
350
if(_rawBytes[i] < p._rawBytes[i])
354
else if(p._rawBytes[i] < _rawBytes[i])
367
for(int i = 0; i < _rawBytes.length; i++)
369
_hashCode = 5 * _hashCode + _rawBytes[i];
374
private byte[] _rawBytes;
375
private int _hashCode;