diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-09-09 09:37:35 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-09-09 09:37:35 +0000 |
commit | b2ea05d550077826840214a453b1ba0ac1418b39 (patch) | |
tree | d6c37e3857d25733c95b19ad2013e59a8ba3c95b /java/src | |
parent | Added new proxy methods: ice_getEndpoints(), ice_getAdapterId(), (diff) | |
download | ice-b2ea05d550077826840214a453b1ba0ac1418b39.tar.bz2 ice-b2ea05d550077826840214a453b1ba0ac1418b39.tar.xz ice-b2ea05d550077826840214a453b1ba0ac1418b39.zip |
Added support for new proxy methods (ice_getAdapterId(),
ice_newAdapterId(), ice_getEndpoints(), ice_newEndpoints()).
Diffstat (limited to 'java/src')
25 files changed, 307 insertions, 179 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index cd1077dff8f..bb2683af69e 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -962,7 +962,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne } } - public IceInternal.Endpoint + public IceInternal.EndpointI endpoint() { // No mutex protection necessary, _endpoint is immutable. @@ -1248,7 +1248,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne } public ConnectionI(IceInternal.Instance instance, IceInternal.Transceiver transceiver, - IceInternal.Endpoint endpoint, ObjectAdapter adapter) + IceInternal.EndpointI endpoint, ObjectAdapter adapter) { super(instance); _transceiver = transceiver; @@ -2401,7 +2401,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne private IceInternal.Transceiver _transceiver; private final String _desc; private final String _type; - private final IceInternal.Endpoint _endpoint; + private final IceInternal.EndpointI _endpoint; private ObjectAdapter _adapter; private IceInternal.ServantManager _servantManager; diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index 79edfa2c418..6ba0cc87d42 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -480,7 +480,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // Create a reference and return a reverse proxy for this // reference. // - IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0]; + IceInternal.EndpointI[] endpoints = new IceInternal.EndpointI[0]; ConnectionI[] arr = new ConnectionI[connections.size()]; connections.toArray(arr); IceInternal.Reference ref = _instance.referenceFactory().create(ident, new java.util.HashMap(), "", @@ -501,7 +501,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // adapter. // ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)routerInfo.getServerProxy(); - IceInternal.Endpoint[] endpoints = proxy.__reference().getEndpoints(); + IceInternal.EndpointI[] endpoints = proxy.__reference().getEndpoints(); for(int i = 0; i < endpoints.length; ++i) { _routerEndpoints.add(endpoints[i]); @@ -562,7 +562,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt checkForDeactivation(); IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference(); - final IceInternal.Endpoint[] endpoints = ref.getEndpoints(); + final IceInternal.EndpointI[] endpoints = ref.getEndpoints(); try { @@ -714,7 +714,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt java.util.ArrayList endpoints = parseEndpoints(endpointInfo); for(int i = 0; i < endpoints.size(); ++i) { - IceInternal.Endpoint endp = (IceInternal.Endpoint)endpoints.get(i); + IceInternal.EndpointI endp = (IceInternal.EndpointI)endpoints.get(i); _incomingConnectionFactories.add(new IceInternal.IncomingConnectionFactory(instance, endp, this)); } @@ -805,7 +805,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // Create a reference with the adapter id and return a // proxy for the reference. // - IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0]; + IceInternal.EndpointI[] endpoints = new IceInternal.EndpointI[0]; ConnectionI[] connections = new ConnectionI[0]; IceInternal.Reference reference = _instance.referenceFactory().create(ident, new java.util.HashMap(), facet, @@ -818,7 +818,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt private ObjectPrx newDirectProxy(Identity ident, String facet) { - IceInternal.Endpoint[] endpoints; + IceInternal.EndpointI[] endpoints; // // Use the published endpoints, otherwise use the endpoints from all @@ -827,13 +827,13 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt int sz = _publishedEndpoints.size(); if(sz > 0) { - endpoints = new IceInternal.Endpoint[sz + _routerEndpoints.size()]; + endpoints = new IceInternal.EndpointI[sz + _routerEndpoints.size()]; _publishedEndpoints.toArray(endpoints); } else { sz = _incomingConnectionFactories.size(); - endpoints = new IceInternal.Endpoint[sz + _routerEndpoints.size()]; + endpoints = new IceInternal.EndpointI[sz + _routerEndpoints.size()]; for(int i = 0; i < sz; ++i) { IceInternal.IncomingConnectionFactory factory = @@ -849,7 +849,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt // for(int i = 0; i < _routerEndpoints.size(); ++i) { - endpoints[sz + i] = (IceInternal.Endpoint)_routerEndpoints.get(i); + endpoints[sz + i] = (IceInternal.EndpointI)_routerEndpoints.get(i); } // @@ -928,7 +928,7 @@ public final class ObjectAdapterI extends LocalObjectImpl implements ObjectAdapt } String s = endpts.substring(beg, end); - IceInternal.Endpoint endp = _instance.endpointFactoryManager().create(s); + IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s); if(endp == null) { Ice.EndpointParseException e = new Ice.EndpointParseException(); diff --git a/java/src/Ice/ObjectPrx.java b/java/src/Ice/ObjectPrx.java index c7d6ac1cca4..bb5a155e671 100644 --- a/java/src/Ice/ObjectPrx.java +++ b/java/src/Ice/ObjectPrx.java @@ -48,6 +48,12 @@ public interface ObjectPrx String ice_getFacet(); ObjectPrx ice_newFacet(String newFacet); + String ice_getAdapterId(); + ObjectPrx ice_newAdapterId(String newAdapterId); + + Endpoint[] ice_getEndpoints(); + ObjectPrx ice_newEndpoints(Endpoint[] newEndpoints); + ObjectPrx ice_twoway(); boolean ice_isTwoway(); ObjectPrx ice_oneway(); diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index 96d0687cbb0..9f350845d43 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -274,6 +274,48 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final String + ice_getAdapterId() + { + return _reference.getAdapterId(); + } + + public final ObjectPrx + ice_newAdapterId(String newAdapterId) + { + if(newAdapterId.equals(_reference.getAdapterId())) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeAdapterId(newAdapterId)); + return proxy; + } + } + + public final Endpoint[] + ice_getEndpoints() + { + return _reference.getEndpoints(); + } + + public final ObjectPrx + ice_newEndpoints(Endpoint[] newEndpoints) + { + if(java.util.Arrays.equals(newEndpoints, _reference.getEndpoints())) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeEndpoints((IceInternal.EndpointI[])newEndpoints)); + return proxy; + } + } + public final ObjectPrx ice_twoway() { diff --git a/java/src/IceInternal/DirectReference.java b/java/src/IceInternal/DirectReference.java index 1a0893281a3..67565c6adcc 100644 --- a/java/src/IceInternal/DirectReference.java +++ b/java/src/IceInternal/DirectReference.java @@ -19,7 +19,7 @@ public class DirectReference extends RoutableReference String fs, int md, boolean sec, - Endpoint[] endpts, + EndpointI[] endpts, RouterInfo rtrInfo, boolean collocationOpt) { @@ -27,21 +27,16 @@ public class DirectReference extends RoutableReference _endpoints = endpts; } - public Endpoint[] getEndpoints() + public String + getAdapterId() { - return _endpoints; + return ""; } - public final Reference - changeEndpoints(Endpoint[] newEndpoints) + public EndpointI[] + getEndpoints() { - if(compare(newEndpoints, _endpoints)) - { - return this; - } - DirectReference r = (DirectReference)getInstance().referenceFactory().copy(this); - r._endpoints = newEndpoints; - return r; + return _endpoints; } public Reference @@ -83,7 +78,7 @@ public class DirectReference extends RoutableReference changeCompress(boolean newCompress) { DirectReference r = (DirectReference)getInstance().referenceFactory().copy(this); - Endpoint[] newEndpoints = new Endpoint[_endpoints.length]; + EndpointI[] newEndpoints = new EndpointI[_endpoints.length]; for(int i = 0; i < _endpoints.length; i++) { newEndpoints[i] = _endpoints[i].compress(newCompress); @@ -96,7 +91,7 @@ public class DirectReference extends RoutableReference changeTimeout(int newTimeout) { DirectReference r = (DirectReference)getInstance().referenceFactory().copy(this); - Endpoint[] newEndpoints = new Endpoint[_endpoints.length]; + EndpointI[] newEndpoints = new EndpointI[_endpoints.length]; for(int i = 0; i < _endpoints.length; i++) { newEndpoints[i] = _endpoints[i].timeout(newTimeout); @@ -105,6 +100,32 @@ public class DirectReference extends RoutableReference return r; } + public Reference + changeAdapterId(String newAdapterId) + { + if(newAdapterId == null || newAdapterId.length() == 0) + { + return this; + } + LocatorInfo locatorInfo = + getInstance().locatorManager().get(getInstance().referenceFactory().getDefaultLocator()); + return getInstance().referenceFactory().create(getIdentity(), getContext(), getFacet(), getMode(), + getSecure(), newAdapterId, getRouterInfo(), locatorInfo, + getCollocationOptimization()); + } + + public Reference + changeEndpoints(EndpointI[] newEndpoints) + { + if(compare(newEndpoints, _endpoints)) + { + return this; + } + DirectReference r = (DirectReference)getInstance().referenceFactory().copy(this); + r._endpoints = newEndpoints; + return r; + } + public void streamWrite(BasicStream s) throws Ice.MarshalException @@ -146,12 +167,12 @@ public class DirectReference extends RoutableReference public Ice.ConnectionI getConnection(Ice.BooleanHolder comp) { - Endpoint[] endpts = super.getRoutedEndpoints(); + EndpointI[] endpts = super.getRoutedEndpoints(); if(endpts.length == 0) { endpts = _endpoints; } - Endpoint[] filteredEndpoints = filterEndpoints(endpts); + EndpointI[] filteredEndpoints = filterEndpoints(endpts); if(filteredEndpoints.length == 0) { Ice.NoEndpointException ex = new Ice.NoEndpointException(); @@ -195,5 +216,5 @@ public class DirectReference extends RoutableReference return compare(_endpoints, rhs._endpoints); } - private Endpoint[] _endpoints; + private EndpointI[] _endpoints; } diff --git a/java/src/IceInternal/EndpointFactory.java b/java/src/IceInternal/EndpointFactory.java index 3062e09c79d..26211045eea 100644 --- a/java/src/IceInternal/EndpointFactory.java +++ b/java/src/IceInternal/EndpointFactory.java @@ -13,7 +13,7 @@ public interface EndpointFactory { short type(); String protocol(); - Endpoint create(String str); - Endpoint read(BasicStream s); + EndpointI create(String str); + EndpointI read(BasicStream s); void destroy(); } diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index 4aa9f17011b..944405f2bb3 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -44,7 +44,7 @@ public final class EndpointFactoryManager return null; } - public synchronized Endpoint + public synchronized EndpointI create(String str) { String s = str.trim(); @@ -79,10 +79,10 @@ public final class EndpointFactoryManager return null; } - public synchronized Endpoint + public synchronized EndpointI read(BasicStream s) { - Endpoint v; + EndpointI v; short type = s.readShort(); for(int i = 0; i < _factories.size(); i++) @@ -94,7 +94,7 @@ public final class EndpointFactoryManager } } - return new UnknownEndpoint(type, s); + return new UnknownEndpointI(type, s); } void diff --git a/java/src/IceInternal/Endpoint.java b/java/src/IceInternal/EndpointI.java index 8a2b9352d4d..7d0078af9c6 100644 --- a/java/src/IceInternal/Endpoint.java +++ b/java/src/IceInternal/EndpointI.java @@ -9,69 +9,83 @@ package IceInternal; -public interface Endpoint extends java.lang.Comparable +abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable { - // - // Marshal the endpoint. - // - void streamWrite(BasicStream s); + public java.lang.Object + clone() + throws java.lang.CloneNotSupportedException + { + return super.clone(); + } + + public int + ice_hash() + { + return hashCode(); + } + + public String + toString() + { + return _toString(); + } // - // Convert the endpoint to its string form. + // Marshal the endpoint. // - String toString(); + public abstract void streamWrite(BasicStream s); // // Return the endpoint type. // - short type(); - + public abstract short type(); + // // Return the timeout for the endpoint in milliseconds. 0 means // non-blocking, -1 means no timeout. // - int timeout(); + public abstract int timeout(); // // Return a new endpoint with a different timeout value, provided // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. // - Endpoint timeout(int t); + public abstract EndpointI timeout(int t); // // Return true if the endpoints support bzip2 compress, or false // otherwise. // - boolean compress(); + public abstract boolean compress(); // // Return a new endpoint with a different compression value, // provided that compression is supported by the // endpoint. Otherwise the same endpoint is returned. // - Endpoint compress(boolean co); + public abstract EndpointI compress(boolean co); // // Return true if the endpoint is datagram-based. // - boolean datagram(); + public abstract boolean datagram(); // // Return true if the endpoint is secure. // - boolean secure(); + public abstract boolean secure(); // // Return true if the endpoint type is unknown. // - boolean unknown(); + public abstract boolean unknown(); // // Return a client side transceiver for this endpoint, or null if a // transceiver can only be created by a connector. // - Transceiver clientTransceiver(); + public abstract Transceiver clientTransceiver(); // // Return a server side transceiver for this endpoint, or null if a @@ -80,13 +94,13 @@ public interface Endpoint extends java.lang.Comparable // "effective" endpoint, which might differ from this endpoint, // for example, if a dynamic port number is assigned. // - Transceiver serverTransceiver(EndpointHolder endpoint); + public abstract Transceiver serverTransceiver(EndpointIHolder endpoint); // // Return a connector for this endpoint, or null if no connector // is available. // - Connector connector(); + public abstract Connector connector(); // // Return an acceptor for this endpoint, or null if no acceptors @@ -95,18 +109,18 @@ public interface Endpoint extends java.lang.Comparable // from this endpoint, for example, if a dynamic port number is // assigned. // - Acceptor acceptor(EndpointHolder endpoint); + public abstract Acceptor acceptor(EndpointIHolder endpoint); // // Check whether the endpoint is equivalent to a specific // Transceiver or Acceptor. // - boolean equivalent(Transceiver transceiver); - boolean equivalent(Acceptor acceptor); + public abstract boolean equivalent(Transceiver transceiver); + public abstract boolean equivalent(Acceptor acceptor); // // Compare endpoints for sorting purposes. // - boolean equals(java.lang.Object obj); - int compareTo(java.lang.Object obj); // From java.lang.Comparable. + public abstract boolean equals(java.lang.Object obj); + public abstract int compareTo(java.lang.Object obj); // From java.lang.Comparable. } diff --git a/java/src/IceInternal/EndpointHolder.java b/java/src/IceInternal/EndpointIHolder.java index 6c6debb6d2a..1a9103cbf5c 100644 --- a/java/src/IceInternal/EndpointHolder.java +++ b/java/src/IceInternal/EndpointIHolder.java @@ -9,7 +9,7 @@ package IceInternal; -public final class EndpointHolder +public final class EndpointIHolder { - public Endpoint value; + public EndpointI value; } diff --git a/java/src/IceInternal/FixedReference.java b/java/src/IceInternal/FixedReference.java index e677abf6ccb..a29e87f05a8 100644 --- a/java/src/IceInternal/FixedReference.java +++ b/java/src/IceInternal/FixedReference.java @@ -36,10 +36,16 @@ public class FixedReference extends Reference return false; } - public Endpoint[] + public String + getAdapterId() + { + return ""; + } + + public EndpointI[] getEndpoints() { - return new Endpoint[0]; + return new EndpointI[0]; } public boolean @@ -73,6 +79,18 @@ public class FixedReference extends Reference } public Reference + changeAdapterId(String newAdapterId) + { + return this; + } + + public Reference + changeEndpoints(EndpointI[] newEndpoints) + { + return this; + } + + public Reference changeCompress(boolean newCompress) { // TODO: FixedReferences should probably have a _compress flag, diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java index 79fa40fce02..6973e8bb324 100644 --- a/java/src/IceInternal/IncomingConnectionFactory.java +++ b/java/src/IceInternal/IncomingConnectionFactory.java @@ -130,7 +130,7 @@ public final class IncomingConnectionFactory extends EventHandler } } - public Endpoint + public EndpointI endpoint() { // No mutex protection necessary, _endpoint is immutable. @@ -138,7 +138,7 @@ public final class IncomingConnectionFactory extends EventHandler } public boolean - equivalent(Endpoint endp) + equivalent(EndpointI endp) { if(_transceiver != null) { @@ -352,7 +352,7 @@ public final class IncomingConnectionFactory extends EventHandler } public - IncomingConnectionFactory(Instance instance, Endpoint endpoint, Ice.ObjectAdapter adapter) + IncomingConnectionFactory(Instance instance, EndpointI endpoint, Ice.ObjectAdapter adapter) { super(instance); _endpoint = endpoint; @@ -372,7 +372,7 @@ public final class IncomingConnectionFactory extends EventHandler _endpoint = _endpoint.compress(defaultsAndOverrides.overrideCompressValue); } - EndpointHolder h = new EndpointHolder(); + EndpointIHolder h = new EndpointIHolder(); h.value = _endpoint; _transceiver = _endpoint.serverTransceiver(h); @@ -762,7 +762,7 @@ public final class IncomingConnectionFactory extends EventHandler private Acceptor _acceptor; private final Transceiver _transceiver; - private Endpoint _endpoint; + private EndpointI _endpoint; private final Ice.ObjectAdapter _adapter; diff --git a/java/src/IceInternal/IndirectReference.java b/java/src/IceInternal/IndirectReference.java index 8a7b57afb33..1caab5833da 100644 --- a/java/src/IceInternal/IndirectReference.java +++ b/java/src/IceInternal/IndirectReference.java @@ -29,22 +29,22 @@ public class IndirectReference extends RoutableReference _locatorInfo = locInfo; } - public final String - getAdapterId() - { - return _adapterId; - } - public final LocatorInfo getLocatorInfo() { return _locatorInfo; } - public Endpoint[] + public final String + getAdapterId() + { + return _adapterId; + } + + public EndpointI[] getEndpoints() { - return new Endpoint[0]; + return new EndpointI[0]; } public Reference @@ -57,7 +57,7 @@ public class IndirectReference extends RoutableReference if(loc == null) { return getInstance().referenceFactory().create(getIdentity(), null, "", ModeTwoway, false, - new Endpoint[0], getRouterInfo(), false); + new EndpointI[0], getRouterInfo(), false); } else { @@ -76,7 +76,7 @@ public class IndirectReference extends RoutableReference if(newLocator == null) { return getInstance().referenceFactory().create(getIdentity(), getContext(), getFacet(), getMode(), - getSecure(), new Endpoint[0], getRouterInfo(), + getSecure(), new EndpointI[0], getRouterInfo(), getCollocationOptimization()); } else @@ -119,6 +119,30 @@ public class IndirectReference extends RoutableReference return r; } + public Reference + changeAdapterId(String newAdapterId) + { + if(_adapterId.equals(newAdapterId)) + { + return this; + } + IndirectReference r = (IndirectReference)getInstance().referenceFactory().copy(this); + r._adapterId = newAdapterId; + return r; + } + + public Reference + changeEndpoints(EndpointI[] newEndpoints) + { + if(newEndpoints == null || newEndpoints.length == 0) + { + return this; + } + return getInstance().referenceFactory().create(getIdentity(), getContext(), getFacet(), getMode(), + getSecure(), newEndpoints, getRouterInfo(), + getCollocationOptimization()); + } + public void streamWrite(BasicStream s) throws Ice.MarshalException @@ -169,13 +193,13 @@ public class IndirectReference extends RoutableReference while(true) { - Endpoint[] endpts = super.getRoutedEndpoints(); + EndpointI[] endpts = super.getRoutedEndpoints(); Ice.BooleanHolder cached = new Ice.BooleanHolder(false); if(endpts.length == 0 && _locatorInfo != null) { endpts = _locatorInfo.getEndpoints(this, cached); } - Endpoint[] filteredEndpoints = filterEndpoints(endpts); + EndpointI[] filteredEndpoints = filterEndpoints(endpts); if(filteredEndpoints.length == 0) { Ice.NoEndpointException ex = new Ice.NoEndpointException(); diff --git a/java/src/IceInternal/LocatorInfo.java b/java/src/IceInternal/LocatorInfo.java index 35b096b15b9..42581e6ce9b 100644 --- a/java/src/IceInternal/LocatorInfo.java +++ b/java/src/IceInternal/LocatorInfo.java @@ -75,10 +75,10 @@ public final class LocatorInfo return _locatorRegistry; } - public Endpoint[] + public EndpointI[] getEndpoints(IndirectReference ref, Ice.BooleanHolder cached) { - Endpoint[] endpoints = null; + EndpointI[] endpoints = null; Ice.ObjectPrx object = null; cached.value = true; String adapterId = ref.getAdapterId(); @@ -200,7 +200,7 @@ public final class LocatorInfo } } - return endpoints == null ? new Endpoint[0] : endpoints; + return endpoints == null ? new EndpointI[0] : endpoints; } public void @@ -236,7 +236,7 @@ public final class LocatorInfo { if(ref.getAdapterId().length() > 0) { - Endpoint[] endpoints = _table.removeAdapterEndpoints(ref.getAdapterId()); + EndpointI[] endpoints = _table.removeAdapterEndpoints(ref.getAdapterId()); if(endpoints != null && ref.getInstance().traceLevels().location >= 2) { @@ -269,7 +269,7 @@ public final class LocatorInfo } private void - trace(String msg, IndirectReference ref, Endpoint[] endpoints) + trace(String msg, IndirectReference ref, EndpointI[] endpoints) { StringBuffer s = new StringBuffer(); s.append(msg + "\n"); diff --git a/java/src/IceInternal/LocatorTable.java b/java/src/IceInternal/LocatorTable.java index 0226be174ea..2fa0670428a 100644 --- a/java/src/IceInternal/LocatorTable.java +++ b/java/src/IceInternal/LocatorTable.java @@ -22,22 +22,22 @@ final class LocatorTable _objectTable.clear(); } - synchronized IceInternal.Endpoint[] + synchronized IceInternal.EndpointI[] getAdapterEndpoints(String adapter) { - return (IceInternal.Endpoint[])_adapterEndpointsTable.get(adapter); + return (IceInternal.EndpointI[])_adapterEndpointsTable.get(adapter); } synchronized void - addAdapterEndpoints(String adapter, IceInternal.Endpoint[] endpoints) + addAdapterEndpoints(String adapter, IceInternal.EndpointI[] endpoints) { _adapterEndpointsTable.put(adapter, endpoints); } - synchronized IceInternal.Endpoint[] + synchronized IceInternal.EndpointI[] removeAdapterEndpoints(String adapter) { - return (IceInternal.Endpoint[])_adapterEndpointsTable.remove(adapter); + return (IceInternal.EndpointI[])_adapterEndpointsTable.remove(adapter); } synchronized Ice.ObjectPrx diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java index 576666898df..05a5473f4b6 100644 --- a/java/src/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/IceInternal/OutgoingConnectionFactory.java @@ -91,10 +91,10 @@ public final class OutgoingConnectionFactory } public Ice.ConnectionI - create(Endpoint[] endpts, Ice.BooleanHolder compress) + create(EndpointI[] endpts, Ice.BooleanHolder compress) { assert(endpts.length > 0); - Endpoint[] endpoints = new Endpoint[endpts.length]; + EndpointI[] endpoints = new EndpointI[endpts.length]; System.arraycopy(endpts, 0, endpoints, 0, endpts.length); DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); @@ -282,7 +282,7 @@ public final class OutgoingConnectionFactory for(int i = 0; i < endpoints.length; i++) { - Endpoint endpoint = endpoints[i]; + EndpointI endpoint = endpoints[i]; try { @@ -417,10 +417,10 @@ public final class OutgoingConnectionFactory Ice.ObjectPrx proxy = routerInfo.getClientProxy(); Ice.ObjectAdapter adapter = routerInfo.getAdapter(); DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - Endpoint[] endpoints = ((Ice.ObjectPrxHelperBase)proxy).__reference().getEndpoints(); + EndpointI[] endpoints = ((Ice.ObjectPrxHelperBase)proxy).__reference().getEndpoints(); for(int i = 0; i < endpoints.length; i++) { - Endpoint endpoint = endpoints[i]; + EndpointI endpoint = endpoints[i]; // // Modify endpoints with overrides. diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index 09e944199fa..1efa3cedde4 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -63,7 +63,8 @@ public abstract class Reference implements Cloneable } public abstract boolean getSecure(); - public abstract Endpoint[] getEndpoints(); + public abstract String getAdapterId(); + public abstract EndpointI[] getEndpoints(); public abstract boolean getCollocationOptimization(); // @@ -152,6 +153,8 @@ public abstract class Reference implements Cloneable public abstract Reference changeCompress(boolean newCompress); public abstract Reference changeTimeout(int newTimeout); public abstract Reference changeCollocationOptimization(boolean newCollocationOptimization); + public abstract Reference changeAdapterId(String newAdapterId); + public abstract Reference changeEndpoints(EndpointI[] newEndpoints); public final synchronized int hashCode() @@ -400,8 +403,8 @@ public abstract class Reference implements Cloneable // // Filter endpoints based on criteria from this reference. // - protected Endpoint[] - filterEndpoints(Endpoint[] allEndpoints) + protected EndpointI[] + filterEndpoints(EndpointI[] allEndpoints) { java.util.ArrayList endpoints = new java.util.ArrayList(); @@ -428,7 +431,7 @@ public abstract class Reference implements Cloneable java.util.Iterator i = endpoints.iterator(); while(i.hasNext()) { - Endpoint endpoint = (Endpoint)i.next(); + EndpointI endpoint = (EndpointI)i.next(); if(endpoint.datagram()) { i.remove(); @@ -446,7 +449,7 @@ public abstract class Reference implements Cloneable java.util.Iterator i = endpoints.iterator(); while(i.hasNext()) { - Endpoint endpoint = (Endpoint)i.next(); + EndpointI endpoint = (EndpointI)i.next(); if(!endpoint.datagram()) { i.remove(); @@ -472,7 +475,7 @@ public abstract class Reference implements Cloneable java.util.Iterator i = endpoints.iterator(); while(i.hasNext()) { - Endpoint endpoint = (Endpoint)i.next(); + EndpointI endpoint = (EndpointI)i.next(); if(!endpoint.secure()) { i.remove(); @@ -484,7 +487,7 @@ public abstract class Reference implements Cloneable java.util.Collections.sort(endpoints, _endpointComparator); } - Endpoint[] arr = new Endpoint[endpoints.size()]; + EndpointI[] arr = new EndpointI[endpoints.size()]; endpoints.toArray(arr); return arr; } @@ -494,8 +497,8 @@ public abstract class Reference implements Cloneable public int compare(java.lang.Object l, java.lang.Object r) { - IceInternal.Endpoint le = (IceInternal.Endpoint)l; - IceInternal.Endpoint re = (IceInternal.Endpoint)r; + IceInternal.EndpointI le = (IceInternal.EndpointI)l; + IceInternal.EndpointI re = (IceInternal.EndpointI)r; boolean ls = le.secure(); boolean rs = re.secure(); if((ls && rs) || (!ls && !rs)) @@ -516,7 +519,7 @@ public abstract class Reference implements Cloneable private static EndpointComparator _endpointComparator = new EndpointComparator(); protected boolean - compare(Endpoint[] arr1, Endpoint[] arr2) + compare(EndpointI[] arr1, EndpointI[] arr2) { if(arr1 == arr2) { diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index 2268d121cb9..3c9fb3d4231 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -17,7 +17,7 @@ public final class ReferenceFactory String facet, int mode, boolean secure, - Endpoint[] endpoints, + EndpointI[] endpoints, RouterInfo routerInfo, boolean collocationOptimization) { @@ -409,7 +409,7 @@ public final class ReferenceFactory } String es = s.substring(beg, end); - Endpoint endp = _instance.endpointFactoryManager().create(es); + EndpointI endp = _instance.endpointFactoryManager().create(es); if(endp != null) { endpoints.add(endp); @@ -437,7 +437,7 @@ public final class ReferenceFactory _instance.logger().warning(msg); } - Endpoint[] endp = new Endpoint[endpoints.size()]; + EndpointI[] endp = new EndpointI[endpoints.size()]; endpoints.toArray(endp); return create(ident, new java.util.HashMap(), facet, mode, secure, endp, routerInfo, true); } @@ -526,7 +526,7 @@ public final class ReferenceFactory boolean secure = s.readBool(); - Endpoint[] endpoints; + EndpointI[] endpoints; String adapterId = ""; RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter()); @@ -535,7 +535,7 @@ public final class ReferenceFactory int sz = s.readSize(); if(sz > 0) { - endpoints = new Endpoint[sz]; + endpoints = new EndpointI[sz]; for(int i = 0; i < sz; i++) { endpoints[i] = _instance.endpointFactoryManager().read(s); @@ -544,7 +544,7 @@ public final class ReferenceFactory } else { - endpoints = new Endpoint[0]; + endpoints = new EndpointI[0]; adapterId = s.readString(); return create(ident, new java.util.HashMap(), facet, mode, secure, adapterId, routerInfo, locatorInfo, true); diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java index d59c553eee9..a13b6c6e976 100644 --- a/java/src/IceInternal/RoutableReference.java +++ b/java/src/IceInternal/RoutableReference.java @@ -17,7 +17,7 @@ public abstract class RoutableReference extends Reference return _routerInfo; } - public final Endpoint[] + public final EndpointI[] getRoutedEndpoints() { if(_routerInfo != null) @@ -29,7 +29,7 @@ public abstract class RoutableReference extends Reference Ice.ObjectPrx clientProxy = _routerInfo.getClientProxy(); return ((Ice.ObjectPrxHelperBase)clientProxy).__reference().getEndpoints(); } - return new Endpoint[0]; + return new EndpointI[0]; } public final boolean diff --git a/java/src/IceInternal/TcpEndpointFactory.java b/java/src/IceInternal/TcpEndpointFactory.java index 9178b1aabd1..2f03dbe382f 100644 --- a/java/src/IceInternal/TcpEndpointFactory.java +++ b/java/src/IceInternal/TcpEndpointFactory.java @@ -19,7 +19,7 @@ final class TcpEndpointFactory implements EndpointFactory public short type() { - return TcpEndpoint.TYPE; + return TcpEndpointI.TYPE; } public String @@ -28,16 +28,16 @@ final class TcpEndpointFactory implements EndpointFactory return "tcp"; } - public Endpoint + public EndpointI create(String str) { - return new TcpEndpoint(_instance, str); + return new TcpEndpointI(_instance, str); } - public Endpoint + public EndpointI read(BasicStream s) { - return new TcpEndpoint(s); + return new TcpEndpointI(s); } public void diff --git a/java/src/IceInternal/TcpEndpoint.java b/java/src/IceInternal/TcpEndpointI.java index 38154cd9225..57055b6597a 100644 --- a/java/src/IceInternal/TcpEndpoint.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -9,12 +9,12 @@ package IceInternal; -final class TcpEndpoint implements Endpoint +final class TcpEndpointI extends EndpointI { final static short TYPE = 1; public - TcpEndpoint(Instance instance, String ho, int po, int ti, boolean co) + TcpEndpointI(Instance instance, String ho, int po, int ti, boolean co) { _instance = instance; _host = ho; @@ -25,7 +25,7 @@ final class TcpEndpoint implements Endpoint } public - TcpEndpoint(Instance instance, String str) + TcpEndpointI(Instance instance, String str) { _instance = instance; _host = null; @@ -150,7 +150,7 @@ final class TcpEndpoint implements Endpoint } public - TcpEndpoint(BasicStream s) + TcpEndpointI(BasicStream s) { _instance = s.instance(); s.startReadEncaps(); @@ -181,7 +181,7 @@ final class TcpEndpoint implements Endpoint // Convert the endpoint to its string form // public String - toString() + _toString() { String s = "tcp -h " + _host + " -p " + _port; if(_timeout != -1) @@ -219,7 +219,7 @@ final class TcpEndpoint implements Endpoint // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. // - public Endpoint + public EndpointI timeout(int timeout) { if(timeout == _timeout) @@ -228,7 +228,7 @@ final class TcpEndpoint implements Endpoint } else { - return new TcpEndpoint(_instance, _host, _port, timeout, _compress); + return new TcpEndpointI(_instance, _host, _port, timeout, _compress); } } @@ -247,7 +247,7 @@ final class TcpEndpoint implements Endpoint // provided that compression is supported by the // endpoint. Otherwise the same endpoint is returned. // - public Endpoint + public EndpointI compress(boolean compress) { if(compress == _compress) @@ -256,7 +256,7 @@ final class TcpEndpoint implements Endpoint } else { - return new TcpEndpoint(_instance, _host, _port, _timeout, compress); + return new TcpEndpointI(_instance, _host, _port, _timeout, compress); } } @@ -305,7 +305,7 @@ final class TcpEndpoint implements Endpoint // for example, if a dynamic port number is assigned. // public Transceiver - serverTransceiver(EndpointHolder endpoint) + serverTransceiver(EndpointIHolder endpoint) { endpoint.value = this; return null; @@ -329,10 +329,10 @@ final class TcpEndpoint implements Endpoint // assigned. // public Acceptor - acceptor(EndpointHolder endpoint) + acceptor(EndpointIHolder endpoint) { TcpAcceptor p = new TcpAcceptor(_instance, _host, _port); - endpoint.value = new TcpEndpoint(_instance, _host, p.effectivePort(), _timeout, _compress); + endpoint.value = new TcpEndpointI(_instance, _host, p.effectivePort(), _timeout, _compress); return p; } @@ -379,11 +379,11 @@ final class TcpEndpoint implements Endpoint public int compareTo(java.lang.Object obj) // From java.lang.Comparable { - TcpEndpoint p = null; + TcpEndpointI p = null; try { - p = (TcpEndpoint)obj; + p = (TcpEndpointI)obj; } catch(ClassCastException ex) { diff --git a/java/src/IceInternal/UdpEndpointFactory.java b/java/src/IceInternal/UdpEndpointFactory.java index 9f8eb39b9f3..241dd90d29f 100644 --- a/java/src/IceInternal/UdpEndpointFactory.java +++ b/java/src/IceInternal/UdpEndpointFactory.java @@ -19,7 +19,7 @@ final class UdpEndpointFactory implements EndpointFactory public short type() { - return UdpEndpoint.TYPE; + return UdpEndpointI.TYPE; } public String @@ -28,16 +28,16 @@ final class UdpEndpointFactory implements EndpointFactory return "udp"; } - public Endpoint + public EndpointI create(String str) { - return new UdpEndpoint(_instance, str); + return new UdpEndpointI(_instance, str); } - public Endpoint + public EndpointI read(BasicStream s) { - return new UdpEndpoint(s); + return new UdpEndpointI(s); } public void diff --git a/java/src/IceInternal/UdpEndpoint.java b/java/src/IceInternal/UdpEndpointI.java index cef841660bd..d6fd929c23c 100644 --- a/java/src/IceInternal/UdpEndpoint.java +++ b/java/src/IceInternal/UdpEndpointI.java @@ -9,12 +9,12 @@ package IceInternal; -final class UdpEndpoint implements Endpoint +final class UdpEndpointI extends EndpointI { final static short TYPE = 3; public - UdpEndpoint(Instance instance, String ho, int po, boolean co) + UdpEndpointI(Instance instance, String ho, int po, boolean co) { _instance = instance; _host = ho; @@ -29,7 +29,7 @@ final class UdpEndpoint implements Endpoint } public - UdpEndpoint(Instance instance, String str) + UdpEndpointI(Instance instance, String str) { _instance = instance; _host = null; @@ -260,7 +260,7 @@ final class UdpEndpoint implements Endpoint } public - UdpEndpoint(BasicStream s) + UdpEndpointI(BasicStream s) { _instance = s.instance(); s.startReadEncaps(); @@ -320,7 +320,7 @@ final class UdpEndpoint implements Endpoint // Convert the endpoint to its string form // public String - toString() + _toString() { String s = "udp"; @@ -385,7 +385,7 @@ final class UdpEndpoint implements Endpoint // provided that compression is supported by the // endpoint. Otherwise the same endpoint is returned. // - public Endpoint + public EndpointI compress(boolean compress) { if(compress == _compress) @@ -394,7 +394,7 @@ final class UdpEndpoint implements Endpoint } else { - return new UdpEndpoint(_instance, _host, _port, compress); + return new UdpEndpointI(_instance, _host, _port, compress); } } @@ -403,7 +403,7 @@ final class UdpEndpoint implements Endpoint // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. // - public Endpoint + public EndpointI timeout(int timeout) { return this; @@ -454,10 +454,10 @@ final class UdpEndpoint implements Endpoint // for example, if a dynamic port number is assigned. // public Transceiver - serverTransceiver(EndpointHolder endpoint) + serverTransceiver(EndpointIHolder endpoint) { UdpTransceiver p = new UdpTransceiver(_instance, _host, _port, _connect); - endpoint.value = new UdpEndpoint(_instance, _host, p.effectivePort(), _compress); + endpoint.value = new UdpEndpointI(_instance, _host, p.effectivePort(), _compress); return p; } @@ -479,7 +479,7 @@ final class UdpEndpoint implements Endpoint // assigned. // public Acceptor - acceptor(EndpointHolder endpoint) + acceptor(EndpointIHolder endpoint) { endpoint.value = this; return null; @@ -528,11 +528,11 @@ final class UdpEndpoint implements Endpoint public int compareTo(java.lang.Object obj) // From java.lang.Comparable { - UdpEndpoint p = null; + UdpEndpointI p = null; try { - p = (UdpEndpoint)obj; + p = (UdpEndpointI)obj; } catch(ClassCastException ex) { diff --git a/java/src/IceInternal/UnknownEndpoint.java b/java/src/IceInternal/UnknownEndpointI.java index b4eab4b7827..7e1f0eca123 100644 --- a/java/src/IceInternal/UnknownEndpoint.java +++ b/java/src/IceInternal/UnknownEndpointI.java @@ -9,10 +9,10 @@ package IceInternal; -final class UnknownEndpoint implements Endpoint +final class UnknownEndpointI extends EndpointI { public - UnknownEndpoint(short type, BasicStream s) + UnknownEndpointI(short type, BasicStream s) { _instance = s.instance(); _type = type; @@ -39,7 +39,7 @@ final class UnknownEndpoint implements Endpoint // Convert the endpoint to its string form // public String - toString() + _toString() { return ""; } @@ -68,7 +68,7 @@ final class UnknownEndpoint implements Endpoint // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. // - public Endpoint + public EndpointI timeout(int t) { return this; @@ -89,7 +89,7 @@ final class UnknownEndpoint implements Endpoint // provided that compression is supported by the // endpoint. Otherwise the same endpoint is returned. // - public Endpoint + public EndpointI compress(boolean compress) { return this; @@ -140,7 +140,7 @@ final class UnknownEndpoint implements Endpoint // for example, if a dynamic port number is assigned. // public Transceiver - serverTransceiver(EndpointHolder endpoint) + serverTransceiver(EndpointIHolder endpoint) { endpoint.value = null; return null; @@ -164,7 +164,7 @@ final class UnknownEndpoint implements Endpoint // assigned. // public Acceptor - acceptor(EndpointHolder endpoint) + acceptor(EndpointIHolder endpoint) { endpoint.value = null; return null; @@ -204,11 +204,11 @@ final class UnknownEndpoint implements Endpoint public int compareTo(java.lang.Object obj) // From java.lang.Comparable { - UnknownEndpoint p = null; + UnknownEndpointI p = null; try { - p = (UnknownEndpoint)obj; + p = (UnknownEndpointI)obj; } catch(ClassCastException ex) { diff --git a/java/src/IceSSL/SslEndpointFactory.java b/java/src/IceSSL/SslEndpointFactory.java index 06f645b343c..89c4f8072bd 100644 --- a/java/src/IceSSL/SslEndpointFactory.java +++ b/java/src/IceSSL/SslEndpointFactory.java @@ -19,7 +19,7 @@ final class SslEndpointFactory implements IceInternal.EndpointFactory public short type() { - return SslEndpoint.TYPE; + return SslEndpointI.TYPE; } public String @@ -28,16 +28,16 @@ final class SslEndpointFactory implements IceInternal.EndpointFactory return "ssl"; } - public IceInternal.Endpoint + public IceInternal.EndpointI create(String str) { - return new SslEndpoint(_instance, str); + return new SslEndpointI(_instance, str); } - public IceInternal.Endpoint + public IceInternal.EndpointI read(IceInternal.BasicStream s) { - return new SslEndpoint(_instance, s); + return new SslEndpointI(_instance, s); } public void diff --git a/java/src/IceSSL/SslEndpoint.java b/java/src/IceSSL/SslEndpointI.java index 9c1956b4ed0..d865d1db123 100644 --- a/java/src/IceSSL/SslEndpoint.java +++ b/java/src/IceSSL/SslEndpointI.java @@ -9,12 +9,12 @@ package IceSSL; -final class SslEndpoint implements IceInternal.Endpoint +final class SslEndpointI extends IceInternal.EndpointI { final static short TYPE = 2; public - SslEndpoint(Instance instance, String ho, int po, int ti, boolean co) + SslEndpointI(Instance instance, String ho, int po, int ti, boolean co) { _instance = instance; _host = ho; @@ -25,7 +25,7 @@ final class SslEndpoint implements IceInternal.Endpoint } public - SslEndpoint(Instance instance, String str) + SslEndpointI(Instance instance, String str) { _instance = instance; _host = null; @@ -150,7 +150,7 @@ final class SslEndpoint implements IceInternal.Endpoint } public - SslEndpoint(Instance instance, IceInternal.BasicStream s) + SslEndpointI(Instance instance, IceInternal.BasicStream s) { _instance = instance; s.startReadEncaps(); @@ -181,7 +181,7 @@ final class SslEndpoint implements IceInternal.Endpoint // Convert the endpoint to its string form // public String - toString() + _toString() { String s = "ssl -h " + _host + " -p " + _port; if(_timeout != -1) @@ -219,7 +219,7 @@ final class SslEndpoint implements IceInternal.Endpoint // that timeouts are supported by the endpoint. Otherwise the same // endpoint is returned. // - public IceInternal.Endpoint + public IceInternal.EndpointI timeout(int timeout) { if(timeout == _timeout) @@ -228,7 +228,7 @@ final class SslEndpoint implements IceInternal.Endpoint } else { - return new SslEndpoint(_instance, _host, _port, timeout, _compress); + return new SslEndpointI(_instance, _host, _port, timeout, _compress); } } @@ -247,7 +247,7 @@ final class SslEndpoint implements IceInternal.Endpoint // provided that compression is supported by the // endpoint. Otherwise the same endpoint is returned. // - public IceInternal.Endpoint + public IceInternal.EndpointI compress(boolean compress) { if(compress == _compress) @@ -256,7 +256,7 @@ final class SslEndpoint implements IceInternal.Endpoint } else { - return new SslEndpoint(_instance, _host, _port, _timeout, compress); + return new SslEndpointI(_instance, _host, _port, _timeout, compress); } } @@ -305,7 +305,7 @@ final class SslEndpoint implements IceInternal.Endpoint // for example, if a dynamic port number is assigned. // public IceInternal.Transceiver - serverTransceiver(IceInternal.EndpointHolder endpoint) + serverTransceiver(IceInternal.EndpointIHolder endpoint) { endpoint.value = this; return null; @@ -329,10 +329,10 @@ final class SslEndpoint implements IceInternal.Endpoint // assigned. // public IceInternal.Acceptor - acceptor(IceInternal.EndpointHolder endpoint) + acceptor(IceInternal.EndpointIHolder endpoint) { SslAcceptor p = new SslAcceptor(_instance, _host, _port); - endpoint.value = new SslEndpoint(_instance, _host, p.effectivePort(), _timeout, _compress); + endpoint.value = new SslEndpointI(_instance, _host, p.effectivePort(), _timeout, _compress); return p; } @@ -379,11 +379,11 @@ final class SslEndpoint implements IceInternal.Endpoint public int compareTo(java.lang.Object obj) // From java.lang.Comparable { - SslEndpoint p = null; + SslEndpointI p = null; try { - p = (SslEndpoint)obj; + p = (SslEndpointI)obj; } catch(ClassCastException ex) { |