diff options
author | tkubaska | 2008-11-09 00:00:58 +0000 |
---|---|---|
committer | tkubaska | 2008-11-09 00:00:58 +0000 |
commit | 67f9c4e4f757ac133a15a854263f39db18ec38e0 (patch) | |
tree | a584a5981ab1682992f5131e7b3a0e50b2dbbf5d /examples | |
parent | b43436c89ec0304f996463d9216d3d8bddd1edf7 (diff) | |
download | org.eclipse.ecf-67f9c4e4f757ac133a15a854263f39db18ec38e0.tar.gz org.eclipse.ecf-67f9c4e4f757ac133a15a854263f39db18ec38e0.tar.xz org.eclipse.ecf-67f9c4e4f757ac133a15a854263f39db18ec38e0.zip |
Added TrivialApplication as IApplication for ease of testing/running
Diffstat (limited to 'examples')
2 files changed, 63 insertions, 0 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/plugin.xml b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/plugin.xml index 3bc68af0e..a5f039785 100755 --- a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/plugin.xml +++ b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/plugin.xml @@ -19,5 +19,17 @@ server="false"> </containerFactory> </extension> + <extension + id="Trivial" + point="org.eclipse.core.runtime.applications"> + <application + cardinality="singleton-global" + thread="main" + visible="true"> + <run + class="org.eclipse.ecf.examples.provider.trivial.TrivialApplication"> + </run> + </application> + </extension> </plugin> diff --git a/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/examples/provider/trivial/TrivialApplication.java b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/examples/provider/trivial/TrivialApplication.java new file mode 100644 index 000000000..aa8d9ba91 --- /dev/null +++ b/examples/bundles/org.eclipse.ecf.examples.provider.trivial/src/org/eclipse/ecf/examples/provider/trivial/TrivialApplication.java @@ -0,0 +1,51 @@ +package org.eclipse.ecf.examples.provider.trivial; + +import org.eclipse.ecf.core.ContainerFactory; +import org.eclipse.ecf.core.IContainer; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.identity.IDFactory; +import org.eclipse.ecf.core.util.ECFException; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; + +public class TrivialApplication implements IApplication { + + private boolean done = false; + + public Object start(IApplicationContext context) throws Exception { + try { + // Create instance of trivial container + IContainer container = ContainerFactory.getDefault() + .createContainer("ecf.container.trivial"); + + // Get appropriate container adapter...e.g. IChannelContainerAdapter + // IChannelContainerAdapter containerAdapter = + // (IChannelContainerAdapter) + // container.getAdapter(IChannelContainerAdapter.class); + + // Connect + ID targetID = IDFactory.getDefault().createID( + container.getConnectNamespace(), "myid"); + container.connect(targetID, null); + + synchronized (this) { + while (!done) { + wait(); + } + } + + } catch (ECFException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + public void stop() { + synchronized (this) { + done = true; + notify(); + } + } + +} |