diff options
author | Mark Spruiell <mes@zeroc.com> | 2016-08-23 17:28:35 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2016-08-23 17:28:35 -0700 |
commit | e6cbf802f2977d06854a65036a860740e24d3151 (patch) | |
tree | 7e1a19dff8bb864a86da6699d0360c3d703e71c5 /java/src | |
parent | Small .gitignore cleanup (diff) | |
download | ice-e6cbf802f2977d06854a65036a860740e24d3151.tar.bz2 ice-e6cbf802f2977d06854a65036a860740e24d3151.tar.xz ice-e6cbf802f2977d06854a65036a860740e24d3151.zip |
Major changes in Java:
- Moved existing Java mapping sources to java-compat subdirectory
- Added new "Java 8" mapping in java subdirectory
- Significant features of Java 8 mapping:
- All classes in com.zeroc package (e.g., com.zeroc.Ice.Communicator)
- New AMI mapping that uses java.util.concurrent.CompletableFuture
- New AMD mapping that uses java.util.concurrent.CompletionStage
- New mapping for out parameters - "holder" types have been eliminated
- New mapping for optional types that uses JDK classes from java.util
(e.g., java.util.Optional)
- "TIE" classes are no longer supported or necessary; servant classes
now only need to implement a generated interface
- Moved IceGrid GUI to new mapping
- The "Java Compat" mapping is provided only for backward compatibility
to ease migration to Ice 3.7. The Slice compiler supports a new --compat
option to generate code for this mapping. However, users are encouraged
to migrate to the new mapping as soon as possible.
Diffstat (limited to 'java/src')
472 files changed, 12377 insertions, 21322 deletions
diff --git a/java/src/Glacier2/build.gradle b/java/src/Glacier2/build.gradle index feedebb7041..c8c2a985fcb 100644 --- a/java/src/Glacier2/build.gradle +++ b/java/src/Glacier2/build.gradle @@ -7,16 +7,27 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "Glacier2" project.ext.description = "Firewall traversal for Ice" +sourceSets { + main { + java { + // ice.jar already includes a marker for the IceMX package. + exclude '**/com/zeroc/IceMX/_Marker.java' + } + } +} + slice { java { set1 { - args = "--ice --tie --checksum Glacier2.SliceChecksums" + args = "--ice --checksum com.zeroc.Glacier2.SliceChecksums" files = fileTree(dir: "${sliceDir}/Glacier2", includes:['*.ice'], excludes:["*F.ice"]) } } diff --git a/java/src/Glacier2/src/main/java/Glacier2/Application.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/Application.java index 2d5768fdf1c..c81eb917632 100644 --- a/java/src/Glacier2/src/main/java/Glacier2/Application.java +++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/Application.java @@ -7,10 +7,14 @@ // // ********************************************************************** -package Glacier2; +package com.zeroc.Glacier2; + +import com.zeroc.Ice.Util; +import com.zeroc.Ice.ACMHeartbeat; +import com.zeroc.IceInternal.Ex; /** - * An extension of Ice.Application that makes it easy to write + * An extension of com.zeroc.Ice.Application that makes it easy to write * Glacier2 applications. * * <p> Applications must create a derived class that implements the @@ -23,9 +27,9 @@ package Glacier2; * returns. * * If {@link #runWithSession} calls {@link #restart} or raises any of - * the exceptions Ice.ConnectionRefusedException, - * Ice.ConnectionLostException, Ice.UnknownLocalException, - * Ice.RequestFailedException, or Ice.TimeoutException, the base + * the exceptions com.zeroc.Ice.ConnectionRefusedException, + * com.zeroc.Ice.ConnectionLostException, com.zeroc.Ice.UnknownLocalException, + * com.zeroc.Ice.RequestFailedException, or com.zeroc.Ice.TimeoutException, the base * class destroys the current session and restarts the application * with another call to {@link #createSession} followed by * {@link #runWithSession}. @@ -36,14 +40,14 @@ package Glacier2; * * A program can contain only one instance of this class. * - * @see Ice.Application - * @see Glacier2.Router - * @see Glacier2.Session - * @see Ice.Communicator - * @see Ice.Logger + * @see com.zeroc.Ice.Application + * @see com.zeroc.Glacier2.Router + * @see com.zeroc.Glacier2.Session + * @see com.zeroc.Ice.Communicator + * @see com.zeroc.Ice.Logger * @see #runWithSession **/ -public abstract class Application extends Ice.Application +public abstract class Application extends com.zeroc.Ice.Application { /** * This exception is raised if the session should be restarted. @@ -56,8 +60,7 @@ public abstract class Application extends Ice.Application * Initializes an instance that calls {@link Communicator#shutdown} if * a signal is received. **/ - public - Application() + public Application() { } @@ -69,8 +72,7 @@ public abstract class Application extends Ice.Application * * @see SignalPolicy **/ - public - Application(Ice.SignalPolicy signalPolicy) + public Application(com.zeroc.Ice.SignalPolicy signalPolicy) { super(signalPolicy); } @@ -90,17 +92,15 @@ public abstract class Application extends Ice.Application * termination, and non-zero otherwise. <code>Application.main</code> returns the * value returned by <code>runWithSession</code>. **/ - public abstract int - runWithSession(String[] args) + public abstract int runWithSession(String[] args) throws RestartSessionException; /** - * Run should not be overridden for Glacier2.Application. Instead + * Run should not be overridden for com.zeroc.Glacier2.Application. Instead * <code>runWithSession</code> should be used. */ @Override - final public int - run(String[] args) + final public int run(String[] args) { // This shouldn't be called. assert false; @@ -114,8 +114,7 @@ public abstract class Application extends Ice.Application * * @throws RestartSessionException This exception is always thrown. **/ - public void - restart() + public void restart() throws RestartSessionException { throw new RestartSessionException(); @@ -124,13 +123,12 @@ public abstract class Application extends Ice.Application /** * Creates a new Glacier2 session. A call to * <code>createSession</code> always precedes a call to - * <code>runWithSession</code>. If <code>Ice.LocalException</code> + * <code>runWithSession</code>. If <code>com.zeroc.Ice.LocalException</code> * is thrown from this method, the application is terminated. * * @return The Glacier2 session. **/ - abstract public Glacier2.SessionPrx - createSession(); + abstract public com.zeroc.Glacier2.SessionPrx createSession(); /** * Called when the session refresh thread detects that the session has been @@ -139,8 +137,7 @@ public abstract class Application extends Ice.Application * according to the Ice invocation dipsatch rules (in other words, it * uses the same rules as an servant upcall or AMI callback). **/ - public void - sessionDestroyed() + public void sessionDestroyed() { } @@ -148,8 +145,7 @@ public abstract class Application extends Ice.Application * Returns the Glacier2 router proxy * @return The router proxy. **/ - public static Glacier2.RouterPrx - router() + public static com.zeroc.Glacier2.RouterPrx router() { return _router; } @@ -158,8 +154,7 @@ public abstract class Application extends Ice.Application * Returns the Glacier2 session proxy * @return The session proxy. **/ - public static Glacier2.SessionPrx - session() + public static com.zeroc.Glacier2.SessionPrx session() { return _session; } @@ -171,8 +166,7 @@ public abstract class Application extends Ice.Application * @return The category. * @throws SessionNotExistException No session exists. **/ - public String - categoryForClient() + public String categoryForClient() throws SessionNotExistException { if(_router == null) @@ -188,11 +182,10 @@ public abstract class Application extends Ice.Application * @return The identity. * @throws SessionNotExistException No session exists. **/ - public Ice.Identity - createCallbackIdentity(String name) + public com.zeroc.Ice.Identity createCallbackIdentity(String name) throws SessionNotExistException { - return new Ice.Identity(name, categoryForClient()); + return new com.zeroc.Ice.Identity(name, categoryForClient()); } /** @@ -201,8 +194,7 @@ public abstract class Application extends Ice.Application * @return The proxy for the servant. * @throws SessionNotExistException No session exists. **/ - public Ice.ObjectPrx - addWithUUID(Ice.Object servant) + public com.zeroc.Ice.ObjectPrx addWithUUID(com.zeroc.Ice.Object servant) throws SessionNotExistException { return objectAdapter().add(servant, createCallbackIdentity(java.util.UUID.randomUUID().toString())); @@ -213,8 +205,7 @@ public abstract class Application extends Ice.Application * @return The object adapter. * @throws SessionNotExistException No session exists. */ - public Ice.ObjectAdapter - objectAdapter() + public com.zeroc.Ice.ObjectAdapter objectAdapter() throws SessionNotExistException { if(_router == null) @@ -233,26 +224,21 @@ public abstract class Application extends Ice.Application return _adapter; } - private class CloseCallbackI implements Ice.CloseCallback + private static class DoMainResult { - @Override - public void closed(Ice.Connection con) - { - sessionDestroyed(); - } + int returnValue; + boolean restart; } @Override - protected int - doMain(Ice.StringSeqHolder argHolder, Ice.InitializationData initData) + protected int doMain(String[] args, com.zeroc.Ice.InitializationData initData) { // // Set the default properties for all Glacier2 applications. // initData.properties.setProperty("Ice.RetryIntervals", "-1"); - boolean restart; - Ice.Holder<Integer> ret = new Ice.Holder<Integer>(); + DoMainResult r; do { // @@ -260,47 +246,47 @@ public abstract class Application extends Ice.Application // needs to be passed to doMainInternal, as these can be // changed by the application. // - Ice.InitializationData id = initData.clone(); + com.zeroc.Ice.InitializationData id = initData.clone(); id.properties = id.properties._clone(); - Ice.StringSeqHolder h = new Ice.StringSeqHolder(); - h.value = argHolder.value.clone(); + String[] a = args.clone(); - restart = doMain(h, id, ret); + r = doMainInternal(a, id); } - while(restart); - return ret.value; + while(r.restart); + return r.returnValue; } - private boolean - doMain(Ice.StringSeqHolder argHolder, Ice.InitializationData initData, Ice.Holder<Integer> status) + private DoMainResult doMainInternal(String[] args, com.zeroc.Ice.InitializationData initData) { // - // Reset internal state variables from Ice.Application. The + // Reset internal state variables from com.zeroc.Ice.Application. The // remainder are reset at the end of this method. // _callbackInProgress = false; _destroyed = false; _interrupted = false; - boolean restart = false; - status.value = 0; + DoMainResult r = new DoMainResult(); + r.restart = false; + r.returnValue = 0; try { - _communicator = Ice.Util.initialize(argHolder, initData); + Util.InitializeResult ir = Util.initialize(args, initData); + _communicator = ir.communicator; - _router = Glacier2.RouterPrxHelper.uncheckedCast(communicator().getDefaultRouter()); + _router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(communicator().getDefaultRouter()); if(_router == null) { - Ice.Util.getProcessLogger().error("no glacier2 router configured"); - status.value = 1; + Util.getProcessLogger().error("no glacier2 router configured"); + r.returnValue = 1; } else { // // The default is to destroy when a signal is received. // - if(_signalPolicy == Ice.SignalPolicy.HandleSignals) + if(_signalPolicy == com.zeroc.Ice.SignalPolicy.HandleSignals) { destroyOnInterrupt(); } @@ -313,10 +299,10 @@ public abstract class Application extends Ice.Application _session = createSession(); _createdSession = true; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - status.value = 1; + Util.getProcessLogger().error(Ex.toString(ex)); + r.returnValue = 1; } if(_createdSession) @@ -326,7 +312,7 @@ public abstract class Application extends Ice.Application { acmTimeout = _router.getACMTimeout(); } - catch(Ice.OperationNotExistException ex) + catch(com.zeroc.Ice.OperationNotExistException ex) { } if(acmTimeout <= 0) @@ -335,15 +321,15 @@ public abstract class Application extends Ice.Application } if(acmTimeout > 0) { - Ice.Connection connection = _router.ice_getCachedConnection(); + com.zeroc.Ice.Connection connection = _router.ice_getCachedConnection(); assert(connection != null); - connection.setACM(new Ice.IntOptional(acmTimeout), - null, - new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways)); - connection.setCloseCallback(new CloseCallbackI()); + connection.setACM( + java.util.OptionalInt.of(acmTimeout), null, + java.util.Optional.of(ACMHeartbeat.HeartbeatAlways)); + connection.setCloseCallback(con -> sessionDestroyed()); } _category = _router.getCategoryForClient(); - status.value = runWithSession(argHolder.value); + r.returnValue = runWithSession(ir.args); } } } @@ -355,56 +341,56 @@ public abstract class Application extends Ice.Application // catch(RestartSessionException ex) { - restart = true; + r.restart = true; } - catch(Ice.ConnectionRefusedException ex) + catch(com.zeroc.Ice.ConnectionRefusedException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - restart = true; + Util.getProcessLogger().error(Ex.toString(ex)); + r.restart = true; } - catch(Ice.ConnectionLostException ex) + catch(com.zeroc.Ice.ConnectionLostException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - restart = true; + Util.getProcessLogger().error(Ex.toString(ex)); + r.restart = true; } - catch(Ice.UnknownLocalException ex) + catch(com.zeroc.Ice.UnknownLocalException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - restart = true; + Util.getProcessLogger().error(Ex.toString(ex)); + r.restart = true; } - catch(Ice.RequestFailedException ex) + catch(com.zeroc.Ice.RequestFailedException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - restart = true; + Util.getProcessLogger().error(Ex.toString(ex)); + r.restart = true; } - catch(Ice.TimeoutException ex) + catch(com.zeroc.Ice.TimeoutException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - restart = true; + Util.getProcessLogger().error(Ex.toString(ex)); + r.restart = true; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - status.value = 1; + Util.getProcessLogger().error(Ex.toString(ex)); + r.returnValue = 1; } catch(java.lang.Exception ex) { - Ice.Util.getProcessLogger().error("unknown exception:\n" + IceInternal.Ex.toString(ex)); - status.value = 1; + Util.getProcessLogger().error("unknown exception:\n" + Ex.toString(ex)); + r.returnValue = 1; } catch(java.lang.Error err) { // // We catch Error to avoid hangs in some non-fatal situations // - Ice.Util.getProcessLogger().error("Java error:\n" + IceInternal.Ex.toString(err)); - status.value = 1; + Util.getProcessLogger().error("Java error:\n" + Ex.toString(err)); + r.returnValue = 1; } // // This clears any set interrupt. // - if(_signalPolicy == Ice.SignalPolicy.HandleSignals) + if(_signalPolicy == com.zeroc.Ice.SignalPolicy.HandleSignals) { defaultInterrupt(); } @@ -443,13 +429,13 @@ public abstract class Application extends Ice.Application { _router.destroySession(); } - catch(Ice.ConnectionLostException ex) + catch(com.zeroc.Ice.ConnectionLostException ex) { // // Expected if another thread invoked on an object from the session concurrently. // } - catch(Glacier2.SessionNotExistException ex) + catch(com.zeroc.Glacier2.SessionNotExistException ex) { // // This can also occur. @@ -460,8 +446,7 @@ public abstract class Application extends Ice.Application // // Not expected. // - Ice.Util.getProcessLogger().error("unexpected exception when destroying the session:\n" + - IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error("unexpected exception when destroying the session:\n" + Ex.toString(ex)); } _router = null; } @@ -472,15 +457,15 @@ public abstract class Application extends Ice.Application { _communicator.destroy(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { - Ice.Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); - status.value = 1; + Util.getProcessLogger().error(Ex.toString(ex)); + r.returnValue = 1; } catch(java.lang.Exception ex) { - Ice.Util.getProcessLogger().error("unknown exception:\n" + IceInternal.Ex.toString(ex)); - status.value = 1; + Util.getProcessLogger().error("unknown exception:\n" + Ex.toString(ex)); + r.returnValue = 1; } _communicator = null; } @@ -504,12 +489,12 @@ public abstract class Application extends Ice.Application _createdSession = false; _category = null; - return restart; + return r; } - private static Ice.ObjectAdapter _adapter; - private static Glacier2.RouterPrx _router; - private static Glacier2.SessionPrx _session; + private static com.zeroc.Ice.ObjectAdapter _adapter; + private static com.zeroc.Glacier2.RouterPrx _router; + private static com.zeroc.Glacier2.SessionPrx _session; private static boolean _createdSession = false; private static String _category; } diff --git a/java/src/Glacier2/src/main/java/Glacier2/SessionCallback.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionCallback.java index b1532e1fbd0..7e76fb80605 100644 --- a/java/src/Glacier2/src/main/java/Glacier2/SessionCallback.java +++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionCallback.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Glacier2; +package com.zeroc.Glacier2; /** * A callback class to get notifications of status changes in the Glacier2 session. diff --git a/java/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionFactoryHelper.java index b7b086a8798..065cfbbf78c 100644 --- a/java/src/Glacier2/src/main/java/Glacier2/SessionFactoryHelper.java +++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionFactoryHelper.java @@ -7,7 +7,12 @@ // // ********************************************************************** -package Glacier2; +package com.zeroc.Glacier2; + +import com.zeroc.Ice.InitializationData; +import com.zeroc.Ice.InitializationException; +import com.zeroc.Ice.Properties; +import com.zeroc.Ice.Util; /** * A helper class for using Glacier2 with GUI applications. @@ -23,13 +28,12 @@ public class SessionFactoryHelper * Creates a SessionFactory object. * * @param callback The callback object for notifications. - * @throws {@link Ice.InitializationException} + * @throws {@link com.zeroc.Ice.InitializationException} */ - public - SessionFactoryHelper(SessionCallback callback) - throws Ice.InitializationException + public SessionFactoryHelper(SessionCallback callback) + throws InitializationException { - initialize(callback, new Ice.InitializationData(), Ice.Util.createProperties()); + initialize(callback, new InitializationData(), Util.createProperties()); } /** @@ -37,11 +41,10 @@ public class SessionFactoryHelper * * @param initData The initialization data to use when creating the communicator. * @param callback The callback object for notifications. - * @throws {@link Ice.InitializationException} + * @throws {@link com.zeroc.Ice.InitializationException} */ - public - SessionFactoryHelper(Ice.InitializationData initData, SessionCallback callback) - throws Ice.InitializationException + public SessionFactoryHelper(InitializationData initData, SessionCallback callback) + throws InitializationException { initialize(callback, initData, initData.properties); } @@ -51,35 +54,33 @@ public class SessionFactoryHelper * * @param properties The properties to use when creating the communicator. * @param callback The callback object for notifications. - * @throws {@link Ice.InitializationException} + * @throws {@link com.zeroc.Ice.InitializationException} */ - public - SessionFactoryHelper(Ice.Properties properties, SessionCallback callback) - throws Ice.InitializationException + public SessionFactoryHelper(Properties properties, SessionCallback callback) + throws InitializationException { - initialize(callback, new Ice.InitializationData(), properties); + initialize(callback, new InitializationData(), properties); } - private void - initialize(SessionCallback callback, Ice.InitializationData initData, Ice.Properties properties) - throws Ice.InitializationException + private void initialize(SessionCallback callback, InitializationData initData, Properties properties) + throws InitializationException { if(callback == null) { - throw new Ice.InitializationException("Attempt to create a SessionFactoryHelper with a null " + - "SessionCallback argument"); + throw new InitializationException("Attempt to create a SessionFactoryHelper with a null " + + "SessionCallback argument"); } if(initData == null) { - throw new Ice.InitializationException("Attempt to create a SessionFactoryHelper with a null " + - "InitializationData argument"); + throw new InitializationException("Attempt to create a SessionFactoryHelper with a null " + + "InitializationData argument"); } if(properties == null) { - throw new Ice.InitializationException("Attempt to create a SessionFactoryHelper with a null Properties " + - "argument"); + throw new InitializationException("Attempt to create a SessionFactoryHelper with a null Properties " + + "argument"); } _callback = callback; @@ -97,8 +98,7 @@ public class SessionFactoryHelper * * @param identity The Glacier2 router's identity. */ - synchronized public void - setRouterIdentity(Ice.Identity identity) + synchronized public void setRouterIdentity(com.zeroc.Ice.Identity identity) { _identity = identity; } @@ -108,8 +108,7 @@ public class SessionFactoryHelper * * @return The Glacier2 router's identity. */ - synchronized public Ice.Identity - getRouterIdentity() + synchronized public com.zeroc.Ice.Identity getRouterIdentity() { return _identity; } @@ -119,8 +118,7 @@ public class SessionFactoryHelper * * @param hostname The host name (or IP address) of the router host. */ - synchronized public void - setRouterHost(String hostname) + synchronized public void setRouterHost(String hostname) { _routerHost = hostname; } @@ -130,8 +128,7 @@ public class SessionFactoryHelper * * @return The Glacier2 router host. */ - synchronized public String - getRouterHost() + synchronized public String getRouterHost() { return _routerHost; } @@ -144,8 +141,7 @@ public class SessionFactoryHelper * @deprecated deprecated, use SessionFactoryHelper.setProtocol instead */ @Deprecated - public void - setSecure(boolean secure) + public void setSecure(boolean secure) { setProtocol(secure ? "ssl" : "tcp"); } @@ -157,8 +153,7 @@ public class SessionFactoryHelper * @deprecated deprecated, use SessionFactoryHelper.getProtocol instead */ @Deprecated - public boolean - getSecure() + public boolean getSecure() { return getProtocol().equals("ssl"); } @@ -204,8 +199,7 @@ public class SessionFactoryHelper * @param timeoutMillisecs The timeout in milliseconds. A zero * or negative timeout value indicates that the router proxy has no associated timeout. */ - synchronized public void - setTimeout(int timeoutMillisecs) + synchronized public void setTimeout(int timeoutMillisecs) { _timeout = timeoutMillisecs; } @@ -215,8 +209,7 @@ public class SessionFactoryHelper * * @return The timeout. */ - synchronized public int - getTimeout() + synchronized public int getTimeout() { return _timeout; } @@ -226,8 +219,7 @@ public class SessionFactoryHelper * * @param port The port. If 0, then the default port (4063 for TCP or 4064 for SSL) is used. */ - synchronized public void - setPort(int port) + synchronized public void setPort(int port) { _port = port; } @@ -237,8 +229,7 @@ public class SessionFactoryHelper * * @return The port. */ - synchronized public int - getPort() + synchronized public int getPort() { return getPortInternal(); } @@ -254,8 +245,7 @@ public class SessionFactoryHelper * * @return The initialization data. */ - synchronized public Ice.InitializationData - getInitializationData() + synchronized public InitializationData getInitializationData() { return _initData; } @@ -265,8 +255,7 @@ public class SessionFactoryHelper * * @param context The request context. */ - synchronized public void - setConnectContext(final java.util.Map<String, String> context) + synchronized public void setConnectContext(final java.util.Map<String, String> context) { _context = context; } @@ -277,8 +266,7 @@ public class SessionFactoryHelper * * @param useCallbacks True if the session should create an object adapter. */ - synchronized public void - setUseCallbacks(boolean useCallbacks) + synchronized public void setUseCallbacks(boolean useCallbacks) { _useCallbacks = useCallbacks; } @@ -289,8 +277,7 @@ public class SessionFactoryHelper * * @return True if the session will create an object adapter. */ - synchronized public boolean - getUseCallbacks() + synchronized public boolean getUseCallbacks() { return _useCallbacks; } @@ -303,8 +290,7 @@ public class SessionFactoryHelper * * @return The connected session. */ - synchronized public SessionHelper - connect() + synchronized public SessionHelper connect() { SessionHelper session = new SessionHelper(_callback, createInitData(), getRouterFinderStr(), _useCallbacks); session.connect(_context); @@ -321,21 +307,19 @@ public class SessionFactoryHelper * @param password The password. * @return The connected session. */ - synchronized public SessionHelper - connect(final String username, final String password) + synchronized public SessionHelper connect(final String username, final String password) { SessionHelper session = new SessionHelper(_callback, createInitData(), getRouterFinderStr(), _useCallbacks); session.connect(username, password, _context); return session; } - private Ice.InitializationData - createInitData() + private InitializationData createInitData() { // // Clone the initialization data and properties. // - Ice.InitializationData initData = _initData.clone(); + InitializationData initData = _initData.clone(); initData.properties = initData.properties._clone(); if(initData.properties.getProperty("Ice.Default.Router").length() == 0 && _identity != null) @@ -351,25 +335,24 @@ public class SessionFactoryHelper if((_protocol.equals("ssl") || _protocol.equals("wss")) && initData.properties.getProperty("Ice.Plugin.IceSSL").length() == 0) { - initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); + initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory"); } return initData; } - private String - getRouterFinderStr() + private String getRouterFinderStr() { - Ice.Identity ident = new Ice.Identity("RouterFinder", "Ice"); + com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity("RouterFinder", "Ice"); return getProxyStr(ident); } private String - getProxyStr(Ice.Identity ident) + getProxyStr(com.zeroc.Ice.Identity ident) { StringBuilder sb = new StringBuilder(); sb.append("\""); - sb.append(Ice.Util.identityToString(ident)); + sb.append(Util.identityToString(ident)); sb.append("\":"); sb.append(_protocol + " -p "); sb.append(getPortInternal()); @@ -386,8 +369,8 @@ public class SessionFactoryHelper private SessionCallback _callback; private String _routerHost = "localhost"; - private Ice.InitializationData _initData; - private Ice.Identity _identity = null; + private InitializationData _initData; + private com.zeroc.Ice.Identity _identity = null; private String _protocol = "ssl"; private int _port = 0; private int _timeout = 10000; diff --git a/java/src/Glacier2/src/main/java/Glacier2/SessionHelper.java b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java index 70257c9f66d..d9cad5f60d2 100644 --- a/java/src/Glacier2/src/main/java/Glacier2/SessionHelper.java +++ b/java/src/Glacier2/src/main/java/com/zeroc/Glacier2/SessionHelper.java @@ -7,7 +7,10 @@ // // ********************************************************************** -package Glacier2; +package com.zeroc.Glacier2; + +import com.zeroc.Ice.ACMHeartbeat; +import com.zeroc.Ice.InitializationData; /** * A helper class for using Glacier2 with GUI applications. @@ -22,7 +25,7 @@ public class SessionHelper * @param finderStr The stringified Ice.RouterFinder proxy. * @param useCallbacks True if the session should create an object adapter for receiving callbacks. */ - public SessionHelper(SessionCallback callback, Ice.InitializationData initData, String finderStr, + public SessionHelper(SessionCallback callback, InitializationData initData, String finderStr, boolean useCallbacks) { _callback = callback; @@ -37,8 +40,7 @@ public class SessionHelper * Once the session has been destroyed, {@link SessionCallback.disconnected} is called on * the associated callback object. */ - public void - destroy() + public void destroy() { synchronized(this) { @@ -98,8 +100,7 @@ public class SessionHelper * Returns the session's communicator object. * @return The communicator. */ - synchronized public Ice.Communicator - communicator() + synchronized public com.zeroc.Ice.Communicator communicator() { return _communicator; } @@ -111,8 +112,7 @@ public class SessionHelper * @return The category. * @throws SessionNotExistException No session exists. **/ - synchronized public String - categoryForClient() + synchronized public String categoryForClient() throws SessionNotExistException { if(_router == null) @@ -129,16 +129,15 @@ public class SessionHelper * @return The proxy for the servant. * @throws SessionNotExistException No session exists. **/ - synchronized public Ice.ObjectPrx - addWithUUID(Ice.Object servant) + synchronized public com.zeroc.Ice.ObjectPrx addWithUUID(com.zeroc.Ice.Object servant) throws SessionNotExistException { if(_router == null) { throw new SessionNotExistException(); } - return internalObjectAdapter().add(servant, new Ice.Identity(java.util.UUID.randomUUID().toString(), - _category)); + return internalObjectAdapter().add(servant, new com.zeroc.Ice.Identity(java.util.UUID.randomUUID().toString(), + _category)); } /** @@ -147,8 +146,7 @@ public class SessionHelper * @return The session proxy, or throws SessionNotExistException if no session exists. * @throws SessionNotExistException No session exists. */ - synchronized public Glacier2.SessionPrx - session() + synchronized public com.zeroc.Glacier2.SessionPrx session() throws SessionNotExistException { if(_session == null) @@ -163,8 +161,7 @@ public class SessionHelper * Returns true if there is an active session, otherwise returns false. * @return <code>true</code>if session exists or false if no session exists. */ - synchronized public boolean - isConnected() + synchronized public boolean isConnected() { return _connected; } @@ -174,8 +171,7 @@ public class SessionHelper * @return The object adapter. * @throws SessionNotExistException No session exists. */ - synchronized public Ice.ObjectAdapter - objectAdapter() + synchronized public com.zeroc.Ice.ObjectAdapter objectAdapter() throws SessionNotExistException { return internalObjectAdapter(); @@ -184,8 +180,7 @@ public class SessionHelper // // Only call this method when the calling thread owns the lock // - private Ice.ObjectAdapter - internalObjectAdapter() + private com.zeroc.Ice.ObjectAdapter internalObjectAdapter() throws SessionNotExistException { if(_router == null) @@ -194,7 +189,7 @@ public class SessionHelper } if(!_useCallbacks) { - throw new Ice.InitializationException( + throw new com.zeroc.Ice.InitializationException( "Object adapter not available, call SessionFactoryHelper.setUseCallbacks(true)"); } return _adapter; @@ -202,8 +197,7 @@ public class SessionHelper private interface ConnectStrategy { - Glacier2.SessionPrx - connect(Glacier2.RouterPrx router) + com.zeroc.Glacier2.SessionPrx connect(com.zeroc.Glacier2.RouterPrx router) throws CannotCreateSessionException, PermissionDeniedException; } @@ -215,8 +209,7 @@ public class SessionHelper * * @param context The request context to use when creating the session. */ - synchronized protected void - connect(final java.util.Map<String, String> context) + synchronized protected void connect(final java.util.Map<String, String> context) { connectImpl(new ConnectStrategy() { @@ -239,8 +232,8 @@ public class SessionHelper * @param password The password. * @param context The request context to use when creating the session. */ - synchronized protected void - connect(final String username, final String password, final java.util.Map<String, String> context) + synchronized protected void connect(final String username, final String password, + final java.util.Map<String, String> context) { connectImpl(new ConnectStrategy() { @@ -253,21 +246,20 @@ public class SessionHelper }); } - private void - connected(RouterPrx router, SessionPrx session) + private void connected(RouterPrx router, SessionPrx session) { // // Remote invocation should be done without acquiring a mutex lock. // assert(router != null); - Ice.Connection conn = router.ice_getCachedConnection(); + com.zeroc.Ice.Connection conn = router.ice_getCachedConnection(); String category = router.getCategoryForClient(); int acmTimeout = 0; try { acmTimeout = router.getACMTimeout(); } - catch(Ice.OperationNotExistException ex) + catch(com.zeroc.Ice.OperationNotExistException ex) { } @@ -322,19 +314,12 @@ public class SessionHelper if(acmTimeout > 0) { - Ice.Connection connection = _router.ice_getCachedConnection(); + com.zeroc.Ice.Connection connection = _router.ice_getCachedConnection(); assert(connection != null); - connection.setACM(new Ice.IntOptional(acmTimeout), + connection.setACM(java.util.OptionalInt.of(acmTimeout), null, - new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways)); - connection.setCloseCallback(new Ice.CloseCallback() - { - @Override - public void closed(Ice.Connection con) - { - destroy(); - } - }); + java.util.Optional.of(ACMHeartbeat.HeartbeatAlways)); + connection.setCloseCallback(con -> destroy()); } _shutdownHook = new Thread("Shutdown hook") @@ -381,12 +366,11 @@ public class SessionHelper }, conn); } - private void - destroyInternal() + private void destroyInternal() { assert _destroy; - Glacier2.RouterPrx router = null; - Ice.Communicator communicator = null; + com.zeroc.Glacier2.RouterPrx router = null; + com.zeroc.Ice.Communicator communicator = null; synchronized(this) { if(_router == null) @@ -406,7 +390,7 @@ public class SessionHelper { router.destroySession(); } - catch(Ice.ConnectionLostException e) + catch(com.zeroc.Ice.ConnectionLostException e) { // // Expected if another thread invoked on an object from the session concurrently. @@ -447,10 +431,9 @@ public class SessionHelper }, null); } - private void - destroyCommunicator() + private void destroyCommunicator() { - Ice.Communicator communicator = null; + com.zeroc.Ice.Communicator communicator = null; synchronized(this) { communicator = _communicator; @@ -468,16 +451,15 @@ public class SessionHelper } } - private void - connectImpl(final ConnectStrategy factory) + private void connectImpl(final ConnectStrategy factory) { assert !_destroy; try { - _communicator = Ice.Util.initialize(_initData); + _communicator = com.zeroc.Ice.Util.initialize(_initData); } - catch(final Ice.LocalException ex) + catch(final com.zeroc.Ice.LocalException ex) { _destroy = true; new Thread(new Runnable() @@ -498,8 +480,8 @@ public class SessionHelper return; } - final Ice.RouterFinderPrx finder = - Ice.RouterFinderPrxHelper.uncheckedCast(_communicator.stringToProxy(_finderStr)); + final com.zeroc.Ice.RouterFinderPrx finder = + com.zeroc.Ice.RouterFinderPrx.uncheckedCast(_communicator.stringToProxy(_finderStr)); new Thread(new Runnable() { @Override @@ -511,7 +493,7 @@ public class SessionHelper { _communicator.setDefaultRouter(finder.getRouter()); } - catch(final Ice.CommunicatorDestroyedException ex) + catch(final com.zeroc.Ice.CommunicatorDestroyedException ex) { dispatchCallback(new Runnable() { @@ -529,8 +511,9 @@ public class SessionHelper // In case of error getting router identity from RouterFinder use // default identity. // - Ice.Identity ident = new Ice.Identity("router", "Glacier2"); - _communicator.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(finder.ice_identity(ident))); + com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity("router", "Glacier2"); + _communicator.setDefaultRouter( + com.zeroc.Ice.RouterPrx.uncheckedCast(finder.ice_identity(ident))); } } @@ -545,9 +528,9 @@ public class SessionHelper } }); - Glacier2.RouterPrx routerPrx = Glacier2.RouterPrxHelper.uncheckedCast( + com.zeroc.Glacier2.RouterPrx routerPrx = com.zeroc.Glacier2.RouterPrx.uncheckedCast( _communicator.getDefaultRouter()); - Glacier2.SessionPrx session = factory.connect(routerPrx); + com.zeroc.Glacier2.SessionPrx session = factory.connect(routerPrx); connected(routerPrx, session); } catch(final Exception ex) @@ -573,8 +556,7 @@ public class SessionHelper }).start(); } - private void - dispatchCallback(Runnable runnable, Ice.Connection conn) + private void dispatchCallback(Runnable runnable, com.zeroc.Ice.Connection conn) { if(_initData.dispatcher != null) { @@ -586,8 +568,7 @@ public class SessionHelper } } - private void - dispatchCallbackAndWait(final Runnable runnable) + private void dispatchCallbackAndWait(final Runnable runnable) { if(_initData.dispatcher != null) { @@ -596,8 +577,7 @@ public class SessionHelper new Runnable() { @Override - public void - run() + public void run() { runnable.run(); sem.release(); @@ -611,11 +591,11 @@ public class SessionHelper } } - private final Ice.InitializationData _initData; - private Ice.Communicator _communicator; - private Ice.ObjectAdapter _adapter; - private Glacier2.RouterPrx _router; - private Glacier2.SessionPrx _session; + private final InitializationData _initData; + private com.zeroc.Ice.Communicator _communicator; + private com.zeroc.Ice.ObjectAdapter _adapter; + private com.zeroc.Glacier2.RouterPrx _router; + private com.zeroc.Glacier2.SessionPrx _session; private String _category; private String _finderStr; private boolean _useCallbacks; diff --git a/java/src/Ice/build.gradle b/java/src/Ice/build.gradle index eec56094858..7e687c43682 100644 --- a/java/src/Ice/build.gradle +++ b/java/src/Ice/build.gradle @@ -7,8 +7,10 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "Ice" project.ext.description = "Ice is a comprehensive RPC framework that helps you build distributed applications" + diff --git a/java/src/Ice/src/main/java/Ice/AMDCallback.java b/java/src/Ice/src/main/java/Ice/AMDCallback.java deleted file mode 100644 index 9ece32a5899..00000000000 --- a/java/src/Ice/src/main/java/Ice/AMDCallback.java +++ /dev/null @@ -1,23 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * AMDCallback is the interface from which all AMD callbacks are derived. - **/ -public interface AMDCallback -{ - /** - * ice_exception indicates to the Ice run time that - * the operation completed with an exception. - * @param ex The exception to be raised. - **/ - public void ice_exception(java.lang.Exception ex); -} diff --git a/java/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java b/java/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java deleted file mode 100644 index 5fbeb9649c6..00000000000 --- a/java/src/Ice/src/main/java/Ice/AMD_Object_ice_invoke.java +++ /dev/null @@ -1,40 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback interface for <Blobject> AMD servants. - * - @see BlobjectAsync - **/ -public interface AMD_Object_ice_invoke -{ - /** - * Indicates to the Ice run time that an operation - * completed. - * - * @param ok <code>true</code> indicates that the operation - * completed successfully; <code>false</code> indicates that the - * operation raised a user exception. - * @param outEncaps The encoded out-parameters for the operation or, - * if <code>ok</code> is <code>false</code>, the encoded user exception. - **/ - void ice_response(boolean ok, byte[] outEncaps); - - /** - * Indicates to the Ice run time that an operation completed - * with a run-time exception. - * - * @param ex The encoded Ice run-time exception. Note that, if <code>ex</code> - * is a user exception, the caller receives {@link UnknownUserException}. - * Use {@link #ice_response} to raise user exceptions. - **/ - void ice_exception(java.lang.Exception ex); -} diff --git a/java/src/Ice/src/main/java/Ice/AsyncCallback.java b/java/src/Ice/src/main/java/Ice/AsyncCallback.java deleted file mode 100644 index 7ec2a2837ac..00000000000 --- a/java/src/Ice/src/main/java/Ice/AsyncCallback.java +++ /dev/null @@ -1,22 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * An application can optionally supply an instance of this class in an - * asynchronous invocation. The application must create a subclass and - * implement the completed method. - * - * @deprecated This class is deprecated, use Ice.Callback instead. - **/ -@Deprecated -public abstract class AsyncCallback extends Callback -{ -} diff --git a/java/src/Ice/src/main/java/Ice/Blobject.java b/java/src/Ice/src/main/java/Ice/Blobject.java deleted file mode 100644 index 0a3fda4b795..00000000000 --- a/java/src/Ice/src/main/java/Ice/Blobject.java +++ /dev/null @@ -1,53 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base class for dynamic dispatch servants. A server application - * derives a concrete servant class from <code>Blobject</code> that - * implements the {@link Blobject#ice_invoke} method. - **/ -public abstract class Blobject extends Ice.ObjectImpl -{ - /** - * Dispatch an incoming request. - * - * @param inEncaps The encoded in-parameters for the operation. - * @param outEncaps The encoded out-paramaters and return value - * for the operation. The return value follows any out-parameters. - * @param current The Current object to pass to the operation. - * @return If the operation completed successfully, the return value - * is <code>true</code>. If the operation raises a user exception, - * the return value is <code>false</code>; in this case, <code>outEncaps</code> - * must contain the encoded user exception. If the operation raises an - * Ice run-time exception, it must throw it directly. - **/ - public abstract boolean - ice_invoke(byte[] inEncaps, ByteSeqHolder outEncaps, Current current); - - @Override - public DispatchStatus - __dispatch(IceInternal.Incoming in, Current current) - { - byte[] inEncaps; - ByteSeqHolder outEncaps = new ByteSeqHolder(); - inEncaps = in.readParamEncaps(); - boolean ok = ice_invoke(inEncaps, outEncaps, current); - in.__writeParamEncaps(outEncaps.value, ok); - if(ok) - { - return DispatchStatus.DispatchOK; - } - else - { - return DispatchStatus.DispatchUserException; - } - } -} diff --git a/java/src/Ice/src/main/java/Ice/BlobjectAsync.java b/java/src/Ice/src/main/java/Ice/BlobjectAsync.java deleted file mode 100644 index 4521de71e11..00000000000 --- a/java/src/Ice/src/main/java/Ice/BlobjectAsync.java +++ /dev/null @@ -1,50 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * <code>BlobjectAsync</code> is the base class for asynchronous dynamic - * dispatch servants. A server application derives a concrete servant - * class that implements the {@link BlobjectAsync#ice_invoke_async} method, - * which is called by the Ice run time to deliver every request on this - * object. - **/ -public abstract class BlobjectAsync extends Ice.ObjectImpl -{ - /** - * Dispatch an incoming request. - * - * @param cb The callback object through which the invocation's results - * must be delivered. - * @param inEncaps The encoded input parameters. - * @param current The Current object, which provides important information - * about the request, such as the identity of the target object and the - * name of the operation. - **/ - public abstract void - ice_invoke_async(AMD_Object_ice_invoke cb, byte[] inEncaps, Current current); - - @Override - public DispatchStatus - __dispatch(IceInternal.Incoming in, Current current) - { - byte[] inEncaps = in.readParamEncaps(); - AMD_Object_ice_invoke cb = new _AMD_Object_ice_invoke(in); - try - { - ice_invoke_async(cb, inEncaps, current); - } - catch(java.lang.Exception ex) - { - cb.ice_exception(ex); - } - return DispatchStatus.DispatchAsync; - } -} diff --git a/java/src/Ice/src/main/java/Ice/BooleanHolder.java b/java/src/Ice/src/main/java/Ice/BooleanHolder.java deleted file mode 100644 index 7233a0d27fc..00000000000 --- a/java/src/Ice/src/main/java/Ice/BooleanHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for booleans that are out- or inout-parameters. - **/ -public final class BooleanHolder extends Holder<Boolean> -{ - /** - * Instantiates the class with the value <code>false</code>. - **/ - public - BooleanHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * @param value The <code>boolean</code> value stored by this holder. - **/ - public - BooleanHolder(boolean value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/BooleanOptional.java b/java/src/Ice/src/main/java/Ice/BooleanOptional.java deleted file mode 100644 index e6275db43ae..00000000000 --- a/java/src/Ice/src/main/java/Ice/BooleanOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional boolean parameter. - **/ -public class BooleanOptional -{ - /** - * The value defaults to unset. - **/ - public BooleanOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public BooleanOptional(boolean v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public BooleanOptional(BooleanOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public boolean get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(boolean v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(BooleanOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = false; - } - - private boolean _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/ByteHolder.java b/java/src/Ice/src/main/java/Ice/ByteHolder.java deleted file mode 100644 index ac54599f84d..00000000000 --- a/java/src/Ice/src/main/java/Ice/ByteHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for bytes that are out- or inout-parameters. - **/ -public final class ByteHolder extends Holder<Byte> -{ - /** - * Instantiates the class with the value zero. - **/ - public - ByteHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * @param value The <code>byte</code> value stored by this holder. - **/ - public - ByteHolder(byte value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/ByteOptional.java b/java/src/Ice/src/main/java/Ice/ByteOptional.java deleted file mode 100644 index 493bfaf34a4..00000000000 --- a/java/src/Ice/src/main/java/Ice/ByteOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional byte parameter. - **/ -public class ByteOptional -{ - /** - * The value defaults to unset. - **/ - public ByteOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public ByteOptional(byte v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public ByteOptional(ByteOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public byte get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(byte v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(ByteOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = 0; - } - - private byte _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/Callback.java b/java/src/Ice/src/main/java/Ice/Callback.java deleted file mode 100644 index 0d852d6d4c6..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback.java +++ /dev/null @@ -1,57 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * An application can optionally supply an instance of this class in an - * asynchronous invocation. The application must create a subclass and - * implement the completed method. - **/ -public abstract class Callback extends IceInternal.CallbackBase -{ - /** - * Invoked when the invocation completes. The subclass should - * call the matching <code>end_OP</code> method on the proxy and - * must be prepared to handle exceptions. - * - * @param r The asynchronous result object returned by the <code>begin_OP</code> method. - **/ - public abstract void completed(AsyncResult r); - - /** - * Invoked when the Ice run time has passed the outgoing message - * buffer to the transport. The default implementation does nothing, - * a subclass can override it if it needs to take action when the - * message is successfully sent. - * - * @param r The asynchronous result object returned by the <code>begin_OP</code> method. - **/ - public void sent(AsyncResult r) - { - } - - @Override - public final void __completed(AsyncResult r) - { - completed(r); - } - - @Override - public final void __sent(AsyncResult r) - { - sent(r); - } - - @Override - public final boolean __hasSentCallback() - { - return true; - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java b/java/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java deleted file mode 100644 index ef8fabded16..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Communicator_flushBatchRequests.java +++ /dev/null @@ -1,55 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Asynchronous callback base class for Communicator.begin_flushBatchRequests. - **/ -public abstract class Callback_Communicator_flushBatchRequests extends IceInternal.CallbackBase -{ - /** - * Called when the invocation raises an Ice run-time exception. - * - * @param ex The Ice run-time exception raised by the operation. - **/ - public abstract void exception(LocalException ex); - - /** - * Called when a queued invocation is sent successfully. - **/ - public void sent(boolean sentSynchronously) - { - } - - @Override - public final void __completed(AsyncResult __result) - { - try - { - __result.getCommunicator().end_flushBatchRequests(__result); - } - catch(LocalException __ex) - { - exception(__ex); - } - } - - @Override - public final void __sent(AsyncResult __result) - { - sent(__result.sentSynchronously()); - } - - @Override - public final boolean __hasSentCallback() - { - return true; - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java b/java/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java deleted file mode 100644 index 0386c6c8abf..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Connection_flushBatchRequests.java +++ /dev/null @@ -1,55 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Asynchronous callback base class for Connection.begin_flushBatchRequests. - **/ -public abstract class Callback_Connection_flushBatchRequests extends IceInternal.CallbackBase -{ - /** - * Called when the invocation raises an Ice run-time exception. - * - * @param ex The Ice run-time exception raised by the operation. - **/ - public abstract void exception(LocalException ex); - - /** - * Called when a queued invocation is sent successfully. - **/ - public void sent(boolean sentSynchronously) - { - } - - @Override - public final void __completed(AsyncResult __result) - { - try - { - __result.getConnection().end_flushBatchRequests(__result); - } - catch(LocalException __ex) - { - exception(__ex); - } - } - - @Override - public final void __sent(AsyncResult __result) - { - sent(__result.sentSynchronously()); - } - - @Override - public final boolean __hasSentCallback() - { - return true; - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java deleted file mode 100644 index 2154e37cfa4..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_flushBatchRequests.java +++ /dev/null @@ -1,22 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_flushBatchRequests}. - **/ -public abstract class Callback_Object_ice_flushBatchRequests extends OnewayCallback -{ - @Override - public final void response() - { - // Not used. - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java deleted file mode 100644 index f65533fdaf1..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_getConnection.java +++ /dev/null @@ -1,31 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_getConnection}. - **/ -public abstract class Callback_Object_ice_getConnection extends IceInternal.TwowayCallback - implements Ice.TwowayCallbackArg1<Ice.Connection> -{ - /** - * Called when the invocation completes successfully. - * - * @param __ret The connection being used by the proxy. - **/ - @Override - public abstract void response(Ice.Connection __ret); - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_getConnection_completed(this, __result); - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java deleted file mode 100644 index 541989f45da..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_id.java +++ /dev/null @@ -1,31 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_id}. - **/ -public abstract class Callback_Object_ice_id extends IceInternal.TwowayCallback - implements Ice.TwowayCallbackArg1<String> -{ - /** - * Called when the invocation completes successfully. - * - * @param __ret The Slice type id of the most-derived interface supported by the target object. - **/ - @Override - public abstract void response(String __ret); - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_id_completed(this, __result); - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java deleted file mode 100644 index ab2ecbd5a95..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ids.java +++ /dev/null @@ -1,31 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_ids}. - **/ -public abstract class Callback_Object_ice_ids extends IceInternal.TwowayCallback - implements Ice.TwowayCallbackArg1<String[]> -{ - /** - * Called when the invocation completes successfully. - * - * @param __ret The Slice type ids of the interfaces supported by the target object. - **/ - @Override - public abstract void response(String[] __ret); - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_ids_completed(this, __result); - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java deleted file mode 100644 index a60a22ce7ff..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_invoke.java +++ /dev/null @@ -1,36 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_invoke}. - **/ -public abstract class Callback_Object_ice_invoke - extends IceInternal.TwowayCallback implements _Callback_Object_ice_invoke -{ - /** - * The Ice run time calls <code>response</code> when an asynchronous operation invocation - * completes successfully or raises a user exception. - * - * @param ret Indicates the result of the invocation. If <code>true</code>, the operation - * completed succesfully; if <code>false</code>, the operation raised a user exception. - * @param outParams Contains the encoded out-parameters of the operation (if any) if <code>ok</code> - * is <code>true</code>; otherwise, if <code>ok</code> is <code>false</code>, contains the - * encoded user exception raised by the operation. - **/ - @Override - public abstract void response(boolean ret, byte[] outParams); - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_invoke_completed(this, __result); - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java deleted file mode 100644 index 8ccba433133..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_isA.java +++ /dev/null @@ -1,30 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_isA}. - **/ -public abstract class Callback_Object_ice_isA extends IceInternal.TwowayCallback implements Ice.TwowayCallbackBool -{ - /** - * Called when the invocation completes successfully. - * - * @param __ret True if the target object supports the given interface, false otherwise. - **/ - @Override - public abstract void response(boolean __ret); - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_isA_completed(this, __result); - } -} diff --git a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java b/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java deleted file mode 100644 index 61be444f1bc..00000000000 --- a/java/src/Ice/src/main/java/Ice/Callback_Object_ice_ping.java +++ /dev/null @@ -1,17 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_ping}. - **/ -public abstract class Callback_Object_ice_ping extends OnewayCallback -{ -} diff --git a/java/src/Ice/src/main/java/Ice/DispatchInterceptor.java b/java/src/Ice/src/main/java/Ice/DispatchInterceptor.java deleted file mode 100644 index d5cb1519f58..00000000000 --- a/java/src/Ice/src/main/java/Ice/DispatchInterceptor.java +++ /dev/null @@ -1,71 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base class that allows a server intercept incoming requests. - * The application must derive a concrete class from <code>DispatchInterceptor</code> - * that implements the {@link DispatchInterceptor#dispatch} operation. An instance of this derived - * class can be registered with an object adapter like any other servant. - * <p> - * A dispatch interceptor is useful particularly to automatically retry requests - * that have failed due to a recoverable error condition. - **/ -public abstract class DispatchInterceptor extends ObjectImpl -{ - /** - * Called by the Ice run time to dispatch an incoming request. The implementation - * of <code>dispatch</code> must dispatch the request to the actual servant. - * - * @param request The details of the incoming request. - * @return For synchronous dispatch, the return value must be whatever is - * returned {@link #ice_dispatch}. For asynchronous dispatch, the return - * value must be <code>DispatchAsync</code>. - * - * @see Request - * @see DispatchStatus - **/ - public abstract DispatchStatus - dispatch(Request request); - - @Override - public DispatchStatus - __dispatch(IceInternal.Incoming in, Current current) - { - try - { - DispatchStatus status = dispatch(in); - if(status != DispatchStatus.DispatchAsync) - { - // - // Make sure 'in' owns the connection etc. - // - in.killAsync(); - } - return status; - } - catch(ResponseSentException e) - { - return DispatchStatus.DispatchAsync; - } - catch(java.lang.RuntimeException e) - { - try - { - in.killAsync(); - throw e; - } - catch(ResponseSentException rse) - { - return DispatchStatus.DispatchAsync; - } - } - } -} diff --git a/java/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java b/java/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java deleted file mode 100644 index fdbf42ebe06..00000000000 --- a/java/src/Ice/src/main/java/Ice/DispatchInterceptorAsyncCallback.java +++ /dev/null @@ -1,35 +0,0 @@ -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * The callback object for asynchronous dispatch. - **/ -public interface DispatchInterceptorAsyncCallback -{ - /** - * Called when the operation succeeded or raised a user exception, - * as indicated by the <code>ok</code> parameter. - * - * @param ok True if the operation succeeded, or false if the - * operation raised a user exception. - * @return True to allow the Ice run time to handle the result - * as it normally would, or false if the interceptor has handled - * the operation. - **/ - boolean response(boolean ok); - - /** - * Called when the operation failed with a run-time exception. - * - * @param ex The exception raised by the operation. - * @return True to allow the Ice run time to handle the result - * as it normally would, or false if the interceptor has handled - * the operation. - **/ - boolean exception(java.lang.Exception ex); -} diff --git a/java/src/Ice/src/main/java/Ice/DispatchStatus.java b/java/src/Ice/src/main/java/Ice/DispatchStatus.java deleted file mode 100644 index beb91152d03..00000000000 --- a/java/src/Ice/src/main/java/Ice/DispatchStatus.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Indicates the status of operation dispatch. - * - * @see DispatchInterceptor - **/ -public enum DispatchStatus implements java.io.Serializable -{ - /** - * Indicates that an operation was dispatched synchronously and successfully. - **/ - DispatchOK, - - /** - * Indicates that an operation was dispatched synchronously and raised a user exception. - **/ - DispatchUserException, - - /** - * Indicates that an operation was dispatched asynchronously. - **/ - DispatchAsync; - - public static final long serialVersionUID = 0L; -} diff --git a/java/src/Ice/src/main/java/Ice/DoubleHolder.java b/java/src/Ice/src/main/java/Ice/DoubleHolder.java deleted file mode 100644 index db51782dc22..00000000000 --- a/java/src/Ice/src/main/java/Ice/DoubleHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for doubles that are out- or inout-parameters. - **/ -public final class DoubleHolder extends Holder<Double> -{ - /** - * Instantiates the class with the value zero. - **/ - public - DoubleHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * @param value The <code>double</code> value stored by this holder. - **/ - public - DoubleHolder(double value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/DoubleOptional.java b/java/src/Ice/src/main/java/Ice/DoubleOptional.java deleted file mode 100644 index 7efd476babd..00000000000 --- a/java/src/Ice/src/main/java/Ice/DoubleOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional double parameter. - **/ -public class DoubleOptional -{ - /** - * The value defaults to unset. - **/ - public DoubleOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public DoubleOptional(double v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public DoubleOptional(DoubleOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public double get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(double v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(DoubleOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = 0; - } - - private double _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/FloatHolder.java b/java/src/Ice/src/main/java/Ice/FloatHolder.java deleted file mode 100644 index 4abd74438e5..00000000000 --- a/java/src/Ice/src/main/java/Ice/FloatHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for floats that are out- or inout-parameters. - **/ -public final class FloatHolder extends Holder<Float> -{ - /** - * Instantiates the class with the value zero. - **/ - public - FloatHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * @param value The <code>float</code> value stored by this holder. - **/ - public - FloatHolder(float value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/FloatOptional.java b/java/src/Ice/src/main/java/Ice/FloatOptional.java deleted file mode 100644 index 92f67c32071..00000000000 --- a/java/src/Ice/src/main/java/Ice/FloatOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional float parameter. - **/ -public class FloatOptional -{ - /** - * The value defaults to unset. - **/ - public FloatOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public FloatOptional(float v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public FloatOptional(FloatOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public float get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(float v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(FloatOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = 0; - } - - private float _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/Holder.java b/java/src/Ice/src/main/java/Ice/Holder.java deleted file mode 100644 index bc086b1683b..00000000000 --- a/java/src/Ice/src/main/java/Ice/Holder.java +++ /dev/null @@ -1,40 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Generic holder class for values that are in- or in-out parameters. - **/ -public class Holder<T> -{ - /** - * Instantiates the class with the default-initialized value of type <code>T</code>. - **/ - public - Holder() - { - } - - /** - * Instantiates the class with the passed value. - * - * @param value The value stored by this holder. - **/ - public - Holder(T value) - { - this.value = value; - } - - /** - * The <code>T</code> value stored by this holder. - **/ - public T value; -} diff --git a/java/src/Ice/src/main/java/Ice/IntHolder.java b/java/src/Ice/src/main/java/Ice/IntHolder.java deleted file mode 100644 index c79285985d6..00000000000 --- a/java/src/Ice/src/main/java/Ice/IntHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for integers that are out- or inout-parameters. - **/ -public final class IntHolder extends Holder<Integer> -{ - /** - * Instantiates the class with the value zero. - **/ - public - IntHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * The <code>int</code> value for this holder. - **/ - public - IntHolder(int value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/IntOptional.java b/java/src/Ice/src/main/java/Ice/IntOptional.java deleted file mode 100644 index 825ae76b1d7..00000000000 --- a/java/src/Ice/src/main/java/Ice/IntOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional int parameter. - **/ -public class IntOptional -{ - /** - * The value defaults to unset. - **/ - public IntOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public IntOptional(int v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public IntOptional(IntOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public int get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(int v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(IntOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = 0; - } - - private int _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/LocalObjectHolder.java b/java/src/Ice/src/main/java/Ice/LocalObjectHolder.java deleted file mode 100644 index 704aa31b234..00000000000 --- a/java/src/Ice/src/main/java/Ice/LocalObjectHolder.java +++ /dev/null @@ -1,33 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for local objects that are out- or inout-parameters. - **/ -public final class LocalObjectHolder extends Holder<java.lang.Object> -{ - /** - * Instantiates the class with a <code>null</code> value. - **/ - public - LocalObjectHolder() - { - } - - /** - * Instantiates the class with the passed local object. - **/ - public - LocalObjectHolder(java.lang.Object value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/LongHolder.java b/java/src/Ice/src/main/java/Ice/LongHolder.java deleted file mode 100644 index 6027d071be6..00000000000 --- a/java/src/Ice/src/main/java/Ice/LongHolder.java +++ /dev/null @@ -1,33 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for longs that are out- or inout-parameters. - **/ -public final class LongHolder extends Holder<Long> -{ - /** - * Instantiates the class with the value zero. - **/ - public - LongHolder() - { - } - - /** - * Instantiates the class with the passed value. - **/ - public - LongHolder(long value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/LongOptional.java b/java/src/Ice/src/main/java/Ice/LongOptional.java deleted file mode 100644 index e7301ae8dc6..00000000000 --- a/java/src/Ice/src/main/java/Ice/LongOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional long parameter. - **/ -public class LongOptional -{ - /** - * The value defaults to unset. - **/ - public LongOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public LongOptional(long v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public LongOptional(LongOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public long get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(long v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(LongOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = 0; - } - - private long _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/Object.java b/java/src/Ice/src/main/java/Ice/Object.java deleted file mode 100644 index e83fc29756f..00000000000 --- a/java/src/Ice/src/main/java/Ice/Object.java +++ /dev/null @@ -1,162 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * The base interface for servants. - **/ -public interface Object -{ - /** - * Returns a copy of the object. The cloned object contains field-for-field copies - * of the state. - * - * @return The cloned object. - **/ - Object clone() throws java.lang.CloneNotSupportedException; - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param s The type ID of the Slice interface to test against. - * @return <code>true</code> if this object has the interface - * specified by <code>s</code> or derives from the interface - * specified by <code>s</code>. - **/ - boolean ice_isA(String s); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param s The type ID of the Slice interface to test against. - * @param current The {@link Current} object for the invocation. - * @return <code>true</code> if this object has the interface - * specified by <code>s</code> or derives from the interface - * specified by <code>s</code>. - **/ - boolean ice_isA(String s, Current current); - - /** - * Tests whether this object can be reached. - **/ - void ice_ping(); - - /** - * Tests whether this object can be reached. - * - * @param current The {@link Current} object for the invocation. - **/ - void ice_ping(Current current); - - /** - * Returns the Slice type IDs of the interfaces supported by this object. - * - * @return The Slice type IDs of the interfaces supported by this object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - String[] ice_ids(); - - /** - * Returns the Slice type IDs of the interfaces supported by this object. - * - * @param current The {@link Current} object for the invocation. - * @return The Slice type IDs of the interfaces supported by this object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - String[] ice_ids(Current current); - - /** - * Returns the Slice type ID of the most-derived interface supported by this object. - * - * @return The Slice type ID of the most-derived interface. - **/ - String ice_id(); - - /** - * Returns the Slice type ID of the most-derived interface supported by this object. - * - * @param current The {@link Current} object for the invocation. - * @return The Slice type ID of the most-derived interface. - **/ - String ice_id(Current current); - - /** - * Returns the Freeze metadata attributes for an operation. - * - * @param operation The name of the operation. - * @return The least significant bit indicates whether the operation is a read - * or write operation. If the bit is set, the operation is a write operation. - * The expression <code>ice_operationAttributes("op") & 0x1</code> is true if - * the operation has a <code>["freeze:write"]</code> metadata directive. - * <p> - * The second- and third least significant bit indicate the transactional mode - * of the operation. The expression <code>ice_operationAttributes("op") & 0x6 >> 1</code> - * indicates the transactional mode as follows: - * <dl> - * <dt>0</dt> - * <dd><code>["freeze:read:supports"]</code></dd> - * <dt>1</dt> - * <dd><code>["freeze:read:mandatory"]</code> or <code>["freeze:write:mandatory"]</code></dd> - * <dt>2</dt> - * <dd><code>["freeze:read:required"]</code> or <code>["freeze:write:required"]</code></dd> - * <dt>3</dt> - * <dd><code>["freeze:read:never"]</code></dd> - * </dl> - * - * Refer to the Freeze manual for more information on the TransactionalEvictor. - **/ - int ice_operationAttributes(String operation); - - /** - * The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass - * to override this method in order to validate its data members. - **/ - void ice_preMarshal(); - - /** - * The Ice run time invokes this method vafter unmarshaling an object's data members. This allows a - * subclass to override this method in order to perform additional initialization. - **/ - void ice_postUnmarshal(); - - /** - * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation - * to a servant (or to another interceptor). - * - * @param request The details of the invocation. - * @param cb The callback object for asynchronous dispatch. For synchronous dispatch, the callback object - * must be <code>null</code>. - * @return The dispatch status for the operation. - * - * @see DispatchInterceptor - * @see DispatchInterceptorAsyncCallback - * @see DispatchStatus - **/ - DispatchStatus ice_dispatch(Request request, DispatchInterceptorAsyncCallback cb); - - /** - * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation - * to a servant (or to another interceptor). - * - * @param request The details of the invocation. - * @return The dispatch status for the operation. - * - * @see DispatchInterceptor - * @see DispatchStatus - **/ - DispatchStatus ice_dispatch(Request request); - - DispatchStatus __dispatch(IceInternal.Incoming in, Current current); - - void __write(OutputStream __os); - void __read(InputStream __is); - - public static final String ice_staticId = "::Ice::Object"; -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectHolder.java b/java/src/Ice/src/main/java/Ice/ObjectHolder.java deleted file mode 100644 index c570288a292..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectHolder.java +++ /dev/null @@ -1,41 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for Ice objects that are out- or inout-parameters. - **/ -public final class ObjectHolder extends ObjectHolderBase<Ice.Object> -{ - /** - * Instantiates the class with a <code>null</code> value. - **/ - public ObjectHolder() - { - } - - /** - * Instantiates the class with the passed Ice object. - **/ - public ObjectHolder(Ice.Object value) - { - super(value); - } - - /** - * Sets the value of this holder to the passed instance. - * - * @param v The new value for this holder. - **/ - public void valueReady(Ice.Object v) - { - value = v; - } -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectHolderBase.java b/java/src/Ice/src/main/java/Ice/ObjectHolderBase.java deleted file mode 100644 index 62fa4ac1591..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectHolderBase.java +++ /dev/null @@ -1,38 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder base class for Ice objects that are in- or inout-parameters. - **/ -public abstract class ObjectHolderBase<T extends Ice.Object> implements ReadValueCallback -{ - /** - * Instantiates the class with a <code>null</code> value. - **/ - public - ObjectHolderBase() - { - } - - /** - * Instantiates the class with the passed Ice object. - **/ - public - ObjectHolderBase(T obj) - { - this.value = obj; - } - - /** - * The Ice object stored by this holder. - **/ - public T value; -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectImpl.java b/java/src/Ice/src/main/java/Ice/ObjectImpl.java deleted file mode 100644 index b6a253d13ef..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectImpl.java +++ /dev/null @@ -1,429 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base class for all Slice classes. - **/ -public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io.Serializable -{ - /** - * Instantiates an Ice object. - **/ - public - ObjectImpl() - { - } - - /** - * Returns a copy of the object. The cloned object contains field-for-field copies - * of the state. - * - * @return The cloned object. - **/ - @Override - public ObjectImpl - clone() - { - ObjectImpl c = null; - - try - { - c = (ObjectImpl)super.clone(); - } - catch(CloneNotSupportedException ex) - { - assert false; - } - return c; - } - - public final static String[] __ids = - { - "::Ice::Object" - }; - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param s The type ID of the Slice interface to test against. - * @return The return value is <code>true</code> if <code>s</code> is - * <code>::Ice::Object</code>. - **/ - @Override - public boolean - ice_isA(String s) - { - return s.equals(__ids[0]); - } - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param s The type ID of the Slice interface to test against. - * @param current The current object for the invocation. - * @return The return value is <code>true</code> if <code>s</code> is - * <code>::Ice::Object</code>. - **/ - @Override - public boolean - ice_isA(String s, Current current) - { - return s.equals(__ids[0]); - } - - public static DispatchStatus - ___ice_isA(Ice.Object __obj, IceInternal.Incoming __inS, Current __current) - { - InputStream __is = __inS.startReadParams(); - String __id = __is.readString(); - __inS.endReadParams(); - boolean __ret = __obj.ice_isA(__id, __current); - OutputStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat); - __os.writeBool(__ret); - __inS.__endWriteParams(true); - return DispatchStatus.DispatchOK; - } - - /** - * Tests whether this object can be reached. - **/ - @Override - public void - ice_ping() - { - // Nothing to do. - } - - /** - * Tests whether this object can be reached. - * - * @param current The current object for the invocation. - **/ - @Override - public void - ice_ping(Current current) - { - // Nothing to do. - } - - public static DispatchStatus - ___ice_ping(Ice.Object __obj, IceInternal.Incoming __inS, Current __current) - { - __inS.readEmptyParams(); - __obj.ice_ping(__current); - __inS.__writeEmptyParams(); - return DispatchStatus.DispatchOK; - } - - /** - * Returns the Slice type IDs of the interfaces supported by this object. - * - * @return An array whose only element is <code>::Ice::Object</code>. - **/ - @Override - public String[] - ice_ids() - { - return __ids; - } - - /** - * Returns the Slice type IDs of the interfaces supported by this object. - * - * @param current The current object for the invocation. - * @return An array whose only element is <code>::Ice::Object</code>. - **/ - @Override - public String[] - ice_ids(Current current) - { - return __ids; - } - - public static DispatchStatus - ___ice_ids(Ice.Object __obj, IceInternal.Incoming __inS, Current __current) - { - __inS.readEmptyParams(); - String[] __ret = __obj.ice_ids(__current); - OutputStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat); - __os.writeStringSeq(__ret); - __inS.__endWriteParams(true); - return DispatchStatus.DispatchOK; - } - - /** - * Returns the Slice type ID of the most-derived interface supported by this object. - * - * @return The return value is always <code>::Ice::Object</code>. - **/ - @Override - public String - ice_id() - { - return __ids[0]; - } - - /** - * Returns the Slice type ID of the most-derived interface supported by this object. - * - * @param current The current object for the invocation. - * @return A Slice type ID. - **/ - @Override - public String - ice_id(Current current) - { - return __ids[0]; - } - - public static DispatchStatus - ___ice_id(Ice.Object __obj, IceInternal.Incoming __inS, Current __current) - { - __inS.readEmptyParams(); - String __ret = __obj.ice_id(__current); - OutputStream __os = __inS.__startWriteParams(Ice.FormatType.DefaultFormat); - __os.writeString(__ret); - __inS.__endWriteParams(true); - return DispatchStatus.DispatchOK; - } - - /** - * Returns the Slice type ID of the interface supported by this object. - * - * @return The return value is always ::Ice::Object. - **/ - public static String - ice_staticId() - { - return __ids[0]; - } - - /** - * Returns the Freeze metadata attributes for an operation. - * - * @param operation The name of the operation. - * @return The least significant bit indicates whether the operation is a read - * or write operation. If the bit is set, the operation is a write operation. - * The expression <code>ice_operationAttributes("op") & 0x1</code> is true if - * the operation has a <code>["freeze:write"]</code> metadata directive. - * <p> - * The second- and third least significant bit indicate the transactional mode - * of the operation. The expression <code>ice_operationAttributes("op") & 0x6 >> 1</code> - * indicates the transactional mode as follows: - * <dl> - * <dt>0</dt> - * <dd><code>["freeze:read:supports"]</code></dd> - * <dt>1</dt> - * <dd><code>["freeze:read:mandatory"]</code> or <code>["freeze:write:mandatory"]</code></dd> - * <dt>2</dt> - * <dd><code>["freeze:read:required"]</code> or <code>["freeze:write:required"]</code></dd> - * <dt>3</dt> - * <dd><code>["freeze:read:never"]</code></dd> - * </dl> - * - * Refer to the Freeze manual for more information on the TransactionalEvictor. - **/ - @Override - public int ice_operationAttributes(String operation) - { - return 0; - } - - /** - * The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass - * to override this method in order to validate its data members. This default implementation does nothing. - **/ - @Override - public void - ice_preMarshal() - { - } - - /** - * This Ice run time invokes this method vafter unmarshaling an object's data members. This allows a - * subclass to override this method in order to perform additional initialization. This default - * implementation does nothing. - **/ - @Override - public void - ice_postUnmarshal() - { - } - - private final static String[] __all = - { - "ice_id", - "ice_ids", - "ice_isA", - "ice_ping" - }; - - /** - * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation - * to a servant (or to another interceptor). - * - * @param request The details of the invocation. - * @param cb The callback object for asynchchronous dispatch. For synchronous dispatch, the callback object must - * be <code>null</code>. - * @return The dispatch status for the operation. - * - * @see DispatchInterceptor - * @see DispatchInterceptorAsyncCallback - * @see DispatchStatus - **/ - @Override - public DispatchStatus - ice_dispatch(Request request, DispatchInterceptorAsyncCallback cb) - { - IceInternal.Incoming in = (IceInternal.Incoming)request; - if(cb != null) - { - in.push(cb); - } - try - { - in.startOver(); // may raise ResponseSentException - return __dispatch(in, in.getCurrent()); - } - finally - { - if(cb != null) - { - in.pop(); - } - } - } - - /** - * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation - * to a servant (or to another interceptor). - * - * @param request The details of the invocation. - * @return The dispatch status for the operation. - * - * @see DispatchInterceptor - * @see DispatchStatus - **/ - @Override - public DispatchStatus - ice_dispatch(Request request) - { - return ice_dispatch(request, null); - } - - @Override - public DispatchStatus - __dispatch(IceInternal.Incoming in, Current current) - { - int pos = java.util.Arrays.binarySearch(__all, current.operation); - if(pos < 0) - { - throw new Ice.OperationNotExistException(current.id, current.facet, current.operation); - } - - switch(pos) - { - case 0: - { - return ___ice_id(this, in, current); - } - case 1: - { - return ___ice_ids(this, in, current); - } - case 2: - { - return ___ice_isA(this, in, current); - } - case 3: - { - return ___ice_ping(this, in, current); - } - } - - assert(false); - throw new Ice.OperationNotExistException(current.id, current.facet, current.operation); - } - - @Override - public void - __write(OutputStream os) - { - os.startValue(null); - __writeImpl(os); - os.endValue(); - } - - @Override - public void - __read(InputStream is) - { - is.startValue(); - __readImpl(is); - is.endValue(false); - } - - protected void - __writeImpl(OutputStream os) - { - } - - protected void - __readImpl(InputStream is) - { - } - - private static String - operationModeToString(OperationMode mode) - { - if(mode == Ice.OperationMode.Normal) - { - return "::Ice::Normal"; - } - if(mode == Ice.OperationMode.Nonmutating) - { - return "::Ice::Nonmutating"; - } - - if(mode == Ice.OperationMode.Idempotent) - { - return "::Ice::Idempotent"; - } - - return "???"; - } - - protected static void - __checkMode(OperationMode expected, OperationMode received) - { - if(expected != received) - { - if(expected == Ice.OperationMode.Idempotent - && received == Ice.OperationMode.Nonmutating) - { - // - // Fine: typically an old client still using the - // deprecated nonmutating keyword - // - } - else - { - Ice.MarshalException ex = new Ice.MarshalException(); - ex.reason = "unexpected operation mode. expected = " - + operationModeToString(expected) + " received = " - + operationModeToString(received); - throw ex; - } - } - } - - public static final long serialVersionUID = 0L; -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrx.java b/java/src/Ice/src/main/java/Ice/ObjectPrx.java deleted file mode 100644 index ad077d2edb1..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectPrx.java +++ /dev/null @@ -1,1214 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base interface of all object proxies. - **/ -public interface ObjectPrx -{ - /** - * Returns the communicator that created this proxy. - * - * @return The communicator that created this proxy. - **/ - Communicator ice_getCommunicator(); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @return <code>true</code> if the target object has the interface - * specified by <code>__id</code> or derives from the interface - * specified by <code>__id</code>. - **/ - boolean ice_isA(String __id); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @param __context The context map for the invocation. - * @return <code>true</code> if the target object has the interface - * specified by <code>__id</code> or derives from the interface - * specified by <code>__id</code>. - **/ - boolean ice_isA(String __id, java.util.Map<String, String> __context); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, Callback __cb); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context, Callback __cb); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, Callback_Object_ice_isA __cb); - - /** - * Tests whether this object supports a specific Slice interface. - * - * @param __id The type ID of the Slice interface to test against. - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context, Callback_Object_ice_isA __cb); - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_isA(String __id, java.util.Map<String, String> __context, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Completes the asynchronous ice_isA request. - * - * @param __result The asynchronous result. - * @return <code>true</code> if this proxy supports the specified interface; <code>false</code>, otherwise. - **/ - boolean end_ice_isA(AsyncResult __result); - - /** - * Tests whether the target object of this proxy can be reached. - **/ - void ice_ping(); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - **/ - void ice_ping(java.util.Map<String, String> __context); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(java.util.Map<String, String> __context); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(Callback __cb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(java.util.Map<String, String> __context, Callback __cb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(Callback_Object_ice_ping __cb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(java.util.Map<String, String> __context, Callback_Object_ice_ping __cb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(java.util.Map<String, String> __context, - IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ping(java.util.Map<String, String> __context, - IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Completes the asynchronous ice_ping request. - * - * @param __result The asynchronous result. - **/ - void end_ice_ping(AsyncResult __result); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - String[] ice_ids(); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - String[] ice_ids(java.util.Map<String, String> __context); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(java.util.Map<String, String> __context); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(Callback __cb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(java.util.Map<String, String> __context, Callback __cb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(Callback_Object_ice_ids __cb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(java.util.Map<String, String> __context, Callback_Object_ice_ids __cb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_ids(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Completes the asynchronous ice_ids request. - * - * @param __result The asynchronous result. - * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - String[] end_ice_ids(AsyncResult __result); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @return The Slice type ID of the most-derived interface. - **/ - String ice_id(); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @return The Slice type ID of the most-derived interface. - **/ - String ice_id(java.util.Map<String, String> __context); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(java.util.Map<String, String> __context); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(Callback __cb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(java.util.Map<String, String> __context, Callback __cb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(Callback_Object_ice_id __cb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(java.util.Map<String, String> __context, Callback_Object_ice_id __cb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_id(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Completes the asynchronous ice_id request. - * - * @param __result The asynchronous result. - * @return The Slice type ID of the most-derived interface. - **/ - String end_ice_id(AsyncResult __result); - - /** - * Invokes an operation dynamically. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param outParams The encoded out-paramaters and return value - * for the operation. The return value follows any out-parameters. - * @return If the operation completed successfully, the return value - * is <code>true</code>. If the operation raises a user exception, - * the return value is <code>false</code>; in this case, <code>outParams</code> - * contains the encoded user exception. If the operation raises a run-time exception, - * it throws it directly. - * - * @see Blobject - * @see OperationMode - **/ - boolean ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams); - - /** - * Invokes an operation dynamically. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param outParams The encoded out-paramaters and return value - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @return If the operation completed successfully, the return value - * is <code>true</code>. If the operation raises a user exception, - * the return value is <code>false</code>; in this case, <code>outParams</code> - * contains the encoded user exception. If the operation raises a run-time exception, - * it throws it directly. - * - * @see Blobject - * @see OperationMode - **/ - boolean ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, - java.util.Map<String, String> __context); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, Callback __cb); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context, Callback __cb); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - Callback_Object_ice_invoke __cb); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context, Callback_Object_ice_invoke __cb); - - public interface FunctionalCallback_Object_ice_invoke_Response - { - void apply(boolean result, byte[] outArgs); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - FunctionalCallback_Object_ice_invoke_Response __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - FunctionalCallback_Object_ice_invoke_Response __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param __context The context map for the invocation. - * for the operation. The return value follows any out-parameters. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context, - FunctionalCallback_Object_ice_invoke_Response __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param __context The context map for the invocation. - * for the operation. The return value follows any out-parameters. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context, - FunctionalCallback_Object_ice_invoke_Response __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Completes the asynchronous ice_invoke request. - * - * @param outParams The encoded out-paramaters and return value. - * @param __result The asynchronous result. - * @return If the operation completed successfully, the return value - * is <code>true</code>. If the operation raises a user exception, - * the return value is <code>false</code>; in this case, <code>outParams</code> - * contains the encoded user exception. If the operation raises a run-time exception, - * it throws it directly. - **/ - boolean end_ice_invoke(ByteSeqHolder outParams, AsyncResult __result); - - /** - * Returns the identity embedded in this proxy. - * - * @return The identity of the target object. - **/ - Identity ice_getIdentity(); - - /** - * Creates a new proxy that is identical to this proxy, except for the identity. - * - * @param newIdentity The identity for the new proxy. - * @return The proxy with the new identity. - **/ - ObjectPrx ice_identity(Identity newIdentity); - - /** - * Returns the per-proxy context for this proxy. - * - * @return The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value - * is <code>null</code>. - **/ - java.util.Map<String, String> ice_getContext(); - - /** - * Creates a new proxy that is identical to this proxy, except for the per-proxy context. - * - * @param newContext The context for the new proxy. - * @return The proxy with the new per-proxy context. - **/ - ObjectPrx ice_context(java.util.Map<String, String> newContext); - - /** - * Returns the facet for this proxy. - * - * @return The facet for this proxy. If the proxy uses the default facet, the return value is the empty string. - **/ - String ice_getFacet(); - - /** - * Creates a new proxy that is identical to this proxy, except for the facet. - * - * @param newFacet The facet for the new proxy. - * @return The proxy with the new facet. - **/ - ObjectPrx ice_facet(String newFacet); - - /** - * Returns the adapter ID for this proxy. - * - * @return The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string. - **/ - String ice_getAdapterId(); - - /** - * Creates a new proxy that is identical to this proxy, except for the adapter ID. - * - * @param newAdapterId The adapter ID for the new proxy. - * @return The proxy with the new adapter ID. - **/ - ObjectPrx ice_adapterId(String newAdapterId); - - /** - * Returns the endpoints used by this proxy. - * - * @return The endpoints used by this proxy. - * - * @see Endpoint - **/ - Endpoint[] ice_getEndpoints(); - - /** - * Creates a new proxy that is identical to this proxy, except for the endpoints. - * - * @param newEndpoints The endpoints for the new proxy. - * @return The proxy with the new endpoints. - **/ - ObjectPrx ice_endpoints(Endpoint[] newEndpoints); - - /** - * Returns the locator cache timeout of this proxy. - * - * @return The locator cache timeout value (in seconds). - * - * @see Locator - **/ - int ice_getLocatorCacheTimeout(); - - /** - * Returns the invocation timeout of this proxy. - * - * @return The invocation timeout value (in seconds). - **/ - int ice_getInvocationTimeout(); - - /** - * Returns the connection id of this proxy. - * - * @return The connection id. - * - **/ - String ice_getConnectionId(); - - /** - * Creates a new proxy that is identical to this proxy, except for the locator cache timeout. - * - * @param newTimeout The new locator cache timeout (in seconds). - * - * @see Locator - **/ - ObjectPrx ice_locatorCacheTimeout(int newTimeout); - - /** - * Creates a new proxy that is identical to this proxy, except for the invocation timeout. - * - * @param newTimeout The new invocation timeout (in seconds). - * - **/ - ObjectPrx ice_invocationTimeout(int newTimeout); - - /** - * Returns whether this proxy caches connections. - * - * @return <code>true</code> if this proxy caches connections; <code>false</code>, otherwise. - **/ - boolean ice_isConnectionCached(); - - /** - * Creates a new proxy that is identical to this proxy, except for connection caching. - * - * @param newCache <code>true</code> if the new proxy should cache connections; <code>false</code>, otherwise. - * @return The new proxy with the specified caching policy. - **/ - ObjectPrx ice_connectionCached(boolean newCache); - - /** - * Returns how this proxy selects endpoints (randomly or ordered). - * - * @return The endpoint selection policy. - * - * @see EndpointSelectionType - **/ - EndpointSelectionType ice_getEndpointSelection(); - - /** - * Creates a new proxy that is identical to this proxy, except for the endpoint selection policy. - * - * @param newType The new endpoint selection policy. - * @return The new proxy with the specified endpoint selection policy. - * - * @see EndpointSelectionType - **/ - ObjectPrx ice_endpointSelection(EndpointSelectionType newType); - - /** - * Returns whether this proxy uses only secure endpoints. - * - * @return <code>True</code> if this proxy communicates only via secure endpoints; <code>false</code>, otherwise. - **/ - boolean ice_isSecure(); - - /** - * Creates a new proxy that is identical to this proxy, except for how it selects endpoints. - * - * @param b If <code>b</code> is <code>true</code>, only endpoints that use a secure transport are - * used by the new proxy. If <code>b</code> is false, the returned proxy uses both secure and insecure - * endpoints. - * @return The new proxy with the specified selection policy. - **/ - ObjectPrx ice_secure(boolean b); - - /** - * Creates a new proxy that is identical to this proxy, except for the encoding used to marshal - * parameters. - * - * @param e The encoding version to use to marshal requests parameters. - * @return The new proxy with the specified encoding version. - **/ - ObjectPrx ice_encodingVersion(Ice.EncodingVersion e); - - /** - * Returns the encoding version used to marshal requests parameters. - * - * @return The encoding version. - **/ - Ice.EncodingVersion ice_getEncodingVersion(); - - /** - * Returns whether this proxy prefers secure endpoints. - * - * @return <code>true</code> if the proxy always attempts to invoke via secure endpoints before it - * attempts to use insecure endpoints; <code>false</code>, otherwise. - **/ - boolean ice_isPreferSecure(); - - /** - * Creates a new proxy that is identical to this proxy, except for its endpoint selection policy. - * - * @param b If <code>b</code> is <code>true</code>, the new proxy will use secure endpoints for invocations - * and only use insecure endpoints if an invocation cannot be made via secure endpoints. If <code>b</code> is - * <code>false</code>, the proxy prefers insecure endpoints to secure ones. - * @return The new proxy with the new endpoint selection policy. - **/ - ObjectPrx ice_preferSecure(boolean b); - - /** - * Returns the router for this proxy. - * - * @return The router for the proxy. If no router is configured for the proxy, the return value - * is <code>null</code>. - **/ - Ice.RouterPrx ice_getRouter(); - - /** - * Creates a new proxy that is identical to this proxy, except for the router. - * - * @param router The router for the new proxy. - * @return The new proxy with the specified router. - **/ - ObjectPrx ice_router(Ice.RouterPrx router); - - /** - * Returns the locator for this proxy. - * - * @return The locator for this proxy. If no locator is configured, the return value is <code>null</code>. - **/ - Ice.LocatorPrx ice_getLocator(); - - /** - * Creates a new proxy that is identical to this proxy, except for the locator. - * - * @param locator The locator for the new proxy. - * @return The new proxy with the specified locator. - **/ - ObjectPrx ice_locator(Ice.LocatorPrx locator); - - /** - * Returns whether this proxy uses collocation optimization. - * - * @return <code>true</code> if the proxy uses collocation optimization; <code>false</code>, otherwise. - **/ - boolean ice_isCollocationOptimized(); - - /** - * Creates a new proxy that is identical to this proxy, except for collocation optimization. - * - * @param b <code>true</code> if the new proxy enables collocation optimization; <code>false</code>, otherwise. - * @return The new proxy the specified collocation optimization. - **/ - ObjectPrx ice_collocationOptimized(boolean b); - - /** - * Creates a new proxy that is identical to this proxy, but uses twoway invocations. - * - * @return A new proxy that uses twoway invocations. - **/ - ObjectPrx ice_twoway(); - - /** - * Returns whether this proxy uses twoway invocations. - * @return <code>true</code> if this proxy uses twoway invocations; <code>false</code>, otherwise. - **/ - boolean ice_isTwoway(); - - /** - * Creates a new proxy that is identical to this proxy, but uses oneway invocations. - * - * @return A new proxy that uses oneway invocations. - **/ - ObjectPrx ice_oneway(); - - /** - * Returns whether this proxy uses oneway invocations. - * @return <code>true</code> if this proxy uses oneway invocations; <code>false</code>, otherwise. - **/ - boolean ice_isOneway(); - - /** - * Creates a new proxy that is identical to this proxy, but uses batch oneway invocations. - * - * @return A new proxy that uses batch oneway invocations. - **/ - ObjectPrx ice_batchOneway(); - - /** - * Returns whether this proxy uses batch oneway invocations. - * @return <code>true</code> if this proxy uses batch oneway invocations; <code>false</code>, otherwise. - **/ - boolean ice_isBatchOneway(); - - /** - * Creates a new proxy that is identical to this proxy, but uses datagram invocations. - * - * @return A new proxy that uses datagram invocations. - **/ - ObjectPrx ice_datagram(); - - /** - * Returns whether this proxy uses datagram invocations. - * @return <code>true</code> if this proxy uses datagram invocations; <code>false</code>, otherwise. - **/ - boolean ice_isDatagram(); - - /** - * Creates a new proxy that is identical to this proxy, but uses batch datagram invocations. - * - * @return A new proxy that uses batch datagram invocations. - **/ - ObjectPrx ice_batchDatagram(); - - /** - * Returns whether this proxy uses batch datagram invocations. - * @return <code>true</code> if this proxy uses batch datagram invocations; <code>false</code>, otherwise. - **/ - boolean ice_isBatchDatagram(); - - /** - * Creates a new proxy that is identical to this proxy, except for compression. - * - * @param co <code>true</code> enables compression for the new proxy; <code>false</code> disables compression. - * @return A new proxy with the specified compression setting. - **/ - ObjectPrx ice_compress(boolean co); - - /** - * Creates a new proxy that is identical to this proxy, except for its timeout setting. - * - * @param t The timeout for the new proxy in milliseconds. - * @return A new proxy with the specified timeout. - **/ - ObjectPrx ice_timeout(int t); - - /** - * Creates a new proxy that is identical to this proxy, except for its connection ID. - * - * @param connectionId The connection ID for the new proxy. An empty string removes the - * connection ID. - * - * @return A new proxy with the specified connection ID. - **/ - ObjectPrx ice_connectionId(String connectionId); - - /** - * Returns the {@link Connection} for this proxy. If the proxy does not yet have an established connection, - * it first attempts to create a connection. - * - * @return The {@link Connection} for this proxy. - * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a - * collocated object. - * - * @see Connection - **/ - Connection ice_getConnection(); - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_getConnection(); - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_getConnection(Callback __cb); - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @param __cb The callback object to notify the application when the operation is complete. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_getConnection(Callback_Object_ice_getConnection __cb); - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @param __responseCb The callback object to notify the application when there is a response available. - * @param __exceptionCb The callback object to notify the application when an exception occurs while getting - * the connection. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_getConnection(IceInternal.Functional_GenericCallback1<Ice.Connection> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb); - - /** - * Completes the asynchronous get connection. - * - * @param __result The asynchronous result. - **/ - Ice.Connection end_ice_getConnection(AsyncResult __result); - - /** - * Returns the cached {@link Connection} for this proxy. If the proxy does not yet have an established - * connection, it does not attempt to create a connection. - * - * @return The cached {@link Connection} for this proxy (<code>null</code> if the proxy does not have - * an established connection). - * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a - * collocated object. - * - * @see Connection - **/ - Connection ice_getCachedConnection(); - - /** - * Flushes any pending batched requests for this communicator. The call blocks until the flush is complete. - **/ - void ice_flushBatchRequests(); - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_flushBatchRequests(); - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_flushBatchRequests(Callback __cb); - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @param __cb The callback object to notify the application when the flush is complete. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_flushBatchRequests(Callback_Object_ice_flushBatchRequests __cb); - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @param __responseCb The asynchronous completion callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - AsyncResult begin_ice_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb); - - /** - * Completes the asynchronous flush request. - * - * @param __result The asynchronous result. - **/ - void end_ice_flushBatchRequests(AsyncResult __result); - - /** - * Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all respects, - * that is, if their object identity, endpoints timeout settings, and so on are all equal. - * - * @param r The object to compare this proxy with. - * @return <code>true</code> if this proxy is equal to <code>r</code>; <code>false</code>, otherwise. - **/ - @Override - boolean equals(java.lang.Object r); - - void __write(OutputStream os); -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrxHelper.java b/java/src/Ice/src/main/java/Ice/ObjectPrxHelper.java deleted file mode 100644 index 77c758ef68e..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectPrxHelper.java +++ /dev/null @@ -1,157 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base class for all proxy helpers. - **/ -public class ObjectPrxHelper extends ObjectPrxHelperBase -{ - /** - * Casts a proxy to {@link Ice.ObjectPrx}. This call contacts - * the server and will throw an Ice run-time exception if the target - * object does not exist or the server cannot be reached. - * - * @param b The proxy to cast to @{link Ice.ObjectPrx}. - * @return <code>b</code>. - **/ - public static ObjectPrx - checkedCast(Ice.ObjectPrx b) - { - return b; - } - - /** - * Casts a proxy to {@link Ice.ObjectPrx}. This call contacts - * the server and throws an Ice run-time exception if the target - * object does not exist or the server cannot be reached. - * - * @param b The proxy to cast to {@link Ice.ObjectPrx}. - * @param ctx The <code>Context</code> map for the invocation. - * @return <code>b</code>. - **/ - public static ObjectPrx - checkedCast(Ice.ObjectPrx b, java.util.Map<String, String> ctx) - { - return b; - } - - /** - * Creates a new proxy that is identical to the passed proxy, except - * for its facet. This call contacts - * the server and throws an Ice run-time exception if the target - * object does not exist, the specified facet does not exist, or the server cannot be reached. - * - * @param b The proxy to cast to {@link Ice.ObjectPrx}. - * @param f The facet for the new proxy. - * @return The new proxy with the specified facet. - **/ - public static ObjectPrx - checkedCast(Ice.ObjectPrx b, String f) - { - ObjectPrx d = null; - if(b != null) - { - Ice.ObjectPrx bb = b.ice_facet(f); - try - { - boolean ok = bb.ice_isA("::Ice::Object"); - assert(ok); - ObjectPrxHelper h = new ObjectPrxHelper(); - h.__copyFrom(bb); - d = h; - } - catch(Ice.FacetNotExistException ex) - { - } - } - return d; - } - - /** - * Creates a new proxy that is identical to the passed proxy, except - * for its facet. This call contacts - * the server and throws an Ice run-time exception if the target - * object does not exist, the specified facet does not exist, or the server cannot be reached. - * - * @param b The proxy to cast to {@link Ice.ObjectPrx}. - * @param f The facet for the new proxy. - * @param ctx The <code>Context</code> map for the invocation. - * @return The new proxy with the specified facet. - **/ - public static ObjectPrx - checkedCast(Ice.ObjectPrx b, String f, java.util.Map<String, String> ctx) - { - ObjectPrx d = null; - if(b != null) - { - Ice.ObjectPrx bb = b.ice_facet(f); - try - { - boolean ok = bb.ice_isA("::Ice::Object", ctx); - assert(ok); - ObjectPrxHelper h = new ObjectPrxHelper(); - h.__copyFrom(bb); - d = h; - } - catch(Ice.FacetNotExistException ex) - { - } - } - return d; - } - - /** - * Casts a proxy to {@link Ice.ObjectPrx}. This call does - * not contact the server and always succeeds. - * - * @param b The proxy to cast to {@link Ice.ObjectPrx}. - * @return <code>b</code>. - **/ - public static ObjectPrx - uncheckedCast(Ice.ObjectPrx b) - { - return b; - } - - /** - * Creates a new proxy that is identical to the passed proxy, except - * for its facet. This call does not contact the server and always succeeds. - * - * @param b The proxy to cast to {@link Ice.ObjectPrx}. - * @param f The facet for the new proxy. - * @return The new proxy with the specified facet. - **/ - public static ObjectPrx - uncheckedCast(Ice.ObjectPrx b, String f) - { - ObjectPrx d = null; - if(b != null) - { - Ice.ObjectPrx bb = b.ice_facet(f); - ObjectPrxHelper h = new ObjectPrxHelper(); - h.__copyFrom(bb); - d = h; - } - return d; - } - - /** - * Returns the Slice type id of the interface or class associated - * with this proxy class. - * - * @return the type id, "::Ice::Object" - **/ - public static String - ice_staticId() - { - return Ice.ObjectImpl.ice_staticId(); - } -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java b/java/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java deleted file mode 100644 index fa60f0a62f2..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectPrxHelperBase.java +++ /dev/null @@ -1,3000 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -import java.util.LinkedList; -import java.util.List; - -import Ice.Instrumentation.InvocationObserver; -import IceInternal.RetryException; - -/** - * Base class for all proxies. - **/ -public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable -{ - /** - * Returns a hash code for this proxy. - * - * @return The hash code. - **/ - @Override - public final int - hashCode() - { - return _reference.hashCode(); - } - - /** - * Returns the communicator that created this proxy. - * - * @return The communicator that created this proxy. - **/ - @Override - public final Communicator - ice_getCommunicator() - { - return _reference.getCommunicator(); - } - - /** - * Returns the stringified form of this proxy. - * - * @return The stringified proxy. - **/ - @Override - public final String - toString() - { - return _reference.toString(); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @return <code>true</code> if this proxy supports the specified interface; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isA(String __id) - { - return ice_isA(__id, null, false); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @return <code>true</code> if this proxy supports the specified interface; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isA(String __id, java.util.Map<String, String> __context) - { - return ice_isA(__id, __context, true); - } - - private static final String __ice_isA_name = "ice_isA"; - - private boolean - ice_isA(String __id, java.util.Map<String, String> __context, boolean __explicitCtx) - { - __checkTwowayOnly(__ice_isA_name); - return end_ice_isA(begin_ice_isA(__id, __context, __explicitCtx, true, null)); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id) - { - return begin_ice_isA(__id, null, false, false, null); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, java.util.Map<String, String> __context) - { - return begin_ice_isA(__id, __context, true, false, null); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, Callback __cb) - { - return begin_ice_isA(__id, null, false, false, __cb); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, java.util.Map<String, String> __context, Callback __cb) - { - return begin_ice_isA(__id, __context, true, false, __cb); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, Callback_Object_ice_isA __cb) - { - return begin_ice_isA(__id, null, false, false, __cb); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, java.util.Map<String, String> __context, Callback_Object_ice_isA __cb) - { - return begin_ice_isA(__id, __context, true, false, __cb); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_isA(__id, null, false, false, __responseCb, __exceptionCb, null); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_isA(__id, null, false, false, __responseCb, __exceptionCb, __sentCb); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, - java.util.Map<String, String> __context, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_isA(__id, __context, true, false, __responseCb, __exceptionCb, null); - } - - /** - * Tests whether this proxy supports a given interface. - * - * @param __id The Slice type ID of an interface. - * @param __context The <code>Context</code> map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_isA(String __id, - java.util.Map<String, String> __context, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_isA(__id, __context, true, false, __responseCb, __exceptionCb, __sentCb); - } - - private AsyncResult - begin_ice_isA(String __id, - java.util.Map<String, String> __context, - boolean __explicitCtx, - boolean __synchronous, - IceInternal.Functional_BoolCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_isA(__id, __context, __explicitCtx, __synchronous, - new IceInternal.Functional_TwowayCallbackBool(__responseCb, __exceptionCb, __sentCb) - { - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_isA_completed(this, __result); - } - }); - } - - private AsyncResult - begin_ice_isA(String __id, java.util.Map<String, String> __context, boolean __explicitCtx, - boolean __synchronous, IceInternal.CallbackBase __cb) - { - __checkAsyncTwowayOnly(__ice_isA_name); - IceInternal.OutgoingAsync __result = getOutgoingAsync(__ice_isA_name, __cb); - try - { - __result.prepare(__ice_isA_name, OperationMode.Nonmutating, __context, __explicitCtx, __synchronous); - OutputStream __os = __result.startWriteParams(Ice.FormatType.DefaultFormat); - __os.writeString(__id); - __result.endWriteParams(); - __result.invoke(); - } - catch(Exception __ex) - { - __result.abort(__ex); - } - return __result; - } - - /** - * Completes the asynchronous ice_isA request. - * - * @param __r The asynchronous result. - * @return <code>true</code> if this proxy supports the specified interface; <code>false</code>, otherwise. - **/ - @Override - public final boolean - end_ice_isA(AsyncResult __r) - { - IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__r, this, __ice_isA_name); - try - { - if(!__result.__wait()) - { - try - { - __result.throwUserException(); - } - catch(UserException __ex) - { - throw new UnknownUserException(__ex.ice_id(), __ex); - } - } - boolean __ret; - InputStream __is = __result.startReadParams(); - __ret = __is.readBool(); - __result.endReadParams(); - return __ret; - } - finally - { - if(__result != null) - { - __result.cacheMessageBuffers(); - } - } - } - - static public void __ice_isA_completed(TwowayCallbackBool __cb, AsyncResult __result) - { - boolean __ret = false; - try - { - __ret = __result.getProxy().end_ice_isA(__result); - } - catch(LocalException __ex) - { - __cb.exception(__ex); - return; - } - catch(SystemException __ex) - { - __cb.exception(__ex); - return; - } - __cb.response(__ret); - } - - /** - * Tests whether the target object of this proxy can be reached. - **/ - @Override - public final void - ice_ping() - { - ice_ping(null, false); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The <code>Context</code> map for the invocation. - **/ - @Override - public final void - ice_ping(java.util.Map<String, String> __context) - { - ice_ping(__context, true); - } - - private static final String __ice_ping_name = "ice_ping"; - - private void - ice_ping(java.util.Map<String, String> __context, boolean __explicitCtx) - { - end_ice_ping(begin_ice_ping(__context, __explicitCtx, true, null)); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping() - { - return begin_ice_ping(null, false, false, null); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(java.util.Map<String, String> __context) - { - return begin_ice_ping(__context, true, false, null); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(Callback __cb) - { - return begin_ice_ping(null, false, false, __cb); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(java.util.Map<String, String> __context, Callback __cb) - { - return begin_ice_ping(__context, true, false, __cb); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(Callback_Object_ice_ping __cb) - { - return begin_ice_ping(null, false, false, __cb); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(java.util.Map<String, String> __context, Callback_Object_ice_ping __cb) - { - return begin_ice_ping(__context, true, false, __cb); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_ping(null, false, false, - new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, null)); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_ping(null, false, false, new IceInternal.Functional_OnewayCallback(__responseCb, - __exceptionCb, __sentCb)); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(java.util.Map<String, String> __context, - IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_ping(__context, true, false, new IceInternal.Functional_OnewayCallback(__responseCb, - __exceptionCb, null)); - } - - /** - * Tests whether the target object of this proxy can be reached. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ping(java.util.Map<String, String> __context, - IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_ping(__context, true, false, - new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, __sentCb)); - } - - private AsyncResult begin_ice_ping(java.util.Map<String, String> __context, boolean __explicitCtx, - boolean __synchronous, IceInternal.CallbackBase __cb) - { - IceInternal.OutgoingAsync __result = getOutgoingAsync(__ice_ping_name, __cb); - try - { - __result.prepare(__ice_ping_name, OperationMode.Nonmutating, __context, __explicitCtx, __synchronous); - __result.writeEmptyParams(); - __result.invoke(); - } - catch(Exception __ex) - { - __result.abort(__ex); - } - return __result; - } - - /** - * Completes the asynchronous ping request. - * - * @param __result The asynchronous result. - **/ - @Override - public final void - end_ice_ping(AsyncResult __result) - { - __end(__result, __ice_ping_name); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - @Override - public final String[] - ice_ids() - { - return ice_ids(null, false); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The <code>Context</code> map for the invocation. - * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - @Override - public final String[] - ice_ids(java.util.Map<String, String> __context) - { - return ice_ids(__context, true); - } - - private static final String __ice_ids_name = "ice_ids"; - - private String[] - ice_ids(java.util.Map<String, String> __context, boolean __explicitCtx) - { - __checkTwowayOnly(__ice_id_name); - return end_ice_ids(begin_ice_ids(__context, __explicitCtx, true, null)); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids() - { - return begin_ice_ids(null, false, false, null); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(java.util.Map<String, String> __context) - { - return begin_ice_ids(__context, true, false, null); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(Callback __cb) - { - return begin_ice_ids(null, false, false,__cb); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(java.util.Map<String, String> __context, Callback __cb) - { - return begin_ice_ids(__context, true, false,__cb); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(Callback_Object_ice_ids __cb) - { - return begin_ice_ids(null, false, false,__cb); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(java.util.Map<String, String> __context, Callback_Object_ice_ids __cb) - { - return begin_ice_ids(__context, true, false,__cb); - } - - private class FunctionalCallback_Object_ice_ids extends IceInternal.Functional_TwowayCallbackArg1<String[]> - { - FunctionalCallback_Object_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - super(__responseCb, __exceptionCb, __sentCb); - } - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_ids_completed(this, __result); - } - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_ids(null, false, false, new FunctionalCallback_Object_ice_ids(__responseCb, __exceptionCb, - null)); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_ids(null, false, false, new FunctionalCallback_Object_ice_ids(__responseCb, __exceptionCb, - __sentCb)); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_ids(__context, true, false, new FunctionalCallback_Object_ice_ids(__responseCb, __exceptionCb, - null)); - } - - /** - * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_ids(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String[]> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_ids(__context, true, false, - new FunctionalCallback_Object_ice_ids(__responseCb, __exceptionCb, __sentCb)); - } - - private AsyncResult begin_ice_ids(java.util.Map<String, String> __context, boolean __explicitCtx, - boolean __synchronous, IceInternal.CallbackBase __cb) - { - __checkAsyncTwowayOnly(__ice_ids_name); - IceInternal.OutgoingAsync __result = getOutgoingAsync(__ice_ids_name, __cb); - try - { - __result.prepare(__ice_ids_name, OperationMode.Nonmutating, __context, __explicitCtx, __synchronous); - __result.writeEmptyParams(); - __result.invoke(); - } - catch(Exception __ex) - { - __result.abort(__ex); - } - return __result; - } - - /** - * Completes the asynchronous ice_ids request. - * - * @param __r The asynchronous result. - * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived - * order. The first element of the returned array is always <code>::Ice::Object</code>. - **/ - @Override - public final String[] - end_ice_ids(AsyncResult __r) - { - IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__r, this, __ice_ids_name); - try - { - if(!__result.__wait()) - { - try - { - __result.throwUserException(); - } - catch(UserException __ex) - { - throw new UnknownUserException(__ex.ice_id(), __ex); - } - } - String[] __ret = null; - InputStream __is = __result.startReadParams(); - __ret = StringSeqHelper.read(__is); - __result.endReadParams(); - return __ret; - } - finally - { - if(__result != null) - { - __result.cacheMessageBuffers(); - } - } - } - - static public void __ice_ids_completed(TwowayCallbackArg1<String[]> __cb, AsyncResult __result) - { - String[] __ret = null; - try - { - __ret = __result.getProxy().end_ice_ids(__result); - } - catch(LocalException __ex) - { - __cb.exception(__ex); - return; - } - catch(SystemException __ex) - { - __cb.exception(__ex); - return; - } - __cb.response(__ret); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @return The Slice type ID of the most-derived interface. - **/ - @Override - public final String - ice_id() - { - return ice_id(null, false); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The <code>Context</code> map for the invocation. - * @return The Slice type ID of the most-derived interface. - **/ - @Override - public final String - ice_id(java.util.Map<String, String> __context) - { - return ice_id(__context, true); - } - - private static final String __ice_id_name = "ice_id"; - - private String - ice_id(java.util.Map<String, String> __context, boolean __explicitCtx) - { - __checkTwowayOnly(__ice_id_name); - return end_ice_id(begin_ice_id(__context, __explicitCtx, true, null)); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id() - { - return begin_ice_id(null, false, false, null); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(java.util.Map<String, String> __context) - { - return begin_ice_id(__context, true, false, null); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(Callback __cb) - { - return begin_ice_id(null, false, false, __cb); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(java.util.Map<String, String> __context, Callback __cb) - { - return begin_ice_id(__context, true, false, __cb); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(Callback_Object_ice_id __cb) - { - return begin_ice_id(null, false, false, __cb); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(java.util.Map<String, String> __context, Callback_Object_ice_id __cb) - { - return begin_ice_id(__context, true, false, __cb); - } - - private class FunctionalCallback_Object_ice_id extends IceInternal.Functional_TwowayCallbackArg1<String> - { - FunctionalCallback_Object_ice_id(IceInternal.Functional_GenericCallback1<String> responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb, - IceInternal.Functional_BoolCallback sentCb) - { - super(responseCb, exceptionCb, sentCb); - } - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_id_completed(this, __result); - } - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_id(null, false, false, new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, null)); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_id(null, false, false, new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, __sentCb)); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_id(__context, true, false, new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, null)); - } - - /** - * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. - * - * @param __context The context map for the invocation. - * @param __responseCb The asynchronous response callback object. - * @param __exceptionCb The asynchronous exception callback object. - * @param __sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - **/ - @Override - public final AsyncResult - begin_ice_id(java.util.Map<String, String> __context, - IceInternal.Functional_GenericCallback1<String> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_id(__context, true, false, - new FunctionalCallback_Object_ice_id(__responseCb, __exceptionCb, __sentCb)); - } - - private AsyncResult begin_ice_id(java.util.Map<String, String> __context, boolean __explicitCtx, - boolean __synchronous, IceInternal.CallbackBase __cb) - { - __checkAsyncTwowayOnly(__ice_id_name); - IceInternal.OutgoingAsync __result = getOutgoingAsync(__ice_id_name, __cb); - try - { - __result.prepare(__ice_id_name, OperationMode.Nonmutating, __context, __explicitCtx, __synchronous); - __result.writeEmptyParams(); - __result.invoke(); - } - catch(Exception __ex) - { - __result.abort(__ex); - } - return __result; - } - - /** - * Completes the asynchronous ice_id request. - * - * @param __r The asynchronous result. - * @return The Slice type ID of the most-derived interface. - **/ - @Override - public final String - end_ice_id(AsyncResult __r) - { - IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__r, this, __ice_id_name); - try - { - if(!__result.__wait()) - { - try - { - __result.throwUserException(); - } - catch(UserException __ex) - { - throw new UnknownUserException(__ex.ice_id(), __ex); - } - } - String __ret = null; - InputStream __is = __result.startReadParams(); - __ret = __is.readString(); - __result.endReadParams(); - return __ret; - } - finally - { - if(__result != null) - { - __result.cacheMessageBuffers(); - } - } - } - - static public void __ice_id_completed(TwowayCallbackArg1<String> __cb, AsyncResult __result) - { - String __ret = null; - try - { - __ret = __result.getProxy().end_ice_id(__result); - } - catch(LocalException __ex) - { - __cb.exception(__ex); - return; - } - catch(SystemException __ex) - { - __cb.exception(__ex); - return; - } - __cb.response(__ret); - } - - /** - * Invoke an operation dynamically. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param outParams The encoded out-paramaters and return value - * for the operation. The return value follows any out-parameters. - * @return If the operation completed successfully, the return value - * is <code>true</code>. If the operation raises a user exception, - * the return value is <code>false</code>; in this case, <code>outParams</code> - * contains the encoded user exception. If the operation raised an - * it throws it directly. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final boolean - ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams) - { - return ice_invoke(operation, mode, inParams, outParams, null, false); - } - - /** - * Invoke an operation dynamically. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param outParams The encoded out-paramaters and return value - * for the operation. The return value follows any out-parameters. - * @param context The context map for the invocation. - * @return If the operation was invoked synchronously (because there - * was no need to queue the request), the return value is <code>true</code>; - * otherwise, if the invocation was queued, the return value is <code>false</code>. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final boolean - ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, - java.util.Map<String, String> context) - { - return ice_invoke(operation, mode, inParams, outParams, context, true); - } - - private boolean - ice_invoke(String operation, OperationMode mode, byte[] inParams, ByteSeqHolder outParams, - java.util.Map<String, String> context, boolean explicitCtx) - { - return end_ice_invoke(outParams, begin_ice_invoke(operation, mode, inParams, context, explicitCtx, true, null)); - } - - private static final String __ice_invoke_name = "ice_invoke"; - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams) - { - return begin_ice_invoke(operation, mode, inParams, null, false, false, null); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context) - { - return begin_ice_invoke(operation, mode, inParams, __context, true, false, null); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, Callback __cb) - { - return begin_ice_invoke(operation, mode, inParams, null, false, false, __cb); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, java.util.Map<String, String> __context, - Callback __cb) - { - return begin_ice_invoke(operation, mode, inParams, __context, true, false, __cb); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, Callback_Object_ice_invoke __cb) - { - return begin_ice_invoke(operation, mode, inParams, null, false, false, __cb); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param __context The context map for the invocation. - * @param __cb The asynchronous callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, java.util.Map<String, String> __context, - Callback_Object_ice_invoke __cb) - { - return begin_ice_invoke(operation, mode, inParams, __context, true, false, __cb); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param responseCb The asynchronous response callback object. - * @param exceptionCb The asynchronous exception callback object. - * @param sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - FunctionalCallback_Object_ice_invoke_Response responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb, - IceInternal.Functional_BoolCallback sentCb) - { - return begin_ice_invoke(operation, mode, inParams, null, false, false, responseCb, exceptionCb, sentCb); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * for the operation. The return value follows any out-parameters. - * @param responseCb The asynchronous response callback object. - * @param exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - FunctionalCallback_Object_ice_invoke_Response responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb) - { - return begin_ice_invoke(operation, mode, inParams, null, false, false, responseCb, exceptionCb, null); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param context The context map for the invocation. - * for the operation. The return value follows any out-parameters. - * @param responseCb The asynchronous response callback object. - * @param exceptionCb The asynchronous exception callback object. - * @param sentCb The asynchronous sent callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> context, - FunctionalCallback_Object_ice_invoke_Response responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb, - IceInternal.Functional_BoolCallback sentCb) - { - return begin_ice_invoke(operation, mode, inParams, context, true, false, responseCb, exceptionCb, sentCb); - } - - /** - * Invokes an operation dynamically and asynchronously. - * - * @param operation The name of the operation to invoke. - * @param mode The operation mode (normal or idempotent). - * @param inParams The encoded in-parameters for the operation. - * @param context The context map for the invocation. - * for the operation. The return value follows any out-parameters. - * @param responseCb The asynchronous response callback object. - * @param exceptionCb The asynchronous exception callback object. - * @return The asynchronous result object. - * - * @see Blobject - * @see OperationMode - **/ - @Override - public final AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> context, - FunctionalCallback_Object_ice_invoke_Response responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb) - { - return begin_ice_invoke(operation, mode, inParams, context, true, false, responseCb, exceptionCb, null); - } - - private AsyncResult begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, - java.util.Map<String, String> __context, - boolean __explicitCtx, - boolean __synchronous, - FunctionalCallback_Object_ice_invoke_Response __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - class CB extends IceInternal.Functional_TwowayCallback implements _Callback_Object_ice_invoke - { - CB(FunctionalCallback_Object_ice_invoke_Response responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> exceptionCb, - IceInternal.Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - @Override - public void response(boolean __ret, byte[] outParams) - { - __responseCb.apply(__ret, outParams); - } - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_invoke_completed(this, __result); - } - - FunctionalCallback_Object_ice_invoke_Response __responseCb; - } - return begin_ice_invoke(operation, mode, inParams, __context, __explicitCtx, __synchronous, - new CB(__responseCb, __exceptionCb, __sentCb)); - } - - private AsyncResult - begin_ice_invoke(String operation, OperationMode mode, byte[] inParams, java.util.Map<String, String> __context, - boolean __explicitCtx, boolean __synchronous, IceInternal.CallbackBase __cb) - { - IceInternal.OutgoingAsync __result = getOutgoingAsync(__ice_invoke_name, __cb); - try - { - __result.prepare(operation, mode, __context, __explicitCtx, __synchronous); - __result.writeParamEncaps(inParams); - __result.invoke(); - } - catch(Exception __ex) - { - __result.abort(__ex); - } - return __result; - } - - /** - * Completes the asynchronous ice_invoke request. - * - * @param outParams The encoded out-paramaters and return value. - * @param __r The asynchronous result. - * @return If the operation completed successfully, the return value - * is <code>true</code>. If the operation raises a user exception, - * the return value is <code>false</code>; in this case, <code>outParams</code> - * contains the encoded user exception. If the operation raises a run-time exception, - * it throws it directly. - **/ - @Override - public final boolean - end_ice_invoke(ByteSeqHolder outParams, AsyncResult __r) - { - IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__r, this, __ice_invoke_name); - try - { - boolean ok = __result.__wait(); - if(_reference.getMode() == IceInternal.Reference.ModeTwoway) - { - if(outParams != null) - { - outParams.value = __result.readParamEncaps(); - } - } - return ok; - } - finally - { - if(__result != null) - { - __result.cacheMessageBuffers(); - } - } - } - - public static void __ice_invoke_completed(_Callback_Object_ice_invoke __cb, AsyncResult __result) - { - ByteSeqHolder outParams = new ByteSeqHolder(); - boolean __ret = false; - try - { - __ret = __result.getProxy().end_ice_invoke(outParams, __result); - } - catch(LocalException __ex) - { - __cb.exception(__ex); - return; - } - catch(SystemException __ex) - { - __cb.exception(__ex); - return; - } - __cb.response(__ret, outParams.value); - } - - /** - * Returns the identity embedded in this proxy. - * - * @return The identity of the target object. - **/ - @Override - public final Identity - ice_getIdentity() - { - return _reference.getIdentity().clone(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the identity. - * - * @param newIdentity The identity for the new proxy. - * @return The proxy with the new identity. - **/ - @Override - public final ObjectPrx - ice_identity(Identity newIdentity) - { - if(newIdentity.name.equals("")) - { - throw new IllegalIdentityException(); - } - if(newIdentity.equals(_reference.getIdentity())) - { - return this; - } - else - { - ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); - proxy.__setup(_reference.changeIdentity(newIdentity)); - return proxy; - } - } - - /** - * Returns the per-proxy context for this proxy. - * - * @return The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value - * is <code>null</code>. - **/ - @Override - public final java.util.Map<String, String> - ice_getContext() - { - return new java.util.HashMap<String, String>(_reference.getContext()); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the per-proxy context. - * - * @param newContext The context for the new proxy. - * @return The proxy with the new per-proxy context. - **/ - @Override - public final ObjectPrx - ice_context(java.util.Map<String, String> newContext) - { - return newInstance(_reference.changeContext(newContext)); - } - - /** - * Returns the facet for this proxy. - * - * @return The facet for this proxy. If the proxy uses the default facet, the return value is the empty string. - **/ - @Override - public final String - ice_getFacet() - { - return _reference.getFacet(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the facet. - * - * @param newFacet The facet for the new proxy. - * @return The proxy with the new facet. - **/ - @Override - public final ObjectPrx - ice_facet(String newFacet) - { - if(newFacet == null) - { - newFacet = ""; - } - - if(newFacet.equals(_reference.getFacet())) - { - return this; - } - else - { - ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); - proxy.__setup(_reference.changeFacet(newFacet)); - return proxy; - } - } - - /** - * Returns the adapter ID for this proxy. - * - * @return The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string. - **/ - @Override - public final String - ice_getAdapterId() - { - return _reference.getAdapterId(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the adapter ID. - * - * @param newAdapterId The adapter ID for the new proxy. - * @return The proxy with the new adapter ID. - **/ - @Override - public final ObjectPrx - ice_adapterId(String newAdapterId) - { - if(newAdapterId == null) - { - newAdapterId = ""; - } - - if(newAdapterId.equals(_reference.getAdapterId())) - { - return this; - } - else - { - return newInstance(_reference.changeAdapterId(newAdapterId)); - } - } - - /** - * Returns the endpoints used by this proxy. - * - * @return The endpoints used by this proxy. - * - * @see Endpoint - **/ - @Override - public final Endpoint[] - ice_getEndpoints() - { - return _reference.getEndpoints().clone(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the endpoints. - * - * @param newEndpoints The endpoints for the new proxy. - * @return The proxy with the new endpoints. - **/ - @Override - public final ObjectPrx - ice_endpoints(Endpoint[] newEndpoints) - { - if(java.util.Arrays.equals(newEndpoints, _reference.getEndpoints())) - { - return this; - } - else - { - IceInternal.EndpointI[] edpts = new IceInternal.EndpointI[newEndpoints.length]; - edpts = java.util.Arrays.asList(newEndpoints).toArray(edpts); - return newInstance(_reference.changeEndpoints(edpts)); - } - } - - /** - * Returns the locator cache timeout of this proxy. - * - * @return The locator cache timeout value (in seconds). - * - * @see Locator - **/ - @Override - public final int - ice_getLocatorCacheTimeout() - { - return _reference.getLocatorCacheTimeout(); - } - - /** - * Returns the invocation timeout of this proxy. - * - * @return The invocation timeout value (in seconds). - **/ - @Override - public final int - ice_getInvocationTimeout() - { - return _reference.getInvocationTimeout(); - } - - /** - * Returns the connection id of this proxy. - * - * @return The connection id. - * - **/ - @Override - public final String - ice_getConnectionId() - { - return _reference.getConnectionId(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the locator cache timeout. - * - * @param newTimeout The new locator cache timeout (in seconds). - * - * @see Locator - **/ - @Override - public final ObjectPrx - ice_locatorCacheTimeout(int newTimeout) - { - if(newTimeout < -1) - { - throw new IllegalArgumentException("invalid value passed to ice_locatorCacheTimeout: " + newTimeout); - } - if(newTimeout == _reference.getLocatorCacheTimeout()) - { - return this; - } - else - { - return newInstance(_reference.changeLocatorCacheTimeout(newTimeout)); - } - } - - /** - * Creates a new proxy that is identical to this proxy, except for the invocation timeout. - * - * @param newTimeout The new invocation timeout (in seconds). - **/ - @Override - public final ObjectPrx - ice_invocationTimeout(int newTimeout) - { - if(newTimeout < 1 && newTimeout != -1 && newTimeout != -2) - { - throw new IllegalArgumentException("invalid value passed to ice_invocationTimeout: " + newTimeout); - } - if(newTimeout == _reference.getInvocationTimeout()) - { - return this; - } - else - { - return newInstance(_reference.changeInvocationTimeout(newTimeout)); - } - } - - /** - * Returns whether this proxy caches connections. - * - * @return <code>true</code> if this proxy caches connections; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isConnectionCached() - { - return _reference.getCacheConnection(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for connection caching. - * - * @param newCache <code>true</code> if the new proxy should cache connections; <code>false</code>, otherwise. - * @return The new proxy with the specified caching policy. - **/ - @Override - public final ObjectPrx - ice_connectionCached(boolean newCache) - { - if(newCache == _reference.getCacheConnection()) - { - return this; - } - else - { - return newInstance(_reference.changeCacheConnection(newCache)); - } - } - - /** - * Returns how this proxy selects endpoints (randomly or ordered). - * - * @return The endpoint selection policy. - * - * @see EndpointSelectionType - **/ - @Override - public final Ice.EndpointSelectionType - ice_getEndpointSelection() - { - return _reference.getEndpointSelection(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for the endpoint selection policy. - * - * @param newType The new endpoint selection policy. - * @return The new proxy with the specified endpoint selection policy. - * - * @see EndpointSelectionType - **/ - @Override - public final ObjectPrx - ice_endpointSelection(Ice.EndpointSelectionType newType) - { - if(newType == _reference.getEndpointSelection()) - { - return this; - } - else - { - return newInstance(_reference.changeEndpointSelection(newType)); - } - } - - /** - * Returns whether this proxy uses only secure endpoints. - * - * @return <code>true</code> if all endpoints for this proxy are secure; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isSecure() - { - return _reference.getSecure(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for its endpoints. - * - * @param b If <code>b</code> is <code>true</code>, only endpoints that use a secure transport are - * retained for the new proxy. If <code>b</code> is false, the returned proxy is identical to this proxy. - * @return The new proxy with possible different endpoints.k - **/ - @Override - public final ObjectPrx - ice_secure(boolean b) - { - if(b == _reference.getSecure()) - { - return this; - } - else - { - return newInstance(_reference.changeSecure(b)); - } - } - - /** - * Creates a new proxy that is identical to this proxy, except for the encoding used to marshal - * parameters. - * - * @param e The encoding version to use to marshal requests parameters. - * @return The new proxy with the specified encoding version. - **/ - @Override - public final ObjectPrx - ice_encodingVersion(Ice.EncodingVersion e) - { - if(e.equals(_reference.getEncoding())) - { - return this; - } - else - { - return newInstance(_reference.changeEncoding(e)); - } - } - - /** - * Returns the encoding version used to marshal requests parameters. - * - * @return The encoding version. - **/ - @Override - public final Ice.EncodingVersion - ice_getEncodingVersion() - { - return _reference.getEncoding().clone(); - } - - /** - * Returns whether this proxy prefers secure endpoints. - * - * @return <code>true</code> if the proxy always attempts to invoke via secure endpoints before it - * attempts to use insecure endpoints; <code>false</code>, otherwise; - **/ - @Override - public final boolean - ice_isPreferSecure() - { - return _reference.getPreferSecure(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for its endpoint selection policy. - * - * @param b If <code>b</code> is <code>true</code>, the new proxy will use secure endpoints for invocations - * and only use insecure endpoints if an invocation cannot be made via secure endpoints. If <code>b</code> is - * <code>false</code>, the proxy prefers insecure endpoints to secure ones. - * @return The new proxy with the new endpoint selection policy. - **/ - @Override - public final ObjectPrx - ice_preferSecure(boolean b) - { - if(b == _reference.getPreferSecure()) - { - return this; - } - else - { - return newInstance(_reference.changePreferSecure(b)); - } - } - - /** - * Returns the router for this proxy. - * - * @return The router for the proxy. If no router is configured for the proxy, the return value - * is <code>null</code>. - **/ - @Override - public final Ice.RouterPrx - ice_getRouter() - { - IceInternal.RouterInfo ri = _reference.getRouterInfo(); - return ri != null ? ri.getRouter() : null; - } - - /** - * Creates a new proxy that is identical to this proxy, except for the router. - * - * @param router The router for the new proxy. - * @return The new proxy with the specified router. - **/ - @Override - public final ObjectPrx - ice_router(Ice.RouterPrx router) - { - IceInternal.Reference ref = _reference.changeRouter(router); - if(ref.equals(_reference)) - { - return this; - } - else - { - return newInstance(ref); - } - } - - /** - * Returns the locator for this proxy. - * - * @return The locator for this proxy. If no locator is configured, the return value is <code>null</code>. - **/ - @Override - public final Ice.LocatorPrx - ice_getLocator() - { - IceInternal.LocatorInfo ri = _reference.getLocatorInfo(); - return ri != null ? ri.getLocator() : null; - } - - /** - * Creates a new proxy that is identical to this proxy, except for the locator. - * - * @param locator The locator for the new proxy. - * @return The new proxy with the specified locator. - **/ - @Override - public final ObjectPrx - ice_locator(Ice.LocatorPrx locator) - { - IceInternal.Reference ref = _reference.changeLocator(locator); - if(ref.equals(_reference)) - { - return this; - } - else - { - return newInstance(ref); - } - } - - /** - * Returns whether this proxy uses collocation optimization. - * - * @return <code>true</code> if the proxy uses collocation optimization; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isCollocationOptimized() - { - return _reference.getCollocationOptimized(); - } - - /** - * Creates a new proxy that is identical to this proxy, except for collocation optimization. - * - * @param b <code>true</code> if the new proxy enables collocation optimization; <code>false</code>, otherwise. - * @return The new proxy the specified collocation optimization. - **/ - @Override - public final ObjectPrx - ice_collocationOptimized(boolean b) - { - if(b == _reference.getCollocationOptimized()) - { - return this; - } - else - { - return newInstance(_reference.changeCollocationOptimized(b)); - } - } - - /** - * Creates a new proxy that is identical to this proxy, but uses twoway invocations. - * - * @return A new proxy that uses twoway invocations. - **/ - @Override - public final ObjectPrx - ice_twoway() - { - if(_reference.getMode() == IceInternal.Reference.ModeTwoway) - { - return this; - } - else - { - return newInstance(_reference.changeMode(IceInternal.Reference.ModeTwoway)); - } - } - - /** - * Returns whether this proxy uses twoway invocations. - * @return <code>true</code> if this proxy uses twoway invocations; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isTwoway() - { - return _reference.getMode() == IceInternal.Reference.ModeTwoway; - } - - /** - * Creates a new proxy that is identical to this proxy, but uses oneway invocations. - * - * @return A new proxy that uses oneway invocations. - **/ - @Override - public final ObjectPrx - ice_oneway() - { - if(_reference.getMode() == IceInternal.Reference.ModeOneway) - { - return this; - } - else - { - return newInstance(_reference.changeMode(IceInternal.Reference.ModeOneway)); - } - } - - /** - * Returns whether this proxy uses oneway invocations. - * @return <code>true</code> if this proxy uses oneway invocations; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isOneway() - { - return _reference.getMode() == IceInternal.Reference.ModeOneway; - } - - /** - * Creates a new proxy that is identical to this proxy, but uses batch oneway invocations. - * - * @return A new proxy that uses batch oneway invocations. - **/ - @Override - public final ObjectPrx - ice_batchOneway() - { - if(_reference.getMode() == IceInternal.Reference.ModeBatchOneway) - { - return this; - } - else - { - return newInstance(_reference.changeMode(IceInternal.Reference.ModeBatchOneway)); - } - } - - /** - * Returns whether this proxy uses batch oneway invocations. - * @return <code>true</code> if this proxy uses batch oneway invocations; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isBatchOneway() - { - return _reference.getMode() == IceInternal.Reference.ModeBatchOneway; - } - - /** - * Creates a new proxy that is identical to this proxy, but uses datagram invocations. - * - * @return A new proxy that uses datagram invocations. - **/ - @Override - public final ObjectPrx - ice_datagram() - { - if(_reference.getMode() == IceInternal.Reference.ModeDatagram) - { - return this; - } - else - { - return newInstance(_reference.changeMode(IceInternal.Reference.ModeDatagram)); - } - } - - /** - * Returns whether this proxy uses datagram invocations. - * @return <code>true</code> if this proxy uses datagram invocations; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isDatagram() - { - return _reference.getMode() == IceInternal.Reference.ModeDatagram; - } - - /** - * Creates a new proxy that is identical to this proxy, but uses batch datagram invocations. - * - * @return A new proxy that uses batch datagram invocations. - **/ - @Override - public final ObjectPrx - ice_batchDatagram() - { - if(_reference.getMode() == IceInternal.Reference.ModeBatchDatagram) - { - return this; - } - else - { - return newInstance(_reference.changeMode(IceInternal.Reference.ModeBatchDatagram)); - } - } - - /** - * Returns whether this proxy uses batch datagram invocations. - * @return <code>true</code> if this proxy uses batch datagram invocations; <code>false</code>, otherwise. - **/ - @Override - public final boolean - ice_isBatchDatagram() - { - return _reference.getMode() == IceInternal.Reference.ModeBatchDatagram; - } - - /** - * Creates a new proxy that is identical to this proxy, except for compression. - * - * @param co <code>true</code> enables compression for the new proxy; <code>false</code>disables compression. - * @return A new proxy with the specified compression setting. - **/ - @Override - public final ObjectPrx - ice_compress(boolean co) - { - IceInternal.Reference ref = _reference.changeCompress(co); - if(ref.equals(_reference)) - { - return this; - } - else - { - return newInstance(ref); - } - } - - /** - * Creates a new proxy that is identical to this proxy, except for its timeout setting. - * - * @param t The timeout for the new proxy in milliseconds. - * @return A new proxy with the specified timeout. - **/ - @Override - public final ObjectPrx - ice_timeout(int t) - { - if(t < 1 && t != -1) - { - throw new IllegalArgumentException("invalid value passed to ice_timeout: " + t); - } - IceInternal.Reference ref = _reference.changeTimeout(t); - if(ref.equals(_reference)) - { - return this; - } - else - { - return newInstance(ref); - } - } - - /** - * Creates a new proxy that is identical to this proxy, except for its connection ID. - * - * @param id The connection ID for the new proxy. An empty string removes the - * connection ID. - * - * @return A new proxy with the specified connection ID. - **/ - @Override - public final ObjectPrx - ice_connectionId(String id) - { - IceInternal.Reference ref = _reference.changeConnectionId(id); - if(ref.equals(_reference)) - { - return this; - } - else - { - return newInstance(ref); - } - } - - /** - * Returns the {@link Connection} for this proxy. If the proxy does not yet have an established connection, - * it first attempts to create a connection. - * - * @return The {@link Connection} for this proxy. - * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a - * collocated object. - * - * @see Connection - **/ - @Override - public final Connection - ice_getConnection() - { - return end_ice_getConnection(begin_ice_getConnection()); - } - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_getConnection() - { - return begin_ice_getConnectionInternal(null); - } - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @param __cb The callback object to notify the application when the flush is complete. - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_getConnection(Callback __cb) - { - return begin_ice_getConnectionInternal(__cb); - } - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @param __cb The callback object to notify the application when the flush is complete. - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_getConnection(Callback_Object_ice_getConnection __cb) - { - return begin_ice_getConnectionInternal(__cb); - } - - private class FunctionalCallback_Object_ice_getConnection - extends IceInternal.Functional_TwowayCallbackArg1<Ice.Connection> - { - FunctionalCallback_Object_ice_getConnection( - IceInternal.Functional_GenericCallback1<Ice.Connection> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - super(__responseCb, __exceptionCb, null); - } - - @Override - public final void __completed(AsyncResult __result) - { - ObjectPrxHelperBase.__ice_getConnection_completed(this, __result); - } - } - - /** - * Asynchronously gets the connection for this proxy. The call does not block. - * - * @param __responseCb The callback object to notify the application when the there is a response available. - * @param __exceptionCb The callback object to notify the application when the there is an exception getting - * connection. - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_getConnection(IceInternal.Functional_GenericCallback1<Ice.Connection> __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb) - { - return begin_ice_getConnectionInternal( - new FunctionalCallback_Object_ice_getConnection(__responseCb, __exceptionCb)); - } - - private static final String __ice_getConnection_name = "ice_getConnection"; - - private AsyncResult - begin_ice_getConnectionInternal(IceInternal.CallbackBase cb) - { - IceInternal.ProxyGetConnection result = new IceInternal.ProxyGetConnection(this, __ice_getConnection_name, cb); - try - { - result.invoke(); - } - catch(Exception ex) - { - result.abort(ex); - } - return result; - } - - @Override - public Ice.Connection - end_ice_getConnection(AsyncResult r) - { - IceInternal.ProxyGetConnection result = IceInternal.ProxyGetConnection.check(r, this, __ice_getConnection_name); - result.__wait(); - return result.getConnection(); - } - - static public void __ice_getConnection_completed(TwowayCallbackArg1<Ice.Connection> cb, AsyncResult result) - { - Ice.Connection ret = null; - try - { - ret = result.getProxy().end_ice_getConnection(result); - } - catch(LocalException ex) - { - cb.exception(ex); - return; - } - catch(SystemException ex) - { - cb.exception(ex); - return; - } - cb.response(ret); - } - - /** - * Returns the cached {@link Connection} for this proxy. If the proxy does not yet have an established - * connection, it does not attempt to create a connection. - * - * @return The cached {@link Connection} for this proxy (<code>null</code> if the proxy does not have - * an established connection). - * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a - * collocated object. - * - * @see Connection - **/ - @Override - public final Connection - ice_getCachedConnection() - { - IceInternal.RequestHandler handler = null; - synchronized(this) - { - handler = _requestHandler; - } - - if(handler != null) - { - try - { - return handler.getConnection(); - } - catch(LocalException ex) - { - } - } - return null; - } - - /** - * Flushes any pending batched requests for this communicator. The call blocks until the flush is complete. - **/ - @Override - public void - ice_flushBatchRequests() - { - end_ice_flushBatchRequests(begin_ice_flushBatchRequests()); - } - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_flushBatchRequests() - { - return begin_ice_flushBatchRequestsInternal(null); - } - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @param __cb The callback object to notify the application when the flush is complete. - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_flushBatchRequests(Callback __cb) - { - return begin_ice_flushBatchRequestsInternal(__cb); - } - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @param __cb The callback object to notify the application when the flush is complete. - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_flushBatchRequests(Callback_Object_ice_flushBatchRequests __cb) - { - return begin_ice_flushBatchRequestsInternal(__cb); - } - - /** - * Asynchronously flushes any pending batched requests for this communicator. The call does not block. - * - * @param __exceptionCb The callback object to notify the application when the there is an exception flushing - * the requests. - * @param __sentCb The callback object to notify the application when the flush is complete. - * @return The asynchronous result object. - **/ - @Override - public AsyncResult - begin_ice_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_ice_flushBatchRequestsInternal( - new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, __sentCb)); - } - - private static final String __ice_flushBatchRequests_name = "ice_flushBatchRequests"; - - private AsyncResult - begin_ice_flushBatchRequestsInternal(IceInternal.CallbackBase cb) - { - IceInternal.ProxyFlushBatch result = new IceInternal.ProxyFlushBatch(this, __ice_flushBatchRequests_name, cb); - try - { - result.invoke(); - } - catch(Exception ex) - { - result.abort(ex); - } - return result; - } - - @Override - public void - end_ice_flushBatchRequests(AsyncResult r) - { - IceInternal.ProxyFlushBatch result = IceInternal.ProxyFlushBatch.check(r, this, __ice_flushBatchRequests_name); - result.__wait(); - } - - /** - * Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all respects, - * that is, if their object identity, endpoints timeout settings, and so on are all equal. - * - * @param r The object to compare this proxy with. - * @return <code>true</code> if this proxy is equal to <code>r</code>; <code>false</code>, otherwise. - **/ - @Override - public final boolean - equals(java.lang.Object r) - { - if(this == r) - { - return true; - } - - if(r instanceof ObjectPrxHelperBase) - { - return _reference.equals(((ObjectPrxHelperBase)r)._reference); - } - - return false; - } - - public void __write(OutputStream os) - { - _reference.getIdentity().__write(os); - _reference.streamWrite(os); - } - - public final IceInternal.Reference - __reference() - { - return _reference; - } - - public final void - __copyFrom(ObjectPrx from) - { - synchronized(from) - { - ObjectPrxHelperBase h = (ObjectPrxHelperBase)from; - _reference = h._reference; - _requestHandler = h._requestHandler; - } - } - - public final int - __handleException(Exception ex, IceInternal.RequestHandler handler, OperationMode mode, boolean sent, - Holder<Integer> interval, int cnt) - { - __updateRequestHandler(handler, null); // Clear the request handler - - // - // We only retry local exception, system exceptions aren't retried. - // - // A CloseConnectionException indicates graceful server shutdown, and is therefore - // always repeatable without violating "at-most-once". That's because by sending a - // close connection message, the server guarantees that all outstanding requests - // can safely be repeated. - // - // An ObjectNotExistException can always be retried as well without violating - // "at-most-once" (see the implementation of the checkRetryAfterException method - // of the ProxyFactory class for the reasons why it can be useful). - // - // If the request didn't get sent or if it's non-mutating or idempotent it can - // also always be retried if the retry count isn't reached. - // - if(ex instanceof LocalException && (!sent || - mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent || - ex instanceof CloseConnectionException || - ex instanceof ObjectNotExistException)) - { - try - { - return _reference.getInstance().proxyFactory().checkRetryAfterException((LocalException)ex, - _reference, - interval, - cnt); - } - catch(CommunicatorDestroyedException exc) - { - // - // The communicator is already destroyed, so we cannot retry. - // - throw ex; - } - } - else - { - throw ex; // Retry could break at-most-once semantics, don't retry. - } - } - - public final void - __checkTwowayOnly(String name) - { - // - // No mutex lock necessary, there is nothing mutable in this - // operation. - // - - if(!ice_isTwoway()) - { - TwowayOnlyException ex = new TwowayOnlyException(); - ex.operation = name; - throw ex; - } - } - - public final void - __checkAsyncTwowayOnly(String name) - { - // - // No mutex lock necessary, there is nothing mutable in this - // operation. - // - - if(!ice_isTwoway()) - { - throw new java.lang.IllegalArgumentException("`" + name + "' can only be called with a twoway proxy"); - } - } - - public final void - __end(AsyncResult r, String operation) - { - IceInternal.ProxyOutgoingAsyncBase result = IceInternal.ProxyOutgoingAsyncBase.check(r, this, operation); - try - { - boolean ok = result.__wait(); - if(_reference.getMode() == IceInternal.Reference.ModeTwoway) - { - IceInternal.OutgoingAsync outAsync = (IceInternal.OutgoingAsync)result; - if(!ok) - { - try - { - outAsync.throwUserException(); - } - catch(UserException ex) - { - throw new UnknownUserException(ex.ice_id(), ex); - } - } - outAsync.readEmptyParams(); - } - } - finally - { - if(result != null) - { - result.cacheMessageBuffers(); - } - } - } - - public final IceInternal.RequestHandler - __getRequestHandler() - { - if(_reference.getCacheConnection()) - { - synchronized(this) - { - if(_requestHandler != null) - { - return _requestHandler; - } - } - } - return _reference.getRequestHandler(this); - } - - synchronized public final IceInternal.BatchRequestQueue - __getBatchRequestQueue() - { - if(_batchRequestQueue == null) - { - _batchRequestQueue = _reference.getBatchRequestQueue(); - } - return _batchRequestQueue; - } - - public IceInternal.RequestHandler - __setRequestHandler(IceInternal.RequestHandler handler) - { - if(_reference.getCacheConnection()) - { - synchronized(this) - { - if(_requestHandler == null) - { - _requestHandler = handler; - } - return _requestHandler; - } - } - return handler; - } - - public void - __updateRequestHandler(IceInternal.RequestHandler previous, IceInternal.RequestHandler handler) - { - if(_reference.getCacheConnection() && previous != null) - { - synchronized(this) - { - if(_requestHandler != null && _requestHandler != handler) - { - // - // Update the request handler only if "previous" is the same - // as the current request handler. This is called after - // connection binding by the connect request handler. We only - // replace the request handler if the current handler is the - // connect request handler. - // - _requestHandler = _requestHandler.update(previous, handler); - } - } - } - } - - public void - cacheMessageBuffers(InputStream is, OutputStream os) - { - synchronized(this) - { - if(_streamCache == null) - { - _streamCache = new LinkedList<StreamCacheEntry>(); - } - _streamCache.add(new StreamCacheEntry(is, os)); - } - } - - // - // Only for use by IceInternal.ProxyFactory - // - public final void - __setup(IceInternal.Reference ref) - { - // - // No need to synchronize, as this operation is only called - // upon initial initialization. - // - - assert(_reference == null); - assert(_requestHandler == null); - - _reference = ref; - } - - protected static <T> T checkedCastImpl(Ice.ObjectPrx obj, String id, Class<T> proxyCls, Class<?> helperCls) - { - return checkedCastImpl(obj, null, false, null, false, id, proxyCls, helperCls); - } - - protected static <T> T checkedCastImpl(Ice.ObjectPrx obj, java.util.Map<String, String> ctx, String id, - Class<T> proxyCls, Class<?> helperCls) - { - return checkedCastImpl(obj, ctx, true, null, false, id, proxyCls, helperCls); - } - - protected static <T> T checkedCastImpl(Ice.ObjectPrx obj, String facet, String id, Class<T> proxyCls, - Class<?> helperCls) - { - return checkedCastImpl(obj, null, false, facet, true, id, proxyCls, helperCls); - } - - protected static <T> T checkedCastImpl(Ice.ObjectPrx obj, String facet, java.util.Map<String, String> ctx, - String id, Class<T> proxyCls, Class<?> helperCls) - { - return checkedCastImpl(obj, ctx, true, facet, true, id, proxyCls, helperCls); - } - - protected static <T> T checkedCastImpl(Ice.ObjectPrx obj, java.util.Map<String, String> ctx, boolean explicitCtx, - String facet, boolean explicitFacet, String id, Class<T> proxyCls, - Class<?> helperCls) - { - T d = null; - if(obj != null) - { - if(explicitFacet) - { - obj = obj.ice_facet(facet); - } - if(proxyCls.isInstance(obj)) - { - d = proxyCls.cast(obj); - } - else - { - try - { - final boolean b = explicitCtx ? obj.ice_isA(id, ctx) : obj.ice_isA(id); - if(b) - { - ObjectPrxHelperBase h = null; - try - { - h = ObjectPrxHelperBase.class.cast(helperCls.newInstance()); - } - catch(InstantiationException ex) - { - throw new SyscallException(ex); - } - catch(IllegalAccessException ex) - { - throw new SyscallException(ex); - } - h.__copyFrom(obj); - d = proxyCls.cast(h); - } - } - catch(FacetNotExistException ex) - { - } - } - } - return d; - } - - protected static <T> T uncheckedCastImpl(Ice.ObjectPrx obj, Class<T> proxyCls, Class<?> helperCls) - { - return uncheckedCastImpl(obj, null, false, proxyCls, helperCls); - } - - protected static <T> T uncheckedCastImpl(Ice.ObjectPrx obj, String facet, Class<T> proxyCls, Class<?> helperCls) - { - return uncheckedCastImpl(obj, facet, true, proxyCls, helperCls); - } - - protected static <T> T uncheckedCastImpl(Ice.ObjectPrx obj, String facet, boolean explicitFacet, Class<T> proxyCls, - Class<?> helperCls) - { - T d = null; - if(obj != null) - { - try - { - if(explicitFacet) - { - ObjectPrxHelperBase h = ObjectPrxHelperBase.class.cast(helperCls.newInstance()); - h.__copyFrom(obj.ice_facet(facet)); - d = proxyCls.cast(h); - } - else - { - if(proxyCls.isInstance(obj)) - { - d = proxyCls.cast(obj); - } - else - { - ObjectPrxHelperBase h = ObjectPrxHelperBase.class.cast(helperCls.newInstance()); - h.__copyFrom(obj); - d = proxyCls.cast(h); - } - } - } - catch(InstantiationException ex) - { - throw new SyscallException(ex); - } - catch(IllegalAccessException ex) - { - throw new SyscallException(ex); - } - } - return d; - } - - protected IceInternal.OutgoingAsync - getOutgoingAsync(String operation, IceInternal.CallbackBase cb) - { - StreamCacheEntry cacheEntry = null; - if(_reference.getInstance().cacheMessageBuffers() > 0) - { - synchronized(this) - { - if(_streamCache != null && !_streamCache.isEmpty()) - { - cacheEntry = _streamCache.remove(0); - } - } - } - if(cacheEntry == null) - { - return new IceInternal.OutgoingAsync(this, operation, cb); - } - else - { - return new IceInternal.OutgoingAsync(this, operation, cb, cacheEntry.is, cacheEntry.os); - } - } - - private ObjectPrxHelperBase - newInstance(IceInternal.Reference ref) - { - try - { - ObjectPrxHelperBase proxy = getClass().newInstance(); - proxy.__setup(ref); - return proxy; - } - catch(InstantiationException e) - { - // - // Impossible - // - assert false; - return null; - } - catch(IllegalAccessException e) - { - // - // Impossible - // - assert false; - return null; - } - } - - private void - writeObject(java.io.ObjectOutputStream out) - throws java.io.IOException - { - out.writeUTF(toString()); - } - - private void - readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException - { - String s = in.readUTF(); - try - { - Communicator communicator = ((Ice.ObjectInputStream)in).getCommunicator(); - if(communicator == null) - { - throw new java.io.IOException("Cannot deserialize proxy: no communicator provided"); - } - ObjectPrxHelperBase proxy = (ObjectPrxHelperBase)communicator.stringToProxy(s); - _reference = proxy._reference; - assert(proxy._requestHandler == null); - } - catch(ClassCastException ex) - { - java.io.IOException e = - new java.io.IOException("Cannot deserialize proxy: Ice.ObjectInputStream not found"); - e.initCause(ex); - throw e; - } - catch(LocalException ex) - { - java.io.IOException e = new java.io.IOException("Failure occurred while deserializing proxy"); - e.initCause(ex); - throw e; - } - } - - private static class StreamCacheEntry - { - StreamCacheEntry(InputStream is, OutputStream os) - { - this.is = is; - this.os = os; - } - - InputStream is; - OutputStream os; - } - - private transient IceInternal.Reference _reference; - private transient IceInternal.RequestHandler _requestHandler; - private transient IceInternal.BatchRequestQueue _batchRequestQueue; - private transient List<StreamCacheEntry> _streamCache; - public static final long serialVersionUID = 0L; -} diff --git a/java/src/Ice/src/main/java/Ice/ObjectPrxHolder.java b/java/src/Ice/src/main/java/Ice/ObjectPrxHolder.java deleted file mode 100644 index eb61958e123..00000000000 --- a/java/src/Ice/src/main/java/Ice/ObjectPrxHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for proxies that are out- or inout-parameters. - **/ -public final class ObjectPrxHolder extends Holder<ObjectPrx> -{ - /** - * Instantiates the class with a <code>null</code> proxy. - **/ - public - ObjectPrxHolder() - { - } - - /** - * Instantiates the class with the passed proxy. - * - * @param value The proxy stored this holder. - **/ - public - ObjectPrxHolder(ObjectPrx value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/OnewayCallback.java b/java/src/Ice/src/main/java/Ice/OnewayCallback.java deleted file mode 100644 index 76405d95605..00000000000 --- a/java/src/Ice/src/main/java/Ice/OnewayCallback.java +++ /dev/null @@ -1,77 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base class for generated oneway operation callback. - **/ -public abstract class OnewayCallback extends IceInternal.CallbackBase -{ - /** - * Called when the invocation response is received. - **/ - public abstract void response(); - - /** - * Called when the invocation raises an Ice run-time exception. - * - * @param ex The Ice run-time exception raised by the operation. - **/ - public abstract void exception(LocalException ex); - - /** - * Called when the invocation raises an Ice system exception. - * - * @param ex The Ice system exception raised by the operation. - **/ - public void exception(SystemException ex) - { - exception(new Ice.UnknownException(ex)); - } - - /** - * Called when a queued invocation is sent successfully. - **/ - public void sent(boolean sentSynchronously) - { - } - - @Override - public final void __sent(AsyncResult __result) - { - sent(__result.sentSynchronously()); - } - - @Override - public final boolean __hasSentCallback() - { - return true; - } - - @Override - public final void __completed(AsyncResult __result) - { - try - { - ((ObjectPrxHelperBase)__result.getProxy()).__end(__result, __result.getOperation()); - } - catch(LocalException __ex) - { - exception(__ex); - return; - } - catch(SystemException __ex) - { - exception(__ex); - return; - } - response(); - } -} diff --git a/java/src/Ice/src/main/java/Ice/Optional.java b/java/src/Ice/src/main/java/Ice/Optional.java deleted file mode 100644 index b906e31def0..00000000000 --- a/java/src/Ice/src/main/java/Ice/Optional.java +++ /dev/null @@ -1,202 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Generic class for optional parameters. - **/ -public class Optional<T> -{ - /** - * The value defaults to unset. - **/ - public Optional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public Optional(T v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public Optional(Optional<T> opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public T get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(T v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(Optional<T> opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = null; - } - - /** - * Helper function for creating Optional instances. - * - * @param v The initial value of the Optional. - * - * @return A new Optional instance set to the given value. - **/ - public static <T> Optional<T> O(T v) - { - return new Optional<T>(v); - } - - /** - * Helper function for creating BooleanOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new BooleanOptional instance set to the given value. - **/ - public static BooleanOptional O(boolean v) - { - return new BooleanOptional(v); - } - - /** - * Helper function for creating ByteOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new ByteOptional instance set to the given value. - **/ - public static ByteOptional O(byte v) - { - return new ByteOptional(v); - } - - /** - * Helper function for creating ShortOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new ShortOptional instance set to the given value. - **/ - public static ShortOptional O(short v) - { - return new ShortOptional(v); - } - - /** - * Helper function for creating IntOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new IntOptional instance set to the given value. - **/ - public static IntOptional O(int v) - { - return new IntOptional(v); - } - - /** - * Helper function for creating LongOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new LongOptional instance set to the given value. - **/ - public static LongOptional O(long v) - { - return new LongOptional(v); - } - - /** - * Helper function for creating FloatOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new FloatOptional instance set to the given value. - **/ - public static FloatOptional O(float v) - { - return new FloatOptional(v); - } - - /** - * Helper function for creating DoubleOptional instances. - * - * @param v The initial value of the Optional. - * - * @return A new DoubleOptional instance set to the given value. - **/ - public static DoubleOptional O(double v) - { - return new DoubleOptional(v); - } - - private T _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/OptionalObject.java b/java/src/Ice/src/main/java/Ice/OptionalObject.java deleted file mode 100644 index cbb1c27384c..00000000000 --- a/java/src/Ice/src/main/java/Ice/OptionalObject.java +++ /dev/null @@ -1,70 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Handles callbacks for an optional object parameter. - **/ -public class OptionalObject implements ReadValueCallback -{ - /** - * Instantiates the class with the given optional. - * - * @param opt The target optional. - * @param cls The formal type required for the unmarshaled object. - * @param type The Slice type ID corresponding to the formal type. - **/ - @SuppressWarnings("rawtypes") - public - OptionalObject(Optional opt, Class<?> cls, String type) - { - this.opt = opt; - this.cls = cls; - this.type = type; - } - - /** - * Sets the value of the optional to the passed instance. - * - * @param v The new value for the optional. - **/ - @SuppressWarnings("unchecked") - public void - valueReady(Ice.Object v) - { - if(v == null || cls.isInstance(v)) - { - // - // The line below would normally cause an "unchecked cast" warning. - // - opt.set(v); - } - else - { - IceInternal.Ex.throwUOE(type, v); - } - } - - /** - * The optional object. - **/ - @SuppressWarnings("rawtypes") - public Optional opt; - - /** - * The formal type of the target class. - **/ - public Class<?> cls; - - /** - * The Slice type ID of the target class. - **/ - public String type; -} diff --git a/java/src/Ice/src/main/java/Ice/ShortHolder.java b/java/src/Ice/src/main/java/Ice/ShortHolder.java deleted file mode 100644 index f960536349d..00000000000 --- a/java/src/Ice/src/main/java/Ice/ShortHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for shorts that are out- or inout-parameters. - **/ -public final class ShortHolder extends Holder<Short> -{ - /** - * Instantiates the class with the value zero. - **/ - public - ShortHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * The <code>short</code> value for this holder. - **/ - public - ShortHolder(short value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/ShortOptional.java b/java/src/Ice/src/main/java/Ice/ShortOptional.java deleted file mode 100644 index 60b9228f1f0..00000000000 --- a/java/src/Ice/src/main/java/Ice/ShortOptional.java +++ /dev/null @@ -1,106 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Manages an optional short parameter. - **/ -public class ShortOptional -{ - /** - * The value defaults to unset. - **/ - public ShortOptional() - { - _isSet = false; - } - - /** - * Sets the value to the given argument. - * - * @param v The initial value. - **/ - public ShortOptional(short v) - { - _value = v; - _isSet = true; - } - - /** - * Sets the value to a shallow copy of the given optional. - * - * @param opt The source value. - **/ - public ShortOptional(ShortOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Obtains the current value. - * - * @return The current value. - * @throws IllegalStateException If the value is not set. - **/ - public short get() - { - if(!_isSet) - { - throw new IllegalStateException("no value is set"); - } - return _value; - } - - /** - * Sets the value to the given argument. - * - * @param v The new value. - **/ - public void set(short v) - { - _value = v; - _isSet = true; - } - - /** - * If the given argument is set, this optional is set to a shallow copy of the argument, - * otherwise this optional is unset. - * - * @param opt The source value. - **/ - public void set(ShortOptional opt) - { - _value = opt._value; - _isSet = opt._isSet; - } - - /** - * Determines whether the value is set. - * - * @return True if the value is set, false otherwise. - **/ - public boolean isSet() - { - return _isSet; - } - - /** - * Unsets this value. - **/ - public void clear() - { - _isSet = false; - _value = 0; - } - - private short _value; - private boolean _isSet; -} diff --git a/java/src/Ice/src/main/java/Ice/StringHolder.java b/java/src/Ice/src/main/java/Ice/StringHolder.java deleted file mode 100644 index 46095138097..00000000000 --- a/java/src/Ice/src/main/java/Ice/StringHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Holder class for strings that are out- or inout-parameters. - **/ -public final class StringHolder extends Holder<String> -{ - /** - * Instantiates the class with a <code>null</code> string. - **/ - public - StringHolder() - { - } - - /** - * Instantiates the class with the passed value. - * - * @param value The <code>String</code> value stored by this holder. - **/ - public - StringHolder(String value) - { - super(value); - } -} diff --git a/java/src/Ice/src/main/java/Ice/TieBase.java b/java/src/Ice/src/main/java/Ice/TieBase.java deleted file mode 100644 index 0cbd8ff7c4e..00000000000 --- a/java/src/Ice/src/main/java/Ice/TieBase.java +++ /dev/null @@ -1,30 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Interface for servants using the tie mapping. - **/ -public interface TieBase -{ - /** - * Returns the delegate for this tie. - * - * @return The delegate. - **/ - java.lang.Object ice_delegate(); - - /** - * Sets the delegate for this tie. - * - * @param delegate The delegate. - **/ - void ice_delegate(java.lang.Object delegate); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallback.java b/java/src/Ice/src/main/java/Ice/TwowayCallback.java deleted file mode 100644 index bedbe2970c6..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Base interface for generated twoway operation callback. - **/ -public interface TwowayCallback -{ - /** - * Called when the invocation raises an Ice run-time exception. - * - * @param __ex The Ice run-time exception raised by the operation. - **/ - public void exception(LocalException __ex); - - /** - * Called when the invocation raises an Ice system exception. - * - * @param __ex The Ice system exception raised by the operation. - **/ - public void exception(SystemException __ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java deleted file mode 100644 index 5149a2b4116..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackArg1<T> extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(T arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java deleted file mode 100644 index f1a8e57995d..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackArg1UE.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackArg1UE<T> extends TwowayCallbackArg1<T> -{ - /** - * Called when the invocation raises an user exception. - * - * @param ex The user exception raised by the operation. - **/ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackBool.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackBool.java deleted file mode 100644 index bcbdb51971f..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackBool.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackBool extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(boolean arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java deleted file mode 100644 index 5a6492e4b63..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackBoolUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackBoolUE extends TwowayCallbackBool -{ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackByte.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackByte.java deleted file mode 100644 index 2c66deb95ab..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackByte.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackByte extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(byte arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java deleted file mode 100644 index 042b35e2bc1..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackDouble.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackDouble extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(double arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java deleted file mode 100644 index 3190a0b0d9b..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackDoubleUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackDoubleUE extends TwowayCallbackDouble -{ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java deleted file mode 100644 index 37818f8e8c1..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloat.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackFloat extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(float arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java deleted file mode 100644 index 26a14b83fe7..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackFloatUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackFloatUE extends TwowayCallbackFloat -{ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackInt.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackInt.java deleted file mode 100644 index 3319fae792e..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackInt.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackInt extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(int arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java deleted file mode 100644 index 7627bbb9ad6..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackIntUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackIntUE extends TwowayCallbackInt -{ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackLong.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackLong.java deleted file mode 100644 index ea49ed2a7b4..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackLong.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackLong extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(long arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java deleted file mode 100644 index 47ca9c303f3..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackLongUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackLongUE extends TwowayCallbackLong -{ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackShort.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackShort.java deleted file mode 100644 index 8f613175c92..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackShort.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackShort extends TwowayCallback -{ - /** - * Called when the invocation response is received. - * - * @param arg The operation return value. - **/ - void response(short arg); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java deleted file mode 100644 index 142993b319a..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackShortUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackShortUE extends TwowayCallbackShort -{ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackUE.java deleted file mode 100644 index ecd25e75edb..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackUE.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackUE extends TwowayCallback -{ - public void exception(UserException __ex); -} diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java b/java/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java deleted file mode 100644 index 24813fb7420..00000000000 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackVoidUE.java +++ /dev/null @@ -1,25 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -public interface TwowayCallbackVoidUE extends TwowayCallback -{ - /** - * Called when the invocation response is received. - **/ - void response(); - - /** - * Called when the invocation raises an user exception. - * - * @param ex The user exception raised by the operation. - **/ - void exception(Ice.UserException ex); -} diff --git a/java/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java b/java/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java deleted file mode 100644 index edc77cb14be..00000000000 --- a/java/src/Ice/src/main/java/Ice/_AMD_Object_ice_invoke.java +++ /dev/null @@ -1,38 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -final class _AMD_Object_ice_invoke extends IceInternal.IncomingAsync implements AMD_Object_ice_invoke -{ - public - _AMD_Object_ice_invoke(IceInternal.Incoming in) - { - super(in); - } - - @Override - public void - ice_response(boolean ok, byte[] outEncaps) - { - if(__validateResponse(ok)) - { - try - { - __writeParamEncaps(outEncaps, ok); - } - catch(Ice.LocalException ex) - { - __exception(ex); - return; - } - __response(); - } - } -} diff --git a/java/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java b/java/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java deleted file mode 100644 index 6357f50555c..00000000000 --- a/java/src/Ice/src/main/java/Ice/_Callback_Object_ice_invoke.java +++ /dev/null @@ -1,28 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Ice; - -/** - * Callback object for {@link ObjectPrx#begin_ice_invoke}. - **/ -public interface _Callback_Object_ice_invoke extends Ice.TwowayCallback -{ - /** - * The Ice run time calls <code>response</code> when an asynchronous operation invocation - * completes successfully or raises a user exception. - * - * @param ret Indicates the result of the invocation. If <code>true</code>, the operation - * completed succesfully; if <code>false</code>, the operation raised a user exception. - * @param outParams Contains the encoded out-parameters of the operation (if any) if <code>ok</code> - * is <code>true</code>; otherwise, if <code>ok</code> is <code>false</code>, contains the - * encoded user exception raised by the operation. - **/ - public void response(boolean ret, byte[] outParams); -} diff --git a/java/src/Ice/src/main/java/IceInternal/ACMMonitor.java b/java/src/Ice/src/main/java/IceInternal/ACMMonitor.java deleted file mode 100644 index 0265886b023..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/ACMMonitor.java +++ /dev/null @@ -1,20 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface ACMMonitor -{ - void add(Ice.ConnectionI con); - void remove(Ice.ConnectionI con); - void reap(Ice.ConnectionI con); - - ACMMonitor acm(Ice.IntOptional timeout, Ice.Optional<Ice.ACMClose> close, Ice.Optional<Ice.ACMHeartbeat> heartbeat); - Ice.ACM getACM(); -} diff --git a/java/src/Ice/src/main/java/IceInternal/CallbackBase.java b/java/src/Ice/src/main/java/IceInternal/CallbackBase.java deleted file mode 100644 index b482e9a71cd..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/CallbackBase.java +++ /dev/null @@ -1,25 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class CallbackBase -{ - public abstract void __completed(Ice.AsyncResult r); - public abstract void __sent(Ice.AsyncResult r); - public abstract boolean __hasSentCallback(); - - public static void check(boolean cb) - { - if(!cb) - { - throw new IllegalArgumentException("callback cannot be null"); - } - } -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java deleted file mode 100644 index 71954017a36..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_BoolCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_BoolCallback -{ - void apply(boolean arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java deleted file mode 100644 index 06d44618159..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_ByteCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_ByteCallback -{ - void apply(byte arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java b/java/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java deleted file mode 100644 index dc200518c10..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_CallbackBase.java +++ /dev/null @@ -1,50 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_CallbackBase extends IceInternal.CallbackBase -{ - public Functional_CallbackBase(boolean responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - CallbackBase.check(responseCb || exceptionCb != null); - __exceptionCb = exceptionCb; - __sentCb = sentCb; - } - - protected Functional_CallbackBase(Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - __exceptionCb = exceptionCb; - __sentCb = sentCb; - } - - @Override - public final void __sent(Ice.AsyncResult __result) - { - if(__sentCb != null) - { - __sentCb.apply(__result.sentSynchronously()); - } - } - - @Override - public final boolean __hasSentCallback() - { - return __sentCb != null; - } - - @Override - public abstract void __completed(Ice.AsyncResult __result); - - protected final Functional_GenericCallback1<Ice.Exception> __exceptionCb; - protected final Functional_BoolCallback __sentCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java deleted file mode 100644 index 8aba3931756..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_DoubleCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_DoubleCallback -{ - void apply(double arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java deleted file mode 100644 index 69deb3ff76d..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_FloatCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_FloatCallback -{ - void apply(float arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java b/java/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java deleted file mode 100644 index aae63a7e35b..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_GenericCallback1.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_GenericCallback1<T> -{ - void apply(T arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java deleted file mode 100644 index ab901b9cad8..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_IntCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_IntCallback -{ - void apply(int arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java deleted file mode 100644 index ff64e28b35e..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_LongCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_LongCallback -{ - void apply(long arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java deleted file mode 100644 index 7962cd4e336..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_OnewayCallback.java +++ /dev/null @@ -1,44 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class Functional_OnewayCallback extends IceInternal.Functional_CallbackBase -{ - public Functional_OnewayCallback(Functional_VoidCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || exceptionCb != null); - __responseCb = responseCb; - } - - @Override - public final void __completed(Ice.AsyncResult __result) - { - try - { - ((Ice.ObjectPrxHelperBase)__result.getProxy()).__end(__result, __result.getOperation()); - if(__responseCb != null) - { - __responseCb.apply(); - } - } - catch(Ice.Exception __ex) - { - if(__exceptionCb != null) - { - __exceptionCb.apply(__ex); - } - } - } - - private final Functional_VoidCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java deleted file mode 100644 index 32a1d925ce6..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_ShortCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_ShortCallback -{ - void apply(short arg); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java deleted file mode 100644 index f88b2d64ca6..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallback.java +++ /dev/null @@ -1,44 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallback extends IceInternal.Functional_CallbackBase implements Ice.TwowayCallback -{ - public Functional_TwowayCallback(boolean responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb, exceptionCb, sentCb); - } - - protected Functional_TwowayCallback(Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - } - - @Override - public void exception(Ice.SystemException ex) - { - if(__exceptionCb != null) - { - __exceptionCb.apply(ex); - } - } - - @Override - public final void exception(Ice.LocalException ex) - { - if(__exceptionCb != null) - { - __exceptionCb.apply(ex); - } - } -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java deleted file mode 100644 index c7b52ea9c52..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackArg1<T> extends Functional_TwowayCallback - implements Ice.TwowayCallbackArg1<T> -{ - public Functional_TwowayCallbackArg1(Functional_GenericCallback1<T> responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackArg1(boolean userExceptionCb, - Functional_GenericCallback1<T> responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - @Override - public void response(T arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_GenericCallback1<T> __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java deleted file mode 100644 index ed810994d8e..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackArg1UE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackArg1UE<T> - extends Functional_TwowayCallbackArg1<T> implements Ice.TwowayCallbackArg1UE<T> -{ - public Functional_TwowayCallbackArg1UE( - Functional_GenericCallback1<T> responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(userExceptionCb != null, responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java deleted file mode 100644 index 973b107f1ff..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBool.java +++ /dev/null @@ -1,42 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackBool extends Functional_TwowayCallback implements Ice.TwowayCallbackBool -{ - public Functional_TwowayCallbackBool(Functional_BoolCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - this.__responseCb = responseCb; - } - - protected Functional_TwowayCallbackBool(boolean userExceptionCb, - Functional_BoolCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - this.__responseCb = responseCb; - } - - @Override - public void response(boolean arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_BoolCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java deleted file mode 100644 index 28d2a92777f..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackBoolUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackBoolUE - extends Functional_TwowayCallbackBool implements Ice.TwowayCallbackBoolUE -{ - public Functional_TwowayCallbackBoolUE( - Functional_BoolCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(userExceptionCb != null, responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java deleted file mode 100644 index 986163e8d80..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByte.java +++ /dev/null @@ -1,42 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackByte extends Functional_TwowayCallback implements Ice.TwowayCallbackByte -{ - public Functional_TwowayCallbackByte(Functional_ByteCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackByte(boolean userExceptionCb, - Functional_ByteCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - @Override - public void response(byte arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_ByteCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java deleted file mode 100644 index 1c0fb9bb8bc..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackByteUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackByteUE - extends Functional_TwowayCallbackByte implements Ice.TwowayCallbackByteUE -{ - public Functional_TwowayCallbackByteUE( - Functional_ByteCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(userExceptionCb != null, responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java deleted file mode 100644 index 879014d73e5..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java +++ /dev/null @@ -1,42 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackDouble - extends Functional_TwowayCallback implements Ice.TwowayCallbackDouble -{ - public Functional_TwowayCallbackDouble(Functional_DoubleCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackDouble(boolean userExceptionCb, - Functional_DoubleCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - public void response(double arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_DoubleCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java deleted file mode 100644 index a8d28cf12fe..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDoubleUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackDoubleUE - extends Functional_TwowayCallbackDouble implements Ice.TwowayCallbackDoubleUE -{ - public Functional_TwowayCallbackDoubleUE( - Functional_DoubleCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(userExceptionCb != null, responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java deleted file mode 100644 index 7ea9b1f9753..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloat.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackFloat - extends Functional_TwowayCallback implements Ice.TwowayCallbackFloat -{ - public Functional_TwowayCallbackFloat(Functional_FloatCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackFloat(boolean userExceptionCb, - Functional_FloatCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - @Override - public void response(float arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_FloatCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java deleted file mode 100644 index d5dc8141064..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackFloatUE.java +++ /dev/null @@ -1,34 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackFloatUE - extends Functional_TwowayCallbackFloat implements Ice.TwowayCallbackFloatUE -{ - public Functional_TwowayCallbackFloatUE(Functional_FloatCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(userExceptionCb != null, responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java deleted file mode 100644 index 8c6fea2818e..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackInt.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackInt - extends Functional_TwowayCallback implements Ice.TwowayCallbackInt -{ - public Functional_TwowayCallbackInt(Functional_IntCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackInt(boolean userExceptionCb, - Functional_IntCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - @Override - public void response(int arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_IntCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java deleted file mode 100644 index b749b44b1ad..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackIntUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackIntUE - extends Functional_TwowayCallbackInt implements Ice.TwowayCallbackIntUE -{ - public Functional_TwowayCallbackIntUE( - Functional_IntCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(userExceptionCb != null, responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java deleted file mode 100644 index bc6c654643e..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLong.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackLong - extends Functional_TwowayCallback implements Ice.TwowayCallbackLong -{ - public Functional_TwowayCallbackLong(Functional_LongCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackLong(boolean userExceptionCb, - Functional_LongCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - @Override - public void response(long arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_LongCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java deleted file mode 100644 index 2eb6985fcb8..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackLongUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackLongUE - extends Functional_TwowayCallbackLong implements Ice.TwowayCallbackLongUE -{ - public Functional_TwowayCallbackLongUE( - Functional_LongCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java deleted file mode 100644 index f6c835f0721..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShort.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackShort - extends Functional_TwowayCallback implements Ice.TwowayCallbackShort -{ - public Functional_TwowayCallbackShort(Functional_ShortCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, exceptionCb, sentCb); - __responseCb = responseCb; - } - - protected Functional_TwowayCallbackShort(boolean userExceptionCb, - Functional_ShortCallback responseCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb != null || (userExceptionCb && exceptionCb != null)); - __responseCb = responseCb; - } - - @Override - public void response(short arg) - { - if(__responseCb != null) - { - __responseCb.apply(arg); - } - } - - final private Functional_ShortCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java deleted file mode 100644 index 47ff52de87c..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackShortUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackShortUE - extends Functional_TwowayCallbackShort implements Ice.TwowayCallbackShortUE -{ - public Functional_TwowayCallbackShortUE( - Functional_ShortCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb, exceptionCb, sentCb); - __userExceptionCb = userExceptionCb; - } - - @Override - public void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - private final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java deleted file mode 100644 index 5ae5d838274..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackUE.java +++ /dev/null @@ -1,34 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackUE extends Functional_TwowayCallback implements Ice.TwowayCallbackUE -{ - public Functional_TwowayCallbackUE(boolean responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(exceptionCb, sentCb); - CallbackBase.check(responseCb || (userExceptionCb != null && exceptionCb != null)); - __userExceptionCb = userExceptionCb; - } - - @Override - public final void exception(Ice.UserException ex) - { - if(__userExceptionCb != null) - { - __userExceptionCb.apply(ex); - } - } - - protected final Functional_GenericCallback1<Ice.UserException> __userExceptionCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java deleted file mode 100644 index 080b4ad863a..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackVoidUE.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class Functional_TwowayCallbackVoidUE - extends Functional_TwowayCallbackUE implements Ice.TwowayCallbackVoidUE -{ - public Functional_TwowayCallbackVoidUE( - Functional_VoidCallback responseCb, - Functional_GenericCallback1<Ice.UserException> userExceptionCb, - Functional_GenericCallback1<Ice.Exception> exceptionCb, - Functional_BoolCallback sentCb) - { - super(responseCb != null, userExceptionCb, exceptionCb, sentCb); - __responseCb = responseCb; - } - - @Override - public void response() - { - if(__responseCb != null) - { - __responseCb.apply(); - } - } - - private final Functional_VoidCallback __responseCb; -} diff --git a/java/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java b/java/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java deleted file mode 100644 index ca40c37cd7c..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Functional_VoidCallback.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public interface Functional_VoidCallback -{ - void apply(); -} diff --git a/java/src/Ice/src/main/java/IceInternal/Incoming.java b/java/src/Ice/src/main/java/IceInternal/Incoming.java deleted file mode 100644 index 6a7babc0c36..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/Incoming.java +++ /dev/null @@ -1,415 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -import Ice.Instrumentation.CommunicatorObserver; - -final public class Incoming extends IncomingBase implements Ice.Request -{ - public - Incoming(Instance instance, ResponseHandler responseHandler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, - boolean response, byte compress, int requestId) - { - super(instance, responseHandler, connection, adapter, response, compress, requestId); - - // - // Prepare the response if necessary. - // - if(response) - { - _os.writeBlob(IceInternal.Protocol.replyHdr); - - // - // Add the request ID. - // - _os.writeInt(requestId); - } - } - - @Override - public Ice.Current - getCurrent() - { - return _current; - } - - // - // These functions allow this object to be reused, rather than reallocated. - // - @Override - public void - reset(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, - boolean response, byte compress, int requestId) - { - _cb = null; - _inParamPos = -1; - - super.reset(instance, handler, connection, adapter, response, compress, requestId); - - // - // Prepare the response if necessary. - // - if(response) - { - _os.writeBlob(IceInternal.Protocol.replyHdr); - - // - // Add the request ID. - // - _os.writeInt(requestId); - } - } - - @Override - public void - reclaim() - { - _cb = null; - _inParamPos = -1; - - super.reclaim(); - } - - public void - invoke(ServantManager servantManager, Ice.InputStream stream) - { - _is = stream; - - int start = _is.pos(); - - // - // Read the current. - // - _current.id.__read(_is); - - // - // For compatibility with the old FacetPath. - // - String[] facetPath = _is.readStringSeq(); - if(facetPath.length > 0) - { - if(facetPath.length > 1) - { - throw new Ice.MarshalException(); - } - _current.facet = facetPath[0]; - } - else - { - _current.facet = ""; - } - - _current.operation = _is.readString(); - _current.mode = Ice.OperationMode.values()[_is.readByte()]; - _current.ctx = new java.util.HashMap<String, String>(); - int sz = _is.readSize(); - while(sz-- > 0) - { - String first = _is.readString(); - String second = _is.readString(); - _current.ctx.put(first, second); - } - - CommunicatorObserver obsv = _instance.initializationData().observer; - if(obsv != null) - { - // Read the parameter encapsulation size. - int size = _is.readInt(); - _is.pos(_is.pos() - 4); - - _observer = obsv.getDispatchObserver(_current, _is.pos() - start + size); - if(_observer != null) - { - _observer.attach(); - } - } - - // - // Don't put the code above into the try block below. Exceptions - // in the code above are considered fatal, and must propagate to - // the caller of this operation. - // - - if(servantManager != null) - { - _servant = servantManager.findServant(_current.id, _current.facet); - if(_servant == null) - { - _locator = servantManager.findServantLocator(_current.id.category); - if(_locator == null && _current.id.category.length() > 0) - { - _locator = servantManager.findServantLocator(""); - } - - if(_locator != null) - { - try - { - _servant = _locator.locate(_current, _cookie); - } - catch(Ice.UserException ex) - { - Ice.EncodingVersion encoding = _is.skipEncapsulation(); // Required for batch requests. - - if(_observer != null) - { - _observer.userException(); - } - - if(_response) - { - _os.writeByte(ReplyStatus.replyUserException); - _os.startEncapsulation(encoding, Ice.FormatType.DefaultFormat); - _os.writeException(ex); - _os.endEncapsulation(); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, false); - } - else - { - _responseHandler.sendNoResponse(); - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } - _responseHandler = null; - return; - } - catch(java.lang.Exception ex) - { - _is.skipEncapsulation(); // Required for batch requests. - __handleException(ex, false); - return; - } - catch(java.lang.Error ex) - { - _is.skipEncapsulation(); // Required for batch requests. - __handleError(ex, false); // Always throws. - } - } - } - } - - try - { - if(_servant != null) - { - if(_instance.useApplicationClassLoader()) - { - Thread.currentThread().setContextClassLoader(_servant.getClass().getClassLoader()); - } - - try - { - // - // DispatchAsync is a "pseudo dispatch status", used internally only - // to indicate async dispatch. - // - if(_servant.__dispatch(this, _current) == Ice.DispatchStatus.DispatchAsync) - { - // - // If this was an asynchronous dispatch, we're done here. - // - return; - } - } - finally - { - if(_instance.useApplicationClassLoader()) - { - Thread.currentThread().setContextClassLoader(null); - } - } - - if(_locator != null && !__servantLocatorFinished(false)) - { - return; - } - } - else - { - // - // Skip the input parameters, this is required for reading - // the next batch request if dispatching batch requests. - // - _is.skipEncapsulation(); - - if(servantManager != null && servantManager.hasServant(_current.id)) - { - throw new Ice.FacetNotExistException(_current.id, _current.facet, _current.operation); - } - else - { - throw new Ice.ObjectNotExistException(_current.id, _current.facet, _current.operation); - } - } - } - catch(java.lang.Exception ex) - { - if(_servant != null && _locator != null && !__servantLocatorFinished(false)) - { - return; - } - __handleException(ex, false); - return; - } - catch(java.lang.Error ex) - { - if(_servant != null && _locator != null && !__servantLocatorFinished(false)) - { - return; - } - __handleError(ex, false); // Always throws. - } - - // - // Don't put the code below into the try block above. Exceptions - // in the code below are considered fatal, and must propagate to - // the caller of this operation. - // - - assert(_responseHandler != null); - - if(_response) - { - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, false); - } - else - { - _responseHandler.sendNoResponse(); - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } - _responseHandler = null; - } - - public final void - push(Ice.DispatchInterceptorAsyncCallback cb) - { - if(_interceptorAsyncCallbackList == null) - { - _interceptorAsyncCallbackList = new java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback>(); - } - - _interceptorAsyncCallbackList.addFirst(cb); - } - - public final void - pop() - { - assert _interceptorAsyncCallbackList != null; - _interceptorAsyncCallbackList.removeFirst(); - } - - public final void - startOver() - { - if(_inParamPos == -1) - { - // - // That's the first startOver, so almost nothing to do - // - _inParamPos = _is.pos(); - } - else - { - killAsync(); - - // - // Let's rewind _is and clean-up _os - // - _is.pos(_inParamPos); - if(_response) - { - _os.resize(Protocol.headerSize + 4); - } - } - } - - public final void - killAsync() - { - // - // Always runs in the dispatch thread - // - if(_cb != null) - { - // - // May raise ResponseSentException - // - _cb.__deactivate(this); - _cb = null; - } - } - - public final Ice.InputStream - startReadParams() - { - // - // Remember the encoding used by the input parameters, we'll - // encode the response parameters with the same encoding. - // - _current.encoding = _is.startEncapsulation(); - return _is; - } - - public final void - endReadParams() - { - _is.endEncapsulation(); - } - - public final void - readEmptyParams() - { - _current.encoding = _is.skipEmptyEncapsulation(); - } - - public final byte[] - readParamEncaps() - { - _current.encoding = new Ice.EncodingVersion(); - return _is.readEncapsulation(_current.encoding); - } - - final void - setActive(IncomingAsync cb) - { - assert _cb == null; - _cb = cb; - } - - final boolean - isRetriable() - { - return _inParamPos != -1; - } - - public Incoming next; // For use by ConnectionI. - - private Ice.InputStream _is; - - private IncomingAsync _cb; - private int _inParamPos = -1; -} diff --git a/java/src/Ice/src/main/java/IceInternal/IncomingAsync.java b/java/src/Ice/src/main/java/IceInternal/IncomingAsync.java deleted file mode 100644 index 7abed77651d..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/IncomingAsync.java +++ /dev/null @@ -1,204 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class IncomingAsync extends IncomingBase implements Ice.AMDCallback -{ - public - IncomingAsync(Incoming in) // Adopts the argument. It must not be used afterwards. - { - super(in); - _retriable = in.isRetriable(); - - if(_retriable) - { - in.setActive(this); - _active = true; - } - } - - @Override - public void - ice_exception(java.lang.Exception ex) - { - // - // Only call __exception if this incoming is not retriable or if - // all the interceptors return true and no response has been sent - // yet. - // - - if(_retriable) - { - try - { - if(_interceptorAsyncCallbackList != null) - { - for(Ice.DispatchInterceptorAsyncCallback cb : _interceptorAsyncCallbackList) - { - if(!cb.exception(ex)) - { - return; - } - } - } - } - catch(java.lang.RuntimeException exc) - { - return; - } - - synchronized(this) - { - if(!_active) - { - return; - } - _active = false; - } - } - - if(_responseHandler != null) - { - __exception(ex); - } - else - { - // - // Response has already been sent. - // - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - } - } - - final void - __deactivate(Incoming in) - { - assert _retriable; - - synchronized(this) - { - if(!_active) - { - // - // Since _deactivate can only be called on an active object, - // this means the response has already been sent (see __validateXXX below) - // - throw new Ice.ResponseSentException(); - } - _active = false; - } - - in.adopt(this); - } - - final protected void - __response() - { - try - { - if(_locator != null && !__servantLocatorFinished(true)) - { - return; - } - - assert(_responseHandler != null); - - if(_response) - { - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, true); - } - else - { - _responseHandler.sendNoResponse(); - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } - _responseHandler = null; - } - catch(Ice.LocalException ex) - { - _responseHandler.invokeException(_current.requestId, ex, 1, true); - } - } - - final protected void - __exception(java.lang.Exception exc) - { - try - { - if(_locator != null && !__servantLocatorFinished(true)) - { - return; - } - - __handleException(exc, true); - } - catch(Ice.LocalException ex) - { - _responseHandler.invokeException(_current.requestId, ex, 1, true); - } - } - - final protected boolean - __validateResponse(boolean ok) - { - // - // Only returns true if this incoming is not retriable or if all - // the interceptors return true and no response has been sent - // yet. Upon getting a true return value, the caller should send - // the response. - // - - if(_retriable) - { - try - { - if(_interceptorAsyncCallbackList != null) - { - for(Ice.DispatchInterceptorAsyncCallback cb : _interceptorAsyncCallbackList) - { - if(!cb.response(ok)) - { - return false; - } - } - } - } - catch(java.lang.RuntimeException ex) - { - return false; - } - - synchronized(this) - { - if(!_active) - { - return false; - } - _active = false; - } - } - return true; - } - - private final boolean _retriable; - private boolean _active = false; // only meaningful when _retriable == true -} diff --git a/java/src/Ice/src/main/java/IceInternal/IncomingBase.java b/java/src/Ice/src/main/java/IceInternal/IncomingBase.java deleted file mode 100644 index 93c853c9853..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/IncomingBase.java +++ /dev/null @@ -1,663 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -class IncomingBase -{ - protected - IncomingBase(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, - boolean response, byte compress, int requestId) - { - _instance = instance; - _responseHandler = handler; - _response = response; - _compress = compress; - if(_response) - { - _os = new Ice.OutputStream(instance, Protocol.currentProtocolEncoding); - } - - _current = new Ice.Current(); - _current.id = new Ice.Identity(); - _current.adapter = adapter; - _current.con = connection; - _current.requestId = requestId; - - _cookie = new Ice.LocalObjectHolder(); - } - - protected - IncomingBase(IncomingBase in) // Adopts the argument. It must not be used afterwards. - { - // - // We don't change _current as it's exposed by Ice::Request - // - _current = in._current; - - // - // Deep copy - // - if(in._interceptorAsyncCallbackList != null) - { - // - // Copy, not just reference - // - _interceptorAsyncCallbackList = - new java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback>(in._interceptorAsyncCallbackList); - } - - adopt(in); - } - - protected void - adopt(IncomingBase other) - { - _instance = other._instance; - //other._instance = null; // Don't reset _instance. - - _observer = other._observer; - other._observer = null; - - _servant = other._servant; - other._servant = null; - - _locator = other._locator; - other._locator = null; - - _cookie = other._cookie; - other._cookie = null; - - _response = other._response; - other._response = false; - - _compress = other._compress; - other._compress = 0; - - // - // Adopt the stream - it creates less garbage. - // - _os = other._os; - other._os = null; - - _responseHandler = other._responseHandler; - other._responseHandler = null; - } - - public Ice.OutputStream - __startWriteParams(Ice.FormatType format) - { - if(!_response) - { - throw new Ice.MarshalException("can't marshal out parameters for oneway dispatch"); - } - - assert(_os.size() == Protocol.headerSize + 4); // Reply status position. - assert(_current.encoding != null); // Encoding for reply is known. - _os.writeByte((byte)0); - _os.startEncapsulation(_current.encoding, format); - return _os; - } - - public void - __endWriteParams(boolean ok) - { - if(!ok && _observer != null) - { - _observer.userException(); - } - - assert(_response); - - int save = _os.pos(); - _os.pos(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ok ? ReplyStatus.replyOK : ReplyStatus.replyUserException); - _os.pos(save); - _os.endEncapsulation(); - } - - public void - __writeEmptyParams() - { - if(_response) - { - assert(_os.size() == Protocol.headerSize + 4); // Reply status position. - assert(_current.encoding != null); // Encoding for reply is known. - _os.writeByte(ReplyStatus.replyOK); - _os.writeEmptyEncapsulation(_current.encoding); - } - } - - public void - __writeParamEncaps(byte[] v, boolean ok) - { - if(!ok && _observer != null) - { - _observer.userException(); - } - - if(_response) - { - assert(_os.size() == Protocol.headerSize + 4); // Reply status position. - assert(_current.encoding != null); // Encoding for reply is known. - _os.writeByte(ok ? ReplyStatus.replyOK : ReplyStatus.replyUserException); - if(v == null || v.length == 0) - { - _os.writeEmptyEncapsulation(_current.encoding); - } - else - { - _os.writeEncapsulation(v); - } - } - } - - public void - __writeUserException(Ice.UserException ex, Ice.FormatType format) - { - Ice.OutputStream __os = __startWriteParams(format); - __os.writeException(ex); - __endWriteParams(false); - } - - // - // These functions allow this object to be reused, rather than reallocated. - // - public void - reset(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, - boolean response, byte compress, int requestId) - { - _instance = instance; - - // - // Don't recycle the Current object, because servants may keep a reference to it. - // - _current = new Ice.Current(); - _current.id = new Ice.Identity(); - _current.adapter = adapter; - _current.con = connection; - _current.requestId = requestId; - - if(_cookie == null) - { - _cookie = new Ice.LocalObjectHolder(); - } - - _response = response; - - _compress = compress; - - if(_response && _os == null) - { - _os = new Ice.OutputStream(instance, Protocol.currentProtocolEncoding); - } - - _responseHandler = handler; - - _interceptorAsyncCallbackList = null; - } - - public void - reclaim() - { - _servant = null; - - _locator = null; - - if(_cookie != null) - { - _cookie.value = null; - } - - _observer = null; - - if(_os != null) - { - _os.reset(); - } - - _interceptorAsyncCallbackList = null; - } - - final protected void - __warning(java.lang.Exception ex) - { - assert(_instance != null); - - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - IceUtilInternal.OutputBase out = new IceUtilInternal.OutputBase(pw); - out.setUseTab(false); - out.print("dispatch exception:"); - out.print("\nidentity: " + Ice.Util.identityToString(_current.id)); - out.print("\nfacet: " + IceUtilInternal.StringUtil.escapeString(_current.facet, "")); - out.print("\noperation: " + _current.operation); - if(_current.con != null) - { - for(Ice.ConnectionInfo connInfo = _current.con.getInfo(); connInfo != null; connInfo = connInfo.underlying) - { - if(connInfo instanceof Ice.IPConnectionInfo) - { - Ice.IPConnectionInfo ipConnInfo = (Ice.IPConnectionInfo)connInfo; - out.print("\nremote host: " + ipConnInfo.remoteAddress + " remote port: " + ipConnInfo.remotePort); - } - } - } - out.print("\n"); - ex.printStackTrace(pw); - pw.flush(); - _instance.initializationData().logger.warning(sw.toString()); - } - - final protected boolean - __servantLocatorFinished(boolean amd) - { - assert(_locator != null && _servant != null); - try - { - _locator.finished(_current, _servant, _cookie.value); - return true; - } - catch(Ice.UserException ex) - { - assert(_responseHandler != null); - - if(_observer != null) - { - _observer.userException(); - } - - // - // The operation may have already marshaled a reply; we must overwrite that reply. - // - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUserException); - _os.startEncapsulation(_current.encoding, Ice.FormatType.DefaultFormat); - _os.writeException(ex); - _os.endEncapsulation(); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } - _responseHandler = null; - } - catch(java.lang.Exception ex) - { - __handleException(ex, amd); - } - catch(java.lang.Error ex) - { - __handleError(ex, amd); // Always throws. - } - return false; - } - - final protected void - __handleException(java.lang.Exception exc, boolean amd) - { - assert(_responseHandler != null); - - try - { - throw exc; - } - catch(Ice.RequestFailedException ex) - { - if(ex.id == null || ex.id.name == null || ex.id.name.isEmpty()) - { - ex.id = _current.id; - } - - if(ex.facet == null || ex.facet.isEmpty()) - { - ex.facet = _current.facet; - } - - if(ex.operation == null || ex.operation.length() == 0) - { - ex.operation = _current.operation; - } - - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - if(ex instanceof Ice.ObjectNotExistException) - { - _os.writeByte(ReplyStatus.replyObjectNotExist); - } - else if(ex instanceof Ice.FacetNotExistException) - { - _os.writeByte(ReplyStatus.replyFacetNotExist); - } - else if(ex instanceof Ice.OperationNotExistException) - { - _os.writeByte(ReplyStatus.replyOperationNotExist); - } - else - { - assert(false); - } - ex.id.__write(_os); - - // - // For compatibility with the old FacetPath. - // - if(ex.facet == null || ex.facet.length() == 0) - { - _os.writeStringSeq(null); - } - else - { - String[] facetPath2 = { ex.facet }; - _os.writeStringSeq(facetPath2); - } - - _os.writeString(ex.operation); - - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - catch(Ice.UnknownLocalException ex) - { - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownLocalException); - _os.writeString(ex.unknown); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - catch(Ice.UnknownUserException ex) - { - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownUserException); - _os.writeString(ex.unknown); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - catch(Ice.UnknownException ex) - { - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownException); - _os.writeString(ex.unknown); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - catch(Ice.Exception ex) - { - if(ex instanceof Ice.SystemException) - { - if(_responseHandler.systemException(_current.requestId, (Ice.SystemException)ex, amd)) - { - return; - } - } - - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownLocalException); - //_os.writeString(ex.toString()); - java.io.StringWriter sw = new java.io.StringWriter(); - sw.write(ex.ice_id() + "\n"); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _os.writeString(sw.toString()); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - catch(Ice.UserException ex) - { - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownUserException); - //_os.writeString(ex.toString()); - java.io.StringWriter sw = new java.io.StringWriter(); - sw.write(ex.ice_id() + "\n"); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _os.writeString(sw.toString()); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - catch(java.lang.Exception ex) - { - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(ex); - } - - if(_observer != null) - { - _observer.failed(ex.getClass().getName()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownException); - //_os.writeString(ex.toString()); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _os.writeString(sw.toString()); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } - _responseHandler = null; - } - - final protected void - __handleError(java.lang.Error exc, boolean amd) - { - assert(_responseHandler != null); - - Ice.UnknownException uex = new Ice.UnknownException(exc); - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - exc.printStackTrace(pw); - pw.flush(); - uex.unknown = sw.toString(); - - if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) - { - __warning(uex); - } - - if(_observer != null) - { - _observer.failed(uex.ice_id()); - } - - if(_response) - { - _os.resize(Protocol.headerSize + 4); // Reply status position. - _os.writeByte(ReplyStatus.replyUnknownException); - _os.writeString(uex.unknown); - if(_observer != null) - { - _observer.reply(_os.size() - Protocol.headerSize - 4); - } - _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); - } - else - { - _responseHandler.sendNoResponse(); - } - - if(_observer != null) - { - _observer.detach(); - _observer = null; - } - _responseHandler = null; - - throw new ServantError(exc); - } - - protected Instance _instance; - protected Ice.Current _current; - protected Ice.Object _servant; - protected Ice.ServantLocator _locator; - protected Ice.LocalObjectHolder _cookie; - protected Ice.Instrumentation.DispatchObserver _observer; - - protected boolean _response; - protected byte _compress; - - protected Ice.OutputStream _os; - - protected ResponseHandler _responseHandler; - - protected java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback> _interceptorAsyncCallbackList; -} diff --git a/java/src/Ice/src/main/java/IceInternal/ListPatcher.java b/java/src/Ice/src/main/java/IceInternal/ListPatcher.java deleted file mode 100644 index 56f3472d567..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/ListPatcher.java +++ /dev/null @@ -1,46 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class ListPatcher<T> implements Ice.ReadValueCallback -{ - public ListPatcher(java.util.List<T> list, Class<T> cls, int index) - { - _list = list; - _cls = cls; - _index = index; - } - - public void valueReady(Ice.Object v) - { - if(v != null) - { - // - // Raise ClassCastException if the element doesn't match the expected type. - // - if(!_cls.isInstance(v)) - { - throw new ClassCastException("expected element of type " + _cls.getName() + " but received " + - v.getClass().getName()); - } - } - - // - // This isn't very efficient for sequentially-accessed lists, but there - // isn't much we can do about it as long as a new patcher instance is - // created for each element. - // - _list.set(_index, _cls.cast(v)); - } - - private java.util.List<T> _list; - private Class<T> _cls; - private int _index; -} diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java b/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java deleted file mode 100644 index 85e5522be77..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/OutgoingAsync.java +++ /dev/null @@ -1,444 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class OutgoingAsync extends ProxyOutgoingAsyncBase -{ - public static OutgoingAsync check(Ice.AsyncResult r, Ice.ObjectPrx prx, String operation) - { - ProxyOutgoingAsyncBase.checkImpl(r, prx, operation); - try - { - return (OutgoingAsync)r; - } - catch(ClassCastException ex) - { - throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method"); - } - } - - public OutgoingAsync(Ice.ObjectPrx prx, String operation, CallbackBase cb) - { - super((Ice.ObjectPrxHelperBase)prx, operation, cb); - _encoding = Protocol.getCompatibleEncoding(_proxy.__reference().getEncoding()); - _is = null; - } - - public OutgoingAsync(Ice.ObjectPrx prx, String operation, CallbackBase cb, Ice.InputStream is, Ice.OutputStream os) - { - super((Ice.ObjectPrxHelperBase)prx, operation, cb, os); - _encoding = Protocol.getCompatibleEncoding(_proxy.__reference().getEncoding()); - _is = is; - } - - public void prepare(String operation, Ice.OperationMode mode, java.util.Map<String, String> ctx, - boolean explicitCtx, boolean synchronous) - { - Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_proxy.__reference().getProtocol())); - - _mode = mode; - _synchronous = synchronous; - - if(explicitCtx && ctx == null) - { - ctx = _emptyContext; - } - _observer = ObserverHelper.get(_proxy, operation, ctx); - - switch(_proxy.__reference().getMode()) - { - case Reference.ModeTwoway: - case Reference.ModeOneway: - case Reference.ModeDatagram: - { - _os.writeBlob(IceInternal.Protocol.requestHdr); - break; - } - - case Reference.ModeBatchOneway: - case Reference.ModeBatchDatagram: - { - _proxy.__getBatchRequestQueue().prepareBatchRequest(_os); - break; - } - } - - Reference ref = _proxy.__reference(); - - ref.getIdentity().__write(_os); - - // - // For compatibility with the old FacetPath. - // - String facet = ref.getFacet(); - if(facet == null || facet.length() == 0) - { - _os.writeStringSeq(null); - } - else - { - String[] facetPath = { facet }; - _os.writeStringSeq(facetPath); - } - - _os.writeString(operation); - - _os.writeByte((byte) mode.value()); - - if(ctx != null) - { - // - // Explicit context - // - Ice.ContextHelper.write(_os, ctx); - } - else - { - // - // Implicit context - // - Ice.ImplicitContextI implicitContext = ref.getInstance().getImplicitContext(); - java.util.Map<String, String> prxContext = ref.getContext(); - - if(implicitContext == null) - { - Ice.ContextHelper.write(_os, prxContext); - } - else - { - implicitContext.write(prxContext, _os); - } - } - } - - @Override - public boolean sent() - { - return sent(!_proxy.ice_isTwoway()); // done = true if not a two-way proxy (no response expected) - } - - @Override - public int invokeRemote(Ice.ConnectionI connection, boolean compress, boolean response) throws RetryException - { - _cachedConnection = connection; - return connection.sendAsyncRequest(this, compress, response, 0); - } - - @Override - public int invokeCollocated(CollocatedRequestHandler handler) - { - // The stream cannot be cached if the proxy is not a twoway or there is an invocation timeout set. - if(!_proxy.ice_isTwoway() || _proxy.__reference().getInvocationTimeout() > 0) - { - // Disable caching by marking the streams as cached! - _state |= StateCachedBuffers; - } - return handler.invokeAsyncRequest(this, 0, _synchronous); - } - - @Override - public void abort(Ice.Exception ex) - { - int mode = _proxy.__reference().getMode(); - if(mode == Reference.ModeBatchOneway || mode == Reference.ModeBatchDatagram) - { - // - // If we didn't finish a batch oneway or datagram request, we - // must notify the connection about that we give up ownership - // of the batch stream. - // - _proxy.__getBatchRequestQueue().abortBatchRequest(_os); - } - - super.abort(ex); - } - - public void invoke() - { - int mode = _proxy.__reference().getMode(); - if(mode == Reference.ModeBatchOneway || mode == Reference.ModeBatchDatagram) - { - // - // NOTE: we don't call sent/completed callbacks for batch AMI requests - // - _sentSynchronously = true; - _proxy.__getBatchRequestQueue().finishBatchRequest(_os, _proxy, getOperation()); - finished(true); - } - else - { - // - // NOTE: invokeImpl doesn't throw so this can be called from the - // try block with the catch block calling abort() in case of an - // exception. - // - invokeImpl(true); // userThread = true - } - } - - @Override - public final boolean completed(Ice.InputStream is) - { - // - // NOTE: this method is called from ConnectionI.parseMessage - // with the connection locked. Therefore, it must not invoke - // any user callbacks. - // - - assert(_proxy.ice_isTwoway()); // Can only be called for twoways. - - if(_childObserver != null) - { - _childObserver.reply(is.size() - Protocol.headerSize - 4); - _childObserver.detach(); - _childObserver = null; - } - - byte replyStatus; - try - { - // _is can already be initialized if the invocation is retried - if(_is == null) - { - _is = new Ice.InputStream(_instance, IceInternal.Protocol.currentProtocolEncoding); - } - _is.swap(is); - replyStatus = _is.readByte(); - - switch(replyStatus) - { - case ReplyStatus.replyOK: - { - break; - } - - case ReplyStatus.replyUserException: - { - if(_observer != null) - { - _observer.userException(); - } - break; - } - - case ReplyStatus.replyObjectNotExist: - case ReplyStatus.replyFacetNotExist: - case ReplyStatus.replyOperationNotExist: - { - Ice.Identity id = new Ice.Identity(); - id.__read(_is); - - // - // For compatibility with the old FacetPath. - // - String[] facetPath = _is.readStringSeq(); - String facet; - if(facetPath.length > 0) - { - if(facetPath.length > 1) - { - throw new Ice.MarshalException(); - } - facet = facetPath[0]; - } - else - { - facet = ""; - } - - String operation = _is.readString(); - - Ice.RequestFailedException ex = null; - switch(replyStatus) - { - case ReplyStatus.replyObjectNotExist: - { - ex = new Ice.ObjectNotExistException(); - break; - } - - case ReplyStatus.replyFacetNotExist: - { - ex = new Ice.FacetNotExistException(); - break; - } - - case ReplyStatus.replyOperationNotExist: - { - ex = new Ice.OperationNotExistException(); - break; - } - - default: - { - assert(false); - break; - } - } - - ex.id = id; - ex.facet = facet; - ex.operation = operation; - throw ex; - } - - case ReplyStatus.replyUnknownException: - case ReplyStatus.replyUnknownLocalException: - case ReplyStatus.replyUnknownUserException: - { - String unknown = _is.readString(); - - Ice.UnknownException ex = null; - switch(replyStatus) - { - case ReplyStatus.replyUnknownException: - { - ex = new Ice.UnknownException(); - break; - } - - case ReplyStatus.replyUnknownLocalException: - { - ex = new Ice.UnknownLocalException(); - break; - } - - case ReplyStatus.replyUnknownUserException: - { - ex = new Ice.UnknownUserException(); - break; - } - - default: - { - assert(false); - break; - } - } - - ex.unknown = unknown; - throw ex; - } - - default: - { - throw new Ice.UnknownReplyStatusException(); - } - } - - return finished(replyStatus == ReplyStatus.replyOK); - } - catch(Ice.Exception ex) - { - return completed(ex); - } - } - - public Ice.OutputStream startWriteParams(Ice.FormatType format) - { - _os.startEncapsulation(_encoding, format); - return _os; - } - - public void endWriteParams() - { - _os.endEncapsulation(); - } - - public void writeEmptyParams() - { - _os.writeEmptyEncapsulation(_encoding); - } - - public void writeParamEncaps(byte[] encaps) - { - if(encaps == null || encaps.length == 0) - { - _os.writeEmptyEncapsulation(_encoding); - } - else - { - _os.writeEncapsulation(encaps); - } - } - - public Ice.InputStream startReadParams() - { - _is.startEncapsulation(); - return _is; - } - - public void endReadParams() - { - _is.endEncapsulation(); - } - - public void readEmptyParams() - { - _is.skipEmptyEncapsulation(); - } - - public byte[] readParamEncaps() - { - return _is.readEncapsulation(null); - } - - public final void throwUserException() - throws Ice.UserException - { - try - { - _is.startEncapsulation(); - _is.throwException(null); - } - catch(Ice.UserException ex) - { - _is.endEncapsulation(); - throw ex; - } - } - - @Override - public void cacheMessageBuffers() - { - if(_proxy.__reference().getInstance().cacheMessageBuffers() > 0) - { - synchronized(this) - { - if((_state & StateCachedBuffers) > 0) - { - return; - } - _state |= StateCachedBuffers; - } - - if(_is != null) - { - _is.reset(); - } - _os.reset(); - - _proxy.cacheMessageBuffers(_is, _os); - - _is = null; - _os = null; - } - } - - final private Ice.EncodingVersion _encoding; - private Ice.InputStream _is; - - // - // If true this AMI request is being used for a generated synchronous invocation. - // - private boolean _synchronous; - - private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>(); -} diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java b/java/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java deleted file mode 100644 index eb49b24c6f1..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/ProxyFlushBatch.java +++ /dev/null @@ -1,62 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class ProxyFlushBatch extends ProxyOutgoingAsyncBase -{ - public static ProxyFlushBatch check(Ice.AsyncResult r, Ice.ObjectPrx prx, String operation) - { - ProxyOutgoingAsyncBase.checkImpl(r, prx, operation); - try - { - return (ProxyFlushBatch)r; - } - catch(ClassCastException ex) - { - throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method"); - } - } - - public ProxyFlushBatch(Ice.ObjectPrxHelperBase prx, String operation, CallbackBase callback) - { - super(prx, operation, callback); - _observer = ObserverHelper.get(prx, operation); - _batchRequestNum = prx.__getBatchRequestQueue().swap(_os); - } - - @Override - public int invokeRemote(Ice.ConnectionI connection, boolean compress, boolean response) throws RetryException - { - if(_batchRequestNum == 0) - { - return sent() ? AsyncStatus.Sent | AsyncStatus.InvokeSentCallback : AsyncStatus.Sent; - } - _cachedConnection = connection; - return connection.sendAsyncRequest(this, compress, false, _batchRequestNum); - } - - @Override - public int invokeCollocated(CollocatedRequestHandler handler) - { - if(_batchRequestNum == 0) - { - return sent() ? AsyncStatus.Sent | AsyncStatus.InvokeSentCallback : AsyncStatus.Sent; - } - return handler.invokeAsyncRequest(this, _batchRequestNum, false); - } - - public void invoke() - { - Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_proxy.__reference().getProtocol())); - invokeImpl(true); // userThread = true - } - - protected int _batchRequestNum; -} diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java b/java/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java deleted file mode 100644 index f4da8e83e12..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/ProxyGetConnection.java +++ /dev/null @@ -1,65 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class ProxyGetConnection extends ProxyOutgoingAsyncBase -{ - public static ProxyGetConnection check(Ice.AsyncResult r, Ice.ObjectPrx prx, String operation) - { - ProxyOutgoingAsyncBase.checkImpl(r, prx, operation); - try - { - return (ProxyGetConnection)r; - } - catch(ClassCastException ex) - { - throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method"); - } - } - - public ProxyGetConnection(Ice.ObjectPrxHelperBase prx, String operation, CallbackBase cb) - { - super(prx, operation, cb); - _observer = ObserverHelper.get(prx, operation); - } - - @Override - public int invokeRemote(Ice.ConnectionI connection, boolean compress, boolean response) - throws RetryException - { - _cachedConnection = connection; - if(finished(true)) - { - invokeCompletedAsync(); - } - return AsyncStatus.Sent; - } - - @Override - public int invokeCollocated(CollocatedRequestHandler handler) - { - if(finished(true)) - { - invokeCompletedAsync(); - } - return AsyncStatus.Sent; - } - - @Override - public Ice.Connection getConnection() - { - return _cachedConnection; - } - - public void invoke() - { - invokeImpl(true); // userThread = true - } -} diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java b/java/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java deleted file mode 100644 index a38c6c28c7a..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/ProxyOutgoingAsyncBase.java +++ /dev/null @@ -1,318 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -// -// Base class for proxy based invocations. This class handles the -// retry for proxy invocations. It also ensures the child observer is -// correct notified of failures and make sure the retry task is -// correctly canceled when the invocation completes. -// -public abstract class ProxyOutgoingAsyncBase extends OutgoingAsyncBase -{ - public static ProxyOutgoingAsyncBase check(Ice.AsyncResult r, Ice.ObjectPrx prx, String operation) - { - ProxyOutgoingAsyncBase.checkImpl(r, prx, operation); - try - { - return (ProxyOutgoingAsyncBase)r; - } - catch(ClassCastException ex) - { - throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method"); - } - } - - public abstract int invokeRemote(Ice.ConnectionI con, boolean compress, boolean response) throws RetryException; - - public abstract int invokeCollocated(CollocatedRequestHandler handler); - - @Override - public Ice.ObjectPrx getProxy() - { - return _proxy; - } - - @Override - public boolean completed(Ice.Exception exc) - { - if(_childObserver != null) - { - _childObserver.failed(exc.ice_id()); - _childObserver.detach(); - _childObserver = null; - } - - // - // NOTE: at this point, synchronization isn't needed, no other threads should be - // calling on the callback. - // - try - { - // - // It's important to let the retry queue do the retry even if - // the retry interval is 0. This method can be called with the - // connection locked so we can't just retry here. - // - _instance.retryQueue().add(this, handleException(exc)); - return false; - } - catch(Ice.Exception ex) - { - return finished(ex); // No retries, we're done - } - } - - public void retryException(Ice.Exception ex) - { - try - { - // - // It's important to let the retry queue do the retry. This is - // called from the connect request handler and the retry might - // require could end up waiting for the flush of the - // connection to be done. - // - _proxy.__updateRequestHandler(_handler, null); // Clear request handler and always retry. - _instance.retryQueue().add(this, 0); - } - catch(Ice.Exception exc) - { - if(completed(exc)) - { - invokeCompletedAsync(); - } - } - } - - public void retry() - { - invokeImpl(false); - } - - public void cancelable(final CancellationHandler handler) - { - if(_proxy.__reference().getInvocationTimeout() == -2 && _cachedConnection != null) - { - final int timeout = _cachedConnection.timeout(); - if(timeout > 0) - { - _future = _instance.timer().schedule( - new Runnable() - { - @Override - public void run() - { - cancel(new Ice.ConnectionTimeoutException()); - } - }, timeout, java.util.concurrent.TimeUnit.MILLISECONDS); - } - } - super.cancelable(handler); - } - - public void abort(Ice.Exception ex) - { - assert(_childObserver == null); - if(finished(ex)) - { - invokeCompletedAsync(); - } - else if(ex instanceof Ice.CommunicatorDestroyedException) - { - // - // If it's a communicator destroyed exception, don't swallow - // it but instead notify the user thread. Even if no callback - // was provided. - // - throw ex; - } - } - - protected ProxyOutgoingAsyncBase(Ice.ObjectPrxHelperBase prx, String op, CallbackBase delegate) - { - super(prx.ice_getCommunicator(), prx.__reference().getInstance(), op, delegate); - _proxy = prx; - _mode = Ice.OperationMode.Normal; - _cnt = 0; - _sent = false; - } - - protected ProxyOutgoingAsyncBase(Ice.ObjectPrxHelperBase prx, String op, CallbackBase delegate, Ice.OutputStream os) - { - super(prx.ice_getCommunicator(), prx.__reference().getInstance(), op, delegate, os); - _proxy = prx; - _mode = Ice.OperationMode.Normal; - _cnt = 0; - _sent = false; - } - - protected static Ice.AsyncResult checkImpl(Ice.AsyncResult r, Ice.ObjectPrx p, String operation) - { - check(r, operation); - if(r.getProxy() != p) - { - throw new IllegalArgumentException("Proxy for call to end_" + operation + - " does not match proxy that was used to call corresponding " + - "begin_" + operation + " method"); - } - return r; - } - - protected void invokeImpl(boolean userThread) - { - try - { - if(userThread) - { - int invocationTimeout = _proxy.__reference().getInvocationTimeout(); - if(invocationTimeout > 0) - { - _future = _instance.timer().schedule( - new Runnable() - { - @Override - public void run() - { - cancel(new Ice.InvocationTimeoutException()); - } - }, invocationTimeout, java.util.concurrent.TimeUnit.MILLISECONDS); - } - } - else // If not called from the user thread, it's called from the retry queue - { - if(_observer != null) - { - _observer.retried(); - } - } - - while(true) - { - try - { - _sent = false; - _handler = null; - _handler = _proxy.__getRequestHandler(); - int status = _handler.sendAsyncRequest(this); - if((status & AsyncStatus.Sent) > 0) - { - if(userThread) - { - _sentSynchronously = true; - if((status & AsyncStatus.InvokeSentCallback) > 0) - { - invokeSent(); // Call the sent callback from the user thread. - } - } - else - { - if((status & AsyncStatus.InvokeSentCallback) > 0) - { - invokeSentAsync(); // Call the sent callback from a client thread pool thread. - } - } - } - return; // We're done! - } - catch(RetryException ex) - { - _proxy.__updateRequestHandler(_handler, null); // Clear request handler and always retry. - } - catch(Ice.Exception ex) - { - if(_childObserver != null) - { - _childObserver.failed(ex.ice_id()); - _childObserver.detach(); - _childObserver = null; - } - final int interval = handleException(ex); - if(interval > 0) - { - _instance.retryQueue().add(this, interval); - return; - } - else if(_observer != null) - { - _observer.retried(); - } - } - } - } - catch(Ice.Exception ex) - { - // - // If called from the user thread we re-throw, the exception - // will be catch by the caller and abort() will be called. - // - if(userThread) - { - throw ex; - } - else if(finished(ex)) // No retries, we're done - { - invokeCompletedAsync(); - } - } - } - - @Override - protected boolean sent(boolean done) - { - _sent = true; - if(done) - { - if(_future != null) - { - _future.cancel(false); - _future = null; - } - } - return super.sent(done); - } - - @Override - protected boolean finished(Ice.Exception ex) - { - if(_future != null) - { - _future.cancel(false); - _future = null; - } - return super.finished(ex); - } - - @Override - protected boolean finished(boolean ok) - { - if(_future != null) - { - _future.cancel(false); - _future = null; - } - return super.finished(ok); - } - - protected int handleException(Ice.Exception exc) - { - Ice.Holder<Integer> interval = new Ice.Holder<Integer>(); - _cnt = _proxy.__handleException(exc, _handler, _mode, _sent, interval, _cnt); - return interval.value; - } - - final protected Ice.ObjectPrxHelperBase _proxy; - protected RequestHandler _handler; - protected Ice.OperationMode _mode; - - private java.util.concurrent.Future<?> _future; - private int _cnt; - private boolean _sent; -} diff --git a/java/src/Ice/src/main/java/IceInternal/SequencePatcher.java b/java/src/Ice/src/main/java/IceInternal/SequencePatcher.java deleted file mode 100644 index ca11b14d21c..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/SequencePatcher.java +++ /dev/null @@ -1,41 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class SequencePatcher implements Ice.ReadValueCallback -{ - public SequencePatcher(java.lang.Object[] seq, Class<?> cls, int index) - { - _seq = seq; - _cls = cls; - _index = index; - } - - public void valueReady(Ice.Object v) - { - if(v != null) - { - // - // Raise ClassCastException if the element doesn't match the expected type. - // - if(!_cls.isInstance(v)) - { - throw new ClassCastException("expected element of type " + _cls.getName() + " but received " + - v.getClass().getName()); - } - } - - _seq[_index] = v; - } - - private java.lang.Object[] _seq; - private Class<?> _cls; - private int _index; -} diff --git a/java/src/Ice/src/main/java/IceInternal/TwowayCallback.java b/java/src/Ice/src/main/java/IceInternal/TwowayCallback.java deleted file mode 100644 index 713f965d848..00000000000 --- a/java/src/Ice/src/main/java/IceInternal/TwowayCallback.java +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public abstract class TwowayCallback extends CallbackBase implements Ice.TwowayCallback -{ - public void sent(boolean sentSynchronously) - { - } - - @Override - public void exception(Ice.SystemException __ex) - { - exception(new Ice.UnknownException(__ex)); - } - - @Override - public final void __sent(Ice.AsyncResult __result) - { - sent(__result.sentSynchronously()); - } - - @Override - public final boolean __hasSentCallback() - { - return true; - } -} diff --git a/java/src/Ice/src/main/java/IceUtilInternal/Base64.java b/java/src/Ice/src/main/java/IceUtilInternal/Base64.java deleted file mode 100644 index 661a464649e..00000000000 --- a/java/src/Ice/src/main/java/IceUtilInternal/Base64.java +++ /dev/null @@ -1,270 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceUtilInternal; - -public class Base64 -{ - -public static String -encode(byte[] plainSeq) -{ - if(plainSeq == null || plainSeq.length == 0) - { - return ""; - } - - int base64Bytes = (((plainSeq.length * 4) / 3) + 1); - int newlineBytes = (((base64Bytes * 2) / 76) + 1); - int totalBytes = base64Bytes + newlineBytes; - - StringBuilder retval = new StringBuilder(totalBytes); - - int by1; - int by2; - int by3; - int by4; - int by5; - int by6; - int by7; - - for(int i = 0; i < plainSeq.length; i += 3) - { - by1 = plainSeq[i] & 0xff; - by2 = 0; - by3 = 0; - - if((i + 1) < plainSeq.length) - { - by2 = plainSeq[i+1] & 0xff; - } - - if((i + 2) < plainSeq.length) - { - by3 = plainSeq[i+2] & 0xff; - } - - by4 = (by1 >> 2) & 0xff; - by5 = (((by1 & 0x3) << 4) | (by2 >> 4)) & 0xff; - by6 = (((by2 & 0xf) << 2) | (by3 >> 6)) & 0xff; - by7 = by3 & 0x3f; - - retval.append(encode((byte)by4)); - retval.append(encode((byte)by5)); - - if((i + 1) < plainSeq.length) - { - retval.append(encode((byte)by6)); - } - else - { - retval.append('='); - } - - if((i + 2) < plainSeq.length) - { - retval.append(encode((byte)by7)); - } - else - { - retval.append('='); - } - } - - StringBuilder outString = new StringBuilder(totalBytes); - int iter = 0; - - while((retval.length() - iter) > 76) - { - outString.append(retval.substring(iter, iter + 76)); - outString.append("\r\n"); - iter += 76; - } - - outString.append(retval.substring(iter)); - - return outString.toString(); -} - -public static byte[] -decode(String str) -{ - StringBuilder newStr = new StringBuilder(str.length()); - - for(int j = 0; j < str.length(); j++) - { - char c = str.charAt(j); - if(isBase64(c)) - { - newStr.append(c); - } - } - - if(newStr.length() == 0) - { - return null; - } - - // Note: This is how we were previously computing the size of the return - // sequence. The method below is more efficient (and correct). - // size_t lines = str.size() / 78; - // size_t totalBytes = (lines * 76) + (((str.size() - (lines * 78)) * 3) / 4); - - // Figure out how long the final sequence is going to be. - int totalBytes = (newStr.length() * 3 / 4) + 1; - - java.nio.ByteBuffer retval = java.nio.ByteBuffer.allocate(totalBytes); - - int by1; - int by2; - int by3; - int by4; - - char c1, c2, c3, c4; - - int pos = 0; - for(int i = 0; i < newStr.length(); i += 4) - { - c1 = 'A'; - c2 = 'A'; - c3 = 'A'; - c4 = 'A'; - - c1 = newStr.charAt(i); - - if((i + 1) < newStr.length()) - { - c2 = newStr.charAt(i + 1); - } - - if((i + 2) < newStr.length()) - { - c3 = newStr.charAt(i + 2); - } - - if((i + 3) < newStr.length()) - { - c4 = newStr.charAt(i + 3); - } - - by1 = decode(c1) & 0xff; - by2 = decode(c2) & 0xff; - by3 = decode(c3) & 0xff; - by4 = decode(c4) & 0xff; - - retval.put((byte)((by1 << 2) | (by2 >> 4))); - ++pos; - - if(c3 != '=') - { - retval.put((byte)(((by2 & 0xf) << 4) | (by3 >> 2))); - ++pos; - } - - if(c4 != '=') - { - retval.put((byte)(((by3 & 0x3) << 6) | by4)); - ++pos; - } - } - - byte[] arr = new byte[pos]; - System.arraycopy(retval.array(), 0, arr, 0, pos); - return arr; -} - -public static boolean -isBase64(char c) -{ - if(c >= 'A' && c <= 'Z') - { - return true; - } - - if(c >= 'a' && c <= 'z') - { - return true; - } - - if(c >= '0' && c <= '9') - { - return true; - } - - if(c == '+') - { - return true; - } - - if(c == '/') - { - return true; - } - - if(c == '=') - { - return true; - } - - return false; -} - -private static char -encode(byte uc) -{ - if(uc < 26) - { - return (char)('A' + uc); - } - - if(uc < 52) - { - return (char)('a' + (uc - 26)); - } - - if(uc < 62) - { - return (char)('0' + (uc - 52)); - } - - if(uc == 62) - { - return '+'; - } - - return '/'; -} - -private static byte -decode(char c) -{ - if(c >= 'A' && c <= 'Z') - { - return (byte)(c - 'A'); - } - - if(c >= 'a' && c <= 'z') - { - return (byte)(c - 'a' + 26); - } - - if(c >= '0' && c <= '9') - { - return (byte)(c - '0' + 52); - } - - if(c == '+') - { - return 62; - } - - return 63; -} - -} diff --git a/java/src/Ice/src/main/java/Ice/Application.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Application.java index 3562445becb..ed74d65161e 100644 --- a/java/src/Ice/src/main/java/Ice/Application.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Application.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Utility base class that makes it easy to correctly initialize and finalize @@ -106,12 +106,12 @@ public abstract class Application } catch(LocalException ex) { - Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex)); return 1; } catch(java.lang.Exception ex) { - Util.getProcessLogger().error("unknown exception: " + IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex)); return 1; } } @@ -165,19 +165,21 @@ public abstract class Application { initData = new InitializationData(); } - StringSeqHolder argHolder = new StringSeqHolder(args); + + Util.CreatePropertiesResult cpr = null; try { - initData.properties = Util.createProperties(argHolder, initData.properties); + cpr = Util.createProperties(args, initData.properties); + initData.properties = cpr.properties; } catch(LocalException ex) { - Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex)); return 1; } catch(java.lang.Exception ex) { - Util.getProcessLogger().error("unknown exception: " + IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex)); return 1; } _appName = initData.properties.getPropertyWithDefault("Ice.ProgramName", _appName); @@ -191,17 +193,18 @@ public abstract class Application Util.setProcessLogger(new LoggerI(initData.properties.getProperty("Ice.ProgramName"), "")); } - return doMain(argHolder, initData); + return doMain(cpr.args, initData); } - protected int - doMain(StringSeqHolder argHolder, Ice.InitializationData initData) + protected int doMain(String[] args, InitializationData initData) { int status = 0; try { - _communicator = Util.initialize(argHolder, initData); + Util.InitializeResult ir = Util.initialize(args, initData); + + _communicator = ir.communicator; // // The default is to destroy when a signal is received. @@ -211,16 +214,16 @@ public abstract class Application destroyOnInterrupt(); } - status = run(argHolder.value); + status = run(ir.args); } catch(LocalException ex) { - Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex)); status = 1; } catch(java.lang.Exception ex) { - Util.getProcessLogger().error("unknown exception: " + IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex)); status = 1; } catch(java.lang.Error err) @@ -228,7 +231,7 @@ public abstract class Application // // We catch Error to avoid hangs in some non-fatal situations // - Util.getProcessLogger().error("Java error: " + IceInternal.Ex.toString(err)); + Util.getProcessLogger().error("Java error: " + com.zeroc.IceInternal.Ex.toString(err)); status = 1; } @@ -280,9 +283,9 @@ public abstract class Application { _communicator.destroy(); } - catch(Ice.OperationInterruptedException ex) + catch(OperationInterruptedException ex) { - Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex)); // Retry communicator destroy in case of an operation // interrupt exception, but don't do so in a loop // otherwise it could go on forever. @@ -291,12 +294,12 @@ public abstract class Application } catch(LocalException ex) { - Util.getProcessLogger().error(IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error(com.zeroc.IceInternal.Ex.toString(ex)); status = 1; } catch(java.lang.Exception ex) { - Util.getProcessLogger().error("unknown exception: " + IceInternal.Ex.toString(ex)); + Util.getProcessLogger().error("unknown exception: " + com.zeroc.IceInternal.Ex.toString(ex)); status = 1; } _communicator = null; diff --git a/java/src/Ice/src/main/java/Ice/AsyncResult.java b/java/src/Ice/src/main/java/com/zeroc/Ice/AsyncResult.java index f62006ecc43..1e336c7dbac 100644 --- a/java/src/Ice/src/main/java/Ice/AsyncResult.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/AsyncResult.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * An AsyncResult object is the return value of an asynchronous invocation. diff --git a/java/src/Ice/src/main/java/Ice/BatchRequest.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequest.java index c18b6da917a..b3687efa9f2 100644 --- a/java/src/Ice/src/main/java/Ice/BatchRequest.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequest.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public interface BatchRequest { @@ -29,5 +29,5 @@ public interface BatchRequest /** * The proxy used to invoke the batch request. **/ - Ice.ObjectPrx getProxy(); + ObjectPrx getProxy(); }; diff --git a/java/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java index 148225cbd21..2f03d6b65e6 100644 --- a/java/src/Ice/src/main/java/Ice/BatchRequestInterceptor.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BatchRequestInterceptor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Base interface for listening to batch request queues. @@ -24,5 +24,5 @@ public interface BatchRequestInterceptor * raise an Ice local exception to notify the caller of a failure. * **/ - void enqueue(Ice.BatchRequest request, int queueBatchRequestCount, int queueBatchRequestSize); + void enqueue(BatchRequest request, int queueBatchRequestCount, int queueBatchRequestSize); } diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java new file mode 100644 index 00000000000..4c802bb977f --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Blobject.java @@ -0,0 +1,48 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +import java.util.concurrent.CompletionStage; + +/** + * Base class for dynamic dispatch servants. A server application + * derives a concrete servant class from <code>Blobject</code> that + * implements the {@link Blobject#ice_invoke} method. + **/ +public interface Blobject extends com.zeroc.Ice.Object +{ + /** + * Dispatch an incoming request. + * + * @param inEncaps The encoded in-parameters for the operation. + * @param outEncaps The encoded out-paramaters and return value + * for the operation. The return value follows any out-parameters. + * @param current The Current object to pass to the operation. + * @return The method returns an instance of <code>Ice_invokeResult</code>. + * If the operation completed successfully, set the <code>returnValue</code> + * member to <code>true</code> and the <code>outParams</code> member to + * the encoded results. If the operation raises a user exception, you can + * either throw it directly or set the <code>returnValue</code> member to + * <code>false</code> and the <code>outParams</code> member to the encoded + * user exception. If the operation raises an Ice run-time exception, it + * must throw it directly. + **/ + com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(byte[] inEncaps, Current current) + throws UserException; + + @Override + default CompletionStage<OutputStream> __dispatch(com.zeroc.IceInternal.Incoming in, Current current) + throws UserException + { + byte[] inEncaps = in.readParamEncaps(); + com.zeroc.Ice.Object.Ice_invokeResult r = ice_invoke(inEncaps, current); + return in.setResult(in.writeParamEncaps(r.outParams, r.returnValue)); + } +} diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java b/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java new file mode 100644 index 00000000000..f0edc5442fe --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/BlobjectAsync.java @@ -0,0 +1,66 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CompletableFuture; + +/** + * <code>BlobjectAsync</code> is the base class for asynchronous dynamic + * dispatch servants. A server application derives a concrete servant + * class that implements the {@link BlobjectAsync#ice_invoke_async} method, + * which is called by the Ice run time to deliver every request on this + * object. + **/ +public interface BlobjectAsync extends com.zeroc.Ice.Object +{ + /** + * Dispatch an incoming request. + * + * @param inEncaps The encoded input parameters. + * @param response Accepts the invocation's results on success. + * @param exception Accepts an exception on failure. User exceptions must be sent via + * <code>response</code>. + * @param current The Current object, which provides important information + * about the request, such as the identity of the target object and the + * name of the operation. + * @return A completion stage that eventually completes with the result of + * the invocation, an instance of <code>Ice_invokeResult</code>. + * If the operation completed successfully, set the <code>returnValue</code> + * member to <code>true</code> and the <code>outParams</code> member to + * the encoded results. If the operation raises a user exception, you can + * throw it directly from <code>ice_invokeAsync</code>, or complete the + * future by setting the <code>returnValue</code> member to + * <code>false</code> and the <code>outParams</code> member to the encoded + * user exception. + **/ + CompletionStage<Object.Ice_invokeResult> ice_invokeAsync(byte[] inEncaps, Current current) + throws UserException; + + @Override + default CompletionStage<OutputStream> __dispatch(com.zeroc.IceInternal.Incoming in, Current current) + throws UserException + { + byte[] inEncaps = in.readParamEncaps(); + CompletableFuture<OutputStream> f = new CompletableFuture<>(); + ice_invokeAsync(inEncaps, current).whenComplete((result, ex) -> + { + if(ex != null) + { + f.completeExceptionally(ex); + } + else + { + f.complete(in.writeParamEncaps(result.outParams, result.returnValue)); + } + }); + return f; + } +} diff --git a/java/src/Ice/src/main/java/Ice/ClassResolver.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java index 87be1d49ce3..31cac6b2955 100644 --- a/java/src/Ice/src/main/java/Ice/ClassResolver.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ClassResolver.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * diff --git a/java/src/Ice/src/main/java/Ice/CommunicatorI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/CommunicatorI.java index 1713b0dc05e..64ff934f6d4 100644 --- a/java/src/Ice/src/main/java/Ice/CommunicatorI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/CommunicatorI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public final class CommunicatorI implements Communicator { @@ -40,7 +40,7 @@ public final class CommunicatorI implements Communicator } @Override - public Ice.ObjectPrx + public ObjectPrx stringToProxy(String s) { return _instance.proxyFactory().stringToProxy(s); @@ -48,13 +48,13 @@ public final class CommunicatorI implements Communicator @Override public String - proxyToString(Ice.ObjectPrx proxy) + proxyToString(ObjectPrx proxy) { return _instance.proxyFactory().proxyToString(proxy); } @Override - public Ice.ObjectPrx + public ObjectPrx propertyToProxy(String s) { return _instance.proxyFactory().propertyToProxy(s); @@ -62,23 +62,23 @@ public final class CommunicatorI implements Communicator @Override public java.util.Map<String, String> - proxyToProperty(Ice.ObjectPrx proxy, String prefix) + proxyToProperty(ObjectPrx proxy, String prefix) { return _instance.proxyFactory().proxyToProperty(proxy, prefix); } - @Override - public Ice.Identity + @Override @SuppressWarnings("deprecation") + public Identity stringToIdentity(String s) { - return Ice.Util.stringToIdentity(s); + return Util.stringToIdentity(s); } - @Override + @Override @SuppressWarnings("deprecation") public String - identityToString(Ice.Identity ident) + identityToString(Identity ident) { - return Ice.Util.identityToString(ident); + return Util.identityToString(ident); } @Override @@ -155,7 +155,7 @@ public final class CommunicatorI implements Communicator } @Override - public Ice.Instrumentation.CommunicatorObserver + public com.zeroc.Ice.Instrumentation.CommunicatorObserver getObserver() { return _instance.initializationData().observer; @@ -204,96 +204,41 @@ public final class CommunicatorI implements Communicator } @Override - public void - flushBatchRequests() + public void flushBatchRequests() { - end_flushBatchRequests(begin_flushBatchRequests()); + __flushBatchRequestsAsync().__wait(); } @Override - public AsyncResult - begin_flushBatchRequests() + public java.util.concurrent.CompletableFuture<Void> flushBatchRequestsAsync() { - return begin_flushBatchRequestsInternal(null); + return __flushBatchRequestsAsync(); } - @Override - public AsyncResult - begin_flushBatchRequests(Callback cb) + public com.zeroc.IceInternal.CommunicatorFlushBatch __flushBatchRequestsAsync() { - return begin_flushBatchRequestsInternal(cb); - } - - @Override - public AsyncResult - begin_flushBatchRequests(Callback_Communicator_flushBatchRequests cb) - { - return begin_flushBatchRequestsInternal(cb); - } - - @Override - public AsyncResult - begin_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_flushBatchRequestsInternal( - new IceInternal.Functional_CallbackBase(false, __exceptionCb, __sentCb) - { - @Override - public final void __completed(AsyncResult __result) - { - try - { - __result.getCommunicator().end_flushBatchRequests(__result); - } - catch(Exception __ex) - { - __exceptionCb.apply(__ex); - } - } - }); - } - - private static final String __flushBatchRequests_name = "flushBatchRequests"; - - private Ice.AsyncResult - begin_flushBatchRequestsInternal(IceInternal.CallbackBase cb) - { - IceInternal.OutgoingConnectionFactory connectionFactory = _instance.outgoingConnectionFactory(); - IceInternal.ObjectAdapterFactory adapterFactory = _instance.objectAdapterFactory(); + com.zeroc.IceInternal.OutgoingConnectionFactory connectionFactory = _instance.outgoingConnectionFactory(); + com.zeroc.IceInternal.ObjectAdapterFactory adapterFactory = _instance.objectAdapterFactory(); // // This callback object receives the results of all invocations // of Connection.begin_flushBatchRequests. // - IceInternal.CommunicatorFlushBatch result = new IceInternal.CommunicatorFlushBatch(this, - _instance, - __flushBatchRequests_name, - cb); + com.zeroc.IceInternal.CommunicatorFlushBatch __f = + new com.zeroc.IceInternal.CommunicatorFlushBatch(this, _instance); - connectionFactory.flushAsyncBatchRequests(result); - adapterFactory.flushAsyncBatchRequests(result); + connectionFactory.flushAsyncBatchRequests(__f); + adapterFactory.flushAsyncBatchRequests(__f); // // Inform the callback that we have finished initiating all of the // flush requests. // - result.ready(); - - return result; - } + __f.ready(); - @Override - public void - end_flushBatchRequests(AsyncResult r) - { - IceInternal.CommunicatorFlushBatch ri = - IceInternal.CommunicatorFlushBatch.check(r, this, __flushBatchRequests_name); - ri.__wait(); + return __f; } - @Override public ObjectPrx createAdmin(ObjectAdapter adminAdapter, Identity adminId) @@ -330,7 +275,7 @@ public final class CommunicatorI implements Communicator } @Override - public java.util.Map<String, Ice.Object> + public java.util.Map<String, com.zeroc.Ice.Object> findAllAdminFacets() { return _instance.findAllAdminFacets(); @@ -338,7 +283,7 @@ public final class CommunicatorI implements Communicator CommunicatorI(InitializationData initData) { - _instance = new IceInternal.Instance(this, initData); + _instance = new com.zeroc.IceInternal.Instance(this, initData); } /** @@ -362,12 +307,11 @@ public final class CommunicatorI implements Communicator // Certain initialization tasks need to be completed after the // constructor. // - void - finishSetup(StringSeqHolder args) + String[] finishSetup(String[] args) { try { - _instance.finishSetup(args, this); + return _instance.finishSetup(args, this); } catch(RuntimeException ex) { @@ -377,13 +321,13 @@ public final class CommunicatorI implements Communicator } // - // For use by IceInternal.Util.getInstance() + // For use by com.zeroc.IceInternal.Util.getInstance() // - public IceInternal.Instance + public com.zeroc.IceInternal.Instance getInstance() { return _instance; } - private IceInternal.Instance _instance; + private com.zeroc.IceInternal.Instance _instance; } diff --git a/java/src/Ice/src/main/java/Ice/CompactIdResolver.java b/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java index d959ab38904..a6af91cc5af 100644 --- a/java/src/Ice/src/main/java/Ice/CompactIdResolver.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/CompactIdResolver.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Applications that make use of compact type IDs to conserve space diff --git a/java/src/Ice/src/main/java/Ice/ConnectionI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java index cac2a6fb3d2..d2b85c58782 100644 --- a/java/src/Ice/src/main/java/Ice/ConnectionI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ConnectionI.java @@ -7,18 +7,28 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; import java.util.concurrent.Callable; -public final class ConnectionI extends IceInternal.EventHandler - implements Connection, IceInternal.ResponseHandler, IceInternal.CancellationHandler +import com.zeroc.IceInternal.AsyncStatus; +import com.zeroc.IceInternal.Buffer; +import com.zeroc.IceInternal.Incoming; +import com.zeroc.IceInternal.OutgoingAsyncBase; +import com.zeroc.IceInternal.Protocol; +import com.zeroc.IceInternal.SocketOperation; +import com.zeroc.IceInternal.Time; +import com.zeroc.IceInternal.TraceUtil; +import com.zeroc.Ice.Instrumentation.ConnectionState; + +public final class ConnectionI extends com.zeroc.IceInternal.EventHandler + implements Connection, com.zeroc.IceInternal.ResponseHandler, com.zeroc.IceInternal.CancellationHandler { public interface StartCallback { void connectionStartCompleted(ConnectionI connection); - void connectionStartFailed(ConnectionI connection, Ice.LocalException ex); + void connectionStartFailed(ConnectionI connection, LocalException ex); } private class TimeoutCallback implements Runnable @@ -41,10 +51,10 @@ public final class ConnectionI extends IceInternal.EventHandler if(_state >= StateClosed) { assert (_exception != null); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } - if(!initialize(IceInternal.SocketOperation.None) || !validate(IceInternal.SocketOperation.None)) + if(!initialize(SocketOperation.None) || !validate(SocketOperation.None)) { _startCallback = callback; return; @@ -56,7 +66,7 @@ public final class ConnectionI extends IceInternal.EventHandler setState(StateHolding); } } - catch(Ice.LocalException ex) + catch(LocalException ex) { exception(ex); callback.connectionStartFailed(this, _exception); @@ -77,10 +87,10 @@ public final class ConnectionI extends IceInternal.EventHandler if(_state >= StateClosed) { assert (_exception != null); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } - if(!initialize(IceInternal.SocketOperation.None) || !validate(IceInternal.SocketOperation.None)) + if(!initialize(SocketOperation.None) || !validate(SocketOperation.None)) { while(_state <= StateNotValidated) { @@ -90,7 +100,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_state >= StateClosing) { assert (_exception != null); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } } @@ -100,7 +110,7 @@ public final class ConnectionI extends IceInternal.EventHandler setState(StateHolding); } } - catch(Ice.LocalException ex) + catch(LocalException ex) { exception(ex); waitUntilFinished(); @@ -116,7 +126,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_acmLastActivity > 0) { - _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis(); + _acmLastActivity = Time.currentMonotonicTimeMillis(); } setState(StateActive); @@ -159,7 +169,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } if(force) @@ -183,7 +193,7 @@ public final class ConnectionI extends IceInternal.EventHandler } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } } @@ -212,7 +222,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_exception != null) { assert (_state >= StateClosing); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } } @@ -268,7 +278,7 @@ public final class ConnectionI extends IceInternal.EventHandler } } - synchronized public void monitor(long now, IceInternal.ACMConfig acm) + synchronized public void monitor(long now, com.zeroc.IceInternal.ACMConfig acm) { if(_state != StateActive) { @@ -298,7 +308,7 @@ public final class ConnectionI extends IceInternal.EventHandler } } - if(_readStream.size() > IceInternal.Protocol.headerSize || !_writeStream.isEmpty()) + if(_readStream.size() > Protocol.headerSize || !_writeStream.isEmpty()) { // // If writing or reading, nothing to do, the connection @@ -332,8 +342,9 @@ public final class ConnectionI extends IceInternal.EventHandler } synchronized public int - sendAsyncRequest(IceInternal.OutgoingAsyncBase out, boolean compress, boolean response, int batchRequestNum) - throws IceInternal.RetryException + sendAsyncRequest(OutgoingAsyncBase out, boolean compress, boolean response, + int batchRequestNum) + throws com.zeroc.IceInternal.RetryException { final OutputStream os = out.getOs(); @@ -344,7 +355,7 @@ public final class ConnectionI extends IceInternal.EventHandler // to send our request, we always try to send the request // again. // - throw new IceInternal.RetryException((Ice.LocalException) _exception.fillInStackTrace()); + throw new com.zeroc.IceInternal.RetryException((LocalException) _exception.fillInStackTrace()); } assert (_state > StateNotValidated); @@ -378,12 +389,12 @@ public final class ConnectionI extends IceInternal.EventHandler // // Fill in the request ID. // - os.pos(IceInternal.Protocol.headerSize); + os.pos(Protocol.headerSize); os.writeInt(requestId); } else if(batchRequestNum > 0) { - os.pos(IceInternal.Protocol.headerSize); + os.pos(Protocol.headerSize); os.writeInt(batchRequestNum); } @@ -394,11 +405,11 @@ public final class ConnectionI extends IceInternal.EventHandler { status = sendMessage(new OutgoingMessage(out, os, compress, requestId)); } - catch(Ice.LocalException ex) + catch(LocalException ex) { setState(StateClosed, ex); assert (_exception != null); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } if(response) @@ -411,7 +422,7 @@ public final class ConnectionI extends IceInternal.EventHandler return status; } - public IceInternal.BatchRequestQueue + public com.zeroc.IceInternal.BatchRequestQueue getBatchRequestQueue() { return _batchRequestQueue; @@ -420,65 +431,16 @@ public final class ConnectionI extends IceInternal.EventHandler @Override public void flushBatchRequests() { - end_flushBatchRequests(begin_flushBatchRequests()); - } - - private static final String __flushBatchRequests_name = "flushBatchRequests"; - - @Override - public Ice.AsyncResult begin_flushBatchRequests() - { - return begin_flushBatchRequestsInternal(null); + ObjectPrx.__waitForCompletion(flushBatchRequestsAsync()); } @Override - public Ice.AsyncResult begin_flushBatchRequests(Callback cb) - { - return begin_flushBatchRequestsInternal(cb); - } - - @Override - public Ice.AsyncResult begin_flushBatchRequests(Callback_Connection_flushBatchRequests cb) - { - return begin_flushBatchRequestsInternal(cb); - } - - @Override - public AsyncResult begin_flushBatchRequests(IceInternal.Functional_VoidCallback __responseCb, - IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, - IceInternal.Functional_BoolCallback __sentCb) - { - return begin_flushBatchRequestsInternal(new IceInternal.Functional_CallbackBase(false, __exceptionCb, __sentCb) - { - @Override - public final void __completed(AsyncResult __result) - { - try - { - __result.getConnection().end_flushBatchRequests(__result); - } - catch(Exception __ex) - { - __exceptionCb.apply(__ex); - } - } - }); - } - - private Ice.AsyncResult begin_flushBatchRequestsInternal(IceInternal.CallbackBase cb) + public java.util.concurrent.CompletableFuture<Void> flushBatchRequestsAsync() { - IceInternal.ConnectionFlushBatch result = - new IceInternal.ConnectionFlushBatch(this, _communicator, _instance, __flushBatchRequests_name, cb); - result.invoke(); - return result; - } - - @Override - public void end_flushBatchRequests(AsyncResult ir) - { - IceInternal.ConnectionFlushBatch r = - IceInternal.ConnectionFlushBatch.check(ir, this, __flushBatchRequests_name); - r.__wait(); + com.zeroc.IceInternal.ConnectionFlushBatch __f = + new com.zeroc.IceInternal.ConnectionFlushBatch(this, _communicator, _instance); + __f.invoke(); + return __f; } @Override @@ -488,7 +450,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(callback != null) { - _threadPool.dispatch(new IceInternal.DispatchWorkItem(this) + _threadPool.dispatch(new com.zeroc.IceInternal.DispatchWorkItem(this) { @Override public void run() @@ -518,8 +480,8 @@ public final class ConnectionI extends IceInternal.EventHandler } @Override - synchronized public void setACM(Ice.IntOptional timeout, Ice.Optional<ACMClose> close, - Ice.Optional<ACMHeartbeat> heartbeat) + synchronized public void setACM(java.util.OptionalInt timeout, java.util.Optional<ACMClose> close, + java.util.Optional<ACMHeartbeat> heartbeat) { if(_monitor == null || _state >= StateClosed) { @@ -538,7 +500,7 @@ public final class ConnectionI extends IceInternal.EventHandler } else if(_state == StateActive && _acmLastActivity == -1) { - _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis(); + _acmLastActivity = Time.currentMonotonicTimeMillis(); } if(_state == StateActive) @@ -548,13 +510,13 @@ public final class ConnectionI extends IceInternal.EventHandler } @Override - synchronized public Ice.ACM getACM() + synchronized public ACM getACM() { return _monitor != null ? _monitor.getACM() : new ACM(0, ACMClose.CloseOff, ACMHeartbeat.HeartbeatOff); } @Override - synchronized public void asyncRequestCanceled(IceInternal.OutgoingAsyncBase outAsync, Ice.LocalException ex) + synchronized public void asyncRequestCanceled(OutgoingAsyncBase outAsync, LocalException ex) { if(_state >= StateClosed) { @@ -600,10 +562,10 @@ public final class ConnectionI extends IceInternal.EventHandler } } - if(outAsync instanceof IceInternal.OutgoingAsync) + if(outAsync instanceof com.zeroc.IceInternal.OutgoingAsync) { - IceInternal.OutgoingAsync o = (IceInternal.OutgoingAsync) outAsync; - java.util.Iterator<IceInternal.OutgoingAsyncBase> it2 = _asyncRequests.values().iterator(); + com.zeroc.IceInternal.OutgoingAsync o = (com.zeroc.IceInternal.OutgoingAsync) outAsync; + java.util.Iterator<OutgoingAsyncBase> it2 = _asyncRequests.values().iterator(); while(it2.hasNext()) { if(it2.next() == o) @@ -645,7 +607,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_state >= StateClosed) { assert (_exception != null); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } sendMessage(new OutgoingMessage(os, compressFlag != 0, true)); @@ -679,7 +641,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_state >= StateClosed) { assert (_exception != null); - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } if(_state == StateClosing && _dispatchCount == 0) @@ -694,7 +656,7 @@ public final class ConnectionI extends IceInternal.EventHandler } @Override - public boolean systemException(int requestId, Ice.SystemException ex, boolean amd) + public boolean systemException(int requestId, SystemException ex, boolean amd) { return false; // System exceptions aren't marshalled. } @@ -726,13 +688,13 @@ public final class ConnectionI extends IceInternal.EventHandler } } - public IceInternal.EndpointI endpoint() + public com.zeroc.IceInternal.EndpointI endpoint() { return _endpoint; // No mutex protection necessary, _endpoint is // immutable. } - public IceInternal.Connector connector() + public com.zeroc.IceInternal.Connector connector() { return _connector; // No mutex protection necessary, _connector is // immutable. @@ -795,7 +757,7 @@ public final class ConnectionI extends IceInternal.EventHandler // Operations from EventHandler // @Override - public void message(IceInternal.ThreadPoolCurrent current) + public void message(com.zeroc.IceInternal.ThreadPoolCurrent current) { StartCallback startCB = null; java.util.List<OutgoingMessage> sentCBs = null; @@ -819,33 +781,33 @@ public final class ConnectionI extends IceInternal.EventHandler { unscheduleTimeout(current.operation); - int writeOp = IceInternal.SocketOperation.None; - int readOp = IceInternal.SocketOperation.None; + int writeOp = SocketOperation.None; + int readOp = SocketOperation.None; - if((readyOp & IceInternal.SocketOperation.Write) != 0) + if((readyOp & SocketOperation.Write) != 0) { - final IceInternal.Buffer buf = _writeStream.getBuffer(); + final Buffer buf = _writeStream.getBuffer(); if(_observer != null) { observerStartWrite(buf); } writeOp = write(buf); - if(_observer != null && (writeOp & IceInternal.SocketOperation.Write) == 0) + if(_observer != null && (writeOp & SocketOperation.Write) == 0) { observerFinishWrite(buf); } } - while((readyOp & IceInternal.SocketOperation.Read) != 0) + while((readyOp & SocketOperation.Read) != 0) { - final IceInternal.Buffer buf = _readStream.getBuffer(); + final Buffer buf = _readStream.getBuffer(); if(_observer != null && !_readHeader) { observerStartRead(buf); } readOp = read(buf); - if((readOp & IceInternal.SocketOperation.Read) != 0) + if((readOp & SocketOperation.Read) != 0) { break; } @@ -861,16 +823,16 @@ public final class ConnectionI extends IceInternal.EventHandler if(_observer != null) { - _observer.receivedBytes(IceInternal.Protocol.headerSize); + _observer.receivedBytes(Protocol.headerSize); } int pos = _readStream.pos(); - if(pos < IceInternal.Protocol.headerSize) + if(pos < Protocol.headerSize) { // // This situation is possible for small UDP packets. // - throw new Ice.IllegalMessageSizeException(); + throw new IllegalMessageSizeException(); } _readStream.pos(0); @@ -879,30 +841,32 @@ public final class ConnectionI extends IceInternal.EventHandler m[1] = _readStream.readByte(); m[2] = _readStream.readByte(); m[3] = _readStream.readByte(); - if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] || - m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3]) + if(m[0] != Protocol.magic[0] || + m[1] != Protocol.magic[1] || + m[2] != Protocol.magic[2] || + m[3] != Protocol.magic[3]) { - Ice.BadMagicException ex = new Ice.BadMagicException(); + BadMagicException ex = new BadMagicException(); ex.badMagic = m; throw ex; } - _readProtocol.__read(_readStream); - IceInternal.Protocol.checkSupportedProtocol(_readProtocol); + _readProtocol.ice_read(_readStream); + Protocol.checkSupportedProtocol(_readProtocol); - _readProtocolEncoding.__read(_readStream); - IceInternal.Protocol.checkSupportedProtocolEncoding(_readProtocolEncoding); + _readProtocolEncoding.ice_read(_readStream); + Protocol.checkSupportedProtocolEncoding(_readProtocolEncoding); _readStream.readByte(); // messageType _readStream.readByte(); // compress int size = _readStream.readInt(); - if(size < IceInternal.Protocol.headerSize) + if(size < Protocol.headerSize) { - throw new Ice.IllegalMessageSizeException(); + throw new IllegalMessageSizeException(); } if(size > _messageSizeMax) { - IceInternal.Ex.throwMemoryLimitException(size, _messageSizeMax); + com.zeroc.IceInternal.Ex.throwMemoryLimitException(size, _messageSizeMax); } if(size > _readStream.size()) { @@ -916,7 +880,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_endpoint.datagram()) { // The message was truncated. - throw new Ice.DatagramLimitException(); + throw new DatagramLimitException(); } continue; } @@ -974,7 +938,7 @@ public final class ConnectionI extends IceInternal.EventHandler // We parse messages first, if we receive a close // connection message we won't send more messages. // - if((readyOp & IceInternal.SocketOperation.Read) != 0) + if((readyOp & SocketOperation.Read) != 0) { // Optimization: use the thread's stream. info = new MessageInfo(current.stream); @@ -982,9 +946,9 @@ public final class ConnectionI extends IceInternal.EventHandler dispatchCount += info.messageDispatchCount; } - if((readyOp & IceInternal.SocketOperation.Write) != 0) + if((readyOp & SocketOperation.Write) != 0) { - sentCBs = new java.util.LinkedList<OutgoingMessage>(); + sentCBs = new java.util.LinkedList<>(); newOp |= sendNextMessage(sentCBs); if(!sentCBs.isEmpty()) { @@ -1005,7 +969,7 @@ public final class ConnectionI extends IceInternal.EventHandler if(_acmLastActivity > 0) { - _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis(); + _acmLastActivity = Time.currentMonotonicTimeMillis(); } if(dispatchCount == 0) @@ -1022,7 +986,7 @@ public final class ConnectionI extends IceInternal.EventHandler { _logger.warning("maximum datagram size of " + _readStream.pos() + " exceeded"); } - _readStream.resize(IceInternal.Protocol.headerSize); + _readStream.resize(Protocol.headerSize); _readStream.pos(0); _readHeader = true; return; @@ -1041,7 +1005,7 @@ public final class ConnectionI extends IceInternal.EventHandler String s = "datagram connection exception:\n" + ex + '\n' + _desc; _logger.warning(s); } - _readStream.resize(IceInternal.Protocol.headerSize); + _readStream.resize(Protocol.headerSize); _readStream.pos(0); _readHeader = true; } @@ -1068,14 +1032,14 @@ public final class ConnectionI extends IceInternal.EventHandler // assert (info.stream == current.stream); InputStream stream = info.stream; - info.stream = new InputStream(_instance, IceInternal.Protocol.currentProtocolEncoding); + info.stream = new InputStream(_instance, Protocol.currentProtocolEncoding); info.stream.swap(stream); } final StartCallback finalStartCB = startCB; final java.util.List<OutgoingMessage> finalSentCBs = sentCBs; final MessageInfo finalInfo = info; - _threadPool.dispatchFromThisThread(new IceInternal.DispatchWorkItem(this) + _threadPool.dispatchFromThisThread(new com.zeroc.IceInternal.DispatchWorkItem(this) { @Override public void run() @@ -1187,7 +1151,7 @@ public final class ConnectionI extends IceInternal.EventHandler { initiateShutdown(); } - catch(Ice.LocalException ex) + catch(LocalException ex) { setState(StateClosed, ex); } @@ -1217,7 +1181,7 @@ public final class ConnectionI extends IceInternal.EventHandler { initiateShutdown(); } - catch(Ice.LocalException ex) + catch(LocalException ex) { setState(StateClosed, ex); } @@ -1231,12 +1195,12 @@ public final class ConnectionI extends IceInternal.EventHandler } @Override - public void finished(IceInternal.ThreadPoolCurrent current, final boolean close) + public void finished(com.zeroc.IceInternal.ThreadPoolCurrent current, final boolean close) { synchronized(this) { assert (_state == StateClosed); - unscheduleTimeout(IceInternal.SocketOperation.Read | IceInternal.SocketOperation.Write); + unscheduleTimeout(SocketOperation.Read | SocketOperation.Write); } // @@ -1260,7 +1224,7 @@ public final class ConnectionI extends IceInternal.EventHandler } else { - _threadPool.dispatchFromThisThread(new IceInternal.DispatchWorkItem(this) + _threadPool.dispatchFromThisThread(new com.zeroc.IceInternal.DispatchWorkItem(this) { @Override public void run() @@ -1319,7 +1283,7 @@ public final class ConnectionI extends IceInternal.EventHandler { _transceiver.close(); } - catch(Ice.LocalException ex) + catch(LocalException ex) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter pw = new java.io.PrintWriter(sw); @@ -1376,7 +1340,7 @@ public final class ConnectionI extends IceInternal.EventHandler _sendStreams.clear(); } - for(IceInternal.OutgoingAsyncBase p : _asyncRequests.values()) + for(OutgoingAsyncBase p : _asyncRequests.values()) { if(p.completed(_exception)) { @@ -1437,7 +1401,7 @@ public final class ConnectionI extends IceInternal.EventHandler } @Override - public void setReadyCallback(IceInternal.ReadyCallback callback) + public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback) { _transceiver.setReadyCallback(callback); } @@ -1476,7 +1440,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_state >= StateClosed) { - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } return initConnectionInfo(); } @@ -1486,7 +1450,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_state >= StateClosed) { - throw (Ice.LocalException) _exception.fillInStackTrace(); + throw (LocalException) _exception.fillInStackTrace(); } _transceiver.setBufferSize(rcvSize, sndSize); _info = null; // Invalidate the cached connection info @@ -1503,9 +1467,10 @@ public final class ConnectionI extends IceInternal.EventHandler setState(StateClosed, ex); } - public ConnectionI(Communicator communicator, IceInternal.Instance instance, IceInternal.ACMMonitor monitor, - IceInternal.Transceiver transceiver, IceInternal.Connector connector, - IceInternal.EndpointI endpoint, ObjectAdapterI adapter) + public ConnectionI(Communicator communicator, com.zeroc.IceInternal.Instance instance, + com.zeroc.IceInternal.ACMMonitor monitor, com.zeroc.IceInternal.Transceiver transceiver, + com.zeroc.IceInternal.Connector connector, com.zeroc.IceInternal.EndpointI endpoint, + ObjectAdapterI adapter) { _communicator = communicator; _instance = instance; @@ -1516,7 +1481,7 @@ public final class ConnectionI extends IceInternal.EventHandler _connector = connector; _endpoint = endpoint; _adapter = adapter; - final Ice.InitializationData initData = instance.initializationData(); + final InitializationData initData = instance.initializationData(); // Cached for better performance. _dispatcher = initData.dispatcher != null; _logger = initData.logger; // Cached for better performance. @@ -1531,7 +1496,7 @@ public final class ConnectionI extends IceInternal.EventHandler _cacheBuffers = instance.cacheMessageBuffers(); if(_monitor != null && _monitor.getACM().timeout > 0) { - _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis(); + _acmLastActivity = Time.currentMonotonicTimeMillis(); } else { @@ -1539,11 +1504,11 @@ public final class ConnectionI extends IceInternal.EventHandler } _nextRequestId = 1; _messageSizeMax = adapter != null ? adapter.messageSizeMax() : instance.messageSizeMax(); - _batchRequestQueue = new IceInternal.BatchRequestQueue(instance, _endpoint.datagram()); - _readStream = new InputStream(instance, IceInternal.Protocol.currentProtocolEncoding); + _batchRequestQueue = new com.zeroc.IceInternal.BatchRequestQueue(instance, _endpoint.datagram()); + _readStream = new InputStream(instance, Protocol.currentProtocolEncoding); _readHeader = false; _readStreamPos = -1; - _writeStream = new OutputStream(instance, IceInternal.Protocol.currentProtocolEncoding); + _writeStream = new OutputStream(instance, Protocol.currentProtocolEncoding); _writeStreamPos = -1; _dispatchCount = 0; _state = StateNotInitialized; @@ -1580,13 +1545,13 @@ public final class ConnectionI extends IceInternal.EventHandler } _threadPool.initialize(this); } - catch(Ice.LocalException ex) + catch(LocalException ex) { throw ex; } catch(java.lang.Exception ex) { - throw new Ice.SyscallException(ex); + throw new SyscallException(ex); } } @@ -1595,11 +1560,11 @@ public final class ConnectionI extends IceInternal.EventHandler { try { - IceUtilInternal.Assert.FinalizerAssert(_startCallback == null); - IceUtilInternal.Assert.FinalizerAssert(_state == StateFinished); - IceUtilInternal.Assert.FinalizerAssert(_dispatchCount == 0); - IceUtilInternal.Assert.FinalizerAssert(_sendStreams.isEmpty()); - IceUtilInternal.Assert.FinalizerAssert(_asyncRequests.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_startCallback == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_state == StateFinished); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_dispatchCount == 0); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_sendStreams.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_asyncRequests.isEmpty()); } catch(java.lang.Exception ex) { @@ -1723,7 +1688,7 @@ public final class ConnectionI extends IceInternal.EventHandler { return; } - _threadPool.register(this, IceInternal.SocketOperation.Read); + _threadPool.register(this, SocketOperation.Read); break; } @@ -1739,7 +1704,7 @@ public final class ConnectionI extends IceInternal.EventHandler } if(_state == StateActive) { - _threadPool.unregister(this, IceInternal.SocketOperation.Read); + _threadPool.unregister(this, SocketOperation.Read); } break; } @@ -1785,7 +1750,7 @@ public final class ConnectionI extends IceInternal.EventHandler } } } - catch(Ice.LocalException ex) + catch(LocalException ex) { java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter pw = new java.io.PrintWriter(sw); @@ -1807,7 +1772,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_acmLastActivity > 0) { - _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis(); + _acmLastActivity = Time.currentMonotonicTimeMillis(); } _monitor.add(this); } @@ -1819,8 +1784,8 @@ public final class ConnectionI extends IceInternal.EventHandler if(_instance.initializationData().observer != null) { - Ice.Instrumentation.ConnectionState oldState = toConnectionState(_state); - Ice.Instrumentation.ConnectionState newState = toConnectionState(state); + ConnectionState oldState = toConnectionState(_state); + ConnectionState newState = toConnectionState(state); if(oldState != newState) { _observer = _instance.initializationData().observer.getConnectionObserver(initConnectionInfo(), @@ -1883,16 +1848,16 @@ public final class ConnectionI extends IceInternal.EventHandler // // Before we shut down, we send a close connection message. // - OutputStream os = new OutputStream(_instance, IceInternal.Protocol.currentProtocolEncoding); - os.writeBlob(IceInternal.Protocol.magic); - IceInternal.Protocol.currentProtocol.__write(os); - IceInternal.Protocol.currentProtocolEncoding.__write(os); - os.writeByte(IceInternal.Protocol.closeConnectionMsg); + OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + os.writeBlob(Protocol.magic); + Protocol.currentProtocol.ice_write(os); + Protocol.currentProtocolEncoding.ice_write(os); + os.writeByte(Protocol.closeConnectionMsg); os.writeByte((byte) 0); // compression status: always report 0 for // CloseConnection in Java. - os.writeInt(IceInternal.Protocol.headerSize); // Message size. + os.writeInt(Protocol.headerSize); // Message size. - if((sendMessage(new OutgoingMessage(os, false, false)) & IceInternal.AsyncStatus.Sent) > 0) + if((sendMessage(new OutgoingMessage(os, false, false)) & AsyncStatus.Sent) > 0) { setState(StateClosingPending); @@ -1916,20 +1881,20 @@ public final class ConnectionI extends IceInternal.EventHandler if(!_endpoint.datagram()) { - OutputStream os = new OutputStream(_instance, IceInternal.Protocol.currentProtocolEncoding); - os.writeBlob(IceInternal.Protocol.magic); - IceInternal.Protocol.currentProtocol.__write(os); - IceInternal.Protocol.currentProtocolEncoding.__write(os); - os.writeByte(IceInternal.Protocol.validateConnectionMsg); + OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + os.writeBlob(Protocol.magic); + Protocol.currentProtocol.ice_write(os); + Protocol.currentProtocolEncoding.ice_write(os); + os.writeByte(Protocol.validateConnectionMsg); os.writeByte((byte) 0); - os.writeInt(IceInternal.Protocol.headerSize); // Message size. + os.writeInt(Protocol.headerSize); // Message size. try { OutgoingMessage message = new OutgoingMessage(os, false, false); sendMessage(message); } - catch(Ice.LocalException ex) + catch(LocalException ex) { setState(StateClosed, ex); assert (_exception != null); @@ -1940,7 +1905,7 @@ public final class ConnectionI extends IceInternal.EventHandler private boolean initialize(int operation) { int s = _transceiver.initialize(_readStream.getBuffer(), _writeStream.getBuffer()); - if(s != IceInternal.SocketOperation.None) + if(s != SocketOperation.None) { scheduleTimeout(s); _threadPool.update(this, operation, s); @@ -1968,16 +1933,15 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_writeStream.isEmpty()) { - _writeStream.writeBlob(IceInternal.Protocol.magic); - IceInternal.Protocol.currentProtocol.__write(_writeStream); - IceInternal.Protocol.currentProtocolEncoding.__write(_writeStream); - _writeStream.writeByte(IceInternal.Protocol.validateConnectionMsg); + _writeStream.writeBlob(Protocol.magic); + Protocol.currentProtocol.ice_write(_writeStream); + Protocol.currentProtocolEncoding.ice_write(_writeStream); + _writeStream.writeByte(Protocol.validateConnectionMsg); _writeStream.writeByte((byte) 0); // Compression status // (always zero for // validate connection). - _writeStream.writeInt(IceInternal.Protocol.headerSize); // Message - // size. - IceInternal.TraceUtil.traceSend(_writeStream, _logger, _traceLevels); + _writeStream.writeInt(Protocol.headerSize); // Message size. + TraceUtil.traceSend(_writeStream, _logger, _traceLevels); _writeStream.prepareWrite(); } @@ -2007,7 +1971,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_readStream.isEmpty()) { - _readStream.resize(IceInternal.Protocol.headerSize); + _readStream.resize(Protocol.headerSize); _readStream.pos(0); } @@ -2032,36 +1996,36 @@ public final class ConnectionI extends IceInternal.EventHandler observerFinishRead(_readStream.getBuffer()); } - assert (_readStream.pos() == IceInternal.Protocol.headerSize); + assert (_readStream.pos() == Protocol.headerSize); _readStream.pos(0); byte[] m = _readStream.readBlob(4); - if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] || - m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3]) + if(m[0] != Protocol.magic[0] || m[1] != Protocol.magic[1] || + m[2] != Protocol.magic[2] || m[3] != Protocol.magic[3]) { BadMagicException ex = new BadMagicException(); ex.badMagic = m; throw ex; } - _readProtocol.__read(_readStream); - IceInternal.Protocol.checkSupportedProtocol(_readProtocol); + _readProtocol.ice_read(_readStream); + Protocol.checkSupportedProtocol(_readProtocol); - _readProtocolEncoding.__read(_readStream); - IceInternal.Protocol.checkSupportedProtocolEncoding(_readProtocolEncoding); + _readProtocolEncoding.ice_read(_readStream); + Protocol.checkSupportedProtocolEncoding(_readProtocolEncoding); byte messageType = _readStream.readByte(); - if(messageType != IceInternal.Protocol.validateConnectionMsg) + if(messageType != Protocol.validateConnectionMsg) { throw new ConnectionNotValidatedException(); } _readStream.readByte(); // Ignore compression status for // validate connection. int size = _readStream.readInt(); - if(size != IceInternal.Protocol.headerSize) + if(size != Protocol.headerSize) { throw new IllegalMessageSizeException(); } - IceInternal.TraceUtil.traceRecv(_readStream, _logger, _traceLevels); + TraceUtil.traceRecv(_readStream, _logger, _traceLevels); _validated = true; } @@ -2070,7 +2034,7 @@ public final class ConnectionI extends IceInternal.EventHandler _writeStream.resize(0); _writeStream.pos(0); - _readStream.resize(IceInternal.Protocol.headerSize); + _readStream.resize(Protocol.headerSize); _readStream.pos(0); _readHeader = true; @@ -2104,7 +2068,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_sendStreams.isEmpty()) { - return IceInternal.SocketOperation.None; + return SocketOperation.None; } else if(_state == StateClosingPending && _writeStream.pos() == 0) { @@ -2112,7 +2076,7 @@ public final class ConnectionI extends IceInternal.EventHandler // send more data. OutgoingMessage message = _sendStreams.getFirst(); _writeStream.swap(message.stream); - return IceInternal.SocketOperation.None; + return SocketOperation.None; } assert (!_writeStream.isEmpty() && _writeStream.pos() == _writeStream.size()); @@ -2148,7 +2112,7 @@ public final class ConnectionI extends IceInternal.EventHandler // if(_state >= StateClosingPending) { - return IceInternal.SocketOperation.None; + return SocketOperation.None; } // @@ -2162,8 +2126,14 @@ public final class ConnectionI extends IceInternal.EventHandler message.stream.prepareWrite(); message.prepared = true; - IceInternal.TraceUtil.traceSend(stream, _logger, _traceLevels); - + if(message.outAsync != null) + { + TraceUtil.trace("sending asynchronous request", stream, _logger, _traceLevels); + } + else + { + TraceUtil.traceSend(stream, _logger, _traceLevels); + } _writeStream.swap(message.stream); // @@ -2202,11 +2172,11 @@ public final class ConnectionI extends IceInternal.EventHandler } } } - catch(Ice.LocalException ex) + catch(LocalException ex) { setState(StateClosed, ex); } - return IceInternal.SocketOperation.None; + return SocketOperation.None; } private int sendMessage(OutgoingMessage message) @@ -2217,7 +2187,7 @@ public final class ConnectionI extends IceInternal.EventHandler { message.adopt(); _sendStreams.addLast(message); - return IceInternal.AsyncStatus.Queued; + return AsyncStatus.Queued; } // @@ -2234,7 +2204,14 @@ public final class ConnectionI extends IceInternal.EventHandler message.prepared = true; int op; - IceInternal.TraceUtil.traceSend(stream, _logger, _traceLevels); + if(message.outAsync != null) + { + TraceUtil.trace("sending asynchronous request", stream, _logger, _traceLevels); + } + else + { + TraceUtil.traceSend(stream, _logger, _traceLevels); + } // // Send the message without blocking. @@ -2251,15 +2228,15 @@ public final class ConnectionI extends IceInternal.EventHandler observerFinishWrite(message.stream.getBuffer()); } - int status = IceInternal.AsyncStatus.Sent; + int status = AsyncStatus.Sent; if(message.sent()) { - status |= IceInternal.AsyncStatus.InvokeSentCallback; + status |= AsyncStatus.InvokeSentCallback; } if(_acmLastActivity > 0) { - _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis(); + _acmLastActivity = Time.currentMonotonicTimeMillis(); } return status; } @@ -2270,7 +2247,7 @@ public final class ConnectionI extends IceInternal.EventHandler _sendStreams.addLast(message); scheduleTimeout(op); _threadPool.register(this, op); - return IceInternal.AsyncStatus.Queued; + return AsyncStatus.Queued; } private OutputStream doCompress(OutputStream uncompressed, boolean compress) @@ -2282,7 +2259,7 @@ public final class ConnectionI extends IceInternal.EventHandler // Don't check whether compression support is available unless the // proxy is configured for compression. // - compressionSupported = IceInternal.BZip2.supported(); + compressionSupported = com.zeroc.IceInternal.BZip2.supported(); } if(compressionSupported && uncompressed.size() >= 100) @@ -2290,8 +2267,8 @@ public final class ConnectionI extends IceInternal.EventHandler // // Do compression. // - IceInternal.Buffer cbuf = IceInternal.BZip2.compress(uncompressed.getBuffer(), - IceInternal.Protocol.headerSize, _compressionLevel); + Buffer cbuf = com.zeroc.IceInternal.BZip2.compress(uncompressed.getBuffer(), + Protocol.headerSize, _compressionLevel); if(cbuf != null) { OutputStream cstream = @@ -2345,9 +2322,9 @@ public final class ConnectionI extends IceInternal.EventHandler int invokeNum; int requestId; byte compress; - IceInternal.ServantManager servantManager; + com.zeroc.IceInternal.ServantManager servantManager; ObjectAdapter adapter; - IceInternal.OutgoingAsyncBase outAsync; + OutgoingAsyncBase outAsync; HeartbeatCallback heartbeatCallback; int messageDispatchCount; } @@ -2357,7 +2334,7 @@ public final class ConnectionI extends IceInternal.EventHandler assert (_state > StateNotValidated && _state < StateClosed); _readStream.swap(info.stream); - _readStream.resize(IceInternal.Protocol.headerSize); + _readStream.resize(Protocol.headerSize); _readStream.pos(0); _readHeader = true; @@ -2382,11 +2359,11 @@ public final class ConnectionI extends IceInternal.EventHandler info.compress = info.stream.readByte(); if(info.compress == (byte)2) { - if(IceInternal.BZip2.supported()) + if(com.zeroc.IceInternal.BZip2.supported()) { - IceInternal.Buffer ubuf = IceInternal.BZip2.uncompress(info.stream.getBuffer(), - IceInternal.Protocol.headerSize, - _messageSizeMax); + Buffer ubuf = com.zeroc.IceInternal.BZip2.uncompress(info.stream.getBuffer(), + Protocol.headerSize, + _messageSizeMax); info.stream = new InputStream(info.stream.instance(), info.stream.getEncoding(), ubuf, true); } else @@ -2397,13 +2374,13 @@ public final class ConnectionI extends IceInternal.EventHandler throw ex; } } - info.stream.pos(IceInternal.Protocol.headerSize); + info.stream.pos(Protocol.headerSize); switch(messageType) { - case IceInternal.Protocol.closeConnectionMsg: + case Protocol.closeConnectionMsg: { - IceInternal.TraceUtil.traceRecv(info.stream, _logger, _traceLevels); + TraceUtil.traceRecv(info.stream, _logger, _traceLevels); if(_endpoint.datagram()) { if(_warn) @@ -2429,17 +2406,17 @@ public final class ConnectionI extends IceInternal.EventHandler break; } - case IceInternal.Protocol.requestMsg: + case Protocol.requestMsg: { if(_state >= StateClosing) { - IceInternal.TraceUtil.trace("received request during closing\n" + TraceUtil.trace("received request during closing\n" + "(ignored by server, client will retry)", info.stream, _logger, _traceLevels); } else { - IceInternal.TraceUtil.traceRecv(info.stream, _logger, _traceLevels); + TraceUtil.traceRecv(info.stream, _logger, _traceLevels); info.requestId = info.stream.readInt(); info.invokeNum = 1; info.servantManager = _servantManager; @@ -2449,17 +2426,17 @@ public final class ConnectionI extends IceInternal.EventHandler break; } - case IceInternal.Protocol.requestBatchMsg: + case Protocol.requestBatchMsg: { if(_state >= StateClosing) { - IceInternal.TraceUtil.trace("received batch request during closing\n" + TraceUtil.trace("received batch request during closing\n" + "(ignored by server, client will retry)", info.stream, _logger, _traceLevels); } else { - IceInternal.TraceUtil.traceRecv(info.stream, _logger, _traceLevels); + TraceUtil.traceRecv(info.stream, _logger, _traceLevels); info.invokeNum = info.stream.readInt(); if(info.invokeNum < 0) { @@ -2473,12 +2450,12 @@ public final class ConnectionI extends IceInternal.EventHandler break; } - case IceInternal.Protocol.replyMsg: + case Protocol.replyMsg: { - IceInternal.TraceUtil.traceRecv(info.stream, _logger, _traceLevels); + TraceUtil.traceRecv(info.stream, _logger, _traceLevels); info.requestId = info.stream.readInt(); - IceInternal.OutgoingAsyncBase outAsync = _asyncRequests.remove(info.requestId); + OutgoingAsyncBase outAsync = _asyncRequests.remove(info.requestId); if(outAsync != null && outAsync.completed(info.stream)) { info.outAsync = outAsync; @@ -2488,9 +2465,9 @@ public final class ConnectionI extends IceInternal.EventHandler break; } - case IceInternal.Protocol.validateConnectionMsg: + case Protocol.validateConnectionMsg: { - IceInternal.TraceUtil.traceRecv(info.stream, _logger, _traceLevels); + TraceUtil.traceRecv(info.stream, _logger, _traceLevels); if(_heartbeatCallback != null) { info.heartbeatCallback = _heartbeatCallback; @@ -2501,8 +2478,8 @@ public final class ConnectionI extends IceInternal.EventHandler default: { - IceInternal.TraceUtil.trace("received unknown message\n(invalid, closing connection)", info.stream, - _logger, _traceLevels); + TraceUtil.trace("received unknown message\n(invalid, closing connection)", info.stream, + _logger, _traceLevels); throw new UnknownMessageException(); } } @@ -2522,18 +2499,18 @@ public final class ConnectionI extends IceInternal.EventHandler } } - return _state == StateHolding ? IceInternal.SocketOperation.None : IceInternal.SocketOperation.Read; + return _state == StateHolding ? SocketOperation.None : SocketOperation.Read; } private void invokeAll(InputStream stream, int invokeNum, int requestId, byte compress, - IceInternal.ServantManager servantManager, ObjectAdapter adapter) + com.zeroc.IceInternal.ServantManager servantManager, ObjectAdapter adapter) { // // Note: In contrast to other private or protected methods, this // operation must be called *without* the mutex locked. // - IceInternal.Incoming in = null; + Incoming in = null; try { while(invokeNum > 0) @@ -2562,7 +2539,7 @@ public final class ConnectionI extends IceInternal.EventHandler { invokeException(requestId, ex, invokeNum, false); } - catch(IceInternal.ServantError ex) + catch(com.zeroc.IceInternal.ServantError ex) { // // ServantError is thrown when an Error has been raised by servant (or servant locator) @@ -2616,7 +2593,7 @@ public final class ConnectionI extends IceInternal.EventHandler int timeout; if(_state < StateActive) { - IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); + com.zeroc.IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); if(defaultsAndOverrides.overrideConnectTimeout) { timeout = defaultsAndOverrides.overrideConnectTimeoutValue; @@ -2630,13 +2607,13 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_readHeader) // No timeout for reading the header. { - status &= ~IceInternal.SocketOperation.Read; + status &= ~SocketOperation.Read; } timeout = _endpoint.timeout(); } else { - IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); + com.zeroc.IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); if(defaultsAndOverrides.overrideCloseTimeout) { timeout = defaultsAndOverrides.overrideCloseTimeoutValue; @@ -2654,7 +2631,7 @@ public final class ConnectionI extends IceInternal.EventHandler try { - if((status & IceInternal.SocketOperation.Read) != 0) + if((status & SocketOperation.Read) != 0) { if(_readTimeoutFuture != null) { @@ -2662,7 +2639,7 @@ public final class ConnectionI extends IceInternal.EventHandler } _readTimeoutFuture = _timer.schedule(_readTimeout, timeout, java.util.concurrent.TimeUnit.MILLISECONDS); } - if((status & (IceInternal.SocketOperation.Write | IceInternal.SocketOperation.Connect)) != 0) + if((status & (SocketOperation.Write | SocketOperation.Connect)) != 0) { if(_writeTimeoutFuture != null) { @@ -2680,12 +2657,12 @@ public final class ConnectionI extends IceInternal.EventHandler private void unscheduleTimeout(int status) { - if((status & IceInternal.SocketOperation.Read) != 0 && _readTimeoutFuture != null) + if((status & SocketOperation.Read) != 0 && _readTimeoutFuture != null) { _readTimeoutFuture.cancel(false); _readTimeoutFuture = null; } - if((status & (IceInternal.SocketOperation.Write | IceInternal.SocketOperation.Connect)) != 0 && + if((status & (SocketOperation.Write | SocketOperation.Connect)) != 0 && _writeTimeoutFuture != null) { _writeTimeoutFuture.cancel(false); @@ -2704,7 +2681,7 @@ public final class ConnectionI extends IceInternal.EventHandler { _info = _transceiver.getInfo(); } - catch(Ice.LocalException ex) + catch(LocalException ex) { _info = new ConnectionInfo(); } @@ -2717,7 +2694,7 @@ public final class ConnectionI extends IceInternal.EventHandler return _info; } - private Ice.Instrumentation.ConnectionState toConnectionState(int state) + private ConnectionState toConnectionState(int state) { return connectionStateMap[state]; } @@ -2732,7 +2709,7 @@ public final class ConnectionI extends IceInternal.EventHandler _logger.warning(s); } - private void observerStartRead(IceInternal.Buffer buf) + private void observerStartRead(Buffer buf) { if(_readStreamPos >= 0) { @@ -2742,7 +2719,7 @@ public final class ConnectionI extends IceInternal.EventHandler _readStreamPos = buf.empty() ? -1 : buf.b.position(); } - private void observerFinishRead(IceInternal.Buffer buf) + private void observerFinishRead(Buffer buf) { if(_readStreamPos == -1) { @@ -2753,7 +2730,7 @@ public final class ConnectionI extends IceInternal.EventHandler _readStreamPos = -1; } - private void observerStartWrite(IceInternal.Buffer buf) + private void observerStartWrite(Buffer buf) { if(_writeStreamPos >= 0) { @@ -2763,7 +2740,7 @@ public final class ConnectionI extends IceInternal.EventHandler _writeStreamPos = buf.empty() ? -1 : buf.b.position(); } - private void observerFinishWrite(IceInternal.Buffer buf) + private void observerFinishWrite(Buffer buf) { if(_writeStreamPos == -1) { @@ -2776,9 +2753,10 @@ public final class ConnectionI extends IceInternal.EventHandler _writeStreamPos = -1; } - private IceInternal.Incoming getIncoming(ObjectAdapter adapter, boolean response, byte compress, int requestId) + private Incoming getIncoming(ObjectAdapter adapter, boolean response, byte compress, + int requestId) { - IceInternal.Incoming in = null; + Incoming in = null; if(_cacheBuffers > 0) { @@ -2786,7 +2764,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(_incomingCache == null) { - in = new IceInternal.Incoming(_instance, this, this, adapter, response, compress, requestId); + in = new Incoming(_instance, this, this, adapter, response, compress, requestId); } else { @@ -2799,24 +2777,20 @@ public final class ConnectionI extends IceInternal.EventHandler } else { - in = new IceInternal.Incoming(_instance, this, this, adapter, response, compress, requestId); + in = new Incoming(_instance, this, this, adapter, response, compress, requestId); } return in; } - private void reclaimIncoming(IceInternal.Incoming in) + private void reclaimIncoming(Incoming in) { - if(_cacheBuffers > 0) + if(_cacheBuffers > 0 && in.reclaim()) { synchronized(_incomingCacheMutex) { in.next = _incomingCache; _incomingCache = in; - // - // Clear references to Ice objects as soon as possible. - // - _incomingCache.reclaim(); } } } @@ -2833,7 +2807,7 @@ public final class ConnectionI extends IceInternal.EventHandler } } - private int read(IceInternal.Buffer buf) + private int read(Buffer buf) { int start = buf.b.position(); int op = _transceiver.read(buf); @@ -2860,7 +2834,7 @@ public final class ConnectionI extends IceInternal.EventHandler return op; } - private int write(IceInternal.Buffer buf) + private int write(Buffer buf) { int start = buf.b.position(); int op = _transceiver.write(buf); @@ -2892,7 +2866,7 @@ public final class ConnectionI extends IceInternal.EventHandler this.requestId = 0; } - OutgoingMessage(IceInternal.OutgoingAsyncBase out, OutputStream stream, boolean compress, + OutgoingMessage(OutgoingAsyncBase out, OutputStream stream, boolean compress, int requestId) { this.stream = stream; @@ -2911,8 +2885,7 @@ public final class ConnectionI extends IceInternal.EventHandler { if(adopt) { - OutputStream stream = - new OutputStream(this.stream.instance(), IceInternal.Protocol.currentProtocolEncoding); + OutputStream stream = new OutputStream(this.stream.instance(), Protocol.currentProtocolEncoding); stream.swap(this.stream); this.stream = stream; adopt = false; @@ -2928,7 +2901,7 @@ public final class ConnectionI extends IceInternal.EventHandler return false; } - public void completed(Ice.LocalException ex) + public void completed(LocalException ex) { if(outAsync != null && outAsync.completed(ex)) { @@ -2937,7 +2910,7 @@ public final class ConnectionI extends IceInternal.EventHandler } public OutputStream stream; - public IceInternal.OutgoingAsyncBase outAsync; + public OutgoingAsyncBase outAsync; public boolean compress; public int requestId; boolean adopt; @@ -2945,21 +2918,21 @@ public final class ConnectionI extends IceInternal.EventHandler } private Communicator _communicator; - private final IceInternal.Instance _instance; - private IceInternal.ACMMonitor _monitor; - private final IceInternal.Transceiver _transceiver; + private final com.zeroc.IceInternal.Instance _instance; + private com.zeroc.IceInternal.ACMMonitor _monitor; + private final com.zeroc.IceInternal.Transceiver _transceiver; private String _desc; private final String _type; - private final IceInternal.Connector _connector; - private final IceInternal.EndpointI _endpoint; + private final com.zeroc.IceInternal.Connector _connector; + private final com.zeroc.IceInternal.EndpointI _endpoint; private ObjectAdapter _adapter; - private IceInternal.ServantManager _servantManager; + private com.zeroc.IceInternal.ServantManager _servantManager; private final boolean _dispatcher; private final Logger _logger; - private final IceInternal.TraceLevels _traceLevels; - private final IceInternal.ThreadPool _threadPool; + private final com.zeroc.IceInternal.TraceLevels _traceLevels; + private final com.zeroc.IceInternal.ThreadPool _threadPool; private final java.util.concurrent.ScheduledExecutorService _timer; private final Runnable _writeTimeout; @@ -2978,21 +2951,20 @@ public final class ConnectionI extends IceInternal.EventHandler private int _nextRequestId; - private java.util.Map<Integer, IceInternal.OutgoingAsyncBase> _asyncRequests = - new java.util.HashMap<Integer, IceInternal.OutgoingAsyncBase>(); + private java.util.Map<Integer, OutgoingAsyncBase> _asyncRequests = new java.util.HashMap<>(); private LocalException _exception; private final int _messageSizeMax; - private IceInternal.BatchRequestQueue _batchRequestQueue; + private com.zeroc.IceInternal.BatchRequestQueue _batchRequestQueue; - private java.util.LinkedList<OutgoingMessage> _sendStreams = new java.util.LinkedList<OutgoingMessage>(); + private java.util.LinkedList<OutgoingMessage> _sendStreams = new java.util.LinkedList<>(); private InputStream _readStream; private boolean _readHeader; private OutputStream _writeStream; - private Ice.Instrumentation.ConnectionObserver _observer; + private com.zeroc.Ice.Instrumentation.ConnectionObserver _observer; private int _readStreamPos; private int _writeStreamPos; @@ -3003,28 +2975,28 @@ public final class ConnectionI extends IceInternal.EventHandler private boolean _initialized = false; private boolean _validated = false; - private IceInternal.Incoming _incomingCache; + private Incoming _incomingCache; private final java.lang.Object _incomingCacheMutex = new java.lang.Object(); - private Ice.ProtocolVersion _readProtocol = new Ice.ProtocolVersion(); - private Ice.EncodingVersion _readProtocolEncoding = new Ice.EncodingVersion(); + private ProtocolVersion _readProtocol = new ProtocolVersion(); + private EncodingVersion _readProtocolEncoding = new EncodingVersion(); private int _cacheBuffers; - private Ice.ConnectionInfo _info; + private ConnectionInfo _info; private CloseCallback _closeCallback; private HeartbeatCallback _heartbeatCallback; - private static Ice.Instrumentation.ConnectionState connectionStateMap[] = { - Ice.Instrumentation.ConnectionState.ConnectionStateValidating, // StateNotInitialized - Ice.Instrumentation.ConnectionState.ConnectionStateValidating, // StateNotValidated - Ice.Instrumentation.ConnectionState.ConnectionStateActive, // StateActive - Ice.Instrumentation.ConnectionState.ConnectionStateHolding, // StateHolding - Ice.Instrumentation.ConnectionState.ConnectionStateClosing, // StateClosing - Ice.Instrumentation.ConnectionState.ConnectionStateClosing, // StateClosingPending - Ice.Instrumentation.ConnectionState.ConnectionStateClosed, // StateClosed - Ice.Instrumentation.ConnectionState.ConnectionStateClosed, // StateFinished + private static ConnectionState connectionStateMap[] = + { + ConnectionState.ConnectionStateValidating, // StateNotInitialized + ConnectionState.ConnectionStateValidating, // StateNotValidated + ConnectionState.ConnectionStateActive, // StateActive + ConnectionState.ConnectionStateHolding, // StateHolding + ConnectionState.ConnectionStateClosing, // StateClosing + ConnectionState.ConnectionStateClosing, // StateClosingPending + ConnectionState.ConnectionStateClosed, // StateClosed + ConnectionState.ConnectionStateClosed, // StateFinished }; - } diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java b/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java new file mode 100644 index 00000000000..7a753abd81b --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/DispatchInterceptor.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +import java.util.concurrent.CompletionStage; + +/** + * Base class that allows a server to intercept incoming requests. + * The application must derive a concrete class from <code>DispatchInterceptor</code> + * that implements the {@link DispatchInterceptor#dispatch} operation. An instance of this derived + * class can be registered with an object adapter like any other servant. + * <p> + * A dispatch interceptor is useful particularly to automatically retry requests + * that have failed due to a recoverable error condition. + **/ +public abstract class DispatchInterceptor implements com.zeroc.Ice.Object +{ + /** + * Called by the Ice run time to dispatch an incoming request. The implementation + * of <code>dispatch</code> must dispatch the request to the actual servant. + * + * @param request The details of the incoming request. + * @return A completion stage if dispatched asynchronously, null otherwise. + * + * @see Request + **/ + public abstract CompletionStage<OutputStream> dispatch(Request request) + throws UserException; + + @Override + public CompletionStage<OutputStream> __dispatch(com.zeroc.IceInternal.Incoming in, Current current) + throws UserException + { + return dispatch(in); + } +} diff --git a/java/src/Ice/src/main/java/Ice/Dispatcher.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java index 83975f9b8c9..9fd63168693 100644 --- a/java/src/Ice/src/main/java/Ice/Dispatcher.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Dispatcher.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * You can control which thread receives operation invocations and AMI @@ -30,5 +30,5 @@ public interface Dispatcher * callback to be dispatched. * @param con The connection associated with the dispatch. **/ - void dispatch(Runnable runnable, Ice.Connection con); + void dispatch(Runnable runnable, Connection con); } diff --git a/java/src/Ice/src/main/java/Ice/Exception.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java index 2cd7cd585c1..a35d23777b8 100644 --- a/java/src/Ice/src/main/java/Ice/Exception.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Exception.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Base class for Ice local and system exceptions. Those exceptions @@ -80,11 +80,11 @@ public abstract class Exception extends RuntimeException implements Cloneable { java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter pw = new java.io.PrintWriter(sw); - IceUtilInternal.OutputBase out = new IceUtilInternal.OutputBase(pw); + com.zeroc.IceUtilInternal.OutputBase out = new com.zeroc.IceUtilInternal.OutputBase(pw); out.setUseTab(false); out.print(getClass().getName()); out.inc(); - IceInternal.ValueWriter.write(this, out); + com.zeroc.IceInternal.ValueWriter.write(this, out); pw.flush(); return sw.toString(); } diff --git a/java/src/Ice/src/main/java/Ice/FormatType.java b/java/src/Ice/src/main/java/com/zeroc/Ice/FormatType.java index 7d421f259fd..ad47bcc6d8e 100644 --- a/java/src/Ice/src/main/java/Ice/FormatType.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/FormatType.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * This enumeration describes the possible formats for classes and exceptions. diff --git a/java/src/Ice/src/main/java/Ice/ImplicitContextI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ImplicitContextI.java index 8dd39e414b9..626bbfe3fc2 100644 --- a/java/src/Ice/src/main/java/Ice/ImplicitContextI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ImplicitContextI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; // // The base class for all ImplicitContext implementations @@ -30,8 +30,8 @@ public abstract class ImplicitContextI implements ImplicitContext } else { - throw new Ice.InitializationException( - "'" + kind + "' is not a valid value for Ice.ImplicitContext"); + throw new InitializationException( + "'" + kind + "' is not a valid value for ImplicitContext"); } } @@ -43,7 +43,7 @@ public abstract class ImplicitContextI implements ImplicitContext @Override public synchronized java.util.Map<String, String> getContext() { - return new java.util.HashMap<String, String>(_context); + return new java.util.HashMap<>(_context); } @Override @@ -145,12 +145,12 @@ public abstract class ImplicitContextI implements ImplicitContext @Override synchronized java.util.Map<String, String> combine(java.util.Map<String, String> prxContext) { - java.util.Map<String, String> combined = new java.util.HashMap<String, String>(_context); + java.util.Map<String, String> combined = new java.util.HashMap<>(_context); combined.putAll(prxContext); return combined; } - private java.util.Map<String, String> _context = new java.util.HashMap<String, String>(); + private java.util.Map<String, String> _context = new java.util.HashMap<>(); } static class PerThread extends ImplicitContextI @@ -166,7 +166,7 @@ public abstract class ImplicitContextI implements ImplicitContext if(threadContext == null) { - threadContext = new java.util.HashMap<String, String>(); + threadContext = new java.util.HashMap<>(); } return threadContext; } @@ -180,7 +180,7 @@ public abstract class ImplicitContextI implements ImplicitContext } else { - java.util.Map<String, String> threadContext = new java.util.HashMap<String, String>(context); + java.util.Map<String, String> threadContext = new java.util.HashMap<>(context); _map.put(Thread.currentThread(), threadContext); } } @@ -242,7 +242,7 @@ public abstract class ImplicitContextI implements ImplicitContext if(threadContext == null) { - threadContext = new java.util.HashMap<String, String>(); + threadContext = new java.util.HashMap<>(); _map.put(currentThread, threadContext); } @@ -293,7 +293,7 @@ public abstract class ImplicitContextI implements ImplicitContext } else { - java.util.Map<String, String> combined = new java.util.HashMap<String, String>(threadContext); + java.util.Map<String, String> combined = new java.util.HashMap<>(threadContext); combined.putAll(prxContext); ContextHelper.write(os, combined); } @@ -304,7 +304,7 @@ public abstract class ImplicitContextI implements ImplicitContext { java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); - java.util.Map<String, String> combined = new java.util.HashMap<String, String>(threadContext); + java.util.Map<String, String> combined = new java.util.HashMap<>(threadContext); combined.putAll(prxContext); return combined; } @@ -313,6 +313,6 @@ public abstract class ImplicitContextI implements ImplicitContext // Synchronized map Thread -> Context // private java.util.Map<Thread, java.util.Map<String, String> > _map = - java.util.Collections.synchronizedMap(new java.util.HashMap<Thread, java.util.Map<String, String> >()); + java.util.Collections.synchronizedMap(new java.util.HashMap<>()); } } diff --git a/java/src/Ice/src/main/java/Ice/InitializationData.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java index 860557563e6..61394af201c 100644 --- a/java/src/Ice/src/main/java/Ice/InitializationData.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InitializationData.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * A class that encapsulates data to initialize a communicator. @@ -62,7 +62,7 @@ public final class InitializationData implements Cloneable /** * The communicator observer used by the Ice run-time. **/ - public Ice.Instrumentation.CommunicatorObserver observer; + public com.zeroc.Ice.Instrumentation.CommunicatorObserver observer; /** * The thread hook for the communicator. diff --git a/java/src/Ice/src/main/java/Ice/InputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java index 2027f53d03b..197831372cc 100644 --- a/java/src/Ice/src/main/java/Ice/InputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java @@ -7,10 +7,15 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; import java.io.IOException; +import com.zeroc.IceInternal.Buffer; +import com.zeroc.IceInternal.Instance; +import com.zeroc.IceInternal.Protocol; +import com.zeroc.IceInternal.SequencePatcher; + /** * Interface for input streams used to extract Slice types from a sequence * of bytes. @@ -26,8 +31,8 @@ public class InputStream **/ public InputStream() { - initialize(IceInternal.Protocol.currentEncoding); - _buf = new IceInternal.Buffer(false); + initialize(Protocol.currentEncoding); + _buf = new Buffer(false); } /** @@ -39,8 +44,8 @@ public class InputStream **/ public InputStream(byte[] data) { - initialize(IceInternal.Protocol.currentEncoding); - _buf = new IceInternal.Buffer(data); + initialize(Protocol.currentEncoding); + _buf = new Buffer(data); } /** @@ -52,19 +57,19 @@ public class InputStream **/ public InputStream(java.nio.ByteBuffer buf) { - initialize(IceInternal.Protocol.currentEncoding); - _buf = new IceInternal.Buffer(buf); + initialize(Protocol.currentEncoding); + _buf = new Buffer(buf); } - public InputStream(IceInternal.Buffer buf) + public InputStream(Buffer buf) { this(buf, false); } - public InputStream(IceInternal.Buffer buf, boolean adopt) + public InputStream(Buffer buf, boolean adopt) { - initialize(IceInternal.Protocol.currentEncoding); - _buf = new IceInternal.Buffer(buf, adopt); + initialize(Protocol.currentEncoding); + _buf = new Buffer(buf, adopt); } /** @@ -74,9 +79,9 @@ public class InputStream **/ public InputStream(Communicator communicator) { - IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, instance.defaultsAndOverrides().defaultEncoding); - _buf = new IceInternal.Buffer(instance.cacheMessageBuffers() > 1); + _buf = new Buffer(instance.cacheMessageBuffers() > 1); } /** @@ -88,7 +93,7 @@ public class InputStream public InputStream(Communicator communicator, byte[] data) { initialize(communicator); - _buf = new IceInternal.Buffer(data); + _buf = new Buffer(data); } /** @@ -100,18 +105,18 @@ public class InputStream public InputStream(Communicator communicator, java.nio.ByteBuffer buf) { initialize(communicator); - _buf = new IceInternal.Buffer(buf); + _buf = new Buffer(buf); } - public InputStream(Communicator communicator, IceInternal.Buffer buf) + public InputStream(Communicator communicator, Buffer buf) { this(communicator, buf, false); } - public InputStream(Communicator communicator, IceInternal.Buffer buf, boolean adopt) + public InputStream(Communicator communicator, Buffer buf, boolean adopt) { initialize(communicator); - _buf = new IceInternal.Buffer(buf, adopt); + _buf = new Buffer(buf, adopt); } /** @@ -120,7 +125,7 @@ public class InputStream public InputStream(EncodingVersion encoding) { initialize(encoding); - _buf = new IceInternal.Buffer(false); + _buf = new Buffer(false); } /** @@ -131,7 +136,7 @@ public class InputStream public InputStream(EncodingVersion encoding, byte[] data) { initialize(encoding); - _buf = new IceInternal.Buffer(data); + _buf = new Buffer(data); } /** @@ -142,18 +147,18 @@ public class InputStream public InputStream(EncodingVersion encoding, java.nio.ByteBuffer buf) { initialize(encoding); - _buf = new IceInternal.Buffer(buf); + _buf = new Buffer(buf); } - public InputStream(EncodingVersion encoding, IceInternal.Buffer buf) + public InputStream(EncodingVersion encoding, Buffer buf) { this(encoding, buf, false); } - public InputStream(EncodingVersion encoding, IceInternal.Buffer buf, boolean adopt) + public InputStream(EncodingVersion encoding, Buffer buf, boolean adopt) { initialize(encoding); - _buf = new IceInternal.Buffer(buf, adopt); + _buf = new Buffer(buf, adopt); } /** @@ -164,9 +169,9 @@ public class InputStream **/ public InputStream(Communicator communicator, EncodingVersion encoding) { - IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, encoding); - _buf = new IceInternal.Buffer(instance.cacheMessageBuffers() > 1); + _buf = new Buffer(instance.cacheMessageBuffers() > 1); } /** @@ -179,7 +184,7 @@ public class InputStream public InputStream(Communicator communicator, EncodingVersion encoding, byte[] data) { initialize(communicator, encoding); - _buf = new IceInternal.Buffer(data); + _buf = new Buffer(data); } /** @@ -192,47 +197,47 @@ public class InputStream public InputStream(Communicator communicator, EncodingVersion encoding, java.nio.ByteBuffer buf) { initialize(communicator, encoding); - _buf = new IceInternal.Buffer(buf); + _buf = new Buffer(buf); } - public InputStream(Communicator communicator, EncodingVersion encoding, IceInternal.Buffer buf) + public InputStream(Communicator communicator, EncodingVersion encoding, Buffer buf) { this(communicator, encoding, buf, false); } - public InputStream(Communicator communicator, EncodingVersion encoding, IceInternal.Buffer buf, boolean adopt) + public InputStream(Communicator communicator, EncodingVersion encoding, Buffer buf, boolean adopt) { initialize(communicator, encoding); - _buf = new IceInternal.Buffer(buf, adopt); + _buf = new Buffer(buf, adopt); } - public InputStream(IceInternal.Instance instance, EncodingVersion encoding) + public InputStream(Instance instance, EncodingVersion encoding) { this(instance, encoding, instance.cacheMessageBuffers() > 1); } - public InputStream(IceInternal.Instance instance, EncodingVersion encoding, boolean direct) + public InputStream(Instance instance, EncodingVersion encoding, boolean direct) { initialize(instance, encoding); - _buf = new IceInternal.Buffer(direct); + _buf = new Buffer(direct); } - public InputStream(IceInternal.Instance instance, EncodingVersion encoding, byte[] data) + public InputStream(Instance instance, EncodingVersion encoding, byte[] data) { initialize(instance, encoding); - _buf = new IceInternal.Buffer(data); + _buf = new Buffer(data); } - public InputStream(IceInternal.Instance instance, EncodingVersion encoding, java.nio.ByteBuffer data) + public InputStream(Instance instance, EncodingVersion encoding, java.nio.ByteBuffer data) { initialize(instance, encoding); - _buf = new IceInternal.Buffer(data); + _buf = new Buffer(data); } - public InputStream(IceInternal.Instance instance, EncodingVersion encoding, IceInternal.Buffer buf, boolean adopt) + public InputStream(Instance instance, EncodingVersion encoding, Buffer buf, boolean adopt) { initialize(instance, encoding); - _buf = new IceInternal.Buffer(buf, adopt); + _buf = new Buffer(buf, adopt); } /** @@ -242,7 +247,7 @@ public class InputStream **/ public void initialize(Communicator communicator) { - IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, instance.defaultsAndOverrides().defaultEncoding); } @@ -254,11 +259,11 @@ public class InputStream **/ public void initialize(Communicator communicator, EncodingVersion encoding) { - IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, encoding); } - private void initialize(IceInternal.Instance instance, EncodingVersion encoding) + private void initialize(Instance instance, EncodingVersion encoding) { initialize(encoding); @@ -406,7 +411,7 @@ public class InputStream return prev; } - public IceInternal.Instance instance() + public Instance instance() { return _instance; } @@ -420,7 +425,7 @@ public class InputStream { assert(_instance == other._instance); - IceInternal.Buffer tmpBuf = other._buf; + Buffer tmpBuf = other._buf; other._buf = _buf; _buf = tmpBuf; @@ -489,7 +494,7 @@ public class InputStream _buf.b.position(sz); } - public IceInternal.Buffer getBuffer() + public Buffer getBuffer() { return _buf; } @@ -576,9 +581,8 @@ public class InputStream } _encapsStack.sz = sz; - EncodingVersion encoding = new EncodingVersion(); - encoding.__read(this); - IceInternal.Protocol.checkSupportedEncoding(encoding); // Make sure the encoding is supported. + EncodingVersion encoding = EncodingVersion.read(this, null); + Protocol.checkSupportedEncoding(encoding); // Make sure the encoding is supported. _encapsStack.setEncoding(encoding); return encoding; @@ -639,19 +643,19 @@ public class InputStream int sz = readInt(); if(sz < 6) { - throw new Ice.EncapsulationException(); + throw new EncapsulationException(); } if(sz - 4 > _buf.b.remaining()) { - throw new Ice.UnmarshalOutOfBoundsException(); + throw new UnmarshalOutOfBoundsException(); } EncodingVersion encoding = EncodingVersion.read(this, null); - if(encoding.equals(Ice.Util.Encoding_1_0)) + if(encoding.equals(Util.Encoding_1_0)) { if(sz != 6) { - throw new Ice.EncapsulationException(); + throw new EncapsulationException(); } } else @@ -687,7 +691,7 @@ public class InputStream if(encoding != null) { - encoding.__read(this); + encoding.ice_read(this); _buf.b.position(_buf.b.position() - 6); } else @@ -740,8 +744,7 @@ public class InputStream { throw new UnmarshalOutOfBoundsException(); } - EncodingVersion encoding = new EncodingVersion(); - encoding.__read(this); + EncodingVersion encoding = EncodingVersion.read(this, null); try { _buf.b.position(_buf.b.position() + sz - 6); @@ -958,17 +961,17 @@ public class InputStream * Extracts an optional byte value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readByte(int tag, ByteOptional v) + public java.util.Optional<Byte> readByte(int tag) { if(readOptional(tag, OptionalFormat.F1)) { - v.set(readByte()); + return java.util.Optional.of(readByte()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -996,17 +999,17 @@ public class InputStream * Extracts an optional byte sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readByteSeq(int tag, Optional<byte[]> v) + public java.util.Optional<byte[]> readByteSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { - v.set(readByteSeq()); + return java.util.Optional.of(readByteSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1043,11 +1046,11 @@ public class InputStream { return null; } - IceInternal.ObjectInputStream in = null; + com.zeroc.IceInternal.ObjectInputStream in = null; try { - IceInternal.InputStreamWrapper w = new IceInternal.InputStreamWrapper(sz, _buf.b); - in = new IceInternal.ObjectInputStream(_instance, w); + com.zeroc.IceInternal.InputStreamWrapper w = new com.zeroc.IceInternal.InputStreamWrapper(sz, _buf.b); + in = new com.zeroc.IceInternal.ObjectInputStream(_instance, w); return (java.io.Serializable)in.readObject(); } catch(LocalException ex) @@ -1095,17 +1098,17 @@ public class InputStream * Extracts an optional boolean value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readBool(int tag, BooleanOptional v) + public java.util.Optional<Boolean> readBool(int tag) { if(readOptional(tag, OptionalFormat.F1)) { - v.set(readBool()); + return java.util.Optional.of(readBool()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1136,17 +1139,17 @@ public class InputStream * Extracts an optional boolean sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readBoolSeq(int tag, Optional<boolean[]> v) + public java.util.Optional<boolean[]> readBoolSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { - v.set(readBoolSeq()); + return java.util.Optional.of(readBoolSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1171,17 +1174,17 @@ public class InputStream * Extracts an optional short value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readShort(int tag, ShortOptional v) + public java.util.Optional<Short> readShort(int tag) { if(readOptional(tag, OptionalFormat.F2)) { - v.set(readShort()); + return java.util.Optional.of(readShort()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1211,18 +1214,18 @@ public class InputStream * Extracts an optional short sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readShortSeq(int tag, Optional<short[]> v) + public java.util.Optional<short[]> readShortSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { skipSize(); - v.set(readShortSeq()); + return java.util.Optional.of(readShortSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1269,17 +1272,17 @@ public class InputStream * Extracts an optional int value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readInt(int tag, IntOptional v) + public java.util.OptionalInt readInt(int tag) { if(readOptional(tag, OptionalFormat.F4)) { - v.set(readInt()); + return java.util.OptionalInt.of(readInt()); } else { - v.clear(); + return java.util.OptionalInt.empty(); } } @@ -1309,18 +1312,18 @@ public class InputStream * Extracts an optional int sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readIntSeq(int tag, Optional<int[]> v) + public java.util.Optional<int[]> readIntSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { skipSize(); - v.set(readIntSeq()); + return java.util.Optional.of(readIntSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1367,17 +1370,17 @@ public class InputStream * Extracts an optional long value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readLong(int tag, LongOptional v) + public java.util.OptionalLong readLong(int tag) { if(readOptional(tag, OptionalFormat.F8)) { - v.set(readLong()); + return java.util.OptionalLong.of(readLong()); } else { - v.clear(); + return java.util.OptionalLong.empty(); } } @@ -1407,18 +1410,18 @@ public class InputStream * Extracts an optional long sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readLongSeq(int tag, Optional<long[]> v) + public java.util.Optional<long[]> readLongSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { skipSize(); - v.set(readLongSeq()); + return java.util.Optional.of(readLongSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1465,17 +1468,17 @@ public class InputStream * Extracts an optional float value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readFloat(int tag, FloatOptional v) + public java.util.Optional<Float> readFloat(int tag) { if(readOptional(tag, OptionalFormat.F4)) { - v.set(readFloat()); + return java.util.Optional.of(readFloat()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1505,18 +1508,18 @@ public class InputStream * Extracts an optional float sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readFloatSeq(int tag, Optional<float[]> v) + public java.util.Optional<float[]> readFloatSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { skipSize(); - v.set(readFloatSeq()); + return java.util.Optional.of(readFloatSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1563,17 +1566,17 @@ public class InputStream * Extracts an optional double value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readDouble(int tag, DoubleOptional v) + public java.util.OptionalDouble readDouble(int tag) { if(readOptional(tag, OptionalFormat.F8)) { - v.set(readDouble()); + return java.util.OptionalDouble.of(readDouble()); } else { - v.clear(); + return java.util.OptionalDouble.empty(); } } @@ -1603,18 +1606,18 @@ public class InputStream * Extracts an optional double sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readDoubleSeq(int tag, Optional<double[]> v) + public java.util.Optional<double[]> readDoubleSeq(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { skipSize(); - v.set(readDoubleSeq()); + return java.util.Optional.of(readDoubleSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1729,17 +1732,17 @@ public class InputStream * Extracts an optional string value from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readString(int tag, Optional<String> v) + public java.util.Optional<String> readString(int tag) { if(readOptional(tag, OptionalFormat.VSize)) { - v.set(readString()); + return java.util.Optional.of(readString()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1763,18 +1766,18 @@ public class InputStream * Extracts an optional string sequence from the stream. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readStringSeq(int tag, Optional<String[]> v) + public java.util.Optional<String[]> readStringSeq(int tag) { if(readOptional(tag, OptionalFormat.FSize)) { skip(4); - v.set(readStringSeq()); + return java.util.Optional.of(readStringSeq()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1797,18 +1800,18 @@ public class InputStream * Extracts an optional proxy from the stream. The stream must have been initialized with a communicator. * * @param tag The numeric tag associated with the value. - * @param v Holds the optional value (if any). + * @return The optional value (if any). **/ - public void readProxy(int tag, Optional<ObjectPrx> v) + public java.util.Optional<ObjectPrx> readProxy(int tag) { if(readOptional(tag, OptionalFormat.FSize)) { skip(4); - v.set(readProxy()); + return java.util.Optional.of(readProxy()); } else { - v.clear(); + return java.util.Optional.empty(); } } @@ -1859,19 +1862,22 @@ public class InputStream /** * Extracts the index of an optional Slice value from the stream. * - * @param v Holds the optional value (if any). If a value is present, it will not be set in the - * argument until after {@link #readPendingValues} has completed. + * @param tag The numeric tag associated with the value. + * @param cb The callback to notify the application when the extracted instance is available. + * The stream extracts Slice values in stages. The Ice run time calls {@link ReadValueCallback#valueReady} + * when the corresponding instance has been fully unmarshaled. + * + * @see ReadValueCallback **/ - public void readValue(int tag, Optional<Ice.Object> v) + public void readValue(int tag, ReadValueCallback cb) { if(readOptional(tag, OptionalFormat.Class)) { - OptionalObject opt = new OptionalObject(v, Ice.Object.class, ObjectImpl.ice_staticId()); - readValue(opt); + readValue(cb); } else { - v.clear(); + cb.valueReady(null); } } @@ -1913,7 +1919,7 @@ public class InputStream final byte b = readByte(); final int v = b < 0 ? b + 256 : b; - if(v == IceInternal.Protocol.OPTIONAL_END_MARKER) + if(v == Protocol.OPTIONAL_END_MARKER) { _buf.b.position(_buf.b.position() - 1); // Rewind. return false; @@ -2008,7 +2014,7 @@ public class InputStream final byte b = readByte(); final int v = b < 0 ? b + 256 : b; - if(v == IceInternal.Protocol.OPTIONAL_END_MARKER) + if(v == Protocol.OPTIONAL_END_MARKER) { return; } @@ -2111,8 +2117,8 @@ public class InputStream return userEx; } - private IceInternal.Instance _instance; - private IceInternal.Buffer _buf; + private Instance _instance; + private Buffer _buf; private Object _closure; private byte[] _stringBytes; // Reusable array for reading strings. private char[] _stringChars; // Reusable array for reading strings. @@ -2128,7 +2134,7 @@ public class InputStream _valueFactoryManager = f; _classResolver = cr; _typeIdIndex = 0; - _unmarshaledMap = new java.util.TreeMap<Integer, Ice.Object>(); + _unmarshaledMap = new java.util.TreeMap<>(); } abstract void readValue(ReadValueCallback cb); @@ -2154,7 +2160,7 @@ public class InputStream { if(_typeIdMap == null) // Lazy initialization { - _typeIdMap = new java.util.TreeMap<Integer, String>(); + _typeIdMap = new java.util.TreeMap<>(); } if(isIndex) @@ -2180,7 +2186,7 @@ public class InputStream Class<?> cls = null; if(_typeIdCache == null) { - _typeIdCache = new java.util.HashMap<String, Class<?> >(); // Lazy initialization. + _typeIdCache = new java.util.HashMap<>(); // Lazy initialization. } else { @@ -2210,13 +2216,13 @@ public class InputStream return cls; } - protected Ice.Object newInstance(String typeId) + protected Value newInstance(String typeId) { // // Try to find a factory registered for the specific type. // ValueFactory userFactory = _valueFactoryManager.find(typeId); - Ice.Object v = null; + Value v = null; if(userFactory != null) { v = userFactory.create(typeId); @@ -2246,7 +2252,7 @@ public class InputStream { try { - v = (Ice.Object)cls.newInstance(); + v = (Value)cls.newInstance(); } catch(java.lang.Exception ex) { @@ -2266,7 +2272,7 @@ public class InputStream // Check if we have already unmarshalled the instance. If that's the case, // just invoke the callback and we're done. // - Ice.Object obj = _unmarshaledMap.get(index); + Value obj = _unmarshaledMap.get(index); if(obj != null) { cb.valueReady(obj); @@ -2275,7 +2281,7 @@ public class InputStream if(_patchMap == null) // Lazy initialization { - _patchMap = new java.util.TreeMap<Integer, java.util.LinkedList<ReadValueCallback> >(); + _patchMap = new java.util.TreeMap<>(); } // @@ -2290,7 +2296,7 @@ public class InputStream // We have no outstanding instances to be patched for this // index, so make a new entry in the patch map. // - l = new java.util.LinkedList<ReadValueCallback>(); + l = new java.util.LinkedList<>(); _patchMap.put(index, l); } @@ -2300,7 +2306,7 @@ public class InputStream l.add(cb); } - protected void unmarshal(int index, Ice.Object v) + protected void unmarshal(int index, Value v) { // // Add the instance to the map of unmarshaled instances, this must @@ -2347,7 +2353,7 @@ public class InputStream } catch(java.lang.Exception ex) { - String s = "exception raised by ice_postUnmarshal:\n" + IceInternal.Ex.toString(ex); + String s = "exception raised by ice_postUnmarshal:\n" + com.zeroc.IceInternal.Ex.toString(ex); _stream.instance().initializationData().logger.warning(s); } } @@ -2355,7 +2361,7 @@ public class InputStream { if(_valueList == null) // Lazy initialization { - _valueList = new java.util.ArrayList<Ice.Object>(); + _valueList = new java.util.ArrayList<>(); } _valueList.add(v); @@ -2367,7 +2373,7 @@ public class InputStream // unmarshaled in order to ensure that any instance data members // have been properly patched. // - for(Ice.Object p : _valueList) + for(Value p : _valueList) { try { @@ -2375,7 +2381,8 @@ public class InputStream } catch(java.lang.Exception ex) { - String s = "exception raised by ice_postUnmarshal:\n" + IceInternal.Ex.toString(ex); + String s = "exception raised by ice_postUnmarshal:\n" + + com.zeroc.IceInternal.Ex.toString(ex); _stream.instance().initializationData().logger.warning(s); } } @@ -2393,10 +2400,10 @@ public class InputStream // Encapsulation attributes for value unmarshaling. // protected java.util.TreeMap<Integer, java.util.LinkedList<ReadValueCallback> > _patchMap; - private java.util.TreeMap<Integer, Ice.Object> _unmarshaledMap; + private java.util.TreeMap<Integer, Value> _unmarshaledMap; private java.util.TreeMap<Integer, String> _typeIdMap; private int _typeIdIndex; - private java.util.List<Ice.Object> _valueList; + private java.util.List<Value> _valueList; private java.util.HashMap<String, Class<?> > _typeIdCache; } @@ -2639,14 +2646,14 @@ public class InputStream // startSlice(); final String mostDerivedId = _typeId; - Ice.Object v = null; + Value v = null; while(true) { // // For the 1.0 encoding, the type ID for the base Object class // marks the last slice. // - if(_typeId.equals(ObjectImpl.ice_staticId())) + if(_typeId.equals(Value.ice_staticId)) { throw new NoValueFactoryException("", mostDerivedId); } @@ -2717,7 +2724,7 @@ public class InputStream cb.valueReady(null); } } - else if(_current != null && (_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) + else if(_current != null && (_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) { // // When reading a class instance within a slice and there's an @@ -2734,7 +2741,7 @@ public class InputStream { if(_current.indirectPatchList == null) // Lazy initialization { - _current.indirectPatchList = new java.util.ArrayDeque<IndirectPatchEntry>(); + _current.indirectPatchList = new java.util.ArrayDeque<>(); } IndirectPatchEntry e = new IndirectPatchEntry(); e.index = index - 1; @@ -2801,7 +2808,7 @@ public class InputStream // skipSlice(); - if((_current.sliceFlags & IceInternal.Protocol.FLAG_IS_LAST_SLICE) != 0) + if((_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0) { if(mostDerivedId.startsWith("::")) { @@ -2863,17 +2870,17 @@ public class InputStream // if(_current.sliceType == SliceType.ValueSlice) { - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_TYPE_ID_COMPACT) == - IceInternal.Protocol.FLAG_HAS_TYPE_ID_COMPACT) // Must be checked 1st! + if((_current.sliceFlags & Protocol.FLAG_HAS_TYPE_ID_COMPACT) == + Protocol.FLAG_HAS_TYPE_ID_COMPACT) // Must be checked 1st! { _current.typeId = ""; _current.compactId = _stream.readSize(); } - else if((_current.sliceFlags & (IceInternal.Protocol.FLAG_HAS_TYPE_ID_INDEX | - IceInternal.Protocol.FLAG_HAS_TYPE_ID_STRING)) != 0) + else if((_current.sliceFlags & (Protocol.FLAG_HAS_TYPE_ID_INDEX | + Protocol.FLAG_HAS_TYPE_ID_STRING)) != 0) { _current.typeId = - readTypeId((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_TYPE_ID_INDEX) != 0); + readTypeId((_current.sliceFlags & Protocol.FLAG_HAS_TYPE_ID_INDEX) != 0); _current.compactId = -1; } else @@ -2894,7 +2901,7 @@ public class InputStream // // Read the slice size if necessary. // - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0) + if((_current.sliceFlags & Protocol.FLAG_HAS_SLICE_SIZE) != 0) { _current.sliceSize = _stream.readInt(); if(_current.sliceSize < 4) @@ -2913,7 +2920,7 @@ public class InputStream @Override void endSlice() { - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0) + if((_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0) { _stream.skipOptionals(); } @@ -2922,7 +2929,7 @@ public class InputStream // Read the indirection table if one is present and transform the // indirect patch list into patch entries with direct references. // - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) + if((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) { // // The table is written as a sequence<size> to conserve space. @@ -2943,7 +2950,7 @@ public class InputStream throw new MarshalException("empty indirection table"); } if((_current.indirectPatchList == null || _current.indirectPatchList.isEmpty()) && - (_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) == 0) + (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) == 0) { throw new MarshalException("no references to indirection table"); } @@ -2974,7 +2981,7 @@ public class InputStream int start = _stream.pos(); - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0) + if((_current.sliceFlags & Protocol.FLAG_HAS_SLICE_SIZE) != 0) { assert(_current.sliceSize >= 4); _stream.skip(_current.sliceSize - 4); @@ -3006,8 +3013,8 @@ public class InputStream SliceInfo info = new SliceInfo(); info.typeId = _current.typeId; info.compactId = _current.compactId; - info.hasOptionalMembers = (_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0; - info.isLastSlice = (_current.sliceFlags & IceInternal.Protocol.FLAG_IS_LAST_SLICE) != 0; + info.hasOptionalMembers = (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0; + info.isLastSlice = (_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0; java.nio.ByteBuffer b = _stream.getBuffer().b; final int end = b.position(); int dataEnd = end; @@ -3026,8 +3033,8 @@ public class InputStream if(_current.slices == null) // Lazy initialization { - _current.slices = new java.util.ArrayList<SliceInfo>(); - _current.indirectionTables = new java.util.ArrayList<int[]>(); + _current.slices = new java.util.ArrayList<>(); + _current.indirectionTables = new java.util.ArrayList<>(); } // @@ -3039,7 +3046,7 @@ public class InputStream // readSlicedData is called. // - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) + if((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) { int[] indirectionTable = new int[_stream.readAndCheckSeqSize(1)]; for(int i = 0; i < indirectionTable.length; ++i) @@ -3063,7 +3070,7 @@ public class InputStream { return _stream.readOptImpl(readTag, expectedFormat); } - else if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0) + else if((_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0) { return _stream.readOptImpl(readTag, expectedFormat); } @@ -3097,7 +3104,7 @@ public class InputStream // startSlice(); final String mostDerivedId = _current.typeId; - Ice.Object v = null; + Value v = null; while(true) { boolean updateCache = false; @@ -3111,7 +3118,7 @@ public class InputStream // if(_compactIdCache == null) { - _compactIdCache = new java.util.TreeMap<Integer, Class<?> >(); // Lazy initialization. + _compactIdCache = new java.util.TreeMap<>(); // Lazy initialization. } else { @@ -3123,7 +3130,7 @@ public class InputStream { try { - v = (Ice.Object)cls.newInstance(); + v = (Value)cls.newInstance(); updateCache = false; } catch(java.lang.Exception ex) @@ -3147,14 +3154,14 @@ public class InputStream { _current.typeId = _compactIdResolver.resolve(_current.compactId); } - catch(Ice.LocalException ex) + catch(LocalException ex) { throw ex; } catch(Throwable ex) { - throw new Ice.MarshalException("exception in CompactIdResolver for ID " + - _current.compactId, ex); + throw new MarshalException("exception in CompactIdResolver for ID " + + _current.compactId, ex); } } @@ -3202,14 +3209,14 @@ public class InputStream // If this is the last slice, keep the instance as an opaque // UnknownSlicedValue object. // - if((_current.sliceFlags & IceInternal.Protocol.FLAG_IS_LAST_SLICE) != 0) + if((_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0) { // // Provide a factory with an opportunity to supply the instance. // We pass the "::Ice::Object" ID to indicate that this is the // last chance to preserve the instance. // - v = newInstance(ObjectImpl.ice_staticId()); + v = newInstance(Value.ice_staticId); if(v == null) { v = new UnknownSlicedValue(mostDerivedId); @@ -3265,10 +3272,11 @@ public class InputStream // final int[] table = _current.indirectionTables.get(n); SliceInfo info = _current.slices.get(n); - info.instances = new Ice.Object[table != null ? table.length : 0]; + info.instances = new Value[table != null ? table.length : 0]; for(int j = 0; j < info.instances.length; ++j) { - addPatchEntry(table[j], new IceInternal.SequencePatcher(info.instances, Ice.Object.class, j)); + addPatchEntry(table[j], + new SequencePatcher<Value>(info.instances, Value.class, Value.ice_staticId, j)); } } @@ -3404,11 +3412,17 @@ public class InputStream { if(_traceSlicing && _logger != null) { - IceInternal.TraceUtil.traceSlicing(sliceType == SliceType.ExceptionSlice ? "exception" : "object", typeId, - "Slicing", _logger); + com.zeroc.IceInternal.TraceUtil.traceSlicing( + sliceType == SliceType.ExceptionSlice ? "exception" : "object", typeId, "Slicing", _logger); } } + @FunctionalInterface + static public interface Unmarshaler + { + void unmarshal(InputStream istr); + } + private boolean _sliceValues; private boolean _traceSlicing; diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java new file mode 100644 index 00000000000..86a303e7656 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InvocationFuture.java @@ -0,0 +1,131 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; + +/** + * An instance of an InvocationFuture subclass is the return value of an asynchronous invocation. + * With this object, an application can obtain several attributes of the invocation. + **/ +public abstract class InvocationFuture<T> extends CompletableFuture<T> +{ + /** + * If not completed, cancels the request. This is a local + * operation, it won't cancel the request on the server side. + * Calling <code>cancel</code> prevents a queued request from + * being sent or ignores a reply if the request has already + * been sent. + * + * @return True if this task is now cancelled. + **/ + public abstract boolean cancel(); + + /** + * Returns the communicator that sent the invocation. + * + * @return The communicator. + **/ + public abstract Communicator getCommunicator(); + + /** + * Returns the connection that was used to start the invocation, or nil + * if this future was not obtained via an asynchronous connection invocation + * (such as <code>flushBatchRequestsAsync</code>). + * + * @return The connection. + **/ + public abstract Connection getConnection(); + + /** + * Returns the proxy that was used to start the asynchronous invocation, or nil + * if this object was not obtained via an asynchronous proxy invocation. + * + * @return The proxy. + **/ + public abstract ObjectPrx getProxy(); + + /** + * Returns the name of the operation. + * + * @return The operation name. + **/ + public abstract String getOperation(); + + /** + * Blocks the caller until the result of the invocation is available. + **/ + public abstract void waitForCompleted(); + + /** + * When you start an asynchronous invocation, the Ice run time attempts to + * write the corresponding request to the client-side transport. If the + * transport cannot accept the request, the Ice run time queues the request + * for later transmission. This method returns true if, at the time it is called, + * the request has been written to the local transport (whether it was initially + * queued or not). Otherwise, if the request is still queued, this method returns + * false. + * + * @return True if the request has been sent, or false if the request is queued. + **/ + public abstract boolean isSent(); + + /** + * Blocks the caller until the request has been written to the client-side transport. + **/ + public abstract void waitForSent(); + + /** + * Returns true if a request was written to the client-side + * transport without first being queued. If the request was initially + * queued, this method returns false (independent of whether the request + * is still in the queue or has since been written to the client-side transport). + * + * @return True if the request was sent without being queued, or false + * otherwise. + **/ + public abstract boolean sentSynchronously(); + + /** + * Returns a future that completes when the entire request message has been + * accepted by the transport and executes the given action. The boolean value + * indicates whether the message was sent synchronously. + * + * @param action Executed when the future is completed successfully or exceptionally. + * @return A future that completes when the message has been handed off to the transport. + **/ + public abstract CompletableFuture<Boolean> whenSent( + java.util.function.BiConsumer<Boolean, ? super Throwable> action); + + /** + * Returns a future that completes when the entire request message has been + * accepted by the transport and executes the given action using the default executor. The boolean value + * indicates whether the message was sent synchronously. + * + * @param action Executed when the future is completed successfully or exceptionally. + * @return A future that completes when the message has been handed off to the transport. + **/ + public abstract CompletableFuture<Boolean> whenSentAsync( + java.util.function.BiConsumer<Boolean, ? super Throwable> action); + + /** + * Returns a future that completes when the entire request message has been + * accepted by the transport and executes the given action using the executor. The boolean value + * indicates whether the message was sent synchronously. + * + * @param action Executed when the future is completed successfully or exceptionally. + * @param executor The executor to use for asynchronous execution. + * @return A future that completes when the message has been handed off to the transport. + **/ + public abstract CompletableFuture<Boolean> whenSentAsync( + java.util.function.BiConsumer<Boolean, ? super Throwable> action, + Executor executor); +} diff --git a/java/src/Ice/src/main/java/Ice/LocalException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/LocalException.java index 2052b64a0c7..5056dacf449 100644 --- a/java/src/Ice/src/main/java/Ice/LocalException.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/LocalException.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Base class for all Ice run-time exceptions. diff --git a/java/src/Ice/src/main/java/Ice/LoggerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerI.java index a1108e6df55..c2e2aed82d2 100644 --- a/java/src/Ice/src/main/java/Ice/LoggerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public class LoggerI implements Logger { @@ -108,7 +108,7 @@ public class LoggerI implements Logger write(s, true); } - + @Override public String getPrefix() diff --git a/java/src/Ice/src/main/java/Ice/LoggerPlugin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerPlugin.java index 90af9141202..e78c46ef383 100644 --- a/java/src/Ice/src/main/java/Ice/LoggerPlugin.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/LoggerPlugin.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Class to support custom loggers. Applications using a custom logger @@ -17,7 +17,7 @@ package Ice; * @see PluginFactory * @see Plugin **/ -public class LoggerPlugin implements Ice.Plugin +public class LoggerPlugin implements Plugin { /** * Installs a custom logger for a communicator. @@ -42,7 +42,7 @@ public class LoggerPlugin implements Ice.Plugin throw ex; } - IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); instance.setLogger(logger); } diff --git a/java/src/IceBT/src/main/java/IceBT/Util.java b/java/src/Ice/src/main/java/com/zeroc/Ice/MarshaledResult.java index ffb07e0a2f5..84cccff3887 100644 --- a/java/src/IceBT/src/main/java/IceBT/Util.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/MarshaledResult.java @@ -1,14 +1,12 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** -package IceBT; +package com.zeroc.Ice; -public final class Util +public interface MarshaledResult { + OutputStream getOutputStream(); } diff --git a/java/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java index 1e5df346592..6c163f26f6d 100644 --- a/java/src/Ice/src/main/java/Ice/NativePropertiesAdmin.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/NativePropertiesAdmin.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public interface NativePropertiesAdmin { diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java new file mode 100644 index 00000000000..92e17bcfa79 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java @@ -0,0 +1,320 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +import java.util.concurrent.CompletionStage; + +import com.zeroc.IceInternal.Incoming; + +/** + * The base interface for servants. + **/ +public interface Object +{ + public static final String ice_staticId = "::Ice::Object"; + + public final static String[] __ids = + { + ice_staticId + }; + + /** + * Holds the results of a call to <code>ice_invoke</code>. + **/ + public class Ice_invokeResult + { + /** + * Default initializes the members. + **/ + public Ice_invokeResult() + { + } + + /** + * One-shot constructor to initialize the members. + * + * @param returnValue True for a succesful invocation with any results encoded in <code>outParams</code>. + * False if a user exception occurred with the exception encoded in <code>outParams</code>. + * @param outParams The encoded results. + **/ + public Ice_invokeResult(boolean returnValue, byte[] outParams) + { + this.returnValue = returnValue; + this.outParams = outParams; + } + + /** + * If the operation completed successfully, the return value + * is <code>true</code>. If the operation raises a user exception, + * the return value is <code>false</code>; in this case, <code>outParams</code> + * contains the encoded user exception. If the operation raises a run-time exception, + * it throws it directly. + **/ + public boolean returnValue; + + /** + * The encoded out-paramaters and return value for the operation. The return value + * follows any out-parameters. + **/ + public byte[] outParams; + } + + /** + * Tests whether this object supports a specific Slice interface. + * + * @param s The type ID of the Slice interface to test against. + * @param current The {@link Current} object for the invocation. + * @return <code>true</code> if this object has the interface + * specified by <code>s</code> or derives from the interface + * specified by <code>s</code>. + **/ + default boolean ice_isA(String s, Current current) + { + return java.util.Arrays.binarySearch(ice_ids(current), s) >= 0; + } + + /** + * Tests whether this object can be reached. + * + * @param current The {@link Current} object for the invocation. + **/ + default void ice_ping(Current current) + { + // Nothing to do. + } + + /** + * Returns the Slice type IDs of the interfaces supported by this object. + * + * @param current The {@link Current} object for the invocation. + * @return The Slice type IDs of the interfaces supported by this object, in base-to-derived + * order. The first element of the returned array is always <code>::Ice::Object</code>. + **/ + default String[] ice_ids(Current current) + { + return __ids; + } + + /** + * Returns the Slice type ID of the most-derived interface supported by this object. + * + * @param current The {@link Current} object for the invocation. + * @return The Slice type ID of the most-derived interface. + **/ + default String ice_id(Current current) + { + return __ids[0]; + } + + /** + * Returns the Slice type ID of the interface supported by this object. + * + * @return The return value is always ::Ice::Object. + **/ + public static String ice_staticId() + { + return ice_staticId; + } + + /** + * Returns the Freeze metadata attributes for an operation. + * + * @param operation The name of the operation. + * @return The least significant bit indicates whether the operation is a read + * or write operation. If the bit is set, the operation is a write operation. + * The expression <code>ice_operationAttributes("op") & 0x1</code> is true if + * the operation has a <code>["freeze:write"]</code> metadata directive. + * <p> + * The second- and third least significant bit indicate the transactional mode + * of the operation. The expression <code>ice_operationAttributes("op") & 0x6 >> 1</code> + * indicates the transactional mode as follows: + * <dl> + * <dt>0</dt> + * <dd><code>["freeze:read:supports"]</code></dd> + * <dt>1</dt> + * <dd><code>["freeze:read:mandatory"]</code> or <code>["freeze:write:mandatory"]</code></dd> + * <dt>2</dt> + * <dd><code>["freeze:read:required"]</code> or <code>["freeze:write:required"]</code></dd> + * <dt>3</dt> + * <dd><code>["freeze:read:never"]</code></dd> + * </dl> + * + * Refer to the Freeze manual for more information on the TransactionalEvictor. + **/ + default int ice_operationAttributes(String operation) + { + return 0; + } + + final static String[] __ops = + { + "ice_id", + "ice_ids", + "ice_isA", + "ice_ping" + }; + + /** + * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation + * to a servant (or to another interceptor). + * + * @param request The details of the invocation. + * @return A completion stage if the dispatched asynchronously, null otherwise. + * + * @see DispatchInterceptor + **/ + default CompletionStage<OutputStream> ice_dispatch(Request request) + throws UserException + { + Incoming in = (Incoming)request; + in.startOver(); + return __dispatch(in, in.getCurrent()); + } + + default CompletionStage<OutputStream> __dispatch(Incoming in, Current current) + throws UserException + { + int pos = java.util.Arrays.binarySearch(__ops, current.operation); + if(pos < 0) + { + throw new OperationNotExistException(current.id, current.facet, current.operation); + } + + switch(pos) + { + case 0: + { + return ___ice_id(this, in, current); + } + case 1: + { + return ___ice_ids(this, in, current); + } + case 2: + { + return ___ice_isA(this, in, current); + } + case 3: + { + return ___ice_ping(this, in, current); + } + } + + assert(false); + throw new OperationNotExistException(current.id, current.facet, current.operation); + } + + default void __write(OutputStream __os) + { + __os.startValue(null); + __writeImpl(__os); + __os.endValue(); + } + + default void __writeImpl(OutputStream __os) + { + } + + default void __read(InputStream __is) + { + __is.startValue(); + __readImpl(__is); + __is.endValue(false); + } + + default void __readImpl(InputStream __is) + { + } + + static CompletionStage<OutputStream> ___ice_isA(Object __obj, Incoming __inS, Current __current) + { + InputStream __is = __inS.startReadParams(); + String __id = __is.readString(); + __inS.endReadParams(); + boolean __ret = __obj.ice_isA(__id, __current); + OutputStream __os = __inS.startWriteParams(); + __os.writeBool(__ret); + __inS.endWriteParams(__os); + return __inS.setResult(__os); + } + + static CompletionStage<OutputStream> ___ice_ping(Object __obj, Incoming __inS, Current __current) + { + __inS.readEmptyParams(); + __obj.ice_ping(__current); + return __inS.setResult(__inS.writeEmptyParams()); + } + + static CompletionStage<OutputStream> ___ice_ids(Object __obj, Incoming __inS, Current __current) + { + __inS.readEmptyParams(); + String[] __ret = __obj.ice_ids(__current); + OutputStream __os = __inS.startWriteParams(); + __os.writeStringSeq(__ret); + __inS.endWriteParams(__os); + return __inS.setResult(__os); + } + + static CompletionStage<OutputStream> ___ice_id(Object __obj, Incoming __inS, Current __current) + { + __inS.readEmptyParams(); + String __ret = __obj.ice_id(__current); + OutputStream __os = __inS.startWriteParams(); + __os.writeString(__ret); + __inS.endWriteParams(__os); + return __inS.setResult(__os); + } + + static String __operationModeToString(OperationMode mode) + { + if(mode == OperationMode.Normal) + { + return "::Ice::Normal"; + } + if(mode == OperationMode.Nonmutating) + { + return "::Ice::Nonmutating"; + } + + if(mode == OperationMode.Idempotent) + { + return "::Ice::Idempotent"; + } + + return "???"; + } + + static void __checkMode(OperationMode expected, OperationMode received) + { + if(expected == null) + { + expected = OperationMode.Normal; + } + + if(expected != received) + { + if(expected == OperationMode.Idempotent && received == OperationMode.Nonmutating) + { + // + // Fine: typically an old client still using the + // deprecated nonmutating keyword + // + } + else + { + MarshalException ex = new MarshalException(); + ex.reason = "unexpected operation mode. expected = " + + __operationModeToString(expected) + " received = " + + __operationModeToString(received); + throw ex; + } + } + } +} diff --git a/java/src/Ice/src/main/java/Ice/ObjectAdapterI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java index 1aeef2206fa..61cf6d72537 100644 --- a/java/src/Ice/src/main/java/Ice/ObjectAdapterI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectAdapterI.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; import java.util.Map; import java.util.List; import java.util.ArrayList; -import IceInternal.IncomingConnectionFactory; +import com.zeroc.IceInternal.IncomingConnectionFactory; public final class ObjectAdapterI implements ObjectAdapter { @@ -38,7 +38,7 @@ public final class ObjectAdapterI implements ObjectAdapter public void activate() { - IceInternal.LocatorInfo locatorInfo = null; + com.zeroc.IceInternal.LocatorInfo locatorInfo = null; boolean printAdapterReady = false; synchronized(this) @@ -77,11 +77,11 @@ public final class ObjectAdapterI implements ObjectAdapter try { - Ice.Identity dummy = new Ice.Identity(); + Identity dummy = new Identity(); dummy.name = "dummy"; updateLocatorRegistry(locatorInfo, createDirectProxy(dummy)); } - catch(Ice.LocalException ex) + catch(LocalException ex) { // // If we couldn't update the locator registry, we let the @@ -137,14 +137,14 @@ public final class ObjectAdapterI implements ObjectAdapter { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } List<IncomingConnectionFactory> incomingConnectionFactories; synchronized(this) { checkForDeactivation(); - incomingConnectionFactories = new ArrayList<IncomingConnectionFactory>(_incomingConnectionFactories); + incomingConnectionFactories = new ArrayList<>(_incomingConnectionFactories); } for(IncomingConnectionFactory factory : incomingConnectionFactories) @@ -155,7 +155,7 @@ public final class ObjectAdapterI implements ObjectAdapter } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } } } @@ -167,7 +167,7 @@ public final class ObjectAdapterI implements ObjectAdapter { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } synchronized(this) @@ -184,7 +184,7 @@ public final class ObjectAdapterI implements ObjectAdapter } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } } if(_state > StateDeactivating) @@ -216,7 +216,7 @@ public final class ObjectAdapterI implements ObjectAdapter { updateLocatorRegistry(_locatorInfo, null); } - catch(Ice.LocalException ex) + catch(LocalException ex) { // // We can't throw exceptions in deactivate so we ignore @@ -254,7 +254,7 @@ public final class ObjectAdapterI implements ObjectAdapter { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } try @@ -275,7 +275,7 @@ public final class ObjectAdapterI implements ObjectAdapter { return; } - incomingConnectionFactories = new ArrayList<IncomingConnectionFactory>(_incomingConnectionFactories); + incomingConnectionFactories = new ArrayList<>(_incomingConnectionFactories); } // @@ -290,7 +290,7 @@ public final class ObjectAdapterI implements ObjectAdapter } catch(InterruptedException e) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } } @@ -307,7 +307,7 @@ public final class ObjectAdapterI implements ObjectAdapter { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } // @@ -333,7 +333,7 @@ public final class ObjectAdapterI implements ObjectAdapter } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } } if(_state == StateDestroyed) @@ -362,7 +362,7 @@ public final class ObjectAdapterI implements ObjectAdapter } catch (InterruptedException e) { - throw new Ice.OperationInterruptedException(); + throw new OperationInterruptedException(); } } @@ -394,14 +394,14 @@ public final class ObjectAdapterI implements ObjectAdapter @Override public ObjectPrx - add(Ice.Object object, Identity ident) + add(com.zeroc.Ice.Object object, Identity ident) { return addFacet(object, ident, ""); } @Override public synchronized ObjectPrx - addFacet(Ice.Object object, Identity ident, String facet) + addFacet(com.zeroc.Ice.Object object, Identity ident, String facet) { checkForDeactivation(); checkIdentity(ident); @@ -422,14 +422,14 @@ public final class ObjectAdapterI implements ObjectAdapter @Override public ObjectPrx - addWithUUID(Ice.Object object) + addWithUUID(com.zeroc.Ice.Object object) { return addFacetWithUUID(object, ""); } @Override public ObjectPrx - addFacetWithUUID(Ice.Object object, String facet) + addFacetWithUUID(com.zeroc.Ice.Object object, String facet) { Identity ident = new Identity(); ident.category = ""; @@ -440,7 +440,7 @@ public final class ObjectAdapterI implements ObjectAdapter @Override public synchronized void - addDefaultServant(Ice.Object servant, String category) + addDefaultServant(com.zeroc.Ice.Object servant, String category) { checkServant(servant); checkForDeactivation(); @@ -449,14 +449,14 @@ public final class ObjectAdapterI implements ObjectAdapter } @Override - public Ice.Object + public com.zeroc.Ice.Object remove(Identity ident) { return removeFacet(ident, ""); } @Override - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object removeFacet(Identity ident, String facet) { checkForDeactivation(); @@ -476,7 +476,7 @@ public final class ObjectAdapterI implements ObjectAdapter } @Override - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object removeDefaultServant(String category) { checkForDeactivation(); @@ -485,14 +485,14 @@ public final class ObjectAdapterI implements ObjectAdapter } @Override - public Ice.Object + public com.zeroc.Ice.Object find(Identity ident) { return findFacet(ident, ""); } @Override - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object findFacet(Identity ident, String facet) { checkForDeactivation(); @@ -502,7 +502,7 @@ public final class ObjectAdapterI implements ObjectAdapter } @Override - public synchronized java.util.Map<String, Ice.Object> + public synchronized java.util.Map<String, com.zeroc.Ice.Object> findAllFacets(Identity ident) { checkForDeactivation(); @@ -512,17 +512,17 @@ public final class ObjectAdapterI implements ObjectAdapter } @Override - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object findByProxy(ObjectPrx proxy) { checkForDeactivation(); - IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference(); + com.zeroc.IceInternal.Reference ref = ((_ObjectPrxI)proxy).__reference(); return findFacet(ref.getIdentity(), ref.getFacet()); } @Override - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object findDefaultServant(String category) { checkForDeactivation(); @@ -614,8 +614,8 @@ public final class ObjectAdapterI implements ObjectAdapter public void refreshPublishedEndpoints() { - IceInternal.LocatorInfo locatorInfo = null; - List<IceInternal.EndpointI> oldPublishedEndpoints; + com.zeroc.IceInternal.LocatorInfo locatorInfo = null; + List<com.zeroc.IceInternal.EndpointI> oldPublishedEndpoints; synchronized(this) { @@ -629,11 +629,11 @@ public final class ObjectAdapterI implements ObjectAdapter try { - Ice.Identity dummy = new Ice.Identity(); + Identity dummy = new Identity(); dummy.name = "dummy"; updateLocatorRegistry(locatorInfo, createDirectProxy(dummy)); } - catch(Ice.LocalException ex) + catch(LocalException ex) { synchronized(this) { @@ -650,7 +650,7 @@ public final class ObjectAdapterI implements ObjectAdapter public synchronized Endpoint[] getEndpoints() { - List<Endpoint> endpoints = new ArrayList<Endpoint>(); + List<Endpoint> endpoints = new ArrayList<>(); for(IncomingConnectionFactory factory : _incomingConnectionFactories) { endpoints.add(factory.endpoint()); @@ -673,7 +673,7 @@ public final class ObjectAdapterI implements ObjectAdapter // it can be called for AMI invocations if the proxy has no delegate set yet. // - IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference(); + com.zeroc.IceInternal.Reference ref = ((_ObjectPrxI)proxy).__reference(); if(ref.isWellKnown()) { // @@ -692,7 +692,7 @@ public final class ObjectAdapterI implements ObjectAdapter } else { - IceInternal.EndpointI[] endpoints = ref.getEndpoints(); + com.zeroc.IceInternal.EndpointI[] endpoints = ref.getEndpoints(); synchronized(this) { @@ -703,9 +703,9 @@ public final class ObjectAdapterI implements ObjectAdapter // endpoints used by this object adapter's incoming connection // factories are considered local. // - for(IceInternal.EndpointI endpoint : endpoints) + for(com.zeroc.IceInternal.EndpointI endpoint : endpoints) { - for(IceInternal.EndpointI p : _publishedEndpoints) + for(com.zeroc.IceInternal.EndpointI p : _publishedEndpoints) { if(endpoint.equivalent(p)) { @@ -728,9 +728,9 @@ public final class ObjectAdapterI implements ObjectAdapter // if(_routerInfo != null && _routerInfo.getRouter().equals(proxy.ice_getRouter())) { - for(IceInternal.EndpointI endpoint : endpoints) + for(com.zeroc.IceInternal.EndpointI endpoint : endpoints) { - for(IceInternal.EndpointI p : _routerEndpoints) + for(com.zeroc.IceInternal.EndpointI p : _routerEndpoints) { if(endpoint.equivalent(p)) { @@ -746,12 +746,12 @@ public final class ObjectAdapterI implements ObjectAdapter } public void - flushAsyncBatchRequests(IceInternal.CommunicatorFlushBatch outAsync) + flushAsyncBatchRequests(com.zeroc.IceInternal.CommunicatorFlushBatch outAsync) { List<IncomingConnectionFactory> f; synchronized(this) { - f = new ArrayList<IncomingConnectionFactory>(_incomingConnectionFactories); + f = new ArrayList<>(_incomingConnectionFactories); } for(IncomingConnectionFactory p : f) { @@ -765,7 +765,7 @@ public final class ObjectAdapterI implements ObjectAdapter List<IncomingConnectionFactory> f; synchronized(this) { - f = new ArrayList<IncomingConnectionFactory>(_incomingConnectionFactories); + f = new ArrayList<>(_incomingConnectionFactories); } for(IncomingConnectionFactory p : f) { @@ -776,7 +776,7 @@ public final class ObjectAdapterI implements ObjectAdapter public void updateThreadObservers() { - IceInternal.ThreadPool threadPool = null; + com.zeroc.IceInternal.ThreadPool threadPool = null; synchronized(this) { threadPool = _threadPool; @@ -810,7 +810,7 @@ public final class ObjectAdapterI implements ObjectAdapter } } - public IceInternal.ThreadPool + public com.zeroc.IceInternal.ThreadPool getThreadPool() { // No mutex lock necessary, _threadPool and _instance are @@ -831,7 +831,7 @@ public final class ObjectAdapterI implements ObjectAdapter } } - public IceInternal.ServantManager + public com.zeroc.IceInternal.ServantManager getServantManager() { // @@ -840,7 +840,7 @@ public final class ObjectAdapterI implements ObjectAdapter return _servantManager; } - public IceInternal.ACMConfig + public com.zeroc.IceInternal.ACMConfig getACM() { // No check for deactivation here! @@ -856,17 +856,17 @@ public final class ObjectAdapterI implements ObjectAdapter } // - // Only for use by IceInternal.ObjectAdapterFactory + // Only for use by com.zeroc.IceInternal.ObjectAdapterFactory // public - ObjectAdapterI(IceInternal.Instance instance, Communicator communicator, - IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, + ObjectAdapterI(com.zeroc.IceInternal.Instance instance, Communicator communicator, + com.zeroc.IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, RouterPrx router, boolean noConfig) { _instance = instance; _communicator = communicator; _objectAdapterFactory = objectAdapterFactory; - _servantManager = new IceInternal.ServantManager(instance, name); + _servantManager = new com.zeroc.IceInternal.ServantManager(instance, name); _name = name; _directCount = 0; _noConfig = noConfig; @@ -882,7 +882,7 @@ public final class ObjectAdapterI implements ObjectAdapter } final Properties properties = _instance.initializationData().properties; - List<String> unknownProps = new ArrayList<String>(); + List<String> unknownProps = new ArrayList<>(); boolean noProps = filterProperties(unknownProps); // @@ -937,7 +937,8 @@ public final class ObjectAdapterI implements ObjectAdapter throw ex; } - _acm = new IceInternal.ACMConfig(properties, communicator.getLogger(), _name + ".ACM", instance.serverACM()); + _acm = new com.zeroc.IceInternal.ACMConfig(properties, communicator.getLogger(), _name + ".ACM", + instance.serverACM()); { final int defaultMessageSizeMax = instance.messageSizeMax() / 1024; @@ -962,12 +963,12 @@ public final class ObjectAdapterI implements ObjectAdapter // if(threadPoolSize > 0 || threadPoolSizeMax > 0) { - _threadPool = new IceInternal.ThreadPool(_instance, _name + ".ThreadPool", 0); + _threadPool = new com.zeroc.IceInternal.ThreadPool(_instance, _name + ".ThreadPool", 0); } if(router == null) { - router = RouterPrxHelper.uncheckedCast(_instance.proxyFactory().propertyToProxy(name + ".Router")); + router = RouterPrx.uncheckedCast(_instance.proxyFactory().propertyToProxy(name + ".Router")); } if(router != null) { @@ -980,15 +981,15 @@ public final class ObjectAdapterI implements ObjectAdapter if(_routerInfo.getAdapter() != null) { throw new AlreadyRegisteredException("object adapter with router", - Ice.Util.identityToString(router.ice_getIdentity())); + Util.identityToString(router.ice_getIdentity())); } // // Add the router's server proxy endpoints to this object // adapter. // - IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints(); - for(IceInternal.EndpointI endpoint : endpoints) + com.zeroc.IceInternal.EndpointI[] endpoints = _routerInfo.getServerEndpoints(); + for(com.zeroc.IceInternal.EndpointI endpoint : endpoints) { _routerEndpoints.add(endpoint); } @@ -1000,8 +1001,8 @@ public final class ObjectAdapterI implements ObjectAdapter // for(int i = 0; i < _routerEndpoints.size() - 1;) { - IceInternal.EndpointI e1 = _routerEndpoints.get(i); - IceInternal.EndpointI e2 = _routerEndpoints.get(i + 1); + com.zeroc.IceInternal.EndpointI e1 = _routerEndpoints.get(i); + com.zeroc.IceInternal.EndpointI e2 = _routerEndpoints.get(i + 1); if(e1.equals(e2)) { _routerEndpoints.remove(i); @@ -1033,16 +1034,16 @@ public final class ObjectAdapterI implements ObjectAdapter // Parse the endpoints, but don't store them in the adapter. The connection // factory might change it, for example, to fill in the real port number. // - List<IceInternal.EndpointI> endpoints = + List<com.zeroc.IceInternal.EndpointI> endpoints = parseEndpoints(properties.getProperty(_name + ".Endpoints"), true); - for(IceInternal.EndpointI endp : endpoints) + for(com.zeroc.IceInternal.EndpointI endp : endpoints) { IncomingConnectionFactory factory = new IncomingConnectionFactory(instance, endp, this); _incomingConnectionFactories.add(factory); } if(endpoints.size() == 0) { - IceInternal.TraceLevels tl = _instance.traceLevels(); + com.zeroc.IceInternal.TraceLevels tl = _instance.traceLevels(); if(tl.network >= 2) { _instance.initializationData().logger.trace(tl.networkCat, @@ -1058,8 +1059,7 @@ public final class ObjectAdapterI implements ObjectAdapter if(properties.getProperty(_name + ".Locator").length() > 0) { - setLocator(LocatorPrxHelper.uncheckedCast( - _instance.proxyFactory().propertyToProxy(_name + ".Locator"))); + setLocator(LocatorPrx.uncheckedCast(_instance.proxyFactory().propertyToProxy(_name + ".Locator"))); } else { @@ -1092,11 +1092,11 @@ public final class ObjectAdapterI implements ObjectAdapter } else { - IceUtilInternal.Assert.FinalizerAssert(_threadPool == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_threadPool == null); // Not cleared, it needs to be immutable. - //IceUtilInternal.Assert.FinalizerAssert(_servantManager == null); - //IceUtilInternal.Assert.FinalizerAssert(_incomingConnectionFactories.isEmpty()); - IceUtilInternal.Assert.FinalizerAssert(_directCount == 0); + //com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_servantManager == null); + //com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_incomingConnectionFactories.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_directCount == 0); } } catch(java.lang.Exception ex) @@ -1128,10 +1128,10 @@ public final class ObjectAdapterI implements ObjectAdapter private ObjectPrx newDirectProxy(Identity ident, String facet) { - IceInternal.EndpointI[] endpoints; + com.zeroc.IceInternal.EndpointI[] endpoints; int sz = _publishedEndpoints.size(); - endpoints = new IceInternal.EndpointI[sz + _routerEndpoints.size()]; + endpoints = new com.zeroc.IceInternal.EndpointI[sz + _routerEndpoints.size()]; _publishedEndpoints.toArray(endpoints); // @@ -1147,7 +1147,7 @@ public final class ObjectAdapterI implements ObjectAdapter // // Create a reference and return a proxy for this reference. // - IceInternal.Reference ref = _instance.referenceFactory().create(ident, facet, _reference, endpoints); + com.zeroc.IceInternal.Reference ref = _instance.referenceFactory().create(ident, facet, _reference, endpoints); return _instance.proxyFactory().referenceToProxy(ref); } @@ -1158,7 +1158,7 @@ public final class ObjectAdapterI implements ObjectAdapter // Create a reference with the adapter id and return a proxy // for the reference. // - IceInternal.Reference ref = _instance.referenceFactory().create(ident, facet, _reference, id); + com.zeroc.IceInternal.Reference ref = _instance.referenceFactory().create(ident, facet, _reference, id); return _instance.proxyFactory().referenceToProxy(ref); } @@ -1188,7 +1188,7 @@ public final class ObjectAdapterI implements ObjectAdapter } private static void - checkServant(Ice.Object servant) + checkServant(com.zeroc.Ice.Object servant) { if(servant == null) { @@ -1196,7 +1196,7 @@ public final class ObjectAdapterI implements ObjectAdapter } } - private List<IceInternal.EndpointI> + private List<com.zeroc.IceInternal.EndpointI> parseEndpoints(String endpts, boolean oaEndpoints) { int beg; @@ -1204,10 +1204,10 @@ public final class ObjectAdapterI implements ObjectAdapter final String delim = " \t\n\r"; - List<IceInternal.EndpointI> endpoints = new ArrayList<IceInternal.EndpointI>(); + List<com.zeroc.IceInternal.EndpointI> endpoints = new ArrayList<>(); while(end < endpts.length()) { - beg = IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end); + beg = com.zeroc.IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end); if(beg == -1) { break; @@ -1263,10 +1263,10 @@ public final class ObjectAdapterI implements ObjectAdapter } String s = endpts.substring(beg, end); - IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s, oaEndpoints); + com.zeroc.IceInternal.EndpointI endp = _instance.endpointFactoryManager().create(s, oaEndpoints); if(endp == null) { - Ice.EndpointParseException e = new Ice.EndpointParseException(); + EndpointParseException e = new EndpointParseException(); e.str = "invalid object adapter endpoint `" + s + "'"; throw e; } @@ -1278,7 +1278,7 @@ public final class ObjectAdapterI implements ObjectAdapter return endpoints; } - private List<IceInternal.EndpointI> + private List<com.zeroc.IceInternal.EndpointI> parsePublishedEndpoints() { // @@ -1286,7 +1286,7 @@ public final class ObjectAdapterI implements ObjectAdapter // instead of the connection factory Endpoints. // String endpts = _instance.initializationData().properties.getProperty(_name + ".PublishedEndpoints"); - List<IceInternal.EndpointI> endpoints = parseEndpoints(endpts, false); + List<com.zeroc.IceInternal.EndpointI> endpoints = parseEndpoints(endpts, false); if(endpoints.isEmpty()) { // @@ -1306,7 +1306,7 @@ public final class ObjectAdapterI implements ObjectAdapter s.append(_name); s.append("':\n"); boolean first = true; - for(IceInternal.EndpointI endpoint : endpoints) + for(com.zeroc.IceInternal.EndpointI endpoint : endpoints) { if(!first) { @@ -1321,7 +1321,7 @@ public final class ObjectAdapterI implements ObjectAdapter } private void - updateLocatorRegistry(IceInternal.LocatorInfo locatorInfo, Ice.ObjectPrx proxy) + updateLocatorRegistry(com.zeroc.IceInternal.LocatorInfo locatorInfo, ObjectPrx proxy) { if(_id.length() == 0 || locatorInfo == null) { @@ -1432,7 +1432,7 @@ public final class ObjectAdapterI implements ObjectAdapter s.append("endpoints = "); if(proxy != null) { - Ice.Endpoint[] endpoints = proxy.ice_getEndpoints(); + Endpoint[] endpoints = proxy.ice_getEndpoints(); for(int i = 0; i < endpoints.length; i++) { s.append(endpoints[i].toString()); @@ -1495,9 +1495,9 @@ public final class ObjectAdapterI implements ObjectAdapter // boolean addUnknown = true; String prefix = _name + "."; - for(int i = 0; IceInternal.PropertyNames.clPropNames[i] != null; ++i) + for(int i = 0; com.zeroc.IceInternal.PropertyNames.clPropNames[i] != null; ++i) { - if(prefix.startsWith(IceInternal.PropertyNames.clPropNames[i] + ".")) + if(prefix.startsWith(com.zeroc.IceInternal.PropertyNames.clPropNames[i] + ".")) { addUnknown = false; break; @@ -1538,21 +1538,21 @@ public final class ObjectAdapterI implements ObjectAdapter private static final int StateDestroyed = 7; private int _state = StateUninitialized; - private IceInternal.Instance _instance; + private com.zeroc.IceInternal.Instance _instance; private Communicator _communicator; - private IceInternal.ObjectAdapterFactory _objectAdapterFactory; - private IceInternal.ThreadPool _threadPool; - private IceInternal.ACMConfig _acm; - private IceInternal.ServantManager _servantManager; + private com.zeroc.IceInternal.ObjectAdapterFactory _objectAdapterFactory; + private com.zeroc.IceInternal.ThreadPool _threadPool; + private com.zeroc.IceInternal.ACMConfig _acm; + private com.zeroc.IceInternal.ServantManager _servantManager; final private String _name; final private String _id; final private String _replicaGroupId; - private IceInternal.Reference _reference; - private List<IncomingConnectionFactory> _incomingConnectionFactories = new ArrayList<IncomingConnectionFactory>(); - private List<IceInternal.EndpointI> _routerEndpoints = new ArrayList<IceInternal.EndpointI>(); - private IceInternal.RouterInfo _routerInfo = null; - private List<IceInternal.EndpointI> _publishedEndpoints = new ArrayList<IceInternal.EndpointI>(); - private IceInternal.LocatorInfo _locatorInfo; + private com.zeroc.IceInternal.Reference _reference; + private List<IncomingConnectionFactory> _incomingConnectionFactories = new ArrayList<>(); + private List<com.zeroc.IceInternal.EndpointI> _routerEndpoints = new ArrayList<>(); + private com.zeroc.IceInternal.RouterInfo _routerInfo = null; + private List<com.zeroc.IceInternal.EndpointI> _publishedEndpoints = new ArrayList<>(); + private com.zeroc.IceInternal.LocatorInfo _locatorInfo; private int _directCount; // The number of direct proxies dispatching on this object adapter. private boolean _noConfig; private final int _messageSizeMax; diff --git a/java/src/Ice/src/main/java/Ice/ObjectInputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectInputStream.java index 0d635b49b32..caffaa274fa 100644 --- a/java/src/Ice/src/main/java/Ice/ObjectInputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectInputStream.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * For deserialization of Slice types that contain a proxy, the application diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java new file mode 100644 index 00000000000..50b1045d72d --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ObjectPrx.java @@ -0,0 +1,1252 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +/** + * Base interface of all object proxies. + **/ +public interface ObjectPrx +{ + /** + * Returns the communicator that created this proxy. + * + * @return The communicator that created this proxy. + **/ + Communicator ice_getCommunicator(); + + /** + * Tests whether this object supports a specific Slice interface. + * + * @param id The type ID of the Slice interface to test against. + * @return <code>true</code> if the target object has the interface + * specified by <code>id</code> or derives from the interface + * specified by <code>id</code>. + **/ + boolean ice_isA(String id); + + /** + * Tests whether this object supports a specific Slice interface. + * + * @param id The type ID of the Slice interface to test against. + * @param __context The context map for the invocation. + * @return <code>true</code> if the target object has the interface + * specified by <code>id</code> or derives from the interface + * specified by <code>id</code>. + **/ + boolean ice_isA(String id, java.util.Map<String, String> __context); + + /** + * Tests whether this object supports a specific Slice interface. + * + * @param id The type ID of the Slice interface to test against. + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<Boolean> ice_isAAsync(String id); + + /** + * Tests whether this object supports a specific Slice interface. + * + * @param id The type ID of the Slice interface to test against. + * @param __context The context map for the invocation. + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<Boolean> ice_isAAsync(String id, java.util.Map<String, String> __context); + + /** + * Tests whether the target object of this proxy can be reached. + **/ + void ice_ping(); + + /** + * Tests whether the target object of this proxy can be reached. + * + * @param __context The context map for the invocation. + **/ + void ice_ping(java.util.Map<String, String> __context); + + /** + * Tests whether the target object of this proxy can be reached. + * + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<Void> ice_pingAsync(); + + /** + * Tests whether the target object of this proxy can be reached. + * + * @param __context The context map for the invocation. + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<Void> ice_pingAsync(java.util.Map<String, String> __context); + + /** + * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. + * + * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived + * order. The first element of the returned array is always <code>::Ice::Object</code>. + **/ + String[] ice_ids(); + + /** + * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. + * + * @param __context The context map for the invocation. + * @return The Slice type IDs of the interfaces supported by the target object, in base-to-derived + * order. The first element of the returned array is always <code>::Ice::Object</code>. + **/ + String[] ice_ids(java.util.Map<String, String> __context); + + /** + * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. + * + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<String[]> ice_idsAsync(); + + /** + * Returns the Slice type IDs of the interfaces supported by the target object of this proxy. + * + * @param __context The context map for the invocation. + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<String[]> ice_idsAsync(java.util.Map<String, String> __context); + + /** + * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. + * + * @return The Slice type ID of the most-derived interface. + **/ + String ice_id(); + + /** + * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. + * + * @param __context The context map for the invocation. + * @return The Slice type ID of the most-derived interface. + **/ + String ice_id(java.util.Map<String, String> __context); + + /** + * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. + * + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<String> ice_idAsync(); + + /** + * Returns the Slice type ID of the most-derived interface supported by the target object of this proxy. + * + * @param __context The context map for the invocation. + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<String> ice_idAsync(java.util.Map<String, String> __context); + + /** + * Invokes an operation dynamically. + * + * @param operation The name of the operation to invoke. + * @param mode The operation mode (normal or idempotent). + * @param inParams The encoded in-parameters for the operation. + * @return The results of the invocation. + * + * @see Blobject + * @see OperationMode + **/ + com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams); + + /** + * Invokes an operation dynamically. + * + * @param operation The name of the operation to invoke. + * @param mode The operation mode (normal or idempotent). + * @param inParams The encoded in-parameters for the operation. + * @param __context The context map for the invocation. + * @return The results of the invocation. + * + * @see Blobject + * @see OperationMode + **/ + com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams, + java.util.Map<String, String> __context); + + /** + * Invokes an operation dynamically and asynchronously. + * + * @param operation The name of the operation to invoke. + * @param mode The operation mode (normal or idempotent). + * @param inParams The encoded in-parameters for the operation. + * @return A future for the completion of the request. + * + * @see Blobject + * @see OperationMode + **/ + java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync( + String operation, + OperationMode mode, + byte[] inParams); + + /** + * Invokes an operation dynamically and asynchronously. + * + * @param operation The name of the operation to invoke. + * @param mode The operation mode (normal or idempotent). + * @param inParams The encoded in-parameters for the operation. + * for the operation. The return value follows any out-parameters. + * @param __context The context map for the invocation. + * @return A future for the completion of the request. + * + * @see Blobject + * @see OperationMode + **/ + java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync( + String operation, + OperationMode mode, + byte[] inParams, + java.util.Map<String, String> __context); + + /** + * Returns the identity embedded in this proxy. + * + * @return The identity of the target object. + **/ + Identity ice_getIdentity(); + + /** + * Returns a proxy that is identical to this proxy, except for the identity. + * + * @param newIdentity The identity for the new proxy. + * @return The proxy with the new identity. + **/ + ObjectPrx ice_identity(Identity newIdentity); + + /** + * Returns the per-proxy context for this proxy. + * + * @return The per-proxy context. If the proxy does not have a per-proxy (implicit) context, the return value + * is <code>null</code>. + **/ + java.util.Map<String, String> ice_getContext(); + + /** + * Returns a proxy that is identical to this proxy, except for the per-proxy context. + * + * @param newContext The context for the new proxy. + * @return The proxy with the new per-proxy context. + **/ + default ObjectPrx ice_context(java.util.Map<String, String> newContext) + { + return __ice_context(newContext); + } + + /** + * Returns the facet for this proxy. + * + * @return The facet for this proxy. If the proxy uses the default facet, the return value is the empty string. + **/ + String ice_getFacet(); + + /** + * Returns a proxy that is identical to this proxy, except for the facet. + * + * @param newFacet The facet for the new proxy. + * @return The proxy with the new facet. + **/ + ObjectPrx ice_facet(String newFacet); + + /** + * Returns the adapter ID for this proxy. + * + * @return The adapter ID. If the proxy does not have an adapter ID, the return value is the empty string. + **/ + String ice_getAdapterId(); + + /** + * Returns a proxy that is identical to this proxy, except for the adapter ID. + * + * @param newAdapterId The adapter ID for the new proxy. + * @return The proxy with the new adapter ID. + **/ + default ObjectPrx ice_adapterId(String newAdapterId) + { + return __ice_adapterId(newAdapterId); + } + + /** + * Returns the endpoints used by this proxy. + * + * @return The endpoints used by this proxy. + * + * @see Endpoint + **/ + Endpoint[] ice_getEndpoints(); + + /** + * Returns a proxy that is identical to this proxy, except for the endpoints. + * + * @param newEndpoints The endpoints for the new proxy. + * @return The proxy with the new endpoints. + **/ + default ObjectPrx ice_endpoints(Endpoint[] newEndpoints) + { + return __ice_endpoints(newEndpoints); + } + + /** + * Returns the locator cache timeout of this proxy. + * + * @return The locator cache timeout value (in seconds). + * + * @see Locator + **/ + int ice_getLocatorCacheTimeout(); + + /** + * Returns the invocation timeout of this proxy. + * + * @return The invocation timeout value (in seconds). + **/ + int ice_getInvocationTimeout(); + + /** + * Returns the connection id of this proxy. + * + * @return The connection id. + * + **/ + String ice_getConnectionId(); + + /** + * Returns a proxy that is identical to this proxy, except for the locator cache timeout. + * + * @param newTimeout The new locator cache timeout (in seconds). + * @return The proxy with the new timeout. + * + * @see Locator + **/ + default ObjectPrx ice_locatorCacheTimeout(int newTimeout) + { + return __ice_locatorCacheTimeout(newTimeout); + } + + /** + * Returns a proxy that is identical to this proxy, except for the invocation timeout. + * + * @param newTimeout The new invocation timeout (in seconds). + * @return The proxy with the new timeout. + * + **/ + default ObjectPrx ice_invocationTimeout(int newTimeout) + { + return __ice_invocationTimeout(newTimeout); + } + + /** + * Returns whether this proxy caches connections. + * + * @return <code>true</code> if this proxy caches connections; <code>false</code> otherwise. + **/ + boolean ice_isConnectionCached(); + + /** + * Returns a proxy that is identical to this proxy, except for connection caching. + * + * @param newCache <code>true</code> if the new proxy should cache connections; <code>false</code> otherwise. + * @return The proxy with the specified caching policy. + **/ + default ObjectPrx ice_connectionCached(boolean newCache) + { + return __ice_connectionCached(newCache); + } + + /** + * Returns how this proxy selects endpoints (randomly or ordered). + * + * @return The endpoint selection policy. + * + * @see EndpointSelectionType + **/ + EndpointSelectionType ice_getEndpointSelection(); + + /** + * Returns a proxy that is identical to this proxy, except for the endpoint selection policy. + * + * @param newType The new endpoint selection policy. + * @return The proxy with the specified endpoint selection policy. + * + * @see EndpointSelectionType + **/ + default ObjectPrx ice_endpointSelection(EndpointSelectionType newType) + { + return __ice_endpointSelection(newType); + } + + /** + * Returns whether this proxy uses only secure endpoints. + * + * @return <code>True</code> if this proxy communicates only via secure endpoints; <code>false</code> otherwise. + **/ + boolean ice_isSecure(); + + /** + * Returns a proxy that is identical to this proxy, except for how it selects endpoints. + * + * @param b If <code>b</code> is <code>true</code>, only endpoints that use a secure transport are + * used by the new proxy. If <code>b</code> is false, the returned proxy uses both secure and insecure + * endpoints. + * @return The proxy with the specified selection policy. + **/ + default ObjectPrx ice_secure(boolean b) + { + return __ice_secure(b); + } + + /** + * Returns a proxy that is identical to this proxy, except for the encoding used to marshal + * parameters. + * + * @param e The encoding version to use to marshal request parameters. + * @return The proxy with the specified encoding version. + **/ + default ObjectPrx ice_encodingVersion(EncodingVersion e) + { + return __ice_encodingVersion(e); + } + + /** + * Returns the encoding version used to marshal requests parameters. + * + * @return The encoding version. + **/ + EncodingVersion ice_getEncodingVersion(); + + /** + * Returns whether this proxy prefers secure endpoints. + * + * @return <code>true</code> if the proxy always attempts to invoke via secure endpoints before it + * attempts to use insecure endpoints; <code>false</code> otherwise. + **/ + boolean ice_isPreferSecure(); + + /** + * Returns a proxy that is identical to this proxy, except for its endpoint selection policy. + * + * @param b If <code>b</code> is <code>true</code>, the new proxy will use secure endpoints for invocations + * and only use insecure endpoints if an invocation cannot be made via secure endpoints. If <code>b</code> is + * <code>false</code>, the proxy prefers insecure endpoints to secure ones. + * @return The proxy with the specified selection policy. + **/ + default ObjectPrx ice_preferSecure(boolean b) + { + return __ice_preferSecure(b); + } + + /** + * Returns the router for this proxy. + * + * @return The router for the proxy. If no router is configured for the proxy, the return value + * is <code>null</code>. + **/ + RouterPrx ice_getRouter(); + + /** + * Returns a proxy that is identical to this proxy, except for the router. + * + * @param router The router for the new proxy. + * @return The proxy with the specified router. + **/ + default ObjectPrx ice_router(RouterPrx router) + { + return __ice_router(router); + } + + /** + * Returns the locator for this proxy. + * + * @return The locator for this proxy. If no locator is configured, the return value is <code>null</code>. + **/ + LocatorPrx ice_getLocator(); + + /** + * Returns a proxy that is identical to this proxy, except for the locator. + * + * @param locator The locator for the new proxy. + * @return The proxy with the specified locator. + **/ + default ObjectPrx ice_locator(LocatorPrx locator) + { + return __ice_locator(locator); + } + + /** + * Returns whether this proxy uses collocation optimization. + * + * @return <code>true</code> if the proxy uses collocation optimization; <code>false</code> otherwise. + **/ + boolean ice_isCollocationOptimized(); + + /** + * Returns a proxy that is identical to this proxy, except for collocation optimization. + * + * @param b <code>true</code> if the new proxy enables collocation optimization; <code>false</code> otherwise. + * @return The proxy the specified collocation optimization. + **/ + default ObjectPrx ice_collocationOptimized(boolean b) + { + return __ice_collocationOptimized(b); + } + + /** + * Returns a proxy that is identical to this proxy, but uses twoway invocations. + * + * @return A proxy that uses twoway invocations. + **/ + default ObjectPrx ice_twoway() + { + return __ice_twoway(); + } + + /** + * Returns whether this proxy uses twoway invocations. + * @return <code>true</code> if this proxy uses twoway invocations; <code>false</code> otherwise. + **/ + boolean ice_isTwoway(); + + /** + * Returns a proxy that is identical to this proxy, but uses oneway invocations. + * + * @return A proxy that uses oneway invocations. + **/ + default ObjectPrx ice_oneway() + { + return __ice_oneway(); + } + + /** + * Returns whether this proxy uses oneway invocations. + * @return <code>true</code> if this proxy uses oneway invocations; <code>false</code> otherwise. + **/ + boolean ice_isOneway(); + + /** + * Returns a proxy that is identical to this proxy, but uses batch oneway invocations. + * + * @return A new proxy that uses batch oneway invocations. + **/ + default ObjectPrx ice_batchOneway() + { + return __ice_batchOneway(); + } + + /** + * Returns whether this proxy uses batch oneway invocations. + * @return <code>true</code> if this proxy uses batch oneway invocations; <code>false</code> otherwise. + **/ + boolean ice_isBatchOneway(); + + /** + * Returns a proxy that is identical to this proxy, but uses datagram invocations. + * + * @return A new proxy that uses datagram invocations. + **/ + default ObjectPrx ice_datagram() + { + return __ice_datagram(); + } + + /** + * Returns whether this proxy uses datagram invocations. + * @return <code>true</code> if this proxy uses datagram invocations; <code>false</code> otherwise. + **/ + boolean ice_isDatagram(); + + /** + * Returns a proxy that is identical to this proxy, but uses batch datagram invocations. + * + * @return A new proxy that uses batch datagram invocations. + **/ + default ObjectPrx ice_batchDatagram() + { + return __ice_batchDatagram(); + } + + /** + * Returns whether this proxy uses batch datagram invocations. + * @return <code>true</code> if this proxy uses batch datagram invocations; <code>false</code> otherwise. + **/ + boolean ice_isBatchDatagram(); + + /** + * Returns a proxy that is identical to this proxy, except for compression. + * + * @param co <code>true</code> enables compression for the new proxy; <code>false</code> disables compression. + * @return A proxy with the specified compression setting. + **/ + default ObjectPrx ice_compress(boolean co) + { + return __ice_compress(co); + } + + /** + * Returns a proxy that is identical to this proxy, except for its connection timeout setting. + * + * @param t The connection timeout for the proxy in milliseconds. + * @return A proxy with the specified timeout. + **/ + default ObjectPrx ice_timeout(int t) + { + return __ice_timeout(t); + } + + /** + * Returns a proxy that is identical to this proxy, except for its connection ID. + * + * @param connectionId The connection ID for the new proxy. An empty string removes the + * connection ID. + * + * @return A proxy with the specified connection ID. + **/ + default ObjectPrx ice_connectionId(String connectionId) + { + return __ice_connectionId(connectionId); + } + + /** + * Returns the {@link Connection} for this proxy. If the proxy does not yet have an established connection, + * it first attempts to create a connection. + * + * @return The {@link Connection} for this proxy. + * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a + * collocated object. + * + * @see Connection + **/ + Connection ice_getConnection(); + + /** + * Asynchronously gets the connection for this proxy. The call does not block. + * + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<Connection> ice_getConnectionAsync(); + + /** + * Returns the cached {@link Connection} for this proxy. If the proxy does not yet have an established + * connection, it does not attempt to create a connection. + * + * @return The cached {@link Connection} for this proxy (<code>null</code> if the proxy does not have + * an established connection). + * @throws CollocationOptimizationException If the proxy uses collocation optimization and denotes a + * collocated object. + * + * @see Connection + **/ + Connection ice_getCachedConnection(); + + /** + * Flushes any pending batched requests for this communicator. The call blocks until the flush is complete. + **/ + void ice_flushBatchRequests(); + + /** + * Asynchronously flushes any pending batched requests for this communicator. The call does not block. + * + * @return A future for the completion of the request. + **/ + java.util.concurrent.CompletableFuture<Void> ice_flushBatchRequestsAsync(); + + /** + * Returns whether this proxy equals the passed object. Two proxies are equal if they are equal in all respects, + * that is, if their object identity, endpoints timeout settings, and so on are all equal. + * + * @param r The object to compare this proxy with. + * @return <code>true</code> if this proxy is equal to <code>r</code>; <code>false</code> otherwise. + **/ + @Override + boolean equals(java.lang.Object r); + + static final String ice_staticId = "::Ice::Object"; + + /** + * Returns the Slice type ID associated with this type. + **/ + static String ice_staticId() + { + return ice_staticId; + } + + /** + * Casts a proxy to {@link ObjectPrx}. For user-defined types, this call contacts + * the server and will throw an Ice run-time exception if the target + * object does not exist or the server cannot be reached. + * + * @param __obj The proxy to cast to @{link ObjectPrx}. + * @return <code>__obj</code>. + **/ + static ObjectPrx checkedCast(ObjectPrx __obj) + { + return __obj; + } + + /** + * Casts a proxy to {@link ObjectPrx}. For user-defined types, this call contacts + * the server and throws an Ice run-time exception if the target + * object does not exist or the server cannot be reached. + * + * @param __obj The proxy to cast to {@link ObjectPrx}. + * @param __ctx The <code>Context</code> map for the invocation. + * @return <code>__obj</code>. + **/ + static ObjectPrx checkedCast(ObjectPrx __obj, java.util.Map<String, String> __ctx) + { + return __obj; + } + + /** + * Creates a new proxy that is identical to the passed proxy, except + * for its facet. This call contacts + * the server and throws an Ice run-time exception if the target + * object does not exist, the specified facet does not exist, or the server cannot be reached. + * + * @param __obj The proxy to cast to {@link ObjectPrx}. + * @param __facet The facet for the new proxy. + * @return The new proxy with the specified facet. + **/ + static ObjectPrx checkedCast(ObjectPrx __obj, String __facet) + { + return checkedCast(__obj, __facet, noExplicitContext); + } + + /** + * Creates a new proxy that is identical to the passed proxy, except + * for its facet. This call contacts + * the server and throws an Ice run-time exception if the target + * object does not exist, the specified facet does not exist, or the server cannot be reached. + * + * @param __obj The proxy to cast to {@link ObjectPrx}. + * @param __facet The facet for the new proxy. + * @param __ctx The <code>Context</code> map for the invocation. + * @return The new proxy with the specified facet. + **/ + static ObjectPrx checkedCast(ObjectPrx __obj, String __facet, java.util.Map<String, String> __ctx) + { + ObjectPrx r = null; + if(__obj != null) + { + ObjectPrx p = __obj.ice_facet(__facet); + try + { + boolean ok = p.ice_isA(ice_staticId, __ctx); + assert(ok); + r = new _ObjectPrxI(); + r.__copyFrom(p); + } + catch(FacetNotExistException ex) + { + } + } + return r; + } + + /** + * Casts a proxy to {@link ObjectPrx}. This call does + * not contact the server and always succeeds. + * + * @param __obj The proxy to cast to {@link ObjectPrx}. + * @return <code>__obj</code>. + **/ + static ObjectPrx uncheckedCast(ObjectPrx __obj) + { + return __obj; + } + + /** + * Creates a new proxy that is identical to the passed proxy, except + * for its facet. This call does not contact the server and always succeeds. + * + * @param __obj The proxy to cast to {@link ObjectPrx}. + * @param __facet The facet for the new proxy. + * @return The new proxy with the specified facet. + **/ + static ObjectPrx uncheckedCast(ObjectPrx __obj, String __facet) + { + ObjectPrx r = null; + if(__obj != null) + { + ObjectPrx p = __obj.ice_facet(__facet); + r = new _ObjectPrxI(); + r.__copyFrom(p); + } + return r; + } + + /** + * Writes a proxy to the stream. + * + * @param ostr The destination stream. + * @param v The proxy to write to the stream. + **/ + static void write(OutputStream ostr, ObjectPrx v) + { + ostr.writeProxy(v); + } + + /** + * Reads a proxy from the stream. + * + * @param istr The source stream. + * @return A new proxy or null for a nil proxy. + **/ + static ObjectPrx read(InputStream istr) + { + return istr.readProxy(); + } + + static <T> T __checkedCast(ObjectPrx obj, String id, Class<T> proxy, Class<?> impl) + { + return __checkedCast(obj, false, null, noExplicitContext, id, proxy, impl); + } + + static <T> T __checkedCast(ObjectPrx obj, java.util.Map<String, String> ctx, String id, Class<T> proxy, + Class<?> impl) + { + return __checkedCast(obj, false, null, ctx, id, proxy, impl); + } + + static <T> T __checkedCast(ObjectPrx obj, String facet, String id, Class<T> proxy, Class<?> impl) + { + return __checkedCast(obj, true, facet, noExplicitContext, id, proxy, impl); + } + + static <T> T __checkedCast(ObjectPrx obj, String facet, java.util.Map<String, String> ctx, String id, + Class<T> proxy, Class<?> impl) + { + return __checkedCast(obj, true, facet, ctx, id, proxy, impl); + } + + static <T> T __checkedCast(ObjectPrx obj, boolean explicitFacet, String facet, java.util.Map<String, String> ctx, + String id, Class<T> proxy, Class<?> impl) + { + T r = null; + if(obj != null) + { + if(explicitFacet) + { + obj = obj.ice_facet(facet); + } + if(proxy.isInstance(obj)) + { + r = proxy.cast(obj); + } + else + { + try + { + boolean ok = obj.ice_isA(id, ctx); + if(ok) + { + ObjectPrx h = null; + try + { + h = _ObjectPrxI.class.cast(impl.newInstance()); + } + catch(InstantiationException ex) + { + throw new SyscallException(ex); + } + catch(IllegalAccessException ex) + { + throw new SyscallException(ex); + } + h.__copyFrom(obj); + r = proxy.cast(h); + } + } + catch(FacetNotExistException ex) + { + } + } + } + return r; + } + + static <T> T __uncheckedCast(ObjectPrx obj, Class<T> proxy, Class<?> impl) + { + return __uncheckedCast(obj, false, null, proxy, impl); + } + + static <T> T __uncheckedCast(ObjectPrx obj, String facet, Class<T> proxy, Class<?> impl) + { + return __uncheckedCast(obj, true, facet, proxy, impl); + } + + static <T> T __uncheckedCast(ObjectPrx obj, boolean explicitFacet, String facet, Class<T> proxy, Class<?> impl) + { + T r = null; + if(obj != null) + { + try + { + if(explicitFacet) + { + ObjectPrx h = _ObjectPrxI.class.cast(impl.newInstance()); + h.__copyFrom(obj.ice_facet(facet)); + r = proxy.cast(h); + } + else + { + if(proxy.isInstance(obj)) + { + r = proxy.cast(obj); + } + else + { + ObjectPrx h = _ObjectPrxI.class.cast(impl.newInstance()); + h.__copyFrom(obj); + r = proxy.cast(h); + } + } + } + catch(InstantiationException ex) + { + throw new SyscallException(ex); + } + catch(IllegalAccessException ex) + { + throw new SyscallException(ex); + } + } + return r; + } + + static <T> T __waitForCompletion(java.util.concurrent.CompletableFuture<T> f) + { + try + { + return __waitForCompletionUserEx(f); + } + catch(UserException ex) + { + throw new UnknownUserException(ex.ice_id(), ex); + } + } + + static <T> T __waitForCompletionUserEx(java.util.concurrent.CompletableFuture<T> f) + throws UserException + { + if(Thread.currentThread().interrupted()) + { + throw new OperationInterruptedException(); + } + + try + { + return f.get(); + } + catch(InterruptedException ex) + { + throw new OperationInterruptedException(); + } + catch(java.util.concurrent.ExecutionException ee) + { + try + { + throw ee.getCause(); + } + catch(RuntimeException ex) // Includes LocalException + { + throw ex; + } + catch(UserException ex) + { + throw ex; + } + catch(Throwable ex) + { + throw new UnknownException(ex); + } + } + } + + void __write(OutputStream os); + void __copyFrom(ObjectPrx p); + com.zeroc.IceInternal.Reference __reference(); + ObjectPrx __newInstance(com.zeroc.IceInternal.Reference r); + + default ObjectPrx __ice_context(java.util.Map<String, String> newContext) + { + return __newInstance(__reference().changeContext(newContext)); + } + + default ObjectPrx __ice_adapterId(String newAdapterId) + { + if(newAdapterId == null) + { + newAdapterId = ""; + } + + if(newAdapterId.equals(__reference().getAdapterId())) + { + return this; + } + else + { + return __newInstance(__reference().changeAdapterId(newAdapterId)); + } + } + + default ObjectPrx __ice_endpoints(Endpoint[] newEndpoints) + { + if(java.util.Arrays.equals(newEndpoints, __reference().getEndpoints())) + { + return this; + } + else + { + com.zeroc.IceInternal.EndpointI[] edpts = new com.zeroc.IceInternal.EndpointI[newEndpoints.length]; + edpts = java.util.Arrays.asList(newEndpoints).toArray(edpts); + return __newInstance(__reference().changeEndpoints(edpts)); + } + } + + default ObjectPrx __ice_locatorCacheTimeout(int newTimeout) + { + if(newTimeout < -1) + { + throw new IllegalArgumentException("invalid value passed to ice_locatorCacheTimeout: " + newTimeout); + } + if(newTimeout == __reference().getLocatorCacheTimeout()) + { + return this; + } + else + { + return __newInstance(__reference().changeLocatorCacheTimeout(newTimeout)); + } + } + + default ObjectPrx __ice_invocationTimeout(int newTimeout) + { + if(newTimeout < 1 && newTimeout != -1 && newTimeout != -2) + { + throw new IllegalArgumentException("invalid value passed to ice_invocationTimeout: " + newTimeout); + } + if(newTimeout == __reference().getInvocationTimeout()) + { + return this; + } + else + { + return __newInstance(__reference().changeInvocationTimeout(newTimeout)); + } + } + + default ObjectPrx __ice_connectionCached(boolean newCache) + { + if(newCache == __reference().getCacheConnection()) + { + return this; + } + else + { + return __newInstance(__reference().changeCacheConnection(newCache)); + } + } + + default ObjectPrx __ice_endpointSelection(EndpointSelectionType newType) + { + if(newType == __reference().getEndpointSelection()) + { + return this; + } + else + { + return __newInstance(__reference().changeEndpointSelection(newType)); + } + } + + default ObjectPrx __ice_secure(boolean b) + { + if(b == __reference().getSecure()) + { + return this; + } + else + { + return __newInstance(__reference().changeSecure(b)); + } + } + + default ObjectPrx __ice_encodingVersion(EncodingVersion e) + { + if(e.equals(__reference().getEncoding())) + { + return this; + } + else + { + return __newInstance(__reference().changeEncoding(e)); + } + } + + default ObjectPrx __ice_preferSecure(boolean b) + { + if(b == __reference().getPreferSecure()) + { + return this; + } + else + { + return __newInstance(__reference().changePreferSecure(b)); + } + } + + default ObjectPrx __ice_router(RouterPrx router) + { + com.zeroc.IceInternal.Reference ref = __reference().changeRouter(router); + if(ref.equals(__reference())) + { + return this; + } + else + { + return __newInstance(ref); + } + } + + default ObjectPrx __ice_locator(LocatorPrx locator) + { + com.zeroc.IceInternal.Reference ref = __reference().changeLocator(locator); + if(ref.equals(__reference())) + { + return this; + } + else + { + return __newInstance(ref); + } + } + + default ObjectPrx __ice_collocationOptimized(boolean b) + { + if(b == __reference().getCollocationOptimized()) + { + return this; + } + else + { + return __newInstance(__reference().changeCollocationOptimized(b)); + } + } + + default ObjectPrx __ice_twoway() + { + if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeTwoway) + { + return this; + } + else + { + return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeTwoway)); + } + } + + default ObjectPrx __ice_oneway() + { + if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeOneway) + { + return this; + } + else + { + return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeOneway)); + } + } + + default ObjectPrx __ice_batchOneway() + { + if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeBatchOneway) + { + return this; + } + else + { + return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeBatchOneway)); + } + } + + default ObjectPrx __ice_datagram() + { + if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeDatagram) + { + return this; + } + else + { + return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeDatagram)); + } + } + + default ObjectPrx __ice_batchDatagram() + { + if(__reference().getMode() == com.zeroc.IceInternal.Reference.ModeBatchDatagram) + { + return this; + } + else + { + return __newInstance(__reference().changeMode(com.zeroc.IceInternal.Reference.ModeBatchDatagram)); + } + } + + default ObjectPrx __ice_compress(boolean co) + { + com.zeroc.IceInternal.Reference ref = __reference().changeCompress(co); + if(ref.equals(__reference())) + { + return this; + } + else + { + return __newInstance(ref); + } + } + + default ObjectPrx __ice_timeout(int t) + { + if(t < 1 && t != -1) + { + throw new IllegalArgumentException("invalid value passed to ice_timeout: " + t); + } + com.zeroc.IceInternal.Reference ref = __reference().changeTimeout(t); + if(ref.equals(__reference())) + { + return this; + } + else + { + return __newInstance(ref); + } + } + + default ObjectPrx __ice_connectionId(String connectionId) + { + com.zeroc.IceInternal.Reference ref = __reference().changeConnectionId(connectionId); + if(ref.equals(__reference())) + { + return this; + } + else + { + return __newInstance(ref); + } + } + + static final java.util.Map<String, String> noExplicitContext = new java.util.HashMap<>(); +} diff --git a/java/src/Ice/src/main/java/Ice/OptionalFormat.java b/java/src/Ice/src/main/java/com/zeroc/Ice/OptionalFormat.java index 2c68b26ea4f..b1460bf6da7 100644 --- a/java/src/Ice/src/main/java/Ice/OptionalFormat.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/OptionalFormat.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * The optional type. diff --git a/java/src/Ice/src/main/java/Ice/OutputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java index c2a028d15a6..051bd3fa320 100644 --- a/java/src/Ice/src/main/java/Ice/OutputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public class OutputStream { @@ -30,10 +30,10 @@ public class OutputStream **/ public OutputStream(boolean direct) { - _buf = new IceInternal.Buffer(direct); + _buf = new com.zeroc.IceInternal.Buffer(direct); _instance = null; _closure = null; - _encoding = IceInternal.Protocol.currentEncoding; + _encoding = com.zeroc.IceInternal.Protocol.currentEncoding; _format = FormatType.CompactFormat; } @@ -45,7 +45,7 @@ public class OutputStream public OutputStream(Communicator communicator) { assert(communicator != null); - final IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, instance.defaultsAndOverrides().defaultEncoding, instance.cacheMessageBuffers() > 1); } @@ -58,7 +58,7 @@ public class OutputStream public OutputStream(Communicator communicator, boolean direct) { assert(communicator != null); - final IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, instance.defaultsAndOverrides().defaultEncoding, direct); } @@ -71,7 +71,7 @@ public class OutputStream public OutputStream(Communicator communicator, EncodingVersion encoding) { assert(communicator != null); - final IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, encoding, instance.cacheMessageBuffers() > 1); } @@ -85,23 +85,24 @@ public class OutputStream public OutputStream(Communicator communicator, EncodingVersion encoding, boolean direct) { assert(communicator != null); - final IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, encoding, direct); } - public OutputStream(IceInternal.Instance instance, EncodingVersion encoding) + public OutputStream(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding) { initialize(instance, encoding, instance.cacheMessageBuffers() > 1); } - public OutputStream(IceInternal.Instance instance, EncodingVersion encoding, boolean direct) + public OutputStream(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding, boolean direct) { initialize(instance, encoding, direct); } - public OutputStream(IceInternal.Instance instance, EncodingVersion encoding, IceInternal.Buffer buf, boolean adopt) + public OutputStream(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding, + com.zeroc.IceInternal.Buffer buf, boolean adopt) { - initialize(instance, encoding, new IceInternal.Buffer(buf, adopt)); + initialize(instance, encoding, new com.zeroc.IceInternal.Buffer(buf, adopt)); } /** @@ -113,7 +114,7 @@ public class OutputStream public void initialize(Communicator communicator) { assert(communicator != null); - final IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, instance.defaultsAndOverrides().defaultEncoding, instance.cacheMessageBuffers() > 1); } @@ -127,16 +128,17 @@ public class OutputStream public void initialize(Communicator communicator, EncodingVersion encoding) { assert(communicator != null); - final IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + final com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); initialize(instance, encoding, instance.cacheMessageBuffers() > 1); } - private void initialize(IceInternal.Instance instance, EncodingVersion encoding, boolean direct) + private void initialize(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding, boolean direct) { - initialize(instance, encoding, new IceInternal.Buffer(direct)); + initialize(instance, encoding, new com.zeroc.IceInternal.Buffer(direct)); } - private void initialize(IceInternal.Instance instance, EncodingVersion encoding, IceInternal.Buffer buf) + private void initialize(com.zeroc.IceInternal.Instance instance, EncodingVersion encoding, + com.zeroc.IceInternal.Buffer buf) { assert(instance != null); @@ -176,7 +178,7 @@ public class OutputStream } } - public IceInternal.Instance instance() + public com.zeroc.IceInternal.Instance instance() { return _instance; } @@ -221,7 +223,7 @@ public class OutputStream **/ public byte[] finished() { - IceInternal.Buffer buf = prepareWrite(); + com.zeroc.IceInternal.Buffer buf = prepareWrite(); byte[] result = new byte[buf.b.limit()]; buf.b.get(result); return result; @@ -236,7 +238,7 @@ public class OutputStream { assert(_instance == other._instance); - IceInternal.Buffer tmpBuf = other._buf; + com.zeroc.IceInternal.Buffer tmpBuf = other._buf; other._buf = _buf; _buf = tmpBuf; @@ -276,7 +278,7 @@ public class OutputStream /** * Prepares the internal data buffer to be written to a socket. **/ - public IceInternal.Buffer prepareWrite() + public com.zeroc.IceInternal.Buffer prepareWrite() { _buf.b.limit(_buf.size()); _buf.b.position(0); @@ -288,7 +290,7 @@ public class OutputStream * * @return The buffer. **/ - public IceInternal.Buffer getBuffer() + public com.zeroc.IceInternal.Buffer getBuffer() { return _buf; } @@ -364,7 +366,7 @@ public class OutputStream **/ public void startEncapsulation(EncodingVersion encoding, FormatType format) { - IceInternal.Protocol.checkSupportedEncoding(encoding); + com.zeroc.IceInternal.Protocol.checkSupportedEncoding(encoding); Encaps curr = _encapsCache; if(curr != null) @@ -384,7 +386,7 @@ public class OutputStream _encapsStack.start = _buf.size(); writeInt(0); // Placeholder for the encapsulation length. - _encapsStack.encoding.__write(this); + _encapsStack.encoding.ice_write(this); } /** @@ -413,9 +415,9 @@ public class OutputStream **/ public void writeEmptyEncapsulation(EncodingVersion encoding) { - IceInternal.Protocol.checkSupportedEncoding(encoding); + com.zeroc.IceInternal.Protocol.checkSupportedEncoding(encoding); writeInt(6); // Size - encoding.__write(this); + encoding.ice_write(this); } /** @@ -607,9 +609,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional byte to write to the stream. **/ - public void writeByte(int tag, ByteOptional v) + public void writeByte(int tag, java.util.Optional<Byte> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeByte(tag, v.get()); } @@ -666,9 +668,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional byte sequence to write to the stream. **/ - public void writeByteSeq(int tag, Optional<byte[]> v) + public void writeByteSeq(int tag, java.util.Optional<byte[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeByteSeq(tag, v.get()); } @@ -721,7 +723,7 @@ public class OutputStream } try { - IceInternal.OutputStreamWrapper w = new IceInternal.OutputStreamWrapper(this); + com.zeroc.IceInternal.OutputStreamWrapper w = new com.zeroc.IceInternal.OutputStreamWrapper(this); java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(w); out.writeObject(o); out.close(); @@ -750,9 +752,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional boolean to write to the stream. **/ - public void writeBool(int tag, BooleanOptional v) + public void writeBool(int tag, java.util.Optional<Boolean> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeBool(tag, v.get()); } @@ -812,9 +814,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional boolean sequence to write to the stream. **/ - public void writeBoolSeq(int tag, Optional<boolean[]> v) + public void writeBoolSeq(int tag, java.util.Optional<boolean[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeBoolSeq(tag, v.get()); } @@ -851,9 +853,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional short to write to the stream. **/ - public void writeShort(int tag, ShortOptional v) + public void writeShort(int tag, java.util.Optional<Short> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeShort(tag, v.get()); } @@ -901,9 +903,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional short sequence to write to the stream. **/ - public void writeShortSeq(int tag, Optional<short[]> v) + public void writeShortSeq(int tag, java.util.Optional<short[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeShortSeq(tag, v.get()); } @@ -964,11 +966,11 @@ public class OutputStream * @param tag The optional tag. * @param v The optional int to write to the stream. **/ - public void writeInt(int tag, IntOptional v) + public void writeInt(int tag, java.util.OptionalInt v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { - writeInt(tag, v.get()); + writeInt(tag, v.getAsInt()); } } @@ -1025,9 +1027,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional int sequence to write to the stream. **/ - public void writeIntSeq(int tag, Optional<int[]> v) + public void writeIntSeq(int tag, java.util.Optional<int[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeIntSeq(tag, v.get()); } @@ -1088,11 +1090,11 @@ public class OutputStream * @param tag The optional tag. * @param v The optional long to write to the stream. **/ - public void writeLong(int tag, LongOptional v) + public void writeLong(int tag, java.util.OptionalLong v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { - writeLong(tag, v.get()); + writeLong(tag, v.getAsLong()); } } @@ -1138,9 +1140,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional long sequence to write to the stream. **/ - public void writeLongSeq(int tag, Optional<long[]> v) + public void writeLongSeq(int tag, java.util.Optional<long[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeLongSeq(tag, v.get()); } @@ -1201,9 +1203,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional float to write to the stream. **/ - public void writeFloat(int tag, FloatOptional v) + public void writeFloat(int tag, java.util.Optional<Float> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeFloat(tag, v.get()); } @@ -1251,9 +1253,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional float sequence to write to the stream. **/ - public void writeFloatSeq(int tag, Optional<float[]> v) + public void writeFloatSeq(int tag, java.util.Optional<float[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeFloatSeq(tag, v.get()); } @@ -1314,11 +1316,11 @@ public class OutputStream * @param tag The optional tag. * @param v The optional double to write to the stream. **/ - public void writeDouble(int tag, DoubleOptional v) + public void writeDouble(int tag, java.util.OptionalDouble v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { - writeDouble(tag, v.get()); + writeDouble(tag, v.getAsDouble()); } } @@ -1364,9 +1366,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional double sequence to write to the stream. **/ - public void writeDoubleSeq(int tag, Optional<double[]> v) + public void writeDoubleSeq(int tag, java.util.Optional<double[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeDoubleSeq(tag, v.get()); } @@ -1487,9 +1489,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional string to write to the stream. **/ - public void writeString(int tag, Optional<String> v) + public void writeString(int tag, java.util.Optional<String> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeString(tag, v.get()); } @@ -1537,9 +1539,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional string sequence to write to the stream. **/ - public void writeStringSeq(int tag, Optional<String[]> v) + public void writeStringSeq(int tag, java.util.Optional<String[]> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeStringSeq(tag, v.get()); } @@ -1575,7 +1577,7 @@ public class OutputStream else { Identity ident = new Identity(); - ident.__write(this); + ident.ice_write(this); } } @@ -1585,9 +1587,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional proxy to write to the stream. **/ - public void writeProxy(int tag, Optional<ObjectPrx> v) + public void writeProxy(int tag, java.util.Optional<ObjectPrx> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeProxy(tag, v.get()); } @@ -1644,7 +1646,7 @@ public class OutputStream * @param v The value to write. This method writes the index of an instance; the state of the value is * written once {@link #writePendingValues} is called. **/ - public void writeValue(Ice.Object v) + public void writeValue(Value v) { initEncaps(); _encapsStack.encoder.writeValue(v); @@ -1656,9 +1658,9 @@ public class OutputStream * @param tag The optional tag. * @param v The optional value to write to the stream. **/ - public <T extends Ice.Object> void writeValue(int tag, Optional<T> v) + public <T extends Value> void writeValue(int tag, java.util.Optional<T> v) { - if(v != null && v.isSet()) + if(v != null && v.isPresent()) { writeValue(tag, v.get()); } @@ -1670,7 +1672,7 @@ public class OutputStream * @param tag The optional tag. * @param v The value to write to the stream. **/ - public void writeValue(int tag, Ice.Object v) + public void writeValue(int tag, Value v) { if(writeOptional(tag, OptionalFormat.Class)) { @@ -1761,8 +1763,8 @@ public class OutputStream _buf.expand(n); } - private IceInternal.Instance _instance; - private IceInternal.Buffer _buf; + private com.zeroc.IceInternal.Instance _instance; + private com.zeroc.IceInternal.Buffer _buf; private Object _closure; private FormatType _format; private byte[] _stringBytes; // Reusable array for string operations. @@ -1777,10 +1779,10 @@ public class OutputStream _stream = stream; _encaps = encaps; _typeIdIndex = 0; - _marshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + _marshaledMap = new java.util.IdentityHashMap<>(); } - abstract void writeValue(Ice.Object v); + abstract void writeValue(Value v); abstract void writeException(UserException v); abstract void startInstance(SliceType type, SlicedData data); @@ -1801,7 +1803,7 @@ public class OutputStream { if(_typeIdMap == null) // Lazy initialization { - _typeIdMap = new java.util.TreeMap<String, Integer>(); + _typeIdMap = new java.util.TreeMap<>(); } Integer p = _typeIdMap.get(typeId); @@ -1820,7 +1822,7 @@ public class OutputStream final protected Encaps _encaps; // Encapsulation attributes for instance marshaling. - final protected java.util.IdentityHashMap<Ice.Object, Integer> _marshaledMap; + final protected java.util.IdentityHashMap<Value, Integer> _marshaledMap; private java.util.TreeMap<String, Integer> _typeIdMap; private int _typeIdIndex; } @@ -1832,11 +1834,11 @@ public class OutputStream super(stream, encaps); _sliceType = SliceType.NoSlice; _valueIdIndex = 0; - _toBeMarshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + _toBeMarshaledMap = new java.util.IdentityHashMap<>(); } @Override - void writeValue(Ice.Object v) + void writeValue(Value v) { // // Object references are encoded as a negative integer in 1.0. @@ -1885,7 +1887,7 @@ public class OutputStream // // Write the Object slice. // - startSlice(ObjectImpl.ice_staticId(), -1, true); + startSlice(Value.ice_staticId, -1, true); _stream.writeSize(0); // For compatibility with the old AFM. endSlice(); } @@ -1947,10 +1949,10 @@ public class OutputStream // _marshaledMap.putAll(_toBeMarshaledMap); - java.util.IdentityHashMap<Ice.Object, Integer> savedMap = _toBeMarshaledMap; - _toBeMarshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + java.util.IdentityHashMap<Value, Integer> savedMap = _toBeMarshaledMap; + _toBeMarshaledMap = new java.util.IdentityHashMap<>(); _stream.writeSize(savedMap.size()); - for(java.util.Map.Entry<Ice.Object, Integer> p : savedMap.entrySet()) + for(java.util.Map.Entry<Value, Integer> p : savedMap.entrySet()) { // // Ask the instance to marshal itself. Any new class @@ -1965,7 +1967,7 @@ public class OutputStream } catch(java.lang.Exception ex) { - String s = "exception raised by ice_preMarshal:\n" + IceInternal.Ex.toString(ex); + String s = "exception raised by ice_preMarshal:\n" + com.zeroc.IceInternal.Ex.toString(ex); _stream.instance().initializationData().logger.warning(s); } @@ -1975,7 +1977,7 @@ public class OutputStream _stream.writeSize(0); // Zero marker indicates end of sequence of sequences of instances. } - private int registerValue(Ice.Object v) + private int registerValue(Value v) { assert(v != null); @@ -2013,7 +2015,7 @@ public class OutputStream // Encapsulation attributes for instance marshaling. private int _valueIdIndex; - private java.util.IdentityHashMap<Ice.Object, Integer> _toBeMarshaledMap; + private java.util.IdentityHashMap<Value, Integer> _toBeMarshaledMap; } private static final class EncapsEncoder11 extends EncapsEncoder @@ -2026,7 +2028,7 @@ public class OutputStream } @Override - void writeValue(Ice.Object v) + void writeValue(Value v) { if(v == null) { @@ -2036,8 +2038,8 @@ public class OutputStream { if(_current.indirectionTable == null) // Lazy initialization { - _current.indirectionTable = new java.util.ArrayList<Ice.Object>(); - _current.indirectionMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + _current.indirectionTable = new java.util.ArrayList<>(); + _current.indirectionMap = new java.util.IdentityHashMap<>(); } // @@ -2110,11 +2112,11 @@ public class OutputStream if(_encaps.format == FormatType.SlicedFormat) { // Encode the slice size if using the sliced format. - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_SLICE_SIZE; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_SLICE_SIZE; } if(last) { - _current.sliceFlags |= IceInternal.Protocol.FLAG_IS_LAST_SLICE; // This is the last slice. + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_IS_LAST_SLICE; // This is the last slice. } _stream.writeByte((byte)0); // Placeholder for the slice flags @@ -2134,7 +2136,7 @@ public class OutputStream { if(compactId >= 0) { - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_TYPE_ID_COMPACT; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_TYPE_ID_COMPACT; _stream.writeSize(compactId); } else @@ -2142,12 +2144,12 @@ public class OutputStream int index = registerTypeId(typeId); if(index < 0) { - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_TYPE_ID_STRING; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_TYPE_ID_STRING; _stream.writeString(typeId); } else { - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_TYPE_ID_INDEX; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_TYPE_ID_INDEX; _stream.writeSize(index); } } @@ -2158,7 +2160,7 @@ public class OutputStream _stream.writeString(typeId); } - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0) + if((_current.sliceFlags & com.zeroc.IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0) { _stream.writeInt(0); // Placeholder for the slice length. } @@ -2175,15 +2177,15 @@ public class OutputStream // were encoded. Note that the optional members are encoded before // the indirection table and are included in the slice size. // - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0) + if((_current.sliceFlags & com.zeroc.IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0) { - _stream.writeByte((byte)IceInternal.Protocol.OPTIONAL_END_MARKER); + _stream.writeByte((byte)com.zeroc.IceInternal.Protocol.OPTIONAL_END_MARKER); } // // Write the slice length if necessary. // - if((_current.sliceFlags & IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0) + if((_current.sliceFlags & com.zeroc.IceInternal.Protocol.FLAG_HAS_SLICE_SIZE) != 0) { final int sz = _stream.pos() - _current.writeSlice + 4; _stream.rewriteInt(sz, _current.writeSlice - 4); @@ -2195,13 +2197,13 @@ public class OutputStream if(_current.indirectionTable != null && !_current.indirectionTable.isEmpty()) { assert(_encaps.format == FormatType.SlicedFormat); - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_INDIRECTION_TABLE; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_INDIRECTION_TABLE; // // Write the indirection instance table. // _stream.writeSize(_current.indirectionTable.size()); - for(Ice.Object v : _current.indirectionTable) + for(Value v : _current.indirectionTable) { writeInstance(v); } @@ -2226,7 +2228,7 @@ public class OutputStream { if(_stream.writeOptionalImpl(tag, format)) { - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS; return true; } else @@ -2262,7 +2264,7 @@ public class OutputStream if(info.hasOptionalMembers) { - _current.sliceFlags |= IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS; + _current.sliceFlags |= com.zeroc.IceInternal.Protocol.FLAG_HAS_OPTIONAL_MEMBERS; } // @@ -2272,10 +2274,10 @@ public class OutputStream { if(_current.indirectionTable == null) // Lazy initialization { - _current.indirectionTable = new java.util.ArrayList<Ice.Object>(); - _current.indirectionMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + _current.indirectionTable = new java.util.ArrayList<>(); + _current.indirectionMap = new java.util.IdentityHashMap<>(); } - for(Ice.Object o : info.instances) + for(Value o : info.instances) { _current.indirectionTable.add(o); } @@ -2285,7 +2287,7 @@ public class OutputStream } } - private void writeInstance(Ice.Object v) + private void writeInstance(Value v) { assert(v != null); @@ -2311,7 +2313,7 @@ public class OutputStream } catch(java.lang.Exception ex) { - String s = "exception raised by ice_preMarshal:\n" + IceInternal.Ex.toString(ex); + String s = "exception raised by ice_preMarshal:\n" + com.zeroc.IceInternal.Ex.toString(ex); _stream.instance().initializationData().logger.warning(s); } @@ -2339,8 +2341,8 @@ public class OutputStream byte sliceFlags; int writeSlice; // Position of the slice data members int sliceFlagsPos; // Position of the slice flags - java.util.List<Ice.Object> indirectionTable; - java.util.IdentityHashMap<Ice.Object, Integer> indirectionMap; + java.util.List<Value> indirectionTable; + java.util.IdentityHashMap<Value, Integer> indirectionMap; final InstanceData previous; InstanceData next; @@ -2423,4 +2425,10 @@ public class OutputStream } } } + + @FunctionalInterface + static public interface Marshaler + { + void marshal(OutputStream ostr); + } } diff --git a/java/src/Ice/src/main/java/Ice/PluginFactory.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginFactory.java index a92439a8d9e..048566ef7f8 100644 --- a/java/src/Ice/src/main/java/Ice/PluginFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginFactory.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Applications implement this interface to provide a plug-in factory diff --git a/java/src/Ice/src/main/java/Ice/PluginManagerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginManagerI.java index 6b40bb0f333..e3ec657ab95 100644 --- a/java/src/Ice/src/main/java/Ice/PluginManagerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PluginManagerI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; import java.net.URLEncoder; @@ -29,7 +29,7 @@ public final class PluginManagerI implements PluginManager // // Invoke initialize() on the plug-ins, in the order they were loaded. // - java.util.List<Plugin> initializedPlugins = new java.util.ArrayList<Plugin>(); + java.util.List<Plugin> initializedPlugins = new java.util.ArrayList<>(); try { for(PluginInfo p : _plugins) @@ -38,7 +38,7 @@ public final class PluginManagerI implements PluginManager { p.plugin.initialize(); } - catch(Ice.PluginInitializationException ex) + catch(PluginInitializationException ex) { throw ex; } @@ -81,7 +81,7 @@ public final class PluginManagerI implements PluginManager public synchronized String[] getPlugins() { - java.util.ArrayList<String> names = new java.util.ArrayList<String>(); + java.util.ArrayList<String> names = new java.util.ArrayList<>(); for(PluginInfo p : _plugins) { names.add(p.name); @@ -151,8 +151,8 @@ public final class PluginManagerI implements PluginManager } catch(RuntimeException ex) { - Ice.Util.getProcessLogger().warning("unexpected exception raised by plug-in `" + - p.name + "' destruction:\n" + ex.toString()); + Util.getProcessLogger().warning("unexpected exception raised by plug-in `" + + p.name + "' destruction:\n" + ex.toString()); } } } @@ -168,16 +168,14 @@ public final class PluginManagerI implements PluginManager } } - public - PluginManagerI(Communicator communicator, IceInternal.Instance instance) + public PluginManagerI(Communicator communicator, com.zeroc.IceInternal.Instance instance) { _communicator = communicator; _instance = instance; _initialized = false; } - public void - loadPlugins(StringSeqHolder cmdArgs) + public String[] loadPlugins(String[] cmdArgs) { assert(_communicator != null); @@ -221,7 +219,7 @@ public final class PluginManagerI implements PluginManager if(hasKey) { final String value = plugins.get(key); - loadPlugin(name, value, cmdArgs); + cmdArgs = loadPlugin(name, value, cmdArgs); plugins.remove(key); } else @@ -256,7 +254,7 @@ public final class PluginManagerI implements PluginManager else if(suffix.equals("java")) { name = name.substring(0, dotPos); - loadPlugin(name, entry.getValue(), cmdArgs); + cmdArgs = loadPlugin(name, entry.getValue(), cmdArgs); p.remove(); // @@ -287,13 +285,14 @@ public final class PluginManagerI implements PluginManager value = javaValue; } - loadPlugin(name, value, cmdArgs); + cmdArgs = loadPlugin(name, value, cmdArgs); } } + + return cmdArgs; } - private void - loadPlugin(String name, String pluginSpec, StringSeqHolder cmdArgs) + private String[] loadPlugin(String name, String pluginSpec, String[] cmdArgs) { assert(_communicator != null); @@ -310,9 +309,9 @@ public final class PluginManagerI implements PluginManager String[] args; try { - args = IceUtilInternal.Options.split(pluginSpec); + args = com.zeroc.IceUtilInternal.Options.split(pluginSpec); } - catch(IceUtilInternal.Options.BadQuote ex) + catch(com.zeroc.IceUtilInternal.Options.BadQuote ex) { throw new PluginInitializationException("invalid arguments for plug-in `" + name + "':\n" + ex.getMessage()); @@ -386,7 +385,7 @@ public final class PluginManagerI implements PluginManager // Properties properties = _communicator.getProperties(); args = properties.parseCommandLineOptions(name, args); - cmdArgs.value = properties.parseCommandLineOptions(name, cmdArgs.value); + cmdArgs = properties.parseCommandLineOptions(name, cmdArgs); // // Instantiate the class. @@ -423,7 +422,7 @@ public final class PluginManagerI implements PluginManager if(_classLoaders == null) { - _classLoaders = new java.util.HashMap<String, ClassLoader>(); + _classLoaders = new java.util.HashMap<>(); } else { @@ -466,7 +465,7 @@ public final class PluginManagerI implements PluginManager } else { - c = IceInternal.Util.getInstance(_communicator).findClass(className); + c = com.zeroc.IceInternal.Util.getInstance(_communicator).findClass(className); } if(c == null) @@ -481,7 +480,7 @@ public final class PluginManagerI implements PluginManager } catch(ClassCastException ex) { - throw new PluginInitializationException("class " + className + " does not implement Ice.PluginFactory", + throw new PluginInitializationException("class " + className + " does not implement PluginFactory", ex); } } @@ -520,10 +519,11 @@ public final class PluginManagerI implements PluginManager info.name = name; info.plugin = plugin; _plugins.add(info); + + return cmdArgs; } - private Plugin - findPlugin(String name) + private Plugin findPlugin(String name) { for(PluginInfo p : _plugins) { @@ -542,8 +542,8 @@ public final class PluginManagerI implements PluginManager } private Communicator _communicator; - private IceInternal.Instance _instance; - private java.util.List<PluginInfo> _plugins = new java.util.ArrayList<PluginInfo>(); + private com.zeroc.IceInternal.Instance _instance; + private java.util.List<PluginInfo> _plugins = new java.util.ArrayList<>(); private boolean _initialized; private java.util.Map<String, ClassLoader> _classLoaders; } diff --git a/java/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java index d07b0dab83a..4585a4ddfb1 100644 --- a/java/src/Ice/src/main/java/Ice/PropertiesAdminUpdateCallback.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesAdminUpdateCallback.java @@ -7,8 +7,9 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; +@FunctionalInterface public interface PropertiesAdminUpdateCallback { void updated(java.util.Map<String, String> changes); diff --git a/java/src/Ice/src/main/java/Ice/PropertiesI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesI.java index 81cff7c62e5..29ae6ddc1e5 100644 --- a/java/src/Ice/src/main/java/Ice/PropertiesI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/PropertiesI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public final class PropertiesI implements Properties { @@ -83,8 +83,8 @@ public final class PropertiesI implements Properties } catch(NumberFormatException ex) { - Ice.Util.getProcessLogger().warning("numeric property " + key + - " set to non-numeric value, defaulting to " + value); + Util.getProcessLogger().warning("numeric property " + key + + " set to non-numeric value, defaulting to " + value); } } @@ -112,11 +112,11 @@ public final class PropertiesI implements Properties { pv.used = true; - String[] result = IceUtilInternal.StringUtil.splitString(pv.value, ", \t\r\n"); + String[] result = com.zeroc.IceUtilInternal.StringUtil.splitString(pv.value, ", \t\r\n"); if(result == null) { - Ice.Util.getProcessLogger().warning("mismatched quotes in property " + key - + "'s value, returning default value"); + Util.getProcessLogger().warning("mismatched quotes in property " + key + + "'s value, returning default value"); return value; } if(result.length == 0) @@ -135,7 +135,7 @@ public final class PropertiesI implements Properties public synchronized java.util.Map<String, String> getPropertiesForPrefix(String prefix) { - java.util.HashMap<String, String> result = new java.util.HashMap<String, String>(); + java.util.HashMap<String, String> result = new java.util.HashMap<>(); for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet()) { String key = p.getKey(); @@ -164,19 +164,19 @@ public final class PropertiesI implements Properties // // Check if the property is legal. // - Logger logger = Ice.Util.getProcessLogger(); + Logger logger = Util.getProcessLogger(); if(key == null || key.length() == 0) { - throw new Ice.InitializationException("Attempt to set property with empty key"); + throw new InitializationException("Attempt to set property with empty key"); } int dotPos = key.indexOf('.'); if(dotPos != -1) { String prefix = key.substring(0, dotPos); - for(int i = 0; IceInternal.PropertyNames.validProps[i] != null; ++i) + for(int i = 0; com.zeroc.IceInternal.PropertyNames.validProps[i] != null; ++i) { - String pattern = IceInternal.PropertyNames.validProps[i][0].pattern(); + String pattern = com.zeroc.IceInternal.PropertyNames.validProps[i][0].pattern(); dotPos = pattern.indexOf('.'); // // Each top level prefix describes a non-empty namespace. Having a string without a @@ -192,19 +192,19 @@ public final class PropertiesI implements Properties } boolean found = false; - for(int j = 0; IceInternal.PropertyNames.validProps[i][j] != null && !found; ++j) + for(int j = 0; com.zeroc.IceInternal.PropertyNames.validProps[i][j] != null && !found; ++j) { - pattern = IceInternal.PropertyNames.validProps[i][j].pattern(); + pattern = com.zeroc.IceInternal.PropertyNames.validProps[i][j].pattern(); java.util.regex.Pattern pComp = java.util.regex.Pattern.compile(pattern); java.util.regex.Matcher m = pComp.matcher(key); found = m.matches(); - if(found && IceInternal.PropertyNames.validProps[i][j].deprecated()) + if(found && com.zeroc.IceInternal.PropertyNames.validProps[i][j].deprecated()) { logger.warning("deprecated property: " + key); - if(IceInternal.PropertyNames.validProps[i][j].deprecatedBy() != null) + if(com.zeroc.IceInternal.PropertyNames.validProps[i][j].deprecatedBy() != null) { - key = IceInternal.PropertyNames.validProps[i][j].deprecatedBy(); + key = com.zeroc.IceInternal.PropertyNames.validProps[i][j].deprecatedBy(); } } @@ -281,7 +281,7 @@ public final class PropertiesI implements Properties } pfx = "--" + pfx; - java.util.ArrayList<String> result = new java.util.ArrayList<String>(); + java.util.ArrayList<String> result = new java.util.ArrayList<>(); for(String opt : options) { if(opt.startsWith(pfx)) @@ -306,9 +306,9 @@ public final class PropertiesI implements Properties parseIceCommandLineOptions(String[] options) { String[] args = options; - for(int i = 0; IceInternal.PropertyNames.clPropNames[i] != null; ++i) + for(int i = 0; com.zeroc.IceInternal.PropertyNames.clPropNames[i] != null; ++i) { - args = parseCommandLineOptions(IceInternal.PropertyNames.clPropNames[i], args); + args = parseCommandLineOptions(com.zeroc.IceInternal.PropertyNames.clPropNames[i], args); } return args; } @@ -386,7 +386,7 @@ public final class PropertiesI implements Properties } } } - catch(Ice.LocalException ex) + catch(LocalException ex) { throw ex; } @@ -400,7 +400,7 @@ public final class PropertiesI implements Properties java.io.PushbackInputStream is = null; try { - java.io.InputStream f = IceInternal.Util.openResource(getClass().getClassLoader(), file); + java.io.InputStream f = com.zeroc.IceInternal.Util.openResource(getClass().getClassLoader(), file); if(f == null) { FileException fe = new FileException(); @@ -456,7 +456,7 @@ public final class PropertiesI implements Properties public synchronized java.util.List<String> getUnusedProperties() { - java.util.List<String> unused = new java.util.ArrayList<String>(); + java.util.List<String> unused = new java.util.ArrayList<>(); for(java.util.Map.Entry<String, PropertyValue> p : _properties.entrySet()) { PropertyValue pv = p.getValue(); @@ -485,7 +485,7 @@ public final class PropertiesI implements Properties { } - PropertiesI(StringSeqHolder args, Properties defaults) + String[] init(String[] args, Properties defaults) { if(defaults != null) { @@ -493,7 +493,7 @@ public final class PropertiesI implements Properties // NOTE: we can't just do a shallow copy of the map as the map values // would otherwise be shared between the two PropertiesI object. // - //_properties = new java.util.HashMap<String, PropertyValue>(((PropertiesI)defaults)._properties); + //_properties = new java.util.HashMap<>(((PropertiesI)defaults)._properties); for(java.util.Map.Entry<String, PropertyValue> p : (((PropertiesI)defaults)._properties).entrySet()) { _properties.put(p.getKey(), new PropertyValue(p.getValue())); @@ -502,11 +502,11 @@ public final class PropertiesI implements Properties boolean loadConfigFiles = false; - for(int i = 0; i < args.value.length; i++) + for(int i = 0; i < args.length; i++) { - if(args.value[i].startsWith("--Ice.Config")) + if(args[i].startsWith("--Ice.Config")) { - String line = args.value[i]; + String line = args[i]; if(line.indexOf('=') == -1) { line += "=1"; @@ -514,13 +514,13 @@ public final class PropertiesI implements Properties parseLine(line.substring(2)); loadConfigFiles = true; - String[] arr = new String[args.value.length - 1]; - System.arraycopy(args.value, 0, arr, 0, i); - if(i < args.value.length - 1) + String[] arr = new String[args.length - 1]; + System.arraycopy(args, 0, arr, 0, i); + if(i < args.length - 1) { - System.arraycopy(args.value, i + 1, arr, i, args.value.length - i - 1); + System.arraycopy(args, i + 1, arr, i, args.length - i - 1); } - args.value = arr; + args = arr; } } @@ -537,7 +537,7 @@ public final class PropertiesI implements Properties loadConfig(); } - args.value = parseIceCommandLineOptions(args.value); + return parseIceCommandLineOptions(args); } private void @@ -717,7 +717,7 @@ public final class PropertiesI implements Properties if((state == ParseStateKey && key.length() != 0) || (state == ParseStateValue && key.length() == 0)) { - Ice.Util.getProcessLogger().warning("invalid config file entry: \"" + line + "\""); + Util.getProcessLogger().warning("invalid config file entry: \"" + line + "\""); return; } else if(key.length() == 0) @@ -760,5 +760,5 @@ public final class PropertiesI implements Properties } } - private java.util.HashMap<String, PropertyValue> _properties = new java.util.HashMap<String, PropertyValue>(); + private java.util.HashMap<String, PropertyValue> _properties = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityFacetKey.java index 21ff8089ba2..bac38e4842b 100644 --- a/java/src/Ice/src/main/java/Ice/ProxyIdentityFacetKey.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityFacetKey.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * This class wraps a proxy to allow it to be used the key for a hashed collection. @@ -27,7 +27,7 @@ public class ProxyIdentityFacetKey * @param proxy The proxy for this instance. **/ public - ProxyIdentityFacetKey(Ice.ObjectPrx proxy) + ProxyIdentityFacetKey(ObjectPrx proxy) { _proxy = proxy; @@ -37,8 +37,8 @@ public class ProxyIdentityFacetKey _identity = proxy.ice_getIdentity(); _facet = proxy.ice_getFacet(); int h = 5381; - h = IceInternal.HashUtil.hashAdd(h, _identity); - h = IceInternal.HashUtil.hashAdd(h, _facet); + h = com.zeroc.IceInternal.HashUtil.hashAdd(h, _identity); + h = com.zeroc.IceInternal.HashUtil.hashAdd(h, _facet); _hashCode = h; } @@ -84,14 +84,14 @@ public class ProxyIdentityFacetKey * * @return The proxy stored by this class. **/ - public Ice.ObjectPrx + public ObjectPrx getProxy() { return _proxy; } - final private Ice.ObjectPrx _proxy; - final private Ice.Identity _identity; + final private ObjectPrx _proxy; + final private Identity _identity; final private String _facet; final private int _hashCode; } diff --git a/java/src/Ice/src/main/java/Ice/ProxyIdentityKey.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityKey.java index b8c85cf324b..cc1a763cb1e 100644 --- a/java/src/Ice/src/main/java/Ice/ProxyIdentityKey.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ProxyIdentityKey.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * This class wraps a proxy to allow it to be used the key for a hashed collection. @@ -27,7 +27,7 @@ public class ProxyIdentityKey * @param proxy The proxy for this instance. **/ public - ProxyIdentityKey(Ice.ObjectPrx proxy) + ProxyIdentityKey(ObjectPrx proxy) { _proxy = proxy; @@ -36,7 +36,7 @@ public class ProxyIdentityKey // _identity = proxy.ice_getIdentity(); int h = 5381; - h = IceInternal.HashUtil.hashAdd(h, _identity); + h = com.zeroc.IceInternal.HashUtil.hashAdd(h, _identity); _hashCode = h; } @@ -77,13 +77,13 @@ public class ProxyIdentityKey return false; } - public Ice.ObjectPrx + public ObjectPrx getProxy() { return _proxy; } - final private Ice.ObjectPrx _proxy; - final private Ice.Identity _identity; + final private ObjectPrx _proxy; + final private Identity _identity; final private int _hashCode; } diff --git a/java/src/Ice/src/main/java/Ice/ReadValueCallback.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java index 9a3132a9822..41e9ffba464 100644 --- a/java/src/Ice/src/main/java/Ice/ReadValueCallback.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ReadValueCallback.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Callback class to inform an application when an instance of a Slice class has been @@ -15,13 +15,14 @@ package Ice; * * @see InputStream#readValue **/ +@FunctionalInterface public interface ReadValueCallback { /** * The Ice run time calls this method when it has fully unmarshaled the state * of a Slice class instance. * - * @param obj The unmarshaled Slice class instance. + * @param v The unmarshaled Slice class instance. **/ - void valueReady(Ice.Object obj); + void valueReady(Value v); } diff --git a/java/src/Ice/src/main/java/Ice/Request.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Request.java index 1be2ec37fbf..4b9ccb87190 100644 --- a/java/src/Ice/src/main/java/Ice/Request.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Request.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Interface for incoming requests. diff --git a/java/src/Ice/src/main/java/Ice/SignalPolicy.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SignalPolicy.java index b1bb328d199..060fd83b1bf 100644 --- a/java/src/Ice/src/main/java/Ice/SignalPolicy.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SignalPolicy.java @@ -7,17 +7,17 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * The signal policy for Ice.Application signal handling. * - * @see Ice.Application + * @see Application **/ public enum SignalPolicy { /** - * If a signal is received, {@link Ice.Application} reacts to the signal + * If a signal is received, {@link Application} reacts to the signal * by calling {@link Communicator#destroy} or {@link Communicator#shutdown}, * or by calling a custom shutdown hook installed by the application. **/ diff --git a/java/src/Ice/src/main/java/Ice/SliceInfo.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SliceInfo.java index 8297a4d447c..c1834b1c53c 100644 --- a/java/src/Ice/src/main/java/Ice/SliceInfo.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SliceInfo.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * SliceInfo encapsulates the details of a slice for an unknown class or exception type. @@ -32,7 +32,7 @@ public class SliceInfo /** * The class instances referenced by this slice. **/ - public Ice.Object[] instances; + public com.zeroc.Ice.Value[] instances; /** * Whether or not the slice contains optional members. diff --git a/java/src/Ice/src/main/java/Ice/SlicedData.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SlicedData.java index b747689687a..33d2b91e7b6 100644 --- a/java/src/Ice/src/main/java/Ice/SlicedData.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SlicedData.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * SlicedData holds the slices of unknown class or exception types. diff --git a/java/src/Ice/src/main/java/Ice/SysLoggerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SysLoggerI.java index 2938990276a..1818e225aee 100644 --- a/java/src/Ice/src/main/java/Ice/SysLoggerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SysLoggerI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; import java.net.DatagramPacket; import java.net.DatagramSocket; @@ -102,7 +102,7 @@ public final class SysLoggerI implements Logger } else { - throw new Ice.InitializationException("Invalid value for Ice.SyslogFacility: " + facilityString); + throw new InitializationException("Invalid value for Ice.SyslogFacility: " + facilityString); } initialize(prefix, facility); } @@ -125,13 +125,13 @@ public final class SysLoggerI implements Logger // try { - _host = IceInternal.Network.getLocalAddress(IceInternal.Network.EnableBoth); + _host = com.zeroc.IceInternal.Network.getLocalAddress(com.zeroc.IceInternal.Network.EnableBoth); _socket = new DatagramSocket(); _socket.connect(_host, _port); } catch(IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -201,7 +201,7 @@ public final class SysLoggerI implements Logger } catch(IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } diff --git a/java/src/Ice/src/main/java/Ice/SystemException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java index c6f063adfb8..d07c2da2c37 100644 --- a/java/src/Ice/src/main/java/Ice/SystemException.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/SystemException.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Base class for all Ice system exceptions. diff --git a/java/src/Ice/src/main/java/Ice/ThreadHookPlugin.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java index 8ce5943d638..799b89a0b72 100644 --- a/java/src/Ice/src/main/java/Ice/ThreadHookPlugin.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadHookPlugin.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Class to support thread notification hooks. Applications using thread @@ -18,7 +18,7 @@ package Ice; * @see PluginFactory * @see Plugin **/ -public class ThreadHookPlugin implements Ice.Plugin +public class ThreadHookPlugin implements Plugin { /** * Installs a thread notification hook for a communicator. @@ -36,7 +36,7 @@ public class ThreadHookPlugin implements Ice.Plugin throw ex; } - IceInternal.Instance instance = IceInternal.Util.getInstance(communicator); + com.zeroc.IceInternal.Instance instance = com.zeroc.IceInternal.Util.getInstance(communicator); instance.setThreadHook(threadHook); } diff --git a/java/src/Ice/src/main/java/Ice/ThreadNotification.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java index 3fae6f8930e..195e6e842b0 100644 --- a/java/src/Ice/src/main/java/Ice/ThreadNotification.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ThreadNotification.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Interface for thread notification hooks. Applications can derive diff --git a/java/src/Ice/src/main/java/Ice/UnknownSlicedValue.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java index 98d3d45260c..7b0cfc75fbc 100644 --- a/java/src/Ice/src/main/java/Ice/UnknownSlicedValue.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java @@ -7,20 +7,19 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Unknown sliced value holds an instance of an unknown Slice class type. **/ -public final class UnknownSlicedValue extends ObjectImpl +public final class UnknownSlicedValue extends Value { /** * Represents an instance of a Slice class type having the given Slice type. * * @param unknownTypeId The Slice type ID of the unknown object. **/ - public - UnknownSlicedValue(String unknownTypeId) + public UnknownSlicedValue(String unknownTypeId) { _unknownTypeId = unknownTypeId; } diff --git a/java/src/Ice/src/main/java/Ice/UserException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java index 1d78d42c722..e4ea68ea718 100644 --- a/java/src/Ice/src/main/java/Ice/UserException.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Base class for Slice user exceptions. @@ -52,8 +52,7 @@ public abstract class UserException extends java.lang.Exception implements Clone * @deprecated ice_name() is deprecated, use ice_id() instead. **/ @Deprecated - public String - ice_name() + public String ice_name() { return ice_id().substring(2); } @@ -63,8 +62,7 @@ public abstract class UserException extends java.lang.Exception implements Clone * * @return The type id of this exception. **/ - public abstract String - ice_id(); + public abstract String ice_id(); /** * Returns a string representation of this exception. @@ -72,45 +70,39 @@ public abstract class UserException extends java.lang.Exception implements Clone * @return A string representation of this exception. **/ @Override - public String - toString() + public String toString() { java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter pw = new java.io.PrintWriter(sw); - IceUtilInternal.OutputBase out = new IceUtilInternal.OutputBase(pw); + com.zeroc.IceUtilInternal.OutputBase out = new com.zeroc.IceUtilInternal.OutputBase(pw); out.setUseTab(false); out.print(getClass().getName()); out.inc(); - IceInternal.ValueWriter.write(this, out); + com.zeroc.IceInternal.ValueWriter.write(this, out); pw.flush(); return sw.toString(); } - public void - __write(OutputStream os) + public void __write(OutputStream os) { os.startException(null); __writeImpl(os); os.endException(); } - public void - __read(InputStream is) + public void __read(InputStream is) { is.startException(); __readImpl(is); is.endException(false); } - public boolean - __usesClasses() + public boolean __usesClasses() { return false; } - protected abstract void - __writeImpl(OutputStream os); + protected abstract void __writeImpl(OutputStream os); - protected abstract void - __readImpl(InputStream is); + protected abstract void __readImpl(InputStream is); } diff --git a/java/src/Ice/src/main/java/Ice/UserExceptionFactory.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UserExceptionFactory.java index 9e899e813ec..9ee52aacf31 100644 --- a/java/src/Ice/src/main/java/Ice/UserExceptionFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UserExceptionFactory.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** * Instantiates user exceptions. diff --git a/java/src/Ice/src/main/java/Ice/Util.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Util.java index 565dab3588a..05e8faccafd 100644 --- a/java/src/Ice/src/main/java/Ice/Util.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Util.java @@ -7,7 +7,9 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; + +import com.zeroc.IceUtilInternal.StringUtil; /** * Utility methods for the Ice run time. @@ -19,51 +21,21 @@ public final class Util * * @return A new empty property set. **/ - public static Properties - createProperties() + public static Properties createProperties() { return new PropertiesI(); } /** - * Creates a property set initialized from an argument vector. - * - * @param args A command-line argument vector, possibly containing - * options to set properties. If the command-line options include - * a <code>--Ice.Config</code> option, the corresponding configuration - * files are parsed. If the same property is set in a configuration - * file and in the argument vector, the argument vector takes precedence. - * <p> - * This method modifies the argument vector by removing any Ice-related options. - * - * @return A property set initialized with the property settings - * that were removed from <code>args</code>. + * Encapsulates the results of a call to createProperties(). **/ - public static Properties - createProperties(StringSeqHolder args) + public static class CreatePropertiesResult { - return new PropertiesI(args, null); - } + /** The new property set. */ + public Properties properties; - /** - * Creates a property set initialized from an argument vector. - * - * @param args A command-line argument vector, possibly containing - * options to set properties. If the command-line options include - * a <code>--Ice.Config</code> option, the corresponding configuration - * files are parsed. If the same property is set in a configuration - * file and in the argument vector, the argument vector takes precedence. - * <p> - * This method modifies the argument vector by removing any Ice-related options. - * @param defaults Default values for the property set. Settings in configuration - * files and <code>args</code> override these defaults. - * - * @return An initalized property set. - **/ - public static Properties - createProperties(StringSeqHolder args, Properties defaults) - { - return new PropertiesI(args, defaults); + /** The original command-line arguments with Ice-related arguments removed. */ + public String[] args; } /** @@ -75,14 +47,13 @@ public final class Util * files are parsed. If the same property is set in a configuration * file and in the argument vector, the argument vector takes precedence. * - * @return A property set initialized with the property settings - * in <code>args</code>. + * @return A new property set initialized with the property settings + * that were removed from the argument vector, along with the filtered + * argument vector. **/ - public static Properties - createProperties(String[] args) + public static CreatePropertiesResult createProperties(String[] args) { - StringSeqHolder argsH = new StringSeqHolder(args); - return createProperties(argsH); + return createProperties(args, null); } /** @@ -93,64 +64,62 @@ public final class Util * a <code>--Ice.Config</code> option, the corresponding configuration * files are parsed. If the same property is set in a configuration * file and in the argument vector, the argument vector takes precedence. + * * @param defaults Default values for the property set. Settings in configuration * files and <code>args</code> override these defaults. * - * @return An initalized property set. + * @return A new property set initialized with the property settings + * that were removed from the argument vector, along with the filtered + * argument vector. **/ - public static Properties - createProperties(String[] args, Properties defaults) + public static CreatePropertiesResult createProperties(String[] args, Properties defaults) { - StringSeqHolder argsH = new StringSeqHolder(args); - return createProperties(argsH, defaults); + PropertiesI properties = new PropertiesI(); + CreatePropertiesResult cpr = new CreatePropertiesResult(); + cpr.properties = properties; + cpr.args = properties.init(args, defaults); + return cpr; } /** - * Creates a communicator. - * - * @param args A command-line argument vector. Any Ice-related options - * in this vector are used to intialize the communicator. - * This method modifies the argument vector by removing any Ice-related options. - * - * @return The initialized communicator. + * Encapsulates the results of a call to initialize(). **/ - public static Communicator - initialize(StringSeqHolder args) + public static class InitializeResult { - return initialize(args, null); + /** The new communicator. */ + public Communicator communicator; + + /** The original command-line arguments with Ice-related arguments removed. */ + public String[] args; } /** * Creates a communicator. * * @param args A command-line argument vector. Any Ice-related options - * in this vector are used to intialize the communicator. + * in this vector are used to initialize the communicator. * - * @return The initialized communicator. + * @return The new communicator and a filtered argument vector. **/ - public static Communicator - initialize(String[] args) + public static InitializeResult initialize(String[] args) { - StringSeqHolder argsH = new StringSeqHolder(args); - return initialize(argsH); + return initialize(args, null); } /** * Creates a communicator. * * @param args A command-line argument vector. Any Ice-related options - * in this vector are used to intialize the communicator. - * This method modifies the argument vector by removing any Ice-related options. + * in this vector are used to initialize the communicator. * - * @param initData Additional intialization data. Property settings in <code>args</code> + * @param initData Additional initialization data. Property settings in <code>args</code> * override property settings in <code>initData</code>. * - * @return The initialized communicator. + * @return The new communicator and a filtered argument vector. * * @see InitializationData **/ - public static Communicator - initialize(StringSeqHolder args, InitializationData initData) + public static InitializeResult initialize(String[] args, InitializationData initData) { if(initData == null) { @@ -160,44 +129,28 @@ public final class Util { initData = initData.clone(); } - initData.properties = createProperties(args, initData.properties); - CommunicatorI result = new CommunicatorI(initData); - result.finishSetup(args); - return result; - } + CreatePropertiesResult cpr = createProperties(args, initData.properties); + initData.properties = cpr.properties; - /** - * Creates a communicator. - * - * @param args A command-line argument vector. Any Ice-related options - * in this vector are used to intialize the communicator. - * - * @param initData Additional intialization data. Property settings in <code>args</code> - * override property settings in <code>initData</code>. - * - * @return The initialized communicator. - * - * @see InitializationData - **/ - public static Communicator - initialize(String[] args, InitializationData initData) - { - StringSeqHolder argsH = new StringSeqHolder(args); - return initialize(argsH, initData); + InitializeResult ir = new InitializeResult(); + + CommunicatorI c = new CommunicatorI(initData); + ir.communicator = c; + ir.args = c.finishSetup(cpr.args); + return ir; } /** * Creates a communicator. * - * @param initData Additional intialization data. + * @param initData Additional initialization data. * - * @return The initialized communicator. + * @return The new communicator. * * @see InitializationData **/ - public static Communicator - initialize(InitializationData initData) + public static Communicator initialize(InitializationData initData) { if(initData == null) { @@ -209,15 +162,14 @@ public final class Util } CommunicatorI result = new CommunicatorI(initData); - result.finishSetup(new StringSeqHolder(new String[0])); + result.finishSetup(new String[0]); return result; } /** * Creates a communicator using a default configuration. **/ - public static Communicator - initialize() + public static Communicator initialize() { return initialize(new InitializationData()); } @@ -229,8 +181,7 @@ public final class Util * * @return The converted object identity. **/ - public static Identity - stringToIdentity(String s) + public static Identity stringToIdentity(String s) { Identity ident = new Identity(); @@ -274,7 +225,7 @@ public final class Util ident.category = ""; try { - ident.name = IceUtilInternal.StringUtil.unescapeString(s, 0, s.length()); + ident.name = StringUtil.unescapeString(s, 0, s.length()); } catch(IllegalArgumentException e) { @@ -287,7 +238,7 @@ public final class Util { try { - ident.category = IceUtilInternal.StringUtil.unescapeString(s, 0, slash); + ident.category = StringUtil.unescapeString(s, 0, slash); } catch(IllegalArgumentException e) { @@ -299,7 +250,7 @@ public final class Util { try { - ident.name = IceUtilInternal.StringUtil.unescapeString(s, slash + 1, s.length()); + ident.name = StringUtil.unescapeString(s, slash + 1, s.length()); } catch(IllegalArgumentException e) { @@ -324,17 +275,15 @@ public final class Util * * @return The string representation of the object identity. **/ - public static String - identityToString(Identity ident) + public static String identityToString(Identity ident) { if(ident.category == null || ident.category.length() == 0) { - return IceUtilInternal.StringUtil.escapeString(ident.name, "/"); + return StringUtil.escapeString(ident.name, "/"); } else { - return IceUtilInternal.StringUtil.escapeString(ident.category, "/") + '/' + - IceUtilInternal.StringUtil.escapeString(ident.name, "/"); + return StringUtil.escapeString(ident.category, "/") + '/' + StringUtil.escapeString(ident.name, "/"); } } @@ -351,8 +300,7 @@ public final class Util * @see ProxyIdentityFacetKey * @see #proxyIdentityAndFacetCompare **/ - public static int - proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs) + public static int proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs) { if(lhs == null && rhs == null) { @@ -392,8 +340,7 @@ public final class Util * @see ProxyIdentityKey * @see #proxyIdentityCompare **/ - public static int - proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs) + public static int proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs) { if(lhs == null && rhs == null) { @@ -444,8 +391,7 @@ public final class Util * * @return The process-wide logger. **/ - public static Logger - getProcessLogger() + public static Logger getProcessLogger() { synchronized(_processLoggerMutex) { @@ -466,8 +412,7 @@ public final class Util * * @param logger The new process-wide logger. **/ - public static void - setProcessLogger(Logger logger) + public static void setProcessLogger(Logger logger) { synchronized(_processLoggerMutex) { @@ -482,8 +427,7 @@ public final class Util * * @return The Ice version. **/ - public static String - stringVersion() + public static String stringVersion() { return "3.7a3"; // "A.B.C", with A=major, B=minor, C=patch } @@ -495,8 +439,7 @@ public final class Util * * @return The Ice version. **/ - public static int - intVersion() + public static int intVersion() { return 30753; // AABBCC, with AA=major, BB=minor, CC=patch } @@ -508,10 +451,9 @@ public final class Util * * @return The converted protocol version. **/ - static public Ice.ProtocolVersion - stringToProtocolVersion(String version) + static public ProtocolVersion stringToProtocolVersion(String version) { - return new Ice.ProtocolVersion(stringToMajor(version), stringToMinor(version)); + return new ProtocolVersion(stringToMajor(version), stringToMinor(version)); } /** @@ -521,10 +463,9 @@ public final class Util * * @return The converted object identity. **/ - static public Ice.EncodingVersion - stringToEncodingVersion(String version) + static public EncodingVersion stringToEncodingVersion(String version) { - return new Ice.EncodingVersion(stringToMajor(version), stringToMinor(version)); + return new EncodingVersion(stringToMajor(version), stringToMinor(version)); } /** @@ -534,8 +475,7 @@ public final class Util * * @return The converted string. **/ - static public String - protocolVersionToString(Ice.ProtocolVersion v) + static public String protocolVersionToString(ProtocolVersion v) { return majorMinorToString(v.major, v.minor); } @@ -547,8 +487,7 @@ public final class Util * * @return The converted string. **/ - static public String - encodingVersionToString(Ice.EncodingVersion v) + static public String encodingVersionToString(EncodingVersion v) { return majorMinorToString(v.major, v.minor); } @@ -558,10 +497,9 @@ public final class Util * * @return The Ice protocol version. **/ - static public Ice.ProtocolVersion - currentProtocol() + static public ProtocolVersion currentProtocol() { - return IceInternal.Protocol.currentProtocol.clone(); + return com.zeroc.IceInternal.Protocol.currentProtocol.clone(); } /** @@ -569,10 +507,25 @@ public final class Util * * @return The Ice encoding version. **/ - static public Ice.EncodingVersion - currentEncoding() + static public EncodingVersion currentEncoding() { - return IceInternal.Protocol.currentEncoding.clone(); + return com.zeroc.IceInternal.Protocol.currentEncoding.clone(); + } + + /** + * Returns the InvocationFuture equivalent of the given CompletableFuture. + * + * @param f The CompletableFuture returned by an asynchronous Ice proxy invocation. + * @return The InvocationFuture object. + **/ + @SuppressWarnings("unchecked") + static public <T> InvocationFuture<T> getInvocationFuture(java.util.concurrent.CompletableFuture<T> f) + { + if(!(f instanceof InvocationFuture)) + { + throw new IllegalArgumentException("future did not originate from an asynchronous proxy invocation"); + } + return (InvocationFuture)f; } /** @@ -581,7 +534,7 @@ public final class Util * @param id The Slice type id, such as <code>::Module::Type</code>. * @return The equivalent Java class name, or null if the type id is malformed. **/ - public static String typeIdToClass(String id) + static public String typeIdToClass(String id) { if(!id.startsWith("::")) { @@ -616,7 +569,7 @@ public final class Util return buf.toString(); } - private static String fixKwd(String name) + static private String fixKwd(String name) { // // Keyword list. *Must* be kept in alphabetical order. Note that checkedCast and uncheckedCast @@ -639,13 +592,12 @@ public final class Util return found ? "_" + name : name; } - static private byte - stringToMajor(String str) + static private byte stringToMajor(String str) { int pos = str.indexOf('.'); if(pos == -1) { - throw new Ice.VersionParseException("malformed version value `" + str + "'"); + throw new VersionParseException("malformed version value `" + str + "'"); } String majStr = str.substring(0, pos); @@ -656,24 +608,23 @@ public final class Util } catch(NumberFormatException ex) { - throw new Ice.VersionParseException("invalid version value `" + str + "'"); + throw new VersionParseException("invalid version value `" + str + "'"); } if(majVersion < 1 || majVersion > 255) { - throw new Ice.VersionParseException("range error in version `" + str + "'"); + throw new VersionParseException("range error in version `" + str + "'"); } return (byte)majVersion; } - static private byte - stringToMinor(String str) + static private byte stringToMinor(String str) { int pos = str.indexOf('.'); if(pos == -1) { - throw new Ice.VersionParseException("malformed version value `" + str + "'"); + throw new VersionParseException("malformed version value `" + str + "'"); } String minStr = str.substring(pos + 1, str.length()); @@ -684,19 +635,18 @@ public final class Util } catch(NumberFormatException ex) { - throw new Ice.VersionParseException("invalid version value `" + str + "'"); + throw new VersionParseException("invalid version value `" + str + "'"); } if(minVersion < 0 || minVersion > 255) { - throw new Ice.VersionParseException("range error in version `" + str + "'"); + throw new VersionParseException("range error in version `" + str + "'"); } return (byte)minVersion; } - static private String - majorMinorToString(byte major, byte minor) + static private String majorMinorToString(byte major, byte minor) { StringBuilder str = new StringBuilder(); str.append(major < 0 ? major + 255 : (int)major); @@ -705,10 +655,10 @@ public final class Util return str.toString(); } - public final static Ice.ProtocolVersion Protocol_1_0 = new Ice.ProtocolVersion((byte)1, (byte)0); + public final static ProtocolVersion Protocol_1_0 = new ProtocolVersion((byte)1, (byte)0); - public final static Ice.EncodingVersion Encoding_1_0 = new Ice.EncodingVersion((byte)1, (byte)0); - public final static Ice.EncodingVersion Encoding_1_1 = new Ice.EncodingVersion((byte)1, (byte)1); + public final static EncodingVersion Encoding_1_0 = new EncodingVersion((byte)1, (byte)0); + public final static EncodingVersion Encoding_1_1 = new EncodingVersion((byte)1, (byte)1); private static java.lang.Object _processLoggerMutex = new java.lang.Object(); private static Logger _processLogger = null; diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java new file mode 100644 index 00000000000..7b1c64781f8 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java @@ -0,0 +1,90 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +/** + * The base class for instances of Slice classes. + **/ +public abstract class Value implements java.lang.Cloneable, java.io.Serializable +{ + /** + * Returns a copy of the object. The cloned object contains field-for-field copies + * of the state. + * + * @return The cloned object. + **/ + public Value clone() + { + Value c = null; + + try + { + c = (Value)super.clone(); + } + catch(CloneNotSupportedException ex) + { + assert(false); + } + + return c; + } + + /** + * The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass + * to override this method in order to validate its data members. + **/ + public void ice_preMarshal() + { + } + + /** + * The Ice run time invokes this method vafter unmarshaling an object's data members. This allows a + * subclass to override this method in order to perform additional initialization. + **/ + public void ice_postUnmarshal() + { + } + + public static final String ice_staticId = "::Ice::Object"; + + /** + * Returns the Slice type ID of the most-derived interface supported by this object. + * + * @return The return value is always <code>::Ice::Object</code>. + **/ + public String ice_id() + { + return ice_staticId; + } + + public void __write(OutputStream __os) + { + __os.startValue(null); + __writeImpl(__os); + __os.endValue(); + } + + public void __read(InputStream __is) + { + __is.startValue(); + __readImpl(__is); + __is.endValue(false); + } + + protected void __writeImpl(OutputStream __os) + { + } + + protected void __readImpl(InputStream __is) + { + } + + public static final long serialVersionUID = 0L; +} diff --git a/java/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueFactoryManagerI.java index 13e968f5cae..bba1a8d8eb0 100644 --- a/java/src/Ice/src/main/java/Ice/ValueFactoryManagerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueFactoryManagerI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; public class ValueFactoryManagerI implements ValueFactoryManager { @@ -26,5 +26,5 @@ public class ValueFactoryManagerI implements ValueFactoryManager return _factoryMap.get(id); } - private java.util.HashMap<String, ValueFactory> _factoryMap = new java.util.HashMap<String, ValueFactory>(); + private java.util.HashMap<String, ValueFactory> _factoryMap = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/Ice/ObjectReader.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueReader.java index 488986f98af..86849af7450 100644 --- a/java/src/Ice/src/main/java/Ice/ObjectReader.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueReader.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** - * Base class for extracting objects from an input stream. + * Base class for extracting a Slice class instance from an input stream. **/ -public abstract class ObjectReader extends ObjectImpl +public abstract class ValueReader extends Value { /** * Reads the state of this Slice class from an input stream. diff --git a/java/src/Ice/src/main/java/Ice/ObjectWriter.java b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueWriter.java index 91e474477a7..40e739a914f 100644 --- a/java/src/Ice/src/main/java/Ice/ObjectWriter.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/ValueWriter.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package Ice; +package com.zeroc.Ice; /** - * Base class for writing Slice classes to an output stream. + * Base class for writing a Slice class instance to an output stream. **/ -public abstract class ObjectWriter extends ObjectImpl +public abstract class ValueWriter extends Value { /** * Writes the state of this Slice class to an output stream. @@ -28,7 +28,7 @@ public abstract class ObjectWriter extends ObjectImpl } @Override - public void __read(Ice.InputStream is) + public void __read(InputStream is) { assert(false); } diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java new file mode 100644 index 00000000000..a322a6e86b6 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxFactoryMethods.java @@ -0,0 +1,144 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +/** + * Provides overloads of the proxy factory methods with covariant return types + * so that applications do not need to downcast to the derived proxy type. + **/ +@SuppressWarnings("unchecked") +public interface _ObjectPrxFactoryMethods<T extends ObjectPrx> extends ObjectPrx +{ + @Override + default T ice_context(java.util.Map<String, String> newContext) + { + return (T)ObjectPrx.super.ice_context(newContext); + } + + @Override + default T ice_adapterId(String newAdapterId) + { + return (T)ObjectPrx.super.ice_adapterId(newAdapterId); + } + + @Override + default T ice_endpoints(Endpoint[] newEndpoints) + { + return (T)ObjectPrx.super.ice_endpoints(newEndpoints); + } + + @Override + default T ice_locatorCacheTimeout(int newTimeout) + { + return (T)ObjectPrx.super.ice_locatorCacheTimeout(newTimeout); + } + + @Override + default T ice_invocationTimeout(int newTimeout) + { + return (T)ObjectPrx.super.ice_invocationTimeout(newTimeout); + } + + @Override + default T ice_connectionCached(boolean newCache) + { + return (T)ObjectPrx.super.ice_connectionCached(newCache); + } + + @Override + default T ice_endpointSelection(EndpointSelectionType newType) + { + return (T)ObjectPrx.super.ice_endpointSelection(newType); + } + + @Override + default T ice_secure(boolean b) + { + return (T)ObjectPrx.super.ice_secure(b); + } + + @Override + default T ice_encodingVersion(EncodingVersion e) + { + return (T)ObjectPrx.super.ice_encodingVersion(e); + } + + @Override + default T ice_preferSecure(boolean b) + { + return (T)ObjectPrx.super.ice_preferSecure(b); + } + + @Override + default T ice_router(RouterPrx router) + { + return (T)ObjectPrx.super.ice_router(router); + } + + @Override + default T ice_locator(LocatorPrx locator) + { + return (T)ObjectPrx.super.ice_locator(locator); + } + + @Override + default T ice_collocationOptimized(boolean b) + { + return (T)ObjectPrx.super.ice_collocationOptimized(b); + } + + @Override + default T ice_twoway() + { + return (T)ObjectPrx.super.ice_twoway(); + } + + @Override + default T ice_oneway() + { + return (T)ObjectPrx.super.ice_oneway(); + } + + @Override + default T ice_batchOneway() + { + return (T)ObjectPrx.super.ice_batchOneway(); + } + + @Override + default T ice_datagram() + { + return (T)ObjectPrx.super.ice_datagram(); + } + + @Override + default T ice_batchDatagram() + { + return (T)ObjectPrx.super.ice_batchDatagram(); + } + + @Override + default T ice_compress(boolean co) + { + return (T)ObjectPrx.super.ice_compress(co); + } + + @Override + default T ice_timeout(int t) + { + return (T)ObjectPrx.super.ice_timeout(t); + } + + @Override + default T ice_connectionId(String connectionId) + { + return (T)ObjectPrx.super.ice_connectionId(connectionId); + } +} diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java new file mode 100644 index 00000000000..10af97bb35a --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java @@ -0,0 +1,690 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.Ice; + +import java.util.LinkedList; +import java.util.List; + +import com.zeroc.IceInternal.OutgoingAsync; + +/** + * Concrete proxy implementation. + **/ +public class _ObjectPrxI implements ObjectPrx, java.io.Serializable +{ + public Communicator ice_getCommunicator() + { + return _reference.getCommunicator(); + } + + public boolean ice_isA(String id) + { + return ice_isA(id, ObjectPrx.noExplicitContext); + } + + public boolean ice_isA(String id, java.util.Map<String, String> __ctx) + { + return __ice_isAAsync(id, __ctx, true).__wait(); + } + + public java.util.concurrent.CompletableFuture<java.lang.Boolean> ice_isAAsync(String id) + { + return __ice_isAAsync(id, ObjectPrx.noExplicitContext, false); + } + + public java.util.concurrent.CompletableFuture<java.lang.Boolean> ice_isAAsync( + String id, + java.util.Map<String, String> __ctx) + { + return __ice_isAAsync(id, __ctx, false); + } + + private OutgoingAsync<java.lang.Boolean> __ice_isAAsync( + String id, + java.util.Map<String, String> __ctx, + boolean __sync) + { + OutgoingAsync<java.lang.Boolean> __f = + new OutgoingAsync<>(this, "ice_isA", OperationMode.Nonmutating, __sync, null); + __f.invoke(true, __ctx, null, __os -> { + __os.writeString(id); + }, __is -> { + boolean __ret; + __ret = __is.readBool(); + return __ret; + }); + return __f; + } + + public void ice_ping() + { + ice_ping(ObjectPrx.noExplicitContext); + } + + public void ice_ping(java.util.Map<String, String> __ctx) + { + __ice_pingAsync(__ctx, true).__wait(); + } + + public java.util.concurrent.CompletableFuture<Void> ice_pingAsync() + { + return __ice_pingAsync(ObjectPrx.noExplicitContext, false); + } + + public java.util.concurrent.CompletableFuture<Void> ice_pingAsync(java.util.Map<String, String> __ctx) + { + return __ice_pingAsync(__ctx, false); + } + + private OutgoingAsync<Void> __ice_pingAsync( + java.util.Map<String, String> __ctx, + boolean __sync) + { + OutgoingAsync<Void> __f = new OutgoingAsync<>(this, "ice_ping", OperationMode.Nonmutating, __sync, null); + __f.invoke(false, __ctx, null, null, null); + return __f; + } + + public String[] ice_ids() + { + return ice_ids(ObjectPrx.noExplicitContext); + } + + public String[] ice_ids(java.util.Map<String, String> __ctx) + { + return __ice_idsAsync(__ctx, true).__wait(); + } + + public java.util.concurrent.CompletableFuture<String[]> ice_idsAsync() + { + return __ice_idsAsync(ObjectPrx.noExplicitContext, false); + } + + public java.util.concurrent.CompletableFuture<String[]> ice_idsAsync(java.util.Map<String, String> __ctx) + { + return __ice_idsAsync(__ctx, false); + } + + private OutgoingAsync<String[]> __ice_idsAsync( + java.util.Map<String, String> __ctx, + boolean __sync) + { + OutgoingAsync<String[]> __f = + new OutgoingAsync<>(this, "ice_ids", OperationMode.Nonmutating, __sync, null); + __f.invoke(true, __ctx, null, null, __is -> { + String[] __ret; + __ret = StringSeqHelper.read(__is); + return __ret; + }); + return __f; + } + + public String ice_id() + { + return ice_id(ObjectPrx.noExplicitContext); + } + + public String ice_id(java.util.Map<String, String> __ctx) + { + return __ice_idAsync(__ctx, true).__wait(); + } + + public java.util.concurrent.CompletableFuture<java.lang.String> ice_idAsync() + { + return __ice_idAsync(ObjectPrx.noExplicitContext, false); + } + + public java.util.concurrent.CompletableFuture<java.lang.String> ice_idAsync(java.util.Map<String, String> __ctx) + { + return __ice_idAsync(__ctx, false); + } + + private OutgoingAsync<java.lang.String> __ice_idAsync( + java.util.Map<String, String> __ctx, + boolean __sync) + { + OutgoingAsync<java.lang.String> __f = + new OutgoingAsync<>(this, "ice_id", OperationMode.Nonmutating, __sync, null); + __f.invoke(true, __ctx, null, null, __is -> { + String __ret; + __ret = __is.readString(); + return __ret; + }); + return __f; + } + + public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams) + { + return ice_invoke(operation, mode, inParams, ObjectPrx.noExplicitContext); + } + + public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(String operation, OperationMode mode, byte[] inParams, + java.util.Map<String, String> __context) + { + return __ice_invokeAsync(operation, mode, inParams, __context, true).__wait(); + } + + public java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync( + String operation, + OperationMode mode, + byte[] inParams) + { + return ice_invokeAsync(operation, mode, inParams, ObjectPrx.noExplicitContext); + } + + public java.util.concurrent.CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync( + String operation, + OperationMode mode, + byte[] inParams, + java.util.Map<String, String> __context) + { + return __ice_invokeAsync(operation, mode, inParams, __context, false); + } + + private com.zeroc.IceInternal.ProxyIceInvoke __ice_invokeAsync( + String operation, + OperationMode mode, + byte[] inParams, + java.util.Map<String, String> __context, + boolean __sync) + { + com.zeroc.IceInternal.ProxyIceInvoke __f = + new com.zeroc.IceInternal.ProxyIceInvoke(this, operation, mode, __sync); + __f.invoke(inParams, __context); + return __f; + } + + public Identity ice_getIdentity() + { + return _reference.getIdentity().clone(); + } + + public ObjectPrx ice_identity(Identity newIdentity) + { + if(newIdentity.name == null || newIdentity.name.equals("")) + { + throw new IllegalIdentityException(); + } + if(newIdentity.equals(_reference.getIdentity())) + { + return this; + } + else + { + _ObjectPrxI proxy = new _ObjectPrxI(); + proxy.__setup(_reference.changeIdentity(newIdentity)); + return proxy; + } + } + + public java.util.Map<String, String> ice_getContext() + { + return new java.util.HashMap<>(_reference.getContext()); + } + + public String ice_getFacet() + { + return _reference.getFacet(); + } + + public ObjectPrx ice_facet(String newFacet) + { + if(newFacet == null) + { + newFacet = ""; + } + + if(newFacet.equals(_reference.getFacet())) + { + return this; + } + else + { + _ObjectPrxI proxy = new _ObjectPrxI(); + proxy.__setup(_reference.changeFacet(newFacet)); + return proxy; + } + } + + public String ice_getAdapterId() + { + return _reference.getAdapterId(); + } + + public Endpoint[] ice_getEndpoints() + { + return _reference.getEndpoints().clone(); + } + + public int ice_getLocatorCacheTimeout() + { + return _reference.getLocatorCacheTimeout(); + } + + public int ice_getInvocationTimeout() + { + return _reference.getInvocationTimeout(); + } + + public String ice_getConnectionId() + { + return _reference.getConnectionId(); + } + + public boolean ice_isConnectionCached() + { + return _reference.getCacheConnection(); + } + + public EndpointSelectionType ice_getEndpointSelection() + { + return _reference.getEndpointSelection(); + } + + public boolean ice_isSecure() + { + return _reference.getSecure(); + } + + public EncodingVersion ice_getEncodingVersion() + { + return _reference.getEncoding().clone(); + } + + public boolean ice_isPreferSecure() + { + return _reference.getPreferSecure(); + } + + public RouterPrx ice_getRouter() + { + com.zeroc.IceInternal.RouterInfo ri = _reference.getRouterInfo(); + return ri != null ? ri.getRouter() : null; + } + + public LocatorPrx ice_getLocator() + { + com.zeroc.IceInternal.LocatorInfo ri = _reference.getLocatorInfo(); + return ri != null ? ri.getLocator() : null; + } + + public boolean ice_isCollocationOptimized() + { + return _reference.getCollocationOptimized(); + } + + public boolean ice_isTwoway() + { + return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeTwoway; + } + + public boolean ice_isOneway() + { + return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeOneway; + } + + public boolean ice_isBatchOneway() + { + return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeBatchOneway; + } + + public boolean ice_isDatagram() + { + return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeDatagram; + } + + public boolean ice_isBatchDatagram() + { + return _reference.getMode() == com.zeroc.IceInternal.Reference.ModeBatchDatagram; + } + + public Connection ice_getConnection() + { + return __ice_getConnectionAsync().__wait(); + } + + public java.util.concurrent.CompletableFuture<Connection> ice_getConnectionAsync() + { + return __ice_getConnectionAsync(); + } + + private com.zeroc.IceInternal.ProxyGetConnection __ice_getConnectionAsync() + { + com.zeroc.IceInternal.ProxyGetConnection r = new com.zeroc.IceInternal.ProxyGetConnection(this); + r.invoke(); + return r; + } + + public Connection ice_getCachedConnection() + { + com.zeroc.IceInternal.RequestHandler handler = null; + synchronized(this) + { + handler = _requestHandler; + } + + if(handler != null) + { + try + { + return handler.getConnection(); + } + catch(LocalException ex) + { + } + } + return null; + } + + public void ice_flushBatchRequests() + { + __ice_flushBatchRequestsAsync().__wait(); + } + + public java.util.concurrent.CompletableFuture<Void> ice_flushBatchRequestsAsync() + { + return __ice_flushBatchRequestsAsync(); + } + + private com.zeroc.IceInternal.ProxyFlushBatch __ice_flushBatchRequestsAsync() + { + com.zeroc.IceInternal.ProxyFlushBatch __f = new com.zeroc.IceInternal.ProxyFlushBatch(this); + try + { + __f.invoke(); + } + catch(Exception ex) + { + __f.abort(ex); + } + return __f; + } + + @Override + public boolean equals(java.lang.Object r) + { + if(this == r) + { + return true; + } + + if(r instanceof _ObjectPrxI) + { + return _reference.equals(((_ObjectPrxI)r)._reference); + } + + return false; + } + + @Override + public final int hashCode() + { + return _reference.hashCode(); + } + + @Override + public final String toString() + { + return _reference.toString(); + } + + @Override + public void __write(OutputStream os) + { + _reference.getIdentity().ice_write(os); + _reference.streamWrite(os); + } + + @Override + public void __copyFrom(ObjectPrx p) + { + synchronized(p) + { + _ObjectPrxI h = (_ObjectPrxI)p; + _reference = h._reference; + _requestHandler = h._requestHandler; + } + } + + @Override + public com.zeroc.IceInternal.Reference __reference() + { + return _reference; + } + + @Override + public ObjectPrx __newInstance(com.zeroc.IceInternal.Reference ref) + { + try + { + _ObjectPrxI proxy = getClass().newInstance(); + proxy.__setup(ref); + return proxy; + } + catch(InstantiationException e) + { + // + // Impossible + // + assert false; + return null; + } + catch(IllegalAccessException e) + { + // + // Impossible + // + assert false; + return null; + } + } + + public StreamPair __getCachedMessageBuffers() + { + synchronized(this) + { + if(_streamCache != null && !_streamCache.isEmpty()) + { + return _streamCache.remove(0); + } + } + return null; + } + + public void __cacheMessageBuffers(InputStream is, OutputStream os) + { + synchronized(this) + { + if(_streamCache == null) + { + _streamCache = new LinkedList<>(); + } + _streamCache.add(new StreamPair(is, os)); + } + } + + public int __handleException(Exception ex, com.zeroc.IceInternal.RequestHandler handler, OperationMode mode, + boolean sent, com.zeroc.IceInternal.Holder<Integer> interval, int cnt) + { + __updateRequestHandler(handler, null); // Clear the request handler + + // + // We only retry local exception, system exceptions aren't retried. + // + // A CloseConnectionException indicates graceful server shutdown, and is therefore + // always repeatable without violating "at-most-once". That's because by sending a + // close connection message, the server guarantees that all outstanding requests + // can safely be repeated. + // + // An ObjectNotExistException can always be retried as well without violating + // "at-most-once" (see the implementation of the checkRetryAfterException method + // of the ProxyFactory class for the reasons why it can be useful). + // + // If the request didn't get sent or if it's non-mutating or idempotent it can + // also always be retried if the retry count isn't reached. + // + if(ex instanceof LocalException && (!sent || + mode == OperationMode.Nonmutating || mode == OperationMode.Idempotent || + ex instanceof CloseConnectionException || + ex instanceof ObjectNotExistException)) + { + try + { + return _reference.getInstance().proxyFactory().checkRetryAfterException((LocalException)ex, + _reference, + interval, + cnt); + } + catch(CommunicatorDestroyedException exc) + { + // + // The communicator is already destroyed, so we cannot retry. + // + throw ex; + } + } + else + { + throw ex; // Retry could break at-most-once semantics, don't retry. + } + } + + public com.zeroc.IceInternal.RequestHandler __getRequestHandler() + { + if(_reference.getCacheConnection()) + { + synchronized(this) + { + if(_requestHandler != null) + { + return _requestHandler; + } + } + } + return _reference.getRequestHandler(this); + } + + synchronized public com.zeroc.IceInternal.BatchRequestQueue __getBatchRequestQueue() + { + if(_batchRequestQueue == null) + { + _batchRequestQueue = _reference.getBatchRequestQueue(); + } + return _batchRequestQueue; + } + + public com.zeroc.IceInternal.RequestHandler __setRequestHandler(com.zeroc.IceInternal.RequestHandler handler) + { + if(_reference.getCacheConnection()) + { + synchronized(this) + { + if(_requestHandler == null) + { + _requestHandler = handler; + } + return _requestHandler; + } + } + return handler; + } + + public void __updateRequestHandler(com.zeroc.IceInternal.RequestHandler previous, + com.zeroc.IceInternal.RequestHandler handler) + { + if(_reference.getCacheConnection() && previous != null) + { + synchronized(this) + { + if(_requestHandler != null && _requestHandler != handler) + { + // + // Update the request handler only if "previous" is the same + // as the current request handler. This is called after + // connection binding by the connect request handler. We only + // replace the request handler if the current handler is the + // connect request handler. + // + _requestHandler = _requestHandler.update(previous, handler); + } + } + } + } + + // + // Only for use by ProxyFactory + // + public void __setup(com.zeroc.IceInternal.Reference ref) + { + // + // No need to synchronize, as this operation is only called + // upon initial initialization. + // + + assert(_reference == null); + assert(_requestHandler == null); + + _reference = ref; + } + + private void writeObject(java.io.ObjectOutputStream out) + throws java.io.IOException + { + out.writeUTF(toString()); + } + + private void readObject(java.io.ObjectInputStream in) + throws java.io.IOException, ClassNotFoundException + { + String s = in.readUTF(); + try + { + Communicator communicator = ((com.zeroc.Ice.ObjectInputStream)in).getCommunicator(); + if(communicator == null) + { + throw new java.io.IOException("Cannot deserialize proxy: no communicator provided"); + } + _ObjectPrxI proxy = (_ObjectPrxI)communicator.stringToProxy(s); + _reference = proxy._reference; + assert(proxy._requestHandler == null); + } + catch(ClassCastException ex) + { + java.io.IOException e = + new java.io.IOException("Cannot deserialize proxy: com.zeroc.Ice.ObjectInputStream not found"); + e.initCause(ex); + throw e; + } + catch(LocalException ex) + { + java.io.IOException e = new java.io.IOException("Failure occurred while deserializing proxy"); + e.initCause(ex); + throw e; + } + } + + public static class StreamPair + { + StreamPair(InputStream is, OutputStream os) + { + this.is = is; + this.os = os; + } + + public InputStream is; + public OutputStream os; + } + + protected transient com.zeroc.IceInternal.Reference _reference; + private transient com.zeroc.IceInternal.RequestHandler _requestHandler; + private transient com.zeroc.IceInternal.BatchRequestQueue _batchRequestQueue; + private transient List<StreamPair> _streamCache; + public static final long serialVersionUID = 0L; +} diff --git a/java/src/Ice/src/main/java/IceInternal/ACMConfig.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMConfig.java index 291e9d1c59f..dc321cbe82d 100644 --- a/java/src/Ice/src/main/java/IceInternal/ACMConfig.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMConfig.java @@ -7,18 +7,21 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.ACMClose; +import com.zeroc.Ice.ACMHeartbeat; public final class ACMConfig implements java.lang.Cloneable { ACMConfig(boolean server) { timeout = 60 * 1000; - heartbeat = Ice.ACMHeartbeat.HeartbeatOnInvocation; - close = server ? Ice.ACMClose.CloseOnInvocation : Ice.ACMClose.CloseOnInvocationAndIdle; + heartbeat = ACMHeartbeat.HeartbeatOnInvocation; + close = server ? ACMClose.CloseOnInvocation : ACMClose.CloseOnInvocationAndIdle; } - public ACMConfig(Ice.Properties p, Ice.Logger l, String prefix, ACMConfig dflt) + public ACMConfig(com.zeroc.Ice.Properties p, com.zeroc.Ice.Logger l, String prefix, ACMConfig dflt) { assert(prefix != null); @@ -36,7 +39,7 @@ public final class ACMConfig implements java.lang.Cloneable timeout = p.getPropertyAsIntWithDefault(timeoutProperty, dflt.timeout / 1000) * 1000; // To milliseconds int hb = p.getPropertyAsIntWithDefault(prefix + ".Heartbeat", dflt.heartbeat.ordinal()); - Ice.ACMHeartbeat[] heartbeatValues = Ice.ACMHeartbeat.values(); + ACMHeartbeat[] heartbeatValues = ACMHeartbeat.values(); if(hb >= 0 && hb < heartbeatValues.length) { heartbeat = heartbeatValues[hb]; @@ -47,7 +50,7 @@ public final class ACMConfig implements java.lang.Cloneable heartbeat = dflt.heartbeat; } - Ice.ACMClose[] closeValues = Ice.ACMClose.values(); + ACMClose[] closeValues = ACMClose.values(); int cl = p.getPropertyAsIntWithDefault(prefix + ".Close", dflt.close.ordinal()); if(cl >= 0 && cl < closeValues.length) { @@ -77,6 +80,6 @@ public final class ACMConfig implements java.lang.Cloneable } public int timeout; - public Ice.ACMHeartbeat heartbeat; - public Ice.ACMClose close; + public ACMHeartbeat heartbeat; + public ACMClose close; } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java new file mode 100644 index 00000000000..d60dcdad7f1 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ACMMonitor.java @@ -0,0 +1,21 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +public interface ACMMonitor +{ + void add(com.zeroc.Ice.ConnectionI con); + void remove(com.zeroc.Ice.ConnectionI con); + void reap(com.zeroc.Ice.ConnectionI con); + + ACMMonitor acm(java.util.OptionalInt timeout, java.util.Optional<com.zeroc.Ice.ACMClose> close, + java.util.Optional<com.zeroc.Ice.ACMHeartbeat> heartbeat); + com.zeroc.Ice.ACM getACM(); +} diff --git a/java/src/Ice/src/main/java/IceInternal/Acceptor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Acceptor.java index 628e147620a..8c12faf2072 100644 --- a/java/src/Ice/src/main/java/IceInternal/Acceptor.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Acceptor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface Acceptor { diff --git a/java/src/Ice/src/main/java/IceInternal/AsyncStatus.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/AsyncStatus.java index 19fa9f28cb0..adb6e2c6a55 100644 --- a/java/src/Ice/src/main/java/IceInternal/AsyncStatus.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/AsyncStatus.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class AsyncStatus { diff --git a/java/src/Ice/src/main/java/IceInternal/BZip2.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java index a29b7c30c32..495d1ed1da3 100644 --- a/java/src/Ice/src/main/java/IceInternal/BZip2.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class BZip2 { @@ -62,7 +62,7 @@ public class BZip2 } catch(Exception ex) { - throw new Ice.CompressionException("bzip2 compression failure", ex); + throw new com.zeroc.Ice.CompressionException("bzip2 compression failure", ex); } // @@ -104,11 +104,11 @@ public class BZip2 int uncompressedSize = buf.b.getInt(); if(uncompressedSize <= headerSize) { - throw new Ice.IllegalMessageSizeException(); + throw new com.zeroc.Ice.IllegalMessageSizeException(); } if(uncompressedSize > messageSizeMax) { - IceInternal.Ex.throwMemoryLimitException(uncompressedSize, messageSizeMax); + Ex.throwMemoryLimitException(uncompressedSize, messageSizeMax); } int compressedLen = buf.size() - headerSize - 4; @@ -155,7 +155,7 @@ public class BZip2 byte magicZ = (byte)bais.read(); if(magicB != (byte)'B' || magicZ != (byte)'Z') { - Ice.CompressionException e = new Ice.CompressionException(); + com.zeroc.Ice.CompressionException e = new com.zeroc.Ice.CompressionException(); e.reason = "bzip2 uncompression failure: invalid magic bytes"; throw e; } @@ -172,7 +172,7 @@ public class BZip2 } catch(Exception ex) { - throw new Ice.CompressionException("bzip2 uncompression failure", ex); + throw new com.zeroc.Ice.CompressionException("bzip2 uncompression failure", ex); } // @@ -200,13 +200,13 @@ public class BZip2 { Class<?> cls; Class<?>[] types = new Class<?>[1]; - cls = IceInternal.Util.findClass("org.apache.tools.bzip2.CBZip2InputStream", null); + cls = Util.findClass("org.apache.tools.bzip2.CBZip2InputStream", null); if(cls != null) { types[0] = java.io.InputStream.class; _bzInputStreamCtor = cls.getDeclaredConstructor(types); } - cls = IceInternal.Util.findClass("org.apache.tools.bzip2.CBZip2OutputStream", null); + cls = Util.findClass("org.apache.tools.bzip2.CBZip2OutputStream", null); if(cls != null) { types = new Class[2]; diff --git a/java/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BatchRequestQueue.java index 3db2ac67177..3bb4d920c16 100644 --- a/java/src/Ice/src/main/java/IceInternal/BatchRequestQueue.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BatchRequestQueue.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class BatchRequestQueue { - class BatchRequestI implements Ice.BatchRequest + class BatchRequestI implements com.zeroc.Ice.BatchRequest { - public void reset(Ice.ObjectPrx proxy, String operation, int size) + public void reset(com.zeroc.Ice.ObjectPrx proxy, String operation, int size) { _proxy = proxy; _operation = operation; @@ -27,7 +27,7 @@ public class BatchRequestQueue } @Override - public Ice.ObjectPrx getProxy() + public com.zeroc.Ice.ObjectPrx getProxy() { return _proxy; } @@ -44,7 +44,7 @@ public class BatchRequestQueue return _size; } - private Ice.ObjectPrx _proxy; + private com.zeroc.Ice.ObjectPrx _proxy; private String _operation; private int _size; } @@ -52,11 +52,11 @@ public class BatchRequestQueue public BatchRequestQueue(Instance instance, boolean datagram) { - Ice.InitializationData initData = instance.initializationData(); + com.zeroc.Ice.InitializationData initData = instance.initializationData(); _interceptor = initData.batchRequestInterceptor; _batchStreamInUse = false; _batchRequestNum = 0; - _batchStream = new Ice.OutputStream(instance, Protocol.currentProtocolEncoding); + _batchStream = new com.zeroc.Ice.OutputStream(instance, Protocol.currentProtocolEncoding); _batchStream.writeBlob(Protocol.requestBatchHdr); _batchMarker = _batchStream.size(); _request = new BatchRequestI(); @@ -73,11 +73,11 @@ public class BatchRequestQueue } synchronized public void - prepareBatchRequest(Ice.OutputStream os) + prepareBatchRequest(com.zeroc.Ice.OutputStream os) { if(_exception != null) { - throw (Ice.LocalException)_exception.fillInStackTrace(); + throw (com.zeroc.Ice.LocalException)_exception.fillInStackTrace(); } waitStreamInUse(false); @@ -86,7 +86,7 @@ public class BatchRequestQueue } public void - finishBatchRequest(Ice.OutputStream os, Ice.ObjectPrx proxy, String operation) + finishBatchRequest(com.zeroc.Ice.OutputStream os, com.zeroc.Ice.ObjectPrx proxy, String operation) { // // No need for synchronization, no other threads are supposed @@ -101,7 +101,7 @@ public class BatchRequestQueue if(_maxSize > 0 && _batchStream.size() >= _maxSize) { - proxy.begin_ice_flushBatchRequests(); // Auto flush + proxy.ice_flushBatchRequestsAsync(); // Auto flush } assert(_batchMarker < _batchStream.size()); @@ -129,7 +129,7 @@ public class BatchRequestQueue } synchronized public void - abortBatchRequest(Ice.OutputStream os) + abortBatchRequest(com.zeroc.Ice.OutputStream os) { if(_batchStreamInUse) { @@ -141,7 +141,7 @@ public class BatchRequestQueue } synchronized public int - swap(Ice.OutputStream os) + swap(com.zeroc.Ice.OutputStream os) { if(_batchRequestNum == 0) { @@ -177,7 +177,7 @@ public class BatchRequestQueue } synchronized public void - destroy(Ice.LocalException ex) + destroy(com.zeroc.Ice.LocalException ex) { _exception = ex; } @@ -225,14 +225,14 @@ public class BatchRequestQueue ++_batchRequestNum; } - private Ice.BatchRequestInterceptor _interceptor; - private Ice.OutputStream _batchStream; + private com.zeroc.Ice.BatchRequestInterceptor _interceptor; + private com.zeroc.Ice.OutputStream _batchStream; private boolean _batchStreamInUse; private boolean _batchStreamCanFlush; private int _batchRequestNum; private int _batchMarker; private BatchRequestI _request; - private Ice.LocalException _exception; + private com.zeroc.Ice.LocalException _exception; private int _maxSize; final private static int _udpOverhead = 20 + 8; diff --git a/java/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BufSizeWarnInfo.java index 67e84387319..e3cbf387cf2 100644 --- a/java/src/Ice/src/main/java/IceInternal/BufSizeWarnInfo.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BufSizeWarnInfo.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class BufSizeWarnInfo { diff --git a/java/src/Ice/src/main/java/IceInternal/Buffer.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Buffer.java index 911d8df76d4..81baab46d88 100644 --- a/java/src/Ice/src/main/java/IceInternal/Buffer.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Buffer.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; // // An instance of java.nio.ByteBuffer cannot grow beyond its initial capacity. diff --git a/java/src/Ice/src/main/java/IceInternal/CancellationHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CancellationHandler.java index 3085b41e3d0..ba958f0253d 100644 --- a/java/src/Ice/src/main/java/IceInternal/CancellationHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CancellationHandler.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface CancellationHandler { - void asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex); + void asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex); } diff --git a/java/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedObserverI.java index a29cc2ad237..995ad3685c4 100644 --- a/java/src/Ice/src/main/java/IceInternal/CollocatedObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedObserverI.java @@ -7,21 +7,21 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class CollocatedObserverI - extends IceMX.ObserverWithDelegate<IceMX.CollocatedMetrics, Ice.Instrumentation.CollocatedObserver> - implements Ice.Instrumentation.CollocatedObserver + extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.CollocatedMetrics, + com.zeroc.Ice.Instrumentation.CollocatedObserver> + implements com.zeroc.Ice.Instrumentation.CollocatedObserver { @Override public void reply(final int size) { - forEach(new MetricsUpdate<IceMX.CollocatedMetrics>() + forEach(new MetricsUpdate<com.zeroc.IceMX.CollocatedMetrics>() { @Override - public void - update(IceMX.CollocatedMetrics v) + public void update(com.zeroc.IceMX.CollocatedMetrics v) { v.replySize += size; } diff --git a/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedRequestHandler.java index ad823f21319..54dd044788c 100644 --- a/java/src/Ice/src/main/java/IceInternal/CollocatedRequestHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CollocatedRequestHandler.java @@ -7,13 +7,14 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class CollocatedRequestHandler implements RequestHandler, ResponseHandler { private class InvokeAllAsync extends DispatchWorkItem { - private InvokeAllAsync(OutgoingAsyncBase outAsync, Ice.OutputStream os, int requestId, int batchRequestNum) + private InvokeAllAsync(OutgoingAsyncBase outAsync, com.zeroc.Ice.OutputStream os, int requestId, + int batchRequestNum) { _outAsync = outAsync; _os = os; @@ -31,17 +32,17 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler } private final OutgoingAsyncBase _outAsync; - private Ice.OutputStream _os; + private com.zeroc.Ice.OutputStream _os; private final int _requestId; private final int _batchRequestNum; } public - CollocatedRequestHandler(Reference ref, Ice.ObjectAdapter adapter) + CollocatedRequestHandler(Reference ref, com.zeroc.Ice.ObjectAdapter adapter) { _reference = ref; _dispatcher = ref.getInstance().initializationData().dispatcher != null; - _adapter = (Ice.ObjectAdapterI)adapter; + _adapter = (com.zeroc.Ice.ObjectAdapterI)adapter; _response = _reference.getMode() == Reference.ModeTwoway; _logger = _reference.getInstance().initializationData().logger; // Cached for better performance. @@ -65,7 +66,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler @Override synchronized public void - asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex) + asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex) { Integer requestId = _sendAsyncRequests.remove(outAsync); if(requestId != null) @@ -103,7 +104,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler @Override public void - sendResponse(int requestId, final Ice.OutputStream os, byte status, boolean amd) + sendResponse(int requestId, final com.zeroc.Ice.OutputStream os, byte status, boolean amd) { OutgoingAsyncBase outAsync = null; synchronized(this) @@ -116,7 +117,8 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler } // Adopt the OutputStream's buffer. - Ice.InputStream is = new Ice.InputStream(os.instance(), os.getEncoding(), os.getBuffer(), true); + com.zeroc.Ice.InputStream is = + new com.zeroc.Ice.InputStream(os.instance(), os.getEncoding(), os.getBuffer(), true); is.pos(Protocol.replyHdr.length + 4); @@ -160,7 +162,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler @Override public boolean - systemException(int requestId, Ice.SystemException ex, boolean amd) + systemException(int requestId, com.zeroc.Ice.SystemException ex, boolean amd) { handleException(requestId, ex, amd); _adapter.decDirectCount(); @@ -169,7 +171,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler @Override public void - invokeException(int requestId, Ice.LocalException ex, int batchRequestNum, boolean amd) + invokeException(int requestId, com.zeroc.Ice.LocalException ex, int batchRequestNum, boolean amd) { handleException(requestId, ex, amd); _adapter.decDirectCount(); @@ -183,7 +185,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler } @Override - public Ice.ConnectionI + public com.zeroc.Ice.ConnectionI getConnection() { return null; @@ -271,7 +273,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler } private void - invokeAll(Ice.OutputStream os, int requestId, int batchRequestNum) + invokeAll(com.zeroc.Ice.OutputStream os, int requestId, int batchRequestNum) { if(_traceLevels.protocol >= 1) { @@ -287,7 +289,8 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler TraceUtil.traceSend(os, _logger, _traceLevels); } - Ice.InputStream is = new Ice.InputStream(os.instance(), os.getEncoding(), os.getBuffer(), false); + com.zeroc.Ice.InputStream is = + new com.zeroc.Ice.InputStream(os.instance(), os.getEncoding(), os.getBuffer(), false); if(batchRequestNum > 0) { @@ -314,7 +317,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler { _adapter.incDirectCount(); } - catch(Ice.ObjectAdapterDeactivatedException ex) + catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex) { handleException(requestId, ex, false); break; @@ -326,7 +329,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler --invokeNum; } } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { invokeException(requestId, ex, invokeNum, false); // Fatal invocation exception } @@ -354,7 +357,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler // // Note that this does NOT send a response to the client. // - Ice.UnknownException uex = new Ice.UnknownException(ex); + com.zeroc.Ice.UnknownException uex = new com.zeroc.Ice.UnknownException(ex); java.io.StringWriter sw = new java.io.StringWriter(); java.io.PrintWriter pw = new java.io.PrintWriter(sw); ex.printStackTrace(pw); @@ -375,7 +378,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler } private void - handleException(int requestId, Ice.Exception ex, boolean amd) + handleException(int requestId, com.zeroc.Ice.Exception ex, boolean amd) { if(requestId == 0) { @@ -411,7 +414,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler } private void - fillInValue(Ice.OutputStream os, int pos, int value) + fillInValue(com.zeroc.Ice.OutputStream os, int pos, int value) { os.rewriteInt(value, pos); } @@ -419,8 +422,8 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler private final Reference _reference; private final boolean _dispatcher; private final boolean _response; - private final Ice.ObjectAdapterI _adapter; - private final Ice.Logger _logger; + private final com.zeroc.Ice.ObjectAdapterI _adapter; + private final com.zeroc.Ice.Logger _logger; private final TraceLevels _traceLevels; private int _requestId; @@ -428,9 +431,7 @@ public class CollocatedRequestHandler implements RequestHandler, ResponseHandler // A map of outstanding requests that can be canceled. A request // can be canceled if it has an invocation timeout, or we support // interrupts. - private java.util.Map<OutgoingAsyncBase, Integer> _sendAsyncRequests = - new java.util.HashMap<OutgoingAsyncBase, Integer>(); + private java.util.Map<OutgoingAsyncBase, Integer> _sendAsyncRequests = new java.util.HashMap<>(); - private java.util.Map<Integer, OutgoingAsyncBase> _asyncRequests = - new java.util.HashMap<Integer, OutgoingAsyncBase>(); + private java.util.Map<Integer, OutgoingAsyncBase> _asyncRequests = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorFlushBatch.java index 309c9dd6a55..772c1a463ab 100644 --- a/java/src/Ice/src/main/java/IceInternal/CommunicatorFlushBatch.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorFlushBatch.java @@ -7,33 +7,17 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.concurrent.Callable; -public class CommunicatorFlushBatch extends IceInternal.AsyncResultI +public class CommunicatorFlushBatch extends InvocationFutureI<Void> { - public static CommunicatorFlushBatch check(Ice.AsyncResult r, Ice.Communicator com, String operation) + public CommunicatorFlushBatch(com.zeroc.Ice.Communicator communicator, Instance instance) { - check(r, operation); - if(!(r instanceof CommunicatorFlushBatch)) - { - throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method"); - } - if(r.getCommunicator() != com) - { - throw new IllegalArgumentException("Communicator for call to end_" + operation + - " does not match communicator that was used to call corresponding " + - "begin_" + operation + " method"); - } - return (CommunicatorFlushBatch)r; - } + super(communicator, instance, "flushBatchRequests"); - public CommunicatorFlushBatch(Ice.Communicator communicator, Instance instance, String op, CallbackBase callback) - { - super(communicator, instance, op, callback); - - _observer = ObserverHelper.get(instance, op); + _observer = ObserverHelper.get(instance, "flushBatchRequests"); // // _useCount is initialized to 1 to prevent premature callbacks. @@ -43,16 +27,42 @@ public class CommunicatorFlushBatch extends IceInternal.AsyncResultI _useCount = 1; } - public void flushConnection(final Ice.ConnectionI con) + @Override + protected void __sent() + { + super.__sent(); + + assert((_state & StateOK) != 0); + complete(null); + } + + public void flushConnection(final com.zeroc.Ice.ConnectionI con) { - class FlushBatch extends OutgoingAsyncBase + class FlushBatch extends OutgoingAsyncBase<Void> { public FlushBatch() { super(CommunicatorFlushBatch.this.getCommunicator(), CommunicatorFlushBatch.this._instance, - CommunicatorFlushBatch.this.getOperation(), - null); + CommunicatorFlushBatch.this.getOperation()); + } + + @Override + protected void __sent() + { + assert(false); + } + + @Override + protected boolean __needCallback() + { + return false; + } + + @Override + protected void __completed() + { + assert(false); } @Override @@ -69,7 +79,7 @@ public class CommunicatorFlushBatch extends IceInternal.AsyncResultI // TODO: MJN: This is missing a test. @Override - public boolean completed(Ice.Exception ex) + public boolean completed(com.zeroc.Ice.Exception ex) { if(_childObserver != null) { @@ -82,7 +92,7 @@ public class CommunicatorFlushBatch extends IceInternal.AsyncResultI } @Override - protected Ice.Instrumentation.InvocationObserver getObserver() + protected com.zeroc.Ice.Instrumentation.InvocationObserver getObserver() { return CommunicatorFlushBatch.this._observer; } @@ -123,7 +133,7 @@ public class CommunicatorFlushBatch extends IceInternal.AsyncResultI doCheck(false); throw ex.get(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { doCheck(false); throw ex; @@ -135,6 +145,38 @@ public class CommunicatorFlushBatch extends IceInternal.AsyncResultI doCheck(true); } + public void __wait() + { + if(Thread.currentThread().interrupted()) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + + try + { + get(); + } + catch(InterruptedException ex) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + catch(java.util.concurrent.ExecutionException ee) + { + try + { + throw ee.getCause(); + } + catch(RuntimeException ex) // Includes LocalException + { + throw ex; + } + catch(Throwable ex) + { + throw new com.zeroc.Ice.UnknownException(ex); + } + } + } + private void doCheck(boolean userThread) { synchronized(this) diff --git a/java/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java index 095948736e3..d16ba494470 100644 --- a/java/src/Ice/src/main/java/IceInternal/CommunicatorObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/CommunicatorObserverI.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -import IceMX.*; +import com.zeroc.IceMX.*; -public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorObserver +public class CommunicatorObserverI implements com.zeroc.Ice.Instrumentation.CommunicatorObserver { static void addEndpointAttributes(MetricsHelper.AttributeResolver r, Class<?> cl) @@ -19,14 +19,14 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb { r.add("endpoint", cl.getDeclaredMethod("getEndpoint")); - Class<?> cli = Ice.EndpointInfo.class; + Class<?> cli = com.zeroc.Ice.EndpointInfo.class; r.add("endpointType", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("type")); r.add("endpointIsDatagram", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("datagram")); r.add("endpointIsSecure", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredMethod("secure")); r.add("endpointTimeout", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("timeout")); r.add("endpointCompress", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("compress")); - cli = Ice.IPEndpointInfo.class; + cli = com.zeroc.Ice.IPEndpointInfo.class; r.add("endpointHost", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("host")); r.add("endpointPort", cl.getDeclaredMethod("getEndpointInfo"), cli.getDeclaredField("port")); } @@ -35,18 +35,18 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb addConnectionAttributes(MetricsHelper.AttributeResolver r, Class<?> cl) throws Exception { - Class<?> cli = Ice.ConnectionInfo.class; + Class<?> cli = com.zeroc.Ice.ConnectionInfo.class; r.add("incoming", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("incoming")); r.add("adapterName", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("adapterName")); r.add("connectionId", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("connectionId")); - cli = Ice.IPConnectionInfo.class; + cli = com.zeroc.Ice.IPConnectionInfo.class; r.add("localHost", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("localAddress")); r.add("localPort", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("localPort")); r.add("remoteHost", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("remoteAddress")); r.add("remotePort", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("remotePort")); - cli = Ice.UDPConnectionInfo.class; + cli = com.zeroc.Ice.UDPConnectionInfo.class; r.add("mcastHost", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("mcastAddress")); r.add("mcastPort", cl.getDeclaredMethod("getConnectionInfo"), cli.getDeclaredField("mcastPort")); @@ -73,7 +73,8 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } }; - ConnectionHelper(Ice.ConnectionInfo con, Ice.Endpoint endpt, Ice.Instrumentation.ConnectionState state) + ConnectionHelper(com.zeroc.Ice.ConnectionInfo con, com.zeroc.Ice.Endpoint endpt, + com.zeroc.Ice.Instrumentation.ConnectionState state) { super(_attributes); _connectionInfo = con; @@ -87,7 +88,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb if(_id == null) { StringBuilder os = new StringBuilder(); - Ice.IPConnectionInfo info = getIPConnectionInfo(); + com.zeroc.Ice.IPConnectionInfo info = getIPConnectionInfo(); if(info != null) { os.append(info.localAddress).append(':').append(info.localPort); @@ -141,19 +142,19 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } } - public Ice.ConnectionInfo + public com.zeroc.Ice.ConnectionInfo getConnectionInfo() { return _connectionInfo; } - public Ice.Endpoint + public com.zeroc.Ice.Endpoint getEndpoint() { return _endpoint; } - public Ice.EndpointInfo + public com.zeroc.Ice.EndpointInfo getEndpointInfo() { if(_endpointInfo == null) @@ -163,24 +164,24 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return _endpointInfo; } - private Ice.IPConnectionInfo + private com.zeroc.Ice.IPConnectionInfo getIPConnectionInfo() { - for(Ice.ConnectionInfo p = _connectionInfo; p != null; p = p.underlying) + for(com.zeroc.Ice.ConnectionInfo p = _connectionInfo; p != null; p = p.underlying) { - if(p instanceof Ice.IPConnectionInfo) + if(p instanceof com.zeroc.Ice.IPConnectionInfo) { - return (Ice.IPConnectionInfo)p; + return (com.zeroc.Ice.IPConnectionInfo)p; } } return null; } - private final Ice.ConnectionInfo _connectionInfo; - private final Ice.Endpoint _endpoint; - private final Ice.Instrumentation.ConnectionState _state; + private final com.zeroc.Ice.ConnectionInfo _connectionInfo; + private final com.zeroc.Ice.Endpoint _endpoint; + private final com.zeroc.Ice.Instrumentation.ConnectionState _state; private String _id; - private Ice.EndpointInfo _endpointInfo; + private com.zeroc.Ice.EndpointInfo _endpointInfo; } static public final class DispatchHelper extends MetricsHelper<DispatchMetrics> @@ -196,7 +197,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb addConnectionAttributes(this, cl); - Class<?> clc = Ice.Current.class; + Class<?> clc = com.zeroc.Ice.Current.class; add("operation", cl.getDeclaredMethod("getCurrent"), clc.getDeclaredField("operation")); add("identity", cl.getDeclaredMethod("getIdentity")); add("facet", cl.getDeclaredMethod("getCurrent"), clc.getDeclaredField("facet")); @@ -211,7 +212,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } }; - DispatchHelper(Ice.Current current, int size) + DispatchHelper(com.zeroc.Ice.Current current, int size) { super(_attributes); _current = current; @@ -274,7 +275,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return _current.adapter.getName(); } - public Ice.ConnectionInfo + public com.zeroc.Ice.ConnectionInfo getConnectionInfo() { if(_current.con != null) @@ -284,7 +285,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return null; } - public Ice.Endpoint + public com.zeroc.Ice.Endpoint getEndpoint() { if(_current.con != null) @@ -294,13 +295,13 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return null; } - public Ice.Connection + public com.zeroc.Ice.Connection getConnection() { return _current.con; } - public Ice.EndpointInfo + public com.zeroc.Ice.EndpointInfo getEndpointInfo() { if(_current.con != null && _endpointInfo == null) @@ -310,7 +311,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return _endpointInfo; } - public Ice.Current + public com.zeroc.Ice.Current getCurrent() { return _current; @@ -319,13 +320,13 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb public String getIdentity() { - return Ice.Util.identityToString(_current.id); + return com.zeroc.Ice.Util.identityToString(_current.id); } - final private Ice.Current _current; + final private com.zeroc.Ice.Current _current; final private int _size; private String _id; - private Ice.EndpointInfo _endpointInfo; + private com.zeroc.Ice.EndpointInfo _endpointInfo; } static public final class InvocationHelper extends MetricsHelper<InvocationMetrics> @@ -342,7 +343,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb add("operation", cl.getDeclaredMethod("getOperation")); add("identity", cl.getDeclaredMethod("getIdentity")); - Class<?> cli = Ice.ObjectPrx.class; + Class<?> cli = com.zeroc.Ice.ObjectPrx.class; add("facet", cl.getDeclaredMethod("getProxy"), cli.getDeclaredMethod("ice_getFacet")); add("encoding", cl.getDeclaredMethod("getEncodingVersion")); add("mode", cl.getDeclaredMethod("getMode")); @@ -356,7 +357,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } }; - InvocationHelper(Ice.ObjectPrx proxy, String op, java.util.Map<String, String> ctx) + InvocationHelper(com.zeroc.Ice.ObjectPrx proxy, String op, java.util.Map<String, String> ctx) { super(_attributes); _proxy = proxy; @@ -428,7 +429,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb catch(Exception ex) { // Either a fixed proxy or the communicator is destroyed. - os.append(Ice.Util.identityToString(_proxy.ice_getIdentity())); + os.append(com.zeroc.Ice.Util.identityToString(_proxy.ice_getIdentity())); os.append(" [").append(_operation).append(']'); } _id = os.toString(); @@ -447,7 +448,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return "Communicator"; } - public Ice.ObjectPrx + public com.zeroc.Ice.ObjectPrx getProxy() { return _proxy; @@ -458,7 +459,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb { if(_proxy != null) { - return Ice.Util.identityToString(_proxy.ice_getIdentity()); + return com.zeroc.Ice.Util.identityToString(_proxy.ice_getIdentity()); } else { @@ -475,15 +476,15 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb public String getEncodingVersion() { - return Ice.Util.encodingVersionToString(_proxy.ice_getEncodingVersion()); + return com.zeroc.Ice.Util.encodingVersionToString(_proxy.ice_getEncodingVersion()); } - final private Ice.ObjectPrx _proxy; + final private com.zeroc.Ice.ObjectPrx _proxy; final private String _operation; final private java.util.Map<String, String> _context; private String _id; - static final private Ice.Endpoint[] emptyEndpoints = new Ice.Endpoint[0]; + static final private com.zeroc.Ice.Endpoint[] emptyEndpoints = new com.zeroc.Ice.Endpoint[0]; } static public final class ThreadHelper extends MetricsHelper<ThreadMetrics> @@ -503,7 +504,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } }; - ThreadHelper(String parent, String id, Ice.Instrumentation.ThreadState state) + ThreadHelper(String parent, String id, com.zeroc.Ice.Instrumentation.ThreadState state) { super(_attributes); _parent = parent; @@ -533,7 +534,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb final public String _parent; final public String _id; - final private Ice.Instrumentation.ThreadState _state; + final private com.zeroc.Ice.Instrumentation.ThreadState _state; } static public final class EndpointHelper extends MetricsHelper<Metrics> @@ -555,20 +556,20 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } }; - EndpointHelper(Ice.Endpoint endpt, String id) + EndpointHelper(com.zeroc.Ice.Endpoint endpt, String id) { super(_attributes); _endpoint = endpt; _id = id; } - EndpointHelper(Ice.Endpoint endpt) + EndpointHelper(com.zeroc.Ice.Endpoint endpt) { super(_attributes); _endpoint = endpt; } - public Ice.EndpointInfo + public com.zeroc.Ice.EndpointInfo getEndpointInfo() { if(_endpointInfo == null) @@ -600,29 +601,29 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb return _endpoint.toString(); } - final private Ice.Endpoint _endpoint; + final private com.zeroc.Ice.Endpoint _endpoint; private String _id; - private Ice.EndpointInfo _endpointInfo; + private com.zeroc.Ice.EndpointInfo _endpointInfo; } public - CommunicatorObserverI(Ice.InitializationData initData) + CommunicatorObserverI(com.zeroc.Ice.InitializationData initData) { _metrics = new MetricsAdminI(initData.properties, initData.logger); _delegate = initData.observer; _connections = new ObserverFactoryWithDelegate<ConnectionMetrics, ConnectionObserverI, - Ice.Instrumentation.ConnectionObserver>(_metrics, "Connection", ConnectionMetrics.class); + com.zeroc.Ice.Instrumentation.ConnectionObserver>(_metrics, "Connection", ConnectionMetrics.class); _dispatch = new ObserverFactoryWithDelegate<DispatchMetrics, DispatchObserverI, - Ice.Instrumentation.DispatchObserver>(_metrics, "Dispatch", DispatchMetrics.class); + com.zeroc.Ice.Instrumentation.DispatchObserver>(_metrics, "Dispatch", DispatchMetrics.class); _invocations = new ObserverFactoryWithDelegate<InvocationMetrics, InvocationObserverI, - Ice.Instrumentation.InvocationObserver>(_metrics, "Invocation", InvocationMetrics.class); + com.zeroc.Ice.Instrumentation.InvocationObserver>(_metrics, "Invocation", InvocationMetrics.class); _threads = new ObserverFactoryWithDelegate<ThreadMetrics, ThreadObserverI, - Ice.Instrumentation.ThreadObserver>(_metrics, "Thread", ThreadMetrics.class); + com.zeroc.Ice.Instrumentation.ThreadObserver>(_metrics, "Thread", ThreadMetrics.class); _connects = new ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI, - Ice.Instrumentation.Observer>(_metrics, "ConnectionEstablishment", Metrics.class); + com.zeroc.Ice.Instrumentation.Observer>(_metrics, "ConnectionEstablishment", Metrics.class); _endpointLookups = new ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI, - Ice.Instrumentation.Observer>(_metrics, "EndpointLookup", Metrics.class); + com.zeroc.Ice.Instrumentation.Observer>(_metrics, "EndpointLookup", Metrics.class); try { @@ -638,14 +639,14 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } @Override - public Ice.Instrumentation.Observer - getConnectionEstablishmentObserver(Ice.Endpoint endpt, String connector) + public com.zeroc.Ice.Instrumentation.Observer + getConnectionEstablishmentObserver(com.zeroc.Ice.Endpoint endpt, String connector) { if(_connects.isEnabled()) { try { - Ice.Instrumentation.Observer delegate = null; + com.zeroc.Ice.Instrumentation.Observer delegate = null; if(_delegate != null) { delegate = _delegate.getConnectionEstablishmentObserver(endpt, connector); @@ -662,14 +663,14 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } @Override - public Ice.Instrumentation.Observer - getEndpointLookupObserver(Ice.Endpoint endpt) + public com.zeroc.Ice.Instrumentation.Observer + getEndpointLookupObserver(com.zeroc.Ice.Endpoint endpt) { if(_endpointLookups.isEnabled()) { try { - Ice.Instrumentation.Observer delegate = null; + com.zeroc.Ice.Instrumentation.Observer delegate = null; if(_delegate != null) { delegate = _delegate.getEndpointLookupObserver(endpt); @@ -686,15 +687,16 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } @Override - public Ice.Instrumentation.ConnectionObserver - getConnectionObserver(Ice.ConnectionInfo c, Ice.Endpoint e, Ice.Instrumentation.ConnectionState s, - Ice.Instrumentation.ConnectionObserver observer) + public com.zeroc.Ice.Instrumentation.ConnectionObserver + getConnectionObserver(com.zeroc.Ice.ConnectionInfo c, com.zeroc.Ice.Endpoint e, + com.zeroc.Ice.Instrumentation.ConnectionState s, + com.zeroc.Ice.Instrumentation.ConnectionObserver observer) { if(_connections.isEnabled()) { try { - Ice.Instrumentation.ConnectionObserver delegate = null; + com.zeroc.Ice.Instrumentation.ConnectionObserver delegate = null; ConnectionObserverI o = observer instanceof ConnectionObserverI ? (ConnectionObserverI)observer : null; if(_delegate != null) { @@ -711,15 +713,15 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } @Override - public Ice.Instrumentation.ThreadObserver - getThreadObserver(String parent, String id, Ice.Instrumentation.ThreadState s, - Ice.Instrumentation.ThreadObserver observer) + public com.zeroc.Ice.Instrumentation.ThreadObserver + getThreadObserver(String parent, String id, com.zeroc.Ice.Instrumentation.ThreadState s, + com.zeroc.Ice.Instrumentation.ThreadObserver observer) { if(_threads.isEnabled()) { try { - Ice.Instrumentation.ThreadObserver delegate = null; + com.zeroc.Ice.Instrumentation.ThreadObserver delegate = null; ThreadObserverI o = observer instanceof ThreadObserverI ? (ThreadObserverI)observer : null; if(_delegate != null) { @@ -736,14 +738,15 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } @Override - public Ice.Instrumentation.InvocationObserver - getInvocationObserver(Ice.ObjectPrx prx, String operation, java.util.Map<java.lang.String, java.lang.String> ctx) + public com.zeroc.Ice.Instrumentation.InvocationObserver + getInvocationObserver(com.zeroc.Ice.ObjectPrx prx, String operation, java.util.Map<java.lang.String, + java.lang.String> ctx) { if(_invocations.isEnabled()) { try { - Ice.Instrumentation.InvocationObserver delegate = null; + com.zeroc.Ice.Instrumentation.InvocationObserver delegate = null; if(_delegate != null) { delegate = _delegate.getInvocationObserver(prx, operation, ctx); @@ -761,14 +764,14 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } @Override - public Ice.Instrumentation.DispatchObserver - getDispatchObserver(Ice.Current c, int size) + public com.zeroc.Ice.Instrumentation.DispatchObserver + getDispatchObserver(com.zeroc.Ice.Current c, int size) { if(_dispatch.isEnabled()) { try { - Ice.Instrumentation.DispatchObserver delegate = null; + com.zeroc.Ice.Instrumentation.DispatchObserver delegate = null; if(_delegate != null) { delegate = _delegate.getDispatchObserver(c, size); @@ -785,7 +788,7 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb @Override public void - setObserverUpdater(final Ice.Instrumentation.ObserverUpdater updater) + setObserverUpdater(final com.zeroc.Ice.Instrumentation.ObserverUpdater updater) { if(updater == null) { @@ -818,23 +821,23 @@ public class CommunicatorObserverI implements Ice.Instrumentation.CommunicatorOb } } - public IceInternal.MetricsAdminI getFacet() + public MetricsAdminI getFacet() { return _metrics; } - final private IceInternal.MetricsAdminI _metrics; - final private Ice.Instrumentation.CommunicatorObserver _delegate; + final private MetricsAdminI _metrics; + final private com.zeroc.Ice.Instrumentation.CommunicatorObserver _delegate; final private ObserverFactoryWithDelegate<ConnectionMetrics, ConnectionObserverI, - Ice.Instrumentation.ConnectionObserver> _connections; + com.zeroc.Ice.Instrumentation.ConnectionObserver> _connections; final private ObserverFactoryWithDelegate<DispatchMetrics, DispatchObserverI, - Ice.Instrumentation.DispatchObserver> _dispatch; + com.zeroc.Ice.Instrumentation.DispatchObserver> _dispatch; final private ObserverFactoryWithDelegate<InvocationMetrics, InvocationObserverI, - Ice.Instrumentation.InvocationObserver> _invocations; + com.zeroc.Ice.Instrumentation.InvocationObserver> _invocations; final private ObserverFactoryWithDelegate<ThreadMetrics, ThreadObserverI, - Ice.Instrumentation.ThreadObserver> _threads; + com.zeroc.Ice.Instrumentation.ThreadObserver> _threads; final private ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI, - Ice.Instrumentation.Observer> _connects; + com.zeroc.Ice.Instrumentation.Observer> _connects; final private ObserverFactoryWithDelegate<Metrics, ObserverWithDelegateI, - Ice.Instrumentation.Observer> _endpointLookups; + com.zeroc.Ice.Instrumentation.Observer> _endpointLookups; } diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java index 4f50988102a..12e6d3616a1 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectRequestHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectRequestHandler.java @@ -7,9 +7,7 @@ // // ********************************************************************** -package IceInternal; - -import Ice.ConnectionI; +package com.zeroc.IceInternal; import java.util.concurrent.Callable; @@ -17,7 +15,7 @@ public class ConnectRequestHandler implements RequestHandler, Reference.GetConnectionCallback, RouterInfo.AddProxyCallback { synchronized public RequestHandler - connect(Ice.ObjectPrxHelperBase proxy) + connect(com.zeroc.Ice._ObjectPrxI proxy) { if(!initialized()) { @@ -56,7 +54,7 @@ public class ConnectRequestHandler @Override public void - asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex) + asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex) { synchronized(this) { @@ -95,12 +93,12 @@ public class ConnectRequestHandler } @Override - synchronized public ConnectionI + synchronized public com.zeroc.Ice.ConnectionI getConnection() { if(_exception != null) { - throw (Ice.LocalException)_exception.fillInStackTrace(); + throw (com.zeroc.Ice.LocalException)_exception.fillInStackTrace(); } else { @@ -114,7 +112,7 @@ public class ConnectRequestHandler @Override public void - setConnection(Ice.ConnectionI connection, boolean compress) + setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress) { synchronized(this) { @@ -141,7 +139,7 @@ public class ConnectRequestHandler @Override public synchronized void - setException(final Ice.LocalException ex) + setException(final com.zeroc.Ice.LocalException ex) { assert(!_initialized && _exception == null); _exception = ex; @@ -158,7 +156,7 @@ public class ConnectRequestHandler { _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this); } - catch(Ice.CommunicatorDestroyedException exc) + catch(com.zeroc.Ice.CommunicatorDestroyedException exc) { // Ignore } @@ -189,11 +187,11 @@ public class ConnectRequestHandler } public - ConnectRequestHandler(Reference ref, Ice.ObjectPrxHelperBase proxy) + ConnectRequestHandler(Reference ref, com.zeroc.Ice._ObjectPrxI proxy) { _reference = ref; _response = _reference.getMode() == Reference.ModeTwoway; - _proxy = (Ice.ObjectPrxHelperBase)proxy; + _proxy = proxy; _initialized = false; _flushing = false; @@ -255,7 +253,7 @@ public class ConnectRequestHandler // return true; } - throw (Ice.LocalException)_exception.fillInStackTrace(); + throw (com.zeroc.Ice.LocalException)_exception.fillInStackTrace(); } else { @@ -300,7 +298,7 @@ public class ConnectRequestHandler _flushing = true; } - Ice.LocalException exception = null; + com.zeroc.Ice.LocalException exception = null; for(ProxyOutgoingAsyncBase outAsync : _requests) { try @@ -318,7 +316,7 @@ public class ConnectRequestHandler _reference.getInstance().requestHandlerFactory().removeRequestHandler(_reference, this); outAsync.retryException(ex.get()); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { exception = ex; if(outAsync.completed(ex)) @@ -343,7 +341,7 @@ public class ConnectRequestHandler { _requestHandler = new QueueRequestHandler(_reference.getInstance(), _requestHandler); } - for(Ice.ObjectPrxHelperBase proxy : _proxies) + for(com.zeroc.Ice._ObjectPrxI proxy : _proxies) { proxy.__updateRequestHandler(previous, _requestHandler); } @@ -371,15 +369,15 @@ public class ConnectRequestHandler private final Reference _reference; private boolean _response; - private Ice.ObjectPrxHelperBase _proxy; - private java.util.Set<Ice.ObjectPrxHelperBase> _proxies = new java.util.HashSet<Ice.ObjectPrxHelperBase>(); + private com.zeroc.Ice._ObjectPrxI _proxy; + private java.util.Set<com.zeroc.Ice._ObjectPrxI> _proxies = new java.util.HashSet<>(); - private Ice.ConnectionI _connection; + private com.zeroc.Ice.ConnectionI _connection; private boolean _compress; - private Ice.LocalException _exception; + private com.zeroc.Ice.LocalException _exception; private boolean _initialized; private boolean _flushing; - private java.util.List<ProxyOutgoingAsyncBase> _requests = new java.util.LinkedList<ProxyOutgoingAsyncBase>(); + private java.util.List<ProxyOutgoingAsyncBase> _requests = new java.util.LinkedList<>(); private RequestHandler _requestHandler; } diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java index 7e4b1427c1f..f7576e28816 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectionACMMonitor.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionACMMonitor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class ConnectionACMMonitor implements ACMMonitor { @@ -26,7 +26,7 @@ class ConnectionACMMonitor implements ACMMonitor { try { - IceUtilInternal.Assert.FinalizerAssert(_connection == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connection == null); } catch(java.lang.Exception ex) { @@ -39,7 +39,7 @@ class ConnectionACMMonitor implements ACMMonitor @Override public synchronized void - add(Ice.ConnectionI connection) + add(com.zeroc.Ice.ConnectionI connection) { assert(_connection == null); _connection = connection; @@ -58,7 +58,7 @@ class ConnectionACMMonitor implements ACMMonitor @Override public synchronized void - remove(Ice.ConnectionI connection) + remove(com.zeroc.Ice.ConnectionI connection) { assert(_connection == connection); _connection = null; @@ -71,23 +71,24 @@ class ConnectionACMMonitor implements ACMMonitor @Override public void - reap(Ice.ConnectionI connection) + reap(com.zeroc.Ice.ConnectionI connection) { _parent.reap(connection); } @Override public ACMMonitor - acm(Ice.IntOptional timeout, Ice.Optional<Ice.ACMClose> close, Ice.Optional<Ice.ACMHeartbeat> heartbeat) + acm(java.util.OptionalInt timeout, java.util.Optional<com.zeroc.Ice.ACMClose> close, + java.util.Optional<com.zeroc.Ice.ACMHeartbeat> heartbeat) { return _parent.acm(timeout, close, heartbeat); } @Override - public Ice.ACM + public com.zeroc.Ice.ACM getACM() { - Ice.ACM acm = new Ice.ACM(); + com.zeroc.Ice.ACM acm = new com.zeroc.Ice.ACM(); acm.timeout = _config.timeout / 1000; acm.close = _config.close; acm.heartbeat = _config.heartbeat; @@ -97,7 +98,7 @@ class ConnectionACMMonitor implements ACMMonitor private void monitorConnection() { - Ice.ConnectionI connection; + com.zeroc.Ice.ConnectionI connection; synchronized(this) { if(_connection == null) @@ -122,5 +123,5 @@ class ConnectionACMMonitor implements ACMMonitor private java.util.concurrent.Future<?> _future; final private ACMConfig _config; - private Ice.ConnectionI _connection; + private com.zeroc.Ice.ConnectionI _connection; } diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionFlushBatch.java index 7824d3154c1..3ec636ed074 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectionFlushBatch.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionFlushBatch.java @@ -7,39 +7,42 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.concurrent.Callable; -public class ConnectionFlushBatch extends OutgoingAsyncBase +public class ConnectionFlushBatch extends OutgoingAsyncBase<Void> { - public static ConnectionFlushBatch check(Ice.AsyncResult r, Ice.Connection con, String operation) + public ConnectionFlushBatch(com.zeroc.Ice.ConnectionI con, com.zeroc.Ice.Communicator communicator, + Instance instance) { - check(r, operation); - if(!(r instanceof ConnectionFlushBatch)) - { - throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method"); - } - if(r.getConnection() != con) - { - throw new IllegalArgumentException("Connection for call to end_" + operation + - " does not match connection that was used to call corresponding " + - "begin_" + operation + " method"); - } - return (ConnectionFlushBatch)r; + super(communicator, instance, "flushBatchRequests"); + _connection = con; } - public ConnectionFlushBatch(Ice.ConnectionI con, Ice.Communicator communicator, Instance instance, - String operation, CallbackBase callback) + @Override + public com.zeroc.Ice.Connection getConnection() { - super(communicator, instance, operation, callback); - _connection = con; + return _connection; } @Override - public Ice.Connection getConnection() + protected void __sent() { - return _connection; + super.__sent(); + + assert((_state & StateOK) != 0); + complete(null); + } + + @Override + protected void __completed() + { + if(_exception != null) + { + completeExceptionally(_exception); + } + super.__completed(); } public void invoke() @@ -51,10 +54,10 @@ public class ConnectionFlushBatch extends OutgoingAsyncBase int status; if(batchRequestNum == 0) { - status = IceInternal.AsyncStatus.Sent; + status = AsyncStatus.Sent; if(sent()) { - status |= IceInternal.AsyncStatus.InvokeSentCallback; + status |= AsyncStatus.InvokeSentCallback; } } else if(_instance.queueRequests()) @@ -62,7 +65,8 @@ public class ConnectionFlushBatch extends OutgoingAsyncBase status = _instance.getQueueExecutor().execute(new Callable<Integer>() { @Override - public Integer call() throws RetryException + public Integer call() + throws RetryException { return _connection.sendAsyncRequest(ConnectionFlushBatch.this, false, false, batchRequestNum); } @@ -89,7 +93,7 @@ public class ConnectionFlushBatch extends OutgoingAsyncBase invokeCompletedAsync(); } } - catch(Ice.Exception ex) + catch(com.zeroc.Ice.Exception ex) { if(completed(ex)) { @@ -98,5 +102,5 @@ public class ConnectionFlushBatch extends OutgoingAsyncBase } } - private Ice.ConnectionI _connection; + private com.zeroc.Ice.ConnectionI _connection; } diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionObserverI.java index ebbf963aba9..b3898f5476c 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectionObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionObserverI.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class ConnectionObserverI - extends IceMX.ObserverWithDelegate<IceMX.ConnectionMetrics, Ice.Instrumentation.ConnectionObserver> - implements Ice.Instrumentation.ConnectionObserver + extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.ConnectionMetrics, + com.zeroc.Ice.Instrumentation.ConnectionObserver> + implements com.zeroc.Ice.Instrumentation.ConnectionObserver { @Override - public void - sentBytes(final int num) + public void sentBytes(final int num) { _sentBytes = num; forEach(_sentBytesUpdate); @@ -26,8 +26,7 @@ public class ConnectionObserverI } @Override - public void - receivedBytes(int num) + public void receivedBytes(int num) { _receivedBytes = num; forEach(_receivedBytesUpdate); @@ -37,21 +36,21 @@ public class ConnectionObserverI } } - private MetricsUpdate<IceMX.ConnectionMetrics> _sentBytesUpdate = new MetricsUpdate<IceMX.ConnectionMetrics>() + private MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics> _sentBytesUpdate = + new MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics>() { @Override - public void - update(IceMX.ConnectionMetrics v) + public void update(com.zeroc.IceMX.ConnectionMetrics v) { v.sentBytes += _sentBytes; } }; - private MetricsUpdate<IceMX.ConnectionMetrics> _receivedBytesUpdate = new MetricsUpdate<IceMX.ConnectionMetrics>() + private MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics> _receivedBytesUpdate = + new MetricsUpdate<com.zeroc.IceMX.ConnectionMetrics>() { @Override - public void - update(IceMX.ConnectionMetrics v) + public void update(com.zeroc.IceMX.ConnectionMetrics v) { v.receivedBytes += _receivedBytes; } diff --git a/java/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionRequestHandler.java index 6e098e1c6a4..586c20dd54a 100644 --- a/java/src/Ice/src/main/java/IceInternal/ConnectionRequestHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ConnectionRequestHandler.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class ConnectionRequestHandler implements RequestHandler { @@ -31,7 +31,7 @@ public class ConnectionRequestHandler implements RequestHandler return newHandler; } } - catch(Ice.Exception ex) + catch(com.zeroc.Ice.Exception ex) { // Ignore } @@ -47,7 +47,7 @@ public class ConnectionRequestHandler implements RequestHandler @Override public void - asyncRequestCanceled(OutgoingAsyncBase outgoingAsync, Ice.LocalException ex) + asyncRequestCanceled(OutgoingAsyncBase outgoingAsync, com.zeroc.Ice.LocalException ex) { _connection.asyncRequestCanceled(outgoingAsync, ex); } @@ -60,13 +60,13 @@ public class ConnectionRequestHandler implements RequestHandler } @Override - public Ice.ConnectionI + public com.zeroc.Ice.ConnectionI getConnection() { return _connection; } - public ConnectionRequestHandler(Reference ref, Ice.ConnectionI connection, boolean compress) + public ConnectionRequestHandler(Reference ref, com.zeroc.Ice.ConnectionI connection, boolean compress) { _reference = ref; _response = _reference.getMode() == Reference.ModeTwoway; @@ -76,7 +76,7 @@ public class ConnectionRequestHandler implements RequestHandler private final Reference _reference; private final boolean _response; - private final Ice.ConnectionI _connection; + private final com.zeroc.Ice.ConnectionI _connection; private final boolean _compress; } diff --git a/java/src/Ice/src/main/java/IceInternal/Connector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Connector.java index 29638f0f138..28de64f6115 100644 --- a/java/src/Ice/src/main/java/IceInternal/Connector.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Connector.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface Connector { diff --git a/java/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DefaultsAndOverrides.java index b1b7fc5687d..2bb2903476d 100644 --- a/java/src/Ice/src/main/java/IceInternal/DefaultsAndOverrides.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DefaultsAndOverrides.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class DefaultsAndOverrides { - DefaultsAndOverrides(Ice.Properties properties, Ice.Logger logger) + DefaultsAndOverrides(com.zeroc.Ice.Properties properties, com.zeroc.Ice.Logger logger) { String value; int intValue; @@ -34,8 +34,8 @@ public final class DefaultsAndOverrides defaultSourceAddress = Network.getNumericAddress(value); if(defaultSourceAddress == null) { - throw new Ice.InitializationException("invalid IP address set for Ice.Default.SourceAddress: `" + - value + "'"); + throw new com.zeroc.Ice.InitializationException( + "invalid IP address set for Ice.Default.SourceAddress: `" + value + "'"); } } else @@ -151,15 +151,16 @@ public final class DefaultsAndOverrides value = properties.getPropertyWithDefault("Ice.Default.EndpointSelection", "Random"); if(value.equals("Random")) { - defaultEndpointSelection = Ice.EndpointSelectionType.Random; + defaultEndpointSelection = com.zeroc.Ice.EndpointSelectionType.Random; } else if(value.equals("Ordered")) { - defaultEndpointSelection = Ice.EndpointSelectionType.Ordered; + defaultEndpointSelection = com.zeroc.Ice.EndpointSelectionType.Ordered; } else { - Ice.EndpointSelectionTypeParseException ex = new Ice.EndpointSelectionTypeParseException(); + com.zeroc.Ice.EndpointSelectionTypeParseException ex = + new com.zeroc.Ice.EndpointSelectionTypeParseException(); ex.str = "illegal value `" + value + "'; expected `Random' or `Ordered'"; throw ex; } @@ -209,25 +210,25 @@ public final class DefaultsAndOverrides defaultPreferSecure = properties.getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0; value = properties.getPropertyWithDefault("Ice.Default.EncodingVersion", - Ice.Util.encodingVersionToString(Protocol.currentEncoding)); - defaultEncoding = Ice.Util.stringToEncodingVersion(value); + com.zeroc.Ice.Util.encodingVersionToString(Protocol.currentEncoding)); + defaultEncoding = com.zeroc.Ice.Util.stringToEncodingVersion(value); Protocol.checkSupportedEncoding(defaultEncoding); boolean slicedFormat = properties.getPropertyAsIntWithDefault("Ice.Default.SlicedFormat", 0) > 0; - defaultFormat = slicedFormat ? Ice.FormatType.SlicedFormat : Ice.FormatType.CompactFormat; + defaultFormat = slicedFormat ? com.zeroc.Ice.FormatType.SlicedFormat : com.zeroc.Ice.FormatType.CompactFormat; } final public String defaultHost; final public java.net.InetSocketAddress defaultSourceAddress; final public String defaultProtocol; final public boolean defaultCollocationOptimization; - final public Ice.EndpointSelectionType defaultEndpointSelection; + final public com.zeroc.Ice.EndpointSelectionType defaultEndpointSelection; final public int defaultTimeout; final public int defaultLocatorCacheTimeout; final public int defaultInvocationTimeout; final public boolean defaultPreferSecure; - final public Ice.EncodingVersion defaultEncoding; - final public Ice.FormatType defaultFormat; + final public com.zeroc.Ice.EncodingVersion defaultEncoding; + final public com.zeroc.Ice.FormatType defaultFormat; final public boolean overrideTimeout; final public int overrideTimeoutValue; diff --git a/java/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java index 2f426ac4fa1..f77f47eb84d 100644 --- a/java/src/Ice/src/main/java/IceInternal/DictionaryPatcher.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DictionaryPatcher.java @@ -7,35 +7,32 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -public class DictionaryPatcher<K, V> implements Ice.ReadValueCallback +public class DictionaryPatcher<K, V> implements com.zeroc.Ice.ReadValueCallback { - public DictionaryPatcher(java.util.Map<K, V> dict, Class<V> cls, K key) + public DictionaryPatcher(java.util.Map<K, V> dict, Class<V> cls, String type, K key) { _dict = dict; _cls = cls; + _type = type; _key = key; } - public void valueReady(Ice.Object v) + public void valueReady(com.zeroc.Ice.Value v) { - if(v != null) + if(v == null || _cls.isInstance(v)) { - // - // Raise ClassCastException if the element doesn't match the expected type. - // - if(!_cls.isInstance(v)) - { - throw new ClassCastException("expected element of type " + _cls.getName() + " but received " + - v.getClass().getName()); - } + _dict.put(_key, _cls.cast(v)); + } + else + { + Ex.throwUOE(_type, v); } - - _dict.put(_key, _cls.cast(v)); } private java.util.Map<K, V> _dict; private Class<V> _cls; + private String _type; private K _key; } diff --git a/java/src/Ice/src/main/java/IceInternal/DispatchObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchObserverI.java index 1d4ce8be34e..1cc43566526 100644 --- a/java/src/Ice/src/main/java/IceInternal/DispatchObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchObserverI.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class DispatchObserverI - extends IceMX.ObserverWithDelegate<IceMX.DispatchMetrics, Ice.Instrumentation.DispatchObserver> - implements Ice.Instrumentation.DispatchObserver + extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.DispatchMetrics, + com.zeroc.Ice.Instrumentation.DispatchObserver> + implements com.zeroc.Ice.Instrumentation.DispatchObserver { @Override - public void - userException() + public void userException() { forEach(_userException); if(_delegate != null) @@ -25,14 +25,12 @@ public class DispatchObserverI } @Override - public void - reply(final int size) + public void reply(final int size) { - forEach(new MetricsUpdate<IceMX.DispatchMetrics>() + forEach(new MetricsUpdate<com.zeroc.IceMX.DispatchMetrics>() { @Override - public void - update(IceMX.DispatchMetrics v) + public void update(com.zeroc.IceMX.DispatchMetrics v) { v.replySize += size; } @@ -43,11 +41,11 @@ public class DispatchObserverI } } - final private MetricsUpdate<IceMX.DispatchMetrics> _userException = new MetricsUpdate<IceMX.DispatchMetrics>() + final private MetricsUpdate<com.zeroc.IceMX.DispatchMetrics> _userException = + new MetricsUpdate<com.zeroc.IceMX.DispatchMetrics>() { @Override - public void - update(IceMX.DispatchMetrics v) + public void update(com.zeroc.IceMX.DispatchMetrics v) { ++v.userException; } diff --git a/java/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchWorkItem.java index 157cf841f78..9e5cbf669c8 100644 --- a/java/src/Ice/src/main/java/IceInternal/DispatchWorkItem.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/DispatchWorkItem.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; // // A helper class for thread pool work items that only need to call user @@ -21,7 +21,7 @@ abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable { } - public DispatchWorkItem(Ice.Connection connection) + public DispatchWorkItem(com.zeroc.Ice.Connection connection) { _connection = connection; } @@ -34,11 +34,11 @@ abstract public class DispatchWorkItem implements ThreadPoolWorkItem, Runnable current.dispatchFromThisThread(this); } - public Ice.Connection + public com.zeroc.Ice.Connection getConnection() { return _connection; } - private Ice.Connection _connection; + private com.zeroc.Ice.Connection _connection; } diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactory.java index 350a9aa7e15..01abd58535f 100644 --- a/java/src/Ice/src/main/java/IceInternal/EndpointFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactory.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface EndpointFactory { short type(); String protocol(); EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint); - EndpointI read(Ice.InputStream s); + EndpointI read(com.zeroc.Ice.InputStream s); void destroy(); EndpointFactory clone(ProtocolInstance instance, EndpointFactory delegate); diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactoryManager.java index 252baa39baf..7fa9aa318a3 100644 --- a/java/src/Ice/src/main/java/IceInternal/EndpointFactoryManager.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointFactoryManager.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class EndpointFactoryManager { @@ -44,22 +44,22 @@ public final class EndpointFactoryManager public synchronized EndpointI create(String str, boolean oaEndpoint) { - String[] arr = IceUtilInternal.StringUtil.splitString(str, " \t\r\n"); + String[] arr = com.zeroc.IceUtilInternal.StringUtil.splitString(str, " \t\r\n"); if(arr == null) { - Ice.EndpointParseException e = new Ice.EndpointParseException(); + com.zeroc.Ice.EndpointParseException e = new com.zeroc.Ice.EndpointParseException(); e.str = "mismatched quote"; throw e; } if(arr.length == 0) { - Ice.EndpointParseException e = new Ice.EndpointParseException(); + com.zeroc.Ice.EndpointParseException e = new com.zeroc.Ice.EndpointParseException(); e.str = "value has no non-whitespace characters"; throw e; } - java.util.ArrayList<String> v = new java.util.ArrayList<String>(java.util.Arrays.asList(arr)); + java.util.ArrayList<String> v = new java.util.ArrayList<>(java.util.Arrays.asList(arr)); String protocol = v.get(0); v.remove(0); @@ -84,7 +84,7 @@ public final class EndpointFactoryManager EndpointI e = factory.create(v, oaEndpoint); if(!v.isEmpty()) { - Ice.EndpointParseException ex = new Ice.EndpointParseException(); + com.zeroc.Ice.EndpointParseException ex = new com.zeroc.Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v.get(0) + "' in endpoint `" + str + "'"; throw ex; } @@ -99,7 +99,7 @@ public final class EndpointFactoryManager java.nio.ByteBuffer buf = bs.getBuffer(); buf.position(0); short type = bs.readShort(); - EndpointI ue = new IceInternal.OpaqueEndpointI(type, bs); + EndpointI ue = new OpaqueEndpointI(type, bs); System.err.println("Normal: " + e); System.err.println("Opaque: " + ue); return e; @@ -115,7 +115,7 @@ public final class EndpointFactoryManager EndpointI ue = new OpaqueEndpointI(v); if(!v.isEmpty()) { - Ice.EndpointParseException ex = new Ice.EndpointParseException(); + com.zeroc.Ice.EndpointParseException ex = new com.zeroc.Ice.EndpointParseException(); ex.str = "unrecognized argument `" + v.get(0) + "' in endpoint `" + str + "'"; throw ex; } @@ -127,11 +127,12 @@ public final class EndpointFactoryManager // and ask the factory to read the endpoint data from that stream to create // the actual endpoint. // - Ice.OutputStream os = new Ice.OutputStream(_instance, Protocol.currentProtocolEncoding, false); + com.zeroc.Ice.OutputStream os = + new com.zeroc.Ice.OutputStream(_instance, Protocol.currentProtocolEncoding, false); os.writeShort(ue.type()); ue.streamWrite(os); - Ice.InputStream is = - new Ice.InputStream(_instance, Protocol.currentProtocolEncoding, os.getBuffer(), true); + com.zeroc.Ice.InputStream is = + new com.zeroc.Ice.InputStream(_instance, Protocol.currentProtocolEncoding, os.getBuffer(), true); is.pos(0); is.readShort(); // type is.startEncapsulation(); @@ -145,7 +146,7 @@ public final class EndpointFactoryManager return null; } - public synchronized EndpointI read(Ice.InputStream s) + public synchronized EndpointI read(com.zeroc.Ice.InputStream s) { short type = s.readShort(); @@ -179,5 +180,5 @@ public final class EndpointFactoryManager } private Instance _instance; - private java.util.List<EndpointFactory> _factories = new java.util.ArrayList<EndpointFactory>(); + private java.util.List<EndpointFactory> _factories = new java.util.ArrayList<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java index 89cc00f4a3a..bdf3aceed54 100644 --- a/java/src/Ice/src/main/java/IceInternal/EndpointHostResolver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointHostResolver.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class EndpointHostResolver { @@ -31,7 +31,7 @@ class EndpointHostResolver } } - synchronized void resolve(final String host, final int port, final Ice.EndpointSelectionType selType, + synchronized void resolve(final String host, final int port, final com.zeroc.Ice.EndpointSelectionType selType, final IPEndpointI endpoint, final EndpointI_connectors callback) { // @@ -54,8 +54,8 @@ class EndpointHostResolver } } - final Ice.Instrumentation.ThreadObserver threadObserver = _observer; - final Ice.Instrumentation.Observer observer = getObserver(endpoint); + final com.zeroc.Ice.Instrumentation.ThreadObserver threadObserver = _observer; + final com.zeroc.Ice.Instrumentation.Observer observer = getObserver(endpoint); if(observer != null) { observer.attach(); @@ -70,7 +70,8 @@ class EndpointHostResolver { if(_destroyed) { - Ice.CommunicatorDestroyedException ex = new Ice.CommunicatorDestroyedException(); + com.zeroc.Ice.CommunicatorDestroyedException ex = + new com.zeroc.Ice.CommunicatorDestroyedException(); if(observer != null) { observer.failed(ex.ice_id()); @@ -83,8 +84,8 @@ class EndpointHostResolver if(threadObserver != null) { - threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateIdle, - Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); + threadObserver.stateChanged(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle, + com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); } try @@ -108,7 +109,7 @@ class EndpointHostResolver true), networkProxy)); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { if(observer != null) { @@ -120,8 +121,9 @@ class EndpointHostResolver { if(threadObserver != null) { - threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, - Ice.Instrumentation.ThreadState.ThreadStateIdle); + threadObserver.stateChanged( + com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, + com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle); } if(observer != null) { @@ -168,11 +170,11 @@ class EndpointHostResolver synchronized void updateObserver() { - Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; + com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; if(obsv != null) { _observer = obsv.getThreadObserver("Communicator", _threadName, - Ice.Instrumentation.ThreadState.ThreadStateIdle, + com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle, _observer); if(_observer != null) { @@ -181,10 +183,10 @@ class EndpointHostResolver } } - private Ice.Instrumentation.Observer + private com.zeroc.Ice.Instrumentation.Observer getObserver(IPEndpointI endpoint) { - Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; + com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; if(obsv != null) { return obsv.getEndpointLookupObserver(endpoint); @@ -196,7 +198,7 @@ class EndpointHostResolver private final int _protocol; private final boolean _preferIPv6; private boolean _destroyed; - private Ice.Instrumentation.ThreadObserver _observer; + private com.zeroc.Ice.Instrumentation.ThreadObserver _observer; private String _threadName; private java.util.concurrent.ExecutorService _executor; } diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI.java index d393916472d..f5ee93573b1 100644 --- a/java/src/Ice/src/main/java/IceInternal/EndpointI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<EndpointI> +abstract public class EndpointI implements com.zeroc.Ice.Endpoint, java.lang.Comparable<EndpointI> { - public void streamWrite(Ice.OutputStream s) + public void streamWrite(com.zeroc.Ice.OutputStream s) { s.startEncapsulation(); streamWriteImpl(s); @@ -40,7 +40,7 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En // // Marshal the endpoint. // - public abstract void streamWriteImpl(Ice.OutputStream s); + public abstract void streamWriteImpl(com.zeroc.Ice.OutputStream s); // // Return the endpoint type. @@ -108,7 +108,7 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En // Return connectors for this endpoint, or empty list if no connector // is available. // - public abstract void connectors_async(Ice.EndpointSelectionType selType, EndpointI_connectors callback); + public abstract void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, EndpointI_connectors callback); // // Return an acceptor for this endpoint, or null if no acceptors @@ -131,12 +131,12 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<En public void initWithOptions(java.util.ArrayList<String> args) { - java.util.ArrayList<String> unknown = new java.util.ArrayList<String>(); + java.util.ArrayList<String> unknown = new java.util.ArrayList<>(); String str = "`" + protocol() + " "; for(String p : args) { - if(IceUtilInternal.StringUtil.findFirstOf(p, " \t\n\r") != -1) + if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(p, " \t\n\r") != -1) { str += " \"" + p + "\""; } diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointIHolder.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointIHolder.java index 226664113f1..e5e8568fb65 100644 --- a/java/src/Ice/src/main/java/IceInternal/EndpointIHolder.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointIHolder.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class EndpointIHolder { diff --git a/java/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI_connectors.java index dfcdb479645..f3444ef8d94 100644 --- a/java/src/Ice/src/main/java/IceInternal/EndpointI_connectors.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EndpointI_connectors.java @@ -7,10 +7,10 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface EndpointI_connectors { void connectors(java.util.List<Connector> connectors); - void exception(Ice.LocalException ex); + void exception(com.zeroc.Ice.LocalException ex); } diff --git a/java/src/Ice/src/main/java/IceInternal/EventHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandler.java index 06fab81e580..f7e1a24e5cc 100644 --- a/java/src/Ice/src/main/java/IceInternal/EventHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandler.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public abstract class EventHandler { diff --git a/java/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandlerOpPair.java index 37deadd0ff4..bef7d5e9cf6 100644 --- a/java/src/Ice/src/main/java/IceInternal/EventHandlerOpPair.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/EventHandlerOpPair.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class EventHandlerOpPair { diff --git a/java/src/Ice/src/main/java/IceInternal/Ex.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java index dcffe92be76..0880a697bae 100644 --- a/java/src/Ice/src/main/java/IceInternal/Ex.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Ex.java @@ -7,32 +7,32 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class Ex { - public static void throwUOE(String expectedType, Ice.Object v) + public static void throwUOE(String expectedType, com.zeroc.Ice.Value v) { // // If the object is an unknown sliced object, we didn't find an // value factory, in this case raise a NoValueFactoryException // instead. // - if(v instanceof Ice.UnknownSlicedValue) + if(v instanceof com.zeroc.Ice.UnknownSlicedValue) { - Ice.UnknownSlicedValue usv = (Ice.UnknownSlicedValue)v; - throw new Ice.NoValueFactoryException("", usv.getUnknownTypeId()); + com.zeroc.Ice.UnknownSlicedValue usv = (com.zeroc.Ice.UnknownSlicedValue)v; + throw new com.zeroc.Ice.NoValueFactoryException("", usv.getUnknownTypeId()); } String type = v.ice_id(); - throw new Ice.UnexpectedObjectException("expected element of type `" + expectedType + "' but received '" + - type, type, expectedType); + throw new com.zeroc.Ice.UnexpectedObjectException( + "expected element of type `" + expectedType + "' but received '" + type, type, expectedType); } public static void throwMemoryLimitException(int requested, int maximum) { - throw new Ice.MemoryLimitException("requested " + requested + " bytes, maximum allowed is " + maximum + - " bytes (see Ice.MessageSizeMax)"); + throw new com.zeroc.Ice.MemoryLimitException( + "requested " + requested + " bytes, maximum allowed is " + maximum + " bytes (see Ice.MessageSizeMax)"); } // diff --git a/java/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java index 1944656bcfa..33da39b01dd 100644 --- a/java/src/Ice/src/main/java/IceInternal/FactoryACMMonitor.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FactoryACMMonitor.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class FactoryACMMonitor implements ACMMonitor { static class Change { - Change(Ice.ConnectionI connection, boolean remove) + Change(com.zeroc.Ice.ConnectionI connection, boolean remove) { this.connection = connection; this.remove = remove; } - final Ice.ConnectionI connection; + final com.zeroc.Ice.ConnectionI connection; final boolean remove; } @@ -36,10 +36,10 @@ class FactoryACMMonitor implements ACMMonitor { try { - IceUtilInternal.Assert.FinalizerAssert(_instance == null); - IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty()); - IceUtilInternal.Assert.FinalizerAssert(_changes.isEmpty()); - IceUtilInternal.Assert.FinalizerAssert(_reapedConnections.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_instance == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_changes.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_reapedConnections.isEmpty()); } catch(java.lang.Exception ex) { @@ -64,7 +64,7 @@ class FactoryACMMonitor implements ACMMonitor @Override public void - add(Ice.ConnectionI connection) + add(com.zeroc.Ice.ConnectionI connection) { if(_config.timeout == 0) { @@ -95,7 +95,7 @@ class FactoryACMMonitor implements ACMMonitor @Override public void - remove(Ice.ConnectionI connection) + remove(com.zeroc.Ice.ConnectionI connection) { if(_config.timeout == 0) { @@ -111,27 +111,28 @@ class FactoryACMMonitor implements ACMMonitor @Override public synchronized void - reap(Ice.ConnectionI connection) + reap(com.zeroc.Ice.ConnectionI connection) { _reapedConnections.add(connection); } @Override public synchronized ACMMonitor - acm(Ice.IntOptional timeout, Ice.Optional<Ice.ACMClose> close, Ice.Optional<Ice.ACMHeartbeat> heartbeat) + acm(java.util.OptionalInt timeout, java.util.Optional<com.zeroc.Ice.ACMClose> close, + java.util.Optional<com.zeroc.Ice.ACMHeartbeat> heartbeat) { assert(_instance != null); ACMConfig config = _config.clone(); - if(timeout != null && timeout.isSet()) + if(timeout != null && timeout.isPresent()) { - config.timeout = timeout.get() * 1000; // To milliseconds + config.timeout = timeout.getAsInt() * 1000; // To milliseconds } - if(close != null && close.isSet()) + if(close != null && close.isPresent()) { config.close = close.get(); } - if(heartbeat != null && heartbeat.isSet()) + if(heartbeat != null && heartbeat.isPresent()) { config.heartbeat = heartbeat.get(); } @@ -139,25 +140,25 @@ class FactoryACMMonitor implements ACMMonitor } @Override - public Ice.ACM + public com.zeroc.Ice.ACM getACM() { - Ice.ACM acm = new Ice.ACM(); + com.zeroc.Ice.ACM acm = new com.zeroc.Ice.ACM(); acm.timeout = _config.timeout / 1000; acm.close = _config.close; acm.heartbeat = _config.heartbeat; return acm; } - synchronized java.util.List<Ice.ConnectionI> + synchronized java.util.List<com.zeroc.Ice.ConnectionI> swapReapedConnections() { if(_reapedConnections.isEmpty()) { return null; } - java.util.List<Ice.ConnectionI> connections = _reapedConnections; - _reapedConnections = new java.util.ArrayList<Ice.ConnectionI>(); + java.util.List<com.zeroc.Ice.ConnectionI> connections = _reapedConnections; + _reapedConnections = new java.util.ArrayList<>(); return connections; } @@ -198,7 +199,7 @@ class FactoryACMMonitor implements ACMMonitor // that connections can be added or removed during monitoring. // long now = Time.currentMonotonicTimeMillis(); - for(Ice.ConnectionI connection : _connections) + for(com.zeroc.Ice.ConnectionI connection : _connections) { try { @@ -224,9 +225,9 @@ class FactoryACMMonitor implements ACMMonitor private Instance _instance; final private ACMConfig _config; - private java.util.Set<Ice.ConnectionI> _connections = new java.util.HashSet<Ice.ConnectionI>(); - private java.util.List<Change> _changes = new java.util.ArrayList<Change>(); - private java.util.List<Ice.ConnectionI> _reapedConnections = new java.util.ArrayList<Ice.ConnectionI>(); + private java.util.Set<com.zeroc.Ice.ConnectionI> _connections = new java.util.HashSet<>(); + private java.util.List<Change> _changes = new java.util.ArrayList<>(); + private java.util.List<com.zeroc.Ice.ConnectionI> _reapedConnections = new java.util.ArrayList<>(); private java.util.concurrent.Future<?> _future; } diff --git a/java/src/Ice/src/main/java/IceInternal/FixedReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java index 6ae5fe1b4c2..a861857bf4d 100644 --- a/java/src/Ice/src/main/java/IceInternal/FixedReference.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/FixedReference.java @@ -7,21 +7,22 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class FixedReference extends Reference { public FixedReference(Instance instance, - Ice.Communicator communicator, - Ice.Identity identity, + com.zeroc.Ice.Communicator communicator, + com.zeroc.Ice.Identity identity, String facet, int mode, boolean secure, - Ice.EncodingVersion encoding, - Ice.ConnectionI connection) + com.zeroc.Ice.EncodingVersion encoding, + com.zeroc.Ice.ConnectionI connection) { - super(instance, communicator, identity, facet, mode, secure, Ice.Util.Protocol_1_0, encoding, -1, null); + super(instance, communicator, identity, facet, mode, secure, com.zeroc.Ice.Util.Protocol_1_0, encoding, -1, + null); _fixedConnection = connection; } @@ -75,10 +76,10 @@ public class FixedReference extends Reference } @Override - public final Ice.EndpointSelectionType + public final com.zeroc.Ice.EndpointSelectionType getEndpointSelection() { - return Ice.EndpointSelectionType.Random; + return com.zeroc.Ice.EndpointSelectionType.Random; } @Override @@ -99,77 +100,77 @@ public class FixedReference extends Reference public Reference changeEndpoints(EndpointI[] newEndpoints) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference changeAdapterId(String newAdapterId) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference - changeLocator(Ice.LocatorPrx newLocator) + changeLocator(com.zeroc.Ice.LocatorPrx newLocator) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference - changeRouter(Ice.RouterPrx newRouter) + changeRouter(com.zeroc.Ice.RouterPrx newRouter) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference changeCollocationOptimized(boolean newCollocationOptimized) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public final Reference changeCacheConnection(boolean newCache) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference changePreferSecure(boolean prefSec) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public final Reference - changeEndpointSelection(Ice.EndpointSelectionType newType) + changeEndpointSelection(com.zeroc.Ice.EndpointSelectionType newType) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference changeLocatorCacheTimeout(int newTimeout) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference changeTimeout(int newTimeout) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public Reference changeConnectionId(String connectionId) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override @@ -188,30 +189,30 @@ public class FixedReference extends Reference @Override public void - streamWrite(Ice.OutputStream s) - throws Ice.MarshalException + streamWrite(com.zeroc.Ice.OutputStream s) + throws com.zeroc.Ice.MarshalException { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public String toString() - throws Ice.MarshalException + throws com.zeroc.Ice.MarshalException { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public java.util.Map<String, String> toProperty(String prefix) { - throw new Ice.FixedProxyException(); + throw new com.zeroc.Ice.FixedProxyException(); } @Override public RequestHandler - getRequestHandler(Ice.ObjectPrxHelperBase proxy) + getRequestHandler(com.zeroc.Ice._ObjectPrxI proxy) { switch(getMode()) { @@ -221,7 +222,7 @@ public class FixedReference extends Reference { if(_fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new com.zeroc.Ice.NoEndpointException(""); } break; } @@ -231,7 +232,7 @@ public class FixedReference extends Reference { if(!_fixedConnection.endpoint().datagram()) { - throw new Ice.NoEndpointException(""); + throw new com.zeroc.Ice.NoEndpointException(""); } break; } @@ -253,7 +254,7 @@ public class FixedReference extends Reference } if(secure && !_fixedConnection.endpoint().secure()) { - throw new Ice.NoEndpointException(""); + throw new com.zeroc.Ice.NoEndpointException(""); } _fixedConnection.throwException(); // Throw in case our connection is already destroyed. @@ -314,6 +315,6 @@ public class FixedReference extends Reference return super.hashCode(); } - private Ice.ConnectionI _fixedConnection; + private com.zeroc.Ice.ConnectionI _fixedConnection; private static EndpointI[] _emptyEndpoints = new EndpointI[0]; } diff --git a/java/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HTTPNetworkProxy.java index 1214731fbea..0cf95aa34e2 100644 --- a/java/src/Ice/src/main/java/IceInternal/HTTPNetworkProxy.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HTTPNetworkProxy.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class HTTPNetworkProxy implements NetworkProxy { @@ -92,7 +92,7 @@ public final class HTTPNetworkProxy implements NetworkProxy parser.parse(readBuffer.b, 0, readBuffer.b.position()); if(parser.status() != 200) { - throw new Ice.ConnectFailedException(); + throw new com.zeroc.Ice.ConnectFailedException(); } } @@ -103,7 +103,7 @@ public final class HTTPNetworkProxy implements NetworkProxy return new HTTPNetworkProxy(Network.getAddresses(_host, _port, protocol, - Ice.EndpointSelectionType.Random, + com.zeroc.Ice.EndpointSelectionType.Random, false, true).get(0), protocol); diff --git a/java/src/Ice/src/main/java/IceInternal/HashUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HashUtil.java index fc931e8294f..8c88f0d6695 100644 --- a/java/src/Ice/src/main/java/IceInternal/HashUtil.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HashUtil.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class HashUtil { diff --git a/java/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Holder.java index cccbd04fe42..bd21a9a2042 100644 --- a/java/src/Ice/src/main/java/Ice/TwowayCallbackByteUE.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Holder.java @@ -7,9 +7,18 @@ // // ********************************************************************** -package Ice; +package com.zeroc.IceInternal; -public interface TwowayCallbackByteUE extends TwowayCallbackByte +public class Holder<T> { - void exception(Ice.UserException ex); + public Holder() + { + } + + public Holder(T value) + { + this.value = value; + } + + public T value; } diff --git a/java/src/Ice/src/main/java/IceInternal/HttpParser.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HttpParser.java index 999b2a62430..ebaed1fe646 100644 --- a/java/src/Ice/src/main/java/IceInternal/HttpParser.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/HttpParser.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class HttpParser { @@ -667,7 +667,7 @@ final class HttpParser java.util.Map<String, String> getHeaders() { - java.util.Map<String, String> headers = new java.util.HashMap<String, String>(); + java.util.Map<String, String> headers = new java.util.HashMap<>(); for(java.util.Map.Entry<String, String> entry : _headers.entrySet()) { headers.put(_headerNames.get(entry.getKey()), entry.getValue().trim()); // Return original header name. @@ -680,8 +680,8 @@ final class HttpParser private StringBuffer _method = new StringBuffer(); private StringBuffer _uri = new StringBuffer(); - private java.util.Map<String, String> _headers = new java.util.HashMap<String, String>(); - private java.util.Map<String, String> _headerNames = new java.util.HashMap<String, String>(); + private java.util.Map<String, String> _headers = new java.util.HashMap<>(); + private java.util.Map<String, String> _headerNames = new java.util.HashMap<>(); private String _headerName = ""; private int _versionMajor; diff --git a/java/src/Ice/src/main/java/IceInternal/IPEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IPEndpointI.java index 7a6057800c6..89f3d8855af 100644 --- a/java/src/Ice/src/main/java/IceInternal/IPEndpointI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IPEndpointI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public abstract class IPEndpointI extends EndpointI { @@ -32,7 +32,7 @@ public abstract class IPEndpointI extends EndpointI _hashInitialized = false; } - protected IPEndpointI(ProtocolInstance instance, Ice.InputStream s) + protected IPEndpointI(ProtocolInstance instance, com.zeroc.Ice.InputStream s) { _instance = instance; _host = s.readString(); @@ -43,9 +43,9 @@ public abstract class IPEndpointI extends EndpointI } @Override - public Ice.EndpointInfo getInfo() + public com.zeroc.Ice.EndpointInfo getInfo() { - Ice.IPEndpointInfo info = new Ice.IPEndpointInfo() + com.zeroc.Ice.IPEndpointInfo info = new com.zeroc.Ice.IPEndpointInfo() { @Override public short type() @@ -107,7 +107,7 @@ public abstract class IPEndpointI extends EndpointI } @Override - public void connectors_async(Ice.EndpointSelectionType selType, EndpointI_connectors callback) + public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, EndpointI_connectors callback) { _instance.resolve(_host, _port, selType, this, callback); } @@ -115,7 +115,7 @@ public abstract class IPEndpointI extends EndpointI @Override public java.util.List<EndpointI> expand() { - java.util.List<EndpointI> endps = new java.util.ArrayList<EndpointI>(); + java.util.List<EndpointI> endps = new java.util.ArrayList<>(); java.util.List<String> hosts = Network.getHostsForEndpointExpand(_host, _instance.protocolSupport(), false); if(hosts == null || hosts.isEmpty()) { @@ -146,7 +146,7 @@ public abstract class IPEndpointI extends EndpointI public java.util.List<Connector> connectors(java.util.List<java.net.InetSocketAddress> addresses, NetworkProxy proxy) { - java.util.List<Connector> connectors = new java.util.ArrayList<Connector>(); + java.util.List<Connector> connectors = new java.util.ArrayList<>(); for(java.net.InetSocketAddress p : addresses) { connectors.add(createConnector(p, proxy)); @@ -243,7 +243,7 @@ public abstract class IPEndpointI extends EndpointI } @Override - public void streamWriteImpl(Ice.OutputStream s) + public void streamWriteImpl(com.zeroc.Ice.OutputStream s) { s.writeString(_host); s.writeInt(_port); @@ -261,7 +261,7 @@ public abstract class IPEndpointI extends EndpointI return h; } - public void fillEndpointInfo(Ice.IPEndpointInfo info) + public void fillEndpointInfo(com.zeroc.Ice.IPEndpointInfo info) { info.timeout = timeout(); info.compress = compress(); @@ -286,7 +286,8 @@ public abstract class IPEndpointI extends EndpointI } else { - throw new Ice.EndpointParseException("`-h *' not valid for proxy endpoint `" + toString() + "'"); + throw new com.zeroc.Ice.EndpointParseException( + "`-h *' not valid for proxy endpoint `" + toString() + "'"); } } @@ -304,8 +305,8 @@ public abstract class IPEndpointI extends EndpointI } else if(oaEndpoint) { - throw new Ice.EndpointParseException("`--sourceAddress' not valid for object adapter endpoint `" + - toString() + "'"); + throw new com.zeroc.Ice.EndpointParseException( + "`--sourceAddress' not valid for object adapter endpoint `" + toString() + "'"); } } @@ -316,7 +317,8 @@ public abstract class IPEndpointI extends EndpointI { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -h option in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException( + "no argument provided for -h option in endpoint " + endpoint); } _host = argument; } @@ -324,7 +326,8 @@ public abstract class IPEndpointI extends EndpointI { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -p option in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException( + "no argument provided for -p option in endpoint " + endpoint); } try @@ -333,27 +336,27 @@ public abstract class IPEndpointI extends EndpointI } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException("invalid port value `" + argument + - "' in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException( + "invalid port value `" + argument + "' in endpoint " + endpoint); } if(_port < 0 || _port > 65535) { - throw new Ice.EndpointParseException("port value `" + argument + - "' out of range in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException( + "port value `" + argument + "' out of range in endpoint " + endpoint); } } else if(option.equals("--sourceAddress")) { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for --sourceAddress option in endpoint " + - endpoint); + throw new com.zeroc.Ice.EndpointParseException( + "no argument provided for --sourceAddress option in endpoint " + endpoint); } _sourceAddr = Network.getNumericAddress(argument); if(_sourceAddr == null) { - throw new Ice.EndpointParseException( + throw new com.zeroc.Ice.EndpointParseException( "invalid IP address provided for --sourceAddress option in endpoint " + endpoint); } } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java new file mode 100644 index 00000000000..7ca1acc5465 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Incoming.java @@ -0,0 +1,896 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +import com.zeroc.Ice.ConnectionInfo; +import com.zeroc.Ice.Current; +import com.zeroc.Ice.FormatType; +import com.zeroc.Ice.Instrumentation.CommunicatorObserver; +import com.zeroc.Ice.Instrumentation.DispatchObserver; +import com.zeroc.Ice.InputStream; +import com.zeroc.Ice.IPConnectionInfo; +import com.zeroc.Ice.MarshaledResult; +import com.zeroc.Ice.OutputStream; +import com.zeroc.Ice.ServantLocator; +import com.zeroc.Ice.Util; + +final public class Incoming implements com.zeroc.Ice.Request +{ + public Incoming(Instance instance, ResponseHandler responseHandler, com.zeroc.Ice.ConnectionI connection, + com.zeroc.Ice.ObjectAdapter adapter, boolean response, byte compress, int requestId) + { + _instance = instance; + _responseHandler = responseHandler; + _response = response; + _compress = compress; + + _current = new Current(); + _current.id = new com.zeroc.Ice.Identity(); + _current.adapter = adapter; + _current.con = connection; + _current.requestId = requestId; + + _cookie = null; + } + + // + // These functions allow this object to be reused, rather than reallocated. + // + public void reset(Instance instance, ResponseHandler handler, com.zeroc.Ice.ConnectionI connection, + com.zeroc.Ice.ObjectAdapter adapter, boolean response, byte compress, int requestId) + { + _instance = instance; + _responseHandler = handler; + _response = response; + _compress = compress; + + // + // Don't recycle the Current object, because servants may keep a reference to it. + // + _current = new Current(); + _current.id = new com.zeroc.Ice.Identity(); + _current.adapter = adapter; + _current.con = connection; + _current.requestId = requestId; + + assert(_cookie == null); + + _inParamPos = -1; + } + + public boolean reclaim() + { + if(_responseHandler != null) // Async dispatch not ready for being reclaimed! + { + return false; + } + + _current = null; + _servant = null; + _locator = null; + _cookie = null; + + //_observer = null; + assert(_observer == null); + + if(_os != null) + { + _os.reset(); + } + + _is = null; + + //_responseHandler = null; + assert(_responseHandler == null); + + _inParamPos = -1; + + return true; + } + + @Override + public Current getCurrent() + { + return _current; + } + + public void invoke(ServantManager servantManager, InputStream stream) + { + _is = stream; + + int start = _is.pos(); + + // + // Read the current. + // + _current.id.ice_read(_is); + + // + // For compatibility with the old FacetPath. + // + String[] facetPath = _is.readStringSeq(); + if(facetPath.length > 0) + { + if(facetPath.length > 1) + { + throw new com.zeroc.Ice.MarshalException(); + } + _current.facet = facetPath[0]; + } + else + { + _current.facet = ""; + } + + _current.operation = _is.readString(); + _current.mode = com.zeroc.Ice.OperationMode.values()[_is.readByte()]; + _current.ctx = new java.util.HashMap<>(); + int sz = _is.readSize(); + while(sz-- > 0) + { + String first = _is.readString(); + String second = _is.readString(); + _current.ctx.put(first, second); + } + + CommunicatorObserver obsv = _instance.initializationData().observer; + if(obsv != null) + { + // Read the parameter encapsulation size. + int size = _is.readInt(); + _is.pos(_is.pos() - 4); + + _observer = obsv.getDispatchObserver(_current, _is.pos() - start + size); + if(_observer != null) + { + _observer.attach(); + } + } + + // + // Don't put the code above into the try block below. Exceptions + // in the code above are considered fatal, and must propagate to + // the caller of this operation. + // + + if(servantManager != null) + { + _servant = servantManager.findServant(_current.id, _current.facet); + if(_servant == null) + { + _locator = servantManager.findServantLocator(_current.id.category); + if(_locator == null && _current.id.category.length() > 0) + { + _locator = servantManager.findServantLocator(""); + } + + if(_locator != null) + { + try + { + ServantLocator.LocateResult r = _locator.locate(_current); + _servant = r.returnValue; + _cookie = r.cookie; + } + catch(Throwable ex) + { + skipReadParams(); // Required for batch requests. + handleException(ex, false); + return; + } + } + } + } + + if(_servant == null) + { + try + { + // + // Skip the input parameters, this is required for reading + // the next batch request if dispatching batch requests. + // + _is.skipEncapsulation(); + + if(servantManager != null && servantManager.hasServant(_current.id)) + { + throw new com.zeroc.Ice.FacetNotExistException(_current.id, _current.facet, _current.operation); + } + else + { + throw new com.zeroc.Ice.ObjectNotExistException(_current.id, _current.facet, _current.operation); + } + } + catch(Throwable ex) + { + handleException(ex, false); + return; + } + } + + try + { + if(_instance.useApplicationClassLoader()) + { + Thread.currentThread().setContextClassLoader(_servant.getClass().getClassLoader()); + } + + try + { + CompletionStage<OutputStream> f = _servant.__dispatch(this, _current); + if(f == null) + { + completed(null, false); + } + else + { + f.whenComplete((result, ex) -> + { + if(ex != null) + { + completed(ex, true); // true = asynchronous + } + else + { + _os = result; + completed(null, true); // true = asynchronous + } + }); + } + } + finally + { + if(_instance.useApplicationClassLoader()) + { + Thread.currentThread().setContextClassLoader(null); + } + } + } + catch(Throwable ex) + { + completed(ex, false); + } + } + + public CompletionStage<OutputStream> setResult(OutputStream os) + { + _os = os; + return null; // Response is cached in the Incoming to not have to create unnecessary future + } + + @FunctionalInterface + public static interface Write<T> + { + void write(OutputStream os, T v); + } + + public <T> CompletionStage<OutputStream> setResultFuture(CompletionStage<T> f, Write<T> write) + { + final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>(); + f.whenComplete((result, ex) -> + { + if(ex != null) + { + r.completeExceptionally(ex); + } + else + { + OutputStream os = startWriteParams(); + write.write(os, result); + endWriteParams(os); + r.complete(os); + } + }); + return r; + } + + public CompletionStage<OutputStream> setResultFuture(CompletionStage<Void> f) + { + final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>(); + f.whenComplete((result, ex) -> + { + if(ex != null) + { + r.completeExceptionally(ex); + } + else + { + r.complete(writeEmptyParams()); + } + }); + return r; + } + + public CompletionStage<OutputStream> setMarshaledResult(MarshaledResult result) + { + _os = result.getOutputStream(); + return null; // Response is cached in the Incoming to not have to create unnecessary future + } + + public <T extends MarshaledResult> CompletionStage<OutputStream> + setMarshaledResultFuture(CompletionStage<T> f) + { + final CompletableFuture<OutputStream> r = new CompletableFuture<OutputStream>(); + f.whenComplete((result, ex) -> + { + if(ex != null) + { + r.completeExceptionally(ex); + } + else + { + r.complete(result.getOutputStream()); + } + }); + return r; + } + + public void completed(Throwable exc, boolean amd) + { + try + { + if(_locator != null) + { + assert(_locator != null && _servant != null); + try + { + _locator.finished(_current, _servant, _cookie); + } + catch(Throwable ex) + { + handleException(ex, amd); + return; + } + } + + assert(_responseHandler != null); + + if(exc != null) + { + handleException(exc, amd); + } + else if(_response) + { + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(com.zeroc.Ice.LocalException ex) + { + _responseHandler.invokeException(_current.requestId, ex, 1, amd); + } + finally + { + if(_observer != null) + { + _observer.detach(); + _observer = null; + } + _responseHandler = null; + } + } + + public final void startOver() + { + if(_inParamPos == -1) + { + // + // That's the first startOver, so almost nothing to do + // + _inParamPos = _is.pos(); + } + else + { + // + // Let's rewind _is and clean-up _os + // + _is.pos(_inParamPos); + } + } + + public void skipReadParams() + { + // + // Remember the encoding used by the input parameters, we'll + // encode the response parameters with the same encoding. + // + _current.encoding = _is.skipEncapsulation(); + } + + public InputStream startReadParams() + { + // + // Remember the encoding used by the input parameters, we'll + // encode the response parameters with the same encoding. + // + _current.encoding = _is.startEncapsulation(); + return _is; + } + + public void endReadParams() + { + _is.endEncapsulation(); + } + + public void readEmptyParams() + { + _current.encoding = _is.skipEmptyEncapsulation(); + } + + public byte[] readParamEncaps() + { + _current.encoding = new com.zeroc.Ice.EncodingVersion(); + return _is.readEncapsulation(_current.encoding); + } + + public void setFormat(FormatType format) + { + if(format == null) + { + format = FormatType.DefaultFormat; + } + _format = format; + } + + static public OutputStream createResponseOutputStream(Current current) + { + OutputStream os = new OutputStream(current.adapter.getCommunicator(), Protocol.currentProtocolEncoding); + os.writeBlob(Protocol.replyHdr); + os.writeInt(current.requestId); + os.writeByte(ReplyStatus.replyOK); + return os; + } + + public com.zeroc.Ice.OutputStream startWriteParams() + { + if(!_response) + { + throw new com.zeroc.Ice.MarshalException("can't marshal out parameters for oneway dispatch"); + } + + OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + os.writeBlob(Protocol.replyHdr); + os.writeInt(_current.requestId); + os.writeByte(ReplyStatus.replyOK); + os.startEncapsulation(_current.encoding, _format); + return os; + } + + public void endWriteParams(OutputStream os) + { + if(_response) + { + os.endEncapsulation(); + } + } + + public OutputStream writeEmptyParams() + { + if(_response) + { + OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + os.writeBlob(Protocol.replyHdr); + os.writeInt(_current.requestId); + os.writeByte(ReplyStatus.replyOK); + os.writeEmptyEncapsulation(_current.encoding); + return os; + } + else + { + return null; + } + } + + public OutputStream writeParamEncaps(byte[] v, boolean ok) + { + if(!ok && _observer != null) + { + _observer.userException(); + } + + if(_response) + { + OutputStream os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + os.writeBlob(Protocol.replyHdr); + os.writeInt(_current.requestId); + os.writeByte(ok ? ReplyStatus.replyOK : ReplyStatus.replyUserException); + if(v == null || v.length == 0) + { + os.writeEmptyEncapsulation(_current.encoding); + } + else + { + os.writeEncapsulation(v); + } + return os; + } + else + { + return null; + } + } + + private void warning(Throwable ex) + { + assert(_instance != null); + + java.io.StringWriter sw = new java.io.StringWriter(); + java.io.PrintWriter pw = new java.io.PrintWriter(sw); + com.zeroc.IceUtilInternal.OutputBase out = new com.zeroc.IceUtilInternal.OutputBase(pw); + out.setUseTab(false); + out.print("dispatch exception:"); + out.print("\nidentity: " + Util.identityToString(_current.id)); + out.print("\nfacet: " + com.zeroc.IceUtilInternal.StringUtil.escapeString(_current.facet, "")); + out.print("\noperation: " + _current.operation); + if(_current.con != null) + { + for(ConnectionInfo connInfo = _current.con.getInfo(); connInfo != null; connInfo = connInfo.underlying) + { + if(connInfo instanceof IPConnectionInfo) + { + IPConnectionInfo ipConnInfo = (IPConnectionInfo)connInfo; + out.print("\nremote host: " + ipConnInfo.remoteAddress + " remote port: " + ipConnInfo.remotePort); + } + } + } + out.print("\n"); + ex.printStackTrace(pw); + pw.flush(); + _instance.initializationData().logger.warning(sw.toString()); + } + + private void handleException(Throwable exc, boolean amd) + { + assert(_responseHandler != null); + + try + { + throw exc; + } + catch(com.zeroc.Ice.RequestFailedException ex) + { + if(ex.id == null || ex.id.name == null || ex.id.name.isEmpty()) + { + ex.id = _current.id; + } + + if(ex.facet == null || ex.facet.isEmpty()) + { + ex.facet = _current.facet; + } + + if(ex.operation == null || ex.operation.length() == 0) + { + ex.operation = _current.operation; + } + + if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) + { + warning(ex); + } + + if(_observer != null) + { + _observer.failed(ex.ice_id()); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) + { + _os.writeByte(ReplyStatus.replyObjectNotExist); + } + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) + { + _os.writeByte(ReplyStatus.replyFacetNotExist); + } + else if(ex instanceof com.zeroc.Ice.OperationNotExistException) + { + _os.writeByte(ReplyStatus.replyOperationNotExist); + } + else + { + assert(false); + } + ex.id.ice_write(_os); + + // + // For compatibility with the old FacetPath. + // + if(ex.facet == null || ex.facet.length() == 0) + { + _os.writeStringSeq(null); + } + else + { + String[] facetPath2 = { ex.facet }; + _os.writeStringSeq(facetPath2); + } + + _os.writeString(ex.operation); + + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(com.zeroc.Ice.UnknownLocalException ex) + { + if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + warning(ex); + } + + if(_observer != null) + { + _observer.failed(ex.ice_id()); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + _os.writeByte(ReplyStatus.replyUnknownLocalException); + _os.writeString(ex.unknown); + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(com.zeroc.Ice.UnknownUserException ex) + { + if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + warning(ex); + } + + if(_observer != null) + { + _observer.failed(ex.ice_id()); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + _os.writeByte(ReplyStatus.replyUnknownUserException); + _os.writeString(ex.unknown); + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(com.zeroc.Ice.UnknownException ex) + { + if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + warning(ex); + } + + if(_observer != null) + { + _observer.failed(ex.ice_id()); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + _os.writeByte(ReplyStatus.replyUnknownException); + _os.writeString(ex.unknown); + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(com.zeroc.Ice.UserException ex) + { + if(_observer != null) + { + _observer.userException(); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + _os.writeByte(ReplyStatus.replyUserException); + _os.startEncapsulation(_current.encoding, _format); + _os.writeException(ex); + _os.endEncapsulation(); + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, false); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(com.zeroc.Ice.Exception ex) + { + if(ex instanceof com.zeroc.Ice.SystemException) + { + if(_responseHandler.systemException(_current.requestId, (com.zeroc.Ice.SystemException)ex, amd)) + { + return; + } + } + + if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + warning(ex); + } + + if(_observer != null) + { + _observer.failed(ex.ice_id()); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + _os.writeByte(ReplyStatus.replyUnknownLocalException); + //_os.writeString(ex.toString()); + java.io.StringWriter sw = new java.io.StringWriter(); + sw.write(ex.ice_id() + "\n"); + java.io.PrintWriter pw = new java.io.PrintWriter(sw); + ex.printStackTrace(pw); + pw.flush(); + _os.writeString(sw.toString()); + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + catch(ExecutionException ex) + { + // + // Raised by CompletableFuture.get(). The inner exception caused the future to complete exceptionally. + // Recurse with the inner exception. + // + handleException(ex.getCause(), amd); + return; + } + catch(java.lang.Error ex) + { + com.zeroc.Ice.UnknownException uex = new com.zeroc.Ice.UnknownException(exc); + java.io.StringWriter sw = new java.io.StringWriter(); + java.io.PrintWriter pw = new java.io.PrintWriter(sw); + exc.printStackTrace(pw); + pw.flush(); + uex.unknown = sw.toString(); + + handleException(uex, amd); + + throw new ServantError(exc); + } + catch(Throwable ex) + { + if(_instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + warning(ex); + } + + if(_observer != null) + { + _observer.failed(ex.getClass().getName()); + } + + if(_response) + { + assert(_responseHandler != null && _current != null); + _os = new OutputStream(_instance, Protocol.currentProtocolEncoding); + _os.writeBlob(Protocol.replyHdr); + _os.writeInt(_current.requestId); + _os.writeByte(ReplyStatus.replyUnknownException); + //_os.writeString(ex.toString()); + java.io.StringWriter sw = new java.io.StringWriter(); + java.io.PrintWriter pw = new java.io.PrintWriter(sw); + ex.printStackTrace(pw); + pw.flush(); + _os.writeString(sw.toString()); + if(_observer != null) + { + _observer.reply(_os.size() - Protocol.headerSize - 4); + } + _responseHandler.sendResponse(_current.requestId, _os, _compress, amd); + } + else + { + _responseHandler.sendNoResponse(); + } + } + + if(_observer != null) + { + _observer.detach(); + _observer = null; + } + _responseHandler = null; + } + + private Instance _instance; + private Current _current; + private com.zeroc.Ice.Object _servant; + private ServantLocator _locator; + private java.lang.Object _cookie; + private DispatchObserver _observer; + private ResponseHandler _responseHandler; + + private boolean _response; + private byte _compress; + private FormatType _format = FormatType.DefaultFormat; + + private OutputStream _os; + private InputStream _is; + + private int _inParamPos = -1; + + public Incoming next; // For use by ConnectionI. +} diff --git a/java/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java index 2a6b69935a3..cc98bfe0394 100644 --- a/java/src/Ice/src/main/java/IceInternal/IncomingConnectionFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/IncomingConnectionFactory.java @@ -7,9 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -public final class IncomingConnectionFactory extends EventHandler implements Ice.ConnectionI.StartCallback +import com.zeroc.Ice.ConnectionI; + +public final class IncomingConnectionFactory extends EventHandler implements ConnectionI.StartCallback { public synchronized void activate() @@ -32,7 +34,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice public synchronized void updateConnectionObservers() { - for(Ice.ConnectionI connection : _connections) + for(ConnectionI connection : _connections) { connection.updateObserver(); } @@ -42,7 +44,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice waitUntilHolding() throws InterruptedException { - java.util.LinkedList<Ice.ConnectionI> connections; + java.util.LinkedList<ConnectionI> connections; synchronized(this) { @@ -59,13 +61,13 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // We want to wait until all connections are in holding state // outside the thread synchronization. // - connections = new java.util.LinkedList<Ice.ConnectionI>(_connections); + connections = new java.util.LinkedList<>(_connections); } // // Now we wait until each connection is in holding state. // - for(Ice.ConnectionI connection : connections) + for(ConnectionI connection : connections) { connection.waitUntilHolding(); } @@ -75,7 +77,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice waitUntilFinished() throws InterruptedException { - java.util.LinkedList<Ice.ConnectionI> connections = null; + java.util.LinkedList<ConnectionI> connections = null; synchronized(this) { @@ -97,12 +99,12 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // We want to wait until all connections are finished outside the // thread synchronization. // - connections = new java.util.LinkedList<Ice.ConnectionI>(_connections); + connections = new java.util.LinkedList<>(_connections); } if(connections != null) { - for(Ice.ConnectionI connection : connections) + for(ConnectionI connection : connections) { try { @@ -113,7 +115,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // // Force close all of the connections. // - for(Ice.ConnectionI c : connections) + for(ConnectionI c : connections) { c.close(true); } @@ -131,7 +133,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice else { // Ensure all the connections are finished and reapable at this point. - java.util.List<Ice.ConnectionI> cons = _monitor.swapReapedConnections(); + java.util.List<ConnectionI> cons = _monitor.swapReapedConnections(); assert((cons == null ? 0 : cons.size()) == _connections.size()); if(cons != null) { @@ -150,15 +152,15 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice return _endpoint; } - public synchronized java.util.LinkedList<Ice.ConnectionI> + public synchronized java.util.LinkedList<ConnectionI> connections() { - java.util.LinkedList<Ice.ConnectionI> connections = new java.util.LinkedList<Ice.ConnectionI>(); + java.util.LinkedList<ConnectionI> connections = new java.util.LinkedList<>(); // // Only copy connections which have not been destroyed. // - for(Ice.ConnectionI connection : _connections) + for(ConnectionI connection : _connections) { if(connection.isActiveOrHolding()) { @@ -172,13 +174,13 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice public void flushAsyncBatchRequests(CommunicatorFlushBatch outAsync) { - for(Ice.ConnectionI c : connections()) // connections() is synchronized, no need to synchronize here. + for(ConnectionI c : connections()) // connections() is synchronized, no need to synchronize here. { try { outAsync.flushConnection(c); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // Ignore. } @@ -193,7 +195,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice public void message(ThreadPoolCurrent current) { - Ice.ConnectionI connection = null; + ConnectionI connection = null; synchronized(this) { if(_state >= StateClosed) @@ -209,10 +211,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // // Reap closed connections. // - java.util.List<Ice.ConnectionI> cons = _monitor.swapReapedConnections(); + java.util.List<ConnectionI> cons = _monitor.swapReapedConnections(); if(cons != null) { - for(Ice.ConnectionI c : cons) + for(ConnectionI c : cons) { _connections.remove(c); } @@ -235,7 +237,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice _instance.initializationData().logger.trace(_instance.traceLevels().networkCat, s.toString()); } } - catch(Ice.SocketException ex) + catch(com.zeroc.Ice.SocketException ex) { if(Network.noMoreFds(ex.getCause())) { @@ -254,7 +256,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // Ignore socket exceptions. return; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // Warn about other Ice local exceptions. if(_warn) @@ -268,16 +270,16 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice try { - connection = new Ice.ConnectionI(_adapter.getCommunicator(), _instance, _monitor, transceiver, null, + connection = new ConnectionI(_adapter.getCommunicator(), _instance, _monitor, transceiver, null, _endpoint, _adapter); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { try { transceiver.close(); } - catch(Ice.LocalException exc) + catch(com.zeroc.Ice.LocalException exc) { // Ignore } @@ -342,7 +344,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // @Override public synchronized void - connectionStartCompleted(Ice.ConnectionI connection) + connectionStartCompleted(ConnectionI connection) { // // Initially, connections are in the holding state. If the factory is active @@ -356,7 +358,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice @Override public synchronized void - connectionStartFailed(Ice.ConnectionI connection, Ice.LocalException ex) + connectionStartFailed(ConnectionI connection, com.zeroc.Ice.LocalException ex) { if(_state >= StateClosed) { @@ -368,7 +370,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice } public - IncomingConnectionFactory(Instance instance, EndpointI endpoint, Ice.ObjectAdapterI adapter) + IncomingConnectionFactory(Instance instance, EndpointI endpoint, com.zeroc.Ice.ObjectAdapterI adapter) { _instance = instance; _endpoint = endpoint; @@ -403,8 +405,8 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice } _endpoint = _transceiver.bind(); - Ice.ConnectionI connection = - new Ice.ConnectionI(_adapter.getCommunicator(), _instance, null, _transceiver, null, _endpoint, + ConnectionI connection = + new ConnectionI(_adapter.getCommunicator(), _instance, null, _transceiver, null, _endpoint, _adapter); connection.startAndWait(); @@ -426,7 +428,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice { _transceiver.close(); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { // Here we ignore any exceptions in close(). } @@ -436,17 +438,17 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice _monitor.destroy(); _connections.clear(); - if(ex instanceof Ice.LocalException) + if(ex instanceof com.zeroc.Ice.LocalException) { - throw (Ice.LocalException)ex; + throw (com.zeroc.Ice.LocalException)ex; } else if(ex instanceof InterruptedException) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } else { - throw new Ice.SyscallException(ex); + throw new com.zeroc.Ice.SyscallException(ex); } } } @@ -458,8 +460,8 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice { try { - IceUtilInternal.Assert.FinalizerAssert(_state == StateFinished); - IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_state == StateFinished); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty()); } catch(java.lang.Exception ex) { @@ -504,7 +506,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice _adapter.getThreadPool().register(this, SocketOperation.Read); } - for(Ice.ConnectionI connection : _connections) + for(ConnectionI connection : _connections) { connection.activate(); } @@ -530,7 +532,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice _adapter.getThreadPool().unregister(this, SocketOperation.Read); } - for(Ice.ConnectionI connection : _connections) + for(ConnectionI connection : _connections) { connection.hold(); } @@ -557,9 +559,9 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice state = StateFinished; } - for(Ice.ConnectionI connection : _connections) + for(ConnectionI connection : _connections) { - connection.destroy(Ice.ConnectionI.ObjectAdapterDeactivated); + connection.destroy(ConnectionI.ObjectAdapterDeactivated); } break; } @@ -635,7 +637,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice } private void - warning(Ice.LocalException ex) + warning(com.zeroc.Ice.LocalException ex) { String s = "connection exception:\n" + Ex.toString(ex) + '\n' + _acceptor.toString(); _instance.initializationData().logger.warning(s); @@ -648,11 +650,11 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice private Transceiver _transceiver; private EndpointI _endpoint; - private Ice.ObjectAdapterI _adapter; + private com.zeroc.Ice.ObjectAdapterI _adapter; private final boolean _warn; - private java.util.Set<Ice.ConnectionI> _connections = new java.util.HashSet<Ice.ConnectionI>(); + private java.util.Set<ConnectionI> _connections = new java.util.HashSet<>(); private int _state; } diff --git a/java/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InputStreamWrapper.java index 8359235b692..3e39f38c45f 100644 --- a/java/src/Ice/src/main/java/IceInternal/InputStreamWrapper.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InputStreamWrapper.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; // // Class to provide a java.io.InputStream on top of a ByteBuffer. diff --git a/java/src/Ice/src/main/java/IceInternal/Instance.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java index 30b78609ca8..d4c3663560f 100644 --- a/java/src/Ice/src/main/java/IceInternal/Instance.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Instance.java @@ -7,11 +7,13 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.concurrent.TimeUnit; -public final class Instance implements Ice.ClassResolver +import com.zeroc.Ice.Instrumentation.ThreadState; + +public final class Instance implements com.zeroc.Ice.ClassResolver { static private class ThreadObserverHelper { @@ -20,14 +22,11 @@ public final class Instance implements Ice.ClassResolver _threadName = threadName; } - synchronized public void updateObserver(Ice.Instrumentation.CommunicatorObserver obsv) + synchronized public void updateObserver(com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv) { assert(obsv != null); - _observer = obsv.getThreadObserver("Communicator", - _threadName, - Ice.Instrumentation.ThreadState.ThreadStateIdle, - _observer); + _observer = obsv.getThreadObserver("Communicator", _threadName, ThreadState.ThreadStateIdle, _observer); if(_observer != null) { _observer.attach(); @@ -39,8 +38,7 @@ public final class Instance implements Ice.ClassResolver _threadObserver = _observer; if(_threadObserver != null) { - _threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateIdle, - Ice.Instrumentation.ThreadState.ThreadStateInUseForOther); + _threadObserver.stateChanged(ThreadState.ThreadStateIdle, ThreadState.ThreadStateInUseForOther); } } @@ -48,8 +46,7 @@ public final class Instance implements Ice.ClassResolver { if(_threadObserver != null) { - _threadObserver.stateChanged(Ice.Instrumentation.ThreadState.ThreadStateInUseForOther, - Ice.Instrumentation.ThreadState.ThreadStateIdle); + _threadObserver.stateChanged(ThreadState.ThreadStateInUseForOther, ThreadState.ThreadStateIdle); _threadObserver = null; } } @@ -60,13 +57,13 @@ public final class Instance implements Ice.ClassResolver // _observer. Reference assignement is atomic in Java so it // also doesn't need to be synchronized. // - private volatile Ice.Instrumentation.ThreadObserver _observer; - private Ice.Instrumentation.ThreadObserver _threadObserver; + private volatile com.zeroc.Ice.Instrumentation.ThreadObserver _observer; + private com.zeroc.Ice.Instrumentation.ThreadObserver _threadObserver; } static private class Timer extends java.util.concurrent.ScheduledThreadPoolExecutor { - Timer(Ice.Properties props, String threadName) + Timer(com.zeroc.Ice.Properties props, String threadName) { super(1, Util.createThreadFactory(props, threadName)); // Single thread executor if(!Util.isAndroid()) @@ -78,7 +75,7 @@ public final class Instance implements Ice.ClassResolver _observerHelper = new ThreadObserverHelper(threadName); } - public void updateObserver(Ice.Instrumentation.CommunicatorObserver obsv) + public void updateObserver(com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv) { _observerHelper.updateObserver(obsv); } @@ -100,14 +97,14 @@ public final class Instance implements Ice.ClassResolver static private class QueueExecutor extends java.util.concurrent.ThreadPoolExecutor { - QueueExecutor(Ice.Properties props, String threadName) + QueueExecutor(com.zeroc.Ice.Properties props, String threadName) { super(1, 1, 0, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(), Util.createThreadFactory(props, threadName)); _observerHelper = new ThreadObserverHelper(threadName); } - public void updateObserver(Ice.Instrumentation.CommunicatorObserver obsv) + public void updateObserver(com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv) { _observerHelper.updateObserver(obsv); } @@ -138,7 +135,7 @@ public final class Instance implements Ice.ClassResolver private final ThreadObserverHelper _observerHelper; } - private class ObserverUpdaterI implements Ice.Instrumentation.ObserverUpdater + private class ObserverUpdaterI implements com.zeroc.Ice.Instrumentation.ObserverUpdater { @Override public void @@ -155,7 +152,7 @@ public final class Instance implements Ice.ClassResolver } } - public Ice.InitializationData + public com.zeroc.Ice.InitializationData initializationData() { // @@ -188,7 +185,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_routerManager != null); @@ -200,7 +197,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_locatorManager != null); @@ -212,7 +209,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_referenceFactory != null); @@ -224,7 +221,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_requestHandlerFactory != null); @@ -236,7 +233,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_proxyFactory != null); @@ -248,7 +245,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_outgoingConnectionFactory != null); @@ -260,7 +257,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_objectAdapterFactory != null); @@ -290,7 +287,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_clientThreadPool != null); @@ -302,14 +299,14 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } if(_serverThreadPool == null) // Lazy initialization. { if(_state == StateDestroyInProgress) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } int timeout = _initData.properties.getPropertyAsInt("Ice.ServerIdleTime"); @@ -324,7 +321,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_endpointHostResolver != null); @@ -336,7 +333,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_retryQueue != null); @@ -348,7 +345,7 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_timer != null); @@ -360,19 +357,19 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_endpointFactoryManager != null); return _endpointFactoryManager; } - public synchronized Ice.PluginManager + public synchronized com.zeroc.Ice.PluginManager pluginManager() { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(_pluginManager != null); @@ -414,18 +411,18 @@ public final class Instance implements Ice.ClassResolver return _serverACM; } - public Ice.ImplicitContextI + public com.zeroc.Ice.ImplicitContextI getImplicitContext() { return _implicitContext; } - public synchronized Ice.ObjectPrx - createAdmin(Ice.ObjectAdapter adminAdapter, Ice.Identity adminIdentity) + public synchronized com.zeroc.Ice.ObjectPrx + createAdmin(com.zeroc.Ice.ObjectAdapter adminAdapter, com.zeroc.Ice.Identity adminIdentity) { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } boolean createAdapter = (adminAdapter == null); @@ -434,22 +431,22 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } if(adminIdentity == null || adminIdentity.name == null || adminIdentity.name.isEmpty()) { - throw new Ice.IllegalIdentityException(adminIdentity); + throw new com.zeroc.Ice.IllegalIdentityException(adminIdentity); } if(_adminAdapter != null) { - throw new Ice.InitializationException("Admin already created"); + throw new com.zeroc.Ice.InitializationException("Admin already created"); } if(!_adminEnabled) { - throw new Ice.InitializationException("Admin is disabled"); + throw new com.zeroc.Ice.InitializationException("Admin is disabled"); } if(createAdapter) @@ -460,7 +457,7 @@ public final class Instance implements Ice.ClassResolver } else { - throw new Ice.InitializationException("Ice.Admin.Endpoints is not set"); + throw new com.zeroc.Ice.InitializationException("Ice.Admin.Endpoints is not set"); } } @@ -475,7 +472,7 @@ public final class Instance implements Ice.ClassResolver { adminAdapter.activate(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // // We cleanup _adminAdapter, however this error is not recoverable @@ -494,22 +491,22 @@ public final class Instance implements Ice.ClassResolver return adminAdapter.createProxy(adminIdentity); } - public Ice.ObjectPrx + public com.zeroc.Ice.ObjectPrx getAdmin() { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } - Ice.ObjectAdapter adminAdapter; - Ice.Identity adminIdentity; + com.zeroc.Ice.ObjectAdapter adminAdapter; + com.zeroc.Ice.Identity adminIdentity; synchronized(this) { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } if(_adminAdapter != null) @@ -526,7 +523,8 @@ public final class Instance implements Ice.ClassResolver { return null; } - adminIdentity = new Ice.Identity("admin", _initData.properties.getProperty("Ice.Admin.InstanceName")); + adminIdentity = + new com.zeroc.Ice.Identity("admin", _initData.properties.getProperty("Ice.Admin.InstanceName")); if(adminIdentity.category.isEmpty()) { adminIdentity.category = java.util.UUID.randomUUID().toString(); @@ -547,7 +545,7 @@ public final class Instance implements Ice.ClassResolver { adminAdapter.activate(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // // We cleanup _adminAdapter, however this error is not recoverable @@ -567,18 +565,18 @@ public final class Instance implements Ice.ClassResolver } public synchronized void - addAdminFacet(Ice.Object servant, String facet) + addAdminFacet(com.zeroc.Ice.Object servant, String facet) { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet))) { if(_adminFacets.get(facet) != null) { - throw new Ice.AlreadyRegisteredException("facet", facet); + throw new com.zeroc.Ice.AlreadyRegisteredException("facet", facet); } _adminFacets.put(facet, servant); } @@ -588,22 +586,22 @@ public final class Instance implements Ice.ClassResolver } } - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object removeAdminFacet(String facet) { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } - Ice.Object result; + com.zeroc.Ice.Object result; if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet))) { result = _adminFacets.remove(facet); if(result == null) { - throw new Ice.NotRegisteredException("facet", facet); + throw new com.zeroc.Ice.NotRegisteredException("facet", facet); } } else @@ -614,15 +612,15 @@ public final class Instance implements Ice.ClassResolver return result; } - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object findAdminFacet(String facet) { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } - Ice.Object result = null; + com.zeroc.Ice.Object result = null; if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet))) { @@ -636,21 +634,21 @@ public final class Instance implements Ice.ClassResolver return result; } - public synchronized java.util.Map<String, Ice.Object> + public synchronized java.util.Map<String, com.zeroc.Ice.Object> findAllAdminFacets() { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } if(_adminAdapter == null) { - return new java.util.HashMap<String, Ice.Object>(_adminFacets); + return new java.util.HashMap<>(_adminFacets); } else { - java.util.Map<String, Ice.Object> result = _adminAdapter.findAllFacets(_adminIdentity); + java.util.Map<String, com.zeroc.Ice.Object> result = _adminAdapter.findAllFacets(_adminIdentity); if(!_adminFacets.isEmpty()) { // Also returns filtered facets @@ -661,29 +659,29 @@ public final class Instance implements Ice.ClassResolver } public synchronized void - setDefaultLocator(Ice.LocatorPrx locator) + setDefaultLocator(com.zeroc.Ice.LocatorPrx locator) { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } _referenceFactory = _referenceFactory.setDefaultLocator(locator); } public synchronized void - setDefaultRouter(Ice.RouterPrx router) + setDefaultRouter(com.zeroc.Ice.RouterPrx router) { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } _referenceFactory = _referenceFactory.setDefaultRouter(router); } public void - setLogger(Ice.Logger logger) + setLogger(com.zeroc.Ice.Logger logger) { // // No locking, as it can only be called during plug-in loading @@ -692,7 +690,7 @@ public final class Instance implements Ice.ClassResolver } public void - setThreadHook(Ice.ThreadNotification threadHook) + setThreadHook(com.zeroc.Ice.ThreadNotification threadHook) { // // No locking, as it can only be called during plug-in loading @@ -712,8 +710,21 @@ public final class Instance implements Ice.ClassResolver return _initData.classLoader; } + static private String[] _iceTypeIdPrefixes = + { + "::Glacier2::", + "::Ice::", + "::IceBox::", + "::IceDiscovery::", + "::IceGrid::", + "::IceLocatorDiscovery::", + "::IceMX::", + "::IcePatch2::", + "::IceStorm::" + }; + // - // From Ice.ClassResolver. + // From com.zeroc.Ice.ClassResolver. // public Class<?> resolveClass(String typeId) throws LinkageError @@ -725,7 +736,7 @@ public final class Instance implements Ice.ClassResolver // // 1. Convert the Slice type id into a classname (e.g., ::M::X -> M.X). // 2. If that fails, extract the top-level module (if any) from the type id - // and check for an Package property. If found, prepend the property + // and check for a Package property. If found, prepend the property // value to the classname. // 3. If that fails, check for an Default.Package property. If found, // prepend the property value to the classname. @@ -733,19 +744,31 @@ public final class Instance implements Ice.ClassResolver String className; boolean addClass = false; + // + // See if we've already translated this type ID before. + // synchronized(this) { className = _typeToClassMap.get(typeId); } + // + // It's a new type ID, so first convert it into a Java class name. + // if(className == null) { - className = Ice.Util.typeIdToClass(typeId); + className = com.zeroc.Ice.Util.typeIdToClass(typeId); addClass = true; } + // + // See if we can find the class without any prefix. + // c = getConcreteClass(className); + // + // See if the application defined an Ice.Package.MODULE property. + // if(c == null) { int pos = typeId.indexOf(':', 2); @@ -760,6 +783,9 @@ public final class Instance implements Ice.ClassResolver } } + // + // See if the application defined a default package. + // if(c == null) { String pkg = _initData.properties.getProperty("Ice.Default.Package"); @@ -769,6 +795,24 @@ public final class Instance implements Ice.ClassResolver } } + // + // See if the type ID is one of the Ice modules. + // + if(c == null) + { + String pkg = null; + for(int i = 0; i < _iceTypeIdPrefixes.length && c == null; ++i) + { + if(typeId.startsWith(_iceTypeIdPrefixes[i])) + { + c = getConcreteClass("com.zeroc." + className); + } + } + } + + // + // If we found the class, update our map so we don't have to translate this type ID again. + // if(c != null && addClass) { synchronized(this) @@ -790,7 +834,7 @@ public final class Instance implements Ice.ClassResolver public String resolveCompactId(int compactId) { - String className = "IceCompactId.TypeId_" + Integer.toString(compactId); + String className = "com.zeroc.IceCompactId.TypeId_" + Integer.toString(compactId); Class<?> c = getConcreteClass(className); if(c == null) { @@ -856,16 +900,16 @@ public final class Instance implements Ice.ClassResolver { if(_state == StateDestroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } return _queueExecutorService; } // - // Only for use by Ice.CommunicatorI + // Only for use by com.zeroc.Ice.CommunicatorI // public - Instance(Ice.Communicator communicator, Ice.InitializationData initData) + Instance(com.zeroc.Ice.Communicator communicator, com.zeroc.Ice.InitializationData initData) { _state = StateActive; _initData = initData; @@ -874,7 +918,7 @@ public final class Instance implements Ice.ClassResolver { if(_initData.properties == null) { - _initData.properties = Ice.Util.createProperties(); + _initData.properties = com.zeroc.Ice.Util.createProperties(); } synchronized(Instance.class) @@ -900,7 +944,7 @@ public final class Instance implements Ice.ClassResolver } catch(java.io.FileNotFoundException ex) { - throw new Ice.FileException(0, stdOut, ex); + throw new com.zeroc.Ice.FileException(0, stdOut, ex); } System.setOut(outStream); @@ -924,7 +968,7 @@ public final class Instance implements Ice.ClassResolver } catch(java.io.FileNotFoundException ex) { - throw new Ice.FileException(0, stdErr, ex); + throw new com.zeroc.Ice.FileException(0, stdErr, ex); } } @@ -941,18 +985,21 @@ public final class Instance implements Ice.ClassResolver { if(logfile.length() != 0) { - throw new Ice.InitializationException("Both syslog and file logger cannot be enabled."); + throw new com.zeroc.Ice.InitializationException( + "Both syslog and file logger cannot be enabled."); } - _initData.logger = new Ice.SysLoggerI(_initData.properties.getProperty("Ice.ProgramName"), - _initData.properties.getPropertyWithDefault("Ice.SyslogFacility", "LOG_USER")); + _initData.logger = new com.zeroc.Ice.SysLoggerI( + _initData.properties.getProperty("Ice.ProgramName"), + _initData.properties.getPropertyWithDefault("Ice.SyslogFacility", "LOG_USER")); } else if(logfile.length() != 0) { - _initData.logger = new Ice.LoggerI(_initData.properties.getProperty("Ice.ProgramName"), logfile); + _initData.logger = + new com.zeroc.Ice.LoggerI(_initData.properties.getProperty("Ice.ProgramName"), logfile); } else { - _initData.logger = Ice.Util.getProcessLogger(); + _initData.logger = com.zeroc.Ice.Util.getProcessLogger(); } } @@ -1018,7 +1065,8 @@ public final class Instance implements Ice.ClassResolver } } - _implicitContext = Ice.ImplicitContextI.create(_initData.properties.getProperty("Ice.ImplicitContext")); + _implicitContext = + com.zeroc.Ice.ImplicitContextI.create(_initData.properties.getProperty("Ice.ImplicitContext")); _routerManager = new RouterManager(); @@ -1035,7 +1083,7 @@ public final class Instance implements Ice.ClassResolver boolean ipv6 = _initData.properties.getPropertyAsIntWithDefault("Ice.IPv6", isIPv6Supported ? 1 : 0) > 0; if(!ipv4 && !ipv6) { - throw new Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled."); + throw new com.zeroc.Ice.InitializationException("Both IPV4 and IPv6 support cannot be disabled."); } else if(ipv4 && ipv6) { @@ -1055,13 +1103,15 @@ public final class Instance implements Ice.ClassResolver _endpointFactoryManager = new EndpointFactoryManager(this); - ProtocolInstance tcpProtocolInstance = new ProtocolInstance(this, Ice.TCPEndpointType.value, "tcp", false); + ProtocolInstance tcpProtocolInstance = + new ProtocolInstance(this, com.zeroc.Ice.TCPEndpointType.value, "tcp", false); _endpointFactoryManager.add(new TcpEndpointFactory(tcpProtocolInstance)); - ProtocolInstance udpProtocolInstance = new ProtocolInstance(this, Ice.UDPEndpointType.value, "udp", false); + ProtocolInstance udpProtocolInstance = + new ProtocolInstance(this, com.zeroc.Ice.UDPEndpointType.value, "udp", false); _endpointFactoryManager.add(new UdpEndpointFactory(udpProtocolInstance)); - _pluginManager = new Ice.PluginManagerI(communicator, this); + _pluginManager = new com.zeroc.Ice.PluginManagerI(communicator, this); if(_initData.valueFactoryManager == null) { @@ -1094,7 +1144,7 @@ public final class Instance implements Ice.ClassResolver _cacheMessageBuffers = _initData.properties.getPropertyAsIntWithDefault("Ice.CacheMessageBuffers", 2); } } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { destroy(); throw ex; @@ -1108,21 +1158,21 @@ public final class Instance implements Ice.ClassResolver { try { - IceUtilInternal.Assert.FinalizerAssert(_state == StateDestroyed); - IceUtilInternal.Assert.FinalizerAssert(_referenceFactory == null); - IceUtilInternal.Assert.FinalizerAssert(_requestHandlerFactory == null); - IceUtilInternal.Assert.FinalizerAssert(_proxyFactory == null); - IceUtilInternal.Assert.FinalizerAssert(_outgoingConnectionFactory == null); - IceUtilInternal.Assert.FinalizerAssert(_objectAdapterFactory == null); - IceUtilInternal.Assert.FinalizerAssert(_clientThreadPool == null); - IceUtilInternal.Assert.FinalizerAssert(_serverThreadPool == null); - IceUtilInternal.Assert.FinalizerAssert(_endpointHostResolver == null); - IceUtilInternal.Assert.FinalizerAssert(_timer == null); - IceUtilInternal.Assert.FinalizerAssert(_routerManager == null); - IceUtilInternal.Assert.FinalizerAssert(_locatorManager == null); - IceUtilInternal.Assert.FinalizerAssert(_endpointFactoryManager == null); - IceUtilInternal.Assert.FinalizerAssert(_pluginManager == null); - IceUtilInternal.Assert.FinalizerAssert(_retryQueue == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_state == StateDestroyed); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_referenceFactory == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_requestHandlerFactory == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_proxyFactory == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_outgoingConnectionFactory == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_objectAdapterFactory == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_clientThreadPool == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_serverThreadPool == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_endpointHostResolver == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_timer == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_routerManager == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_locatorManager == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_endpointFactoryManager == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_pluginManager == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_retryQueue == null); } catch(java.lang.Exception ex) { @@ -1133,29 +1183,30 @@ public final class Instance implements Ice.ClassResolver } } - public void - finishSetup(Ice.StringSeqHolder args, Ice.Communicator communicator) + public String[] finishSetup(String[] args, com.zeroc.Ice.Communicator communicator) { // // Load plug-ins. // assert(_serverThreadPool == null); - Ice.PluginManagerI pluginManagerImpl = (Ice.PluginManagerI)_pluginManager; - pluginManagerImpl.loadPlugins(args); + com.zeroc.Ice.PluginManagerI pluginManagerImpl = (com.zeroc.Ice.PluginManagerI)_pluginManager; + args = pluginManagerImpl.loadPlugins(args); // // Add WS and WSS endpoint factories if TCP/SSL factories are installed. // - final EndpointFactory tcpFactory = _endpointFactoryManager.get(Ice.TCPEndpointType.value); + final EndpointFactory tcpFactory = _endpointFactoryManager.get(com.zeroc.Ice.TCPEndpointType.value); if(tcpFactory != null) { - final ProtocolInstance instance = new ProtocolInstance(this, Ice.WSEndpointType.value, "ws", false); + final ProtocolInstance instance = + new ProtocolInstance(this, com.zeroc.Ice.WSEndpointType.value, "ws", false); _endpointFactoryManager.add(new WSEndpointFactory(instance, tcpFactory.clone(instance, null))); } - final EndpointFactory sslFactory = _endpointFactoryManager.get(Ice.SSLEndpointType.value); + final EndpointFactory sslFactory = _endpointFactoryManager.get(com.zeroc.Ice.SSLEndpointType.value); if(sslFactory != null) { - final ProtocolInstance instance = new ProtocolInstance(this, Ice.WSSEndpointType.value, "wss", true); + final ProtocolInstance instance = + new ProtocolInstance(this, com.zeroc.Ice.WSSEndpointType.value, "wss", true); _endpointFactoryManager.add(new WSEndpointFactory(instance, sslFactory.clone(instance, null))); } @@ -1275,8 +1326,8 @@ public final class Instance implements Ice.ClassResolver // if(_referenceFactory.getDefaultRouter() == null) { - Ice.RouterPrx router = - Ice.RouterPrxHelper.uncheckedCast(_proxyFactory.propertyToProxy("Ice.Default.Router")); + com.zeroc.Ice.RouterPrx router = + com.zeroc.Ice.RouterPrx.uncheckedCast(_proxyFactory.propertyToProxy("Ice.Default.Router")); if(router != null) { _referenceFactory = _referenceFactory.setDefaultRouter(router); @@ -1285,8 +1336,8 @@ public final class Instance implements Ice.ClassResolver if(_referenceFactory.getDefaultLocator() == null) { - Ice.LocatorPrx loc = - Ice.LocatorPrxHelper.uncheckedCast(_proxyFactory.propertyToProxy("Ice.Default.Locator")); + com.zeroc.Ice.LocatorPrx loc = + com.zeroc.Ice.LocatorPrx.uncheckedCast(_proxyFactory.propertyToProxy("Ice.Default.Locator")); if(loc != null) { _referenceFactory = _referenceFactory.setDefaultLocator(loc); @@ -1316,10 +1367,12 @@ public final class Instance implements Ice.ClassResolver { getAdmin(); } + + return args; } // - // Only for use by Ice.CommunicatorI + // Only for use by com.zeroc.Ice.CommunicatorI // @SuppressWarnings("deprecation") public void @@ -1327,7 +1380,7 @@ public final class Instance implements Ice.ClassResolver { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } synchronized(this) @@ -1345,7 +1398,7 @@ public final class Instance implements Ice.ClassResolver } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } } @@ -1454,7 +1507,7 @@ public final class Instance implements Ice.ClassResolver } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } // @@ -1463,7 +1516,7 @@ public final class Instance implements Ice.ClassResolver // called once. // - for(Ice.ObjectFactory f : _objectFactoryMap.values()) + for(com.zeroc.Ice.ObjectFactory f : _objectFactoryMap.values()) { f.destroy(); } @@ -1486,7 +1539,8 @@ public final class Instance implements Ice.ClassResolver if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0) { - java.util.List<String> unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties(); + java.util.List<String> unusedProperties = + ((com.zeroc.Ice.PropertiesI)_initData.properties).getUnusedProperties(); if(unusedProperties.size() != 0) { StringBuilder message = new StringBuilder("The following properties were set but never read:"); @@ -1597,16 +1651,16 @@ public final class Instance implements Ice.ClassResolver } @SuppressWarnings("deprecation") - public synchronized void addObjectFactory(final Ice.ObjectFactory factory, String id) + public synchronized void addObjectFactory(final com.zeroc.Ice.ObjectFactory factory, String id) { // // Create a ValueFactory wrapper around the given ObjectFactory and register the wrapper // with the value factory manager. This may raise AlreadyRegisteredException. // _initData.valueFactoryManager.add( - new Ice.ValueFactory() + new com.zeroc.Ice.ValueFactory() { - public Ice.Object create(String id) + public com.zeroc.Ice.Value create(String id) { return factory.create(id); } @@ -1616,7 +1670,7 @@ public final class Instance implements Ice.ClassResolver } @SuppressWarnings("deprecation") - public synchronized Ice.ObjectFactory findObjectFactory(String id) + public synchronized com.zeroc.Ice.ObjectFactory findObjectFactory(String id) { return _objectFactoryMap.get(id); } @@ -1631,7 +1685,7 @@ public final class Instance implements Ice.ClassResolver assert(_objectAdapterFactory != null); _objectAdapterFactory.updateConnectionObservers(); } - catch(Ice.CommunicatorDestroyedException ex) + catch(com.zeroc.Ice.CommunicatorDestroyedException ex) { } } @@ -1664,7 +1718,7 @@ public final class Instance implements Ice.ClassResolver _queueExecutor.updateObserver(_initData.observer); } } - catch(Ice.CommunicatorDestroyedException ex) + catch(com.zeroc.Ice.CommunicatorDestroyedException ex) { } } @@ -1674,7 +1728,7 @@ public final class Instance implements Ice.ClassResolver { final String prefix = "Ice.Package."; java.util.Map<String, String> map = _initData.properties.getPropertiesForPrefix(prefix); - java.util.List<String> packages = new java.util.ArrayList<String>(); + java.util.List<String> packages = new java.util.ArrayList<>(); for(java.util.Map.Entry<String, String> p : map.entrySet()) { String key = p.getKey(); @@ -1714,8 +1768,8 @@ public final class Instance implements Ice.ClassResolver private synchronized void addAllAdminFacets() { - java.util.Map<String, Ice.Object> filteredFacets = new java.util.HashMap<String, Ice.Object>(); - for(java.util.Map.Entry<String, Ice.Object> p : _adminFacets.entrySet()) + java.util.Map<String, com.zeroc.Ice.Object> filteredFacets = new java.util.HashMap<>(); + for(java.util.Map.Entry<String, com.zeroc.Ice.Object> p : _adminFacets.entrySet()) { if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(p.getKey())) { @@ -1730,15 +1784,15 @@ public final class Instance implements Ice.ClassResolver } private void - setServerProcessProxy(Ice.ObjectAdapter adminAdapter, Ice.Identity adminIdentity) + setServerProcessProxy(com.zeroc.Ice.ObjectAdapter adminAdapter, com.zeroc.Ice.Identity adminIdentity) { - Ice.ObjectPrx admin = adminAdapter.createProxy(adminIdentity); - Ice.LocatorPrx locator = adminAdapter.getLocator(); + com.zeroc.Ice.ObjectPrx admin = adminAdapter.createProxy(adminIdentity); + com.zeroc.Ice.LocatorPrx locator = adminAdapter.getLocator(); String serverId = _initData.properties.getProperty("Ice.Admin.ServerId"); if(locator != null && !serverId.isEmpty()) { - Ice.ProcessPrx process = Ice.ProcessPrxHelper.uncheckedCast(admin.ice_facet("Process")); + com.zeroc.Ice.ProcessPrx process = com.zeroc.Ice.ProcessPrx.uncheckedCast(admin.ice_facet("Process")); try { // @@ -1747,7 +1801,7 @@ public final class Instance implements Ice.ClassResolver // locator.getRegistry().setServerProcessProxy(serverId, process); } - catch(Ice.ServerNotFoundException ex) + catch(com.zeroc.Ice.ServerNotFoundException ex) { if(_traceLevels.location >= 1) { @@ -1759,9 +1813,10 @@ public final class Instance implements Ice.ClassResolver _initData.logger.trace(_traceLevels.locationCat, s.toString()); } - throw new Ice.InitializationException("Locator knows nothing about server `" + serverId + "'"); + throw new com.zeroc.Ice.InitializationException( + "Locator knows nothing about server `" + serverId + "'"); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { if(_traceLevels.location >= 1) { @@ -1786,7 +1841,7 @@ public final class Instance implements Ice.ClassResolver } } - private NetworkProxy createNetworkProxy(Ice.Properties properties, int protocolSupport) + private NetworkProxy createNetworkProxy(com.zeroc.Ice.Properties properties, int protocolSupport) { String proxyHost; @@ -1795,7 +1850,7 @@ public final class Instance implements Ice.ClassResolver { if(protocolSupport == Network.EnableIPv6) { - throw new Ice.InitializationException("IPv6 only is not supported with SOCKS4 proxies"); + throw new com.zeroc.Ice.InitializationException("IPv6 only is not supported with SOCKS4 proxies"); } int proxyPort = properties.getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080); return new SOCKSNetworkProxy(proxyHost, proxyPort); @@ -1815,7 +1870,7 @@ public final class Instance implements Ice.ClassResolver private static final int StateDestroyed = 2; private int _state; - private final Ice.InitializationData _initData; // Immutable, not reset by destroy(). + private final com.zeroc.Ice.InitializationData _initData; // Immutable, not reset by destroy(). private final TraceLevels _traceLevels; // Immutable, not reset by destroy(). private final DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy(). private final int _messageSizeMax; // Immutable, not reset by destroy(). @@ -1823,7 +1878,7 @@ public final class Instance implements Ice.ClassResolver private final int _cacheMessageBuffers; // Immutable, not reset by destroy(). private final ACMConfig _clientACM; // Immutable, not reset by destroy(). private final ACMConfig _serverACM; // Immutable, not reset by destroy(). - private final Ice.ImplicitContextI _implicitContext; + private final com.zeroc.Ice.ImplicitContextI _implicitContext; private RouterManager _routerManager; private LocatorManager _locatorManager; private ReferenceFactory _referenceFactory; @@ -1840,16 +1895,16 @@ public final class Instance implements Ice.ClassResolver private RetryQueue _retryQueue; private Timer _timer; private EndpointFactoryManager _endpointFactoryManager; - private Ice.PluginManager _pluginManager; + private com.zeroc.Ice.PluginManager _pluginManager; private boolean _adminEnabled = false; - private Ice.ObjectAdapter _adminAdapter; - private java.util.Map<String, Ice.Object> _adminFacets = new java.util.HashMap<String, Ice.Object>(); - private java.util.Set<String> _adminFacetFilter = new java.util.HashSet<String>(); - private Ice.Identity _adminIdentity; - private java.util.Map<Short, BufSizeWarnInfo> _setBufSizeWarn = new java.util.HashMap<Short, BufSizeWarnInfo>(); + private com.zeroc.Ice.ObjectAdapter _adminAdapter; + private java.util.Map<String, com.zeroc.Ice.Object> _adminFacets = new java.util.HashMap<>(); + private java.util.Set<String> _adminFacetFilter = new java.util.HashSet<>(); + private com.zeroc.Ice.Identity _adminIdentity; + private java.util.Map<Short, BufSizeWarnInfo> _setBufSizeWarn = new java.util.HashMap<>(); - private java.util.Map<String, String> _typeToClassMap = new java.util.HashMap<String, String>(); + private java.util.Map<String, String> _typeToClassMap = new java.util.HashMap<>(); final private String[] _packages; final private boolean _useApplicationClassLoader; @@ -1858,6 +1913,5 @@ public final class Instance implements Ice.ClassResolver private QueueExecutor _queueExecutor; @SuppressWarnings("deprecation") - private java.util.HashMap<String, Ice.ObjectFactory> _objectFactoryMap = - new java.util.HashMap<String, Ice.ObjectFactory>(); + private java.util.HashMap<String, com.zeroc.Ice.ObjectFactory> _objectFactoryMap = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/AsyncResultI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationFutureI.java index 41f49774a0e..0561794d2a5 100644 --- a/java/src/Ice/src/main/java/IceInternal/AsyncResultI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationFutureI.java @@ -7,19 +7,34 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -import Ice.AsyncResult; -import Ice.Communicator; -import Ice.CommunicatorDestroyedException; -import Ice.Connection; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; -public class AsyncResultI implements AsyncResult +import com.zeroc.Ice.Communicator; +import com.zeroc.Ice.CommunicatorDestroyedException; +import com.zeroc.Ice.Connection; + +public abstract class InvocationFutureI<T> extends com.zeroc.Ice.InvocationFuture<T> { @Override - public void cancel() + public boolean cancel() { - cancel(new Ice.InvocationCanceledException()); + return cancel(false); + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) + { + // + // Call super.cancel(boolean) first. This sets the result of the future. + // Calling cancel(LocalException) also eventually attempts to complete the future + // (exceptionally), but this result is ignored. + // + boolean r = super.cancel(mayInterruptIfRunning); + cancel(new com.zeroc.Ice.InvocationCanceledException()); + return r; } @Override @@ -29,117 +44,193 @@ public class AsyncResultI implements AsyncResult } @Override - public Connection getConnection() + public com.zeroc.Ice.Connection getConnection() { return null; } @Override - public Ice.ObjectPrx getProxy() + public com.zeroc.Ice.ObjectPrx getProxy() { return null; } @Override - public final boolean isCompleted() + public final String getOperation() { - synchronized(this) + return _operation; + } + + @Override + public final void waitForCompleted() + { + if(Thread.interrupted()) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + try + { + join(); + } + catch(Exception ex) { - return (_state & StateDone) > 0; } } @Override - public final void waitForCompleted() + public final boolean isSent() { synchronized(this) { - if(Thread.interrupted()) + return (_state & StateSent) > 0; + } + } + + @Override + synchronized public final void waitForSent() + { + if(Thread.interrupted()) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + while((_state & StateSent) == 0 && _exception == null) + { + try { - throw new Ice.OperationInterruptedException(); + this.wait(); } - while((_state & StateDone) == 0) + catch(InterruptedException ex) { - try - { - this.wait(); - } - catch(InterruptedException ex) - { - throw new Ice.OperationInterruptedException(); - } + throw new com.zeroc.Ice.OperationInterruptedException(); } } } @Override - public final boolean isSent() + public final boolean sentSynchronously() { - synchronized(this) - { - return (_state & StateSent) > 0; - } + return _sentSynchronously; // No lock needed, immutable } @Override - public final void waitForSent() + synchronized public final CompletableFuture<Boolean> whenSent( + java.util.function.BiConsumer<Boolean, ? super Throwable> action) { - synchronized(this) + if(_sentFuture == null) + { + _sentFuture = new CompletableFuture<>(); + } + + CompletableFuture<Boolean> r = _sentFuture.whenComplete(action); + + // + // Check if the request has already been sent. + // + if(((_state & StateSent) > 0 || _exception != null) && !_sentFuture.isDone()) { - if(Thread.interrupted()) + // + // The documented semantics state that a sent callback will be invoked from the + // calling thread if the request was sent synchronously. Calling complete() or + // completeExceptionally() on _sentFuture invokes the action from this thread. + // + if(_sentSynchronously) { - throw new Ice.OperationInterruptedException(); + if(_exception != null) + { + _sentFuture.completeExceptionally(_exception); + } + else + { + _sentFuture.complete(_sentSynchronously); + } } - while((_state & StateSent) == 0 && _exception == null) + else { - try + if(_exception != null) { - this.wait(); + dispatch(() -> + { + _sentFuture.completeExceptionally(_exception); + }); } - catch(InterruptedException ex) + else { - throw new Ice.OperationInterruptedException(); + invokeSentAsync(); } } } + return r; } @Override - public final void throwLocalException() + synchronized public final CompletableFuture<Boolean> whenSentAsync( + java.util.function.BiConsumer<Boolean, ? super Throwable> action) { - synchronized(this) + return whenSentAsync(action, null); + } + + @Override + synchronized public final CompletableFuture<Boolean> whenSentAsync( + java.util.function.BiConsumer<Boolean, ? super Throwable> action, + Executor executor) + { + if(_sentFuture == null) + { + _sentFuture = new CompletableFuture<>(); + } + + CompletableFuture<Boolean> r; + if(executor == null) + { + r = _sentFuture.whenCompleteAsync(action); + } + else { + r = _sentFuture.whenCompleteAsync(action, executor); + } + + // + // Check if the request has already been sent. + // + if(((_state & StateSent) > 0 || _exception != null) && !_sentFuture.isDone()) + { + // + // When the caller uses whenSentAsync, we ignore the regular semantics and + // always complete the future from this thread. The caller's action will + // be invoked using the executor. + // if(_exception != null) { - throw _exception; + _sentFuture.completeExceptionally(_exception); + } + else + { + _sentFuture.complete(_sentSynchronously); } } + return r; } - @Override - public final boolean sentSynchronously() + protected synchronized void __sent() { - return _sentSynchronously; // No lock needed, immutable - } - - @Override - public final String getOperation() - { - return _operation; + if(_sentFuture != null && !_sentFuture.isDone()) + { + _sentFuture.complete(_sentSynchronously); + } } public final void invokeSent() { - assert(_callback != null); - + /* TBD if(_instance.useApplicationClassLoader()) { Thread.currentThread().setContextClassLoader(_callback.getClass().getClassLoader()); } + */ try { - _callback.__sent(this); + __sent(); } catch(java.lang.RuntimeException ex) { @@ -155,15 +246,17 @@ public class AsyncResultI implements AsyncResult } finally { + /* TBD if(_instance.useApplicationClassLoader()) { Thread.currentThread().setContextClassLoader(null); } + */ } if(_observer != null) { - Ice.ObjectPrx proxy = getProxy(); + com.zeroc.Ice.ObjectPrx proxy = getProxy(); if(proxy == null || !proxy.ice_isTwoway()) { _observer.detach(); @@ -172,18 +265,31 @@ public class AsyncResultI implements AsyncResult } } - public final void invokeCompleted() + protected boolean __needCallback() + { + return true; + } + + protected void __completed() { - assert(_callback != null); + if(_exception != null && _sentFuture != null) + { + _sentFuture.completeExceptionally(_exception); + } + } + public final void invokeCompleted() + { + /* TBD if(_instance.useApplicationClassLoader()) { Thread.currentThread().setContextClassLoader(_callback.getClass().getClassLoader()); } + */ try { - _callback.__completed(this); + __completed(); } catch(RuntimeException ex) { @@ -199,10 +305,12 @@ public class AsyncResultI implements AsyncResult } finally { + /* TBD if(_instance.useApplicationClassLoader()) { Thread.currentThread().setContextClassLoader(null); } + */ } if(_observer != null) @@ -215,17 +323,17 @@ public class AsyncResultI implements AsyncResult public final void invokeCompletedAsync() { // - // CommunicatorDestroyedCompleted is the only exception that can propagate directly - // from this method. + // CommunicatorDestroyedException is the only exception that can propagate directly from this method. // - _instance.clientThreadPool().dispatch(new DispatchWorkItem(_cachedConnection) - { - @Override - public void run() - { - invokeCompleted(); - } - }); + _instance.clientThreadPool().dispatch( + new DispatchWorkItem(_cachedConnection) + { + @Override + public void run() + { + invokeCompleted(); + } + }); } synchronized public void cancelable(final CancellationHandler handler) @@ -244,48 +352,7 @@ public class AsyncResultI implements AsyncResult _cancellationHandler = handler; } - public final boolean __wait() - { - try - { - synchronized(this) - { - if((_state & StateEndCalled) > 0) - { - throw new IllegalArgumentException("end_ method called more than once"); - } - - _state |= StateEndCalled; - if(Thread.interrupted()) - { - throw new InterruptedException(); - } - while((_state & StateDone) == 0) - { - this.wait(); - } - - if(_exception != null) - { - throw (Ice.Exception)_exception.fillInStackTrace(); - } - - return (_state & StateOK) > 0; - } - } - catch(InterruptedException ex) - { - Ice.OperationInterruptedException exc = new Ice.OperationInterruptedException(); - cancel(exc); // Must be called outside the synchronization - throw exc; - } - } - - public void cacheMessageBuffers() - { - } - - protected AsyncResultI(Communicator communicator, Instance instance, String op, CallbackBase del) + protected InvocationFutureI(Communicator communicator, Instance instance, String op) { _communicator = communicator; _instance = instance; @@ -293,7 +360,10 @@ public class AsyncResultI implements AsyncResult _state = 0; _sentSynchronously = false; _exception = null; - _callback = del; + } + + protected void cacheMessageBuffers() + { } protected boolean sent(boolean done) @@ -308,11 +378,6 @@ public class AsyncResultI implements AsyncResult { _state |= StateDone | StateOK; _cancellationHandler = null; - if(_observer != null && (_callback == null || !_callback.__hasSentCallback())) - { - _observer.detach(); - _observer = null; - } // // For oneway requests after the data has been sent @@ -324,7 +389,7 @@ public class AsyncResultI implements AsyncResult cacheMessageBuffers(); } this.notifyAll(); - return !alreadySent && _callback != null && _callback.__hasSentCallback(); + return !alreadySent; } } @@ -338,7 +403,7 @@ public class AsyncResultI implements AsyncResult _state |= StateOK; } _cancellationHandler = null; - if(_callback == null) + if(!__needCallback()) { if(_observer != null) { @@ -347,11 +412,11 @@ public class AsyncResultI implements AsyncResult } } this.notifyAll(); - return _callback != null; + return __needCallback(); } } - protected boolean finished(Ice.Exception ex) + protected boolean finished(com.zeroc.Ice.Exception ex) { synchronized(this) { @@ -362,7 +427,7 @@ public class AsyncResultI implements AsyncResult { _observer.failed(ex.ice_id()); } - if(_callback == null) + if(!__needCallback()) { if(_observer != null) { @@ -371,7 +436,7 @@ public class AsyncResultI implements AsyncResult } } this.notifyAll(); - return _callback != null; + return __needCallback(); } } @@ -379,26 +444,13 @@ public class AsyncResultI implements AsyncResult { // // This is called when it's not safe to call the sent callback - // synchronously from this thread. Instead the exception callback - // is called asynchronously from the client thread pool. + // synchronously from this thread. Instead the future is completed + // asynchronously from a client in the client thread pool. // - try - { - _instance.clientThreadPool().dispatch(new DispatchWorkItem(_cachedConnection) - { - @Override - public void run() - { - invokeSent(); - } - }); - } - catch(CommunicatorDestroyedException exc) - { - } + dispatch(() -> invokeSent()); } - protected void cancel(Ice.LocalException ex) + protected void cancel(com.zeroc.Ice.LocalException ex) { CancellationHandler handler; synchronized(this) @@ -413,21 +465,27 @@ public class AsyncResultI implements AsyncResult handler.asyncRequestCanceled((OutgoingAsyncBase)this, ex); } - protected Ice.Instrumentation.InvocationObserver getObserver() + protected com.zeroc.Ice.Instrumentation.InvocationObserver getObserver() { return _observer; } - protected static void check(AsyncResult r, String operation) + protected void dispatch(final Runnable runnable) { - if(r == null) + try { - throw new IllegalArgumentException("AsyncResult == null"); + _instance.clientThreadPool().dispatch( + new DispatchWorkItem(_cachedConnection) + { + @Override + public void run() + { + runnable.run(); + } + }); } - else if(r.getOperation() != operation) // Do NOT use equals() here - we are comparing reference equality + catch(CommunicatorDestroyedException ex) { - throw new IllegalArgumentException("Incorrect operation for end_" + operation + " method: " + - r.getOperation()); } } @@ -447,23 +505,22 @@ public class AsyncResultI implements AsyncResult } protected final Instance _instance; - protected Ice.Instrumentation.InvocationObserver _observer; + protected com.zeroc.Ice.Instrumentation.InvocationObserver _observer; protected Connection _cachedConnection; protected boolean _sentSynchronously; + protected CompletableFuture<Boolean> _sentFuture; - private final Communicator _communicator; - private final String _operation; - private final CallbackBase _callback; + protected final Communicator _communicator; + protected final String _operation; - private Ice.Exception _exception; + protected com.zeroc.Ice.Exception _exception; private CancellationHandler _cancellationHandler; - private Ice.LocalException _cancellationException; + private com.zeroc.Ice.LocalException _cancellationException; protected static final byte StateOK = 0x1; protected static final byte StateDone = 0x2; protected static final byte StateSent = 0x4; - protected static final byte StateEndCalled = 0x8; - protected static final byte StateCachedBuffers = 0x10; + protected static final byte StateCachedBuffers = 0x08; protected byte _state; } diff --git a/java/src/Ice/src/main/java/IceInternal/InvocationObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationObserverI.java index 93cb2fb906a..5d93dc25e5e 100644 --- a/java/src/Ice/src/main/java/IceInternal/InvocationObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/InvocationObserverI.java @@ -7,13 +7,14 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -import IceMX.*; +import com.zeroc.IceMX.*; public class InvocationObserverI - extends IceMX.ObserverWithDelegate<IceMX.InvocationMetrics, Ice.Instrumentation.InvocationObserver> - implements Ice.Instrumentation.InvocationObserver + extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.InvocationMetrics, + com.zeroc.Ice.Instrumentation.InvocationObserver> + implements com.zeroc.Ice.Instrumentation.InvocationObserver { static public final class RemoteInvocationHelper extends MetricsHelper<RemoteMetrics> { @@ -36,7 +37,7 @@ public class InvocationObserverI } }; - RemoteInvocationHelper(Ice.ConnectionInfo con, Ice.Endpoint endpt, int requestId, int size) + RemoteInvocationHelper(com.zeroc.Ice.ConnectionInfo con, com.zeroc.Ice.Endpoint endpt, int requestId, int size) { super(_attributes); _connectionInfo = con; @@ -85,19 +86,19 @@ public class InvocationObserverI } } - public Ice.ConnectionInfo + public com.zeroc.Ice.ConnectionInfo getConnectionInfo() { return _connectionInfo; } - public Ice.Endpoint + public com.zeroc.Ice.Endpoint getEndpoint() { return _endpoint; } - public Ice.EndpointInfo + public com.zeroc.Ice.EndpointInfo getEndpointInfo() { if(_endpointInfo == null) @@ -107,12 +108,12 @@ public class InvocationObserverI return _endpointInfo; } - final private Ice.ConnectionInfo _connectionInfo; - final private Ice.Endpoint _endpoint; + final private com.zeroc.Ice.ConnectionInfo _connectionInfo; + final private com.zeroc.Ice.Endpoint _endpoint; final private int _requestId; final private int _size; private String _id; - private Ice.EndpointInfo _endpointInfo; + private com.zeroc.Ice.EndpointInfo _endpointInfo; } static public final class CollocatedInvocationHelper extends MetricsHelper<CollocatedMetrics> @@ -135,7 +136,7 @@ public class InvocationObserverI } }; - CollocatedInvocationHelper(Ice.ObjectAdapter adapter, int requestId, int size) + CollocatedInvocationHelper(com.zeroc.Ice.ObjectAdapter adapter, int requestId, int size) { super(_attributes); _id = adapter.getName(); @@ -196,10 +197,10 @@ public class InvocationObserverI } @Override - public Ice.Instrumentation.RemoteObserver - getRemoteObserver(Ice.ConnectionInfo con, Ice.Endpoint edpt, int requestId, int sz) + public com.zeroc.Ice.Instrumentation.RemoteObserver + getRemoteObserver(com.zeroc.Ice.ConnectionInfo con, com.zeroc.Ice.Endpoint edpt, int requestId, int sz) { - Ice.Instrumentation.RemoteObserver delegate = null; + com.zeroc.Ice.Instrumentation.RemoteObserver delegate = null; if(_delegate != null) { delegate = _delegate.getRemoteObserver(con, edpt, requestId, sz); @@ -212,10 +213,10 @@ public class InvocationObserverI } @Override - public Ice.Instrumentation.CollocatedObserver - getCollocatedObserver(Ice.ObjectAdapter adapter, int requestId, int sz) + public com.zeroc.Ice.Instrumentation.CollocatedObserver + getCollocatedObserver(com.zeroc.Ice.ObjectAdapter adapter, int requestId, int sz) { - Ice.Instrumentation.CollocatedObserver delegate = null; + com.zeroc.Ice.Instrumentation.CollocatedObserver delegate = null; if(_delegate != null) { delegate = _delegate.getCollocatedObserver(adapter, requestId, sz); diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java new file mode 100644 index 00000000000..b3772713014 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ListPatcher.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +public class ListPatcher<T> implements com.zeroc.Ice.ReadValueCallback +{ + public ListPatcher(java.util.List<T> list, Class<T> cls, String type, int index) + { + _list = list; + _cls = cls; + _type = type; + _index = index; + } + + public void valueReady(com.zeroc.Ice.Value v) + { + if(v == null || _cls.isInstance(v)) + { + // + // This isn't very efficient for sequentially-accessed lists, but there + // isn't much we can do about it as long as a new patcher instance is + // created for each element. + // + _list.set(_index, _cls.cast(v)); + } + else + { + Ex.throwUOE(_type, v); + } + } + + private java.util.List<T> _list; + private Class<T> _cls; + private String _type; + private int _index; +} diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorInfo.java index 82c4dea0e25..74b77c4bd2e 100644 --- a/java/src/Ice/src/main/java/IceInternal/LocatorInfo.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorInfo.java @@ -7,25 +7,25 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class LocatorInfo { interface GetEndpointsCallback { void setEndpoints(EndpointI[] endpoints, boolean cached); - void setException(Ice.LocalException ex); + void setException(com.zeroc.Ice.LocalException ex); } private static class RequestCallback { public void - response(LocatorInfo locatorInfo, Ice.ObjectPrx proxy) + response(LocatorInfo locatorInfo, com.zeroc.Ice.ObjectPrx proxy) { EndpointI[] endpoints = null; if(proxy != null) { - Reference r = ((Ice.ObjectPrxHelperBase)proxy).__reference(); + Reference r = ((com.zeroc.Ice._ObjectPrxI)proxy).__reference(); if(_ref.isWellKnown() && !Protocol.isSupported(_ref.getEncoding(), r.getEncoding())) { // @@ -67,7 +67,7 @@ public final class LocatorInfo { locatorInfo.getEndpointsException(_ref, exc); // This throws. } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { if(_callback != null) { @@ -132,7 +132,7 @@ public final class LocatorInfo } protected void - response(Ice.ObjectPrx proxy) + response(com.zeroc.Ice.ObjectPrx proxy) { synchronized(this) { @@ -152,7 +152,7 @@ public final class LocatorInfo { synchronized(this) { - _locatorInfo.finishRequest(_ref, _wellKnownRefs, null, ex instanceof Ice.UserException); + _locatorInfo.finishRequest(_ref, _wellKnownRefs, null, ex instanceof com.zeroc.Ice.UserException); _exception = ex; notifyAll(); } @@ -167,11 +167,11 @@ public final class LocatorInfo final protected LocatorInfo _locatorInfo; final protected Reference _ref; - private java.util.List<RequestCallback> _callbacks = new java.util.ArrayList<RequestCallback>(); - private java.util.List<Reference> _wellKnownRefs = new java.util.ArrayList<Reference>(); + private java.util.List<RequestCallback> _callbacks = new java.util.ArrayList<>(); + private java.util.List<Reference> _wellKnownRefs = new java.util.ArrayList<>(); private boolean _sent; private boolean _response; - private Ice.ObjectPrx _proxy; + private com.zeroc.Ice.ObjectPrx _proxy; private Exception _exception; } @@ -189,29 +189,27 @@ public final class LocatorInfo { try { - _locatorInfo.getLocator().begin_findObjectById( - _ref.getIdentity(), - new Ice.Callback_Locator_findObjectById() + _locatorInfo.getLocator().findObjectByIdAsync(_ref.getIdentity()).whenComplete( + (com.zeroc.Ice.ObjectPrx proxy, Throwable ex) -> { - @Override - public void - response(Ice.ObjectPrx proxy) + if(ex != null) { - ObjectRequest.this.response(proxy); + if(ex instanceof com.zeroc.Ice.LocalException) + { + exception((com.zeroc.Ice.LocalException)ex); + } + else if(ex instanceof com.zeroc.Ice.UserException) + { + exception((com.zeroc.Ice.UserException)ex); + } + else + { + exception(new com.zeroc.Ice.UnknownException(ex)); + } } - - @Override - public void - exception(Ice.UserException ex) - { - ObjectRequest.this.exception(ex); - } - - @Override - public void - exception(Ice.LocalException ex) + else { - ObjectRequest.this.exception(ex); + response(proxy); } }); } @@ -236,29 +234,27 @@ public final class LocatorInfo { try { - _locatorInfo.getLocator().begin_findAdapterById( - _ref.getAdapterId(), - new Ice.Callback_Locator_findAdapterById() + _locatorInfo.getLocator().findAdapterByIdAsync(_ref.getAdapterId()).whenComplete( + (com.zeroc.Ice.ObjectPrx proxy, Throwable ex) -> { - @Override - public void - response(Ice.ObjectPrx proxy) + if(ex != null) { - AdapterRequest.this.response(proxy); + if(ex instanceof com.zeroc.Ice.LocalException) + { + exception((com.zeroc.Ice.LocalException)ex); + } + else if(ex instanceof com.zeroc.Ice.UserException) + { + exception((com.zeroc.Ice.UserException)ex); + } + else + { + exception(new com.zeroc.Ice.UnknownException(ex)); + } } - - @Override - public void - exception(Ice.UserException ex) - { - AdapterRequest.this.exception(ex); - } - - @Override - public void - exception(Ice.LocalException ex) + else { - AdapterRequest.this.exception(ex); + response(proxy); } }); } @@ -269,7 +265,7 @@ public final class LocatorInfo } } - LocatorInfo(Ice.LocatorPrx locator, LocatorTable table, boolean background) + LocatorInfo(com.zeroc.Ice.LocatorPrx locator, LocatorTable table, boolean background) { _locator = locator; _table = table; @@ -307,7 +303,7 @@ public final class LocatorInfo return _locator.hashCode(); } - public Ice.LocatorPrx + public com.zeroc.Ice.LocatorPrx getLocator() { // @@ -316,7 +312,7 @@ public final class LocatorInfo return _locator; } - public Ice.LocatorRegistryPrx + public com.zeroc.Ice.LocatorRegistryPrx getLocatorRegistry() { synchronized(this) @@ -330,7 +326,7 @@ public final class LocatorInfo // // Do not make locator calls from within sync. // - Ice.LocatorRegistryPrx locatorRegistry = _locator.getRegistry(); + com.zeroc.Ice.LocatorRegistryPrx locatorRegistry = _locator.getRegistry(); if(locatorRegistry == null) { return null; @@ -343,8 +339,9 @@ public final class LocatorInfo // endpoint selection in case the locator returned a proxy // with some endpoints which are prefered to be tried first. // - _locatorRegistry = (Ice.LocatorRegistryPrx)locatorRegistry.ice_locator(null).ice_endpointSelection( - Ice.EndpointSelectionType.Ordered); + _locatorRegistry = + (com.zeroc.Ice.LocatorRegistryPrx)locatorRegistry.ice_locator(null).ice_endpointSelection( + com.zeroc.Ice.EndpointSelectionType.Ordered); return _locatorRegistry; } } @@ -360,7 +357,7 @@ public final class LocatorInfo { assert(ref.isIndirect()); EndpointI[] endpoints = null; - Ice.Holder<Boolean> cached = new Ice.Holder<Boolean>(); + Holder<Boolean> cached = new Holder<>(); if(!ref.isWellKnown()) { endpoints = _table.getAdapterEndpoints(ref.getAdapterId(), ttl, cached); @@ -466,7 +463,7 @@ public final class LocatorInfo else { s.append("object = "); - s.append(Ice.Util.identityToString(ref.getIdentity())); + s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity())); s.append("\n"); } @@ -493,7 +490,7 @@ public final class LocatorInfo { throw exc; } - catch(Ice.AdapterNotFoundException ex) + catch(com.zeroc.Ice.AdapterNotFoundException ex) { final Instance instance = ref.getInstance(); if(instance.traceLevels().location >= 1) @@ -505,12 +502,12 @@ public final class LocatorInfo instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString()); } - Ice.NotRegisteredException e = new Ice.NotRegisteredException(); + com.zeroc.Ice.NotRegisteredException e = new com.zeroc.Ice.NotRegisteredException(); e.kindOfObject = "object adapter"; e.id = ref.getAdapterId(); throw e; } - catch(Ice.ObjectNotFoundException ex) + catch(com.zeroc.Ice.ObjectNotFoundException ex) { final Instance instance = ref.getInstance(); if(instance.traceLevels().location >= 1) @@ -518,20 +515,20 @@ public final class LocatorInfo StringBuilder s = new StringBuilder(128); s.append("object not found\n"); s.append("object = "); - s.append(Ice.Util.identityToString(ref.getIdentity())); + s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity())); instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString()); } - Ice.NotRegisteredException e = new Ice.NotRegisteredException(); + com.zeroc.Ice.NotRegisteredException e = new com.zeroc.Ice.NotRegisteredException(); e.kindOfObject = "object"; - e.id = Ice.Util.identityToString(ref.getIdentity()); + e.id = com.zeroc.Ice.Util.identityToString(ref.getIdentity()); throw e; } - catch(Ice.NotRegisteredException ex) + catch(com.zeroc.Ice.NotRegisteredException ex) { throw ex; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { final Instance instance = ref.getInstance(); if(instance.traceLevels().location >= 1) @@ -547,7 +544,7 @@ public final class LocatorInfo else { s.append("object = "); - s.append(Ice.Util.identityToString(ref.getIdentity())); + s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity())); s.append("\n"); } s.append("reason = " + ex); @@ -591,7 +588,7 @@ public final class LocatorInfo { s.append("object\n"); s.append("object = "); - s.append(Ice.Util.identityToString(ref.getIdentity())); + s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity())); s.append("\n"); } instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString()); @@ -630,7 +627,7 @@ public final class LocatorInfo StringBuilder s = new StringBuilder(128); s.append("searching for object by id\n"); s.append("object = "); - s.append(Ice.Util.identityToString(ref.getIdentity())); + s.append(com.zeroc.Ice.Util.identityToString(ref.getIdentity())); instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.toString()); } @@ -645,9 +642,10 @@ public final class LocatorInfo } private void - finishRequest(Reference ref, java.util.List<Reference> wellKnownRefs, Ice.ObjectPrx proxy, boolean notRegistered) + finishRequest(Reference ref, java.util.List<Reference> wellKnownRefs, com.zeroc.Ice.ObjectPrx proxy, + boolean notRegistered) { - if(proxy == null || ((Ice.ObjectPrxHelperBase)proxy).__reference().isIndirect()) + if(proxy == null || ((com.zeroc.Ice._ObjectPrxI)proxy).__reference().isIndirect()) { // // Remove the cached references of well-known objects for which we tried @@ -661,11 +659,11 @@ public final class LocatorInfo if(!ref.isWellKnown()) { - if(proxy != null && !((Ice.ObjectPrxHelperBase)proxy).__reference().isIndirect()) + if(proxy != null && !((com.zeroc.Ice._ObjectPrxI)proxy).__reference().isIndirect()) { // Cache the adapter endpoints. _table.addAdapterEndpoints(ref.getAdapterId(), - ((Ice.ObjectPrxHelperBase)proxy).__reference().getEndpoints()); + ((com.zeroc.Ice._ObjectPrxI)proxy).__reference().getEndpoints()); } else if(notRegistered) // If the adapter isn't registered anymore, remove it from the cache. { @@ -680,10 +678,10 @@ public final class LocatorInfo } else { - if(proxy != null && !((Ice.ObjectPrxHelperBase)proxy).__reference().isWellKnown()) + if(proxy != null && !((com.zeroc.Ice._ObjectPrxI)proxy).__reference().isWellKnown()) { // Cache the well-known object reference. - _table.addObjectReference(ref.getIdentity(), ((Ice.ObjectPrxHelperBase)proxy).__reference()); + _table.addObjectReference(ref.getIdentity(), ((com.zeroc.Ice._ObjectPrxI)proxy).__reference()); } else if(notRegistered) // If the well-known object isn't registered anymore, remove it from the cache. { @@ -698,11 +696,11 @@ public final class LocatorInfo } } - private final Ice.LocatorPrx _locator; - private Ice.LocatorRegistryPrx _locatorRegistry; + private final com.zeroc.Ice.LocatorPrx _locator; + private com.zeroc.Ice.LocatorRegistryPrx _locatorRegistry; private final LocatorTable _table; private final boolean _background; - private java.util.Map<String, Request> _adapterRequests = new java.util.HashMap<String, Request>(); - private java.util.Map<Ice.Identity, Request> _objectRequests = new java.util.HashMap<Ice.Identity, Request>(); + private java.util.Map<String, Request> _adapterRequests = new java.util.HashMap<>(); + private java.util.Map<com.zeroc.Ice.Identity, Request> _objectRequests = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorManager.java index 201dacf41b2..ae1aaca8019 100644 --- a/java/src/Ice/src/main/java/IceInternal/LocatorManager.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorManager.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class LocatorManager { @@ -35,8 +35,8 @@ public final class LocatorManager hashCode() { int h = 5381; - h = IceInternal.HashUtil.hashAdd(h, _id); - h = IceInternal.HashUtil.hashAdd(h, _encoding); + h = HashUtil.hashAdd(h, _id); + h = HashUtil.hashAdd(h, _encoding); return h; } @@ -56,19 +56,19 @@ public final class LocatorManager return c; } - LocatorKey set(Ice.LocatorPrx locator) + LocatorKey set(com.zeroc.Ice.LocatorPrx locator) { - Reference r = ((Ice.ObjectPrxHelperBase)locator).__reference(); + Reference r = ((com.zeroc.Ice._ObjectPrxI)locator).__reference(); _id = r.getIdentity(); _encoding = r.getEncoding(); return this; } - private Ice.Identity _id; - private Ice.EncodingVersion _encoding; + private com.zeroc.Ice.Identity _id; + private com.zeroc.Ice.EncodingVersion _encoding; } - LocatorManager(Ice.Properties properties) + LocatorManager(com.zeroc.Ice.Properties properties) { _background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0; } @@ -89,7 +89,7 @@ public final class LocatorManager // the locator info if it doesn't exist yet. // public LocatorInfo - get(Ice.LocatorPrx loc) + get(com.zeroc.Ice.LocatorPrx loc) { if(loc == null) { @@ -99,7 +99,7 @@ public final class LocatorManager // // The locator can't be located. // - Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(loc.ice_locator(null)); + com.zeroc.Ice.LocatorPrx locator = com.zeroc.Ice.LocatorPrx.uncheckedCast(loc.ice_locator(null)); // // TODO: reap unused locator info objects? @@ -132,9 +132,7 @@ public final class LocatorManager final private boolean _background; - private java.util.HashMap<Ice.LocatorPrx, LocatorInfo> _table = - new java.util.HashMap<Ice.LocatorPrx, LocatorInfo>(); - private java.util.HashMap<LocatorKey, LocatorTable> _locatorTables = - new java.util.HashMap<LocatorKey, LocatorTable>(); + private java.util.HashMap<com.zeroc.Ice.LocatorPrx, LocatorInfo> _table = new java.util.HashMap<>(); + private java.util.HashMap<LocatorKey, LocatorTable> _locatorTables = new java.util.HashMap<>(); private LocatorKey _lookupKey = new LocatorKey(); // A key used for the lookup } diff --git a/java/src/Ice/src/main/java/IceInternal/LocatorTable.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorTable.java index 0f2a13bda37..383c35cdb7b 100644 --- a/java/src/Ice/src/main/java/IceInternal/LocatorTable.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LocatorTable.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class LocatorTable { @@ -22,8 +22,8 @@ final class LocatorTable _objectTable.clear(); } - synchronized IceInternal.EndpointI[] - getAdapterEndpoints(String adapter, int ttl, Ice.Holder<Boolean> cached) + synchronized EndpointI[] + getAdapterEndpoints(String adapter, int ttl, Holder<Boolean> cached) { if(ttl == 0) // Locator cache disabled. { @@ -42,13 +42,13 @@ final class LocatorTable } synchronized void - addAdapterEndpoints(String adapter, IceInternal.EndpointI[] endpoints) + addAdapterEndpoints(String adapter, EndpointI[] endpoints) { _adapterEndpointsTable.put(adapter, - new EndpointTableEntry(IceInternal.Time.currentMonotonicTimeMillis(), endpoints)); + new EndpointTableEntry(Time.currentMonotonicTimeMillis(), endpoints)); } - synchronized IceInternal.EndpointI[] + synchronized EndpointI[] removeAdapterEndpoints(String adapter) { EndpointTableEntry entry = _adapterEndpointsTable.remove(adapter); @@ -56,7 +56,7 @@ final class LocatorTable } synchronized Reference - getObjectReference(Ice.Identity id, int ttl, Ice.Holder<Boolean> cached) + getObjectReference(com.zeroc.Ice.Identity id, int ttl, Holder<Boolean> cached) { if(ttl == 0) // Locator cache disabled. { @@ -75,13 +75,13 @@ final class LocatorTable } synchronized void - addObjectReference(Ice.Identity id, Reference ref) + addObjectReference(com.zeroc.Ice.Identity id, Reference ref) { - _objectTable.put(id, new ReferenceTableEntry(IceInternal.Time.currentMonotonicTimeMillis(), ref)); + _objectTable.put(id, new ReferenceTableEntry(Time.currentMonotonicTimeMillis(), ref)); } synchronized Reference - removeObjectReference(Ice.Identity id) + removeObjectReference(com.zeroc.Ice.Identity id) { ReferenceTableEntry entry = _objectTable.remove(id); return entry != null ? entry.reference : null; @@ -97,20 +97,20 @@ final class LocatorTable } else { - return IceInternal.Time.currentMonotonicTimeMillis() - time <= ((long)ttl * 1000); + return Time.currentMonotonicTimeMillis() - time <= ((long)ttl * 1000); } } private static final class EndpointTableEntry { - public EndpointTableEntry(long time, IceInternal.EndpointI[] endpoints) + public EndpointTableEntry(long time, EndpointI[] endpoints) { this.time = time; this.endpoints = endpoints; } final public long time; - final public IceInternal.EndpointI[] endpoints; + final public EndpointI[] endpoints; } private static final class ReferenceTableEntry @@ -125,8 +125,6 @@ final class LocatorTable final public Reference reference; } - private java.util.Map<String, EndpointTableEntry> _adapterEndpointsTable = - new java.util.HashMap<String, EndpointTableEntry>(); - private java.util.Map<Ice.Identity, ReferenceTableEntry> _objectTable = - new java.util.HashMap<Ice.Identity, ReferenceTableEntry>(); + private java.util.Map<String, EndpointTableEntry> _adapterEndpointsTable = new java.util.HashMap<>(); + private java.util.Map<com.zeroc.Ice.Identity, ReferenceTableEntry> _objectTable = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/LoggerAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminI.java index 4a322318fad..cf1dec3eebd 100644 --- a/java/src/Ice/src/main/java/IceInternal/LoggerAdminI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminI.java @@ -7,40 +7,44 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -final class LoggerAdminI extends Ice._LoggerAdminDisp +import com.zeroc.Ice.LogMessage; +import com.zeroc.Ice.LogMessageType; +import com.zeroc.Ice.RemoteLoggerPrx; + +final class LoggerAdminI implements com.zeroc.Ice.LoggerAdmin { @Override - public void attachRemoteLogger(Ice.RemoteLoggerPrx prx, Ice.LogMessageType[] messageTypes, String[] categories, - int messageMax, Ice.Current current) - throws Ice.RemoteLoggerAlreadyAttachedException + public void attachRemoteLogger(RemoteLoggerPrx prx, LogMessageType[] messageTypes, + String[] categories, int messageMax, com.zeroc.Ice.Current current) + throws com.zeroc.Ice.RemoteLoggerAlreadyAttachedException { if(prx == null) { return; // can't send this null RemoteLogger anything! } - - Ice.RemoteLoggerPrx remoteLogger = Ice.RemoteLoggerPrxHelper.uncheckedCast(prx.ice_twoway()); - + + RemoteLoggerPrx remoteLogger = RemoteLoggerPrx.uncheckedCast(prx.ice_twoway()); + Filters filters = new Filters(messageTypes, categories); - java.util.List<Ice.LogMessage> initLogMessages = null; - + java.util.List<LogMessage> initLogMessages = null; + synchronized(this) { if(_sendLogCommunicator == null) { if(_destroyed) { - throw new Ice.ObjectNotExistException(); + throw new com.zeroc.Ice.ObjectNotExistException(); } - _sendLogCommunicator = + _sendLogCommunicator = createSendLogCommunicator(current.adapter.getCommunicator(), _logger.getLocalLogger()); } - - Ice.Identity remoteLoggerId = remoteLogger.ice_getIdentity(); - + + com.zeroc.Ice.Identity remoteLoggerId = remoteLogger.ice_getIdentity(); + if(_remoteLoggerMap.containsKey(remoteLoggerId)) { if(_traceLevel > 0) @@ -48,23 +52,23 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp _logger.trace(_traceCategory, "rejecting `" + remoteLogger.toString() + "' with RemoteLoggerAlreadyAttachedException"); } - - throw new Ice.RemoteLoggerAlreadyAttachedException(); + + throw new com.zeroc.Ice.RemoteLoggerAlreadyAttachedException(); } - _remoteLoggerMap.put(remoteLoggerId, + _remoteLoggerMap.put(remoteLoggerId, new RemoteLoggerData(changeCommunicator(remoteLogger, _sendLogCommunicator), filters)); - + if(messageMax != 0) { - initLogMessages = new java.util.LinkedList<Ice.LogMessage>(_queue); // copy + initLogMessages = new java.util.LinkedList<>(_queue); // copy } else { - initLogMessages = new java.util.LinkedList<Ice.LogMessage>(); + initLogMessages = new java.util.LinkedList<>(); } } - + if(_traceLevel > 0) { _logger.trace(_traceCategory, "attached `" + remoteLogger.toString() + "'"); @@ -74,51 +78,48 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp { filterLogMessages(initLogMessages, filters.messageTypes, filters.traceCategories, messageMax); } - - final Ice.Callback initCompletedCb = new Ice.Callback() - { - @Override - public void completed(Ice.AsyncResult r) + + try + { + remoteLogger.initAsync(_logger.getPrefix(), initLogMessages.toArray(new LogMessage[0])).whenComplete( + (Void v, Throwable ex) -> { - Ice.RemoteLoggerPrx remoteLogger = Ice.RemoteLoggerPrxHelper.uncheckedCast(r.getProxy()); - - try + if(ex != null) { - remoteLogger.end_init(r); - - if(_traceLevel > 1) + if(ex instanceof com.zeroc.Ice.LocalException) { - _logger.trace(_traceCategory, r.getOperation() + " on `" + remoteLogger.toString() + - "' completed successfully"); + deadRemoteLogger(remoteLogger, _logger, (com.zeroc.Ice.LocalException)ex, "init"); + } + else + { + deadRemoteLogger(remoteLogger, _logger, new com.zeroc.Ice.UnknownException(ex), "init"); } } - catch(Ice.LocalException ex) + else { - deadRemoteLogger(remoteLogger, _logger, ex, r.getOperation()); + if(_traceLevel > 1) + { + _logger.trace(_traceCategory, "init on `" + remoteLogger.toString() + + "' completed successfully"); + } } - } - }; - - try - { - remoteLogger.begin_init(_logger.getPrefix(), initLogMessages.toArray(new Ice.LogMessage[0]), - initCompletedCb); + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { deadRemoteLogger(remoteLogger, _logger, ex, "init"); throw ex; - } + } } - + @Override - public boolean detachRemoteLogger(Ice.RemoteLoggerPrx remoteLogger, Ice.Current current) + public boolean detachRemoteLogger(RemoteLoggerPrx remoteLogger, com.zeroc.Ice.Current current) { if(remoteLogger == null) { return false; } - + // // No need to convert the proxy as we only use its identity // @@ -138,46 +139,51 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp return found; } - + @Override - public Ice.LogMessage[] getLog(Ice.LogMessageType[] messageTypes, String[] categories, int messageMax, - Ice.StringHolder prefix, Ice.Current current) + public com.zeroc.Ice.LoggerAdmin.GetLogResult getLog( + LogMessageType[] messageTypes, + String[] categories, + int messageMax, + com.zeroc.Ice.Current current) { - java.util.List<Ice.LogMessage> logMessages = null; + com.zeroc.Ice.LoggerAdmin.GetLogResult r = new com.zeroc.Ice.LoggerAdmin.GetLogResult(); + + java.util.List<LogMessage> logMessages = null; synchronized(this) { if(messageMax != 0) { - logMessages = new java.util.LinkedList<Ice.LogMessage>(_queue); + logMessages = new java.util.LinkedList<>(_queue); } else { - logMessages = new java.util.LinkedList<Ice.LogMessage>(); + logMessages = new java.util.LinkedList<>(); } } - - prefix.value = _logger.getPrefix(); - + + r.prefix = _logger.getPrefix(); + if(!logMessages.isEmpty()) { Filters filters = new Filters(messageTypes, categories); filterLogMessages(logMessages, filters.messageTypes, filters.traceCategories, messageMax); } - return logMessages.toArray(new Ice.LogMessage[0]); + r.returnValue = logMessages.toArray(new LogMessage[0]); + return r; } - - LoggerAdminI(Ice.Properties props, LoggerAdminLoggerI logger) + LoggerAdminI(com.zeroc.Ice.Properties props, LoggerAdminLoggerI logger) { _maxLogCount = props.getPropertyAsIntWithDefault("Ice.Admin.Logger.KeepLogs", 100); _maxTraceCount = props.getPropertyAsIntWithDefault("Ice.Admin.Logger.KeepTraces", 100); _traceLevel = props.getPropertyAsInt("Ice.Trace.Admin.Logger"); _logger = logger; } - + void destroy() { - Ice.Communicator sendLogCommunicator = null; + com.zeroc.Ice.Communicator sendLogCommunicator = null; synchronized(this) { @@ -188,9 +194,9 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp _sendLogCommunicator = null; } } - - // - // Destroy outside lock to avoid deadlock when there are outstanding two-way log calls sent to + + // + // Destroy outside lock to avoid deadlock when there are outstanding two-way log calls sent to // remote logggers // if(sendLogCommunicator != null) @@ -199,19 +205,19 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp } } - synchronized java.util.List<Ice.RemoteLoggerPrx> log(Ice.LogMessage logMessage) + synchronized java.util.List<RemoteLoggerPrx> log(LogMessage logMessage) { - java.util.List<Ice.RemoteLoggerPrx> remoteLoggers = null; + java.util.List<RemoteLoggerPrx> remoteLoggers = null; // // Put message in _queue // - if((logMessage.type != Ice.LogMessageType.TraceMessage && _maxLogCount > 0) || - (logMessage.type == Ice.LogMessageType.TraceMessage && _maxTraceCount > 0)) + if((logMessage.type != LogMessageType.TraceMessage && _maxLogCount > 0) || + (logMessage.type == LogMessageType.TraceMessage && _maxTraceCount > 0)) { - _queue.add(logMessage); // add at the end - - if(logMessage.type != Ice.LogMessageType.TraceMessage) + _queue.add(logMessage); // add at the end + + if(logMessage.type != LogMessageType.TraceMessage) { assert(_maxLogCount > 0); if(_logCount == _maxLogCount) @@ -222,8 +228,8 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp assert(_oldestLog != -1); _queue.remove(_oldestLog); int qs = _queue.size(); - - while(_oldestLog < qs && _queue.get(_oldestLog).type == Ice.LogMessageType.TraceMessage) + + while(_oldestLog < qs && _queue.get(_oldestLog).type == LogMessageType.TraceMessage) { _oldestLog++; } @@ -250,7 +256,7 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp assert(_oldestTrace != -1); _queue.remove(_oldestTrace); int qs = _queue.size(); - while(_oldestTrace < qs && _queue.get(_oldestTrace).type != Ice.LogMessageType.TraceMessage) + while(_oldestTrace < qs && _queue.get(_oldestTrace).type != LogMessageType.TraceMessage) { _oldestTrace++; } @@ -266,33 +272,34 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp } } } - + // // Queue updated, now find which remote loggers want this message - // + // for(RemoteLoggerData p : _remoteLoggerMap.values()) { Filters filters = p.filters; - + if(filters.messageTypes.isEmpty() || filters.messageTypes.contains(logMessage.type)) { - if(logMessage.type != Ice.LogMessageType.TraceMessage || filters.traceCategories.isEmpty() || - filters.traceCategories.contains(logMessage.traceCategory)) + if(logMessage.type != LogMessageType.TraceMessage || filters.traceCategories.isEmpty() || + filters.traceCategories.contains(logMessage.traceCategory)) { if(remoteLoggers == null) { - remoteLoggers = new java.util.ArrayList<Ice.RemoteLoggerPrx>(); + remoteLoggers = new java.util.ArrayList<>(); } remoteLoggers.add(p.remoteLogger); } } } } - + return remoteLoggers; } - - void deadRemoteLogger(Ice.RemoteLoggerPrx remoteLogger, Ice.Logger logger, Ice.LocalException ex, String operation) + + void deadRemoteLogger(RemoteLoggerPrx remoteLogger, com.zeroc.Ice.Logger logger, + com.zeroc.Ice.LocalException ex, String operation) { // // No need to convert remoteLogger as we only use its identity @@ -301,28 +308,28 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp { if(_traceLevel > 0) { - logger.trace(_traceCategory, "detached `" + remoteLogger.toString() + "' because " + logger.trace(_traceCategory, "detached `" + remoteLogger.toString() + "' because " + operation + " raised:\n" + ex.toString()); } } } - + int getTraceLevel() { return _traceLevel; } - - private synchronized boolean removeRemoteLogger(Ice.RemoteLoggerPrx remoteLogger) + + private synchronized boolean removeRemoteLogger(RemoteLoggerPrx remoteLogger) { - return _remoteLoggerMap.remove(remoteLogger.ice_getIdentity()) != null; + return _remoteLoggerMap.remove(remoteLogger.ice_getIdentity()) != null; } - - private static void filterLogMessages(java.util.List<Ice.LogMessage> logMessages, - java.util.Set<Ice.LogMessageType> messageTypes, + + private static void filterLogMessages(java.util.List<LogMessage> logMessages, + java.util.Set<LogMessageType> messageTypes, java.util.Set<String> traceCategories, int messageMax) { assert(!logMessages.isEmpty() && messageMax != 0); - + // // Filter only if one of the 3 filters is set; messageMax < 0 means "give me all" // that match the other filters, if any. @@ -330,20 +337,20 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp if(!messageTypes.isEmpty() || !traceCategories.isEmpty() || messageMax > 0) { int count = 0; - java.util.ListIterator<Ice.LogMessage> p = logMessages.listIterator(logMessages.size()); + java.util.ListIterator<LogMessage> p = logMessages.listIterator(logMessages.size()); while(p.hasPrevious()) { boolean keepIt = false; - Ice.LogMessage msg = p.previous(); + LogMessage msg = p.previous(); if(messageTypes.isEmpty() || messageTypes.contains(msg.type)) { - if(msg.type != Ice.LogMessageType.TraceMessage || traceCategories.isEmpty() || + if(msg.type != LogMessageType.TraceMessage || traceCategories.isEmpty() || traceCategories.contains(msg.traceCategory)) { keepIt = true; } } - + if(keepIt) { ++count; @@ -372,18 +379,18 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp // // Change this proxy's communicator, while keeping its invocation timeout // - private static Ice.RemoteLoggerPrx changeCommunicator(Ice.RemoteLoggerPrx prx, Ice.Communicator communicator) + private static RemoteLoggerPrx changeCommunicator(RemoteLoggerPrx prx, com.zeroc.Ice.Communicator communicator) { if(prx == null) { return null; } - Ice.ObjectPrx result = communicator.stringToProxy(prx.toString()); - return Ice.RemoteLoggerPrxHelper.uncheckedCast(result.ice_invocationTimeout(prx.ice_getInvocationTimeout())); + com.zeroc.Ice.ObjectPrx result = communicator.stringToProxy(prx.toString()); + return RemoteLoggerPrx.uncheckedCast(result.ice_invocationTimeout(prx.ice_getInvocationTimeout())); } - private static void copyProperties(String prefix, Ice.Properties from, Ice.Properties to) + private static void copyProperties(String prefix, com.zeroc.Ice.Properties from, com.zeroc.Ice.Properties to) { for(java.util.Map.Entry<String, String> p : from.getPropertiesForPrefix(prefix).entrySet()) { @@ -391,20 +398,21 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp } } - private static Ice.Communicator createSendLogCommunicator(Ice.Communicator communicator, Ice.Logger logger) + private static com.zeroc.Ice.Communicator createSendLogCommunicator(com.zeroc.Ice.Communicator communicator, + com.zeroc.Ice.Logger logger) { - Ice.InitializationData initData = new Ice.InitializationData(); + com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData(); initData.logger = logger; - initData.properties = Ice.Util.createProperties(); + initData.properties = com.zeroc.Ice.Util.createProperties(); - Ice.Properties mainProps = communicator.getProperties(); + com.zeroc.Ice.Properties mainProps = communicator.getProperties(); copyProperties("Ice.Default.Locator", mainProps, initData.properties); copyProperties("Ice.Plugin.IceSSL", mainProps, initData.properties); copyProperties("IceSSL.", mainProps, initData.properties); String[] extraProps = mainProps.getPropertyAsList("Ice.Admin.Logger.Properties"); - + if(extraProps.length > 0) { for(int i = 0; i < extraProps.length; ++i) @@ -417,11 +425,11 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp } initData.properties.parseCommandLineOptions("", extraProps); } - return Ice.Util.initialize(initData); + return com.zeroc.Ice.Util.initialize(initData); } - - private final java.util.List<Ice.LogMessage> _queue = new java.util.LinkedList<Ice.LogMessage>(); + + private final java.util.List<LogMessage> _queue = new java.util.LinkedList<>(); private int _logCount = 0; // non-trace messages private final int _maxLogCount; private int _traceCount = 0; @@ -433,33 +441,32 @@ final class LoggerAdminI extends Ice._LoggerAdminDisp private static class Filters { - Filters(Ice.LogMessageType[] m, String[] c) + Filters(LogMessageType[] m, String[] c) { - messageTypes = new java.util.HashSet<Ice.LogMessageType>(java.util.Arrays.asList(m)); - traceCategories = new java.util.HashSet<String>(java.util.Arrays.asList(c)); + messageTypes = new java.util.HashSet<>(java.util.Arrays.asList(m)); + traceCategories = new java.util.HashSet<>(java.util.Arrays.asList(c)); } - final java.util.Set<Ice.LogMessageType> messageTypes; + final java.util.Set<LogMessageType> messageTypes; final java.util.Set<String> traceCategories; } private static class RemoteLoggerData { - RemoteLoggerData(Ice.RemoteLoggerPrx prx, Filters f) + RemoteLoggerData(RemoteLoggerPrx prx, Filters f) { remoteLogger = prx; filters = f; } - final Ice.RemoteLoggerPrx remoteLogger; + final RemoteLoggerPrx remoteLogger; final Filters filters; } - private final java.util.Map<Ice.Identity, RemoteLoggerData> _remoteLoggerMap - = new java.util.HashMap<Ice.Identity, RemoteLoggerData>(); - + private final java.util.Map<com.zeroc.Ice.Identity, RemoteLoggerData> _remoteLoggerMap = new java.util.HashMap<>(); + private final LoggerAdminLoggerI _logger; - private Ice.Communicator _sendLogCommunicator = null; + private com.zeroc.Ice.Communicator _sendLogCommunicator = null; private boolean _destroyed = false; static private final String _traceCategory = "Admin.Logger"; } diff --git a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLogger.java index 1ae9f52faf1..fe7d62d3dcc 100644 --- a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLogger.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLogger.java @@ -7,10 +7,10 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -interface LoggerAdminLogger extends Ice.Logger +interface LoggerAdminLogger extends com.zeroc.Ice.Logger { - Ice.Object getFacet(); + com.zeroc.Ice.Object getFacet(); void destroy(); } diff --git a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLoggerI.java index b5743d72873..dff7ea3e85c 100644 --- a/java/src/Ice/src/main/java/IceInternal/LoggerAdminLoggerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/LoggerAdminLoggerI.java @@ -7,14 +7,17 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.LogMessage; +import com.zeroc.Ice.LogMessageType; final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable { @Override public void print(String message) { - Ice.LogMessage logMessage = new Ice.LogMessage(Ice.LogMessageType.PrintMessage, now(), "", message); + LogMessage logMessage = new LogMessage(LogMessageType.PrintMessage, now(), "", message); _localLogger.print(message); log(logMessage); } @@ -22,7 +25,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable @Override public void trace(String category, String message) { - Ice.LogMessage logMessage = new Ice.LogMessage(Ice.LogMessageType.TraceMessage, now(), category, message); + LogMessage logMessage = new LogMessage(LogMessageType.TraceMessage, now(), category, message); _localLogger.trace(category, message); log(logMessage); } @@ -30,7 +33,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable @Override public void warning(String message) { - Ice.LogMessage logMessage = new Ice.LogMessage(Ice.LogMessageType.WarningMessage, now(), "", message); + LogMessage logMessage = new LogMessage(LogMessageType.WarningMessage, now(), "", message); _localLogger.warning(message); log(logMessage); } @@ -38,7 +41,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable @Override public void error(String message) { - Ice.LogMessage logMessage = new Ice.LogMessage(Ice.LogMessageType.ErrorMessage, now(), "", message); + LogMessage logMessage = new LogMessage(LogMessageType.ErrorMessage, now(), "", message); _localLogger.error(message); log(logMessage); } @@ -50,13 +53,13 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable } @Override - public Ice.Logger cloneWithPrefix(String prefix) + public com.zeroc.Ice.Logger cloneWithPrefix(String prefix) { return _localLogger.cloneWithPrefix(prefix); } - + @Override - public Ice.Object getFacet() + public com.zeroc.Ice.Object getFacet() { return _loggerAdmin; } @@ -75,7 +78,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable notifyAll(); } } - + if(thread != null) { try @@ -88,7 +91,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable { _sendLogThread = thread; } - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } } @@ -103,36 +106,6 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable _localLogger.trace(_traceCategory, "send log thread started"); } - final Ice.Callback logCompletedCb = new Ice.Callback() - { - - @Override - public void completed(Ice.AsyncResult r) - { - Ice.RemoteLoggerPrx remoteLogger = Ice.RemoteLoggerPrxHelper.uncheckedCast(r.getProxy()); - - try - { - remoteLogger.end_log(r); - - if(_loggerAdmin.getTraceLevel() > 1) - { - _localLogger.trace(_traceCategory, r.getOperation() + " on `" + remoteLogger.toString() + - "' completed successfully"); - } - } - catch(Ice.CommunicatorDestroyedException ex) - { - // expected if there are outstanding calls during - // communicator destruction - } - catch(Ice.LocalException ex) - { - _loggerAdmin.deadRemoteLogger(remoteLogger, _localLogger, ex, r.getOperation()); - } - } - }; - for(;;) { Job job = null; @@ -149,7 +122,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable // Ignored, this should never occur } } - + if(_destroyed) { break; // for(;;) @@ -158,26 +131,54 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable assert(!_jobQueue.isEmpty()); job = _jobQueue.removeFirst(); } - - for(Ice.RemoteLoggerPrx p : job.remoteLoggers) + + for(com.zeroc.Ice.RemoteLoggerPrx p : job.remoteLoggers) { if(_loggerAdmin.getTraceLevel() > 1) { _localLogger.trace(_traceCategory, "sending log message to `" + p.toString() + "'"); } - + try { // // p is a proxy associated with the _sendLogCommunicator // - p.begin_log(job.logMessage, logCompletedCb); + p.logAsync(job.logMessage).whenComplete( + (Void v, Throwable ex) -> + { + if(ex != null) + { + if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException) + { + // Expected if there are outstanding calls during communicator destruction. + } + else if(ex instanceof com.zeroc.Ice.LocalException) + { + _loggerAdmin.deadRemoteLogger(p, _localLogger, (com.zeroc.Ice.LocalException)ex, + "log"); + } + else + { + _loggerAdmin.deadRemoteLogger(p, _localLogger, + new com.zeroc.Ice.UnknownException(ex), "log"); + } + } + else + { + if(_loggerAdmin.getTraceLevel() > 1) + { + _localLogger.trace(_traceCategory, "log on `" + p.toString() + + "' completed successfully"); + } + } + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { _loggerAdmin.deadRemoteLogger(p, _localLogger, ex, "log"); } - } + } } if(_loggerAdmin.getTraceLevel() > 1) @@ -186,7 +187,7 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable } } - LoggerAdminLoggerI(Ice.Properties props, Ice.Logger localLogger) + LoggerAdminLoggerI(com.zeroc.Ice.Properties props, com.zeroc.Ice.Logger localLogger) { if(localLogger instanceof LoggerAdminLoggerI) { @@ -200,19 +201,19 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable _loggerAdmin = new LoggerAdminI(props, this); } - Ice.Logger getLocalLogger() + com.zeroc.Ice.Logger getLocalLogger() { return _localLogger; } - void log(Ice.LogMessage logMessage) + void log(LogMessage logMessage) { - java.util.List<Ice.RemoteLoggerPrx> remoteLoggers = _loggerAdmin.log(logMessage); - + java.util.List<com.zeroc.Ice.RemoteLoggerPrx> remoteLoggers = _loggerAdmin.log(logMessage); + if(remoteLoggers != null) { assert(!remoteLoggers.isEmpty()); - + synchronized(this) { if(_sendLogThread == null) @@ -220,10 +221,10 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable _sendLogThread = new Thread(this, "Ice.SendLogThread"); _sendLogThread.start(); } - + _jobQueue.addLast(new Job(remoteLoggers, logMessage)); notifyAll(); - } + } } } @@ -231,24 +232,24 @@ final class LoggerAdminLoggerI implements LoggerAdminLogger, Runnable { return java.util.Calendar.getInstance().getTimeInMillis() * 1000; } - + private static class Job { - Job(java.util.List<Ice.RemoteLoggerPrx> r, Ice.LogMessage l) + Job(java.util.List<com.zeroc.Ice.RemoteLoggerPrx> r, LogMessage l) { remoteLoggers = r; logMessage = l; } - - final java.util.List<Ice.RemoteLoggerPrx> remoteLoggers; - final Ice.LogMessage logMessage; - } - - private final Ice.Logger _localLogger; + + final java.util.List<com.zeroc.Ice.RemoteLoggerPrx> remoteLoggers; + final LogMessage logMessage; + } + + private final com.zeroc.Ice.Logger _localLogger; private final LoggerAdminI _loggerAdmin; private boolean _destroyed = false; private Thread _sendLogThread; - private final java.util.Deque<Job> _jobQueue = new java.util.ArrayDeque<Job>(); - + private final java.util.Deque<Job> _jobQueue = new java.util.ArrayDeque<>(); + static private final String _traceCategory = "Admin.Logger"; } diff --git a/java/src/Ice/src/main/java/IceInternal/MetricsAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java index 92b0cb139a6..dad0c811f1d 100644 --- a/java/src/Ice/src/main/java/IceInternal/MetricsAdminI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsAdminI.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.PropertiesAdminUpdateCallback +public class MetricsAdminI implements com.zeroc.IceMX.MetricsAdmin, com.zeroc.Ice.PropertiesAdminUpdateCallback { final static private String[] suffixes = { @@ -21,17 +21,16 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper "Map.*", }; - static void - validateProperties(String prefix, Ice.Properties properties) + static void validateProperties(String prefix, com.zeroc.Ice.Properties properties) { java.util.Map<String, String> props = properties.getPropertiesForPrefix(prefix); - java.util.List<String> unknownProps = new java.util.ArrayList<String>(); + java.util.List<String> unknownProps = new java.util.ArrayList<>(); for(String prop : props.keySet()) { boolean valid = false; for(String suffix : suffixes) { - if(IceUtilInternal.StringUtil.match(prop, prefix + suffix, false)) + if(com.zeroc.IceUtilInternal.StringUtil.match(prop, prefix + suffix, false)) { valid = true; break; @@ -54,11 +53,11 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper message.append("\n "); message.append(p); } - Ice.Util.getProcessLogger().warning(message.toString()); + com.zeroc.Ice.Util.getProcessLogger().warning(message.toString()); } } - static class MetricsMapFactory<T extends IceMX.Metrics> + static class MetricsMapFactory<T extends com.zeroc.IceMX.Metrics> { public MetricsMapFactory(Runnable updater, Class<T> cl) { @@ -74,12 +73,12 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } public MetricsMap<T> - create(String mapPrefix, Ice.Properties properties) + create(String mapPrefix, com.zeroc.Ice.Properties properties) { return new MetricsMap<T>(mapPrefix, _class, properties, _subMaps); } - public <S extends IceMX.Metrics> void + public <S extends com.zeroc.IceMX.Metrics> void registerSubMap(String subMap, Class<S> cl, java.lang.reflect.Field field) { _subMaps.put(subMap, new MetricsMap.SubMapFactory<S>(cl, field)); @@ -87,11 +86,10 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper final private Runnable _updater; final private Class<T> _class; - final private java.util.Map<String, MetricsMap.SubMapFactory<?>> _subMaps = - new java.util.HashMap<String, MetricsMap.SubMapFactory<?>>(); + final private java.util.Map<String, MetricsMap.SubMapFactory<?>> _subMaps = new java.util.HashMap<>(); } - public MetricsAdminI(Ice.Properties properties, Ice.Logger logger) + public MetricsAdminI(com.zeroc.Ice.Properties properties, com.zeroc.Ice.Logger logger) { _logger = logger; _properties = properties; @@ -100,12 +98,12 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper public void updateViews() { - java.util.Set<MetricsMapFactory<?> > updatedMaps = new java.util.HashSet<MetricsMapFactory<?> >(); + java.util.Set<MetricsMapFactory<?> > updatedMaps = new java.util.HashSet<>(); synchronized(this) { String viewsPrefix = "IceMX.Metrics."; java.util.Map<String, String> viewsProps = _properties.getPropertiesForPrefix(viewsPrefix); - java.util.Map<String, MetricsViewI> views = new java.util.HashMap<String, MetricsViewI>(); + java.util.Map<String, MetricsViewI> views = new java.util.HashMap<>(); _disabledViews.clear(); for(java.util.Map.Entry<String, String> e : viewsProps.entrySet()) { @@ -176,17 +174,20 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } @Override - synchronized public String[] - getMetricsViewNames(Ice.StringSeqHolder holder, Ice.Current current) + synchronized public com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult getMetricsViewNames( + com.zeroc.Ice.Current current) { - holder.value = _disabledViews.toArray(new String[_disabledViews.size()]); - return _views.keySet().toArray(new String[_views.size()]); + com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult r = + new com.zeroc.IceMX.MetricsAdmin.GetMetricsViewNamesResult(); + r.disabledViews = _disabledViews.toArray(new String[_disabledViews.size()]); + r.returnValue = _views.keySet().toArray(new String[_views.size()]); + return r; } @Override public void - enableMetricsView(String name, Ice.Current current) - throws IceMX.UnknownMetricsView + enableMetricsView(String name, com.zeroc.Ice.Current current) + throws com.zeroc.IceMX.UnknownMetricsView { synchronized(this) { @@ -197,9 +198,8 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } @Override - public void - disableMetricsView(String name, Ice.Current current) - throws IceMX.UnknownMetricsView + public void disableMetricsView(String name, com.zeroc.Ice.Current current) + throws com.zeroc.IceMX.UnknownMetricsView { synchronized(this) { @@ -210,47 +210,52 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } @Override - synchronized public java.util.Map<String, IceMX.Metrics[]> - getMetricsView(String viewName, Ice.LongHolder holder, Ice.Current current) - throws IceMX.UnknownMetricsView + synchronized public com.zeroc.IceMX.MetricsAdmin.GetMetricsViewResult getMetricsView( + String viewName, + com.zeroc.Ice.Current current) + throws com.zeroc.IceMX.UnknownMetricsView { + com.zeroc.IceMX.MetricsAdmin.GetMetricsViewResult r = new com.zeroc.IceMX.MetricsAdmin.GetMetricsViewResult(); MetricsViewI view = getMetricsView(viewName); - holder.value = IceInternal.Time.currentMonotonicTimeMillis(); + r.timestamp = Time.currentMonotonicTimeMillis(); if(view != null) { - return view.getMetrics(); + r.returnValue = view.getMetrics(); + } + else + { + r.returnValue = new java.util.HashMap<>(); } - return new java.util.HashMap<String, IceMX.Metrics[]>(); + return r; } @Override - synchronized public IceMX.MetricsFailures[] - getMapMetricsFailures(String viewName, String mapName, Ice.Current current) - throws IceMX.UnknownMetricsView + synchronized public com.zeroc.IceMX.MetricsFailures[] getMapMetricsFailures(String viewName, String mapName, + com.zeroc.Ice.Current current) + throws com.zeroc.IceMX.UnknownMetricsView { MetricsViewI view = getMetricsView(viewName); if(view != null) { return view.getFailures(mapName); } - return new IceMX.MetricsFailures[0]; + return new com.zeroc.IceMX.MetricsFailures[0]; } @Override - synchronized public IceMX.MetricsFailures - getMetricsFailures(String viewName, String mapName, String id, Ice.Current current) - throws IceMX.UnknownMetricsView + synchronized public com.zeroc.IceMX.MetricsFailures getMetricsFailures(String viewName, String mapName, String id, + com.zeroc.Ice.Current current) + throws com.zeroc.IceMX.UnknownMetricsView { MetricsViewI view = getMetricsView(viewName); if(view != null) { return view.getFailures(mapName, id); } - return new IceMX.MetricsFailures(); + return new com.zeroc.IceMX.MetricsFailures(); } - public <T extends IceMX.Metrics> void - registerMap(String map, Class<T> cl, Runnable updater) + public <T extends com.zeroc.IceMX.Metrics> void registerMap(String map, Class<T> cl, Runnable updater) { boolean updated; MetricsMapFactory<T> factory; @@ -266,8 +271,8 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } } - synchronized public <S extends IceMX.Metrics> void - registerSubMap(String map, String subMap, Class<S> cl, java.lang.reflect.Field field) + synchronized public <S extends com.zeroc.IceMX.Metrics> void registerSubMap(String map, String subMap, Class<S> cl, + java.lang.reflect.Field field) { boolean updated; MetricsMapFactory<?> factory; @@ -288,8 +293,7 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } } - public void - unregisterMap(String mapName) + public void unregisterMap(String mapName) { boolean updated; MetricsMapFactory<?> factory; @@ -308,10 +312,9 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } } - public <T extends IceMX.Metrics> java.util.List<MetricsMap<T>> - getMaps(String mapName, Class<T> cl) + public <T extends com.zeroc.IceMX.Metrics> java.util.List<MetricsMap<T>> getMaps(String mapName, Class<T> cl) { - java.util.List<MetricsMap<T>> maps = new java.util.ArrayList<MetricsMap<T>>(); + java.util.List<MetricsMap<T>> maps = new java.util.ArrayList<>(); for(MetricsViewI v : _views.values()) { MetricsMap<T> map = v.getMap(mapName, cl); @@ -323,15 +326,13 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper return maps; } - public Ice.Logger - getLogger() + public com.zeroc.Ice.Logger getLogger() { return _logger; } @Override - public void - updated(java.util.Map<String, String> props) + public void updated(java.util.Map<String, String> props) { for(java.util.Map.Entry<String, String> e : props.entrySet()) { @@ -352,24 +353,22 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper } } - private MetricsViewI - getMetricsView(String name) - throws IceMX.UnknownMetricsView + private MetricsViewI getMetricsView(String name) + throws com.zeroc.IceMX.UnknownMetricsView { MetricsViewI view = _views.get(name); if(view == null) { if(!_disabledViews.contains(name)) { - throw new IceMX.UnknownMetricsView(); + throw new com.zeroc.IceMX.UnknownMetricsView(); } return null; } return view; } - private boolean - addOrUpdateMap(String mapName, MetricsMapFactory<?> factory) + private boolean addOrUpdateMap(String mapName, MetricsMapFactory<?> factory) { boolean updated = false; for(MetricsViewI v : _views.values()) @@ -379,8 +378,7 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper return updated; } - private boolean - removeMap(String mapName) + private boolean removeMap(String mapName) { boolean updated = false; for(MetricsViewI v : _views.values()) @@ -390,11 +388,10 @@ public class MetricsAdminI extends IceMX._MetricsAdminDisp implements Ice.Proper return updated; } - private Ice.Properties _properties; - final private Ice.Logger _logger; - final private java.util.Map<String, MetricsMapFactory<?>> _factories = - new java.util.HashMap<String, MetricsMapFactory<?>>(); + private com.zeroc.Ice.Properties _properties; + final private com.zeroc.Ice.Logger _logger; + final private java.util.Map<String, MetricsMapFactory<?>> _factories = new java.util.HashMap<>(); - private java.util.Map<String, MetricsViewI> _views = new java.util.HashMap<String, MetricsViewI>(); - private java.util.Set<String> _disabledViews = new java.util.HashSet<String>(); + private java.util.Map<String, MetricsViewI> _views = new java.util.HashMap<>(); + private java.util.Set<String> _disabledViews = new java.util.HashSet<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/MetricsMap.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsMap.java index b4d6dfb10c2..dae79c069d1 100644 --- a/java/src/Ice/src/main/java/IceInternal/MetricsMap.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsMap.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -public class MetricsMap<T extends IceMX.Metrics> +public class MetricsMap<T extends com.zeroc.IceMX.Metrics> { public class Entry { @@ -26,7 +26,7 @@ public class MetricsMap<T extends IceMX.Metrics> ++_object.failures; if(_failures == null) { - _failures = new java.util.HashMap<String, Integer>(); + _failures = new java.util.HashMap<>(); } Integer count = _failures.get(exceptionName); _failures.put(exceptionName, new Integer(count == null ? 1 : count + 1)); @@ -34,8 +34,8 @@ public class MetricsMap<T extends IceMX.Metrics> } @SuppressWarnings("unchecked") - public <S extends IceMX.Metrics> MetricsMap<S>.Entry - getMatching(String mapName, IceMX.MetricsHelper<S> helper, Class<S> cl) + public <S extends com.zeroc.IceMX.Metrics> MetricsMap<S>.Entry + getMatching(String mapName, com.zeroc.IceMX.MetricsHelper<S> helper, Class<S> cl) { SubMap<S> m; synchronized(MetricsMap.this) @@ -50,7 +50,7 @@ public class MetricsMap<T extends IceMX.Metrics> } if(_subMaps == null) { - _subMaps = new java.util.HashMap<String, SubMap<?>>(); + _subMaps = new java.util.HashMap<>(); } _subMaps.put(mapName, m); } @@ -72,7 +72,7 @@ public class MetricsMap<T extends IceMX.Metrics> } public void - execute(IceMX.Observer.MetricsUpdate<T> func) + execute(com.zeroc.IceMX.Observer.MetricsUpdate<T> func) { synchronized(MetricsMap.this) { @@ -86,21 +86,21 @@ public class MetricsMap<T extends IceMX.Metrics> return MetricsMap.this; } - private IceMX.MetricsFailures + private com.zeroc.IceMX.MetricsFailures getFailures() { if(_failures == null) { return null; } - IceMX.MetricsFailures f = new IceMX.MetricsFailures(); + com.zeroc.IceMX.MetricsFailures f = new com.zeroc.IceMX.MetricsFailures(); f.id = _object.id; - f.failures = new java.util.HashMap<String, Integer>(_failures); + f.failures = new java.util.HashMap<>(_failures); return f; } private void - attach(IceMX.MetricsHelper<T> helper) + attach(com.zeroc.IceMX.MetricsHelper<T> helper) { ++_object.total; ++_object.current; @@ -115,7 +115,7 @@ public class MetricsMap<T extends IceMX.Metrics> @Override @SuppressWarnings("unchecked") - public IceMX.Metrics + public com.zeroc.IceMX.Metrics clone() { T metrics = (T)_object.clone(); @@ -134,7 +134,7 @@ public class MetricsMap<T extends IceMX.Metrics> private java.util.Map<String, SubMap<?>> _subMaps; } - static class SubMap<S extends IceMX.Metrics> + static class SubMap<S extends com.zeroc.IceMX.Metrics> { public SubMap(MetricsMap<S> map, java.lang.reflect.Field field) @@ -144,13 +144,13 @@ public class MetricsMap<T extends IceMX.Metrics> } public MetricsMap<S>.Entry - getMatching(IceMX.MetricsHelper<S> helper) + getMatching(com.zeroc.IceMX.MetricsHelper<S> helper) { return _map.getMatching(helper, null); } public void - addSubMapToMetrics(IceMX.Metrics metrics) + addSubMapToMetrics(com.zeroc.IceMX.Metrics metrics) { try { @@ -166,7 +166,7 @@ public class MetricsMap<T extends IceMX.Metrics> final private java.lang.reflect.Field _field; } - static class SubMapCloneFactory<S extends IceMX.Metrics> + static class SubMapCloneFactory<S extends com.zeroc.IceMX.Metrics> { public SubMapCloneFactory(MetricsMap<S> map, java.lang.reflect.Field field) { @@ -184,7 +184,7 @@ public class MetricsMap<T extends IceMX.Metrics> final private java.lang.reflect.Field _field; } - static class SubMapFactory<S extends IceMX.Metrics> + static class SubMapFactory<S extends com.zeroc.IceMX.Metrics> { SubMapFactory(Class<S> cl, java.lang.reflect.Field field) { @@ -193,7 +193,7 @@ public class MetricsMap<T extends IceMX.Metrics> } SubMapCloneFactory<S> - createCloneFactory(String subMapPrefix, Ice.Properties properties) + createCloneFactory(String subMapPrefix, com.zeroc.Ice.Properties properties) { return new SubMapCloneFactory<S>(new MetricsMap<S>(subMapPrefix, _class, properties, null), _field); } @@ -202,7 +202,8 @@ public class MetricsMap<T extends IceMX.Metrics> final private java.lang.reflect.Field _field; } - MetricsMap(String mapPrefix, Class<T> cl, Ice.Properties props, java.util.Map<String, SubMapFactory<?>> subMaps) + MetricsMap(String mapPrefix, Class<T> cl, com.zeroc.Ice.Properties props, + java.util.Map<String, SubMapFactory<?>> subMaps) { MetricsAdminI.validateProperties(mapPrefix, props); _properties = props.getPropertiesForPrefix(mapPrefix); @@ -210,8 +211,8 @@ public class MetricsMap<T extends IceMX.Metrics> _retain = props.getPropertyAsIntWithDefault(mapPrefix + "RetainDetached", 10); _accept = parseRule(props, mapPrefix + "Accept"); _reject = parseRule(props, mapPrefix + "Reject"); - _groupByAttributes = new java.util.ArrayList<String>(); - _groupBySeparators = new java.util.ArrayList<String>(); + _groupByAttributes = new java.util.ArrayList<>(); + _groupBySeparators = new java.util.ArrayList<>(); _class = cl; String groupBy = props.getPropertyWithDefault(mapPrefix + "GroupBy", "id"); @@ -257,9 +258,9 @@ public class MetricsMap<T extends IceMX.Metrics> if(subMaps != null && !subMaps.isEmpty()) { - _subMaps = new java.util.HashMap<String, SubMapCloneFactory<?>>(); + _subMaps = new java.util.HashMap<>(); - java.util.List<String> subMapNames = new java.util.ArrayList<String>(); + java.util.List<String> subMapNames = new java.util.ArrayList<>(); for(java.util.Map.Entry<String, SubMapFactory<?>> e : subMaps.entrySet()) { subMapNames.add(e.getKey()); @@ -304,10 +305,10 @@ public class MetricsMap<T extends IceMX.Metrics> return _properties; } - synchronized IceMX.Metrics[] + synchronized com.zeroc.IceMX.Metrics[] getMetrics() { - IceMX.Metrics[] metrics = new IceMX.Metrics[_objects.size()]; + com.zeroc.IceMX.Metrics[] metrics = new com.zeroc.IceMX.Metrics[_objects.size()]; int i = 0; for(Entry e : _objects.values()) { @@ -316,22 +317,22 @@ public class MetricsMap<T extends IceMX.Metrics> return metrics; } - synchronized IceMX.MetricsFailures[] + synchronized com.zeroc.IceMX.MetricsFailures[] getFailures() { - java.util.List<IceMX.MetricsFailures> failures = new java.util.ArrayList<IceMX.MetricsFailures>(); + java.util.List<com.zeroc.IceMX.MetricsFailures> failures = new java.util.ArrayList<>(); for(Entry e : _objects.values()) { - IceMX.MetricsFailures f = e.getFailures(); + com.zeroc.IceMX.MetricsFailures f = e.getFailures(); if(f != null) { failures.add(f); } } - return failures.toArray(new IceMX.MetricsFailures[failures.size()]); + return failures.toArray(new com.zeroc.IceMX.MetricsFailures[failures.size()]); } - synchronized IceMX.MetricsFailures + synchronized com.zeroc.IceMX.MetricsFailures getFailures(String id) { Entry e = _objects.get(id); @@ -343,7 +344,7 @@ public class MetricsMap<T extends IceMX.Metrics> } @SuppressWarnings("unchecked") - public <S extends IceMX.Metrics> SubMap<S> + public <S extends com.zeroc.IceMX.Metrics> SubMap<S> createSubMap(String subMapName, Class<S> cl) { if(_subMaps == null) @@ -359,7 +360,7 @@ public class MetricsMap<T extends IceMX.Metrics> } public Entry - getMatching(IceMX.MetricsHelper<T> helper, Entry previous) + getMatching(com.zeroc.IceMX.MetricsHelper<T> helper, Entry previous) { // // Check the accept and reject filters. @@ -451,7 +452,7 @@ public class MetricsMap<T extends IceMX.Metrics> if(_detachedQueue == null) { - _detachedQueue = new java.util.LinkedList<Entry>(); + _detachedQueue = new java.util.LinkedList<>(); } assert(_detachedQueue.size() <= _retain); @@ -477,9 +478,9 @@ public class MetricsMap<T extends IceMX.Metrics> } private java.util.Map<String, java.util.regex.Pattern> - parseRule(Ice.Properties properties, String name) + parseRule(com.zeroc.Ice.Properties properties, String name) { - java.util.Map<String, java.util.regex.Pattern> pats = new java.util.HashMap<String, java.util.regex.Pattern>(); + java.util.Map<String, java.util.regex.Pattern> pats = new java.util.HashMap<>(); java.util.Map<String, String> rules = properties.getPropertiesForPrefix(name + '.'); for(java.util.Map.Entry<String,String> e : rules.entrySet()) { @@ -489,7 +490,7 @@ public class MetricsMap<T extends IceMX.Metrics> } private boolean - match(String attribute, java.util.regex.Pattern regex, IceMX.MetricsHelper<T> helper, boolean reject) + match(String attribute, java.util.regex.Pattern regex, com.zeroc.IceMX.MetricsHelper<T> helper, boolean reject) { String value; try @@ -511,7 +512,7 @@ public class MetricsMap<T extends IceMX.Metrics> final private java.util.Map<String, java.util.regex.Pattern> _reject; final private Class<T> _class; - final private java.util.Map<String, Entry> _objects = new java.util.HashMap<String, Entry>(); + final private java.util.Map<String, Entry> _objects = new java.util.HashMap<>(); final private java.util.Map<String, SubMapCloneFactory<?>> _subMaps; private java.util.Deque<Entry> _detachedQueue; } diff --git a/java/src/Ice/src/main/java/IceInternal/MetricsViewI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsViewI.java index c45aedff457..c393b03df21 100644 --- a/java/src/Ice/src/main/java/IceInternal/MetricsViewI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/MetricsViewI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class MetricsViewI { @@ -17,8 +17,8 @@ public class MetricsViewI } public boolean - addOrUpdateMap(Ice.Properties properties, String mapName, MetricsAdminI.MetricsMapFactory<?> factory, - Ice.Logger logger) + addOrUpdateMap(com.zeroc.Ice.Properties properties, String mapName, MetricsAdminI.MetricsMapFactory<?> factory, + com.zeroc.Ice.Logger logger) { // // Add maps to views configured with the given map. @@ -28,7 +28,7 @@ public class MetricsViewI java.util.Map<String, String> mapsProps = properties.getPropertiesForPrefix(mapsPrefix); String mapPrefix; - java.util.Map<String, String> mapProps = new java.util.HashMap<String, String>(); + java.util.Map<String, String> mapProps = new java.util.HashMap<>(); if(!mapsProps.isEmpty()) { mapPrefix = mapsPrefix + mapName + "."; @@ -75,10 +75,10 @@ public class MetricsViewI return _maps.remove(mapName) != null; } - public java.util.Map<String, IceMX.Metrics[]> + public java.util.Map<String, com.zeroc.IceMX.Metrics[]> getMetrics() { - java.util.Map<String, IceMX.Metrics[]> metrics = new java.util.HashMap<String, IceMX.Metrics[]>(); + java.util.Map<String, com.zeroc.IceMX.Metrics[]> metrics = new java.util.HashMap<>(); for(java.util.Map.Entry<String, MetricsMap<?>> e : _maps.entrySet()) { metrics.put(e.getKey(), e.getValue().getMetrics()); @@ -86,7 +86,7 @@ public class MetricsViewI return metrics; } - public IceMX.MetricsFailures[] + public com.zeroc.IceMX.MetricsFailures[] getFailures(String mapName) { MetricsMap<?> m = _maps.get(mapName); @@ -97,7 +97,7 @@ public class MetricsViewI return null; } - public IceMX.MetricsFailures + public com.zeroc.IceMX.MetricsFailures getFailures(String mapName, String id) { MetricsMap<?> m = _maps.get(mapName); @@ -115,12 +115,12 @@ public class MetricsViewI } @SuppressWarnings("unchecked") - public <T extends IceMX.Metrics> MetricsMap<T> + public <T extends com.zeroc.IceMX.Metrics> MetricsMap<T> getMap(String mapName, Class<T> cl) { return (MetricsMap<T>)_maps.get(mapName); } final private String _name; - final private java.util.Map<String, MetricsMap<?>> _maps = new java.util.HashMap<String, MetricsMap<?>>(); + final private java.util.Map<String, MetricsMap<?>> _maps = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/Network.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Network.java index 0e19cf0e0b0..0da59a5a5e1 100644 --- a/java/src/Ice/src/main/java/IceInternal/Network.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Network.java @@ -7,7 +7,12 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.ConnectFailedException; +import com.zeroc.Ice.ConnectionRefusedException; +import com.zeroc.Ice.EndpointSelectionType; +import com.zeroc.Ice.SocketException; public final class Network { @@ -146,7 +151,7 @@ public final class Network } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -167,7 +172,7 @@ public final class Network } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -208,19 +213,19 @@ public final class Network } catch(IllegalAccessException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } catch(java.lang.reflect.InvocationTargetException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } catch(NoSuchMethodException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -246,7 +251,7 @@ public final class Network } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -260,7 +265,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -274,7 +279,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -288,7 +293,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -304,7 +309,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -320,7 +325,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -342,7 +347,7 @@ public final class Network continue; } - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -354,7 +359,7 @@ public final class Network } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return fd; @@ -373,7 +378,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -390,22 +395,22 @@ public final class Network if(connectionRefused(ex)) { - throw new Ice.ConnectionRefusedException(ex); + throw new ConnectionRefusedException(ex); } else { - throw new Ice.ConnectFailedException(ex); + throw new ConnectFailedException(ex); } } catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } catch(java.lang.SecurityException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } if(System.getProperty("os.name").equals("Linux")) @@ -418,7 +423,7 @@ public final class Network if(addr.equals(fd.socket().getLocalSocketAddress())) { closeSocketNoThrow(fd); - throw new Ice.ConnectionRefusedException(); + throw new ConnectionRefusedException(); } } return true; @@ -436,7 +441,7 @@ public final class Network { if(!fd.finishConnect()) { - throw new Ice.ConnectFailedException(); + throw new ConnectFailedException(); } if(System.getProperty("os.name").equals("Linux")) @@ -449,7 +454,7 @@ public final class Network java.net.SocketAddress addr = fd.socket().getRemoteSocketAddress(); if(addr != null && addr.equals(fd.socket().getLocalSocketAddress())) { - throw new Ice.ConnectionRefusedException(); + throw new ConnectionRefusedException(); } } } @@ -457,16 +462,16 @@ public final class Network { if(connectionRefused(ex)) { - throw new Ice.ConnectionRefusedException(ex); + throw new ConnectionRefusedException(ex); } else { - throw new Ice.ConnectFailedException(ex); + throw new ConnectFailedException(ex); } } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -489,17 +494,17 @@ public final class Network if(connectionRefused(ex)) { - throw new Ice.ConnectionRefusedException(ex); + throw new ConnectionRefusedException(ex); } else { - throw new Ice.ConnectFailedException(ex); + throw new ConnectFailedException(ex); } } catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -514,7 +519,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -530,7 +535,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return size; } @@ -546,7 +551,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -562,7 +567,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return size; } @@ -578,7 +583,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -594,7 +599,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return size; } @@ -610,7 +615,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -626,7 +631,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return size; } @@ -642,7 +647,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } @@ -658,7 +663,7 @@ public final class Network catch(java.io.IOException ex) { closeSocketNoThrow(fd); - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return size; } @@ -686,10 +691,10 @@ public final class Network } catch(java.lang.SecurityException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } - return getAddresses(host, port, protocol, Ice.EndpointSelectionType.Ordered, preferIPv6, true).get(0); + return getAddresses(host, port, protocol, EndpointSelectionType.Ordered, preferIPv6, true).get(0); } public static int @@ -797,7 +802,7 @@ public final class Network } public static java.util.List<java.net.InetSocketAddress> - getAddresses(String host, int port, int protocol, Ice.EndpointSelectionType selType, boolean preferIPv6, + getAddresses(String host, int port, int protocol, EndpointSelectionType selType, boolean preferIPv6, boolean blocking) { if(!blocking) @@ -807,7 +812,7 @@ public final class Network return null; // Can't get the address without blocking. } - java.util.List<java.net.InetSocketAddress> addrs = new java.util.ArrayList<java.net.InetSocketAddress>(); + java.util.List<java.net.InetSocketAddress> addrs = new java.util.ArrayList<>(); try { addrs.add(new java.net.InetSocketAddress(java.net.InetAddress.getByName(host), port)); @@ -819,7 +824,7 @@ public final class Network return addrs; } - java.util.List<java.net.InetSocketAddress> addresses = new java.util.ArrayList<java.net.InetSocketAddress>(); + java.util.List<java.net.InetSocketAddress> addresses = new java.util.ArrayList<>(); try { java.net.InetAddress[] addrs; @@ -840,7 +845,7 @@ public final class Network } } - if(selType == Ice.EndpointSelectionType.Random) + if(selType == EndpointSelectionType.Random) { java.util.Collections.shuffle(addresses); } @@ -859,11 +864,11 @@ public final class Network } catch(java.net.UnknownHostException ex) { - throw new Ice.DNSException(0, host, ex); + throw new com.zeroc.Ice.DNSException(0, host, ex); } catch(java.lang.SecurityException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } // @@ -871,7 +876,7 @@ public final class Network // if(addresses.isEmpty()) { - throw new Ice.DNSException(0, host); + throw new com.zeroc.Ice.DNSException(0, host); } return addresses; @@ -880,7 +885,7 @@ public final class Network public static java.util.ArrayList<java.net.InetAddress> getLocalAddresses(int protocol) { - java.util.ArrayList<java.net.InetAddress> result = new java.util.ArrayList<java.net.InetAddress>(); + java.util.ArrayList<java.net.InetAddress> result = new java.util.ArrayList<>(); try { java.util.Enumeration<java.net.NetworkInterface> ifaces = java.net.NetworkInterface.getNetworkInterfaces(); @@ -903,11 +908,11 @@ public final class Network } catch(java.net.SocketException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } catch(java.lang.SecurityException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return result; @@ -931,7 +936,7 @@ public final class Network } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } return fds; } @@ -951,11 +956,11 @@ public final class Network } catch(java.lang.SecurityException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } - java.util.ArrayList<String> hosts = new java.util.ArrayList<String>(); + java.util.ArrayList<String> hosts = new java.util.ArrayList<>(); if(wildcard) { java.util.ArrayList<java.net.InetAddress> addrs = getLocalAddresses(protocolSupport); @@ -1022,12 +1027,12 @@ public final class Network { // Warn if the size that was set is less than the requested size and // we have not already warned. - BufSizeWarnInfo winfo = instance.getBufSizeWarn(Ice.TCPEndpointType.value); + BufSizeWarnInfo winfo = instance.getBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value); if(!winfo.rcvWarn || rcvSize != winfo.rcvSize) { instance.logger().warning("TCP receive buffer size: requested size of " + rcvSize + " adjusted to " + size); - instance.setRcvBufSizeWarn(Ice.TCPEndpointType.value, rcvSize); + instance.setRcvBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value, rcvSize); } } } @@ -1045,12 +1050,12 @@ public final class Network { // Warn if the size that was set is less than the requested size and // we have not already warned. - BufSizeWarnInfo winfo = instance.getBufSizeWarn(Ice.TCPEndpointType.value); + BufSizeWarnInfo winfo = instance.getBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value); if(!winfo.sndWarn || sndSize != winfo.sndSize) { instance.logger().warning("TCP send buffer size: requested size of " + sndSize + " adjusted to " + size); - instance.setSndBufSizeWarn(Ice.TCPEndpointType.value, sndSize); + instance.setSndBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value, sndSize); } } } @@ -1086,12 +1091,12 @@ public final class Network { // Warn if the size that was set is less than the requested size and // we have not already warned. - BufSizeWarnInfo winfo = instance.getBufSizeWarn(Ice.TCPEndpointType.value); + BufSizeWarnInfo winfo = instance.getBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value); if(!winfo.rcvWarn || sizeRequested != winfo.rcvSize) { instance.logger().warning("TCP receive buffer size: requested size of " + sizeRequested + " adjusted to " + size); - instance.setRcvBufSizeWarn(Ice.TCPEndpointType.value, sizeRequested); + instance.setRcvBufSizeWarn(com.zeroc.Ice.TCPEndpointType.value, sizeRequested); } } } @@ -1299,7 +1304,7 @@ public final class Network } catch(java.lang.SecurityException ex) { - throw new Ice.SocketException(ex); + throw new SocketException(ex); } } diff --git a/java/src/Ice/src/main/java/IceInternal/NetworkProxy.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/NetworkProxy.java index 80dcce87d3e..825a1afd214 100644 --- a/java/src/Ice/src/main/java/IceInternal/NetworkProxy.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/NetworkProxy.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface NetworkProxy { diff --git a/java/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectAdapterFactory.java index bfec67de6a6..94d1417a663 100644 --- a/java/src/Ice/src/main/java/IceInternal/ObjectAdapterFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectAdapterFactory.java @@ -7,14 +7,17 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.ObjectAdapter; +import com.zeroc.Ice.ObjectAdapterI; public final class ObjectAdapterFactory { public void shutdown() { - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { // @@ -26,14 +29,14 @@ public final class ObjectAdapterFactory return; } - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } // // Deactivate outside the thread synchronization, to avoid // deadlocks. // - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { adapter.deactivate(); } @@ -50,7 +53,7 @@ public final class ObjectAdapterFactory public void waitForShutdown() { - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { // @@ -64,17 +67,17 @@ public final class ObjectAdapterFactory } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } } - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } // // Now we wait for deactivation of each object adapter. // - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { adapter.waitForDeactivate(); } @@ -94,13 +97,13 @@ public final class ObjectAdapterFactory // waitForShutdown(); - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { adapter.destroy(); } @@ -114,13 +117,13 @@ public final class ObjectAdapterFactory public void updateConnectionObservers() { - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { adapter.updateConnectionObservers(); } @@ -129,54 +132,54 @@ public final class ObjectAdapterFactory public void updateThreadObservers() { - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { adapter.updateThreadObservers(); } } - public synchronized Ice.ObjectAdapter - createObjectAdapter(String name, Ice.RouterPrx router) + public synchronized ObjectAdapter + createObjectAdapter(String name, com.zeroc.Ice.RouterPrx router) { if(Thread.interrupted()) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } if(_instance == null) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } - Ice.ObjectAdapterI adapter = null; + ObjectAdapterI adapter = null; if(name.length() == 0) { String uuid = java.util.UUID.randomUUID().toString(); - adapter = new Ice.ObjectAdapterI(_instance, _communicator, this, uuid, null, true); + adapter = new ObjectAdapterI(_instance, _communicator, this, uuid, null, true); } else { if(_adapterNamesInUse.contains(name)) { - throw new Ice.AlreadyRegisteredException("object adapter", name); + throw new com.zeroc.Ice.AlreadyRegisteredException("object adapter", name); } - adapter = new Ice.ObjectAdapterI(_instance, _communicator, this, name, router, false); + adapter = new ObjectAdapterI(_instance, _communicator, this, name, router, false); _adapterNamesInUse.add(name); } _adapters.add(adapter); return adapter; } - public Ice.ObjectAdapter - findObjectAdapter(Ice.ObjectPrx proxy) + public ObjectAdapter + findObjectAdapter(com.zeroc.Ice.ObjectPrx proxy) { - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { if(_instance == null) @@ -184,10 +187,10 @@ public final class ObjectAdapterFactory return null; } - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { try { @@ -196,7 +199,7 @@ public final class ObjectAdapterFactory return adapter; } } - catch(Ice.ObjectAdapterDeactivatedException ex) + catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex) { // Ignore. } @@ -206,7 +209,7 @@ public final class ObjectAdapterFactory } public synchronized void - removeObjectAdapter(Ice.ObjectAdapter adapter) + removeObjectAdapter(ObjectAdapter adapter) { if(_instance == null) { @@ -220,13 +223,13 @@ public final class ObjectAdapterFactory public void flushAsyncBatchRequests(CommunicatorFlushBatch outAsync) { - java.util.List<Ice.ObjectAdapterI> adapters; + java.util.List<ObjectAdapterI> adapters; synchronized(this) { - adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(_adapters); + adapters = new java.util.LinkedList<>(_adapters); } - for(Ice.ObjectAdapterI adapter : adapters) + for(ObjectAdapterI adapter : adapters) { adapter.flushAsyncBatchRequests(outAsync); } @@ -235,7 +238,7 @@ public final class ObjectAdapterFactory // // Only for use by Instance. // - ObjectAdapterFactory(Instance instance, Ice.Communicator communicator) + ObjectAdapterFactory(Instance instance, com.zeroc.Ice.Communicator communicator) { _instance = instance; _communicator = communicator; @@ -248,9 +251,9 @@ public final class ObjectAdapterFactory { try { - IceUtilInternal.Assert.FinalizerAssert(_instance == null); - IceUtilInternal.Assert.FinalizerAssert(_communicator == null); - IceUtilInternal.Assert.FinalizerAssert(_adapters.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_instance == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_communicator == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_adapters.isEmpty()); } catch(java.lang.Exception ex) { @@ -262,7 +265,7 @@ public final class ObjectAdapterFactory } private Instance _instance; - private Ice.Communicator _communicator; - private java.util.Set<String> _adapterNamesInUse = new java.util.HashSet<String>(); - private java.util.List<Ice.ObjectAdapterI> _adapters = new java.util.LinkedList<Ice.ObjectAdapterI>(); + private com.zeroc.Ice.Communicator _communicator; + private java.util.Set<String> _adapterNamesInUse = new java.util.HashSet<>(); + private java.util.List<ObjectAdapterI> _adapters = new java.util.LinkedList<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/ObjectInputStream.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectInputStream.java index ea1e7167f4c..99bc673d9db 100644 --- a/java/src/Ice/src/main/java/IceInternal/ObjectInputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObjectInputStream.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; // // We need to override the resolveClass method of ObjectInputStream so @@ -30,7 +30,7 @@ public class ObjectInputStream extends java.io.ObjectInputStream { if(_instance == null) { - throw new Ice.MarshalException("cannot unmarshal a serializable without a communicator"); + throw new com.zeroc.Ice.MarshalException("cannot unmarshal a serializable without a communicator"); } try diff --git a/java/src/Ice/src/main/java/IceInternal/ObserverHelper.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObserverHelper.java index 290be728304..6075fcbd2b7 100644 --- a/java/src/Ice/src/main/java/IceInternal/ObserverHelper.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ObserverHelper.java @@ -7,10 +7,10 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -import Ice.Instrumentation.CommunicatorObserver; -import Ice.Instrumentation.InvocationObserver; +import com.zeroc.Ice.Instrumentation.CommunicatorObserver; +import com.zeroc.Ice.Instrumentation.InvocationObserver; public final class ObserverHelper { @@ -31,16 +31,16 @@ public final class ObserverHelper } static public InvocationObserver - get(Ice.ObjectPrx proxy, String op) + get(com.zeroc.Ice.ObjectPrx proxy, String op) { return get(proxy, op, null); } static public InvocationObserver - get(Ice.ObjectPrx proxy, String op, java.util.Map<String, String> context) + get(com.zeroc.Ice.ObjectPrx proxy, String op, java.util.Map<String, String> context) { CommunicatorObserver obsv = - ((Ice.ObjectPrxHelperBase)proxy).__reference().getInstance().initializationData().observer; + ((com.zeroc.Ice._ObjectPrxI)proxy).__reference().getInstance().initializationData().observer; if(obsv != null) { InvocationObserver observer; @@ -61,5 +61,5 @@ public final class ObserverHelper return null; } - private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>(); + private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OpaqueEndpointI.java index c6c6b849ba5..4b1c79ecfd2 100644 --- a/java/src/Ice/src/main/java/IceInternal/OpaqueEndpointI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OpaqueEndpointI.java @@ -7,31 +7,34 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.EndpointParseException; +import java.util.Base64; final class OpaqueEndpointI extends EndpointI { public OpaqueEndpointI(java.util.ArrayList<String> args) { _type = -1; - _rawEncoding = Ice.Util.Encoding_1_0; + _rawEncoding = com.zeroc.Ice.Util.Encoding_1_0; _rawBytes = new byte[0]; initWithOptions(args); if(_type < 0) { - throw new Ice.EndpointParseException("no -t option in endpoint " + toString()); + throw new EndpointParseException("no -t option in endpoint " + toString()); } if(_rawBytes.length == 0) { - throw new Ice.EndpointParseException("no -v option in endpoint " + toString()); + throw new EndpointParseException("no -v option in endpoint " + toString()); } calcHashValue(); } - public OpaqueEndpointI(short type, Ice.InputStream s) + public OpaqueEndpointI(short type, com.zeroc.Ice.InputStream s) { _type = type; _rawEncoding = s.getEncoding(); @@ -45,15 +48,15 @@ final class OpaqueEndpointI extends EndpointI // Marshal the endpoint // @Override - public void streamWrite(Ice.OutputStream s) + public void streamWrite(com.zeroc.Ice.OutputStream s) { - s.startEncapsulation(_rawEncoding, Ice.FormatType.DefaultFormat); + s.startEncapsulation(_rawEncoding, com.zeroc.Ice.FormatType.DefaultFormat); s.writeBlob(_rawBytes); s.endEncapsulation(); } @Override - public void streamWriteImpl(Ice.OutputStream s) + public void streamWriteImpl(com.zeroc.Ice.OutputStream s) { assert(false); } @@ -62,9 +65,9 @@ final class OpaqueEndpointI extends EndpointI // Return the endpoint information. // @Override - public Ice.EndpointInfo getInfo() + public com.zeroc.Ice.EndpointInfo getInfo() { - return new Ice.OpaqueEndpointInfo(null, -1, false, _rawEncoding, _rawBytes) + return new com.zeroc.Ice.OpaqueEndpointInfo(null, -1, false, _rawEncoding, _rawBytes) { @Override public short type() @@ -83,7 +86,7 @@ final class OpaqueEndpointI extends EndpointI { return false; } - }; + }; } // @@ -194,9 +197,9 @@ final class OpaqueEndpointI extends EndpointI // is available. // @Override - public void connectors_async(Ice.EndpointSelectionType selType, EndpointI_connectors callback) + public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, EndpointI_connectors callback) { - callback.connectors(new java.util.ArrayList<Connector>()); + callback.connectors(new java.util.ArrayList<>()); } // @@ -217,7 +220,7 @@ final class OpaqueEndpointI extends EndpointI @Override public java.util.List<EndpointI> expand() { - java.util.List<EndpointI> endps = new java.util.ArrayList<EndpointI>(); + java.util.List<EndpointI> endps = new java.util.ArrayList<>(); endps.add(this); return endps; } @@ -245,10 +248,10 @@ final class OpaqueEndpointI extends EndpointI { s += " -t " + _type; } - s += " -e " + Ice.Util.encodingVersionToString(_rawEncoding); + s += " -e " + com.zeroc.Ice.Util.encodingVersionToString(_rawEncoding); if(_rawBytes.length > 0) { - s += " -v " + IceUtilInternal.Base64.encode(_rawBytes); + s += " -v " + Base64.getEncoder().encodeToString(_rawBytes); } return s; } @@ -329,11 +332,11 @@ final class OpaqueEndpointI extends EndpointI { if(_type > -1) { - throw new Ice.EndpointParseException("multiple -t options in endpoint " + endpoint); + throw new EndpointParseException("multiple -t options in endpoint " + endpoint); } if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -t option in endpoint " + endpoint); + throw new EndpointParseException("no argument provided for -t option in endpoint " + endpoint); } int t; @@ -343,13 +346,12 @@ final class OpaqueEndpointI extends EndpointI } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException("invalid type value `" + argument + "' in endpoint " + endpoint); + throw new EndpointParseException("invalid type value `" + argument + "' in endpoint " + endpoint); } if(t < 0 || t > 65535) { - throw new Ice.EndpointParseException("type value `" + argument + "' out of range in endpoint " + - endpoint); + throw new EndpointParseException("type value `" + argument + "' out of range in endpoint " + endpoint); } _type = (short)t; @@ -360,23 +362,21 @@ final class OpaqueEndpointI extends EndpointI { if(_rawBytes.length > 0) { - throw new Ice.EndpointParseException("multiple -v options in endpoint " + endpoint); + throw new EndpointParseException("multiple -v options in endpoint " + endpoint); } if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -v option in endpoint " + endpoint); + throw new EndpointParseException("no argument provided for -v option in endpoint " + endpoint); } - for(int j = 0; j < argument.length(); ++j) + try + { + _rawBytes = Base64.getDecoder().decode(argument); + } + catch(IllegalArgumentException ex) { - if(!IceUtilInternal.Base64.isBase64(argument.charAt(j))) - { - throw new Ice.EndpointParseException("invalid base64 character `" + argument.charAt(j) + - "' (ordinal " + ((int)argument.charAt(j)) + - ") in endpoint " + endpoint); - } + throw new EndpointParseException("base64 decoding failed in endpoint " + endpoint, ex); } - _rawBytes = IceUtilInternal.Base64.decode(argument); return true; } @@ -384,17 +384,17 @@ final class OpaqueEndpointI extends EndpointI { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -e option in endpoint " + endpoint); + throw new EndpointParseException("no argument provided for -e option in endpoint " + endpoint); } try { - _rawEncoding = Ice.Util.stringToEncodingVersion(argument); + _rawEncoding = com.zeroc.Ice.Util.stringToEncodingVersion(argument); } - catch(Ice.VersionParseException e) + catch(com.zeroc.Ice.VersionParseException e) { - throw new Ice.EndpointParseException("invalid encoding version `" + argument + - "' in endpoint " + endpoint + ":\n" + e.str); + throw new EndpointParseException("invalid encoding version `" + argument + "' in endpoint " + + endpoint + ":\n" + e.str); } return true; } @@ -409,14 +409,14 @@ final class OpaqueEndpointI extends EndpointI private void calcHashValue() { int h = 5381; - h = IceInternal.HashUtil.hashAdd(h, _type); - h = IceInternal.HashUtil.hashAdd(h, _rawEncoding); - h = IceInternal.HashUtil.hashAdd(h, _rawBytes); + h = HashUtil.hashAdd(h, _type); + h = HashUtil.hashAdd(h, _rawEncoding); + h = HashUtil.hashAdd(h, _rawBytes); _hashCode = h; } private short _type; - private Ice.EncodingVersion _rawEncoding; + private com.zeroc.Ice.EncodingVersion _rawEncoding; private byte[] _rawBytes; private int _hashCode; } diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java new file mode 100644 index 00000000000..e036660697a --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsync.java @@ -0,0 +1,375 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +import com.zeroc.Ice.FormatType; +import com.zeroc.Ice.InputStream; +import com.zeroc.Ice._ObjectPrxI; +import com.zeroc.Ice.OperationInterruptedException; +import com.zeroc.Ice.OperationMode; +import com.zeroc.Ice.OutputStream; +import com.zeroc.Ice.UserException; +import com.zeroc.Ice.UnknownException; +import com.zeroc.Ice.UnknownUserException; + +public class OutgoingAsync<T> extends ProxyOutgoingAsyncBase<T> +{ + @FunctionalInterface + static public interface Unmarshaler<V> + { + V unmarshal(com.zeroc.Ice.InputStream istr); + } + + public OutgoingAsync(com.zeroc.Ice.ObjectPrx prx, String operation, OperationMode mode, boolean synchronous, + Class<?>[] userExceptions) + { + super((_ObjectPrxI)prx, operation, null); + _mode = mode == null ? OperationMode.Normal : mode; + _synchronous = synchronous; + _userExceptions = userExceptions; + _encoding = Protocol.getCompatibleEncoding(_proxy.__reference().getEncoding()); + + if(_instance.cacheMessageBuffers() > 0) + { + _ObjectPrxI.StreamPair p = _proxy.__getCachedMessageBuffers(); + if(p != null) + { + _is = p.is; + _os = p.os; + } + } + if(_os == null) + { + _os = new com.zeroc.Ice.OutputStream(_instance, Protocol.currentProtocolEncoding); + } + } + + public void invoke(boolean twowayOnly, java.util.Map<String, String> ctx, FormatType format, + OutputStream.Marshaler marshal, Unmarshaler<T> unmarshal) + { + _unmarshal = unmarshal; + + if(twowayOnly && !_proxy.ice_isTwoway()) + { + throw new java.lang.IllegalArgumentException("`" + _operation + + "' can only be called with a twoway proxy"); + } + + if(format == null) + { + format = FormatType.DefaultFormat; + } + + try + { + prepare(ctx); + + if(marshal == null) + { + writeEmptyParams(); + } + else + { + marshal.marshal(startWriteParams(format)); + endWriteParams(); + } + + if(isBatch()) + { + // + // NOTE: we don't call sent/completed callbacks for batch AMI requests + // + _sentSynchronously = true; + _proxy.__getBatchRequestQueue().finishBatchRequest(_os, _proxy, _operation); + finished(true); + } + else + { + // + // NOTE: invokeImpl doesn't throw so this can be called from the + // try block with the catch block calling abort() in case of an + // exception. + // + invokeImpl(true); // userThread = true + } + } + catch(com.zeroc.Ice.Exception ex) + { + abort(ex); + } + } + + public T __wait() + { + if(isBatch()) + { + return null; // The future will not be completed for a batch invocation. + } + + try + { + return __waitUserEx(); + } + catch(UserException ex) + { + throw new UnknownUserException(ex.ice_id(), ex); + } + } + + public T __waitUserEx() + throws UserException + { + if(Thread.currentThread().interrupted()) + { + throw new OperationInterruptedException(); + } + + try + { + return get(); + } + catch(InterruptedException ex) + { + throw new OperationInterruptedException(); + } + catch(java.util.concurrent.ExecutionException ee) + { + try + { + throw ee.getCause(); + } + catch(RuntimeException ex) // Includes LocalException + { + throw ex; + } + catch(UserException ex) + { + throw ex; + } + catch(Throwable ex) + { + throw new UnknownException(ex); + } + } + } + + @Override + protected void __sent() + { + super.__sent(); + + if(!_proxy.ice_isTwoway()) + { + // + // For a non-twoway proxy, the invocation is completed after it is sent. + // + complete(null); + } + } + + @Override + public boolean sent() + { + return sent(!_proxy.ice_isTwoway()); // done = true if not a two-way proxy (no response expected) + } + + @Override + public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response) + throws RetryException + { + _cachedConnection = connection; + return connection.sendAsyncRequest(this, compress, response, 0); + } + + @Override + public int invokeCollocated(CollocatedRequestHandler handler) + { + // The stream cannot be cached if the proxy is not a twoway or there is an invocation timeout set. + if(!_proxy.ice_isTwoway() || _proxy.__reference().getInvocationTimeout() > 0) + { + // Disable caching by marking the streams as cached! + _state |= StateCachedBuffers; + } + return handler.invokeAsyncRequest(this, 0, _synchronous); + } + + @Override + public void abort(com.zeroc.Ice.Exception ex) + { + if(isBatch()) + { + // + // If we didn't finish a batch oneway or datagram request, we + // must notify the connection about that we give up ownership + // of the batch stream. + // + _proxy.__getBatchRequestQueue().abortBatchRequest(_os); + } + + super.abort(ex); + } + + @Override + protected void __completed() + { + super.__completed(); + + try + { + if(_exception != null) + { + completeExceptionally(_exception); + } + else if((_state & StateOK) > 0) + { + T r = null; + try + { + if(_unmarshal != null) + { + // + // The Unmarshaler callback unmarshals and returns the results. + // + r = _unmarshal.unmarshal(startReadParams()); + endReadParams(); + } + else + { + readEmptyParams(); + } + } + catch(com.zeroc.Ice.LocalException ex) + { + completeExceptionally(ex); + return; + } + complete(r); + } + else + { + // + // Handle user exception. + // + try + { + throwUserException(); + } + catch(Throwable ex) + { + completeExceptionally(ex); + } + } + } + finally + { + cacheMessageBuffers(); + } + } + + @Override + public final boolean completed(com.zeroc.Ice.InputStream is) + { + // + // NOTE: this method is called from ConnectionI.parseMessage + // with the connection locked. Therefore, it must not invoke + // any user callbacks. + // + + // _is can already be initialized if the invocation is retried + if(_is == null) + { + _is = new com.zeroc.Ice.InputStream(_instance, Protocol.currentProtocolEncoding); + } + _is.swap(is); + + return super.completed(_is); + } + + private com.zeroc.Ice.OutputStream startWriteParams(FormatType format) + { + _os.startEncapsulation(_encoding, format); + return _os; + } + + private void endWriteParams() + { + _os.endEncapsulation(); + } + + private void writeEmptyParams() + { + _os.writeEmptyEncapsulation(_encoding); + } + + private com.zeroc.Ice.InputStream startReadParams() + { + _is.startEncapsulation(); + return _is; + } + + private void endReadParams() + { + _is.endEncapsulation(); + } + + private void readEmptyParams() + { + _is.skipEmptyEncapsulation(); + } + + private final void throwUserException() + throws com.zeroc.Ice.UserException + { + try + { + _is.startEncapsulation(); + _is.throwException(null); + } + catch(com.zeroc.Ice.UserException ex) + { + _is.endEncapsulation(); + throw ex; + } + } + + @Override + protected void cacheMessageBuffers() + { + if(_instance.cacheMessageBuffers() > 0) + { + synchronized(this) + { + if((_state & StateCachedBuffers) > 0) + { + return; + } + _state |= StateCachedBuffers; + } + + if(_is != null) + { + _is.reset(); + } + _os.reset(); + + _proxy.__cacheMessageBuffers(_is, _os); + + _is = null; + _os = null; + } + } + + final private com.zeroc.Ice.EncodingVersion _encoding; + private com.zeroc.Ice.InputStream _is; + + private boolean _synchronous; // True if this AMI request is being used for a generated synchronous invocation. + private Class<?>[] _userExceptions; // Valid user exceptions. + private Unmarshaler<T> _unmarshal; +} diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsyncBase.java index 7af12ad2912..10f2bbca055 100644 --- a/java/src/Ice/src/main/java/IceInternal/OutgoingAsyncBase.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingAsyncBase.java @@ -7,36 +7,37 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; // // Base class for handling asynchronous invocations. This class is // responsible for the handling of the output stream and the child // invocation observer. // -public abstract class OutgoingAsyncBase extends IceInternal.AsyncResultI +public abstract class OutgoingAsyncBase<T> extends InvocationFutureI<T> { public boolean sent() { return sent(true); } - public boolean completed(Ice.InputStream is) + public boolean completed(com.zeroc.Ice.InputStream is) { assert(false); // Must be implemented by classes that handle responses return false; } - public boolean completed(Ice.Exception ex) + public boolean completed(com.zeroc.Ice.Exception ex) { return finished(ex); } - public final void attachRemoteObserver(Ice.ConnectionInfo info, Ice.Endpoint endpt, int requestId) + public final void attachRemoteObserver(com.zeroc.Ice.ConnectionInfo info, com.zeroc.Ice.Endpoint endpt, + int requestId) { if(_observer != null) { - final int size = _os.size() - IceInternal.Protocol.headerSize - 4; + final int size = _os.size() - Protocol.headerSize - 4; _childObserver = getObserver().getRemoteObserver(info, endpt, requestId, size); if(_childObserver != null) { @@ -45,11 +46,11 @@ public abstract class OutgoingAsyncBase extends IceInternal.AsyncResultI } } - public final void attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId) + public final void attachCollocatedObserver(com.zeroc.Ice.ObjectAdapter adapter, int requestId) { if(_observer != null) { - final int size = _os.size() - IceInternal.Protocol.headerSize - 4; + final int size = _os.size() - Protocol.headerSize - 4; _childObserver = getObserver().getCollocatedObserver(adapter, requestId, size); if(_childObserver != null) { @@ -58,21 +59,21 @@ public abstract class OutgoingAsyncBase extends IceInternal.AsyncResultI } } - public final Ice.OutputStream getOs() + public final com.zeroc.Ice.OutputStream getOs() { return _os; } - protected OutgoingAsyncBase(Ice.Communicator com, Instance instance, String op, CallbackBase del) + protected OutgoingAsyncBase(com.zeroc.Ice.Communicator com, Instance instance, String op) { - super(com, instance, op, del); - _os = new Ice.OutputStream(instance, Protocol.currentProtocolEncoding); + super(com, instance, op); + _os = new com.zeroc.Ice.OutputStream(instance, Protocol.currentProtocolEncoding); } - protected OutgoingAsyncBase(Ice.Communicator com, Instance instance, String op, CallbackBase del, - Ice.OutputStream os) + protected OutgoingAsyncBase(com.zeroc.Ice.Communicator com, Instance instance, String op, + com.zeroc.Ice.OutputStream os) { - super(com, instance, op, del); + super(com, instance, op); _os = os; } @@ -91,7 +92,7 @@ public abstract class OutgoingAsyncBase extends IceInternal.AsyncResultI } @Override - protected boolean finished(Ice.Exception ex) + protected boolean finished(com.zeroc.Ice.Exception ex) { if(_childObserver != null) { @@ -102,6 +103,6 @@ public abstract class OutgoingAsyncBase extends IceInternal.AsyncResultI return super.finished(ex); } - protected Ice.OutputStream _os; - protected Ice.Instrumentation.ChildInvocationObserver _childObserver; + protected com.zeroc.Ice.OutputStream _os; + protected com.zeroc.Ice.Instrumentation.ChildInvocationObserver _childObserver; } diff --git a/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java index 94b80c0e2fb..d41029e3a92 100644 --- a/java/src/Ice/src/main/java/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutgoingConnectionFactory.java @@ -7,7 +7,10 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.ConnectionI; +import com.zeroc.Ice.LocalException; public final class OutgoingConnectionFactory { @@ -22,7 +25,7 @@ public final class OutgoingConnectionFactory java.util.List<V> list = this.get(key); if(list == null) { - list = new java.util.LinkedList<V>(); + list = new java.util.LinkedList<>(); this.put(key, list); } list.add(value); @@ -44,8 +47,8 @@ public final class OutgoingConnectionFactory interface CreateConnectionCallback { - void setConnection(Ice.ConnectionI connection, boolean compress); - void setException(Ice.LocalException ex); + void setConnection(ConnectionI connection, boolean compress); + void setException(LocalException ex); } public synchronized void @@ -56,11 +59,11 @@ public final class OutgoingConnectionFactory return; } - for(java.util.List<Ice.ConnectionI> connectionList : _connections.values()) + for(java.util.List<ConnectionI> connectionList : _connections.values()) { - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { - connection.destroy(Ice.ConnectionI.CommunicatorDestroyed); + connection.destroy(ConnectionI.CommunicatorDestroyed); } } @@ -72,9 +75,9 @@ public final class OutgoingConnectionFactory public synchronized void updateConnectionObservers() { - for(java.util.List<Ice.ConnectionI> connectionList : _connections.values()) + for(java.util.List<ConnectionI> connectionList : _connections.values()) { - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { connection.updateObserver(); } @@ -85,7 +88,7 @@ public final class OutgoingConnectionFactory public void waitUntilFinished() { - java.util.Map<Connector, java.util.List<Ice.ConnectionI> > connections = null; + java.util.Map<Connector, java.util.List<ConnectionI> > connections = null; synchronized(this) { // @@ -102,7 +105,7 @@ public final class OutgoingConnectionFactory } catch(InterruptedException ex) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } } @@ -110,15 +113,15 @@ public final class OutgoingConnectionFactory // We want to wait until all connections are finished outside the // thread synchronization. // - connections = new java.util.HashMap<Connector, java.util.List<Ice.ConnectionI> >(_connections); + connections = new java.util.HashMap<>(_connections); } // // Now we wait until the destruction of each connection is finished. // - for(java.util.List<Ice.ConnectionI> connectionList : connections.values()) + for(java.util.List<ConnectionI> connectionList : connections.values()) { - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { try { @@ -129,14 +132,14 @@ public final class OutgoingConnectionFactory // // Force close all of the connections. // - for(java.util.List<Ice.ConnectionI> l : connections.values()) + for(java.util.List<ConnectionI> l : connections.values()) { - for(Ice.ConnectionI c : l) + for(ConnectionI c : l) { c.close(true); } } - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } } } @@ -144,11 +147,11 @@ public final class OutgoingConnectionFactory synchronized(this) { // Ensure all the connections are finished and reapable at this point. - java.util.List<Ice.ConnectionI> cons = _monitor.swapReapedConnections(); + java.util.List<ConnectionI> cons = _monitor.swapReapedConnections(); if(cons != null) { int size = 0; - for(java.util.List<Ice.ConnectionI> connectionList : _connections.values()) + for(java.util.List<ConnectionI> connectionList : _connections.values()) { size += connectionList.size(); } @@ -166,7 +169,8 @@ public final class OutgoingConnectionFactory } public void - create(EndpointI[] endpts, boolean hasMore, Ice.EndpointSelectionType selType, CreateConnectionCallback callback) + create(EndpointI[] endpts, boolean hasMore, com.zeroc.Ice.EndpointSelectionType selType, + CreateConnectionCallback callback) { assert(endpts.length > 0); @@ -180,15 +184,15 @@ public final class OutgoingConnectionFactory // try { - Ice.Holder<Boolean> compress = new Ice.Holder<Boolean>(); - Ice.ConnectionI connection = findConnectionByEndpoint(endpoints, compress); + Holder<Boolean> compress = new Holder<>(); + ConnectionI connection = findConnectionByEndpoint(endpoints, compress); if(connection != null) { callback.setConnection(connection, compress.value); return; } } - catch(Ice.LocalException ex) + catch(LocalException ex) { callback.setException(ex); return; @@ -199,11 +203,11 @@ public final class OutgoingConnectionFactory } public synchronized void - setRouterInfo(IceInternal.RouterInfo routerInfo) + setRouterInfo(RouterInfo routerInfo) { if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } assert(routerInfo != null); @@ -214,7 +218,7 @@ public final class OutgoingConnectionFactory // connections, so that callbacks from the router can be // received over such connections. // - Ice.ObjectAdapter adapter = routerInfo.getAdapter(); + com.zeroc.Ice.ObjectAdapter adapter = routerInfo.getAdapter(); DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); for(EndpointI endpoint : routerInfo.getClientEndpoints()) { @@ -237,9 +241,9 @@ public final class OutgoingConnectionFactory // endpoint = endpoint.compress(false); - for(java.util.List<Ice.ConnectionI> connectionList : _connections.values()) + for(java.util.List<ConnectionI> connectionList : _connections.values()) { - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { if(connection.endpoint() == endpoint) { @@ -251,16 +255,16 @@ public final class OutgoingConnectionFactory } public synchronized void - removeAdapter(Ice.ObjectAdapter adapter) + removeAdapter(com.zeroc.Ice.ObjectAdapter adapter) { if(_destroyed) { return; } - for(java.util.List<Ice.ConnectionI> connectionList : _connections.values()) + for(java.util.List<ConnectionI> connectionList : _connections.values()) { - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { if(connection.getAdapter() == adapter) { @@ -273,15 +277,15 @@ public final class OutgoingConnectionFactory public void flushAsyncBatchRequests(CommunicatorFlushBatch outAsync) { - java.util.List<Ice.ConnectionI> c = new java.util.LinkedList<Ice.ConnectionI>(); + java.util.List<ConnectionI> c = new java.util.LinkedList<>(); synchronized(this) { if(!_destroyed) { - for(java.util.List<Ice.ConnectionI> connectionList : _connections.values()) + for(java.util.List<ConnectionI> connectionList : _connections.values()) { - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { if(connection.isActiveOrHolding()) { @@ -292,13 +296,13 @@ public final class OutgoingConnectionFactory } } - for(Ice.ConnectionI conn : c) + for(ConnectionI conn : c) { try { outAsync.flushConnection(conn); } - catch(Ice.LocalException ex) + catch(LocalException ex) { // Ignore. } @@ -308,7 +312,7 @@ public final class OutgoingConnectionFactory // // Only for use by Instance. // - OutgoingConnectionFactory(Ice.Communicator communicator, Instance instance) + OutgoingConnectionFactory(com.zeroc.Ice.Communicator communicator, Instance instance) { _communicator = communicator; _instance = instance; @@ -323,11 +327,11 @@ public final class OutgoingConnectionFactory { try { - IceUtilInternal.Assert.FinalizerAssert(_destroyed); - IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty()); - IceUtilInternal.Assert.FinalizerAssert(_connectionsByEndpoint.isEmpty()); - IceUtilInternal.Assert.FinalizerAssert(_pendingConnectCount == 0); - IceUtilInternal.Assert.FinalizerAssert(_pending.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_destroyed); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connections.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_connectionsByEndpoint.isEmpty()); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_pendingConnectCount == 0); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_pending.isEmpty()); } catch(java.lang.Exception ex) { @@ -342,7 +346,7 @@ public final class OutgoingConnectionFactory applyOverrides(EndpointI[] endpts) { DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); + java.util.List<EndpointI> endpoints = new java.util.ArrayList<>(); for(EndpointI endpoint : endpts) { // @@ -361,12 +365,12 @@ public final class OutgoingConnectionFactory return endpoints; } - synchronized private Ice.ConnectionI - findConnectionByEndpoint(java.util.List<EndpointI> endpoints, Ice.Holder<Boolean> compress) + synchronized private ConnectionI + findConnectionByEndpoint(java.util.List<EndpointI> endpoints, Holder<Boolean> compress) { if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); @@ -374,13 +378,13 @@ public final class OutgoingConnectionFactory for(EndpointI endpoint : endpoints) { - java.util.List<Ice.ConnectionI> connectionList = _connectionsByEndpoint.get(endpoint); + java.util.List<ConnectionI> connectionList = _connectionsByEndpoint.get(endpoint); if(connectionList == null) { continue; } - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections { @@ -403,8 +407,8 @@ public final class OutgoingConnectionFactory // // Must be called while synchronized. // - private Ice.ConnectionI - findConnection(java.util.List<ConnectorInfo> connectors, Ice.Holder<Boolean> compress) + private ConnectionI + findConnection(java.util.List<ConnectorInfo> connectors, Holder<Boolean> compress) { DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); for(ConnectorInfo ci : connectors) @@ -414,13 +418,13 @@ public final class OutgoingConnectionFactory continue; } - java.util.List<Ice.ConnectionI> connectionList = _connections.get(ci.connector); + java.util.List<ConnectionI> connectionList = _connections.get(ci.connector); if(connectionList == null) { continue; } - for(Ice.ConnectionI connection : connectionList) + for(ConnectionI connection : connectionList) { if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections { @@ -453,7 +457,7 @@ public final class OutgoingConnectionFactory if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } ++_pendingConnectCount; } @@ -469,24 +473,24 @@ public final class OutgoingConnectionFactory } } - private Ice.ConnectionI - getConnection(java.util.List<ConnectorInfo> connectors, ConnectCallback cb, Ice.Holder<Boolean> compress) + private ConnectionI + getConnection(java.util.List<ConnectorInfo> connectors, ConnectCallback cb, Holder<Boolean> compress) { assert(cb != null); synchronized(this) { if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } // // Reap closed connections // - java.util.List<Ice.ConnectionI> cons = _monitor.swapReapedConnections(); + java.util.List<ConnectionI> cons = _monitor.swapReapedConnections(); if(cons != null) { - for(Ice.ConnectionI c : cons) + for(ConnectionI c : cons) { _connections.removeElementWithValue(c.connector(), c); _connectionsByEndpoint.removeElementWithValue(c.endpoint(), c); @@ -503,13 +507,13 @@ public final class OutgoingConnectionFactory { if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } // // Search for a matching connection. If we find one, we're done. // - Ice.ConnectionI connection = findConnection(connectors, compress); + ConnectionI connection = findConnection(connectors, compress); if(connection != null) { return connection; @@ -545,7 +549,7 @@ public final class OutgoingConnectionFactory return null; } - private synchronized Ice.ConnectionI + private synchronized ConnectionI createConnection(Transceiver transceiver, ConnectorInfo ci) { assert(_pending.containsKey(ci.connector) && transceiver != null); @@ -555,24 +559,24 @@ public final class OutgoingConnectionFactory // is necessary to support the interruption of the connection initialization and validation // in case the communicator is destroyed. // - Ice.ConnectionI connection = null; + ConnectionI connection = null; try { if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } - connection = new Ice.ConnectionI(_communicator, _instance, _monitor, transceiver, ci.connector, + connection = new ConnectionI(_communicator, _instance, _monitor, transceiver, ci.connector, ci.endpoint.compress(false), null); } - catch(Ice.LocalException ex) + catch(LocalException ex) { try { transceiver.close(); } - catch(Ice.LocalException exc) + catch(LocalException exc) { // Ignore } @@ -588,16 +592,16 @@ public final class OutgoingConnectionFactory private void finishGetConnection(java.util.List<ConnectorInfo> connectors, ConnectorInfo ci, - Ice.ConnectionI connection, + ConnectionI connection, ConnectCallback cb) { - java.util.Set<ConnectCallback> connectionCallbacks = new java.util.HashSet<ConnectCallback>(); + java.util.Set<ConnectCallback> connectionCallbacks = new java.util.HashSet<>(); if(cb != null) { connectionCallbacks.add(cb); } - java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<ConnectCallback>(); + java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<>(); synchronized(this) { for(ConnectorInfo c : connectors) @@ -653,15 +657,15 @@ public final class OutgoingConnectionFactory } private void - finishGetConnection(java.util.List<ConnectorInfo> connectors, Ice.LocalException ex, ConnectCallback cb) + finishGetConnection(java.util.List<ConnectorInfo> connectors, LocalException ex, ConnectCallback cb) { - java.util.Set<ConnectCallback> failedCallbacks = new java.util.HashSet<ConnectCallback>(); + java.util.Set<ConnectCallback> failedCallbacks = new java.util.HashSet<>(); if(cb != null) { failedCallbacks.add(cb); } - java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<ConnectCallback>(); + java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<>(); synchronized(this) { for(ConnectorInfo c : connectors) @@ -735,7 +739,7 @@ public final class OutgoingConnectionFactory { if(!_pending.containsKey(p.connector)) { - _pending.put(p.connector, new java.util.HashSet<ConnectCallback>()); + _pending.put(p.connector, new java.util.HashSet<>()); } } @@ -756,14 +760,14 @@ public final class OutgoingConnectionFactory } private void - handleConnectionException(Ice.LocalException ex, boolean hasMore) + handleConnectionException(LocalException ex, boolean hasMore) { TraceLevels traceLevels = _instance.traceLevels(); if(traceLevels.retry >= 2) { StringBuilder s = new StringBuilder(128); s.append("connection to endpoint failed"); - if(ex instanceof Ice.CommunicatorDestroyedException) + if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException) { s.append("\n"); } @@ -784,14 +788,14 @@ public final class OutgoingConnectionFactory } private void - handleException(Ice.LocalException ex, boolean hasMore) + handleException(LocalException ex, boolean hasMore) { TraceLevels traceLevels = _instance.traceLevels(); if(traceLevels.retry >= 2) { StringBuilder s = new StringBuilder(128); s.append("couldn't resolve endpoint host"); - if(ex instanceof Ice.CommunicatorDestroyedException) + if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException) { s.append("\n"); } @@ -838,10 +842,10 @@ public final class OutgoingConnectionFactory public EndpointI endpoint; } - private static class ConnectCallback implements Ice.ConnectionI.StartCallback, EndpointI_connectors + private static class ConnectCallback implements ConnectionI.StartCallback, EndpointI_connectors { ConnectCallback(OutgoingConnectionFactory f, java.util.List<EndpointI> endpoints, boolean more, - CreateConnectionCallback cb, Ice.EndpointSelectionType selType) + CreateConnectionCallback cb, com.zeroc.Ice.EndpointSelectionType selType) { _factory = f; _endpoints = endpoints; @@ -856,7 +860,7 @@ public final class OutgoingConnectionFactory // @Override public void - connectionStartCompleted(Ice.ConnectionI connection) + connectionStartCompleted(ConnectionI connection) { if(_observer != null) { @@ -868,7 +872,7 @@ public final class OutgoingConnectionFactory @Override public void - connectionStartFailed(Ice.ConnectionI connection, Ice.LocalException ex) + connectionStartFailed(ConnectionI connection, LocalException ex) { assert(_current != null); if(connectionStartFailedImpl(ex)) @@ -908,7 +912,7 @@ public final class OutgoingConnectionFactory @Override public void - exception(Ice.LocalException ex) + exception(LocalException ex) { _factory.handleException(ex, _hasMore || _endpointsIter.hasNext()); if(_endpointsIter.hasNext()) @@ -932,7 +936,7 @@ public final class OutgoingConnectionFactory } void - setConnection(Ice.ConnectionI connection, boolean compress) + setConnection(ConnectionI connection, boolean compress) { // // Callback from the factory: the connection to one of the callback @@ -943,7 +947,7 @@ public final class OutgoingConnectionFactory } void - setException(Ice.LocalException ex) + setException(LocalException ex) { // // Callback from the factory: connection establishment failed. @@ -984,7 +988,7 @@ public final class OutgoingConnectionFactory // _factory.incPendingConnectCount(); } - catch(Ice.LocalException ex) + catch(LocalException ex) { _callback.setException(ex); return; @@ -1002,7 +1006,7 @@ public final class OutgoingConnectionFactory _currentEndpoint = _endpointsIter.next(); _currentEndpoint.connectors_async(_selType, this); } - catch(Ice.LocalException ex) + catch(LocalException ex) { exception(ex); } @@ -1017,8 +1021,8 @@ public final class OutgoingConnectionFactory // If all the connectors have been created, we ask the factory to get a // connection. // - Ice.Holder<Boolean> compress = new Ice.Holder<Boolean>(); - Ice.ConnectionI connection = _factory.getConnection(_connectors, this, compress); + Holder<Boolean> compress = new Holder<>(); + ConnectionI connection = _factory.getConnection(_connectors, this, compress); if(connection == null) { // @@ -1033,7 +1037,7 @@ public final class OutgoingConnectionFactory _callback.setConnection(connection, compress.value); _factory.decPendingConnectCount(); // Must be called last. } - catch(Ice.LocalException ex) + catch(LocalException ex) { _callback.setException(ex); _factory.decPendingConnectCount(); // Must be called last. @@ -1050,7 +1054,8 @@ public final class OutgoingConnectionFactory assert(_iter.hasNext()); _current = _iter.next(); - Ice.Instrumentation.CommunicatorObserver obsv = _factory._instance.initializationData().observer; + com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = + _factory._instance.initializationData().observer; if(obsv != null) { _observer = obsv.getConnectionEstablishmentObserver(_current.endpoint, @@ -1067,14 +1072,15 @@ public final class OutgoingConnectionFactory s.append(_current.endpoint.protocol()); s.append(" connection to "); s.append(_current.connector.toString()); - _factory._instance.initializationData().logger.trace(_factory._instance.traceLevels().networkCat, - s.toString()); + _factory._instance.initializationData().logger.trace( + _factory._instance.traceLevels().networkCat, s.toString()); } - Ice.ConnectionI connection = _factory.createConnection(_current.connector.connect(), _current); + ConnectionI connection = + _factory.createConnection(_current.connector.connect(), _current); connection.start(this); } - catch(Ice.LocalException ex) + catch(LocalException ex) { if(_factory._instance.traceLevels().network >= 2) { @@ -1084,8 +1090,8 @@ public final class OutgoingConnectionFactory s.append(_current.connector.toString()); s.append("\n"); s.append(ex); - _factory._instance.initializationData().logger.trace(_factory._instance.traceLevels().networkCat, - s.toString()); + _factory._instance.initializationData().logger.trace( + _factory._instance.traceLevels().networkCat, s.toString()); } if(connectionStartFailedImpl(ex)) @@ -1098,7 +1104,7 @@ public final class OutgoingConnectionFactory } private boolean - connectionStartFailedImpl(Ice.LocalException ex) + connectionStartFailedImpl(LocalException ex) { if(_observer != null) { @@ -1107,7 +1113,7 @@ public final class OutgoingConnectionFactory } _factory.handleConnectionException(ex, _hasMore || _iter.hasNext()); - if(ex instanceof Ice.CommunicatorDestroyedException) // No need to continue. + if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException) // No need to continue. { _factory.finishGetConnection(_connectors, ex, this); } @@ -1126,24 +1132,22 @@ public final class OutgoingConnectionFactory private final boolean _hasMore; private final CreateConnectionCallback _callback; private final java.util.List<EndpointI> _endpoints; - private final Ice.EndpointSelectionType _selType; + private final com.zeroc.Ice.EndpointSelectionType _selType; private java.util.Iterator<EndpointI> _endpointsIter; private EndpointI _currentEndpoint; - private java.util.List<ConnectorInfo> _connectors = new java.util.ArrayList<ConnectorInfo>(); + private java.util.List<ConnectorInfo> _connectors = new java.util.ArrayList<>(); private java.util.Iterator<ConnectorInfo> _iter; private ConnectorInfo _current; - private Ice.Instrumentation.Observer _observer; + private com.zeroc.Ice.Instrumentation.Observer _observer; } - private Ice.Communicator _communicator; + private com.zeroc.Ice.Communicator _communicator; private final Instance _instance; private final FactoryACMMonitor _monitor; private boolean _destroyed; - private MultiHashMap<Connector, Ice.ConnectionI> _connections = new MultiHashMap<Connector, Ice.ConnectionI>(); - private MultiHashMap<EndpointI, Ice.ConnectionI> _connectionsByEndpoint = - new MultiHashMap<EndpointI, Ice.ConnectionI>(); - private java.util.Map<Connector, java.util.HashSet<ConnectCallback> > _pending = - new java.util.HashMap<Connector, java.util.HashSet<ConnectCallback> >(); + private MultiHashMap<Connector, ConnectionI> _connections = new MultiHashMap<>(); + private MultiHashMap<EndpointI, ConnectionI> _connectionsByEndpoint = new MultiHashMap<>(); + private java.util.Map<Connector, java.util.HashSet<ConnectCallback> > _pending = new java.util.HashMap<>(); private int _pendingConnectCount = 0; } diff --git a/java/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutputStreamWrapper.java index 6f9e2f9a9d6..7e25830de18 100644 --- a/java/src/Ice/src/main/java/IceInternal/OutputStreamWrapper.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/OutputStreamWrapper.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.io.*; @@ -30,7 +30,7 @@ import java.io.*; public class OutputStreamWrapper extends java.io.OutputStream { public - OutputStreamWrapper(Ice.OutputStream s) + OutputStreamWrapper(com.zeroc.Ice.OutputStream s) { _s = s; _spos = s.pos(); @@ -171,7 +171,7 @@ public class OutputStreamWrapper extends java.io.OutputStream } } - private Ice.OutputStream _s; + private com.zeroc.Ice.OutputStream _s; private int _spos; private byte[] _bytes; private int _pos; diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java new file mode 100644 index 00000000000..43263641dd0 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Patcher.java @@ -0,0 +1,52 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +public class Patcher<T> implements com.zeroc.Ice.ReadValueCallback +{ + @FunctionalInterface + public interface Callback<T> + { + void valueReady(T v); + } + + public Patcher(Class<T> cls, String type) + { + this(cls, type, null); + } + + public Patcher(Class<T> cls, String type, Callback<T> cb) + { + _cls = cls; + _type = type; + _cb = cb; + } + + public void valueReady(com.zeroc.Ice.Value v) + { + if(v == null || _cls.isInstance(v)) + { + value = _cls.cast(v); + if(_cb != null) + { + _cb.valueReady(value); + } + } + else + { + Ex.throwUOE(_type, v); + } + } + + private Class<T> _cls; + private String _type; + private Callback<T> _cb; + public T value; +} diff --git a/java/src/Ice/src/main/java/IceInternal/ProcessI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProcessI.java index 516d5f03aa9..d8565158954 100644 --- a/java/src/Ice/src/main/java/IceInternal/ProcessI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProcessI.java @@ -7,25 +7,23 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -public class ProcessI extends Ice._ProcessDisp +public class ProcessI implements com.zeroc.Ice.Process { - public ProcessI(Ice.Communicator communicator) + public ProcessI(com.zeroc.Ice.Communicator communicator) { _communicator = communicator; } @Override - public void - shutdown(Ice.Current current) + public void shutdown(com.zeroc.Ice.Current current) { _communicator.shutdown(); } @Override - public void - writeMessage(String message, int fd, Ice.Current current) + public void writeMessage(String message, int fd, com.zeroc.Ice.Current current) { switch(fd) { @@ -42,5 +40,5 @@ public class ProcessI extends Ice._ProcessDisp } } - private Ice.Communicator _communicator; + private com.zeroc.Ice.Communicator _communicator; } diff --git a/java/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java index b6041ba4fd6..6a08670bc4c 100644 --- a/java/src/Ice/src/main/java/IceInternal/PropertiesAdminI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertiesAdminI.java @@ -7,9 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -class PropertiesAdminI extends Ice._PropertiesAdminDisp implements Ice.NativePropertiesAdmin +import com.zeroc.Ice.PropertiesAdminUpdateCallback; + +class PropertiesAdminI implements com.zeroc.Ice.PropertiesAdmin, com.zeroc.Ice.NativePropertiesAdmin { public PropertiesAdminI(Instance instance) { @@ -18,21 +20,20 @@ class PropertiesAdminI extends Ice._PropertiesAdminDisp implements Ice.NativePro } @Override - public synchronized String - getProperty(String name, Ice.Current current) + public synchronized String getProperty(String name, com.zeroc.Ice.Current current) { return _properties.getProperty(name); } @Override public synchronized java.util.TreeMap<String, String> - getPropertiesForPrefix(String name, Ice.Current current) + getPropertiesForPrefix(String name, com.zeroc.Ice.Current current) { - return new java.util.TreeMap<String, String>(_properties.getPropertiesForPrefix(name)); + return new java.util.TreeMap<>(_properties.getPropertiesForPrefix(name)); } @Override - synchronized public void setProperties(java.util.Map<String, String> props, Ice.Current current) + synchronized public void setProperties(java.util.Map<String, String> props, com.zeroc.Ice.Current current) { java.util.Map<String, String> old = _properties.getPropertiesForPrefix(""); final int traceLevel = _properties.getPropertyAsInt("Ice.Trace.Admin.Properties"); @@ -47,9 +48,9 @@ class PropertiesAdminI extends Ice._PropertiesAdminDisp implements Ice.NativePro // 3) Any properties not present in the new set but present in the existing set. // In other words, the property has been removed. // - java.util.Map<String, String> added = new java.util.HashMap<String, String>(); - java.util.Map<String, String> changed = new java.util.HashMap<String, String>(); - java.util.Map<String, String> removed = new java.util.HashMap<String, String>(); + java.util.Map<String, String> added = new java.util.HashMap<>(); + java.util.Map<String, String> changed = new java.util.HashMap<>(); + java.util.Map<String, String> removed = new java.util.HashMap<>(); for(java.util.Map.Entry<String, String> e : props.entrySet()) { final String key = e.getKey(); @@ -160,22 +161,20 @@ class PropertiesAdminI extends Ice._PropertiesAdminDisp implements Ice.NativePro if(!_updateCallbacks.isEmpty()) { - java.util.Map<String, String> changes = new java.util.HashMap<String, String>(added); + java.util.Map<String, String> changes = new java.util.HashMap<>(added); changes.putAll(changed); changes.putAll(removed); // // Copy the callbacks to allow callbacks to update the callbacks. // - java.util.List<Ice.PropertiesAdminUpdateCallback> callbacks = - new java.util.ArrayList<Ice.PropertiesAdminUpdateCallback>(_updateCallbacks); - for(Ice.PropertiesAdminUpdateCallback callback : callbacks) + for(PropertiesAdminUpdateCallback callback : new java.util.ArrayList<>(_updateCallbacks)) { try { callback.updated(changes); } - catch(java.lang.Exception ex) + catch(RuntimeException ex) { if(_properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1) { @@ -192,23 +191,20 @@ class PropertiesAdminI extends Ice._PropertiesAdminDisp implements Ice.NativePro } @Override - public synchronized void - addUpdateCallback (Ice.PropertiesAdminUpdateCallback cb) + public synchronized void addUpdateCallback(PropertiesAdminUpdateCallback cb) { _updateCallbacks.add(cb); } @Override - public synchronized void - removeUpdateCallback(Ice.PropertiesAdminUpdateCallback cb) + public synchronized void removeUpdateCallback(PropertiesAdminUpdateCallback cb) { _updateCallbacks.remove(cb); } - private final Ice.Properties _properties; - private final Ice.Logger _logger; - private java.util.List<Ice.PropertiesAdminUpdateCallback> _updateCallbacks = - new java.util.ArrayList<Ice.PropertiesAdminUpdateCallback>(); + private final com.zeroc.Ice.Properties _properties; + private final com.zeroc.Ice.Logger _logger; + private java.util.List<PropertiesAdminUpdateCallback> _updateCallbacks = new java.util.ArrayList<>(); static private final String _traceCategory = "Admin.Properties"; } diff --git a/java/src/Ice/src/main/java/IceInternal/Property.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Property.java index 3d8395c0289..8f1555c5831 100644 --- a/java/src/Ice/src/main/java/IceInternal/Property.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Property.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class Property { diff --git a/java/src/Ice/src/main/java/IceInternal/PropertyNames.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java index 78fca903d04..45647f08494 100644 --- a/java/src/Ice/src/main/java/IceInternal/PropertyNames.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java @@ -6,11 +6,11 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Aug 18 20:28:56 2016 +// Generated by makeprops.py from file ..\config\PropertyNames.xml, Fri Jul 15 14:02:34 2016 // IMPORTANT: Do not edit this file -- any edits made here will be lost! -package IceInternal; +package com.zeroc.IceInternal; public final class PropertyNames { diff --git a/java/src/Ice/src/main/java/IceInternal/Protocol.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Protocol.java index 01b9a460b42..d6840f9d524 100644 --- a/java/src/Ice/src/main/java/IceInternal/Protocol.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Protocol.java @@ -7,7 +7,10 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.EncodingVersion; +import com.zeroc.Ice.ProtocolVersion; final public class Protocol { @@ -52,15 +55,15 @@ final public class Protocol public final static byte[] requestHdr = { - IceInternal.Protocol.magic[0], - IceInternal.Protocol.magic[1], - IceInternal.Protocol.magic[2], - IceInternal.Protocol.magic[3], - IceInternal.Protocol.protocolMajor, - IceInternal.Protocol.protocolMinor, - IceInternal.Protocol.protocolEncodingMajor, - IceInternal.Protocol.protocolEncodingMinor, - IceInternal.Protocol.requestMsg, + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.protocolEncodingMajor, + Protocol.protocolEncodingMinor, + Protocol.requestMsg, (byte)0, // Compression status. (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). @@ -68,15 +71,15 @@ final public class Protocol public final static byte[] requestBatchHdr = { - IceInternal.Protocol.magic[0], - IceInternal.Protocol.magic[1], - IceInternal.Protocol.magic[2], - IceInternal.Protocol.magic[3], - IceInternal.Protocol.protocolMajor, - IceInternal.Protocol.protocolMinor, - IceInternal.Protocol.protocolEncodingMajor, - IceInternal.Protocol.protocolEncodingMinor, - IceInternal.Protocol.requestBatchMsg, + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.protocolEncodingMajor, + Protocol.protocolEncodingMinor, + Protocol.requestBatchMsg, 0, // Compression status. (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). @@ -84,49 +87,49 @@ final public class Protocol public final static byte[] replyHdr = { - IceInternal.Protocol.magic[0], - IceInternal.Protocol.magic[1], - IceInternal.Protocol.magic[2], - IceInternal.Protocol.magic[3], - IceInternal.Protocol.protocolMajor, - IceInternal.Protocol.protocolMinor, - IceInternal.Protocol.protocolEncodingMajor, - IceInternal.Protocol.protocolEncodingMinor, - IceInternal.Protocol.replyMsg, + Protocol.magic[0], + Protocol.magic[1], + Protocol.magic[2], + Protocol.magic[3], + Protocol.protocolMajor, + Protocol.protocolMinor, + Protocol.protocolEncodingMajor, + Protocol.protocolEncodingMinor, + Protocol.replyMsg, (byte)0, // Compression status. (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). }; - static final public Ice.ProtocolVersion currentProtocol = new Ice.ProtocolVersion(protocolMajor, protocolMinor); - static final public Ice.EncodingVersion currentProtocolEncoding = new Ice.EncodingVersion(protocolEncodingMajor, - protocolEncodingMinor); + static final public ProtocolVersion currentProtocol = new ProtocolVersion(protocolMajor, protocolMinor); + static final public EncodingVersion currentProtocolEncoding = new EncodingVersion(protocolEncodingMajor, + protocolEncodingMinor); - static final public Ice.EncodingVersion currentEncoding = new Ice.EncodingVersion(encodingMajor, encodingMinor); + static final public EncodingVersion currentEncoding = new EncodingVersion(encodingMajor, encodingMinor); static public void - checkSupportedProtocol(Ice.ProtocolVersion v) + checkSupportedProtocol(ProtocolVersion v) { if(v.major != currentProtocol.major || v.minor > currentProtocol.minor) { - throw new Ice.UnsupportedProtocolException("", v, currentProtocol); + throw new com.zeroc.Ice.UnsupportedProtocolException("", v, currentProtocol); } } static public void - checkSupportedProtocolEncoding(Ice.EncodingVersion v) + checkSupportedProtocolEncoding(EncodingVersion v) { if(v.major != currentProtocolEncoding.major || v.minor > currentProtocolEncoding.minor) { - throw new Ice.UnsupportedEncodingException("", v, currentProtocolEncoding); + throw new com.zeroc.Ice.UnsupportedEncodingException("", v, currentProtocolEncoding); } } static public void - checkSupportedEncoding(Ice.EncodingVersion v) + checkSupportedEncoding(EncodingVersion v) { if(v.major != currentEncoding.major || v.minor > currentEncoding.minor) { - throw new Ice.UnsupportedEncodingException("", v, currentEncoding); + throw new com.zeroc.Ice.UnsupportedEncodingException("", v, currentEncoding); } } @@ -134,8 +137,8 @@ final public class Protocol // Either return the given protocol if not compatible, or the greatest // supported protocol otherwise. // - static public Ice.ProtocolVersion - getCompatibleProtocol(Ice.ProtocolVersion v) + static public ProtocolVersion + getCompatibleProtocol(ProtocolVersion v) { if(v.major != currentProtocol.major) { @@ -159,8 +162,8 @@ final public class Protocol // Either return the given encoding if not compatible, or the greatest // supported encoding otherwise. // - static public Ice.EncodingVersion - getCompatibleEncoding(Ice.EncodingVersion v) + static public EncodingVersion + getCompatibleEncoding(EncodingVersion v) { if(v.major != currentEncoding.major) { @@ -181,7 +184,7 @@ final public class Protocol } static public boolean - isSupported(Ice.EncodingVersion version, Ice.EncodingVersion supported) + isSupported(EncodingVersion version, EncodingVersion supported) { return version.major == supported.major && version.minor <= supported.minor; } diff --git a/java/src/Ice/src/main/java/IceInternal/ProtocolInstance.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolInstance.java index e88ec007887..125f55414af 100644 --- a/java/src/Ice/src/main/java/IceInternal/ProtocolInstance.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolInstance.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class ProtocolInstance { - public ProtocolInstance(Ice.Communicator communicator, short type, String protocol, boolean secure) + public ProtocolInstance(com.zeroc.Ice.Communicator communicator, short type, String protocol, boolean secure) { _instance = Util.getInstance(communicator); _traceLevel = _instance.traceLevels().network; @@ -33,7 +33,7 @@ public class ProtocolInstance return _traceCategory; } - public Ice.Logger logger() + public com.zeroc.Ice.Logger logger() { return _logger; } @@ -53,7 +53,7 @@ public class ProtocolInstance return _secure; } - public Ice.Properties properties() + public com.zeroc.Ice.Properties properties() { return _properties; } @@ -78,7 +78,7 @@ public class ProtocolInstance return _instance.defaultsAndOverrides().defaultSourceAddress; } - public Ice.EncodingVersion defaultEncoding() + public com.zeroc.Ice.EncodingVersion defaultEncoding() { return _instance.defaultsAndOverrides().defaultEncoding; } @@ -98,7 +98,7 @@ public class ProtocolInstance return _instance.messageSizeMax(); } - public void resolve(String host, int port, Ice.EndpointSelectionType type, IPEndpointI endpt, + public void resolve(String host, int port, com.zeroc.Ice.EndpointSelectionType type, IPEndpointI endpt, EndpointI_connectors callback) { _instance.endpointHostResolver().resolve(host, port, type, endpt, callback); @@ -134,8 +134,8 @@ public class ProtocolInstance protected Instance _instance; protected int _traceLevel; protected String _traceCategory; - protected Ice.Logger _logger; - protected Ice.Properties _properties; + protected com.zeroc.Ice.Logger _logger; + protected com.zeroc.Ice.Properties _properties; protected String _protocol; protected short _type; protected boolean _secure; diff --git a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacade.java index 7bfb91f3e04..b988b67274c 100644 --- a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacade.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacade.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface ProtocolPluginFacade { @@ -15,7 +15,7 @@ public interface ProtocolPluginFacade // Get the Communicator instance with which this facade is // associated. // - Ice.Communicator getCommunicator(); + com.zeroc.Ice.Communicator getCommunicator(); // // Register an EndpointFactory. diff --git a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacadeI.java index fa510e2e6f9..2456d0c061c 100644 --- a/java/src/Ice/src/main/java/IceInternal/ProtocolPluginFacadeI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProtocolPluginFacadeI.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class ProtocolPluginFacadeI implements ProtocolPluginFacade { - public ProtocolPluginFacadeI(Ice.Communicator communicator) + public ProtocolPluginFacadeI(com.zeroc.Ice.Communicator communicator) { _communicator = communicator; _instance = Util.getInstance(communicator); @@ -22,7 +22,7 @@ public class ProtocolPluginFacadeI implements ProtocolPluginFacade // associated. // @Override - public Ice.Communicator getCommunicator() + public com.zeroc.Ice.Communicator getCommunicator() { return _communicator; } @@ -55,5 +55,5 @@ public class ProtocolPluginFacadeI implements ProtocolPluginFacade } private Instance _instance; - private Ice.Communicator _communicator; + private com.zeroc.Ice.Communicator _communicator; } diff --git a/java/src/Ice/src/main/java/IceInternal/ProxyFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java index ed3f1b81bd6..941dbab051a 100644 --- a/java/src/Ice/src/main/java/IceInternal/ProxyFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFactory.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -import Ice.OperationInterruptedException; +import com.zeroc.Ice.OperationInterruptedException; public final class ProxyFactory { - public Ice.ObjectPrx + public com.zeroc.Ice.ObjectPrx stringToProxy(String str) { Reference ref = _instance.referenceFactory().create(str, null); @@ -21,11 +21,11 @@ public final class ProxyFactory } public String - proxyToString(Ice.ObjectPrx proxy) + proxyToString(com.zeroc.Ice.ObjectPrx proxy) { if(proxy != null) { - Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy; + com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)proxy; return h.__reference().toString(); } else @@ -34,7 +34,7 @@ public final class ProxyFactory } } - public Ice.ObjectPrx + public com.zeroc.Ice.ObjectPrx propertyToProxy(String prefix) { String proxy = _instance.initializationData().properties.getProperty(prefix); @@ -43,35 +43,34 @@ public final class ProxyFactory } public java.util.Map<String, String> - proxyToProperty(Ice.ObjectPrx proxy, String prefix) + proxyToProperty(com.zeroc.Ice.ObjectPrx proxy, String prefix) { if(proxy != null) { - Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy; + com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)proxy; return h.__reference().toProperty(prefix); } else { - return new java.util.HashMap<String, String>(); + return new java.util.HashMap<>(); } } - public Ice.ObjectPrx - streamToProxy(Ice.InputStream s) + public com.zeroc.Ice.ObjectPrx + streamToProxy(com.zeroc.Ice.InputStream s) { - Ice.Identity ident = new Ice.Identity(); - ident.__read(s); + com.zeroc.Ice.Identity ident = com.zeroc.Ice.Identity.read(s, null); Reference ref = _instance.referenceFactory().create(ident, s); return referenceToProxy(ref); } - public Ice.ObjectPrx + public com.zeroc.Ice.ObjectPrx referenceToProxy(Reference ref) { if(ref != null) { - Ice.ObjectPrxHelperBase proxy = new Ice.ObjectPrxHelperBase(); + com.zeroc.Ice._ObjectPrxI proxy = new com.zeroc.Ice._ObjectPrxI(); proxy.__setup(ref); return proxy; } @@ -82,25 +81,24 @@ public final class ProxyFactory } public int - checkRetryAfterException(Ice.LocalException ex, Reference ref, Ice.Holder<Integer> sleepInterval, int cnt) + checkRetryAfterException(com.zeroc.Ice.LocalException ex, Reference ref, Holder<Integer> sleepInterval, int cnt) { TraceLevels traceLevels = _instance.traceLevels(); - Ice.Logger logger = _instance.initializationData().logger; + com.zeroc.Ice.Logger logger = _instance.initializationData().logger; // // We don't retry batch requests because the exception might have caused - // the all the requests batched with the connection to be aborted and we + // all the requests batched with the connection to be aborted and we // want the application to be notified. // - if(ref.getMode() == IceInternal.Reference.ModeBatchOneway || - ref.getMode() == IceInternal.Reference.ModeBatchDatagram) + if(ref.getMode() == Reference.ModeBatchOneway || ref.getMode() == Reference.ModeBatchDatagram) { throw ex; } - if(ex instanceof Ice.ObjectNotExistException) + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) { - Ice.ObjectNotExistException one = (Ice.ObjectNotExistException)ex; + com.zeroc.Ice.ObjectNotExistException one = (com.zeroc.Ice.ObjectNotExistException)ex; if(ref.getRouterInfo() != null && one.operation.equals("ice_add_proxy")) { @@ -151,7 +149,7 @@ public final class ProxyFactory throw ex; } } - else if(ex instanceof Ice.RequestFailedException) + else if(ex instanceof com.zeroc.Ice.RequestFailedException) { // // For all other cases, we don't retry ObjectNotExistException @@ -181,7 +179,7 @@ public final class ProxyFactory // the client that all of the batched requests were accepted, when // in reality only the last few are actually sent. // - if(ex instanceof Ice.MarshalException) + if(ex instanceof com.zeroc.Ice.MarshalException) { throw ex; } @@ -190,7 +188,8 @@ public final class ProxyFactory // Don't retry if the communicator is destroyed or object adapter // deactivated. // - if(ex instanceof Ice.CommunicatorDestroyedException || ex instanceof Ice.ObjectAdapterDeactivatedException) + if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException || + ex instanceof com.zeroc.Ice.ObjectAdapterDeactivatedException) { throw ex; } @@ -198,7 +197,8 @@ public final class ProxyFactory // // Don't retry invocation timeouts. // - if(ex instanceof Ice.InvocationTimeoutException || ex instanceof Ice.InvocationCanceledException) + if(ex instanceof com.zeroc.Ice.InvocationTimeoutException || + ex instanceof com.zeroc.Ice.InvocationCanceledException) { throw ex; } @@ -215,7 +215,7 @@ public final class ProxyFactory assert(cnt > 0); int interval; - if(cnt == (_retryIntervals.length + 1) && ex instanceof Ice.CloseConnectionException) + if(cnt == (_retryIntervals.length + 1) && ex instanceof com.zeroc.Ice.CloseConnectionException) { // // A close connection exception is always retried at least once, even if the retry diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java new file mode 100644 index 00000000000..5253ecb37b5 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyFlushBatch.java @@ -0,0 +1,114 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +public class ProxyFlushBatch extends ProxyOutgoingAsyncBase<Void> +{ + public ProxyFlushBatch(com.zeroc.Ice._ObjectPrxI prx) + { + super(prx, "ice_flushBatchRequests"); + _observer = ObserverHelper.get(prx, "ice_flushBatchRequests"); + _batchRequestNum = prx.__getBatchRequestQueue().swap(_os); + } + + @Override + public boolean completed(com.zeroc.Ice.InputStream is) + { + assert(false); + return false; + } + + @Override + protected synchronized void __sent() + { + super.__sent(); + + assert((_state & StateOK) != 0); + complete(null); + } + + @Override + protected boolean __needCallback() + { + return true; + } + + @Override + protected void __completed() + { + super.__completed(); + if(_exception != null) + { + completeExceptionally(_exception); + } + } + + @Override + public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response) + throws RetryException + { + if(_batchRequestNum == 0) + { + return sent() ? AsyncStatus.Sent | AsyncStatus.InvokeSentCallback : AsyncStatus.Sent; + } + _cachedConnection = connection; + return connection.sendAsyncRequest(this, compress, false, _batchRequestNum); + } + + @Override + public int invokeCollocated(CollocatedRequestHandler handler) + { + if(_batchRequestNum == 0) + { + return sent() ? AsyncStatus.Sent | AsyncStatus.InvokeSentCallback : AsyncStatus.Sent; + } + return handler.invokeAsyncRequest(this, _batchRequestNum, false); + } + + public void invoke() + { + Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_proxy.__reference().getProtocol())); + invokeImpl(true); // userThread = true + } + + public void __wait() + { + if(Thread.currentThread().interrupted()) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + + try + { + get(); + } + catch(InterruptedException ex) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + catch(java.util.concurrent.ExecutionException ee) + { + try + { + throw ee.getCause(); + } + catch(RuntimeException ex) // Includes LocalException + { + throw ex; + } + catch(Throwable ex) + { + throw new com.zeroc.Ice.UnknownException(ex); + } + } + } + + protected int _batchRequestNum; +} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java new file mode 100644 index 00000000000..f7cbaa9a94b --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyGetConnection.java @@ -0,0 +1,106 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +public class ProxyGetConnection extends ProxyOutgoingAsyncBase<com.zeroc.Ice.Connection> +{ + public ProxyGetConnection(com.zeroc.Ice._ObjectPrxI prx) + { + super(prx, "ice_getConnection"); + _observer = ObserverHelper.get(prx, "ice_getConnection"); + } + + @Override + protected boolean __needCallback() + { + return true; + } + + @Override + protected void __completed() + { + super.__completed(); + + if(_exception != null) + { + completeExceptionally(_exception); + } + else + { + complete(_cachedConnection); + } + } + + @Override + public boolean completed(com.zeroc.Ice.InputStream is) + { + assert(false); + return false; + } + + @Override + public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response) + throws RetryException + { + _cachedConnection = connection; + if(finished(true)) + { + invokeCompletedAsync(); + } + return AsyncStatus.Sent; + } + + @Override + public int invokeCollocated(CollocatedRequestHandler handler) + { + if(finished(true)) + { + invokeCompletedAsync(); + } + return AsyncStatus.Sent; + } + + public void invoke() + { + invokeImpl(true); // userThread = true + } + + public com.zeroc.Ice.Connection __wait() + { + if(Thread.currentThread().interrupted()) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + + try + { + return get(); + } + catch(InterruptedException ex) + { + throw new com.zeroc.Ice.OperationInterruptedException(); + } + catch(java.util.concurrent.ExecutionException ee) + { + try + { + throw ee.getCause(); + } + catch(RuntimeException ex) // Includes LocalException + { + throw ex; + } + catch(Throwable ex) + { + throw new com.zeroc.Ice.UnknownException(ex); + } + } + } +} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java new file mode 100644 index 00000000000..05bb8483cf0 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyIceInvoke.java @@ -0,0 +1,218 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +import com.zeroc.Ice.FormatType; +import com.zeroc.Ice.InputStream; +import com.zeroc.Ice.OperationInterruptedException; +import com.zeroc.Ice.OutputStream; +import com.zeroc.Ice.UserException; +import com.zeroc.Ice.UnknownException; +import com.zeroc.Ice.UnknownUserException; + +public class ProxyIceInvoke extends ProxyOutgoingAsyncBase<com.zeroc.Ice.Object.Ice_invokeResult> +{ + public ProxyIceInvoke(com.zeroc.Ice.ObjectPrx prx, String operation, com.zeroc.Ice.OperationMode mode, + boolean synchronous) + { + super((com.zeroc.Ice._ObjectPrxI)prx, operation); + _mode = mode == null ? com.zeroc.Ice.OperationMode.Normal : mode; + _synchronous = synchronous; + _encoding = Protocol.getCompatibleEncoding(_proxy.__reference().getEncoding()); + _is = null; + } + + public void invoke(byte[] inParams, java.util.Map<String, String> ctx) + { + try + { + prepare(ctx); + writeParamEncaps(inParams); + + if(isBatch()) + { + // + // NOTE: we don't call sent/completed callbacks for batch AMI requests + // + _sentSynchronously = true; + _proxy.__getBatchRequestQueue().finishBatchRequest(_os, _proxy, _operation); + finished(true); + } + else + { + // + // NOTE: invokeImpl doesn't throw so this can be called from the + // try block with the catch block calling abort() in case of an + // exception. + // + invokeImpl(true); // userThread = true + } + } + catch(com.zeroc.Ice.Exception ex) + { + abort(ex); + } + } + + public com.zeroc.Ice.Object.Ice_invokeResult __wait() + { + if(isBatch()) + { + // + // The future will not be completed for a batch invocation. + // + return new com.zeroc.Ice.Object.Ice_invokeResult(true, new byte[0]); + } + + if(Thread.currentThread().interrupted()) + { + throw new OperationInterruptedException(); + } + + try + { + return get(); + } + catch(InterruptedException ex) + { + throw new OperationInterruptedException(); + } + catch(java.util.concurrent.ExecutionException ee) + { + try + { + throw ee.getCause(); + } + catch(RuntimeException ex) // Includes LocalException + { + throw ex; + } + catch(Throwable ex) + { + throw new UnknownException(ex); + } + } + } + + @Override + protected void __sent() + { + super.__sent(); + + if(!_proxy.ice_isTwoway()) + { + // + // For a non-twoway proxy, the invocation is completed after it is sent. + // + complete(new com.zeroc.Ice.Object.Ice_invokeResult(true, new byte[0])); + } + } + + @Override + public boolean sent() + { + return sent(!_proxy.ice_isTwoway()); // done = true if not a two-way proxy (no response expected) + } + + @Override + public int invokeRemote(com.zeroc.Ice.ConnectionI connection, boolean compress, boolean response) + throws RetryException + { + _cachedConnection = connection; + return connection.sendAsyncRequest(this, compress, response, 0); + } + + @Override + public int invokeCollocated(CollocatedRequestHandler handler) + { + // The stream cannot be cached if the proxy is not a twoway or there is an invocation timeout set. + if(!_proxy.ice_isTwoway() || _proxy.__reference().getInvocationTimeout() > 0) + { + // Disable caching by marking the streams as cached! + _state |= StateCachedBuffers; + } + return handler.invokeAsyncRequest(this, 0, _synchronous); + } + + @Override + public void abort(com.zeroc.Ice.Exception ex) + { + if(isBatch()) + { + // + // If we didn't finish a batch oneway or datagram request, we + // must notify the connection about that we give up ownership + // of the batch stream. + // + _proxy.__getBatchRequestQueue().abortBatchRequest(_os); + } + + super.abort(ex); + } + + @Override + protected void __completed() + { + super.__completed(); + + if(_exception != null) + { + completeExceptionally(_exception); + } + else + { + com.zeroc.Ice.Object.Ice_invokeResult r = new com.zeroc.Ice.Object.Ice_invokeResult(); + r.returnValue = (_state & StateOK) > 0; + r.outParams = readParamEncaps(); + complete(r); + } + } + + @Override + public final boolean completed(com.zeroc.Ice.InputStream is) + { + // + // NOTE: this method is called from ConnectionI.parseMessage + // with the connection locked. Therefore, it must not invoke + // any user callbacks. + // + + // _is can already be initialized if the invocation is retried + if(_is == null) + { + _is = new com.zeroc.Ice.InputStream(_instance, Protocol.currentProtocolEncoding); + } + _is.swap(is); + + return super.completed(_is); + } + + private void writeParamEncaps(byte[] encaps) + { + if(encaps == null || encaps.length == 0) + { + _os.writeEmptyEncapsulation(_encoding); + } + else + { + _os.writeEncapsulation(encaps); + } + } + + private byte[] readParamEncaps() + { + return _is.readEncapsulation(null); + } + + final private com.zeroc.Ice.EncodingVersion _encoding; + private com.zeroc.Ice.InputStream _is; + + private boolean _synchronous; // True if this AMI request is being used for a generated synchronous invocation. +} diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java new file mode 100644 index 00000000000..861941470f7 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ProxyOutgoingAsyncBase.java @@ -0,0 +1,533 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +// +// Base class for proxy based invocations. This class handles the +// retry for proxy invocations. It also ensures the child observer is +// correct notified of failures and make sure the retry task is +// correctly canceled when the invocation completes. +// +public abstract class ProxyOutgoingAsyncBase<T> extends OutgoingAsyncBase<T> +{ + public abstract int invokeRemote(com.zeroc.Ice.ConnectionI con, boolean compress, boolean response) + throws RetryException; + + public abstract int invokeCollocated(CollocatedRequestHandler handler); + + public boolean isBatch() + { + return _proxyMode == Reference.ModeBatchOneway || _proxyMode == Reference.ModeBatchDatagram; + } + + @Override + public com.zeroc.Ice.ObjectPrx getProxy() + { + return _proxy; + } + + @Override + public boolean completed(com.zeroc.Ice.InputStream is) + { + // + // NOTE: this method is called from ConnectionI.parseMessage + // with the connection locked. Therefore, it must not invoke + // any user callbacks. + // + + assert(_proxy.ice_isTwoway()); // Can only be called for twoways. + + if(_childObserver != null) + { + _childObserver.reply(is.size() - Protocol.headerSize - 4); + _childObserver.detach(); + _childObserver = null; + } + + byte replyStatus; + try + { + replyStatus = is.readByte(); + + switch(replyStatus) + { + case ReplyStatus.replyOK: + { + break; + } + + case ReplyStatus.replyUserException: + { + if(_observer != null) + { + _observer.userException(); + } + break; + } + + case ReplyStatus.replyObjectNotExist: + case ReplyStatus.replyFacetNotExist: + case ReplyStatus.replyOperationNotExist: + { + com.zeroc.Ice.Identity id = com.zeroc.Ice.Identity.read(is, null); + + // + // For compatibility with the old FacetPath. + // + String[] facetPath = is.readStringSeq(); + String facet; + if(facetPath.length > 0) + { + if(facetPath.length > 1) + { + throw new com.zeroc.Ice.MarshalException(); + } + facet = facetPath[0]; + } + else + { + facet = ""; + } + + String operation = is.readString(); + + com.zeroc.Ice.RequestFailedException ex = null; + switch(replyStatus) + { + case ReplyStatus.replyObjectNotExist: + { + ex = new com.zeroc.Ice.ObjectNotExistException(); + break; + } + + case ReplyStatus.replyFacetNotExist: + { + ex = new com.zeroc.Ice.FacetNotExistException(); + break; + } + + case ReplyStatus.replyOperationNotExist: + { + ex = new com.zeroc.Ice.OperationNotExistException(); + break; + } + + default: + { + assert(false); + break; + } + } + + ex.id = id; + ex.facet = facet; + ex.operation = operation; + throw ex; + } + + case ReplyStatus.replyUnknownException: + case ReplyStatus.replyUnknownLocalException: + case ReplyStatus.replyUnknownUserException: + { + String unknown = is.readString(); + + com.zeroc.Ice.UnknownException ex = null; + switch(replyStatus) + { + case ReplyStatus.replyUnknownException: + { + ex = new com.zeroc.Ice.UnknownException(); + break; + } + + case ReplyStatus.replyUnknownLocalException: + { + ex = new com.zeroc.Ice.UnknownLocalException(); + break; + } + + case ReplyStatus.replyUnknownUserException: + { + ex = new com.zeroc.Ice.UnknownUserException(); + break; + } + + default: + { + assert(false); + break; + } + } + + ex.unknown = unknown; + throw ex; + } + + default: + { + throw new com.zeroc.Ice.UnknownReplyStatusException(); + } + } + + return finished(replyStatus == ReplyStatus.replyOK); + } + catch(com.zeroc.Ice.Exception ex) + { + return completed(ex); + } + } + + @Override + public boolean completed(com.zeroc.Ice.Exception exc) + { + if(_childObserver != null) + { + _childObserver.failed(exc.ice_id()); + _childObserver.detach(); + _childObserver = null; + } + + // + // NOTE: at this point, synchronization isn't needed, no other threads should be + // calling on the callback. + // + try + { + // + // It's important to let the retry queue do the retry even if + // the retry interval is 0. This method can be called with the + // connection locked so we can't just retry here. + // + _instance.retryQueue().add(this, handleException(exc)); + return false; + } + catch(com.zeroc.Ice.Exception ex) + { + return finished(ex); // No retries, we're done + } + } + + public void retryException(com.zeroc.Ice.Exception ex) + { + try + { + // + // It's important to let the retry queue do the retry. This is + // called from the connect request handler and the retry might + // require could end up waiting for the flush of the + // connection to be done. + // + _proxy.__updateRequestHandler(_handler, null); // Clear request handler and always retry. + _instance.retryQueue().add(this, 0); + } + catch(com.zeroc.Ice.Exception exc) + { + if(completed(exc)) + { + invokeCompletedAsync(); + } + } + } + + public void retry() + { + invokeImpl(false); + } + + public void cancelable(final CancellationHandler handler) + { + if(_proxy.__reference().getInvocationTimeout() == -2 && _cachedConnection != null) + { + final int timeout = _cachedConnection.timeout(); + if(timeout > 0) + { + _timerFuture = _instance.timer().schedule( + new Runnable() + { + @Override + public void run() + { + cancel(new com.zeroc.Ice.ConnectionTimeoutException()); + } + }, timeout, java.util.concurrent.TimeUnit.MILLISECONDS); + } + } + super.cancelable(handler); + } + + public void abort(com.zeroc.Ice.Exception ex) + { + assert(_childObserver == null); + if(finished(ex)) + { + invokeCompletedAsync(); + } + else if(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException) + { + // + // If it's a communicator destroyed exception, don't swallow + // it but instead notify the user thread. Even if no callback + // was provided. + // + throw ex; + } + } + + protected ProxyOutgoingAsyncBase(com.zeroc.Ice._ObjectPrxI prx, String op) + { + super(prx.ice_getCommunicator(), prx.__reference().getInstance(), op); + _proxy = prx; + _mode = com.zeroc.Ice.OperationMode.Normal; + _cnt = 0; + _sent = false; + _proxyMode = _proxy.__reference().getMode(); + } + + protected ProxyOutgoingAsyncBase(com.zeroc.Ice._ObjectPrxI prx, String op, com.zeroc.Ice.OutputStream os) + { + super(prx.ice_getCommunicator(), prx.__reference().getInstance(), op, os); + _proxy = prx; + _mode = com.zeroc.Ice.OperationMode.Normal; + _cnt = 0; + _sent = false; + _proxyMode = _proxy.__reference().getMode(); + } + + @Override + protected boolean __needCallback() + { + return !isBatch(); + } + + protected void invokeImpl(boolean userThread) + { + try + { + if(userThread) + { + int invocationTimeout = _proxy.__reference().getInvocationTimeout(); + if(invocationTimeout > 0) + { + _timerFuture = _instance.timer().schedule( + new Runnable() + { + @Override + public void run() + { + cancel(new com.zeroc.Ice.InvocationTimeoutException()); + } + }, invocationTimeout, java.util.concurrent.TimeUnit.MILLISECONDS); + } + } + else // If not called from the user thread, it's called from the retry queue + { + if(_observer != null) + { + _observer.retried(); + } + } + + while(true) + { + try + { + _sent = false; + _handler = null; + _handler = _proxy.__getRequestHandler(); + int status = _handler.sendAsyncRequest(this); + if((status & AsyncStatus.Sent) > 0) + { + if(userThread) + { + _sentSynchronously = true; + if((status & AsyncStatus.InvokeSentCallback) > 0) + { + invokeSent(); // Call the sent callback from the user thread. + } + } + else + { + if((status & AsyncStatus.InvokeSentCallback) > 0) + { + invokeSentAsync(); // Call the sent callback from a client thread pool thread. + } + } + } + return; // We're done! + } + catch(RetryException ex) + { + _proxy.__updateRequestHandler(_handler, null); // Clear request handler and always retry. + } + catch(com.zeroc.Ice.Exception ex) + { + if(_childObserver != null) + { + _childObserver.failed(ex.ice_id()); + _childObserver.detach(); + _childObserver = null; + } + final int interval = handleException(ex); + if(interval > 0) + { + _instance.retryQueue().add(this, interval); + return; + } + else if(_observer != null) + { + _observer.retried(); + } + } + } + } + catch(com.zeroc.Ice.Exception ex) + { + // + // If called from the user thread we re-throw, the exception + // will be catch by the caller and abort() will be called. + // + if(userThread) + { + throw ex; + } + else if(finished(ex)) // No retries, we're done + { + invokeCompletedAsync(); + } + } + } + + @Override + protected boolean sent(boolean done) + { + _sent = true; + if(done) + { + if(_timerFuture != null) + { + _timerFuture.cancel(false); + _timerFuture = null; + } + } + return super.sent(done); + } + + @Override + protected boolean finished(com.zeroc.Ice.Exception ex) + { + if(_timerFuture != null) + { + _timerFuture.cancel(false); + _timerFuture = null; + } + return super.finished(ex); + } + + @Override + protected boolean finished(boolean ok) + { + if(_timerFuture != null) + { + _timerFuture.cancel(false); + _timerFuture = null; + } + return super.finished(ok); + } + + protected int handleException(com.zeroc.Ice.Exception exc) + { + Holder<Integer> interval = new Holder<>(); + _cnt = _proxy.__handleException(exc, _handler, _mode, _sent, interval, _cnt); + return interval.value; + } + + protected void prepare(java.util.Map<String, String> ctx) + { + Protocol.checkSupportedProtocol(Protocol.getCompatibleProtocol(_proxy.__reference().getProtocol())); + + _observer = ObserverHelper.get(_proxy, _operation, ctx == null ? _emptyContext : ctx); + + switch(_proxyMode) + { + case Reference.ModeTwoway: + case Reference.ModeOneway: + case Reference.ModeDatagram: + { + _os.writeBlob(Protocol.requestHdr); + break; + } + + case Reference.ModeBatchOneway: + case Reference.ModeBatchDatagram: + { + _proxy.__getBatchRequestQueue().prepareBatchRequest(_os); + break; + } + } + + Reference ref = _proxy.__reference(); + + ref.getIdentity().ice_write(_os); + + // + // For compatibility with the old FacetPath. + // + String facet = ref.getFacet(); + if(facet == null || facet.length() == 0) + { + _os.writeStringSeq(null); + } + else + { + String[] facetPath = { facet }; + _os.writeStringSeq(facetPath); + } + + _os.writeString(_operation); + + _os.writeByte((byte)_mode.value()); + + if(ctx != com.zeroc.Ice.ObjectPrx.noExplicitContext) + { + // + // Explicit context + // + com.zeroc.Ice.ContextHelper.write(_os, ctx); + } + else + { + // + // Implicit context + // + com.zeroc.Ice.ImplicitContextI implicitContext = ref.getInstance().getImplicitContext(); + java.util.Map<String, String> prxContext = ref.getContext(); + + if(implicitContext == null) + { + com.zeroc.Ice.ContextHelper.write(_os, prxContext); + } + else + { + implicitContext.write(prxContext, _os); + } + } + } + + final protected com.zeroc.Ice._ObjectPrxI _proxy; + protected RequestHandler _handler; + protected com.zeroc.Ice.OperationMode _mode; + protected int _proxyMode; + + private java.util.concurrent.Future<?> _timerFuture; + private int _cnt; + private boolean _sent; + + private static final java.util.Map<String, String> _emptyContext = new java.util.HashMap<>(); +} diff --git a/java/src/Ice/src/main/java/IceInternal/QueueExecutorService.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueExecutorService.java index cb46d5dfe0b..2524df636d5 100644 --- a/java/src/Ice/src/main/java/IceInternal/QueueExecutorService.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueExecutorService.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.concurrent.ExecutorService; import java.util.concurrent.Callable; @@ -84,7 +84,7 @@ public final class QueueExecutorService } catch(RejectedExecutionException e) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } catch(ExecutionException e) { diff --git a/java/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueRequestHandler.java index a77e67c0f9f..df255eee76f 100644 --- a/java/src/Ice/src/main/java/IceInternal/QueueRequestHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/QueueRequestHandler.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.concurrent.Callable; -import Ice.ConnectionI; +import com.zeroc.Ice.ConnectionI; public class QueueRequestHandler implements RequestHandler { @@ -41,7 +41,7 @@ public class QueueRequestHandler implements RequestHandler return newHandler; } } - catch(Ice.Exception ex) + catch(com.zeroc.Ice.Exception ex) { // Ignore } @@ -64,7 +64,7 @@ public class QueueRequestHandler implements RequestHandler @Override public void - asyncRequestCanceled(final OutgoingAsyncBase outAsync, final Ice.LocalException ex) + asyncRequestCanceled(final OutgoingAsyncBase outAsync, final com.zeroc.Ice.LocalException ex) { _executor.executeNoThrow(new Callable<Void>() { diff --git a/java/src/Ice/src/main/java/IceInternal/ReadyCallback.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReadyCallback.java index e4c1482c5fb..8c8185b5b8a 100644 --- a/java/src/Ice/src/main/java/IceInternal/ReadyCallback.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReadyCallback.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface ReadyCallback { diff --git a/java/src/Ice/src/main/java/IceInternal/Reference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Reference.java index b7ea1dd2f32..e8420c9c6f7 100644 --- a/java/src/Ice/src/main/java/IceInternal/Reference.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Reference.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public abstract class Reference implements Cloneable { @@ -20,8 +20,8 @@ public abstract class Reference implements Cloneable public interface GetConnectionCallback { - void setConnection(Ice.ConnectionI connection, boolean compress); - void setException(Ice.LocalException ex); + void setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress); + void setException(com.zeroc.Ice.LocalException ex); } public final int @@ -36,19 +36,19 @@ public abstract class Reference implements Cloneable return _secure; } - public final Ice.ProtocolVersion + public final com.zeroc.Ice.ProtocolVersion getProtocol() { return _protocol; } - public final Ice.EncodingVersion + public final com.zeroc.Ice.EncodingVersion getEncoding() { return _encoding; } - public final Ice.Identity + public final com.zeroc.Ice.Identity getIdentity() { return _identity; @@ -78,7 +78,7 @@ public abstract class Reference implements Cloneable return _invocationTimeout; } - public final Ice.Communicator + public final com.zeroc.Ice.Communicator getCommunicator() { return _communicator; @@ -91,7 +91,7 @@ public abstract class Reference implements Cloneable public abstract boolean getCollocationOptimized(); public abstract boolean getCacheConnection(); public abstract boolean getPreferSecure(); - public abstract Ice.EndpointSelectionType getEndpointSelection(); + public abstract com.zeroc.Ice.EndpointSelectionType getEndpointSelection(); public abstract int getLocatorCacheTimeout(); public abstract String getConnectionId(); @@ -114,7 +114,7 @@ public abstract class Reference implements Cloneable } else { - r._context = new java.util.HashMap<String, String>(newContext); + r._context = new java.util.HashMap<>(newContext); } return r; } @@ -144,7 +144,7 @@ public abstract class Reference implements Cloneable } public final Reference - changeIdentity(Ice.Identity newIdentity) + changeIdentity(com.zeroc.Ice.Identity newIdentity) { if(newIdentity.equals(_identity)) { @@ -180,7 +180,7 @@ public abstract class Reference implements Cloneable } public Reference - changeEncoding(Ice.EncodingVersion newEncoding) + changeEncoding(com.zeroc.Ice.EncodingVersion newEncoding) { if(newEncoding.equals(_encoding)) { @@ -206,12 +206,12 @@ public abstract class Reference implements Cloneable public abstract Reference changeAdapterId(String newAdapterId); public abstract Reference changeEndpoints(EndpointI[] newEndpoints); - public abstract Reference changeLocator(Ice.LocatorPrx newLocator); - public abstract Reference changeRouter(Ice.RouterPrx newRouter); + public abstract Reference changeLocator(com.zeroc.Ice.LocatorPrx newLocator); + public abstract Reference changeRouter(com.zeroc.Ice.RouterPrx newRouter); public abstract Reference changeCollocationOptimized(boolean newCollocationOptimized); public abstract Reference changeCacheConnection(boolean newCache); public abstract Reference changePreferSecure(boolean newPreferSecure); - public abstract Reference changeEndpointSelection(Ice.EndpointSelectionType newType); + public abstract Reference changeEndpointSelection(com.zeroc.Ice.EndpointSelectionType newType); public abstract Reference changeLocatorCacheTimeout(int newTimeout); public abstract Reference changeTimeout(int newTimeout); @@ -227,19 +227,19 @@ public abstract class Reference implements Cloneable } int h = 5381; - h = IceInternal.HashUtil.hashAdd(h, _mode); - h = IceInternal.HashUtil.hashAdd(h, _secure); - h = IceInternal.HashUtil.hashAdd(h, _identity); - h = IceInternal.HashUtil.hashAdd(h, _context); - h = IceInternal.HashUtil.hashAdd(h, _facet); - h = IceInternal.HashUtil.hashAdd(h, _overrideCompress); + h = HashUtil.hashAdd(h, _mode); + h = HashUtil.hashAdd(h, _secure); + h = HashUtil.hashAdd(h, _identity); + h = HashUtil.hashAdd(h, _context); + h = HashUtil.hashAdd(h, _facet); + h = HashUtil.hashAdd(h, _overrideCompress); if(_overrideCompress) { - h = IceInternal.HashUtil.hashAdd(h, _compress); + h = HashUtil.hashAdd(h, _compress); } - h = IceInternal.HashUtil.hashAdd(h, _protocol); - h = IceInternal.HashUtil.hashAdd(h, _encoding); - h = IceInternal.HashUtil.hashAdd(h, _invocationTimeout); + h = HashUtil.hashAdd(h, _protocol); + h = HashUtil.hashAdd(h, _encoding); + h = HashUtil.hashAdd(h, _invocationTimeout); _hashValue = h; _hashInitialized = true; @@ -257,7 +257,7 @@ public abstract class Reference implements Cloneable // Marshal the reference. // public void - streamWrite(Ice.OutputStream s) + streamWrite(com.zeroc.Ice.OutputStream s) { // // Don't write the identity here. Operations calling streamWrite @@ -281,10 +281,10 @@ public abstract class Reference implements Cloneable s.writeBool(_secure); - if(!s.getEncoding().equals(Ice.Util.Encoding_1_0)) + if(!s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0)) { - _protocol.__write(s); - _encoding.__write(s); + _protocol.ice_write(s); + _encoding.ice_write(s); } // Derived class writes the remainder of the reference. @@ -311,8 +311,8 @@ public abstract class Reference implements Cloneable // the reference parser uses as separators, then we enclose // the identity string in quotes. // - String id = Ice.Util.identityToString(_identity); - if(IceUtilInternal.StringUtil.findFirstOf(id, " :@") != -1) + String id = com.zeroc.Ice.Util.identityToString(_identity); + if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(id, " :@") != -1) { s.append('"'); s.append(id); @@ -331,8 +331,8 @@ public abstract class Reference implements Cloneable // the facet string in quotes. // s.append(" -f "); - String fs = IceUtilInternal.StringUtil.escapeString(_facet, ""); - if(IceUtilInternal.StringUtil.findFirstOf(fs, " :@") != -1) + String fs = com.zeroc.IceUtilInternal.StringUtil.escapeString(_facet, ""); + if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(fs, " :@") != -1) { s.append('"'); s.append(fs); @@ -382,7 +382,7 @@ public abstract class Reference implements Cloneable s.append(" -s"); } - if(!_protocol.equals(Ice.Util.Protocol_1_0)) + if(!_protocol.equals(com.zeroc.Ice.Util.Protocol_1_0)) { // // We only print the protocol if it's not 1.0. It's fine as @@ -391,7 +391,7 @@ public abstract class Reference implements Cloneable // stringToProxy. // s.append(" -p "); - s.append(Ice.Util.protocolVersionToString(_protocol)); + s.append(com.zeroc.Ice.Util.protocolVersionToString(_protocol)); } // @@ -400,7 +400,7 @@ public abstract class Reference implements Cloneable // stringToProxy (and won't use Ice.Default.EncodingVersion). // s.append(" -e "); - s.append(Ice.Util.encodingVersionToString(_encoding)); + s.append(com.zeroc.Ice.Util.encodingVersionToString(_encoding)); return s.toString(); @@ -412,7 +412,7 @@ public abstract class Reference implements Cloneable // public abstract java.util.Map<String, String> toProperty(String prefix); - public abstract RequestHandler getRequestHandler(Ice.ObjectPrxHelperBase proxy); + public abstract RequestHandler getRequestHandler(com.zeroc.Ice._ObjectPrxI proxy); public abstract BatchRequestQueue getBatchRequestQueue(); @@ -495,31 +495,31 @@ public abstract class Reference implements Cloneable protected int _hashValue; protected boolean _hashInitialized; - private static java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>(); + private static java.util.Map<String, String> _emptyContext = new java.util.HashMap<>(); final private Instance _instance; - final private Ice.Communicator _communicator; + final private com.zeroc.Ice.Communicator _communicator; private int _mode; private boolean _secure; - private Ice.Identity _identity; + private com.zeroc.Ice.Identity _identity; private java.util.Map<String, String> _context; private String _facet; - private Ice.ProtocolVersion _protocol; - private Ice.EncodingVersion _encoding; + private com.zeroc.Ice.ProtocolVersion _protocol; + private com.zeroc.Ice.EncodingVersion _encoding; private int _invocationTimeout; protected boolean _overrideCompress; protected boolean _compress; // Only used if _overrideCompress == true protected Reference(Instance instance, - Ice.Communicator communicator, - Ice.Identity identity, + com.zeroc.Ice.Communicator communicator, + com.zeroc.Ice.Identity identity, String facet, int mode, boolean secure, - Ice.ProtocolVersion protocol, - Ice.EncodingVersion encoding, + com.zeroc.Ice.ProtocolVersion protocol, + com.zeroc.Ice.EncodingVersion encoding, int invocationTimeout, java.util.Map<String, String> context) { @@ -535,7 +535,7 @@ public abstract class Reference implements Cloneable _mode = mode; _secure = secure; _identity = identity; - _context = context != null ? new java.util.HashMap<String, String>(context) : _emptyContext; + _context = context != null ? new java.util.HashMap<>(context) : _emptyContext; _facet = facet; _protocol = protocol; _encoding = encoding; diff --git a/java/src/Ice/src/main/java/IceInternal/ReferenceFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java index ed36537017e..3a89782f1be 100644 --- a/java/src/Ice/src/main/java/IceInternal/ReferenceFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReferenceFactory.java @@ -7,12 +7,15 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.ProxyParseException; +import com.zeroc.IceUtilInternal.StringUtil; public final class ReferenceFactory { public Reference - create(Ice.Identity ident, String facet, Reference tmpl, EndpointI[] endpoints) + create(com.zeroc.Ice.Identity ident, String facet, Reference tmpl, EndpointI[] endpoints) { if(ident.name.length() == 0 && ident.category.length() == 0) { @@ -24,7 +27,7 @@ public final class ReferenceFactory } public Reference - create(Ice.Identity ident, String facet, Reference tmpl, String adapterId) + create(com.zeroc.Ice.Identity ident, String facet, Reference tmpl, String adapterId) { if(ident.name.length() == 0 && ident.category.length() == 0) { @@ -36,7 +39,7 @@ public final class ReferenceFactory } public Reference - create(Ice.Identity ident, Ice.ConnectionI fixedConnection) + create(com.zeroc.Ice.Identity ident, com.zeroc.Ice.ConnectionI fixedConnection) { if(ident.name.length() == 0 && ident.category.length() == 0) { @@ -60,7 +63,7 @@ public final class ReferenceFactory public Reference copy(Reference r) { - Ice.Identity ident = r.getIdentity(); + com.zeroc.Ice.Identity ident = r.getIdentity(); if(ident.name.length() == 0 && ident.category.length() == 0) { return null; @@ -81,10 +84,10 @@ public final class ReferenceFactory int beg; int end = 0; - beg = IceUtilInternal.StringUtil.findFirstNotOf(s, delim, end); + beg = StringUtil.findFirstNotOf(s, delim, end); if(beg == -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "no non-whitespace characters found in `" + s + "'"; throw e; } @@ -94,16 +97,16 @@ public final class ReferenceFactory // or double quotation marks. // String idstr = null; - end = IceUtilInternal.StringUtil.checkQuote(s, beg); + end = StringUtil.checkQuote(s, beg); if(end == -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "mismatched quotes around identity in `" + s + "'"; throw e; } else if(end == 0) { - end = IceUtilInternal.StringUtil.findFirstOf(s, delim + ":@", beg); + end = StringUtil.findFirstOf(s, delim + ":@", beg); if(end == -1) { end = s.length(); @@ -119,7 +122,7 @@ public final class ReferenceFactory if(beg == end) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "no identity in `" + s + "'"; throw e; } @@ -127,7 +130,7 @@ public final class ReferenceFactory // // Parsing the identity may raise IdentityParseException. // - Ice.Identity ident = Ice.Util.stringToIdentity(idstr); + com.zeroc.Ice.Identity ident = com.zeroc.Ice.Util.stringToIdentity(idstr); if(ident.name.length() == 0) { @@ -137,7 +140,7 @@ public final class ReferenceFactory // if(ident.category.length() > 0) { - Ice.IllegalIdentityException e = new Ice.IllegalIdentityException(); + com.zeroc.Ice.IllegalIdentityException e = new com.zeroc.Ice.IllegalIdentityException(); e.id = ident; throw e; } @@ -147,9 +150,9 @@ public final class ReferenceFactory // a null proxy, but only if nothing follows the // quotes. // - else if(IceUtilInternal.StringUtil.findFirstNotOf(s, delim, end) != -1) + else if(StringUtil.findFirstNotOf(s, delim, end) != -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "invalid characters after identity in `" + s + "'"; throw e; } @@ -162,13 +165,13 @@ public final class ReferenceFactory String facet = ""; int mode = Reference.ModeTwoway; boolean secure = false; - Ice.EncodingVersion encoding = _instance.defaultsAndOverrides().defaultEncoding; - Ice.ProtocolVersion protocol = Ice.Util.Protocol_1_0; + com.zeroc.Ice.EncodingVersion encoding = _instance.defaultsAndOverrides().defaultEncoding; + com.zeroc.Ice.ProtocolVersion protocol = com.zeroc.Ice.Util.Protocol_1_0; String adapter = ""; while(true) { - beg = IceUtilInternal.StringUtil.findFirstNotOf(s, delim, end); + beg = StringUtil.findFirstNotOf(s, delim, end); if(beg == -1) { break; @@ -179,7 +182,7 @@ public final class ReferenceFactory break; } - end = IceUtilInternal.StringUtil.findFirstOf(s, delim + ":@", beg); + end = StringUtil.findFirstOf(s, delim + ":@", beg); if(end == -1) { end = s.length(); @@ -193,7 +196,7 @@ public final class ReferenceFactory String option = s.substring(beg, end); if(option.length() != 2 || option.charAt(0) != '-') { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "expected a proxy option but found `" + option + "' in `" + s + "'"; throw e; } @@ -204,23 +207,23 @@ public final class ReferenceFactory // quotation marks. // String argument = null; - int argumentBeg = IceUtilInternal.StringUtil.findFirstNotOf(s, delim, end); + int argumentBeg = StringUtil.findFirstNotOf(s, delim, end); if(argumentBeg != -1) { final char ch = s.charAt(argumentBeg); if(ch != '@' && ch != ':' && ch != '-') { beg = argumentBeg; - end = IceUtilInternal.StringUtil.checkQuote(s, beg); + end = StringUtil.checkQuote(s, beg); if(end == -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "mismatched quotes around value for " + option + " option in `" + s + "'"; throw e; } else if(end == 0) { - end = IceUtilInternal.StringUtil.findFirstOf(s, delim + ":@", beg); + end = StringUtil.findFirstOf(s, delim + ":@", beg); if(end == -1) { end = s.length(); @@ -246,18 +249,18 @@ public final class ReferenceFactory { if(argument == null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "no argument provided for -f option in `" + s + "'"; throw e; } try { - facet = IceUtilInternal.StringUtil.unescapeString(argument, 0, argument.length()); + facet = StringUtil.unescapeString(argument, 0, argument.length()); } catch(IllegalArgumentException ex) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "invalid facet in `" + s + "': " + ex.getMessage(); throw e; } @@ -269,7 +272,7 @@ public final class ReferenceFactory { if(argument != null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unexpected argument `" + argument + "' provided for -t option in `" + s + "'"; throw e; } @@ -281,7 +284,7 @@ public final class ReferenceFactory { if(argument != null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unexpected argument `" + argument + "' provided for -o option in `" + s + "'"; throw e; } @@ -293,7 +296,7 @@ public final class ReferenceFactory { if(argument != null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unexpected argument `" + argument + "' provided for -O option in `" + s + "'"; throw e; } @@ -305,7 +308,7 @@ public final class ReferenceFactory { if(argument != null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unexpected argument `" + argument + "' provided for -d option in `" + s + "'"; throw e; } @@ -317,7 +320,7 @@ public final class ReferenceFactory { if(argument != null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unexpected argument `" + argument + "' provided for -D option in `" + s + "'"; throw e; } @@ -329,7 +332,7 @@ public final class ReferenceFactory { if(argument != null) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unexpected argument `" + argument + "' provided for -s option in `" + s + "'"; throw e; } @@ -341,17 +344,17 @@ public final class ReferenceFactory { if(argument == null) { - throw new Ice.ProxyParseException("no argument provided for -e option in `" + s + "'"); + throw new ProxyParseException("no argument provided for -e option in `" + s + "'"); } try { - encoding = Ice.Util.stringToEncodingVersion(argument); + encoding = com.zeroc.Ice.Util.stringToEncodingVersion(argument); } - catch(Ice.VersionParseException e) + catch(com.zeroc.Ice.VersionParseException e) { - throw new Ice.ProxyParseException("invalid encoding version `" + argument + "' in `" + s + - "':\n" + e.str); + throw new ProxyParseException("invalid encoding version `" + argument + "' in `" + s + + "':\n" + e.str); } break; } @@ -360,24 +363,24 @@ public final class ReferenceFactory { if(argument == null) { - throw new Ice.ProxyParseException("no argument provided for -p option in `" + s + "'"); + throw new ProxyParseException("no argument provided for -p option in `" + s + "'"); } try { - protocol = Ice.Util.stringToProtocolVersion(argument); + protocol = com.zeroc.Ice.Util.stringToProtocolVersion(argument); } - catch(Ice.VersionParseException e) + catch(com.zeroc.Ice.VersionParseException e) { - throw new Ice.ProxyParseException("invalid protocol version `" + argument + "' in `" + s + - "':\n" + e.str); + throw new ProxyParseException("invalid protocol version `" + argument + "' in `" + s + + "':\n" + e.str); } break; } default: { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "unknown option `" + option + "' in `" + s + "'"; throw e; } @@ -389,11 +392,11 @@ public final class ReferenceFactory return create(ident, facet, mode, secure, protocol, encoding, null, null, propertyPrefix); } - java.util.ArrayList<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); + java.util.ArrayList<EndpointI> endpoints = new java.util.ArrayList<>(); if(s.charAt(beg) == ':') { - java.util.ArrayList<String> unknownEndpoints = new java.util.ArrayList<String>(); + java.util.ArrayList<String> unknownEndpoints = new java.util.ArrayList<>(); end = beg; while(end < s.length() && s.charAt(end) == ':') @@ -457,7 +460,7 @@ public final class ReferenceFactory if(endpoints.size() == 0) { assert(!unknownEndpoints.isEmpty()); - Ice.EndpointParseException e = new Ice.EndpointParseException(); + com.zeroc.Ice.EndpointParseException e = new com.zeroc.Ice.EndpointParseException(); e.str = "invalid endpoint `" + unknownEndpoints.get(0) + "' in `" + s + "'"; throw e; } @@ -480,25 +483,25 @@ public final class ReferenceFactory } else if(s.charAt(beg) == '@') { - beg = IceUtilInternal.StringUtil.findFirstNotOf(s, delim, beg + 1); + beg = StringUtil.findFirstNotOf(s, delim, beg + 1); if(beg == -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "missing adapter id in `" + s + "'"; throw e; } String adapterstr = null; - end = IceUtilInternal.StringUtil.checkQuote(s, beg); + end = StringUtil.checkQuote(s, beg); if(end == -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "mismatched quotes around adapter id in `" + s + "'"; throw e; } else if(end == 0) { - end = IceUtilInternal.StringUtil.findFirstOf(s, delim, beg); + end = StringUtil.findFirstOf(s, delim, beg); if(end == -1) { end = s.length(); @@ -512,39 +515,39 @@ public final class ReferenceFactory end++; // Skip trailing quote } - if(end != s.length() && IceUtilInternal.StringUtil.findFirstNotOf(s, delim, end) != -1) + if(end != s.length() && StringUtil.findFirstNotOf(s, delim, end) != -1) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "invalid trailing characters after `" + s.substring(0, end + 1) + "' in `" + s + "'"; throw e; } try { - adapter = IceUtilInternal.StringUtil.unescapeString(adapterstr, 0, adapterstr.length()); + adapter = StringUtil.unescapeString(adapterstr, 0, adapterstr.length()); } catch(IllegalArgumentException ex) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "invalid adapter id in `" + s + "': " + ex.getMessage(); throw e; } if(adapter.length() == 0) { - Ice.ProxyParseException e = new Ice.ProxyParseException(); + ProxyParseException e = new ProxyParseException(); e.str = "empty adapter id in `" + s + "'"; throw e; } return create(ident, facet, mode, secure, protocol, encoding, null, adapter, propertyPrefix); } - Ice.ProxyParseException ex = new Ice.ProxyParseException(); + ProxyParseException ex = new ProxyParseException(); ex.str = "malformed proxy `" + s + "'"; throw ex; } public Reference - create(Ice.Identity ident, Ice.InputStream s) + create(com.zeroc.Ice.Identity ident, com.zeroc.Ice.InputStream s) { // // Don't read the identity here. Operations calling this @@ -565,7 +568,7 @@ public final class ReferenceFactory { if(facetPath.length > 1) { - throw new Ice.ProxyUnmarshalException(); + throw new com.zeroc.Ice.ProxyUnmarshalException(); } facet = facetPath[0]; } @@ -577,24 +580,22 @@ public final class ReferenceFactory int mode = s.readByte(); if(mode < 0 || mode > Reference.ModeLast) { - throw new Ice.ProxyUnmarshalException(); + throw new com.zeroc.Ice.ProxyUnmarshalException(); } boolean secure = s.readBool(); - Ice.ProtocolVersion protocol; - Ice.EncodingVersion encoding; - if(!s.getEncoding().equals(Ice.Util.Encoding_1_0)) + com.zeroc.Ice.ProtocolVersion protocol; + com.zeroc.Ice.EncodingVersion encoding; + if(!s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0)) { - protocol = new Ice.ProtocolVersion(); - protocol.__read(s); - encoding = new Ice.EncodingVersion(); - encoding.__read(s); + protocol = com.zeroc.Ice.ProtocolVersion.read(s, null); + encoding = com.zeroc.Ice.EncodingVersion.read(s, null); } else { - protocol = Ice.Util.Protocol_1_0; - encoding = Ice.Util.Encoding_1_0; + protocol = com.zeroc.Ice.Util.Protocol_1_0; + encoding = com.zeroc.Ice.Util.Encoding_1_0; } EndpointI[] endpoints = null; @@ -618,7 +619,7 @@ public final class ReferenceFactory } public ReferenceFactory - setDefaultRouter(Ice.RouterPrx defaultRouter) + setDefaultRouter(com.zeroc.Ice.RouterPrx defaultRouter) { if(_defaultRouter == null ? defaultRouter == null : _defaultRouter.equals(defaultRouter)) { @@ -631,14 +632,14 @@ public final class ReferenceFactory return factory; } - public Ice.RouterPrx + public com.zeroc.Ice.RouterPrx getDefaultRouter() { return _defaultRouter; } public ReferenceFactory - setDefaultLocator(Ice.LocatorPrx defaultLocator) + setDefaultLocator(com.zeroc.Ice.LocatorPrx defaultLocator) { if(_defaultLocator == null ? defaultLocator == null : _defaultLocator.equals(defaultLocator)) { @@ -651,7 +652,7 @@ public final class ReferenceFactory return factory; } - public Ice.LocatorPrx + public com.zeroc.Ice.LocatorPrx getDefaultLocator() { return _defaultLocator; @@ -660,7 +661,7 @@ public final class ReferenceFactory // // Only for use by Instance // - ReferenceFactory(Instance instance, Ice.Communicator communicator) + ReferenceFactory(Instance instance, com.zeroc.Ice.Communicator communicator) { _instance = instance; _communicator = communicator; @@ -685,15 +686,15 @@ public final class ReferenceFactory // // Do not warn about unknown properties if Ice prefix, ie Ice, Glacier2, etc // - for(int i = 0; IceInternal.PropertyNames.clPropNames[i] != null; ++i) + for(int i = 0; PropertyNames.clPropNames[i] != null; ++i) { - if(prefix.startsWith(IceInternal.PropertyNames.clPropNames[i] + ".")) + if(prefix.startsWith(PropertyNames.clPropNames[i] + ".")) { return; } } - java.util.ArrayList<String> unknownProps = new java.util.ArrayList<String>(); + java.util.ArrayList<String> unknownProps = new java.util.ArrayList<>(); java.util.Map<String, String> props = _instance.initializationData().properties.getPropertiesForPrefix(prefix + "."); for(java.util.Map.Entry<String, String> p : props.entrySet()) @@ -732,8 +733,8 @@ public final class ReferenceFactory } private Reference - create(Ice.Identity ident, String facet, int mode, boolean secure, Ice.ProtocolVersion protocol, - Ice.EncodingVersion encoding, EndpointI[] endpoints, String adapterId, String propertyPrefix) + create(com.zeroc.Ice.Identity ident, String facet, int mode, boolean secure, com.zeroc.Ice.ProtocolVersion protocol, + com.zeroc.Ice.EncodingVersion encoding, EndpointI[] endpoints, String adapterId, String propertyPrefix) { DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); @@ -743,10 +744,10 @@ public final class ReferenceFactory LocatorInfo locatorInfo = null; if(_defaultLocator != null) { - if(!((Ice.ObjectPrxHelperBase)_defaultLocator).__reference().getEncoding().equals(encoding)) + if(!((com.zeroc.Ice._ObjectPrxI)_defaultLocator).__reference().getEncoding().equals(encoding)) { locatorInfo = _instance.locatorManager().get( - (Ice.LocatorPrx)_defaultLocator.ice_encodingVersion(encoding)); + (com.zeroc.Ice.LocatorPrx)_defaultLocator.ice_encodingVersion(encoding)); } else { @@ -757,7 +758,7 @@ public final class ReferenceFactory boolean collocationOptimized = defaultsAndOverrides.defaultCollocationOptimization; boolean cacheConnection = true; boolean preferSecure = defaultsAndOverrides.defaultPreferSecure; - Ice.EndpointSelectionType endpointSelection = defaultsAndOverrides.defaultEndpointSelection; + com.zeroc.Ice.EndpointSelectionType endpointSelection = defaultsAndOverrides.defaultEndpointSelection; int locatorCacheTimeout = defaultsAndOverrides.defaultLocatorCacheTimeout; int invocationTimeout = defaultsAndOverrides.defaultInvocationTimeout; java.util.Map<String, String> context = null; @@ -767,7 +768,7 @@ public final class ReferenceFactory // if(propertyPrefix != null && propertyPrefix.length() > 0) { - Ice.Properties properties = _instance.initializationData().properties; + com.zeroc.Ice.Properties properties = _instance.initializationData().properties; // // Warn about unknown properties. @@ -780,12 +781,14 @@ public final class ReferenceFactory String property; property = propertyPrefix + ".Locator"; - Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(_communicator.propertyToProxy(property)); + com.zeroc.Ice.LocatorPrx locator = + com.zeroc.Ice.LocatorPrx.uncheckedCast(_communicator.propertyToProxy(property)); if(locator != null) { - if(!((Ice.ObjectPrxHelperBase)locator).__reference().getEncoding().equals(encoding)) + if(!((com.zeroc.Ice._ObjectPrxI)locator).__reference().getEncoding().equals(encoding)) { - locatorInfo = _instance.locatorManager().get((Ice.LocatorPrx)locator.ice_encodingVersion(encoding)); + locatorInfo = + _instance.locatorManager().get((com.zeroc.Ice.LocatorPrx)locator.ice_encodingVersion(encoding)); } else { @@ -794,7 +797,8 @@ public final class ReferenceFactory } property = propertyPrefix + ".Router"; - Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(_communicator.propertyToProxy(property)); + com.zeroc.Ice.RouterPrx router = + com.zeroc.Ice.RouterPrx.uncheckedCast(_communicator.propertyToProxy(property)); if(router != null) { if(propertyPrefix.endsWith(".Router")) @@ -824,15 +828,15 @@ public final class ReferenceFactory String type = properties.getProperty(property); if(type.equals("Random")) { - endpointSelection = Ice.EndpointSelectionType.Random; + endpointSelection = com.zeroc.Ice.EndpointSelectionType.Random; } else if(type.equals("Ordered")) { - endpointSelection = Ice.EndpointSelectionType.Ordered; + endpointSelection = com.zeroc.Ice.EndpointSelectionType.Ordered; } else { - throw new Ice.EndpointSelectionTypeParseException("illegal value `" + type + + throw new com.zeroc.Ice.EndpointSelectionTypeParseException("illegal value `" + type + "'; expected `Random' or `Ordered'"); } } @@ -877,7 +881,7 @@ public final class ReferenceFactory java.util.Map<String, String> contexts = properties.getPropertiesForPrefix(property); if(!contexts.isEmpty()) { - context = new java.util.HashMap<String, String>(); + context = new java.util.HashMap<>(); for(java.util.Map.Entry<String, String> e : contexts.entrySet()) { context.put(e.getKey().substring(property.length()), e.getValue()); @@ -910,7 +914,7 @@ public final class ReferenceFactory } final private Instance _instance; - final private Ice.Communicator _communicator; - private Ice.RouterPrx _defaultRouter; - private Ice.LocatorPrx _defaultLocator; + final private com.zeroc.Ice.Communicator _communicator; + private com.zeroc.Ice.RouterPrx _defaultRouter; + private com.zeroc.Ice.LocatorPrx _defaultLocator; } diff --git a/java/src/Ice/src/main/java/IceInternal/RemoteObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RemoteObserverI.java index f7c35f706eb..f6a96326ee1 100644 --- a/java/src/Ice/src/main/java/IceInternal/RemoteObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RemoteObserverI.java @@ -7,21 +7,20 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class RemoteObserverI - extends IceMX.ObserverWithDelegate<IceMX.RemoteMetrics, Ice.Instrumentation.RemoteObserver> - implements Ice.Instrumentation.RemoteObserver + extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.RemoteMetrics, + com.zeroc.Ice.Instrumentation.RemoteObserver> + implements com.zeroc.Ice.Instrumentation.RemoteObserver { @Override - public void - reply(final int size) + public void reply(final int size) { - forEach(new MetricsUpdate<IceMX.RemoteMetrics>() + forEach(new MetricsUpdate<com.zeroc.IceMX.RemoteMetrics>() { @Override - public void - update(IceMX.RemoteMetrics v) + public void update(com.zeroc.IceMX.RemoteMetrics v) { v.replySize += size; } diff --git a/java/src/Ice/src/main/java/IceInternal/ReplyStatus.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReplyStatus.java index 20b2cc32dd1..63462113ac9 100644 --- a/java/src/Ice/src/main/java/IceInternal/ReplyStatus.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ReplyStatus.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; interface ReplyStatus { diff --git a/java/src/Ice/src/main/java/IceInternal/RequestHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandler.java index 5fa3485400d..43f3acb0704 100644 --- a/java/src/Ice/src/main/java/IceInternal/RequestHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandler.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface RequestHandler extends CancellationHandler { @@ -18,5 +18,5 @@ public interface RequestHandler extends CancellationHandler Reference getReference(); - Ice.ConnectionI getConnection(); + com.zeroc.Ice.ConnectionI getConnection(); } diff --git a/java/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandlerFactory.java index ff4022724a9..19b2a85ad9b 100644 --- a/java/src/Ice/src/main/java/IceInternal/RequestHandlerFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RequestHandlerFactory.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.Map; import java.util.HashMap; @@ -21,11 +21,11 @@ public final class RequestHandlerFactory } public RequestHandler - getRequestHandler(final RoutableReference ref, Ice.ObjectPrxHelperBase proxy) + getRequestHandler(final RoutableReference ref, com.zeroc.Ice._ObjectPrxI proxy) { if(ref.getCollocationOptimized()) { - Ice.ObjectAdapter adapter = _instance.objectAdapterFactory().findObjectAdapter(proxy); + com.zeroc.Ice.ObjectAdapter adapter = _instance.objectAdapterFactory().findObjectAdapter(proxy); if(adapter != null) { return proxy.__setRequestHandler(new CollocatedRequestHandler(ref, adapter)); @@ -92,5 +92,5 @@ public final class RequestHandlerFactory } private final Instance _instance; - private final Map<Reference, ConnectRequestHandler> _handlers = new HashMap<Reference, ConnectRequestHandler>(); + private final Map<Reference, ConnectRequestHandler> _handlers = new HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/ResponseHandler.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ResponseHandler.java index 401d80e5451..0b492b3ce3d 100644 --- a/java/src/Ice/src/main/java/IceInternal/ResponseHandler.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ResponseHandler.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface ResponseHandler { - void sendResponse(int requestId, Ice.OutputStream os, byte status, boolean amd); + void sendResponse(int requestId, com.zeroc.Ice.OutputStream os, byte status, boolean amd); void sendNoResponse(); - boolean systemException(int requestId, Ice.SystemException ex, boolean amd); - void invokeException(int requestId, Ice.LocalException ex, int invokeNum, boolean amd); + boolean systemException(int requestId, com.zeroc.Ice.SystemException ex, boolean amd); + void invokeException(int requestId, com.zeroc.Ice.LocalException ex, int invokeNum, boolean amd); } diff --git a/java/src/Ice/src/main/java/IceInternal/RetryException.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryException.java index 463a675b24a..77412c8be73 100644 --- a/java/src/Ice/src/main/java/IceInternal/RetryException.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryException.java @@ -7,21 +7,21 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class RetryException extends Exception { public - RetryException(Ice.LocalException ex) + RetryException(com.zeroc.Ice.LocalException ex) { _ex = ex; } - public Ice.LocalException + public com.zeroc.Ice.LocalException get() { return _ex; } - private Ice.LocalException _ex; + private com.zeroc.Ice.LocalException _ex; } diff --git a/java/src/Ice/src/main/java/IceInternal/RetryQueue.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryQueue.java index f495e6ecbcc..5cac12f30d2 100644 --- a/java/src/Ice/src/main/java/IceInternal/RetryQueue.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryQueue.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class RetryQueue { @@ -20,7 +20,7 @@ public class RetryQueue { if(_instance == null) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } RetryTask task = new RetryTask(_instance, this, outAsync); outAsync.cancelable(task); // This will throw if the request is canceled @@ -35,7 +35,7 @@ public class RetryQueue return; // Already destroyed. } - java.util.HashSet<RetryTask> keep = new java.util.HashSet<RetryTask>(); + java.util.HashSet<RetryTask> keep = new java.util.HashSet<>(); for(RetryTask task : _requests) { if(!task.destroy()) @@ -80,5 +80,5 @@ public class RetryQueue } private Instance _instance; - private java.util.HashSet<RetryTask> _requests = new java.util.HashSet<RetryTask>(); + private java.util.HashSet<RetryTask> _requests = new java.util.HashSet<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/RetryTask.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryTask.java index a9b4b1d1119..426f0a2ebb8 100644 --- a/java/src/Ice/src/main/java/IceInternal/RetryTask.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RetryTask.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class RetryTask implements Runnable, CancellationHandler { @@ -33,7 +33,7 @@ class RetryTask implements Runnable, CancellationHandler } @Override - public void asyncRequestCanceled(OutgoingAsyncBase outAsync, Ice.LocalException ex) + public void asyncRequestCanceled(OutgoingAsyncBase outAsync, com.zeroc.Ice.LocalException ex) { if(_queue.remove(this) && _future.cancel(false)) { @@ -57,9 +57,9 @@ class RetryTask implements Runnable, CancellationHandler { try { - _outAsync.abort(new Ice.CommunicatorDestroyedException()); + _outAsync.abort(new com.zeroc.Ice.CommunicatorDestroyedException()); } - catch(Ice.CommunicatorDestroyedException ex) + catch(com.zeroc.Ice.CommunicatorDestroyedException ex) { // Abort can throw if there's no callback, just ignore in this case } diff --git a/java/src/Ice/src/main/java/IceInternal/RoutableReference.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java index 688b2ca9935..968300834d6 100644 --- a/java/src/Ice/src/main/java/IceInternal/RoutableReference.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RoutableReference.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class RoutableReference extends Reference { @@ -61,7 +61,7 @@ public class RoutableReference extends Reference } @Override - public final Ice.EndpointSelectionType + public final com.zeroc.Ice.EndpointSelectionType getEndpointSelection() { return _endpointSelection; @@ -83,7 +83,7 @@ public class RoutableReference extends Reference @Override public Reference - changeEncoding(Ice.EncodingVersion newEncoding) + changeEncoding(com.zeroc.Ice.EncodingVersion newEncoding) { RoutableReference r = (RoutableReference)super.changeEncoding(newEncoding); if(r != this) @@ -92,7 +92,7 @@ public class RoutableReference extends Reference if(locInfo != null && !locInfo.getLocator().ice_getEncodingVersion().equals(newEncoding)) { r._locatorInfo = getInstance().locatorManager().get( - (Ice.LocatorPrx)locInfo.getLocator().ice_encodingVersion(newEncoding)); + (com.zeroc.Ice.LocatorPrx)locInfo.getLocator().ice_encodingVersion(newEncoding)); } } return r; @@ -146,7 +146,7 @@ public class RoutableReference extends Reference @Override public Reference - changeLocator(Ice.LocatorPrx newLocator) + changeLocator(com.zeroc.Ice.LocatorPrx newLocator) { LocatorInfo newLocatorInfo = getInstance().locatorManager().get(newLocator); if(newLocatorInfo != null && _locatorInfo != null && newLocatorInfo.equals(_locatorInfo)) @@ -160,7 +160,7 @@ public class RoutableReference extends Reference @Override public Reference - changeRouter(Ice.RouterPrx newRouter) + changeRouter(com.zeroc.Ice.RouterPrx newRouter) { RouterInfo newRouterInfo = getInstance().routerManager().get(newRouter); if(newRouterInfo != null && _routerInfo != null && newRouterInfo.equals(_routerInfo)) @@ -213,7 +213,7 @@ public class RoutableReference extends Reference @Override public final Reference - changeEndpointSelection(Ice.EndpointSelectionType newType) + changeEndpointSelection(com.zeroc.Ice.EndpointSelectionType newType) { if(newType == _endpointSelection) { @@ -298,8 +298,8 @@ public class RoutableReference extends Reference @Override public void - streamWrite(Ice.OutputStream s) - throws Ice.MarshalException + streamWrite(com.zeroc.Ice.OutputStream s) + throws com.zeroc.Ice.MarshalException { super.streamWrite(s); @@ -353,8 +353,8 @@ public class RoutableReference extends Reference // the reference parser uses as separators, then we enclose // the adapter id string in quotes. // - String a = IceUtilInternal.StringUtil.escapeString(_adapterId, null); - if(IceUtilInternal.StringUtil.findFirstOf(a, " :@") != -1) + String a = com.zeroc.IceUtilInternal.StringUtil.escapeString(_adapterId, null); + if(com.zeroc.IceUtilInternal.StringUtil.findFirstOf(a, " :@") != -1) { s.append('"'); s.append(a); @@ -371,14 +371,14 @@ public class RoutableReference extends Reference @Override public java.util.Map<String, String> toProperty(String prefix) { - java.util.Map<String, String> properties = new java.util.HashMap<String, String>(); + java.util.Map<String, String> properties = new java.util.HashMap<>(); properties.put(prefix, toString()); properties.put(prefix + ".CollocationOptimized", _collocationOptimized ? "1" : "0"); properties.put(prefix + ".ConnectionCached", _cacheConnection ? "1" : "0"); properties.put(prefix + ".PreferSecure", _preferSecure ? "1" : "0"); properties.put(prefix + ".EndpointSelection", - _endpointSelection == Ice.EndpointSelectionType.Random ? "Random" : "Ordered"); + _endpointSelection == com.zeroc.Ice.EndpointSelectionType.Random ? "Random" : "Ordered"); { StringBuffer s = new StringBuffer(); @@ -393,7 +393,7 @@ public class RoutableReference extends Reference if(_routerInfo != null) { - Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)_routerInfo.getRouter(); + com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)_routerInfo.getRouter(); java.util.Map<String, String> routerProperties = h.__reference().toProperty(prefix + ".Router"); for(java.util.Map.Entry<String, String> p : routerProperties.entrySet()) { @@ -403,7 +403,7 @@ public class RoutableReference extends Reference if(_locatorInfo != null) { - Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)_locatorInfo.getLocator(); + com.zeroc.Ice._ObjectPrxI h = (com.zeroc.Ice._ObjectPrxI)_locatorInfo.getLocator(); java.util.Map<String, String> locatorProperties = h.__reference().toProperty(prefix + ".Locator"); for(java.util.Map.Entry<String, String> p : locatorProperties.entrySet()) { @@ -421,7 +421,7 @@ public class RoutableReference extends Reference if(!_hashInitialized) { super.hashCode(); // Initializes _hashValue. - _hashValue = IceInternal.HashUtil.hashAdd(_hashValue, _adapterId); + _hashValue = HashUtil.hashAdd(_hashValue, _adapterId); } return _hashValue; } @@ -497,7 +497,7 @@ public class RoutableReference extends Reference @Override public RequestHandler - getRequestHandler(Ice.ObjectPrxHelperBase proxy) + getRequestHandler(com.zeroc.Ice._ObjectPrxI proxy) { return getInstance().requestHandlerFactory().getRequestHandler(this, proxy); } @@ -537,7 +537,7 @@ public class RoutableReference extends Reference @Override public void - setException(Ice.LocalException ex) + setException(com.zeroc.Ice.LocalException ex) { callback.setException(ex); } @@ -569,7 +569,7 @@ public class RoutableReference extends Reference { if(endpoints.length == 0) { - callback.setException(new Ice.NoEndpointException(self.toString())); + callback.setException(new com.zeroc.Ice.NoEndpointException(self.toString())); return; } @@ -578,24 +578,24 @@ public class RoutableReference extends Reference { @Override public void - setConnection(Ice.ConnectionI connection, boolean compress) + setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress) { callback.setConnection(connection, compress); } @Override public void - setException(Ice.LocalException exc) + setException(com.zeroc.Ice.LocalException exc) { try { throw exc; } - catch(Ice.NoEndpointException ex) + catch(com.zeroc.Ice.NoEndpointException ex) { callback.setException(ex); // No need to retry if there's no endpoints. } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { assert(_locatorInfo != null); _locatorInfo.clearCache(self); @@ -619,7 +619,7 @@ public class RoutableReference extends Reference @Override public void - setException(Ice.LocalException ex) + setException(com.zeroc.Ice.LocalException ex) { callback.setException(ex); } @@ -627,19 +627,19 @@ public class RoutableReference extends Reference } else { - callback.setException(new Ice.NoEndpointException(toString())); + callback.setException(new com.zeroc.Ice.NoEndpointException(toString())); } } protected RoutableReference(Instance instance, - Ice.Communicator communicator, - Ice.Identity identity, + com.zeroc.Ice.Communicator communicator, + com.zeroc.Ice.Identity identity, String facet, int mode, boolean secure, - Ice.ProtocolVersion protocol, - Ice.EncodingVersion encoding, + com.zeroc.Ice.ProtocolVersion protocol, + com.zeroc.Ice.EncodingVersion encoding, EndpointI[] endpoints, String adapterId, LocatorInfo locatorInfo, @@ -647,7 +647,7 @@ public class RoutableReference extends Reference boolean collocationOptimized, boolean cacheConnection, boolean prefereSecure, - Ice.EndpointSelectionType endpointSelection, + com.zeroc.Ice.EndpointSelectionType endpointSelection, int locatorCacheTimeout, int invocationTimeout, java.util.Map<String, String> context) @@ -699,14 +699,14 @@ public class RoutableReference extends Reference private EndpointI[] filterEndpoints(EndpointI[] allEndpoints) { - java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); + java.util.List<EndpointI> endpoints = new java.util.ArrayList<>(); // // Filter out opaque endpoints. // for(EndpointI endpoint : allEndpoints) { - if(!(endpoint instanceof IceInternal.OpaqueEndpointI)) + if(!(endpoint instanceof OpaqueEndpointI)) { endpoints.add(endpoint); } @@ -814,7 +814,7 @@ public class RoutableReference extends Reference final EndpointI[] endpoints = filterEndpoints(allEndpoints); if(endpoints.length == 0) { - callback.setException(new Ice.NoEndpointException(toString())); + callback.setException(new com.zeroc.Ice.NoEndpointException(toString())); return; } @@ -833,7 +833,7 @@ public class RoutableReference extends Reference { @Override public void - setConnection(Ice.ConnectionI connection, boolean compress) + setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress) { // // If we have a router, set the object adapter for this router @@ -849,7 +849,7 @@ public class RoutableReference extends Reference @Override public void - setException(Ice.LocalException ex) + setException(com.zeroc.Ice.LocalException ex) { callback.setException(ex); } @@ -870,7 +870,7 @@ public class RoutableReference extends Reference { @Override public void - setConnection(Ice.ConnectionI connection, boolean compress) + setConnection(com.zeroc.Ice.ConnectionI connection, boolean compress) { // // If we have a router, set the object adapter for this router @@ -886,7 +886,7 @@ public class RoutableReference extends Reference @Override public void - setException(final Ice.LocalException ex) + setException(final com.zeroc.Ice.LocalException ex) { if(_exception == null) { @@ -905,7 +905,7 @@ public class RoutableReference extends Reference } private int _i = 0; - private Ice.LocalException _exception = null; + private com.zeroc.Ice.LocalException _exception = null; }); } } @@ -965,7 +965,7 @@ public class RoutableReference extends Reference private boolean _collocationOptimized; private boolean _cacheConnection; private boolean _preferSecure; - private Ice.EndpointSelectionType _endpointSelection; + private com.zeroc.Ice.EndpointSelectionType _endpointSelection; private int _locatorCacheTimeout; private boolean _overrideTimeout; diff --git a/java/src/Ice/src/main/java/IceInternal/RouterInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterInfo.java index 1de08e756fe..e103ead153a 100644 --- a/java/src/Ice/src/main/java/IceInternal/RouterInfo.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterInfo.java @@ -7,23 +7,23 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class RouterInfo { interface GetClientEndpointsCallback { void setEndpoints(EndpointI[] endpoints); - void setException(Ice.LocalException ex); + void setException(com.zeroc.Ice.LocalException ex); } interface AddProxyCallback { void addedProxy(); - void setException(Ice.LocalException ex); + void setException(com.zeroc.Ice.LocalException ex); } - RouterInfo(Ice.RouterPrx router) + RouterInfo(com.zeroc.Ice.RouterPrx router) { _router = router; @@ -63,7 +63,7 @@ public final class RouterInfo return _router.hashCode(); } - public Ice.RouterPrx + public com.zeroc.Ice.RouterPrx getRouter() { // @@ -101,20 +101,22 @@ public final class RouterInfo return; } - _router.begin_getClientProxy(new Ice.Callback_Router_getClientProxy() + _router.getClientProxyAsync().whenComplete((com.zeroc.Ice.ObjectPrx clientProxy, Throwable ex) -> { - @Override - public void - response(Ice.ObjectPrx clientProxy) + if(ex != null) { - callback.setEndpoints(setClientEndpoints(clientProxy)); + if(ex instanceof com.zeroc.Ice.LocalException) + { + callback.setException((com.zeroc.Ice.LocalException)ex); + } + else + { + callback.setException(new com.zeroc.Ice.UnknownException(ex)); + } } - - @Override - public void - exception(Ice.LocalException ex) + else { - callback.setException(ex); + callback.setEndpoints(setClientEndpoints(clientProxy)); } }); } @@ -134,7 +136,7 @@ public final class RouterInfo } public boolean - addProxy(final Ice.ObjectPrx proxy, final AddProxyCallback callback) + addProxy(final com.zeroc.Ice.ObjectPrx proxy, final AddProxyCallback callback) { assert(proxy != null); synchronized(this) @@ -148,22 +150,24 @@ public final class RouterInfo } } - _router.begin_addProxies(new Ice.ObjectPrx[] { proxy }, - new Ice.Callback_Router_addProxies() + _router.addProxiesAsync(new com.zeroc.Ice.ObjectPrx[] { proxy }).whenComplete( + (com.zeroc.Ice.ObjectPrx[] evictedProxies, Throwable ex) -> { - @Override - public void - response(Ice.ObjectPrx[] evictedProxies) + if(ex != null) { - addAndEvictProxies(proxy, evictedProxies); - callback.addedProxy(); + if(ex instanceof com.zeroc.Ice.LocalException) + { + callback.setException((com.zeroc.Ice.LocalException)ex); + } + else + { + callback.setException(new com.zeroc.Ice.UnknownException(ex)); + } } - - @Override - public void - exception(Ice.LocalException ex) + else { - callback.setException(ex); + addAndEvictProxies(proxy, evictedProxies); + callback.addedProxy(); } }); @@ -171,12 +175,12 @@ public final class RouterInfo } public synchronized void - setAdapter(Ice.ObjectAdapter adapter) + setAdapter(com.zeroc.Ice.ObjectAdapter adapter) { _adapter = adapter; } - public synchronized Ice.ObjectAdapter + public synchronized com.zeroc.Ice.ObjectAdapter getAdapter() { return _adapter; @@ -188,7 +192,7 @@ public final class RouterInfo } private synchronized EndpointI[] - setClientEndpoints(Ice.ObjectPrx clientProxy) + setClientEndpoints(com.zeroc.Ice.ObjectPrx clientProxy) { if(_clientEndpoints == null) { @@ -197,7 +201,7 @@ public final class RouterInfo // // If getClientProxy() return nil, use router endpoints. // - _clientEndpoints = ((Ice.ObjectPrxHelperBase)_router).__reference().getEndpoints(); + _clientEndpoints = ((com.zeroc.Ice._ObjectPrxI)_router).__reference().getEndpoints(); } else { @@ -213,27 +217,27 @@ public final class RouterInfo clientProxy = clientProxy.ice_timeout(_router.ice_getConnection().timeout()); } - _clientEndpoints = ((Ice.ObjectPrxHelperBase)clientProxy).__reference().getEndpoints(); + _clientEndpoints = ((com.zeroc.Ice._ObjectPrxI)clientProxy).__reference().getEndpoints(); } } return _clientEndpoints; } private synchronized EndpointI[] - setServerEndpoints(Ice.ObjectPrx serverProxy) + setServerEndpoints(com.zeroc.Ice.ObjectPrx serverProxy) { if(serverProxy == null) { - throw new Ice.NoEndpointException(); + throw new com.zeroc.Ice.NoEndpointException(); } serverProxy = serverProxy.ice_router(null); // The server proxy cannot be routed. - _serverEndpoints = ((Ice.ObjectPrxHelperBase)serverProxy).__reference().getEndpoints(); + _serverEndpoints = ((com.zeroc.Ice._ObjectPrxI)serverProxy).__reference().getEndpoints(); return _serverEndpoints; } private synchronized void - addAndEvictProxies(Ice.ObjectPrx proxy, Ice.ObjectPrx[] evictedProxies) + addAndEvictProxies(com.zeroc.Ice.ObjectPrx proxy, com.zeroc.Ice.ObjectPrx[] evictedProxies) { // // Check if the proxy hasn't already been evicted by a @@ -257,7 +261,7 @@ public final class RouterInfo // // We also must remove whatever proxies the router evicted. // - for(Ice.ObjectPrx p : evictedProxies) + for(com.zeroc.Ice.ObjectPrx p : evictedProxies) { if(!_identities.remove(p.ice_getIdentity())) { @@ -271,10 +275,11 @@ public final class RouterInfo } } - private final Ice.RouterPrx _router; + private final com.zeroc.Ice.RouterPrx _router; private EndpointI[] _clientEndpoints; private EndpointI[] _serverEndpoints; - private Ice.ObjectAdapter _adapter; - private java.util.Set<Ice.Identity> _identities = new java.util.HashSet<Ice.Identity>(); - private java.util.List<Ice.Identity> _evictedIdentities = new java.util.ArrayList<Ice.Identity>(); + private com.zeroc.Ice.ObjectAdapter _adapter; + private java.util.Set<com.zeroc.Ice.Identity> _identities = new java.util.HashSet<com.zeroc.Ice.Identity>(); + private java.util.List<com.zeroc.Ice.Identity> _evictedIdentities = + new java.util.ArrayList<com.zeroc.Ice.Identity>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/RouterManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterManager.java index 217c5d86d5d..363ba6a454d 100644 --- a/java/src/Ice/src/main/java/IceInternal/RouterManager.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/RouterManager.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class RouterManager { @@ -30,7 +30,7 @@ public final class RouterManager // the router info if it doesn't exist yet. // public RouterInfo - get(Ice.RouterPrx rtr) + get(com.zeroc.Ice.RouterPrx rtr) { if(rtr == null) { @@ -40,7 +40,7 @@ public final class RouterManager // // The router cannot be routed. // - Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(rtr.ice_router(null)); + com.zeroc.Ice.RouterPrx router = com.zeroc.Ice.RouterPrx.uncheckedCast(rtr.ice_router(null)); synchronized(this) { @@ -56,13 +56,13 @@ public final class RouterManager } public RouterInfo - erase(Ice.RouterPrx rtr) + erase(com.zeroc.Ice.RouterPrx rtr) { RouterInfo info = null; if(rtr != null) { // The router cannot be routed. - Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(rtr.ice_router(null)); + com.zeroc.Ice.RouterPrx router = com.zeroc.Ice.RouterPrx.uncheckedCast(rtr.ice_router(null)); synchronized(this) { @@ -72,5 +72,6 @@ public final class RouterManager return info; } - private java.util.HashMap<Ice.RouterPrx, RouterInfo> _table = new java.util.HashMap<Ice.RouterPrx, RouterInfo>(); + private java.util.HashMap<com.zeroc.Ice.RouterPrx, RouterInfo> _table = + new java.util.HashMap<com.zeroc.Ice.RouterPrx, RouterInfo>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SOCKSNetworkProxy.java index c2843bdbf6e..ce35ab4ee14 100644 --- a/java/src/Ice/src/main/java/IceInternal/SOCKSNetworkProxy.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SOCKSNetworkProxy.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class SOCKSNetworkProxy implements NetworkProxy { @@ -28,11 +28,11 @@ public final class SOCKSNetworkProxy implements NetworkProxy final java.net.InetAddress addr = endpoint.getAddress(); if(addr == null) { - throw new Ice.FeatureNotSupportedException("SOCKS4 does not support domain names"); + throw new com.zeroc.Ice.FeatureNotSupportedException("SOCKS4 does not support domain names"); } else if(!(addr instanceof java.net.Inet4Address)) { - throw new Ice.FeatureNotSupportedException("SOCKS4 only supports IPv4 addresses"); + throw new com.zeroc.Ice.FeatureNotSupportedException("SOCKS4 only supports IPv4 addresses"); } // @@ -87,7 +87,7 @@ public final class SOCKSNetworkProxy implements NetworkProxy byte b2 = readBuffer.b.get(); if(b1 != 0x00 || b2 != 0x5a) { - throw new Ice.ConnectFailedException(); + throw new com.zeroc.Ice.ConnectFailedException(); } } @@ -98,7 +98,7 @@ public final class SOCKSNetworkProxy implements NetworkProxy return new SOCKSNetworkProxy(Network.getAddresses(_host, _port, protocolSupport, - Ice.EndpointSelectionType.Random, + com.zeroc.Ice.EndpointSelectionType.Random, false, true).get(0)); } diff --git a/java/src/Ice/src/main/java/IceInternal/Selector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Selector.java index ecc4529845e..a35ddd2a5d5 100644 --- a/java/src/Ice/src/main/java/IceInternal/Selector.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Selector.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class Selector { @@ -27,7 +27,7 @@ public final class Selector } catch(java.io.IOException ex) { - throw new Ice.SyscallException(ex); + throw new com.zeroc.Ice.SyscallException(ex); } // @@ -246,10 +246,10 @@ public final class Selector // timeouts are correctly detected, we wait for a little longer than // the configured timeout (10ms). // - long before = IceInternal.Time.currentMonotonicTimeMillis(); + long before = Time.currentMonotonicTimeMillis(); if(_selector.select(timeout * 1000 + 10) == 0) { - if(IceInternal.Time.currentMonotonicTimeMillis() - before >= timeout * 1000) + if(Time.currentMonotonicTimeMillis() - before >= timeout * 1000) { throw new TimeoutException(); } @@ -399,8 +399,8 @@ public final class Selector private java.nio.channels.Selector _selector; private java.util.Set<java.nio.channels.SelectionKey> _keys; - private java.util.HashSet<EventHandler> _changes = new java.util.HashSet<EventHandler>(); - private java.util.HashSet<EventHandler> _readyHandlers = new java.util.HashSet<EventHandler>(); + private java.util.HashSet<EventHandler> _changes = new java.util.HashSet<>(); + private java.util.HashSet<EventHandler> _readyHandlers = new java.util.HashSet<>(); private boolean _selecting; private boolean _selectNow; private boolean _interrupted; diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java new file mode 100644 index 00000000000..22309d162f0 --- /dev/null +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SequencePatcher.java @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceInternal; + +public class SequencePatcher<T> implements com.zeroc.Ice.ReadValueCallback +{ + public SequencePatcher(T[] seq, Class<T> cls, String type, int index) + { + _seq = seq; + _cls = cls; + _type = type; + _index = index; + } + + public void valueReady(com.zeroc.Ice.Value v) + { + if(v == null || _cls.isInstance(v)) + { + _seq[_index] = _cls.cast(v); + } + else + { + Ex.throwUOE(_type, v); + } + + } + + private T[] _seq; + private Class<T> _cls; + private String _type; + private int _index; +} diff --git a/java/src/Ice/src/main/java/IceInternal/ServantError.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantError.java index 8823aae9ea9..998059bee4b 100644 --- a/java/src/Ice/src/main/java/IceInternal/ServantError.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantError.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final public class ServantError extends java.lang.Error { diff --git a/java/src/Ice/src/main/java/IceInternal/ServantManager.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantManager.java index 2789304f276..d83dfb8e141 100644 --- a/java/src/Ice/src/main/java/IceInternal/ServantManager.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ServantManager.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class ServantManager { public synchronized void - addServant(Ice.Object servant, Ice.Identity ident, String facet) + addServant(com.zeroc.Ice.Object servant, com.zeroc.Ice.Identity ident, String facet) { assert(_instance != null); // Must not be called after destruction. @@ -21,22 +21,22 @@ public final class ServantManager facet = ""; } - java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); + java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident); if(m == null) { - m = new java.util.HashMap<String, Ice.Object>(); + m = new java.util.HashMap<String, com.zeroc.Ice.Object>(); _servantMapMap.put(ident, m); } else { if(m.containsKey(facet)) { - Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); - ex.id = Ice.Util.identityToString(ident); + com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException(); + ex.id = com.zeroc.Ice.Util.identityToString(ident); ex.kindOfObject = "servant"; if(facet.length() > 0) { - ex.id += " -f " + IceUtilInternal.StringUtil.escapeString(facet, ""); + ex.id += " -f " + com.zeroc.IceUtilInternal.StringUtil.escapeString(facet, ""); } throw ex; } @@ -46,14 +46,14 @@ public final class ServantManager } public synchronized void - addDefaultServant(Ice.Object servant, String category) + addDefaultServant(com.zeroc.Ice.Object servant, String category) { assert(_instance != null); // Must not be called after destruction - Ice.Object obj = _defaultServantMap.get(category); + com.zeroc.Ice.Object obj = _defaultServantMap.get(category); if(obj != null) { - Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); + com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException(); ex.kindOfObject = "default servant"; ex.id = category; throw ex; @@ -62,8 +62,8 @@ public final class ServantManager _defaultServantMap.put(category, servant); } - public synchronized Ice.Object - removeServant(Ice.Identity ident, String facet) + public synchronized com.zeroc.Ice.Object + removeServant(com.zeroc.Ice.Identity ident, String facet) { assert(_instance != null); // Must not be called after destruction. @@ -72,16 +72,16 @@ public final class ServantManager facet = ""; } - java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); - Ice.Object obj = null; + java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident); + com.zeroc.Ice.Object obj = null; if(m == null || (obj = m.remove(facet)) == null) { - Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); - ex.id = Ice.Util.identityToString(ident); + com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException(); + ex.id = com.zeroc.Ice.Util.identityToString(ident); ex.kindOfObject = "servant"; if(facet.length() > 0) { - ex.id += " -f " + IceUtilInternal.StringUtil.escapeString(facet, ""); + ex.id += " -f " + com.zeroc.IceUtilInternal.StringUtil.escapeString(facet, ""); } throw ex; } @@ -93,15 +93,15 @@ public final class ServantManager return obj; } - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object removeDefaultServant(String category) { assert(_instance != null); // Must not be called after destruction. - Ice.Object obj = _defaultServantMap.get(category); + com.zeroc.Ice.Object obj = _defaultServantMap.get(category); if(obj == null) { - Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); + com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException(); ex.kindOfObject = "default servant"; ex.id = category; throw ex; @@ -111,16 +111,16 @@ public final class ServantManager return obj; } - public synchronized java.util.Map<String, Ice.Object> - removeAllFacets(Ice.Identity ident) + public synchronized java.util.Map<String, com.zeroc.Ice.Object> + removeAllFacets(com.zeroc.Ice.Identity ident) { assert(_instance != null); // Must not be called after destruction. - java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); + java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident); if(m == null) { - Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); - ex.id = Ice.Util.identityToString(ident); + com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException(); + ex.id = com.zeroc.Ice.Util.identityToString(ident); ex.kindOfObject = "servant"; throw ex; } @@ -130,8 +130,8 @@ public final class ServantManager return m; } - public synchronized Ice.Object - findServant(Ice.Identity ident, String facet) + public synchronized com.zeroc.Ice.Object + findServant(com.zeroc.Ice.Identity ident, String facet) { // // This assert is not valid if the adapter dispatch incoming @@ -146,8 +146,8 @@ public final class ServantManager facet = ""; } - java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); - Ice.Object obj = null; + java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident); + com.zeroc.Ice.Object obj = null; if(m == null) { obj = _defaultServantMap.get(ident.category); @@ -164,7 +164,7 @@ public final class ServantManager return obj; } - public synchronized Ice.Object + public synchronized com.zeroc.Ice.Object findDefaultServant(String category) { assert(_instance != null); // Must not be called after destruction. @@ -172,22 +172,22 @@ public final class ServantManager return _defaultServantMap.get(category); } - public synchronized java.util.Map<String, Ice.Object> - findAllFacets(Ice.Identity ident) + public synchronized java.util.Map<String, com.zeroc.Ice.Object> + findAllFacets(com.zeroc.Ice.Identity ident) { assert(_instance != null); // Must not be called after destruction. - java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); + java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident); if(m != null) { - return new java.util.HashMap<String, Ice.Object>(m); + return new java.util.HashMap<String, com.zeroc.Ice.Object>(m); } - return new java.util.HashMap<String, Ice.Object>(); + return new java.util.HashMap<String, com.zeroc.Ice.Object>(); } public synchronized boolean - hasServant(Ice.Identity ident) + hasServant(com.zeroc.Ice.Identity ident) { // // This assert is not valid if the adapter dispatch incoming @@ -197,7 +197,7 @@ public final class ServantManager // //assert(_instance != null); // Must not be called after destruction. - java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); + java.util.Map<String, com.zeroc.Ice.Object> m = _servantMapMap.get(ident); if(m == null) { return false; @@ -210,15 +210,15 @@ public final class ServantManager } public synchronized void - addServantLocator(Ice.ServantLocator locator, String category) + addServantLocator(com.zeroc.Ice.ServantLocator locator, String category) { assert(_instance != null); // Must not be called after destruction. - Ice.ServantLocator l = _locatorMap.get(category); + com.zeroc.Ice.ServantLocator l = _locatorMap.get(category); if(l != null) { - Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); - ex.id = IceUtilInternal.StringUtil.escapeString(category, ""); + com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException(); + ex.id = com.zeroc.IceUtilInternal.StringUtil.escapeString(category, ""); ex.kindOfObject = "servant locator"; throw ex; } @@ -226,24 +226,24 @@ public final class ServantManager _locatorMap.put(category, locator); } - public synchronized Ice.ServantLocator + public synchronized com.zeroc.Ice.ServantLocator removeServantLocator(String category) { - Ice.ServantLocator l = null; + com.zeroc.Ice.ServantLocator l = null; assert(_instance != null); // Must not be called after destruction. l = _locatorMap.remove(category); if(l == null) { - Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); - ex.id = IceUtilInternal.StringUtil.escapeString(category, ""); + com.zeroc.Ice.NotRegisteredException ex = new com.zeroc.Ice.NotRegisteredException(); + ex.id = com.zeroc.IceUtilInternal.StringUtil.escapeString(category, ""); ex.kindOfObject = "servant locator"; throw ex; } return l; } - public synchronized Ice.ServantLocator + public synchronized com.zeroc.Ice.ServantLocator findServantLocator(String category) { // @@ -258,7 +258,7 @@ public final class ServantManager } // - // Only for use by Ice.ObjectAdatperI. + // Only for use by com.zeroc.Ice.ObjectAdatperI. // public ServantManager(Instance instance, String adapterName) @@ -268,13 +268,14 @@ public final class ServantManager } // - // Only for use by Ice.ObjectAdapterI. + // Only for use by com.zeroc.Ice.ObjectAdapterI. // public void destroy() { - java.util.Map<String, Ice.ServantLocator> locatorMap = new java.util.HashMap<String, Ice.ServantLocator>(); - Ice.Logger logger = null; + java.util.Map<String, com.zeroc.Ice.ServantLocator> locatorMap = + new java.util.HashMap<String, com.zeroc.Ice.ServantLocator>(); + com.zeroc.Ice.Logger logger = null; synchronized(this) { // @@ -297,9 +298,9 @@ public final class ServantManager _instance = null; } - for(java.util.Map.Entry<String, Ice.ServantLocator> p : locatorMap.entrySet()) + for(java.util.Map.Entry<String, com.zeroc.Ice.ServantLocator> p : locatorMap.entrySet()) { - Ice.ServantLocator locator = p.getValue(); + com.zeroc.Ice.ServantLocator locator = p.getValue(); try { locator.deactivate(p.getKey()); @@ -315,8 +316,10 @@ public final class ServantManager private Instance _instance; final private String _adapterName; - private java.util.Map<Ice.Identity, java.util.Map<String, Ice.Object> > _servantMapMap = - new java.util.HashMap<Ice.Identity, java.util.Map<String, Ice.Object> >(); - private java.util.Map<String, Ice.Object> _defaultServantMap = new java.util.HashMap<String, Ice.Object>(); - private java.util.Map<String, Ice.ServantLocator> _locatorMap = new java.util.HashMap<String, Ice.ServantLocator>(); + private java.util.Map<com.zeroc.Ice.Identity, java.util.Map<String, com.zeroc.Ice.Object> > _servantMapMap = + new java.util.HashMap<com.zeroc.Ice.Identity, java.util.Map<String, com.zeroc.Ice.Object> >(); + private java.util.Map<String, com.zeroc.Ice.Object> _defaultServantMap = + new java.util.HashMap<String, com.zeroc.Ice.Object>(); + private java.util.Map<String, com.zeroc.Ice.ServantLocator> _locatorMap = + new java.util.HashMap<String, com.zeroc.Ice.ServantLocator>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/SocketOperation.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SocketOperation.java index 030d5d32bfd..362491af202 100644 --- a/java/src/Ice/src/main/java/IceInternal/SocketOperation.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/SocketOperation.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.nio.channels.SelectionKey; diff --git a/java/src/Ice/src/main/java/IceInternal/StreamSocket.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/StreamSocket.java index 03cd265e0e6..811f69ba75a 100644 --- a/java/src/Ice/src/main/java/IceInternal/StreamSocket.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/StreamSocket.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class StreamSocket { @@ -30,7 +30,7 @@ public class StreamSocket _state = _proxy != null ? StateProxyWrite : StateConnected; } } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { assert(!_fd.isOpen()); _fd = null; // Necessary for the finalizer @@ -52,7 +52,7 @@ public class StreamSocket { init(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { assert(!_fd.isOpen()); _fd = null; // Necessary for the finalizer @@ -68,7 +68,7 @@ public class StreamSocket { try { - IceUtilInternal.Assert.FinalizerAssert(_fd == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_fd == null); } catch(java.lang.Exception ex) { @@ -189,7 +189,7 @@ public class StreamSocket int ret = _fd.read(buf); if(ret == -1) { - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); } else if(ret == 0) { @@ -204,7 +204,7 @@ public class StreamSocket } catch(java.io.IOException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } } return read; @@ -234,7 +234,7 @@ public class StreamSocket if(ret == -1) { - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); } else if(ret == 0) { @@ -248,7 +248,7 @@ public class StreamSocket } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new com.zeroc.Ice.SocketException(ex); } } return sent; @@ -263,7 +263,7 @@ public class StreamSocket } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new com.zeroc.Ice.SocketException(ex); } finally { diff --git a/java/src/Ice/src/main/java/IceInternal/TcpAcceptor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpAcceptor.java index 27418ca2bad..0a8afadcaa6 100644 --- a/java/src/Ice/src/main/java/IceInternal/TcpAcceptor.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpAcceptor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; class TcpAcceptor implements Acceptor { @@ -40,7 +40,7 @@ class TcpAcceptor implements Acceptor { _addr = Network.doBind(_fd, _addr, _backlog); } - catch(Ice.Exception ex) + catch(com.zeroc.Ice.Exception ex) { _fd = null; throw ex; @@ -78,7 +78,7 @@ class TcpAcceptor implements Acceptor if(!intfs.isEmpty()) { s.append("\nlocal interfaces = "); - s.append(IceUtilInternal.StringUtil.joinString(intfs, ", ")); + s.append(com.zeroc.IceUtilInternal.StringUtil.joinString(intfs, ", ")); } return s.toString(); } @@ -131,7 +131,7 @@ class TcpAcceptor implements Acceptor { try { - IceUtilInternal.Assert.FinalizerAssert(_fd == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_fd == null); } catch(java.lang.Exception ex) { diff --git a/java/src/Ice/src/main/java/IceInternal/TcpConnector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpConnector.java index 64ab2c3b515..11496dd18c8 100644 --- a/java/src/Ice/src/main/java/IceInternal/TcpConnector.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpConnector.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class TcpConnector implements Connector { @@ -49,14 +49,14 @@ final class TcpConnector implements Connector _connectionId = connectionId; _hashCode = 5381; - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getPort()); + _hashCode = HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); + _hashCode = HashUtil.hashAdd(_hashCode , _addr.getPort()); if(_sourceAddr != null) { - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _sourceAddr.getAddress().getHostAddress()); + _hashCode = HashUtil.hashAdd(_hashCode , _sourceAddr.getAddress().getHostAddress()); } - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _timeout); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _connectionId); + _hashCode = HashUtil.hashAdd(_hashCode , _timeout); + _hashCode = HashUtil.hashAdd(_hashCode , _connectionId); } @Override diff --git a/java/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointFactory.java index 9211951ca59..dbb773829bd 100644 --- a/java/src/Ice/src/main/java/IceInternal/TcpEndpointFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointFactory.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class TcpEndpointFactory implements EndpointFactory { @@ -37,7 +37,7 @@ final class TcpEndpointFactory implements EndpointFactory } @Override - public EndpointI read(Ice.InputStream s) + public EndpointI read(com.zeroc.Ice.InputStream s) { return new TcpEndpointI(_instance, s); } diff --git a/java/src/Ice/src/main/java/IceInternal/TcpEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointI.java index f038da63a2d..18560947241 100644 --- a/java/src/Ice/src/main/java/IceInternal/TcpEndpointI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpEndpointI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class TcpEndpointI extends IPEndpointI { @@ -26,7 +26,7 @@ final class TcpEndpointI extends IPEndpointI _compress = false; } - public TcpEndpointI(ProtocolInstance instance, Ice.InputStream s) + public TcpEndpointI(ProtocolInstance instance, com.zeroc.Ice.InputStream s) { super(instance, s); _timeout = s.readInt(); @@ -37,9 +37,9 @@ final class TcpEndpointI extends IPEndpointI // Return the endpoint information. // @Override - public Ice.EndpointInfo getInfo() + public com.zeroc.Ice.EndpointInfo getInfo() { - Ice.TCPEndpointInfo info = new Ice.TCPEndpointInfo() + com.zeroc.Ice.TCPEndpointInfo info = new com.zeroc.Ice.TCPEndpointInfo() { @Override public short type() @@ -222,7 +222,7 @@ final class TcpEndpointI extends IPEndpointI } @Override - public void streamWriteImpl(Ice.OutputStream s) + public void streamWriteImpl(com.zeroc.Ice.OutputStream s) { super.streamWriteImpl(s); s.writeInt(_timeout); @@ -233,8 +233,8 @@ final class TcpEndpointI extends IPEndpointI public int hashInit(int h) { h = super.hashInit(h); - h = IceInternal.HashUtil.hashAdd(h, _timeout); - h = IceInternal.HashUtil.hashAdd(h, _compress); + h = HashUtil.hashAdd(h, _timeout); + h = HashUtil.hashAdd(h, _compress); return h; } @@ -252,7 +252,8 @@ final class TcpEndpointI extends IPEndpointI { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -t option in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException("no argument provided for -t option in endpoint " + + endpoint); } if(argument.equals("infinite")) @@ -266,14 +267,14 @@ final class TcpEndpointI extends IPEndpointI _timeout = Integer.parseInt(argument); if(_timeout < 1) { - throw new Ice.EndpointParseException("invalid timeout value `" + argument + - "' in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException("invalid timeout value `" + argument + + "' in endpoint " + endpoint); } } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException("invalid timeout value `" + argument + - "' in endpoint " + endpoint); + throw new com.zeroc.Ice.EndpointParseException("invalid timeout value `" + argument + + "' in endpoint " + endpoint); } } @@ -284,8 +285,8 @@ final class TcpEndpointI extends IPEndpointI { if(argument != null) { - throw new Ice.EndpointParseException("unexpected argument `" + argument + - "' provided for -z option in " + endpoint); + throw new com.zeroc.Ice.EndpointParseException("unexpected argument `" + argument + + "' provided for -z option in " + endpoint); } _compress = true; diff --git a/java/src/Ice/src/main/java/IceInternal/TcpTransceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpTransceiver.java index 069e79a3408..2404953af2b 100644 --- a/java/src/Ice/src/main/java/IceInternal/TcpTransceiver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TcpTransceiver.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class TcpTransceiver implements Transceiver { @@ -31,7 +31,7 @@ final class TcpTransceiver implements Transceiver } @Override - public int closing(boolean initiator, Ice.LocalException ex) + public int closing(boolean initiator, com.zeroc.Ice.LocalException ex) { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. @@ -82,9 +82,9 @@ final class TcpTransceiver implements Transceiver } @Override - public Ice.ConnectionInfo getInfo() + public com.zeroc.Ice.ConnectionInfo getInfo() { - Ice.TCPConnectionInfo info = new Ice.TCPConnectionInfo(); + com.zeroc.Ice.TCPConnectionInfo info = new com.zeroc.Ice.TCPConnectionInfo(); if(_stream.fd() != null) { java.net.Socket socket = _stream.fd().socket(); diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadObserverI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadObserverI.java index 553e46840bf..81a0290b666 100644 --- a/java/src/Ice/src/main/java/IceInternal/ThreadObserverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadObserverI.java @@ -7,15 +7,16 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public class ThreadObserverI - extends IceMX.ObserverWithDelegate<IceMX.ThreadMetrics, Ice.Instrumentation.ThreadObserver> - implements Ice.Instrumentation.ThreadObserver + extends com.zeroc.IceMX.ObserverWithDelegate<com.zeroc.IceMX.ThreadMetrics, + com.zeroc.Ice.Instrumentation.ThreadObserver> + implements com.zeroc.Ice.Instrumentation.ThreadObserver { @Override - public void - stateChanged(final Ice.Instrumentation.ThreadState oldState, final Ice.Instrumentation.ThreadState newState) + public void stateChanged(final com.zeroc.Ice.Instrumentation.ThreadState oldState, + final com.zeroc.Ice.Instrumentation.ThreadState newState) { _oldState = oldState; _newState = newState; @@ -26,11 +27,11 @@ public class ThreadObserverI } } - private MetricsUpdate<IceMX.ThreadMetrics> _threadStateUpdate = new MetricsUpdate<IceMX.ThreadMetrics>() + private com.zeroc.IceMX.Observer.MetricsUpdate<com.zeroc.IceMX.ThreadMetrics> _threadStateUpdate = + new com.zeroc.IceMX.Observer.MetricsUpdate<com.zeroc.IceMX.ThreadMetrics>() { @Override - public void - update(IceMX.ThreadMetrics v) + public void update(com.zeroc.IceMX.ThreadMetrics v) { switch(_oldState) { @@ -63,6 +64,6 @@ public class ThreadObserverI } }; - private Ice.Instrumentation.ThreadState _oldState; - private Ice.Instrumentation.ThreadState _newState; + private com.zeroc.Ice.Instrumentation.ThreadState _oldState; + private com.zeroc.Ice.Instrumentation.ThreadState _newState; } diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPool.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java index 9dc5f1ec92a..83bb22218df 100644 --- a/java/src/Ice/src/main/java/IceInternal/ThreadPool.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPool.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class ThreadPool { @@ -21,7 +21,7 @@ public final class ThreadPool { _instance.objectAdapterFactory().shutdown(); } - catch(Ice.CommunicatorDestroyedException ex) + catch(com.zeroc.Ice.CommunicatorDestroyedException ex) { } } @@ -94,7 +94,7 @@ public final class ThreadPool public ThreadPool(Instance instance, String prefix, int timeout) { - Ice.Properties properties = instance.initializationData().properties; + com.zeroc.Ice.Properties properties = instance.initializationData().properties; _instance = instance; _dispatcher = instance.initializationData().dispatcher; @@ -221,7 +221,7 @@ public final class ThreadPool } catch (InterruptedException e) { - throw new Ice.OperationInterruptedException(); + throw new com.zeroc.Ice.OperationInterruptedException(); } throw ex; } @@ -234,7 +234,7 @@ public final class ThreadPool { try { - IceUtilInternal.Assert.FinalizerAssert(_destroyed); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_destroyed); } catch(java.lang.Exception ex) { @@ -360,7 +360,7 @@ public final class ThreadPool { if(_destroyed) { - throw new Ice.CommunicatorDestroyedException(); + throw new com.zeroc.Ice.CommunicatorDestroyedException(); } _workQueue.queue(workItem); } @@ -487,7 +487,7 @@ public final class ThreadPool current._ioCompleted = false; current._handler = n.handler; current.operation = op; - thread.setState(Ice.Instrumentation.ThreadState.ThreadStateInUseForIO); + thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForIO); break; } } @@ -509,7 +509,7 @@ public final class ThreadPool _handlers.clear(); _selector.startSelect(); select = true; - thread.setState(Ice.Instrumentation.ThreadState.ThreadStateIdle); + thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle); } } else if(_sizeMax > 1) @@ -533,7 +533,7 @@ public final class ThreadPool { current._ioCompleted = true; // Set the IO completed flag to specify that ioCompleted() has been called. - current._thread.setState(Ice.Instrumentation.ThreadState.ThreadStateInUseForUser); + current._thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateInUseForUser); if(_sizeMax > 1) { @@ -620,7 +620,7 @@ public final class ThreadPool { assert(!current._leader); - current._thread.setState(Ice.Instrumentation.ThreadState.ThreadStateIdle); + current._thread.setState(com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle); // // It's important to clear the handler before waiting to make sure that @@ -637,7 +637,7 @@ public final class ThreadPool { if(_threadIdleTime > 0) { - long before = IceInternal.Time.currentMonotonicTimeMillis(); + long before = Time.currentMonotonicTimeMillis(); boolean interrupted = false; try { @@ -650,7 +650,7 @@ public final class ThreadPool { interrupted = true; } - if(interrupted || IceInternal.Time.currentMonotonicTimeMillis() - before >= _threadIdleTime * 1000) + if(interrupted || Time.currentMonotonicTimeMillis() - before >= _threadIdleTime * 1000) { if(!_destroyed && (!_promote || _inUseIO == _sizeIO || (!_nextHandler.hasNext() && _inUseIO > 0))) { @@ -686,7 +686,7 @@ public final class ThreadPool } private final Instance _instance; - private final Ice.Dispatcher _dispatcher; + private final com.zeroc.Ice.Dispatcher _dispatcher; private final ThreadPoolWorkQueue _workQueue; private boolean _destroyed; private final String _prefix; @@ -698,7 +698,7 @@ public final class ThreadPool EventHandlerThread(String name) { _name = name; - _state = Ice.Instrumentation.ThreadState.ThreadStateIdle; + _state = com.zeroc.Ice.Instrumentation.ThreadState.ThreadStateIdle; updateObserver(); } @@ -706,7 +706,7 @@ public final class ThreadPool updateObserver() { // Must be called with the thread pool mutex locked - Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; + com.zeroc.Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer; if(obsv != null) { _observer = obsv.getThreadObserver(_prefix, _name, _state, _observer); @@ -718,7 +718,7 @@ public final class ThreadPool } public void - setState(Ice.Instrumentation.ThreadState s) + setState(com.zeroc.Ice.Instrumentation.ThreadState s) { // Must be called with the thread pool mutex locked if(_observer != null) @@ -796,8 +796,8 @@ public final class ThreadPool final private String _name; private Thread _thread; - private Ice.Instrumentation.ThreadState _state; - private Ice.Instrumentation.ThreadObserver _observer; + private com.zeroc.Ice.Instrumentation.ThreadState _state; + private com.zeroc.Ice.Instrumentation.ThreadObserver _observer; } private final int _size; // Number of threads that are pre-created. @@ -811,12 +811,12 @@ public final class ThreadPool private final long _threadIdleTime; private final int _stackSize; - private java.util.List<EventHandlerThread> _threads = new java.util.ArrayList<EventHandlerThread>(); + private java.util.List<EventHandlerThread> _threads = new java.util.ArrayList<>(); private int _threadIndex; // For assigning thread names. private int _inUse; // Number of threads that are currently in use. private int _inUseIO; // Number of threads that are currently performing IO. - private java.util.List<EventHandlerOpPair> _handlers = new java.util.ArrayList<EventHandlerOpPair>(); + private java.util.List<EventHandlerOpPair> _handlers = new java.util.ArrayList<>(); private java.util.Iterator<EventHandlerOpPair> _nextHandler; private boolean _promote; diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolCurrent.java index cdd5b9fe2bc..e3eb3c759fa 100644 --- a/java/src/Ice/src/main/java/IceInternal/ThreadPoolCurrent.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolCurrent.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class ThreadPoolCurrent { ThreadPoolCurrent(Instance instance, ThreadPool threadPool, ThreadPool.EventHandlerThread thread) { operation = SocketOperation.None; - stream = new Ice.InputStream(instance, Protocol.currentProtocolEncoding); + stream = new com.zeroc.Ice.InputStream(instance, Protocol.currentProtocolEncoding); _threadPool = threadPool; _thread = thread; @@ -23,7 +23,7 @@ public final class ThreadPoolCurrent } public int operation; - public Ice.InputStream stream; // A per-thread stream to be used by event handlers for optimization. + public com.zeroc.Ice.InputStream stream; // A per-thread stream to be used by event handlers for optimization. public boolean ioReady() diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkItem.java index 27f06f9366b..f39ab05652a 100644 --- a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkItem.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkItem.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface ThreadPoolWorkItem { diff --git a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkQueue.java index ae838d61cdf..62990f48b20 100644 --- a/java/src/Ice/src/main/java/IceInternal/ThreadPoolWorkQueue.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ThreadPoolWorkQueue.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.List; @@ -26,7 +26,7 @@ final class ThreadPoolWorkQueue extends EventHandler { try { - IceUtilInternal.Assert.FinalizerAssert(_destroyed); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_destroyed); } catch(java.lang.Exception ex) { @@ -112,5 +112,5 @@ final class ThreadPoolWorkQueue extends EventHandler private final ThreadPool _threadPool; private boolean _destroyed; private Selector _selector; - private java.util.LinkedList<ThreadPoolWorkItem> _workItems = new java.util.LinkedList<ThreadPoolWorkItem>(); + private java.util.LinkedList<ThreadPoolWorkItem> _workItems = new java.util.LinkedList<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/Time.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Time.java index e1547f9e552..1198561400e 100644 --- a/java/src/Ice/src/main/java/IceInternal/Time.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Time.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final public class Time { diff --git a/java/src/Ice/src/main/java/IceInternal/TraceLevels.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceLevels.java index 8273966cdad..e92fc043732 100644 --- a/java/src/Ice/src/main/java/IceInternal/TraceLevels.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceLevels.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class TraceLevels { - TraceLevels(Ice.Properties properties) + TraceLevels(com.zeroc.Ice.Properties properties) { networkCat = "Network"; protocolCat = "Protocol"; diff --git a/java/src/Ice/src/main/java/IceInternal/TraceUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java index 2ff165c475d..4798d1be659 100644 --- a/java/src/Ice/src/main/java/IceInternal/TraceUtil.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/TraceUtil.java @@ -7,17 +7,18 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class TraceUtil { public static void - traceSend(Ice.OutputStream str, Ice.Logger logger, TraceLevels tl) + traceSend(com.zeroc.Ice.OutputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl) { if(tl.protocol >= 1) { int p = str.pos(); - Ice.InputStream is = new Ice.InputStream(str.instance(), str.getEncoding(), str.getBuffer(), false); + com.zeroc.Ice.InputStream is = + new com.zeroc.Ice.InputStream(str.instance(), str.getEncoding(), str.getBuffer(), false); is.pos(0); java.io.StringWriter s = new java.io.StringWriter(); @@ -30,7 +31,7 @@ public final class TraceUtil } public static void - traceRecv(Ice.InputStream str, Ice.Logger logger, TraceLevels tl) + traceRecv(com.zeroc.Ice.InputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl) { if(tl.protocol >= 1) { @@ -47,12 +48,13 @@ public final class TraceUtil } public static void - trace(String heading, Ice.OutputStream str, Ice.Logger logger, TraceLevels tl) + trace(String heading, com.zeroc.Ice.OutputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl) { if(tl.protocol >= 1) { int p = str.pos(); - Ice.InputStream is = new Ice.InputStream(str.instance(), str.getEncoding(), str.getBuffer(), false); + com.zeroc.Ice.InputStream is = + new com.zeroc.Ice.InputStream(str.instance(), str.getEncoding(), str.getBuffer(), false); is.pos(0); java.io.StringWriter s = new java.io.StringWriter(); @@ -65,7 +67,7 @@ public final class TraceUtil } public static void - trace(String heading, Ice.InputStream str, Ice.Logger logger, TraceLevels tl) + trace(String heading, com.zeroc.Ice.InputStream str, com.zeroc.Ice.Logger logger, TraceLevels tl) { if(tl.protocol >= 1) { @@ -81,10 +83,10 @@ public final class TraceUtil } } - private static java.util.Set<String> slicingIds = new java.util.HashSet<String>(); + private static java.util.Set<String> slicingIds = new java.util.HashSet<>(); public synchronized static void - traceSlicing(String kind, String typeId, String slicingCat, Ice.Logger logger) + traceSlicing(String kind, String typeId, String slicingCat, com.zeroc.Ice.Logger logger) { if(slicingIds.add(typeId)) { @@ -95,7 +97,7 @@ public final class TraceUtil } public static void - dumpStream(Ice.InputStream stream) + dumpStream(com.zeroc.Ice.InputStream stream) { int pos = stream.pos(); stream.pos(0); @@ -162,19 +164,18 @@ public final class TraceUtil } private static void - printIdentityFacetOperation(java.io.Writer out, Ice.InputStream stream) + printIdentityFacetOperation(java.io.Writer out, com.zeroc.Ice.InputStream stream) { try { - Ice.Identity identity = new Ice.Identity(); - identity.__read(stream); - out.write("\nidentity = " + Ice.Util.identityToString(identity)); + com.zeroc.Ice.Identity identity = com.zeroc.Ice.Identity.read(stream, null); + out.write("\nidentity = " + com.zeroc.Ice.Util.identityToString(identity)); String[] facet = stream.readStringSeq(); out.write("\nfacet = "); if(facet.length > 0) { - out.write(IceUtilInternal.StringUtil.escapeString(facet[0], "")); + out.write(com.zeroc.IceUtilInternal.StringUtil.escapeString(facet[0], "")); } String operation = stream.readString(); @@ -187,7 +188,7 @@ public final class TraceUtil } private static void - printRequest(java.io.StringWriter s, Ice.InputStream str) + printRequest(java.io.StringWriter s, com.zeroc.Ice.InputStream str) { int requestId = str.readInt(); s.write("\nrequest id = " + requestId); @@ -200,7 +201,7 @@ public final class TraceUtil } private static void - printBatchRequest(java.io.StringWriter s, Ice.InputStream str) + printBatchRequest(java.io.StringWriter s, com.zeroc.Ice.InputStream str) { int batchRequestNum = str.readInt(); s.write("\nnumber of requests = " + batchRequestNum); @@ -213,7 +214,7 @@ public final class TraceUtil } private static void - printReply(java.io.StringWriter s, Ice.InputStream str) + printReply(java.io.StringWriter s, com.zeroc.Ice.InputStream str) { int requestId = str.readInt(); s.write("\nrequest id = " + requestId); @@ -315,17 +316,17 @@ public final class TraceUtil if(replyStatus == ReplyStatus.replyOK || replyStatus == ReplyStatus.replyUserException) { - Ice.EncodingVersion v = str.skipEncapsulation(); - if(!v.equals(Ice.Util.Encoding_1_0)) + com.zeroc.Ice.EncodingVersion v = str.skipEncapsulation(); + if(!v.equals(com.zeroc.Ice.Util.Encoding_1_0)) { s.write("\nencoding = "); - s.write(Ice.Util.encodingVersionToString(v)); + s.write(com.zeroc.Ice.Util.encodingVersionToString(v)); } } } private static void - printRequestHeader(java.io.Writer out, Ice.InputStream stream) + printRequestHeader(java.io.Writer out, com.zeroc.Ice.InputStream stream) { printIdentityFacetOperation(out, stream); @@ -333,7 +334,7 @@ public final class TraceUtil { byte mode = stream.readByte(); out.write("\nmode = " + (int) mode + ' '); - switch(Ice.OperationMode.values()[mode]) + switch(com.zeroc.Ice.OperationMode.values()[mode]) { case Normal: { @@ -373,11 +374,11 @@ public final class TraceUtil } } - Ice.EncodingVersion v = stream.skipEncapsulation(); - if(!v.equals(Ice.Util.Encoding_1_0)) + com.zeroc.Ice.EncodingVersion v = stream.skipEncapsulation(); + if(!v.equals(com.zeroc.Ice.Util.Encoding_1_0)) { out.write("\nencoding = "); - out.write(Ice.Util.encodingVersionToString(v)); + out.write(com.zeroc.Ice.Util.encodingVersionToString(v)); } } catch(java.io.IOException ex) @@ -387,7 +388,7 @@ public final class TraceUtil } private static byte - printHeader(java.io.Writer out, Ice.InputStream stream) + printHeader(java.io.Writer out, com.zeroc.Ice.InputStream stream) { stream.readByte(); // Don't bother printing the magic number stream.readByte(); @@ -452,7 +453,7 @@ public final class TraceUtil } static private byte - printMessage(java.io.StringWriter s, Ice.InputStream str) + printMessage(java.io.StringWriter s, com.zeroc.Ice.InputStream str) { byte type = printHeader(s, str); diff --git a/java/src/Ice/src/main/java/IceInternal/Transceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java index c62c00984b6..9fa34e034ce 100644 --- a/java/src/Ice/src/main/java/IceInternal/Transceiver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public interface Transceiver { @@ -15,7 +15,7 @@ public interface Transceiver void setReadyCallback(ReadyCallback callback); int initialize(Buffer readBuffer, Buffer writeBuffer); - int closing(boolean initiator, Ice.LocalException ex); + int closing(boolean initiator, com.zeroc.Ice.LocalException ex); void close(); EndpointI bind(); @@ -26,7 +26,7 @@ public interface Transceiver @Override String toString(); String toDetailedString(); - Ice.ConnectionInfo getInfo(); + com.zeroc.Ice.ConnectionInfo getInfo(); void checkSendSize(Buffer buf); void setBufferSize(int rcvSize, int sndSize); } diff --git a/java/src/Ice/src/main/java/IceInternal/UdpConnector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpConnector.java index ad91ec7fba2..1b9b3a6cdd5 100644 --- a/java/src/Ice/src/main/java/IceInternal/UdpConnector.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpConnector.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class UdpConnector implements Connector { @@ -55,15 +55,15 @@ final class UdpConnector implements Connector _connectionId = connectionId; _hashCode = 5381; - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr.getPort()); + _hashCode = HashUtil.hashAdd(_hashCode , _addr.getAddress().getHostAddress()); + _hashCode = HashUtil.hashAdd(_hashCode , _addr.getPort()); if(_sourceAddr != null) { - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _sourceAddr.getAddress().getHostAddress()); + _hashCode = HashUtil.hashAdd(_hashCode , _sourceAddr.getAddress().getHostAddress()); } - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _mcastInterface); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _mcastTtl); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _connectionId); + _hashCode = HashUtil.hashAdd(_hashCode , _mcastInterface); + _hashCode = HashUtil.hashAdd(_hashCode , _mcastTtl); + _hashCode = HashUtil.hashAdd(_hashCode , _connectionId); } @Override diff --git a/java/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointFactory.java index 6683b57dcb9..0ce60175f5d 100644 --- a/java/src/Ice/src/main/java/IceInternal/UdpEndpointFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointFactory.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class UdpEndpointFactory implements EndpointFactory { @@ -37,7 +37,7 @@ final class UdpEndpointFactory implements EndpointFactory } @Override - public EndpointI read(Ice.InputStream s) + public EndpointI read(com.zeroc.Ice.InputStream s) { return new UdpEndpointI(_instance, s); } diff --git a/java/src/Ice/src/main/java/IceInternal/UdpEndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointI.java index 8c1d0bc837d..d11b031271f 100644 --- a/java/src/Ice/src/main/java/IceInternal/UdpEndpointI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpEndpointI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; + +import com.zeroc.Ice.EndpointParseException; final class UdpEndpointI extends IPEndpointI { @@ -28,10 +30,10 @@ final class UdpEndpointI extends IPEndpointI _compress = false; } - public UdpEndpointI(ProtocolInstance instance, Ice.InputStream s) + public UdpEndpointI(ProtocolInstance instance, com.zeroc.Ice.InputStream s) { super(instance, s); - if(s.getEncoding().equals(Ice.Util.Encoding_1_0)) + if(s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0)) { s.readByte(); s.readByte(); @@ -48,9 +50,9 @@ final class UdpEndpointI extends IPEndpointI // Return the endpoint information. // @Override - public Ice.EndpointInfo getInfo() + public com.zeroc.Ice.EndpointInfo getInfo() { - Ice.UDPEndpointInfo info = new Ice.UDPEndpointInfo() + com.zeroc.Ice.UDPEndpointInfo info = new com.zeroc.Ice.UDPEndpointInfo() { @Override public short type() @@ -251,13 +253,13 @@ final class UdpEndpointI extends IPEndpointI // Marshal the endpoint // @Override - public void streamWriteImpl(Ice.OutputStream s) + public void streamWriteImpl(com.zeroc.Ice.OutputStream s) { super.streamWriteImpl(s); - if(s.getEncoding().equals(Ice.Util.Encoding_1_0)) + if(s.getEncoding().equals(com.zeroc.Ice.Util.Encoding_1_0)) { - Ice.Util.Protocol_1_0.__write(s); - Ice.Util.Encoding_1_0.__write(s); + com.zeroc.Ice.Util.Protocol_1_0.ice_write(s); + com.zeroc.Ice.Util.Encoding_1_0.ice_write(s); } // Not transmitted. //s.writeBool(_connect); @@ -268,20 +270,20 @@ final class UdpEndpointI extends IPEndpointI public int hashInit(int h) { h = super.hashInit(h); - h = IceInternal.HashUtil.hashAdd(h, _mcastInterface); - h = IceInternal.HashUtil.hashAdd(h, _mcastTtl); - h = IceInternal.HashUtil.hashAdd(h, _connect); - h = IceInternal.HashUtil.hashAdd(h, _compress); + h = HashUtil.hashAdd(h, _mcastInterface); + h = HashUtil.hashAdd(h, _mcastTtl); + h = HashUtil.hashAdd(h, _connect); + h = HashUtil.hashAdd(h, _compress); return h; } @Override - public void fillEndpointInfo(Ice.IPEndpointInfo info) + public void fillEndpointInfo(com.zeroc.Ice.IPEndpointInfo info) { super.fillEndpointInfo(info); - if(info instanceof Ice.UDPEndpointInfo) + if(info instanceof com.zeroc.Ice.UDPEndpointInfo) { - Ice.UDPEndpointInfo udpInfo = (Ice.UDPEndpointInfo)info; + com.zeroc.Ice.UDPEndpointInfo udpInfo = (com.zeroc.Ice.UDPEndpointInfo)info; udpInfo.mcastInterface = _mcastInterface; udpInfo.mcastTtl = _mcastTtl; } @@ -299,8 +301,8 @@ final class UdpEndpointI extends IPEndpointI { if(argument != null) { - throw new Ice.EndpointParseException("unexpected argument `" + argument + - "' provided for -c option in " + endpoint); + throw new EndpointParseException("unexpected argument `" + argument + "' provided for -c option in " + + endpoint); } _connect = true; @@ -309,8 +311,8 @@ final class UdpEndpointI extends IPEndpointI { if(argument != null) { - throw new Ice.EndpointParseException("unexpected argument `" + argument + - "' provided for -z option in " + endpoint); + throw new EndpointParseException("unexpected argument `" + argument + "' provided for -z option in " + + endpoint); } _compress = true; @@ -319,29 +321,29 @@ final class UdpEndpointI extends IPEndpointI { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for " + option + " option in endpoint " + - endpoint); + throw new EndpointParseException("no argument provided for " + option + " option in endpoint " + + endpoint); } try { - Ice.EncodingVersion v = Ice.Util.stringToEncodingVersion(argument); + com.zeroc.Ice.EncodingVersion v = com.zeroc.Ice.Util.stringToEncodingVersion(argument); if(v.major != 1 || v.minor != 0) { _instance.logger().warning("deprecated udp endpoint option: " + option); } } - catch(Ice.VersionParseException e) + catch(com.zeroc.Ice.VersionParseException e) { - throw new Ice.EndpointParseException("invalid version `" + argument + "' in endpoint " + - endpoint + ":\n" + e.str); + throw new EndpointParseException("invalid version `" + argument + "' in endpoint " + endpoint + ":\n" + + e.str); } } else if(option.equals("--ttl")) { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for --ttl option in endpoint " + endpoint); + throw new EndpointParseException("no argument provided for --ttl option in endpoint " + endpoint); } try @@ -350,21 +352,19 @@ final class UdpEndpointI extends IPEndpointI } catch(NumberFormatException ex) { - throw new Ice.EndpointParseException("invalid TTL value `" + argument + "' in endpoint " + endpoint); + throw new EndpointParseException("invalid TTL value `" + argument + "' in endpoint " + endpoint); } if(_mcastTtl < 0) { - throw new Ice.EndpointParseException("TTL value `" + argument + "' out of range in endpoint " + - endpoint); + throw new EndpointParseException("TTL value `" + argument + "' out of range in endpoint " + endpoint); } } else if(option.equals("--interface")) { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for --interface option in endpoint " + - endpoint); + throw new EndpointParseException("no argument provided for --interface option in endpoint " + endpoint); } _mcastInterface = argument; } diff --git a/java/src/Ice/src/main/java/IceInternal/UdpTransceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpTransceiver.java index 1f4899f7bce..7090b6b27d4 100644 --- a/java/src/Ice/src/main/java/IceInternal/UdpTransceiver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/UdpTransceiver.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class UdpTransceiver implements Transceiver { @@ -33,7 +33,7 @@ final class UdpTransceiver implements Transceiver } @Override - public int closing(boolean initiator, Ice.LocalException ex) + public int closing(boolean initiator, com.zeroc.Ice.LocalException ex) { // // Nothing to do. @@ -139,7 +139,7 @@ final class UdpTransceiver implements Transceiver { if(_peerAddr == null) { - throw new Ice.SocketException(); // No peer has sent a datagram yet. + throw new com.zeroc.Ice.SocketException(); // No peer has sent a datagram yet. } ret = _fd.send(buf.b, _peerAddr); } @@ -147,11 +147,11 @@ final class UdpTransceiver implements Transceiver } catch(java.nio.channels.AsynchronousCloseException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } catch(java.net.PortUnreachableException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } catch(java.io.InterruptedIOException ex) { @@ -159,7 +159,7 @@ final class UdpTransceiver implements Transceiver } catch(java.io.IOException ex) { - throw new Ice.SocketException(ex); + throw new com.zeroc.Ice.SocketException(ex); } } @@ -204,11 +204,11 @@ final class UdpTransceiver implements Transceiver } catch(java.nio.channels.AsynchronousCloseException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } catch(java.net.PortUnreachableException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } catch(java.io.InterruptedIOException ex) { @@ -216,7 +216,7 @@ final class UdpTransceiver implements Transceiver } catch(java.io.IOException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } } @@ -290,15 +290,15 @@ final class UdpTransceiver implements Transceiver if(!intfs.isEmpty()) { s.append("\nlocal interfaces = "); - s.append(IceUtilInternal.StringUtil.joinString(intfs, ", ")); + s.append(com.zeroc.IceUtilInternal.StringUtil.joinString(intfs, ", ")); } return s.toString(); } @Override - public Ice.ConnectionInfo getInfo() + public com.zeroc.Ice.ConnectionInfo getInfo() { - Ice.UDPConnectionInfo info = new Ice.UDPConnectionInfo(); + com.zeroc.Ice.UDPConnectionInfo info = new com.zeroc.Ice.UDPConnectionInfo(); if(_fd != null) { java.net.DatagramSocket socket = _fd.socket(); @@ -344,7 +344,7 @@ final class UdpTransceiver implements Transceiver final int packetSize = java.lang.Math.min(_maxPacketSize, _sndSize - _udpOverhead); if(packetSize < buf.size()) { - throw new Ice.DatagramLimitException(); + throw new com.zeroc.Ice.DatagramLimitException(); } } @@ -385,7 +385,7 @@ final class UdpTransceiver implements Transceiver Network.doConnect(_fd, _addr, sourceAddr); _state = StateConnected; // We're connected now } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { _fd = null; throw ex; @@ -412,7 +412,7 @@ final class UdpTransceiver implements Transceiver setBufSize(-1, -1); Network.setBlock(_fd, false); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { _fd = null; throw ex; @@ -459,7 +459,7 @@ final class UdpTransceiver implements Transceiver // // Check for sanity. // - if(sizeRequested < (_udpOverhead + IceInternal.Protocol.headerSize)) + if(sizeRequested < (_udpOverhead + Protocol.headerSize)) { _instance.logger().warning("Invalid " + prop + " value of " + sizeRequested + " adjusted to " + dfltSize); @@ -493,7 +493,7 @@ final class UdpTransceiver implements Transceiver // if(sizeSet < sizeRequested) { - BufSizeWarnInfo winfo = _instance.getBufSizeWarn(Ice.UDPEndpointType.value); + BufSizeWarnInfo winfo = _instance.getBufSizeWarn(com.zeroc.Ice.UDPEndpointType.value); if((isSnd && (!winfo.sndWarn || winfo.sndSize != sizeRequested)) || (!isSnd && (!winfo.rcvWarn || winfo.rcvSize != sizeRequested))) { @@ -502,11 +502,11 @@ final class UdpTransceiver implements Transceiver if(isSnd) { - _instance.setSndBufSizeWarn(Ice.UDPEndpointType.value, sizeRequested); + _instance.setSndBufSizeWarn(com.zeroc.Ice.UDPEndpointType.value, sizeRequested); } else { - _instance.setRcvBufSizeWarn(Ice.UDPEndpointType.value, sizeRequested); + _instance.setRcvBufSizeWarn(com.zeroc.Ice.UDPEndpointType.value, sizeRequested); } } } @@ -582,7 +582,7 @@ final class UdpTransceiver implements Transceiver if(!join) { - throw new Ice.SocketException(new IllegalArgumentException( + throw new com.zeroc.Ice.SocketException(new IllegalArgumentException( "There are no interfaces that are configured for the group protocol.\n" + "Cannot join the multicast group.")); } @@ -603,7 +603,7 @@ final class UdpTransceiver implements Transceiver } catch(Exception ex) { - throw new Ice.SocketException(ex); + throw new com.zeroc.Ice.SocketException(ex); } } @@ -613,7 +613,7 @@ final class UdpTransceiver implements Transceiver { try { - IceUtilInternal.Assert.FinalizerAssert(_fd == null); + com.zeroc.IceUtilInternal.Assert.FinalizerAssert(_fd == null); } catch(java.lang.Exception ex) { diff --git a/java/src/Ice/src/main/java/IceInternal/Util.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Util.java index 46920d5d04d..77d57aa5837 100644 --- a/java/src/Ice/src/main/java/IceInternal/Util.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/Util.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.util.concurrent.ThreadFactory; public final class Util { static String - createThreadName(final Ice.Properties properties, final String name) + createThreadName(final com.zeroc.Ice.Properties properties, final String name) { String threadName = properties.getProperty("Ice.ProgramName"); if(threadName.length() > 0) @@ -27,7 +27,7 @@ public final class Util } static ThreadFactory - createThreadFactory(final Ice.Properties properties, final String name) + createThreadFactory(final com.zeroc.Ice.Properties properties, final String name) { return new java.util.concurrent.ThreadFactory() { @@ -47,14 +47,14 @@ public final class Util } public static Instance - getInstance(Ice.Communicator communicator) + getInstance(com.zeroc.Ice.Communicator communicator) { - Ice.CommunicatorI p = (Ice.CommunicatorI)communicator; + com.zeroc.Ice.CommunicatorI p = (com.zeroc.Ice.CommunicatorI)communicator; return p.getInstance(); } public static ProtocolPluginFacade - getProtocolPluginFacade(Ice.Communicator communicator) + getProtocolPluginFacade(com.zeroc.Ice.Communicator communicator) { return new ProtocolPluginFacadeI(communicator); } @@ -88,7 +88,7 @@ public final class Util // comment will produce this exception under Windows. // // URLClassLoader cl = new URLClassLoader(new URL[] {new URL("http://localhost:8080/")}); - // java.io.InputStream in = IceInternal.Util.openResource(cl, "c:\\foo.txt"); + // java.io.InputStream in = Util.openResource(cl, "c:\\foo.txt"); // } if(stream == null) @@ -203,7 +203,7 @@ public final class Util } public static int - getThreadPriorityProperty(Ice.Properties properties, String prefix) + getThreadPriorityProperty(com.zeroc.Ice.Properties properties, String prefix) { String pri = properties.getProperty(prefix + ".ThreadPriority"); if(pri.equals("MIN_PRIORITY") || pri.equals("java.lang.Thread.MIN_PRIORITY")) diff --git a/java/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueFactoryManagerI.java index dfd51f0cbd5..da94133eed3 100644 --- a/java/src/Ice/src/main/java/IceInternal/ValueFactoryManagerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueFactoryManagerI.java @@ -7,16 +7,18 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -final class ValueFactoryManagerI implements Ice.ValueFactoryManager +import com.zeroc.Ice.ValueFactory; + +final class ValueFactoryManagerI implements com.zeroc.Ice.ValueFactoryManager { - public synchronized void add(Ice.ValueFactory factory, String id) + public synchronized void add(ValueFactory factory, String id) { Object o = _factoryMap.get(id); if(o != null) { - Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); + com.zeroc.Ice.AlreadyRegisteredException ex = new com.zeroc.Ice.AlreadyRegisteredException(); ex.id = id; ex.kindOfObject = "value factory"; throw ex; @@ -24,10 +26,10 @@ final class ValueFactoryManagerI implements Ice.ValueFactoryManager _factoryMap.put(id, factory); } - public synchronized Ice.ValueFactory find(String id) + public synchronized ValueFactory find(String id) { return _factoryMap.get(id); } - private java.util.Map<String, Ice.ValueFactory> _factoryMap = new java.util.HashMap<String, Ice.ValueFactory>(); + private java.util.Map<String, ValueFactory> _factoryMap = new java.util.HashMap<>(); } diff --git a/java/src/Ice/src/main/java/IceInternal/ValueWriter.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueWriter.java index 3184c250734..45f4c8e8a94 100644 --- a/java/src/Ice/src/main/java/IceInternal/ValueWriter.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/ValueWriter.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; public final class ValueWriter { public static void - write(java.lang.Object obj, IceUtilInternal.OutputBase out) + write(java.lang.Object obj, com.zeroc.IceUtilInternal.OutputBase out) { writeValue(null, obj, null, out); } private static void writeValue(String name, java.lang.Object value, java.util.Map<java.lang.Object, java.lang.Object> objectTable, - IceUtilInternal.OutputBase out) + com.zeroc.IceUtilInternal.OutputBase out) { if(value == null) { @@ -80,13 +80,13 @@ public final class ValueWriter writeValue(elem + "value", entry.getValue(), objectTable, out); } } - else if(value instanceof Ice.ObjectPrxHelperBase) + else if(value instanceof com.zeroc.Ice._ObjectPrxI) { writeName(name, out); - Ice.ObjectPrxHelperBase proxy = (Ice.ObjectPrxHelperBase)value; + com.zeroc.Ice._ObjectPrxI proxy = (com.zeroc.Ice._ObjectPrxI)value; out.print(proxy.__reference().toString()); } - else if(value instanceof Ice.Object) + else if(value instanceof com.zeroc.Ice.Value) { // // Check for recursion. @@ -123,7 +123,7 @@ public final class ValueWriter private static void writeFields(String name, java.lang.Object obj, Class<?> c, - java.util.Map<java.lang.Object, java.lang.Object> objectTable, IceUtilInternal.OutputBase out) + java.util.Map<java.lang.Object, java.lang.Object> objectTable, com.zeroc.IceUtilInternal.OutputBase out) { if(!c.equals(java.lang.Object.class)) { @@ -180,7 +180,7 @@ public final class ValueWriter } private static void - writeName(String name, IceUtilInternal.OutputBase out) + writeName(String name, com.zeroc.IceUtilInternal.OutputBase out) { if(name != null) { diff --git a/java/src/Ice/src/main/java/IceInternal/WSAcceptor.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSAcceptor.java index 4b87907a671..0e8b0d1ecb8 100644 --- a/java/src/Ice/src/main/java/IceInternal/WSAcceptor.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSAcceptor.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -final class WSAcceptor implements IceInternal.Acceptor +final class WSAcceptor implements Acceptor { @Override public java.nio.channels.ServerSocketChannel fd() @@ -37,7 +37,7 @@ final class WSAcceptor implements IceInternal.Acceptor } @Override - public IceInternal.Transceiver accept() + public Transceiver accept() { // // WebSocket handshaking is performed in TransceiverI::initialize, since @@ -69,7 +69,7 @@ final class WSAcceptor implements IceInternal.Acceptor return _delegate; } - WSAcceptor(WSEndpoint endpoint, ProtocolInstance instance, IceInternal.Acceptor del) + WSAcceptor(WSEndpoint endpoint, ProtocolInstance instance, Acceptor del) { _endpoint = endpoint; _instance = instance; @@ -78,5 +78,5 @@ final class WSAcceptor implements IceInternal.Acceptor private WSEndpoint _endpoint; private ProtocolInstance _instance; - private IceInternal.Acceptor _delegate; + private Acceptor _delegate; } diff --git a/java/src/Ice/src/main/java/IceInternal/WSConnector.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSConnector.java index 3c9ecc7e06b..cf4fff54e2c 100644 --- a/java/src/Ice/src/main/java/IceInternal/WSConnector.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSConnector.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class WSConnector implements Connector { diff --git a/java/src/Ice/src/main/java/IceInternal/WSEndpoint.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpoint.java index 91ea36d1a62..8f15c5a324c 100644 --- a/java/src/Ice/src/main/java/IceInternal/WSEndpoint.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpoint.java @@ -7,9 +7,11 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; -final class WSEndpoint extends IceInternal.EndpointI +import com.zeroc.Ice.WSEndpointInfo; + +final class WSEndpoint extends EndpointI { public WSEndpoint(ProtocolInstance instance, EndpointI del, String res) { @@ -31,7 +33,7 @@ final class WSEndpoint extends IceInternal.EndpointI } } - public WSEndpoint(ProtocolInstance instance, EndpointI del, Ice.InputStream s) + public WSEndpoint(ProtocolInstance instance, EndpointI del, com.zeroc.Ice.InputStream s) { _instance = instance; _delegate = del; @@ -39,9 +41,9 @@ final class WSEndpoint extends IceInternal.EndpointI } @Override - public Ice.EndpointInfo getInfo() + public com.zeroc.Ice.EndpointInfo getInfo() { - Ice.WSEndpointInfo info = new Ice.WSEndpointInfo(_delegate.getInfo(), timeout(), compress(), _resource) + WSEndpointInfo info = new WSEndpointInfo(_delegate.getInfo(), timeout(), compress(), _resource) { @Override public short type() @@ -79,7 +81,7 @@ final class WSEndpoint extends IceInternal.EndpointI } @Override - public void streamWriteImpl(Ice.OutputStream s) + public void streamWriteImpl(com.zeroc.Ice.OutputStream s) { _delegate.streamWriteImpl(s); s.writeString(_resource); @@ -161,14 +163,14 @@ final class WSEndpoint extends IceInternal.EndpointI } @Override - public void connectors_async(Ice.EndpointSelectionType selType, final EndpointI_connectors callback) + public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, final EndpointI_connectors callback) { - Ice.IPEndpointInfo ipInfo = null; - for(Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying) + com.zeroc.Ice.IPEndpointInfo ipInfo = null; + for(com.zeroc.Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying) { - if(p instanceof Ice.IPEndpointInfo) + if(p instanceof com.zeroc.Ice.IPEndpointInfo) { - ipInfo = (Ice.IPEndpointInfo)p; + ipInfo = (com.zeroc.Ice.IPEndpointInfo)p; } } final String host = ipInfo != null ? (ipInfo.host + ":" + ipInfo.port) : ""; @@ -177,7 +179,7 @@ final class WSEndpoint extends IceInternal.EndpointI @Override public void connectors(java.util.List<Connector> connectors) { - java.util.List<Connector> l = new java.util.ArrayList<Connector>(); + java.util.List<Connector> l = new java.util.ArrayList<>(); for(Connector c : connectors) { l.add(new WSConnector(_instance, c, host, _resource)); @@ -186,7 +188,7 @@ final class WSEndpoint extends IceInternal.EndpointI } @Override - public void exception(Ice.LocalException ex) + public void exception(com.zeroc.Ice.LocalException ex) { callback.exception(ex); } @@ -210,7 +212,7 @@ final class WSEndpoint extends IceInternal.EndpointI public java.util.List<EndpointI> expand() { java.util.List<EndpointI> endps = _delegate.expand(); - java.util.List<EndpointI> l = new java.util.ArrayList<EndpointI>(); + java.util.List<EndpointI> l = new java.util.ArrayList<>(); for(EndpointI e : endps) { l.add(e == _delegate ? this : new WSEndpoint(_instance, e, _resource)); @@ -233,7 +235,7 @@ final class WSEndpoint extends IceInternal.EndpointI synchronized public int hashCode() { int h = _delegate.hashCode(); - h = IceInternal.HashUtil.hashAdd(h, _resource); + h = HashUtil.hashAdd(h, _resource); return h; } @@ -304,8 +306,8 @@ final class WSEndpoint extends IceInternal.EndpointI { if(argument == null) { - throw new Ice.EndpointParseException("no argument provided for -r option in endpoint " + endpoint + - _delegate.options()); + throw new com.zeroc.Ice.EndpointParseException("no argument provided for -r option in endpoint " + + endpoint + _delegate.options()); } _resource = argument; return true; diff --git a/java/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpointFactory.java index 493cddfd5eb..0c5c0ba1498 100644 --- a/java/src/Ice/src/main/java/IceInternal/WSEndpointFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSEndpointFactory.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final public class WSEndpointFactory implements EndpointFactory { @@ -36,7 +36,7 @@ final public class WSEndpointFactory implements EndpointFactory } @Override - public EndpointI read(Ice.InputStream s) + public EndpointI read(com.zeroc.Ice.InputStream s) { return new WSEndpoint(_instance, _delegate.read(s), s); } diff --git a/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSTransceiver.java index 8188ab322c8..63d7325b599 100644 --- a/java/src/Ice/src/main/java/IceInternal/WSTransceiver.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WSTransceiver.java @@ -7,9 +7,10 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; import java.security.*; +import java.util.Base64; final class WSTransceiver implements Transceiver { @@ -74,12 +75,11 @@ final class WSTransceiver implements Transceiver out.append("Sec-WebSocket-Key: "); // - // The value for Sec-WebSocket-Key is a 16-byte random number, - // encoded with Base64. + // The value for Sec-WebSocket-Key is a 16-byte random number, encoded with Base64. // byte[] key = new byte[16]; _rand.nextBytes(key); - _key = IceUtilInternal.Base64.encode(key); + _key = Base64.getEncoder().encodeToString(key); out.append(_key + "\r\n\r\n"); // EOM _writeBuffer.resize(out.length(), false); @@ -140,7 +140,7 @@ final class WSTransceiver implements Transceiver final int oldSize = _readBuffer.b.position(); if(oldSize + 1024 > _instance.messageSizeMax()) { - throw new Ice.MemoryLimitException(); + throw new com.zeroc.Ice.MemoryLimitException(); } _readBuffer.resize(oldSize + 1024, true); _readBuffer.b.position(oldSize); @@ -173,7 +173,7 @@ final class WSTransceiver implements Transceiver } else { - throw new Ice.ProtocolException("incomplete request message"); + throw new com.zeroc.Ice.ProtocolException("incomplete request message"); } } @@ -201,14 +201,14 @@ final class WSTransceiver implements Transceiver } else { - throw new Ice.ProtocolException("incomplete response message"); + throw new com.zeroc.Ice.ProtocolException("incomplete response message"); } } } } catch(WebSocketException ex) { - throw new Ice.ProtocolException(ex.getMessage()); + throw new com.zeroc.Ice.ProtocolException(ex.getMessage(), ex); } _state = StateOpened; @@ -219,7 +219,7 @@ final class WSTransceiver implements Transceiver _readyCallback.ready(SocketOperation.Read, true); } } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { if(_instance.traceLevel() >= 2) { @@ -247,7 +247,7 @@ final class WSTransceiver implements Transceiver } @Override - public int closing(boolean initiator, Ice.LocalException reason) + public int closing(boolean initiator, com.zeroc.Ice.LocalException reason) { if(_instance.traceLevel() >= 1) { @@ -277,20 +277,20 @@ final class WSTransceiver implements Transceiver } _closingInitiator = initiator; - if(reason instanceof Ice.CloseConnectionException) + if(reason instanceof com.zeroc.Ice.CloseConnectionException) { _closingReason = CLOSURE_NORMAL; } - else if(reason instanceof Ice.ObjectAdapterDeactivatedException || - reason instanceof Ice.CommunicatorDestroyedException) + else if(reason instanceof com.zeroc.Ice.ObjectAdapterDeactivatedException || + reason instanceof com.zeroc.Ice.CommunicatorDestroyedException) { _closingReason = CLOSURE_SHUTDOWN; } - else if(reason instanceof Ice.ProtocolException) + else if(reason instanceof com.zeroc.Ice.ProtocolException) { _closingReason = CLOSURE_PROTOCOL_ERROR; } - else if(reason instanceof Ice.MemoryLimitException) + else if(reason instanceof com.zeroc.Ice.MemoryLimitException) { _closingReason = CLOSURE_TOO_BIG; } @@ -495,9 +495,9 @@ final class WSTransceiver implements Transceiver } @Override - public Ice.ConnectionInfo getInfo() + public com.zeroc.Ice.ConnectionInfo getInfo() { - Ice.WSConnectionInfo info = new Ice.WSConnectionInfo(); + com.zeroc.Ice.WSConnectionInfo info = new com.zeroc.Ice.WSConnectionInfo(); info.underlying = _delegate.getInfo(); info.headers = _parser.getHeaders(); return info; @@ -636,7 +636,7 @@ final class WSTransceiver implements Transceiver val = _parser.getHeader("Sec-WebSocket-Protocol", true); if(val != null) { - String[] protocols = IceUtilInternal.StringUtil.splitString(val, ","); + String[] protocols = com.zeroc.IceUtilInternal.StringUtil.splitString(val, ","); if(protocols == null) { throw new WebSocketException("invalid value `" + val + "' for WebSocket protocol"); @@ -661,7 +661,7 @@ final class WSTransceiver implements Transceiver throw new WebSocketException("missing value for WebSocket key"); } - byte[] decodedKey = IceUtilInternal.Base64.decode(key); + byte[] decodedKey = Base64.getDecoder().decode(key); if(decodedKey.length != 16) { throw new WebSocketException("invalid value `" + key + "' for WebSocket key"); @@ -701,7 +701,7 @@ final class WSTransceiver implements Transceiver final MessageDigest sha1 = MessageDigest.getInstance("SHA1"); sha1.update(input.getBytes(_ascii)); final byte[] hash = sha1.digest(); - out.append(IceUtilInternal.Base64.encode(hash) + "\r\n" + "\r\n"); // EOM + out.append(Base64.getEncoder().encodeToString(hash) + "\r\n" + "\r\n"); // EOM } catch(NoSuchAlgorithmException ex) { @@ -811,7 +811,7 @@ final class WSTransceiver implements Transceiver final String input = _key + _wsUUID; final MessageDigest sha1 = MessageDigest.getInstance("SHA1"); sha1.update(input.getBytes(_ascii)); - if(!val.equals(IceUtilInternal.Base64.encode(sha1.digest()))) + if(!val.equals(Base64.getEncoder().encodeToString(sha1.digest()))) { throw new WebSocketException("invalid value `" + val + "' for Sec-WebSocket-Accept"); } @@ -857,7 +857,7 @@ final class WSTransceiver implements Transceiver { if(!_readLastFrame) { - throw new Ice.ProtocolException("invalid data frame, no FIN on previous frame"); + throw new com.zeroc.Ice.ProtocolException("invalid data frame, no FIN on previous frame"); } _readLastFrame = (ch & FLAG_FINAL) == FLAG_FINAL; } @@ -865,7 +865,7 @@ final class WSTransceiver implements Transceiver { if(_readLastFrame) { - throw new Ice.ProtocolException("invalid continuation frame, previous frame FIN set"); + throw new com.zeroc.Ice.ProtocolException("invalid continuation frame, previous frame FIN set"); } _readLastFrame = (ch & FLAG_FINAL) == FLAG_FINAL; } @@ -883,7 +883,7 @@ final class WSTransceiver implements Transceiver final boolean masked = (ch & FLAG_MASKED) == FLAG_MASKED; if(masked != _incoming) { - throw new Ice.ProtocolException("invalid masking"); + throw new com.zeroc.Ice.ProtocolException("invalid masking"); } // @@ -939,7 +939,7 @@ final class WSTransceiver implements Transceiver _readBufferPos += 8; if(l < 0 || l > Integer.MAX_VALUE) { - throw new Ice.ProtocolException("invalid WebSocket payload length: " + l); + throw new com.zeroc.Ice.ProtocolException("invalid WebSocket payload length: " + l); } _readPayloadLength = (int)l; } @@ -960,7 +960,7 @@ final class WSTransceiver implements Transceiver { case OP_TEXT: // Text frame { - throw new Ice.ProtocolException("text frames not supported"); + throw new com.zeroc.Ice.ProtocolException("text frames not supported"); } case OP_CONT: // Continuation frame case OP_DATA: // Data frame @@ -975,7 +975,7 @@ final class WSTransceiver implements Transceiver if(_readPayloadLength <= 0) { - throw new Ice.ProtocolException("payload length is 0"); + throw new com.zeroc.Ice.ProtocolException("payload length is 0"); } _readState = ReadStatePayload; assert(buf.b.hasRemaining()); @@ -1014,7 +1014,7 @@ final class WSTransceiver implements Transceiver } else { - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); } } case OP_PING: @@ -1039,7 +1039,7 @@ final class WSTransceiver implements Transceiver } default: { - throw new Ice.ProtocolException("unsupported opcode: " + _readOpCode); + throw new com.zeroc.Ice.ProtocolException("unsupported opcode: " + _readOpCode); } } } @@ -1374,7 +1374,7 @@ final class WSTransceiver implements Transceiver } else { - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); } } else if(_state == StateClosed) diff --git a/java/src/Ice/src/main/java/IceInternal/WebSocketException.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WebSocketException.java index cee046461cb..d8b3b4b6e23 100644 --- a/java/src/Ice/src/main/java/IceInternal/WebSocketException.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/WebSocketException.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceInternal; +package com.zeroc.IceInternal; final class WebSocketException extends java.lang.RuntimeException { diff --git a/java/src/Ice/src/main/java/IceMX/MetricsHelper.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/MetricsHelper.java index 84dfc57d19f..4f769fc1aa5 100644 --- a/java/src/Ice/src/main/java/IceMX/MetricsHelper.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/MetricsHelper.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceMX; +package com.zeroc.IceMX; public class MetricsHelper<T> { @@ -140,13 +140,13 @@ public class MetricsHelper<T> { // If we're dealing with an endpoint/connection information class, // check if the field is from the underlying info objects. - if(o instanceof Ice.EndpointInfo) + if(o instanceof com.zeroc.Ice.EndpointInfo) { - o = ((Ice.EndpointInfo)o).underlying; + o = ((com.zeroc.Ice.EndpointInfo)o).underlying; } - else if(o instanceof Ice.ConnectionInfo) + else if(o instanceof com.zeroc.Ice.ConnectionInfo) { - o = ((Ice.ConnectionInfo)o).underlying; + o = ((com.zeroc.Ice.ConnectionInfo)o).underlying; } else { @@ -157,7 +157,7 @@ public class MetricsHelper<T> throw new IllegalArgumentException(name); } - private java.util.Map<String, Resolver> _attributes = new java.util.HashMap<String, Resolver>(); + private java.util.Map<String, Resolver> _attributes = new java.util.HashMap<>(); } protected diff --git a/java/src/Ice/src/main/java/IceMX/Observer.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/Observer.java index deec790deff..0474ca87f49 100644 --- a/java/src/Ice/src/main/java/IceMX/Observer.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/Observer.java @@ -7,11 +7,12 @@ // // ********************************************************************** -package IceMX; +package com.zeroc.IceMX; -import IceInternal.MetricsMap; +import com.zeroc.IceInternal.MetricsMap; -public class Observer<T extends Metrics> extends IceUtilInternal.StopWatch implements Ice.Instrumentation.Observer +public class Observer<T extends Metrics> extends com.zeroc.IceUtilInternal.StopWatch + implements com.zeroc.Ice.Instrumentation.Observer { public interface MetricsUpdate<T> { @@ -94,7 +95,7 @@ public class Observer<T extends Metrics> extends IceUtilInternal.StopWatch imple { if(metricsObjects == null) { - metricsObjects = new java.util.ArrayList<MetricsMap<S>.Entry>(_objects.size()); + metricsObjects = new java.util.ArrayList<>(_objects.size()); } metricsObjects.add(e); } diff --git a/java/src/Ice/src/main/java/IceMX/ObserverFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java index ca06b0a8c00..d0df4bcc5d4 100644 --- a/java/src/Ice/src/main/java/IceMX/ObserverFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactory.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceMX; +package com.zeroc.IceMX; -import IceInternal.MetricsMap; +import com.zeroc.IceInternal.MetricsMap; public class ObserverFactory<T extends Metrics, O extends Observer<T>> { public - ObserverFactory(IceInternal.MetricsAdminI metrics, String name, Class<T> cl) + ObserverFactory(com.zeroc.IceInternal.MetricsAdminI metrics, String name, Class<T> cl) { _metrics = metrics; _name = name; @@ -65,7 +65,7 @@ public class ObserverFactory<T extends Metrics, O extends Observer<T>> { if(metricsObjects == null) { - metricsObjects = new java.util.ArrayList<MetricsMap<T>.Entry>(_maps.size()); + metricsObjects = new java.util.ArrayList<>(_maps.size()); } metricsObjects.add(e); } @@ -94,7 +94,7 @@ public class ObserverFactory<T extends Metrics, O extends Observer<T>> return obsv; } - public <S extends IceMX.Metrics> void + public <S extends com.zeroc.IceMX.Metrics> void registerSubMap(String subMap, Class<S> cl, java.lang.reflect.Field field) { _metrics.registerSubMap(_name, subMap, cl, field); @@ -133,10 +133,10 @@ public class ObserverFactory<T extends Metrics, O extends Observer<T>> _updater = updater; } - private final IceInternal.MetricsAdminI _metrics; + private final com.zeroc.IceInternal.MetricsAdminI _metrics; private final String _name; private final Class<T> _class; - private java.util.List<MetricsMap<T>> _maps = new java.util.ArrayList<MetricsMap<T>>(); + private java.util.List<MetricsMap<T>> _maps = new java.util.ArrayList<>(); private volatile boolean _enabled; private Runnable _updater; } diff --git a/java/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactoryWithDelegate.java index 9e0e01c2949..9854fef1f9f 100644 --- a/java/src/Ice/src/main/java/IceMX/ObserverFactoryWithDelegate.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverFactoryWithDelegate.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceMX; +package com.zeroc.IceMX; public class ObserverFactoryWithDelegate<T extends Metrics, OImpl extends ObserverWithDelegate<T, O>, - O extends Ice.Instrumentation.Observer> + O extends com.zeroc.Ice.Instrumentation.Observer> extends ObserverFactory<T, OImpl> { public - ObserverFactoryWithDelegate(IceInternal.MetricsAdminI metrics, String name, Class<T> cl) + ObserverFactoryWithDelegate(com.zeroc.IceInternal.MetricsAdminI metrics, String name, Class<T> cl) { super(metrics, name, cl); } diff --git a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegate.java index 94b09bb9821..242906b27ce 100644 --- a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegate.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegate.java @@ -7,9 +7,10 @@ // // ********************************************************************** -package IceMX; +package com.zeroc.IceMX; -public class ObserverWithDelegate<T extends Metrics, O extends Ice.Instrumentation.Observer> extends Observer<T> +public class ObserverWithDelegate<T extends Metrics, O extends com.zeroc.Ice.Instrumentation.Observer> + extends Observer<T> { @Override public void @@ -58,7 +59,7 @@ public class ObserverWithDelegate<T extends Metrics, O extends Ice.Instrumentati @SuppressWarnings("unchecked") public <S extends Metrics, ObserverImpl extends ObserverWithDelegate<S, Obs>, - Obs extends Ice.Instrumentation.Observer> Obs + Obs extends com.zeroc.Ice.Instrumentation.Observer> Obs getObserver(String mapName, MetricsHelper<S> helper, Class<S> mcl, Class<ObserverImpl> ocl, Obs delegate) { ObserverImpl obsv = super.getObserver(mapName, helper, mcl, ocl); diff --git a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegateI.java index f146b9f9780..d0b02d96abf 100644 --- a/java/src/Ice/src/main/java/IceMX/ObserverWithDelegateI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceMX/ObserverWithDelegateI.java @@ -7,8 +7,8 @@ // // ********************************************************************** -package IceMX; +package com.zeroc.IceMX; -public class ObserverWithDelegateI extends ObserverWithDelegate<Metrics, Ice.Instrumentation.Observer> +public class ObserverWithDelegateI extends ObserverWithDelegate<Metrics, com.zeroc.Ice.Instrumentation.Observer> { } diff --git a/java/src/Ice/src/main/java/IceSSL/AcceptorI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/AcceptorI.java index bf21888839e..f0df8ffe4ae 100644 --- a/java/src/Ice/src/main/java/IceSSL/AcceptorI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/AcceptorI.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; -final class AcceptorI implements IceInternal.Acceptor +final class AcceptorI implements com.zeroc.IceInternal.Acceptor { @Override public java.nio.channels.ServerSocketChannel fd() @@ -18,7 +18,7 @@ final class AcceptorI implements IceInternal.Acceptor } @Override - public void setReadyCallback(IceInternal.ReadyCallback callback) + public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback) { _delegate.setReadyCallback(callback); } @@ -30,21 +30,21 @@ final class AcceptorI implements IceInternal.Acceptor } @Override - public IceInternal.EndpointI listen() + public com.zeroc.IceInternal.EndpointI listen() { _endpoint = _endpoint.endpoint(_delegate.listen()); return _endpoint; } @Override - public IceInternal.Transceiver accept() + public com.zeroc.IceInternal.Transceiver accept() { // // The plug-in may not be fully initialized. // if(!_instance.initialized()) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + com.zeroc.Ice.PluginInitializationException ex = new com.zeroc.Ice.PluginInitializationException(); ex.reason = "IceSSL: plug-in is not initialized"; throw ex; } @@ -70,7 +70,7 @@ final class AcceptorI implements IceInternal.Acceptor return _delegate.toDetailedString(); } - AcceptorI(EndpointI endpoint, Instance instance, IceInternal.Acceptor delegate, String adapterName) + AcceptorI(EndpointI endpoint, Instance instance, com.zeroc.IceInternal.Acceptor delegate, String adapterName) { _endpoint = endpoint; _instance = instance; @@ -80,6 +80,6 @@ final class AcceptorI implements IceInternal.Acceptor private EndpointI _endpoint; private Instance _instance; - private IceInternal.Acceptor _delegate; + private com.zeroc.IceInternal.Acceptor _delegate; private String _adapterName; } diff --git a/java/src/Ice/src/main/java/IceSSL/CertificateVerifier.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/CertificateVerifier.java index 4aaa6b91f11..da27b27c76e 100644 --- a/java/src/Ice/src/main/java/IceSSL/CertificateVerifier.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/CertificateVerifier.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; /** * An application can customize the certificate verification process diff --git a/java/src/Ice/src/main/java/IceSSL/ConnectorI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/ConnectorI.java index d463a89bf3d..cb86f2920cf 100644 --- a/java/src/Ice/src/main/java/IceSSL/ConnectorI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/ConnectorI.java @@ -7,19 +7,21 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; -final class ConnectorI implements IceInternal.Connector +import com.zeroc.IceInternal.Network; + +final class ConnectorI implements com.zeroc.IceInternal.Connector { @Override - public IceInternal.Transceiver connect() + public com.zeroc.IceInternal.Transceiver connect() { // // The plug-in may not be fully initialized. // if(!_instance.initialized()) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + com.zeroc.Ice.PluginInitializationException ex = new com.zeroc.Ice.PluginInitializationException(); ex.reason = "IceSSL: plug-in is not initialized"; throw ex; } @@ -48,7 +50,7 @@ final class ConnectorI implements IceInternal.Connector // // Only for use by EndpointI. // - ConnectorI(Instance instance, IceInternal.Connector delegate, String host) + ConnectorI(Instance instance, com.zeroc.IceInternal.Connector delegate, String host) { _instance = instance; _delegate = delegate; @@ -73,6 +75,6 @@ final class ConnectorI implements IceInternal.Connector } private Instance _instance; - private IceInternal.Connector _delegate; + private com.zeroc.IceInternal.Connector _delegate; private String _host; } diff --git a/java/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointFactoryI.java index ffe402c6193..73b41deb9c4 100644 --- a/java/src/Ice/src/main/java/IceSSL/EndpointFactoryI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointFactoryI.java @@ -7,11 +7,13 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; -final class EndpointFactoryI implements IceInternal.EndpointFactory +import com.zeroc.IceInternal.EndpointFactory; + +final class EndpointFactoryI implements EndpointFactory { - EndpointFactoryI(Instance instance, IceInternal.EndpointFactory delegate) + EndpointFactoryI(Instance instance, EndpointFactory delegate) { _instance = instance; _delegate = delegate; @@ -30,13 +32,13 @@ final class EndpointFactoryI implements IceInternal.EndpointFactory } @Override - public IceInternal.EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint) + public com.zeroc.IceInternal.EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint) { return new EndpointI(_instance, _delegate.create(args, oaEndpoint)); } @Override - public IceInternal.EndpointI read(Ice.InputStream s) + public com.zeroc.IceInternal.EndpointI read(com.zeroc.Ice.InputStream s) { return new EndpointI(_instance, _delegate.read(s)); } @@ -49,12 +51,12 @@ final class EndpointFactoryI implements IceInternal.EndpointFactory } @Override - public IceInternal.EndpointFactory clone(IceInternal.ProtocolInstance inst, IceInternal.EndpointFactory delegate) + public EndpointFactory clone(com.zeroc.IceInternal.ProtocolInstance inst, EndpointFactory delegate) { Instance instance = new Instance(_instance.engine(), inst.type(), inst.protocol()); return new EndpointFactoryI(instance, delegate != null ? delegate : _delegate.clone(instance, null)); } private Instance _instance; - private IceInternal.EndpointFactory _delegate; + private com.zeroc.IceInternal.EndpointFactory _delegate; } diff --git a/java/src/Ice/src/main/java/IceSSL/EndpointI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointI.java index 08de48c2f11..e7120a73f9c 100644 --- a/java/src/Ice/src/main/java/IceSSL/EndpointI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/EndpointI.java @@ -7,18 +7,18 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; -final class EndpointI extends IceInternal.EndpointI +final class EndpointI extends com.zeroc.IceInternal.EndpointI { - public EndpointI(Instance instance, IceInternal.EndpointI delegate) + public EndpointI(Instance instance, com.zeroc.IceInternal.EndpointI delegate) { _instance = instance; _delegate = delegate; } @Override - public void streamWriteImpl(Ice.OutputStream s) + public void streamWriteImpl(com.zeroc.Ice.OutputStream s) { _delegate.streamWriteImpl(s); } @@ -27,9 +27,9 @@ final class EndpointI extends IceInternal.EndpointI // Return the endpoint information. // @Override - public Ice.EndpointInfo getInfo() + public com.zeroc.Ice.EndpointInfo getInfo() { - IceSSL.EndpointInfo info = new IceSSL.EndpointInfo(_delegate.getInfo(), timeout(), compress()) + EndpointInfo info = new EndpointInfo(_delegate.getInfo(), timeout(), compress()) { @Override public short type() @@ -73,7 +73,7 @@ final class EndpointI extends IceInternal.EndpointI } @Override - public IceInternal.EndpointI timeout(int timeout) + public com.zeroc.IceInternal.EndpointI timeout(int timeout) { if(timeout == _delegate.timeout()) { @@ -92,7 +92,7 @@ final class EndpointI extends IceInternal.EndpointI } @Override - public IceInternal.EndpointI connectionId(String connectionId) + public com.zeroc.IceInternal.EndpointI connectionId(String connectionId) { if(connectionId == _delegate.connectionId()) { @@ -111,7 +111,7 @@ final class EndpointI extends IceInternal.EndpointI } @Override - public IceInternal.EndpointI compress(boolean compress) + public com.zeroc.IceInternal.EndpointI compress(boolean compress) { if(compress == _delegate.compress()) { @@ -140,30 +140,32 @@ final class EndpointI extends IceInternal.EndpointI // transceiver can only be created by an acceptor. // @Override - public IceInternal.Transceiver transceiver() + public com.zeroc.IceInternal.Transceiver transceiver() { return null; } @Override - public void connectors_async(Ice.EndpointSelectionType selType, final IceInternal.EndpointI_connectors callback) + public void connectors_async(com.zeroc.Ice.EndpointSelectionType selType, + final com.zeroc.IceInternal.EndpointI_connectors callback) { - Ice.IPEndpointInfo ipInfo = null; - for(Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying) + com.zeroc.Ice.IPEndpointInfo ipInfo = null; + for(com.zeroc.Ice.EndpointInfo p = _delegate.getInfo(); p != null; p = p.underlying) { - if(p instanceof Ice.IPEndpointInfo) + if(p instanceof com.zeroc.Ice.IPEndpointInfo) { - ipInfo = (Ice.IPEndpointInfo)p; + ipInfo = (com.zeroc.Ice.IPEndpointInfo)p; } } final String host = ipInfo != null ? ipInfo.host : ""; - IceInternal.EndpointI_connectors cb = new IceInternal.EndpointI_connectors() + com.zeroc.IceInternal.EndpointI_connectors cb = new com.zeroc.IceInternal.EndpointI_connectors() { @Override - public void connectors(java.util.List<IceInternal.Connector> connectors) + public void connectors(java.util.List<com.zeroc.IceInternal.Connector> connectors) { - java.util.List<IceInternal.Connector> l = new java.util.ArrayList<IceInternal.Connector>(); - for(IceInternal.Connector c : connectors) + java.util.List<com.zeroc.IceInternal.Connector> l = + new java.util.ArrayList<com.zeroc.IceInternal.Connector>(); + for(com.zeroc.IceInternal.Connector c : connectors) { l.add(new ConnectorI(_instance, c, host)); } @@ -171,7 +173,7 @@ final class EndpointI extends IceInternal.EndpointI } @Override - public void exception(Ice.LocalException ex) + public void exception(com.zeroc.Ice.LocalException ex) { callback.exception(ex); } @@ -184,22 +186,22 @@ final class EndpointI extends IceInternal.EndpointI // is available. // @Override - public IceInternal.Acceptor acceptor(String adapterName) + public com.zeroc.IceInternal.Acceptor acceptor(String adapterName) { return new AcceptorI(this, _instance, _delegate.acceptor(adapterName), adapterName); } - public EndpointI endpoint(IceInternal.EndpointI delEndpt) + public EndpointI endpoint(com.zeroc.IceInternal.EndpointI delEndpt) { return new EndpointI(_instance, delEndpt); } @Override - public java.util.List<IceInternal.EndpointI> expand() + public java.util.List<com.zeroc.IceInternal.EndpointI> expand() { - java.util.List<IceInternal.EndpointI> endps = _delegate.expand(); - java.util.List<IceInternal.EndpointI> l = new java.util.ArrayList<IceInternal.EndpointI>(); - for(IceInternal.EndpointI e : endps) + java.util.List<com.zeroc.IceInternal.EndpointI> endps = _delegate.expand(); + java.util.List<com.zeroc.IceInternal.EndpointI> l = new java.util.ArrayList<com.zeroc.IceInternal.EndpointI>(); + for(com.zeroc.IceInternal.EndpointI e : endps) { l.add(e == _delegate ? this : new EndpointI(_instance, e)); } @@ -207,7 +209,7 @@ final class EndpointI extends IceInternal.EndpointI } @Override - public boolean equivalent(IceInternal.EndpointI endpoint) + public boolean equivalent(com.zeroc.IceInternal.EndpointI endpoint) { if(!(endpoint instanceof EndpointI)) { @@ -233,7 +235,7 @@ final class EndpointI extends IceInternal.EndpointI // Compare endpoints for sorting purposes // @Override - public int compareTo(IceInternal.EndpointI obj) // From java.lang.Comparable + public int compareTo(com.zeroc.IceInternal.EndpointI obj) // From java.lang.Comparable { if(!(obj instanceof EndpointI)) { @@ -256,5 +258,5 @@ final class EndpointI extends IceInternal.EndpointI } private Instance _instance; - private IceInternal.EndpointI _delegate; + private com.zeroc.IceInternal.EndpointI _delegate; } diff --git a/java/src/Ice/src/main/java/IceSSL/Instance.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Instance.java index 53ffac5c29f..634690ce098 100644 --- a/java/src/Ice/src/main/java/IceSSL/Instance.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Instance.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; -class Instance extends IceInternal.ProtocolInstance +class Instance extends com.zeroc.IceInternal.ProtocolInstance { Instance(SSLEngine engine, short type, String protocol) { diff --git a/java/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/NativeConnectionInfo.java index 3e726309267..3d02b7b4896 100644 --- a/java/src/Ice/src/main/java/IceSSL/NativeConnectionInfo.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/NativeConnectionInfo.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; /** * diff --git a/java/src/Ice/src/main/java/IceSSL/PasswordCallback.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PasswordCallback.java index 227b7c41361..fd9ac813396 100644 --- a/java/src/Ice/src/main/java/IceSSL/PasswordCallback.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PasswordCallback.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; /** * A password callback is an alternate way to supply the plug-in with diff --git a/java/src/Ice/src/main/java/IceSSL/Plugin.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Plugin.java index 7301c37ed6a..d005aabbf45 100644 --- a/java/src/Ice/src/main/java/IceSSL/Plugin.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Plugin.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; /** * Interface that allows applications to interact with the IceSSL plug-in. **/ -public interface Plugin extends Ice.Plugin +public interface Plugin extends com.zeroc.Ice.Plugin { /** * Establishes the SSL context. The context must be established before diff --git a/java/src/Ice/src/main/java/IceSSL/PluginFactory.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginFactory.java index cb8063fe148..0ae8459755d 100644 --- a/java/src/Ice/src/main/java/IceSSL/PluginFactory.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginFactory.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; /** * Plug-in factories must implement this interface. **/ -public class PluginFactory implements Ice.PluginFactory +public class PluginFactory implements com.zeroc.Ice.PluginFactory { /** * Returns a new plug-in. @@ -26,8 +26,8 @@ public class PluginFactory implements Ice.PluginFactory * {@link PluginInitializationException} to provide more detailed information. **/ @Override - public Ice.Plugin - create(Ice.Communicator communicator, String name, String[] args) + public com.zeroc.Ice.Plugin + create(com.zeroc.Ice.Communicator communicator, String name, String[] args) { return new PluginI(communicator); } diff --git a/java/src/Ice/src/main/java/IceSSL/PluginI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginI.java index a57d6e31245..047fe67057b 100644 --- a/java/src/Ice/src/main/java/IceSSL/PluginI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/PluginI.java @@ -7,13 +7,14 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; class PluginI implements Plugin { - public PluginI(Ice.Communicator communicator) + public PluginI(com.zeroc.Ice.Communicator communicator) { - final IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(communicator); + final com.zeroc.IceInternal.ProtocolPluginFacade facade = + com.zeroc.IceInternal.Util.getProtocolPluginFacade(communicator); _engine = new SSLEngine(facade); // @@ -23,18 +24,18 @@ class PluginI implements Plugin // // SSL based on TCP - IceInternal.EndpointFactory tcp = facade.getEndpointFactory(Ice.TCPEndpointType.value); + com.zeroc.IceInternal.EndpointFactory tcp = facade.getEndpointFactory(com.zeroc.Ice.TCPEndpointType.value); if(tcp != null) { - Instance instance = new Instance(_engine, Ice.SSLEndpointType.value, "ssl"); + Instance instance = new Instance(_engine, com.zeroc.Ice.SSLEndpointType.value, "ssl"); facade.addEndpointFactory(new EndpointFactoryI(instance, tcp.clone(instance, null))); } // SSL based on Bluetooth - IceInternal.EndpointFactory bluetooth = facade.getEndpointFactory(Ice.BTEndpointType.value); + com.zeroc.IceInternal.EndpointFactory bluetooth = facade.getEndpointFactory(com.zeroc.Ice.BTEndpointType.value); if(bluetooth != null) { - Instance instance = new Instance(_engine, Ice.BTSEndpointType.value, "bts"); + Instance instance = new Instance(_engine, com.zeroc.Ice.BTSEndpointType.value, "bts"); facade.addEndpointFactory(new EndpointFactoryI(instance, bluetooth.clone(instance, null))); } } diff --git a/java/src/Ice/src/main/java/IceSSL/RFC2253.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/RFC2253.java index 3d88287ca1b..27b0908a431 100644 --- a/java/src/Ice/src/main/java/IceSSL/RFC2253.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/RFC2253.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; // // See RFC 2253 and RFC 1779. // class RFC2253 { - static class ParseException extends Ice.LocalException + static class ParseException extends com.zeroc.Ice.LocalException { public ParseException() { @@ -43,7 +43,7 @@ class RFC2253 static class RDNEntry { - java.util.List<RDNPair> rdn = new java.util.LinkedList<RDNPair>(); + java.util.List<RDNPair> rdn = new java.util.LinkedList<>(); boolean negate = false; } @@ -57,7 +57,7 @@ class RFC2253 parse(String data) throws ParseException { - java.util.List<RDNEntry> results = new java.util.LinkedList<RDNEntry>(); + java.util.List<RDNEntry> results = new java.util.LinkedList<>(); RDNEntry current = new RDNEntry(); ParseState state = new ParseState(); state.data = data; @@ -103,7 +103,7 @@ class RFC2253 parseStrict(String data) throws ParseException { - java.util.List<RDNPair> results = new java.util.LinkedList<RDNPair>(); + java.util.List<RDNPair> results = new java.util.LinkedList<>(); ParseState state = new ParseState(); state.data = data; state.pos = 0; diff --git a/java/src/Ice/src/main/java/IceSSL/SSLEngine.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/SSLEngine.java index e8da76b6b26..cf40b19c53d 100644 --- a/java/src/Ice/src/main/java/IceSSL/SSLEngine.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/SSLEngine.java @@ -7,16 +7,17 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.security.cert.*; +import com.zeroc.Ice.PluginInitializationException; class SSLEngine { - SSLEngine(IceInternal.ProtocolPluginFacade facade) + SSLEngine(com.zeroc.IceInternal.ProtocolPluginFacade facade) { _communicator = facade.getCommunicator(); _logger = _communicator.getLogger(); @@ -34,7 +35,7 @@ class SSLEngine } final String prefix = "IceSSL."; - Ice.Properties properties = communicator().getProperties(); + com.zeroc.Ice.Properties properties = communicator().getProperties(); // // Parse the cipher list. @@ -48,7 +49,7 @@ class SSLEngine String[] protocols = properties.getPropertyAsList(prefix + "Protocols"); if(protocols.length != 0) { - java.util.ArrayList<String> l = new java.util.ArrayList<String>(); + java.util.ArrayList<String> l = new java.util.ArrayList<>(); for(String prot : protocols) { String s = prot.toUpperCase(); @@ -71,7 +72,7 @@ class SSLEngine } else { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = new PluginInitializationException(); e.reason = "IceSSL: unrecognized protocol `" + prot + "'"; throw e; } @@ -106,7 +107,7 @@ class SSLEngine { if(_verifier != null) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = new PluginInitializationException(); e.reason = "IceSSL: certificate verifier already installed"; throw e; } @@ -118,7 +119,7 @@ class SSLEngine } catch(Throwable ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to load certificate verifier class " + certVerifierClass, ex); } @@ -128,7 +129,7 @@ class SSLEngine } catch(Throwable ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to instantiate certificate verifier class " + certVerifierClass, ex); } } @@ -141,7 +142,7 @@ class SSLEngine { if(_passwordCallback != null) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = new PluginInitializationException(); e.reason = "IceSSL: password callback already installed"; throw e; } @@ -153,7 +154,7 @@ class SSLEngine } catch(Throwable ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to load password callback class " + passwordCallbackClass, ex); } @@ -163,7 +164,7 @@ class SSLEngine } catch(Throwable ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to instantiate password callback class " + passwordCallbackClass, ex); } } @@ -209,7 +210,8 @@ class SSLEngine java.io.InputStream seedStream = openResource(file); if(seedStream == null) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = + new PluginInitializationException(); e.reason = "IceSSL: random seed file not found:\n" + file; throw e; } @@ -218,7 +220,7 @@ class SSLEngine } catch(java.io.IOException ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to access random seed file:\n" + file, ex); } } @@ -248,7 +250,8 @@ class SSLEngine } catch(java.io.IOException ex) { - throw new Ice.PluginInitializationException("IceSSL: error while reading random seed", ex); + throw new PluginInitializationException( + "IceSSL: error while reading random seed", ex); } finally { @@ -337,7 +340,8 @@ class SSLEngine keystoreStream = openResource(keystorePath); if(keystoreStream == null) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = + new PluginInitializationException(); e.reason = "IceSSL: keystore not found:\n" + keystorePath; throw e; } @@ -369,7 +373,7 @@ class SSLEngine } catch(java.io.IOException ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to load keystore:\n" + keystorePath, ex); } finally @@ -435,7 +439,8 @@ class SSLEngine // if(!keys.isKeyEntry(alias)) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = + new PluginInitializationException(); e.reason = "IceSSL: keystore does not contain an entry with alias `" + alias + "'"; throw e; } @@ -478,7 +483,8 @@ class SSLEngine truststoreStream = openResource(truststorePath); if(truststoreStream == null) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); + PluginInitializationException e = + new PluginInitializationException(); e.reason = "IceSSL: truststore not found:\n" + truststorePath; throw e; } @@ -511,7 +517,7 @@ class SSLEngine } catch(java.io.IOException ex) { - throw new Ice.PluginInitializationException( + throw new PluginInitializationException( "IceSSL: unable to load truststore:\n" + truststorePath, ex); } finally @@ -599,7 +605,7 @@ class SSLEngine // if(trustStore != null && trustStore.size() == 0) { - throw new Ice.PluginInitializationException("IceSSL: truststore is empty"); + throw new PluginInitializationException("IceSSL: truststore is empty"); } if(trustManagers == null) @@ -617,7 +623,7 @@ class SSLEngine // return an empty list of accepted issuers. // _validator = CertPathValidator.getInstance("PKIX"); - java.util.Set<TrustAnchor> anchors = new java.util.HashSet<TrustAnchor>(); + java.util.Set<TrustAnchor> anchors = new java.util.HashSet<>(); for(javax.net.ssl.TrustManager tm : trustManagers) { X509Certificate[] certs = ((javax.net.ssl.X509TrustManager)tm).getAcceptedIssuers(); @@ -651,7 +657,7 @@ class SSLEngine } catch(java.security.GeneralSecurityException ex) { - throw new Ice.PluginInitializationException("IceSSL: unable to initialize context", ex); + throw new PluginInitializationException("IceSSL: unable to initialize context", ex); } } @@ -677,7 +683,7 @@ class SSLEngine return null; // Couldn't validate the given certificate chain, no trust anchors configured. } - List<Certificate> certs = new ArrayList<Certificate>(java.util.Arrays.asList(chain)); + List<Certificate> certs = new ArrayList<>(java.util.Arrays.asList(chain)); try { CertPath path = CertificateFactory.getInstance("X.509").generateCertPath(certs); @@ -699,7 +705,7 @@ class SSLEngine { if(_initialized) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = new PluginInitializationException(); ex.reason = "IceSSL: plug-in is already initialized"; throw ex; } @@ -737,7 +743,7 @@ class SSLEngine { if(_initialized) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = new PluginInitializationException(); ex.reason = "IceSSL: plugin is already initialized"; throw ex; } @@ -749,7 +755,7 @@ class SSLEngine { if(_initialized) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = new PluginInitializationException(); ex.reason = "IceSSL: plugin is already initialized"; throw ex; } @@ -797,7 +803,7 @@ class SSLEngine } catch(IllegalArgumentException ex) { - throw new Ice.SecurityException("IceSSL: invalid ciphersuite", ex); + throw new com.zeroc.Ice.SecurityException("IceSSL: invalid ciphersuite", ex); } if(_securityTraceLevel >= 1) @@ -820,7 +826,7 @@ class SSLEngine } catch(IllegalArgumentException ex) { - throw new Ice.SecurityException("IceSSL: invalid protocol", ex); + throw new com.zeroc.Ice.SecurityException("IceSSL: invalid protocol", ex); } } else @@ -828,7 +834,7 @@ class SSLEngine // // Disable SSLv3 // - List<String> protocols = new ArrayList<String>(java.util.Arrays.asList(engine.getEnabledProtocols())); + List<String> protocols = new ArrayList<>(java.util.Arrays.asList(engine.getEnabledProtocols())); protocols.remove("SSLv3"); engine.setEnabledProtocols(protocols.toArray(new String[protocols.size()])); } @@ -857,7 +863,7 @@ class SSLEngine } catch(javax.net.ssl.SSLException ex) { - throw new Ice.SecurityException("IceSSL: handshake error", ex); + throw new com.zeroc.Ice.SecurityException("IceSSL: handshake error", ex); } return engine; @@ -865,7 +871,7 @@ class SSLEngine String[] filterCiphers(String[] supportedCiphers, String[] defaultCiphers) { - java.util.LinkedList<String> result = new java.util.LinkedList<String>(); + java.util.LinkedList<String> result = new java.util.LinkedList<>(); if(_allCiphers) { for(String cipher : supportedCiphers) @@ -950,7 +956,7 @@ class SSLEngine _logger.trace(_securityTraceCategory, msg); } - Ice.Communicator communicator() + com.zeroc.Ice.Communicator communicator() { return _communicator; } @@ -965,7 +971,7 @@ class SSLEngine { if(_verifyPeer > 0 && !info.verified) { - throw new Ice.SecurityException("IceSSL: server did not supply a certificate"); + throw new com.zeroc.Ice.SecurityException("IceSSL: server did not supply a certificate"); } } @@ -981,8 +987,8 @@ class SSLEngine // Extract the IP addresses and the DNS names from the subject // alternative names. // - java.util.ArrayList<String> ipAddresses = new java.util.ArrayList<String>(); - java.util.ArrayList<String> dnsNames = new java.util.ArrayList<String>(); + java.util.ArrayList<String> ipAddresses = new java.util.ArrayList<>(); + java.util.ArrayList<String> dnsNames = new java.util.ArrayList<>(); try { java.util.Collection<java.util.List<?> > subjectAltNames = cert.getSubjectAlternativeNames(); @@ -1096,7 +1102,7 @@ class SSLEngine } if(_checkCertName) { - Ice.SecurityException ex = new Ice.SecurityException(); + com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException(); ex.reason = sb.toString(); throw ex; } @@ -1112,7 +1118,7 @@ class SSLEngine { _logger.trace(_securityTraceCategory, msg); } - Ice.SecurityException ex = new Ice.SecurityException(); + com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException(); ex.reason = msg; throw ex; } @@ -1124,7 +1130,7 @@ class SSLEngine { _logger.trace(_securityTraceCategory, msg); } - Ice.SecurityException ex = new Ice.SecurityException(); + com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException(); ex.reason = msg; throw ex; } @@ -1137,7 +1143,7 @@ class SSLEngine { _logger.trace(_securityTraceCategory, msg); } - Ice.SecurityException ex = new Ice.SecurityException(); + com.zeroc.Ice.SecurityException ex = new com.zeroc.Ice.SecurityException(); ex.reason = msg; throw ex; } @@ -1170,7 +1176,7 @@ class SSLEngine private void parseCiphers(String ciphers) { - java.util.ArrayList<CipherExpression> cipherList = new java.util.ArrayList<CipherExpression>(); + java.util.ArrayList<CipherExpression> cipherList = new java.util.ArrayList<>(); String[] expr = ciphers.split("[ \t]+"); for(int i = 0; i < expr.length; ++i) { @@ -1178,7 +1184,7 @@ class SSLEngine { if(i != 0) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = new PluginInitializationException(); ex.reason = "IceSSL: `ALL' must be first in cipher list `" + ciphers + "'"; throw ex; } @@ -1188,7 +1194,7 @@ class SSLEngine { if(i != 0) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = new PluginInitializationException(); ex.reason = "IceSSL: `NONE' must be first in cipher list `" + ciphers + "'"; throw ex; } @@ -1207,7 +1213,8 @@ class SSLEngine } else { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = + new PluginInitializationException(); ex.reason = "IceSSL: invalid cipher expression `" + exp + "'"; throw ex; } @@ -1217,7 +1224,7 @@ class SSLEngine { if(!exp.endsWith(")")) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + PluginInitializationException ex = new PluginInitializationException(); ex.reason = "IceSSL: invalid cipher expression `" + exp + "'"; throw ex; } @@ -1228,8 +1235,7 @@ class SSLEngine } catch(java.util.regex.PatternSyntaxException ex) { - throw new Ice.PluginInitializationException( - "IceSSL: invalid cipher expression `" + exp + "'", ex); + throw new PluginInitializationException("IceSSL: invalid cipher expression `" + exp + "'", ex); } } else @@ -1259,7 +1265,7 @@ class SSLEngine isAbsolute = f.isAbsolute(); } - java.io.InputStream stream = IceInternal.Util.openResource(getClass().getClassLoader(), path); + java.io.InputStream stream = com.zeroc.IceInternal.Util.openResource(getClass().getClassLoader(), path); // // If the first attempt fails and IceSSL.DefaultDir is defined and the original path is relative, @@ -1267,7 +1273,7 @@ class SSLEngine // if(stream == null && _defaultDir.length() > 0 && !isAbsolute) { - stream = IceInternal.Util.openResource(getClass().getClassLoader(), + stream = com.zeroc.IceInternal.Util.openResource(getClass().getClassLoader(), _defaultDir + java.io.File.separator + path); } @@ -1286,9 +1292,9 @@ class SSLEngine java.util.regex.Pattern re; } - private Ice.Communicator _communicator; - private Ice.Logger _logger; - private IceInternal.ProtocolPluginFacade _facade; + private com.zeroc.Ice.Communicator _communicator; + private com.zeroc.Ice.Logger _logger; + private com.zeroc.IceInternal.ProtocolPluginFacade _facade; private int _securityTraceLevel; private String _securityTraceCategory; private boolean _initialized; @@ -1307,7 +1313,7 @@ class SSLEngine private InputStream _keystoreStream; private InputStream _truststoreStream; - private List<InputStream> _seeds = new ArrayList<InputStream>(); + private List<InputStream> _seeds = new ArrayList<>(); private CertPathValidator _validator; private PKIXParameters _validatorParams; diff --git a/java/src/Ice/src/main/java/IceSSL/TransceiverI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TransceiverI.java index d34a83acdae..c56430ec4f3 100644 --- a/java/src/Ice/src/main/java/IceSSL/TransceiverI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TransceiverI.java @@ -7,13 +7,15 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; import java.nio.*; +import java.util.Base64; import javax.net.ssl.*; import javax.net.ssl.SSLEngineResult.*; +import com.zeroc.IceInternal.SocketOperation; -final class TransceiverI implements IceInternal.Transceiver +final class TransceiverI implements com.zeroc.IceInternal.Transceiver { @Override public java.nio.channels.SelectableChannel fd() @@ -22,30 +24,30 @@ final class TransceiverI implements IceInternal.Transceiver } @Override - public void setReadyCallback(IceInternal.ReadyCallback callback) + public void setReadyCallback(com.zeroc.IceInternal.ReadyCallback callback) { _readyCallback = callback; _delegate.setReadyCallback(callback); } @Override - public int initialize(IceInternal.Buffer readBuffer, IceInternal.Buffer writeBuffer) + public int initialize(com.zeroc.IceInternal.Buffer readBuffer, com.zeroc.IceInternal.Buffer writeBuffer) { if(!_isConnected) { int status = _delegate.initialize(readBuffer, writeBuffer); - if(status != IceInternal.SocketOperation.None) + if(status != SocketOperation.None) { return status; } _isConnected = true; - Ice.IPConnectionInfo ipInfo = null; - for(Ice.ConnectionInfo p = _delegate.getInfo(); p != null; p = p.underlying) + com.zeroc.Ice.IPConnectionInfo ipInfo = null; + for(com.zeroc.Ice.ConnectionInfo p = _delegate.getInfo(); p != null; p = p.underlying) { - if(p instanceof Ice.IPConnectionInfo) + if(p instanceof com.zeroc.Ice.IPConnectionInfo) { - ipInfo = (Ice.IPConnectionInfo)p; + ipInfo = (com.zeroc.Ice.IPConnectionInfo)p; } } final String host = _incoming ? (ipInfo != null ? ipInfo.remoteAddress : "") : _host; @@ -53,12 +55,12 @@ final class TransceiverI implements IceInternal.Transceiver _engine = _instance.createSSLEngine(_incoming, host, port); _appInput = ByteBuffer.allocateDirect(_engine.getSession().getApplicationBufferSize() * 2); int bufSize = _engine.getSession().getPacketBufferSize() * 2; - _netInput = new IceInternal.Buffer(ByteBuffer.allocateDirect(bufSize * 2)); - _netOutput = new IceInternal.Buffer(ByteBuffer.allocateDirect(bufSize * 2)); + _netInput = new com.zeroc.IceInternal.Buffer(ByteBuffer.allocateDirect(bufSize * 2)); + _netOutput = new com.zeroc.IceInternal.Buffer(ByteBuffer.allocateDirect(bufSize * 2)); } int status = handshakeNonBlocking(); - if(status != IceInternal.SocketOperation.None) + if(status != SocketOperation.None) { return status; } @@ -72,15 +74,15 @@ final class TransceiverI implements IceInternal.Transceiver { _instance.traceConnection(_delegate.toString(), _engine, _incoming); } - return IceInternal.SocketOperation.None; + return SocketOperation.None; } @Override - public int closing(boolean initiator, Ice.LocalException ex) + public int closing(boolean initiator, com.zeroc.Ice.LocalException ex) { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. - return initiator ? IceInternal.SocketOperation.Read : IceInternal.SocketOperation.None; + return initiator ? SocketOperation.Read : SocketOperation.None; } @Override @@ -107,7 +109,7 @@ final class TransceiverI implements IceInternal.Transceiver // flushNonBlocking(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // Ignore. } @@ -145,14 +147,14 @@ final class TransceiverI implements IceInternal.Transceiver } @Override - public IceInternal.EndpointI bind() + public com.zeroc.IceInternal.EndpointI bind() { assert(false); return null; } @Override - public int write(IceInternal.Buffer buf) + public int write(com.zeroc.IceInternal.Buffer buf) { if(!_isConnected) { @@ -160,19 +162,19 @@ final class TransceiverI implements IceInternal.Transceiver } int status = writeNonBlocking(buf.b); - assert(status == IceInternal.SocketOperation.None || status == IceInternal.SocketOperation.Write); + assert(status == SocketOperation.None || status == SocketOperation.Write); return status; } @Override - public int read(IceInternal.Buffer buf) + public int read(com.zeroc.IceInternal.Buffer buf) { if(!_isConnected) { return _delegate.read(buf); } - _readyCallback.ready(IceInternal.SocketOperation.Read, false); + _readyCallback.ready(SocketOperation.Read, false); // // Try to satisfy the request from data we've already decrypted. @@ -197,14 +199,14 @@ final class TransceiverI implements IceInternal.Transceiver if(status == Status.CLOSED) { - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); } // Android API 21 SSLEngine doesn't report underflow, so look at the absence of // network data and application data to signal a network read. else if(status == Status.BUFFER_UNDERFLOW || (_appInput.position() == 0 && _netInput.b.position() == 0)) { int s = _delegate.read(_netInput); - if(s != IceInternal.SocketOperation.None && _netInput.b.position() == 0) + if(s != SocketOperation.None && _netInput.b.position() == 0) { return s; } @@ -228,7 +230,7 @@ final class TransceiverI implements IceInternal.Transceiver } catch(SSLException ex) { - throw new Ice.SecurityException("IceSSL: error during read", ex); + throw new com.zeroc.Ice.SecurityException("IceSSL: error during read", ex); } // @@ -236,10 +238,10 @@ final class TransceiverI implements IceInternal.Transceiver // if(_netInput.b.position() > 0 || _appInput.position() > 0) { - _readyCallback.ready(IceInternal.SocketOperation.Read, true); + _readyCallback.ready(SocketOperation.Read, true); } - return IceInternal.SocketOperation.None; + return SocketOperation.None; } @Override @@ -261,7 +263,7 @@ final class TransceiverI implements IceInternal.Transceiver } @Override - public Ice.ConnectionInfo getInfo() + public com.zeroc.Ice.ConnectionInfo getInfo() { NativeConnectionInfo info = new NativeConnectionInfo(); info.underlying = _delegate.getInfo(); @@ -277,11 +279,11 @@ final class TransceiverI implements IceInternal.Transceiver java.security.cert.Certificate[] vcerts = _instance.engine().getVerifiedCertificateChain(pcerts); info.verified = vcerts != null; info.nativeCerts = vcerts != null ? vcerts : pcerts; - java.util.ArrayList<String> certs = new java.util.ArrayList<String>(); + java.util.ArrayList<String> certs = new java.util.ArrayList<>(); for(java.security.cert.Certificate c : info.nativeCerts) { StringBuilder s = new StringBuilder("-----BEGIN CERTIFICATE-----\n"); - s.append(IceUtilInternal.Base64.encode(c.getEncoded())); + s.append(Base64.getEncoder().encodeToString(c.getEncoded())); s.append("\n-----END CERTIFICATE-----"); certs.add(s.toString()); } @@ -305,12 +307,13 @@ final class TransceiverI implements IceInternal.Transceiver } @Override - public void checkSendSize(IceInternal.Buffer buf) + public void checkSendSize(com.zeroc.IceInternal.Buffer buf) { _delegate.checkSendSize(buf); } - TransceiverI(Instance instance, IceInternal.Transceiver delegate, String hostOrAdapterName, boolean incoming) + TransceiverI(Instance instance, com.zeroc.IceInternal.Transceiver delegate, String hostOrAdapterName, + boolean incoming) { _instance = instance; _delegate = delegate; @@ -338,7 +341,7 @@ final class TransceiverI implements IceInternal.Transceiver case FINISHED: case NOT_HANDSHAKING: { - return IceInternal.SocketOperation.None; + return SocketOperation.None; } case NEED_TASK: { @@ -355,7 +358,7 @@ final class TransceiverI implements IceInternal.Transceiver if(_netInput.b.position() == 0) { int s = _delegate.read(_netInput); - if(s != IceInternal.SocketOperation.None && _netInput.b.position() == 0) + if(s != SocketOperation.None && _netInput.b.position() == 0) { return s; } @@ -385,7 +388,7 @@ final class TransceiverI implements IceInternal.Transceiver assert(status == javax.net.ssl.SSLEngineResult.HandshakeStatus.NEED_UNWRAP); int position = _netInput.b.position(); int s = _delegate.read(_netInput); - if(s != IceInternal.SocketOperation.None && _netInput.b.position() == position) + if(s != SocketOperation.None && _netInput.b.position() == position) { return s; } @@ -393,7 +396,7 @@ final class TransceiverI implements IceInternal.Transceiver } case CLOSED: { - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); } case OK: { @@ -411,7 +414,7 @@ final class TransceiverI implements IceInternal.Transceiver if(result.bytesProduced() > 0) { int s = flushNonBlocking(); - if(s != IceInternal.SocketOperation.None) + if(s != SocketOperation.None) { return s; } @@ -437,7 +440,7 @@ final class TransceiverI implements IceInternal.Transceiver assert(status == HandshakeStatus.NEED_UNWRAP); break; case CLOSED: - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); case OK: break; } @@ -446,9 +449,9 @@ final class TransceiverI implements IceInternal.Transceiver } catch(SSLException ex) { - throw new Ice.SecurityException("IceSSL: handshake error", ex); + throw new com.zeroc.Ice.SecurityException("IceSSL: handshake error", ex); } - return IceInternal.SocketOperation.None; + return SocketOperation.None; } private int writeNonBlocking(ByteBuffer buf) @@ -479,7 +482,7 @@ final class TransceiverI implements IceInternal.Transceiver assert(false); break; case CLOSED: - throw new Ice.ConnectionLostException(); + throw new com.zeroc.Ice.ConnectionLostException(); case OK: break; } @@ -493,7 +496,7 @@ final class TransceiverI implements IceInternal.Transceiver if(_netOutput.b.position() > 0) { int s = flushNonBlocking(); - if(s != IceInternal.SocketOperation.None) + if(s != SocketOperation.None) { return s; } @@ -502,11 +505,11 @@ final class TransceiverI implements IceInternal.Transceiver } catch(SSLException ex) { - throw new Ice.SecurityException("IceSSL: error while encoding message", ex); + throw new com.zeroc.Ice.SecurityException("IceSSL: error while encoding message", ex); } assert(_netOutput.b.position() == 0); - return IceInternal.SocketOperation.None; + return SocketOperation.None; } private int flushNonBlocking() @@ -516,18 +519,18 @@ final class TransceiverI implements IceInternal.Transceiver try { int s = _delegate.write(_netOutput); - if(s != IceInternal.SocketOperation.None) + if(s != SocketOperation.None) { _netOutput.b.compact(); return s; } } - catch(Ice.SocketException ex) + catch(com.zeroc.Ice.SocketException ex) { - throw new Ice.ConnectionLostException(ex); + throw new com.zeroc.Ice.ConnectionLostException(ex); } _netOutput.b.clear(); - return IceInternal.SocketOperation.None; + return SocketOperation.None; } private void fill(ByteBuffer buf) @@ -573,16 +576,16 @@ final class TransceiverI implements IceInternal.Transceiver } private Instance _instance; - private IceInternal.Transceiver _delegate; + private com.zeroc.IceInternal.Transceiver _delegate; private javax.net.ssl.SSLEngine _engine; private String _host = ""; private String _adapterName = ""; private boolean _incoming; - private IceInternal.ReadyCallback _readyCallback; + private com.zeroc.IceInternal.ReadyCallback _readyCallback; private boolean _isConnected = false; private ByteBuffer _appInput; // Holds clear-text data to be read by the application. - private IceInternal.Buffer _netInput; // Holds encrypted data read from the socket. - private IceInternal.Buffer _netOutput; // Holds encrypted data to be written to the socket. + private com.zeroc.IceInternal.Buffer _netInput; // Holds encrypted data read from the socket. + private com.zeroc.IceInternal.Buffer _netOutput; // Holds encrypted data to be written to the socket. private static ByteBuffer _emptyBuffer = ByteBuffer.allocate(0); // Used during handshaking. } diff --git a/java/src/Ice/src/main/java/IceSSL/TrustManager.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TrustManager.java index ba17851dee8..a2713702c16 100644 --- a/java/src/Ice/src/main/java/IceSSL/TrustManager.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/TrustManager.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; class TrustManager { - TrustManager(Ice.Communicator communicator) + TrustManager(com.zeroc.Ice.Communicator communicator) { assert communicator != null; _communicator = communicator; - Ice.Properties properties = communicator.getProperties(); + com.zeroc.Ice.Properties properties = communicator.getProperties(); _traceLevel = properties.getPropertyAsInt("IceSSL.Trace.Security"); String key = null; try @@ -48,7 +48,7 @@ class TrustManager } catch(RFC2253.ParseException e) { - Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + com.zeroc.Ice.PluginInitializationException ex = new com.zeroc.Ice.PluginInitializationException(); ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason; throw ex; } @@ -128,7 +128,8 @@ class TrustManager // if(info.nativeCerts != null && info.nativeCerts.length > 0) { - javax.security.auth.x500.X500Principal subjectDN = ((java.security.cert.X509Certificate)info.nativeCerts[0]).getSubjectX500Principal(); + javax.security.auth.x500.X500Principal subjectDN = + ((java.security.cert.X509Certificate)info.nativeCerts[0]).getSubjectX500Principal(); String subjectName = subjectDN.getName(javax.security.auth.x500.X500Principal.RFC2253); assert subjectName != null; try @@ -339,7 +340,7 @@ class TrustManager } } - private Ice.Communicator _communicator; + private com.zeroc.Ice.Communicator _communicator; private int _traceLevel; private java.util.List<java.util.List<RFC2253.RDNPair> > _rejectAll = diff --git a/java/src/Ice/src/main/java/IceSSL/Util.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Util.java index 53a71e15896..eab2851d8f1 100644 --- a/java/src/Ice/src/main/java/IceSSL/Util.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/Util.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; public final class Util { diff --git a/java/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509KeyManagerI.java index 70ca764bfa1..4ba37d93e9e 100644 --- a/java/src/Ice/src/main/java/IceSSL/X509KeyManagerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509KeyManagerI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; import javax.net.ssl.X509ExtendedKeyManager; diff --git a/java/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509TrustManagerI.java index 57d03e5200e..da241df6e2a 100644 --- a/java/src/Ice/src/main/java/IceSSL/X509TrustManagerI.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceSSL/X509TrustManagerI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceSSL; +package com.zeroc.IceSSL; final class X509TrustManagerI implements javax.net.ssl.X509TrustManager { diff --git a/java/src/Ice/src/main/java/IceUtilInternal/Assert.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Assert.java index 545bed9c635..8f344d00510 100644 --- a/java/src/Ice/src/main/java/IceUtilInternal/Assert.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Assert.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceUtilInternal; +package com.zeroc.IceUtilInternal; public final class Assert { diff --git a/java/src/Ice/src/main/java/IceUtilInternal/Options.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Options.java index a16c0ed56ac..7aee137b60f 100644 --- a/java/src/Ice/src/main/java/IceUtilInternal/Options.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/Options.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceUtilInternal; +package com.zeroc.IceUtilInternal; public final class Options { @@ -38,7 +38,7 @@ public final class Options int state = NormalState; StringBuilder arg = new StringBuilder(128); - java.util.List<String> vec = new java.util.ArrayList<String>(); + java.util.List<String> vec = new java.util.ArrayList<>(); for(int i = 0; i < line.length(); ++i) { diff --git a/java/src/Ice/src/main/java/IceUtilInternal/OutputBase.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/OutputBase.java index 7638be77c0b..065d8d84ff7 100644 --- a/java/src/Ice/src/main/java/IceUtilInternal/OutputBase.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/OutputBase.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceUtilInternal; +package com.zeroc.IceUtilInternal; public class OutputBase { @@ -182,7 +182,7 @@ public class OutputBase protected int _pos; protected int _indent; protected int _indentSize; - protected java.util.LinkedList<Integer> _indentSave = new java.util.LinkedList<Integer>(); + protected java.util.LinkedList<Integer> _indentSave = new java.util.LinkedList<>(); protected boolean _useTab; protected boolean _separator; } diff --git a/java/src/Ice/src/main/java/IceUtilInternal/StopWatch.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StopWatch.java index 137a8cad364..abaf7691a1f 100644 --- a/java/src/Ice/src/main/java/IceUtilInternal/StopWatch.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StopWatch.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceUtilInternal; +package com.zeroc.IceUtilInternal; public class StopWatch { diff --git a/java/src/Ice/src/main/java/IceUtilInternal/StringUtil.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StringUtil.java index 953359c5c4b..cf6de757a9c 100644 --- a/java/src/Ice/src/main/java/IceUtilInternal/StringUtil.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/StringUtil.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceUtilInternal; +package com.zeroc.IceUtilInternal; public final class StringUtil { @@ -219,12 +219,26 @@ public final class StringUtil return c; } + static class Holder<T> + { + public Holder() + { + } + + public Holder(T value) + { + this.value = value; + } + + public T value; + } + // // Decode the character or escape sequence starting at start and return it. // newStart is set to the index of the first character following the decoded character // or escape sequence. // - private static char decodeChar(String s, int start, int end, Ice.Holder<Integer> nextStart) + private static char decodeChar(String s, int start, int end, Holder<Integer> nextStart) { assert(start >= 0); assert(start < end); @@ -327,7 +341,7 @@ public final class StringUtil private static void decodeString(String s, int start, int end, StringBuilder sb) { - Ice.Holder<Integer> nextStart = new Ice.Holder<Integer>(); + Holder<Integer> nextStart = new Holder<>(); while(start < end) { sb.append(decodeChar(s, start, end, nextStart)); @@ -390,7 +404,7 @@ public final class StringUtil static public String[] splitString(String str, String delim) { - java.util.List<String> l = new java.util.ArrayList<String>(); + java.util.List<String> l = new java.util.ArrayList<>(); char[] arr = new char[str.length()]; int pos = 0; diff --git a/java/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/XMLOutput.java index 8d6f4ab9569..ed8428fc236 100644 --- a/java/src/Ice/src/main/java/IceUtilInternal/XMLOutput.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceUtilInternal/XMLOutput.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceUtilInternal; +package com.zeroc.IceUtilInternal; public class XMLOutput extends OutputBase { @@ -265,7 +265,7 @@ public class XMLOutput extends OutputBase return v; } - private java.util.LinkedList<String> _elementStack = new java.util.LinkedList<String>(); + private java.util.LinkedList<String> _elementStack = new java.util.LinkedList<>(); boolean _se; boolean _text; diff --git a/java/src/IceBT/build.gradle b/java/src/IceBT/build.gradle deleted file mode 100644 index 1e7cfbe607b..00000000000 --- a/java/src/IceBT/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility - -project.ext.displayName = "IceBT" -project.ext.description = "Bluetooth support for Ice" - -slice { - java { - set1 { - args = "--ice" - files = fileTree(dir: "$sliceDir/IceBT", includes:['*.ice'], excludes:["*F.ice"]) - } - } -} - -dependencies { - compile project(':ice') -} - -apply from: "$rootProject.projectDir/gradle/library.gradle" - -jar { - // - // The classes in src/main/java/android/bluetooth are stubs that allow us to compile the IceBT transport - // plug-in without requiring an Android SDK. These classes are excluded from the IceBT JAR file. - // - exclude("android/**") -} diff --git a/java/src/IceBT/src/main/java/IceBT/AcceptorI.java b/java/src/IceBT/src/main/java/IceBT/AcceptorI.java deleted file mode 100644 index 553e13ae149..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/AcceptorI.java +++ /dev/null @@ -1,224 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -import android.bluetooth.BluetoothSocket; -import android.bluetooth.BluetoothServerSocket; -import java.util.UUID; - -final class AcceptorI implements IceInternal.Acceptor -{ - @Override - public java.nio.channels.ServerSocketChannel fd() - { - return null; - } - - @Override - public void setReadyCallback(IceInternal.ReadyCallback callback) - { - _readyCallback = callback; - } - - @Override - public void close() - { - synchronized(this) - { - _closed = true; - } - - if(_socket != null) - { - try - { - _socket.close(); // Wakes up the thread blocked in accept(). - } - catch(Exception ex) - { - // Ignore. - } - } - if(_thread != null) - { - try - { - _thread.join(); - } - catch(Exception ex) - { - // Ignore. - } - } - } - - @Override - public IceInternal.EndpointI listen() - { - try - { - // - // We always listen using the "secure" method. - // - _socket = _instance.bluetoothAdapter().listenUsingRfcommWithServiceRecord(_name, _uuid); - } - catch(java.io.IOException ex) - { - throw new Ice.SocketException(ex); - } - - // - // Use a helper thread to perform the blocking accept() calls. - // - _thread = new Thread() - { - public void run() - { - runAccept(); - } - }; - _thread.start(); - - return _endpoint; - } - - @Override - public synchronized IceInternal.Transceiver accept() - { - if(_exception != null) - { - throw new Ice.SocketException(_exception); - } - - // - // accept() should only be called when we have at least one socket ready. - // - assert(!_pending.isEmpty()); - - BluetoothSocket socket = _pending.pop(); - - // - // Update our status with the thread pool. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, !_pending.isEmpty()); - - return new TransceiverI(_instance, socket, _uuid, _adapterName); - } - - @Override - public String protocol() - { - return _instance.protocol(); - } - - @Override - public String toString() - { - StringBuffer s = new StringBuffer("local address = "); - s.append(_instance.bluetoothAdapter().getAddress()); - return s.toString(); - } - - @Override - public String toDetailedString() - { - StringBuffer s = new StringBuffer(toString()); - if(!_name.isEmpty()) - { - s.append("\nservice name = '"); - s.append(_name); - s.append("'"); - } - if(_uuid != null) - { - s.append("\nservice uuid = "); - s.append(_uuid.toString()); - } - return s.toString(); - } - - AcceptorI(EndpointI endpoint, Instance instance, String adapterName, UUID uuid, String name) - { - _endpoint = endpoint; - _instance = instance; - _adapterName = adapterName; - _name = name; - _uuid = uuid; - - _pending = new java.util.Stack<BluetoothSocket>(); - _closed = false; - } - - private void runAccept() - { - try - { - while(true) - { - BluetoothSocket socket = _socket.accept(); - synchronized(this) - { - _pending.push(socket); - - // - // Notify the thread pool that we are ready to "read". The thread pool will invoke accept() - // and we can return a new transceiver. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, true); - } - } - } - catch(Exception ex) - { - synchronized(this) - { - if(!_closed) - { - _exception = ex; - _readyCallback.ready(IceInternal.SocketOperation.Read, true); - } - } - } - - // - // Close any remaining incoming sockets that haven't been accepted yet. - // - java.util.Stack<BluetoothSocket> pending; - synchronized(this) - { - pending = _pending; - _pending = null; - } - - for(BluetoothSocket s : pending) - { - try - { - s.close(); - } - catch(Exception ex) - { - // Ignore. - } - } - } - - private EndpointI _endpoint; - private Instance _instance; - private String _adapterName; - private String _name; - private UUID _uuid; - private IceInternal.ReadyCallback _readyCallback; - private BluetoothServerSocket _socket; - private java.util.Stack<BluetoothSocket> _pending; - private Thread _thread; - private Exception _exception; - private boolean _closed; -} diff --git a/java/src/IceBT/src/main/java/IceBT/ConnectorI.java b/java/src/IceBT/src/main/java/IceBT/ConnectorI.java deleted file mode 100644 index e8c8e8d47f5..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/ConnectorI.java +++ /dev/null @@ -1,109 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -import java.util.UUID; - -final class ConnectorI implements IceInternal.Connector -{ - @Override - public IceInternal.Transceiver connect() - { - return new TransceiverI(_instance, _addr, _uuid, _connectionId); - } - - @Override - public short type() - { - return _instance.type(); - } - - @Override - public String toString() - { - StringBuffer buf = new StringBuffer(); - if(!_addr.isEmpty()) - { - buf.append(_addr); - } - if(_uuid != null) - { - if(!_addr.isEmpty()) - { - buf.append(';'); - } - buf.append(_uuid.toString()); - } - return buf.toString(); - } - - @Override - public int hashCode() - { - return _hashCode; - } - - // - // Only for use by EndpointI. - // - ConnectorI(Instance instance, String addr, UUID uuid, int timeout, String connectionId) - { - _instance = instance; - _addr = addr; - _uuid = uuid; - _timeout = timeout; - _connectionId = connectionId; - - _hashCode = 5381; - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _addr); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _uuid); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _timeout); - _hashCode = IceInternal.HashUtil.hashAdd(_hashCode , _connectionId); - } - - @Override - public boolean equals(java.lang.Object obj) - { - if(!(obj instanceof ConnectorI)) - { - return false; - } - - if(this == obj) - { - return true; - } - - ConnectorI p = (ConnectorI)obj; - if(!_uuid.equals(p._uuid)) - { - return false; - } - - if(_timeout != p._timeout) - { - return false; - } - - if(!_connectionId.equals(p._connectionId)) - { - return false; - } - - return _addr.equals(p._addr); - } - - private Instance _instance; - private String _addr; - private UUID _uuid; - private int _timeout; - private String _connectionId; - private int _hashCode; -} diff --git a/java/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java b/java/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java deleted file mode 100644 index 5ffc5141907..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/EndpointFactoryI.java +++ /dev/null @@ -1,59 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -final class EndpointFactoryI implements IceInternal.EndpointFactory -{ - EndpointFactoryI(Instance instance) - { - _instance = instance; - } - - @Override - public short type() - { - return _instance.type(); - } - - @Override - public String protocol() - { - return _instance.protocol(); - } - - @Override - public IceInternal.EndpointI create(java.util.ArrayList<String> args, boolean oaEndpoint) - { - EndpointI endpt = new EndpointI(_instance); - endpt.initWithOptions(args, oaEndpoint); - return endpt; - } - - @Override - public IceInternal.EndpointI read(Ice.InputStream s) - { - return new EndpointI(_instance, s); - } - - @Override - public void destroy() - { - _instance.destroy(); - _instance = null; - } - - @Override - public IceInternal.EndpointFactory clone(IceInternal.ProtocolInstance inst, IceInternal.EndpointFactory del) - { - return new EndpointFactoryI(new Instance(_instance.communicator(), inst.type(), inst.protocol())); - } - - private Instance _instance; -} diff --git a/java/src/IceBT/src/main/java/IceBT/EndpointI.java b/java/src/IceBT/src/main/java/IceBT/EndpointI.java deleted file mode 100644 index 7576f458fae..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/EndpointI.java +++ /dev/null @@ -1,551 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -import android.bluetooth.BluetoothAdapter; -import java.util.UUID; - -final class EndpointI extends IceInternal.EndpointI -{ - public EndpointI(Instance instance, String addr, UUID uuid, String name, int channel, int timeout, - String connectionId, boolean compress) - { - _instance = instance; - _addr = addr; - _uuid = uuid; - _name = name; - _channel = channel; - _timeout = timeout; - _connectionId = connectionId; - _compress = compress; - hashInit(); - } - - public EndpointI(Instance instance) - { - _instance = instance; - _addr = ""; - _uuid = null; - _name = ""; - _channel = 0; - _timeout = instance.defaultTimeout(); - _connectionId = ""; - _compress = false; - } - - public EndpointI(Instance instance, Ice.InputStream s) - { - _instance = instance; - - // - // _name and _channel are not marshaled. - // - _name = ""; - _channel = 0; - - _addr = s.readString().toUpperCase(); - if(!BluetoothAdapter.checkBluetoothAddress(_addr)) - { - throw new Ice.MarshalException("invalid address `" + _addr + "' in endpoint"); - } - - try - { - _uuid = UUID.fromString(s.readString()); - } - catch(IllegalArgumentException ex) - { - throw new Ice.MarshalException("invalid UUID for Bluetooth endpoint", ex); - } - - _timeout = s.readInt(); - _compress = s.readBool(); - hashInit(); - } - - @Override - public void streamWriteImpl(Ice.OutputStream s) - { - // - // _name and _channel are not marshaled. - // - s.writeString(_addr); - s.writeString(_uuid.toString()); - s.writeInt(_timeout); - s.writeBool(_compress); - } - - @Override - public short type() - { - return _instance.type(); - } - - @Override - public String protocol() - { - return _instance.protocol(); - } - - @Override - public int timeout() - { - return _timeout; - } - - @Override - public IceInternal.EndpointI timeout(int timeout) - { - if(timeout == _timeout) - { - return this; - } - else - { - return new EndpointI(_instance, _addr, _uuid, _name, _channel, timeout, _connectionId, _compress); - } - } - - @Override - public String connectionId() - { - return _connectionId; - } - - @Override - public IceInternal.EndpointI connectionId(String connectionId) - { - if(connectionId.equals(_connectionId)) - { - return this; - } - else - { - return new EndpointI(_instance, _addr, _uuid, _name, _channel, _timeout, connectionId, _compress); - } - } - - @Override - public boolean compress() - { - return _compress; - } - - @Override - public IceInternal.EndpointI compress(boolean compress) - { - if(compress == _compress) - { - return this; - } - else - { - return new EndpointI(_instance, _addr, _uuid, _name, _channel, _timeout, _connectionId, compress); - } - } - - @Override - public boolean datagram() - { - return false; - } - - @Override - public boolean secure() - { - return _instance.secure(); - } - - @Override - public IceInternal.Transceiver transceiver() - { - return null; - } - - @Override - public void connectors_async(Ice.EndpointSelectionType selType, IceInternal.EndpointI_connectors callback) - { - java.util.List<IceInternal.Connector> conns = new java.util.ArrayList<IceInternal.Connector>(); - conns.add(new ConnectorI(_instance, _addr, _uuid, _timeout, _connectionId)); - callback.connectors(conns); - } - - @Override - public IceInternal.Acceptor acceptor(String adapterName) - { - return new AcceptorI(this, _instance, adapterName, _uuid, _name); - } - - @Override - public java.util.List<IceInternal.EndpointI> expand() - { - java.util.List<IceInternal.EndpointI> endps = new java.util.ArrayList<IceInternal.EndpointI>(); - endps.add(this); - return endps; - } - - @Override - public boolean equivalent(IceInternal.EndpointI endpoint) - { - if(!(endpoint instanceof EndpointI)) - { - return false; - } - EndpointI btEndpointI = (EndpointI)endpoint; - return btEndpointI.type() == type() && btEndpointI._addr.equals(_addr) && btEndpointI._uuid.equals(_uuid) && - btEndpointI._channel == _channel; - } - - @Override - public String options() - { - // - // WARNING: Certain features, such as proxy validation in Glacier2, - // depend on the format of proxy strings. Changes to toString() and - // methods called to generate parts of the reference string could break - // these features. Please review for all features that depend on the - // format of proxyToString() before changing this and related code. - // - String s = ""; - - if(_addr != null && _addr.length() > 0) - { - s += " -a "; - boolean addQuote = _addr.indexOf(':') != -1; - if(addQuote) - { - s += "\""; - } - s += _addr; - if(addQuote) - { - s += "\""; - } - } - - if(_uuid != null) - { - s += " -u "; - String uuidStr = _uuid.toString(); - boolean addQuote = uuidStr.indexOf(':') != -1; - if(addQuote) - { - s += "\""; - } - s += uuidStr; - if(addQuote) - { - s += "\""; - } - } - - if(_channel > 0) - { - s += " -c " + _channel; - } - - if(_timeout == -1) - { - s += " -t infinite"; - } - else - { - s += " -t " + _timeout; - } - - if(_compress) - { - s += " -z"; - } - - return s; - } - - public void initWithOptions(java.util.ArrayList<String> args, boolean oaEndpoint) - { - super.initWithOptions(args); - - if(_addr.length() == 0) - { - _addr = _instance.defaultHost(); - if(_addr == null) - { - _addr = ""; - } - } - - if(_addr.length() == 0 || _addr.equals("*")) - { - if(oaEndpoint) - { - // - // Ignore a missing address, we always use the default adapter anyway. - // - } - else - { - throw new Ice.EndpointParseException( - "a device address must be specified using the -a option or Ice.Default.Host"); - } - } - - if(_name.length() == 0) - { - _name = "Ice Service"; - } - - if(_uuid == null) - { - if(oaEndpoint) - { - // - // Generate a UUID for object adapters that don't specify one. - // - _uuid = UUID.randomUUID(); - } - else - { - throw new Ice.EndpointParseException("a UUID must be specified using the -u option"); - } - } - - hashInit(); - } - - @Override - public Ice.EndpointInfo getInfo() - { - EndpointInfo info = new EndpointInfo() - { - @Override - public short type() - { - return EndpointI.this.type(); - } - - @Override - public boolean datagram() - { - return EndpointI.this.datagram(); - } - - @Override - public boolean secure() - { - return EndpointI.this.secure(); - } - }; - info.addr = _addr; - info.uuid = _uuid.toString(); - return info; - } - - @Override - public int compareTo(IceInternal.EndpointI obj) // From java.lang.Comparable - { - if(!(obj instanceof EndpointI)) - { - return type() < obj.type() ? -1 : 1; - } - - EndpointI p = (EndpointI)obj; - if(this == p) - { - return 0; - } - - int v = _addr.compareTo(p._addr); - if(v != 0) - { - return v; - } - - v = _uuid.toString().compareTo(p._uuid.toString()); - if(v != 0) - { - return v; - } - - if(_channel < p._channel) - { - return -1; - } - else if(p._channel < _channel) - { - return 1; - } - - if(_timeout < p._timeout) - { - return -1; - } - else if(p._timeout < _timeout) - { - return 1; - } - - v = _connectionId.compareTo(p._connectionId); - if(v != 0) - { - return v; - } - - if(!_compress && p._compress) - { - return -1; - } - else if(!p._compress && _compress) - { - return 1; - } - - return 0; - } - - @Override - public int hashCode() - { - return _hashValue; - } - - @Override - protected boolean checkOption(String option, String argument, String endpoint) - { - if(super.checkOption(option, argument, endpoint)) - { - return true; - } - - if(option.equals("-a")) - { - if(argument == null) - { - throw new Ice.EndpointParseException("no argument provided for -a option in endpoint " + endpoint); - } - if(!argument.equals("*") && !BluetoothAdapter.checkBluetoothAddress(argument.toUpperCase())) - { - throw new Ice.EndpointParseException("invalid address provided for -a option in endpoint " + endpoint); - } - _addr = argument.toUpperCase(); // Android requires a hardware address to use upper case letters. - } - else if(option.equals("-u")) - { - if(argument == null) - { - throw new Ice.EndpointParseException("no argument provided for -u option in endpoint " + endpoint); - } - try - { - _uuid = UUID.fromString(argument); - } - catch(IllegalArgumentException ex) - { - throw new Ice.EndpointParseException("invalid UUID for Bluetooth endpoint", ex); - } - } - else if(option.equals("-c")) - { - if(argument == null) - { - throw new Ice.EndpointParseException("no argument provided for -c option in endpoint " + endpoint); - } - - try - { - _channel = Integer.parseInt(argument); - } - catch(NumberFormatException ex) - { - throw new Ice.EndpointParseException("invalid channel value `" + argument + - "' in endpoint " + endpoint); - } - - if(_channel < 0 || _channel > 30) // RFCOMM channel limit is 30 - { - throw new Ice.EndpointParseException("channel value `" + argument + - "' out of range in endpoint " + endpoint); - } - } - else if(option.equals("-t")) - { - if(argument == null) - { - throw new Ice.EndpointParseException("no argument provided for -t option in endpoint " + endpoint); - } - - if(argument.equals("infinite")) - { - _timeout = -1; - } - else - { - try - { - _timeout = Integer.parseInt(argument); - if(_timeout < 1) - { - throw new Ice.EndpointParseException("invalid timeout value `" + argument + "' in endpoint " + - endpoint); - } - } - catch(NumberFormatException ex) - { - throw new Ice.EndpointParseException("invalid timeout value `" + argument + "' in endpoint " + - endpoint); - } - } - } - else if(option.equals("-z")) - { - if(argument != null) - { - throw new Ice.EndpointParseException("unexpected argument `" + argument + - "' provided for -z option in " + endpoint); - } - - _compress = true; - } - else if(option.equals("--name")) - { - if(argument == null) - { - throw new Ice.EndpointParseException("no argument provided for --name option in endpoint " + endpoint); - } - - _name = argument; - } - else - { - return false; - } - return true; - } - - private void hashInit() - { - int h = 5381; - h = IceInternal.HashUtil.hashAdd(h, _addr); - h = IceInternal.HashUtil.hashAdd(h, _uuid.toString()); - h = IceInternal.HashUtil.hashAdd(h, _timeout); - h = IceInternal.HashUtil.hashAdd(h, _connectionId); - h = IceInternal.HashUtil.hashAdd(h, _compress); - _hashValue = h; - } - - private Instance _instance; - private String _addr; - private UUID _uuid; - private String _name; - private int _channel; - private int _timeout; - private String _connectionId; - private boolean _compress; - private int _hashValue; -} diff --git a/java/src/IceBT/src/main/java/IceBT/Instance.java b/java/src/IceBT/src/main/java/IceBT/Instance.java deleted file mode 100644 index db5d516adcb..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/Instance.java +++ /dev/null @@ -1,54 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -import android.bluetooth.BluetoothAdapter; - -class Instance extends IceInternal.ProtocolInstance -{ - Instance(Ice.Communicator communicator, short type, String protocol) - { - // - // We consider the transport to be "secure" because it uses the secure versions Android's Bluetooth API - // methods for establishing and accepting connections. The boolean argument below sets secure=true. - // - super(communicator, type, protocol, true); - - _communicator = communicator; - - _bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); - if(_bluetoothAdapter == null) - { - throw new Ice.PluginInitializationException("bluetooth adapter not available"); - } - else if(!_bluetoothAdapter.isEnabled()) - { - throw new Ice.PluginInitializationException("bluetooth is not enabled"); - } - } - - void destroy() - { - _communicator = null; - } - - Ice.Communicator communicator() - { - return _communicator; - } - - BluetoothAdapter bluetoothAdapter() - { - return _bluetoothAdapter; - } - - private Ice.Communicator _communicator; - private BluetoothAdapter _bluetoothAdapter; -} diff --git a/java/src/IceBT/src/main/java/IceBT/PluginFactory.java b/java/src/IceBT/src/main/java/IceBT/PluginFactory.java deleted file mode 100644 index fc523108cae..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/PluginFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -/** - * Plug-in factories must implement this interface. - **/ -public class PluginFactory implements Ice.PluginFactory -{ - /** - * Returns a new plug-in. - * - * @param communicator The communicator for the plug-in. - * @param name The name of the plug-in. - * @param args The arguments that are specified in the plug-in's configuration. - * - * @return The new plug-in. <code>null</code> can be returned to indicate - * that a general error occurred. Alternatively, <code>create</code> can throw - * {@link PluginInitializationException} to provide more detailed information. - **/ - @Override - public Ice.Plugin - create(Ice.Communicator communicator, String name, String[] args) - { - return new PluginI(communicator); - } -} diff --git a/java/src/IceBT/src/main/java/IceBT/PluginI.java b/java/src/IceBT/src/main/java/IceBT/PluginI.java deleted file mode 100644 index bee179f55ca..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/PluginI.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -class PluginI implements Ice.Plugin -{ - public PluginI(Ice.Communicator communicator) - { - final IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(communicator); - - // - // Register the endpoint factory. We have to do this now, rather than - // in initialize, because the communicator may need to interpret - // proxies before the plug-in is fully initialized. - // - EndpointFactoryI factory = new EndpointFactoryI(new Instance(communicator, Ice.BTEndpointType.value, "bt")); - facade.addEndpointFactory(factory); - - IceInternal.EndpointFactory sslFactory = facade.getEndpointFactory(Ice.SSLEndpointType.value); - if(sslFactory != null) - { - Instance instance = new Instance(communicator, Ice.BTSEndpointType.value, "bts"); - facade.addEndpointFactory(sslFactory.clone(instance, new EndpointFactoryI(instance))); - } - } - - @Override - public void initialize() - { - } - - @Override - public void destroy() - { - } -} diff --git a/java/src/IceBT/src/main/java/IceBT/TransceiverI.java b/java/src/IceBT/src/main/java/IceBT/TransceiverI.java deleted file mode 100644 index fe6df651826..00000000000 --- a/java/src/IceBT/src/main/java/IceBT/TransceiverI.java +++ /dev/null @@ -1,693 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceBT; - -import java.lang.Thread; -import java.nio.ByteBuffer; -import java.nio.channels.*; -import java.util.UUID; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.BluetoothDevice; -import android.bluetooth.BluetoothSocket; - -final class TransceiverI implements IceInternal.Transceiver -{ - @Override - public java.nio.channels.SelectableChannel fd() - { - // - // Android doesn't provide non-blocking APIs for Bluetooth. - // - return null; - } - - @Override - public void setReadyCallback(IceInternal.ReadyCallback callback) - { - _readyCallback = callback; - } - - @Override - public synchronized int initialize(IceInternal.Buffer readBuffer, IceInternal.Buffer writeBuffer) - { - if(_exception != null) - { - throw _exception; - //throw (Ice.LocalException) _exception.fillInStackTrace(); - } - - if(_state == StateConnecting) - { - // - // Wait until the connect thread is finished. - // - return IceInternal.SocketOperation.Read; - } - else if(_state == StateConnected) - { - // - // Update our Read state to indicate whether we still have more data waiting to be read. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, _readBuffer.b.position() > 0); - } - - return IceInternal.SocketOperation.None; - } - - @Override - public int closing(boolean initiator, Ice.LocalException ex) - { - // - // If we are initiating the connection closure, wait for the peer - // to close the connection. Otherwise, close immediately. - // - return initiator ? IceInternal.SocketOperation.Read : IceInternal.SocketOperation.None; - } - - @Override - public void close() - { - Thread connectThread = null, readThread = null, writeThread = null; - - synchronized(this) - { - // - // Close the socket first in order to interrupt the helper threads. - // - if(_socket != null) - { - try - { - _socket.close(); - } - catch(java.io.IOException ex) - { - // Ignore. - } - _socket = null; - } - - connectThread = _connectThread; - _connectThread = null; - readThread = _readThread; - _readThread = null; - writeThread = _writeThread; - _writeThread = null; - - _state = StateClosed; - - if(writeThread != null) - { - notifyAll(); // Wake up the read/write threads. - } - } - - if(connectThread != null) - { - try - { - connectThread.join(); - } - catch(InterruptedException ex) - { - // Ignore. - } - } - - if(readThread != null) - { - try - { - readThread.join(); - } - catch(InterruptedException ex) - { - // Ignore. - } - } - - if(writeThread != null) - { - try - { - writeThread.join(); - } - catch(InterruptedException ex) - { - // Ignore. - } - } - } - - @Override - public IceInternal.EndpointI bind() - { - assert(false); - return null; - } - - @Override - public synchronized int write(IceInternal.Buffer buf) - { - if(_exception != null) - { - throw _exception; - //throw (Ice.LocalException) _exception.fillInStackTrace(); - } - - // - // Accept up to _sndSize bytes in our internal buffer. - // - final int capacity = _sndSize - _writeBuffer.b.position(); - if(capacity > 0) - { - final int num = Math.min(capacity, buf.b.remaining()); - _writeBuffer.expand(num); - final int lim = buf.b.limit(); // Save the current limit. - buf.b.limit(buf.b.position() + num); // Temporarily change the limit. - _writeBuffer.b.put(buf.b); // Copy to our internal buffer. - buf.b.limit(lim); // Restore the previous limit. - - notifyAll(); // We've added data to the internal buffer, so wake up the write thread. - } - - return buf.b.hasRemaining() ? IceInternal.SocketOperation.Write : IceInternal.SocketOperation.None; - } - - @Override - public synchronized int read(IceInternal.Buffer buf) - { - if(_exception != null) - { - throw _exception; - //throw (Ice.LocalException) _exception.fillInStackTrace(); - } - - // - // Copy the requested amount of data from our internal buffer to the given buffer. - // - _readBuffer.b.flip(); - if(_readBuffer.b.hasRemaining()) - { - int bytesAvailable = _readBuffer.b.remaining(); - int bytesNeeded = buf.b.remaining(); - if(bytesAvailable > bytesNeeded) - { - bytesAvailable = bytesNeeded; - } - if(buf.b.hasArray()) - { - // - // Copy directly into the destination buffer's backing array. - // - byte[] arr = buf.b.array(); - _readBuffer.b.get(arr, buf.b.arrayOffset() + buf.b.position(), bytesAvailable); - buf.b.position(buf.b.position() + bytesAvailable); - } - else if(_readBuffer.b.hasArray()) - { - // - // Copy directly from the source buffer's backing array. - // - byte[] arr = _readBuffer.b.array(); - buf.b.put(arr, _readBuffer.b.arrayOffset() + _readBuffer.b.position(), bytesAvailable); - _readBuffer.b.position(_readBuffer.b.position() + bytesAvailable); - } - else - { - // - // Copy using a temporary array. - // - byte[] arr = new byte[bytesAvailable]; - _readBuffer.b.get(arr); - buf.b.put(arr); - } - } - _readBuffer.b.compact(); - - // - // The read thread will temporarily stop reading if we exceed our configured limit. - // - if(_readBuffer.b.position() < _rcvSize) - { - notifyAll(); - } - - // - // Update our Read state to indicate whether we still have more data waiting to be read. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, _readBuffer.b.position() > 0); - - return buf.b.hasRemaining() ? IceInternal.SocketOperation.Read : IceInternal.SocketOperation.None; - } - - @Override - public String protocol() - { - return _instance.protocol(); - } - - @Override - public String toString() - { - return _desc; - } - - @Override - public String toDetailedString() - { - return toString(); - } - - @Override - public Ice.ConnectionInfo getInfo() - { - ConnectionInfo info = new ConnectionInfo(); - info.incoming = _adapterName != null; - info.adapterName = _adapterName != null ? _adapterName : ""; - info.connectionId = _connectionId; - info.rcvSize = _rcvSize; - info.sndSize = _sndSize; - info.localAddress = BluetoothAdapter.getDefaultAdapter().getAddress(); - //info.localChannel - not available, use default value of -1 - info.remoteAddress = _remoteAddr; - //info.remoteChannel - not available, use default value of -1 - info.uuid = _uuid.toString(); - return info; - } - - @Override - public synchronized void setBufferSize(int rcvSize, int sndSize) - { - _rcvSize = Math.max(1024, rcvSize); - _sndSize = Math.max(1024, sndSize); - } - - @Override - public void checkSendSize(IceInternal.Buffer buf) - { - } - - // - // Used by ConnectorI. - // - TransceiverI(Instance instance, String remoteAddr, UUID uuid, String connectionId) - { - _instance = instance; - _remoteAddr = remoteAddr; - _uuid = uuid; - _connectionId = connectionId; - _state = StateConnecting; - - init(); - - BluetoothAdapter adapter = _instance.bluetoothAdapter(); - assert(adapter != null); - - BluetoothDevice device = null; - try - { - device = adapter.getRemoteDevice(_remoteAddr); - } - catch(IllegalArgumentException ex) - { - // - // Illegal address - This should have been detected by the endpoint. - // - assert(false); - throw new Ice.SocketException(ex); - } - - try - { - // - // We always connect using the "secure" method. - // - _socket = device.createRfcommSocketToServiceRecord(_uuid); - } - catch(java.io.IOException ex) - { - throw new Ice.SocketException(ex); - } - - _connectThread = new Thread() - { - public void run() - { - String name = "IceBT.ConnectThread"; - if(_remoteAddr != null && !_remoteAddr.isEmpty()) - { - name += "-" + _remoteAddr; - } - if(_uuid != null) - { - name += "-" + _uuid.toString(); - } - setName(name); - - runConnectThread(); - } - }; - _connectThread.start(); - } - - // - // Used by AcceptorI. - // - TransceiverI(Instance instance, BluetoothSocket socket, UUID uuid, String adapterName) - { - _instance = instance; - _remoteAddr = socket.getRemoteDevice().getAddress(); - _uuid = uuid; - _connectionId = ""; - _adapterName = adapterName; - _socket = socket; - _state = StateConnected; - - init(); - - startReadWriteThreads(); - } - - private void init() - { - _desc = "local address = " + _instance.bluetoothAdapter().getAddress(); - if(_remoteAddr != null && !_remoteAddr.isEmpty()) - { - _desc += "\nremote address = " + _remoteAddr; - } - if(_uuid != null) - { - _desc += "\nservice uuid = " + _uuid.toString(); - } - - final int defaultBufSize = 128 * 1024; - _rcvSize = _instance.properties().getPropertyAsIntWithDefault("IceBT.RcvSize", defaultBufSize); - _sndSize = _instance.properties().getPropertyAsIntWithDefault("IceBT.SndSize", defaultBufSize); - - _readBuffer = new IceInternal.Buffer(false); - _writeBuffer = new IceInternal.Buffer(false); - } - - private synchronized void exception(Ice.LocalException ex) - { - if(_exception == null) - { - _exception = ex; - } - } - - private void runConnectThread() - { - // - // Always cancel discovery prior to a connect attempt. - // - _instance.bluetoothAdapter().cancelDiscovery(); - - try - { - // - // This can block for several seconds. - // - _socket.connect(); - } - catch(java.io.IOException ex) - { - exception(new Ice.ConnectFailedException(ex)); - } - - synchronized(this) - { - _connectThread = null; - - if(_exception == null) - { - // - // Connect succeeded. - // - _state = StateConnected; - - startReadWriteThreads(); - } - } - - // - // This causes the Ice run time to invoke initialize() again. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, true); - } - - private void startReadWriteThreads() - { - String s = ""; - if(_remoteAddr != null && !_remoteAddr.isEmpty()) - { - s += "-" + _remoteAddr; - } - if(_uuid != null) - { - s += "-" + _uuid.toString(); - } - final String suffix = s; - - _readThread = new Thread() - { - public void run() - { - setName("IceBT.ReadThread" + suffix); - - runReadThread(); - } - }; - _readThread.start(); - - _writeThread = new Thread() - { - public void run() - { - setName("IceBT.WriteThread" + suffix); - - runWriteThread(); - } - }; - _writeThread.start(); - } - - private void runReadThread() - { - java.io.InputStream in = null; - - try - { - byte[] buf = null; - - synchronized(this) - { - if(_socket == null) - { - return; - } - in = _socket.getInputStream(); - - buf = new byte[_rcvSize]; - } - - while(true) - { - ByteBuffer b = null; - - synchronized(this) - { - // - // If we've read too much data, wait until the application consumes some before we read again. - // - while(_state == StateConnected && _exception == null && _readBuffer.b.position() > _rcvSize) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - break; - } - } - - if(_state != StateConnected || _exception != null) - { - break; - } - } - - int num = in.read(buf); - if(num > 0) - { - synchronized(this) - { - _readBuffer.expand(num); - _readBuffer.b.put(buf, 0, num); - _readyCallback.ready(IceInternal.SocketOperation.Read, true); - - if(buf.length != _rcvSize) - { - // - // Application must have called setBufferSize. - // - buf = new byte[_rcvSize]; - } - } - } - } - } - catch(java.io.IOException ex) - { - exception(new Ice.SocketException(ex)); - // - // Mark as ready for reading so that the Ice run time will invoke read() and we can report the exception. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, true); - } - catch(Ice.LocalException ex) - { - exception(ex); - // - // Mark as ready for reading so that the Ice run time will invoke read() and we can report the exception. - // - _readyCallback.ready(IceInternal.SocketOperation.Read, true); - } - finally - { - if(in != null) - { - try - { - in.close(); - } - catch(java.io.IOException ex) - { - // Ignore. - } - } - } - } - - private void runWriteThread() - { - java.io.OutputStream out = null; - - try - { - synchronized(this) - { - if(_socket == null) - { - return; - } - out = _socket.getOutputStream(); - } - - boolean done = false; - while(!done) - { - ByteBuffer b = null; - - synchronized(this) - { - while(_state == StateConnected && _exception == null && _writeBuffer.b.position() == 0) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - break; - } - } - - if(_state != StateConnected || _exception != null) - { - done = true; - } - - b = _writeBuffer.b; // Adopt the ByteBuffer. - _writeBuffer.clear(); - } - - assert(b != null && b.hasArray()); - b.flip(); - if(b.hasRemaining() && !done) - { - // - // write() blocks until all the data has been written. - // - out.write(b.array(), b.arrayOffset(), b.remaining()); - } - - // TBD: Recycle the buffer? - - synchronized(this) - { - // - // After the write is complete, indicate whether we can accept more data. - // - _readyCallback.ready(IceInternal.SocketOperation.Write, _writeBuffer.b.position() < _sndSize); - } - } - } - catch(java.io.IOException ex) - { - exception(new Ice.SocketException(ex)); - } - finally - { - if(out != null) - { - try - { - out.close(); - } - catch(java.io.IOException ex) - { - // Ignore. - } - } - } - } - - private Instance _instance; - private String _remoteAddr; - private UUID _uuid; - private String _connectionId; - private String _adapterName; - - private BluetoothSocket _socket; - - private static final int StateConnecting = 0; - private static final int StateConnected = 1; - private static final int StateClosed = 2; - private int _state; - - private Thread _connectThread; - private Thread _readThread; - private Thread _writeThread; - - private Ice.LocalException _exception; - - private int _rcvSize; - private int _sndSize; - - private IceInternal.Buffer _readBuffer; - private IceInternal.Buffer _writeBuffer; - - private String _desc; - - private IceInternal.ReadyCallback _readyCallback; -} diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java b/java/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java deleted file mode 100644 index 8d00d879d3b..00000000000 --- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -// -// This is a placeholder for the Android API. It is not included in the IceBT JAR file. -// - -package android.bluetooth; - -public final class BluetoothAdapter -{ - public boolean cancelDiscovery() - { - return false; - } - - public boolean isEnabled() - { - return false; - } - - public String getAddress() - { - return ""; - } - - public static boolean checkBluetoothAddress(String address) - { - return false; - } - - public static BluetoothAdapter getDefaultAdapter() - { - return null; - } - - public BluetoothDevice getRemoteDevice(byte[] address) - { - return null; - } - - public BluetoothDevice getRemoteDevice(String address) - { - return null; - } - - public BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String name, java.util.UUID uuid) - throws java.io.IOException - { - return null; - } - - public BluetoothServerSocket listenUsingRfcommWithServiceRecord(String name, java.util.UUID uuid) - throws java.io.IOException - { - return null; - } -} diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java b/java/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java deleted file mode 100644 index 7fbee8880de..00000000000 --- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothDevice.java +++ /dev/null @@ -1,25 +0,0 @@ -// -// This is a placeholder for the Android API. It is not included in the IceBT JAR file. -// - -package android.bluetooth; - -public final class BluetoothDevice -{ - public BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID uuid) - throws java.io.IOException - { - return null; - } - - public BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID uuid) - throws java.io.IOException - { - return null; - } - - public String getAddress() - { - return ""; - } -} diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java b/java/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java deleted file mode 100644 index c6e6f2a6978..00000000000 --- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothServerSocket.java +++ /dev/null @@ -1,19 +0,0 @@ -// -// This is a placeholder for the Android API. It is not included in the IceBT JAR file. -// - -package android.bluetooth; - -public final class BluetoothServerSocket implements java.io.Closeable -{ - public BluetoothSocket accept() - throws java.io.IOException - { - return null; - } - - public void close() - throws java.io.IOException - { - } -} diff --git a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java b/java/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java deleted file mode 100644 index 80470a11a52..00000000000 --- a/java/src/IceBT/src/main/java/android/bluetooth/BluetoothSocket.java +++ /dev/null @@ -1,40 +0,0 @@ -// -// This is a placeholder for the Android API. It is not included in the IceBT JAR file. -// - -package android.bluetooth; - -public final class BluetoothSocket implements java.io.Closeable -{ - public void close() - throws java.io.IOException - { - } - - public void connect() - throws java.io.IOException - { - } - - public java.io.InputStream getInputStream() - throws java.io.IOException - { - return null; - } - - public java.io.OutputStream getOutputStream() - throws java.io.IOException - { - return null; - } - - public BluetoothDevice getRemoteDevice() - { - return null; - } - - public boolean isConnected() - { - return false; - } -} diff --git a/java/src/IceBox/build.gradle b/java/src/IceBox/build.gradle index 8ef453cc9fb..7d8bad65ca1 100644 --- a/java/src/IceBox/build.gradle +++ b/java/src/IceBox/build.gradle @@ -7,8 +7,10 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "IceBox" project.ext.description = "IceBox is an easy-to-use framework for Ice application services" @@ -16,7 +18,7 @@ project.ext.description = "IceBox is an easy-to-use framework for Ice applicatio slice { java { set1 { - args = "--ice --tie --checksum IceBox.SliceChecksums" + args = "--ice --checksum com.zeroc.IceBox.SliceChecksums" files = fileTree(dir: "$sliceDir/IceBox", includes:['*.ice'], excludes:["*F.ice"]) } } diff --git a/java/src/IceBox/src/main/java/IceBox/Admin.java b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Admin.java index 52e39ee771e..ace16b7d0b7 100644 --- a/java/src/IceBox/src/main/java/IceBox/Admin.java +++ b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Admin.java @@ -7,14 +7,13 @@ // // ********************************************************************** -package IceBox; +package com.zeroc.IceBox; public final class Admin { - private static class Client extends Ice.Application + private static class Client extends com.zeroc.Ice.Application { - private void - usage() + private void usage() { System.err.println( "Usage: " + appName() + " [options] [command...]\n" + @@ -28,10 +27,9 @@ public final class Admin } @Override - public int - run(String[] args) + public int run(String[] args) { - java.util.List<String> commands = new java.util.ArrayList<String>(); + java.util.List<String> commands = new java.util.ArrayList<>(); int idx = 0; while(idx < args.length) @@ -60,7 +58,7 @@ public final class Admin return 0; } - Ice.ObjectPrx base = communicator().propertyToProxy("IceBoxAdmin.ServiceManager.Proxy"); + com.zeroc.Ice.ObjectPrx base = communicator().propertyToProxy("IceBoxAdmin.ServiceManager.Proxy"); if(base == null) { @@ -68,9 +66,9 @@ public final class Admin // The old deprecated way to retrieve the service manager proxy // - Ice.Properties properties = communicator().getProperties(); + com.zeroc.Ice.Properties properties = communicator().getProperties(); - Ice.Identity managerIdentity = new Ice.Identity(); + com.zeroc.Ice.Identity managerIdentity = new com.zeroc.Ice.Identity(); managerIdentity.category = properties.getPropertyWithDefault("IceBox.InstanceName", "IceBox"); managerIdentity.name = "ServiceManager"; @@ -84,7 +82,8 @@ public final class Admin return 1; } - managerProxy = "\"" + Ice.Util.identityToString(managerIdentity) + "\" :" + managerEndpoints; + managerProxy = "\"" + com.zeroc.Ice.Util.identityToString(managerIdentity) + "\" :" + + managerEndpoints; } else { @@ -95,13 +94,14 @@ public final class Admin return 1; } - managerProxy = "\"" + Ice.Util.identityToString(managerIdentity) + "\" @" + managerAdapterId; + managerProxy = "\"" + com.zeroc.Ice.Util.identityToString(managerIdentity) + "\" @" + + managerAdapterId; } base = communicator().stringToProxy(managerProxy); } - IceBox.ServiceManagerPrx manager = IceBox.ServiceManagerPrxHelper.checkedCast(base); + com.zeroc.IceBox.ServiceManagerPrx manager = com.zeroc.IceBox.ServiceManagerPrx.checkedCast(base); if(manager == null) { System.err.println(appName() + ": `" + base.toString() + "' is not an IceBox::ServiceManager"); @@ -128,12 +128,12 @@ public final class Admin { manager.startService(service); } - catch(IceBox.NoSuchServiceException ex) + catch(com.zeroc.IceBox.NoSuchServiceException ex) { System.err.println(appName() + ": unknown service `" + service + "'"); return 1; } - catch(IceBox.AlreadyStartedException ex) + catch(com.zeroc.IceBox.AlreadyStartedException ex) { System.err.println(appName() + "service already started."); } @@ -151,12 +151,12 @@ public final class Admin { manager.stopService(service); } - catch(IceBox.NoSuchServiceException ex) + catch(com.zeroc.IceBox.NoSuchServiceException ex) { System.err.println(appName() + ": unknown service `" + service + "'"); return 1; } - catch(IceBox.AlreadyStoppedException ex) + catch(com.zeroc.IceBox.AlreadyStoppedException ex) { System.err.println(appName() + "service already stopped."); } @@ -173,8 +173,7 @@ public final class Admin } } - public static void - main(String[] args) + public static void main(String[] args) { Client app = new Client(); int rc = app.main("IceBox.Admin", args); diff --git a/java/src/IceBox/src/main/java/IceBox/Server.java b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Server.java index f6147ea423b..0ceb87215d8 100644 --- a/java/src/IceBox/src/main/java/IceBox/Server.java +++ b/java/src/IceBox/src/main/java/com/zeroc/IceBox/Server.java @@ -7,25 +7,23 @@ // // ********************************************************************** -package IceBox; +package com.zeroc.IceBox; -public final class Server extends Ice.Application +public final class Server extends com.zeroc.Ice.Application { - private static void - usage() + private static void usage() { - System.err.println("Usage: IceBox.Server [options] --Ice.Config=<file>\n"); + System.err.println("Usage: com.zeroc.IceBox.Server [options] --Ice.Config=<file>\n"); System.err.println( "Options:\n" + "-h, --help Show this message.\n" ); } - public static void - main(String[] args) + public static void main(String[] args) { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(); + com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData(); + initData.properties = com.zeroc.Ice.Util.createProperties(); initData.properties.setProperty("Ice.Admin.DelayCreation", "1"); Server server = new Server(); @@ -33,13 +31,12 @@ public final class Server extends Ice.Application } @Override - public int - run(String[] args) + public int run(String[] args) { final String prefix = "IceBox.Service."; - Ice.Properties properties = communicator().getProperties(); + com.zeroc.Ice.Properties properties = communicator().getProperties(); java.util.Map<String, String> services = properties.getPropertiesForPrefix(prefix); - java.util.List<String> argSeq = new java.util.ArrayList<String>(args.length); + java.util.List<String> argSeq = new java.util.ArrayList<>(args.length); for(String s : args) { argSeq.add(s); diff --git a/java/src/IceBox/src/main/java/IceBox/ServiceManagerI.java b/java/src/IceBox/src/main/java/com/zeroc/IceBox/ServiceManagerI.java index ceefc3170ff..17ec55be0db 100644 --- a/java/src/IceBox/src/main/java/IceBox/ServiceManagerI.java +++ b/java/src/IceBox/src/main/java/com/zeroc/IceBox/ServiceManagerI.java @@ -7,23 +7,26 @@ // // ********************************************************************** -package IceBox; +package com.zeroc.IceBox; import java.net.URLEncoder; +import com.zeroc.Ice.Current; +import com.zeroc.Ice.Properties; +import com.zeroc.Ice.Util; + // // NOTE: the class isn't final on purpose to allow users to eventually // extend it. // -public class ServiceManagerI extends _ServiceManagerDisp +public class ServiceManagerI implements ServiceManager { - public - ServiceManagerI(Ice.Communicator communicator, String[] args) + public ServiceManagerI(com.zeroc.Ice.Communicator communicator, String[] args) { _communicator = communicator; _logger = _communicator.getLogger(); - Ice.Properties props = _communicator.getProperties(); + Properties props = _communicator.getProperties(); if(props.getProperty("Ice.Admin.Enabled").isEmpty()) { @@ -39,50 +42,27 @@ public class ServiceManagerI extends _ServiceManagerDisp String[] facetFilter = props.getPropertyAsList("Ice.Admin.Facets"); if(facetFilter.length > 0) { - _adminFacetFilter = new java.util.HashSet<String>(java.util.Arrays.asList(facetFilter)); + _adminFacetFilter = new java.util.HashSet<>(java.util.Arrays.asList(facetFilter)); } else { - _adminFacetFilter = new java.util.HashSet<String>(); + _adminFacetFilter = new java.util.HashSet<>(); } } _argv = args; _traceServiceObserver = props.getPropertyAsInt("IceBox.Trace.ServiceObserver"); - _observerCompletedCB = new Ice.Callback() - { - @Override - public void completed(Ice.AsyncResult result) - { - try - { - result.throwLocalException(); - } - catch(Ice.LocalException ex) - { - ServiceObserverPrx observer = ServiceObserverPrxHelper.uncheckedCast(result.getProxy()); - synchronized(ServiceManagerI.this) - { - if(_observers.remove(observer)) - { - observerRemoved(observer, ex); - } - } - } - } - }; } @Override - public java.util.Map<String, String> - getSliceChecksums(Ice.Current current) + public java.util.Map<String, String> getSliceChecksums(Current current) { return SliceChecksums.checksums; } @Override public void - startService(String name, Ice.Current current) + startService(String name, Current current) throws AlreadyStartedException, NoSuchServiceException { ServiceInfo info = null; @@ -137,7 +117,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { p.status = StatusStarted; - java.util.List<String> services = new java.util.ArrayList<String>(); + java.util.List<String> services = new java.util.ArrayList<>(); services.add(name); servicesStarted(services, _observers); } @@ -154,8 +134,7 @@ public class ServiceManagerI extends _ServiceManagerDisp } @Override - public void - stopService(String name, Ice.Current current) + public void stopService(String name, Current current) throws AlreadyStoppedException, NoSuchServiceException { ServiceInfo info = null; @@ -210,7 +189,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { p.status = StatusStopped; - java.util.List<String> services = new java.util.ArrayList<String>(); + java.util.List<String> services = new java.util.ArrayList<>(); services.add(name); servicesStopped(services, _observers); } @@ -227,10 +206,9 @@ public class ServiceManagerI extends _ServiceManagerDisp } @Override - public void - addObserver(final ServiceObserverPrx observer, Ice.Current current) + public void addObserver(final ServiceObserverPrx observer, Current current) { - java.util.List<String> activeServices = new java.util.LinkedList<String>(); + java.util.List<String> activeServices = new java.util.LinkedList<>(); // // Null observers and duplicate registrations are ignored @@ -258,35 +236,37 @@ public class ServiceManagerI extends _ServiceManagerDisp if(activeServices.size() > 0) { - observer.begin_servicesStarted(activeServices.toArray(new String[0]), _observerCompletedCB); + observer.servicesStartedAsync(activeServices.toArray(new String[0])).exceptionally(ex -> + { + observerFailed(observer, ex); + return null; + }); } } @Override - public void - shutdown(Ice.Current current) + public void shutdown(Current current) { _communicator.shutdown(); } - public int - run() + public int run() { try { - Ice.Properties properties = _communicator.getProperties(); + Properties properties = _communicator.getProperties(); // // Create an object adapter. Services probably should NOT share // this object adapter, as the endpoint(s) for this object adapter // will most likely need to be firewalled for security reasons. // - Ice.ObjectAdapter adapter = null; + com.zeroc.Ice.ObjectAdapter adapter = null; if(properties.getProperty("IceBox.ServiceManager.Endpoints").length() != 0) { adapter = _communicator.createObjectAdapter("IceBox.ServiceManager"); - Ice.Identity identity = new Ice.Identity(); + com.zeroc.Ice.Identity identity = new com.zeroc.Ice.Identity(); identity.category = properties.getPropertyWithDefault("IceBox.InstanceName", "IceBox"); identity.name = "ServiceManager"; adapter.add(this, identity); @@ -304,7 +284,7 @@ public class ServiceManagerI extends _ServiceManagerDisp final String prefix = "IceBox.Service."; java.util.Map<String, String> services = properties.getPropertiesForPrefix(prefix); String[] loadOrder = properties.getPropertyAsList("IceBox.LoadOrder"); - java.util.List<StartServiceInfo> servicesInfo = new java.util.ArrayList<StartServiceInfo>(); + java.util.List<StartServiceInfo> servicesInfo = new java.util.ArrayList<>(); for(String name : loadOrder) { if(name.length() > 0) @@ -336,7 +316,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // if(properties.getPropertiesForPrefix("IceBox.UseSharedCommunicator.").size() > 0) { - Ice.InitializationData initData = new Ice.InitializationData(); + com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData(); initData.properties = createServiceProperties("SharedCommunicator"); for(StartServiceInfo service : servicesInfo) { @@ -349,9 +329,8 @@ public class ServiceManagerI extends _ServiceManagerDisp // Load the service properties using the shared communicator properties as // the default properties. // - Ice.StringSeqHolder serviceArgs = new Ice.StringSeqHolder(service.args); - Ice.Properties svcProperties = Ice.Util.createProperties(serviceArgs, initData.properties); - service.args = serviceArgs.value; + Util.CreatePropertiesResult cpr = Util.createProperties(service.args, initData.properties); + service.args = cpr.args; // // Remove properties from the shared property set that a service explicitly clears. @@ -359,7 +338,7 @@ public class ServiceManagerI extends _ServiceManagerDisp java.util.Map<String, String> allProps = initData.properties.getPropertiesForPrefix(""); for(String key : allProps.keySet()) { - if(svcProperties.getProperty(key).length() == 0) + if(cpr.properties.getProperty(key).length() == 0) { initData.properties.setProperty(key, ""); } @@ -368,7 +347,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // // Add the service properties to the shared communicator properties. // - for(java.util.Map.Entry<String, String> p : svcProperties.getPropertiesForPrefix("").entrySet()) + for(java.util.Map.Entry<String, String> p : cpr.properties.getPropertiesForPrefix("").entrySet()) { initData.properties.setProperty(p.getKey(), p.getValue()); } @@ -383,14 +362,15 @@ public class ServiceManagerI extends _ServiceManagerDisp String facetNamePrefix = "IceBox.SharedCommunicator."; boolean addFacets = configureAdmin(initData.properties, facetNamePrefix); - _sharedCommunicator = Ice.Util.initialize(initData); + _sharedCommunicator = Util.initialize(initData); if(addFacets) { // Add all facets created on shared communicator to the IceBox communicator // but renamed <prefix>.<facet-name>, except for the Process facet which is // never added. - for(java.util.Map.Entry<String, Ice.Object> p : _sharedCommunicator.findAllAdminFacets().entrySet()) + for(java.util.Map.Entry<String, com.zeroc.Ice.Object> p : + _sharedCommunicator.findAllAdminFacets().entrySet()) { if(!p.getKey().equals("Process")) { @@ -429,7 +409,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // reachable before sending a signal to shutdown the // IceBox. // - Ice.Application.shutdownOnInterrupt(); + com.zeroc.Ice.Application.shutdownOnInterrupt(); // // Register "this" as a facet to the Admin object and @@ -440,7 +420,7 @@ public class ServiceManagerI extends _ServiceManagerDisp _communicator.addAdminFacet(this, "IceBox.ServiceManager"); _communicator.getAdmin(); } - catch(Ice.ObjectAdapterDeactivatedException ex) + catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex) { // // Expected if the communicator has been shutdown. @@ -456,7 +436,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { adapter.activate(); } - catch(Ice.ObjectAdapterDeactivatedException ex) + catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex) { // // Expected if the communicator has been shutdown. @@ -465,7 +445,7 @@ public class ServiceManagerI extends _ServiceManagerDisp } _communicator.waitForShutdown(); - Ice.Application.defaultInterrupt(); + com.zeroc.Ice.Application.defaultInterrupt(); } catch(FailureException ex) { @@ -497,8 +477,8 @@ public class ServiceManagerI extends _ServiceManagerDisp return 0; } - synchronized private void - start(String service, String className, String classDir, boolean absolutePath, String[] args) + synchronized private void start(String service, String className, String classDir, boolean absolutePath, + String[] args) throws FailureException { // @@ -533,7 +513,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(_classLoaders == null) { - _classLoaders = new java.util.HashMap<String, ClassLoader>(); + _classLoaders = new java.util.HashMap<>(); } else { @@ -567,7 +547,7 @@ public class ServiceManagerI extends _ServiceManagerDisp } else { - c = IceInternal.Util.findClass(className, null); + c = com.zeroc.IceInternal.Util.findClass(className, null); } if(c == null) @@ -587,7 +567,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // defined, add the service properties to the shared // commnunicator property set. // - Ice.Communicator communicator; + com.zeroc.Ice.Communicator communicator; if(_communicator.getProperties().getPropertyAsInt("IceBox.UseSharedCommunicator." + service) > 0) { assert(_sharedCommunicator != null); @@ -601,22 +581,23 @@ public class ServiceManagerI extends _ServiceManagerDisp // Create the service properties. We use the communicator properties as the default // properties if IceBox.InheritProperties is set. // - Ice.InitializationData initData = new Ice.InitializationData(); + com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData(); initData.properties = createServiceProperties(service); - Ice.StringSeqHolder serviceArgs = new Ice.StringSeqHolder(info.args); - if(serviceArgs.value.length > 0) + String[] serviceArgs = info.args; + if(serviceArgs.length > 0) { // // Create the service properties with the given service arguments. This should // read the service config file if it's specified with --Ice.Config. // - initData.properties = Ice.Util.createProperties(serviceArgs, initData.properties); + Util.CreatePropertiesResult cpr = Util.createProperties(serviceArgs, initData.properties); + initData.properties = cpr.properties; // // Next, parse the service "<service>.*" command line options (the Ice command - // line options were parsed by the createProperties above) + // line options were parsed by the createProperties above). // - serviceArgs.value = initData.properties.parseCommandLineOptions(service, serviceArgs.value); + serviceArgs = initData.properties.parseCommandLineOptions(service, cpr.args); } // @@ -642,8 +623,9 @@ public class ServiceManagerI extends _ServiceManagerDisp // Remaining command line options are passed to the communicator. This is // necessary for Ice plug-in properties (e.g.: IceSSL). // - info.communicator = Ice.Util.initialize(serviceArgs, initData); - info.args = serviceArgs.value; + Util.InitializeResult ir = Util.initialize(serviceArgs, initData); + info.communicator = ir.communicator; + info.args = ir.args; communicator = info.communicator; if(addFacets) @@ -651,7 +633,8 @@ public class ServiceManagerI extends _ServiceManagerDisp // Add all facets created on the service communicator to the IceBox communicator // but renamed IceBox.Service.<service>.<facet-name>, except for the Process facet // which is never added - for(java.util.Map.Entry<String, Ice.Object> p : communicator.findAllAdminFacets().entrySet()) + for(java.util.Map.Entry<String, com.zeroc.Ice.Object> p : + communicator.findAllAdminFacets().entrySet()) { if(!p.getKey().equals("Process")) { @@ -677,19 +660,20 @@ public class ServiceManagerI extends _ServiceManagerDisp try { // - // If the service class provides a constructor that accepts an Ice.Communicator argument, + // If the service class provides a constructor that accepts an com.zeroc.Ice.Communicator argument, // use that in preference to the default constructor. // java.lang.Object obj = null; try { - java.lang.reflect.Constructor<?> con = c.getDeclaredConstructor(Ice.Communicator.class); + java.lang.reflect.Constructor<?> con = c.getDeclaredConstructor(com.zeroc.Ice.Communicator.class); obj = con.newInstance(_communicator); } catch(IllegalAccessException ex) { throw new FailureException( - "ServiceManager: unable to access service constructor " + className + "(Ice.Communicator)", ex); + "ServiceManager: unable to access service constructor " + className + + "(com.zeroc.Ice.Communicator)", ex); } catch(NoSuchMethodException ex) { @@ -703,7 +687,8 @@ public class ServiceManagerI extends _ServiceManagerDisp } else { - throw new FailureException("ServiceManager: exception in service constructor for " + className, ex); + throw new FailureException("ServiceManager: exception in service constructor for " + + className, ex); } } @@ -729,7 +714,8 @@ public class ServiceManagerI extends _ServiceManagerDisp } catch(ClassCastException ex) { - throw new FailureException("ServiceManager: class " + className + " does not implement IceBox.Service"); + throw new FailureException("ServiceManager: class " + className + + " does not implement com.zeroc.IceBox.Service"); } } catch(InstantiationException ex) @@ -782,8 +768,7 @@ public class ServiceManagerI extends _ServiceManagerDisp } } - private synchronized void - stopAll() + private synchronized void stopAll() { // // First wait for any active startService/stopService calls to complete. @@ -803,7 +788,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // For each service, we call stop on the service and flush its database environment to // the disk. Services are stopped in the reverse order of the order they were started. // - java.util.List<String> stoppedServices = new java.util.ArrayList<String>(); + java.util.List<String> stoppedServices = new java.util.ArrayList<>(); java.util.ListIterator<ServiceInfo> p = _services.listIterator(_services.size()); while(p.hasPrevious()) { @@ -856,8 +841,7 @@ public class ServiceManagerI extends _ServiceManagerDisp servicesStopped(stoppedServices, _observers); } - private void - servicesStarted(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers) + private void servicesStarted(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers) { if(services.size() > 0) { @@ -865,13 +849,16 @@ public class ServiceManagerI extends _ServiceManagerDisp for(final ServiceObserverPrx observer: observers) { - observer.begin_servicesStarted(servicesArray, _observerCompletedCB); + observer.servicesStartedAsync(servicesArray).exceptionally(ex -> + { + observerFailed(observer, ex); + return null; + }); } } } - private void - servicesStopped(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers) + private void servicesStopped(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers) { if(services.size() > 0) { @@ -879,13 +866,27 @@ public class ServiceManagerI extends _ServiceManagerDisp for(final ServiceObserverPrx observer: observers) { - observer.begin_servicesStopped(servicesArray, _observerCompletedCB); + observer.servicesStoppedAsync(servicesArray).exceptionally(ex -> + { + observerFailed(observer, ex); + return null; + }); + } + } + } + + private synchronized void observerFailed(ServiceObserverPrx observer, Throwable ex) + { + if(ex instanceof com.zeroc.Ice.LocalException) + { + if(_observers.remove(observer)) + { + observerRemoved(observer, (com.zeroc.Ice.LocalException)ex); } } } - private void - observerRemoved(ServiceObserverPrx observer, RuntimeException ex) + private void observerRemoved(ServiceObserverPrx observer, RuntimeException ex) { if(_traceServiceObserver >= 1) { @@ -894,7 +895,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // been sent, but the communicator was destroyed before the reply was received. We do not // log a message for this exception. // - if(!(ex instanceof Ice.CommunicatorDestroyedException)) + if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)) { _logger.trace("IceBox.ServiceObserver", "Removed service observer " + _communicator.proxyToString(observer) @@ -926,7 +927,7 @@ public class ServiceManagerI extends _ServiceManagerDisp public String name; public Service service; - public Ice.Communicator communicator = null; + public com.zeroc.Ice.Communicator communicator; public int status; public String[] args; } @@ -949,9 +950,9 @@ public class ServiceManagerI extends _ServiceManagerDisp try { - args = IceUtilInternal.Options.split(value); + args = com.zeroc.IceUtilInternal.Options.split(value); } - catch(IceUtilInternal.Options.BadQuote ex) + catch(com.zeroc.IceUtilInternal.Options.BadQuote ex) { throw new FailureException("ServiceManager: invalid arguments for service `" + name + "':\n" + ex.getMessage()); @@ -1020,7 +1021,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(serverArgs.length > 0) { - java.util.List<String> l = new java.util.ArrayList<String>(java.util.Arrays.asList(args)); + java.util.List<String> l = new java.util.ArrayList<>(java.util.Arrays.asList(args)); for(String arg : serverArgs) { if(arg.startsWith("--" + service + ".")) @@ -1039,11 +1040,10 @@ public class ServiceManagerI extends _ServiceManagerDisp boolean absolutePath; } - private Ice.Properties - createServiceProperties(String service) + private Properties createServiceProperties(String service) { - Ice.Properties properties; - Ice.Properties communicatorProperties = _communicator.getProperties(); + Properties properties; + Properties communicatorProperties = _communicator.getProperties(); if(communicatorProperties.getPropertyAsInt("IceBox.InheritProperties") > 0) { properties = communicatorProperties._clone(); @@ -1055,7 +1055,7 @@ public class ServiceManagerI extends _ServiceManagerDisp } else { - properties = Ice.Util.createProperties(); + properties = Util.createProperties(); } String programName = communicatorProperties.getProperty("Ice.ProgramName"); @@ -1070,15 +1070,14 @@ public class ServiceManagerI extends _ServiceManagerDisp return properties; } - private void - destroyServiceCommunicator(String service, Ice.Communicator communicator) + private void destroyServiceCommunicator(String service, com.zeroc.Ice.Communicator communicator) { try { communicator.shutdown(); communicator.waitForShutdown(); } - catch(Ice.CommunicatorDestroyedException e) + catch(com.zeroc.Ice.CommunicatorDestroyedException e) { // // Ignore, the service might have already destroyed @@ -1112,11 +1111,11 @@ public class ServiceManagerI extends _ServiceManagerDisp } } - private boolean configureAdmin(Ice.Properties properties, String prefix) + private boolean configureAdmin(Properties properties, String prefix) { if(_adminEnabled && properties.getProperty("Ice.Admin.Enabled").isEmpty()) { - java.util.List<String> facetNames = new java.util.LinkedList<String>(); + java.util.List<String> facetNames = new java.util.LinkedList<>(); for(String p : _adminFacetFilter) { if(p.startsWith(prefix)) @@ -1132,7 +1131,8 @@ public class ServiceManagerI extends _ServiceManagerDisp if(!facetNames.isEmpty()) { // TODO: need joinString with escape! - properties.setProperty("Ice.Admin.Facets", IceUtilInternal.StringUtil.joinString(facetNames, " ")); + properties.setProperty("Ice.Admin.Facets", + com.zeroc.IceUtilInternal.StringUtil.joinString(facetNames, " ")); } return true; } @@ -1152,27 +1152,26 @@ public class ServiceManagerI extends _ServiceManagerDisp } } } - catch(Ice.CommunicatorDestroyedException ex) + catch(com.zeroc.Ice.CommunicatorDestroyedException ex) { // Ignored } - catch(Ice.ObjectAdapterDeactivatedException ex) + catch(com.zeroc.Ice.ObjectAdapterDeactivatedException ex) { // Ignored } } - private Ice.Communicator _communicator; + private com.zeroc.Ice.Communicator _communicator; private boolean _adminEnabled = false; private java.util.Set<String> _adminFacetFilter; - private Ice.Communicator _sharedCommunicator; - private Ice.Logger _logger; + private com.zeroc.Ice.Communicator _sharedCommunicator; + private com.zeroc.Ice.Logger _logger; private String[] _argv; // Filtered server argument vector - private java.util.List<ServiceInfo> _services = new java.util.LinkedList<ServiceInfo>(); + private java.util.List<ServiceInfo> _services = new java.util.LinkedList<>(); private boolean _pendingStatusChanges = false; - private Ice.Callback _observerCompletedCB; - private java.util.HashSet<ServiceObserverPrx> _observers = new java.util.HashSet<ServiceObserverPrx>(); + private java.util.HashSet<ServiceObserverPrx> _observers = new java.util.HashSet<>(); private int _traceServiceObserver = 0; private java.util.Map<String, ClassLoader> _classLoaders; } diff --git a/java/src/IceDiscovery/build.gradle b/java/src/IceDiscovery/build.gradle index 9c7b78cfcc1..75e09daf79a 100644 --- a/java/src/IceDiscovery/build.gradle +++ b/java/src/IceDiscovery/build.gradle @@ -7,8 +7,10 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "IceDiscovery" project.ext.description = "Allow Ice applications to discover objects and object adapters" diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java b/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java deleted file mode 100644 index 7061f168010..00000000000 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorI.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceDiscovery; - -class LocatorI extends Ice._LocatorDisp -{ - public LocatorI(LookupI lookup, Ice.LocatorRegistryPrx registry) - { - _lookup = lookup; - _registry = registry; - } - - @Override - public void - findObjectById_async(Ice.AMD_Locator_findObjectById cb, Ice.Identity id, Ice.Current current) - { - _lookup.findObject(cb, id); - } - - @Override - public void - findAdapterById_async(Ice.AMD_Locator_findAdapterById cb, String adapterId, Ice.Current current) - { - _lookup.findAdapter(cb, adapterId); - } - - @Override - public Ice.LocatorRegistryPrx - getRegistry(Ice.Current current) - { - return _registry; - } - - private final LookupI _lookup; - private final Ice.LocatorRegistryPrx _registry; -} diff --git a/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java new file mode 100644 index 00000000000..a46267911ca --- /dev/null +++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorI.java @@ -0,0 +1,49 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceDiscovery; + +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CompletableFuture; + +class LocatorI implements com.zeroc.Ice.Locator +{ + public LocatorI(LookupI lookup, com.zeroc.Ice.LocatorRegistryPrx registry) + { + _lookup = lookup; + _registry = registry; + } + + @Override + public CompletionStage<com.zeroc.Ice.ObjectPrx> findObjectByIdAsync(com.zeroc.Ice.Identity id, + com.zeroc.Ice.Current current) + { + CompletableFuture<com.zeroc.Ice.ObjectPrx> f = new CompletableFuture<com.zeroc.Ice.ObjectPrx>(); + _lookup.findObject(f, id); + return f; + } + + @Override + public CompletionStage<com.zeroc.Ice.ObjectPrx> findAdapterByIdAsync(String adapterId, + com.zeroc.Ice.Current current) + { + CompletableFuture<com.zeroc.Ice.ObjectPrx> f = new CompletableFuture<com.zeroc.Ice.ObjectPrx>(); + _lookup.findAdapter(f, adapterId); + return f; + } + + @Override + public com.zeroc.Ice.LocatorRegistryPrx getRegistry(com.zeroc.Ice.Current current) + { + return _registry; + } + + private final LookupI _lookup; + private final com.zeroc.Ice.LocatorRegistryPrx _registry; +} diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorRegistryI.java index be8e0e6f220..b256daa07ca 100644 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LocatorRegistryI.java +++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LocatorRegistryI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceDiscovery; +package com.zeroc.IceDiscovery; import java.util.Map; import java.util.HashMap; @@ -15,20 +15,21 @@ import java.util.Set; import java.util.HashSet; import java.util.List; import java.util.ArrayList; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CompletableFuture; -class LocatorRegistryI extends Ice._LocatorRegistryDisp +class LocatorRegistryI implements com.zeroc.Ice.LocatorRegistry { - public LocatorRegistryI(Ice.Communicator com) + public LocatorRegistryI(com.zeroc.Ice.Communicator com) { _wellKnownProxy = com.stringToProxy("p").ice_locator(null).ice_router(null).ice_collocationOptimized(true); } @Override - synchronized public void - setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, - String adapterId, - Ice.ObjectPrx proxy, - Ice.Current current) + synchronized public CompletionStage<Void> setAdapterDirectProxyAsync( + String adapterId, + com.zeroc.Ice.ObjectPrx proxy, + com.zeroc.Ice.Current current) { if(proxy != null) { @@ -38,16 +39,15 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp { _adapters.remove(adapterId); } - cb.ice_response(); + return CompletableFuture.completedFuture((Void)null); } @Override - synchronized public void - setReplicatedAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, - String adapterId, - String replicaGroupId, - Ice.ObjectPrx proxy, - Ice.Current current) + synchronized public CompletionStage<Void> setReplicatedAdapterDirectProxyAsync( + String adapterId, + String replicaGroupId, + com.zeroc.Ice.ObjectPrx proxy, + com.zeroc.Ice.Current current) { if(proxy != null) { @@ -55,7 +55,7 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp Set<String> s = _replicaGroups.get(replicaGroupId); if(s == null) { - s = new HashSet<String>(); + s = new HashSet<>(); _replicaGroups.put(replicaGroupId, s); } s.add(adapterId); @@ -73,30 +73,28 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp } } } - cb.ice_response(); + return CompletableFuture.completedFuture((Void)null); } @Override - public void - setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, - String serverId, - Ice.ProcessPrx process, - Ice.Current current) + public CompletionStage<Void> setServerProcessProxyAsync( + String serverId, + com.zeroc.Ice.ProcessPrx process, + com.zeroc.Ice.Current current) { - cb.ice_response(); + return CompletableFuture.completedFuture((Void)null); } - synchronized Ice.ObjectPrx - findObject(Ice.Identity id) + synchronized com.zeroc.Ice.ObjectPrx findObject(com.zeroc.Ice.Identity id) { if(id.name.length() == 0) { return null; } - Ice.ObjectPrx prx = _wellKnownProxy.ice_identity(id); + com.zeroc.Ice.ObjectPrx prx = _wellKnownProxy.ice_identity(id); - List<String> adapterIds = new ArrayList<String>(); + List<String> adapterIds = new ArrayList<>(); for(String a : _replicaGroups.keySet()) { try @@ -104,7 +102,7 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp prx.ice_adapterId(a).ice_ping(); adapterIds.add(a); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { } } @@ -117,7 +115,7 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp prx.ice_adapterId(a).ice_ping(); adapterIds.add(a); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { } } @@ -131,21 +129,29 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp return prx.ice_adapterId(adapterIds.get(0)); } - synchronized Ice.ObjectPrx - findAdapter(String adapterId, Ice.Holder<Boolean> isReplicaGroup) + static class FindAdapterResult { - Ice.ObjectPrx proxy = _adapters.get(adapterId); + com.zeroc.Ice.ObjectPrx returnValue; + boolean isReplicaGroup; + } + + synchronized FindAdapterResult findAdapter(String adapterId) + { + FindAdapterResult r = new FindAdapterResult(); + + com.zeroc.Ice.ObjectPrx proxy = _adapters.get(adapterId); if(proxy != null) { - isReplicaGroup.value = false; - return proxy; + r.isReplicaGroup = false; + r.returnValue = proxy; + return r; } Set<String> s = _replicaGroups.get(adapterId); if(s != null) { - List<Ice.Endpoint> endpoints = new ArrayList<Ice.Endpoint>(); - Ice.ObjectPrx prx = null; + List<com.zeroc.Ice.Endpoint> endpoints = new ArrayList<>(); + com.zeroc.Ice.ObjectPrx prx = null; for(String a : s) { proxy = _adapters.get(a); @@ -164,16 +170,17 @@ class LocatorRegistryI extends Ice._LocatorRegistryDisp if(prx != null) { - isReplicaGroup.value = true; - return prx.ice_endpoints(endpoints.toArray(new Ice.Endpoint[endpoints.size()])); + r.isReplicaGroup = true; + r.returnValue = prx.ice_endpoints(endpoints.toArray(new com.zeroc.Ice.Endpoint[endpoints.size()])); + return r; } } - isReplicaGroup.value = false; - return null; + r.isReplicaGroup = false; + r.returnValue = null; + return r; } - final Ice.ObjectPrx _wellKnownProxy; - final Map<String, Ice.ObjectPrx> _adapters = new HashMap<String, Ice.ObjectPrx>(); - final Map<String, Set<String>> _replicaGroups = new HashMap<String, Set<String>>(); + final com.zeroc.Ice.ObjectPrx _wellKnownProxy; + final Map<String, com.zeroc.Ice.ObjectPrx> _adapters = new HashMap<>(); + final Map<String, Set<String>> _replicaGroups = new HashMap<>(); } - diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupI.java index 003fe63c53b..5190180b12e 100644 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupI.java +++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupI.java @@ -7,16 +7,17 @@ // // ********************************************************************** -package IceDiscovery; +package com.zeroc.IceDiscovery; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; +import java.util.concurrent.CompletableFuture; -class LookupI extends _LookupDisp +class LookupI implements Lookup { - abstract private class Request<T, AmdCB> implements Runnable + abstract private class Request<T, Ret> implements Runnable { Request(T id, int retryCount) { @@ -24,33 +25,28 @@ class LookupI extends _LookupDisp _nRetry = retryCount; } - T - getId() + T getId() { return _id; } - boolean - addCallback(AmdCB cb) + boolean addFuture(CompletableFuture<Ret> f) { - _callbacks.add(cb); - return _callbacks.size() == 1; + _futures.add(f); + return _futures.size() == 1; } - boolean - retry() + boolean retry() { return --_nRetry >= 0; } - void - scheduleTimer(long timeout) + void scheduleTimer(long timeout) { _future = _timer.schedule(this, timeout, java.util.concurrent.TimeUnit.MILLISECONDS); } - void - cancelTimer() + void cancelTimer() { assert _future != null; _future.cancel(false); @@ -58,12 +54,12 @@ class LookupI extends _LookupDisp } protected int _nRetry; - protected List<AmdCB> _callbacks = new ArrayList<AmdCB>(); + protected List<CompletableFuture<Ret>> _futures = new ArrayList<>(); private T _id; protected java.util.concurrent.Future<?> _future; - }; + } - private class AdapterRequest extends Request<String, Ice.AMD_Locator_findAdapterById> + private class AdapterRequest extends Request<String, com.zeroc.Ice.ObjectPrx> { AdapterRequest(String id, int retryCount) { @@ -73,14 +69,12 @@ class LookupI extends _LookupDisp } @Override - boolean - retry() + boolean retry() { return _proxies.size() == 0 && --_nRetry >= 0; } - boolean - response(Ice.ObjectPrx proxy, boolean isReplicaGroup) + boolean response(com.zeroc.Ice.ObjectPrx proxy, boolean isReplicaGroup) { if(isReplicaGroup) { @@ -101,8 +95,7 @@ class LookupI extends _LookupDisp return true; } - void - finished(Ice.ObjectPrx proxy) + void finished(com.zeroc.Ice.ObjectPrx proxy) { if(proxy != null || _proxies.isEmpty()) { @@ -115,9 +108,9 @@ class LookupI extends _LookupDisp return; } - List<Ice.Endpoint> endpoints = new ArrayList<Ice.Endpoint>(); - Ice.ObjectPrx result = null; - for(Ice.ObjectPrx prx : _proxies) + List<com.zeroc.Ice.Endpoint> endpoints = new ArrayList<>(); + com.zeroc.Ice.ObjectPrx result = null; + for(com.zeroc.Ice.ObjectPrx prx : _proxies) { if(result == null) { @@ -125,63 +118,58 @@ class LookupI extends _LookupDisp } endpoints.addAll(java.util.Arrays.asList(prx.ice_getEndpoints())); } - sendResponse(result.ice_endpoints(endpoints.toArray(new Ice.Endpoint[endpoints.size()]))); + sendResponse(result.ice_endpoints(endpoints.toArray(new com.zeroc.Ice.Endpoint[endpoints.size()]))); } @Override - public void - run() + public void run() { adapterRequestTimedOut(this); } - private void - sendResponse(Ice.ObjectPrx proxy) + private void sendResponse(com.zeroc.Ice.ObjectPrx proxy) { - for(Ice.AMD_Locator_findAdapterById cb : _callbacks) + for(CompletableFuture<com.zeroc.Ice.ObjectPrx> f : _futures) { - cb.ice_response(proxy); + f.complete(proxy); } - _callbacks.clear(); + _futures.clear(); } - private List<Ice.ObjectPrx> _proxies = new ArrayList<Ice.ObjectPrx>(); + private List<com.zeroc.Ice.ObjectPrx> _proxies = new ArrayList<>(); private long _start; private long _latency; - }; + } - private class ObjectRequest extends Request<Ice.Identity, Ice.AMD_Locator_findObjectById> + private class ObjectRequest extends Request<com.zeroc.Ice.Identity, com.zeroc.Ice.ObjectPrx> { - ObjectRequest(Ice.Identity id, int retryCount) + ObjectRequest(com.zeroc.Ice.Identity id, int retryCount) { super(id, retryCount); } - void - response(Ice.ObjectPrx proxy) + void response(com.zeroc.Ice.ObjectPrx proxy) { finished(proxy); } - void - finished(Ice.ObjectPrx proxy) + void finished(com.zeroc.Ice.ObjectPrx proxy) { - for(Ice.AMD_Locator_findObjectById cb : _callbacks) + for(CompletableFuture<com.zeroc.Ice.ObjectPrx> f : _futures) { - cb.ice_response(proxy); + f.complete(proxy); } - _callbacks.clear(); + _futures.clear(); } @Override - public void - run() + public void run() { objectRequestTimedOut(this); } - }; + } - public LookupI(LocatorRegistryI registry, LookupPrx lookup, Ice.Properties properties) + public LookupI(LocatorRegistryI registry, LookupPrx lookup, com.zeroc.Ice.Properties properties) { _registry = registry; _lookup = lookup; @@ -189,25 +177,24 @@ class LookupI extends _LookupDisp _retryCount = properties.getPropertyAsIntWithDefault("IceDiscovery.RetryCount", 3); _latencyMultiplier = properties.getPropertyAsIntWithDefault("IceDiscovery.LatencyMultiplier", 1); _domainId = properties.getProperty("IceDiscovery.DomainId"); - _timer = IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); + _timer = com.zeroc.IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); } - void - setLookupReply(LookupReplyPrx lookupReply) + void setLookupReply(LookupReplyPrx lookupReply) { _lookupReply = lookupReply; } @Override - public void - findObjectById(String domainId, Ice.Identity id, IceDiscovery.LookupReplyPrx reply, Ice.Current c) + public void findObjectById(String domainId, com.zeroc.Ice.Identity id, com.zeroc.IceDiscovery.LookupReplyPrx reply, + com.zeroc.Ice.Current c) { if(!domainId.equals(_domainId)) { return; // Ignore. } - Ice.ObjectPrx proxy = _registry.findObject(id); + com.zeroc.Ice.ObjectPrx proxy = _registry.findObject(id); if(proxy != null) { // @@ -215,9 +202,9 @@ class LookupI extends _LookupDisp // try { - reply.begin_foundObjectById(id, proxy); + reply.foundObjectByIdAsync(id, proxy); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // Ignore } @@ -225,34 +212,32 @@ class LookupI extends _LookupDisp } @Override - public void - findAdapterById(String domainId, String adapterId, IceDiscovery.LookupReplyPrx reply, Ice.Current c) + public void findAdapterById(String domainId, String adapterId, com.zeroc.IceDiscovery.LookupReplyPrx reply, + com.zeroc.Ice.Current c) { if(!domainId.equals(_domainId)) { return; // Ignore. } - Ice.Holder<Boolean> isReplicaGroup = new Ice.Holder<Boolean>(); - Ice.ObjectPrx proxy = _registry.findAdapter(adapterId, isReplicaGroup); - if(proxy != null) + LocatorRegistryI.FindAdapterResult r = _registry.findAdapter(adapterId); + if(r.returnValue != null) { // // Reply to the multicast request using the given proxy. // try { - reply.begin_foundAdapterById(adapterId, proxy, isReplicaGroup.value); + reply.foundAdapterByIdAsync(adapterId, r.returnValue, r.isReplicaGroup); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { // Ignore } } } - synchronized void - findObject(Ice.AMD_Locator_findObjectById cb, Ice.Identity id) + synchronized void findObject(CompletableFuture<com.zeroc.Ice.ObjectPrx> f, com.zeroc.Ice.Identity id) { ObjectRequest request = _objectRequests.get(id); if(request == null) @@ -261,14 +246,14 @@ class LookupI extends _LookupDisp _objectRequests.put(id, request); } - if(request.addCallback(cb)) + if(request.addFuture(f)) { try { - _lookup.begin_findObjectById(_domainId, id, _lookupReply); + _lookup.findObjectByIdAsync(_domainId, id, _lookupReply); request.scheduleTimer(_timeout); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { request.finished(null); _objectRequests.remove(id); @@ -276,8 +261,7 @@ class LookupI extends _LookupDisp } } - synchronized void - findAdapter(Ice.AMD_Locator_findAdapterById cb, String adapterId) + synchronized void findAdapter(CompletableFuture<com.zeroc.Ice.ObjectPrx> f, String adapterId) { AdapterRequest request = _adapterRequests.get(adapterId); if(request == null) @@ -286,14 +270,14 @@ class LookupI extends _LookupDisp _adapterRequests.put(adapterId, request); } - if(request.addCallback(cb)) + if(request.addFuture(f)) { try { - _lookup.begin_findAdapterById(_domainId, adapterId, _lookupReply); + _lookup.findAdapterByIdAsync(_domainId, adapterId, _lookupReply); request.scheduleTimer(_timeout); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { request.finished(null); _adapterRequests.remove(adapterId); @@ -301,8 +285,7 @@ class LookupI extends _LookupDisp } } - synchronized void - foundObject(Ice.Identity id, Ice.ObjectPrx proxy) + synchronized void foundObject(com.zeroc.Ice.Identity id, com.zeroc.Ice.ObjectPrx proxy) { ObjectRequest request = _objectRequests.get(id); if(request == null) @@ -315,8 +298,7 @@ class LookupI extends _LookupDisp _objectRequests.remove(id); } - synchronized void - foundAdapter(String adapterId, Ice.ObjectPrx proxy, boolean isReplicaGroup) + synchronized void foundAdapter(String adapterId, com.zeroc.Ice.ObjectPrx proxy, boolean isReplicaGroup) { AdapterRequest request = _adapterRequests.get(adapterId); if(request == null) @@ -331,8 +313,7 @@ class LookupI extends _LookupDisp } } - synchronized void - objectRequestTimedOut(ObjectRequest request) + synchronized void objectRequestTimedOut(ObjectRequest request) { ObjectRequest r = _objectRequests.get(request.getId()); if(r == null || request != r) @@ -344,11 +325,11 @@ class LookupI extends _LookupDisp { try { - _lookup.begin_findObjectById(_domainId, request.getId(), _lookupReply); + _lookup.findObjectByIdAsync(_domainId, request.getId(), _lookupReply); request.scheduleTimer(_timeout); return; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { } } @@ -357,8 +338,7 @@ class LookupI extends _LookupDisp _objectRequests.remove(request.getId()); } - synchronized void - adapterRequestTimedOut(AdapterRequest request) + synchronized void adapterRequestTimedOut(AdapterRequest request) { AdapterRequest r = _adapterRequests.get(request.getId()); if(r == null || r != request) @@ -370,11 +350,11 @@ class LookupI extends _LookupDisp { try { - _lookup.begin_findAdapterById(_domainId, request.getId(), _lookupReply); + _lookup.findAdapterByIdAsync(_domainId, request.getId(), _lookupReply); request.scheduleTimer(_timeout); return; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { } } @@ -393,7 +373,6 @@ class LookupI extends _LookupDisp private final java.util.concurrent.ScheduledExecutorService _timer; - private Map<Ice.Identity, ObjectRequest> _objectRequests = new HashMap<Ice.Identity, ObjectRequest>(); - private Map<String, AdapterRequest> _adapterRequests = new HashMap<String, AdapterRequest>(); + private Map<com.zeroc.Ice.Identity, ObjectRequest> _objectRequests = new HashMap<>(); + private Map<String, AdapterRequest> _adapterRequests = new HashMap<>(); } - diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupReplyI.java index c848d425630..dd7585faede 100644 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/LookupReplyI.java +++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/LookupReplyI.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceDiscovery; +package com.zeroc.IceDiscovery; -class LookupReplyI extends _LookupReplyDisp +class LookupReplyI implements LookupReply { public LookupReplyI(LookupI lookup) { @@ -17,19 +17,17 @@ class LookupReplyI extends _LookupReplyDisp } @Override - public void - foundObjectById(Ice.Identity id, Ice.ObjectPrx proxy, Ice.Current current) + public void foundObjectById(com.zeroc.Ice.Identity id, com.zeroc.Ice.ObjectPrx proxy, com.zeroc.Ice.Current current) { _lookup.foundObject(id, proxy); } @Override - public void - foundAdapterById(String adapterId, Ice.ObjectPrx proxy, boolean isReplicaGroup, Ice.Current current) + public void foundAdapterById(String adapterId, com.zeroc.Ice.ObjectPrx proxy, boolean isReplicaGroup, + com.zeroc.Ice.Current current) { _lookup.foundAdapter(adapterId, proxy, isReplicaGroup); } private final LookupI _lookup; } - diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginFactory.java index 506746369a6..15bbd2ab04f 100644 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginFactory.java +++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginFactory.java @@ -7,13 +7,12 @@ // // ********************************************************************** -package IceDiscovery; +package com.zeroc.IceDiscovery; -public class PluginFactory implements Ice.PluginFactory +public class PluginFactory implements com.zeroc.Ice.PluginFactory { @Override - public Ice.Plugin - create(Ice.Communicator communicator, String name, String[] args) + public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args) { return new PluginI(communicator); } diff --git a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginI.java index 4f45834c7ea..0c2f494a02b 100644 --- a/java/src/IceDiscovery/src/main/java/IceDiscovery/PluginI.java +++ b/java/src/IceDiscovery/src/main/java/com/zeroc/IceDiscovery/PluginI.java @@ -7,21 +7,19 @@ // // ********************************************************************** -package IceDiscovery; +package com.zeroc.IceDiscovery; -public class PluginI implements Ice.Plugin +public class PluginI implements com.zeroc.Ice.Plugin { - public - PluginI(Ice.Communicator communicator) + public PluginI(com.zeroc.Ice.Communicator communicator) { _communicator = communicator; } @Override - public void - initialize() + public void initialize() { - Ice.Properties properties = _communicator.getProperties(); + com.zeroc.Ice.Properties properties = _communicator.getProperties(); boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0; boolean preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0; @@ -70,7 +68,7 @@ public class PluginI implements Ice.Plugin // Setup locatory registry. // LocatorRegistryI locatorRegistry = new LocatorRegistryI(_communicator); - Ice.LocatorRegistryPrx locatorRegistryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast( + com.zeroc.Ice.LocatorRegistryPrx locatorRegistryPrx = com.zeroc.Ice.LocatorRegistryPrx.uncheckedCast( _locatorAdapter.addWithUUID(locatorRegistry)); String lookupEndpoints = properties.getProperty("IceDiscovery.Lookup"); @@ -85,13 +83,13 @@ public class PluginI implements Ice.Plugin lookupEndpoints = s.toString(); } - Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints); + com.zeroc.Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints); lookupPrx = lookupPrx.ice_collocationOptimized(false); // No collocation optimization for the multicast proxy! try { lookupPrx.ice_getConnection(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { StringBuilder b = new StringBuilder(); b.append("IceDiscovery is unable to establish a multicast connection:\n"); @@ -99,23 +97,23 @@ public class PluginI implements Ice.Plugin b.append(lookupPrx.toString()); b.append('\n'); b.append(ex.toString()); - throw new Ice.PluginInitializationException(b.toString()); + throw new com.zeroc.Ice.PluginInitializationException(b.toString()); } // // Add lookup and lookup reply Ice objects // - LookupI lookup = new LookupI(locatorRegistry, LookupPrxHelper.uncheckedCast(lookupPrx), properties); - _multicastAdapter.add(lookup, Ice.Util.stringToIdentity("IceDiscovery/Lookup")); + LookupI lookup = new LookupI(locatorRegistry, LookupPrx.uncheckedCast(lookupPrx), properties); + _multicastAdapter.add(lookup, com.zeroc.Ice.Util.stringToIdentity("IceDiscovery/Lookup")); - Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(lookup)).ice_datagram(); - lookup.setLookupReply(LookupReplyPrxHelper.uncheckedCast(lookupReply)); + com.zeroc.Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(lookup)).ice_datagram(); + lookup.setLookupReply(LookupReplyPrx.uncheckedCast(lookupReply)); // // Setup locator on the communicator. // - Ice.ObjectPrx locator = _locatorAdapter.addWithUUID(new LocatorI(lookup, locatorRegistryPrx)); - _communicator.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); + com.zeroc.Ice.ObjectPrx locator = _locatorAdapter.addWithUUID(new LocatorI(lookup, locatorRegistryPrx)); + _communicator.setDefaultLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(locator)); _multicastAdapter.activate(); _replyAdapter.activate(); @@ -123,16 +121,15 @@ public class PluginI implements Ice.Plugin } @Override - public void - destroy() + public void destroy() { _multicastAdapter.destroy(); _replyAdapter.destroy(); _locatorAdapter.destroy(); } - private Ice.Communicator _communicator; - private Ice.ObjectAdapter _multicastAdapter; - private Ice.ObjectAdapter _replyAdapter; - private Ice.ObjectAdapter _locatorAdapter; + private com.zeroc.Ice.Communicator _communicator; + private com.zeroc.Ice.ObjectAdapter _multicastAdapter; + private com.zeroc.Ice.ObjectAdapter _replyAdapter; + private com.zeroc.Ice.ObjectAdapter _locatorAdapter; } diff --git a/java/src/IceGrid/build.gradle b/java/src/IceGrid/build.gradle index 8e72c858086..30ec3c3d50d 100644 --- a/java/src/IceGrid/build.gradle +++ b/java/src/IceGrid/build.gradle @@ -7,8 +7,10 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "IceGrid" project.ext.description = "Locate, deploy, and manage Ice servers" @@ -16,7 +18,7 @@ project.ext.description = "Locate, deploy, and manage Ice servers" slice { java { set1 { - args = "--ice --tie --checksum IceGrid.SliceChecksums" + args = "--ice --checksum com.zeroc.IceGrid.SliceChecksums" files = fileTree(dir: "$sliceDir/IceGrid", includes:['*.ice'], excludes:["*F.ice"]) } } diff --git a/java/src/IceGridGUI/build.gradle b/java/src/IceGridGUI/build.gradle index fa6a55a150f..fe6fc517a29 100644 --- a/java/src/IceGridGUI/build.gradle +++ b/java/src/IceGridGUI/build.gradle @@ -7,10 +7,12 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 -project.ext.displayName = "IceGridGUI" +project.ext.displayName = "IceGridGUI Compat" project.ext.description = "" def macosx = System.properties['os.name'] == "Mac OS X" @@ -61,7 +63,7 @@ jar { archiveName = tmpJarName if (!hasJavaFx) { manifest { - attributes 'Main-Class': "IceGridGUI.Main" + attributes 'Main-Class': "com.zeroc.IceGridGUI.Main" } } } @@ -107,13 +109,13 @@ if(icegridguiProguard.toBoolean()) { if (hasJavaFx) { ant.jar(update: true, destfile: "${libDir}/${jarName}") { delegate.manifest { - attribute(name: 'Main-Class', value: 'IceGridGUI.MainProxy') + attribute(name: 'Main-Class', value: 'com.zeroc.IceGridGUI.MainProxy') attribute(name: 'Built-By', value: 'Zeroc, Inc.') } } } } - + task copyJars(type: Copy, dependsOn: updateManifest) { from new File("${libDir}/${jarName}") into "${DESTDIR}${jarDir}" @@ -127,11 +129,11 @@ if(icegridguiProguard.toBoolean()) { rename("${tmpJarName}", "${jarName}") } - + task updateManifest(dependsOn: copyTmpJars) << { ant.jar(update: true, destfile: "${libDir}/${jarName}") { delegate.manifest { - attribute(name: "Main-Class", value: "IceGridGUI.Main") + attribute(name: "Main-Class", value: "com.zeroc.IceGridGUI.Main") attribute(name: "Built-By", value: "ZeroC, Inc.") attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ')) } @@ -146,7 +148,7 @@ if(icegridguiProguard.toBoolean()) { into "${DESTDIR}${jarDir}" rename("${tmpJarName}", "${jarName}") } - + // // We need to update the manifest of the installed IceGridGUI jar and fix the // Class-Path to point to the installed JAR files. @@ -154,17 +156,17 @@ if(icegridguiProguard.toBoolean()) { task updateInstallManifest(dependsOn: copyJars) << { ant.jar(update: true, destfile: "${DESTDIR}${jarDir}/${jarName}") { delegate.manifest { - attribute(name: "Main-Class", value: "IceGridGUI.Main") + attribute(name: "Main-Class", value: "com.zeroc.IceGridGUI.Main") attribute(name: "Built-By", value: "ZeroC, Inc.") attribute(name: "Class-Path", value: configurations.runtime.resolve().collect { "file://${it.absolutePath}" }.join(' ').replaceAll("${libDir}", "${jarDir}")) } } } - + // // We need to sign the install JARs after updating the manifest. // - task signInstalJar(dependsOn: updateInstallManifest) << { + task signInstalJar(dependsOn: updateInstallManifest) << { if(keystore != null && keystore.length() > 0) { ant.signjar(jar: "${DESTDIR}${jarDir}/${jarName}", alias: "zeroc.com", diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java b/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java deleted file mode 100644 index 9fa1b6132fe..00000000000 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsView.java +++ /dev/null @@ -1,376 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceGridGUI.LiveDeployment; - -import java.awt.Component; - -import javax.swing.Icon; -import javax.swing.JTree; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.SwingUtilities; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; - -import IceGridGUI.*; - -class MetricsView extends TreeNode -{ - @Override - public Editor getEditor() - { - return _editor; - } - - // - // Actions - // - @Override - public boolean[] getAvailableActions() - { - boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; - actions[ENABLE_METRICS_VIEW] = !_enabled; - actions[DISABLE_METRICS_VIEW] = _enabled; - return actions; - } - - @Override - public Component getTreeCellRendererComponent( - JTree tree, - Object value, - boolean sel, - boolean expanded, - boolean leaf, - int row, - boolean hasFocus) - { - if(_cellRenderer == null) - { - _cellRenderer = new DefaultTreeCellRenderer(); - - _enabledIcon = Utils.getIcon("/icons/16x16/metrics.png"); - _disabledIcon = Utils.getIcon("/icons/16x16/metrics_disabled.png"); - } - - Icon icon = _enabled ? _enabledIcon : _disabledIcon; - _cellRenderer.setLeafIcon(icon); - return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - - MetricsView(TreeNode parent, String name, IceMX.MetricsAdminPrx admin, boolean enabled) - { - super(parent, name); - _name = name; - _admin = admin; - _editor = new MetricsViewEditor(getRoot()); - _enabled = enabled; - } - - @Override - public void enableMetricsView(boolean enabled) - { - IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin(); - if(metricsAdmin != null) - { - if(enabled) - { - IceMX.Callback_MetricsAdmin_enableMetricsView cb = new IceMX.Callback_MetricsAdmin_enableMetricsView() - { - @Override - public void response() - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _enabled = true; - getRoot().getTreeModel().nodeChanged(MetricsView.this); - getRoot().getCoordinator().showActions(MetricsView.this); - if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this) - { - // - // If the metrics view is selected when enabled success, - // we must start the refresh thread to pull updates. - // - MetricsViewEditor.startRefresh(MetricsView.this); - } - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - MetricsViewEditor.stopRefresh(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - if(e instanceof Ice.ObjectNotExistException || - e instanceof Ice.ConnectionRefusedException) - { - // Server is down. - } - else if(e instanceof Ice.CommunicatorDestroyedException) - { - } - else - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - } - }); - } - - @Override - public void exception(final Ice.UserException e) - { - MetricsViewEditor.stopRefresh(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - }); - } - }; - metricsAdmin.begin_enableMetricsView(_name, cb); - } - else - { - IceMX.Callback_MetricsAdmin_disableMetricsView cb = new IceMX.Callback_MetricsAdmin_disableMetricsView() - { - @Override - public void response() - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _enabled = false; - _editor.show(MetricsView.this, null, 0); - getRoot().getTreeModel().nodeChanged(MetricsView.this); - getRoot().getCoordinator().showActions(MetricsView.this); - if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this) - { - // - // If the metrics view is selected when disabled success, - // we stop the refresh. - // - MetricsViewEditor.stopRefresh(); - } - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - MetricsViewEditor.stopRefresh(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - if(e instanceof Ice.ObjectNotExistException || - e instanceof Ice.ConnectionRefusedException) - { - // Server is down. - } - else if(e instanceof Ice.CommunicatorDestroyedException) - { - } - else - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - } - }); - } - - @Override - public void exception(final Ice.UserException e) - { - MetricsViewEditor.stopRefresh(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - }); - } - }; - metricsAdmin.begin_disableMetricsView(_name, cb); - } - } - } - - public boolean isEnabled() - { - return _enabled; - } - - public String name() - { - return _name; - } - - IceMX.MetricsAdminPrx getMetricsAdmin() - { - return _admin; - } - - @Override - public JPopupMenu getPopupMenu() - { - LiveActions la = getCoordinator().getLiveActionsForPopup(); - - if(_popup == null) - { - _popup = new JPopupMenu(); - _popup.add(la.get(ENABLE_METRICS_VIEW)); - _popup.add(la.get(DISABLE_METRICS_VIEW)); - } - - la.setTarget(this); - return _popup; - } - - public void fetchMetricsFailures(String map, String id, IceMX.Callback_MetricsAdmin_getMetricsFailures cb) - { - IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin(); - if(metricsAdmin != null) - { - try - { - metricsAdmin.begin_getMetricsFailures(_name, map, id, cb); - } - catch(Ice.LocalException e) - { - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - } - } - - public void fetchMetricsView() - { - IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin(); - if(metricsAdmin != null) - { - IceMX.Callback_MetricsAdmin_getMetricsView cb = new IceMX.Callback_MetricsAdmin_getMetricsView() - { - @Override - public void response(final java.util.Map<java.lang.String, IceMX.Metrics[]> data, - final long timestamp) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _editor.show(MetricsView.this, data, timestamp); - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - MetricsViewEditor.stopRefresh(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - if(e instanceof Ice.ObjectNotExistException || - e instanceof Ice.ConnectionRefusedException) - { - // Server is down. - } - else if(e instanceof Ice.FacetNotExistException) - { - // MetricsAdmin facet not present. - } - else if(e instanceof Ice.CommunicatorDestroyedException) - { - } - else - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - } - }); - } - - @Override - public void exception(final Ice.UserException e) - { - MetricsViewEditor.stopRefresh(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - }); - } - }; - try - { - metricsAdmin.begin_getMetricsView(_name, cb); - } - catch(Ice.CommunicatorDestroyedException e) - { - } - catch(Ice.LocalException e) - { - MetricsViewEditor.stopRefresh(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - } - } - - - private String _name; - private IceMX.MetricsAdminPrx _admin; - private MetricsViewEditor _editor; - private boolean _enabled; - static private JPopupMenu _popup; - static private DefaultTreeCellRenderer _cellRenderer; - static private Icon _enabledIcon; - static private Icon _disabledIcon; -} diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdapterObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java index c4cd71d6745..00c59ac2a7b 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdapterObserverI.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdapterObserverI.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.SwingUtilities; -import IceGrid.*; +import com.zeroc.IceGrid.*; -class AdapterObserverI extends _AdapterObserverDisp +class AdapterObserverI implements AdapterObserver { AdapterObserverI(Coordinator coordinator) { @@ -21,7 +21,7 @@ class AdapterObserverI extends _AdapterObserverDisp } @Override - public synchronized void adapterInit(final AdapterInfo[] adapters, Ice.Current current) + public synchronized void adapterInit(final AdapterInfo[] adapters, com.zeroc.Ice.Current current) { if(_trace) { @@ -52,7 +52,7 @@ class AdapterObserverI extends _AdapterObserverDisp } @Override - public void adapterAdded(final AdapterInfo info, Ice.Current current) + public void adapterAdded(final AdapterInfo info, com.zeroc.Ice.Current current) { if(_trace) { @@ -70,7 +70,7 @@ class AdapterObserverI extends _AdapterObserverDisp } @Override - public void adapterUpdated(final AdapterInfo info, Ice.Current current) + public void adapterUpdated(final AdapterInfo info, com.zeroc.Ice.Current current) { if(_trace) { @@ -88,7 +88,7 @@ class AdapterObserverI extends _AdapterObserverDisp } @Override - public void adapterRemoved(final String id, Ice.Current current) + public void adapterRemoved(final String id, com.zeroc.Ice.Current current) { if(_trace) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdminRouter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java index 195e0240e57..f51a9b9708d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/AdminRouter.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/AdminRouter.java @@ -7,18 +7,18 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; -import IceGrid.*; +import com.zeroc.IceGrid.*; -class AdminRouter extends Ice.Blobject +class AdminRouter implements com.zeroc.Ice.Blobject { @Override - public boolean ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current) + public com.zeroc.Ice.Object.Ice_invokeResult ice_invoke(byte[] inParams, com.zeroc.Ice.Current current) { if(_admin == null) { - throw new Ice.ObjectNotExistException(current.id, current.facet, current.operation); + throw new com.zeroc.Ice.ObjectNotExistException(current.id, current.facet, current.operation); } else if(current.operation.equals("ice_id") || current.operation.equals("ice_ids") || @@ -26,14 +26,14 @@ class AdminRouter extends Ice.Blobject current.operation.equals("ice_ping") || current.operation.equals("getDefaultApplicationDescriptor")) { - return _admin.ice_invoke(current.operation, current.mode, inParams, outParams, current.ctx); + return _admin.ice_invoke(current.operation, current.mode, inParams, current.ctx); } else { // // Routing other operations could be a security risk // - throw new Ice.OperationNotExistException(current.id, current.facet, current.operation); + throw new com.zeroc.Ice.OperationNotExistException(current.id, current.facet, current.operation); } } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AbstractServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AbstractServerEditor.java index b90f51fba8d..3f933d444d7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AbstractServerEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AbstractServerEditor.java @@ -7,10 +7,10 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JOptionPane; -import IceGrid.*; +import com.zeroc.IceGrid.*; // // Base class for ServerEditor and ServerInstanceEditor diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Adapter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Adapter.java index bb694fa4029..94525630141 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Adapter.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Adapter.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class Adapter extends TreeNode implements DescriptorHolder { @@ -32,7 +32,7 @@ class Adapter extends TreeNode implements DescriptorHolder static public java.util.List<AdapterDescriptor> copyDescriptors(java.util.List<AdapterDescriptor> descriptors) { - java.util.List<AdapterDescriptor> copy = new java.util.LinkedList<AdapterDescriptor>(); + java.util.List<AdapterDescriptor> copy = new java.util.LinkedList<>(); for(AdapterDescriptor p : descriptors) { copy.add(copyDescriptor(p)); @@ -174,7 +174,7 @@ class Adapter extends TreeNode implements DescriptorHolder { if(!_ephemeral) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", _descriptor.name)); String oaPrefix = _descriptor.name + "."; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AdapterEditor.java index e026b78b883..6b2477854f8 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/AdapterEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/AdapterEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; @@ -29,8 +29,8 @@ import javax.swing.event.DocumentListener; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; @SuppressWarnings("unchecked") class AdapterEditor extends CommunicatorChildEditor @@ -165,7 +165,7 @@ class AdapterEditor extends CommunicatorChildEditor JTextField idTextField = (JTextField)_id.getEditor().getEditorComponent(); idTextField.getDocument().addDocumentListener(_updateListener); - _id.setToolTipText("Identities this object adapter within an IceGrid deployment"); + _id.setToolTipText("Identifies this object adapter within an IceGrid deployment"); JTextField replicaGroupIdTextField = (JTextField)_replicaGroupId.getEditor().getEditorComponent(); replicaGroupIdTextField.getDocument().addDocumentListener(_updateListener); @@ -386,11 +386,9 @@ class AdapterEditor extends CommunicatorChildEditor } else { - ReplicaGroups replicaGroups = - getAdapter().getRoot().getReplicaGroups(); + ReplicaGroups replicaGroups = getAdapter().getRoot().getReplicaGroups(); - ReplicaGroup replicaGroup = - (ReplicaGroup)replicaGroups.findChild(replicaGroupId); + ReplicaGroup replicaGroup = (ReplicaGroup)replicaGroups.findChild(replicaGroupId); if(replicaGroup != null) { @@ -576,10 +574,10 @@ class AdapterEditor extends CommunicatorChildEditor private java.util.Map<String, String[]> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects) { - java.util.Map<String, String[]> result = new java.util.TreeMap<String, String[]>(); + java.util.Map<String, String[]> result = new java.util.TreeMap<>(); for(ObjectDescriptor p : objects) { - String k = Ice.Util.identityToString(p.id); + String k = com.zeroc.Ice.Util.identityToString(p.id); result.put(k, new String[]{p.type, getAdapter().lookupPropertyValue(k),p.proxyOptions}); } return result; @@ -588,16 +586,16 @@ class AdapterEditor extends CommunicatorChildEditor private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String[]> map) { String badIdentities = ""; - java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>(); + java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, String[]> p : map.entrySet()) { try { - Ice.Identity id = Ice.Util.stringToIdentity(p.getKey()); + com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity(p.getKey()); String[] val = p.getValue(); result.add(new ObjectDescriptor(id, val[0], val[2])); } - catch(Ice.IdentityParseException ex) + catch(com.zeroc.Ice.IdentityParseException ex) { badIdentities += "- " + p.getKey() + "\n"; } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ApplicationEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ApplicationEditor.java index b46369a6130..0e72572a063 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ApplicationEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ApplicationEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JComponent; import javax.swing.JComboBox; @@ -19,8 +19,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; @SuppressWarnings("unchecked") class ApplicationEditor extends Editor diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ArrayMapField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ArrayMapField.java index e7d2fb0b490..acd11be666c 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ArrayMapField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ArrayMapField.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; import java.awt.event.ActionEvent; @@ -34,7 +34,7 @@ public class ArrayMapField extends JTable _substituteKey = substituteKey; _vectorSize = columns.length; - _columnNames = new java.util.Vector<String>(_vectorSize); + _columnNames = new java.util.Vector<>(_vectorSize); for(String name : columns) { _columnNames.add(name); @@ -91,10 +91,10 @@ public class ArrayMapField extends JTable // // Transform map into vector of vectors // - java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(map.size()); for(java.util.Map.Entry<String, String[]> p : map.entrySet()) { - java.util.Vector<String> row = new java.util.Vector<String>(_vectorSize); + java.util.Vector<String> row = new java.util.Vector<>(_vectorSize); if(_substituteKey) { @@ -115,7 +115,7 @@ public class ArrayMapField extends JTable if(_editable) { - java.util.Vector<String> newRow = new java.util.Vector<String>(_vectorSize); + java.util.Vector<String> newRow = new java.util.Vector<>(_vectorSize); for(int i = 0; i < _vectorSize; ++i) { newRow.add(""); @@ -176,7 +176,7 @@ public class ArrayMapField extends JTable java.util.Vector<java.util.Vector<String>> vector = _model.getDataVector(); - java.util.TreeMap<String, String[]> result = new java.util.TreeMap<String, String[]>(); + java.util.TreeMap<String, String[]> result = new java.util.TreeMap<>(); for(java.util.Vector<String> row : vector) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Communicator.java index 931d26883df..3e526a56ace 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Communicator.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Communicator.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.util.Enumeration; import javax.swing.JOptionPane; import javax.swing.tree.DefaultTreeModel; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; // // The base class for Server, Service, ServerTemplate and ServiceTemplate @@ -179,7 +179,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder { Adapter.AdapterCopy copy = (Adapter.AdapterCopy)descriptor; _adapters.newAdapter(Adapter.copyDescriptor(copy.descriptor), - new java.util.HashMap<String, String>(copy.parentProperties)); + new java.util.HashMap<>(copy.parentProperties)); } else if(descriptor instanceof DbEnvDescriptor) { @@ -206,7 +206,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder // java.util.List<? extends TemplateInstance> findInstances() { - java.util.List<TemplateInstance> result = new java.util.LinkedList<TemplateInstance>(); + java.util.List<TemplateInstance> result = new java.util.LinkedList<>(); result.add((TemplateInstance)this); return result; } @@ -482,7 +482,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder return id; } - protected java.util.List<TreeNode> _children = new java.util.LinkedList<TreeNode>(); + protected java.util.List<TreeNode> _children = new java.util.LinkedList<>(); protected java.util.List<T> _descriptors; protected boolean _sorted; } @@ -826,7 +826,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder { t = (ServiceTemplate)getRoot().getServiceTemplates().getChildAt(0); descriptor.template = t.getId(); - descriptor.parameterValues = new java.util.HashMap<String, String>(); + descriptor.parameterValues = new java.util.HashMap<>(); } } @@ -882,7 +882,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder java.util.List<ServiceInstance> findServiceInstances(String template) { - java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>(); + java.util.List<ServiceInstance> result = new java.util.LinkedList<>(); java.util.Iterator<TreeNode> p = _services.iterator(); while(p.hasNext()) { @@ -987,7 +987,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder java.util.Map<String, String> propertiesMap() { - java.util.Map<String, String> result = new java.util.HashMap<String, String>(); + java.util.Map<String, String> result = new java.util.HashMap<>(); CommunicatorDescriptor descriptor = getCommunicatorDescriptor(); for(PropertyDescriptor p : descriptor.propertySet.properties) diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorChildEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorChildEditor.java index c0e323f1496..63569c0e469 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorChildEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorChildEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JOptionPane; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorSubEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorSubEditor.java index dadfc906cfc..a58ae91b36d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/CommunicatorSubEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/CommunicatorSubEditor.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JScrollPane; import javax.swing.JTextArea; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class CommunicatorSubEditor { @@ -107,7 +107,7 @@ class CommunicatorSubEditor // // Note that we don't substitute in the lookup // - java.util.Map<String, String> map = new java.util.TreeMap<String, String>(); + java.util.Map<String, String> map = new java.util.TreeMap<>(); for(String log : descriptor.logs) { String prop = lookupKey(descriptor.propertySet.properties, log); diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnv.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnv.java index 5117e6b0ec9..e02fc499b85 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnv.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnv.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class DbEnv extends TreeNode implements DescriptorHolder { @@ -25,7 +25,7 @@ class DbEnv extends TreeNode implements DescriptorHolder static public java.util.List<DbEnvDescriptor> copyDescriptors(java.util.List<DbEnvDescriptor> list) { - java.util.List<DbEnvDescriptor> copy = new java.util.LinkedList<DbEnvDescriptor>(); + java.util.List<DbEnvDescriptor> copy = new java.util.LinkedList<>(); for(DbEnvDescriptor p : list) { copy.add(copyDescriptor(p)); @@ -156,7 +156,7 @@ class DbEnv extends TreeNode implements DescriptorHolder { for(PropertyDescriptor p : properties) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", p.name)); attributes.add(createAttribute("value", p.value)); writer.writeElement("dbproperty", attributes); @@ -169,7 +169,7 @@ class DbEnv extends TreeNode implements DescriptorHolder { if(!_ephemeral) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", _descriptor.name)); if(_descriptor.dbHome.length() > 0) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnvEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnvEditor.java index 4fd753aef1f..233c488059d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DbEnvEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DbEnvEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JComboBox; import javax.swing.JScrollPane; @@ -17,8 +17,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class DbEnvEditor extends CommunicatorChildEditor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DescriptorHolder.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DescriptorHolder.java index fd5b7dcad52..646c44a8952 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/DescriptorHolder.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/DescriptorHolder.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; interface DescriptorHolder { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editable.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editable.java index e60d09adc5d..696c435b8ef 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editable.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editable.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; class Editable implements Cloneable { @@ -50,7 +50,7 @@ class Editable implements Cloneable java.util.TreeSet<String> set = _removedElements.get(forClass); if(set == null) { - set = new java.util.TreeSet<String>(); + set = new java.util.TreeSet<>(); _removedElements.put(forClass, set); } set.add(id); @@ -75,11 +75,10 @@ class Editable implements Cloneable try { Editable result = (Editable)clone(); - java.util.HashMap<Class, java.util.TreeSet<String>> removedElements = - new java.util.HashMap<Class, java.util.TreeSet<String>>(); + java.util.HashMap<Class, java.util.TreeSet<String>> removedElements = new java.util.HashMap<>(); for(java.util.Map.Entry<Class, java.util.TreeSet<String>> p : result._removedElements.entrySet()) { - java.util.TreeSet<String> val = new java.util.TreeSet<String>(p.getValue()); + java.util.TreeSet<String> val = new java.util.TreeSet<>(p.getValue()); removedElements.put(p.getKey(), val); } result._removedElements = removedElements; @@ -102,6 +101,5 @@ class Editable implements Cloneable private boolean _isNew = false; private boolean _modified = false; - private java.util.HashMap<Class, java.util.TreeSet<String>> _removedElements = - new java.util.HashMap<Class, java.util.TreeSet<String>>(); + private java.util.HashMap<Class, java.util.TreeSet<String>> _removedElements = new java.util.HashMap<>(); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editor.java index fc0570421f2..8763214cf8f 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Editor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Editor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.BorderLayout; import java.awt.event.ActionEvent; @@ -22,7 +22,7 @@ import javax.swing.event.DocumentListener; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.factories.Borders; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; public class Editor extends EditorBase { @@ -30,7 +30,7 @@ public class Editor extends EditorBase java.util.Map<String, String> oldParameterValues, java.util.List<String> newParameters) { - java.util.Map<String, String> result = new java.util.HashMap<String, String>(); + java.util.Map<String, String> result = new java.util.HashMap<>(); for(String name : newParameters) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTextField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTextField.java index e554a95188e..ea3e1aa230f 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTextField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTextField.java @@ -7,15 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; import javax.swing.JTextField; // -// A special field used to show/edit a list of strings separated -// by whitespace +// A special field used to show/edit a list of strings separated by whitespace // public class ListTextField extends JTextField @@ -36,13 +35,13 @@ public class ListTextField extends JTextField } }; - setText(Utils.stringify(list, stringifier, " ", null)); + setText(Utils.stringify(list, stringifier, " ").returnValue); } public java.util.LinkedList<String> getList() { String text = getText().trim(); - java.util.LinkedList<String> result = new java.util.LinkedList<String>(); + java.util.LinkedList<String> result = new java.util.LinkedList<>(); while(text.length() > 0) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTreeNode.java index a5f2eec59cf..ddb9aa97249 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ListTreeNode.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ListTreeNode.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.tree.DefaultTreeModel; import java.util.Enumeration; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; // // An editable TreeNode that holds a list of children @@ -242,7 +242,7 @@ abstract class ListTreeNode extends TreeNode private Object _selectedItem; } - protected final java.util.LinkedList<TreeNodeBase> _children = new java.util.LinkedList<TreeNodeBase>(); + protected final java.util.LinkedList<TreeNodeBase> _children = new java.util.LinkedList<>(); protected Editable _editable; static private Editor _editor; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Node.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Node.java index 00c9592aeca..0662b573eb8 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Node.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Node.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import java.util.Enumeration; @@ -20,8 +20,8 @@ import javax.swing.JTree; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class Node extends TreeNode implements PropertySetParent { @@ -32,13 +32,13 @@ class Node extends TreeNode implements PropertySetParent copy.propertySets = PropertySets.copyDescriptors(copy.propertySets); - copy.serverInstances = new java.util.LinkedList<ServerInstanceDescriptor>(); + copy.serverInstances = new java.util.LinkedList<>(); for(ServerInstanceDescriptor p : nd.serverInstances) { copy.serverInstances.add(ServerInstance.copyDescriptor(p)); } - copy.servers = new java.util.LinkedList<ServerDescriptor>(); + copy.servers = new java.util.LinkedList<>(); for(ServerDescriptor p : nd.servers) { copy.servers.add(PlainServer.copyDescriptor(p)); @@ -453,7 +453,7 @@ class Node extends TreeNode implements PropertySetParent { if(!_ephemeral) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", _id)); if(_descriptor.loadFactor.length() > 0) { @@ -511,8 +511,8 @@ class Node extends TreeNode implements PropertySetParent _resolver.put("application", root.getId()); _resolver.put("node", _id); - backup.backupList = new java.util.Vector<Object>(); - backup.servers = new java.util.LinkedList<Server>(_servers); + backup.backupList = new java.util.Vector<>(); + backup.servers = new java.util.LinkedList<>(_servers); for(Server p : backup.servers) { @@ -626,7 +626,7 @@ class Node extends TreeNode implements PropertySetParent else { update.removePropertySets = _editable.removedElements(PropertySet.class); - update.propertySets = new java.util.HashMap<String, PropertySetDescriptor>(); + update.propertySets = new java.util.HashMap<>(); for(PropertySet p : _propertySets) { @@ -649,8 +649,8 @@ class Node extends TreeNode implements PropertySetParent update.removeServers = _editable.removedElements(Server.class); } - update.serverInstances = new java.util.LinkedList<ServerInstanceDescriptor>(); - update.servers = new java.util.LinkedList<ServerDescriptor>(); + update.serverInstances = new java.util.LinkedList<>(); + update.servers = new java.util.LinkedList<>(); for(Server p : _servers) { @@ -684,26 +684,26 @@ class Node extends TreeNode implements PropertySetParent { update.variables = _descriptor.variables; update.removeVariables = new String[0]; - update.loadFactor = new IceGrid.BoxedString(_descriptor.loadFactor); - update.description = new IceGrid.BoxedString(_descriptor.description); + update.loadFactor = new com.zeroc.IceGrid.BoxedString(_descriptor.loadFactor); + update.description = new com.zeroc.IceGrid.BoxedString(_descriptor.description); } else { if(!_descriptor.description.equals(_origDescription)) { - update.description = new IceGrid.BoxedString(_descriptor.description); + update.description = new com.zeroc.IceGrid.BoxedString(_descriptor.description); } if(!_descriptor.loadFactor.equals(_origLoadFactor)) { - update.loadFactor = new IceGrid.BoxedString(_descriptor.loadFactor); + update.loadFactor = new com.zeroc.IceGrid.BoxedString(_descriptor.loadFactor); } // // Diff variables (TODO: avoid duplication with same code in Root) // - update.variables = new java.util.TreeMap<String, String>(_descriptor.variables); - java.util.List<String> removeVariables = new java.util.LinkedList<String>(); + update.variables = new java.util.TreeMap<>(_descriptor.variables); + java.util.List<String> removeVariables = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, String> p : _origVariables.entrySet()) { @@ -734,8 +734,8 @@ class Node extends TreeNode implements PropertySetParent { Root root = getRoot(); - java.util.Vector<Server> newServers = new java.util.Vector<Server>(); - java.util.Vector<Server> updatedServers = new java.util.Vector<Server>(); + java.util.Vector<Server> newServers = new java.util.Vector<>(); + java.util.Vector<Server> updatedServers = new java.util.Vector<>(); if(update != null) { @@ -775,8 +775,8 @@ class Node extends TreeNode implements PropertySetParent _descriptor.propertySets.remove(id); } - java.util.Vector<PropertySet> newPropertySets = new java.util.Vector<PropertySet>(); - java.util.Vector<PropertySet> updatedPropertySets = new java.util.Vector<PropertySet>(); + java.util.Vector<PropertySet> newPropertySets = new java.util.Vector<>(); + java.util.Vector<PropertySet> updatedPropertySets = new java.util.Vector<>(); for(java.util.Map.Entry<String, PropertySetDescriptor> p : update.propertySets.entrySet()) { @@ -897,7 +897,7 @@ class Node extends TreeNode implements PropertySetParent // // Find servers affected by template updates // - java.util.Set<Server> serverSet = new java.util.HashSet<Server>(); + java.util.Set<Server> serverSet = new java.util.HashSet<>(); for(String p : serverTemplates) { @@ -1028,7 +1028,7 @@ class Node extends TreeNode implements PropertySetParent java.util.List<ServerInstance> findServerInstances(String template) { - java.util.List<ServerInstance> result = new java.util.LinkedList<ServerInstance>(); + java.util.List<ServerInstance> result = new java.util.LinkedList<>(); for(Server p : _servers) { if(p instanceof ServerInstance) @@ -1046,7 +1046,7 @@ class Node extends TreeNode implements PropertySetParent void removeServerInstances(String template) { - java.util.List<String> toRemove = new java.util.LinkedList<String>(); + java.util.List<String> toRemove = new java.util.LinkedList<>(); for(Server p : _servers) { @@ -1075,7 +1075,7 @@ class Node extends TreeNode implements PropertySetParent java.util.List<ServiceInstance> findServiceInstances(String template) { - java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>(); + java.util.List<ServiceInstance> result = new java.util.LinkedList<>(); for(Server p : _servers) { if(p instanceof PlainServer) @@ -1264,7 +1264,7 @@ class Node extends TreeNode implements PropertySetParent t = (ServerTemplate)root.getServerTemplates().getChildAt(0); descriptor.template = t.getId(); - descriptor.parameterValues = new java.util.HashMap<String, String>(); + descriptor.parameterValues = new java.util.HashMap<>(); } ServerInstance server = new ServerInstance(this, id, descriptor); @@ -1289,8 +1289,8 @@ class Node extends TreeNode implements PropertySetParent private final boolean _ephemeral; private NodeEditor _editor; - private java.util.LinkedList<PropertySet> _propertySets = new java.util.LinkedList<PropertySet>(); - private java.util.LinkedList<Server> _servers = new java.util.LinkedList<Server>(); + private java.util.LinkedList<PropertySet> _propertySets = new java.util.LinkedList<>(); + private java.util.LinkedList<Server> _servers = new java.util.LinkedList<>(); private Editable _editable; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/NodeEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/NodeEditor.java index d5c854ac2a7..d276d10df33 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/NodeEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/NodeEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JOptionPane; import javax.swing.JScrollPane; @@ -16,8 +16,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class NodeEditor extends Editor { @@ -97,7 +97,7 @@ class NodeEditor extends Editor // Rebuild node; don't need the backup // since it's just one node // - java.util.List<Editable> editables = new java.util.LinkedList<Editable>(); + java.util.List<Editable> editables = new java.util.LinkedList<>(); try { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Nodes.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Nodes.java index e2d2c058417..55fe24431e7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Nodes.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Nodes.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class Nodes extends ListTreeNode { static public java.util.Map<String, NodeDescriptor> copyDescriptors(java.util.Map<String, NodeDescriptor> descriptors) { - java.util.Map<String, NodeDescriptor> copy = new java.util.HashMap<String, NodeDescriptor>(); + java.util.Map<String, NodeDescriptor> copy = new java.util.HashMap<>(); for(java.util.Map.Entry<String, NodeDescriptor> p : descriptors.entrySet()) { copy.put(p.getKey(), Node.copyDescriptor(p.getValue())); @@ -129,8 +129,8 @@ class Nodes extends ListTreeNode void rebuild() throws UpdateFailedException { - java.util.List<Node.Backup> backupList = new java.util.ArrayList<Node.Backup>(); - java.util.List<Editable> editables = new java.util.LinkedList<Editable>(); + java.util.List<Node.Backup> backupList = new java.util.ArrayList<>(); + java.util.List<Editable> editables = new java.util.LinkedList<>(); for(TreeNodeBase p : _children) { @@ -170,7 +170,7 @@ class Nodes extends ListTreeNode java.util.LinkedList<NodeUpdateDescriptor> getUpdates() { - java.util.LinkedList<NodeUpdateDescriptor> updates = new java.util.LinkedList<NodeUpdateDescriptor>(); + java.util.LinkedList<NodeUpdateDescriptor> updates = new java.util.LinkedList<>(); for(TreeNodeBase p : _children) { Node node = (Node)p; @@ -194,7 +194,7 @@ class Nodes extends ListTreeNode java.util.List<ServiceInstance> findServiceInstances(String template) { - java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>(); + java.util.List<ServiceInstance> result = new java.util.LinkedList<>(); for(TreeNodeBase p : _children) { Node node = (Node)p; @@ -231,8 +231,8 @@ class Nodes extends ListTreeNode // // One big set of updates, followed by inserts // - java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>(); - java.util.Set<Node> updatedNodes = new java.util.HashSet<Node>(); + java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>(); + java.util.Set<Node> updatedNodes = new java.util.HashSet<>(); for(NodeUpdateDescriptor update : updates) { @@ -280,7 +280,7 @@ class Nodes extends ListTreeNode java.util.List<ServerInstance> findServerInstances(String template) { - java.util.List<ServerInstance> result = new java.util.LinkedList<ServerInstance>(); + java.util.List<ServerInstance> result = new java.util.LinkedList<>(); for(TreeNodeBase p : _children) { Node node = (Node)p; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParameterValuesField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParameterValuesField.java index 5f1ef398f85..3bd2a85208f 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParameterValuesField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParameterValuesField.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; import javax.swing.DefaultCellEditor; import javax.swing.JComboBox; @@ -30,7 +30,7 @@ public class ParameterValuesField extends JTable { _editor = editor; - _columnNames = new java.util.Vector<String>(2); + _columnNames = new java.util.Vector<>(2); _columnNames.add("Name"); _columnNames.add("Value"); @@ -56,15 +56,14 @@ public class ParameterValuesField extends JTable // // Transform map into vector of vectors // - java.util.Vector<java.util.Vector<String>> vector = - new java.util.Vector<java.util.Vector<String>>(names.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(names.size()); _hasDefault = new boolean[names.size()]; int i = 0; for(String name : names) { - java.util.Vector<String> row = new java.util.Vector<String>(2); + java.util.Vector<String> row = new java.util.Vector<>(2); row.add(name); _hasDefault[i] = (defaultValues.get(name) != null); @@ -118,7 +117,7 @@ public class ParameterValuesField extends JTable public java.util.Map<String, String> getValues() { - java.util.Map<String, String> values = new java.util.HashMap<String, String>(); + java.util.Map<String, String> values = new java.util.HashMap<>(); if(isEditing()) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParametersField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParametersField.java index 5f293678d32..c18b8c8cfa0 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ParametersField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ParametersField.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.event.ActionEvent; @@ -34,7 +34,7 @@ public class ParametersField extends JTable { _editor = editor; - _columnNames = new java.util.Vector<String>(2); + _columnNames = new java.util.Vector<>(2); _columnNames.add("Name"); _columnNames.add("Default value"); @@ -85,11 +85,10 @@ public class ParametersField extends JTable // // Transform map into vector of vectors // - java.util.Vector<java.util.Vector<String>> vector = - new java.util.Vector<java.util.Vector<String>>(names.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(names.size()); for(String name : names) { - java.util.Vector<String> row = new java.util.Vector<String>(2); + java.util.Vector<String> row = new java.util.Vector<>(2); row.add(name); @@ -105,7 +104,7 @@ public class ParametersField extends JTable vector.add(row); } - java.util.Vector<String> newRow = new java.util.Vector<String>(2); + java.util.Vector<String> newRow = new java.util.Vector<>(2); newRow.add(""); newRow.add(_noDefault); vector.add(newRow); @@ -138,7 +137,7 @@ public class ParametersField extends JTable { assert names != null; - java.util.Map<String, String> values = new java.util.HashMap<String, String>(); + java.util.Map<String, String> values = new java.util.HashMap<>(); if(isEditing()) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServer.java index bd72656f482..0a810ac22b4 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServer.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServer.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; @@ -17,8 +17,8 @@ import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class PlainServer extends Communicator implements Server { @@ -284,7 +284,7 @@ class PlainServer extends Communicator implements Server static java.util.List<String[]> createAttributes(ServerDescriptor descriptor) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("id", descriptor.id)); if(descriptor.activation.length() > 0) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServerEditor.java index 0c6d9c548c0..ae1edaa3f96 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServerEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServerEditor.java @@ -7,11 +7,11 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import com.jgoodies.forms.builder.DefaultFormBuilder; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; class PlainServerEditor extends AbstractServerEditor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainService.java index 07d182b08f6..d3788e1e0f5 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainService.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainService.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class PlainService extends Communicator implements Service, Cloneable { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServiceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServiceEditor.java index 8a600e6198f..3aaa2e8f826 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PlainServiceEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PlainServiceEditor.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import com.jgoodies.forms.builder.DefaultFormBuilder; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class PlainServiceEditor extends CommunicatorChildEditor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertiesField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertiesField.java index 0ca5979e848..782c476376e 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertiesField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertiesField.java @@ -7,10 +7,10 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; import java.awt.event.ActionEvent; @@ -31,7 +31,7 @@ public class PropertiesField extends JTable { public PropertiesField(Editor editor) { - _columnNames = new java.util.Vector<String>(2); + _columnNames = new java.util.Vector<>(2); _columnNames.add("Name"); _columnNames.add("Value"); @@ -88,12 +88,12 @@ public class PropertiesField extends JTable // We don't show the .Endpoint and .PublishedEndpoints of adapters, // since they already appear in the Adapter pages // - java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>(); + java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<>(); // // We also hide properties whose value match an object or allocatable // - java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>(); + java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<>(); _hiddenProperties.clear(); @@ -111,11 +111,11 @@ public class PropertiesField extends JTable for(ObjectDescriptor q : p.objects) { - hiddenPropertyValues.add(Ice.Util.identityToString(q.id)); + hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id)); } for(ObjectDescriptor q : p.allocatables) { - hiddenPropertyValues.add(Ice.Util.identityToString(q.id)); + hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id)); } } } @@ -131,8 +131,7 @@ public class PropertiesField extends JTable // // Transform list into vector of vectors // - java.util.Vector<java.util.Vector<String>> vector = - new java.util.Vector<java.util.Vector<String>>(properties.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(properties.size()); for(PropertyDescriptor p : properties) { if(hiddenPropertyNames.contains(p.name)) @@ -167,7 +166,7 @@ public class PropertiesField extends JTable } else { - java.util.Vector<String> row = new java.util.Vector<String>(2); + java.util.Vector<String> row = new java.util.Vector<>(2); row.add(Utils.substitute(p.name, resolver)); row.add(Utils.substitute(p.value, resolver)); vector.add(row); @@ -176,7 +175,7 @@ public class PropertiesField extends JTable if(_editable) { - java.util.Vector<String> newRow = new java.util.Vector<String>(2); + java.util.Vector<String> newRow = new java.util.Vector<>(2); newRow.add(""); newRow.add(""); vector.add(newRow); @@ -229,8 +228,7 @@ public class PropertiesField extends JTable java.util.Vector<java.util.Vector<String>> vector = _model.getDataVector(); - java.util.LinkedList<PropertyDescriptor> result = - new java.util.LinkedList<PropertyDescriptor>(_hiddenProperties); + java.util.LinkedList<PropertyDescriptor> result = new java.util.LinkedList<>(_hiddenProperties); for(java.util.Vector<String> row : vector) { @@ -260,8 +258,7 @@ public class PropertiesField extends JTable private java.util.Vector<String> _columnNames; private boolean _editable = false; - private java.util.LinkedList<PropertyDescriptor> _hiddenProperties = - new java.util.LinkedList<PropertyDescriptor>(); + private java.util.LinkedList<PropertyDescriptor> _hiddenProperties = new java.util.LinkedList<>(); private Editor _editor; } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySet.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySet.java index 1d6c0aa2500..87bc5163cf7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySet.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySet.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class PropertySet extends TreeNode { @@ -22,7 +22,7 @@ class PropertySet extends TreeNode copyDescriptor(PropertySetDescriptor d) { PropertySetDescriptor psd = d.clone(); - psd.properties = new java.util.LinkedList<PropertyDescriptor>(psd.properties); + psd.properties = new java.util.LinkedList<>(psd.properties); return psd; } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetEditor.java index 623b3b6cf48..97dfa5aa198 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JComponent; import javax.swing.JLabel; @@ -18,8 +18,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class PropertySetEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetParent.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetParent.java index c08553f31fe..333cfb5c4f0 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySetParent.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySetParent.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGrid.*; +import com.zeroc.IceGrid.*; interface PropertySetParent { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySets.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySets.java index cf2870c2a87..2793451a08e 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/PropertySets.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/PropertySets.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JPopupMenu; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class PropertySets extends ListTreeNode implements PropertySetParent { static public java.util.Map<String, PropertySetDescriptor> copyDescriptors(java.util.Map<String, PropertySetDescriptor> descriptors) { - java.util.Map<String, PropertySetDescriptor> copy = new java.util.HashMap<String, PropertySetDescriptor>(); + java.util.Map<String, PropertySetDescriptor> copy = new java.util.HashMap<>(); for(java.util.Map.Entry<String, PropertySetDescriptor> p : descriptors.entrySet()) { copy.put(p.getKey(), PropertySet.copyDescriptor(p.getValue())); @@ -103,7 +103,7 @@ class PropertySets extends ListTreeNode implements PropertySetParent // // One big set of updates, followed by inserts // - java.util.List<PropertySet> newChildren = new java.util.ArrayList<PropertySet>(); + java.util.List<PropertySet> newChildren = new java.util.ArrayList<>(); for(java.util.Map.Entry<String, PropertySetDescriptor> p : updates.entrySet()) { @@ -124,7 +124,7 @@ class PropertySets extends ListTreeNode implements PropertySetParent java.util.Map<String, PropertySetDescriptor> getUpdates() { - java.util.Map<String, PropertySetDescriptor> updates = new java.util.HashMap<String, PropertySetDescriptor>(); + java.util.Map<String, PropertySetDescriptor> updates = new java.util.HashMap<>(); for(TreeNodeBase p : _children) { PropertySet ps = (PropertySet)p; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroup.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroup.java index afe5e306403..b681c515109 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroup.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroup.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ReplicaGroup extends TreeNode { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroupEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroupEditor.java index 72e06ec9696..4f1642b15e8 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroupEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroupEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -22,8 +22,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; @SuppressWarnings("unchecked") class ReplicaGroupEditor extends Editor @@ -421,10 +421,10 @@ class ReplicaGroupEditor extends Editor private java.util.Map<String, String[]> objectDescriptorSeqToMap(java.util.List<ObjectDescriptor> objects) { - java.util.Map<String, String[]> result = new java.util.TreeMap<String, String[]>(); + java.util.Map<String, String[]> result = new java.util.TreeMap<>(); for(ObjectDescriptor p : objects) { - result.put(Ice.Util.identityToString(p.id), new String[]{p.type, p.proxyOptions}); + result.put(com.zeroc.Ice.Util.identityToString(p.id), new String[]{p.type, p.proxyOptions}); } return result; } @@ -432,17 +432,17 @@ class ReplicaGroupEditor extends Editor private java.util.LinkedList<ObjectDescriptor> mapToObjectDescriptorSeq(java.util.Map<String, String[]> map) { String badIdentities = ""; - java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<ObjectDescriptor>(); + java.util.LinkedList<ObjectDescriptor> result = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, String[]> p : map.entrySet()) { try { - Ice.Identity id = Ice.Util.stringToIdentity(p.getKey()); + com.zeroc.Ice.Identity id = com.zeroc.Ice.Util.stringToIdentity(p.getKey()); String[] val = p.getValue(); result.add(new ObjectDescriptor(id, val[0], val[1])); } - catch(Ice.IdentityParseException ex) + catch(com.zeroc.Ice.IdentityParseException ex) { badIdentities += "- " + p.getKey() + "\n"; } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroups.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroups.java index 9a4f4e52028..1743923d859 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ReplicaGroups.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ReplicaGroups.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JPopupMenu; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ReplicaGroups extends ListTreeNode { static public java.util.List<ReplicaGroupDescriptor> copyDescriptors(java.util.List<ReplicaGroupDescriptor> descriptors) { - java.util.List<ReplicaGroupDescriptor> copy = new java.util.LinkedList<ReplicaGroupDescriptor>(); + java.util.List<ReplicaGroupDescriptor> copy = new java.util.LinkedList<>(); for(ReplicaGroupDescriptor p : descriptors) { copy.add(ReplicaGroup.copyDescriptor(p)); @@ -97,7 +97,7 @@ class ReplicaGroups extends ListTreeNode java.util.LinkedList<ReplicaGroupDescriptor> getUpdates() { - java.util.LinkedList<ReplicaGroupDescriptor> updates = new java.util.LinkedList<ReplicaGroupDescriptor>(); + java.util.LinkedList<ReplicaGroupDescriptor> updates = new java.util.LinkedList<>(); for(TreeNodeBase p : _children) { ReplicaGroup ra = (ReplicaGroup)p; @@ -131,7 +131,7 @@ class ReplicaGroups extends ListTreeNode // // Updates and inserts // - java.util.List<TreeNodeBase> updatedChildren = new java.util.ArrayList<TreeNodeBase>(); + java.util.List<TreeNodeBase> updatedChildren = new java.util.ArrayList<>(); for(ReplicaGroupDescriptor p : descriptors) { ReplicaGroup child = (ReplicaGroup)findChild(p.id); diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Root.java index e06818d3aa1..30c125db157 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Root.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Root.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import java.awt.Cursor; @@ -22,8 +22,8 @@ import javax.swing.tree.TreePath; import java.io.File; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; public class Root extends ListTreeNode { @@ -434,85 +434,57 @@ public class Root extends ListTreeNode final String prefix = "Updating application '" + _id + "'..."; _coordinator.getStatusBar().setText(prefix); - - Ice.Callback cb = new Ice.Callback() - { - @Override - public void completed(Ice.AsyncResult result) - { - try - { - if(restart) - { - _coordinator.getAdmin().end_updateApplication(result); - } - else - { - _coordinator.getAdmin().end_updateApplicationWithoutRestart(result); - } - - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry( - "updateApplication for application " + _id + ": success"); - } - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - commit(); - release(); - _coordinator.getStatusBar().setText(prefix + "done."); - } - }); - } - catch(final Exception ex) - { - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry( - "updateApplication for application " + _id + ": failed"); - } - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _skipUpdates--; - if(ex instanceof Ice.UserException) - { - handleFailure(prefix, "Update failed", - "IceGrid exception: " + ex.toString()); - } - else - { - handleFailure(prefix, "Update failed", - "Communication exception: " + - ex.toString()); - } - } - - }); - } - } - }; - if(_traceSaveToRegistry) { _coordinator.traceSaveToRegistry("sending updateApplication for application " + _id); } + java.util.concurrent.CompletableFuture<Void> r; if(restart) { - _coordinator.getAdmin().begin_updateApplication(updateDescriptor, cb); + r = _coordinator.getAdmin().updateApplicationAsync(updateDescriptor); } else { - _coordinator.getAdmin().begin_updateApplicationWithoutRestart(updateDescriptor, cb); + r = _coordinator.getAdmin().updateApplicationWithoutRestartAsync(updateDescriptor); } + + r.whenComplete((result, ex) -> + { + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("updateApplication for application " + + _id + + (ex == null ? ": success" : ": failed")); + } + + if(ex == null) + { + SwingUtilities.invokeLater(() -> + { + commit(); + release(); + _coordinator.getStatusBar().setText(prefix + "done."); + }); + } + else + { + SwingUtilities.invokeLater(() -> + { + _skipUpdates--; + if(ex instanceof com.zeroc.Ice.UserException) + { + handleFailure(prefix, "Update failed", + "IceGrid exception: " + ex.toString()); + } + else + { + handleFailure(prefix, "Update failed", + "Communication exception: " + ex.toString()); + } + }); + } + }); asyncRelease = true; // @@ -540,192 +512,135 @@ public class Root extends ListTreeNode final String prefix = "Adding application '" + _id + "'..."; _coordinator.getStatusBar().setText(prefix); - Callback_Admin_addApplication cb = new Callback_Admin_addApplication() + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("sending addApplication for application " + _id); + } + + _coordinator.getAdmin().addApplicationAsync(_descriptor).whenComplete((result, ex) -> { - @Override - public void response() + if(_traceSaveToRegistry) { - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry("addApplication for application " + - _id + ": success"); - } - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - commit(); - liveReset(); - _coordinator.addLiveApplication(Root.this); - release(); - _coordinator.getStatusBar().setText(prefix + "done."); - } - }); + _coordinator.traceSaveToRegistry("addApplication for application " + _id + + (ex == null ? ": success" : ": failed")); } - @Override - public void exception(final Ice.UserException e) + if(ex == null) { - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry("addApplication for application " + - _id + ": failed"); - } - - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - handleFailure(prefix, "Add failed", - "IceGrid exception: " + e.toString()); - } - + commit(); + liveReset(); + _coordinator.addLiveApplication(Root.this); + release(); + _coordinator.getStatusBar().setText(prefix + "done."); }); } - - @Override - public void exception(final Ice.LocalException e) + else { - if(_traceSaveToRegistry) + if(ex instanceof com.zeroc.Ice.UserException) { - _coordinator.traceSaveToRegistry("addApplication for application " + - _id + ": failed"); + SwingUtilities.invokeLater(() -> + { + handleFailure(prefix, "Add failed", + "IceGrid exception: " + ex.toString()); + }); } - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + else + { + SwingUtilities.invokeLater(() -> { handleFailure(prefix, "Add failed", - "Communication exception: " + e.toString()); - } - }); + "Communication exception: " + ex.toString()); + }); + } } - - }; - - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry("sending addApplication for application " + _id); - } - - _coordinator.getAdmin().begin_addApplication(_descriptor, cb); + }); asyncRelease = true; } else { final String prefix = "Synchronizing application '" + _id + "'..."; _coordinator.getStatusBar().setText(prefix); - - Ice.Callback cb = new Ice.Callback() + + if(_traceSaveToRegistry) + { + _coordinator.traceSaveToRegistry("sending syncApplication for application " + _id); + } + + java.util.concurrent.CompletableFuture<Void> r; + if(restart) + { + r = _coordinator.getAdmin().syncApplicationAsync(_descriptor); + } + else + { + r = _coordinator.getAdmin().syncApplicationWithoutRestartAsync(_descriptor); + } + + r.whenComplete((result, ex) -> { - @Override - public void completed(Ice.AsyncResult result) + if(_traceSaveToRegistry) { - try - { - if(restart) - { - _coordinator.getAdmin().end_syncApplication(result); - } - else - { - _coordinator.getAdmin().end_syncApplicationWithoutRestart(result); - } - - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry("syncApplication for application " + - _id + ": success"); - } - - SwingUtilities.invokeLater(new Runnable() + _coordinator.traceSaveToRegistry("syncApplication for application " + _id + + (ex == null ? ": success" : ": failed")); + } + + if(ex == null) + { + SwingUtilities.invokeLater(() -> { - @Override - public void run() + commit(); + if(!_live) { - commit(); - if(!_live) + // + // Make this tab live or close it if there is one already + // open + // + ApplicationPane app = _coordinator.getLiveApplication(_id); + if(app == null) { - // - // Make this tab live or close it if there is one already - // open - // - ApplicationPane app = _coordinator.getLiveApplication(_id); - if(app == null) - { - liveReset(); - _coordinator.addLiveApplication(Root.this); - } - else + liveReset(); + _coordinator.addLiveApplication(Root.this); + } + else + { + boolean selected = isSelected(); + _coordinator.getMainPane().removeApplication(Root.this); + if(selected) { - boolean selected = isSelected(); - _coordinator.getMainPane().removeApplication(Root.this); - if(selected) - { - _coordinator.getMainPane().setSelectedComponent(app); - } + _coordinator.getMainPane().setSelectedComponent(app); } } - - release(); - _coordinator.getStatusBar().setText(prefix + "done."); } - }); - } - catch(final Exception ex) - { - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry("syncApplication for application " + - _id + ": failed"); - } - SwingUtilities.invokeLater(new Runnable() + release(); + _coordinator.getStatusBar().setText(prefix + "done."); + }); + } + else + { + SwingUtilities.invokeLater(() -> + { + if(_live) { - @Override - public void run() - { - if(_live) - { - _skipUpdates--; - } - - if(ex instanceof Ice.UserException) - { - handleFailure(prefix, "Sync failed", - "IceGrid exception: " + ex.toString()); - } - else - { - handleFailure(prefix, "Sync failed", - "Communication exception: " + - ex.toString()); - } - } + _skipUpdates--; + } - }); - } + if(ex instanceof com.zeroc.Ice.UserException) + { + handleFailure(prefix, "Sync failed", + "IceGrid exception: " + ex.toString()); + } + else + { + handleFailure(prefix, "Sync failed", + "Communication exception: " + + ex.toString()); + } + }); } - }; - - if(_traceSaveToRegistry) - { - _coordinator.traceSaveToRegistry("sending syncApplication for application " + _id); - } - - if(restart) - { - _coordinator.getAdmin().begin_syncApplication(_descriptor, cb); - } - else - { - _coordinator.getAdmin().begin_syncApplicationWithoutRestart(_descriptor, cb); - } + }); asyncRelease = true; if(_live) @@ -743,13 +658,13 @@ public class Root extends ListTreeNode _coordinator.getDiscardUpdatesAction().setEnabled(false); } } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { if(_traceSaveToRegistry) { _coordinator.traceSaveToRegistry("Ice communications exception while saving application " + _id); - } + } JOptionPane.showMessageDialog( _coordinator.getMainFrame(), @@ -776,7 +691,7 @@ public class Root extends ListTreeNode { _coordinator.accessDenied(e); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog( _coordinator.getMainFrame(), @@ -813,7 +728,7 @@ public class Root extends ListTreeNode { desc = _coordinator.getLiveDeploymentRoot().getApplicationDescriptor(_id); assert desc != null; - desc = IceGridGUI.Application.Root.copyDescriptor(desc); + desc = com.zeroc.IceGridGUI.Application.Root.copyDescriptor(desc); } else if(_file != null) { @@ -879,14 +794,14 @@ public class Root extends ListTreeNode // if(!_descriptor.description.equals(_origDescription)) { - update.description = new IceGrid.BoxedString(_descriptor.description); + update.description = new com.zeroc.IceGrid.BoxedString(_descriptor.description); } // // Diff variables // - update.variables = new java.util.TreeMap<String, String>(_descriptor.variables); - java.util.List<String> removeVariables = new java.util.LinkedList<String>(); + update.variables = new java.util.TreeMap<>(_descriptor.variables); + java.util.List<String> removeVariables = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, String> p : _origVariables.entrySet()) { @@ -912,12 +827,12 @@ public class Root extends ListTreeNode // if(!_descriptor.distrib.equals(_origDistrib)) { - update.distrib = new IceGrid.BoxedDistributionDescriptor(_descriptor.distrib); + update.distrib = new com.zeroc.IceGrid.BoxedDistributionDescriptor(_descriptor.distrib); } } else { - update.variables = new java.util.TreeMap<String, String>(); + update.variables = new java.util.TreeMap<>(); update.removeVariables = new String[0]; } @@ -1299,7 +1214,7 @@ public class Root extends ListTreeNode { writer.writeStartTag("icegrid"); - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", _id)); writer.writeStartTag("application", attributes); @@ -1547,8 +1462,7 @@ public class Root extends ListTreeNode // Updates saved when _updated == false and // _registryUpdatesEnabled == false // - private java.util.List<ApplicationUpdateDescriptor> _concurrentUpdates = - new java.util.LinkedList<ApplicationUpdateDescriptor>(); + private java.util.List<ApplicationUpdateDescriptor> _concurrentUpdates = new java.util.LinkedList<>(); // // When _live is true and _canUseUpdateDescriptor is true, we can @@ -1573,7 +1487,7 @@ public class Root extends ListTreeNode // // Map editor-class to Editor object // - private java.util.Map<Class, Editor> _editorMap = new java.util.HashMap<Class, Editor>(); + private java.util.Map<Class, Editor> _editorMap = new java.util.HashMap<>(); private ApplicationPane _applicationPane; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Server.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Server.java index 730065269fe..a16d6fac0c2 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Server.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Server.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; interface Server extends TemplateInstance { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstance.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstance.java index 0d9d71c72a4..958119a384d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstance.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstance.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; @@ -17,8 +17,8 @@ import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServerInstance extends ListTreeNode implements Server, PropertySetParent { @@ -300,7 +300,7 @@ class ServerInstance extends ListTreeNode implements Server, PropertySetParent TemplateDescriptor templateDescriptor = getRoot().findServerTemplateDescriptor(_descriptor.template); - java.util.Set<String> parameters = new java.util.HashSet<String>(templateDescriptor.parameters); + java.util.Set<String> parameters = new java.util.HashSet<>(templateDescriptor.parameters); if(!parameters.equals(_descriptor.parameterValues.keySet())) { backup.parameterValues = _descriptor.parameterValues; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstanceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstanceEditor.java index 0336bf1496d..5191af06dc9 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstanceEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstanceEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.event.ActionEvent; @@ -22,8 +22,8 @@ import javax.swing.event.ListDataListener; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; @SuppressWarnings("unchecked") class ServerInstanceEditor extends AbstractServerEditor diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstancePropertySetEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstancePropertySetEditor.java index ada8db7630f..e609b38d28d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerInstancePropertySetEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerInstancePropertySetEditor.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JTextField; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; class ServerInstancePropertySetEditor extends PropertySetEditor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerSubEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerSubEditor.java index 210f74a96a5..16829817e5b 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerSubEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerSubEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.event.ActionEvent; @@ -22,8 +22,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; @SuppressWarnings("unchecked") class ServerSubEditor extends CommunicatorSubEditor @@ -206,7 +206,7 @@ class ServerSubEditor extends CommunicatorSubEditor descriptor.options = _options.getList(); descriptor.user = _user.getText().trim(); - descriptor.envs = new java.util.LinkedList<String>(); + descriptor.envs = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, String> p : _envs.get().entrySet()) { descriptor.envs.add(p.getKey() + "=" + p.getValue()); @@ -276,7 +276,7 @@ class ServerSubEditor extends CommunicatorSubEditor _user.setText(Utils.substitute(descriptor.user, detailResolver)); _user.setEditable(isEditable); - java.util.Map<String, String> envMap = new java.util.TreeMap<String, String>(); + java.util.Map<String, String> envMap = new java.util.TreeMap<>(); for(String p : descriptor.envs) { int equal = p.indexOf('='); diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplate.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplate.java index a4d6cd21fa8..197a162e749 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplate.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplate.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.Icon; @@ -16,8 +16,8 @@ import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServerTemplate extends Communicator { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplateEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplateEditor.java index 8f220cd5016..3265c555b96 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplateEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplateEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import com.jgoodies.forms.builder.DefaultFormBuilder; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplates.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplates.java index 4f4556a663c..cfafffe1de7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServerTemplates.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServerTemplates.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JPopupMenu; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServerTemplates extends Templates { static public java.util.Map<String, TemplateDescriptor> copyDescriptors(java.util.Map<String, TemplateDescriptor> descriptors) { - java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<String, TemplateDescriptor>(); + java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<>(); for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet()) { copy.put(p.getKey(), ServerTemplate.copyDescriptor(p.getValue())); @@ -119,7 +119,7 @@ class ServerTemplates extends Templates java.util.Map<String, TemplateDescriptor> getUpdates() { - java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<String, TemplateDescriptor>(); + java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<>(); for(TreeNodeBase p : _children) { ServerTemplate t = (ServerTemplate)p; @@ -143,7 +143,7 @@ class ServerTemplates extends Templates java.util.List<ServiceInstance> findServiceInstances(String template) { - java.util.List<ServiceInstance> result = new java.util.LinkedList<ServiceInstance>(); + java.util.List<ServiceInstance> result = new java.util.LinkedList<>(); for(TreeNodeBase p : _children) { ServerTemplate t = (ServerTemplate)p; @@ -211,8 +211,8 @@ class ServerTemplates extends Templates // // One big set of updates, followed by inserts // - java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>(); - java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<TreeNodeBase>(); + java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>(); + java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, TemplateDescriptor> p : updates.entrySet()) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Service.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Service.java index ac0bb8455c5..034effd125e 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Service.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Service.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; interface Service extends TemplateInstance, DescriptorHolder { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstance.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstance.java index d68c1436be1..aaa4cc4bc0a 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstance.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstance.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServiceInstance extends TreeNode implements Service, Cloneable { @@ -36,7 +36,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable static public java.util.List<ServiceInstanceDescriptor> copyDescriptors(java.util.List<ServiceInstanceDescriptor> descriptors) { - java.util.List<ServiceInstanceDescriptor> copy = new java.util.LinkedList<ServiceInstanceDescriptor>(); + java.util.List<ServiceInstanceDescriptor> copy = new java.util.LinkedList<>(); for(ServiceInstanceDescriptor p : descriptors) { copy.add(copyDescriptor(p)); @@ -233,7 +233,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable { TemplateDescriptor templateDescriptor = getRoot().findServiceTemplateDescriptor(_descriptor.template); - java.util.Set<String> parameters = new java.util.HashSet<String>(templateDescriptor.parameters); + java.util.Set<String> parameters = new java.util.HashSet<>(templateDescriptor.parameters); if(!parameters.equals(_descriptor.parameterValues.keySet())) { backup.parameterValues = _descriptor.parameterValues; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstanceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstanceEditor.java index 544cf5fa1b7..c2b7f04a8e9 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceInstanceEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceInstanceEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.event.ActionEvent; @@ -22,8 +22,8 @@ import javax.swing.event.ListDataListener; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; @SuppressWarnings("unchecked") class ServiceInstanceEditor extends CommunicatorChildEditor diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceSubEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceSubEditor.java index 51a049173d4..de919f2a14c 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceSubEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceSubEditor.java @@ -7,14 +7,14 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServiceSubEditor extends CommunicatorSubEditor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplate.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplate.java index 98630c9fa3f..fe87092dacf 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplate.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplate.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.awt.Component; import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServiceTemplate extends Communicator { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplateEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplateEditor.java index 9a82352a390..a50ea4b27e8 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplateEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplateEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import com.jgoodies.forms.builder.DefaultFormBuilder; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplates.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplates.java index 841e7f9b3b3..dada1ff903b 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/ServiceTemplates.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/ServiceTemplates.java @@ -7,19 +7,19 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JPopupMenu; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServiceTemplates extends Templates { static public java.util.Map<String, TemplateDescriptor> copyDescriptors(java.util.Map<String, TemplateDescriptor> descriptors) { - java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<String, TemplateDescriptor>(); + java.util.Map<String, TemplateDescriptor> copy = new java.util.HashMap<>(); for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet()) { copy.put(p.getKey(), ServiceTemplate.copyDescriptor(p.getValue())); @@ -130,7 +130,7 @@ class ServiceTemplates extends Templates java.util.Map<String, TemplateDescriptor> getUpdates() { - java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<String, TemplateDescriptor>(); + java.util.Map<String, TemplateDescriptor> updates = new java.util.HashMap<>(); for(TreeNodeBase p : _children) { ServiceTemplate t = (ServiceTemplate)p; @@ -167,8 +167,8 @@ class ServiceTemplates extends Templates // // One big set of updates, followed by inserts // - java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<TreeNodeBase>(); - java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<TreeNodeBase>(); + java.util.List<TreeNodeBase> newChildren = new java.util.ArrayList<>(); + java.util.List<TreeNodeBase> updatedChildren = new java.util.LinkedList<>(); for(java.util.Map.Entry<String, TemplateDescriptor> p : descriptors.entrySet()) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/SimpleMapField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/SimpleMapField.java index 4bc4173dd9e..9e02d8b2f51 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/SimpleMapField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/SimpleMapField.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; import java.awt.event.ActionEvent; @@ -33,7 +33,7 @@ public class SimpleMapField extends JTable _editor = editor; _substituteKey = substituteKey; - _columnNames = new java.util.Vector<String>(2); + _columnNames = new java.util.Vector<>(2); _columnNames.add(headKey); _columnNames.add(headValue); @@ -85,10 +85,10 @@ public class SimpleMapField extends JTable // // Transform map into vector of vectors // - java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(map.size()); for(java.util.Map.Entry<String, String> p : map.entrySet()) { - java.util.Vector<String> row = new java.util.Vector<String>(2); + java.util.Vector<String> row = new java.util.Vector<>(2); if(_substituteKey) { @@ -105,7 +105,7 @@ public class SimpleMapField extends JTable if(_editable) { - java.util.Vector<String> newRow = new java.util.Vector<String>(2); + java.util.Vector<String> newRow = new java.util.Vector<>(2); newRow.add(""); newRow.add(""); vector.add(newRow); @@ -159,7 +159,7 @@ public class SimpleMapField extends JTable java.util.Vector<java.util.Vector<String>> vector = _model.getDataVector(); - java.util.TreeMap<String, String> result = new java.util.TreeMap<String, String>(); + java.util.TreeMap<String, String> result = new java.util.TreeMap<>(); for(java.util.Vector<String> row : vector) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateEditor.java index 661e35ea217..b24b86f93e4 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import javax.swing.JOptionPane; import javax.swing.JScrollPane; @@ -16,7 +16,7 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; +import com.zeroc.IceGrid.*; class TemplateEditor extends Editor { @@ -42,7 +42,7 @@ class TemplateEditor extends Editor void writeDescriptor() { TemplateDescriptor descriptor = getDescriptor(); - java.util.LinkedList<String> parameters = new java.util.LinkedList<String>(); + java.util.LinkedList<String> parameters = new java.util.LinkedList<>(); descriptor.parameterDefaults = _parameters.get(parameters); descriptor.parameters = parameters; } @@ -50,7 +50,7 @@ class TemplateEditor extends Editor boolean isSimpleUpdate() { TemplateDescriptor descriptor = getDescriptor(); - java.util.List<String> parameters = new java.util.LinkedList<String>(); + java.util.List<String> parameters = new java.util.LinkedList<>(); java.util.Map<String, String> defaultValues = _parameters.get(parameters); return descriptor.parameters.equals(parameters) && descriptor.parameterDefaults.equals(defaultValues); diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateInstance.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateInstance.java index c780c7cd9a2..e05e2a1f323 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TemplateInstance.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TemplateInstance.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; interface TemplateInstance { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Templates.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Templates.java index 4251fa67f86..bdb04178da0 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/Templates.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/Templates.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; -import IceGrid.*; +import com.zeroc.IceGrid.*; abstract class Templates extends ListTreeNode { @@ -25,9 +25,9 @@ abstract class Templates extends ListTreeNode throws UpdateFailedException { java.util.List<? extends TemplateInstance> instanceList = child.findInstances(); - java.util.List<Object> backupList = new java.util.Vector<Object>(); + java.util.List<Object> backupList = new java.util.Vector<>(); - java.util.List<Editable> editables = new java.util.LinkedList<Editable>(); + java.util.List<Editable> editables = new java.util.LinkedList<>(); for(TemplateInstance p : instanceList) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TreeNode.java index e72a51aed04..f8276f2dc2c 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/TreeNode.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/TreeNode.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; import java.util.Enumeration; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; public abstract class TreeNode extends TreeNodeBase { @@ -99,7 +99,7 @@ public abstract class TreeNode extends TreeNodeBase { for(java.util.Map.Entry<String, String> p : variables.entrySet()) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", p.getKey())); attributes.add(createAttribute("value", p.getValue())); @@ -128,8 +128,8 @@ public abstract class TreeNode extends TreeNodeBase // We don't show the .Endpoint of adapters, // since they already appear in the Adapter descriptors // - java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<String>(); - java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<String>(); + java.util.Set<String> hiddenPropertyNames = new java.util.HashSet<>(); + java.util.Set<String> hiddenPropertyValues = new java.util.HashSet<>(); if(adapters != null) { @@ -140,11 +140,11 @@ public abstract class TreeNode extends TreeNodeBase for(ObjectDescriptor q : p.objects) { - hiddenPropertyValues.add(Ice.Util.identityToString(q.id)); + hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id)); } for(ObjectDescriptor q : p.allocatables) { - hiddenPropertyValues.add(Ice.Util.identityToString(q.id)); + hiddenPropertyValues.add(com.zeroc.Ice.Util.identityToString(q.id)); } } } @@ -157,7 +157,7 @@ public abstract class TreeNode extends TreeNodeBase } } - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); if(id.length() > 0) { attributes.add(createAttribute(idAttrName, id)); @@ -207,7 +207,7 @@ public abstract class TreeNode extends TreeNodeBase { for(String log : logs) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("path", log)); String prop = lookupName(log, properties); if(prop != null) @@ -235,7 +235,7 @@ public abstract class TreeNode extends TreeNodeBase { if(descriptor.icepatch.length() > 0) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("icepatch", descriptor.icepatch)); if(descriptor.directories.isEmpty()) @@ -260,8 +260,8 @@ public abstract class TreeNode extends TreeNodeBase { for(ObjectDescriptor p : objects) { - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); - String strId = Ice.Util.identityToString(p.id); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); + String strId = com.zeroc.Ice.Util.identityToString(p.id); attributes.add(createAttribute("identity", strId)); if(p.type.length() > 0) { @@ -290,7 +290,7 @@ public abstract class TreeNode extends TreeNodeBase for(String p : new java.util.LinkedHashSet<String>(parameters)) { String val = defaultValues.get(p); - java.util.List<String[]> attributes = new java.util.LinkedList<String[]>(); + java.util.List<String[]> attributes = new java.util.LinkedList<>(); attributes.add(createAttribute("name", p)); if(val != null) { @@ -303,7 +303,7 @@ public abstract class TreeNode extends TreeNodeBase static java.util.LinkedList<String[]> parameterValuesToAttributes(java.util.Map<String, String> parameterValues, java.util.List<String> parameters) { - java.util.LinkedList<String[]> result = new java.util.LinkedList<String[]>(); + java.util.LinkedList<String[]> result = new java.util.LinkedList<>(); // // We use a LinkedHashSet to maintain order while eliminating duplicates diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/UpdateFailedException.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/UpdateFailedException.java index b64452e6bc5..30cce1ffcb8 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Application/UpdateFailedException.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Application/UpdateFailedException.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.Application; +package com.zeroc.IceGridGUI.Application; public class UpdateFailedException extends Exception { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationActions.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationActions.java index ffe0526f439..6029c2c52ca 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationActions.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationActions.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; -import IceGridGUI.Application.*; +import com.zeroc.IceGridGUI.Application.*; // // Holds all actions for the Application view diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java index 2016ac3b0f8..7589bd2c61b 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationObserverI.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationObserverI.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.SwingUtilities; -import IceGrid.*; +import com.zeroc.IceGrid.*; -class ApplicationObserverI extends _ApplicationObserverDisp +class ApplicationObserverI implements ApplicationObserver { ApplicationObserverI(String instanceName, Coordinator coordinator) { @@ -48,13 +48,13 @@ class ApplicationObserverI extends _ApplicationObserverDisp } else { - throw new Ice.TimeoutException(); + throw new com.zeroc.Ice.TimeoutException(); } } @Override public synchronized void applicationInit(int serial, java.util.List<ApplicationInfo> applications, - Ice.Current current) + com.zeroc.Ice.Current current) { if(_trace) { @@ -86,7 +86,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp } @Override - public void applicationAdded(final int serial, final ApplicationInfo info, Ice.Current current) + public void applicationAdded(final int serial, final ApplicationInfo info, com.zeroc.Ice.Current current) { if(_trace) { @@ -106,7 +106,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp } @Override - public void applicationRemoved(final int serial, final String name, final Ice.Current current) + public void applicationRemoved(final int serial, final String name, final com.zeroc.Ice.Current current) { if(_trace) { @@ -126,7 +126,7 @@ class ApplicationObserverI extends _ApplicationObserverDisp } @Override - public void applicationUpdated(final int serial, final ApplicationUpdateInfo info, Ice.Current current) + public void applicationUpdated(final int serial, final ApplicationUpdateInfo info, com.zeroc.Ice.Current current) { if(_trace) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationPane.java index b02e075d58d..a0c44c1b75a 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ApplicationPane.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ApplicationPane.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.*; import java.awt.event.MouseAdapter; @@ -25,9 +25,9 @@ import javax.swing.tree.TreeSelectionModel; import com.jgoodies.forms.factories.Borders; -import IceGridGUI.Application.Editor; -import IceGridGUI.Application.Root; -import IceGridGUI.Application.TreeNode; +import com.zeroc.IceGridGUI.Application.Editor; +import com.zeroc.IceGridGUI.Application.Root; +import com.zeroc.IceGridGUI.Application.TreeNode; public class ApplicationPane extends JSplitPane implements Tab { @@ -484,8 +484,8 @@ public class ApplicationPane extends JSplitPane implements Tab // // back/forward navigation // - private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>(); - private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>(); + private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<>(); + private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<>(); private TreeNode _currentNode; private Editor _currentEditor; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/CellRenderer.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/CellRenderer.java index e9c5adb16a0..da00e67dc98 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/CellRenderer.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/CellRenderer.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.Component; import javax.swing.JTree; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java index a06e8617f97..63a307cbe63 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Coordinator.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Coordinator.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.lang.reflect.Constructor; import java.net.URI; @@ -42,13 +42,13 @@ import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.X509Certificate; -import Ice.LocatorFinderPrxHelper; -import IceGrid.*; +import com.zeroc.Ice.LocatorFinderPrx; +import com.zeroc.IceGrid.*; import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; -import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData; +import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData; // // This class coordinates the communications between the various objects @@ -204,7 +204,7 @@ public class Coordinator else if(o instanceof JTree) { JTree tree = (JTree)o; - if(tree.getModel().getRoot() instanceof IceGridGUI.Application.Root) + if(tree.getModel().getRoot() instanceof com.zeroc.IceGridGUI.Application.Root) { enableTreeEditActions(); } @@ -265,11 +265,11 @@ public class Coordinator private void enableTreeEditActions() { _cut.setTarget(null); - _copy.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.COPY)); - _paste.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.PASTE)); - _delete.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.DELETE)); - _moveUp.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.MOVE_UP)); - _moveDown.setTarget(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.MOVE_DOWN)); + _copy.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.COPY)); + _paste.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.PASTE)); + _delete.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.DELETE)); + _moveUp.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.MOVE_UP)); + _moveDown.setTarget(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.MOVE_DOWN)); } private class MenuBar extends JMenuBar @@ -295,11 +295,11 @@ public class Coordinator _newMenu.add(_newApplicationWithDefaultTemplates); _newMenu.addSeparator(); - _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_ADAPTER)); - _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_DBENV)); - _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_NODE)); - _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_PROPERTY_SET)); - _newMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_REPLICA_GROUP)); + _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_ADAPTER)); + _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_DBENV)); + _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_NODE)); + _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_PROPERTY_SET)); + _newMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_REPLICA_GROUP)); // // Open sub-menu @@ -314,9 +314,10 @@ public class Coordinator _newServerMenu = new JMenu("Server"); _newServerMenu.setEnabled(false); _newMenu.add(_newServerMenu); - _newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER)); - _newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX)); - _newServerMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE)); + _newServerMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER)); + _newServerMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX)); + _newServerMenu.add( + _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE)); // // New service sub-sub-menu @@ -324,8 +325,9 @@ public class Coordinator _newServiceMenu = new JMenu("Service"); _newServiceMenu.setEnabled(false); _newMenu.add(_newServiceMenu); - _newServiceMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVICE)); - _newServiceMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE)); + _newServiceMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE)); + _newServiceMenu.add( + _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE)); // // New template sub-sub-menu @@ -333,9 +335,11 @@ public class Coordinator _newTemplateMenu = new JMenu("Template"); _newTemplateMenu.setEnabled(false); _newMenu.add(_newTemplateMenu); - _newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER)); - _newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX)); - _newTemplateMenu.add(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE)); + _newTemplateMenu.add(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER)); + _newTemplateMenu.add( + _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX)); + _newTemplateMenu.add( + _appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE)); // // New Graph sub-menu @@ -419,8 +423,10 @@ public class Coordinator _metricsViewMenu = new JMenu("Metrics View"); _metricsViewMenu.setEnabled(false); toolsMenu.add(_metricsViewMenu); - _metricsViewMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW)); - _metricsViewMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW)); + _metricsViewMenu.add( + _liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW)); + _metricsViewMenu.add( + _liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW)); // // Node sub-menu @@ -428,11 +434,11 @@ public class Coordinator _nodeMenu = new JMenu("Node"); _nodeMenu.setEnabled(false); toolsMenu.add(_nodeMenu); - _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); - _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT)); - _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR)); + _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); + _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT)); + _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR)); _nodeMenu.addSeparator(); - _nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE)); + _nodeMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE)); // // Registry sub-menu @@ -440,13 +446,13 @@ public class Coordinator _registryMenu = new JMenu("Registry"); _registryMenu.setEnabled(false); toolsMenu.add(_registryMenu); - _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ADD_OBJECT)); + _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ADD_OBJECT)); _registryMenu.addSeparator(); - _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); - _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT)); - _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR)); + _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); + _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT)); + _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR)); _registryMenu.addSeparator(); - _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY)); + _registryMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY)); // // Server sub-menu @@ -454,31 +460,31 @@ public class Coordinator _serverMenu = new JMenu("Server"); _serverMenu.setEnabled(false); toolsMenu.add(_serverMenu); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.START)); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.STOP)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP)); _serverMenu.addSeparator(); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ENABLE)); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.DISABLE)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE)); _serverMenu.addSeparator(); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.PATCH_SERVER)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.PATCH_SERVER)); _serverMenu.addSeparator(); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.WRITE_MESSAGE)); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT)); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR)); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.WRITE_MESSAGE)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDOUT)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_STDERR)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE)); _serverMenu.addSeparator(); _signalMenu = new JMenu("Send Signal"); _serverMenu.add(_signalMenu); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGHUP)); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGINT)); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGQUIT)); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGKILL)); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGUSR1)); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGUSR2)); - _signalMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SIGTERM)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGHUP)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGINT)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGQUIT)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGKILL)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGUSR1)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGUSR2)); + _signalMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGTERM)); _serverMenu.addSeparator(); - _serverMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION)); + _serverMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION)); // // Service sub-menu @@ -486,11 +492,11 @@ public class Coordinator _serviceMenu = new JMenu("Service"); _serviceMenu.setEnabled(false); toolsMenu.add(_serviceMenu); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.START)); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.STOP)); + _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START)); + _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP)); _serviceMenu.addSeparator(); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); - _serviceMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE)); + _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG)); + _serviceMenu.add(_liveActionsForMenu.get(com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE)); // // Help menu @@ -598,48 +604,48 @@ public class Coordinator } } - static private class ReuseConnectionRouter extends Ice._RouterDisp + static private class ReuseConnectionRouter implements com.zeroc.Ice.Router { public - ReuseConnectionRouter(Ice.ObjectPrx proxy) + ReuseConnectionRouter(com.zeroc.Ice.ObjectPrx proxy) { _clientProxy = proxy; } @Override - public Ice.ObjectPrx - getClientProxy(Ice.Current current) + public com.zeroc.Ice.ObjectPrx + getClientProxy(com.zeroc.Ice.Current current) { return _clientProxy; } @Override - public Ice.ObjectPrx - getServerProxy(Ice.Current current) + public com.zeroc.Ice.ObjectPrx + getServerProxy(com.zeroc.Ice.Current current) { return null; } @Override - public Ice.ObjectPrx[] - addProxies(Ice.ObjectPrx[] proxies, Ice.Current current) + public com.zeroc.Ice.ObjectPrx[] + addProxies(com.zeroc.Ice.ObjectPrx[] proxies, com.zeroc.Ice.Current current) { - return new Ice.ObjectPrx[0]; + return new com.zeroc.Ice.ObjectPrx[0]; } - private final Ice.ObjectPrx _clientProxy; + private final com.zeroc.Ice.ObjectPrx _clientProxy; } - public Ice.Communicator getCommunicator() + public com.zeroc.Ice.Communicator getCommunicator() { if(_communicator == null) { - _communicator = Ice.Util.initialize(_initData); + _communicator = com.zeroc.Ice.Util.initialize(_initData); } return _communicator; } - public Ice.Properties getProperties() + public com.zeroc.Ice.Properties getProperties() { return _initData.properties; } @@ -715,13 +721,13 @@ public class Coordinator // // Essential: deep-copy desc! // - desc = IceGridGUI.Application.Root.copyDescriptor(desc); - IceGridGUI.Application.Root root; + desc = com.zeroc.IceGridGUI.Application.Root.copyDescriptor(desc); + com.zeroc.IceGridGUI.Application.Root root; try { - root = new IceGridGUI.Application.Root(this, desc, true, null); + root = new com.zeroc.IceGridGUI.Application.Root(this, desc, true, null); } - catch(IceGridGUI.Application.UpdateFailedException e) + catch(com.zeroc.IceGridGUI.Application.UpdateFailedException e) { JOptionPane.showMessageDialog( _mainFrame, @@ -744,7 +750,7 @@ public class Coordinator _liveApplications.remove(name); } - public void addLiveApplication(IceGridGUI.Application.Root root) + public void addLiveApplication(com.zeroc.IceGridGUI.Application.Root root) { ApplicationPane app = _mainPane.findApplication(root); assert app != null; @@ -864,7 +870,7 @@ public class Coordinator _liveDeploymentPane.refresh(); } - void objectRemoved(Ice.Identity id) + void objectRemoved(com.zeroc.Ice.Identity id) { _liveDeploymentRoot.objectRemoved(id); _liveDeploymentPane.refresh(); @@ -883,9 +889,10 @@ public class Coordinator public void pasteApplication() { Object descriptor = getClipboard(); - ApplicationDescriptor desc = IceGridGUI.Application.Root.copyDescriptor((ApplicationDescriptor)descriptor); + ApplicationDescriptor desc = + com.zeroc.IceGridGUI.Application.Root.copyDescriptor((ApplicationDescriptor)descriptor); - IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, desc); + com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, desc); ApplicationPane app = new ApplicationPane(root); _mainPane.addApplication(app); _mainPane.setSelectedComponent(app); @@ -925,78 +932,53 @@ public class Coordinator boolean asyncRelease = false; final String prefix = "Deleting application '" + name + "'..."; - Callback_Admin_removeApplication cb = new Callback_Admin_removeApplication() - { - @Override - public void response() + + if(_traceSaveToRegistry) + { + traceSaveToRegistry("sending removeApplication for application " + name); + } + + try + { + _sessionKeeper.getAdmin().removeApplicationAsync(name).whenComplete((result, ex) -> { if(_traceSaveToRegistry) { - traceSaveToRegistry("removeApplication for application " + name + ": success"); + traceSaveToRegistry("removeApplication for application " + name + + (ex == null ? ": success" : ": failed")); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + if(ex == null) + { + SwingUtilities.invokeLater(() -> { release(); getStatusBar().setText(prefix + "done."); - } - }); - } - - @Override - public void exception(final Ice.UserException e) - { - if(_traceSaveToRegistry) - { - traceSaveToRegistry("removeApplication for application " + name + ": failed"); + }); } - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - handleFailure(prefix, "Delete failed", - "IceGrid exception: " + e.toString()); - } - - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - if(_traceSaveToRegistry) + else { - traceSaveToRegistry("removeApplication for application " + name + ": failed"); - } - - SwingUtilities.invokeLater(new Runnable() + if(ex instanceof com.zeroc.Ice.UserException) { - @Override - public void run() - { - handleFailure(prefix, "Delete failed", - "Communication exception: " + e.toString()); - } - }); - } - }; - - if(_traceSaveToRegistry) - { - traceSaveToRegistry("sending removeApplication for application " + name); - } - - try - { - _sessionKeeper.getAdmin().begin_removeApplication(name, cb); + SwingUtilities.invokeLater(() -> + { + handleFailure(prefix, "Delete failed", + "IceGrid exception: " + ex.toString()); + }); + } + else + { + SwingUtilities.invokeLater(() -> + { + handleFailure(prefix, "Delete failed", + "Communication exception: " + ex.toString()); + }); + } + } + }); asyncRelease = true; } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { if(_traceSaveToRegistry) { @@ -1026,7 +1008,7 @@ public class Coordinator { accessDenied(e); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog( _mainFrame, @@ -1117,13 +1099,13 @@ public class Coordinator { accessDenied(e); } - catch(Ice.ObjectNotExistException e) + catch(com.zeroc.Ice.ObjectNotExistException e) { // // Ignored, the session is gone, and so is the exclusive access. // } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog( _mainFrame, @@ -1226,7 +1208,7 @@ public class Coordinator // // Close al graphs // - java.util.List<IGraphView> views = new java.util.ArrayList<IGraphView>(_graphViews); + java.util.List<IGraphView> views = new java.util.ArrayList<>(_graphViews); for(IGraphView v : views) { v.close(); @@ -1246,7 +1228,7 @@ public class Coordinator _saveToRegistryWithoutRestart.setEnabled(false); } - enum TrustDecision{YesAlways, YesThisTime, No}; + enum TrustDecision { YesAlways, YesThisTime, No }; void login(final SessionKeeper sessionKeeper, @@ -1254,7 +1236,6 @@ public class Coordinator final JDialog parent, final Cursor oldCursor) { - // // Keep certificates arround for connection retry // @@ -1263,10 +1244,10 @@ public class Coordinator destroyCommunicator(); - Ice.InitializationData initData = _initData; + com.zeroc.Ice.InitializationData initData = _initData; initData = initData.clone(); initData.properties = initData.properties._clone(); - initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); + initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory"); initData.properties.setProperty("IceSSL.VerifyPeer", "0"); if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType | info.getUseX509Certificate()) @@ -1297,9 +1278,9 @@ public class Coordinator try { - _communicator = Ice.Util.initialize(initData); + _communicator = com.zeroc.Ice.Util.initialize(initData); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog(parent, e.toString(), @@ -1309,9 +1290,10 @@ public class Coordinator return; } - class CertificateVerifier implements IceSSL.CertificateVerifier + class CertificateVerifier implements com.zeroc.IceSSL.CertificateVerifier { - public CertificateVerifier() throws java.io.IOException, java.security.GeneralSecurityException, java.lang.Exception + public CertificateVerifier() + throws java.io.IOException, java.security.GeneralSecurityException, java.lang.Exception { { _trustedCaKeyStore = KeyStore.getInstance("JKS"); @@ -1342,7 +1324,7 @@ public class Coordinator class AcceptInvalidCertDialog implements Runnable { - public TrustDecision show(IceSSL.NativeConnectionInfo info, boolean validDate, + public TrustDecision show(com.zeroc.IceSSL.NativeConnectionInfo info, boolean validDate, boolean validAlternateName, boolean trustedCA) { _info = info; @@ -1388,7 +1370,7 @@ public class Coordinator } } - private IceSSL.NativeConnectionInfo _info; + private com.zeroc.IceSSL.NativeConnectionInfo _info; private boolean _validDate; private boolean _validAlternateName; private boolean _trustedCA; @@ -1396,7 +1378,7 @@ public class Coordinator } @Override - public boolean verify(IceSSL.NativeConnectionInfo info) + public boolean verify(com.zeroc.IceSSL.NativeConnectionInfo info) { if(!(info.nativeCerts[0] instanceof X509Certificate)) { @@ -1499,11 +1481,11 @@ public class Coordinator } String remoteAddress = null; - for(Ice.ConnectionInfo p = info.underlying; p != null; p = p.underlying) + for(com.zeroc.Ice.ConnectionInfo p = info.underlying; p != null; p = p.underlying) { - if(p instanceof Ice.IPConnectionInfo) + if(p instanceof com.zeroc.Ice.IPConnectionInfo) { - remoteAddress = ((Ice.IPConnectionInfo)p).remoteAddress; + remoteAddress = ((com.zeroc.Ice.IPConnectionInfo)p).remoteAddress; break; } } @@ -1638,7 +1620,8 @@ public class Coordinator @Override public void run() { - JOptionPane.showMessageDialog(parent, ex.toString(), "Error saving certificate", + JOptionPane.showMessageDialog(parent, ex.toString(), + "Error saving certificate", JOptionPane.ERROR_MESSAGE); } }); @@ -1661,7 +1644,7 @@ public class Coordinator private KeyStore _trustedServerKeyStore; } - IceSSL.Plugin plugin = (IceSSL.Plugin)_communicator.getPluginManager().getPlugin("IceSSL"); + com.zeroc.IceSSL.Plugin plugin = (com.zeroc.IceSSL.Plugin)_communicator.getPluginManager().getPlugin("IceSSL"); try { plugin.setCertificateVerifier(new CertificateVerifier()); @@ -1772,169 +1755,126 @@ public class Coordinator { try { - Ice.RouterFinderPrx finder = Ice.RouterFinderPrxHelper.uncheckedCast( - _communicator.stringToProxy(finderStr)); + com.zeroc.Ice.RouterFinderPrx finder = com.zeroc.Ice.RouterFinderPrx.uncheckedCast( + _communicator.stringToProxy(finderStr)); info.setInstanceName(finder.getRouter().ice_getIdentity().category); info.save(); - Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.uncheckedCast( - finder.ice_identity(new Ice.Identity("router", info.getInstanceName()))); + com.zeroc.Glacier2.RouterPrx router = com.zeroc.Glacier2.RouterPrx.uncheckedCast( + finder.ice_identity(new com.zeroc.Ice.Identity("router", info.getInstanceName()))); // // The session must be routed through this router // _communicator.setDefaultRouter(router); - - Glacier2.SessionPrx s; + com.zeroc.Glacier2.SessionPrx s; if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType) { - router = Glacier2.RouterPrxHelper.uncheckedCast(router.ice_secure(true)); + router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_secure(true)); s = router.createSessionFromSecureConnection(); if(s == null) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - parent, - "createSessionFromSecureConnection returned a null session: \n" - + "verify that Glacier2.SSLSessionManager is set to " - + "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 " - + "router configuration", - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog( + parent, + "createSessionFromSecureConnection returned a null session: \n" + + "verify that Glacier2.SSLSessionManager is set to " + + "<IceGridInstanceName>/AdminSSLSessionManager in your Glacier2 " + + "router configuration", + "Login failed", + JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } } else { - router = Glacier2.RouterPrxHelper.uncheckedCast(router.ice_preferSecure(true)); + router = com.zeroc.Glacier2.RouterPrx.uncheckedCast(router.ice_preferSecure(true)); s = router.createSession(info.getUsername(), info.getPassword() != null ? new String(info.getPassword()) : ""); if(s == null) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - parent, - "createSession returned a null session: \n" - + "verify that Glacier2.SessionManager is set to " - + "<IceGridInstanceName>/AdminSessionManager in your Glacier2 " - + "router configuration", - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog( + parent, + "createSession returned a null session: \n" + + "verify that Glacier2.SessionManager is set to " + + "<IceGridInstanceName>/AdminSessionManager in your Glacier2 " + + "router configuration", + "Login failed", + JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } } - cb.setSession(AdminSessionPrxHelper.uncheckedCast(s)); + cb.setSession(AdminSessionPrx.uncheckedCast(s)); cb.setSessionTimeout(router.getSessionTimeout()); try { cb.setACMTimeout(router.getACMTimeout()); } - catch(Ice.OperationNotExistException ex) + catch(com.zeroc.Ice.OperationNotExistException ex) { } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - cb.loginSuccess(); - } - }); + SwingUtilities.invokeLater(() -> cb.loginSuccess()); } - catch(final Glacier2.PermissionDeniedException e) + catch(final com.zeroc.Glacier2.PermissionDeniedException e) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + String msg = e.reason; + if(msg.length() == 0) { - String msg = e.reason; - if(msg.length() == 0) - { - msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ? - "Invalid credentials" : "Invalid username/password"; - } - if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType) - { - JOptionPane.showMessageDialog(parent, - "Permission denied: " - + msg, - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } - else - { - cb.permissionDenied(msg); - } + msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ? + "Invalid credentials" : "Invalid username/password"; + } + if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType) + { + JOptionPane.showMessageDialog(parent, "Permission denied: " + msg, + "Login failed", JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); + } + else + { + cb.permissionDenied(msg); } }); return; } - catch(final Glacier2.CannotCreateSessionException e) + catch(final com.zeroc.Glacier2.CannotCreateSessionException e) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog(parent, "Could not create session: " - + e.reason, - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog(parent, "Could not create session: " + e.reason, + "Login failed", JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } catch(final java.util.prefs.BackingStoreException ex) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - getMainFrame(), - ex.toString(), - "Error saving connection", - JOptionPane.ERROR_MESSAGE); - } + JOptionPane.showMessageDialog(getMainFrame(), ex.toString(), + "Error saving connection", JOptionPane.ERROR_MESSAGE); }); return; } - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog(parent, - "Could not create session: " - + e.toString(), - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog(parent, "Could not create session: " + e.toString(), + "Login failed", JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } @@ -1965,17 +1905,17 @@ public class Coordinator return _currentRegistry; } - synchronized public void setLocator(IceGrid.LocatorPrx locator) + synchronized public void setLocator(com.zeroc.IceGrid.LocatorPrx locator) { _locator = locator; } - synchronized public IceGrid.LocatorPrx getLocator() + synchronized public com.zeroc.IceGrid.LocatorPrx getLocator() { return _locator; } - private IceGrid.LocatorPrx _locator; + private com.zeroc.IceGrid.LocatorPrx _locator; private RegistryPrx _registry; private RegistryPrx _currentRegistry; } @@ -2002,8 +1942,8 @@ public class Coordinator { try { - Ice.LocatorFinderPrx finder = LocatorFinderPrxHelper.uncheckedCast( - _communicator.stringToProxy(finderStr)); + LocatorFinderPrx finder = LocatorFinderPrx.uncheckedCast( + _communicator.stringToProxy(finderStr)); info.setInstanceName(finder.getLocator().ice_getIdentity().category); info.save(); @@ -2011,24 +1951,21 @@ public class Coordinator // // The client uses the locator only without routing // - cb.setLocator(IceGrid.LocatorPrxHelper.checkedCast( - finder.ice_identity(new Ice.Identity("Locator", info.getInstanceName())))); + cb.setLocator(com.zeroc.IceGrid.LocatorPrx.checkedCast( + finder.ice_identity( + new com.zeroc.Ice.Identity("Locator", info.getInstanceName())))); if(cb.getLocator() == null) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - parent, - "This version of IceGrid Admin requires an IceGrid Registry " - + "version 3.3", - "Version Mismatch", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog( + parent, + "This version of IceGrid Admin requires an IceGrid Registry " + + "version 3.3", + "Version Mismatch", + JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } @@ -2051,20 +1988,16 @@ public class Coordinator }); return; } - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - parent, - "Could not create session: " + e.toString(), - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog( + parent, + "Could not create session: " + e.toString(), + "Login failed", + JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } @@ -2073,13 +2006,13 @@ public class Coordinator if(info.getConnectToMaster() && !cb.getCurrentRegistry().ice_getIdentity().name.equals("Registry")) { - Ice.Identity masterRegistryId = new Ice.Identity(); + com.zeroc.Ice.Identity masterRegistryId = new com.zeroc.Ice.Identity(); masterRegistryId.category = info.getInstanceName(); masterRegistryId.name = "Registry"; - cb.setRegistry(RegistryPrxHelper. - uncheckedCast(_communicator.stringToProxy( - "\"" + Ice.Util.identityToString(masterRegistryId) + "\""))); + cb.setRegistry(RegistryPrx.uncheckedCast(_communicator.stringToProxy( + "\"" + com.zeroc.Ice.Util.identityToString(masterRegistryId) + + "\""))); } // @@ -2091,24 +2024,21 @@ public class Coordinator { try { - Ice.ObjectAdapter colloc = _communicator.createObjectAdapter(""); - Ice.ObjectPrx router = colloc.addWithUUID(new ReuseConnectionRouter(cb.getLocator())); - _communicator.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(router)); - cb.setRegistry(RegistryPrxHelper.uncheckedCast(cb.getRegistry().ice_router( - _communicator.getDefaultRouter()))); + com.zeroc.Ice.ObjectAdapter colloc = _communicator.createObjectAdapter(""); + com.zeroc.Ice.ObjectPrx router = + colloc.addWithUUID(new ReuseConnectionRouter(cb.getLocator())); + _communicator.setDefaultRouter(com.zeroc.Ice.RouterPrx.uncheckedCast(router)); + cb.setRegistry(cb.getRegistry().ice_router(_communicator.getDefaultRouter())); } - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + SwingUtilities.invokeLater(() -> { - JOptionPane.showMessageDialog(parent, "Could not create session: " + e.toString(), - "Login failed", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(parent, "Could not create session: " + + e.toString(), "Login failed", + JOptionPane.ERROR_MESSAGE); cb.loginFailed(); - } - }); + }); return; } } @@ -2118,15 +2048,13 @@ public class Coordinator { if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType) { - cb.setRegistry(RegistryPrxHelper.uncheckedCast( - cb.getRegistry().ice_secure(true))); + cb.setRegistry(cb.getRegistry().ice_secure(true)); cb.setSession(cb.getRegistry().createAdminSessionFromSecureConnection()); assert cb.getSession() != null; } else { - cb.setRegistry(RegistryPrxHelper.uncheckedCast( - cb.getRegistry().ice_preferSecure(true))); + cb.setRegistry(cb.getRegistry().ice_preferSecure(true)); cb.setSession(cb.getRegistry().createAdminSession(info.getUsername(), info.getPassword() != null ? new String(info.getPassword()) : "")); @@ -2137,58 +2065,46 @@ public class Coordinator { cb.setACMTimeout(cb.getRegistry().getACMTimeout()); } - catch(Ice.OperationNotExistException ex) + catch(com.zeroc.Ice.OperationNotExistException ex) { } } - catch(final IceGrid.PermissionDeniedException e) + catch(final com.zeroc.IceGrid.PermissionDeniedException e) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + String msg = e.reason; + if(msg.length() == 0) { - String msg = e.reason; - if(msg.length() == 0) - { - msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ? - "Invalid credentials" : "Invalid username/password"; - } + msg = info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType ? + "Invalid credentials" : "Invalid username/password"; + } - if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType) - { - JOptionPane.showMessageDialog(parent, - "Permission denied: " - + e.reason, - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } - else - { - cb.permissionDenied(msg); - } + if(info.getAuth() == SessionKeeper.AuthType.X509CertificateAuthType) + { + JOptionPane.showMessageDialog(parent, "Permission denied: " + e.reason, + "Login failed", + JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); + } + else + { + cb.permissionDenied(msg); } }); return; } - - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { - if(cb.getRegistry().ice_getIdentity().equals(cb.getCurrentRegistry().ice_getIdentity())) + if(cb.getRegistry().ice_getIdentity().equals( + cb.getCurrentRegistry().ice_getIdentity())) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog(parent, - "Could not create session: " - + e.toString(), - "Login failed", - JOptionPane.ERROR_MESSAGE); - cb.loginFailed(); - } + JOptionPane.showMessageDialog(parent, "Could not create session: " + + e.toString(), "Login failed", + JOptionPane.ERROR_MESSAGE); + cb.loginFailed(); }); return; } @@ -2198,25 +2114,22 @@ public class Coordinator { try { - SwingUtilities.invokeAndWait(new Runnable() + SwingUtilities.invokeAndWait(() -> { - @Override - public void run() + if(JOptionPane.showConfirmDialog( + parent, + "Unable to connect to the Master Registry:\n " + + e.toString() + + "\n\nDo you want to connect to a Slave Registry?", + "Cannot connect to Master Registry", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) + { + cb.setRegistry(cb.getCurrentRegistry()); + } + else { - if(JOptionPane.showConfirmDialog( - parent, - "Unable to connect to the Master Registry:\n " + e.toString() - + "\n\nDo you want to connect to a Slave Registry?", - "Cannot connect to Master Registry", - JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) - { - cb.setRegistry(cb.getCurrentRegistry()); - } - else - { - cb.loginFailed(); - } + cb.loginFailed(); } }); break; @@ -2239,14 +2152,7 @@ public class Coordinator } } while(cb.getSession() == null); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - cb.loginSuccess(); - } - }); + SwingUtilities.invokeLater(() -> cb.loginSuccess()); } } }).start(); @@ -2261,14 +2167,14 @@ public class Coordinator { if(!routed) { - session.begin_destroy(); + session.destroyAsync(); } else { - Glacier2.RouterPrxHelper.uncheckedCast(_communicator.getDefaultRouter()).begin_destroySession(); + com.zeroc.Glacier2.RouterPrx.uncheckedCast(_communicator.getDefaultRouter()).destroySessionAsync(); } } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { } } @@ -2333,17 +2239,17 @@ public class Coordinator return _sessionKeeper.getServerAdminCategory(); } - public Ice.ObjectPrx addCallback(Ice.Object servant, String name, String facet) + public com.zeroc.Ice.ObjectPrx addCallback(com.zeroc.Ice.Object servant, String name, String facet) { return _sessionKeeper.addCallback(servant, name, facet); } - public Ice.ObjectPrx retrieveCallback(String name, String facet) + public com.zeroc.Ice.ObjectPrx retrieveCallback(String name, String facet) { return _sessionKeeper.retrieveCallback(name, facet); } - public Ice.Object removeCallback(String name, String facet) + public com.zeroc.Ice.Object removeCallback(String name, String facet) { return _sessionKeeper.removeCallback(name, facet); } @@ -2424,7 +2330,7 @@ public class Coordinator try { - FileParserPrx fileParser = FileParserPrxHelper.checkedCast( + FileParserPrx fileParser = FileParserPrx.checkedCast( getCommunicator().stringToProxy(_fileParser).ice_router(null)); return fileParser.parse(file.getAbsolutePath(), _sessionKeeper.getRoutedAdmin()); } @@ -2437,7 +2343,7 @@ public class Coordinator JOptionPane.ERROR_MESSAGE); return null; } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog( _mainFrame, @@ -2458,13 +2364,14 @@ public class Coordinator _icegridadminProcess.destroy(); } catch(Exception e) - {} + { + } _icegridadminProcess = null; _fileParser = null; } } - public File saveToFile(boolean ask, IceGridGUI.Application.Root root, File file) + public File saveToFile(boolean ask, com.zeroc.IceGridGUI.Application.Root root, File file) { if(ask || file == null) { @@ -2541,9 +2448,9 @@ public class Coordinator return _saveIceLogChooser; } - static private Ice.Properties createProperties(Ice.StringSeqHolder args) + static private com.zeroc.Ice.Util.CreatePropertiesResult createProperties(String[] args) { - Ice.Properties properties = Ice.Util.createProperties(); + com.zeroc.Ice.Properties properties = com.zeroc.Ice.Util.createProperties(); // // Set various default values @@ -2555,28 +2462,27 @@ public class Coordinator // properties.setProperty("Ice.RetryIntervals", "-1"); - return Ice.Util.createProperties(args, properties); + return com.zeroc.Ice.Util.createProperties(args, properties); } - Coordinator(JFrame mainFrame, Ice.StringSeqHolder args, Preferences prefs) + Coordinator(JFrame mainFrame, String[] args, Preferences prefs) { _connected = false; _mainFrame = mainFrame; _prefs = prefs; - _initData = new Ice.InitializationData(); + _initData = new com.zeroc.Ice.InitializationData(); _initData.logger = new Logger(mainFrame); - _initData.properties = createProperties(args); + _initData.properties = createProperties(args).properties; // - // We enable IceSSL so the communicator knows how to parse ssl - // endpoints. + // We enable IceSSL so the communicator knows how to parse ssl endpoints. // - _initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); + _initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory"); - if(args.value.length > 0) + if(args.length > 0) { String msg = "Extra command-line arguments: "; - for(String arg : args.value) + for(String arg : args) { msg += arg + " "; } @@ -2586,7 +2492,7 @@ public class Coordinator _traceObservers = _initData.properties.getPropertyAsInt("IceGridAdmin.Trace.Observers") > 0; _traceSaveToRegistry = _initData.properties.getPropertyAsInt("IceGridAdmin.Trace.SaveToRegistry") > 0; - _liveDeploymentRoot = new IceGridGUI.LiveDeployment.Root(this); + _liveDeploymentRoot = new com.zeroc.IceGridGUI.LiveDeployment.Root(this); _sessionKeeper = new SessionKeeper(this); @@ -2710,15 +2616,14 @@ public class Coordinator { if(_graphViews.size() > 0) { - if(JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(getMainFrame(), - "Close all open Metrics Graph Views and logout?", - "Confirm logout", - JOptionPane.YES_NO_OPTION)) + if(JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog( + getMainFrame(), "Close all open Metrics Graph Views and logout?", "Confirm logout", + JOptionPane.YES_NO_OPTION)) { return; } - java.util.List<IGraphView> views = new java.util.ArrayList<IGraphView>(_graphViews); + java.util.List<IGraphView> views = new java.util.ArrayList<>(_graphViews); for(IGraphView v : views) { v.close(); @@ -2794,7 +2699,7 @@ public class Coordinator } else { - java.util.List<Object> names = new java.util.ArrayList<Object>(); + java.util.List<Object> names = new java.util.ArrayList<>(); names.add("<All>"); names.addAll(java.util.Arrays.asList(applicationNames)); String appName = (String)JOptionPane.showInputDialog( @@ -2834,12 +2739,12 @@ public class Coordinator if(desc != null) { - IceGridGUI.Application.Root root; + com.zeroc.IceGridGUI.Application.Root root; try { - root = new IceGridGUI.Application.Root(Coordinator.this, desc, false, file); + root = new com.zeroc.IceGridGUI.Application.Root(Coordinator.this, desc, false, file); } - catch(IceGridGUI.Application.UpdateFailedException ex) + catch(com.zeroc.IceGridGUI.Application.UpdateFailedException ex) { JOptionPane.showMessageDialog( _mainFrame, @@ -2888,7 +2793,7 @@ public class Coordinator ApplicationPane app = openLiveApplication(appName); if(app != null) { - IceGridGUI.Application.Root root = app.getRoot(); + com.zeroc.IceGridGUI.Application.Root root = app.getRoot(); if(root.getSelectedNode() == null) { root.setSelectedNode(root); @@ -3084,7 +2989,7 @@ public class Coordinator else { String appName = (String)JOptionPane.showInputDialog( - _mainFrame, "Which Application do you want to patch?", + _mainFrame, "Which application do you want to patch?", "Patch application", JOptionPane.QUESTION_MESSAGE, null, applicationNames, applicationNames[0]); @@ -3119,7 +3024,7 @@ public class Coordinator if(appName == null) { appName = (String)JOptionPane.showInputDialog( - _mainFrame, "Which Application do you to display", + _mainFrame, "Which application do you to display", "Show details", JOptionPane.QUESTION_MESSAGE, null, applicationNames, applicationNames[0]); @@ -3152,7 +3057,7 @@ public class Coordinator else { String appName = (String)JOptionPane.showInputDialog( - _mainFrame, "Which Application do you want to remove?", + _mainFrame, "Which application do you want to remove?", "Remove application", JOptionPane.QUESTION_MESSAGE, null, applicationNames, applicationNames[0]); @@ -3185,14 +3090,16 @@ public class Coordinator _moveUp = new ActionWrapper("Move Up"); _moveDown = new ActionWrapper("Move Down"); - _showVarsMenuItem = new JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS)); - _showVarsTool = new JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS)); + _showVarsMenuItem = + new JCheckBoxMenuItem(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SHOW_VARS)); + _showVarsTool = new JToggleButton(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SHOW_VARS)); _showVarsTool.setIcon(Utils.getIcon("/icons/24x24/show_vars.png")); _showVarsTool.setText(""); _substituteMenuItem = new - JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS)); - _substituteTool = new JToggleButton(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS)); + JCheckBoxMenuItem(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS)); + _substituteTool = + new JToggleButton(_appActionsForMenu.get(com.zeroc.IceGridGUI.Application.TreeNode.SUBSTITUTE_VARS)); _substituteTool.setIcon(Utils.getIcon("/icons/24x24/substitute.png")); _substituteTool.setText(""); @@ -3238,7 +3145,7 @@ public class Coordinator public IGraphView createGraphView() { IGraphView view = null; - Class<?> c1 = IceInternal.Util.findClass("IceGridGUI.LiveDeployment.GraphView", null); + Class<?> c1 = com.zeroc.IceInternal.Util.findClass("com.zeroc.IceGridGUI.LiveDeployment.GraphView", null); if(c1 == null) { JOptionPane.showMessageDialog(_mainFrame, @@ -3246,7 +3153,7 @@ public class Coordinator "IceGrid Admin Info", JOptionPane.INFORMATION_MESSAGE); } - else if(IceInternal.Util.findClass("javafx.embed.swing.JFXPanel", null) == null) + else if(com.zeroc.IceInternal.Util.findClass("javafx.embed.swing.JFXPanel", null) == null) { JOptionPane.showMessageDialog(_mainFrame, "The Metrics Graph view requires JavaFX 2", @@ -3290,7 +3197,7 @@ public class Coordinator return _liveDeploymentPane; } - public IceGridGUI.LiveDeployment.Root getLiveDeploymentRoot() + public com.zeroc.IceGridGUI.LiveDeployment.Root getLiveDeploymentRoot() { return _liveDeploymentRoot; } @@ -3307,7 +3214,7 @@ public class Coordinator "", new java.util.LinkedList<String>()), "", new java.util.HashMap<String, PropertySetDescriptor>()); - IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, desc); + com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, desc); ApplicationPane app = new ApplicationPane(root); _mainPane.addApplication(app); _mainPane.setSelectedComponent(app); @@ -3321,7 +3228,7 @@ public class Coordinator { ApplicationDescriptor descriptor = getAdmin().getDefaultApplicationDescriptor(); descriptor.name = "NewApplication"; - IceGridGUI.Application.Root root = new IceGridGUI.Application.Root(this, descriptor); + com.zeroc.IceGridGUI.Application.Root root = new com.zeroc.IceGridGUI.Application.Root(this, descriptor); ApplicationPane app = new ApplicationPane(root); _mainPane.addApplication(app); _mainPane.setSelectedComponent(app); @@ -3336,7 +3243,7 @@ public class Coordinator "Deployment Exception", JOptionPane.ERROR_MESSAGE); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog( _mainFrame, @@ -3353,14 +3260,14 @@ public class Coordinator private void helpContents() { - int pos = Ice.Util.stringVersion().indexOf('b'); + int pos = com.zeroc.Ice.Util.stringVersion().indexOf('b'); if(pos == -1) { - pos = Ice.Util.stringVersion().lastIndexOf('.'); + pos = com.zeroc.Ice.Util.stringVersion().lastIndexOf('.'); assert(pos != -1); } - String version = Ice.Util.stringVersion().substring(0, pos); + String version = com.zeroc.Ice.Util.stringVersion().substring(0, pos); Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; if(desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) @@ -3384,7 +3291,7 @@ public class Coordinator private void about() { String text = "IceGrid Admin version " - + Ice.Util.stringVersion() + "\n" + + com.zeroc.Ice.Util.stringVersion() + "\n" + "Copyright \u00A9 2005-2016 ZeroC, Inc. All rights reserved.\n"; JOptionPane.showMessageDialog( @@ -3426,7 +3333,7 @@ public class Coordinator return; } - java.util.List<IGraphView> views = new java.util.ArrayList<IGraphView>(_graphViews); + java.util.List<IGraphView> views = new java.util.ArrayList<>(_graphViews); for(IGraphView v : views) { v.close(); @@ -3468,7 +3375,7 @@ public class Coordinator { _communicator.destroy(); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { } _communicator = null; @@ -3553,7 +3460,7 @@ public class Coordinator return _appActionsForPopup; } - public void showActions(IceGridGUI.LiveDeployment.TreeNode node) + public void showActions(com.zeroc.IceGridGUI.LiveDeployment.TreeNode node) { boolean[] availableActions = _liveActionsForMenu.setTarget(node); _appActionsForMenu.setTarget(null); @@ -3564,42 +3471,42 @@ public class Coordinator _appMenu.setEnabled(true); - _metricsViewMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW] || - availableActions[IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW]); + _metricsViewMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ENABLE_METRICS_VIEW] || + availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.DISABLE_METRICS_VIEW]); - _nodeMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]); + _nodeMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]); - _registryMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]); + _registryMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_REGISTRY]); - _signalMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.SIGHUP]); + _signalMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.SIGHUP]); - _serverMenu.setEnabled(availableActions[IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]); + _serverMenu.setEnabled(availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.OPEN_DEFINITION]); - _serviceMenu.setEnabled(node instanceof IceGridGUI.LiveDeployment.Service && - (availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG] || - availableActions[IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE] || - availableActions[IceGridGUI.LiveDeployment.TreeNode.START] || - availableActions[IceGridGUI.LiveDeployment.TreeNode.STOP])); + _serviceMenu.setEnabled(node instanceof com.zeroc.IceGridGUI.LiveDeployment.Service && + (availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_ICE_LOG] || + availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.RETRIEVE_LOG_FILE] || + availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.START] || + availableActions[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.STOP])); } - public void showActions(IceGridGUI.Application.TreeNode node) + public void showActions(com.zeroc.IceGridGUI.Application.TreeNode node) { boolean[] availableActions = _appActionsForMenu.setTarget(node); _liveActionsForMenu.setTarget(null); _newServerMenu.setEnabled( - availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER] || - availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX] || - availableActions[IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE]); + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER] || + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_ICEBOX] || + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVER_FROM_TEMPLATE]); _newServiceMenu.setEnabled( - availableActions[IceGridGUI.Application.TreeNode.NEW_SERVICE] || - availableActions[IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE]); + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE] || + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_SERVICE_FROM_TEMPLATE]); _newTemplateMenu.setEnabled( - availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER] || - availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX] || - availableActions[IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE]); + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER] || + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVER_ICEBOX] || + availableActions[com.zeroc.IceGridGUI.Application.TreeNode.NEW_TEMPLATE_SERVICE]); _appMenu.setEnabled(false); _metricsViewMenu.setEnabled(false); @@ -3692,7 +3599,8 @@ public class Coordinator { throw new Exception("Could not get Documents dir from Windows registry key `" + regKey + "'"); } - _dataDir += File.separator + "ZeroC" + File.separator + "IceGrid Admin" + File.separator + "KeyStore"; + _dataDir += File.separator + "ZeroC" + File.separator + "IceGrid Admin" + File.separator + + "KeyStore"; } catch(java.io.IOException ex) { @@ -3705,8 +3613,8 @@ public class Coordinator } else { - _dataDir = System.getProperty("user.home") + File.separator + ".ZeroC" + File.separator + "IceGrid Admin" + - File.separator + "KeyStore"; + _dataDir = System.getProperty("user.home") + File.separator + ".ZeroC" + File.separator + + "IceGrid Admin" + File.separator + "KeyStore"; } } if(!new File(_dataDir).isDirectory()) @@ -3758,8 +3666,8 @@ public class Coordinator static class UntrustedCertificateDialog extends JDialog { - public UntrustedCertificateDialog(java.awt.Window owner, IceSSL.NativeConnectionInfo info, boolean validDate, - boolean validAlternateName, boolean trustedCA) + public UntrustedCertificateDialog(java.awt.Window owner, com.zeroc.IceSSL.NativeConnectionInfo info, + boolean validDate, boolean validAlternateName, boolean trustedCA) throws java.security.GeneralSecurityException, java.io.IOException, javax.naming.InvalidNameException { @@ -3864,16 +3772,18 @@ public class Coordinator } private TrustDecision _decision = TrustDecision.No; - private static Icon _infoIcon = new ImageIcon(Utils.iconToImage(UIManager.getIcon("OptionPane.informationIcon")). - getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH )); + private static Icon _infoIcon = new ImageIcon( + Utils.iconToImage(UIManager.getIcon("OptionPane.informationIcon")). + getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH )); - private static Icon _warnIcon = new ImageIcon(Utils.iconToImage(UIManager.getIcon("OptionPane.warningIcon")). - getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH )); + private static Icon _warnIcon = new ImageIcon( + Utils.iconToImage(UIManager.getIcon("OptionPane.warningIcon")). + getScaledInstance(16, 16, java.awt.Image.SCALE_SMOOTH )); } private String _dataDir; - private final Ice.InitializationData _initData; - private Ice.Communicator _communicator; + private final com.zeroc.Ice.InitializationData _initData; + private com.zeroc.Ice.Communicator _communicator; private boolean _traceObservers; private boolean _traceSaveToRegistry; @@ -3881,13 +3791,13 @@ public class Coordinator private Preferences _prefs; private StatusBarI _statusBar = new StatusBarI(); - private IceGridGUI.LiveDeployment.Root _liveDeploymentRoot; + private com.zeroc.IceGridGUI.LiveDeployment.Root _liveDeploymentRoot; private LiveDeploymentPane _liveDeploymentPane; // // Maps application-name to ApplicationPane (only for 'live' applications) // - private java.util.Map<String, ApplicationPane> _liveApplications = new java.util.HashMap<String, ApplicationPane>(); + private java.util.Map<String, ApplicationPane> _liveApplications = new java.util.HashMap<>(); private MainPane _mainPane; @@ -3993,7 +3903,7 @@ public class Coordinator private X509Certificate _transientCert; - private java.util.List<IGraphView> _graphViews = new java.util.ArrayList<IGraphView>(); + private java.util.List<IGraphView> _graphViews = new java.util.ArrayList<>(); private java.util.concurrent.ScheduledExecutorService _executor; } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/EditorBase.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/EditorBase.java index 36c9491a752..01f4c97b318 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/EditorBase.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/EditorBase.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.BorderLayout; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Fallback.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java index 4c21bee85bd..2db4e32b2e2 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Fallback.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Fallback.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.JOptionPane; @@ -20,11 +20,11 @@ public class Fallback extends javax.swing.JApplet { java.net.URL jar = Fallback.class.getProtectionDomain().getCodeSource().getLocation(); - java.util.List<String> command = new java.util.ArrayList<String>(); + java.util.List<String> command = new java.util.ArrayList<>(); command.add("java"); command.add("-cp"); command.add(jar.toURI().getPath()); - command.add("IceGridGUI.Main"); + command.add("com.zeroc.IceGridGUI.Main"); String[] args = MainProxy.args(); for(String arg : args) diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveActions.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveActions.java index 3f6dde703ef..b61253780a2 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveActions.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveActions.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; -import IceGridGUI.LiveDeployment.*; +import com.zeroc.IceGridGUI.LiveDeployment.*; // // Holds all actions for the "Live Deployment" view diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Adapter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Adapter.java index d7262e3e304..73a097ead7b 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Adapter.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Adapter.java @@ -7,15 +7,15 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; import javax.swing.Icon; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class Adapter extends TreeNode { @@ -61,7 +61,7 @@ class Adapter extends TreeNode } Adapter(TreeNode parent, String adapterName, Utils.Resolver resolver, String adapterId, - AdapterDescriptor descriptor, Ice.ObjectPrx proxy) + AdapterDescriptor descriptor, com.zeroc.Ice.ObjectPrx proxy) { super(parent, adapterName); _resolver = resolver; @@ -130,7 +130,7 @@ class Adapter extends TreeNode return false; } - private void setCurrentEndpoints(Ice.ObjectPrx proxy) + private void setCurrentEndpoints(com.zeroc.Ice.ObjectPrx proxy) { if(proxy == null) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/AdapterEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/AdapterEditor.java index ae33b88598c..fb80900b721 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/AdapterEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/AdapterEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import javax.swing.JCheckBox; import javax.swing.JScrollPane; @@ -17,8 +17,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class AdapterEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java index 544052a7333..4429acf61aa 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ApplicationDetailsDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Container; import javax.swing.JDialog; @@ -20,7 +20,7 @@ import com.jgoodies.forms.factories.Borders; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.util.LayoutStyle; -import IceGrid.*; +import com.zeroc.IceGrid.*; class ApplicationDetailsDialog extends JDialog { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/CommunicatorEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java index 115048fb3ac..8a9ddd62a09 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/CommunicatorEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -15,8 +15,8 @@ import javax.swing.JTextArea; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class CommunicatorEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnv.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnv.java index f93e3b0a71b..5dc54f5bcc4 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnv.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnv.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class DbEnv extends TreeNode { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnvEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnvEditor.java index 7a70666d9e3..925ce972363 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/DbEnvEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/DbEnvEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import javax.swing.JScrollPane; import javax.swing.JTextArea; @@ -16,8 +16,8 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class DbEnvEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Editor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Editor.java index f9fd8665874..d618070900a 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Editor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Editor.java @@ -7,9 +7,9 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; public abstract class Editor extends EditorBase { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/GraphView.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java index 0276ee8ce03..c344a4e35cc 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/GraphView.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/GraphView.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.util.Map; import java.util.List; @@ -94,11 +94,11 @@ import com.jgoodies.looks.HeaderStyle; import com.jgoodies.looks.BorderStyle; import com.jgoodies.looks.plastic.PlasticLookAndFeel; -import IceGridGUI.*; -import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewInfo; -import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsCell; -import IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData; -import IceGridGUI.LiveDeployment.MetricsViewEditor.FormatedNumberRenderer; +import com.zeroc.IceGridGUI.*; +import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewInfo; +import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsCell; +import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.MetricsViewTransferableData; +import com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor.FormatedNumberRenderer; import java.util.prefs.Preferences; import java.util.prefs.BackingStoreException; @@ -155,7 +155,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato class TransferHandler extends javax.swing.TransferHandler { @Override - public boolean + public boolean canImport(TransferHandler.TransferSupport support) { boolean supported = false; @@ -180,7 +180,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato } Transferable t = support.getTransferable(); - + for(DataFlavor flavor : support.getDataFlavors()) { try @@ -219,7 +219,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato addWindowListener(new WindowAdapter() { @Override - public void windowClosing(WindowEvent e) + public void windowClosing(WindowEvent e) { close(); } @@ -231,7 +231,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato Action preferences = new AbstractAction("Preferences") { @Override - public void actionPerformed(ActionEvent event) + public void actionPerformed(ActionEvent event) { // // Set the title @@ -248,13 +248,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // SpinnerNumberModel to set a refresh period. // - SpinnerNumberModel refreshPeriod = new SpinnerNumberModel(getRefreshPeriod(), _minRefreshPeriod, + SpinnerNumberModel refreshPeriod = new SpinnerNumberModel(getRefreshPeriod(), _minRefreshPeriod, _maxRefreshPeriod, 1); // // SpinnerNumberModel to set the maximum number of samples to keep in X axis. // - final SpinnerNumberModel samples = new SpinnerNumberModel(_samples, _minSamples, + final SpinnerNumberModel samples = new SpinnerNumberModel(_samples, _minSamples, _maxSamples, 1); JPanel refreshPanel; @@ -272,12 +272,12 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // JComboBox to select time format used in X Axis // - JComboBox<String> dateFormats = new JComboBox<String>(_dateFormats); + JComboBox<String> dateFormats = new JComboBox<>(_dateFormats); dateFormats.setSelectedItem(getDateFormat()); JPanel xAxisPanel; { - DefaultFormBuilder builder = - new DefaultFormBuilder(new FormLayout("pref,2dlu,pref:grow", "pref")); + DefaultFormBuilder builder = + new DefaultFormBuilder(new FormLayout("pref,2dlu,pref:grow", "pref")); builder.append("Samples displayed:", new JSpinner(samples)); builder.append("", new JLabel("<html><p>The number of samples displayed on a graph;" + "<br/>must be between 2 and 300." + "</p></html>")); @@ -295,7 +295,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato builder.nextLine(); builder.append(xAxisPanel); - if(JOptionPane.showConfirmDialog(GraphView.this, builder.getPanel(), "Metrics Graph Preferences", + if(JOptionPane.showConfirmDialog(GraphView.this, builder.getPanel(), "Metrics Graph Preferences", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) != JOptionPane.OK_OPTION) { return; @@ -317,7 +317,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato if(convertColumnIndexToModel(columnAtPoint(e.getPoint())) == 6) { return _legendModel.getRows(new int[]{rowAtPoint(e.getPoint())})[0].cell.getField(). - getColumnToolTip(); + getColumnToolTip(); } else { @@ -325,7 +325,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato } } }; - + // // Adjust row height for larger fonts // @@ -335,14 +335,14 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato { _legendTable.setRowHeight(minRowHeight); } - + // // Graph preferences. // final Action delete = new AbstractAction("Delete") { @Override - public void actionPerformed(ActionEvent event) + public void actionPerformed(ActionEvent event) { int[] selectedRows = _legendTable.getSelectedRows(); for(int i = 0; i < selectedRows.length; ++i) @@ -477,16 +477,16 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // Set a combobox to edit the scale factors. // - JComboBox<Double> scales = new JComboBox<Double>(_scales); + JComboBox<Double> scales = new JComboBox<>(_scales); scales.setRenderer(new DecimalRenderer(scales.getRenderer())); _legendTable.getColumnModel().getColumn(7).setCellEditor(new DefaultCellEditor(scales)); // - //Set default renderer and editor for Color.class column. + // Set default renderer and editor for Color.class column. // _legendTable.setDefaultRenderer(Color.class, new ColorRenderer(true)); _legendTable.setDefaultEditor(Color.class, new ColorEditor()); - + _legendTable.setAutoCreateRowSorter(true); final JFXPanel fxPanel = new JFXPanel(); @@ -502,7 +502,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato scrollPane.setMinimumSize(new Dimension(0, 50)); scrollPane.setPreferredSize(new Dimension(800, 200)); _splitPane.setBottomComponent(scrollPane); - + DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("fill:pref:grow", "fill:pref:grow, pref")); builder.append(_splitPane); builder.nextLine(); @@ -516,65 +516,61 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // initialize the scene in JavaFX thread. // - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() - { - _xAxis = new NumberAxis(); - _yAxis = new NumberAxis(); - - _chart = new LineChart<Number, Number>(_xAxis, _yAxis); - _chart.setCreateSymbols(false); - _xAxis.setLabel("Time (" + getDateFormat() + ")"); - _xAxis.setTickLabelFormatter(_timeFormater); - _xAxis.setForceZeroInRange(false); - _chart.setAnimated(true); - _chart.setLegendVisible(false); - - final Scene scene = new Scene(_chart); - scene.setOnDragOver( - new EventHandler<DragEvent>() + _xAxis = new NumberAxis(); + _yAxis = new NumberAxis(); + + _chart = new LineChart<>(_xAxis, _yAxis); + _chart.setCreateSymbols(false); + _xAxis.setLabel("Time (" + getDateFormat() + ")"); + _xAxis.setTickLabelFormatter(_timeFormater); + _xAxis.setForceZeroInRange(false); + _chart.setAnimated(true); + _chart.setLegendVisible(false); + + final Scene scene = new Scene(_chart); + scene.setOnDragOver( + new EventHandler<DragEvent>() + { + @Override + public void handle(DragEvent event) { - @Override - public void handle(DragEvent event) + Dragboard db = event.getDragboard(); + if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType)) { - Dragboard db = event.getDragboard(); - if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType)) + Object object = db.getContent(LocalObjectMimeType); + if(object instanceof MetricsViewTransferableData) { - Object object = db.getContent(LocalObjectMimeType); - if(object instanceof MetricsViewTransferableData) - { - event.acceptTransferModes(TransferMode.COPY); - } + event.acceptTransferModes(TransferMode.COPY); } - event.consume(); } - }); + event.consume(); + } + }); - scene.setOnDragDropped( - new EventHandler<DragEvent>() + scene.setOnDragDropped( + new EventHandler<DragEvent>() + { + @Override + public void handle(DragEvent event) { - @Override - public void handle(DragEvent event) + boolean success = false; + Dragboard db = event.getDragboard(); + if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType)) { - boolean success = false; - Dragboard db = event.getDragboard(); - if(event.getGestureSource() != scene && db.hasContent(LocalObjectMimeType)) + Object object = db.getContent(LocalObjectMimeType); + if(object instanceof MetricsViewTransferableData) { - Object object = db.getContent(LocalObjectMimeType); - if(object instanceof MetricsViewTransferableData) - { - addSeries((MetricsViewTransferableData)object); - success = true; - } + addSeries((MetricsViewTransferableData)object); + success = true; } - event.setDropCompleted(success); - event.consume(); } - }); - fxPanel.setScene(scene); - } + event.setDropCompleted(success); + event.consume(); + } + }); + fxPanel.setScene(scene); }); pack(); @@ -599,11 +595,11 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // if(showInfo()) { - JCheckBox checkbox = new JCheckBox("Do not show this message again."); - String message = "Drop metrics cells to add them to the graph."; + JCheckBox checkbox = new JCheckBox("Do not show this message again."); + String message = "Drop metrics cells to add them to the graph."; - JOptionPane.showConfirmDialog(this, new Object[]{message, checkbox}, "Information", - JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showConfirmDialog(this, new Object[]{message, checkbox}, "Information", + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); if(checkbox.isSelected()) { _preferences.node("GraphView").putBoolean("showInfo", false); @@ -682,14 +678,14 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato if(i != pos) { _legendTable.getColumnModel().moveColumn(pos, i); - } + } int columnWidth = preferences.getInt("colWidth" + Integer.toString(i), -1); if(columnWidth != -1) { _legendTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidth); } } - + int refreshPeriod = preferences.getInt("refreshPeriod", _defaultRefreshPeriod); if(refreshPeriod < _minRefreshPeriod) { @@ -732,117 +728,102 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // Must run in JavaFX thread. // - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() + Map<String, Map<String, Map<String, MetricsRow>>> metrics = _series.get(data.info); + if(metrics == null) { - Map<String, Map<String, Map<String, MetricsRow>>> metrics = _series.get(data.info); - if(metrics == null) - { - metrics = new HashMap<String, Map<String, Map<String, MetricsRow>>>(); - _series.put(data.info, metrics); - } + metrics = new HashMap<>(); + _series.put(data.info, metrics); + } + + Map<String, Map<String, MetricsRow>> rows = metrics.get(data.name); + if(rows == null) + { + rows = new HashMap<>(); + metrics.put(data.name, rows); + } - Map<String, Map<String, MetricsRow>> rows = metrics.get(data.name); - if(rows == null) + for(Map.Entry<String, List<MetricsCell>> i : data.rows.entrySet()) + { + final String rowId = i.getKey(); + Map<String, MetricsRow> columns = rows.get(rowId); + if(columns == null) { - rows = new HashMap<String, Map<String, MetricsRow>>(); - metrics.put(data.name, rows); + columns = new HashMap<>(); + rows.put(rowId, columns); } - for(Map.Entry<String, List<MetricsCell>> i : data.rows.entrySet()) + for(MetricsCell j : i.getValue()) { - final String rowId = i.getKey(); - Map<String, MetricsRow> columns = rows.get(rowId); - if(columns == null) + if(columns.get(j.getField().getFieldName()) == null) { - columns = new HashMap<String, MetricsRow>(); - rows.put(rowId, columns); - } - - for(MetricsCell j : i.getValue()) - { - if(columns.get(j.getField().getFieldName()) == null) + String color = DefaultColors[_chart.getData().size() % DefaultColors.length]; + final MetricsRow row = new MetricsRow(data.info, j, color, + new XYChart.Series<Number, Number>()); + + XYChart.Series<Number, Number> series = row.series.peek(); + _chart.getData().add(series); + + String styleClass = getSeriesClass(series); + addStyle(series, styleClass, color); + setNodesStyle(styleClass); + + columns.put(j.getField().getFieldName(), row); + j.getField().setContext(GraphView.this); + // + // When a line is clicked we select the correspoding row in the legend table. + // + javafx.scene.Node n = _chart.lookup(".chart-series-line." + styleClass); + if(n != null) { - String color = DefaultColors[_chart.getData().size() % DefaultColors.length]; - final MetricsRow row = new MetricsRow(data.info, j, color, - new XYChart.Series<Number, Number>()); - - XYChart.Series<Number, Number> series = row.series.peek(); - _chart.getData().add(series); - - String styleClass = getSeriesClass(series); - addStyle(series, styleClass, color); - setNodesStyle(styleClass); - - columns.put(j.getField().getFieldName(), row); - j.getField().setContext(GraphView.this); - // - // When a line is clicked we select the correspoding row in the legend table. - // - javafx.scene.Node n = _chart.lookup(".chart-series-line." + styleClass); - if(n != null) + n.setOnMousePressed(new EventHandler<MouseEvent>() { - n.setOnMousePressed(new EventHandler<MouseEvent>() + @Override public void + handle(MouseEvent e) { - @Override public void - handle(MouseEvent e) + if(e.getEventType() == MouseEvent.MOUSE_PRESSED && + e.getButton() == MouseButton.PRIMARY) { - if(e.getEventType() == MouseEvent.MOUSE_PRESSED && - e.getButton() == MouseButton.PRIMARY) - { - // - // Must run in Swing thread. - // - enqueueSwing(new Runnable() + // + // Must run in Swing thread. + // + enqueueSwing(() -> + { + int i = _legendModel.getRowIndex(row); + if(i != -1) { - @Override - public void run() - { - int i = _legendModel.getRowIndex(row); - if(i != -1) - { - i = _legendTable.convertRowIndexToView(i); - _legendTable.setRowSelectionInterval(i, i); - } - } - }); - } - } - }); - } - // - // Add the serie to the legend, must run in Swing thread. - // - enqueueSwing(new Runnable() - { - @Override - public void run() - { - _legendModel.addRow(row); + i = _legendTable.convertRowIndexToView(i); + _legendTable.setRowSelectionInterval(i, i); + } + }); } - }); - } + } + }); + } + // + // Add the serie to the legend, must run in Swing thread. + // + enqueueSwing(() -> _legendModel.addRow(row)); } } - if(_chart.getData().size() > 0) - { - startRefresh(); - } + } + if(_chart.getData().size() > 0) + { + startRefresh(); } }); } // // Added a new chart series to an existing row, the graph series will use the - // same configuration, the row cell field must be reset so calculations doesn't + // same configuration, the row cell field must be reset so calculations doesn't // take into account previous data. If we don't reset fields here caculations // can be bogus in case the view was disabled and the data in the view was reset. // void addSeries(final MetricsRow row) { - XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>(); + XYChart.Series<Number, Number> series = new XYChart.Series<>(); row.series.push(series); _chart.getData().add(series); @@ -860,9 +841,9 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato row.cell.resetField(); // - // We need also a new click handler so click works in all segments + // We need also a new click handler so click works in all segments // of the line. - // + // // When a line is clicked we select the correspoding row in the legend table. // javafx.scene.Node n = _chart.lookup(".chart-series-line." + styleClass); @@ -870,7 +851,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato { n.setOnMousePressed(new EventHandler<MouseEvent>() { - @Override public void + @Override public void handle(MouseEvent e) { if(e.getEventType() == MouseEvent.MOUSE_PRESSED && @@ -879,17 +860,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // Must run in Swing thread. // - enqueueSwing(new Runnable() + enqueueSwing(() -> { - @Override - public void run() + int i = _legendModel.getRowIndex(row); + if(i != -1) { - int i = _legendModel.getRowIndex(row); - if(i != -1) - { - i = _legendTable.convertRowIndexToView(i); - _legendTable.setRowSelectionInterval(i, i); - } + i = _legendTable.convertRowIndexToView(i); + _legendTable.setRowSelectionInterval(i, i); } }); } @@ -898,127 +875,119 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato } } - private void addData(final MetricsViewInfo info, final Map<String, IceMX.Metrics[]> data, + private void addData(final MetricsViewInfo info, final Map<String, com.zeroc.IceMX.Metrics[]> data, final long timestamp) { // // Update the graph series in JavaFX thread. // - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() + Map<String, Map<String, Map<String, MetricsRow>>> series = _series.get(info); + if(series == null) { - Map<String, Map<String, Map<String, MetricsRow>>> series = _series.get(info); - if(series == null) + return; + } + + for(Map.Entry<String, Map<String, Map<String, MetricsRow>>> i : series.entrySet()) + { + com.zeroc.IceMX.Metrics[] metricsSeq = null; + if(data != null) { - return; + metricsSeq = data.get(i.getKey()); } - for(Map.Entry<String, Map<String, Map<String, MetricsRow>>> i : series.entrySet()) - { - IceMX.Metrics[] metricsSeq = null; - if(data != null) - { - metricsSeq = data.get(i.getKey()); - } + // + // Iterate over all configured values, if there isn't data for one configured + // field we need to add a gap. + // - // - // Iterate over all configured values, if there isn't data for one configured - // field we need to add a gap. - // + for(Map.Entry<String, Map<String, MetricsRow>> j : i.getValue().entrySet()) + { + com.zeroc.IceMX.Metrics metrics = null; - for(Map.Entry<String, Map<String, MetricsRow>> j : i.getValue().entrySet()) + if(metricsSeq != null) { - IceMX.Metrics metrics = null; - - if(metricsSeq != null) + for(com.zeroc.IceMX.Metrics m : metricsSeq) { - for(IceMX.Metrics m : metricsSeq) + if(m.id.equals(j.getKey())) { - if(m.id.equals(j.getKey())) - { - metrics = m; - break; - } + metrics = m; + break; } } - for(Map.Entry<String, MetricsRow> k : j.getValue().entrySet()) + } + for(Map.Entry<String, MetricsRow> k : j.getValue().entrySet()) + { + MetricsRow row = k.getValue(); + // + // If there isn't a metrics object we disable the row and add a dummy value. + // + if(metrics == null) { - MetricsRow row = k.getValue(); // - // If there isn't a metrics object we disable the row and add a dummy value. + // If the row isn't disabled we add a new serie to represent the gap + // and mark the row as disabled. // - if(metrics == null) + if(!row.disabled) { - // - // If the row isn't disabled we add a new serie to represent the gap - // and mark the row as disabled. - // - if(!row.disabled) - { - row.series.push(new XYChart.Series<Number, Number>()); - row.disabled = true; - } - // - // This dummy value is added to represent gap sizes, but isn't displayed - // as the series isn't added to the graph. - // - row.series.peek().getData().add(new XYChart.Data<Number, Number>(0, 0)); + row.series.push(new XYChart.Series<Number, Number>()); + row.disabled = true; } - else + // + // This dummy value is added to represent gap sizes, but isn't displayed + // as the series isn't added to the graph. + // + row.series.peek().getData().add(new XYChart.Data<Number, Number>(0, 0)); + } + else + { + try { - try + if(row.disabled) { - if(row.disabled) - { - addSeries(row); - row.disabled = false; - } - - Number value = row.cell.getValue(metrics, timestamp); - // - // The cell returns null to indicate the value must be skipped, - // this is usually because it needs two values to calculate - // the average. - // - if(value == null) - { - continue; - } - - row.series.peek().getData().add( - new XYChart.Data<Number, Number>(timestamp, value)); + addSeries(row); + row.disabled = false; } - catch(java.lang.RuntimeException ex) + + Number value = row.cell.getValue(metrics, timestamp); + // + // The cell returns null to indicate the value must be skipped, + // this is usually because it needs two values to calculate + // the average. + // + if(value == null) { - ex.printStackTrace(); + continue; } - } - // - // Remove the vertices from the beginning of the series that exceeded - // the maximum number of samples. - // - adjustSize(row); + row.series.peek().getData().add( + new XYChart.Data<Number, Number>(timestamp, value)); + } + catch(java.lang.RuntimeException ex) + { + ex.printStackTrace(); + } } + + // + // Remove the vertices from the beginning of the series that exceeded + // the maximum number of samples. + // + adjustSize(row); } } - // - // Fire an event on the legend model to update all cells. - // - enqueueSwing(new Runnable() - { - @Override - public void run() - { - _legendModel.fireTableChanged( - new TableModelEvent(_legendModel, 0, _legendModel.getRowCount() - 1, - TableModelEvent.ALL_COLUMNS, - TableModelEvent.UPDATE)); - } - }); } + // + // Fire an event on the legend model to update all cells. + // + enqueueSwing(() -> + { + _legendModel.fireTableChanged( + new TableModelEvent(_legendModel, 0, _legendModel.getRowCount() - 1, + TableModelEvent.ALL_COLUMNS, + TableModelEvent.UPDATE)); + }); }); } @@ -1071,51 +1040,36 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato { if(_refreshFuture == null) { - _refreshFuture = _coordinator.getExecutor().scheduleAtFixedRate(new Runnable() - { - @Override - public void run() + _refreshFuture = _coordinator.getExecutor().scheduleAtFixedRate(() -> { java.util.Set<MetricsViewInfo> metrics = null; synchronized(GraphView.this) { - metrics = new java.util.HashSet<MetricsViewInfo>(_series.keySet()); + metrics = new java.util.HashSet<>(_series.keySet()); } for(final MetricsViewInfo m : metrics) { - IceMX.Callback_MetricsAdmin_getMetricsView cb = new IceMX.Callback_MetricsAdmin_getMetricsView() - { - @Override - public void response(final java.util.Map<java.lang.String, IceMX.Metrics[]> data, - long timestamp) - { - addData(m, data, timestamp); - } - - @Override - public void exception(final Ice.LocalException e) - { - addData(m, null, 0); - } - - @Override - public void exception(final Ice.UserException e) - { - addData(m, null, 0); - } - }; try { - m.admin.begin_getMetricsView(m.view, cb); + m.admin.getMetricsViewAsync(m.view).whenComplete((result, ex) -> + { + if(ex == null) + { + addData(m, result.returnValue, result.timestamp); + } + else + { + addData(m, null, 0); + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { addData(m, null, 0); } } - } - }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS); + }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS); } } @@ -1149,7 +1103,6 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato startRefresh(); } - } synchronized String getDateFormat() @@ -1164,14 +1117,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // Update the horizontal axis label, in JavaFx thread. // - enqueueJFX(new Runnable() - { - @Override - public void run() - { - _xAxis.setLabel("Time (" + getDateFormat() + ")"); - } - }); + enqueueJFX(() -> _xAxis.setLabel("Time (" + getDateFormat() + ")")); } synchronized private void setMaximumSamples(final int samples) @@ -1187,16 +1133,12 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // If maximum samples change, we remove older samples. // - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() + MetricsRow[] rows = _legendModel.getRows(); + for(MetricsRow row : rows) { - MetricsRow[] rows = _legendModel.getRows(); - for(MetricsRow row : rows) - { - adjustSize(row); - } + adjustSize(row); } }); } @@ -1232,7 +1174,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // Stack of all the chart series used to represent this metrics object // new values are added to the chart series at the top. // - Stack<XYChart.Series<Number, Number>> series = new Stack<XYChart.Series<Number, Number>>(); + Stack<XYChart.Series<Number, Number>> series = new Stack<>(); } class LegendTableModel extends javax.swing.table.AbstractTableModel @@ -1391,7 +1333,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato @Override public boolean isCellEditable(int row, int col) { - if(col < _columnNames.length && (_columnNames[col].equals("Show") || + if(col < _columnNames.length && (_columnNames[col].equals("Show") || _columnNames[col].equals("Scale") || _columnNames[col].equals("Color"))) { @@ -1412,15 +1354,11 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato if(_columnNames[columnIndex].equals("Show")) { row.visible = ((Boolean)value).booleanValue(); - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() + for(int i = 0; i < row.series.size(); ++i) { - for(int i = 0; i < row.series.size(); ++i) - { - setNodesVisible(getSeriesClass(row.series.get(i)), row.visible); - } + setNodesVisible(getSeriesClass(row.series.get(i)), row.visible); } }); } @@ -1441,7 +1379,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // Convert color to the CSS representation used by JavaFX style. // example: #ff00aa // - row.color = "#" + String.format("%02X", color.getRed()) + + row.color = "#" + String.format("%02X", color.getRed()) + String.format("%02X", color.getGreen()) + String.format("%02X", color.getBlue()); for(int i = 0; i < row.series.size(); ++i) @@ -1467,7 +1405,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato { deletedRows[i] = _rows.remove(rowIndexes[i]); } - Map<Integer, MetricsRow> rows = new HashMap<Integer, MetricsRow>(); + Map<Integer, MetricsRow> rows = new HashMap<>(); for(Map.Entry<Integer, MetricsRow> e : _rows.entrySet()) { rows.put(rows.size(), e.getValue()); @@ -1506,7 +1444,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato return index; } - private Map<Integer, MetricsRow> _rows = new HashMap<Integer, MetricsRow>(); + private Map<Integer, MetricsRow> _rows = new HashMap<>(); } void @@ -1515,15 +1453,11 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // Must run in JavaFX thread. // - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() + for(XYChart.Data<Number, Number> i : series.getData()) { - for(XYChart.Data<Number, Number> i : series.getData()) - { - i.setYValue(i.getYValue().doubleValue() * s2 / s1); - } + i.setYValue(i.getYValue().doubleValue() * s2 / s1); } }); } @@ -1534,17 +1468,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // // Must run in JavaFX thread. // - enqueueJFX(new Runnable() + enqueueJFX(() -> { - @Override - public void run() + String styleClass = getSeriesClass(series); + if(styleClass != null) { - String styleClass = getSeriesClass(series); - if(styleClass != null) - { - addStyle(series, styleClass, color); - setNodesStyle(styleClass); - } + addStyle(series, styleClass, color); + setNodesStyle(styleClass); } }); } @@ -1616,69 +1546,55 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato sb.append(color); sb.append(", white;"); sb.append("-fx-stroke-width: 3;"); - _styles.put(seriesClass, sb.toString()); + _styles.put(seriesClass, sb.toString()); } - private void enqueueJFX(final Runnable runnable) { - _queue.submit(new Runnable() - { - @Override - public void run() + private void enqueueJFX(final Runnable runnable) + { + _queue.submit(() -> { - Platform.runLater(new Runnable() + Platform.runLater(() -> { - @Override - public void run() + try { - try - { - runnable.run(); - } - finally - { - _sem.release(); - } + runnable.run(); + } + finally + { + _sem.release(); } }); _sem.acquireUninterruptibly(); - } - }); + }); } - private void enqueueSwing(final Runnable runnable) { - _queue.submit(new Runnable() - { - @Override - public void run() + private void enqueueSwing(final Runnable runnable) + { + _queue.submit(() -> { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + try { - try - { - runnable.run(); - } - finally - { - _sem.release(); - } + runnable.run(); + } + finally + { + _sem.release(); } }); _sem.acquireUninterruptibly(); - } - }); + }); } - @SuppressWarnings("rawtypes") + @SuppressWarnings("rawtypes") static class DecimalRenderer extends DefaultListCellRenderer - { + { public DecimalRenderer(ListCellRenderer renderer) { this._renderer = renderer; } - + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) @@ -1722,7 +1638,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato } _dialog = JColorChooser.createDialog(_button, "Select the metrics color", true, _colorChooser, this, null); - + } @Override @@ -1733,7 +1649,7 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato _button.setBackground(_currentColor); _colorChooser.setColor(_currentColor); _dialog.setVisible(true); - //Make the renderer reappear. + // Make the renderer reappear. fireEditingStopped(); } else @@ -1768,13 +1684,13 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato Border unselectedBorder = null; Border selectedBorder = null; boolean isBordered = true; - + public ColorRenderer(boolean isBordered) { this.isBordered = isBordered; setOpaque(true); //MUST do this for background to show up. } - + @Override public Component getTableCellRendererComponent(JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int column) @@ -1825,8 +1741,8 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato private NumberAxis _xAxis; private NumberAxis _yAxis; - private final static String[] _columnNames = new String[]{"Show", "Node", "Server", "Metrics View Name", - "Metrics Name", "Metrics Id", "Metrics Field", "Scale", + private final static String[] _columnNames = new String[]{"Show", "Node", "Server", "Metrics View Name", + "Metrics Name", "Metrics Id", "Metrics Field", "Scale", "Last", "Average", "Minimum", "Maximum", "Color"}; @@ -1841,10 +1757,9 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato // Field name // private final Map<MetricsViewInfo, - Map<String, - Map<String, - Map<String, MetricsRow>>>> _series = - new HashMap<MetricsViewInfo, Map<String, Map<String, Map<String, MetricsRow>>>>(); + Map<String, + Map<String, + Map<String, MetricsRow>>>> _series = new HashMap<>(); private final static String[] DefaultColors = new String[] { @@ -1870,29 +1785,29 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato private final LegendTableModel _legendModel = new LegendTableModel(); private JSplitPane _splitPane; - private final Map<String, String> _styles = new HashMap<String, String>(); + private final Map<String, String> _styles = new HashMap<>(); - private final Double[] _scales = new Double[]{0.000000001d, + private final Double[] _scales = new Double[]{0.000000001d, 0.00000001d, - 0.0000001d, - 0.000001d, + 0.0000001d, + 0.000001d, 0.00001d, - 0.0001d, - 0.001d, - 0.01d, - 0.1d, - 1.0d, - 10.0d, + 0.0001d, + 0.001d, + 0.01d, + 0.1d, + 1.0d, + 10.0d, 100.0d, 1000.0d, - 10000.0d, - 100000.0d, - 1000000.0d, + 10000.0d, + 100000.0d, + 1000000.0d, 10000000.0d, 100000000.0d, 1000000000.0d}; - - private final java.util.concurrent.Semaphore _sem = new java.util.concurrent.Semaphore(0); + + private final java.util.concurrent.Semaphore _sem = new java.util.concurrent.Semaphore(0); private final java.util.concurrent.ExecutorService _queue = java.util.concurrent.Executors.newSingleThreadExecutor( new java.util.concurrent.ThreadFactory() { @@ -1909,4 +1824,3 @@ public class GraphView extends JFrame implements MetricsFieldContext, Coordinato private final static DataFormat LocalObjectMimeType = new DataFormat("application/x-java-jvm-local-objectref"); } - diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListArrayTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java index e90422ee5e0..b07a14f30f1 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListArrayTreeNode.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.util.Enumeration; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java index 0a04ae307d9..f22a715f32b 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ListTreeNode.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.util.Enumeration; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogFilterDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogFilterDialog.java index f6a99ac942e..e2f5733a685 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogFilterDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogFilterDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -22,6 +22,8 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.WindowConstants; +import com.zeroc.Ice.LogMessageType; + import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.factories.Borders; @@ -36,20 +38,20 @@ class LogFilterDialog extends JDialog super(dialog, "Ice log filter - IceGrid Admin", true); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - java.util.Set<Ice.LogMessageType> messageTypeFilterSet = null; + java.util.Set<com.zeroc.Ice.LogMessageType> messageTypeFilterSet = null; if(dialog.getMessageTypeFilter() != null) { messageTypeFilterSet = new java.util.HashSet<>(java.util.Arrays.asList(dialog.getMessageTypeFilter())); } final JCheckBox error = new JCheckBox("Error", - messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.ErrorMessage)); + messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.ErrorMessage)); final JCheckBox warning = new JCheckBox("Warning", - messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.WarningMessage)); + messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.WarningMessage)); final JCheckBox print = new JCheckBox("Print", - messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.PrintMessage)); + messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.PrintMessage)); final JCheckBox trace = new JCheckBox("Trace", - messageTypeFilterSet == null || messageTypeFilterSet.contains(Ice.LogMessageType.TraceMessage)); + messageTypeFilterSet == null || messageTypeFilterSet.contains(LogMessageType.TraceMessage)); final JTextArea traceCategories = new JTextArea(3, 40); traceCategories.setLineWrap(true); @@ -58,7 +60,8 @@ class LogFilterDialog extends JDialog if(traceCategoryFilter != null) { // TODO: join with escapes! - traceCategories.setText(IceUtilInternal.StringUtil.joinString(java.util.Arrays.asList(traceCategoryFilter), ", ")); + traceCategories.setText( + com.zeroc.IceUtilInternal.StringUtil.joinString(java.util.Arrays.asList(traceCategoryFilter), ", ")); } else { @@ -78,12 +81,13 @@ class LogFilterDialog extends JDialog String txt = traceCategories.getText(); if(txt != null && !txt.isEmpty()) { - traceCategoryFilter = IceUtilInternal.StringUtil.splitString(txt, ", \t\r\n"); + traceCategoryFilter = com.zeroc.IceUtilInternal.StringUtil.splitString(txt, ", \t\r\n"); if(traceCategoryFilter == null) { // unmatched quote - JOptionPane.showMessageDialog(LogFilterDialog.this, "Unmatched quote in Trace categories field", - "Invalid entry", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(LogFilterDialog.this, + "Unmatched quote in Trace categories field", + "Invalid entry", JOptionPane.ERROR_MESSAGE); return; } @@ -93,32 +97,32 @@ class LogFilterDialog extends JDialog } } - java.util.Set<Ice.LogMessageType> messageTypeFilterSet = new java.util.HashSet<>(); + java.util.Set<LogMessageType> messageTypeFilterSet = new java.util.HashSet<>(); if(error.isSelected()) { - messageTypeFilterSet.add(Ice.LogMessageType.ErrorMessage); + messageTypeFilterSet.add(LogMessageType.ErrorMessage); } if(warning.isSelected()) { - messageTypeFilterSet.add(Ice.LogMessageType.WarningMessage); + messageTypeFilterSet.add(LogMessageType.WarningMessage); } if(print.isSelected()) { - messageTypeFilterSet.add(Ice.LogMessageType.PrintMessage); + messageTypeFilterSet.add(LogMessageType.PrintMessage); } if(trace.isSelected()) { - messageTypeFilterSet.add(Ice.LogMessageType.TraceMessage); + messageTypeFilterSet.add(LogMessageType.TraceMessage); } if(messageTypeFilterSet.size() == 0 || messageTypeFilterSet.size() == 4) { // All or nothing checked equivalent of getting everything! messageTypeFilterSet = null; } - Ice.LogMessageType[] messageTypeFilter = null; + LogMessageType[] messageTypeFilter = null; if(messageTypeFilterSet != null) { - messageTypeFilter = messageTypeFilterSet.toArray(new Ice.LogMessageType[0]); + messageTypeFilter = messageTypeFilterSet.toArray(new LogMessageType[0]); } dispose(); diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogPrefsDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogPrefsDialog.java index 413ad2d7133..03dc4acf9bd 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/LogPrefsDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/LogPrefsDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -132,7 +132,8 @@ class LogPrefsDialog extends JDialog final JTextField initialMessagesField = new JTextField(10); initialMessagesField.setText(Integer.toString(dialog.getInitialMessages())); - initialMessagesField.setToolTipText("Start by retrieving <num> log messages from the server; -1 means retrieve all"); + initialMessagesField.setToolTipText( + "Start by retrieving <num> log messages from the server; -1 means retrieve all"); JButton okButton = new JButton("OK"); ActionListener okListener = new ActionListener() @@ -143,7 +144,8 @@ class LogPrefsDialog extends JDialog try { int maxMessages = parseInt(maxMessagesField, "Max log messages in buffer"); - int initialMessages = parseInt(initialMessagesField, "Number of log messages retrieved initially"); + int initialMessages = + parseInt(initialMessagesField, "Number of log messages retrieved initially"); dialog.setPrefs(maxMessages, initialMessages); dispose(); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsFieldContext.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsFieldContext.java index 71ad2658f8a..3969a3b20f1 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsFieldContext.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsFieldContext.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; public interface MetricsFieldContext { diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java new file mode 100644 index 00000000000..b1cd0b55bd8 --- /dev/null +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsView.java @@ -0,0 +1,280 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.IceGridGUI.LiveDeployment; + +import java.awt.Component; + +import javax.swing.Icon; +import javax.swing.JTree; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.SwingUtilities; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; + +import com.zeroc.IceGridGUI.*; + +class MetricsView extends TreeNode +{ + @Override + public Editor getEditor() + { + return _editor; + } + + // + // Actions + // + @Override + public boolean[] getAvailableActions() + { + boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; + actions[ENABLE_METRICS_VIEW] = !_enabled; + actions[DISABLE_METRICS_VIEW] = _enabled; + return actions; + } + + @Override + public Component getTreeCellRendererComponent( + JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) + { + if(_cellRenderer == null) + { + _cellRenderer = new DefaultTreeCellRenderer(); + + _enabledIcon = Utils.getIcon("/icons/16x16/metrics.png"); + _disabledIcon = Utils.getIcon("/icons/16x16/metrics_disabled.png"); + } + + Icon icon = _enabled ? _enabledIcon : _disabledIcon; + _cellRenderer.setLeafIcon(icon); + return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + } + + MetricsView(TreeNode parent, String name, com.zeroc.IceMX.MetricsAdminPrx admin, boolean enabled) + { + super(parent, name); + _name = name; + _admin = admin; + _editor = new MetricsViewEditor(getRoot()); + _enabled = enabled; + } + + @Override + public void enableMetricsView(boolean enabled) + { + com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin(); + if(metricsAdmin != null) + { + if(enabled) + { + metricsAdmin.enableMetricsViewAsync(_name).whenComplete((result, ex) -> + { + if(ex == null) + { + SwingUtilities.invokeLater(() -> + { + _enabled = true; + getRoot().getTreeModel().nodeChanged(MetricsView.this); + getRoot().getCoordinator().showActions(MetricsView.this); + if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this) + { + // + // If the metrics view is selected when enabled success, + // we must start the refresh thread to pull updates. + // + MetricsViewEditor.startRefresh(MetricsView.this); + } + }); + } + else + { + MetricsViewEditor.stopRefresh(); + SwingUtilities.invokeLater(() -> + { + if(ex instanceof com.zeroc.Ice.ObjectNotExistException || + ex instanceof com.zeroc.Ice.ConnectionRefusedException) + { + // Server is down. + } + else if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), + "Error: " + ex.toString(), "Error", + JOptionPane.ERROR_MESSAGE); + } + }); + } + }); + } + else + { + metricsAdmin.disableMetricsViewAsync(_name).whenComplete((result, ex) -> + { + if(ex == null) + { + SwingUtilities.invokeLater(() -> + { + _enabled = false; + _editor.show(MetricsView.this, null, 0); + getRoot().getTreeModel().nodeChanged(MetricsView.this); + getRoot().getCoordinator().showActions(MetricsView.this); + if(getRoot().getTree().getLastSelectedPathComponent() == MetricsView.this) + { + // + // If the metrics view is selected when disabled success, + // we stop the refresh. + // + MetricsViewEditor.stopRefresh(); + } + }); + } + else + { + MetricsViewEditor.stopRefresh(); + SwingUtilities.invokeLater(() -> + { + if(ex instanceof com.zeroc.Ice.ObjectNotExistException || + ex instanceof com.zeroc.Ice.ConnectionRefusedException) + { + // Server is down. + } + else if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), + "Error: " + ex.toString(), "Error", + JOptionPane.ERROR_MESSAGE); + } + }); + } + }); + } + } + } + + public boolean isEnabled() + { + return _enabled; + } + + public String name() + { + return _name; + } + + com.zeroc.IceMX.MetricsAdminPrx getMetricsAdmin() + { + return _admin; + } + + @Override + public JPopupMenu getPopupMenu() + { + LiveActions la = getCoordinator().getLiveActionsForPopup(); + + if(_popup == null) + { + _popup = new JPopupMenu(); + _popup.add(la.get(ENABLE_METRICS_VIEW)); + _popup.add(la.get(DISABLE_METRICS_VIEW)); + } + + la.setTarget(this); + return _popup; + } + + public java.util.concurrent.CompletableFuture<com.zeroc.IceMX.MetricsFailures> fetchMetricsFailures(String map, + String id) + { + com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin(); + if(metricsAdmin != null) + { + try + { + return metricsAdmin.getMetricsFailuresAsync(_name, map, id); + } + catch(com.zeroc.Ice.LocalException e) + { + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error", + JOptionPane.ERROR_MESSAGE); + } + } + return null; + } + + public void fetchMetricsView() + { + com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = getMetricsAdmin(); + if(metricsAdmin != null) + { + try + { + metricsAdmin.getMetricsViewAsync(_name).whenComplete((result, ex) -> + { + if(ex == null) + { + SwingUtilities.invokeLater(() -> + { + _editor.show(MetricsView.this, result.returnValue, result.timestamp); + }); + } + else + { + MetricsViewEditor.stopRefresh(); + SwingUtilities.invokeLater(() -> + { + if(ex instanceof com.zeroc.Ice.ObjectNotExistException || + ex instanceof com.zeroc.Ice.ConnectionRefusedException) + { + // Server is down. + } + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) + { + // MetricsAdmin facet not present. + } + else if(!(ex instanceof com.zeroc.Ice.CommunicatorDestroyedException)) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), + "Error: " + ex.toString(), "Error", + JOptionPane.ERROR_MESSAGE); + } + }); + } + }); + } + catch(com.zeroc.Ice.CommunicatorDestroyedException e) + { + } + catch(com.zeroc.Ice.LocalException e) + { + MetricsViewEditor.stopRefresh(); + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error", + JOptionPane.ERROR_MESSAGE); + } + } + } + + private String _name; + private com.zeroc.IceMX.MetricsAdminPrx _admin; + private MetricsViewEditor _editor; + private boolean _enabled; + static private JPopupMenu _popup; + static private DefaultTreeCellRenderer _cellRenderer; + static private Icon _enabledIcon; + static private Icon _disabledIcon; +} diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsViewEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsViewEditor.java index fda820b74b9..edac26fd911 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/MetricsViewEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/MetricsViewEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.lang.reflect.Field; @@ -64,7 +64,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.JTableHeader; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; public class MetricsViewEditor extends Editor implements MetricsFieldContext { @@ -101,7 +101,6 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // public static class FormatedNumberRenderer extends DefaultTableCellRenderer { - public FormatedNumberRenderer(String format) { _format = new DecimalFormat(format); @@ -203,8 +202,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext JTree tree = root.getTree(); tree.addTreeSelectionListener(new SelectionListener()); - Set<String> sectionSort = new LinkedHashSet<String>(); - _properties = Ice.Util.createProperties(); + Set<String> sectionSort = new LinkedHashSet<>(); + _properties = com.zeroc.Ice.Util.createProperties(); _properties.load("metrics.cfg"); sectionSort.addAll(java.util.Arrays.asList(_properties.getPropertyAsList("IceGridGUI.Metrics"))); @@ -218,7 +217,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext { _properties.load(s.trim()); } - catch(Ice.FileException ex) + catch(com.zeroc.Ice.FileException ex) { coord.getCommunicator().getLogger().warning("unable to load `" + ex.path + "'"); } @@ -248,15 +247,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext synchronized static void startRefresh(final MetricsView node) { assert(_refreshFuture == null); - _refreshFuture = node.getCoordinator().getExecutor().scheduleAtFixedRate(new Runnable() - { - @Override - public void run() + _refreshFuture = node.getCoordinator().getExecutor().scheduleAtFixedRate(() -> { node.fetchMetricsView(); - } - - }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS); + }, 0, _refreshPeriod, java.util.concurrent.TimeUnit.SECONDS); } synchronized static void stopRefresh() @@ -326,15 +320,15 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext @Override public int hashCode() { - int h = IceInternal.HashUtil.hashAdd(5381, node); - h = IceInternal.HashUtil.hashAdd(h, server); - return IceInternal.HashUtil.hashAdd(h, view); + int h = com.zeroc.IceInternal.HashUtil.hashAdd(5381, node); + h = com.zeroc.IceInternal.HashUtil.hashAdd(h, server); + return com.zeroc.IceInternal.HashUtil.hashAdd(h, view); } public String node; public String server; public String view; - public IceMX.MetricsAdminPrx admin; + public com.zeroc.IceMX.MetricsAdminPrx admin; } public static class MetricsCell @@ -377,8 +371,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext @Override public int hashCode() { - int h = IceInternal.HashUtil.hashAdd(5381, _id); - return IceInternal.HashUtil.hashAdd(h, _field.getFieldName()); + int h = com.zeroc.IceInternal.HashUtil.hashAdd(5381, _id); + return com.zeroc.IceInternal.HashUtil.hashAdd(h, _field.getFieldName()); } public double getScaleFactor() @@ -391,7 +385,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext _scaleFactor = scaleFactor; } - public Number getValue(IceMX.Metrics m, long timestamp) + public Number getValue(com.zeroc.IceMX.Metrics m, long timestamp) { Number value = ((Number)getField().getValue(m, timestamp)); if(value == null) @@ -532,7 +526,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext { int[] selectedRows = table.getSelectedRows(); int[] selectedColumns = table.getSelectedColumns(); - Map<String, List<MetricsCell>> rows = new HashMap<String, List<MetricsCell>>(); + Map<String, List<MetricsCell>> rows = new HashMap<>(); if(selectedRows.length > 0 && selectedColumns.length > 0) { @@ -543,7 +537,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext for(int row : selectedRows) { - List<MetricsCell> cells = new ArrayList<MetricsCell>(); + List<MetricsCell> cells = new ArrayList<>(); String id = model.getValueAt(table.convertRowIndexToModel(row), idColumn).toString(); for(int col : selectedColumns) { @@ -612,7 +606,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext private MetricsView _node; } - public void show(final MetricsView node, final Map<java.lang.String, IceMX.Metrics[]> data, final long timestamp) + public void show(final MetricsView node, final Map<java.lang.String, com.zeroc.IceMX.Metrics[]> data, + final long timestamp) { boolean rebuildPanel = false; if(!node.isEnabled()) @@ -622,14 +617,14 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } else if(data != null) { - for(final Map.Entry<String, IceMX.Metrics[]> entry : data.entrySet()) + for(final Map.Entry<String, com.zeroc.IceMX.Metrics[]> entry : data.entrySet()) { if(_tables.get(entry.getKey()) != null) { continue; } - IceMX.Metrics[] objects = entry.getValue(); + com.zeroc.IceMX.Metrics[] objects = entry.getValue(); if(objects == null || objects.length == 0) { continue; @@ -647,7 +642,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext catch(NoSuchFieldException ex) { } - MetricsField field = createField(node, prefix + "." + name, entry.getKey(), name, objectField, this); + MetricsField field = + createField(node, prefix + "." + name, entry.getKey(), name, objectField, this); if(field != null) { model.addField(field); @@ -671,7 +667,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext @Override public String getToolTipText(MouseEvent e) { - int index = columnModel.getColumn(columnModel.getColumnIndexAtX(e.getPoint().x)).getModelIndex(); + int index = columnModel.getColumn( + columnModel.getColumnIndexAtX(e.getPoint().x)).getModelIndex(); return model.getMetricFields().get(index).getColumnToolTip(); } }; @@ -719,18 +716,19 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext addToGraph.setEnabled(rows.size() > 0); JMenuItem newGraph = new JMenuItem("New Metrics Graph"); newGraph.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) { - @Override - public void actionPerformed(ActionEvent e) + Coordinator.IGraphView view = node.getCoordinator().createGraphView(); + if(view != null) { - Coordinator.IGraphView view = node.getCoordinator().createGraphView(); - if(view != null) - { - view.addSeries(new MetricsViewTransferableData(new MetricsViewInfo(node), - entry.getKey(), rows)); - } + view.addSeries( + new MetricsViewTransferableData(new MetricsViewInfo(node), + entry.getKey(), rows)); } - }); + } + }); addToGraph.add(newGraph); Coordinator.IGraphView[] graphs = node.getCoordinator().getGraphViews(); @@ -743,8 +741,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext @Override public void actionPerformed(ActionEvent e) { - view.addSeries(new MetricsViewTransferableData(new MetricsViewInfo(node), - entry.getKey(), rows)); + view.addSeries( + new MetricsViewTransferableData(new MetricsViewInfo(node), + entry.getKey(), rows)); } }); } @@ -758,7 +757,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext if(fieldEntry.getValue().getCellRenderer() != null) { table.getColumnModel().getColumn(fieldEntry.getKey().intValue()).setCellRenderer( - fieldEntry.getValue().getCellRenderer()); + fieldEntry.getValue().getCellRenderer()); } } @@ -777,10 +776,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // Load the data. // - for(Map.Entry<String, IceMX.Metrics[]> entry : data.entrySet()) + for(Map.Entry<String, com.zeroc.IceMX.Metrics[]> entry : data.entrySet()) { String key = entry.getKey(); - IceMX.Metrics[] values = entry.getValue(); + com.zeroc.IceMX.Metrics[] values = entry.getValue(); JTable table = _tables.get(key); if(table == null) { @@ -792,13 +791,13 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext model.getDataVector().removeAllElements(); model.fireTableDataChanged(); - for(IceMX.Metrics m : values) + for(com.zeroc.IceMX.Metrics m : values) { model.addMetrics(m, timestamp); } int idColumn = table.getColumnModel().getColumnIndex(_properties.getProperty( - "IceGridGUI.Metrics." + key + ".id.columnName")); + "IceGridGUI.Metrics." + key + ".id.columnName")); if(rows.size() > 0) { for(int i = table.getRowCount() - 1; i >= 0; --i) @@ -825,10 +824,14 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext Field objectField, MetricsFieldContext context) { String className = _properties.getPropertyWithDefault( - prefix + ".fieldClass", - "IceGridGUI.LiveDeployment.MetricsViewEditor$DeclaredMetricsField"); + prefix + ".fieldClass", "com.zeroc.IceGridGUI.LiveDeployment.MetricsViewEditor$DeclaredMetricsField"); + + if(!className.startsWith("com.zeroc.")) + { + className = "com.zeroc." + className; + } - Class<?> cls = IceInternal.Util.findClass(className, null); + Class<?> cls = com.zeroc.IceInternal.Util.findClass(className, null); if(cls == null) { System.err.println("Could not find class " + className); @@ -899,7 +902,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext { JSplitPane current = null; JSplitPane top = null; - Map<String, JTable> tables = new HashMap<String, JTable>(_tables); + Map<String, JTable> tables = new HashMap<>(_tables); StringBuilder sb = new StringBuilder(); Object[] elements = _selectedPath.getPath(); @@ -996,7 +999,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext _metricsName = metricsName; } - public void addMetrics(IceMX.Metrics m, long timestamp) + public void addMetrics(com.zeroc.IceMX.Metrics m, long timestamp) { Object[] row = new Object[_fields.size()]; @@ -1040,11 +1043,11 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext return false; } - @Override - public Class getColumnClass(int index) - { - return _fields.get(index).getColumnClass(); - } + @Override + public Class getColumnClass(int index) + { + return _fields.get(index).getColumnClass(); + } public Map<Integer, MetricsField> getMetricFields() { @@ -1057,12 +1060,11 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } String _metricsName; - Map<Integer, MetricsField> _fields = new HashMap<Integer, MetricsField>(); + Map<Integer, MetricsField> _fields = new HashMap<>(); } private static java.util.concurrent.Future<?> _refreshFuture; - private Map<String, JTable> _tables = new HashMap<String, JTable>(); - + private Map<String, JTable> _tables = new HashMap<>(); static class ColumnInfo { @@ -1101,7 +1103,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // Name for display. // - public String getColumnName(); + public String getColumnName(); // // ToolTip @@ -1111,7 +1113,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // The Java class correspoding to the field, is used in the table models. // - public Class getColumnClass(); + public Class getColumnClass(); // // Renderer used by JTable to render the field. @@ -1121,7 +1123,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext // // Return the value of the field for the given metrics object. // - public Object getValue(IceMX.Metrics m, long timestamp); + public Object getValue(com.zeroc.IceMX.Metrics m, long timestamp); // // Set up a field identical to this but without the transient data. @@ -1271,7 +1273,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } @Override - public Object getValue(IceMX.Metrics m, long timestamp) + public Object getValue(com.zeroc.IceMX.Metrics m, long timestamp) { try { @@ -1305,11 +1307,11 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext _cellRenderer = new FormatedNumberRenderer(format); } - @Override - public Class getColumnClass() - { - return Float.class; - } + @Override + public Class getColumnClass() + { + return Float.class; + } @Override public TableCellRenderer getCellRenderer() @@ -1323,9 +1325,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } @Override - public Object getValue(IceMX.Metrics m2, long timestamp) + public Object getValue(com.zeroc.IceMX.Metrics m2, long timestamp) { - IceMX.Metrics m1 = _deltas.get(m2.id); + com.zeroc.IceMX.Metrics m1 = _deltas.get(m2.id); _deltas.put(m2.id, m2); if(m1 == null) { @@ -1343,10 +1345,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } } - private double _scaleFactor = 1.0d; - private String _columnName; + private double _scaleFactor = 1.0d; + private String _columnName; private TableCellRenderer _cellRenderer; - private final Map<String, IceMX.Metrics> _deltas = new HashMap<String, IceMX.Metrics>(); + private final Map<String, com.zeroc.IceMX.Metrics> _deltas = new HashMap<>(); } static public class DeltaMeasurement @@ -1359,10 +1361,10 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext { public DeltaAverageMetricsField(MetricsView node, String prefix, String metricsName, String fieldName, Field field) - { + { super(node, prefix, metricsName, fieldName, field); setFormat("#0.000"); // Set the default format - } + } public void setFormat(String format) { @@ -1392,7 +1394,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } @Override - public Object getValue(IceMX.Metrics m, long timestamp) + public Object getValue(com.zeroc.IceMX.Metrics m, long timestamp) { DeltaMeasurement d1 = _deltas.get(m.id); DeltaMeasurement d2 = new DeltaMeasurement(); @@ -1472,8 +1474,8 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext private double _scaleFactor = 1.0d; private String _dataField; - private final Map<String, DeltaMeasurement> _deltas = new HashMap<String, DeltaMeasurement>(); - private final Map<String, Double> _last = new HashMap<String, Double>(); + private final Map<String, DeltaMeasurement> _deltas = new HashMap<>(); + private final Map<String, Double> _last = new HashMap<>(); private TableCellRenderer _cellRenderer; } @@ -1496,9 +1498,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext return _cellRenderer; } - @Override - public Object getValue(final IceMX.Metrics m, long timestamp) - { + @Override + public Object getValue(final com.zeroc.IceMX.Metrics m, long timestamp) + { JButton button = new JButton(Integer.toString(m.failures)); if(m.failures > 0) { @@ -1535,89 +1537,61 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext JScrollPane scrollPane = new JScrollPane(table); - IceMX.Callback_MetricsAdmin_getMetricsFailures cb = - new IceMX.Callback_MetricsAdmin_getMetricsFailures() + getMetricsNode().getCoordinator().getMainFrame().setCursor( + Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + java.util.concurrent.CompletableFuture<com.zeroc.IceMX.MetricsFailures> r = + getMetricsNode().fetchMetricsFailures(getMetricsName(), m.id); + if(r != null) + { + r.whenComplete((result, ex) -> { - @Override - public void response(final IceMX.MetricsFailures data) + if(ex == null) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + for(Map.Entry<String, Integer> entry : result.failures.entrySet()) { - for(Map.Entry<String, Integer> entry : data.failures.entrySet()) - { - Object[] row = new Object[3]; - row[0] = entry.getValue().toString(); - row[1] = entry.getKey(); - row[2] = m.id; - model.addRow(row); - } - getMetricsNode().getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + Object[] row = new Object[3]; + row[0] = entry.getValue().toString(); + row[1] = entry.getKey(); + row[2] = m.id; + model.addRow(row); } + getMetricsNode().getCoordinator().getMainFrame().setCursor( + Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }); - } - - @Override - public void exception(final Ice.LocalException e) + } + else { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + getMetricsNode().getCoordinator().getMainFrame().setCursor( + Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) { - getMetricsNode().getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - if(e instanceof Ice.ObjectNotExistException) - { - // Server is down. - } - else if(e instanceof Ice.FacetNotExistException) - { - // MetricsAdmin facet not present. - } - else - { - e.printStackTrace(); - JOptionPane.showMessageDialog( - getMetricsNode().getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } + // Server is down. } - }); - } - - @Override - public void exception(final Ice.UserException e) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) { - getMetricsNode().getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - e.printStackTrace(); + // MetricsAdmin facet not present. + } + else + { + ex.printStackTrace(); JOptionPane.showMessageDialog( - getMetricsNode().getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); + getMetricsNode().getCoordinator().getMainFrame(), + "Error: " + ex.toString(), "Error", + JOptionPane.ERROR_MESSAGE); } }); } - }; - - getMetricsNode().getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - getMetricsNode().fetchMetricsFailures(getMetricsName(), m.id, cb); + }); + } JOptionPane.showMessageDialog(getMetricsNode().getCoordinator().getMainFrame(), scrollPane, "Metrics Failures", JOptionPane.PLAIN_MESSAGE); getMetricsNode().getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); } @@ -1626,7 +1600,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext button.setEnabled(false); } return button; - } + } private static final TableCellRenderer _cellRenderer = new ButtonRenderer(); } @@ -1651,11 +1625,12 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } @Override - public Object getValue(final IceMX.Metrics m, final long timestamp) + public Object getValue(final com.zeroc.IceMX.Metrics m, final long timestamp) { try { - final IceMX.Metrics[] objects = (IceMX.Metrics[])m.getClass().getField(getFieldName()).get(m); + final com.zeroc.IceMX.Metrics[] objects = + (com.zeroc.IceMX.Metrics[])m.getClass().getField(getFieldName()).get(m); JButton button = new JButton(Integer.toString(objects.length)); button.setEnabled(objects.length > 0); if(objects.length > 0) @@ -1696,7 +1671,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext final JTable table = new JTable(model) { // - //Implement table header tool tips. + // Implement table header tool tips. // @Override protected JTableHeader createDefaultTableHeader() @@ -1738,7 +1713,7 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext int idColumn = table.getColumnModel().getColumnIndex(_properties.getProperty(prefix + ".id.columnName")); - for(IceMX.Metrics m : objects) + for(com.zeroc.IceMX.Metrics m : objects) { model.addMetrics(m, timestamp); } @@ -1767,9 +1742,9 @@ public class MetricsViewEditor extends Editor implements MetricsFieldContext } private static final int _refreshPeriod = 5; - private static Ice.Properties _properties; + private static com.zeroc.Ice.Properties _properties; private static String[] _sectionSort; - private static Map<String, String> _sectionNames = new HashMap<String, String>(); + private static Map<String, String> _sectionNames = new HashMap<>(); private static TreePath _selectedPath; final private Preferences _prefs; } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Node.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java index 74eaaeddf93..1a08e655d7e 100755 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Node.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; import java.awt.Cursor; @@ -20,8 +20,8 @@ import javax.swing.tree.DefaultTreeCellRenderer; import java.text.NumberFormat; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class Node extends ListTreeNode { @@ -31,7 +31,7 @@ class Node extends ListTreeNode @Override public boolean[] getAvailableActions() { - boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; + boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; actions[SHUTDOWN_NODE] = _up; actions[RETRIEVE_ICE_LOG] = _up; actions[RETRIEVE_STDOUT] = _up; @@ -48,52 +48,44 @@ class Node extends ListTreeNode final String errorTitle = "Failed to retrieve Admin Proxy for Node " + _id; getRoot().getCoordinator().getStatusBar().setText(prefix); - Callback_Admin_getNodeAdmin cb = new Callback_Admin_getNodeAdmin() + try { - @Override - public void response(Ice.ObjectPrx prx) - { - final Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(prx.ice_facet("Logger")); - final String title = "Node " + _id + " Ice log"; - final String defaultFileName = "node-" + _id; - - SwingUtilities.invokeLater(new Runnable() + getRoot().getCoordinator().getSession().getAdmin().getNodeAdminAsync(_id).whenComplete((result, ex) -> { - @Override - public void run() + if(ex == null) { - success(prefix); - if(_showIceLogDialog == null) - { - _showIceLogDialog = new ShowIceLogDialog(Node.this, title, loggerAdmin, defaultFileName, - getRoot().getLogMaxLines(), getRoot().getLogInitialLines()); - } - else - { - _showIceLogDialog.toFront(); - } + final com.zeroc.Ice.LoggerAdminPrx loggerAdmin = + com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(result.ice_facet("Logger")); + final String title = "Node " + _id + " Ice log"; + final String defaultFileName = "node-" + _id; + + SwingUtilities.invokeLater(() -> + { + success(prefix); + if(_showIceLogDialog == null) + { + _showIceLogDialog = new ShowIceLogDialog(Node.this, title, loggerAdmin, + defaultFileName, + getRoot().getLogMaxLines(), + getRoot().getLogInitialLines()); + } + else + { + _showIceLogDialog.toFront(); + } + }); + } + else if(ex instanceof com.zeroc.Ice.UserException) + { + amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex); + } + else + { + amiFailure(prefix, errorTitle, ex.toString()); } }); - } - - @Override - public void exception(Ice.UserException e) - { - amiFailure(prefix, errorTitle, e); - } - - @Override - public void exception(Ice.LocalException e) - { - amiFailure(prefix, errorTitle, e.toString()); - } - }; - - try - { - getRoot().getCoordinator().getSession().getAdmin().begin_getNodeAdmin(_id, cb); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { failure(prefix, errorTitle, e.toString()); } @@ -146,39 +138,17 @@ class Node extends ListTreeNode final String prefix = "Shutting down node '" + _id + "'..."; getCoordinator().getStatusBar().setText(prefix); - Callback_Admin_shutdownNode cb = new Callback_Admin_shutdownNode() - { - // - // Called by another thread! - // - @Override - public void response() - { - amiSuccess(prefix); - } - - @Override - public void exception(Ice.UserException e) - { - amiFailure(prefix, "Failed to shutdown " + _id, e); - } - - @Override - public void exception(Ice.LocalException e) - { - amiFailure(prefix, "Failed to shutdown " + _id, - e.toString()); - } - }; - try { getCoordinator().getMainFrame().setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - getCoordinator().getAdmin().begin_shutdownNode(_id, cb); + getCoordinator().getAdmin().shutdownNodeAsync(_id).whenComplete((result, ex) -> + { + amiComplete(prefix, "Failed to shutdown " + _id, ex); + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { failure(prefix, "Failed to shutdown " + _id, e.toString()); } @@ -280,8 +250,7 @@ class Node extends ListTreeNode up(info, false); } - Node(Root parent, ApplicationDescriptor appDesc, - String nodeName, NodeDescriptor nodeDesc) + Node(Root parent, ApplicationDescriptor appDesc, String nodeName, NodeDescriptor nodeDesc) { super(parent, nodeName); add(appDesc, nodeDesc); @@ -371,7 +340,7 @@ class Node extends ListTreeNode return true; } - java.util.List<Server> toRemove = new java.util.LinkedList<Server>(); + java.util.List<Server> toRemove = new java.util.LinkedList<>(); int[] toRemoveIndices = new int[_children.size()]; int i = 0; @@ -419,7 +388,7 @@ class Node extends ListTreeNode } NodeDescriptor nodeDesc = data.descriptor; - java.util.Set<Server> freshServers = new java.util.HashSet<Server>(); + java.util.Set<Server> freshServers = new java.util.HashSet<>(); if(update != null) { @@ -600,7 +569,7 @@ class Node extends ListTreeNode // // Tell every server on this node // - java.util.Set<Server> updatedServers = new java.util.HashSet<Server>(); + java.util.Set<Server> updatedServers = new java.util.HashSet<>(); for(ServerDynamicInfo sinfo : _info.servers) { Server server = findServer(sinfo.id); @@ -726,7 +695,7 @@ class Node extends ListTreeNode } } - Ice.ObjectPrx getProxy(String adapterId) + com.zeroc.Ice.ObjectPrx getProxy(String adapterId) { if(_info != null) { @@ -745,7 +714,7 @@ class Node extends ListTreeNode java.util.SortedMap<String, String> getLoadFactors() { - java.util.SortedMap<String, String> result = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> result = new java.util.TreeMap<>(); for(java.util.Map.Entry<String, ApplicationData> p : _map.entrySet()) { @@ -764,103 +733,72 @@ class Node extends ListTreeNode void showLoad() { - Callback_Admin_getNodeLoad cb = new Callback_Admin_getNodeLoad() - { - @Override - public void response(LoadInfo loadInfo) - { - NumberFormat format; - if(_windows) - { - format = NumberFormat.getPercentInstance(); - format.setMaximumFractionDigits(1); - format.setMinimumFractionDigits(1); - } - else - { - format = NumberFormat.getNumberInstance(); - format.setMaximumFractionDigits(2); - format.setMinimumFractionDigits(2); - } - - final String load = - format.format(loadInfo.avg1) + " " + - format.format(loadInfo.avg5) + " " + - format.format(loadInfo.avg15); - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _editor.setLoad(load, Node.this); - } - }); - } - - @Override - public void exception(final Ice.UserException e) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - if(e instanceof IceGrid.NodeNotExistException) - { - _editor.setLoad( - "Error: this node is not known to this IceGrid Registry", - Node.this); - } - else if(e instanceof IceGrid.NodeUnreachableException) - { - _editor.setLoad("Error: cannot reach this node", Node.this); - } - else - { - _editor.setLoad("Error: " + e.toString(), Node.this); - } - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _editor.setLoad("Error: " + e.toString(), Node.this); - } - }); - } - }; - try { - getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - IceGrid.AdminPrx admin = getCoordinator().getAdmin(); + com.zeroc.IceGrid.AdminPrx admin = getCoordinator().getAdmin(); if(admin == null) { _editor.setLoad("Unknown", this); } else { - admin.begin_getNodeLoad(_id, cb); + admin.getNodeLoadAsync(_id).whenComplete((result, ex) -> + { + if(ex == null) + { + NumberFormat format; + if(_windows) + { + format = NumberFormat.getPercentInstance(); + format.setMaximumFractionDigits(1); + format.setMinimumFractionDigits(1); + } + else + { + format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + format.setMinimumFractionDigits(2); + } + + final String load = + format.format(result.avg1) + " " + + format.format(result.avg5) + " " + + format.format(result.avg15); + + SwingUtilities.invokeLater(() -> _editor.setLoad(load, Node.this)); + } + else + { + SwingUtilities.invokeLater(() -> + { + if(ex instanceof com.zeroc.IceGrid.NodeNotExistException) + { + _editor.setLoad( + "Error: this node is not known to this IceGrid Registry", + Node.this); + } + else if(ex instanceof com.zeroc.IceGrid.NodeUnreachableException) + { + _editor.setLoad("Error: cannot reach this node", Node.this); + } + else + { + _editor.setLoad("Error: " + ex.toString(), Node.this); + } + }); + } + }); } } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { _editor.setLoad("Error: " + e.toString(), this); } finally { - getCoordinator().getMainFrame().setCursor( - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } @@ -870,8 +808,7 @@ class Node extends ListTreeNode // // Find template // - TemplateDescriptor templateDescriptor = - application.serverTemplates.get(instanceDescriptor.template); + TemplateDescriptor templateDescriptor = application.serverTemplates.get(instanceDescriptor.template); assert templateDescriptor != null; ServerDescriptor serverDescriptor = (ServerDescriptor)templateDescriptor.descriptor; @@ -1014,10 +951,9 @@ class Node extends ListTreeNode Utils.Resolver resolver; } - public java.util.List<Server> - getServers() + public java.util.List<Server> getServers() { - java.util.List<Server> servers = new java.util.ArrayList<Server>(); + java.util.List<Server> servers = new java.util.ArrayList<>(); for(Object obj : _children) { servers.add((Server)obj); @@ -1028,7 +964,7 @@ class Node extends ListTreeNode // // Application name to ApplicationData // - private final java.util.SortedMap<String, ApplicationData> _map = new java.util.TreeMap<String, ApplicationData>(); + private final java.util.SortedMap<String, ApplicationData> _map = new java.util.TreeMap<>(); private boolean _up = false; private NodeDynamicInfo _info; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/NodeEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java index e05d0b1197c..d1bee1e968d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/NodeEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.event.ActionEvent; @@ -21,7 +21,7 @@ import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; +import com.zeroc.IceGrid.*; class NodeEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ObjectDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ObjectDialog.java index 46a0365f7e7..f9ac9d656f7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ObjectDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ObjectDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Container; import java.awt.event.ActionEvent; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/RegistryEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java index 916d1215c64..5513f430400 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/RegistryEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; @@ -24,8 +24,8 @@ import javax.swing.KeyStroke; import com.jgoodies.forms.builder.DefaultFormBuilder; import com.jgoodies.forms.layout.CellConstraints; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class RegistryEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Root.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java index da7141277ab..277e5c34a56 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Root.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; import java.awt.Cursor; @@ -23,15 +23,14 @@ import javax.swing.tree.DefaultTreeModel; import java.util.prefs.Preferences; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; // // The Root node of the Live Deployment view // public class Root extends ListArrayTreeNode { - // // A custom tree model to filter tree views. // @@ -56,8 +55,7 @@ public class Root extends ListArrayTreeNode } @Override - public int - getChildCount(Object parent) + public int getChildCount(Object parent) { if(!filterEnabled()) { @@ -151,7 +149,7 @@ public class Root extends ListArrayTreeNode { return _applicationNameFilter; } - + @Override public void clearShowIceLogDialog() { @@ -208,7 +206,7 @@ public class Root extends ListArrayTreeNode @Override public boolean[] getAvailableActions() { - boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; + boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; actions[ADD_OBJECT] = _coordinator.connectedToMaster(); actions[SHUTDOWN_REGISTRY] = true; actions[RETRIEVE_ICE_LOG] = true; @@ -226,28 +224,12 @@ public class Root extends ListArrayTreeNode try { final AdminPrx admin = _coordinator.getAdmin(); - admin.begin_shutdownRegistry(_replicaName, new Ice.Callback() + admin.shutdownRegistryAsync(_replicaName).whenComplete((result, ex) -> { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_shutdownRegistry(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } + amiComplete(prefix, errorTitle, ex); }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -273,7 +255,7 @@ public class Root extends ListArrayTreeNode public Object[] getPatchableApplicationNames() { - java.util.List<String> result = new java.util.ArrayList<String>(); + java.util.List<String> result = new java.util.ArrayList<>(); for(java.util.Map.Entry<String, ApplicationInfo> p : _infoMap.entrySet()) { @@ -288,7 +270,7 @@ public class Root extends ListArrayTreeNode public java.util.SortedMap<String, String> getApplicationMap() { - java.util.SortedMap<String, String> r = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> r = new java.util.TreeMap<>(); for(java.util.Map.Entry<String, ApplicationInfo> p : _infoMap.entrySet()) { @@ -370,8 +352,7 @@ public class Root extends ListArrayTreeNode { int shutdown = JOptionPane.showConfirmDialog( _coordinator.getMainFrame(), - "You are about to install or refresh your" - + " application distribution.\n" + "You are about to install or refresh your application distribution.\n" + " Do you want shut down all servers affected by this update?", "Patch Confirmation", JOptionPane.YES_NO_CANCEL_OPTION); @@ -388,29 +369,13 @@ public class Root extends ListArrayTreeNode try { final AdminPrx admin = _coordinator.getAdmin(); - admin.begin_patchApplication(applicationName, shutdown == JOptionPane.YES_OPTION, - new Ice.Callback() + admin.patchApplicationAsync(applicationName, shutdown == JOptionPane.YES_OPTION).whenComplete( + (result, ex) -> { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_patchApplication(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } + amiComplete(prefix, errorTitle, ex); }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -458,7 +423,7 @@ public class Root extends ListArrayTreeNode { _infoMap.remove(name); - java.util.List<Node> toRemove = new java.util.LinkedList<Node>(); + java.util.List<Node> toRemove = new java.util.LinkedList<>(); int[] toRemoveIndices = new int[_nodes.size()]; int i = 0; @@ -572,7 +537,7 @@ public class Root extends ListArrayTreeNode // // Add/update // - java.util.Set<Node> freshNodes = new java.util.HashSet<Node>(); + java.util.Set<Node> freshNodes = new java.util.HashSet<>(); for(NodeUpdateDescriptor desc : update.descriptor.nodes) { String nodeName = desc.name; @@ -635,23 +600,23 @@ public class Root extends ListArrayTreeNode { for(ObjectInfo info : objects) { - _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info); + _objects.put(com.zeroc.Ice.Util.identityToString(info.proxy.ice_getIdentity()), info); } } public void objectAdded(ObjectInfo info) { - _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info); + _objects.put(com.zeroc.Ice.Util.identityToString(info.proxy.ice_getIdentity()), info); } public void objectUpdated(ObjectInfo info) { - _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info); + _objects.put(com.zeroc.Ice.Util.identityToString(info.proxy.ice_getIdentity()), info); } - public void objectRemoved(Ice.Identity id) + public void objectRemoved(com.zeroc.Ice.Identity id) { - _objects.remove(Ice.Util.identityToString(id)); + _objects.remove(com.zeroc.Ice.Util.identityToString(id)); } // @@ -847,13 +812,13 @@ public class Root extends ListArrayTreeNode void addObject(String strProxy, final String type, final JDialog dialog) { - Ice.ObjectPrx proxy = null; + com.zeroc.Ice.ObjectPrx proxy = null; try { proxy = _coordinator.getCommunicator().stringToProxy(strProxy); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog( _coordinator.getMainFrame(), @@ -871,66 +836,48 @@ public class Root extends ListArrayTreeNode JOptionPane.ERROR_MESSAGE); } - String strIdentity = Ice.Util.identityToString(proxy.ice_getIdentity()); + String strIdentity = com.zeroc.Ice.Util.identityToString(proxy.ice_getIdentity()); final String prefix = "Adding well-known object '" + strIdentity + "'..."; final AdminPrx admin = _coordinator.getAdmin(); - Ice.Callback cb = new Ice.Callback() - { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - if(type == null) - { - admin.end_addObject(r); - } - else - { - admin.end_addObjectWithType(r); - } - - amiSuccess(prefix); - - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - dialog.setVisible(false); - } - }); - } - catch(ObjectExistsException e) - { - amiFailure(prefix, "addObject failed", - "An object with this identity is already registered as a well-known object"); - } - catch(DeploymentException ex) - { - amiFailure(prefix, "addObject failed", "Deployment exception: " + ex.reason); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, "addObject failed", ex.toString()); - } - } - }; _coordinator.getStatusBar().setText(prefix); try { + java.util.concurrent.CompletableFuture<Void> r; if(type == null) { - admin.begin_addObject(proxy, cb); + r = admin.addObjectAsync(proxy); } else { - admin.begin_addObjectWithType(proxy, type, cb); + r = admin.addObjectWithTypeAsync(proxy, type); } + r.whenComplete((result, ex) -> + { + if(ex == null) + { + amiSuccess(prefix); + + SwingUtilities.invokeLater(() -> dialog.setVisible(false)); + } + else if(ex instanceof ObjectExistsException) + { + amiFailure(prefix, "addObject failed", + "An object with this identity is already registered as a well-known object"); + } + else if(ex instanceof DeploymentException) + { + amiFailure(prefix, "addObject failed", "Deployment exception: " + + ((DeploymentException)ex).reason); + } + else + { + amiFailure(prefix, "addObject failed", ex.toString()); + } + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, "addObject failed", ex.toString()); } @@ -938,9 +885,9 @@ public class Root extends ListArrayTreeNode void removeObject(String strProxy) { - Ice.ObjectPrx proxy = _coordinator.getCommunicator().stringToProxy(strProxy); - Ice.Identity identity = proxy.ice_getIdentity(); - final String strIdentity = Ice.Util.identityToString(identity); + com.zeroc.Ice.ObjectPrx proxy = _coordinator.getCommunicator().stringToProxy(strProxy); + com.zeroc.Ice.Identity identity = proxy.ice_getIdentity(); + final String strIdentity = com.zeroc.Ice.Util.identityToString(identity); final String prefix = "Removing well-known object '" + strIdentity + "'..."; final String errorTitle = "Failed to remove object '" + strIdentity + "'"; @@ -949,29 +896,12 @@ public class Root extends ListArrayTreeNode try { final AdminPrx admin = _coordinator.getAdmin(); - admin.begin_removeObject(identity, - new Ice.Callback() - { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_removeObject(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } - }); + admin.removeObjectAsync(identity).whenComplete((result, ex) -> + { + amiComplete(prefix, errorTitle, ex); + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -985,32 +915,15 @@ public class Root extends ListArrayTreeNode try { final AdminPrx admin = _coordinator.getAdmin(); - admin.begin_removeAdapter(adapterId, new Ice.Callback() + admin.removeAdapterAsync(adapterId).whenComplete((result, ex) -> { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_removeAdapter(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } + amiComplete(prefix, errorTitle, ex); }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } - } @Override @@ -1021,53 +934,44 @@ public class Root extends ListArrayTreeNode final String prefix = "Retrieving Admin proxy for Registry..."; final String errorTitle = "Failed to retrieve Admin Proxy for Registry"; _coordinator.getStatusBar().setText(prefix); - - Callback_Admin_getRegistryAdmin cb = new Callback_Admin_getRegistryAdmin() + + try { - @Override - public void response(Ice.ObjectPrx prx) - { - final Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(prx.ice_facet("Logger")); - final String title = "Registry " + _label + " Ice log"; - final String defaultFileName = "registry-" + _instanceName + "-" + _replicaName; - - SwingUtilities.invokeLater(new Runnable() + _coordinator.getSession().getAdmin().getRegistryAdminAsync(_replicaName).whenComplete((result, ex) -> { - @Override - public void run() + if(ex == null) + { + final com.zeroc.Ice.LoggerAdminPrx loggerAdmin = + com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(result.ice_facet("Logger")); + final String title = "Registry " + _label + " Ice log"; + final String defaultFileName = "registry-" + _instanceName + "-" + _replicaName; + + SwingUtilities.invokeLater(() -> + { + success(prefix); + if(_showIceLogDialog == null) + { + _showIceLogDialog = new ShowIceLogDialog(Root.this, title, loggerAdmin, + defaultFileName, getLogMaxLines(), + getLogInitialLines()); + } + else + { + _showIceLogDialog.toFront(); + } + }); + } + else if(ex instanceof com.zeroc.Ice.UserException) + { + amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex); + } + else { - success(prefix); - if(_showIceLogDialog == null) - { - _showIceLogDialog = new ShowIceLogDialog(Root.this, title, loggerAdmin, defaultFileName, - getLogMaxLines(), getLogInitialLines()); - } - else - { - _showIceLogDialog.toFront(); - } + amiFailure(prefix, errorTitle, ex.toString()); } }); - } - - @Override - public void exception(Ice.UserException e) - { - amiFailure(prefix, errorTitle, e); - } - - @Override - public void exception(Ice.LocalException e) - { - amiFailure(prefix, errorTitle, e.toString()); - } - }; - - try - { - _coordinator.getSession().getAdmin().begin_getRegistryAdmin(_replicaName, cb); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { failure(prefix, errorTitle, e.toString()); } @@ -1077,7 +981,7 @@ public class Root extends ListArrayTreeNode _showIceLogDialog.toFront(); } } - + @Override public void retrieveOutput(final boolean stdout) { @@ -1120,17 +1024,17 @@ public class Root extends ListArrayTreeNode ApplicationInfo app = _infoMap.get(applicationName); return app.descriptor.propertySets.get(name); } - + void addShowIceLogDialog(String title, ShowIceLogDialog dialog) { _showIceLogDialogMap.put(title, dialog); } - + void removeShowIceLogDialog(String title) { _showIceLogDialogMap.remove(title); } - + void openShowLogFileDialog(ShowLogFileDialog.FileIteratorFactory factory) { ShowLogFileDialog d = _showLogFileDialogMap.get(factory.getTitle()); @@ -1159,14 +1063,14 @@ public class Root extends ListArrayTreeNode p.close(false); } _showIceLogDialogMap.clear(); - + for(ShowLogFileDialog p : _showLogFileDialogMap.values()) { p.close(false); } _showLogFileDialogMap.clear(); } - + public int getMessageSizeMax() { return _messageSizeMax; @@ -1182,25 +1086,25 @@ public class Root extends ListArrayTreeNode storeLogPrefs(); } - + public void setLogPrefs(int maxLines, int initialLines) { _logMaxLines = maxLines; _logInitialLines = initialLines; - + storeLogPrefs(); } - + public int getLogMaxLines() { return _logMaxLines; } - + public int getLogInitialLines() { return _logInitialLines; } - + private void loadLogPrefs() { Preferences logPrefs = _coordinator.getPrefs().node("Log"); @@ -1279,23 +1183,23 @@ public class Root extends ListArrayTreeNode private String _instanceName = ""; private String _replicaName; - private final java.util.List<Node> _nodes = new java.util.LinkedList<Node>(); - private final java.util.List<Slave> _slaves = new java.util.LinkedList<Slave>(); + private final java.util.List<Node> _nodes = new java.util.LinkedList<>(); + private final java.util.List<Slave> _slaves = new java.util.LinkedList<>(); // // Maps application name to current application info // - private final java.util.Map<String, ApplicationInfo> _infoMap = new java.util.TreeMap<String, ApplicationInfo>(); + private final java.util.Map<String, ApplicationInfo> _infoMap = new java.util.TreeMap<>(); // // Map AdapterId => AdapterInfo // - private java.util.SortedMap<String, AdapterInfo> _adapters = new java.util.TreeMap<String, AdapterInfo>(); + private java.util.SortedMap<String, AdapterInfo> _adapters = new java.util.TreeMap<>(); // // Map stringified identity => ObjectInfo // - private java.util.SortedMap<String, ObjectInfo> _objects = new java.util.TreeMap<String, ObjectInfo>(); + private java.util.SortedMap<String, ObjectInfo> _objects = new java.util.TreeMap<>(); // // 'this' is the root of the tree @@ -1314,16 +1218,16 @@ public class Root extends ListArrayTreeNode // ShowLogFileDialog and ShowIceLogFileDialog // private final int _messageSizeMax; - - private final java.util.Map<String, ShowIceLogDialog> _showIceLogDialogMap = new java.util.HashMap<String, ShowIceLogDialog>(); - private final java.util.Map<String, ShowLogFileDialog> _showLogFileDialogMap = new java.util.HashMap<String, ShowLogFileDialog>(); - + + private final java.util.Map<String, ShowIceLogDialog> _showIceLogDialogMap = new java.util.HashMap<>(); + private final java.util.Map<String, ShowLogFileDialog> _showLogFileDialogMap = new java.util.HashMap<>(); + int _logMaxLines; int _logMaxSize; int _logInitialLines; int _logMaxReadSize; int _logPeriod; - + private ShowIceLogDialog _showIceLogDialog; private ApplicationDetailsDialog _applicationDetailsDialog; @@ -1332,7 +1236,6 @@ public class Root extends ListArrayTreeNode static private JPopupMenu _popup; static private DefaultTreeCellRenderer _cellRenderer; - // // Application name to filter, if empty all applications are displayed. // diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Server.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java index cff44ce57e6..af9e19a9867 100755 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Server.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; import java.awt.Cursor; @@ -20,8 +20,8 @@ import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; public class Server extends ListArrayTreeNode { @@ -31,7 +31,7 @@ public class Server extends ListArrayTreeNode @Override public boolean[] getAvailableActions() { - boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; + boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; if(_state != null) { @@ -77,28 +77,12 @@ public class Server extends ListArrayTreeNode try { final AdminPrx admin = getCoordinator().getAdmin(); - admin.begin_startServer(_id, new Ice.Callback() + admin.startServerAsync(_id).whenComplete((result, ex) -> { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_startServer(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } + amiComplete(prefix, errorTitle, ex); }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -108,42 +92,29 @@ public class Server extends ListArrayTreeNode public void stop() { final String prefix = "Stopping server '" + _id + "'..."; - final String errorTitle = "Failed to stop " + _id; + final String errorTitle = "Failed to stop " + _id; getCoordinator().getStatusBar().setText(prefix); try { final AdminPrx admin = getCoordinator().getAdmin(); - admin.begin_stopServer(_id, - new Ice.Callback() + admin.stopServerAsync(_id).whenComplete((result, ex) -> + { + if(ex == null) { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_stopServer(r); - amiSuccess(prefix); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - rebuild(Server.this, false); - } - }); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } - }); + amiSuccess(prefix); + SwingUtilities.invokeLater(() -> rebuild(Server.this, false)); + } + else if(ex instanceof com.zeroc.Ice.UserException) + { + amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex); + } + else + { + amiFailure(prefix, errorTitle, ex.toString()); + } + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -176,25 +147,26 @@ public class Server extends ListArrayTreeNode { if(_showIceLogDialog == null) { - Ice.ObjectPrx serverAdmin = getServerAdmin(); + com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin(); if(serverAdmin == null) { - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available", + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available", "No Admin for server " + _id, JOptionPane.ERROR_MESSAGE); return; } - - Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("Logger")); + + com.zeroc.Ice.LoggerAdminPrx loggerAdmin = + com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(serverAdmin.ice_facet("Logger")); String title = "Server " + _id + " Ice log"; _showIceLogDialog = new ShowIceLogDialog(this, title, loggerAdmin, _id, getRoot().getLogMaxLines(), - getRoot().getLogInitialLines()); - } + getRoot().getLogInitialLines()); + } else { _showIceLogDialog.toFront(); } } - + @Override public void retrieveOutput(final boolean stdout) { @@ -252,7 +224,7 @@ public class Server extends ListArrayTreeNode pathArray[i++] = _resolver.substitute(log); } - path = (String)JOptionPane.showInputDialog( + path = (String)JOptionPane.showInputDialog( getCoordinator().getMainFrame(), "Which log file do you want to retrieve?", "Retrieve Log File", @@ -299,29 +271,12 @@ public class Server extends ListArrayTreeNode try { final AdminPrx admin = getCoordinator().getAdmin(); - admin.begin_sendSignal(_id, s, - new Ice.Callback() - { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_sendSignal(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } - }); + admin.sendSignalAsync(_id, s).whenComplete((result, ex) -> + { + amiComplete(prefix, errorTitle, ex); + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -355,29 +310,12 @@ public class Server extends ListArrayTreeNode try { final AdminPrx admin = getCoordinator().getAdmin(); - admin.begin_patchServer(_id, shutdown == JOptionPane.YES_OPTION, - new Ice.Callback() + admin.patchServerAsync(_id, shutdown == JOptionPane.YES_OPTION).whenComplete((result, ex) -> { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_patchServer(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } + amiComplete(prefix, errorTitle, ex); }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -391,29 +329,12 @@ public class Server extends ListArrayTreeNode try { final AdminPrx admin = getCoordinator().getAdmin(); - admin.begin_enableServer(_id, enable, - new Ice.Callback() + admin.enableServerAsync(_id, enable).whenComplete((result, ex) -> { - @Override - public void completed(final Ice.AsyncResult r) - { - try - { - admin.end_enableServer(r); - amiSuccess(prefix); - } - catch(Ice.UserException ex) - { - amiFailure(prefix, errorTitle, ex); - } - catch(Ice.LocalException ex) - { - amiFailure(prefix, errorTitle, ex.toString()); - } - } + amiComplete(prefix, errorTitle, ex); }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { failure(prefix, errorTitle, ex.toString()); } @@ -426,70 +347,60 @@ public class Server extends ListArrayTreeNode return; // Already loaded. } - Ice.ObjectPrx admin = getServerAdmin(); + com.zeroc.Ice.ObjectPrx admin = getServerAdmin(); if(admin == null) { return; } _metricsRetrieved = true; - final IceMX.MetricsAdminPrx metricsAdmin = - IceMX.MetricsAdminPrxHelper.uncheckedCast(admin.ice_facet("Metrics")); - IceMX.Callback_MetricsAdmin_getMetricsViewNames cb = new IceMX.Callback_MetricsAdmin_getMetricsViewNames() - { - @Override - public void response(final String[] enabledViews, final String[] disabledViews) + final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = + com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(admin.ice_facet("Metrics")); + try + { + metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) -> { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + if(ex == null) + { + SwingUtilities.invokeLater(() -> { - for(String name : enabledViews) + for(String name : result.returnValue) { - insertSortedChild(new MetricsView(Server.this, name, metricsAdmin, true), _metrics, null); + insertSortedChild( + new MetricsView(Server.this, name, metricsAdmin, true), _metrics, null); } - for(String name : disabledViews) + for(String name : result.disabledViews) { - insertSortedChild(new MetricsView(Server.this, name, metricsAdmin, false), _metrics, null); + insertSortedChild( + new MetricsView(Server.this, name, metricsAdmin, false), _metrics, null); } rebuild(Server.this, false); - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + }); + } + else + { + SwingUtilities.invokeLater(() -> { _metricsRetrieved = false; - if(e instanceof Ice.ObjectNotExistException) + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) { // Server is down. } - else if(e instanceof Ice.FacetNotExistException) + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) { // MetricsAdmin facet not present. Old server version? } else { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", + ex.printStackTrace(); + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), + "Error: " + ex.toString(), "Error", JOptionPane.ERROR_MESSAGE); } - } - }); - } - }; - try - { - metricsAdmin.begin_getMetricsViewNames(cb); + }); + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { _metricsRetrieved = false; JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error", @@ -499,7 +410,7 @@ public class Server extends ListArrayTreeNode void showRuntimeProperties() { - Ice.ObjectPrx serverAdmin = getServerAdmin(); + com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin(); if(serverAdmin == null) { @@ -507,58 +418,44 @@ public class Server extends ListArrayTreeNode } else { - Ice.Callback_PropertiesAdmin_getPropertiesForPrefix cb = new Ice.Callback_PropertiesAdmin_getPropertiesForPrefix() - { - @Override - public void response(final java.util.Map<String, String> properties) + try + { + com.zeroc.Ice.PropertiesAdminPrx propAdmin = + com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(serverAdmin.ice_facet("Properties")); + propAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) -> { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + if(ex == null) + { + SwingUtilities.invokeLater(() -> { - _editor.setRuntimeProperties((java.util.SortedMap<String, String>)properties, + _editor.setRuntimeProperties((java.util.SortedMap<String, String>)result, Server.this); - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + }); + } + else + { + SwingUtilities.invokeLater(() -> { - if(e instanceof Ice.ObjectNotExistException) + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) { _editor.setBuildId("Error: can't reach this server's Admin object", Server.this); } - else if(e instanceof Ice.FacetNotExistException) + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) { _editor.setBuildId("Error: this server's Admin object does not provide a " + "'Properties' facet", Server.this); } else { - e.printStackTrace(); - _editor.setBuildId("Error: " + e.toString(), Server.this); + ex.printStackTrace(); + _editor.setBuildId("Error: " + ex.toString(), Server.this); } - } - }); - } - }; - - - try - { - Ice.PropertiesAdminPrx propAdmin = - Ice.PropertiesAdminPrxHelper.uncheckedCast(serverAdmin.ice_facet("Properties")); - propAdmin.begin_getPropertiesForPrefix("", cb); + }); + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { _editor.setBuildId("Error: " + e.toString(), this); } @@ -665,7 +562,7 @@ public class Server extends ListArrayTreeNode // IceBox servers // _icons[0][1][0] = Utils.getIcon("/icons/16x16/icebox_server_unknown.png"); - _icons[ServerState.Inactive.value() + 1][1][0] = + _icons[ServerState.Inactive.value() + 1][1][0] = Utils.getIcon("/icons/16x16/icebox_server_inactive.png"); _icons[ServerState.Activating.value() + 1][1][0] = Utils.getIcon("/icons/16x16/icebox_server_activating.png"); @@ -738,7 +635,7 @@ public class Server extends ListArrayTreeNode { _showIceLogDialog = null; } - + Server(Node parent, String serverId, Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor, ServerDescriptor serverDescriptor, ApplicationDescriptor application, ServerState state, int pid, boolean enabled) @@ -876,7 +773,7 @@ public class Server extends ListArrayTreeNode } updateServices(); - + getRoot().getTreeModel().nodeStructureChanged(this); if(fetchMetrics) @@ -952,7 +849,7 @@ public class Server extends ListArrayTreeNode { _stateIconIndex = _state.value() + 1; } - + if(_state == ServerState.Active && getRoot().getTree().isExpanded(getPath())) { fetchMetricsViewNames(); @@ -966,7 +863,7 @@ public class Server extends ListArrayTreeNode rebuild(this, false); } } - + if(_state == ServerState.Inactive) { if(_showIceLogDialog != null) @@ -981,64 +878,56 @@ public class Server extends ListArrayTreeNode { if(_serviceObserver == null) { - _serviceObserver = IceBox.ServiceObserverPrxHelper.uncheckedCast( + _serviceObserver = com.zeroc.IceBox.ServiceObserverPrx.uncheckedCast( getCoordinator().retrieveCallback(_id, "IceBox.ServiceManager")); if(_serviceObserver == null) { - IceBox.ServiceObserver servant = new IceBox._ServiceObserverDisp() + com.zeroc.IceBox.ServiceObserver servant = new com.zeroc.IceBox.ServiceObserver() { @Override - public void servicesStarted(final String[] services, Ice.Current current) + public void servicesStarted(final String[] services, com.zeroc.Ice.Current current) { final java.util.Set<String> serviceSet = - new java.util.HashSet<String>(java.util.Arrays.asList(services)); + new java.util.HashSet<>(java.util.Arrays.asList(services)); - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + for(Service service: _services) { - for(Service service: _services) + if(serviceSet.contains(service.getId())) { - if(serviceSet.contains(service.getId())) - { - service.started(); - } + service.started(); } - _startedServices.addAll(serviceSet); - getCoordinator().getLiveDeploymentPane().refresh(); } + _startedServices.addAll(serviceSet); + getCoordinator().getLiveDeploymentPane().refresh(); }); } @Override - public void servicesStopped(final String[] services, Ice.Current current) + public void servicesStopped(final String[] services, com.zeroc.Ice.Current current) { final java.util.Set<String> serviceSet = - new java.util.HashSet<String>(java.util.Arrays.asList(services)); + new java.util.HashSet<>(java.util.Arrays.asList(services)); - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + for(Service service: _services) { - for(Service service: _services) + if(serviceSet.contains(service.getId())) { - if(serviceSet.contains(service.getId())) - { - service.stopped(); - } + service.stopped(); } - _startedServices.removeAll(serviceSet); - getCoordinator().getLiveDeploymentPane().refresh(); } + _startedServices.removeAll(serviceSet); + getCoordinator().getLiveDeploymentPane().refresh(); }); } }; - _serviceObserver = IceBox.ServiceObserverPrxHelper.uncheckedCast( + _serviceObserver = com.zeroc.IceBox.ServiceObserverPrx.uncheckedCast( getCoordinator().addCallback(servant, _id, "IceBox.ServiceManager")); if(_serviceObserver == null) @@ -1059,37 +948,28 @@ public class Server extends ListArrayTreeNode // Note that duplicate registrations are ignored // - IceBox.Callback_ServiceManager_addObserver cb = new IceBox.Callback_ServiceManager_addObserver() - { - @Override - public void response() - { - // all is good - } - - @Override - public void exception(Ice.LocalException e) - { - JOptionPane.showMessageDialog( - getCoordinator().getMainFrame(), - "Failed to register service-manager observer: " + e.toString(), - "Observer registration error", - JOptionPane.ERROR_MESSAGE); - } - }; - - Ice.ObjectPrx serverAdmin = getServerAdmin(); + com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin(); if(serverAdmin != null) { - IceBox.ServiceManagerPrx serviceManager = - IceBox.ServiceManagerPrxHelper.uncheckedCast( + com.zeroc.IceBox.ServiceManagerPrx serviceManager = + com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast( serverAdmin.ice_facet("IceBox.ServiceManager")); try { - serviceManager.begin_addObserver(_serviceObserver, cb); + serviceManager.addObserverAsync(_serviceObserver).whenComplete((result, ex) -> + { + if(ex != null) + { + JOptionPane.showMessageDialog( + getCoordinator().getMainFrame(), + "Failed to register service-manager observer: " + ex.toString(), + "Observer registration error", + JOptionPane.ERROR_MESSAGE); + } + }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { JOptionPane.showMessageDialog( getCoordinator().getMainFrame(), @@ -1109,7 +989,7 @@ public class Server extends ListArrayTreeNode } } } - + if(fireEvent) { getRoot().getTreeModel().nodeChanged(this); @@ -1188,7 +1068,7 @@ public class Server extends ListArrayTreeNode java.util.SortedMap<String, String> getProperties() { - java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<Utils.ExpandedPropertySet>(); + java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<>(); Node node = (Node)_parent; psList.add(node.expand(_serverDescriptor.propertySet, _application.name, _resolver)); @@ -1212,7 +1092,7 @@ public class Server extends ListArrayTreeNode { String adapterName = Utils.substitute(p.name, _resolver); String adapterId = Utils.substitute(p.id, _resolver); - Ice.ObjectPrx proxy = null; + com.zeroc.Ice.ObjectPrx proxy = null; if(adapterId.length() > 0) { proxy = ((Node)_parent).getProxy(adapterId); @@ -1290,7 +1170,7 @@ public class Server extends ListArrayTreeNode serverInstancePSDescriptor)); } - Ice.ObjectPrx getServerAdmin() + com.zeroc.Ice.ObjectPrx getServerAdmin() { if(_state != ServerState.Active) { @@ -1303,7 +1183,7 @@ public class Server extends ListArrayTreeNode } else { - Ice.Identity adminId = new Ice.Identity(_id, getCoordinator().getServerAdminCategory()); + com.zeroc.Ice.Identity adminId = new com.zeroc.Ice.Identity(_id, getCoordinator().getServerAdminCategory()); return admin.ice_identity(adminId); } } @@ -1327,23 +1207,23 @@ public class Server extends ListArrayTreeNode public java.util.List<MetricsView> getMetrics() { - return new java.util.ArrayList<MetricsView>(_metrics); + return new java.util.ArrayList<>(_metrics); } private ServerInstanceDescriptor _instanceDescriptor; private java.util.Map<String, PropertySetDescriptor> _servicePropertySets = - new java.util.HashMap<String, PropertySetDescriptor>(); // with substituted names! + new java.util.HashMap<>(); // with substituted names! private ServerDescriptor _serverDescriptor; private ApplicationDescriptor _application; private Utils.Resolver _resolver; - private java.util.List<Adapter> _adapters = new java.util.LinkedList<Adapter>(); - private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<DbEnv>(); - private java.util.List<Service> _services = new java.util.LinkedList<Service>(); - private java.util.List<MetricsView> _metrics = new java.util.LinkedList<MetricsView>(); + private java.util.List<Adapter> _adapters = new java.util.LinkedList<>(); + private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<>(); + private java.util.List<Service> _services = new java.util.LinkedList<>(); + private java.util.List<MetricsView> _metrics = new java.util.LinkedList<>(); - private java.util.Set<String> _startedServices = new java.util.HashSet<String>(); + private java.util.Set<String> _startedServices = new java.util.HashSet<>(); private ServerState _state; private boolean _enabled; @@ -1352,7 +1232,7 @@ public class Server extends ListArrayTreeNode private String _toolTip; private boolean _metricsRetrieved = false; - private IceBox.ServiceObserverPrx _serviceObserver; + private com.zeroc.IceBox.ServiceObserverPrx _serviceObserver; private ShowIceLogDialog _showIceLogDialog; static private DefaultTreeCellRenderer _cellRenderer; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java index 43f6e759228..85f15377ab4 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServerEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.event.ActionEvent; @@ -28,8 +28,8 @@ import com.jgoodies.looks.HeaderStyle; import com.jgoodies.looks.BorderStyle; import com.jgoodies.looks.plastic.PlasticLookAndFeel; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServerEditor extends CommunicatorEditor { @@ -165,7 +165,6 @@ class ServerEditor extends CommunicatorEditor _iceVersion.setText(resolver.substitute(descriptor.iceVersion)); _pwd.setText(resolver.substitute(descriptor.pwd)); - Ice.StringHolder toolTipHolder = new Ice.StringHolder(); Utils.Stringifier stringifier = new Utils.Stringifier() { @Override @@ -175,8 +174,9 @@ class ServerEditor extends CommunicatorEditor } }; - _options.setText(Utils.stringify(descriptor.options, stringifier, " ", toolTipHolder)); - _options.setToolTipText(toolTipHolder.value); + Utils.StringifyResult r = Utils.stringify(descriptor.options, stringifier, " "); + _options.setText(r.returnValue); + _options.setToolTipText(r.toolTip); _envs.setEnvs(descriptor.envs, resolver); @@ -191,17 +191,14 @@ class ServerEditor extends CommunicatorEditor _applicationDistrib.setSelected(descriptor.applicationDistrib); _icepatch.setText(resolver.substitute(resolver.substitute(descriptor.distrib.icepatch))); - toolTipHolder = new Ice.StringHolder(); - - _directories.setText( - Utils.stringify(descriptor.distrib.directories, stringifier, ", ", - toolTipHolder)); + r = Utils.stringify(descriptor.distrib.directories, stringifier, ", "); + _directories.setText(r.returnValue); String toolTip = "<html>Include only these directories"; - if(toolTipHolder.value != null) + if(r.toolTip != null) { - toolTip += ":<br>" + toolTipHolder.value; + toolTip += ":<br>" + r.toolTip; } toolTip += "</html>"; _directories.setToolTipText(toolTip); @@ -406,4 +403,3 @@ class ServerEditor extends CommunicatorEditor private JToolBar _toolBar; } - diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Service.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java index 0e9c108595f..64451a9a5be 100755 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Service.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; @@ -18,8 +18,8 @@ import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; public class Service extends ListArrayTreeNode { @@ -29,7 +29,7 @@ public class Service extends ListArrayTreeNode @Override public boolean[] getAvailableActions() { - boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; + boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; ServerState serverState = ((Server)_parent).getState(); @@ -58,52 +58,31 @@ public class Service extends ListArrayTreeNode @Override public void start() { - Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin(); + com.zeroc.Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin(); if(serverAdmin != null) { final String prefix = "Starting service '" + _id + "'..."; getCoordinator().getStatusBar().setText(prefix); - IceBox.Callback_ServiceManager_startService cb = new IceBox.Callback_ServiceManager_startService() - { - // - // Called by another thread! - // - @Override - public void response() - { - amiSuccess(prefix); - } - - @Override - public void exception(Ice.UserException e) - { - if(e instanceof IceBox.AlreadyStartedException) - { - amiSuccess(prefix); - } - else - { - amiFailure(prefix, "Failed to start service " + _id, e.toString()); - } - } - - @Override - public void exception(Ice.LocalException e) - { - amiFailure(prefix, "Failed to start service " + _id, e.toString()); - } - }; - - IceBox.ServiceManagerPrx serviceManager = IceBox.ServiceManagerPrxHelper. - uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager")); + com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast( + serverAdmin.ice_facet("IceBox.ServiceManager")); try { - serviceManager.begin_startService(_id, cb); + serviceManager.startServiceAsync(_id).whenComplete((result, ex) -> + { + if(ex == null || ex instanceof com.zeroc.IceBox.AlreadyStartedException) + { + amiSuccess(prefix); + } + else + { + amiFailure(prefix, "Failed to start service " + _id, ex.toString()); + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { failure(prefix, "Failed to start service " + _id, e.toString()); } @@ -113,52 +92,31 @@ public class Service extends ListArrayTreeNode @Override public void stop() { - Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin(); + com.zeroc.Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin(); if(serverAdmin != null) { final String prefix = "Stopping service '" + _id + "'..."; getCoordinator().getStatusBar().setText(prefix); - IceBox.Callback_ServiceManager_stopService cb = new IceBox.Callback_ServiceManager_stopService() - { - // - // Called by another thread! - // - @Override - public void response() - { - amiSuccess(prefix); - } - - @Override - public void exception(Ice.UserException e) - { - if(e instanceof IceBox.AlreadyStoppedException) - { - amiSuccess(prefix); - } - else - { - amiFailure(prefix, "Failed to stop service " + _id, e.toString()); - } - } - - @Override - public void exception(Ice.LocalException e) - { - amiFailure(prefix, "Failed to stop service " + _id, e.toString()); - } - }; - - IceBox.ServiceManagerPrx serviceManager = IceBox.ServiceManagerPrxHelper. - uncheckedCast(serverAdmin.ice_facet("IceBox.ServiceManager")); + com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast( + serverAdmin.ice_facet("IceBox.ServiceManager")); try { - serviceManager.begin_stopService(_id, cb); + serviceManager.stopServiceAsync(_id).whenComplete((result, ex) -> + { + if(ex == null || ex instanceof com.zeroc.IceBox.AlreadyStoppedException) + { + amiSuccess(prefix); + } + else + { + amiFailure(prefix, "Failed to stop service " + _id, ex.toString()); + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { failure(prefix, "Failed to stop service " + _id, e.toString()); } @@ -170,7 +128,8 @@ public class Service extends ListArrayTreeNode { if(_showIceLogDialog == null) { - Ice.LoggerAdminPrx loggerAdmin = Ice.LoggerAdminPrxHelper.uncheckedCast(getAdminFacet("Logger")); + com.zeroc.Ice.LoggerAdminPrx loggerAdmin = + com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(getAdminFacet("Logger")); if(loggerAdmin == null) { JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available", @@ -314,7 +273,6 @@ public class Service extends ListArrayTreeNode _showIceLogDialog = null; } - Service(Server parent, String serviceName, Utils.Resolver resolver, ServiceInstanceDescriptor descriptor, ServiceDescriptor serviceDescriptor, PropertySetDescriptor serverInstancePSDescriptor) { @@ -411,60 +369,48 @@ public class Service extends ListArrayTreeNode void showRuntimeProperties() { - Ice.PropertiesAdminPrx propAdmin = Ice.PropertiesAdminPrxHelper.uncheckedCast(getAdminFacet("Properties")); + com.zeroc.Ice.PropertiesAdminPrx propAdmin = + com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(getAdminFacet("Properties")); if(propAdmin == null) { _editor.setBuildId("", this); } else { - Ice.Callback_PropertiesAdmin_getPropertiesForPrefix cb = new Ice.Callback_PropertiesAdmin_getPropertiesForPrefix() - { - @Override - public void response(final java.util.Map<String, String> properties) + try + { + propAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) -> { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + if(ex == null) + { + SwingUtilities.invokeLater(() -> { - _editor.setRuntimeProperties((java.util.SortedMap<String, String>)properties, + _editor.setRuntimeProperties((java.util.SortedMap<String, String>)result, Service.this); - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + }); + } + else + { + SwingUtilities.invokeLater(() -> { - if(e instanceof Ice.ObjectNotExistException) + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) { _editor.setBuildId("Error: can't reach the icebox Admin object", Service.this); } - else if(e instanceof Ice.FacetNotExistException) + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) { _editor.setBuildId("Error: this icebox Admin object does not provide a " + "'Properties' facet for this service", Service.this); } else { - _editor.setBuildId("Error: " + e.toString(), Service.this); + _editor.setBuildId("Error: " + ex.toString(), Service.this); } - } - }); - } - }; - - try - { - propAdmin.begin_getPropertiesForPrefix("", cb); + }); + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { _editor.setBuildId("Error: " + e.toString(), this); } @@ -488,7 +434,7 @@ public class Service extends ListArrayTreeNode java.util.SortedMap<String, String> getProperties() { - java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<Utils.ExpandedPropertySet>(); + java.util.List<Utils.ExpandedPropertySet> psList = new java.util.LinkedList<>(); Node node = (Node)_parent.getParent(); String applicationName = ((Server)_parent).getApplication().name; @@ -516,7 +462,7 @@ public class Service extends ListArrayTreeNode String adapterName = Utils.substitute(p.name, _resolver); String adapterId = Utils.substitute(p.id, _resolver); - Ice.ObjectPrx proxy = null; + com.zeroc.Ice.ObjectPrx proxy = null; if(adapterId.length() > 0) { proxy = ((Node)_parent.getParent()).getProxy(adapterId); @@ -542,69 +488,57 @@ public class Service extends ListArrayTreeNode return; // Already loaded. } - final IceMX.MetricsAdminPrx metricsAdmin = IceMX.MetricsAdminPrxHelper.uncheckedCast(getAdminFacet("Metrics")); + final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin = + com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(getAdminFacet("Metrics")); if(metricsAdmin == null) { return; } _metricsRetrieved = true; - IceMX.Callback_MetricsAdmin_getMetricsViewNames cb = new IceMX.Callback_MetricsAdmin_getMetricsViewNames() - { - @Override - public void response(final String[] enabledViews, final String[] disabledViews) + try + { + metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) -> { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + if(ex == null) + { + SwingUtilities.invokeLater(() -> { - for(String name : enabledViews) + for(String name : result.returnValue) { - insertSortedChild(new MetricsView(Service.this, name, metricsAdmin, true), _metrics, null); + insertSortedChild( + new MetricsView(Service.this, name, metricsAdmin, true), _metrics, null); } - for(String name : disabledViews) + for(String name : result.disabledViews) { - insertSortedChild(new MetricsView(Service.this, name, metricsAdmin, false), _metrics, null); + insertSortedChild( + new MetricsView(Service.this, name, metricsAdmin, false), _metrics, null); } rebuild(Service.this); - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - SwingUtilities.invokeLater(new Runnable() + }); + } + else + { + _metricsRetrieved = false; + if(ex instanceof com.zeroc.Ice.ObjectNotExistException) { - @Override - public void run() - { - _metricsRetrieved = false; - if(e instanceof Ice.ObjectNotExistException) - { - // Server is down. - } - else if(e instanceof Ice.FacetNotExistException) - { - // MetricsAdmin facet not present. Old server version? - } - else - { - e.printStackTrace(); - JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), - "Error: " + e.toString(), "Error", - JOptionPane.ERROR_MESSAGE); - } - } - }); - } - }; - try - { - metricsAdmin.begin_getMetricsViewNames(cb); + // Server is down. + } + else if(ex instanceof com.zeroc.Ice.FacetNotExistException) + { + // MetricsAdmin facet not present. Old server version? + } + else + { + ex.printStackTrace(); + JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), + "Error: " + ex.toString(), "Error", + JOptionPane.ERROR_MESSAGE); + } + } + }); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { _metricsRetrieved = false; JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error", @@ -642,10 +576,10 @@ public class Service extends ListArrayTreeNode getRoot().getTreeModel().nodeStructureChanged(this); } - private Ice.ObjectPrx getAdminFacet(String facet) + private com.zeroc.Ice.ObjectPrx getAdminFacet(String facet) { Server parent = (Server)_parent; - Ice.ObjectPrx serverAdmin = parent.getServerAdmin(); + com.zeroc.Ice.ObjectPrx serverAdmin = parent.getServerAdmin(); if(serverAdmin == null) { return null; @@ -668,9 +602,9 @@ public class Service extends ListArrayTreeNode private final PropertySetDescriptor _serverInstancePSDescriptor; private final Utils.Resolver _resolver; - private java.util.List<Adapter> _adapters = new java.util.LinkedList<Adapter>(); - private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<DbEnv>(); - private java.util.List<MetricsView> _metrics = new java.util.LinkedList<MetricsView>(); + private java.util.List<Adapter> _adapters = new java.util.LinkedList<>(); + private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<>(); + private java.util.List<MetricsView> _metrics = new java.util.LinkedList<>(); private boolean _started = false; private boolean _metricsRetrieved = false; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServiceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java index a34b6ee04af..477b9f78ed7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ServiceEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.event.ActionEvent; @@ -27,8 +27,8 @@ import com.jgoodies.looks.HeaderStyle; import com.jgoodies.looks.BorderStyle; import com.jgoodies.looks.plastic.PlasticLookAndFeel; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ServiceEditor extends CommunicatorEditor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowIceLogDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java index e34965c40ce..f99cc2144a0 100755 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowIceLogDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowIceLogDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.BorderLayout; import java.awt.Color; @@ -39,13 +39,13 @@ import com.jgoodies.looks.HeaderStyle; import com.jgoodies.looks.Options; import com.jgoodies.looks.plastic.PlasticLookAndFeel; -import Ice.Current; -import Ice.LocalException; -import Ice.LogMessage; -import Ice.LogMessageType; -import Ice.RemoteLoggerPrxHelper; -import Ice.UserException; -import IceGridGUI.*; +import com.zeroc.Ice.Current; +import com.zeroc.Ice.LocalException; +import com.zeroc.Ice.LogMessage; +import com.zeroc.Ice.LogMessageType; +import com.zeroc.Ice.RemoteLoggerPrx; +import com.zeroc.Ice.UserException; +import com.zeroc.IceGridGUI.*; class ShowIceLogDialog extends JDialog { @@ -85,7 +85,8 @@ class ShowIceLogDialog extends JDialog { JFileChooser fileChooser = _parent.getRoot().getCoordinator().getSaveIceLogChooser(); - fileChooser.setSelectedFile(new java.io.File(fileChooser.getCurrentDirectory(), _defaultFileName + ".csv")); + fileChooser.setSelectedFile( + new java.io.File(fileChooser.getCurrentDirectory(), _defaultFileName + ".csv")); java.io.File file = null; @@ -108,7 +109,7 @@ class ShowIceLogDialog extends JDialog try { os = new java.io.OutputStreamWriter(new java.io.FileOutputStream(file)); - + for(Object p : _tableModel.getDataVector()) { @SuppressWarnings("unchecked") @@ -117,7 +118,7 @@ class ShowIceLogDialog extends JDialog renderLogMessageType((LogMessageType) row.elementAt(1)) + ",\"" + row.elementAt(2).toString().replace("\"", "\"\"") + "\",\"" + row.elementAt(3).toString().replace("\"", "\"\"") + "\""; - + txt += "\r\n"; os.write(txt, 0, txt.length()); } @@ -178,15 +179,15 @@ class ShowIceLogDialog extends JDialog for(int i : _table.getSelectedRows()) { int j = _table.convertRowIndexToModel(i); - + txt += renderDate((java.util.Date)_tableModel.getValueAt(j, 0)) + "\t" + renderLogMessageType((LogMessageType)_tableModel.getValueAt(j, 1)) + "\t" + _tableModel.getValueAt(j, 2).toString() + "\t" + renderMessage(_tableModel.getValueAt(j, 3).toString()) + "\n"; } - + java.awt.datatransfer.StringSelection ss = new java.awt.datatransfer.StringSelection(txt); - + java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null); } @@ -194,7 +195,7 @@ class ShowIceLogDialog extends JDialog copy.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK)); copy.putValue(Action.SHORT_DESCRIPTION, "Copy"); _table.getActionMap().put("copy", copy); - + editMenu.add(copy); editMenu.addSeparator(); @@ -260,26 +261,27 @@ class ShowIceLogDialog extends JDialog bg.add(_stopButton); } } - - private class RemoteLoggerI extends Ice._RemoteLoggerDisp + + private class RemoteLoggerI implements com.zeroc.Ice.RemoteLogger { @Override public synchronized void init(String prefix, LogMessage[] logMessages, Current current) - { + { // Ignore prefix - + if(!_destroyed) - { - _rowCount = logMessages.length + _queue.size() < _maxRows ? logMessages.length + _queue.size() : _maxRows; + { + _rowCount = logMessages.length + + _queue.size() < _maxRows ? logMessages.length + _queue.size() : _maxRows; final Object[][] data = new Object[_rowCount][]; - + int i = _rowCount - 1; - + for(java.util.Iterator<LogMessage> p = _queue.descendingIterator(); p.hasNext() && i >= 0; i--) { data[i] = logMessageToRow(p.next()); } - + int j = logMessages.length - 1; while(i >= 0 && j >= 0) { @@ -287,23 +289,18 @@ class ShowIceLogDialog extends JDialog i--; j--; } - + _queue.clear(); _paused = false; - - SwingUtilities.invokeLater( - new Runnable() - { - @Override - public void run() - { - _tableModel.setDataVector(data, _columnNames); - _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true)); - _pause.setEnabled(true); - } - }); + + SwingUtilities.invokeLater(() -> + { + _tableModel.setDataVector(data, _columnNames); + _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true)); + _pause.setEnabled(true); + }); } - + } @Override @@ -327,40 +324,34 @@ class ShowIceLogDialog extends JDialog showLogMessage(message); } } - + private synchronized void setMaxRows(int maxRows) { _maxRows = maxRows; - + final int rowsToRemove = _rowCount - _maxRows; - + if(rowsToRemove > 0) { _rowCount -= rowsToRemove; - - SwingUtilities.invokeLater( - new Runnable() + + SwingUtilities.invokeLater(() -> + { + int i = rowsToRemove; + while(i-- > 0) { - @Override - public void run() - { - - int i = rowsToRemove; - while(i-- > 0) - { - _tableModel.removeRow(0); - } - } + _tableModel.removeRow(0); + } }); } } - + private synchronized void pause() { assert(!_destroyed); _paused = true; } - + private synchronized void play() { assert(!_destroyed); @@ -371,50 +362,45 @@ class ShowIceLogDialog extends JDialog _queue.clear(); _paused = false; } - + private synchronized void stop() { _destroyed = true; } - + private void showLogMessage(LogMessage msg) { final Object[] row = logMessageToRow(msg); _rowCount++; - final int rowsToRemove = _rowCount - _maxRows; + final int rowsToRemove = _rowCount - _maxRows; if(rowsToRemove > 0) { _rowCount -= rowsToRemove; } - - SwingUtilities.invokeLater( - new Runnable() + + SwingUtilities.invokeLater(() -> + { + _tableModel.addRow(row); + int i = rowsToRemove; + while(i-- > 0) { - @Override - public void run() - { - _tableModel.addRow(row); - int i = rowsToRemove; - while(i-- > 0) - { - _tableModel.removeRow(0); - } - _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true)); - } - }); + _tableModel.removeRow(0); + } + _table.scrollRectToVisible(_table.getCellRect(_table.getRowCount() - 1, 0, true)); + }); } - + private boolean _paused = true; private boolean _destroyed = false; - private final java.util.Deque<LogMessage> _queue = new java.util.ArrayDeque<LogMessage>(); + private final java.util.Deque<LogMessage> _queue = new java.util.ArrayDeque<>(); private int _rowCount = 0; private int _maxRows = _maxMessages; } - - static private class DateRenderer extends DefaultTableCellRenderer + + static private class DateRenderer extends DefaultTableCellRenderer { @Override - public void setValue(Object value) + public void setValue(Object value) { if(value == null) { @@ -426,11 +412,11 @@ class ShowIceLogDialog extends JDialog } } } - - static private class LogMessageTypeRenderer extends DefaultTableCellRenderer + + static private class LogMessageTypeRenderer extends DefaultTableCellRenderer { @Override - public void setValue(Object value) + public void setValue(Object value) { if(value == null) { @@ -442,11 +428,11 @@ class ShowIceLogDialog extends JDialog } } } - - static private class MessageRenderer extends DefaultTableCellRenderer + + static private class MessageRenderer extends DefaultTableCellRenderer { @Override - public void setValue(Object value) + public void setValue(Object value) { if(value == null) { @@ -458,8 +444,9 @@ class ShowIceLogDialog extends JDialog } } } - - ShowIceLogDialog(TreeNode parent, String title, Ice.LoggerAdminPrx loggerAdmin, String defaultFileName, int maxMessages, int initialMessages) + + ShowIceLogDialog(TreeNode parent, String title, com.zeroc.Ice.LoggerAdminPrx loggerAdmin, String defaultFileName, + int maxMessages, int initialMessages) { super(parent.getRoot().getCoordinator().getMainFrame(), title + " - IceGrid Admin", false); @@ -469,7 +456,7 @@ class ShowIceLogDialog extends JDialog _defaultFileName = defaultFileName; _maxMessages = maxMessages; _initialMessages = initialMessages; - + setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { @@ -506,24 +493,24 @@ class ShowIceLogDialog extends JDialog stop(); } }; - - + _tableModel = new DefaultTableModel(_columnNames, 0) { @Override public boolean isCellEditable(int row, int column) { return false; - } - }; - + } + }; + _table = new JTable(_tableModel) { @Override - public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, int row, int column) + public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer, + int row, int column) { java.awt.Component c = super.prepareRenderer(renderer, row, column); - + if (!isRowSelected(row)) { int modelRow = convertRowIndexToModel(row); @@ -536,7 +523,7 @@ class ShowIceLogDialog extends JDialog { c.setBackground(Color.RED); break; - } + } case WarningMessage: { c.setBackground(Color.ORANGE); @@ -557,7 +544,7 @@ class ShowIceLogDialog extends JDialog } return c; } - + @Override public String getToolTipText(java.awt.event.MouseEvent e) { @@ -565,9 +552,9 @@ class ShowIceLogDialog extends JDialog java.awt.Point p = e.getPoint(); int row = rowAtPoint(p); int col = columnAtPoint(p); - + if(col == 3 && row >= 0) // Log message - { + { Object obj = getValueAt(row, col); if(obj != null) { @@ -576,7 +563,6 @@ class ShowIceLogDialog extends JDialog } return tip; } - }; _table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); @@ -603,7 +589,7 @@ class ShowIceLogDialog extends JDialog { _table.setRowHeight(minRowHeight); } - + _table.setRowSelectionAllowed(true); _table.setOpaque(false); _table.setPreferredScrollableViewportSize(new Dimension(800, 400)); @@ -611,7 +597,7 @@ class ShowIceLogDialog extends JDialog setJMenuBar(new MenuBar()); getContentPane().add(new ToolBar(), BorderLayout.PAGE_START); - + JScrollPane scrollPane = new JScrollPane(_table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); @@ -622,11 +608,11 @@ class ShowIceLogDialog extends JDialog setResizable(true); setLocationRelativeTo(_parent.getRoot().getCoordinator().getMainFrame()); - + _parent.getRoot().addShowIceLogDialog(_title, this); - + setVisible(true); - + play(); } @@ -642,7 +628,7 @@ class ShowIceLogDialog extends JDialog { if(_remoteLogger == null) { - _tableModel.setRowCount(0); + _tableModel.setRowCount(0); if(_messageTypeFilter != null || _traceCategoryFilter != null) { setTitle(_title + " (Filtered) - IceGrid Admin"); @@ -651,59 +637,38 @@ class ShowIceLogDialog extends JDialog { setTitle(_title + " (No filter) - IceGrid Admin"); } - + _playItem.setSelected(true); _playButton.setSelected(true); _pause.setEnabled(false); // Init will enable Pause - + String id = _loggerAdmin.ice_getIdentity().name + "-" + java.util.UUID.randomUUID().toString(); _remoteLogger = new RemoteLoggerI(); - _remoteLoggerPrx = RemoteLoggerPrxHelper.uncheckedCast(_parent.getRoot().getCoordinator().addCallback(_remoteLogger, id, "")); - + _remoteLoggerPrx = RemoteLoggerPrx.uncheckedCast( + _parent.getRoot().getCoordinator().addCallback(_remoteLogger, id, "")); + final String prefix = "Attaching remote logger to " + _loggerAdmin.ice_getIdentity().name + "..."; final String errorTitle = "Failed to attach remote logger to " + _loggerAdmin.ice_getIdentity().name; _parent.getRoot().getCoordinator().getStatusBar().setText(prefix); - - Ice.Callback_LoggerAdmin_attachRemoteLogger cb = new Ice.Callback_LoggerAdmin_attachRemoteLogger() - { - @Override - public void response() - { - _parent.getRoot().amiSuccess(prefix); - } - @Override - public void exception(final UserException ex) - { - SwingUtilities.invokeLater(new Runnable() + try + { + _loggerAdmin.attachRemoteLoggerAsync(_remoteLoggerPrx, _messageTypeFilter, _traceCategoryFilter, + _initialMessages).whenComplete((result, ex) -> { - @Override - public void run() + if(ex == null) { - _parent.getRoot().failure(prefix, errorTitle, ex.toString()); - stopped(); + _parent.getRoot().amiSuccess(prefix); } - }); - } - - @Override - public void exception(final LocalException ex) - { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + else { - _parent.getRoot().failure(prefix, errorTitle, ex.toString()); - stopped(); + SwingUtilities.invokeLater(() -> + { + _parent.getRoot().failure(prefix, errorTitle, ex.toString()); + stopped(); + }); } }); - } - }; - - try - { - _loggerAdmin.begin_attachRemoteLogger(_remoteLoggerPrx, _messageTypeFilter, _traceCategoryFilter, _initialMessages, cb); } catch(LocalException ex) { @@ -714,10 +679,10 @@ class ShowIceLogDialog extends JDialog else { _remoteLogger.play(); - _pause.setEnabled(true); + _pause.setEnabled(true); } } - + private void stop(boolean detach) { if(_remoteLogger != null) @@ -726,32 +691,27 @@ class ShowIceLogDialog extends JDialog { final String prefix = "Detaching remote logger from " + _loggerAdmin.ice_getIdentity().name + "..."; _parent.getRoot().getCoordinator().getStatusBar().setText(prefix); - - Ice.Callback_LoggerAdmin_detachRemoteLogger cb = new Ice.Callback_LoggerAdmin_detachRemoteLogger() - { - @Override - public void response(boolean detached) - { - if(detached) - { - _parent.getRoot().amiSuccess(prefix); - } - else - { - _parent.getRoot().amiSuccess(prefix, "not found"); - } - } - @Override - public void exception(LocalException ex) - { - _parent.getRoot().amiSuccess(prefix, ex.ice_id()); - } - }; - try { - _loggerAdmin.begin_detachRemoteLogger(_remoteLoggerPrx, cb); + _loggerAdmin.detachRemoteLoggerAsync(_remoteLoggerPrx).whenComplete((result, ex) -> + { + if(ex == null) + { + if(result) + { + _parent.getRoot().amiSuccess(prefix); + } + else + { + _parent.getRoot().amiSuccess(prefix, "not found"); + } + } + else + { + _parent.getRoot().amiSuccess(prefix, ex.toString()); + } + }); } catch(LocalException ex) { @@ -800,25 +760,25 @@ class ShowIceLogDialog extends JDialog { _remoteLogger.setMaxRows(_maxMessages); } - + _parent.getRoot().setLogPrefs(_maxMessages, _initialMessages); } - + LogMessageType[] getMessageTypeFilter() { return _messageTypeFilter; } - + String[] getTraceCategoryFilter() { return _traceCategoryFilter; } - + void setFilters(LogMessageType[] messageTypeFilter, String[] traceCategoryFilter) { _messageTypeFilter = messageTypeFilter; _traceCategoryFilter = traceCategoryFilter; - + if(_remoteLogger != null) { stop(); @@ -847,34 +807,33 @@ class ShowIceLogDialog extends JDialog } dispose(); } - + private Object[] logMessageToRow(LogMessage msg) { Object[] row = new Object[4]; - + row[0] = new java.util.Date(msg.timestamp / 1000); row[1] = msg.type; row[2] = msg.traceCategory; row[3] = msg.message; - + return row; } - private final TreeNode _parent; - private final Ice.LoggerAdminPrx _loggerAdmin; + private final com.zeroc.Ice.LoggerAdminPrx _loggerAdmin; private final String _title; private final String _defaultFileName; - + private RemoteLoggerI _remoteLogger; - private Ice.RemoteLoggerPrx _remoteLoggerPrx; - + private com.zeroc.Ice.RemoteLoggerPrx _remoteLoggerPrx; + private int _maxMessages; private int _initialMessages; - + private LogMessageType[] _messageTypeFilter; private String[] _traceCategoryFilter; - + private Action _play; private Action _pause; private Action _stop; @@ -890,12 +849,12 @@ class ShowIceLogDialog extends JDialog private final Object[] _columnNames = new Object[]{"Timestamp", "Type", "Trace Category", "Log Message"}; private final DefaultTableModel _tableModel; private final JTable _table; - + private static String renderDate(java.util.Date date) { return _dateFormat.format(date) + _timeFormat.format(date); } - + private static String renderLogMessageType(LogMessageType type) { // Remove "Message" from end of string. @@ -903,13 +862,14 @@ class ShowIceLogDialog extends JDialog assert(s.length() > 7); return s.substring(0, s.length() - 7); } - + private static String renderMessage(String msg) { return msg.replace("\n", " "); } - - private static final java.text.DateFormat _dateFormat = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); + + private static final java.text.DateFormat _dateFormat = + java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); private static final java.text.DateFormat _timeFormat = new java.text.SimpleDateFormat(" HH:mm:ss:SSS"); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowLogFileDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java index 574c972fbdf..40e9a97ea5f 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/ShowLogFileDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ShowLogFileDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.BorderLayout; import java.awt.event.ActionEvent; @@ -36,15 +36,15 @@ import com.jgoodies.looks.HeaderStyle; import com.jgoodies.looks.Options; import com.jgoodies.looks.plastic.PlasticLookAndFeel; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class ShowLogFileDialog extends JDialog { static interface FileIteratorFactory { FileIteratorPrx open(int count) - throws Ice.UserException; + throws com.zeroc.Ice.UserException; String getTitle(); @@ -62,26 +62,22 @@ class ShowLogFileDialog extends JDialog void appendLines(final String[] lines, final int maxLines, final int maxSize) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + for(int i = 0; i < lines.length; ++i) { - for(int i = 0; i < lines.length; ++i) + // + // The last line is always incomplete + // + if(i + 1 != lines.length) { - // - // The last line is always incomplete - // - if(i + 1 != lines.length) - { - append(lines[i] + "\n"); - } - else - { - append(lines[i]); - } - removeLines(maxLines, maxSize); + append(lines[i] + "\n"); + } + else + { + append(lines[i]); } + removeLines(maxLines, maxSize); } }); } @@ -129,27 +125,22 @@ class ShowLogFileDialog extends JDialog private void openError(final String message) { - SwingUtilities.invokeLater( - new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + if(_textArea.getText() == null || _textArea.getText().length() == 0) { - if(_textArea.getText() == null || _textArea.getText().length() == 0) - { - close(true); - } - else - { - stopReading(); - } - - JOptionPane.showMessageDialog( - ShowLogFileDialog.this, - message, - _factory.getTitle() + ": cannot open file", - JOptionPane.ERROR_MESSAGE); + close(true); } + else + { + stopReading(); + } + + JOptionPane.showMessageDialog( + ShowLogFileDialog.this, + message, + _factory.getTitle() + ": cannot open file", + JOptionPane.ERROR_MESSAGE); }); } @@ -170,31 +161,26 @@ class ShowLogFileDialog extends JDialog { _p = _factory.open(initialLines); } - catch(Ice.UserException e) + catch(com.zeroc.Ice.UserException e) { openError(e.toString()); return; } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { openError(e.toString()); return; } - SwingUtilities.invokeLater( - new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + if(isVisible()) { - if(isVisible()) - { - _textArea.setText(null); - } - else - { - setVisible(true); - } + _textArea.setText(null); + } + else + { + setVisible(true); } }); @@ -261,13 +247,14 @@ class ShowLogFileDialog extends JDialog maxReadSize = _threadMaxReadSize; } - Ice.StringSeqHolder linesHolder = new Ice.StringSeqHolder(); + FileIterator.ReadResult r = null; try { - eofEncountered = _p.read(maxReadSize, linesHolder); + r = _p.read(maxReadSize); + eofEncountered = r.returnValue; } - catch(IceGrid.FileNotAvailableException e) + catch(com.zeroc.IceGrid.FileNotAvailableException e) { _textArea.appendLines(new String[] { @@ -275,19 +262,11 @@ class ShowLogFileDialog extends JDialog "IceGridAdmin caught: " + e.toString(), "---------------------------" }, maxLines, maxSize); - SwingUtilities.invokeLater( - new Runnable() - { - @Override - public void run() - { - stopReading(); - } - }); + SwingUtilities.invokeLater(() -> stopReading()); cleanupIterator(); return; } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { _textArea.appendLines(new String[] { @@ -295,19 +274,11 @@ class ShowLogFileDialog extends JDialog "IceGridAdmin caught: " + e.toString(), "---------------------------" }, maxLines, maxSize); - SwingUtilities.invokeLater( - new Runnable() - { - @Override - public void run() - { - stopReading(); - } - }); + SwingUtilities.invokeLater(() -> stopReading()); return; } - _textArea.appendLines(linesHolder.value, maxLines, maxSize); + _textArea.appendLines(r.lines, maxLines, maxSize); } } } @@ -318,7 +289,7 @@ class ShowLogFileDialog extends JDialog { _p.destroy(); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { // Ignored, maybe should log warning } @@ -360,7 +331,7 @@ class ShowLogFileDialog extends JDialog _threadPeriod = _period; } - private FileIteratorPrx _p; + private FileIteratorPrx _p; private boolean _done = false; private boolean _paused = false; @@ -553,8 +524,8 @@ class ShowLogFileDialog extends JDialog } } - ShowLogFileDialog(Root root, FileIteratorFactory factory, int maxLines, int maxSize, int initialLines, int maxReadSize, - int period) + ShowLogFileDialog(Root root, FileIteratorFactory factory, int maxLines, int maxSize, int initialLines, + int maxReadSize, int period) { super(root.getCoordinator().getMainFrame(), factory.getTitle() + " - IceGrid Admin", false); diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Slave.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java index 61b6fee4156..256b8db17f9 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/Slave.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Component; import java.awt.Cursor; @@ -15,8 +15,8 @@ import java.awt.Cursor; import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class Slave extends TreeNode { @@ -26,7 +26,7 @@ class Slave extends TreeNode @Override public boolean[] getAvailableActions() { - boolean[] actions = new boolean[IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; + boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT]; actions[SHUTDOWN_REGISTRY] = true; actions[RETRIEVE_STDOUT] = true; actions[RETRIEVE_STDERR] = true; @@ -39,38 +39,17 @@ class Slave extends TreeNode final String prefix = "Shutting down registry '" + _id + "'..."; getCoordinator().getStatusBar().setText(prefix); - Callback_Admin_shutdownRegistry cb = new Callback_Admin_shutdownRegistry() - { - // - // Called by another thread! - // - @Override - public void response() - { - amiSuccess(prefix); - } - - @Override - public void exception(Ice.UserException e) - { - amiFailure(prefix, "Failed to shutdown " + _id, e); - } - - @Override - public void exception(Ice.LocalException e) - { - amiFailure(prefix, "Failed to shutdown " + _id, - e.toString()); - } - }; - try { getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - getCoordinator().getAdmin().begin_shutdownRegistry(_id, cb); + getCoordinator().getAdmin().shutdownRegistryAsync(_id).whenComplete((result, ex) -> + { + amiComplete(prefix, "Failed to shutdown " + _id, ex); + }); + } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { failure(prefix, "Failed to shutdown " + _id, e.toString()); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/SlaveEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java index 14479497ab2..681fe1f022e 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/SlaveEditor.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import javax.swing.JTextField; import com.jgoodies.forms.builder.DefaultFormBuilder; -import IceGrid.*; +import com.zeroc.IceGrid.*; class SlaveEditor extends Editor { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TableField.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TableField.java index f1b4400d2ec..77ac0980e60 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TableField.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TableField.java @@ -7,10 +7,10 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; @@ -24,7 +24,7 @@ public class TableField extends JTable { public TableField(String... columns) { - _columnNames = new java.util.Vector<String>(columns.length); + _columnNames = new java.util.Vector<>(columns.length); for(String name : columns) { _columnNames.add(name); @@ -62,7 +62,7 @@ public class TableField extends JTable public void setProperties(java.util.List<PropertyDescriptor> properties, Utils.Resolver resolver) { - java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> map = new java.util.TreeMap<>(); for(PropertyDescriptor p : properties) { map.put(resolver.substitute(p.name), resolver.substitute(p.value)); @@ -72,18 +72,19 @@ public class TableField extends JTable public void setObjects(java.util.List<ObjectDescriptor> objects, Utils.Resolver resolver) { - java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> map = new java.util.TreeMap<>(); for(ObjectDescriptor p : objects) { - Ice.Identity id = new Ice.Identity( resolver.substitute(p.id.name), resolver.substitute(p.id.category)); - map.put(Ice.Util.identityToString(id), resolver.substitute(p.type)); + com.zeroc.Ice.Identity id = + new com.zeroc.Ice.Identity(resolver.substitute(p.id.name), resolver.substitute(p.id.category)); + map.put(com.zeroc.Ice.Util.identityToString(id), resolver.substitute(p.type)); } setSortedMap(map); } public void setObjects(java.util.SortedMap<String, ObjectInfo> objects) { - java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> map = new java.util.TreeMap<>(); for(ObjectInfo p : objects.values()) { map.put(p.proxy.toString(), p.type); @@ -93,7 +94,7 @@ public class TableField extends JTable public void setEnvs(java.util.List<String> envs, Utils.Resolver resolver) { - java.util.SortedMap<String, String> map = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> map = new java.util.TreeMap<>(); for(String p : envs) { @@ -114,11 +115,10 @@ public class TableField extends JTable public void setAdapters(java.util.SortedMap<String, AdapterInfo> adapters) { - java.util.Vector<java.util.Vector<String>> vector = - new java.util.Vector<java.util.Vector<String>>(adapters.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(adapters.size()); for(java.util.Map.Entry<String, AdapterInfo> p : adapters.entrySet()) { - java.util.Vector<String> row = new java.util.Vector<String>(3); + java.util.Vector<String> row = new java.util.Vector<>(3); row.add(p.getKey()); AdapterInfo ai = p.getValue(); @@ -153,10 +153,10 @@ public class TableField extends JTable public void setSortedMap(java.util.SortedMap<String, String> map) { - java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<java.util.Vector<String>>(map.size()); + java.util.Vector<java.util.Vector<String>> vector = new java.util.Vector<>(map.size()); for(java.util.Map.Entry<String, String> p : map.entrySet()) { - java.util.Vector<String> row = new java.util.Vector<String>(2); + java.util.Vector<String> row = new java.util.Vector<>(2); row.add(p.getKey()); row.add(p.getValue()); vector.add(row); @@ -170,7 +170,7 @@ public class TableField extends JTable public void clear() { - _model.setDataVector(new java.util.Vector<java.util.Vector<String>>(), _columnNames); + _model.setDataVector(new java.util.Vector<>(), _columnNames); DefaultTableCellRenderer cr = (DefaultTableCellRenderer)getDefaultRenderer(String.class); cr.setOpaque(false); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java index ce7183e43d1..dee7468efe0 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/TreeNode.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import javax.swing.SwingUtilities; import javax.swing.JOptionPane; -import IceGridGUI.*; +import com.zeroc.IceGridGUI.*; public abstract class TreeNode extends TreeNodeBase { @@ -51,7 +51,6 @@ public abstract class TreeNode extends TreeNodeBase public static final int RETRIEVE_STDOUT = 13; public static final int RETRIEVE_STDERR = 14; public static final int RETRIEVE_LOG_FILE = 15; - public static final int SHUTDOWN_NODE = 16; public static final int SHUTDOWN_REGISTRY = 17; @@ -133,7 +132,7 @@ public abstract class TreeNode extends TreeNodeBase { assert false; } - + public void clearShowIceLogDialog() { assert false; @@ -142,50 +141,52 @@ public abstract class TreeNode extends TreeNodeBase // // Helpers // + protected void amiComplete(final String prefix, final String title, final Throwable ex) + { + if(ex == null) + { + amiSuccess(prefix); + } + else if(ex instanceof com.zeroc.Ice.UserException) + { + amiFailure(prefix, title, (com.zeroc.Ice.UserException)ex); + } + else + { + amiFailure(prefix, title, ex.toString()); + } + } + protected void amiSuccess(final String prefix) { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - success(prefix); - } - }); + SwingUtilities.invokeLater(() -> success(prefix)); } - + protected void amiSuccess(final String prefix, final String detail) { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - success(prefix, detail); - } - }); + SwingUtilities.invokeLater(() -> success(prefix, detail)); } - protected void amiFailure(String prefix, String title, Ice.UserException e) + protected void amiFailure(String prefix, String title, com.zeroc.Ice.UserException e) { - if(e instanceof IceGrid.ServerNotExistException) + if(e instanceof com.zeroc.IceGrid.ServerNotExistException) { - IceGrid.ServerNotExistException sne = (IceGrid.ServerNotExistException)e; + com.zeroc.IceGrid.ServerNotExistException sne = (com.zeroc.IceGrid.ServerNotExistException)e; amiFailure(prefix, title, "Server '" + sne.id + "' was not registered with the IceGrid Registry"); } - else if(e instanceof IceGrid.ServerStartException) + else if(e instanceof com.zeroc.IceGrid.ServerStartException) { - IceGrid.ServerStartException ste = (IceGrid.ServerStartException)e; + com.zeroc.IceGrid.ServerStartException ste = (com.zeroc.IceGrid.ServerStartException)e; amiFailure(prefix, title, "Server '" + ste.id + "' did not start: " + ste.reason); } - else if(e instanceof IceGrid.ApplicationNotExistException) + else if(e instanceof com.zeroc.IceGrid.ApplicationNotExistException) { amiFailure(prefix, title, "This application was not registered with the IceGrid Registry"); } - else if(e instanceof IceGrid.PatchException) + else if(e instanceof com.zeroc.IceGrid.PatchException) { - IceGrid.PatchException pe = (IceGrid.PatchException)e; + com.zeroc.IceGrid.PatchException pe = (com.zeroc.IceGrid.PatchException)e; String message = ""; for(String s : pe.reasons) @@ -198,20 +199,20 @@ public abstract class TreeNode extends TreeNodeBase } amiFailure(prefix, title, message); } - else if(e instanceof IceGrid.NodeNotExistException) + else if(e instanceof com.zeroc.IceGrid.NodeNotExistException) { - IceGrid.NodeNotExistException nnee = (IceGrid.NodeNotExistException)e; + com.zeroc.IceGrid.NodeNotExistException nnee = (com.zeroc.IceGrid.NodeNotExistException)e; amiFailure(prefix, title, "Node '" + nnee.name + " 'was not registered with the IceGrid Registry."); } - else if(e instanceof IceGrid.NodeUnreachableException) + else if(e instanceof com.zeroc.IceGrid.NodeUnreachableException) { - IceGrid.NodeUnreachableException nue = (IceGrid.NodeUnreachableException)e; + com.zeroc.IceGrid.NodeUnreachableException nue = (com.zeroc.IceGrid.NodeUnreachableException)e; amiFailure(prefix, title, "Node '" + nue.name + "' is unreachable: " + nue.reason); } - else if(e instanceof IceGrid.DeploymentException) + else if(e instanceof com.zeroc.IceGrid.DeploymentException) { - IceGrid.DeploymentException de = (IceGrid.DeploymentException)e; + com.zeroc.IceGrid.DeploymentException de = (com.zeroc.IceGrid.DeploymentException)e; amiFailure(prefix, title, "Deployment exception: " + de.reason); } else @@ -222,14 +223,7 @@ public abstract class TreeNode extends TreeNodeBase protected void amiFailure(final String prefix, final String title, final String message) { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - failure(prefix, title, message); - } - }); + SwingUtilities.invokeLater(() -> failure(prefix, title, message)); } protected void failure(String prefix, String title, String message) @@ -242,17 +236,17 @@ public abstract class TreeNode extends TreeNodeBase title, JOptionPane.ERROR_MESSAGE); } - + protected void success(String prefix, String detail) { getCoordinator().getStatusBar().setText(prefix + " done (" + detail + ")."); } - + protected void success(String prefix) { getCoordinator().getStatusBar().setText(prefix + " done."); } - + void reparent(TreeNode newParent) { assert newParent != null; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/WriteMessageDialog.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/WriteMessageDialog.java index 2270e25b48f..50bb07c73b9 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeployment/WriteMessageDialog.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/WriteMessageDialog.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI.LiveDeployment; +package com.zeroc.IceGridGUI.LiveDeployment; import java.awt.Container; import java.awt.event.ActionEvent; @@ -33,8 +33,8 @@ import com.jgoodies.forms.factories.Borders; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.util.LayoutStyle; -import IceGrid.*; -import IceGridGUI.*; +import com.zeroc.IceGrid.*; +import com.zeroc.IceGridGUI.*; class WriteMessageDialog extends JDialog { @@ -71,60 +71,45 @@ class WriteMessageDialog extends JDialog } else { + com.zeroc.Ice.Identity adminId = + new com.zeroc.Ice.Identity(_target, c.getServerAdminCategory()); - Ice.Identity adminId = new Ice.Identity(_target, c.getServerAdminCategory()); - - final Ice.ProcessPrx process = Ice.ProcessPrxHelper.uncheckedCast( + final com.zeroc.Ice.ProcessPrx process = com.zeroc.Ice.ProcessPrx.uncheckedCast( admin.ice_identity(adminId).ice_facet("Process")); final String prefix = "Writing message to server '" + _target + "'..."; c.getStatusBar().setText(prefix); - Ice.Callback_Process_writeMessage cb = new Ice.Callback_Process_writeMessage() - { - @Override - public void response() - { - SwingUtilities.invokeLater(new Runnable() + try + { + process.writeMessageAsync(_message.getText(), _stdOut.isSelected() ? 1 : 2). whenComplete( + (result, ex) -> + { + if(ex == null) { - @Override - public void run() - { - c.getStatusBar().setText(prefix + "done."); - } - }); - } - - @Override - public void exception(final Ice.LocalException e) - { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> + { + c.getStatusBar().setText(prefix + "done."); + }); + } + else { - @Override - public void run() - { - handleFailure("Communication exception: " + e.toString()); - } - }); - } - - private void handleFailure(String message) - { - c.getStatusBar().setText(prefix + "failed!"); - - JOptionPane.showMessageDialog( - _mainFrame, - message, - "Writing message to server '" + process.ice_getIdentity().name + "' failed", - JOptionPane.ERROR_MESSAGE); - } - }; + SwingUtilities.invokeLater(() -> + { + c.getStatusBar().setText(prefix + "failed!"); + + JOptionPane.showMessageDialog( + _mainFrame, + "Communication exception: " + ex.toString(), + "Writing message to server '" + + process.ice_getIdentity().name + "' failed", + JOptionPane.ERROR_MESSAGE); + }); + } + }); - try - { - process.begin_writeMessage(_message.getText(), _stdOut.isSelected() ? 1 : 2, cb); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { c.getStatusBar().setText(prefix + "failed."); JOptionPane.showMessageDialog( diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeploymentPane.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeploymentPane.java index e5814767fac..3a2a8c4cb41 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/LiveDeploymentPane.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeploymentPane.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.*; import java.awt.event.MouseAdapter; @@ -24,9 +24,9 @@ import javax.swing.tree.TreeSelectionModel; import javax.swing.tree.TreePath; import com.jgoodies.forms.factories.Borders; -import IceGridGUI.LiveDeployment.Editor; -import IceGridGUI.LiveDeployment.Root; -import IceGridGUI.LiveDeployment.TreeNode; +import com.zeroc.IceGridGUI.LiveDeployment.Editor; +import com.zeroc.IceGridGUI.LiveDeployment.Root; +import com.zeroc.IceGridGUI.LiveDeployment.TreeNode; public class LiveDeploymentPane extends JSplitPane implements Tab { @@ -346,8 +346,8 @@ public class LiveDeploymentPane extends JSplitPane implements Tab // // back/forward navigation // - private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<TreeNode>(); - private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<TreeNode>(); + private java.util.LinkedList<TreeNode> _previousNodes = new java.util.LinkedList<>(); + private java.util.LinkedList<TreeNode> _nextNodes = new java.util.LinkedList<>(); private TreeNode _currentNode; private boolean _selectionListenerEnabled = true; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Logger.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Logger.java index a9a20006a51..8ec0145ea29 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Logger.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Logger.java @@ -7,13 +7,13 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; -public class Logger extends Ice.LoggerI +public class Logger extends com.zeroc.Ice.LoggerI { public Logger(JFrame mainFrame) @@ -34,17 +34,10 @@ public class Logger extends Ice.LoggerI { return; } - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - _mainFrame, - message, - "Warning - IceGrid Admin Logger", - JOptionPane.WARNING_MESSAGE); - } + JOptionPane.showMessageDialog(_mainFrame, message, "Warning - IceGrid Admin Logger", + JOptionPane.WARNING_MESSAGE); }); } @@ -52,17 +45,10 @@ public class Logger extends Ice.LoggerI public void error(final String message) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() - { - JOptionPane.showMessageDialog( - _mainFrame, - message, - "Error - IceGrid Admin Logger", - JOptionPane.ERROR_MESSAGE); - } + JOptionPane.showMessageDialog(_mainFrame, message, "Error - IceGrid Admin Logger", + JOptionPane.ERROR_MESSAGE); }); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Main.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java index 338af04e384..609407a77c5 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Main.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Main.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -61,7 +61,7 @@ public class Main extends JFrame // new Main(args); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { JOptionPane.showMessageDialog(null, e.toString(), @@ -93,11 +93,11 @@ public class Main extends JFrame if(_coordinator.needsSaving()) { if(JOptionPane.showOptionDialog( - Main.this, - "The application has unsave changes, if you exit all unsaved changes will be lost.\n" + - "Exit and discard changes?", - "Save application", JOptionPane.YES_NO_OPTION, - JOptionPane.YES_NO_OPTION, null, null, null) == JOptionPane.YES_OPTION) + Main.this, + "The application has unsaved changes, if you exit all unsaved changes " + + "will be lost.\nExit and discard changes?", + "Save application", JOptionPane.YES_NO_OPTION, + JOptionPane.YES_NO_OPTION, null, null, null) == JOptionPane.YES_OPTION) { _coordinator.exit(0); } @@ -110,7 +110,7 @@ public class Main extends JFrame } }); - _coordinator = new Coordinator(this, new Ice.StringSeqHolder(args), Preferences.userNodeForPackage(getClass())); + _coordinator = new Coordinator(this, args, Preferences.userNodeForPackage(getClass())); _coordinator.showMainFrame(); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainPane.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainPane.java index cbc30f579b0..4ade68f2dba 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainPane.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainPane.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -18,7 +18,7 @@ public class MainPane extends JTabbedPane { public void addApplication(ApplicationPane application) { - IceGridGUI.Application.Root root = application.getRoot(); + com.zeroc.IceGridGUI.Application.Root root = application.getRoot(); super.addTab(computeTitle(root.getId()), getIcon(root), application); } @@ -28,7 +28,7 @@ public class MainPane extends JTabbedPane super.setTitleAt(index, computeTitle(title)); } - public void resetTitle(IceGridGUI.Application.Root root) + public void resetTitle(com.zeroc.IceGridGUI.Application.Root root) { int i = findIndex(root); if(i > 0) @@ -37,7 +37,7 @@ public class MainPane extends JTabbedPane } } - public void resetIcon(IceGridGUI.Application.Root root) + public void resetIcon(com.zeroc.IceGridGUI.Application.Root root) { int i = findIndex(root); if(i > 0) @@ -46,7 +46,7 @@ public class MainPane extends JTabbedPane } } - public int findIndex(IceGridGUI.Application.Root root) + public int findIndex(com.zeroc.IceGridGUI.Application.Root root) { for(int i = 1; i < getTabCount(); ++i) { @@ -59,7 +59,7 @@ public class MainPane extends JTabbedPane return -1; } - public ApplicationPane findApplication(IceGridGUI.Application.Root root) + public ApplicationPane findApplication(com.zeroc.IceGridGUI.Application.Root root) { for(int i = 1; i < getTabCount(); ++i) { @@ -72,7 +72,7 @@ public class MainPane extends JTabbedPane return null; } - public void removeApplication(IceGridGUI.Application.Root root) + public void removeApplication(com.zeroc.IceGridGUI.Application.Root root) { for(int i = 1; i < getTabCount(); ++i) { @@ -132,7 +132,7 @@ public class MainPane extends JTabbedPane return false; } - private ImageIcon getIcon(IceGridGUI.Application.Root root) + private ImageIcon getIcon(com.zeroc.IceGridGUI.Application.Root root) { if(root.isLive()) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainProxy.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java index 4e6ad314dce..4f0d5425b9d 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/MainProxy.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/MainProxy.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.JOptionPane; @@ -21,8 +21,8 @@ public class MainProxy _args = java.util.Arrays.copyOf(args, args.length); String version = System.getProperty("java.version"); - - Class<?> cls = IceInternal.Util.findClass("com.javafx.main.Main", null); + + Class<?> cls = com.zeroc.IceInternal.Util.findClass("com.javafx.main.Main", null); if(cls != null && version.indexOf("1.7") == 0) { try @@ -34,30 +34,27 @@ public class MainProxy catch(NoSuchMethodException ex) { ex.printStackTrace(); - JOptionPane.showMessageDialog(null, - "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'", - "IceGrid Admin Error", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog( + null, "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'", + "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE); } catch(IllegalAccessException ex) { ex.printStackTrace(); - JOptionPane.showMessageDialog(null, - "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'", - "IceGrid Admin Error", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog( + null, + "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'", + "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE); } catch(java.lang.reflect.InvocationTargetException ex) { } } - cls = IceInternal.Util.findClass("IceGridGUI.Main", null); + cls = com.zeroc.IceInternal.Util.findClass("com.zeroc.IceGridGUI.Main", null); if(cls == null) { - JOptionPane.showMessageDialog(null, - "Unable to find class `IceGridGUI.Main'", - "IceGrid Admin Error", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "Unable to find class `com.zeroc.IceGridGUI.Main'", + "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE); return; } try @@ -69,18 +66,16 @@ public class MainProxy catch(NoSuchMethodException ex) { ex.printStackTrace(); - JOptionPane.showMessageDialog(null, - "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'", - "IceGrid Admin Error", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog( + null, "Unable to find method `main(String[] args)' in class `com.javafx.main.Main'", + "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE); } catch(IllegalAccessException ex) { ex.printStackTrace(); - JOptionPane.showMessageDialog(null, - "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'", - "IceGrid Admin Error", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog( + null, "IllegalAccessException invoking method `main(String[] args)' in class `com.javafx.main.Main'", + "IceGrid Admin Error", JOptionPane.ERROR_MESSAGE); } catch(java.lang.reflect.InvocationTargetException ex) { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/NodeObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/NodeObserverI.java index 3d16a3ed61a..bc8e0375cf0 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/NodeObserverI.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/NodeObserverI.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.SwingUtilities; -import IceGrid.*; +import com.zeroc.IceGrid.*; -class NodeObserverI extends _NodeObserverDisp +class NodeObserverI implements NodeObserver { NodeObserverI(Coordinator coordinator) { @@ -21,7 +21,7 @@ class NodeObserverI extends _NodeObserverDisp } @Override - public void nodeInit(final NodeDynamicInfo[] nodes, Ice.Current current) + public void nodeInit(final NodeDynamicInfo[] nodes, com.zeroc.Ice.Current current) { if(_trace) { @@ -40,57 +40,39 @@ class NodeObserverI extends _NodeObserverDisp } } - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + for(NodeDynamicInfo node : nodes) { - for(NodeDynamicInfo node : nodes) - { - _coordinator.nodeUp(node); - } + _coordinator.nodeUp(node); } }); } @Override - public void nodeUp(final NodeDynamicInfo nodeInfo, Ice.Current current) + public void nodeUp(final NodeDynamicInfo nodeInfo, com.zeroc.Ice.Current current) { if(_trace) { _coordinator.traceObserver("nodeUp for node " + nodeInfo.info.name); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.nodeUp(nodeInfo); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.nodeUp(nodeInfo)); } @Override - public void nodeDown(final String nodeName, Ice.Current current) + public void nodeDown(final String nodeName, com.zeroc.Ice.Current current) { if(_trace) { _coordinator.traceObserver("nodeUp for node " + nodeName); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.nodeDown(nodeName); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.nodeDown(nodeName)); } @Override - public void updateServer(final String node, final ServerDynamicInfo updatedInfo, Ice.Current current) + public void updateServer(final String node, final ServerDynamicInfo updatedInfo, com.zeroc.Ice.Current current) { if(_trace) { @@ -99,18 +81,11 @@ class NodeObserverI extends _NodeObserverDisp + updatedInfo.state.toString()); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.updateServer(node, updatedInfo); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.updateServer(node, updatedInfo)); } @Override - public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo, Ice.Current current) + public void updateAdapter(final String node, final AdapterDynamicInfo updatedInfo, com.zeroc.Ice.Current current) { if(_trace) { @@ -120,14 +95,7 @@ class NodeObserverI extends _NodeObserverDisp : updatedInfo.proxy.toString())); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.updateAdapter(node, updatedInfo); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.updateAdapter(node, updatedInfo)); } private final Coordinator _coordinator; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/ObjectObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ObjectObserverI.java index a04c2b12dd5..f68074429f7 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/ObjectObserverI.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/ObjectObserverI.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.SwingUtilities; -import IceGrid.*; +import com.zeroc.IceGrid.*; -class ObjectObserverI extends _ObjectObserverDisp +class ObjectObserverI implements ObjectObserver { ObjectObserverI(Coordinator coordinator) { @@ -21,7 +21,7 @@ class ObjectObserverI extends _ObjectObserverDisp } @Override - public synchronized void objectInit(final ObjectInfo[] objects, Ice.Current current) + public synchronized void objectInit(final ObjectInfo[] objects, com.zeroc.Ice.Current current) { if(_trace) { @@ -41,68 +41,40 @@ class ObjectObserverI extends _ObjectObserverDisp } } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.objectInit(objects); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.objectInit(objects)); } @Override - public void objectAdded(final ObjectInfo info, Ice.Current current) + public void objectAdded(final ObjectInfo info, com.zeroc.Ice.Current current) { if(_trace) { _coordinator.traceObserver("objectAdded for object " + info.proxy.toString()); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.objectAdded(info); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.objectAdded(info)); } @Override - public void objectUpdated(final ObjectInfo info, Ice.Current current) + public void objectUpdated(final ObjectInfo info, com.zeroc.Ice.Current current) { if(_trace) { _coordinator.traceObserver("objectUpdated for object " + info.proxy.toString()); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.objectUpdated(info); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.objectUpdated(info)); } @Override - public void objectRemoved(final Ice.Identity id, Ice.Current current) + public void objectRemoved(final com.zeroc.Ice.Identity id, com.zeroc.Ice.Current current) { if(_trace) { - _coordinator.traceObserver("objectRemoved for object " + Ice.Util.identityToString(id)); + _coordinator.traceObserver("objectRemoved for object " + com.zeroc.Ice.Util.identityToString(id)); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.objectRemoved(id); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.objectRemoved(id)); } private final Coordinator _coordinator; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/RegistryObserverI.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/RegistryObserverI.java index b07304a204b..24ddb706483 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/RegistryObserverI.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/RegistryObserverI.java @@ -7,12 +7,12 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import javax.swing.SwingUtilities; -import IceGrid.*; +import com.zeroc.IceGrid.*; -class RegistryObserverI extends _RegistryObserverDisp +class RegistryObserverI implements RegistryObserver { RegistryObserverI(Coordinator coordinator) { @@ -21,7 +21,7 @@ class RegistryObserverI extends _RegistryObserverDisp } @Override - public void registryInit(final RegistryInfo[] registryInfos, Ice.Current current) + public void registryInit(final RegistryInfo[] registryInfos, com.zeroc.Ice.Current current) { if(_trace) { @@ -42,53 +42,35 @@ class RegistryObserverI extends _RegistryObserverDisp } } - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + for(RegistryInfo info : registryInfos) { - for(RegistryInfo info : registryInfos) - { - _coordinator.registryUp(info); - } + _coordinator.registryUp(info); } }); } @Override - public void registryUp(final RegistryInfo registryInfo, Ice.Current current) + public void registryUp(final RegistryInfo registryInfo, com.zeroc.Ice.Current current) { if(_trace) { _coordinator.traceObserver("registryUp for registry " + registryInfo.name); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.registryUp(registryInfo); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.registryUp(registryInfo)); } @Override - public void registryDown(final String registryName, Ice.Current current) + public void registryDown(final String registryName, com.zeroc.Ice.Current current) { if(_trace) { _coordinator.traceObserver("registryDown for registry " + registryName); } - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _coordinator.registryDown(registryName); - } - }); + SwingUtilities.invokeLater(() -> _coordinator.registryDown(registryName)); } private final Coordinator _coordinator; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SessionKeeper.java index fa178e40271..53d4f2a83ca 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/SessionKeeper.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SessionKeeper.java @@ -7,7 +7,8 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; + import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentListener; @@ -58,13 +59,11 @@ import java.security.MessageDigest; import javax.naming.ldap.LdapName; import javax.naming.ldap.Rdn; -import IceLocatorDiscovery.LookupPrx; -import IceLocatorDiscovery.LookupPrxHelper; -import IceLocatorDiscovery.LookupReplyPrx; -import IceLocatorDiscovery.LookupReplyPrxHelper; -import IceLocatorDiscovery._LookupReplyDisp; +import com.zeroc.IceLocatorDiscovery.LookupPrx; +import com.zeroc.IceLocatorDiscovery.LookupReplyPrx; +import com.zeroc.IceLocatorDiscovery.LookupReply; -import IceGrid.*; +import com.zeroc.IceGrid.*; // // The SessionKeeper is responsible for establishing sessions (one at a time) @@ -88,24 +87,20 @@ public class SessionKeeper { _admin = _session.getAdmin(); } - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { while(true) { try { - SwingUtilities.invokeAndWait(new Runnable() + SwingUtilities.invokeAndWait(() -> { - @Override - public void run() - { - logout(true); - JOptionPane.showMessageDialog( - parent, - "Could not retrieve Admin proxy: " + e.toString(), - "Login failed", - JOptionPane.ERROR_MESSAGE); - } + logout(true); + JOptionPane.showMessageDialog( + parent, + "Could not retrieve Admin proxy: " + e.toString(), + "Login failed", + JOptionPane.ERROR_MESSAGE); }); break; } @@ -125,14 +120,14 @@ public class SessionKeeper { if(!routed) { - Ice.ObjectPrx adminCallbackTemplate = _session.getAdminCallbackTemplate(); + com.zeroc.Ice.ObjectPrx adminCallbackTemplate = _session.getAdminCallbackTemplate(); if(adminCallbackTemplate != null) { _adminCallbackCategory = adminCallbackTemplate.ice_getIdentity().category; String publishedEndpoints = null; - for(Ice.Endpoint endpoint : adminCallbackTemplate.ice_getEndpoints()) + for(com.zeroc.Ice.Endpoint endpoint : adminCallbackTemplate.ice_getEndpoints()) { String endpointString = endpoint.toString(); if(publishedEndpoints == null) @@ -150,24 +145,20 @@ public class SessionKeeper } _serverAdminCategory = _admin.getServerAdminCategory(); } - catch(final Ice.OperationNotExistException e) + catch(final com.zeroc.Ice.OperationNotExistException e) { while(true) { try { - SwingUtilities.invokeAndWait(new Runnable() + SwingUtilities.invokeAndWait(() -> { - @Override - public void run() - { - logout(true); - JOptionPane.showMessageDialog( - parent, - "This version of IceGrid Admin requires an IceGrid Registry version 3.3", - "Login failed: Version Mismatch", - JOptionPane.ERROR_MESSAGE); - } + logout(true); + JOptionPane.showMessageDialog( + parent, + "This version of IceGrid Admin requires an IceGrid Registry version 3.3", + "Login failed: Version Mismatch", + JOptionPane.ERROR_MESSAGE); }); break; } @@ -181,27 +172,22 @@ public class SessionKeeper } } throw e; - } - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { while(true) { try { - SwingUtilities.invokeAndWait(new Runnable() + SwingUtilities.invokeAndWait(() -> { - @Override - public void run() - { - logout(true); - JOptionPane.showMessageDialog( - parent, - "Could not retrieve admin callback template or server admin category: " + - e.toString(), - "Login failed", - JOptionPane.ERROR_MESSAGE); - } + logout(true); + JOptionPane.showMessageDialog( + parent, + "Could not retrieve admin callback template or server admin category: " + + e.toString(), + "Login failed", + JOptionPane.ERROR_MESSAGE); }); break; } @@ -220,96 +206,58 @@ public class SessionKeeper if(acmTimeout > 0) { _session.ice_getConnection().setACM( - new Ice.IntOptional(acmTimeout), + java.util.OptionalInt.of(acmTimeout), null, - new Ice.Optional<Ice.ACMHeartbeat>(Ice.ACMHeartbeat.HeartbeatAlways)); + java.util.Optional.of(com.zeroc.Ice.ACMHeartbeat.HeartbeatAlways)); - _session.ice_getConnection().setCloseCallback( - new Ice.CloseCallback() + _session.ice_getConnection().setCloseCallback(con -> { - @Override - public void - closed(Ice.Connection con) + try { - try - { - con.getInfo(); // This throws when the connection is closed. - assert(false); - } - catch(final Ice.LocalException ex) - { - SwingUtilities.invokeLater( - new Runnable() - { - @Override - public void run() - { - sessionLost("Failed to contact the IceGrid registry: " + ex.toString()); - } - }); - } + con.getInfo(); // This throws when the connection is closed. + assert(false); + } + catch(final com.zeroc.Ice.LocalException ex) + { + SwingUtilities.invokeLater(() -> + { + sessionLost("Failed to contact the IceGrid registry: " + ex.toString()); + }); } }); } else { - _keepAliveFuture = _coordinator.getExecutor().scheduleAtFixedRate(new Runnable() { - private void error(final Exception e) + _keepAliveFuture = _coordinator.getExecutor().scheduleAtFixedRate(() -> { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + _session.keepAliveAsync().whenComplete((result, ex) -> { - sessionLost("Failed to contact the IceGrid registry: " + e.toString()); - } - }); - } - - @Override - public void run() - { - _session.begin_keepAlive(new Callback_AdminSession_keepAlive() - { - @Override - public void - response() + if(ex != null) { - } - - @Override - public void - exception(Ice.LocalException ex) - { - error(ex); + SwingUtilities.invokeLater(() -> + { + sessionLost("Failed to contact the IceGrid registry: " + ex.toString()); + }); } }); - } - }, sessionTimeout / 2, sessionTimeout / 2, java.util.concurrent.TimeUnit.SECONDS); + }, sessionTimeout / 2, sessionTimeout / 2, java.util.concurrent.TimeUnit.SECONDS); } try { registerObservers(); } - catch(final Ice.LocalException e) + catch(final com.zeroc.Ice.LocalException e) { while(true) { try { - SwingUtilities.invokeAndWait(new Runnable() + SwingUtilities.invokeAndWait(() -> { - @Override - public void run() - { - logout(true); - JOptionPane.showMessageDialog(parent, - "Could not register observers: " - + e.toString(), - "Login failed", - JOptionPane.ERROR_MESSAGE); - } + logout(true); + JOptionPane.showMessageDialog(parent, "Could not register observers: " + e.toString(), + "Login failed", JOptionPane.ERROR_MESSAGE); }); break; } @@ -362,18 +310,17 @@ public class SessionKeeper // since the Admin object provided by the registry is a well-known object // (indirect, locator-dependent). // - Ice.ObjectAdapter adminRouterAdapter = _coordinator.getCommunicator(). + com.zeroc.Ice.ObjectAdapter adminRouterAdapter = _coordinator.getCommunicator(). createObjectAdapterWithEndpoints("IceGrid.AdminRouter", "tcp -h localhost"); - _routedAdmin = AdminPrxHelper.uncheckedCast( - adminRouterAdapter.addWithUUID(new AdminRouter(_admin))); + _routedAdmin = AdminPrx.uncheckedCast(adminRouterAdapter.addWithUUID(new AdminRouter(_admin))); adminRouterAdapter.activate(); } return _routedAdmin; } - Ice.ObjectPrx addCallback(Ice.Object servant, String name, String facet) + com.zeroc.Ice.ObjectPrx addCallback(com.zeroc.Ice.Object servant, String name, String facet) { if(_adminCallbackCategory == null) { @@ -381,11 +328,11 @@ public class SessionKeeper } else { - return _adapter.addFacet(servant, new Ice.Identity(name, _adminCallbackCategory), facet); + return _adapter.addFacet(servant, new com.zeroc.Ice.Identity(name, _adminCallbackCategory), facet); } } - Ice.ObjectPrx retrieveCallback(String name, String facet) + com.zeroc.Ice.ObjectPrx retrieveCallback(String name, String facet) { if(_adminCallbackCategory == null) { @@ -393,7 +340,7 @@ public class SessionKeeper } else { - Ice.Identity ident = new Ice.Identity(name, _adminCallbackCategory); + com.zeroc.Ice.Identity ident = new com.zeroc.Ice.Identity(name, _adminCallbackCategory); if(_adapter.findFacet(ident, facet) == null) { return null; @@ -405,7 +352,7 @@ public class SessionKeeper } } - Ice.Object removeCallback(String name, String facet) + com.zeroc.Ice.Object removeCallback(String name, String facet) { if(_adminCallbackCategory == null || _adapter == null) { @@ -413,7 +360,7 @@ public class SessionKeeper } else { - return _adapter.removeFacet(new Ice.Identity(name, _adminCallbackCategory), facet); + return _adapter.removeFacet(new com.zeroc.Ice.Identity(name, _adminCallbackCategory), facet); } } @@ -459,7 +406,7 @@ public class SessionKeeper } else { - Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.uncheckedCast( + com.zeroc.Glacier2.RouterPrx router = com.zeroc.Glacier2.RouterPrx.uncheckedCast( _coordinator.getCommunicator().getDefaultRouter()); category = router.getCategoryForClient(); _adminCallbackCategory = category; @@ -486,66 +433,57 @@ public class SessionKeeper { try { - SwingUtilities.invokeAndWait(new Runnable() + SwingUtilities.invokeAndWait(() -> { - @Override - public void run() - { - ApplicationObserverI applicationObserverServant = new ApplicationObserverI( - _admin.ice_getIdentity().category, _coordinator); - - ApplicationObserverPrx applicationObserver = - ApplicationObserverPrxHelper.uncheckedCast( - _adapter.add( - applicationObserverServant, _applicationObserverIdentity)); - - AdapterObserverPrx adapterObserver = - AdapterObserverPrxHelper.uncheckedCast( - _adapter.add( - new AdapterObserverI(_coordinator), _adapterObserverIdentity)); - - ObjectObserverPrx objectObserver = - ObjectObserverPrxHelper.uncheckedCast( - _adapter.add( - new ObjectObserverI(_coordinator), _objectObserverIdentity)); - - RegistryObserverPrx registryObserver = - RegistryObserverPrxHelper.uncheckedCast( - _adapter.add( - new RegistryObserverI(_coordinator), _registryObserverIdentity)); - - NodeObserverPrx nodeObserver = - NodeObserverPrxHelper.uncheckedCast( - _adapter.add( - new NodeObserverI(_coordinator), _nodeObserverIdentity)); + ApplicationObserverI applicationObserverServant = new ApplicationObserverI( + _admin.ice_getIdentity().category, _coordinator); - try + ApplicationObserverPrx applicationObserver = + ApplicationObserverPrx.uncheckedCast( + _adapter.add(applicationObserverServant, _applicationObserverIdentity)); + + AdapterObserverPrx adapterObserver = + AdapterObserverPrx.uncheckedCast( + _adapter.add(new AdapterObserverI(_coordinator), _adapterObserverIdentity)); + + ObjectObserverPrx objectObserver = + ObjectObserverPrx.uncheckedCast( + _adapter.add(new ObjectObserverI(_coordinator), _objectObserverIdentity)); + + RegistryObserverPrx registryObserver = + RegistryObserverPrx.uncheckedCast( + _adapter.add(new RegistryObserverI(_coordinator), _registryObserverIdentity)); + + NodeObserverPrx nodeObserver = + NodeObserverPrx.uncheckedCast( + _adapter.add(new NodeObserverI(_coordinator), _nodeObserverIdentity)); + + try + { + if(_routed) { - if(_routed) - { - _session.setObservers(registryObserver, - nodeObserver, - applicationObserver, - adapterObserver, - objectObserver); - } - else - { - _session.setObserversByIdentity( - _registryObserverIdentity, - _nodeObserverIdentity, - _applicationObserverIdentity, - _adapterObserverIdentity, - _objectObserverIdentity); - } + _session.setObservers(registryObserver, + nodeObserver, + applicationObserver, + adapterObserver, + objectObserver); } - catch(ObserverAlreadyRegisteredException ex) + else { - assert false; // We use UUIDs for the observer identities. + _session.setObserversByIdentity( + _registryObserverIdentity, + _nodeObserverIdentity, + _applicationObserverIdentity, + _adapterObserverIdentity, + _objectObserverIdentity); } - - applicationObserverServant.waitForInit(); } + catch(ObserverAlreadyRegisteredException ex) + { + assert false; // We use UUIDs for the observer identities. + } + + applicationObserverServant.waitForInit(); }); break; } @@ -565,16 +503,16 @@ public class SessionKeeper private java.util.concurrent.Future<?> _keepAliveFuture; - private Ice.ObjectAdapter _adapter; + private com.zeroc.Ice.ObjectAdapter _adapter; private AdminPrx _admin; private String _serverAdminCategory; private String _adminCallbackCategory; private AdminPrx _routedAdmin; - private Ice.Identity _applicationObserverIdentity = new Ice.Identity(); - private Ice.Identity _adapterObserverIdentity = new Ice.Identity(); - private Ice.Identity _objectObserverIdentity = new Ice.Identity(); - private Ice.Identity _registryObserverIdentity = new Ice.Identity(); - private Ice.Identity _nodeObserverIdentity = new Ice.Identity(); + private com.zeroc.Ice.Identity _applicationObserverIdentity = new com.zeroc.Ice.Identity(); + private com.zeroc.Ice.Identity _adapterObserverIdentity = new com.zeroc.Ice.Identity(); + private com.zeroc.Ice.Identity _objectObserverIdentity = new com.zeroc.Ice.Identity(); + private com.zeroc.Ice.Identity _registryObserverIdentity = new com.zeroc.Ice.Identity(); + private com.zeroc.Ice.Identity _nodeObserverIdentity = new com.zeroc.Ice.Identity(); } private static JScrollPane createStrippedScrollPane(Component component) @@ -1086,7 +1024,6 @@ public class SessionKeeper private char[] _keyPassword; private boolean _storeKeyPassword; private boolean _isDefault; - } @@ -1141,19 +1078,15 @@ public class SessionKeeper { if(_discoveryAdapter != null) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + if(_directDiscoveryEndpointModel.size() > 0) { - if(_directDiscoveryEndpointModel.size() > 0) - { - _discoveryStatus.setText(""); - } - else - { - _discoveryStatus.setText("No registries found"); - } + _discoveryStatus.setText(""); + } + else + { + _discoveryStatus.setText("No registries found"); } }); _discoveryAdapter.destroy(); @@ -1164,45 +1097,41 @@ public class SessionKeeper public void refreshDiscoveryEndpoints() { - final Ice.Communicator communicator = _coordinator.getCommunicator(); + final com.zeroc.Ice.Communicator communicator = _coordinator.getCommunicator(); if(_discoveryLookupReply == null) { - _discoveryLookupReply = new _LookupReplyDisp() + _discoveryLookupReply = new LookupReply() { @Override - public void foundLocator(final Ice.LocatorPrx locator, Ice.Current curr) + public void foundLocator(final com.zeroc.Ice.LocatorPrx locator, com.zeroc.Ice.Current curr) { - SwingUtilities.invokeLater(new Runnable() + SwingUtilities.invokeLater(() -> { - @Override - public void run() + try { - try + com.zeroc.Ice.Endpoint[] endps = locator.ice_getEndpoints(); + for(com.zeroc.Ice.Endpoint e : endps) { - Ice.Endpoint[] endps = locator.ice_getEndpoints(); - for(Ice.Endpoint e : endps) - { - Ice.LocatorPrx prx = Ice.LocatorPrxHelper.uncheckedCast( - communicator.stringToProxy( - Ice.Util.identityToString(locator.ice_getIdentity()) + - ":" + e.toString())); - - if(_directDiscoveryEndpointModel.indexOf(prx) == -1) - { - _directDiscoveryEndpointModel.addElement(prx); - } - } + com.zeroc.Ice.LocatorPrx prx = com.zeroc.Ice.LocatorPrx.uncheckedCast( + communicator.stringToProxy( + com.zeroc.Ice.Util.identityToString(locator.ice_getIdentity()) + + ":" + e.toString())); - if(_directDiscoveryEndpointModel.size() > 0 && - _directDiscoveryEndpointList.getSelectedIndex() == -1) + if(_directDiscoveryEndpointModel.indexOf(prx) == -1) { - _directDiscoveryEndpointList.setSelectedIndex(0); + _directDiscoveryEndpointModel.addElement(prx); } } - catch(Ice.LocalException ex) + + if(_directDiscoveryEndpointModel.size() > 0 && + _directDiscoveryEndpointList.getSelectedIndex() == -1) { + _directDiscoveryEndpointList.setSelectedIndex(0); } } + catch(com.zeroc.Ice.LocalException ex) + { + } }); } }; @@ -1221,7 +1150,7 @@ public class SessionKeeper } } - final Ice.Properties properties = communicator.getProperties(); + final com.zeroc.Ice.Properties properties = communicator.getProperties(); final String intf = properties.getProperty("IceGridAdmin.Discovery.Interface"); String lookupEndpoints = properties.getProperty("IceGridAdmin.Discovery.Lookup"); String address; @@ -1250,14 +1179,11 @@ public class SessionKeeper try { - final LookupPrx lookupPrx = LookupPrxHelper.uncheckedCast( + final LookupPrx lookupPrx = LookupPrx.uncheckedCast( communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" + lookupEndpoints).ice_collocationOptimized(false).ice_router(null)); - new Thread(new Runnable() - { - @Override - public void run() + new Thread(() -> { synchronized(SessionKeeper.this) { @@ -1289,28 +1215,23 @@ public class SessionKeeper _discoveryAdapter = communicator.createObjectAdapter( "IceGridAdmin.Discovery.Reply"); _discoveryAdapter.activate(); - _discoveryReplyPrx = - LookupReplyPrxHelper.uncheckedCast( - _discoveryAdapter.addWithUUID(_discoveryLookupReply).ice_datagram()); + _discoveryReplyPrx = LookupReplyPrx.uncheckedCast( + _discoveryAdapter.addWithUUID(_discoveryLookupReply).ice_datagram()); } lookupPrx.findLocator("", _discoveryReplyPrx); } - catch(final Ice.LocalException ex) + catch(final com.zeroc.Ice.LocalException ex) { ex.printStackTrace(); destroyDisconveryAdapter(); - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() + SwingUtilities.invokeLater(() -> { JOptionPane.showMessageDialog(ConnectionWizardDialog.this, ex.toString(), "Error while looking up locator endpoints", JOptionPane.ERROR_MESSAGE); - } - }); + }); } // @@ -1328,15 +1249,12 @@ public class SessionKeeper }; new java.util.Timer().schedule(_discoveryFinishTask, 2000); } - } - }).start(); + }).start(); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { - JOptionPane.showMessageDialog(ConnectionWizardDialog.this, - ex.toString(), - "Error while looking up locator endpoints", - JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(ConnectionWizardDialog.this, ex.toString(), + "Error while looking up locator endpoints", JOptionPane.ERROR_MESSAGE); } } @@ -1394,8 +1312,8 @@ public class SessionKeeper // Direct Discovery Endpoint List { - _directDiscoveryEndpointModel = new DefaultListModel<Ice.LocatorPrx>(); - _directDiscoveryEndpointList = new JList<Ice.LocatorPrx>(_directDiscoveryEndpointModel); + _directDiscoveryEndpointModel = new DefaultListModel<>(); + _directDiscoveryEndpointList = new JList<>(_directDiscoveryEndpointModel); _directDiscoveryEndpointList.setVisibleRowCount(7); _directDiscoveryEndpointList.addMouseListener( new MouseAdapter() @@ -1407,7 +1325,7 @@ public class SessionKeeper { Object obj = _directDiscoveryEndpointModel.getElementAt( _directDiscoveryEndpointList.locationToIndex(e.getPoint())); - if(obj != null && obj instanceof Ice.LocatorPrx) + if(obj != null && obj instanceof com.zeroc.Ice.LocatorPrx) { _nextButton.doClick(0); } @@ -1427,15 +1345,15 @@ public class SessionKeeper ButtonGroup group = new ButtonGroup(); _directDiscoveryDiscoveredEndpoint = new JRadioButton(new AbstractAction("Discovered Endpoints") { - @Override - public void actionPerformed(ActionEvent e) - { - _directDiscoveryEndpointList.setEnabled(true); - _discoveryStatus.setEnabled(true); - _discoveryRefresh.setEnabled(true); - validatePanel(); - refreshDiscoveryEndpoints(); - } + @Override + public void actionPerformed(ActionEvent e) + { + _directDiscoveryEndpointList.setEnabled(true); + _discoveryStatus.setEnabled(true); + _discoveryRefresh.setEnabled(true); + validatePanel(); + refreshDiscoveryEndpoints(); + } }); _directDiscoveryDiscoveredEndpoint.setSelected(true); group.add(_directDiscoveryDiscoveredEndpoint); @@ -1634,7 +1552,7 @@ public class SessionKeeper }); builder.append("<html><b>Port number:</b></html>", _directDefaultEndpointPort); builder.append("", new JLabel("<html>The port number the IceGrid registry listens on; " + - "leave empty to use the default <br/>IceGrid registry port number.</html>")); + "leave empty to use the default <br/>IceGrid registry port number.</html>")); builder.nextLine(); ButtonGroup group = new ButtonGroup(); _directDefaultEndpointTCP = new JRadioButton(new AbstractAction("TCP") @@ -1657,8 +1575,8 @@ public class SessionKeeper _directDefaultEndpointTCP.setSelected(true); JPanel protocolOptionPane; { - DefaultFormBuilder protocolBuilder = new DefaultFormBuilder( - new FormLayout("pref, 2dlu, pref", "pref")); + DefaultFormBuilder protocolBuilder = + new DefaultFormBuilder(new FormLayout("pref, 2dlu, pref", "pref")); protocolBuilder.append(_directDefaultEndpointTCP,_directDefaultEndpointSSL); protocolOptionPane = protocolBuilder.getPanel(); } @@ -1683,12 +1601,14 @@ public class SessionKeeper validatePanel(); _routedDefaultEndpointHost.requestFocusInWindow(); } + @Override public void removeUpdate(DocumentEvent e) { validatePanel(); _routedDefaultEndpointHost.requestFocusInWindow(); } + @Override public void insertUpdate(DocumentEvent e) { @@ -1710,12 +1630,14 @@ public class SessionKeeper validatePanel(); _routedDefaultEndpointPort.requestFocusInWindow(); } + @Override public void removeUpdate(DocumentEvent e) { validatePanel(); _routedDefaultEndpointPort.requestFocusInWindow(); } + @Override public void insertUpdate(DocumentEvent e) { @@ -1725,7 +1647,7 @@ public class SessionKeeper }); builder.append("<html><b>Port:</b></html>", _routedDefaultEndpointPort); builder.append("", new JLabel("<html>The port number the Glacier2 router listens on; " + - "leave empty to use the default <br/>Glacier2 router port number.</html>")); + "leave empty to use the default <br/>Glacier2 router port number.</html>")); builder.nextLine(); ButtonGroup group = new ButtonGroup(); @@ -1751,7 +1673,7 @@ public class SessionKeeper JPanel protocolOptionPane; { DefaultFormBuilder protocolBuilder = - new DefaultFormBuilder(new FormLayout("pref, 2dlu, pref", "pref")); + new DefaultFormBuilder(new FormLayout("pref, 2dlu, pref", "pref")); protocolBuilder.append(_routedDefaultEndpointTCP,_routedDefaultEndpointSSL); protocolOptionPane = protocolBuilder.getPanel(); } @@ -1775,11 +1697,13 @@ public class SessionKeeper { validatePanel(); } + @Override public void removeUpdate(DocumentEvent e) { validatePanel(); } + @Override public void insertUpdate(DocumentEvent e) { @@ -1810,11 +1734,13 @@ public class SessionKeeper { validatePanel(); } + @Override public void removeUpdate(DocumentEvent e) { validatePanel(); } + @Override public void insertUpdate(DocumentEvent e) { @@ -1861,7 +1787,9 @@ public class SessionKeeper }); group.add(_x509CertificateYesButton); - builder.append(new JLabel("<html><b>Do you want to provide an X.509 certificate for SSL authentication?</b></html>")); + builder.append( + new JLabel( + "<html><b>Do you want to provide an X.509 certificate for SSL authentication?</b></html>")); builder.append(_x509CertificateNoButton); builder.append(_x509CertificateYesButton); @@ -1871,7 +1799,7 @@ public class SessionKeeper // Direct X509 credentials panel { _directCertificateAliases = new JComboBox(); - _directCertificateAliases.addActionListener (new ActionListener () + _directCertificateAliases.addActionListener(new ActionListener () { @Override public void actionPerformed(ActionEvent e) @@ -1913,12 +1841,14 @@ public class SessionKeeper builder.rowGroupingEnabled(true); builder.append("<html><b>Alias:</b></html>", alias); - builder.append("", new JLabel("<html><p>Your X.509 certificate for SSL authentication.</p></html>")); + builder.append("", new JLabel( + "<html><p>Your X.509 certificate for SSL authentication.</p></html>")); _directCertificatePassword = new JPasswordField(); builder.append("<html><b>Password:</b></html>", _directCertificatePassword); - builder.append("", new JLabel("<html>Enter your certificate password above to save it with this connection; otherwise<br>" + - "you will need to enter this password each time you connect.</p></html>")); + builder.append("", new JLabel("<html>Enter your certificate password above to save it " + + "with this connection; otherwise<br>you will need to enter " + + "this password each time you connect.</p></html>")); panel = builder.getPanel(); } @@ -1977,12 +1907,14 @@ public class SessionKeeper builder.rowGroupingEnabled(true); builder.append("<html><b>Alias:</b></html>", alias); - builder.append("", new JLabel("<html><p>Your X.509 certificate for SSL authentication.</p></html>")); + builder.append("", new JLabel( + "<html><p>Your X.509 certificate for SSL authentication.</p></html>")); _routedCertificatePassword = new JPasswordField(); builder.append("<html><b>Password:</b></html>", _routedCertificatePassword); - builder.append("", new JLabel("<html>Enter your certificate password above to save it with this connection; otherwise<br>" + - "you will need to enter this password each time you connect.</p></html>")); + builder.append("", new JLabel("<html>Enter your certificate password above to save it " + + "with this connection; otherwise<br>you will need to enter " + + "this password each time you connect.</p></html>")); panel = builder.getPanel(); } @@ -2049,12 +1981,14 @@ public class SessionKeeper validatePanel(); _directUsername.requestFocusInWindow(); } + @Override public void removeUpdate(DocumentEvent e) { validatePanel(); _directUsername.requestFocusInWindow(); } + @Override public void insertUpdate(DocumentEvent e) { @@ -2066,8 +2000,9 @@ public class SessionKeeper builder.append("<html><b>Username:</b></html>", _directUsername); _directPassword = new JPasswordField(); builder.append("<html><b>Password:</b></html>", _directPassword); - builder.append("", new JLabel("<html>Enter your password above to save it with this connection; otherwise you will<br>" + - "need to enter your password each time you connect.</p></html>")); + builder.append("", new JLabel("<html>Enter your password above to save it with this connection; " + + "otherwise you will<br>need to enter your password each time " + + "you connect.</p></html>")); _cardPanel.add(builder.getPanel(), WizardStep.DirectUsernamePasswordCredentialsStep.toString()); } @@ -2088,12 +2023,14 @@ public class SessionKeeper validatePanel(); _routedUsername.requestFocusInWindow(); } + @Override public void removeUpdate(DocumentEvent e) { validatePanel(); _routedUsername.requestFocusInWindow(); } + @Override public void insertUpdate(DocumentEvent e) { @@ -2105,8 +2042,9 @@ public class SessionKeeper builder.append("<html><b>Username:</b></html>", _routedUsername); _routedPassword = new JPasswordField(); builder.append("<html><b>Password:</b></html>", _routedPassword); - builder.append("", new JLabel("<html>Enter your Glacier2 password above to save it with this connection; otherwise<br>" + - "you will need to enter your password each time you connect.</p></html>")); + builder.append("", new JLabel("<html>Enter your Glacier2 password above to save it with this " + + "connection; otherwise<br>you will need to enter your password " + + "each time you connect.</p></html>")); _cardPanel.add(builder.getPanel(), WizardStep.RoutedUsernamePasswordCredentialsStep.toString()); } @@ -2181,7 +2119,7 @@ public class SessionKeeper } else { - Ice.LocatorPrx locator = _directDiscoveryEndpointList.getSelectedValue(); + com.zeroc.Ice.LocatorPrx locator = _directDiscoveryEndpointList.getSelectedValue(); _directInstanceName.setText(locator.ice_getIdentity().category); _directCustomEndpointValue.setText(locator.ice_getEndpoints()[0].toString()); _directCustomEndpoints.setSelected(true); @@ -2284,11 +2222,11 @@ public class SessionKeeper { try { - Ice.Identity id = new Ice.Identity(); + com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity(); id.name = "Locator"; id.category = _directInstanceName.getText(); StringBuilder endpoint = new StringBuilder(); - endpoint.append(Ice.Util.identityToString(id)); + endpoint.append(com.zeroc.Ice.Util.identityToString(id)); endpoint.append(":"); endpoint.append(_directCustomEndpointValue.getText()); _coordinator.getCommunicator().stringToProxy(endpoint.toString()); @@ -2300,11 +2238,11 @@ public class SessionKeeper else { _cardLayout.show(_cardPanel, - WizardStep.DirectUsernamePasswordCredentialsStep.toString()); + WizardStep.DirectUsernamePasswordCredentialsStep.toString()); _wizardSteps.push(WizardStep.DirectUsernamePasswordCredentialsStep); } } - catch(Ice.EndpointParseException ex) + catch(com.zeroc.Ice.EndpointParseException ex) { JOptionPane.showMessageDialog( ConnectionWizardDialog.this, @@ -2313,7 +2251,7 @@ public class SessionKeeper JOptionPane.ERROR_MESSAGE); return; } - catch(Ice.ProxyParseException ex) + catch(com.zeroc.Ice.ProxyParseException ex) { JOptionPane.showMessageDialog( ConnectionWizardDialog.this, @@ -2341,11 +2279,11 @@ public class SessionKeeper { try { - Ice.Identity id = new Ice.Identity(); + com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity(); id.name = "router"; id.category = _routedInstanceName.getText(); StringBuilder endpoint = new StringBuilder(); - endpoint.append(Ice.Util.identityToString(id)); + endpoint.append(com.zeroc.Ice.Util.identityToString(id)); endpoint.append(":"); endpoint.append(_routedCustomEndpointValue.getText()); _coordinator.getCommunicator().stringToProxy(endpoint.toString()); @@ -2361,7 +2299,7 @@ public class SessionKeeper _wizardSteps.push(WizardStep.RoutedUsernamePasswordCredentialsStep); } } - catch(Ice.EndpointParseException ex) + catch(com.zeroc.Ice.EndpointParseException ex) { JOptionPane.showMessageDialog( ConnectionWizardDialog.this, @@ -2370,7 +2308,7 @@ public class SessionKeeper JOptionPane.ERROR_MESSAGE); return; } - catch(Ice.ProxyParseException ex) + catch(com.zeroc.Ice.ProxyParseException ex) { JOptionPane.showMessageDialog( ConnectionWizardDialog.this, @@ -2510,7 +2448,8 @@ public class SessionKeeper if(_x509CertificateYesButton.isSelected()) { inf.setAlias((String)_directCertificateAliases.getSelectedItem()); - if(_directCertificatePassword.getPassword() != null && _directCertificatePassword.getPassword().length > 0) + if(_directCertificatePassword.getPassword() != null && + _directCertificatePassword.getPassword().length > 0) { inf.setKeyPassword(_directCertificatePassword.getPassword()); inf.setStoreKeyPassword(true); @@ -2658,7 +2597,7 @@ public class SessionKeeper _cancelButton.setAction(cancelAction); JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(_backButton, _nextButton). - addUnrelatedGap().addButton(_finishButton, _cancelButton).build(); + addUnrelatedGap().addButton(_finishButton, _cancelButton).build(); buttonBar.setBorder(Borders.DIALOG); getContentPane().add(buttonBar, java.awt.BorderLayout.SOUTH); @@ -2680,17 +2619,16 @@ public class SessionKeeper boolean lastStep = false; // No next step switch(step) { - case DirectDiscoveryChooseStep: { - if(_directDiscoveryManualEndpoint.isSelected()) - { - _directDiscoveryManualEndpoint.requestFocusInWindow(); - } - else - { - _directDiscoveryEndpointList.requestFocusInWindow(); - } + if(_directDiscoveryManualEndpoint.isSelected()) + { + _directDiscoveryManualEndpoint.requestFocusInWindow(); + } + else + { + _directDiscoveryEndpointList.requestFocusInWindow(); + } break; } @@ -2775,13 +2713,13 @@ public class SessionKeeper } case DirectUsernamePasswordCredentialsStep: { - lastStep = true; + lastStep = true; _directUsername.requestFocusInWindow(); break; } case RoutedUsernamePasswordCredentialsStep: { - lastStep = true; + lastStep = true; _routedUsername.requestFocusInWindow(); break; } @@ -2970,7 +2908,6 @@ public class SessionKeeper } else // Routed { - if(_routedDefaultEndpoints.isSelected()) { if(!validateWizardStep(WizardStep.RoutedDefaultEndpointStep)) @@ -3073,7 +3010,6 @@ public class SessionKeeper _directDefaultEndpoints.setSelected(true); _directDefaultEndpointHost.setText(_conf.getHost()); - if(_conf.getSSL()) { _directDefaultEndpointSSL.setSelected(true); @@ -3185,11 +3121,11 @@ public class SessionKeeper } else { - Ice.Identity id = new Ice.Identity(); + com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity(); id.name = "Locator"; id.category = _directInstanceName.getText(); StringBuilder endpoint = new StringBuilder(); - endpoint.append(Ice.Util.identityToString(id)); + endpoint.append(com.zeroc.Ice.Util.identityToString(id)); endpoint.append(":"); endpoint.append(_directCustomEndpointValue.getText()); return containsSecureEndpoints(endpoint.toString()); @@ -3203,11 +3139,11 @@ public class SessionKeeper } else { - Ice.Identity id = new Ice.Identity(); + com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity(); id.name = "router"; id.category = _routedInstanceName.getText(); StringBuilder endpoint = new StringBuilder(); - endpoint.append(Ice.Util.identityToString(id)); + endpoint.append(com.zeroc.Ice.Util.identityToString(id)); endpoint.append(":"); endpoint.append(_routedCustomEndpointValue.getText()); return containsSecureEndpoints(endpoint.toString()); @@ -3231,16 +3167,16 @@ public class SessionKeeper private JCheckBox _directConnectToMaster; // Direct Discovery Endpoints - private JList<Ice.LocatorPrx> _directDiscoveryEndpointList; - private DefaultListModel<Ice.LocatorPrx> _directDiscoveryEndpointModel; + private JList<com.zeroc.Ice.LocatorPrx> _directDiscoveryEndpointList; + private DefaultListModel<com.zeroc.Ice.LocatorPrx> _directDiscoveryEndpointModel; private JRadioButton _directDiscoveryDiscoveredEndpoint; private JLabel _discoveryStatus; private JButton _discoveryRefresh; private java.util.TimerTask _discoveryFinishTask; - private Ice.ObjectAdapter _discoveryAdapter; + private com.zeroc.Ice.ObjectAdapter _discoveryAdapter; private LookupReplyPrx _discoveryReplyPrx; - private _LookupReplyDisp _discoveryLookupReply; + private LookupReply _discoveryLookupReply; private JRadioButton _directDiscoveryManualEndpoint; // Direct Endpoints panel components @@ -3304,7 +3240,7 @@ public class SessionKeeper // // The wizard steps the user has walked throw. // - java.util.Stack<WizardStep> _wizardSteps = new java.util.Stack<WizardStep>(); + java.util.Stack<WizardStep> _wizardSteps = new java.util.Stack<>(); ConnectionInfo _conf; private boolean _x509CertificateDefault; @@ -3314,7 +3250,7 @@ public class SessionKeeper { try { - for(Ice.Endpoint endpoint : _coordinator.getCommunicator().stringToProxy(str).ice_getEndpoints()) + for(com.zeroc.Ice.Endpoint endpoint : _coordinator.getCommunicator().stringToProxy(str).ice_getEndpoints()) { if(endpoint.getInfo().secure()) { @@ -3322,10 +3258,10 @@ public class SessionKeeper } } } - catch(Ice.EndpointParseException ex) + catch(com.zeroc.Ice.EndpointParseException ex) { } - catch(Ice.ProxyParseException ex) + catch(com.zeroc.Ice.ProxyParseException ex) { } return false; @@ -3395,11 +3331,11 @@ public class SessionKeeper builder.append(new JLabel("<html><b>Endpoints:</b></html>"), new JLabel(inf.getEndpoint())); - Ice.Identity id = new Ice.Identity(); + com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity(); id.name = inf.getDirect() ? "Locator" : "router"; id.category = inf.getInstanceName(); StringBuilder endpoint = new StringBuilder(); - endpoint.append(Ice.Util.identityToString(id)); + endpoint.append(com.zeroc.Ice.Util.identityToString(id)); endpoint.append(":"); endpoint.append(inf.getEndpoint()); ssl = containsSecureEndpoints(endpoint.toString()); @@ -3454,7 +3390,6 @@ public class SessionKeeper } } - private class ConnectionManagerDialog extends JDialog { ConnectionManagerDialog() @@ -3691,7 +3626,7 @@ public class SessionKeeper if(e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { Object obj = _connectionListModel.getElementAt( - _connectionList.locationToIndex(e.getPoint())); + _connectionList.locationToIndex(e.getPoint())); if(obj != null && obj instanceof ConnectionInfo) { ConnectionInfo inf = (ConnectionInfo)obj; @@ -3907,11 +3842,16 @@ public class SessionKeeper public class KeyStorePanel extends JPanel { + public class RequestPasswordResult + { + public char[] password; + public boolean accepted; + } - public char[] requestPassword(String title, String label, Ice.BooleanHolder accepted) + public RequestPasswordResult requestPassword(String title, String label) { + RequestPasswordResult r = new RequestPasswordResult(); final JPasswordField passwordField = new JPasswordField(); - char[] password = null; JOptionPane optionPane = new JOptionPane(new JComponent[]{new JLabel(label), passwordField}, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = optionPane.createDialog(KeyStorePanel.this, title); @@ -3921,14 +3861,7 @@ public class SessionKeeper @Override public void componentShown(ComponentEvent e) { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - passwordField.requestFocusInWindow(); - } - }); + SwingUtilities.invokeLater(() -> passwordField.requestFocusInWindow()); } }); dialog.setLocationRelativeTo(KeyStorePanel.this); @@ -3938,14 +3871,14 @@ public class SessionKeeper if(result != null && result instanceof Integer && ((Integer)result).intValue() == JOptionPane.OK_OPTION) { - password = passwordField.getPassword(); - accepted.value = true; + r.password = passwordField.getPassword(); + r.accepted = true; } else { - accepted.value = false; + r.accepted = false; } - return password; + return r; } public KeyStorePanel() throws java.security.KeyStoreException @@ -4070,7 +4003,7 @@ public class SessionKeeper chooser.setFileFilter(new FileFilter() { - //Accept all directories and *.pem, *.crt files. + // Accept all directories and *.pem, *.crt files. @Override public boolean accept(File f) { @@ -4130,19 +4063,17 @@ public class SessionKeeper if(pkcs12) { KeyStore keyStore = null; - char[] password = null; boolean loaded = false; while(true) { try { - Ice.BooleanHolder accepted = new Ice.BooleanHolder(); keyStore = KeyStore.getInstance("pkcs12"); - password = requestPassword("KeyStore Password - IceGrid Admin", - "KeyStore password:", accepted); - if(accepted.value) + RequestPasswordResult r = requestPassword("KeyStore Password - IceGrid Admin", + "KeyStore password:"); + if(r.accepted) { - keyStore.load(new FileInputStream(keyFile), password); + keyStore.load(new FileInputStream(keyFile), r.password); loaded = true; } break; @@ -4168,7 +4099,6 @@ public class SessionKeeper { try { - importKeyStore(keyStore); } catch(java.lang.Exception ex) @@ -4315,7 +4245,6 @@ public class SessionKeeper _removeButton.setAction(removeAction); } - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(builder.getPanel()); JComponent buttonBar = new ButtonBarBuilder().addButton(_importButton, _viewButton, _removeButton). @@ -4337,18 +4266,17 @@ public class SessionKeeper String alias = aliases.nextElement(); if(keyStore.isKeyEntry(alias)) { - char[] password = null; + RequestPasswordResult r = null; Key key = null; while(true) { try { - Ice.BooleanHolder accepted = new Ice.BooleanHolder(); - password = requestPassword("Certificate Password For <" + alias + "> - IceGrid Admin", - "Certificate password for <" + alias + ">:", accepted); - if(accepted.value) + r = requestPassword("Certificate Password For <" + alias + "> - IceGrid Admin", + "Certificate password for <" + alias + ">:"); + if(r.accepted) { - key = keyStore.getKey(alias, password); + key = keyStore.getKey(alias, r.password); } break; } @@ -4391,7 +4319,7 @@ public class SessionKeeper continue; } } - _keyStore.setKeyEntry(newAlias, key, password, chain); + _keyStore.setKeyEntry(newAlias, key, r.password, chain); } else if(keyStore.isCertificateEntry(alias)) { @@ -4442,7 +4370,7 @@ public class SessionKeeper _keyStore.store(new FileOutputStream(_keyStorePath), new char[]{}); } - _aliases = new java.util.Vector<String>(); + _aliases = new java.util.Vector<>(); for(Enumeration<String> e = _keyStore.aliases(); e.hasMoreElements() ;) { _aliases.add(e.nextElement()); @@ -4470,7 +4398,7 @@ public class SessionKeeper // public static JPanel getSubjectPanel(X509Certificate cert) throws javax.naming.InvalidNameException { - java.util.HashMap< String, Object> details = new java.util.HashMap< String, Object>(); + java.util.HashMap< String, Object> details = new java.util.HashMap<>(); LdapName dn = new LdapName(cert.getSubjectX500Principal().getName()); for(Rdn rdn: dn.getRdns()) { @@ -4488,7 +4416,7 @@ public class SessionKeeper if(details.get("CN") != null) { builder.append(new JLabel("<html><b>Common Name (CN):</b></html>"), - new JLabel(details.get("CN").toString())); + new JLabel(details.get("CN").toString())); } else { @@ -4498,7 +4426,7 @@ public class SessionKeeper if(details.get("O") != null) { builder.append(new JLabel("<html><b>Organization (O):</b></html>"), - new JLabel(details.get("O").toString())); + new JLabel(details.get("O").toString())); } else { @@ -4508,21 +4436,21 @@ public class SessionKeeper if(details.get("OU") != null) { builder.append(new JLabel("<html><b>Organization Unit (OU):</b></html>"), - new JLabel(details.get("OU").toString())); + new JLabel(details.get("OU").toString())); } else { builder.append(new JLabel("<html><b>Organization Unit (OU):</b></html>")); } builder.append(new JLabel("<html><b>Serial Number:</b></html>"), - new JLabel(cert.getSerialNumber().toString())); + new JLabel(cert.getSerialNumber().toString())); return builder.getPanel(); } public static JPanel getIssuerPanel(X509Certificate cert) throws javax.naming.InvalidNameException { - java.util.HashMap< String, Object> details = new java.util.HashMap< String, Object>(); + java.util.HashMap< String, Object> details = new java.util.HashMap<>(); LdapName dn = new LdapName(cert.getIssuerX500Principal().getName()); for(Rdn rdn: dn.getRdns()) @@ -4540,7 +4468,7 @@ public class SessionKeeper if(details.get("CN") != null) { builder.append(new JLabel("<html><b>Common Name (CN):</b></html>"), - new JLabel(details.get("CN").toString())); + new JLabel(details.get("CN").toString())); } else { @@ -4550,7 +4478,7 @@ public class SessionKeeper if(details.get("O") != null) { builder.append(new JLabel("<html><b>Organization (O):</b></html>"), - new JLabel(details.get("O").toString())); + new JLabel(details.get("O").toString())); } else { @@ -4560,7 +4488,7 @@ public class SessionKeeper if(details.get("OU") != null) { builder.append(new JLabel("<html><b>Organization Unit (OU):</b></html>"), - new JLabel(details.get("OU").toString())); + new JLabel(details.get("OU").toString())); } else { @@ -4631,7 +4559,6 @@ public class SessionKeeper new JLabel(sha1Fingerprint)); builder.nextLine(); - String md5Fingerprint = ""; { MessageDigest md = MessageDigest.getInstance("MD5"); @@ -4660,8 +4587,7 @@ public class SessionKeeper } md5Fingerprint = sb.toString().toUpperCase(); } - builder.append(new JLabel("<html><b>MD5 Fingerprint:</b></html>"), - new JLabel(md5Fingerprint)); + builder.append(new JLabel("<html><b>MD5 Fingerprint:</b></html>"), new JLabel(md5Fingerprint)); builder.nextLine(); return builder.getPanel(); @@ -4925,12 +4851,14 @@ public class SessionKeeper _storePassword.setEnabled(_password.getPassword() != null && _password.getPassword().length > 0); } + @Override public void removeUpdate(DocumentEvent e) { _storePassword.setEnabled(_password.getPassword() != null && _password.getPassword().length > 0); } + @Override public void insertUpdate(DocumentEvent e) { @@ -4964,12 +4892,14 @@ public class SessionKeeper _storeKeyPassword.setEnabled(_keyPassword.getPassword() != null && _keyPassword.getPassword().length > 0); } + @Override public void removeUpdate(DocumentEvent e) { _storeKeyPassword.setEnabled(_keyPassword.getPassword() != null && _keyPassword.getPassword().length > 0); } + @Override public void insertUpdate(DocumentEvent e) { @@ -5114,12 +5044,14 @@ public class SessionKeeper _storeKeyPassword.setEnabled(_keyPassword.getPassword() != null && _keyPassword.getPassword().length > 0); } + @Override public void removeUpdate(DocumentEvent e) { _storeKeyPassword.setEnabled(_keyPassword.getPassword() != null && _keyPassword.getPassword().length > 0); } + @Override public void insertUpdate(DocumentEvent e) { @@ -5175,7 +5107,7 @@ public class SessionKeeper cancelButton.setAction(cancelAction); JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(okButton, cancelButton). - addGlue().build(); + addGlue().build(); buttonBar.setBorder(Borders.DIALOG); contentPane.add(buttonBar); @@ -5230,7 +5162,7 @@ public class SessionKeeper { _replicaName = session.getReplicaName(); } - catch(Ice.LocalException e) + catch(com.zeroc.Ice.LocalException e) { logout(true); JOptionPane.showMessageDialog( @@ -5256,63 +5188,48 @@ public class SessionKeeper // // Create the session in is own thread as it made remote calls // - new Thread(new Runnable() + new Thread(() -> { - @Override - public void run() + try { - try - { - setSession(new Session(session, sessionTimeout, acmTimeout, !info.getDirect(), parent)); - } - catch(java.lang.Throwable e) + setSession(new Session(session, sessionTimeout, acmTimeout, !info.getDirect(), parent)); + } + catch(java.lang.Throwable e) + { + SwingUtilities.invokeLater(() -> _connectionManagerDialog.setCursor(oldCursor)); + return; + } + + SwingUtilities.invokeLater(() -> { - SwingUtilities.invokeLater(new Runnable() - { - @Override - public void run() - { - _connectionManagerDialog.setCursor(oldCursor); - } - }); - return; - } + _connectionManagerDialog.setCursor(oldCursor); + _connectionManagerDialog.setVisible(false); + if(!info.getStorePassword()) + { + info.setPassword(null); + } + if(!info.getStoreKeyPassword()) + { + info.setKeyPassword(null); + } - SwingUtilities.invokeLater(new Runnable() + if(info.getStorePassword() || info.getStoreKeyPassword()) { - @Override - public void run() + try { - _connectionManagerDialog.setCursor(oldCursor); - _connectionManagerDialog.setVisible(false); - if(!info.getStorePassword()) - { - info.setPassword(null); - } - if(!info.getStoreKeyPassword()) - { - info.setKeyPassword(null); - } - - if(info.getStorePassword() || info.getStoreKeyPassword()) - { - try - { - info.save(); - } - catch(java.util.prefs.BackingStoreException ex) - { - JOptionPane.showMessageDialog( - _coordinator.getMainFrame(), - ex.toString(), - "Error saving connection", - JOptionPane.ERROR_MESSAGE); - } - _connectionManagerDialog.load(); - } + info.save(); } - }); - } + catch(java.util.prefs.BackingStoreException ex) + { + JOptionPane.showMessageDialog( + _coordinator.getMainFrame(), + ex.toString(), + "Error saving connection", + JOptionPane.ERROR_MESSAGE); + } + _connectionManagerDialog.load(); + } + }); }).start(); } @@ -5358,12 +5275,14 @@ public class SessionKeeper _storePassword.setEnabled(_password.getPassword() != null && _password.getPassword().length > 0); } + @Override public void removeUpdate(DocumentEvent e) { _storePassword.setEnabled(_password.getPassword() != null && _password.getPassword().length > 0); } + @Override public void insertUpdate(DocumentEvent e) { @@ -5401,12 +5320,14 @@ public class SessionKeeper _storeKeyPassword.setEnabled(_keyPassword.getPassword() != null && _keyPassword.getPassword().length > 0); } + @Override public void removeUpdate(DocumentEvent e) { _storeKeyPassword.setEnabled(_keyPassword.getPassword() != null && _keyPassword.getPassword().length > 0); } + @Override public void insertUpdate(DocumentEvent e) { @@ -5488,7 +5409,7 @@ public class SessionKeeper }); JComponent buttonBar = new ButtonBarBuilder().addGlue().addButton(okButton, editConnectionButton, - cancelButton).addGlue().build(); + cancelButton).addGlue().build(); buttonBar.setBorder(Borders.DIALOG); contentPane.add(buttonBar); @@ -5553,17 +5474,17 @@ public class SessionKeeper return _session == null ? null : _session.getServerAdminCategory(); } - Ice.ObjectPrx addCallback(Ice.Object servant, String name, String facet) + com.zeroc.Ice.ObjectPrx addCallback(com.zeroc.Ice.Object servant, String name, String facet) { return _session == null ? null : _session.addCallback(servant, name, facet); } - Ice.ObjectPrx retrieveCallback(String name, String facet) + com.zeroc.Ice.ObjectPrx retrieveCallback(String name, String facet) { return _session == null ? null : _session.retrieveCallback(name, facet); } - Ice.Object removeCallback(String name, String facet) + com.zeroc.Ice.Object removeCallback(String name, String facet) { return _session == null ? null : _session.removeCallback(name, facet); } diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/SimpleInternalFrame.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SimpleInternalFrame.java index 14b0a514911..860e203da78 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/SimpleInternalFrame.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/SimpleInternalFrame.java @@ -28,7 +28,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.*; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/StatusBar.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/StatusBar.java index 8e994f5f3fe..ed489da0bd2 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/StatusBar.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/StatusBar.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; public interface StatusBar { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Tab.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Tab.java index 58f70f1d405..6db8dd99fef 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Tab.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Tab.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; public interface Tab { diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/TreeNodeBase.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/TreeNodeBase.java index 5c961cc7547..c4e877adf6a 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/TreeNodeBase.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/TreeNodeBase.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.util.Enumeration; @@ -127,9 +127,7 @@ public class TreeNodeBase implements javax.swing.tree.TreeNode, TreeCellRenderer public java.util.LinkedList<String> getFullId() { - java.util.LinkedList<String> result = _parent == null ? - new java.util.LinkedList<String>() : - _parent.getFullId(); + java.util.LinkedList<String> result = _parent == null ? new java.util.LinkedList<>() : _parent.getFullId(); result.add(_id); return result; diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/Utils.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java index 9ae439c5d52..b91cc49f677 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/Utils.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/Utils.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.Graphics2D; @@ -20,7 +20,7 @@ import javax.swing.ImageIcon; import javax.swing.JDialog; import javax.swing.JComponent; import javax.swing.KeyStroke; -import IceGrid.*; +import com.zeroc.IceGrid.*; public class Utils { @@ -136,19 +136,19 @@ public class Utils public String toString(Object obj); } + static public class StringifyResult + { + public String returnValue; + public String toolTip; + } + // // Stringify helpers // - static public String stringify(java.util.Collection<?> col, - Stringifier stringifier, - String separator, - Ice.StringHolder toolTipHolder) + static public StringifyResult stringify(java.util.Collection<?> col, Stringifier stringifier, String separator) { - String result = ""; - if(toolTipHolder != null) - { - toolTipHolder.value = null; - } + StringifyResult r = new StringifyResult(); + r.returnValue = ""; java.util.Iterator<?> p = col.iterator(); @@ -161,53 +161,43 @@ public class Utils if(firstElement) { firstElement = false; - if(toolTipHolder != null) - { - toolTipHolder.value = "<html>"; - } + r.toolTip = "<html>"; } else { - result += separator; - if(toolTipHolder != null) - { - toolTipHolder.value += "<br>"; - } + r.returnValue += separator; + r.toolTip += "<br>"; } if(elt.length() == 0) { - result += "\"\""; + r.returnValue += "\"\""; } else if(elt.matches("\\S*")) { // // Only non-whitespace characters // - result += elt; + r.returnValue += elt; } else { - result += '"' + elt + '"'; + r.returnValue += '"' + elt + '"'; } - if(toolTipHolder != null) - { - toolTipHolder.value += elt; - } + r.toolTip += elt; } } - if(toolTipHolder != null && toolTipHolder.value != null) + if(r.toolTip != null) { - toolTipHolder.value += "</html>"; + r.toolTip += "</html>"; } - return result; + return r; } - static public String stringify(java.util.Collection<?> col, String separator, Ice.StringHolder toolTipHolder) + static public StringifyResult stringify(java.util.Collection<?> col, String separator) { - Stringifier stringifier = new Stringifier() { @Override @@ -216,20 +206,17 @@ public class Utils return (String)obj; } }; - return stringify(col, stringifier, separator, toolTipHolder); - + return stringify(col, stringifier, separator); } - static public String stringify(String[] stringSeq, String separator, Ice.StringHolder toolTipHolder) + static public StringifyResult stringify(String[] stringSeq, String separator) { - - return stringify(java.util.Arrays.asList(stringSeq), separator, toolTipHolder); + return stringify(java.util.Arrays.asList(stringSeq), separator); } - static public String stringify(java.util.Map<String, String> stringMap, - final String pairSeparator, - String separator, - Ice.StringHolder toolTipHolder) + static public StringifyResult stringify(java.util.Map<String, String> stringMap, + final String pairSeparator, + String separator) { Stringifier stringifier = new Stringifier() { @@ -242,7 +229,7 @@ public class Utils } }; - return stringify(stringMap.entrySet(), stringifier, separator, toolTipHolder); + return stringify(stringMap.entrySet(), stringifier, separator); } static public class Resolver @@ -260,7 +247,7 @@ public class Utils public Resolver(java.util.Map<String, String>[] variables) { _variables = variables; - _predefinedVariables = new java.util.HashMap<String, String>(); + _predefinedVariables = new java.util.HashMap<>(); _parameters = null; _subResolver = this; @@ -287,7 +274,7 @@ public class Utils public Resolver(Resolver parent) { _variables = parent._variables; - _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables); + _predefinedVariables = new java.util.HashMap<>(parent._predefinedVariables); _parameters = parent._parameters; if(_parameters == null) { @@ -360,7 +347,7 @@ public class Utils java.util.Map<String, String> defaults) { assert _variables == parent._variables; - _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables); + _predefinedVariables = new java.util.HashMap<>(parent._predefinedVariables); _parameters = parent.substituteParameterValues(parameters, defaults); _subResolver = new Resolver(_variables, _predefinedVariables); @@ -369,7 +356,7 @@ public class Utils public void reset(Resolver parent) { assert _variables == parent._variables; - _predefinedVariables = new java.util.HashMap<String, String>(parent._predefinedVariables); + _predefinedVariables = new java.util.HashMap<>(parent._predefinedVariables); assert _parameters == parent._parameters; if(_parameters == null) @@ -459,7 +446,7 @@ public class Utils public java.util.Map<String, String> substituteParameterValues(java.util.Map<String, String> input, java.util.Map<String, String> defaults) { - java.util.Map<String, String> result = new java.util.HashMap<String, String>(); + java.util.Map<String, String> result = new java.util.HashMap<>(); for(java.util.Map.Entry<String, String> p : input.entrySet()) { result.put(p.getKey(), substitute(p.getValue())); @@ -506,7 +493,7 @@ public class Utils java.util.List<ExpandedPropertySet> propertySets, Resolver resolver) { - java.util.SortedMap<String, String> toMap = new java.util.TreeMap<String, String>(); + java.util.SortedMap<String, String> toMap = new java.util.TreeMap<>(); for(ExpandedPropertySet p : propertySets) { addSet(p, resolver, toMap); @@ -517,7 +504,7 @@ public class Utils static public java.util.SortedMap<String, String> propertySetToMap(ExpandedPropertySet propertySet, Resolver resolver) { - java.util.List<ExpandedPropertySet> list = new java.util.LinkedList<ExpandedPropertySet>(); + java.util.List<ExpandedPropertySet> list = new java.util.LinkedList<>(); list.add(propertySet); return propertySetsToMap(list, resolver); } @@ -537,4 +524,3 @@ public class Utils } } } - diff --git a/java/src/IceGridGUI/src/main/java/IceGridGUI/XMLWriter.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/XMLWriter.java index 48e5df943df..efa69f50a7f 100644 --- a/java/src/IceGridGUI/src/main/java/IceGridGUI/XMLWriter.java +++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/XMLWriter.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package IceGridGUI; +package com.zeroc.IceGridGUI; import java.io.*; @@ -110,8 +110,7 @@ public class XMLWriter } } - private String - escape(String input) + private String escape(String input) { String v = input; diff --git a/java/src/IceLocatorDiscovery/build.gradle b/java/src/IceLocatorDiscovery/build.gradle index 0ef49c788be..5d567924de1 100644 --- a/java/src/IceLocatorDiscovery/build.gradle +++ b/java/src/IceLocatorDiscovery/build.gradle @@ -7,8 +7,10 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "IceLocatorDiscovery" project.ext.description = "Ice plug-in that enables the discovery of IceGrid and custom locators via UDP multicast" diff --git a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginFactory.java index 89b2cbba771..98ac988ed37 100644 --- a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginFactory.java +++ b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginFactory.java @@ -7,13 +7,12 @@ // // ********************************************************************** -package IceLocatorDiscovery; +package com.zeroc.IceLocatorDiscovery; -public class PluginFactory implements Ice.PluginFactory +public class PluginFactory implements com.zeroc.Ice.PluginFactory { @Override - public Ice.Plugin - create(Ice.Communicator communicator, String name, String[] args) + public com.zeroc.Ice.Plugin create(com.zeroc.Ice.Communicator communicator, String name, String[] args) { return new PluginI(communicator); } diff --git a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java index b2fb41d7ced..8253ad0a9f5 100644 --- a/java/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java +++ b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java @@ -7,89 +7,85 @@ // // ********************************************************************** -package IceLocatorDiscovery; +package com.zeroc.IceLocatorDiscovery; import java.util.List; import java.util.Arrays; import java.util.ArrayList; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; -class PluginI implements Ice.Plugin +class PluginI implements com.zeroc.Ice.Plugin { private static class Request { Request(LocatorI locator, String operation, - Ice.OperationMode mode, + com.zeroc.Ice.OperationMode mode, byte[] inParams, java.util.Map<String, String> context, - Ice.AMD_Object_ice_invoke amdCB) + CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f) { _locator = locator; _operation = operation; _mode = mode; _inParams = inParams; _context = context; - _amdCB = amdCB; + _future = f; } - void - invoke(Ice.LocatorPrx l) + void invoke(com.zeroc.Ice.LocatorPrx l) { _locatorPrx = l; try { - l.begin_ice_invoke(_operation, _mode, _inParams, _context, - new Ice.Callback_Object_ice_invoke() + final CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f = + l.ice_invokeAsync(_operation, _mode, _inParams, _context); + f.whenComplete((result, ex) -> { - @Override - public void - response(boolean ok, byte[] outParams) + if(ex != null) { - _amdCB.ice_response(ok, outParams); + exception((com.zeroc.Ice.LocalException)ex); } - - @Override - public void - exception(Ice.LocalException ex) + else { - Request.this.exception(ex); + _future.complete(result); } }); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { exception(ex); } } - private void - exception(Ice.LocalException ex) + private void exception(com.zeroc.Ice.LocalException ex) { try { throw ex; } - catch(Ice.RequestFailedException exc) + catch(com.zeroc.Ice.RequestFailedException exc) { - _amdCB.ice_exception(ex); + _future.completeExceptionally(ex); } - catch(Ice.UnknownException exc) + catch(com.zeroc.Ice.UnknownException exc) { - _amdCB.ice_exception(ex); + _future.completeExceptionally(ex); } - catch(Ice.NoEndpointException exc) + catch(com.zeroc.Ice.NoEndpointException exc) { - _amdCB.ice_exception(new Ice.ObjectNotExistException()); + _future.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException()); } - catch(Ice.ObjectAdapterDeactivatedException exc) + catch(com.zeroc.Ice.ObjectAdapterDeactivatedException exc) { - _amdCB.ice_exception(new Ice.ObjectNotExistException()); + _future.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException()); } - catch(Ice.CommunicatorDestroyedException exc) + catch(com.zeroc.Ice.CommunicatorDestroyedException exc) { - _amdCB.ice_exception(new Ice.ObjectNotExistException()); + _future.completeExceptionally(new com.zeroc.Ice.ObjectNotExistException()); } - catch(Ice.LocalException exc) + catch(com.zeroc.Ice.LocalException exc) { _locator.invoke(_locatorPrx, Request.this); // Retry with new locator proxy } @@ -97,47 +93,46 @@ class PluginI implements Ice.Plugin private final LocatorI _locator; private final String _operation; - private final Ice.OperationMode _mode; + private final com.zeroc.Ice.OperationMode _mode; private final java.util.Map<String, String> _context; private final byte[] _inParams; - private final Ice.AMD_Object_ice_invoke _amdCB; + private final CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> _future; - private Ice.LocatorPrx _locatorPrx; - }; + private com.zeroc.Ice.LocatorPrx _locatorPrx; + } - static private class VoidLocatorI extends Ice._LocatorDisp + static private class VoidLocatorI implements com.zeroc.Ice.Locator { @Override - public void - findObjectById_async(Ice.AMD_Locator_findObjectById amdCB, Ice.Identity id, Ice.Current current) + public CompletionStage<com.zeroc.Ice.ObjectPrx> findObjectByIdAsync(com.zeroc.Ice.Identity id, + com.zeroc.Ice.Current current) { - amdCB.ice_response(null); + return CompletableFuture.completedFuture((com.zeroc.Ice.ObjectPrx)null); } @Override - public void - findAdapterById_async(Ice.AMD_Locator_findAdapterById amdCB, String id, Ice.Current current) + public CompletionStage<com.zeroc.Ice.ObjectPrx> findAdapterByIdAsync(String id, com.zeroc.Ice.Current current) { - amdCB.ice_response(null); + return CompletableFuture.completedFuture((com.zeroc.Ice.ObjectPrx)null); } @Override - public Ice.LocatorRegistryPrx - getRegistry(Ice.Current current) + public com.zeroc.Ice.LocatorRegistryPrx getRegistry(com.zeroc.Ice.Current current) { return null; } - }; + } - private static class LocatorI extends Ice.BlobjectAsync + private static class LocatorI implements com.zeroc.Ice.BlobjectAsync { - LocatorI(LookupPrx lookup, Ice.Properties properties, String instanceName, Ice.LocatorPrx voidLocator) + LocatorI(LookupPrx lookup, com.zeroc.Ice.Properties properties, String instanceName, + com.zeroc.Ice.LocatorPrx voidLocator) { _lookup = lookup; _timeout = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Timeout", 300); _retryCount = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryCount", 3); _retryDelay = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryDelay", 2000); - _timer = IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); + _timer = com.zeroc.IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); _instanceName = instanceName; _warned = false; _locator = lookup.ice_getCommunicator().getDefaultLocator(); @@ -145,21 +140,21 @@ class PluginI implements Ice.Plugin _pendingRetryCount = 0; } - public void - setLookupReply(LookupReplyPrx lookupReply) + public void setLookupReply(LookupReplyPrx lookupReply) { _lookupReply = lookupReply; } @Override - public synchronized void - ice_invoke_async(Ice.AMD_Object_ice_invoke amdCB, byte[] inParams, Ice.Current current) + public CompletionStage<com.zeroc.Ice.Object.Ice_invokeResult> ice_invokeAsync(byte[] inParams, + com.zeroc.Ice.Current current) { - invoke(null, new Request(this, current.operation, current.mode, inParams, current.ctx, amdCB)); + CompletableFuture<com.zeroc.Ice.Object.Ice_invokeResult> f = new CompletableFuture<>(); + invoke(null, new Request(this, current.operation, current.mode, inParams, current.ctx, f)); + return f; } - public synchronized void - foundLocator(Ice.LocatorPrx locator) + public synchronized void foundLocator(com.zeroc.Ice.LocatorPrx locator) { if(locator == null || (!_instanceName.isEmpty() && !locator.ice_getIdentity().category.equals(_instanceName))) @@ -202,15 +197,15 @@ class PluginI implements Ice.Plugin // We found another locator replica, append its endpoints to the // current locator proxy endpoints. // - List<Ice.Endpoint> newEndpoints = new ArrayList<Ice.Endpoint>( + List<com.zeroc.Ice.Endpoint> newEndpoints = new ArrayList<>( Arrays.asList(_locator.ice_getEndpoints())); - for(Ice.Endpoint p : locator.ice_getEndpoints()) + for(com.zeroc.Ice.Endpoint p : locator.ice_getEndpoints()) { // // Only add endpoints if not already in the locator proxy endpoints // boolean found = false; - for(Ice.Endpoint q : newEndpoints) + for(com.zeroc.Ice.Endpoint q : newEndpoints) { if(p.equals(q)) { @@ -224,8 +219,8 @@ class PluginI implements Ice.Plugin } } - _locator = (Ice.LocatorPrx)_locator.ice_endpoints( - newEndpoints.toArray(new Ice.Endpoint[newEndpoints.size()])); + _locator = (com.zeroc.Ice.LocatorPrx)_locator.ice_endpoints( + newEndpoints.toArray(new com.zeroc.Ice.Endpoint[newEndpoints.size()])); } else { @@ -246,15 +241,13 @@ class PluginI implements Ice.Plugin _pendingRequests.clear(); } - - public synchronized void - invoke(Ice.LocatorPrx locator, Request request) + public synchronized void invoke(com.zeroc.Ice.LocatorPrx locator, Request request) { if(_locator != null && _locator != locator) { request.invoke(_locator); } - else if(IceInternal.Time.currentMonotonicTimeMillis() < _nextRetry) + else if(com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() < _nextRetry) { request.invoke(_voidLocator); // Don't retry to find a locator before the retry delay expires } @@ -269,10 +262,10 @@ class PluginI implements Ice.Plugin _pendingRetryCount = _retryCount; try { - _lookup.begin_findLocator(_instanceName, _lookupReply); // Send multicast request. + _lookup.findLocatorAsync(_instanceName, _lookupReply); // Send multicast request. _future = _timer.schedule(_retryTask, _timeout, java.util.concurrent.TimeUnit.MILLISECONDS); } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { for(Request req : _pendingRequests) { @@ -296,11 +289,11 @@ class PluginI implements Ice.Plugin { try { - _lookup.begin_findLocator(_instanceName, _lookupReply); // Send multicast request. + _lookup.findLocatorAsync(_instanceName, _lookupReply); // Send multicast request. _future = _timer.schedule(_retryTask, _timeout, java.util.concurrent.TimeUnit.MILLISECONDS); return; } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { } _pendingRetryCount = 0; @@ -311,7 +304,7 @@ class PluginI implements Ice.Plugin req.invoke(_voidLocator); } _pendingRequests.clear(); - _nextRetry = IceInternal.Time.currentMonotonicTimeMillis() + _retryDelay; + _nextRetry = com.zeroc.IceInternal.Time.currentMonotonicTimeMillis() + _retryDelay; } } @@ -327,15 +320,15 @@ class PluginI implements Ice.Plugin private String _instanceName; private boolean _warned; private LookupReplyPrx _lookupReply; - private Ice.LocatorPrx _locator; - private Ice.LocatorPrx _voidLocator; + private com.zeroc.Ice.LocatorPrx _locator; + private com.zeroc.Ice.LocatorPrx _voidLocator; private int _pendingRetryCount; - private List<Request> _pendingRequests = new ArrayList<Request>(); + private List<Request> _pendingRequests = new ArrayList<>(); private long _nextRetry; - }; + } - private class LookupReplyI extends _LookupReplyDisp + private class LookupReplyI implements LookupReply { LookupReplyI(LocatorI locator) { @@ -343,26 +336,23 @@ class PluginI implements Ice.Plugin } @Override - public void - foundLocator(Ice.LocatorPrx locator, Ice.Current curr) + public void foundLocator(com.zeroc.Ice.LocatorPrx locator, com.zeroc.Ice.Current curr) { _locator.foundLocator(locator); } private final LocatorI _locator; - }; + } - public - PluginI(Ice.Communicator communicator) + public PluginI(com.zeroc.Ice.Communicator communicator) { _communicator = communicator; } @Override - public void - initialize() + public void initialize() { - Ice.Properties properties = _communicator.getProperties(); + com.zeroc.Ice.Properties properties = _communicator.getProperties(); boolean ipv4 = properties.getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0; boolean preferIPv6 = properties.getPropertyAsInt("Ice.PreferIPv6Address") > 0; @@ -412,45 +402,46 @@ class PluginI implements Ice.Plugin lookupEndpoints = s.toString(); } - Ice.ObjectPrx lookupPrx = _communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" + lookupEndpoints); + com.zeroc.Ice.ObjectPrx lookupPrx = + _communicator.stringToProxy("IceLocatorDiscovery/Lookup -d:" + lookupEndpoints); lookupPrx = lookupPrx.ice_collocationOptimized(false); // No collocation optimization for the multicast proxy! try { lookupPrx.ice_getConnection(); // Ensure we can establish a connection to the multicast proxy } - catch(Ice.LocalException ex) + catch(com.zeroc.Ice.LocalException ex) { StringBuilder s = new StringBuilder(); s.append("IceLocatorDiscovery is unable to establish a multicast connection:\n"); s.append("proxy = ").append(lookupPrx.toString()).append("\n").append(ex); - throw new Ice.PluginInitializationException(s.toString()); + throw new com.zeroc.Ice.PluginInitializationException(s.toString()); } - Ice.LocatorPrx voidLoc = Ice.LocatorPrxHelper.uncheckedCast(_locatorAdapter.addWithUUID(new VoidLocatorI())); + com.zeroc.Ice.LocatorPrx voidLoc = + com.zeroc.Ice.LocatorPrx.uncheckedCast(_locatorAdapter.addWithUUID(new VoidLocatorI())); String instanceName = properties.getProperty("IceLocatorDiscovery.InstanceName"); - Ice.Identity id = new Ice.Identity(); + com.zeroc.Ice.Identity id = new com.zeroc.Ice.Identity(); id.name = "Locator"; id.category = !instanceName.isEmpty() ? instanceName : java.util.UUID.randomUUID().toString(); - LocatorI locator = new LocatorI(LookupPrxHelper.uncheckedCast(lookupPrx), properties, instanceName, voidLoc); - _communicator.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast(_locatorAdapter.addWithUUID(locator))); + LocatorI locator = new LocatorI(LookupPrx.uncheckedCast(lookupPrx), properties, instanceName, voidLoc); + _communicator.setDefaultLocator(com.zeroc.Ice.LocatorPrx.uncheckedCast(_locatorAdapter.addWithUUID(locator))); - Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(locator)).ice_datagram(); - locator.setLookupReply(LookupReplyPrxHelper.uncheckedCast(lookupReply)); + com.zeroc.Ice.ObjectPrx lookupReply = _replyAdapter.addWithUUID(new LookupReplyI(locator)).ice_datagram(); + locator.setLookupReply(LookupReplyPrx.uncheckedCast(lookupReply)); _replyAdapter.activate(); _locatorAdapter.activate(); } @Override - public void - destroy() + public void destroy() { _replyAdapter.destroy(); _locatorAdapter.destroy(); } - private Ice.Communicator _communicator; - private Ice.ObjectAdapter _locatorAdapter; - private Ice.ObjectAdapter _replyAdapter; + private com.zeroc.Ice.Communicator _communicator; + private com.zeroc.Ice.ObjectAdapter _locatorAdapter; + private com.zeroc.Ice.ObjectAdapter _replyAdapter; } diff --git a/java/src/IcePatch2/build.gradle b/java/src/IcePatch2/build.gradle index 4fc3e88e8a3..4d30cffa9ae 100644 --- a/java/src/IcePatch2/build.gradle +++ b/java/src/IcePatch2/build.gradle @@ -7,8 +7,10 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "IcePatch2" project.ext.description = "File distribution and patching for Ice" @@ -16,7 +18,7 @@ project.ext.description = "File distribution and patching for Ice" slice { java { set1 { - args = "--ice --tie --checksum IcePatch2.SliceChecksums" + args = "--ice --checksum com.zeroc.IcePatch2.SliceChecksums" files = fileTree(dir: "$sliceDir/IcePatch2", includes:['*.ice'], excludes:["*F.ice"]) } } diff --git a/java/src/IceStorm/build.gradle b/java/src/IceStorm/build.gradle index af5afb24b1d..2644a8da018 100644 --- a/java/src/IceStorm/build.gradle +++ b/java/src/IceStorm/build.gradle @@ -7,16 +7,27 @@ // // ********************************************************************** -sourceCompatibility = iceSourceCompatibility -targetCompatibility = iceTargetCompatibility +//sourceCompatibility = iceSourceCompatibility +//targetCompatibility = iceTargetCompatibility +sourceCompatibility = 1.8 +targetCompatibility = 1.8 project.ext.displayName = "IceStorm" project.ext.description = "Publish-subscribe event distribution service" +sourceSets { + main { + java { + // ice.jar already includes a marker for the IceMX package. + exclude '**/com/zeroc/IceMX/_Marker.java' + } + } +} + slice { java { set1 { - args = "--ice --tie --checksum IceStorm.SliceChecksums" + args = "--ice --checksum com.zeroc.IceStorm.SliceChecksums" files = fileTree(dir: "$sliceDir/IceStorm", includes:['*.ice'], excludes:["*F.ice"]) } } |