Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-06-12 20:08:41 +0000
committerslewis2014-06-12 20:08:41 +0000
commitd3dfa412d7f20ca4dc540922537be8e1f3dce094 (patch)
tree406c481459d946b563b6168187b7aba44fa18766 /framework
parentc28a9bebcf78dc077f1313504035a9db3cecbcad (diff)
parente6a34a588cbfec3b900de463ae0568f1743d0203 (diff)
downloadorg.eclipse.ecf-424059.tar.gz
org.eclipse.ecf-424059.tar.xz
org.eclipse.ecf-424059.zip
Merge remote-tracking branch 'origin/master' into 424059424059
Conflicts: framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF merged manually by sbl Change-Id: If086dde4fffb137f44a48d183f6280f068c8eb17
Diffstat (limited to 'framework')
-rw-r--r--framework/bundles/org.eclipse.ecf.console/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryNamespace.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryPlugin.java46
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/messages/SelectionMessage.java24
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF8
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java24
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AdapterManagerTracker.java44
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFRuntimeException.java23
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ExtensionRegistryRunnable.java66
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java247
-rw-r--r--framework/bundles/org.eclipse.ecf.presence.ui/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java1
-rw-r--r--framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties1
-rw-r--r--framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java32
-rw-r--r--framework/bundles/org.eclipse.ecf.presence/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IMultiResourceRosterEntry.java14
-rw-r--r--framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterEntry.java3
-rw-r--r--framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterResource.java11
-rw-r--r--framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterEntry.java58
-rw-r--r--framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterResource.java55
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF4
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/build.properties3
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java26
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java23
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLGenericContainerInstantiator.java23
-rw-r--r--framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLServerSOContainerGroup.java8
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.classpath7
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.gitignore1
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.project28
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.pde.core.prefs3
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF11
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/about.html28
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/build.properties7
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/bundle.properties10
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java14
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java50
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java15
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.classpath7
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.gitignore1
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.project28
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.pde.core.prefs3
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/META-INF/MANIFEST.MF12
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/about.html28
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/build.properties8
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/bundle.properties10
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java14
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java35
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java15
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest/META-INF/MANIFEST.MF9
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/internal/remoteservice/rest/Activator.java15
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientContainer.java34
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestID.java10
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestNamespace.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF18
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java16
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java42
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.servlet/META-INF/MANIFEST.MF12
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.servlet/build.properties5
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.servlet/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.soap/META-INF/MANIFEST.MF3
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.soap/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.ui/META-INF/MANIFEST.MF5
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/.settings/.api_filters12
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF3
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java226
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java7
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/RemoteCall.java3
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/RemoteServiceClientRegistration.java2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/RemoteFilterImpl.java34
-rw-r--r--framework/bundles/org.eclipse.ecf.sharedobject/META-INF/MANIFEST.MF6
-rw-r--r--framework/bundles/org.eclipse.ecf.sharedobject/build.properties1
-rw-r--r--framework/bundles/org.eclipse.ecf.sharedobject/plugin.properties2
-rw-r--r--framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java3
-rw-r--r--framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/internal/core/sharedobject/Activator.java122
-rw-r--r--framework/bundles/org.eclipse.ecf.sync/META-INF/MANIFEST.MF2
-rw-r--r--framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaDocumentChangeMessage.java52
-rw-r--r--framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java256
-rw-r--r--framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF8
-rw-r--r--framework/bundles/org.eclipse.ecf/javadoc.xml3
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/BaseContainer.java6
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerTypeDescription.java7
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java128
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java283
96 files changed, 1750 insertions, 726 deletions
diff --git a/framework/bundles/org.eclipse.ecf.console/plugin.properties b/framework/bundles/org.eclipse.ecf.console/plugin.properties
index 4a010e46b..02c8ca196 100644
--- a/framework/bundles/org.eclipse.ecf.console/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.console/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-plugin.name=ECF OSGi Console Provider
+plugin.name=ECF Console Provider
plugin.provider=Eclipse.org - ECF
diff --git a/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF
index c710b76b3..a126d7ab6 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF
@@ -14,7 +14,7 @@ Export-Package: org.eclipse.ecf.discovery;version="4.1.0",
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.ecf
+ org.eclipse.ecf;bundle-version="3.4.0"
Import-Package: org.eclipse.core.runtime.jobs,
org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework,
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryNamespace.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryNamespace.java
index 258de6c17..264c95401 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryNamespace.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryNamespace.java
@@ -20,6 +20,14 @@ public class DiscoveryNamespace extends Namespace {
private static final long serialVersionUID = 6474091408790223505L;
public static final String NAME = "ecf.namespace.discovery"; //$NON-NLS-1$
+ public DiscoveryNamespace() {
+ super();
+ }
+
+ public DiscoveryNamespace(String description) {
+ super(NAME, description);
+ }
+
/*
* (non-Javadoc)
*
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryPlugin.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryPlugin.java
index 5cead024a..c6ff207c0 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryPlugin.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryPlugin.java
@@ -10,8 +10,8 @@
package org.eclipse.ecf.internal.discovery;
import org.eclipse.core.runtime.*;
-import org.eclipse.ecf.core.util.LogHelper;
-import org.eclipse.ecf.core.util.PlatformHelper;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.*;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -29,7 +29,7 @@ public class DiscoveryPlugin implements BundleActivator {
private BundleContext context;
- private ServiceTracker adapterManagerTracker;
+ private AdapterManagerTracker adapterManagerTracker;
private ServiceTracker logServiceTracker = null;
/**
@@ -43,22 +43,16 @@ public class DiscoveryPlugin implements BundleActivator {
public IAdapterManager getAdapterManager() {
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- if (adapterManager == null)
- getDefault().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Cannot get adapter manager", null)); //$NON-NLS-1$
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
public LogService getLogService() {
if (logServiceTracker == null) {
- logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
+ logServiceTracker = new ServiceTracker(this.context,
+ LogService.class.getName(), null);
logServiceTracker.open();
}
return (LogService) logServiceTracker.getService();
@@ -67,23 +61,34 @@ public class DiscoveryPlugin implements BundleActivator {
public void log(IStatus status) {
LogService logService = getLogService();
if (logService != null) {
- logService.log(LogHelper.getLogCode(status), LogHelper.getLogMessage(status), status.getException());
+ logService.log(LogHelper.getLogCode(status),
+ LogHelper.getLogMessage(status), status.getException());
}
}
/**
* This method is called upon plug-in activation
- * @param ctxt the bundle context
- * @throws Exception
+ *
+ * @param ctxt
+ * the bundle context
+ * @throws Exception
*/
- public void start(BundleContext ctxt) throws Exception {
+ public void start(final BundleContext ctxt) throws Exception {
this.context = ctxt;
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithoutRegistry() throws Exception {
+ ctxt.registerService(Namespace.class, new DiscoveryNamespace(
+ "Discovery Namespace"), null);
+ }
+ });
}
/**
* This method is called when the plug-in is stopped
- * @param ctxt the bundle context
- * @throws Exception
+ *
+ * @param ctxt
+ * the bundle context
+ * @throws Exception
*/
public void stop(BundleContext ctxt) throws Exception {
if (logServiceTracker != null) {
@@ -100,6 +105,7 @@ public class DiscoveryPlugin implements BundleActivator {
/**
* Returns the shared instance.
+ *
* @return default discovery plugin instance.
*/
public synchronized static DiscoveryPlugin getDefault() {
@@ -112,7 +118,7 @@ public class DiscoveryPlugin implements BundleActivator {
public static boolean isStopped() {
return plugin == null;
}
-
+
public BundleContext getBundleContext() {
return context;
}
diff --git a/framework/bundles/org.eclipse.ecf.docshare/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.docshare/META-INF/MANIFEST.MF
index 210a60b7b..ed4bf185c 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.docshare/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.docshare;singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 3.0.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.docshare.Activator
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/messages/SelectionMessage.java b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/messages/SelectionMessage.java
index 451fd23e2..7932c8d6b 100644
--- a/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/messages/SelectionMessage.java
+++ b/framework/bundles/org.eclipse.ecf.docshare/src/org/eclipse/ecf/docshare/messages/SelectionMessage.java
@@ -21,19 +21,11 @@ public class SelectionMessage extends Message {
int offset;
int length;
- int startLine;
- int endLine;
- public SelectionMessage(int offset, int length, int startLine, int endLine) {
+ public SelectionMessage(int offset, int length) {
super();
this.offset = offset;
this.length = length;
- this.startLine = startLine;
- this.endLine = endLine;
- }
-
- public SelectionMessage(int offset, int length) {
- this(offset, length, -1, -1);
}
/**
@@ -50,18 +42,4 @@ public class SelectionMessage extends Message {
return length;
}
- /**
- * @return the startLine
- */
- public int getStartLine() {
- return startLine;
- }
-
- /**
- * @return the endLine
- */
- public int getEndLine() {
- return endLine;
- }
-
}
diff --git a/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF
index f840729f2..dbd41dee3 100644
--- a/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.identity;singleton:=true
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.4.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.core.identity.Activator
Bundle-Localization: plugin
Bundle-Vendor: %plugin.provider
Eclipse-LazyStart: true
Export-Package: org.eclipse.ecf.core.identity;version="3.2.0",
- org.eclipse.ecf.core.util;version="3.2.0",
+ org.eclipse.ecf.core.util;version="3.4.0",
org.eclipse.ecf.internal.core.identity;version="3.2.0";x-internal:=true
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
@@ -17,6 +17,6 @@ Import-Package: org.eclipse.osgi.service.debug;version="1.0.0",
org.osgi.service.log;version="1.3.0",
org.osgi.util.tracker;version="1.3.2"
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.equinox.registry
+ org.eclipse.equinox.registry;resolution:=optional
Bundle-ActivationPolicy: lazy; exclude:="org.eclipse.ecf.core.util"
-
+Provide-Capability: ecf.namespace;names:List<String>=”org.eclipse.ecf.core.identity.StringID,org.eclipse.ecf.core.identity.GUID,org.eclipse.ecf.core.identity.LongID,org.eclipse.ecf.core.identity.URIID”; version:Version=3.3
diff --git a/framework/bundles/org.eclipse.ecf.identity/plugin.properties b/framework/bundles/org.eclipse.ecf.identity/plugin.properties
index aeebc9090..ee9c0bc8c 100644
--- a/framework/bundles/org.eclipse.ecf.identity/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.identity/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-plugin.name=ECF Core Identity API
+plugin.name=ECF Identity Core API
plugin.provider=Eclipse.org - ECF
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java
index 7bbadf36a..d56bd52d6 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/IDFactory.java
@@ -8,7 +8,6 @@
******************************************************************************/
package org.eclipse.ecf.core.identity;
-import java.security.AccessController;
import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -23,12 +22,8 @@ public class IDFactory implements IIDFactory {
public static final String SECURITY_PROPERTY = IDFactory.class.getName()
+ ".security"; //$NON-NLS-1$
- private static final int IDENTITY_CREATION_ERRORCODE = 2001;
-
private static Hashtable namespaces = new Hashtable();
- private static boolean securityEnabled = false;
-
protected static IIDFactory instance = null;
static {
@@ -67,8 +62,6 @@ public class IDFactory implements IIDFactory {
public Namespace addNamespace(Namespace namespace) throws SecurityException {
if (namespace == null)
return null;
- checkPermission(new NamespacePermission(namespace.toString(),
- NamespacePermission.ADD_NAMESPACE));
initialize();
return addNamespace0(namespace);
}
@@ -81,8 +74,6 @@ public class IDFactory implements IIDFactory {
protected final static void checkPermission(
NamespacePermission namespacepermission) throws SecurityException {
- if (securityEnabled)
- AccessController.checkPermission(namespacepermission);
}
/*
@@ -96,8 +87,6 @@ public class IDFactory implements IIDFactory {
throws SecurityException {
if (namespace == null)
return false;
- checkPermission(new NamespacePermission(namespace.toString(),
- NamespacePermission.CONTAINS_NAMESPACE));
initialize();
return containsNamespace0(namespace);
}
@@ -128,8 +117,6 @@ public class IDFactory implements IIDFactory {
public Namespace getNamespace(Namespace namespace) throws SecurityException {
if (namespace == null)
return null;
- checkPermission(new NamespacePermission(namespace.toString(),
- NamespacePermission.GET_NAMESPACE));
initialize();
return getNamespace0(namespace);
}
@@ -187,8 +174,8 @@ public class IDFactory implements IIDFactory {
e = new IDCreateException(s);
}
Activator.getDefault().log(
- new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- IDENTITY_CREATION_ERRORCODE, s, e));
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
+ s, e));
throw e;
}
@@ -268,13 +255,14 @@ public class IDFactory implements IIDFactory {
public Namespace removeNamespace(Namespace n) throws SecurityException {
if (n == null)
return null;
- checkPermission(new NamespacePermission(n.toString(),
- NamespacePermission.REMOVE_NAMESPACE));
initialize();
return removeNamespace0(n);
}
- protected final static Namespace removeNamespace0(Namespace n) {
+ /**
+ * @since 3.4
+ */
+ public final static Namespace removeNamespace0(Namespace n) {
if (n == null)
return null;
return (Namespace) namespaces.remove(n.getName());
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java
index 13133a6f5..2053d1e14 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/NamespacePermission.java
@@ -40,14 +40,6 @@ public class NamespacePermission extends BasicPermission {
}
public boolean implies(Permission p) {
- if ((p == null) || (p.getClass() != getClass()))
- return false;
- NamespacePermission np = (NamespacePermission) p;
- String act = getActions();
- if (act == null)
- return false;
- if (act.equals(ALL_NAMESPACE) || act.equals(np.getActions()))
- return true;
return false;
}
} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AdapterManagerTracker.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AdapterManagerTracker.java
new file mode 100644
index 000000000..a4346d064
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/AdapterManagerTracker.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.core.util;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ecf.internal.core.identity.Activator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+/**
+ * @since 3.4
+ */
+public class AdapterManagerTracker extends ServiceTracker {
+
+ public AdapterManagerTracker(BundleContext context,
+ ServiceTrackerCustomizer customizer) {
+ super(context, IAdapterManager.class.getName(), customizer);
+ }
+
+ public AdapterManagerTracker(BundleContext context) {
+ this(context, null);
+ }
+
+ public IAdapterManager getAdapterManager() {
+ IAdapterManager adapterManager = (IAdapterManager) getService();
+ // Then, if the service isn't there, try to get from Platform class via
+ // PlatformHelper class
+ if (adapterManager == null)
+ adapterManager = PlatformHelper.getPlatformAdapterManager();
+ if (adapterManager == null)
+ Activator.getDefault().log(
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ IStatus.ERROR, "Cannot get adapter manager", null)); //$NON-NLS-1$
+ return adapterManager;
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFRuntimeException.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFRuntimeException.java
index d96550d1d..6ef0a7e6d 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFRuntimeException.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ECFRuntimeException.java
@@ -49,29 +49,32 @@ public class ECFRuntimeException extends RuntimeException {
* @param cause
*/
public ECFRuntimeException(String message, Throwable cause) {
- this(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, ((message == null) ? "" : message), cause)); //$NON-NLS-1$
+ this(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0,
+ ((message == null) ? "" : message), cause)); //$NON-NLS-1$
}
/**
- * Creates a new exception with the given status object. The message
- * of the given status is used as the exception message.
+ * Creates a new exception with the given status object. The message of the
+ * given status is used as the exception message.
*
- * @param status the status object to be associated with this exception
+ * @param status
+ * the status object to be associated with this exception
*/
public ECFRuntimeException(IStatus status) {
super(status.getMessage());
+ initCause(status.getException());
this.status = status;
}
/**
* Returns the status object for this exception.
* <p>
- * <b>IMPORTANT:</b><br>
- * The result must NOT be used to log a <code>CoreException</code>
- * (e.g., using <code>yourPlugin.getLog().log(status);</code>),
- * since that code pattern hides the original stacktrace.
- * Instead, create a new {@link Status} with your plug-in ID and
- * this <code>CoreException</code>, and log that new status.
+ * <b>IMPORTANT:</b><br>
+ * The result must NOT be used to log a <code>CoreException</code> (e.g.,
+ * using <code>yourPlugin.getLog().log(status);</code>), since that code
+ * pattern hides the original stacktrace. Instead, create a new
+ * {@link Status} with your plug-in ID and this <code>CoreException</code>,
+ * and log that new status.
* </p>
*
* @return a status object
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ExtensionRegistryRunnable.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ExtensionRegistryRunnable.java
new file mode 100644
index 000000000..1264147d5
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/ExtensionRegistryRunnable.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.core.util;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.ecf.internal.core.identity.Activator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * @since 3.4
+ */
+public class ExtensionRegistryRunnable implements ISafeRunnable {
+
+ private BundleContext context;
+
+ public ExtensionRegistryRunnable(BundleContext ctxt) {
+ this.context = ctxt;
+ }
+
+ protected void runWithoutRegistry() throws Exception {
+ // by default do nothing
+ }
+
+ protected void runWithRegistry(IExtensionRegistry registry)
+ throws Exception {
+ // by default do nothing
+ }
+
+ protected void logWarning(Throwable exception) {
+ Activator a = Activator.getDefault();
+ if (a != null)
+ a.log(new Status(IStatus.WARNING, Activator.PLUGIN_ID,
+ IStatus.WARNING, "Warning: code cannot be run", exception)); //$NON-NLS-1$
+ }
+
+ public void run() throws Exception {
+ try {
+ runWithRegistry(getExtensionRegistry());
+ } catch (NoClassDefFoundError e) {
+ runWithoutRegistry();
+ }
+ }
+
+ private IExtensionRegistry getExtensionRegistry() {
+ if (context == null)
+ return null;
+ ServiceTracker extensionRegistryTracker = new ServiceTracker(context,
+ IExtensionRegistry.class.getName(), null);
+ extensionRegistryTracker.open();
+ IExtensionRegistry result = (IExtensionRegistry) extensionRegistryTracker
+ .getService();
+ extensionRegistryTracker.close();
+ return result;
+ }
+
+ public void handleException(Throwable exception) {
+ logWarning(exception);
+ }
+}
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java
index 0b186c026..08ccc7ce8 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/internal/core/identity/Activator.java
@@ -15,6 +15,7 @@ import org.eclipse.osgi.service.debug.DebugOptions;
import org.osgi.framework.*;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
/**
* The activator class controls the plug-in life cycle
@@ -24,60 +25,49 @@ public class Activator implements BundleActivator {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.ecf.identity"; //$NON-NLS-1$
- protected static final String NAMESPACE_NAME = "namespace"; //$NON-NLS-1$
+ private static final String NAMESPACE_NAME = "namespace"; //$NON-NLS-1$
- protected static final String NAMESPACE_EPOINT = PLUGIN_ID + "." //$NON-NLS-1$
+ private static final String NAMESPACE_EPOINT = PLUGIN_ID + "." //$NON-NLS-1$
+ NAMESPACE_NAME;
- protected static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+ private static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
- protected static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+ private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
- protected static final int REMOVE_NAMESPACE_ERRORCODE = 100;
+ private static final int FACTORY_NAME_COLLISION_ERRORCODE = 200;
- protected static final int FACTORY_NAME_COLLISION_ERRORCODE = 200;
-
- protected static final String DESCRIPTION_ATTRIBUTE = "description"; //$NON-NLS-1$
+ private static final String DESCRIPTION_ATTRIBUTE = "description"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
- private BundleContext context = null;
+ private BundleContext context;
- private IRegistryChangeListener registryManager = null;
+ private ServiceRegistration idFactoryServiceRegistration;
- private ServiceRegistration idFactoryServiceRegistration = null;
+ private ServiceTracker debugOptionsTracker;
- private ServiceTracker extensionRegistryTracker = null;
+ private ServiceTracker logServiceTracker;
- private ServiceTracker debugOptionsTracker = null;
+ private LogService logService;
- private ServiceTracker logServiceTracker = null;
+ private AdapterManagerTracker adapterManagerTracker;
- private LogService logService = null;
+ private ServiceTracker namespacesTracker;
- private ServiceTracker adapterManagerTracker = null;
+ // This is object rather than typed to avoid referencing the
+ // IRegistryChangedListener class directly
+ private Object registryManager;
public synchronized IAdapterManager getAdapterManager() {
if (this.context == null)
return null;
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context,
- IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker
- .getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- if (adapterManager == null)
- getDefault().log(
- new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR,
- "Cannot get adapter manager", null)); //$NON-NLS-1$
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
/**
@@ -87,17 +77,6 @@ public class Activator implements BundleActivator {
// public null constructor
}
- public synchronized IExtensionRegistry getExtensionRegistry() {
- if (this.context == null)
- return null;
- if (extensionRegistryTracker == null) {
- extensionRegistryTracker = new ServiceTracker(context,
- IExtensionRegistry.class.getName(), null);
- extensionRegistryTracker.open();
- }
- return (IExtensionRegistry) extensionRegistryTracker.getService();
- }
-
public synchronized DebugOptions getDebugOptions() {
if (context == null)
return null;
@@ -122,76 +101,102 @@ public class Activator implements BundleActivator {
idFactoryServiceRegistration = context.registerService(
IIDFactory.class.getName(), IDFactory.getDefault(), null);
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null) {
- this.registryManager = new IdentityRegistryManager();
- reg.addRegistryChangeListener(registryManager);
- }
- }
-
- public BundleContext getBundleContext() {
- return context;
- }
-
- protected class IdentityRegistryManager implements IRegistryChangeListener {
- public void registryChanged(IRegistryChangeEvent event) {
- final IExtensionDelta delta[] = event.getExtensionDeltas(PLUGIN_ID,
- NAMESPACE_NAME);
- for (int i = 0; i < delta.length; i++) {
- switch (delta[i].getKind()) {
- case IExtensionDelta.ADDED:
- addNamespaceExtensions(delta[i].getExtension()
- .getConfigurationElements());
- break;
- case IExtensionDelta.REMOVED:
- removeNamespaceExtensions(delta[i].getExtension()
- .getConfigurationElements());
- break;
+ namespacesTracker = new ServiceTracker(context,
+ Namespace.class.getName(), new ServiceTrackerCustomizer() {
+
+ public Object addingService(ServiceReference reference) {
+ Namespace ns = (Namespace) context
+ .getService(reference);
+ if (ns != null && ns.getName() != null)
+ IDFactory.addNamespace0(ns);
+ return ns;
+ }
+
+ public void modifiedService(ServiceReference reference,
+ Object service) {
+ }
+
+ public void removedService(ServiceReference reference,
+ Object service) {
+ IDFactory.removeNamespace0((Namespace) service);
+ }
+ });
+ namespacesTracker.open();
+
+ SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {
+ protected void runWithRegistry(IExtensionRegistry registry)
+ throws Exception {
+ if (registry != null) {
+ registryManager = new IRegistryChangeListener() {
+ public void registryChanged(IRegistryChangeEvent event) {
+ final IExtensionDelta delta[] = event
+ .getExtensionDeltas(PLUGIN_ID,
+ NAMESPACE_NAME);
+ for (int i = 0; i < delta.length; i++) {
+ switch (delta[i].getKind()) {
+ case IExtensionDelta.ADDED:
+ addNamespaceExtensions(delta[i]
+ .getExtension()
+ .getConfigurationElements());
+ break;
+ case IExtensionDelta.REMOVED:
+ IConfigurationElement[] members = delta[i]
+ .getExtension()
+ .getConfigurationElements();
+ for (int m = 0; m < members.length; m++) {
+ final IConfigurationElement member = members[m];
+ String name = null;
+ try {
+ name = member
+ .getAttribute(NAME_ATTRIBUTE);
+ if (name == null) {
+ name = member
+ .getAttribute(CLASS_ATTRIBUTE);
+ }
+ if (name == null)
+ continue;
+ final IIDFactory factory = IDFactory
+ .getDefault();
+ final Namespace n = factory
+ .getNamespaceByName(name);
+ if (n == null
+ || !factory
+ .containsNamespace(n)) {
+ continue;
+ }
+ // remove
+ factory.removeNamespace(n);
+ } catch (final Exception e) {
+ getDefault()
+ .log(new Status(
+ IStatus.ERROR,
+ Activator.PLUGIN_ID,
+ IStatus.ERROR,
+ "Exception removing namespace", e)); //$NON-NLS-1$
+ }
+ }
+ break;
+ }
+ }
+ }
+ };
+ registry.addRegistryChangeListener((IRegistryChangeListener) registryManager);
}
}
- }
+ });
}
- /**
- * Remove extensions for identity namespace extension point
- *
- * @param members
- * the members to remove
- */
- protected void removeNamespaceExtensions(IConfigurationElement[] members) {
- for (int m = 0; m < members.length; m++) {
- final IConfigurationElement member = members[m];
- String name = null;
- try {
- name = member.getAttribute(NAME_ATTRIBUTE);
- if (name == null) {
- name = member.getAttribute(CLASS_ATTRIBUTE);
- }
- if (name == null)
- continue;
- final IIDFactory factory = IDFactory.getDefault();
- final Namespace n = factory.getNamespaceByName(name);
- if (n == null || !factory.containsNamespace(n)) {
- continue;
- }
- // remove
- factory.removeNamespace(n);
- } catch (final Exception e) {
- getDefault().log(
- new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- REMOVE_NAMESPACE_ERRORCODE,
- "Exception removing namespace", e)); //$NON-NLS-1$
- }
- }
+ public BundleContext getBundleContext() {
+ return context;
}
- public Bundle getBundle() {
+ Bundle getBundle() {
if (context == null)
return null;
return context.getBundle();
}
- protected synchronized LogService getLogService() {
+ synchronized LogService getLogService() {
if (context == null) {
if (logService == null)
logService = new SystemLogService(PLUGIN_ID);
@@ -223,7 +228,7 @@ public class Activator implements BundleActivator {
* @param members
* the members to add
*/
- protected void addNamespaceExtensions(IConfigurationElement[] members) {
+ void addNamespaceExtensions(IConfigurationElement[] members) {
final String bundleName = getDefault().getBundle().getSymbolicName();
for (int m = 0; m < members.length; m++) {
final IConfigurationElement member = members[m];
@@ -270,16 +275,19 @@ public class Activator implements BundleActivator {
*
*/
public void setupNamespaceExtensionPoint() {
- // Process extension points
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null) {
- final IExtensionPoint extensionPoint = reg
- .getExtensionPoint(NAMESPACE_EPOINT);
- if (extensionPoint == null) {
- return;
+ SafeRunner.run(new ExtensionRegistryRunnable(context) {
+ protected void runWithRegistry(IExtensionRegistry registry)
+ throws Exception {
+ if (registry != null) {
+ final IExtensionPoint extensionPoint = registry
+ .getExtensionPoint(NAMESPACE_EPOINT);
+ if (extensionPoint == null)
+ return;
+ addNamespaceExtensions(extensionPoint
+ .getConfigurationElements());
+ }
}
- addNamespaceExtensions(extensionPoint.getConfigurationElements());
- }
+ });
}
/*
@@ -289,9 +297,17 @@ public class Activator implements BundleActivator {
* org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext ctxt) throws Exception {
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null)
- reg.removeRegistryChangeListener(registryManager);
+ SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {
+ protected void runWithRegistry(IExtensionRegistry registry)
+ throws Exception {
+ if (registry != null)
+ registry.removeRegistryChangeListener((IRegistryChangeListener) registryManager);
+ }
+ });
+ if (namespacesTracker != null) {
+ namespacesTracker.close();
+ namespacesTracker = null;
+ }
registryManager = null;
if (logServiceTracker != null) {
logServiceTracker.close();
@@ -302,10 +318,6 @@ public class Activator implements BundleActivator {
debugOptionsTracker.close();
debugOptionsTracker = null;
}
- if (extensionRegistryTracker != null) {
- extensionRegistryTracker.close();
- extensionRegistryTracker = null;
- }
if (idFactoryServiceRegistration != null) {
idFactoryServiceRegistration.unregister();
idFactoryServiceRegistration = null;
@@ -324,9 +336,8 @@ public class Activator implements BundleActivator {
* @return the shared instance
*/
public synchronized static Activator getDefault() {
- if (plugin == null) {
+ if (plugin == null)
plugin = new Activator();
- }
return plugin;
}
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.presence.ui/META-INF/MANIFEST.MF
index b7439962f..9491e9f78 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.presence.ui;singleton:=true
-Bundle-Version: 2.2.0.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.presence.ui.Activator
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java
index 0d3faf2fd..c9168453a 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/Messages.java
@@ -168,6 +168,7 @@ public class Messages extends NLS {
public static String MultiRosterView_SHOW_CHAT_ROOMS_FOR_ACCOUNT_ACTION_TEXT;
public static String MultiRosterView_ShowOffline;
+ public static String MultiRosterView_ShowAway;
public static String MultiRosterView_ShowEmptyGroups;
public static String MultiRosterView_AddContact;
public static String MultiRosterView_SearchContact;
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties
index 47c77cc2d..02a4acb7a 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/internal/presence/ui/messages.properties
@@ -23,6 +23,7 @@ MultiRosterView_SetDoNotDisturb = &Do Not Disturb
MultiRosterView_SetInvisible = &Invisible
MultiRosterView_SetOffline = &Offline
MultiRosterView_ShowOffline = Show &Offline Contacts
+MultiRosterView_ShowAway = Show &Away Contacts
MultiRosterView_ShowEmptyGroups = Show &Empty Groups
MultiRosterView_NO_IDENTIFIER_FOR_ROOM_TITLE=Could not create identifier for room
MultiRosterView_PASSWORD_NOT_CHANGED_MESSAGE=Error changing password
diff --git a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java
index 7e1eaad47..430d0b062 100644
--- a/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java
+++ b/framework/bundles/org.eclipse.ecf.presence.ui/src/org/eclipse/ecf/presence/ui/MultiRosterView.java
@@ -21,6 +21,7 @@ import org.eclipse.ecf.internal.presence.ui.Activator;
import org.eclipse.ecf.internal.presence.ui.Messages;
import org.eclipse.ecf.internal.presence.ui.dialogs.*;
import org.eclipse.ecf.presence.*;
+import org.eclipse.ecf.presence.IPresence.Mode;
import org.eclipse.ecf.presence.chatroom.IChatRoomInfo;
import org.eclipse.ecf.presence.im.*;
import org.eclipse.ecf.presence.roster.*;
@@ -95,6 +96,8 @@ public class MultiRosterView extends ViewPart implements IMultiRosterViewPart {
private IAction showEmptyGroupsAction;
+ private IAction showAwayAction;
+
private IAction addContactAction;
private IAction searchContactAction;
@@ -141,6 +144,21 @@ public class MultiRosterView extends ViewPart implements IMultiRosterViewPart {
}
};
+ private ViewerFilter showAwayFilter = new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IRosterEntry) {
+ IRosterEntry entry = (IRosterEntry) element;
+ IPresence presence = entry.getPresence();
+ if (presence != null) {
+ Mode m = presence.getMode();
+ return (m == IPresence.Mode.AVAILABLE || m == IPresence.Mode.CHAT || m == IPresence.Mode.DND);
+ }
+ return true;
+ }
+ return true;
+ }
+ };
+
/*
* (non-Javadoc)
*
@@ -171,6 +189,7 @@ public class MultiRosterView extends ViewPart implements IMultiRosterViewPart {
treeViewer.setLabelProvider(new MultiRosterLabelProvider());
treeViewer.addFilter(hideOfflineFilter);
treeViewer.addFilter(hideEmptyGroupsFilter);
+ treeViewer.addFilter(showAwayFilter);
treeViewer.setInput(rosterAccounts);
treeViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent e) {
@@ -461,6 +480,16 @@ public class MultiRosterView extends ViewPart implements IMultiRosterViewPart {
}
};
+ showAwayAction = new Action(Messages.MultiRosterView_ShowAway, IAction.AS_CHECK_BOX) {
+ public void run() {
+ if (isChecked()) {
+ treeViewer.removeFilter(showAwayFilter);
+ } else {
+ treeViewer.addFilter(showAwayFilter);
+ }
+ }
+ };
+
addContactAction = new Action(Messages.MultiRosterView_AddContact, SharedImages.getImageDescriptor(SharedImages.IMG_ADD_BUDDY)) {
public void run() {
AddContactDialog dialog = new AddContactDialog(treeViewer.getControl().getShell());
@@ -720,6 +749,7 @@ public class MultiRosterView extends ViewPart implements IMultiRosterViewPart {
setInvisibleAction.setEnabled(enabled);
setOfflineAction.setEnabled(enabled);
showOfflineAction.setEnabled(enabled);
+ showAwayAction.setEnabled(enabled);
showEmptyGroupsAction.setEnabled(enabled);
addContactAction.setEnabled(enabled);
searchContactAction.setEnabled(enabled);
@@ -741,6 +771,8 @@ public class MultiRosterView extends ViewPart implements IMultiRosterViewPart {
manager.add(showEmptyGroupsAction);
+ manager.add(showAwayAction);
+
manager.add(new Separator());
manager.add(addContactAction);
manager.add(new Separator());
diff --git a/framework/bundles/org.eclipse.ecf.presence/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.presence/META-INF/MANIFEST.MF
index fcaa97cc6..4367d3307 100644
--- a/framework/bundles/org.eclipse.ecf.presence/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.presence/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.presence;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.1.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.presence.PresencePlugin
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IMultiResourceRosterEntry.java b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IMultiResourceRosterEntry.java
new file mode 100644
index 000000000..9277f37a5
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IMultiResourceRosterEntry.java
@@ -0,0 +1,14 @@
+package org.eclipse.ecf.presence.roster;
+
+/**
+ * @since 2.1
+ */
+public interface IMultiResourceRosterEntry {
+
+ /**
+ * Get all the resources for this multi resource roster entry
+ * @return IRosterResource[] of resources. Will not return <code>null</code>.
+ */
+ public IRosterResource[] getResources();
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterEntry.java b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterEntry.java
index 75c3ec601..5f77bfd1a 100644
--- a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterEntry.java
+++ b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterEntry.java
@@ -12,7 +12,6 @@
package org.eclipse.ecf.presence.roster;
import java.util.Collection;
-
import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.presence.IPresence;
@@ -35,7 +34,7 @@ public interface IRosterEntry extends IRosterItem {
* Get groups associated with this roster entry. Instance in list are of
* type {@link IRosterGroup}
*
- * @return Iterator of groups that this roster entry belongs to. Will not
+ * @return Collection of IRosterGroup instances entry belongs to. Will not
* return <code>null</code>.
*/
public Collection getGroups();
diff --git a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterResource.java b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterResource.java
new file mode 100644
index 000000000..664895f0f
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/IRosterResource.java
@@ -0,0 +1,11 @@
+package org.eclipse.ecf.presence.roster;
+
+import org.eclipse.ecf.presence.IPresence;
+
+/**
+ * @since 2.1
+ */
+public interface IRosterResource extends IRosterItem {
+ // No new methods
+ public IPresence getPresence();
+}
diff --git a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterEntry.java b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterEntry.java
index fa33a6d12..691790808 100644
--- a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterEntry.java
+++ b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterEntry.java
@@ -21,7 +21,7 @@ import org.eclipse.ecf.presence.IPresence;
* created as appropriate.
*
*/
-public class RosterEntry extends RosterItem implements IRosterEntry {
+public class RosterEntry extends RosterItem implements IRosterEntry, IMultiResourceRosterEntry {
protected IUser user;
@@ -29,6 +29,11 @@ public class RosterEntry extends RosterItem implements IRosterEntry {
protected List groups;
+ /**
+ * @since 2.1
+ */
+ protected List resources;
+
public RosterEntry(IRosterItem parent, IUser user, IPresence presenceState) {
Assert.isNotNull(parent);
Assert.isNotNull(user);
@@ -40,6 +45,7 @@ public class RosterEntry extends RosterItem implements IRosterEntry {
groups.add(parent);
((RosterGroup) parent).add(this);
}
+ this.resources = new ArrayList();
}
public void setPresence(IPresence newPresence) {
@@ -129,6 +135,7 @@ public class RosterEntry extends RosterItem implements IRosterEntry {
public String toString() {
StringBuffer sb = new StringBuffer("RosterEntry["); //$NON-NLS-1$
synchronized (sb) {
+ sb.append("userid=" + getUser().getID().getName()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
sb.append("name=").append(getName()).append(';'); //$NON-NLS-1$
sb.append("presence=").append(presence).append(';'); //$NON-NLS-1$
sb.append("groups="); //$NON-NLS-1$
@@ -144,4 +151,53 @@ public class RosterEntry extends RosterItem implements IRosterEntry {
return sb.toString();
}
+ /**
+ * @since 2.1
+ */
+ public boolean updateResource(String resourceName, IPresence p) {
+ if (resourceName == null)
+ return false;
+ synchronized (resources) {
+ for (Iterator i = resources.iterator(); i.hasNext();) {
+ RosterResource r = (RosterResource) i.next();
+ if (r.getName().equals(resourceName)) {
+ r.setPresence(p);
+ return true;
+ }
+ }
+ resources.add(new RosterResource(this, resourceName, p));
+ return false;
+ }
+ }
+
+ /**
+ * @since 2.1
+ */
+ public RosterResource removeResource(String resourceName) {
+ if (resourceName == null)
+ return null;
+ RosterResource result = null;
+ synchronized (resources) {
+ for (Iterator i = resources.iterator(); i.hasNext();) {
+ RosterResource r = (RosterResource) i.next();
+ if (r.getName().equals(resourceName)) {
+ i.remove();
+ result = r;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @since 2.1
+ */
+ public IRosterResource[] getResources() {
+ List result = null;
+ synchronized (resources) {
+ result = new ArrayList(resources);
+ }
+ return (IRosterResource[]) result.toArray(new IRosterResource[result.size()]);
+ }
+
}
diff --git a/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterResource.java b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterResource.java
new file mode 100644
index 000000000..42c88e0f8
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.presence/src/org/eclipse/ecf/presence/roster/RosterResource.java
@@ -0,0 +1,55 @@
+package org.eclipse.ecf.presence.roster;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.ecf.internal.presence.PresencePlugin;
+import org.eclipse.ecf.presence.IPresence;
+
+/**
+ * @since 2.1
+ */
+public class RosterResource implements IRosterResource {
+
+ private String name;
+ private IRosterEntry parent;
+ private IPresence presence;
+
+ public RosterResource(IRosterEntry parent, String name, IPresence presence) {
+ Assert.isNotNull(parent);
+ this.parent = parent;
+ Assert.isNotNull(name);
+ this.name = name;
+ this.presence = presence;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IRosterItem getParent() {
+ return parent;
+ }
+
+ public IRoster getRoster() {
+ return parent.getRoster();
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter.isInstance(this)) {
+ return this;
+ }
+ IAdapterManager adapterManager = PresencePlugin.getDefault().getAdapterManager();
+ if (adapterManager == null)
+ return null;
+ return adapterManager.loadAdapter(this, adapter.getName());
+ }
+
+ public IPresence getPresence() {
+ return presence;
+ }
+
+ public void setPresence(IPresence presence) {
+ this.presence = presence;
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
index bac5d5780..4f7a4a1c4 100644
--- a/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.provider/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.ecf.provider;singleton:=true
-Bundle-Version: 4.4.0.qualifier
+Bundle-Version: 4.5.0.qualifier
Bundle-Name: %plugin.name
Bundle-Vendor: %plugin.provider
Bundle-Activator: org.eclipse.ecf.internal.provider.ProviderPlugin
@@ -15,7 +15,7 @@ Export-Package: org.eclipse.ecf.internal.provider;x-internal:=true,
Eclipse-BuddyPolicy: global
Bundle-ManifestVersion: 2
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.ecf;bundle-version="3.1.0",
+ org.eclipse.ecf;bundle-version="3.4.0",
org.eclipse.ecf.sharedobject
Import-Package: org.osgi.framework;version="1.3.0",
org.osgi.service.log;version="1.3.0",
diff --git a/framework/bundles/org.eclipse.ecf.provider/build.properties b/framework/bundles/org.eclipse.ecf.provider/build.properties
index 4203b3f2e..7a0fd6349 100644
--- a/framework/bundles/org.eclipse.ecf.provider/build.properties
+++ b/framework/bundles/org.eclipse.ecf.provider/build.properties
@@ -12,8 +12,7 @@ bin.includes = .,\
plugin.xml,\
META-INF/,\
about.html,\
- plugin.properties,\
- OSGI-INF/
+ plugin.properties
src.includes = about.html
jars.compile.order = .
source.. = src/
diff --git a/framework/bundles/org.eclipse.ecf.provider/plugin.properties b/framework/bundles/org.eclipse.ecf.provider/plugin.properties
index 23debdd43..5a2925540 100644
--- a/framework/bundles/org.eclipse.ecf.provider/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.provider/plugin.properties
@@ -6,6 +6,6 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-plugin.name=ECF Provider API
+plugin.name=ECF Generic Provider
plugin.provider=Eclipse.org - ECF
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java
index 52099e772..6e7280610 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/internal/provider/ProviderPlugin.java
@@ -14,7 +14,10 @@ package org.eclipse.ecf.internal.provider;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocketFactory;
import org.eclipse.core.runtime.*;
+import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.provider.generic.GenericContainerInstantiator;
+import org.eclipse.ecf.provider.generic.SSLGenericContainerInstantiator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -36,7 +39,7 @@ public class ProviderPlugin implements BundleActivator {
private ServiceTracker logServiceTracker = null;
- private ServiceTracker adapterManagerTracker = null;
+ private AdapterManagerTracker adapterManagerTracker = null;
private ServiceTracker sslServerSocketFactoryTracker;
private ServiceTracker sslSocketFactoryTracker;
@@ -46,17 +49,10 @@ public class ProviderPlugin implements BundleActivator {
return null;
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- if (adapterManager == null)
- getDefault().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Cannot get adapter manager", null)); //$NON-NLS-1$
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
/**
@@ -70,8 +66,16 @@ public class ProviderPlugin implements BundleActivator {
/**
* This method is called upon plug-in activation
*/
- public void start(BundleContext context1) throws Exception {
+ public void start(final BundleContext context1) throws Exception {
this.context = context1;
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithoutRegistry() throws Exception {
+ context1.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(GenericContainerInstantiator.TCPSERVER_NAME, new GenericContainerInstantiator(), "ECF Generic Server", true, false), null); //$NON-NLS-1$
+ context1.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(GenericContainerInstantiator.TCPCLIENT_NAME, new GenericContainerInstantiator(), "ECF Generic Client", false, true), null); //$NON-NLS-1$
+ context1.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(SSLGenericContainerInstantiator.SSLSERVER_NAME, new SSLGenericContainerInstantiator(), "ECF SSL Generic Server", true, false), null); //$NON-NLS-1$
+ context1.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(SSLGenericContainerInstantiator.SSLCLIENT_NAME, new SSLGenericContainerInstantiator(), "ECF SSL Generic Client", false, true), null); //$NON-NLS-1$
+ }
+ });
}
/**
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java
index 0ffd749a3..429b4b3c3 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/GenericContainerInstantiator.java
@@ -107,7 +107,10 @@ public class GenericContainerInstantiator implements IContainerInstantiator, IRe
return keepAlive;
}
- InetAddress getBindAddress() {
+ /**
+ * @since 4.5
+ */
+ public InetAddress getBindAddress() {
return bindAddress;
}
}
@@ -265,19 +268,33 @@ public class GenericContainerInstantiator implements IContainerInstantiator, IRe
return port;
}
+ /**
+ * @since 4.5
+ */
+ protected IContainer createClientContainer(GenericContainerArgs gcargs) throws Exception {
+ return new TCPClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue());
+ }
+
+ /**
+ * @since 4.5
+ */
+ protected IContainer createServerContainer(GenericContainerArgs gcargs) throws Exception {
+ return new TCPServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue());
+ }
+
public IContainer createInstance(ContainerTypeDescription description, Object[] args) throws ContainerCreateException {
boolean isClient = isClient(description);
try {
GenericContainerArgs gcargs = null;
if (isClient) {
gcargs = getClientArgs(args);
- return new TCPClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue());
+ return createClientContainer(gcargs);
}
// This synchronized block is to prevent issues with
// multithreaded access to ServerPort (to find available port)
synchronized (this) {
gcargs = getServerArgs(args);
- return new TCPServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue());
+ return createServerContainer(gcargs);
}
} catch (Exception e) {
Trace.catching(ProviderPlugin.PLUGIN_ID, ECFProviderDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "createInstance", e); //$NON-NLS-1$
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLGenericContainerInstantiator.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLGenericContainerInstantiator.java
index f6403eede..5737444fd 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLGenericContainerInstantiator.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLGenericContainerInstantiator.java
@@ -108,7 +108,10 @@ public class SSLGenericContainerInstantiator implements IContainerInstantiator,
return keepAlive;
}
- InetAddress getBindAddress() {
+ /**
+ * @since 4.5
+ */
+ public InetAddress getBindAddress() {
return bindAddress;
}
}
@@ -272,19 +275,33 @@ public class SSLGenericContainerInstantiator implements IContainerInstantiator,
return port;
}
+ /**
+ * @since 4.5
+ */
+ protected IContainer createClientContainer(GenericContainerArgs gcargs) throws Exception {
+ return new SSLClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue());
+ }
+
+ /**
+ * @since 4.5
+ */
+ protected IContainer createServerContainer(GenericContainerArgs gcargs) throws Exception {
+ return new SSLServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue());
+ }
+
public IContainer createInstance(ContainerTypeDescription description, Object[] args) throws ContainerCreateException {
boolean isClient = isClient(description);
try {
GenericContainerArgs gcargs = null;
if (isClient) {
gcargs = getClientArgs(args);
- return new SSLClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue());
+ return createClientContainer(gcargs);
}
// This synchronized block is to prevent issues with
// multithreaded access to ServerPort (to find available port)
synchronized (this) {
gcargs = getServerArgs(args);
- return new SSLServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue());
+ return createServerContainer(gcargs);
}
} catch (Exception e) {
Trace.catching(ProviderPlugin.PLUGIN_ID, ECFProviderDebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "createInstance", e); //$NON-NLS-1$
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLServerSOContainerGroup.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLServerSOContainerGroup.java
index df185998b..f6bbdc109 100644
--- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLServerSOContainerGroup.java
+++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SSLServerSOContainerGroup.java
@@ -141,6 +141,14 @@ public class SSLServerSOContainerGroup extends SOContainerGroup implements ISock
threadGroup.interrupt();
threadGroup = null;
}
+ if (this.serverSocket != null) {
+ try {
+ this.serverSocket.close();
+ } catch (IOException e) {
+ Trace.catching("org.eclipse.ecf.provider", ECFProviderDebugOptions.CONNECTION, SSLServerSOContainerGroup.class, "takeOffTheAir", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ this.serverSocket = null;
+ }
isOnTheAir = false;
}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.classpath b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.classpath
new file mode 100644
index 000000000..eca7bdba8
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.gitignore b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.gitignore
new file mode 100644
index 000000000..5e56e040e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.project b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.project
new file mode 100644
index 000000000..3559d273d
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.remoteservice.asyncproxy.j8</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.jdt.core.prefs b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..0c68a61dc
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.pde.core.prefs b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..f29e940a0
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..77356d646
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundle.name
+Bundle-SymbolicName: org.eclipse.ecf.remoteservice.asyncproxy
+Bundle-Version: 2.0.0.qualifier
+Bundle-Vendor: %bundle.provider
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.equinox.concurrent.future
+Bundle-Localization: bundle
+Export-Package: org.eclipse.ecf.remoteservice.asyncproxy;version="2.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/about.html b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/about.html
new file mode 100644
index 000000000..4c79781a5
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 25, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/build.properties b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/build.properties
new file mode 100644
index 000000000..d692a27b5
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ bundle.properties
+src.includes = about.html
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/bundle.properties b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/bundle.properties
new file mode 100644
index 000000000..7a860ca85
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/bundle.properties
@@ -0,0 +1,10 @@
+############################################################################
+# Copyright (c) 2014 Composent Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+############################################################################
+bundle.provider=Eclipse.org - ECF
+bundle.name=ECF RemoteServices AsyncProxy API Java8
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java
new file mode 100644
index 000000000..d6d7d9ddd
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java
@@ -0,0 +1,14 @@
+/****************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.remoteservice.asyncproxy;
+
+public abstract class AbstractAsyncProxyRemoteCall {
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
new file mode 100644
index 000000000..c3c96a3d2
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.remoteservice.asyncproxy;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Future;
+
+import org.eclipse.equinox.concurrent.future.IFuture;
+
+public abstract class AbstractAsyncProxyRemoteService {
+
+ @SuppressWarnings("rawtypes")
+ protected abstract IFuture callAsync(AbstractAsyncProxyRemoteCall call);
+
+ @SuppressWarnings("rawtypes")
+ protected abstract Future callFutureAsync(AbstractAsyncProxyRemoteCall call);
+
+ protected abstract void callCompletableAsync(AbstractAsyncProxyRemoteCall call, IAsyncProxyCompletable completable);
+
+ @SuppressWarnings("unchecked")
+ protected Object callFuture(AbstractAsyncProxyRemoteCall call, @SuppressWarnings("rawtypes") Class returnType) {
+ // If the result value is a CompletableFuture then
+ // we callCompletableAsync
+ if (CompletableFuture.class.isAssignableFrom(returnType)) {
+ @SuppressWarnings("rawtypes")
+ CompletableFuture result = new CompletableFuture();
+ callCompletableAsync(call, (r,hadException,exception) -> {
+ if (hadException) result.completeExceptionally(exception);
+ else result.complete(r);
+ });
+ // And return the CompletableFuture
+ return result;
+ }
+ // Else if it's an IFuture then return
+ // IFuture result of callAsync
+ if (IFuture.class.isAssignableFrom(returnType))
+ return callAsync(call);
+ // Else it must be a Future return value
+ return callFutureAsync(call);
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java
new file mode 100644
index 000000000..26a11a82e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java
@@ -0,0 +1,15 @@
+/****************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.remoteservice.asyncproxy;
+
+public interface IAsyncProxyCompletable {
+ void handleComplete(Object result, boolean hadException, Throwable exception);
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.classpath b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.classpath
new file mode 100644
index 000000000..64c5e31b7
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.gitignore b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.gitignore
new file mode 100644
index 000000000..5e56e040e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.project b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.project
new file mode 100644
index 000000000..d85f9b4a7
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.remoteservice.asyncproxy</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.jdt.core.prefs b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..af0f20f97
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.pde.core.prefs b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..f29e940a0
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..3737650da
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundle.name
+Bundle-SymbolicName: org.eclipse.ecf.remoteservice.asyncproxy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %bundle.provider
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.equinox.concurrent.future
+Bundle-Localization: bundle
+Export-Package: org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Capability: osgi.ee; filter="(&(|(osgi.ee = J2SE)(osgi.ee = JavaSE))(version >= 1.5)(!(version >= 1.8)))"
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/about.html b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/about.html
new file mode 100644
index 000000000..4c79781a5
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 25, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/build.properties b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/build.properties
new file mode 100644
index 000000000..b9ec38b9f
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ bundle.properties,\
+ about.html
+src.includes = bundle.properties,\
+ about.html
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/bundle.properties b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/bundle.properties
new file mode 100644
index 000000000..ffb412962
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/bundle.properties
@@ -0,0 +1,10 @@
+############################################################################
+# Copyright (c) 2014 Composent Inc., IBM Corp, and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+############################################################################
+bundle.provider=Eclipse.org - ECF
+bundle.name=ECF RemoteServices AsyncProxy API
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java
new file mode 100644
index 000000000..d6d7d9ddd
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteCall.java
@@ -0,0 +1,14 @@
+/****************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.remoteservice.asyncproxy;
+
+public abstract class AbstractAsyncProxyRemoteCall {
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
new file mode 100644
index 000000000..7e53b6f75
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
@@ -0,0 +1,35 @@
+/****************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.remoteservice.asyncproxy;
+
+import java.util.concurrent.Future;
+
+import org.eclipse.equinox.concurrent.future.IFuture;
+
+public abstract class AbstractAsyncProxyRemoteService {
+
+ @SuppressWarnings("rawtypes")
+ protected abstract IFuture callAsync(AbstractAsyncProxyRemoteCall call);
+
+ @SuppressWarnings("rawtypes")
+ protected abstract Future callFutureAsync(AbstractAsyncProxyRemoteCall call);
+
+ protected abstract void callCompletableAsync(AbstractAsyncProxyRemoteCall call, IAsyncProxyCompletable completable);
+
+ protected Object callFuture(AbstractAsyncProxyRemoteCall call, @SuppressWarnings("rawtypes") Class returnType) {
+ // Iff it's an IFuture then return
+ // IFuture result of callAsync
+ if (IFuture.class.isAssignableFrom(returnType))
+ return callAsync(call);
+ return callFutureAsync(call);
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java
new file mode 100644
index 000000000..26a11a82e
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy/src/org/eclipse/ecf/remoteservice/asyncproxy/IAsyncProxyCompletable.java
@@ -0,0 +1,15 @@
+/****************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+package org.eclipse.ecf.remoteservice.asyncproxy;
+
+public interface IAsyncProxyCompletable {
+ void handleComplete(Object result, boolean hadException, Throwable exception);
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/META-INF/MANIFEST.MF
index 426e3137d..2e62566ac 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/META-INF/MANIFEST.MF
@@ -16,6 +16,6 @@ Import-Package: com.sun.syndication.feed;version="0.9.0",
org.osgi.util.tracker;version="1.4.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: org.jdom;bundle-version="1.0.0",
- org.eclipse.equinox.common;bundle-version="3.6.0"
+ org.eclipse.equinox.common
Export-Package: org.eclipse.ecf.remoteservice.rest.synd;version="1.1.0"
Bundle-Localization: plugin
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/plugin.properties b/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/plugin.properties
index 9755a2943..9d4db8b13 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest.synd/plugin.properties
@@ -7,4 +7,4 @@
* Contributors: Pavel Samolisov - initial API and implementation
******************************************************************************/
plugin.provider=Eclipse.org - ECF
-plugin.name=ECF REST RemoteServices RSS/Atom support
+plugin.name=ECF RemoteServices REST RSS/Atom Support
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.rest/META-INF/MANIFEST.MF
index ae902db97..c53012b34 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-Vendor: %plugin.provider
Bundle-SymbolicName: org.eclipse.ecf.remoteservice.rest;singleton:=true
-Bundle-Version: 2.2.300.qualifier
+Bundle-Version: 2.4.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.remoteservice.rest.Activator
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: global
@@ -15,18 +15,19 @@ Export-Package: org.eclipse.ecf.internal.remoteservice.rest;x-internal:=true,
org.eclipse.ecf.remoteservice.rest.identity;version="2.2.200",
org.eclipse.ecf.remoteservice.rest.util;version="2.2.200"
Import-Package: org.apache.http;version="4.1.2",
+ org.apache.http.auth;version="4.1.2",
org.apache.http.client;version="4.1.2",
org.apache.http.client.entity;version="4.1.2",
+ org.apache.http.client.methods;version="4.1.2",
org.apache.http.client.params;version="4.1.2",
+ org.apache.http.entity;version="4.1.2",
org.apache.http.impl.auth;version="4.1.2",
org.apache.http.impl.client;version="4.1.2",
- org.apache.http.entity;version="4.1.2",
org.apache.http.message;version="4.1.2",
- org.apache.http.auth;version="4.1.2",
- org.apache.http.client.methods;version="4.1.2",
org.apache.http.params;version="4.1.2",
org.apache.http.util,
org.eclipse.ecf.remoteservice;version="6.0.0",
+ org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.ecf.remoteservice.client,
org.eclipse.ecf.remoteservice.events,
org.eclipse.ecf.remoteservice.util,
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/plugin.properties b/framework/bundles/org.eclipse.ecf.remoteservice.rest/plugin.properties
index 2ba39468d..98e358784 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/plugin.properties
@@ -7,4 +7,4 @@
#
############################################################################
plugin.provider=Eclipse.org - ECF
-plugin.name=ECF REST RemoteServices API
+plugin.name=ECF RemoteServices REST API
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/internal/remoteservice/rest/Activator.java b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/internal/remoteservice/rest/Activator.java
index 74dd34879..8f1cdea0e 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/internal/remoteservice/rest/Activator.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/internal/remoteservice/rest/Activator.java
@@ -10,8 +10,11 @@
package org.eclipse.ecf.internal.remoteservice.rest;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ecf.core.util.LogHelper;
-import org.eclipse.ecf.core.util.SystemLogService;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.remoteservice.rest.identity.RestNamespace;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -40,9 +43,15 @@ public class Activator implements BundleActivator {
* @see
* org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
- public void start(BundleContext context1) throws Exception {
+ public void start(final BundleContext context1) throws Exception {
plugin = this;
this.context = context1;
+ SafeRunner.run(new ExtensionRegistryRunnable(context1) {
+ protected void runWithoutRegistry() throws Exception {
+ context1.registerService(Namespace.class, new RestNamespace(), null);
+ context1.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.rest.client", new RestClientContainerInstantiator(), "Rest Client Container"), null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
}
/*
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientContainer.java b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientContainer.java
index e28c1edf4..e2e1ede83 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientContainer.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/client/RestClientContainer.java
@@ -10,11 +10,15 @@
package org.eclipse.ecf.remoteservice.rest.client;
import java.util.Dictionary;
+import java.util.Hashtable;
+import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.identity.*;
import org.eclipse.ecf.remoteservice.*;
import org.eclipse.ecf.remoteservice.client.*;
import org.eclipse.ecf.remoteservice.rest.identity.RestID;
import org.eclipse.ecf.remoteservice.rest.identity.RestNamespace;
+import org.eclipse.ecf.remoteservice.util.RemoteFilterImpl;
+import org.osgi.framework.InvalidSyntaxException;
/**
* A container for REST services.
@@ -28,6 +32,20 @@ public class RestClientContainer extends AbstractClientContainer implements IRem
setResponseDeserializer(new XMLRemoteResponseDeserializer());
}
+ public IRemoteServiceReference[] getRemoteServiceReferences(ID target, ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException {
+ return super.getRemoteServiceReferences(transformTarget(target, filter), idFilter, clazz, filter);
+ }
+
+ public IRemoteServiceReference[] getRemoteServiceReferences(ID target, String clazz, String filter) throws InvalidSyntaxException, ContainerConnectException {
+ return super.getRemoteServiceReferences(transformTarget(target, filter), clazz, filter);
+ }
+
+ protected ID transformTarget(ID originalTarget, String filter) throws InvalidSyntaxException {
+ if (originalTarget != null && filter != null && originalTarget instanceof RestID)
+ ((RestID) originalTarget).setRsId(new RemoteFilterImpl(filter).getRsId());
+ return originalTarget;
+ }
+
protected class RestRemoteServiceClientRegistration extends RemoteServiceClientRegistration {
public RestRemoteServiceClientRegistration(Namespace namespace, IRemoteCallable[] restCalls, Dictionary properties, RemoteServiceClientRegistry registry) {
@@ -35,7 +53,13 @@ public class RestClientContainer extends AbstractClientContainer implements IRem
ID cID = getConnectedID();
if (cID != null)
this.containerId = cID;
- this.serviceID = new RemoteServiceID(namespace, containerId, registry.getNextServiceId());
+ long rsId = ((RestID) containerId).getRsId();
+ this.serviceID = new RemoteServiceID(namespace, containerId, rsId);
+ if (rsId > 0) {
+ if (this.properties == null)
+ this.properties = new Hashtable();
+ this.properties.put(org.eclipse.ecf.remoteservice.Constants.SERVICE_ID, new Long(rsId));
+ }
}
public RestRemoteServiceClientRegistration(Namespace namespace, String[] classNames, IRemoteCallable[][] restCalls, Dictionary properties, RemoteServiceClientRegistry registry) {
@@ -43,7 +67,13 @@ public class RestClientContainer extends AbstractClientContainer implements IRem
ID cID = getConnectedID();
if (cID != null)
this.containerId = cID;
- this.serviceID = new RemoteServiceID(namespace, containerId, registry.getNextServiceId());
+ long rsId = ((RestID) containerId).getRsId();
+ this.serviceID = new RemoteServiceID(namespace, containerId, rsId);
+ if (rsId > 0) {
+ if (this.properties == null)
+ this.properties = new Hashtable();
+ this.properties.put(org.eclipse.ecf.remoteservice.Constants.SERVICE_ID, new Long(rsId));
+ }
}
}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestID.java b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestID.java
index 82f30f93c..e497be50b 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestID.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestID.java
@@ -17,10 +17,20 @@ public class RestID extends URIID {
private static final long serialVersionUID = 2082626839598770167L;
+ private long rsId = 0;
+
public RestID(Namespace namespace, URI uri) {
super(namespace, uri);
}
+ public long getRsId() {
+ return rsId;
+ }
+
+ public void setRsId(long rsId) {
+ this.rsId = rsId;
+ }
+
public String toString() {
StringBuffer sb = new StringBuffer("RestID["); //$NON-NLS-1$
sb.append(getName()).append("]"); //$NON-NLS-1$
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestNamespace.java b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestNamespace.java
index ea59ed4b3..72fb51ab4 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestNamespace.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rest/src/org/eclipse/ecf/remoteservice/rest/identity/RestNamespace.java
@@ -32,7 +32,7 @@ public class RestNamespace extends Namespace {
public static final String SCHEME = "rest"; //$NON-NLS-1$
public RestNamespace() {
- // nothing
+ super(NAME, "Rest Namespace"); //$NON-NLS-1$
}
public RestNamespace(String name, String desc) {
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF
index 97329b18f..ccb073728 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/META-INF/MANIFEST.MF
@@ -2,15 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.remoteservice.rpc;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.remoteservice.rpc.Activator
Bundle-Vendor: %plugin.provider
Require-Bundle: org.eclipse.ecf,
- org.eclipse.equinox.common;bundle-version="3.6.0"
+ org.eclipse.equinox.common
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Import-Package: org.osgi.framework,
- org.osgi.util.tracker,
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
org.apache.commons.httpclient;version="3.1.0",
org.apache.commons.httpclient.auth;version="3.1.0",
org.apache.commons.httpclient.methods;version="3.1.0",
@@ -22,15 +22,21 @@ Import-Package: org.osgi.framework,
org.apache.xmlrpc.common,
org.apache.xmlrpc.parser,
org.apache.xmlrpc.serializer,
+ org.apache.xmlrpc.server,
+ org.apache.xmlrpc.webserver,
org.eclipse.ecf.core;version="3.0.0",
org.eclipse.ecf.core.identity;version="3.0.0",
org.eclipse.ecf.core.provider,
org.eclipse.ecf.remoteservice;version="6.0.0",
+ org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.ecf.remoteservice.client,
- org.osgi.service.log;version="1.3.0"
+ org.osgi.framework,
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.util.tracker
Export-Package: org.eclipse.ecf.internal.remoteservice.rpc;x-internal:=true,
org.eclipse.ecf.remoteservice.rpc;version="1.0.0",
org.eclipse.ecf.remoteservice.rpc.client;version="1.0.0",
- org.eclipse.ecf.remoteservice.rpc.identity;version="1.0.0"
+ org.eclipse.ecf.remoteservice.rpc.identity;version="1.0.0",
+ org.eclipse.ecf.remoteservice.rpc.server
Bundle-Localization: plugin
DynamicImport-Package: *
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java
index 9295d1c77..fb346dfaf 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/internal/remoteservice/rpc/Activator.java
@@ -10,8 +10,11 @@
package org.eclipse.ecf.internal.remoteservice.rpc;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ecf.core.util.LogHelper;
-import org.eclipse.ecf.core.util.SystemLogService;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.remoteservice.rpc.identity.RpcNamespace;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -39,9 +42,16 @@ public class Activator implements BundleActivator {
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
- public void start(BundleContext bundleContext) throws Exception {
+ public void start(final BundleContext bundleContext) throws Exception {
plugin = this;
Activator.context = bundleContext;
+ SafeRunner.run(new ExtensionRegistryRunnable(bundleContext) {
+ protected void runWithoutRegistry() throws Exception {
+ bundleContext.registerService(Namespace.class, new RpcNamespace(), null);
+ bundleContext.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(
+ "ecf.xmlrpc.client", new RpcClientContainerInstantiator(), "Rpc Client Container"), null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
}
/*
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java
index e9f0484ec..5258bc21b 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/client/TrivialParameterServializer.java
@@ -31,7 +31,7 @@ public class TrivialParameterServializer implements IRemoteCallParameterSerializ
if (paramToSerialize != null) {
for (int i = 0; i < paramToSerialize.length; i++) {
IRemoteCallParameter p = new RemoteCallParameter(currentParameters[i].getName(),
- paramToSerialize[i] == null ? currentParameters[i].getValue() : paramToSerialize);
+ paramToSerialize[i] == null ? currentParameters[i].getValue() : paramToSerialize[i]);
results.add(p);
}
}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java
index 01720e670..a11199906 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/identity/RpcNamespace.java
@@ -33,7 +33,7 @@ public class RpcNamespace extends Namespace {
public static final String SCHEME = "xmlrpc"; //$NON-NLS-1$
public RpcNamespace() {
- // nothing
+ super(NAME, "Rpc Namespace"); //$NON-NLS-1$
}
public RpcNamespace(String name, String desc) {
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java
new file mode 100644
index 000000000..7d62f183b
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.rpc/src/org/eclipse/ecf/remoteservice/rpc/server/RemoteServiceXmlRpcServlet.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Naumen. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Pavel Samolisov - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.remoteservice.rpc.server;
+
+import javax.servlet.ServletConfig;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping;
+import org.apache.xmlrpc.server.XmlRpcHandlerMapping;
+import org.apache.xmlrpc.webserver.XmlRpcServlet;
+import org.apache.xmlrpc.webserver.XmlRpcServletServer;
+
+public class RemoteServiceXmlRpcServlet extends XmlRpcServlet {
+
+ private static final long serialVersionUID = 654171179838565650L;
+
+ class RemoteServiceHandlerMapping extends AbstractReflectiveHandlerMapping {
+
+ }
+
+ private RemoteServiceHandlerMapping mapping;
+
+ protected XmlRpcHandlerMapping newXmlRpcHandlerMapping() throws XmlRpcException {
+ return (mapping == null) ? super.newXmlRpcHandlerMapping() : mapping;
+ }
+
+ class RemoteServiceXmlRpcServletServer extends XmlRpcServletServer {
+
+ }
+
+ private RemoteServiceXmlRpcServletServer server;
+
+ protected XmlRpcServletServer newXmlRpcServer(ServletConfig pConfig) throws XmlRpcException {
+ return (server == null) ? super.newXmlRpcServer(pConfig) : server;
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.servlet/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.servlet/META-INF/MANIFEST.MF
index 63dcb7aef..b56b2fe11 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.servlet/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.servlet/META-INF/MANIFEST.MF
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: ECF Remote Service ServletAPI
+Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.remoteservice.servlet
Bundle-Version: 1.0.0.qualifier
-Bundle-Vendor: Eclipse.org - ECF
+Bundle-Vendor: %plugin.provider
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: javax.servlet,
javax.servlet.http,
@@ -12,9 +12,11 @@ Import-Package: javax.servlet,
org.eclipse.ecf.provider.remoteservice.generic;version="4.0.0",
org.eclipse.ecf.remoteservice;version="7.0.0",
org.eclipse.ecf.remoteservice.util;version="8.1.0",
- org.eclipse.equinox.concurrent.future;version="1.1.0",
+ org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework;version="1.7.0",
org.osgi.service.http;version="1.2.1"
Export-Package: org.eclipse.ecf.remoteservice.servlet
-Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0",
- org.eclipse.ecf;bundle-version="3.2.0"
+Require-Bundle: org.eclipse.equinox.common,
+ org.eclipse.ecf
+Bundle-Localization: plugin
+
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.servlet/build.properties b/framework/bundles/org.eclipse.ecf.remoteservice.servlet/build.properties
index 34d2e4d2d..cdd2db7f1 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.servlet/build.properties
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.servlet/build.properties
@@ -1,4 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.servlet/plugin.properties b/framework/bundles/org.eclipse.ecf.remoteservice.servlet/plugin.properties
index 3968910a1..7b192fe17 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.servlet/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.servlet/plugin.properties
@@ -7,4 +7,4 @@
#
############################################################################
plugin.provider=Eclipse.org - ECF
-plugin.name=ECF RemoteService Servlet API
+plugin.name=ECF RemoteServices Servlet API
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.soap/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.soap/META-INF/MANIFEST.MF
index 6686cbbd6..ec89ff907 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.soap/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.soap/META-INF/MANIFEST.MF
@@ -3,12 +3,13 @@ Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-Vendor: %plugin.provider
Bundle-SymbolicName: org.eclipse.ecf.remoteservice.soap;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Import-Package: org.eclipse.ecf.core;version="3.0.0",
org.eclipse.ecf.core.identity;version="3.0.0",
org.eclipse.ecf.core.util,
org.eclipse.ecf.remoteservice,
+ org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.ecf.remoteservice.client
Bundle-ClassPath: .
Export-Package: org.eclipse.ecf.remoteservice.soap.client;version="1.0.0",
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.soap/plugin.properties b/framework/bundles/org.eclipse.ecf.remoteservice.soap/plugin.properties
index 50a1a8e9d..ca125d439 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.soap/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.soap/plugin.properties
@@ -7,4 +7,4 @@
#
############################################################################
plugin.provider=Eclipse.org - ECF
-plugin.name=ECF Remote Service SOAP Provider API
+plugin.name=ECF RemoteServices SOAP Provider API
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.ui/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.ui/META-INF/MANIFEST.MF
index c78f64472..1a3ee79a5 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.ui/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.remoteservice.ui;singleton:=true
-Bundle-Version: 3.0.0.qualifier
+Bundle-Version: 3.1.0.qualifier
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
Require-Bundle: org.eclipse.core.runtime,
@@ -18,4 +18,5 @@ Bundle-ActivationPolicy: lazy
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.ecf.internal.remoteservices.ui.Activator
-Import-Package: org.eclipse.equinox.concurrent.future;version="1.0.0"
+Import-Package: org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
+ org.eclipse.equinox.concurrent.future;version="1.0.0"
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/.settings/.api_filters b/framework/bundles/org.eclipse.ecf.remoteservice/.settings/.api_filters
deleted file mode 100644
index 950b0b2b5..000000000
--- a/framework/bundles/org.eclipse.ecf.remoteservice/.settings/.api_filters
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.ecf.remoteservice" version="2">
- <resource path="src/org/eclipse/ecf/remoteservice/util/RemoteFilterImpl.java" type="org.eclipse.ecf.remoteservice.util.RemoteFilterImpl">
- <filter comment="remote service filter can implement osgi Filter" id="574660632">
- <message_arguments>
- <message_argument value="IRemoteFilter"/>
- <message_argument value="Filter"/>
- <message_argument value="RemoteFilterImpl"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF
index 3d2b46166..c152c5e49 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.remoteservice
-Bundle-Version: 8.3.0.qualifier
+Bundle-Version: 8.4.100.qualifier
Bundle-Activator: org.eclipse.ecf.internal.remoteservice.Activator
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
@@ -17,6 +17,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.equinox.common,
org.eclipse.ecf
Import-Package: org.eclipse.ecf.core.util.reflection;version="2.2.100",
+ org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework,
org.osgi.service.log,
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/plugin.properties b/framework/bundles/org.eclipse.ecf.remoteservice/plugin.properties
index 9113a5a8c..0d9b2cbda 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/plugin.properties
@@ -7,4 +7,4 @@
#
############################################################################
plugin.provider=Eclipse.org - ECF
-plugin.name=ECF RemoteService API
+plugin.name=ECF RemoteServices API
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java
index d48bcd92e..12fd1af9e 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/AbstractRemoteService.java
@@ -16,6 +16,9 @@ import org.eclipse.core.runtime.*;
import org.eclipse.ecf.core.jobs.JobsExecutor;
import org.eclipse.ecf.core.util.ECFException;
import org.eclipse.ecf.internal.remoteservice.Activator;
+import org.eclipse.ecf.remoteservice.asyncproxy.*;
+import org.eclipse.ecf.remoteservice.events.IRemoteCallCompleteEvent;
+import org.eclipse.ecf.remoteservice.events.IRemoteCallEvent;
import org.eclipse.equinox.concurrent.future.*;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceException;
@@ -28,7 +31,7 @@ import org.osgi.util.tracker.ServiceTracker;
* @since 4.1
*/
//@ProviderType
-public abstract class AbstractRemoteService implements IRemoteService, InvocationHandler {
+public abstract class AbstractRemoteService extends AbstractAsyncProxyRemoteService implements IRemoteService, InvocationHandler {
protected static final Object[] EMPTY_ARGS = new Object[0];
@@ -108,6 +111,11 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
return IRemoteCall.DEFAULT_TIMEOUT;
}
+ @Override
+ protected IFuture callAsync(AbstractAsyncProxyRemoteCall call) {
+ return callAsync((IRemoteCall) call);
+ }
+
public IFuture callAsync(final IRemoteCall call) {
IExecutor executor = getIFutureExecutor(call);
if (executor == null)
@@ -150,22 +158,45 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
classes.add(IRemoteServiceProxy.class);
}
+ private boolean nameAlreadyPresent(String className, List classes) {
+ for (Iterator i = classes.iterator(); i.hasNext();) {
+ Class c = (Class) i.next();
+ if (className.equals(c.getName()))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @since 8.3
+ */
+ protected List addAsyncProxyClasses(ClassLoader cl, Class[] interfaces) {
+ List intfs = Arrays.asList(interfaces);
+ List results = new ArrayList();
+ if (getRemoteServiceReference().getProperty(Constants.SERVICE_PREVENT_ASYNCPROXY) == null) {
+ for (Iterator i = intfs.iterator(); i.hasNext();) {
+ Class intf = (Class) i.next();
+ String intfName = convertInterfaceNameToAsyncInterfaceName(intf.getName());
+ if (intfName != null && !nameAlreadyPresent(intfName, intfs)) {
+ Class asyncClass = findAsyncRemoteServiceProxyClass(cl, intf);
+ // Only add if async
+ if (asyncClass != null && !intfs.contains(asyncClass))
+ results.add(asyncClass);
+ }
+ }
+ }
+ results.addAll(intfs);
+ return results;
+ }
+
/**
* @since 6.0
*/
@SuppressWarnings("unchecked")
public Object getProxy(ClassLoader cl, Class[] interfaces) throws ECFException {
- // Add async classes
- // for all interfaces, add async classes
- List classes = new ArrayList();
- for (int i = 0; i < interfaces.length; i++) {
- // add interface to classes
- classes.add(interfaces[i]);
- Class asyncClass = findAsyncRemoteServiceProxyClass(cl, interfaces[i]);
- if (asyncClass != null)
- classes.add(asyncClass);
- }
- // Add IRemoteServiceProxy to classes, if not restricted via service properties
+ // Now add any async p
+ List classes = addAsyncProxyClasses(cl, interfaces);
+
addRemoteServiceProxyToProxy(classes);
// create and return proxy
try {
@@ -256,6 +287,8 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
*/
protected Class findAsyncRemoteServiceProxyClass(ClassLoader cl, Class c) {
String proxyClassName = convertInterfaceNameToAsyncInterfaceName(c.getName());
+ if (proxyClassName == null)
+ return null;
try {
return Class.forName(proxyClassName, true, cl);
} catch (ClassNotFoundException e) {
@@ -273,7 +306,8 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
String asyncProxyName = (String) getRemoteServiceReference().getProperty(Constants.SERVICE_ASYNC_RSPROXY_CLASS_ + interfaceName);
if (asyncProxyName != null)
return asyncProxyName;
- // If a value has been specified by the ServiceProperty
+ if (interfaceName.endsWith(IAsyncRemoteServiceProxy.ASYNC_INTERFACE_SUFFIX))
+ return interfaceName;
return interfaceName + IAsyncRemoteServiceProxy.ASYNC_INTERFACE_SUFFIX;
}
@@ -290,13 +324,14 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
}
protected Object invokeObject(Object proxy, final Method method, final Object[] args) throws Throwable {
- if (method.getName().equals("toString")) { //$NON-NLS-1$
+ String methodName = method.getName();
+ if (methodName.equals("toString")) { //$NON-NLS-1$
final String[] clazzes = getInterfaceClassNames();
String proxyClass = (clazzes.length == 1) ? clazzes[0] : Arrays.asList(clazzes).toString();
return proxyClass + ".proxy@" + getRemoteServiceID(); //$NON-NLS-1$
- } else if (method.getName().equals("hashCode")) { //$NON-NLS-1$
+ } else if (methodName.equals("hashCode")) { //$NON-NLS-1$
return new Integer(hashCode());
- } else if (method.getName().equals("equals")) { //$NON-NLS-1$
+ } else if (methodName.equals("equals")) { //$NON-NLS-1$
if (args == null || args.length == 0)
return Boolean.FALSE;
try {
@@ -305,9 +340,9 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
return Boolean.FALSE;
}
// This handles the use of IRemoteServiceProxy.getRemoteService method
- } else if (method.getName().equals("getRemoteService")) { //$NON-NLS-1$
+ } else if (methodName.equals("getRemoteService")) { //$NON-NLS-1$
return getRemoteService();
- } else if (method.getName().equals("getRemoteServiceReference")) { //$NON-NLS-1$
+ } else if (methodName.equals("getRemoteServiceReference")) { //$NON-NLS-1$
return getRemoteServiceReference();
}
return null;
@@ -317,6 +352,32 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
return callSync(call);
}
+ /**
+ * @since 8.3
+ */
+ protected boolean isAsync(Object proxy, Method method, Object[] args) {
+ return (Arrays.asList(method.getDeclaringClass().getInterfaces()).contains(IAsyncRemoteServiceProxy.class) || method.getName().endsWith(IAsyncRemoteServiceProxy.ASYNC_METHOD_SUFFIX));
+ }
+
+ /**
+ * @since 8.3
+ */
+ protected IRemoteCall createRemoteCall(final String callMethod, final Object[] callParameters, final long callTimeout) {
+ return new IRemoteCall() {
+ public String getMethod() {
+ return callMethod;
+ }
+
+ public Object[] getParameters() {
+ return callParameters;
+ }
+
+ public long getTimeout() {
+ return callTimeout;
+ }
+ };
+ }
+
public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
// methods declared by Object
try {
@@ -325,27 +386,13 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
Object resultObject = invokeObject(proxy, method, args);
if (resultObject != null)
return resultObject;
- // If the method's class is a subclass of IAsyncRemoteServiceProxy, then we assume
- // that the methods are intended to be invoked asynchronously
- if (Arrays.asList(method.getDeclaringClass().getInterfaces()).contains(IAsyncRemoteServiceProxy.class))
+ if (isAsync(proxy, method, args))
return invokeAsync(method, args);
// else call synchronously/block and return result
final String callMethod = getCallMethodNameForProxyInvoke(method, args);
final Object[] callParameters = getCallParametersForProxyInvoke(callMethod, method, args);
final long callTimeout = getCallTimeoutForProxyInvoke(callMethod, method, args);
- final IRemoteCall remoteCall = new IRemoteCall() {
- public String getMethod() {
- return callMethod;
- }
-
- public Object[] getParameters() {
- return callParameters;
- }
-
- public long getTimeout() {
- return callTimeout;
- }
- };
+ final IRemoteCall remoteCall = createRemoteCall(callMethod, callParameters, callTimeout);
return invokeSync(remoteCall);
} catch (Throwable t) {
if (t instanceof ServiceException)
@@ -356,17 +403,17 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
}
/**
- * @since 3.3
+ * @since 8.4
*/
- protected class AsyncArgs {
+ public class AsyncArgs {
private IRemoteCallListener listener;
private Object[] args;
- private boolean isIFuture;
+ private Class returnType;
- public AsyncArgs(Object[] originalArgs, boolean isIFuture) {
+ public AsyncArgs(Object[] originalArgs, Class returnType) {
this.listener = null;
this.args = originalArgs;
- this.isIFuture = isIFuture;
+ this.returnType = returnType;
}
public AsyncArgs(IRemoteCallListener listener, Object[] originalArgs) {
@@ -387,41 +434,27 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
return args;
}
- /**
- * @since 8.2
- */
- public boolean isIFuture() {
- return isIFuture;
+ public Class getReturnType() {
+ return returnType;
}
}
/**
+ * @since 8.4
+ */
+ protected RemoteCall getAsyncRemoteCall(String invokeMethodName, Object[] asyncArgs) {
+ return new RemoteCall(invokeMethodName, asyncArgs, IRemoteCall.DEFAULT_TIMEOUT);
+ }
+
+ /**
* @since 3.3
*/
protected Object invokeAsync(final Method method, final Object[] args) throws Throwable {
final String invokeMethodName = getAsyncInvokeMethodName(method);
final AsyncArgs asyncArgs = getAsyncArgs(method, args);
+ RemoteCall remoteCall = getAsyncRemoteCall(invokeMethodName, asyncArgs.getArgs());
IRemoteCallListener listener = asyncArgs.getListener();
- IRemoteCall call = new IRemoteCall() {
- public String getMethod() {
- return invokeMethodName;
- }
-
- public Object[] getParameters() {
- return asyncArgs.getArgs();
- }
-
- public long getTimeout() {
- return DEFAULT_TIMEOUT;
- }
- };
- // IFuture or Future will have listener == null
- if (listener == null) {
- if (asyncArgs.isIFuture())
- return callAsync(call);
- return callFutureAsync(call);
- }
- return callAsyncWithResult(call, listener);
+ return (listener != null) ? callAsyncWithResult(remoteCall, listener) : callFuture(remoteCall, asyncArgs.getReturnType());
}
/**
@@ -433,6 +466,29 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
}
/**
+ * @since 8.4
+ */
+ @Override
+ protected void callCompletableAsync(AbstractAsyncProxyRemoteCall call, final IAsyncProxyCompletable completable) {
+ callAsync((IRemoteCall) call, new IRemoteCallListener() {
+ public void handleEvent(IRemoteCallEvent event) {
+ if (event instanceof IRemoteCallCompleteEvent) {
+ IRemoteCallCompleteEvent cce = (IRemoteCallCompleteEvent) event;
+ completable.handleComplete(cce.getResponse(), cce.hadException(), cce.getException());
+ }
+ }
+ });
+ }
+
+ /**
+ * @since 8.4
+ */
+ @Override
+ protected Future callFutureAsync(AbstractAsyncProxyRemoteCall call) {
+ return callFutureAsync((IRemoteCall) call);
+ }
+
+ /**
* @since 8.2
*/
protected Future callFutureAsync(final IRemoteCall call) {
@@ -453,30 +509,26 @@ public abstract class AbstractRemoteService implements IRemoteService, Invocatio
IRemoteCallListener listener = null;
Class returnType = method.getReturnType();
// If the return type is of type java.util.concurrent.Future, then we return
- if (returnType.equals(Future.class)) {
- return new AsyncArgs(args, false);
- } else if (returnType.equals(IFuture.class)) {
- return new AsyncArgs(args, true);
- } else {
- // If the provided args do *not* include an IRemoteCallListener then we have a problem
- if (args == null || args.length == 0)
- throw new IllegalArgumentException("Async calls must include a IRemoteCallListener instance as the last argument"); //$NON-NLS-1$
- // Get the last arg
- Object lastArg = args[args.length - 1];
- // If it's an IRemoteCallListener implementer directly, then just cast and return
- if (lastArg instanceof IRemoteCallListener) {
- listener = (IRemoteCallListener) lastArg;
- }
- // If it's an implementation of IAsyncCallback, then create a new listener based upon
- // callback and return
- if (lastArg instanceof IAsyncCallback) {
- listener = new CallbackRemoteCallListener((IAsyncCallback) lastArg);
- }
- // If the last are is not an instance of IRemoteCallListener then there is a problem
- if (listener == null)
- throw new IllegalArgumentException("Last argument must be an instance of IRemoteCallListener"); //$NON-NLS-1$
- return new AsyncArgs(listener, args);
+ if (Future.class.isAssignableFrom(returnType) || IFuture.class.isAssignableFrom(returnType))
+ return new AsyncArgs(args, returnType);
+ // If the provided args do *not* include an IRemoteCallListener then we have a problem
+ if (args == null || args.length == 0)
+ throw new IllegalArgumentException("Async calls must include a IRemoteCallListener instance as the last argument"); //$NON-NLS-1$
+ // Get the last arg
+ Object lastArg = args[args.length - 1];
+ // If it's an IRemoteCallListener implementer directly, then just cast and return
+ if (lastArg instanceof IRemoteCallListener) {
+ listener = (IRemoteCallListener) lastArg;
+ }
+ // If it's an implementation of IAsyncCallback, then create a new listener based upon
+ // callback and return
+ if (lastArg instanceof IAsyncCallback) {
+ listener = new CallbackRemoteCallListener((IAsyncCallback) lastArg);
}
+ // If the last are is not an instance of IRemoteCallListener then there is a problem
+ if (listener == null)
+ throw new IllegalArgumentException("Last argument must be an instance of IRemoteCallListener"); //$NON-NLS-1$
+ return new AsyncArgs(listener, args);
}
/**
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java
index 2ac0a3dd0..7ae7fbd92 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/Constants.java
@@ -13,6 +13,8 @@ package org.eclipse.ecf.remoteservice;
/**
* Remote service API constants.
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
*/
public interface Constants {
@@ -161,6 +163,11 @@ public interface Constants {
public static final String SERVICE_ASYNC_RSPROXY_CLASS_ = "ecf.rsvc.async.proxy_"; //$NON-NLS-1$
/**
+ * @since 8.3
+ */
+ public static final String SERVICE_PREVENT_ASYNCPROXY = "ecf.rsvc.async.noproxy"; //$NON-NLS-1$
+
+ /**
* @deprecated
*/
public static final String SERVICE_CONNECT_ID = "ecf.rsvc.cnct.id"; //$NON-NLS-1$
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/RemoteCall.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/RemoteCall.java
index 7a2ca6f5f..a438cb189 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/RemoteCall.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/RemoteCall.java
@@ -11,11 +11,12 @@ package org.eclipse.ecf.remoteservice;
import java.util.Arrays;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.ecf.remoteservice.asyncproxy.AbstractAsyncProxyRemoteCall;
/**
* @since 4.0
*/
-public class RemoteCall implements IRemoteCall {
+public class RemoteCall extends AbstractAsyncProxyRemoteCall implements IRemoteCall {
protected String method;
protected Object[] parameters;
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/RemoteServiceClientRegistration.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/RemoteServiceClientRegistration.java
index f4ea5e9f3..e483ff458 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/RemoteServiceClientRegistration.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/client/RemoteServiceClientRegistration.java
@@ -114,6 +114,8 @@ public class RemoteServiceClientRegistration implements IRemoteServiceRegistrati
for (int j = 0; j < subArray.length; j++) {
IRemoteCallable def = subArray[j];
String defMethod = def.getMethod();
+ if (defMethod != null && defMethod.equals(methodToFind))
+ return def;
String fqDefMethod = getFQMethod(className, defMethod);
if (fqDefMethod.equals(methodToFind))
return def;
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/RemoteFilterImpl.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/RemoteFilterImpl.java
index 38963c2e7..b6906d83e 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/RemoteFilterImpl.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/util/RemoteFilterImpl.java
@@ -12,6 +12,8 @@
package org.eclipse.ecf.remoteservice.util;
import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.internal.remoteservice.Activator;
import org.eclipse.ecf.remoteservice.IRemoteFilter;
import org.eclipse.ecf.remoteservice.IRemoteServiceReference;
@@ -23,8 +25,15 @@ import org.osgi.framework.*;
*/
public class RemoteFilterImpl implements IRemoteFilter {
+ /**
+ * @since 8.4
+ */
+ public static final String REMOTE_SERVICEID_PREFIX = "(&(" + org.eclipse.ecf.remoteservice.Constants.SERVICE_ID + "="; //$NON-NLS-1$ //$NON-NLS-2$
+
Filter filter;
+ long rsId = 0;
+
/**
* @param createFilter
*/
@@ -32,6 +41,30 @@ public class RemoteFilterImpl implements IRemoteFilter {
this(Activator.getDefault().getContext(), createFilter);
}
+ private void parseForRsId(String createFilter) {
+ if (createFilter == null)
+ return;
+ if (createFilter.startsWith(REMOTE_SERVICEID_PREFIX)) {
+ String f = createFilter.substring(REMOTE_SERVICEID_PREFIX.length());
+ int rightParenIndex = f.indexOf(')');
+ if (rightParenIndex == -1)
+ return;
+ f = f.substring(0, rightParenIndex);
+ try {
+ this.rsId = Long.parseLong(f);
+ } catch (NumberFormatException e) {
+ Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Exception parsing remote service filter=" + filter, e)); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @since 8.4
+ */
+ public long getRsId() {
+ return rsId;
+ }
+
/**
* @param createFilter
* @since 6.0
@@ -39,6 +72,7 @@ public class RemoteFilterImpl implements IRemoteFilter {
public RemoteFilterImpl(BundleContext context, String createFilter) throws InvalidSyntaxException {
if (createFilter == null)
throw new InvalidSyntaxException("Filter cannot be null", createFilter); //$NON-NLS-1$
+ parseForRsId(createFilter);
this.filter = context.createFilter(createFilter);
}
diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.sharedobject/META-INF/MANIFEST.MF
index 20d73c2cf..d8e1e229d 100644
--- a/framework/bundles/org.eclipse.ecf.sharedobject/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.sharedobject/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.sharedobject;singleton:=true
-Bundle-Version: 2.4.0.qualifier
+Bundle-Version: 2.5.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.core.sharedobject.Activator
Bundle-Localization: plugin
Bundle-Vendor: %plugin.provider
@@ -17,8 +17,8 @@ Export-Package: org.eclipse.ecf.core.sharedobject;version="2.3",
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.equinox.registry,
- org.eclipse.ecf
+ org.eclipse.equinox.registry;resolution:=optional,
+ org.eclipse.ecf;bundle-version="3.4.0"
Import-Package: org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework,
org.osgi.service.log,
diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/build.properties b/framework/bundles/org.eclipse.ecf.sharedobject/build.properties
index 85d76d225..6d5e0f021 100644
--- a/framework/bundles/org.eclipse.ecf.sharedobject/build.properties
+++ b/framework/bundles/org.eclipse.ecf.sharedobject/build.properties
@@ -9,5 +9,4 @@ src.includes = about.html,\
schema/
jars.compile.order = .
source.. = src/
-jre.compilation.profile = J2SE-1.4
javacErrors.. = -assertIdentifier,-enumIdentifier
diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/plugin.properties b/framework/bundles/org.eclipse.ecf.sharedobject/plugin.properties
index a88cffbbb..60429583b 100644
--- a/framework/bundles/org.eclipse.ecf.sharedobject/plugin.properties
+++ b/framework/bundles/org.eclipse.ecf.sharedobject/plugin.properties
@@ -6,6 +6,6 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-plugin.name=ECF Sharedobject API
+plugin.name=ECF SharedObject API
plugin.provider=Eclipse.org - ECF
diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java
index 33c628e1d..0c8e0c181 100644
--- a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java
+++ b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java
@@ -14,8 +14,7 @@ import java.lang.reflect.Method;
import java.util.*;
/**
- * @since 2.2
- *
+ * @since 3.3
*/
@SuppressWarnings("unchecked")
public class ClassUtil {
diff --git a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/internal/core/sharedobject/Activator.java b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/internal/core/sharedobject/Activator.java
index 877613b33..bb32f47bb 100644
--- a/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/internal/core/sharedobject/Activator.java
+++ b/framework/bundles/org.eclipse.ecf.sharedobject/src/org/eclipse/ecf/internal/core/sharedobject/Activator.java
@@ -40,15 +40,11 @@ public class Activator implements BundleActivator {
// The shared instance
private static Activator plugin;
- private BundleContext context = null;
-
- private IRegistryChangeListener registryManager = null;
-
- private ServiceTracker extensionRegistryTracker = null;
+ BundleContext context = null;
private ServiceTracker logServiceTracker = null;
- private ServiceTracker adapterManagerTracker = null;
+ private AdapterManagerTracker adapterManagerTracker = null;
/**
* The constructor
@@ -57,27 +53,24 @@ public class Activator implements BundleActivator {
// null constructor
}
- public IExtensionRegistry getExtensionRegistry() {
- return (IExtensionRegistry) extensionRegistryTracker.getService();
- }
-
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
- @SuppressWarnings("unchecked")
public void start(BundleContext ctxt) throws Exception {
this.context = ctxt;
plugin = this;
- this.extensionRegistryTracker = new ServiceTracker(ctxt, IExtensionRegistry.class.getName(), null);
- this.extensionRegistryTracker.open();
- IExtensionRegistry registry = getExtensionRegistry();
- if (registry != null) {
- this.registryManager = new SharedObjectRegistryManager();
- registry.addRegistryChangeListener(registryManager);
- }
- setupSharedObjectExtensionPoint(ctxt);
+
+ SafeRunner.run(new ExtensionRegistryRunnable(context) {
+ protected void runWithRegistry(IExtensionRegistry registry) throws Exception {
+ if (registry != null) {
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(SHAREDOBJECT_FACTORY_EPOINT);
+ if (extensionPoint != null)
+ addSharedObjectExtensions(extensionPoint.getConfigurationElements());
+ }
+ }
+ });
Trace.exiting(Activator.PLUGIN_ID, SharedObjectDebugOptions.METHODS_ENTERING, Activator.class, "start"); //$NON-NLS-1$
}
@@ -88,14 +81,6 @@ public class Activator implements BundleActivator {
*/
public void stop(BundleContext ctxt) throws Exception {
Trace.entering(Activator.PLUGIN_ID, SharedObjectDebugOptions.METHODS_EXITING, Activator.class, "stop"); //$NON-NLS-1$
- IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null)
- reg.removeRegistryChangeListener(registryManager);
- this.registryManager = null;
- if (extensionRegistryTracker != null) {
- extensionRegistryTracker.close();
- extensionRegistryTracker = null;
- }
if (adapterManagerTracker != null) {
adapterManagerTracker.close();
adapterManagerTracker = null;
@@ -124,7 +109,6 @@ public class Activator implements BundleActivator {
private LogService systemLogService = null;
- @SuppressWarnings("unchecked")
protected LogService getLogService() {
if (context == null) {
if (systemLogService == null)
@@ -145,23 +129,15 @@ public class Activator implements BundleActivator {
}
}
- @SuppressWarnings("unchecked")
public IAdapterManager getAdapterManager() {
if (context == null)
return null;
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- if (adapterManager == null)
- getDefault().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Cannot get adapter manager", null)); //$NON-NLS-1$
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
/**
@@ -170,7 +146,7 @@ public class Activator implements BundleActivator {
* @param members
* the members to remove
*/
- protected void removeSharedObjectExtensions(IConfigurationElement[] members) {
+ void removeSharedObjectExtensions(IConfigurationElement[] members) {
for (int m = 0; m < members.length; m++) {
IConfigurationElement member = members[m];
String name = null;
@@ -203,7 +179,7 @@ public class Activator implements BundleActivator {
* @param members
* to add
*/
- protected void addSharedObjectExtensions(IConfigurationElement[] members) {
+ void addSharedObjectExtensions(IConfigurationElement[] members) {
String bundleName = getDefault().getBundle().getSymbolicName();
// For each configuration element
for (int m = 0; m < members.length; m++) {
@@ -224,8 +200,22 @@ public class Activator implements BundleActivator {
if (description == null) {
description = ""; //$NON-NLS-1$
}
+ IConfigurationElement[] propertyElements = member.getChildren(PROPERTY_ELEMENT_NAME);
+ Properties props = new Properties();
+ if (propertyElements != null) {
+ if (propertyElements.length > 0) {
+ for (int i = 0; i < propertyElements.length; i++) {
+ String name1 = propertyElements[i].getAttribute(NAME_ATTRIBUTE);
+ String value = propertyElements[i].getAttribute(VALUE_ATTRIBUTE);
+ if (name1 != null && !name1.equals("") && value != null //$NON-NLS-1$
+ && !value.equals("")) { //$NON-NLS-1$
+ props.setProperty(name1, value);
+ }
+ }
+ }
+ }
// Get any property elements
- Map properties = getProperties(member.getChildren(PROPERTY_ELEMENT_NAME));
+ Map properties = props;
// Now make description instance
SharedObjectTypeDescription scd = new SharedObjectTypeDescription(name, exten, description, properties);
org.eclipse.ecf.core.util.Trace.trace(Activator.PLUGIN_ID, SharedObjectDebugOptions.DEBUG, "setupSharedObjectExtensionPoint:createdDescription(" //$NON-NLS-1$
@@ -252,54 +242,4 @@ public class Activator implements BundleActivator {
}
}
- /**
- * Setup shared object extension point
- *
- * @param bc
- * the BundleContext for this bundle
- */
- protected void setupSharedObjectExtensionPoint(BundleContext bc) {
- IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null) {
- IExtensionPoint extensionPoint = reg.getExtensionPoint(SHAREDOBJECT_FACTORY_EPOINT);
- if (extensionPoint == null) {
- return;
- }
- addSharedObjectExtensions(extensionPoint.getConfigurationElements());
- }
- }
-
- protected Map getProperties(IConfigurationElement[] propertyElements) {
- Properties props = new Properties();
- if (propertyElements != null) {
- if (propertyElements.length > 0) {
- for (int i = 0; i < propertyElements.length; i++) {
- String name = propertyElements[i].getAttribute(NAME_ATTRIBUTE);
- String value = propertyElements[i].getAttribute(VALUE_ATTRIBUTE);
- if (name != null && !name.equals("") && value != null //$NON-NLS-1$
- && !value.equals("")) { //$NON-NLS-1$
- props.setProperty(name, value);
- }
- }
- }
- }
- return props;
- }
-
- protected class SharedObjectRegistryManager implements IRegistryChangeListener {
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta delta[] = event.getExtensionDeltas(PLUGIN_ID, NAMESPACE_NAME);
- for (int i = 0; i < delta.length; i++) {
- switch (delta[i].getKind()) {
- case IExtensionDelta.ADDED :
- addSharedObjectExtensions(delta[i].getExtension().getConfigurationElements());
- break;
- case IExtensionDelta.REMOVED :
- removeSharedObjectExtensions(delta[i].getExtension().getConfigurationElements());
- break;
- }
- }
- }
- }
-
}
diff --git a/framework/bundles/org.eclipse.ecf.sync/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.sync/META-INF/MANIFEST.MF
index 3b53dd4a0..285973423 100644
--- a/framework/bundles/org.eclipse.ecf.sync/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.sync/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.sync
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.100.qualifier
Bundle-Activator: org.eclipse.ecf.internal.sync.Activator
Bundle-Vendor: %plugin.provider
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaDocumentChangeMessage.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaDocumentChangeMessage.java
index dea9abba1..7bd069f57 100644
--- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaDocumentChangeMessage.java
+++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaDocumentChangeMessage.java
@@ -13,7 +13,6 @@ package org.eclipse.ecf.internal.sync.doc.cola;
import java.util.LinkedList;
import java.util.List;
-
import org.eclipse.ecf.core.util.Trace;
import org.eclipse.ecf.internal.sync.Activator;
import org.eclipse.ecf.internal.sync.SyncDebugOptions;
@@ -23,16 +22,21 @@ public class ColaDocumentChangeMessage extends DocumentChangeMessage {
private static final long serialVersionUID = 2038025022180647210L;
+ public static final int TRANSFORM_TYPE_NOT_REPLACE_OR_DELETE = 0;
+ public static final int TRANSFORM_TYPE_DELETE = 1;
+ public static final int TRANSFORM_TYPE_REPLACE = 2;
+
// TODO encapsulate in a new ColaOpOriginationState and re-implement equals,
// hashCode, i.e. make comparable
private final long localOperationsCount;
private final long remoteOperationsCount;
private final int transformType;
-
+
private boolean splitUp;
private List splitUpRepresentation;
- public ColaDocumentChangeMessage(DocumentChangeMessage msg, long localOperationsCount, long remoteOperationsCount) {
+ public ColaDocumentChangeMessage(DocumentChangeMessage msg,
+ long localOperationsCount, long remoteOperationsCount) {
super(msg.getOffset(), msg.getLengthOfReplacedText(), msg.getText());
this.localOperationsCount = localOperationsCount;
this.remoteOperationsCount = remoteOperationsCount;
@@ -40,32 +44,33 @@ public class ColaDocumentChangeMessage extends DocumentChangeMessage {
this.splitUpRepresentation = new LinkedList();
if (super.getLengthOfReplacedText() == 0) {
// this is neither a replacement, nor a deletion
- transformType = 0;
+ transformType = TRANSFORM_TYPE_NOT_REPLACE_OR_DELETE;
} else {
if (super.getText().length() == 0) {
// something has been replaced, nothing inserted, must be a
// deletion
- transformType = 1;
+ transformType = TRANSFORM_TYPE_DELETE;
} else {
// something has been replaced with some new input, has to be a
// replacement op
- transformType = 2;
- //TODO this has not been implemented yet
- //throw new IllegalArgumentException("Replacement Handling not implemented yet! Known Bug.");
+ transformType = TRANSFORM_TYPE_REPLACE;
+ // TODO this has not been implemented yet
+ // throw new
+ // IllegalArgumentException("Replacement Handling not implemented yet! Known Bug.");
}
}
}
public boolean isInsertion() {
- return (transformType == 0);
+ return (transformType == TRANSFORM_TYPE_NOT_REPLACE_OR_DELETE);
}
public boolean isDeletion() {
- return (transformType == 1);
+ return (transformType == TRANSFORM_TYPE_DELETE);
}
public boolean isReplacement() {
- return (transformType == 2);
+ return (transformType == TRANSFORM_TYPE_REPLACE);
}
public long getLocalOperationsCount() {
@@ -77,15 +82,21 @@ public class ColaDocumentChangeMessage extends DocumentChangeMessage {
}
private ColaTransformationStrategy getTransformationStrategy() {
- if (isInsertion()) return ColaInsertionTransformationStategy.getInstance();
- if (isDeletion()) return ColaDeletionTransformationStrategy.getInstance();
+ if (isInsertion())
+ return ColaInsertionTransformationStategy.getInstance();
+ if (isDeletion())
+ return ColaDeletionTransformationStrategy.getInstance();
return ColaReplacementTransformationStategy.getInstance();
}
-
- public ColaDocumentChangeMessage transformAgainst(ColaDocumentChangeMessage localMsg, boolean localMsgHighPrio) {
- Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING, this.getClass(), "transformAgainst", localMsg); //$NON-NLS-1$
- final ColaDocumentChangeMessage transformedMsg = getTransformationStrategy().getOperationalTransform(this, localMsg, localMsgHighPrio);
- Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_EXITING, this.getClass(), "transformAgainst", transformedMsg); //$NON-NLS-1$
+
+ public ColaDocumentChangeMessage transformAgainst(
+ ColaDocumentChangeMessage localMsg, boolean localMsgHighPrio) {
+ Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING,
+ this.getClass(), "transformAgainst", localMsg); //$NON-NLS-1$
+ final ColaDocumentChangeMessage transformedMsg = getTransformationStrategy()
+ .getOperationalTransform(this, localMsg, localMsgHighPrio);
+ Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_EXITING,
+ this.getClass(), "transformAgainst", transformedMsg); //$NON-NLS-1$
return transformedMsg;
}
@@ -99,7 +110,7 @@ public class ColaDocumentChangeMessage extends DocumentChangeMessage {
} else if (transformType == 2) {
tType = "replace";
}
- buf.append("transformType="+tType);
+ buf.append("transformType=" + tType);
buf.append(";offset=").append(getOffset()); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(";length=").append(getLengthOfReplacedText()).append(";text=").append(getText()).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(";operationsCount[local=").append(getLocalOperationsCount()); //$NON-NLS-1$
@@ -123,7 +134,8 @@ public class ColaDocumentChangeMessage extends DocumentChangeMessage {
return splitUpRepresentation;
}
- public void addToSplitUpRepresentation(ColaDocumentChangeMessage splitUpRepresentationPart) {
+ public void addToSplitUpRepresentation(
+ ColaDocumentChangeMessage splitUpRepresentationPart) {
this.splitUpRepresentation.add(splitUpRepresentationPart);
}
}
diff --git a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java
index cd5f2361c..fe3656ca8 100644
--- a/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java
+++ b/framework/bundles/org.eclipse.ecf.sync/src/org/eclipse/ecf/internal/sync/doc/cola/ColaSynchronizationStrategy.java
@@ -11,29 +11,20 @@
package org.eclipse.ecf.internal.sync.doc.cola;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
+import java.util.*;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.util.Trace;
import org.eclipse.ecf.internal.sync.Activator;
import org.eclipse.ecf.internal.sync.SyncDebugOptions;
-import org.eclipse.ecf.sync.IModelChange;
-import org.eclipse.ecf.sync.IModelChangeMessage;
-import org.eclipse.ecf.sync.IModelSynchronizationStrategy;
-import org.eclipse.ecf.sync.SerializationException;
+import org.eclipse.ecf.sync.*;
import org.eclipse.ecf.sync.doc.DocumentChangeMessage;
import org.eclipse.ecf.sync.doc.IDocumentChange;
import org.eclipse.osgi.util.NLS;
-public class ColaSynchronizationStrategy implements IModelSynchronizationStrategy {
+public class ColaSynchronizationStrategy implements
+ IModelSynchronizationStrategy {
// <ColaDocumentChangeMessage>
private final List unacknowledgedLocalOperations;
@@ -51,14 +42,13 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg
remoteOperationsCount = 0;
}
- public static ColaSynchronizationStrategy getInstanceFor(ID client, boolean isInitiator) {
- ColaSynchronizationStrategy existingStrategy = (ColaSynchronizationStrategy) sessionStrategies.get(client);
- if (existingStrategy != null) {
- Boolean existingStrategyIsInitiator = new Boolean(existingStrategy.isInitiator);
- if (existingStrategyIsInitiator.equals(new Boolean(isInitiator))) {
- return existingStrategy;
- }
- }
+ public static ColaSynchronizationStrategy getInstanceFor(ID client,
+ boolean isInitiator) {
+ ColaSynchronizationStrategy existingStrategy = (ColaSynchronizationStrategy) sessionStrategies
+ .get(client);
+ if (existingStrategy != null
+ && existingStrategy.isInitiator == isInitiator)
+ return existingStrategy;
existingStrategy = new ColaSynchronizationStrategy(isInitiator);
sessionStrategies.put(client, existingStrategy);
return existingStrategy;
@@ -71,35 +61,51 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg
public static void dispose() {
sessionStrategies.clear();
}
+
/**
- * Handles proper transformation of incoming <code>ColaDocumentChangeMessage</code>s.
- * Returned <code>DocumentChangeMessage</code>s can be applied directly to the
- * shared document. The method implements the concurrency algorithm described
- * in <code>http://wiki.eclipse.org/RT_Shared_Editing</code>
- * @param remoteMsg
- * @return List contains <code>DocumentChangeMessage</code>s ready for sequential application to document
+ * Handles proper transformation of incoming
+ * <code>ColaDocumentChangeMessage</code>s. Returned
+ * <code>DocumentChangeMessage</code>s can be applied directly to the shared
+ * document. The method implements the concurrency algorithm described in
+ * <code>http://wiki.eclipse.org/RT_Shared_Editing</code>
+ *
+ * @param remoteMsg
+ * @return List contains <code>DocumentChangeMessage</code>s ready for
+ * sequential application to document
*/
public List transformIncomingMessage(final DocumentChangeMessage remoteMsg) {
if (!(remoteMsg instanceof ColaDocumentChangeMessage)) {
- throw new IllegalArgumentException("DocumentChangeMessage is incompatible with Cola SynchronizationStrategy"); //$NON-NLS-1$
+ throw new IllegalArgumentException(
+ "DocumentChangeMessage is incompatible with Cola SynchronizationStrategy"); //$NON-NLS-1$
}
- Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING, this.getClass(), "transformIncomingMessage", remoteMsg); //$NON-NLS-1$
+ Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING,
+ this.getClass(), "transformIncomingMessage", remoteMsg); //$NON-NLS-1$
ColaDocumentChangeMessage transformedRemote = (ColaDocumentChangeMessage) remoteMsg;
final List transformedRemotes = new LinkedList();
transformedRemotes.add(transformedRemote);
remoteOperationsCount++;
- Trace.trace(Activator.PLUGIN_ID, "unacknowledgedLocalOperations="+unacknowledgedLocalOperations);
- //this is where the concurrency algorithm is executed
- if (!unacknowledgedLocalOperations.isEmpty()) {//Do not remove this. It is necessary. The following iterator does not suffice.
+ Trace.trace(Activator.PLUGIN_ID, "unacknowledgedLocalOperations="
+ + unacknowledgedLocalOperations);
+ // this is where the concurrency algorithm is executed
+ if (!unacknowledgedLocalOperations.isEmpty()) {// Do not remove this. It
+ // is necessary. The
+ // following iterator
+ // does not suffice.
// remove operations from queue that have been implicitly
// acknowledged as received on the remote site by the reception of
// this message
- for (final Iterator it = unacknowledgedLocalOperations.iterator(); it.hasNext();) {
- final ColaDocumentChangeMessage unackedLocalOp = (ColaDocumentChangeMessage) it.next();
- if (transformedRemote.getRemoteOperationsCount() > unackedLocalOp.getLocalOperationsCount()) {
- Trace.trace(Activator.PLUGIN_ID, NLS.bind("transformIncomingMessage.removing {0}", unackedLocalOp)); //$NON-NLS-1$
+ for (final Iterator it = unacknowledgedLocalOperations.iterator(); it
+ .hasNext();) {
+ final ColaDocumentChangeMessage unackedLocalOp = (ColaDocumentChangeMessage) it
+ .next();
+ if (transformedRemote.getRemoteOperationsCount() > unackedLocalOp
+ .getLocalOperationsCount()) {
+ Trace.trace(
+ Activator.PLUGIN_ID,
+ NLS.bind(
+ "transformIncomingMessage.removing {0}", unackedLocalOp)); //$NON-NLS-1$
it.remove();
} else {
// the unackowledgedLocalOperations queue is ordered and
@@ -110,7 +116,8 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg
// remote operation's view)
// is reached, we can abandon the check for the remaining
// queue items
- Trace.trace(Activator.PLUGIN_ID, "breaking out of unackedLocalOperations loop"); //$NON-NLS-1$
+ Trace.trace(Activator.PLUGIN_ID,
+ "breaking out of unackedLocalOperations loop"); //$NON-NLS-1$
break;// exits for-loop
}
}
@@ -119,62 +126,106 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg
// don't require to be transformed against
if (!unacknowledgedLocalOperations.isEmpty()) {
- ColaDocumentChangeMessage localOp = (ColaDocumentChangeMessage) unacknowledgedLocalOperations.get(0);
- Assert.isTrue(transformedRemote.getRemoteOperationsCount() == localOp.getLocalOperationsCount());
+ ColaDocumentChangeMessage localOp = (ColaDocumentChangeMessage) unacknowledgedLocalOperations
+ .get(0);
+ Assert.isTrue(transformedRemote.getRemoteOperationsCount() == localOp
+ .getLocalOperationsCount());
- for (final ListIterator unackOpsListIt = unacknowledgedLocalOperations.listIterator(); unackOpsListIt.hasNext();) {
- for (final ListIterator trafoRemotesIt = transformedRemotes.listIterator(); trafoRemotesIt.hasNext();) {
+ for (final ListIterator unackOpsListIt = unacknowledgedLocalOperations
+ .listIterator(); unackOpsListIt.hasNext();) {
+ for (final ListIterator trafoRemotesIt = transformedRemotes
+ .listIterator(); trafoRemotesIt.hasNext();) {
// returns new instance
- // clarify operation preference, owner/docshare initiator
+ // clarify operation preference, owner/docshare
+ // initiator
// consistently comes first
- localOp = (ColaDocumentChangeMessage) unackOpsListIt.next();
- transformedRemote = (ColaDocumentChangeMessage) trafoRemotesIt.next();
- transformedRemote = transformedRemote.transformAgainst(localOp, isInitiator);
+ localOp = (ColaDocumentChangeMessage) unackOpsListIt
+ .next();
+ transformedRemote = (ColaDocumentChangeMessage) trafoRemotesIt
+ .next();
+ transformedRemote = transformedRemote.transformAgainst(
+ localOp, isInitiator);
if (transformedRemote.isSplitUp()) {
- //currently this only happens for a remote deletion that needs to be transformed against a locally applied insertion
- //attention: before applying a list of deletions to docshare, the indices need to be updated/finalized one last time
- //since deletions can only be applied sequentially and every deletion is going to change the underlying document and the
- //respective indices!
+ // currently this only happens for a remote deletion
+ // that needs to be transformed against a locally
+ // applied insertion
+ // attention: before applying a list of deletions to
+ // docshare, the indices need to be
+ // updated/finalized one last time
+ // since deletions can only be applied sequentially
+ // and every deletion is going to change the
+ // underlying document and the
+ // respective indices!
trafoRemotesIt.remove();
- for (final Iterator splitUpIterator = transformedRemote.getSplitUpRepresentation().iterator(); splitUpIterator.hasNext();) {
+ for (final Iterator splitUpIterator = transformedRemote
+ .getSplitUpRepresentation().iterator(); splitUpIterator
+ .hasNext();) {
trafoRemotesIt.add(splitUpIterator.next());
}
- //according to the ListIterator documentation it seems so as if the following line is unnecessary,
- //as a call to next() after the last removal and additions will return what it would have returned anyway
- //trafoRemotesIt.next();//TODO not sure about the need for this - I want to jump over the two inserted ops and reach the end of this iterator
+ // according to the ListIterator documentation it
+ // seems so as if the following line is unnecessary,
+ // as a call to next() after the last removal and
+ // additions will return what it would have returned
+ // anyway
+ // trafoRemotesIt.next();//TODO not sure about the
+ // need for this - I want to jump over the two
+ // inserted ops and reach the end of this iterator
}
- //TODO check whether or not this collection shuffling does what it is supposed to, i.e. remove current localop in unack list and add split up representation instead
+ // TODO check whether or not this collection shuffling
+ // does what it is supposed to, i.e. remove current
+ // localop in unack list and add split up representation
+ // instead
if (localOp.isSplitUp()) {
- //local operation has been split up during operational transform --> remove current version and add new versions plus jump over those
+ // local operation has been split up during
+ // operational transform --> remove current version
+ // and add new versions plus jump over those
unackOpsListIt.remove();
- for (final Iterator splitUpOpIterator = localOp.getSplitUpRepresentation().iterator(); splitUpOpIterator.hasNext();) {
+ for (final Iterator splitUpOpIterator = localOp
+ .getSplitUpRepresentation().iterator(); splitUpOpIterator
+ .hasNext();) {
unackOpsListIt.add(splitUpOpIterator.next());
}
- //according to the ListIterator documentation it seems so as if the following line is unnecessary,
- //as a call to next() after the last removal and additions will return what it would have returned anyway
- //unackOpsListIt.next();//TODO check whether or not this does jump over both inserted operations that replaced the current unack op
- }//end split up localop handling
- }//transformedRemotes List iteration
+ // according to the ListIterator documentation it
+ // seems so as if the following line is unnecessary,
+ // as a call to next() after the last removal and
+ // additions will return what it would have returned
+ // anyway
+ // unackOpsListIt.next();//TODO check whether or not
+ // this does jump over both inserted operations that
+ // replaced the current unack op
+ }// end split up localop handling
+ }// transformedRemotes List iteration
}
}
}
- Trace.exiting(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_EXITING, this.getClass(), "transformIncomingMessage", transformedRemote); //$NON-NLS-1$
+ Trace.exiting(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_EXITING,
+ this.getClass(), "transformIncomingMessage", transformedRemote); //$NON-NLS-1$
- //TODO find a cleaner and more OO way of cleaning up the list if it contains multiple deletions:
+ // TODO find a cleaner and more OO way of cleaning up the list if it
+ // contains multiple deletions:
if (transformedRemotes.size() > 1) {
- final ColaDocumentChangeMessage firstOp = (ColaDocumentChangeMessage) transformedRemotes.get(0);
+ final ColaDocumentChangeMessage firstOp = (ColaDocumentChangeMessage) transformedRemotes
+ .get(0);
if (firstOp.isDeletion()) {
- //this means all operations in the return list must also be deletions, i.e. modify virtual/optimistic offset for sequential application to document
- final ListIterator deletionFinalizerIt = transformedRemotes.listIterator();
- ColaDocumentChangeMessage previousDel = (ColaDocumentChangeMessage) deletionFinalizerIt.next();//jump over first del-op does not need modification, we know this is OK because of previous size check;
+ // this means all operations in the return list must also be
+ // deletions, i.e. modify virtual/optimistic offset for
+ // sequential application to document
+ final ListIterator deletionFinalizerIt = transformedRemotes
+ .listIterator();
+ ColaDocumentChangeMessage previousDel = (ColaDocumentChangeMessage) deletionFinalizerIt
+ .next();// jump over first del-op does not need
+ // modification, we know this is OK because of
+ // previous size check;
ColaDocumentChangeMessage currentDel;
for (; deletionFinalizerIt.hasNext();) {
- currentDel = (ColaDocumentChangeMessage) deletionFinalizerIt.next();
- currentDel.setOffset(currentDel.getOffset() - previousDel.getLengthOfReplacedText());
+ currentDel = (ColaDocumentChangeMessage) deletionFinalizerIt
+ .next();
+ currentDel.setOffset(currentDel.getOffset()
+ - previousDel.getLengthOfReplacedText());
previousDel = currentDel;
}
}
@@ -188,48 +239,75 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg
return buf.toString();
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#registerLocalChange(org.eclipse.ecf.sync.doc.IModelChange)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#registerLocalChange
+ * (org.eclipse.ecf.sync.doc.IModelChange)
*/
public IModelChangeMessage[] registerLocalChange(IModelChange localChange) {
List results = new ArrayList();
- Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING, this.getClass(), "registerLocalChange", localChange); //$NON-NLS-1$
+ Trace.entering(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_ENTERING,
+ this.getClass(), "registerLocalChange", localChange); //$NON-NLS-1$
if (localChange instanceof IDocumentChange) {
final IDocumentChange docChange = (IDocumentChange) localChange;
- final ColaDocumentChangeMessage colaMsg = new ColaDocumentChangeMessage(new DocumentChangeMessage(docChange.getOffset(), docChange.getLengthOfReplacedText(), docChange.getText()), localOperationsCount, remoteOperationsCount);
- // If not replacement, we simply add to unacknowledgedLocalOperations and add message
+ final ColaDocumentChangeMessage colaMsg = new ColaDocumentChangeMessage(
+ new DocumentChangeMessage(docChange.getOffset(),
+ docChange.getLengthOfReplacedText(),
+ docChange.getText()), localOperationsCount,
+ remoteOperationsCount);
+ // If not replacement, we simply add to
+ // unacknowledgedLocalOperations and add message
// to results
if (!colaMsg.isReplacement()) {
unacknowledgedLocalOperations.add(colaMsg);
localOperationsCount++;
results.add(colaMsg);
} else {
- // It *is a replacement message, so we add both a delete and an insert message
+ // It *is a replacement message, so we add both a delete and an
+ // insert message
// First create/add a delete message (text set to "")...
- ColaDocumentChangeMessage delMsg = new ColaDocumentChangeMessage(new DocumentChangeMessage(docChange.getOffset(),docChange.getLengthOfReplacedText(),""), localOperationsCount, remoteOperationsCount);
+ ColaDocumentChangeMessage delMsg = new ColaDocumentChangeMessage(
+ new DocumentChangeMessage(docChange.getOffset(),
+ docChange.getLengthOfReplacedText(), ""),
+ localOperationsCount, remoteOperationsCount);
unacknowledgedLocalOperations.add(delMsg);
localOperationsCount++;
results.add(delMsg);
// Then create/add the insert message (length set to 0)
- ColaDocumentChangeMessage insMsg = new ColaDocumentChangeMessage(new DocumentChangeMessage(docChange.getOffset(),0,docChange.getText()), localOperationsCount, remoteOperationsCount);
+ ColaDocumentChangeMessage insMsg = new ColaDocumentChangeMessage(
+ new DocumentChangeMessage(docChange.getOffset(), 0,
+ docChange.getText()), localOperationsCount,
+ remoteOperationsCount);
unacknowledgedLocalOperations.add(insMsg);
localOperationsCount++;
results.add(insMsg);
}
- Trace.exiting(Activator.PLUGIN_ID, SyncDebugOptions.METHODS_EXITING, this.getClass(), "registerLocalChange", colaMsg); //$NON-NLS-1$
+ Trace.exiting(Activator.PLUGIN_ID,
+ SyncDebugOptions.METHODS_EXITING, this.getClass(),
+ "registerLocalChange", colaMsg); //$NON-NLS-1$
}
- return (IModelChangeMessage[]) results.toArray(new IModelChangeMessage[] {});
+ return (IModelChangeMessage[]) results
+ .toArray(new IModelChangeMessage[] {});
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#toDocumentChangeMessage(byte[])
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#
+ * toDocumentChangeMessage(byte[])
*/
- public IModelChange deserializeRemoteChange(byte[] bytes) throws SerializationException {
+ public IModelChange deserializeRemoteChange(byte[] bytes)
+ throws SerializationException {
return DocumentChangeMessage.deserialize(bytes);
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#transformRemoteChange(org.eclipse.ecf.sync.doc.IModelChangeMessage)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.sync.doc.IDocumentSynchronizationStrategy#
+ * transformRemoteChange(org.eclipse.ecf.sync.doc.IModelChangeMessage)
*/
public IModelChange[] transformRemoteChange(IModelChange remoteChange) {
if (!(remoteChange instanceof DocumentChangeMessage))
@@ -239,13 +317,17 @@ public class ColaSynchronizationStrategy implements IModelSynchronizationStrateg
return (IDocumentChange[]) l.toArray(new IDocumentChange[] {});
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
- if (adapter == null) return null;
+ if (adapter == null)
+ return null;
IAdapterManager manager = Activator.getDefault().getAdapterManager();
- if (manager == null) return null;
+ if (manager == null)
+ return null;
return manager.loadAdapter(this, adapter.getName());
}
} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
index 45fb08bd7..b201fbc5f 100644
--- a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf;singleton:=true
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.4.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.core.ECFPlugin
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
@@ -17,7 +17,8 @@ Export-Package: org.eclipse.ecf.core;version="3.0.0",
org.eclipse.ecf.core.start;version="3.1.0",
org.eclipse.ecf.core.status;version="1.1.0",
org.eclipse.ecf.core.user;version="3.1.0",
- org.eclipse.ecf.core.util;version="3.2.0",
+ org.eclipse.ecf.core.util;version="3.4.0",
+ org.eclipse.ecf.core.util.reflection;version="2.3.0",
org.eclipse.ecf.internal.core;x-internal:=true
Import-Package: org.eclipse.core.runtime.jobs,
org.eclipse.equinox.concurrent.future;version="1.0.0";resolution:=optional;x-installation:=greedy,
@@ -25,6 +26,7 @@ Import-Package: org.eclipse.core.runtime.jobs,
org.osgi.service.log;version="1.3.0",
org.osgi.util.tracker;version="1.3.2"
Require-Bundle: org.eclipse.equinox.common,
- org.eclipse.equinox.registry,
+ org.eclipse.equinox.registry;resolution:=optional,
org.eclipse.ecf.identity;visibility:=reexport
Bundle-ActivationPolicy: lazy
+Provide-Capability: ecf.containertype;names:List<String>=”ecf.base”; version:Version=3.3
diff --git a/framework/bundles/org.eclipse.ecf/javadoc.xml b/framework/bundles/org.eclipse.ecf/javadoc.xml
index 2ec298707..d5115990d 100644
--- a/framework/bundles/org.eclipse.ecf/javadoc.xml
+++ b/framework/bundles/org.eclipse.ecf/javadoc.xml
@@ -15,7 +15,7 @@
author="false"
classpathref="files.classpath"
destdir="${output}"
- doctitle="Eclipse Communication Framework (ECF) 3.7.0"
+ doctitle="Eclipse Communication Framework (ECF) 3.8.1"
nodeprecated="false"
nodeprecatedlist="false"
noindex="false"
@@ -43,6 +43,7 @@
<exclude name="**/collab/**"/>
<exclude name="**/osgi/services/discovery/**"/>
<exclude name="**/com/mycorp/examples/timeservice/**"/>
+ <exclude name="**/org.eclipse.ecf.remoteservice.asyncproxy.j8/**"/>
<exclude name="**/org.eclipse.ecf.remoteservices.tooling.pde/templates/**"/>
</fileset>
</javadoc>
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/BaseContainer.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/BaseContainer.java
index bf004c746..e35c41a7c 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/BaseContainer.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/BaseContainer.java
@@ -25,6 +25,12 @@ import org.eclipse.ecf.core.security.IConnectContext;
public class BaseContainer extends AbstractContainer {
public static class Instantiator extends BaseContainerInstantiator {
+
+ /**
+ * @since 3.4
+ */
+ public static final String NAME = "ecf.base"; //$NON-NLS-1$
+
private static long nextBaseContainerID = 0L;
public IContainer createInstance(ContainerTypeDescription description, Object[] parameters) throws ContainerCreateException {
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerTypeDescription.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerTypeDescription.java
index c8cd25685..96555812e 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerTypeDescription.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/ContainerTypeDescription.java
@@ -53,6 +53,13 @@ public class ContainerTypeDescription {
this.hidden = hidden;
}
+ /**
+ * @since 3.4
+ */
+ public ContainerTypeDescription(String name, IContainerInstantiator instantiator) {
+ this(name, instantiator, null);
+ }
+
public ContainerTypeDescription(String name, IContainerInstantiator instantiator, String description) {
this(name, instantiator, description, false, false);
}
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java
new file mode 100644
index 000000000..128ade165
--- /dev/null
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/util/reflection/ClassUtil.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Markus Alexander Kuppe.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Alexander Kuppe (ecf-dev_eclipse.org <at> lemmster <dot> de) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.core.util.reflection;
+
+import java.lang.reflect.Method;
+import java.util.*;
+
+/**
+ * @since 3.3
+ */
+public class ClassUtil {
+
+ private static Map convertor = new HashMap();
+
+ static {
+ convertor.put(boolean.class, Boolean.class);
+ convertor.put(byte.class, Byte.class);
+ convertor.put(char.class, Character.class);
+ convertor.put(double.class, Double.class);
+ convertor.put(float.class, Float.class);
+ convertor.put(int.class, Integer.class);
+ convertor.put(long.class, Long.class);
+ convertor.put(short.class, Short.class);
+ }
+
+ /**
+ * @param aClass The Class providing method under question (Must not be null)
+ * @param aMethodName The method name to search for (Must not be null)
+ * @param someParameterTypes Method arguments (May be null or parameters)
+ * @return A match. If more than one method matched (due to overloading) an arbitrary match is taken
+ * @throws NoSuchMethodException If a match cannot be found
+ */
+ public static Method getMethod(final Class aClass, String aMethodName, final Class[] someParameterTypes) throws NoSuchMethodException {
+ // no args makes matching simple
+ if (someParameterTypes == null || someParameterTypes.length == 0) {
+ return aClass.getMethod(aMethodName, (Class[]) null);
+ }
+ return getMethod(aClass.getMethods(), aMethodName, someParameterTypes);
+ }
+
+ /**
+ * @param aClass The Class providing method under question (Must not be null)
+ * @param aMethodName The method name to search for (Must not be null)
+ * @param someParameterTypes Method arguments (May be null or parameters)
+ * @return A match. If more than one method matched (due to overloading) an arbitrary match is taken
+ * @throws NoSuchMethodException If a match cannot be found
+ */
+ public static Method getDeclaredMethod(final Class aClass, String aMethodName, final Class[] someParameterTypes) throws NoSuchMethodException {
+ // no args makes matching simple
+ if (someParameterTypes == null || someParameterTypes.length == 0) {
+ return aClass.getDeclaredMethod(aMethodName, (Class[]) null);
+ }
+ return getMethod(aClass.getDeclaredMethods(), aMethodName, someParameterTypes);
+ }
+
+ private static Method getMethod(final Method[] candidates, String aMethodName, final Class[] someParameterTypes) throws NoSuchMethodException {
+ // match parameters to determine callee
+ final int parameterCount = someParameterTypes.length;
+ aMethodName = aMethodName.intern();
+
+ final TreeSet matches = new TreeSet(new MethodComparator(someParameterTypes));
+ OUTER: for (int i = 0; i < candidates.length; i++) {
+ final Method candidate = candidates[i];
+ final String candidateMethodName = candidate.getName().intern();
+ final Class[] candidateParameterTypes = candidate.getParameterTypes();
+ final int candidateParameterCount = candidateParameterTypes.length;
+ if (candidateParameterCount == parameterCount && aMethodName == candidateMethodName) {
+ for (int j = 0; j < candidateParameterCount; j++) {
+ final Class clazzA = candidateParameterTypes[j];
+ final Class clazzB = someParameterTypes[j];
+ if (clazzB != null && !isAssignableFrom(clazzA, clazzB)) {
+ continue OUTER;
+ }
+ }
+ matches.add(candidate);
+ }
+ }
+
+ // if no match has been found, fail with NSME
+ if (matches.size() == 0) {
+ throw new NoSuchMethodException("No such method: " + aMethodName + "(" + Arrays.asList(someParameterTypes) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return (Method) matches.first();
+ }
+
+ // extends Class.isAssingable(Class) with autoboxing
+ private static boolean isAssignableFrom(Class clazzA, Class clazzB) {
+ if (!(clazzA.isPrimitive() ^ clazzB.isPrimitive())) {
+ return clazzA.isAssignableFrom(clazzB);
+ } else if (clazzA.isPrimitive()) {
+ final Class oClazzA = (Class) convertor.get(clazzA);
+ return oClazzA.isAssignableFrom(clazzB);
+ } else {
+ final Class oClazzB = (Class) convertor.get(clazzB);
+ return clazzA.isAssignableFrom(oClazzB);
+ }
+ }
+
+ private static class MethodComparator implements Comparator {
+
+ private final Class[] parameterTypes;
+
+ public MethodComparator(Class[] someParameterTypes) {
+ parameterTypes = someParameterTypes;
+ }
+
+ public int compare(Object object1, Object object2) {
+ final Class[] pt1 = ((Method) object1).getParameterTypes();
+ final Class[] pt2 = ((Method) object2).getParameterTypes();
+
+ if (Arrays.equals(pt1, pt2)) {
+ return 0;
+ } else if (Arrays.equals(parameterTypes, pt1)) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+ }
+}
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
index c36c03063..151df0d31 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
@@ -19,6 +19,7 @@ import org.eclipse.ecf.internal.core.identity.Activator;
import org.osgi.framework.*;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
public class ECFPlugin implements BundleActivator {
@@ -67,13 +68,13 @@ public class ECFPlugin implements BundleActivator {
// The shared instance.
private static ECFPlugin plugin;
- private BundleContext context = null;
-
- private ServiceTracker extensionRegistryTracker = null;
+ BundleContext context = null;
private Map disposables = new WeakHashMap();
- private IRegistryChangeListener registryManager = null;
+ // This is Object rather than IExtensionRegistryManager to avoid loading
+ // IRegistryChangeListener class (optional)
+ Object registryManager = null;
private ServiceRegistration containerFactoryServiceRegistration;
@@ -83,7 +84,7 @@ public class ECFPlugin implements BundleActivator {
private LogService logService = null;
- private ServiceTracker adapterManagerTracker = null;
+ private AdapterManagerTracker adapterManagerTracker = null;
private BundleActivator ecfTrustManager;
@@ -92,9 +93,8 @@ public class ECFPlugin implements BundleActivator {
* @return ECFPlugin
*/
public synchronized static ECFPlugin getDefault() {
- if (plugin == null) {
+ if (plugin == null)
plugin = new ECFPlugin();
- }
return plugin;
}
@@ -117,14 +117,62 @@ public class ECFPlugin implements BundleActivator {
log(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), "Unexpected Error in ECFPlugin.start", t)); //$NON-NLS-1$
}
- this.extensionRegistryTracker = new ServiceTracker(ctxt, IExtensionRegistry.class.getName(), null);
- this.extensionRegistryTracker.open();
- final IExtensionRegistry registry = getExtensionRegistry();
- if (registry != null) {
- this.registryManager = new ECFRegistryManager();
- registry.addRegistryChangeListener(registryManager);
+ // initialize from ContainerTypeDescription services
+ if (containerTypeDescriptionTracker == null) {
+ containerTypeDescriptionTracker = new ServiceTracker(this.context, ContainerTypeDescription.class.getName(), new ServiceTrackerCustomizer() {
+ public Object addingService(ServiceReference reference) {
+ ContainerTypeDescription ctd = (ContainerTypeDescription) context.getService(reference);
+ if (ctd != null && ctd.getName() != null)
+ ContainerFactory.getDefault().addDescription(ctd);
+ return ctd;
+ }
+
+ public void modifiedService(ServiceReference reference, Object service) {
+ // nothing
+ }
+
+ public void removedService(ServiceReference reference, Object service) {
+ IContainerFactory cf = ContainerFactory.getDefault();
+ cf.removeDescription((ContainerTypeDescription) service);
+ }
+ });
+ containerTypeDescriptionTracker.open();
}
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithRegistry(IExtensionRegistry registry) throws Exception {
+ if (registry != null) {
+ registryManager = new IRegistryChangeListener() {
+ public void registryChanged(IRegistryChangeEvent event) {
+ final IExtensionDelta factoryDeltas[] = event.getExtensionDeltas(ECFNAMESPACE, CONTAINER_FACTORY_NAME);
+ for (int i = 0; i < factoryDeltas.length; i++) {
+ switch (factoryDeltas[i].getKind()) {
+ case IExtensionDelta.ADDED :
+ addContainerFactoryExtensions(factoryDeltas[i].getExtension().getConfigurationElements());
+ break;
+ case IExtensionDelta.REMOVED :
+ removeContainerFactoryExtensions(factoryDeltas[i].getExtension().getConfigurationElements());
+ break;
+ }
+ }
+ final IExtensionDelta containerDeltas[] = event.getExtensionDeltas(ECFNAMESPACE, CONTAINER_NAME);
+ for (int i = 0; i < containerDeltas.length; i++) {
+ switch (containerDeltas[i].getKind()) {
+ case IExtensionDelta.ADDED :
+ addContainerExtensions(containerDeltas[i].getExtension().getConfigurationElements());
+ break;
+ case IExtensionDelta.REMOVED :
+ removeContainerExtensions(containerDeltas[i].getExtension().getConfigurationElements());
+ break;
+ }
+ }
+ }
+ };
+ registry.addRegistryChangeListener((IRegistryChangeListener) registryManager);
+ }
+ }
+ });
+
// defer extension execution until first consumer calls
final ServiceFactory sf = new ServiceFactory() {
public Object getService(Bundle bundle, ServiceRegistration registration) {
@@ -135,25 +183,91 @@ public class ECFPlugin implements BundleActivator {
// NOP
}
};
+
containerFactoryServiceRegistration = ctxt.registerService(IContainerFactory.class.getName(), sf, null);
containerManagerServiceRegistration = ctxt.registerService(IContainerManager.class.getName(), sf, null);
- // but eagerly start ECF startup extension
- setupStartExtensionPoint(context);
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithRegistry(IExtensionRegistry registry) throws Exception {
+ if (registry != null) {
+ final IExtensionPoint extensionPoint = registry.getExtensionPoint(START_EPOINT);
+ if (extensionPoint == null) {
+ return;
+ }
+ IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
+ final String method = "runStartExtensions"; //$NON-NLS-1$
+ // For each configuration element
+ for (int m = 0; m < configurationElements.length; m++) {
+ final IConfigurationElement member = configurationElements[m];
+ try {
+ // The only required attribute is "class"
+ boolean sync = (member.getAttribute(ASYNCH_ATTRIBUTE) == null);
+ IECFStart clazz = (IECFStart) member.createExecutableExtension(CLASS_ATTRIBUTE);
+ // Create job to do start, and schedule
+ if (sync) {
+ IStatus result = null;
+ try {
+ result = clazz.run(new NullProgressMonitor());
+ } catch (final Throwable e) {
+ final String message = "startup extension error"; //$NON-NLS-1$
+ logException(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, e), message, e);
+ }
+ if (result != null && !result.isOK())
+ logException(result, result.getMessage(), result.getException());
+ } else {
+ final ECFStartJob job = new ECFStartJob(clazz.getClass().getName(), clazz);
+ job.schedule();
+ }
+ } catch (final CoreException e) {
+ logException(e.getStatus(), method, e);
+ } catch (final Exception e) {
+ logException(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR, "Unknown start exception", e), method, e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ });
+
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithoutRegistry() throws Exception {
+ ECFPlugin.this.context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(BaseContainer.Instantiator.NAME, new BaseContainer.Instantiator()), null);
+ }
+ });
}
+ private ServiceTracker containerTypeDescriptionTracker;
+
public void initializeExtensions() {
- setupContainerFactoryExtensionPoint(context);
- setupContainerExtensionPoint(context);
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithRegistry(IExtensionRegistry registry) throws Exception {
+ if (registry != null) {
+ IExtensionPoint extensionPoint = registry.getExtensionPoint(CONTAINER_FACTORY_EPOINT);
+ if (extensionPoint == null)
+ return;
+ addContainerFactoryExtensions(extensionPoint.getConfigurationElements());
+ extensionPoint = registry.getExtensionPoint(CONTAINER_EPOINT);
+ if (extensionPoint == null)
+ return;
+ addContainerExtensions(extensionPoint.getConfigurationElements());
+ }
+ }
+ });
}
public void stop(BundleContext ctxt) throws Exception {
fireDisposables();
this.disposables = null;
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null)
- reg.removeRegistryChangeListener(registryManager);
+ SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {
+ protected void runWithRegistry(IExtensionRegistry registry) throws Exception {
+ if (registry != null)
+ registry.removeRegistryChangeListener((IRegistryChangeListener) registryManager);
+ }
+ });
this.registryManager = null;
+ if (containerTypeDescriptionTracker != null) {
+ containerTypeDescriptionTracker.close();
+ containerTypeDescriptionTracker = null;
+ }
if (ecfTrustManager != null) {
ecfTrustManager.stop(ctxt);
ecfTrustManager = null;
@@ -163,10 +277,6 @@ public class ECFPlugin implements BundleActivator {
logServiceTracker = null;
logService = null;
}
- if (extensionRegistryTracker != null) {
- extensionRegistryTracker.close();
- extensionRegistryTracker = null;
- }
if (containerFactoryServiceRegistration != null) {
containerFactoryServiceRegistration.unregister();
containerFactoryServiceRegistration = null;
@@ -411,136 +521,15 @@ public class ECFPlugin implements BundleActivator {
return results;
}
- /**
- * Setup container factory extension point
- *
- * @param bc
- * the BundleContext for this bundle
- */
- protected void setupContainerFactoryExtensionPoint(BundleContext bc) {
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null) {
- final IExtensionPoint extensionPoint = reg.getExtensionPoint(CONTAINER_FACTORY_EPOINT);
- if (extensionPoint == null) {
- return;
- }
- addContainerFactoryExtensions(extensionPoint.getConfigurationElements());
- }
- }
-
- protected void setupContainerExtensionPoint(BundleContext bc) {
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null) {
- final IExtensionPoint extensionPoint = reg.getExtensionPoint(CONTAINER_EPOINT);
- if (extensionPoint == null) {
- return;
- }
- addContainerExtensions(extensionPoint.getConfigurationElements());
- }
- }
-
- public IExtensionRegistry getExtensionRegistry() {
- if (context == null)
- return null;
- return (IExtensionRegistry) extensionRegistryTracker.getService();
- }
-
- /**
- * Setup start extension point
- *
- * @param bc
- * the BundleContext for this bundle
- */
- protected void setupStartExtensionPoint(BundleContext bc) {
- final IExtensionRegistry reg = getExtensionRegistry();
- if (reg != null) {
- final IExtensionPoint extensionPoint = reg.getExtensionPoint(START_EPOINT);
- if (extensionPoint == null) {
- return;
- }
- runStartExtensions(extensionPoint.getConfigurationElements());
- }
- }
-
- protected void runStartExtensions(IConfigurationElement[] configurationElements) {
- final String method = "runStartExtensions"; //$NON-NLS-1$
- // For each configuration element
- for (int m = 0; m < configurationElements.length; m++) {
- final IConfigurationElement member = configurationElements[m];
- try {
- // The only required attribute is "class"
- boolean sync = (member.getAttribute(ASYNCH_ATTRIBUTE) == null);
- IECFStart clazz = (IECFStart) member.createExecutableExtension(CLASS_ATTRIBUTE);
- startExtension(clazz.getClass().getName(), clazz, sync);
- } catch (final CoreException e) {
- logException(e.getStatus(), method, e);
- } catch (final Exception e) {
- logException(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), IStatus.ERROR, "Unknown start exception", e), method, e); //$NON-NLS-1$
- }
- }
- }
-
- private void startExtension(String name, IECFStart exten, boolean synchronous) {
- // Create job to do start, and schedule
- if (synchronous) {
- IStatus result = null;
- try {
- result = exten.run(new NullProgressMonitor());
- } catch (final Throwable e) {
- final String message = "startup extension error"; //$NON-NLS-1$
- logException(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, e), message, e);
- }
- if (result != null && !result.isOK())
- logException(result, result.getMessage(), result.getException());
- } else {
- final ECFStartJob job = new ECFStartJob(name, exten);
- job.schedule();
- }
- }
-
- protected class ECFRegistryManager implements IRegistryChangeListener {
- public void registryChanged(IRegistryChangeEvent event) {
- final IExtensionDelta factoryDeltas[] = event.getExtensionDeltas(ECFNAMESPACE, CONTAINER_FACTORY_NAME);
- for (int i = 0; i < factoryDeltas.length; i++) {
- switch (factoryDeltas[i].getKind()) {
- case IExtensionDelta.ADDED :
- addContainerFactoryExtensions(factoryDeltas[i].getExtension().getConfigurationElements());
- break;
- case IExtensionDelta.REMOVED :
- removeContainerFactoryExtensions(factoryDeltas[i].getExtension().getConfigurationElements());
- break;
- }
- }
- final IExtensionDelta containerDeltas[] = event.getExtensionDeltas(ECFNAMESPACE, CONTAINER_NAME);
- for (int i = 0; i < containerDeltas.length; i++) {
- switch (containerDeltas[i].getKind()) {
- case IExtensionDelta.ADDED :
- addContainerExtensions(containerDeltas[i].getExtension().getConfigurationElements());
- break;
- case IExtensionDelta.REMOVED :
- removeContainerExtensions(containerDeltas[i].getExtension().getConfigurationElements());
- break;
- }
- }
- }
- }
-
public IAdapterManager getAdapterManager() {
if (context == null)
return null;
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- if (adapterManager == null)
- getDefault().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Cannot get adapter manager", null)); //$NON-NLS-1$
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
} \ No newline at end of file

Back to the top