Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-03-27 17:05:04 +0000
committerslewis2014-03-27 17:05:04 +0000
commitbf983108bb7c6d5a5cc04b6e191d5e4eeea32bed (patch)
treec8156394b7b7a7c18c4799ac14543765dc107f73
parent17d2e4d2aa9e137414c9ea459dfb20d5c6158cd8 (diff)
downloadorg.eclipse.ecf-bf983108bb7c6d5a5cc04b6e191d5e4eeea32bed.tar.gz
org.eclipse.ecf-bf983108bb7c6d5a5cc04b6e191d5e4eeea32bed.tar.xz
org.eclipse.ecf-bf983108bb7c6d5a5cc04b6e191d5e4eeea32bed.zip
Added use of ContainerTypeDescription for registering container
-rwxr-xr-xexamples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/Activator.java15
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/container/TrivialContainerInstantiator.java2
-rw-r--r--framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF2
-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/internal/core/ECFPlugin.java47
5 files changed, 46 insertions, 27 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/Activator.java b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/Activator.java
index e392e6d64..04fdb6761 100755
--- a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/Activator.java
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/Activator.java
@@ -1,9 +1,12 @@
package org.eclipse.ecf.internal.examples.provider.trivial;
import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.provider.IContainerInstantiator;
import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
import org.eclipse.ecf.examples.provider.trivial.identity.TrivialNamespace;
+import org.eclipse.ecf.internal.examples.provider.trivial.container.TrivialContainerInstantiator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -35,7 +38,17 @@ public class Activator implements BundleActivator {
plugin = this;
SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
protected void runWithoutRegistry() throws Exception {
- Activator.this.context.registerService(Namespace.class, new TrivialNamespace("ecf.namespace.trivial"), null);
+ // If we don't have a registry, then register trivial namespace
+ Activator.this.context.registerService(Namespace.class,
+ new TrivialNamespace(TrivialNamespace.NAME), null);
+ // And create and register ContainerTypeDescription
+ Activator.this.context
+ .registerService(
+ ContainerTypeDescription.class,
+ new ContainerTypeDescription(
+ TrivialContainerInstantiator.NAME,
+ (IContainerInstantiator) new TrivialContainerInstantiator()),
+ null);
}
});
}
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/container/TrivialContainerInstantiator.java b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/container/TrivialContainerInstantiator.java
index c67829469..489adae6e 100644
--- a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/container/TrivialContainerInstantiator.java
+++ b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/internal/examples/provider/trivial/container/TrivialContainerInstantiator.java
@@ -21,6 +21,8 @@ import org.eclipse.ecf.core.provider.BaseContainerInstantiator;
public class TrivialContainerInstantiator extends BaseContainerInstantiator {
+ public static final String NAME = "ecf.container.trivial";
+
/* (non-Javadoc)
* @see org.eclipse.ecf.core.provider.BaseContainerInstantiator#createInstance(org.eclipse.ecf.core.ContainerTypeDescription, java.lang.Object[])
*/
diff --git a/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf/META-INF/MANIFEST.MF
index aae063726..c3a6984e5 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.3.0.qualifier
+Bundle-Version: 3.4.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.core.ECFPlugin
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
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/internal/core/ECFPlugin.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
index 523051c46..54bf6c93b 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
@@ -117,6 +117,28 @@ public class ECFPlugin implements BundleActivator {
log(new Status(IStatus.ERROR, getDefault().getBundle().getSymbolicName(), "Unexpected Error in ECFPlugin.start", t)); //$NON-NLS-1$
}
+ // 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) {
@@ -210,31 +232,6 @@ public class ECFPlugin implements BundleActivator {
private ServiceTracker containerTypeDescriptionTracker;
public void initializeExtensions() {
- // 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) {
- IContainerFactory cf = ContainerFactory.getDefault();
- cf.addDescription(ctd);
- return ctd;
- }
- return null;
- }
-
- 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) {

Back to the top