killbill-uncached
Changes
osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyCurrencyPlugin.java 32(+16 -16)
osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java 11(+6 -5)
Details
diff --git a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyCurrencyPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyCurrencyPlugin.java
index c6d5291..50f2b3b 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyCurrencyPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyCurrencyPlugin.java
@@ -1,7 +1,9 @@
/*
* Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014 Groupon, Inc
+ * Copyright 2014 The Billing Project, LLC
*
- * Ning licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -23,16 +25,15 @@ import java.util.SortedSet;
import org.joda.time.DateTime;
import org.jruby.Ruby;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.log.LogService;
-
import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.currency.api.Rate;
import org.killbill.billing.currency.plugin.api.CurrencyPluginApi;
import org.killbill.billing.osgi.api.OSGIPluginProperties;
import org.killbill.billing.osgi.api.config.PluginRubyConfig;
import org.killbill.billing.payment.plugin.api.PaymentPluginApiException;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.log.LogService;
public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginApi {
@@ -43,7 +44,6 @@ public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginAp
}
@Override
- @SuppressWarnings("unchecked")
public void startPlugin(final BundleContext context) {
super.startPlugin(context);
@@ -64,13 +64,13 @@ public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginAp
@Override
public Set<Currency> getBaseCurrencies() {
try {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.CURRENCY) {
+ return callWithRuntimeAndChecking(new PluginCallback<Set<Currency>>(VALIDATION_PLUGIN_TYPE.CURRENCY) {
@Override
public Set<Currency> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((CurrencyPluginApi) pluginInstance).getBaseCurrencies();
}
});
- } catch (PaymentPluginApiException e) {
+ } catch (final PaymentPluginApiException e) {
throw new RuntimeException(e);
}
}
@@ -78,13 +78,13 @@ public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginAp
@Override
public DateTime getLatestConversionDate(final Currency currency) {
try {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.CURRENCY) {
+ return callWithRuntimeAndChecking(new PluginCallback<DateTime>(VALIDATION_PLUGIN_TYPE.CURRENCY) {
@Override
public DateTime doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((CurrencyPluginApi) pluginInstance).getLatestConversionDate(currency);
}
});
- } catch (PaymentPluginApiException e) {
+ } catch (final PaymentPluginApiException e) {
throw new RuntimeException(e);
}
}
@@ -92,13 +92,13 @@ public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginAp
@Override
public SortedSet<DateTime> getConversionDates(final Currency currency) {
try {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.CURRENCY) {
+ return callWithRuntimeAndChecking(new PluginCallback<SortedSet<DateTime>>(VALIDATION_PLUGIN_TYPE.CURRENCY) {
@Override
public SortedSet<DateTime> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((CurrencyPluginApi) pluginInstance).getConversionDates(currency);
}
});
- } catch (PaymentPluginApiException e) {
+ } catch (final PaymentPluginApiException e) {
throw new RuntimeException(e);
}
}
@@ -106,13 +106,13 @@ public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginAp
@Override
public Set<Rate> getCurrentRates(final Currency currency) {
try {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.CURRENCY) {
+ return callWithRuntimeAndChecking(new PluginCallback<Set<Rate>>(VALIDATION_PLUGIN_TYPE.CURRENCY) {
@Override
public Set<Rate> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((CurrencyPluginApi) pluginInstance).getCurrentRates(currency);
}
});
- } catch (PaymentPluginApiException e) {
+ } catch (final PaymentPluginApiException e) {
throw new RuntimeException(e);
}
}
@@ -120,13 +120,13 @@ public class JRubyCurrencyPlugin extends JRubyPlugin implements CurrencyPluginAp
@Override
public Set<Rate> getRates(final Currency currency, final DateTime time) {
try {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.CURRENCY) {
+ return callWithRuntimeAndChecking(new PluginCallback<Set<Rate>>(VALIDATION_PLUGIN_TYPE.CURRENCY) {
@Override
public Set<Rate> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((CurrencyPluginApi) pluginInstance).getRates(currency, time);
}
});
- } catch (PaymentPluginApiException e) {
+ } catch (final PaymentPluginApiException e) {
throw new RuntimeException(e);
}
}
diff --git a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java
index 717e057..dad28e8 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyNotificationPlugin.java
@@ -1,7 +1,9 @@
/*
* Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014 Groupon, Inc
+ * Copyright 2014 The Billing Project, LLC
*
- * Ning licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -17,14 +19,13 @@
package org.killbill.billing.osgi.bundles.jruby;
import org.jruby.Ruby;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
-
import org.killbill.billing.notification.plugin.api.ExtBusEvent;
import org.killbill.billing.notification.plugin.api.NotificationPluginApi;
import org.killbill.billing.osgi.api.config.PluginRubyConfig;
import org.killbill.billing.payment.plugin.api.PaymentPluginApiException;
import org.killbill.killbill.osgi.libs.killbill.OSGIKillbillEventDispatcher.OSGIKillbillEventHandler;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
public class JRubyNotificationPlugin extends JRubyPlugin implements OSGIKillbillEventHandler {
@@ -42,7 +43,7 @@ public class JRubyNotificationPlugin extends JRubyPlugin implements OSGIKillbill
return null;
}
});
- } catch (PaymentPluginApiException e) {
+ } catch (final PaymentPluginApiException e) {
throw new IllegalStateException("Unexpected PaymentApiException for notification plugin", e);
}
}
diff --git a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
index daaaba9..1d4fd34 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPaymentPlugin.java
@@ -54,7 +54,6 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
}
@Override
- @SuppressWarnings("unchecked")
public void startPlugin(final BundleContext context) {
super.startPlugin(context);
@@ -72,21 +71,29 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
super.stopPlugin(context);
}
- // STEPH_DP
@Override
- public PaymentInfoPlugin authorizePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final BigDecimal bigDecimal, final Currency currency, final Iterable<PluginProperty> properties, final CallContext callContext) throws PaymentPluginApiException {
- return null;
+ public PaymentInfoPlugin authorizePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
+ return callWithRuntimeAndChecking(new PluginCallback<PaymentInfoPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ @Override
+ public PaymentInfoPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
+ return ((PaymentPluginApi) pluginInstance).authorizePayment(kbAccountId, kbPaymentId, kbPaymentMethodId, amount, currency, properties, context);
+ }
+ });
}
@Override
- public PaymentInfoPlugin capturePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final BigDecimal bigDecimal, final Currency currency, final Iterable<PluginProperty> properties, final CallContext callContext) throws PaymentPluginApiException {
- return null;
+ public PaymentInfoPlugin capturePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
+ return callWithRuntimeAndChecking(new PluginCallback<PaymentInfoPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ @Override
+ public PaymentInfoPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
+ return ((PaymentPluginApi) pluginInstance).capturePayment(kbAccountId, kbPaymentId, kbPaymentMethodId, amount, currency, properties, context);
+ }
+ });
}
@Override
public PaymentInfoPlugin processPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
-
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<PaymentInfoPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public PaymentInfoPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).processPayment(kbAccountId, kbPaymentId, kbPaymentMethodId, amount, currency, properties, context);
@@ -95,14 +102,18 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
}
@Override
- public PaymentInfoPlugin voidPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext callContext) throws PaymentPluginApiException {
- return null;
+ public PaymentInfoPlugin voidPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
+ return callWithRuntimeAndChecking(new PluginCallback<PaymentInfoPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ @Override
+ public PaymentInfoPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
+ return ((PaymentPluginApi) pluginInstance).voidPayment(kbAccountId, kbPaymentId, kbPaymentMethodId, properties, context);
+ }
+ });
}
@Override
public PaymentInfoPlugin getPaymentInfo(final UUID kbAccountId, final UUID kbPaymentId, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
-
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<PaymentInfoPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public PaymentInfoPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).getPaymentInfo(kbAccountId, kbPaymentId, properties, context);
@@ -112,7 +123,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public Pagination<PaymentInfoPlugin> searchPayments(final String searchKey, final Long offset, final Long limit, final Iterable<PluginProperty> properties, final TenantContext tenantContext) throws PaymentPluginApiException {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<Pagination<PaymentInfoPlugin>>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Pagination<PaymentInfoPlugin> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).searchPayments(searchKey, offset, limit, properties, tenantContext);
@@ -122,8 +133,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public RefundInfoPlugin processRefund(final UUID kbAccountId, final UUID kbPaymentId, final BigDecimal refundAmount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
-
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<RefundInfoPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public RefundInfoPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).processRefund(kbAccountId, kbPaymentId, refundAmount, currency, properties, context);
@@ -134,7 +144,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public List<RefundInfoPlugin> getRefundInfo(final UUID kbAccountId, final UUID kbPaymentId, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<List<RefundInfoPlugin>>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public List<RefundInfoPlugin> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).getRefundInfo(kbAccountId, kbPaymentId, properties, context);
@@ -144,7 +154,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public Pagination<RefundInfoPlugin> searchRefunds(final String searchKey, final Long offset, final Long limit, final Iterable<PluginProperty> properties, final TenantContext tenantContext) throws PaymentPluginApiException {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<Pagination<RefundInfoPlugin>>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Pagination<RefundInfoPlugin> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).searchRefunds(searchKey, offset, limit, properties, tenantContext);
@@ -154,7 +164,6 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public void addPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final PaymentMethodPlugin paymentMethodProps, final boolean setDefault, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
-
callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Void doCall(final Ruby runtime) throws PaymentPluginApiException {
@@ -166,7 +175,6 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public void deletePaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
-
callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Void doCall(final Ruby runtime) throws PaymentPluginApiException {
@@ -178,8 +186,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public PaymentMethodPlugin getPaymentMethodDetail(final UUID kbAccountId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
-
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<PaymentMethodPlugin>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public PaymentMethodPlugin doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).getPaymentMethodDetail(kbAccountId, kbPaymentMethodId, properties, context);
@@ -189,7 +196,6 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public void setDefaultPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
-
callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Void doCall(final Ruby runtime) throws PaymentPluginApiException {
@@ -201,7 +207,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public List<PaymentMethodInfoPlugin> getPaymentMethods(final UUID kbAccountId, final boolean refreshFromGateway, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<List<PaymentMethodInfoPlugin>>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public List<PaymentMethodInfoPlugin> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).getPaymentMethods(kbAccountId, Boolean.valueOf(refreshFromGateway), properties, context);
@@ -211,7 +217,7 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public Pagination<PaymentMethodPlugin> searchPaymentMethods(final String searchKey, final Long offset, final Long limit, final Iterable<PluginProperty> properties, final TenantContext tenantContext) throws PaymentPluginApiException {
- return callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ return callWithRuntimeAndChecking(new PluginCallback<Pagination<PaymentMethodPlugin>>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Pagination<PaymentMethodPlugin> doCall(final Ruby runtime) throws PaymentPluginApiException {
return ((PaymentPluginApi) pluginInstance).searchPaymentMethods(searchKey, offset, limit, properties, tenantContext);
@@ -221,7 +227,6 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
@Override
public void resetPaymentMethods(final UUID kbAccountId, final List<PaymentMethodInfoPlugin> paymentMethods, final Iterable<PluginProperty> properties) throws PaymentPluginApiException {
-
callWithRuntimeAndChecking(new PluginCallback(VALIDATION_PLUGIN_TYPE.PAYMENT) {
@Override
public Void doCall(final Ruby runtime) throws PaymentPluginApiException {
@@ -232,12 +237,22 @@ public class JRubyPaymentPlugin extends JRubyPlugin implements PaymentPluginApi
}
@Override
- public HostedPaymentPageFormDescriptor buildFormDescriptor(final UUID kbAccountId, final HostedPaymentPageDescriptorFields hostedPaymentPageDescriptorFields, final Iterable<PluginProperty> properties, final TenantContext tenantContext) {
- return null;
+ public HostedPaymentPageFormDescriptor buildFormDescriptor(final UUID kbAccountId, final HostedPaymentPageDescriptorFields hostedPaymentPageDescriptorFields, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
+ return callWithRuntimeAndChecking(new PluginCallback<HostedPaymentPageFormDescriptor>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ @Override
+ public HostedPaymentPageFormDescriptor doCall(final Ruby runtime) throws PaymentPluginApiException {
+ return ((PaymentPluginApi) pluginInstance).buildFormDescriptor(kbAccountId, hostedPaymentPageDescriptorFields, properties, context);
+ }
+ });
}
@Override
- public HostedPaymentPageNotification processNotification(final String notification, final Iterable<PluginProperty> properties, final TenantContext tenantContext) throws PaymentPluginApiException {
- return null;
+ public HostedPaymentPageNotification processNotification(final String notification, final Iterable<PluginProperty> properties, final TenantContext context) throws PaymentPluginApiException {
+ return callWithRuntimeAndChecking(new PluginCallback<HostedPaymentPageNotification>(VALIDATION_PLUGIN_TYPE.PAYMENT) {
+ @Override
+ public HostedPaymentPageNotification doCall(final Ruby runtime) throws PaymentPluginApiException {
+ return ((PaymentPluginApi) pluginInstance).processNotification(notification, properties, context);
+ }
+ });
}
}
diff --git a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPlugin.java b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPlugin.java
index 06684d6..1593054 100644
--- a/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPlugin.java
+++ b/osgi-bundles/bundles/jruby/src/main/java/org/killbill/billing/osgi/bundles/jruby/JRubyPlugin.java
@@ -1,7 +1,9 @@
/*
* Copyright 2010-2013 Ning, Inc.
+ * Copyright 2014 Groupon, Inc
+ * Copyright 2014 The Billing Project, LLC
*
- * Ning licenses this file to you under the Apache License, version 2.0
+ * The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
@@ -29,15 +31,14 @@ import org.jruby.embed.LocalContextScope;
import org.jruby.embed.LocalVariableBehavior;
import org.jruby.embed.ScriptingContainer;
import org.jruby.runtime.builtin.IRubyObject;
+import org.killbill.billing.osgi.api.config.PluginRubyConfig;
+import org.killbill.billing.payment.plugin.api.PaymentPluginApiException;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.killbill.billing.osgi.api.config.PluginRubyConfig;
-import org.killbill.billing.payment.plugin.api.PaymentPluginApiException;
-
// Bridge between the OSGI bundle and the ruby plugin
public abstract class JRubyPlugin {
@@ -151,7 +152,7 @@ public abstract class JRubyPlugin {
private void checkValidPlugin() {
try {
container.runScriptlet(checkInstanceOfPlugin(KILLBILL_PLUGIN_BASE));
- } catch (EvalFailedException e) {
+ } catch (final EvalFailedException e) {
throw new IllegalArgumentException(e);
}
}
@@ -159,7 +160,7 @@ public abstract class JRubyPlugin {
private void checkValidNotificationPlugin() throws IllegalArgumentException {
try {
container.runScriptlet(checkInstanceOfPlugin(KILLBILL_PLUGIN_NOTIFICATION));
- } catch (EvalFailedException e) {
+ } catch (final EvalFailedException e) {
throw new IllegalArgumentException(e);
}
}
@@ -167,7 +168,7 @@ public abstract class JRubyPlugin {
private void checkValidPaymentPlugin() throws IllegalArgumentException {
try {
container.runScriptlet(checkInstanceOfPlugin(KILLBILL_PLUGIN_PAYMENT));
- } catch (EvalFailedException e) {
+ } catch (final EvalFailedException e) {
throw new IllegalArgumentException(e);
}
}
@@ -175,7 +176,7 @@ public abstract class JRubyPlugin {
private void checkValidCurrencyPlugin() throws IllegalArgumentException {
try {
container.runScriptlet(checkInstanceOfPlugin(KILLBILL_PLUGIN_CURRENCY));
- } catch (EvalFailedException e) {
+ } catch (final EvalFailedException e) {
throw new IllegalArgumentException(e);
}
}
@@ -252,7 +253,7 @@ public abstract class JRubyPlugin {
NONE
}
- protected abstract class PluginCallback {
+ protected abstract class PluginCallback<T> {
private final VALIDATION_PLUGIN_TYPE pluginType;
@@ -260,14 +261,14 @@ public abstract class JRubyPlugin {
this.pluginType = pluginType;
}
- public abstract <T> T doCall(final Ruby runtime) throws PaymentPluginApiException;
+ public abstract T doCall(final Ruby runtime) throws PaymentPluginApiException;
public VALIDATION_PLUGIN_TYPE getPluginType() {
return pluginType;
}
}
- protected <T> T callWithRuntimeAndChecking(final PluginCallback cb) throws PaymentPluginApiException {
+ protected <T> T callWithRuntimeAndChecking(final PluginCallback<T> cb) throws PaymentPluginApiException {
synchronized (pluginMonitor) {
try {
checkPluginIsRunning();
@@ -288,7 +289,7 @@ public abstract class JRubyPlugin {
final Ruby runtime = getRuntime();
return cb.doCall(runtime);
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
log.warn("RuntimeException in jruby plugin ", e);
throw e;
}