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.
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+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
--- /dev/null
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
--- /dev/null
+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"
--- /dev/null
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null
+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!");
+ }
+
+}
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+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
--- /dev/null
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
--- /dev/null
+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"
--- /dev/null
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
--- /dev/null
+package org.feistymeow.bundle.serviceosgi;
+
+public interface HelloService
+{
+ public String sayHello();
+}
--- /dev/null
+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");
+ }
+
+}
--- /dev/null
+package org.feistymeow.bundle.serviceosgi;
+
+public class HelloServiceImpl implements HelloService
+{
+
+ @Override
+ public String sayHello()
+ {
+ System.out.println("Inside HelloServiceImpl.sayHello()");
+ return "Say Hello";
+ }
+
+}
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.