Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-02-11 23:28:37 -0500
committerslewis2008-02-11 23:28:37 -0500
commite077b8395292e5cdee7904dad2db18be12998cd2 (patch)
treeabb8415097bd85eb5887cac64550e75d9d522905
parent33b9da81882b9aa7825d6dfdd28cf16e1078e65c (diff)
downloadorg.eclipse.ecf-e077b8395292e5cdee7904dad2db18be12998cd2.tar.gz
org.eclipse.ecf-e077b8395292e5cdee7904dad2db18be12998cd2.tar.xz
org.eclipse.ecf-e077b8395292e5cdee7904dad2db18be12998cd2.zip
Added disconnect to RemoteEnvironmentInfoServiceAccessHandler. Added .settings to examples.remoteservices and examples.updatesite projects. Added usage instructions for remoteservices and updatesite servers.
-rw-r--r--server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java
index 2feb0f61b..6ffb94f75 100644
--- a/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java
+++ b/server-side/examples/bundles/org.eclipse.ecf.examples.remoteservices.client/src/org/eclipse/ecf/internal/examples/remoteservices/client/RemoteEnvironmentInfoServiceAccessHandler.java
@@ -11,13 +11,13 @@
package org.eclipse.ecf.internal.examples.remoteservices.client;
-import java.io.NotSerializableException;
import java.util.Arrays;
import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.ContainerCreateException;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.util.IAsyncResult;
import org.eclipse.ecf.discovery.ui.handlers.AbstractRemoteServiceAccessHandler;
import org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo;
import org.eclipse.ecf.remoteservice.IRemoteCall;
@@ -80,7 +80,7 @@ public class RemoteEnvironmentInfoServiceAccessHandler extends AbstractRemoteSer
container.disconnect();
// Otherwise we're already connected to the correct container, and we get the normal contributions
} else
- return super.getContributionsForMatchingService();
+ return getConnectedContributions(container);
}
// Otherwise we need to connect so we create a contribution to allow the user to connect
// Now we get the contribution to make connection to correct connectTargetID
@@ -109,8 +109,7 @@ public class RemoteEnvironmentInfoServiceAccessHandler extends AbstractRemoteSer
return NOT_AVAILABLE_CONTRIBUTION;
}
- private IRemoteCall createGetPropertyRemoteCall() throws ClassNotFoundException, NotSerializableException {
- IRemoteEnvironmentInfo.class.getDeclaredMethods();
+ protected IRemoteCall createRemoteCall() {
final InputDialog input = new InputDialog(null, "Get property", "Enter property key", "user.name", null);
input.setBlockOnOpen(true);
final Object[] params = new Object[1];
@@ -157,15 +156,19 @@ public class RemoteEnvironmentInfoServiceAccessHandler extends AbstractRemoteSer
final IAction action = new Action() {
public void run() {
try {
- final IRemoteCall remoteCall = createGetPropertyRemoteCall();
+ final IRemoteCall remoteCall = createRemoteCall();
if (remoteCall != null) {
switch (invokeMode) {
// callSynch
case 0 :
- showResult(IRemoteEnvironmentInfo.class.getName(), remoteCall, remoteService.callSynch(remoteCall));
+ // Actually call
+ Object result = remoteService.callSynch(remoteCall);
+ // Show result
+ showResult(IRemoteEnvironmentInfo.class.getName(), remoteCall, result);
break;
// callAsynch (listener)
case 1 :
+ // Actually call
remoteService.callAsynch(remoteCall, new IRemoteCallListener() {
public void handleEvent(IRemoteCallEvent event) {
if (event instanceof IRemoteCallCompleteEvent) {
@@ -180,21 +183,26 @@ public class RemoteEnvironmentInfoServiceAccessHandler extends AbstractRemoteSer
break;
// callAsynch (future)
case 2 :
- showResult(IRemoteEnvironmentInfo.class.getName(), remoteCall, remoteService.callAsynch(remoteCall).get());
+ // Actually call
+ IAsyncResult asyncResult = remoteService.callAsynch(remoteCall);
+ // Show result
+ showResult(IRemoteEnvironmentInfo.class.getName(), remoteCall, asyncResult.get());
break;
// proxy
case 3 :
IRemoteEnvironmentInfo proxy = (IRemoteEnvironmentInfo) remoteService.getProxy();
- showResult(IRemoteEnvironmentInfo.class.getName(), remoteCall, proxy.getProperty((String) remoteCall.getParameters()[0]));
+ // Actually call
+ Object proxyResult = proxy.getProperty((String) remoteCall.getParameters()[0]);
+ showResult(IRemoteEnvironmentInfo.class.getName(), remoteCall, proxyResult);
break;
}
}
} catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ MessageDialog.openError(null, "Invoke Exception", e.getLocalizedMessage());
}
}
};
+ // Set menu item text
switch (invokeMode) {
case 0 :
action.setText("getProperty (s)");

Back to the top