diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2009-05-27 12:29:18 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2009-05-27 12:29:18 -0230 |
commit | 781e357a2e4703af1d292d1169ad9f1249792330 (patch) | |
tree | b49458392e6e3d99dc97e5f817d499276768a1d4 /java/src | |
parent | Bug 3502: Improve javadoc support in Eclipse (diff) | |
download | ice-781e357a2e4703af1d292d1169ad9f1249792330.tar.bz2 ice-781e357a2e4703af1d292d1169ad9f1249792330.tar.xz ice-781e357a2e4703af1d292d1169ad9f1249792330.zip |
Bug 3964 - improve endpoint info
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Ice/ObjectAdapterI.java | 18 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointFactoryManager.java | 6 | ||||
-rw-r--r-- | java/src/IceInternal/EndpointI.java | 5 | ||||
-rw-r--r-- | java/src/IceInternal/OpaqueEndpointI.java (renamed from java/src/IceInternal/UnknownEndpointI.java) | 20 | ||||
-rw-r--r-- | java/src/IceInternal/RoutableReference.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/TcpEndpointI.java | 19 | ||||
-rw-r--r-- | java/src/IceInternal/UdpEndpointI.java | 38 | ||||
-rw-r--r-- | java/src/IceSSL/EndpointI.java | 19 |
8 files changed, 94 insertions, 35 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 03d8ae52309..8fbfb2bc4f8 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -595,6 +595,24 @@ public final class ObjectAdapterI implements ObjectAdapter } } + public synchronized Endpoint[] + getEndpoints() + { + java.util.List<Endpoint> endpoints = new java.util.ArrayList<Endpoint>(); + for(int i = 0; i < _incomingConnectionFactories.size(); ++i) + { + IceInternal.IncomingConnectionFactory factory = _incomingConnectionFactories.get(i); + endpoints.add(factory.endpoint()); + } + return endpoints.toArray(new Endpoint[0]); + } + + public synchronized Endpoint[] + getPublishedEndpoints() + { + return _publishedEndpoints.toArray(new Endpoint[0]); + } + public boolean isLocal(ObjectPrx proxy) { diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index 4e7c302b248..de816428863 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -83,7 +83,7 @@ public final class EndpointFactoryManager java.nio.ByteBuffer buf = bs.getBuffer(); buf.position(0); short type = bs.readShort(); - EndpointI ue = new IceInternal.UnknownEndpointI(type, bs); + EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); System.err.println("Normal: " + e); System.err.println("Opaque: " + ue); return e; @@ -97,7 +97,7 @@ public final class EndpointFactoryManager // if(protocol.equals("opaque")) { - EndpointI ue = new UnknownEndpointI(s.substring(m.end())); + EndpointI ue = new OpaqueEndpointI(s.substring(m.end())); for(int i = 0; i < _factories.size(); i++) { EndpointFactory f = _factories.get(i); @@ -135,7 +135,7 @@ public final class EndpointFactoryManager return f.read(s); } } - return new UnknownEndpointI(type, s); + return new OpaqueEndpointI(type, s); } void diff --git a/java/src/IceInternal/EndpointI.java b/java/src/IceInternal/EndpointI.java index 77073f86fa1..a95260b4924 100644 --- a/java/src/IceInternal/EndpointI.java +++ b/java/src/IceInternal/EndpointI.java @@ -69,11 +69,6 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En public abstract boolean secure(); // - // Return true if the endpoint type is unknown. - // - public abstract boolean unknown(); - - // // Return a server side transceiver for this endpoint, or null if a // transceiver can only be created by an acceptor. In case a // transceiver is created, this operation also returns a new diff --git a/java/src/IceInternal/UnknownEndpointI.java b/java/src/IceInternal/OpaqueEndpointI.java index d21d5d0030d..51006ba5f5c 100644 --- a/java/src/IceInternal/UnknownEndpointI.java +++ b/java/src/IceInternal/OpaqueEndpointI.java @@ -9,10 +9,10 @@ package IceInternal; -final class UnknownEndpointI extends EndpointI +final class OpaqueEndpointI extends EndpointI implements Ice.OpaqueEndpoint { public - UnknownEndpointI(String str) + OpaqueEndpointI(String str) { int topt = 0; int vopt = 0; @@ -101,7 +101,7 @@ final class UnknownEndpointI extends EndpointI } public - UnknownEndpointI(short type, BasicStream s) + OpaqueEndpointI(short type, BasicStream s) { _type = type; s.startReadEncaps(); @@ -212,14 +212,14 @@ final class UnknownEndpointI extends EndpointI } // - // Return true if the endpoint type is unknown. + // Get the encoded endpoint. // - public boolean - unknown() + public byte[] + rawBytes() { - return true; + return _rawBytes; } - + // // Return a server side transceiver for this endpoint, or null if a // transceiver can only be created by an acceptor. In case a @@ -312,11 +312,11 @@ final class UnknownEndpointI extends EndpointI public int compareTo(EndpointI obj) // From java.lang.Comparable { - UnknownEndpointI p = null; + OpaqueEndpointI p = null; try { - p = (UnknownEndpointI)obj; + p = (OpaqueEndpointI)obj; } catch(ClassCastException ex) { diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java index 654aecc41f4..f73aa78a368 100644 --- a/java/src/IceInternal/RoutableReference.java +++ b/java/src/IceInternal/RoutableReference.java @@ -647,11 +647,11 @@ public class RoutableReference extends Reference java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); // - // Filter out unknown endpoints. + // Filter out opaque endpoints. // for(EndpointI endpoint : allEndpoints) { - if(!endpoint.unknown()) + if(!(endpoint instanceof Ice.OpaqueEndpoint)) { endpoints.add(endpoint); } diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java index c599a9c1687..15689f61566 100644 --- a/java/src/IceInternal/TcpEndpointI.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -9,7 +9,7 @@ package IceInternal; -final class TcpEndpointI extends EndpointI +final class TcpEndpointI extends EndpointI implements Ice.TcpEndpoint { final static short TYPE = 1; @@ -330,12 +330,21 @@ final class TcpEndpointI extends EndpointI } // - // Return true if the endpoint type is unknown. + // Get the host name. // - public boolean - unknown() + public String + host() { - return false; + return _host; + } + + // + // Get the port number. + // + public int + port() + { + return _port; } // diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java index 4759595d2a7..c81838ab617 100644 --- a/java/src/IceInternal/UdpEndpointI.java +++ b/java/src/IceInternal/UdpEndpointI.java @@ -9,7 +9,7 @@ package IceInternal; -final class UdpEndpointI extends EndpointI +final class UdpEndpointI extends EndpointI implements Ice.UdpEndpoint { final static short TYPE = 3; @@ -493,15 +493,43 @@ final class UdpEndpointI extends EndpointI } // - // Return true if the endpoint type is unknown. + // Get the host name. // - public boolean - unknown() + public String + host() { - return false; + return _host; + } + + // + // Get the port number. + // + public int + port() + { + return _port; + } + + // + // Get the multicast interface. + // + public String + mcastInterface() + { + return _mcastInterface; } // + // Get the multicast time-to-live. + // + public int + mcastTtl() + { + return _mcastTtl; + } + + + // // Return a server side transceiver for this endpoint, or null if a // transceiver can only be created by an acceptor. In case a // transceiver is created, this operation also returns a new diff --git a/java/src/IceSSL/EndpointI.java b/java/src/IceSSL/EndpointI.java index 3ab830199ef..c3a3a4e05a5 100644 --- a/java/src/IceSSL/EndpointI.java +++ b/java/src/IceSSL/EndpointI.java @@ -9,7 +9,7 @@ package IceSSL; -final class EndpointI extends IceInternal.EndpointI +final class EndpointI extends IceInternal.EndpointI implements IceSSL.SslEndpoint { final static short TYPE = 2; @@ -330,12 +330,21 @@ final class EndpointI extends IceInternal.EndpointI } // - // Return true if the endpoint type is unknown. + // Get the host name. // - public boolean - unknown() + public String + host() { - return false; + return _host; + } + + // + // Get the port number. + // + public int + port() + { + return _port; } // |