moving in some osgi bundles so as not to lose track of them.
authorChris Koeritz <fred@gruntose.com>
Wed, 27 Feb 2013 15:55:02 +0000 (10:55 -0500)
committerChris Koeritz <fred@gruntose.com>
Wed, 27 Feb 2013 15:55:02 +0000 (10:55 -0500)
the example just provides a service bundle with some functionality, and a hello world
example of using that bundle.  it depends on eclipse to know about the services project
currently, but could be made separate at some point with an ant build script, but then again,
this is just a nice example.

17 files changed:
osgi/org.feistymeow.bundle.helloOSGi/.classpath [new file with mode: 0644]
osgi/org.feistymeow.bundle.helloOSGi/.project [new file with mode: 0644]
osgi/org.feistymeow.bundle.helloOSGi/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
osgi/org.feistymeow.bundle.helloOSGi/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
osgi/org.feistymeow.bundle.helloOSGi/META-INF/MANIFEST.MF [new file with mode: 0644]
osgi/org.feistymeow.bundle.helloOSGi/build.properties [new file with mode: 0644]
osgi/org.feistymeow.bundle.helloOSGi/src/org/feistymeow/bundle/helloosgi/Activator.java [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/.classpath [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/.project [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/META-INF/MANIFEST.MF [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/build.properties [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloService.java [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloServiceActivator.java [new file with mode: 0644]
osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloServiceImpl.java [new file with mode: 0644]
readme.txt

diff --git a/osgi/org.feistymeow.bundle.helloOSGi/.classpath b/osgi/org.feistymeow.bundle.helloOSGi/.classpath
new file mode 100644 (file)
index 0000000..098194c
--- /dev/null
@@ -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.7"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/osgi/org.feistymeow.bundle.helloOSGi/.project b/osgi/org.feistymeow.bundle.helloOSGi/.project
new file mode 100644 (file)
index 0000000..af56a19
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.feistymeow.bundle.helloOSGi</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>
+               <buildCommand>
+                       <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+       </natures>
+</projectDescription>
diff --git a/osgi/org.feistymeow.bundle.helloOSGi/.settings/org.eclipse.jdt.core.prefs b/osgi/org.feistymeow.bundle.helloOSGi/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..f42de36
--- /dev/null
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/osgi/org.feistymeow.bundle.helloOSGi/.settings/org.eclipse.pde.core.prefs b/osgi/org.feistymeow.bundle.helloOSGi/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..e8ff8be
--- /dev/null
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/osgi/org.feistymeow.bundle.helloOSGi/META-INF/MANIFEST.MF b/osgi/org.feistymeow.bundle.helloOSGi/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..0f036d6
--- /dev/null
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: HelloOSGi
+Bundle-SymbolicName: org.feistymeow.bundle.helloOSGi
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.feistymeow.bundle.helloosgi.Activator
+Bundle-Vendor: feistymeow.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Import-Package: org.feistymeow.bundle.serviceosgi,
+ org.osgi.framework;version="1.3.0"
diff --git a/osgi/org.feistymeow.bundle.helloOSGi/build.properties b/osgi/org.feistymeow.bundle.helloOSGi/build.properties
new file mode 100644 (file)
index 0000000..34d2e4d
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/osgi/org.feistymeow.bundle.helloOSGi/src/org/feistymeow/bundle/helloosgi/Activator.java b/osgi/org.feistymeow.bundle.helloOSGi/src/org/feistymeow/bundle/helloosgi/Activator.java
new file mode 100644 (file)
index 0000000..faa68fb
--- /dev/null
@@ -0,0 +1,35 @@
+package org.feistymeow.bundle.helloosgi;
+
+import org.feistymeow.bundle.serviceosgi.HelloService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+@SuppressWarnings("rawtypes")
+public class Activator implements BundleActivator {
+
+       ServiceReference helloServiceReference;
+    
+       /*
+        * (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+        */
+       public void start(BundleContext context) throws Exception {
+               
+               System.out.println("into Hello OSGi!");
+               
+               helloServiceReference = context.getServiceReference(HelloService.class.getName());
+        @SuppressWarnings("unchecked")
+               HelloService helloService = (HelloService)context.getService(helloServiceReference);
+        System.out.println(helloService.sayHello());
+       }
+       
+       /*
+        * (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+        */
+       public void stop(BundleContext context) throws Exception {
+               System.out.println("out of Hello OSGi!");
+       }
+
+}
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/.classpath b/osgi/org.feistymeow.bundle.servicesOSGi/.classpath
new file mode 100644 (file)
index 0000000..098194c
--- /dev/null
@@ -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.7"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/.project b/osgi/org.feistymeow.bundle.servicesOSGi/.project
new file mode 100644 (file)
index 0000000..a831b04
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.feistymeow.bundle.servicesOSGi</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>
+               <buildCommand>
+                       <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+       </natures>
+</projectDescription>
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/.settings/org.eclipse.jdt.core.prefs b/osgi/org.feistymeow.bundle.servicesOSGi/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..f42de36
--- /dev/null
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/.settings/org.eclipse.pde.core.prefs b/osgi/org.feistymeow.bundle.servicesOSGi/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..e8ff8be
--- /dev/null
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/META-INF/MANIFEST.MF b/osgi/org.feistymeow.bundle.servicesOSGi/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..47c2058
--- /dev/null
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: HelloService Plugin
+Bundle-SymbolicName: org.feistymeow.bundle.servicesosgi
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.feistymeow.bundle.serviceosgi.HelloServiceActivator
+Bundle-Vendor: feistymeow.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Import-Package: org.osgi.framework;version="1.3.0"
+Export-Package: org.feistymeow.bundle.serviceosgi;uses:="org.osgi.framework"
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/build.properties b/osgi/org.feistymeow.bundle.servicesOSGi/build.properties
new file mode 100644 (file)
index 0000000..34d2e4d
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloService.java b/osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloService.java
new file mode 100644 (file)
index 0000000..c93c8cc
--- /dev/null
@@ -0,0 +1,6 @@
+package org.feistymeow.bundle.serviceosgi;
+
+public interface HelloService
+{
+       public String sayHello();
+}
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloServiceActivator.java b/osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloServiceActivator.java
new file mode 100644 (file)
index 0000000..6d49301
--- /dev/null
@@ -0,0 +1,37 @@
+package org.feistymeow.bundle.serviceosgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class HelloServiceActivator implements BundleActivator
+{
+
+       @SuppressWarnings("rawtypes")
+       ServiceRegistration helloServiceRegistration;
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+        */
+       public void start(BundleContext context) throws Exception
+       {
+               System.out.println("hello-service start");
+
+               HelloService helloService = new HelloServiceImpl();
+               helloServiceRegistration = context.registerService(HelloService.class.getName(), helloService, null);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+        */
+       public void stop(BundleContext context) throws Exception
+       {
+               helloServiceRegistration.unregister();
+               System.out.println("hello-service stop");
+       }
+
+}
diff --git a/osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloServiceImpl.java b/osgi/org.feistymeow.bundle.servicesOSGi/src/org/feistymeow/bundle/serviceosgi/HelloServiceImpl.java
new file mode 100644 (file)
index 0000000..c007d48
--- /dev/null
@@ -0,0 +1,13 @@
+package org.feistymeow.bundle.serviceosgi;
+
+public class HelloServiceImpl implements HelloService
+{
+
+       @Override
+       public String sayHello()
+       {
+               System.out.println("Inside HelloServiceImpl.sayHello()");
+        return "Say Hello";
+       }
+
+}
index 34a15a492c6fb9ab36134a568bd2fe5f4e14d27f..7c3496390dccb69254d620fb4e968754ee29437b 100644 (file)
@@ -44,6 +44,11 @@ kona/
     Our burgeoning Java libraries.  Not much to see here yet, but there is some code piling
     up for these that we will try to release soon.
 
+osgi/
+    Some example bundles for Java OSGi.  These may eventually fill out with real material,
+    but currently they are just tracking the investigation we did into creating bundles and
+    running using them.
+
 production/
     Machinery for getting releases out the door, including the generated files such as binaries
     and build system tools.