killbill-memoizeit

Details

diff --git a/osgi-bundles/bundles/jruby/pom.xml b/osgi-bundles/bundles/jruby/pom.xml
index 42e737e..6bf8429 100644
--- a/osgi-bundles/bundles/jruby/pom.xml
+++ b/osgi-bundles/bundles/jruby/pom.xml
@@ -79,7 +79,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Bundle-Activator>com.ning.billing.osgi.bundles.jruby.Activator</Bundle-Activator>
+                        <Bundle-Activator>com.ning.billing.osgi.bundles.jruby.JRubyActivator</Bundle-Activator>
                         <Export-Package></Export-Package>
                         <Private-Package>com.ning.billing.osgi.bundles.jruby.*</Private-Package>
                         <!-- Optional resolution because exported by the Felix system bundle -->
diff --git a/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java
index cb76f64..2e49ec5 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java
@@ -19,16 +19,13 @@ package com.ning.billing.osgi.bundles.jruby;
 import org.jruby.embed.ScriptingContainer;
 import org.jruby.javasupport.JavaEmbedUtils;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 import org.osgi.service.log.LogService;
 
 import com.ning.billing.beatrix.bus.api.ExtBusEvent;
-import com.ning.billing.beatrix.bus.api.ExternalBus;
 import com.ning.billing.osgi.api.config.PluginRubyConfig;
+import com.ning.killbill.osgi.libs.killbill.OSGIKillbillEventDispatcher.OSGIKillbillEventHandler;
 
-import com.google.common.eventbus.Subscribe;
-
-public class JRubyNotificationPlugin extends JRubyPlugin {
+public class JRubyNotificationPlugin extends JRubyPlugin implements OSGIKillbillEventHandler {
 
     public JRubyNotificationPlugin(final PluginRubyConfig config, final ScriptingContainer container,
                                    final BundleContext bundleContext, final LogService logger) {
@@ -38,26 +35,12 @@ public class JRubyNotificationPlugin extends JRubyPlugin {
     @Override
     public void startPlugin(final BundleContext context) {
         super.startPlugin(context);
-
-        @SuppressWarnings("unchecked")
-        final ServiceReference<ExternalBus> externalBusReference = (ServiceReference<ExternalBus>) context.getServiceReference(ExternalBus.class.getName());
-        try {
-            final ExternalBus externalBus = context.getService(externalBusReference);
-            externalBus.register(this);
-        } catch (Exception e) {
-            logger.log(LogService.LOG_WARNING, "Error registering notification plugin service", e);
-        } finally {
-            if (externalBusReference != null) {
-                context.ungetService(externalBusReference);
-            }
-        }
     }
 
-    @Subscribe
-    public void onEvent(final ExtBusEvent event) {
+    @Override
+    public void handleKillbillEvent(final ExtBusEvent killbillEvent) {
         checkValidNotificationPlugin();
         checkPluginIsRunning();
-
-        pluginInstance.callMethod("on_event", JavaEmbedUtils.javaToRuby(getRuntime(), event));
+        pluginInstance.callMethod("on_event", JavaEmbedUtils.javaToRuby(getRuntime(), killbillEvent));
     }
 }
diff --git a/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
index 5b7f1c7..6e88dcb 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/com/ning/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
@@ -55,14 +55,12 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi 
 
         final Dictionary<String, Object> props = new Hashtable<String, Object>();
         props.put("name", pluginMainClass);
-
         paymentInfoPluginRegistration = (ServiceRegistration<PaymentPluginApi>) context.registerService(PaymentPluginApi.class.getName(), this, props);
     }
 
     @Override
     public void stopPlugin(final BundleContext context) {
         paymentInfoPluginRegistration.unregister();
-
         super.stopPlugin(context);
     }