Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Once the Groovy jar is loaded into the container, writing an OSGi service that uses Groovy is as simple as creating a subclass of class that extends the framework's BundleActivator classinterface.

Code Block
package org.codehaus.groovy.osgi

import org.osgi.framework.BundleActivator
import org.osgi.framework.BundleContext

class Activator implements BundleActivator {

    void start(BundleContext context) {
        println "Groovy BundleActivator started"

    void stop(BundleContext context) {
        println "Groovy BundleActivator stopped"