killbill-aplcache
Changes
payment/src/main/java/com/ning/billing/payment/glue/DefaultPaymentProviderPluginRegistryProvider.java 8(+5 -3)
payment/src/main/java/com/ning/billing/payment/provider/DefaultPaymentProviderPluginRegistry.java 24(+18 -6)
payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPluginProvider.java 9(+6 -3)
Details
diff --git a/api/src/main/java/com/ning/billing/osgi/api/OSGIServiceRegistration.java b/api/src/main/java/com/ning/billing/osgi/api/OSGIServiceRegistration.java
new file mode 100644
index 0000000..83293e0
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/osgi/api/OSGIServiceRegistration.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2010-2013 Ning, Inc.
+ *
+ * Ning 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:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.osgi.api;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ *
+ * The purpose is to register within Killbill OSGI services
+ * that were exported by specific Killbill plugins
+ *
+ * @param <T> The OSGI service exported by Killbill bundles
+ */
+public interface OSGIServiceRegistration<T> {
+
+ /**
+ *
+ * @param pluginName the name of plugin
+ * @param service the instance that should be registered
+ */
+ void registerService(String pluginName, T service);
+
+ /**
+ *
+ * @param pluginName the name of plugin
+ */
+ void unregisterService(String pluginName);
+
+ /**
+ *
+ * @param pluginName the name of plugin
+ * @return the instance that was registered under that name
+ */
+ T getServiceForPluginName(String pluginName);
+
+ /**
+ *
+ * @return the set of all the plugins registered
+ */
+ Set<String> getAllServiceForPluginName();
+
+ /**
+ *
+ * @return the type of service that is registered under that OSGIServiceRegistration
+ */
+ Class<T> getServiceType();
+}
diff --git a/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIKillbill.java b/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIKillbill.java
index 08e2d04..519465f 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIKillbill.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIKillbill.java
@@ -34,7 +34,6 @@ import com.ning.billing.invoice.api.InvoicePaymentApi;
import com.ning.billing.invoice.api.InvoiceUserApi;
import com.ning.billing.osgi.api.OSGIKillbill;
import com.ning.billing.osgi.api.config.PluginConfigServiceApi;
-import com.ning.billing.osgi.api.http.ServletRouter;
import com.ning.billing.osgi.glue.DefaultOSGIModule;
import com.ning.billing.overdue.OverdueUserApi;
import com.ning.billing.payment.api.PaymentApi;
@@ -71,11 +70,9 @@ public class DefaultOSGIKillbill implements OSGIKillbill {
private final PluginConfigServiceApi configServiceApi;
private final DataSource dataSource;
- private final ServletRouter servletRouter;
@Inject
public DefaultOSGIKillbill(@Named(DefaultOSGIModule.OSGI_NAMED) final DataSource dataSource,
- final ServletRouter servletRouter,
final AccountUserApi accountUserApi,
final AnalyticsSanityApi analyticsSanityApi,
final AnalyticsUserApi analyticsUserApi,
@@ -98,7 +95,6 @@ public class DefaultOSGIKillbill implements OSGIKillbill {
final ExternalBus externalBus,
final PluginConfigServiceApi configServiceApi) {
this.dataSource = dataSource;
- this.servletRouter = servletRouter;
this.accountUserApi = accountUserApi;
this.analyticsSanityApi = analyticsSanityApi;
this.analyticsUserApi = analyticsUserApi;
diff --git a/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java b/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java
index d37acd0..ce9cc29 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/DefaultOSGIService.java
@@ -39,7 +39,9 @@ import org.slf4j.osgi.logservice.impl.Activator;
import com.ning.billing.lifecycle.LifecycleHandlerType;
import com.ning.billing.lifecycle.LifecycleHandlerType.LifecycleLevel;
+import com.ning.billing.osgi.api.OSGIPluginProperties;
import com.ning.billing.osgi.api.OSGIService;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.osgi.api.config.PluginConfigServiceApi;
import com.ning.billing.osgi.api.config.PluginJavaConfig;
import com.ning.billing.osgi.api.config.PluginRubyConfig;
@@ -47,7 +49,6 @@ import com.ning.billing.osgi.pluginconf.DefaultPluginConfigServiceApi;
import com.ning.billing.osgi.pluginconf.PluginConfigException;
import com.ning.billing.osgi.pluginconf.PluginFinder;
import com.ning.billing.payment.plugin.api.PaymentPluginApi;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
import com.ning.billing.util.config.OSGIConfig;
import com.google.common.collect.ImmutableList;
@@ -64,7 +65,6 @@ public class DefaultOSGIService implements OSGIService {
private final PluginFinder pluginFinder;
private final PluginConfigServiceApi pluginConfigServiceApi;
private final KillbillActivator killbillActivator;
- private final PaymentProviderPluginRegistry paymentProviderPluginRegistry;
private Framework framework;
private volatile ServiceReference<PaymentPluginApi>[] paymentApiReferences;
@@ -73,13 +73,11 @@ public class DefaultOSGIService implements OSGIService {
@Inject
public DefaultOSGIService(final OSGIConfig osgiConfig, final PluginFinder pluginFinder,
final PluginConfigServiceApi pluginConfigServiceApi,
- final KillbillActivator killbillActivator,
- final PaymentProviderPluginRegistry paymentProviderPluginRegistry) {
+ final KillbillActivator killbillActivator) {
this.osgiConfig = osgiConfig;
this.pluginFinder = pluginFinder;
this.pluginConfigServiceApi = pluginConfigServiceApi;
this.killbillActivator = killbillActivator;
- this.paymentProviderPluginRegistry = paymentProviderPluginRegistry;
this.framework = null;
}
@@ -107,16 +105,10 @@ public class DefaultOSGIService implements OSGIService {
@LifecycleHandlerType(LifecycleHandlerType.LifecycleLevel.REGISTER_EVENTS)
public void registerForExternalEvents() throws Exception {
- // We use that level which comes before START to register the paymentPluginApis -- before Payment system starts
- fetchPaymentPluginApis();
- for (String pluginName : paymentPluginApis.keySet()) {
- paymentProviderPluginRegistry.register(paymentPluginApis.get(pluginName), pluginName);
- }
}
@LifecycleHandlerType(LifecycleHandlerType.LifecycleLevel.UNREGISTER_EVENTS)
public void unregisterForExternalEvents() {
- releasePaymentPluginApis();
}
@LifecycleHandlerType(LifecycleLevel.START_SERVICE)
@@ -202,28 +194,6 @@ public class DefaultOSGIService implements OSGIService {
return felix;
}
- private void fetchPaymentPluginApis() throws InvalidSyntaxException {
-
- final BundleContext context = framework.getBundleContext();
-
- paymentApiReferences = (ServiceReference<PaymentPluginApi>[]) context.getServiceReferences(PaymentPluginApi.class.getName(), null);
- final ImmutableMap.Builder paymentPluginApisBuilder = ImmutableMap.builder();
- for (ServiceReference<PaymentPluginApi> ref : paymentApiReferences) {
- // TODO 'name' STEPH needs to be in API
- paymentPluginApisBuilder.put(ref.getProperty("name"), context.getService(ref));
- }
- paymentPluginApis = paymentPluginApisBuilder.build();
- }
-
-
- private void releasePaymentPluginApis() {
- for (ServiceReference<PaymentPluginApi> ref : paymentApiReferences) {
- final BundleContext context = framework.getBundleContext();
- context.ungetService(ref);
- }
- paymentApiReferences = null;
- }
-
private void pruneOSGICache() {
final String path = osgiConfig.getOSGIBundleRootDir() + "/" + osgiConfig.getOSGIBundleCacheName();
deleteUnderDirectory(new File(path));
diff --git a/osgi/src/main/java/com/ning/billing/osgi/glue/DefaultOSGIModule.java b/osgi/src/main/java/com/ning/billing/osgi/glue/DefaultOSGIModule.java
index 4b10b8b..701e8dc 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/glue/DefaultOSGIModule.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/glue/DefaultOSGIModule.java
@@ -26,8 +26,8 @@ import com.ning.billing.osgi.DefaultOSGIService;
import com.ning.billing.osgi.KillbillActivator;
import com.ning.billing.osgi.api.OSGIKillbill;
import com.ning.billing.osgi.api.OSGIService;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.osgi.api.config.PluginConfigServiceApi;
-import com.ning.billing.osgi.api.http.ServletRouter;
import com.ning.billing.osgi.http.DefaultServletRouter;
import com.ning.billing.osgi.http.OSGIServlet;
import com.ning.billing.osgi.pluginconf.DefaultPluginConfigServiceApi;
@@ -35,6 +35,7 @@ import com.ning.billing.osgi.pluginconf.PluginFinder;
import com.ning.billing.util.config.OSGIConfig;
import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;
public class DefaultOSGIModule extends AbstractModule {
@@ -50,7 +51,7 @@ public class DefaultOSGIModule extends AbstractModule {
}
protected void installOSGIServlet() {
- bind(ServletRouter.class).to(DefaultServletRouter.class).asEagerSingleton();
+ bind(new TypeLiteral<OSGIServiceRegistration<HttpServlet>>() {}).to(DefaultServletRouter.class).asEagerSingleton();
bind(HttpServlet.class).annotatedWith(Names.named(OSGI_NAMED)).to(OSGIServlet.class).asEagerSingleton();
}
diff --git a/osgi/src/main/java/com/ning/billing/osgi/http/DefaultServletRouter.java b/osgi/src/main/java/com/ning/billing/osgi/http/DefaultServletRouter.java
index a4795d5..fc36943 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/http/DefaultServletRouter.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/http/DefaultServletRouter.java
@@ -17,30 +17,41 @@
package com.ning.billing.osgi.http;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.inject.Singleton;
import javax.servlet.http.HttpServlet;
-import com.ning.billing.osgi.api.http.ServletRouter;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
@Singleton
-public class DefaultServletRouter implements ServletRouter {
+public class DefaultServletRouter implements OSGIServiceRegistration<HttpServlet> {
private final Map<String, HttpServlet> pluginServlets = new ConcurrentHashMap<String, HttpServlet>();
@Override
- public void registerServlet(final String pluginName, final HttpServlet httpServlet) {
+ public void registerService(final String pluginName, final HttpServlet httpServlet) {
pluginServlets.put(pluginName, httpServlet);
}
@Override
- public void unregisterServlet(final String pluginName) {
+ public void unregisterService(final String pluginName) {
pluginServlets.remove(pluginName);
}
@Override
- public HttpServlet getServletForPlugin(final String pluginName) {
+ public HttpServlet getServiceForPluginName(final String pluginName) {
return pluginServlets.get(pluginName);
}
+
+ @Override
+ public Set<String> getAllServiceForPluginName() {
+ return pluginServlets.keySet();
+ }
+
+ @Override
+ public Class<HttpServlet> getServiceType() {
+ return HttpServlet.class;
+ }
}
diff --git a/osgi/src/main/java/com/ning/billing/osgi/http/OSGIServlet.java b/osgi/src/main/java/com/ning/billing/osgi/http/OSGIServlet.java
index b43bd7c..182d142 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/http/OSGIServlet.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/http/OSGIServlet.java
@@ -25,13 +25,13 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.ning.billing.osgi.api.http.ServletRouter;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
@Singleton
public class OSGIServlet extends HttpServlet {
@Inject
- private ServletRouter servletRouter;
+ private OSGIServiceRegistration<HttpServlet> servletRouter;
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
@@ -75,7 +75,7 @@ public class OSGIServlet extends HttpServlet {
private HttpServlet getPluginServlet(final HttpServletRequest req) {
final String pluginName = (String) req.getAttribute("killbill.osgi.pluginName");
if (pluginName != null) {
- return servletRouter.getServletForPlugin(pluginName);
+ return servletRouter.getServiceForPluginName(pluginName);
} else {
return null;
}
diff --git a/osgi/src/main/java/com/ning/billing/osgi/KillbillActivator.java b/osgi/src/main/java/com/ning/billing/osgi/KillbillActivator.java
index 8025980..33b320f 100644
--- a/osgi/src/main/java/com/ning/billing/osgi/KillbillActivator.java
+++ b/osgi/src/main/java/com/ning/billing/osgi/KillbillActivator.java
@@ -16,6 +16,8 @@
package com.ning.billing.osgi;
+import java.util.List;
+
import javax.inject.Inject;
import javax.servlet.http.HttpServlet;
@@ -27,12 +29,16 @@ import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import com.ning.billing.osgi.api.OSGIKillbill;
-import com.ning.billing.osgi.api.http.ServletRouter;
+import com.ning.billing.osgi.api.OSGIPluginProperties;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
+
+import com.google.common.collect.ImmutableList;
public class KillbillActivator implements BundleActivator, ServiceListener {
private final OSGIKillbill osgiKillbill;
- private final ServletRouter servletRouter;
+ private final List<OSGIServiceRegistration> allRegistrationHandlers;
private volatile ServiceRegistration osgiKillbillRegistration;
@@ -40,9 +46,10 @@ public class KillbillActivator implements BundleActivator, ServiceListener {
@Inject
public KillbillActivator(final OSGIKillbill osgiKillbill,
- final ServletRouter servletRouter) {
+ final OSGIServiceRegistration<HttpServlet> servletRouter,
+ final OSGIServiceRegistration<PaymentPluginApi> paymentProviderPluginRegistry) {
this.osgiKillbill = osgiKillbill;
- this.servletRouter = servletRouter;
+ this.allRegistrationHandlers = ImmutableList.<OSGIServiceRegistration>of(servletRouter, paymentProviderPluginRegistry);
}
@Override
@@ -63,41 +70,54 @@ public class KillbillActivator implements BundleActivator, ServiceListener {
@Override
public void serviceChanged(final ServiceEvent event) {
- listenForServlets(event);
+ if (context == null || (event.getType() != ServiceEvent.REGISTERED && event.getType() != ServiceEvent.UNREGISTERING)) {
+ // We are not initialized or uninterested
+ return;
+ }
+ for (OSGIServiceRegistration cur : allRegistrationHandlers) {
+ if (listenForServiceType(event, cur.getServiceType(), cur)) {
+ break;
+ }
+ }
}
- private void listenForServlets(final ServiceEvent event) {
- if (event.getType() != ServiceEvent.REGISTERED && event.getType() != ServiceEvent.UNREGISTERING) {
- // Servlets can only be added or removed, not modified
- return;
+ private <T> boolean listenForServiceType(final ServiceEvent event, Class<T> claz, final OSGIServiceRegistration<T> registation) {
+
+ // Is that for us ?
+ final String[] objectClass = (String[]) event.getServiceReference().getProperty("objectClass");
+ if (objectClass == null || objectClass.length == 0 || !claz.getName().equals(objectClass[0])) {
+ return false;
}
- final ServiceReference serviceReference = event.getServiceReference();
// Make sure we can retrieve the plugin name
- final String pluginName = (String) serviceReference.getProperty("killbill.pluginName");
+ final ServiceReference serviceReference = event.getServiceReference();
+ final String pluginName = (String) serviceReference.getProperty(OSGIPluginProperties.PLUGIN_NAME_PROP);
if (pluginName == null) {
- return;
+ // STEPH logger ?
+ return true;
}
- // Make sure this event is for a servlet
- HttpServlet httpServlet = null;
- final String[] objectClass = (String[]) event.getServiceReference().getProperty("objectClass");
- if (context != null && objectClass != null && objectClass.length > 0 && HttpServlet.class.getName().equals(objectClass[0])) {
- final Object service = context.getService(serviceReference);
- httpServlet = (HttpServlet) service;
+ final T theService = (T) context.getService(serviceReference);
+ if (theService == null) {
+ return true;
}
- if (httpServlet == null) {
- return;
- }
+ switch (event.getType()) {
+ case ServiceEvent.REGISTERED:
+ registation.registerService(pluginName, theService);
- if (event.getType() == ServiceEvent.REGISTERED) {
- servletRouter.registerServlet(pluginName, httpServlet);
- } else if (event.getType() == ServiceEvent.UNREGISTERING) {
- servletRouter.unregisterServlet(pluginName);
+ break;
+ case ServiceEvent.UNREGISTERING:
+ registation.unregisterService(pluginName);
+ break;
+
+ default:
+ break;
}
+ return true;
}
+
private void registerServices(final BundleContext context) {
osgiKillbillRegistration = context.registerService(OSGIKillbill.class.getName(), osgiKillbill, null);
}
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
index 89098ff..ab294d9 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
@@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory;
import com.ning.billing.ErrorCode;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.DefaultPaymentMethod;
import com.ning.billing.payment.api.PaymentApiException;
import com.ning.billing.payment.api.PaymentMethod;
@@ -42,7 +43,6 @@ import com.ning.billing.payment.plugin.api.PaymentPluginApiException;
import com.ning.billing.payment.provider.DefaultNoOpPaymentMethodPlugin;
import com.ning.billing.payment.provider.DefaultPaymentMethodInfoPlugin;
import com.ning.billing.payment.provider.ExternalPaymentProviderPlugin;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
import com.ning.billing.util.callcontext.InternalCallContext;
import com.ning.billing.util.callcontext.InternalTenantContext;
import com.ning.billing.util.globallocker.GlobalLocker;
@@ -63,7 +63,7 @@ public class PaymentMethodProcessor extends ProcessorBase {
private static final Logger log = LoggerFactory.getLogger(PaymentMethodProcessor.class);
@Inject
- public PaymentMethodProcessor(final PaymentProviderPluginRegistry pluginRegistry,
+ public PaymentMethodProcessor(final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry,
final AccountInternalApi accountInternalApi,
final InternalBus eventBus,
final PaymentDao paymentDao,
@@ -74,7 +74,7 @@ public class PaymentMethodProcessor extends ProcessorBase {
}
public Set<String> getAvailablePlugins() {
- return pluginRegistry.getRegisteredPluginNames();
+ return pluginRegistry.getAllServiceForPluginName();
}
public UUID addPaymentMethod(final String pluginName, final Account account,
@@ -88,7 +88,7 @@ public class PaymentMethodProcessor extends ProcessorBase {
PaymentMethod pm = null;
PaymentPluginApi pluginApi = null;
try {
- pluginApi = pluginRegistry.getPlugin(pluginName);
+ pluginApi = pluginRegistry.getServiceForPluginName(pluginName);
pm = new DefaultPaymentMethod(account.getId(), pluginName, paymentMethodProps);
pluginApi.addPaymentMethod(pm.getId(), paymentMethodProps, setDefault, context.toCallContext());
final PaymentMethodModelDao pmModel = new PaymentMethodModelDao(pm.getId(), pm.getCreatedDate(), pm.getUpdatedDate(),
@@ -157,7 +157,7 @@ public class PaymentMethodProcessor extends ProcessorBase {
addPaymentMethod(ExternalPaymentProviderPlugin.PLUGIN_NAME, account, false, props, context);
}
- return (ExternalPaymentProviderPlugin) pluginRegistry.getPlugin(ExternalPaymentProviderPlugin.PLUGIN_NAME);
+ return (ExternalPaymentProviderPlugin) pluginRegistry.getServiceForPluginName(ExternalPaymentProviderPlugin.PLUGIN_NAME);
}
private List<PaymentMethod> getPaymentMethodInternal(final List<PaymentMethodModelDao> paymentMethodModels, final UUID accountId,
@@ -244,7 +244,7 @@ public class PaymentMethodProcessor extends ProcessorBase {
if (paymentMethod == null) {
throw new PaymentApiException(ErrorCode.PAYMENT_NO_SUCH_PAYMENT_METHOD, paymentMethodId);
}
- return pluginRegistry.getPlugin(paymentMethod.getPluginName());
+ return pluginRegistry.getServiceForPluginName(paymentMethod.getPluginName());
}
/**
@@ -262,7 +262,7 @@ public class PaymentMethodProcessor extends ProcessorBase {
// Don't hold the account lock while fetching the payment methods from the gateway as those could change anyway
- final PaymentPluginApi pluginApi = pluginRegistry.getPlugin(pluginName);
+ final PaymentPluginApi pluginApi = pluginRegistry.getServiceForPluginName(pluginName);
final List<PaymentMethodInfoPlugin> pluginPms;
try {
pluginPms = pluginApi.getPaymentMethods(account.getId(), true, context.toCallContext());
diff --git a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
index bff7a2b..2f70a84 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
@@ -37,6 +37,7 @@ import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.invoice.api.InvoiceApiException;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.DefaultPayment;
import com.ning.billing.payment.api.DefaultPaymentErrorEvent;
import com.ning.billing.payment.api.DefaultPaymentInfoEvent;
@@ -51,7 +52,6 @@ import com.ning.billing.payment.dispatcher.PluginDispatcher;
import com.ning.billing.payment.plugin.api.PaymentInfoPlugin;
import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.payment.plugin.api.PaymentPluginApiException;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
import com.ning.billing.payment.retry.AutoPayRetryService.AutoPayRetryServiceScheduler;
import com.ning.billing.payment.retry.FailedPaymentRetryService.FailedPaymentRetryServiceScheduler;
import com.ning.billing.payment.retry.PluginFailureRetryService.PluginFailureRetryServiceScheduler;
@@ -91,7 +91,7 @@ public class PaymentProcessor extends ProcessorBase {
private static final Logger log = LoggerFactory.getLogger(PaymentProcessor.class);
@Inject
- public PaymentProcessor(final PaymentProviderPluginRegistry pluginRegistry,
+ public PaymentProcessor(final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry,
final PaymentMethodProcessor paymentMethodProcessor,
final AccountInternalApi accountUserApi,
final InvoiceInternalApi invoiceApi,
diff --git a/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java b/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
index 0665517..cd345fc 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
@@ -17,7 +17,6 @@
package com.ning.billing.payment.core;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
@@ -31,11 +30,11 @@ import com.ning.billing.ErrorCode;
import com.ning.billing.ObjectType;
import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.PaymentApiException;
import com.ning.billing.payment.dao.PaymentDao;
import com.ning.billing.payment.dao.PaymentMethodModelDao;
import com.ning.billing.payment.plugin.api.PaymentPluginApi;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
import com.ning.billing.util.api.TagApiException;
import com.ning.billing.util.callcontext.InternalCallContext;
import com.ning.billing.util.callcontext.InternalTenantContext;
@@ -58,7 +57,7 @@ public abstract class ProcessorBase {
private static final int NB_LOCK_TRY = 5;
- protected final PaymentProviderPluginRegistry pluginRegistry;
+ protected final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry;
protected final AccountInternalApi accountInternalApi;
protected final InternalBus eventBus;
protected final GlobalLocker locker;
@@ -68,7 +67,7 @@ public abstract class ProcessorBase {
private static final Logger log = LoggerFactory.getLogger(ProcessorBase.class);
- public ProcessorBase(final PaymentProviderPluginRegistry pluginRegistry,
+ public ProcessorBase(final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry,
final AccountInternalApi accountInternalApi,
final InternalBus eventBus,
final PaymentDao paymentDao,
@@ -111,7 +110,7 @@ public abstract class ProcessorBase {
log.error("PaymentMethod dpes not exist", paymentMethodId);
throw new PaymentApiException(ErrorCode.PAYMENT_NO_SUCH_PAYMENT_METHOD, paymentMethodId);
}
- return pluginRegistry.getPlugin(methodDao.getPluginName());
+ return pluginRegistry.getServiceForPluginName(methodDao.getPluginName());
}
protected PaymentPluginApi getPaymentProviderPlugin(final String accountKey, final InternalTenantContext context)
@@ -122,7 +121,7 @@ public abstract class ProcessorBase {
final Account account = accountInternalApi.getAccountByKey(accountKey, context);
return getPaymentProviderPlugin(account, context);
}
- return pluginRegistry.getPlugin(paymentProviderName);
+ return pluginRegistry.getServiceForPluginName(paymentProviderName);
}
protected PaymentPluginApi getPaymentProviderPlugin(final Account account, final InternalTenantContext context) throws PaymentApiException {
diff --git a/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java b/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
index 121ccf4..a1e2783 100644
--- a/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
+++ b/payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
@@ -37,6 +37,7 @@ import com.ning.billing.account.api.Account;
import com.ning.billing.account.api.AccountApiException;
import com.ning.billing.invoice.api.InvoiceApiException;
import com.ning.billing.invoice.api.InvoiceItem;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.DefaultRefund;
import com.ning.billing.payment.api.PaymentApiException;
import com.ning.billing.payment.api.Refund;
@@ -46,7 +47,6 @@ import com.ning.billing.payment.dao.RefundModelDao;
import com.ning.billing.payment.dao.RefundModelDao.RefundStatus;
import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.payment.plugin.api.PaymentPluginApiException;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
import com.ning.billing.util.callcontext.CallOrigin;
import com.ning.billing.util.callcontext.InternalCallContext;
import com.ning.billing.util.callcontext.InternalCallContextFactory;
@@ -75,7 +75,7 @@ public class RefundProcessor extends ProcessorBase {
private final InternalCallContextFactory internalCallContextFactory;
@Inject
- public RefundProcessor(final PaymentProviderPluginRegistry pluginRegistry,
+ public RefundProcessor(final OSGIServiceRegistration<PaymentPluginApi> pluginRegistry,
final AccountInternalApi accountApi,
final InvoiceInternalApi invoiceApi,
final InternalBus eventBus,
diff --git a/payment/src/main/java/com/ning/billing/payment/glue/DefaultPaymentProviderPluginRegistryProvider.java b/payment/src/main/java/com/ning/billing/payment/glue/DefaultPaymentProviderPluginRegistryProvider.java
index 8cbbc5d..4bc2349 100644
--- a/payment/src/main/java/com/ning/billing/payment/glue/DefaultPaymentProviderPluginRegistryProvider.java
+++ b/payment/src/main/java/com/ning/billing/payment/glue/DefaultPaymentProviderPluginRegistryProvider.java
@@ -16,6 +16,8 @@
package com.ning.billing.payment.glue;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.util.config.PaymentConfig;
import com.ning.billing.payment.provider.DefaultPaymentProviderPluginRegistry;
import com.ning.billing.payment.provider.ExternalPaymentProviderPlugin;
@@ -23,7 +25,7 @@ import com.ning.billing.payment.provider.ExternalPaymentProviderPlugin;
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class DefaultPaymentProviderPluginRegistryProvider implements Provider<DefaultPaymentProviderPluginRegistry> {
+public class DefaultPaymentProviderPluginRegistryProvider implements Provider<OSGIServiceRegistration<PaymentPluginApi>> {
private final PaymentConfig paymentConfig;
private final ExternalPaymentProviderPlugin externalPaymentProviderPlugin;
@@ -35,11 +37,11 @@ public class DefaultPaymentProviderPluginRegistryProvider implements Provider<De
}
@Override
- public DefaultPaymentProviderPluginRegistry get() {
+ public OSGIServiceRegistration<PaymentPluginApi> get() {
final DefaultPaymentProviderPluginRegistry pluginRegistry = new DefaultPaymentProviderPluginRegistry(paymentConfig);
// Make the external payment provider plugin available by default
- pluginRegistry.register(externalPaymentProviderPlugin, ExternalPaymentProviderPlugin.PLUGIN_NAME);
+ pluginRegistry.registerService(ExternalPaymentProviderPlugin.PLUGIN_NAME, externalPaymentProviderPlugin);
return pluginRegistry;
}
diff --git a/payment/src/main/java/com/ning/billing/payment/glue/PaymentModule.java b/payment/src/main/java/com/ning/billing/payment/glue/PaymentModule.java
index 19e3f4e..45ac567 100644
--- a/payment/src/main/java/com/ning/billing/payment/glue/PaymentModule.java
+++ b/payment/src/main/java/com/ning/billing/payment/glue/PaymentModule.java
@@ -25,32 +25,35 @@ import org.skife.config.ConfigSource;
import org.skife.config.ConfigurationObjectFactory;
import org.skife.config.SimplePropertyConfigSource;
-import com.ning.billing.payment.bus.PaymentTagHandler;
-import com.ning.billing.payment.dao.DefaultPaymentDao;
-import com.ning.billing.util.config.PaymentConfig;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.DefaultPaymentApi;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.api.PaymentService;
import com.ning.billing.payment.api.svcs.DefaultPaymentInternalApi;
import com.ning.billing.payment.bus.InvoiceHandler;
+import com.ning.billing.payment.bus.PaymentTagHandler;
import com.ning.billing.payment.core.PaymentMethodProcessor;
import com.ning.billing.payment.core.PaymentProcessor;
import com.ning.billing.payment.core.RefundProcessor;
+import com.ning.billing.payment.dao.DefaultPaymentDao;
import com.ning.billing.payment.dao.PaymentDao;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.payment.retry.AutoPayRetryService;
import com.ning.billing.payment.retry.AutoPayRetryService.AutoPayRetryServiceScheduler;
import com.ning.billing.payment.retry.FailedPaymentRetryService;
import com.ning.billing.payment.retry.FailedPaymentRetryService.FailedPaymentRetryServiceScheduler;
import com.ning.billing.payment.retry.PluginFailureRetryService;
import com.ning.billing.payment.retry.PluginFailureRetryService.PluginFailureRetryServiceScheduler;
+import com.ning.billing.util.config.PaymentConfig;
import com.ning.billing.util.svcapi.payment.PaymentInternalApi;
import com.google.common.annotations.VisibleForTesting;
import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;
public class PaymentModule extends AbstractModule {
+
private static final int PLUGIN_NB_THREADS = 3;
private static final String PLUGIN_THREAD_PREFIX = "Plugin-th-";
@@ -109,7 +112,7 @@ public class PaymentModule extends AbstractModule {
final PaymentConfig paymentConfig = factory.build(PaymentConfig.class);
bind(PaymentConfig.class).toInstance(paymentConfig);
- bind(PaymentProviderPluginRegistry.class).toProvider(DefaultPaymentProviderPluginRegistryProvider.class).asEagerSingleton();
+ bind(new TypeLiteral<OSGIServiceRegistration<PaymentPluginApi>>() {}).toProvider(DefaultPaymentProviderPluginRegistryProvider.class).asEagerSingleton();
bind(PaymentInternalApi.class).to(DefaultPaymentInternalApi.class).asEagerSingleton();
bind(PaymentApi.class).to(DefaultPaymentApi.class).asEagerSingleton();
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/DefaultPaymentProviderPluginRegistry.java b/payment/src/main/java/com/ning/billing/payment/provider/DefaultPaymentProviderPluginRegistry.java
index 0a28eaa..0bfc1b1 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/DefaultPaymentProviderPluginRegistry.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/DefaultPaymentProviderPluginRegistry.java
@@ -20,13 +20,14 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import com.ning.billing.util.config.PaymentConfig;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.plugin.api.PaymentPluginApi;
+import com.ning.billing.util.config.PaymentConfig;
import com.google.common.base.Strings;
import com.google.inject.Inject;
-public class DefaultPaymentProviderPluginRegistry implements PaymentProviderPluginRegistry {
+public class DefaultPaymentProviderPluginRegistry implements OSGIServiceRegistration<PaymentPluginApi> {
private final String defaultPlugin;
private final Map<String, PaymentPluginApi> pluginsByName = new ConcurrentHashMap<String, PaymentPluginApi>();
@@ -36,13 +37,19 @@ public class DefaultPaymentProviderPluginRegistry implements PaymentProviderPlug
this.defaultPlugin = config.getDefaultPaymentProvider();
}
+
@Override
- public void register(final PaymentPluginApi plugin, final String name) {
- pluginsByName.put(name.toLowerCase(), plugin);
+ public void registerService(final String pluginName, final PaymentPluginApi service) {
+ pluginsByName.put(pluginName.toLowerCase(), service);
}
@Override
- public PaymentPluginApi getPlugin(final String name) {
+ public void unregisterService(final String pluginName) {
+ pluginsByName.remove(pluginName.toLowerCase());
+ }
+
+ @Override
+ public PaymentPluginApi getServiceForPluginName(final String name) {
final PaymentPluginApi plugin = pluginsByName.get((Strings.emptyToNull(name) == null ? defaultPlugin : name).toLowerCase());
if (plugin == null) {
@@ -53,7 +60,12 @@ public class DefaultPaymentProviderPluginRegistry implements PaymentProviderPlug
}
@Override
- public Set<String> getRegisteredPluginNames() {
+ public Set<String> getAllServiceForPluginName() {
return pluginsByName.keySet();
}
+
+ @Override
+ public Class<PaymentPluginApi> getServiceType() {
+ return PaymentPluginApi.class;
+ }
}
diff --git a/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPluginProvider.java b/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPluginProvider.java
index e392bb2..8bd3830 100644
--- a/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPluginProvider.java
+++ b/payment/src/main/java/com/ning/billing/payment/provider/NoOpPaymentProviderPluginProvider.java
@@ -18,6 +18,9 @@ package com.ning.billing.payment.provider;
import com.google.inject.Inject;
import com.google.inject.Provider;
+
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.util.clock.Clock;
public class NoOpPaymentProviderPluginProvider implements Provider<DefaultNoOpPaymentProviderPlugin> {
@@ -25,7 +28,7 @@ public class NoOpPaymentProviderPluginProvider implements Provider<DefaultNoOpPa
private final String instanceName;
private Clock clock;
- private PaymentProviderPluginRegistry registry;
+ private OSGIServiceRegistration<PaymentPluginApi> registry;
public NoOpPaymentProviderPluginProvider(final String instanceName) {
this.instanceName = instanceName;
@@ -33,7 +36,7 @@ public class NoOpPaymentProviderPluginProvider implements Provider<DefaultNoOpPa
}
@Inject
- public void setPaymentProviderPluginRegistry(final PaymentProviderPluginRegistry registry, final Clock clock) {
+ public void setPaymentProviderPluginRegistry(final OSGIServiceRegistration<PaymentPluginApi> registry, final Clock clock) {
this.clock = clock;
this.registry = registry;
}
@@ -42,7 +45,7 @@ public class NoOpPaymentProviderPluginProvider implements Provider<DefaultNoOpPa
public DefaultNoOpPaymentProviderPlugin get() {
final DefaultNoOpPaymentProviderPlugin plugin = new DefaultNoOpPaymentProviderPlugin(clock);
- registry.register(plugin, instanceName);
+ registry.registerService(instanceName, plugin);
return plugin;
}
}
diff --git a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java
index 4d11db1..f61d8bb 100644
--- a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java
+++ b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteNoDB.java
@@ -25,11 +25,12 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import com.ning.billing.GuicyKillbillTestSuiteNoDB;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.core.PaymentMethodProcessor;
import com.ning.billing.payment.core.PaymentProcessor;
import com.ning.billing.payment.glue.TestPaymentModuleNoDB;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.payment.retry.FailedPaymentRetryService;
import com.ning.billing.payment.retry.PluginFailureRetryService;
import com.ning.billing.util.config.PaymentConfig;
@@ -54,7 +55,7 @@ public abstract class PaymentTestSuiteNoDB extends GuicyKillbillTestSuiteNoDB {
@Inject
protected InvoiceInternalApi invoiceApi;
@Inject
- protected PaymentProviderPluginRegistry registry;
+ protected OSGIServiceRegistration<PaymentPluginApi> registry;
@Inject
protected FailedPaymentRetryService retryService;
@Inject
diff --git a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java
index 2da0b91..64a9802 100644
--- a/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java
+++ b/payment/src/test/java/com/ning/billing/payment/PaymentTestSuiteWithEmbeddedDB.java
@@ -25,12 +25,13 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import com.ning.billing.GuicyKillbillTestSuiteWithEmbeddedDB;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.payment.api.PaymentApi;
import com.ning.billing.payment.core.PaymentMethodProcessor;
import com.ning.billing.payment.core.PaymentProcessor;
import com.ning.billing.payment.dao.PaymentDao;
import com.ning.billing.payment.glue.TestPaymentModuleWithEmbeddedDB;
-import com.ning.billing.payment.provider.PaymentProviderPluginRegistry;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.payment.retry.FailedPaymentRetryService;
import com.ning.billing.payment.retry.PluginFailureRetryService;
import com.ning.billing.util.config.PaymentConfig;
@@ -55,7 +56,7 @@ public abstract class PaymentTestSuiteWithEmbeddedDB extends GuicyKillbillTestSu
@Inject
protected InvoiceInternalApi invoiceApi;
@Inject
- protected PaymentProviderPluginRegistry registry;
+ protected OSGIServiceRegistration<PaymentPluginApi> registry;
@Inject
protected FailedPaymentRetryService retryService;
@Inject
diff --git a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java
index 4ed67ec..8cf86e5 100644
--- a/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java
+++ b/payment/src/test/java/com/ning/billing/payment/provider/MockPaymentProviderPluginProvider.java
@@ -18,11 +18,14 @@ package com.ning.billing.payment.provider;
import com.google.inject.Inject;
import com.google.inject.Provider;
+
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
+import com.ning.billing.payment.plugin.api.PaymentPluginApi;
import com.ning.billing.util.clock.Clock;
public class MockPaymentProviderPluginProvider implements Provider<MockPaymentProviderPlugin> {
- private PaymentProviderPluginRegistry registry;
+ private OSGIServiceRegistration<PaymentPluginApi> registry;
private final String instanceName;
@Inject
@@ -33,7 +36,7 @@ public class MockPaymentProviderPluginProvider implements Provider<MockPaymentPr
}
@Inject
- public void setPaymentProviderPluginRegistry(final PaymentProviderPluginRegistry registry) {
+ public void setPaymentProviderPluginRegistry(final OSGIServiceRegistration<PaymentPluginApi> registry) {
this.registry = registry;
}
@@ -41,7 +44,7 @@ public class MockPaymentProviderPluginProvider implements Provider<MockPaymentPr
public MockPaymentProviderPlugin get() {
final MockPaymentProviderPlugin plugin = new MockPaymentProviderPlugin(clock);
- registry.register(plugin, instanceName);
+ registry.registerService(instanceName, plugin);
return plugin;
}
}
diff --git a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
index 162f007..56d4946 100644
--- a/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
+++ b/payment/src/test/java/com/ning/billing/payment/TestRetryService.java
@@ -59,7 +59,7 @@ public class TestRetryService extends PaymentTestSuiteNoDB {
retryService.initialize(DefaultPaymentService.SERVICE_NAME);
retryService.start();
- mockPaymentProviderPlugin = (MockPaymentProviderPlugin) registry.getPlugin(null);
+ mockPaymentProviderPlugin = (MockPaymentProviderPlugin) registry.getServiceForPluginName(null);
mockPaymentProviderPlugin.clear();
}
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
index 88869d5..d80766a 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.Map;
import javax.inject.Inject;
+import javax.servlet.http.HttpServlet;
import org.eclipse.jetty.servlet.FilterHolder;
import org.joda.time.LocalDate;
@@ -49,7 +50,7 @@ import com.ning.billing.invoice.api.InvoiceNotifier;
import com.ning.billing.invoice.glue.DefaultInvoiceModule;
import com.ning.billing.invoice.notification.NullInvoiceNotifier;
import com.ning.billing.junction.glue.DefaultJunctionModule;
-import com.ning.billing.osgi.api.http.ServletRouter;
+import com.ning.billing.osgi.api.OSGIServiceRegistration;
import com.ning.billing.osgi.glue.DefaultOSGIModule;
import com.ning.billing.overdue.glue.DefaultOverdueModule;
import com.ning.billing.payment.glue.PaymentModule;
@@ -93,7 +94,7 @@ public class TestJaxrsBase extends KillbillClient {
protected static final int DEFAULT_HTTP_TIMEOUT_SEC = 6000; // 5;
@Inject
- protected ServletRouter servletRouter;
+ protected OSGIServiceRegistration<HttpServlet> servletRouter;
protected static TestKillbillGuiceListener listener;
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestPlugin.java b/server/src/test/java/com/ning/billing/jaxrs/TestPlugin.java
index 3b42643..bebe50a 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestPlugin.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestPlugin.java
@@ -158,7 +158,7 @@ public class TestPlugin extends TestJaxrsBase {
}
private void setupOSGIPlugin() {
- servletRouter.registerServlet(TEST_PLUGIN_NAME, new HttpServlet() {
+ servletRouter.registerService(TEST_PLUGIN_NAME, new HttpServlet() {
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
if ((JaxrsResource.PLUGINS_PATH + "/" + TEST_PLUGIN_NAME + "/" + TEST_PLUGIN_VALID_GET_PATH).equals(req.getPathInfo())) {