Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrooks2009-03-04 16:08:50 +0000
committerrbrooks2009-03-04 16:08:50 +0000
commit9f8cfd32ccd989b216718e5b9e70dd0a44259a10 (patch)
tree77a93cf2a0573c0ec97608c157ce9116617d3458
parentf77e167d793b744917baa09953a30eb2231b752e (diff)
downloadorg.eclipse.osee-9f8cfd32ccd989b216718e5b9e70dd0a44259a10.tar.gz
org.eclipse.osee-9f8cfd32ccd989b216718e5b9e70dd0a44259a10.tar.xz
org.eclipse.osee-9f8cfd32ccd989b216718e5b9e70dd0a44259a10.zip
-rw-r--r--org.eclipse.osee.ote.connection.service.test/.classpath7
-rw-r--r--org.eclipse.osee.ote.connection.service.test/.project28
-rw-r--r--org.eclipse.osee.ote.connection.service.test/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.osee.ote.connection.service.test/META-INF/MANIFEST.MF15
-rw-r--r--org.eclipse.osee.ote.connection.service.test/build.properties4
-rw-r--r--org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/Activator.java103
-rw-r--r--org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/TestJiniService.java24
7 files changed, 185 insertions, 0 deletions
diff --git a/org.eclipse.osee.ote.connection.service.test/.classpath b/org.eclipse.osee.ote.connection.service.test/.classpath
new file mode 100644
index 00000000000..02159672985
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.osee.ote.connection.service.test/.project b/org.eclipse.osee.ote.connection.service.test/.project
new file mode 100644
index 00000000000..c0ee3b315bd
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.ote.connection.service.test</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/org.eclipse.osee.ote.connection.service.test/.settings/org.eclipse.pde.core.prefs b/org.eclipse.osee.ote.connection.service.test/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000000..cc5fb64c419
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Wed May 07 16:07:05 MST 2008
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.osee.ote.connection.service.test/META-INF/MANIFEST.MF b/org.eclipse.osee.ote.connection.service.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..b6ee4f97451
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.eclipse.osee.ote.connection.service.test;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.osee.ote.connection.service.test.Activator
+Bundle-Vendor: Eclipse.org
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.osee.connection.service,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.3"
+Require-Bundle: net.jini,
+ org.eclipse.osee.ote.connection.jini,
+ org.eclipse.osee.framework.jdk.core;bundle-version="0.4.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.eclipse.osee.ote.connection.service.test/build.properties b/org.eclipse.osee.ote.connection.service.test/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/Activator.java b/org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/Activator.java
new file mode 100644
index 00000000000..9f2891a0f34
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/Activator.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.connection.service.test;
+
+import java.rmi.Remote;
+import java.util.Collection;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.osee.connection.service.IConnectionService;
+import org.eclipse.osee.connection.service.IConnectorListener;
+import org.eclipse.osee.connection.service.IServiceConnector;
+import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties;
+import org.eclipse.osee.ote.connection.jini.JiniServiceSideConnector;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator {
+ private ServiceTracker connectionServiceTracker;
+ private static Activator instance = null;
+ private JiniServiceSideConnector testConnector;
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ instance = this;
+ connectionServiceTracker = new ServiceTracker(context, IConnectionService.class.getName(), null);
+ connectionServiceTracker.open();
+ final IConnectionService service = getConnectionService();
+// Entry[] entries = new Entry[] {new ServiceInfo("Dummy Test Service", "boeing", "ken", "1.0.0", "test model", "")};
+ EnhancedProperties properties = new EnhancedProperties();
+ properties.setProperty("name", "Dummy Test Service");
+ testConnector = new JiniServiceSideConnector(new TestJiniService(), properties);
+ service.addConnector(testConnector);
+
+ service.addListener(new IConnectorListener() {
+
+ @Override
+ public void onConnectionServiceStopped() {
+ }
+
+ @Override
+ public void onConnectorsAdded(Collection<IServiceConnector> connectors) {
+ for (IServiceConnector connector : connectors) {
+ if (connector.getService() instanceof Remote) {
+ System.out.printf("found remote service %s. connector type=%s\n", connector.getProperty("name",
+ "N.A."), connector.getConnectorType());
+ } else {
+ System.out.println("found a non-remote service!?. connector type=" + connector.getConnectorType());
+ }
+ }
+ }
+
+ @Override
+ public void onConnectorRemoved(IServiceConnector connector) {
+ }
+
+ });
+
+ final Timer timer = new Timer();
+ timer.schedule(new TimerTask() {
+
+ @Override
+ public void run() {
+ System.out.println("connectors:");
+ for (IServiceConnector connector : service.getAllConnectors()) {
+ System.out.printf("\ttype=%s\n", connector.getConnectorType());
+ }
+ timer.cancel();
+ }
+
+ }, 10000);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ instance = null;
+ getConnectionService().removeConnector(testConnector);
+ connectionServiceTracker.close();
+ }
+
+ public Activator getDefault() {
+ return instance;
+ }
+
+ public IConnectionService getConnectionService() {
+ return (IConnectionService) connectionServiceTracker.getService();
+ }
+}
diff --git a/org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/TestJiniService.java b/org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/TestJiniService.java
new file mode 100644
index 00000000000..770daacfa3e
--- /dev/null
+++ b/org.eclipse.osee.ote.connection.service.test/src/org/eclipse/osee/ote/connection/service/test/TestJiniService.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.connection.service.test;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * @author b1529404
+ */
+public class TestJiniService implements Remote {
+
+ public void doSomething() throws RemoteException {
+ System.out.println("doing something...");
+ }
+}

Back to the top