Skip to content

Commit

Permalink
Merge pull request #9 from timothyjward/fix/clientbuilder
Browse files Browse the repository at this point in the history
Avoid errors with the ClientBuilder service
  • Loading branch information
maho7791 committed Jul 3, 2023
2 parents 77a4a3f + fd33706 commit e45bfd5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@

import static org.osgi.namespace.service.ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE;
import static org.osgi.namespace.service.ServiceNamespace.SERVICE_NAMESPACE;
import static org.osgi.service.serviceloader.ServiceLoaderNamespace.SERVICELOADER_NAMESPACE;

import java.util.Dictionary;
import java.util.Hashtable;

import org.eclipse.osgitech.rest.provider.JerseyConstants;
import org.glassfish.jersey.client.JerseyClientBuilder;
import org.osgi.annotation.bundle.Capability;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Expand All @@ -36,7 +38,6 @@
import org.osgi.service.jakartars.client.SseEventSourceFactory;

import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.RxInvokerProvider;

/**
*
Expand Down Expand Up @@ -64,14 +65,18 @@
"service.scope=bundle"
}
)
@Capability(
namespace = SERVICELOADER_NAMESPACE,
name = "jakarta.ws.rs.client.ClientBuilder",
attribute = "register:=\"\"",
uses = ClientBuilder.class
)
public class ClientBuilderComponent {

/** ECLIPSE_OS_GI_TECHNOLOGY */
private static final String SERVICE_VENDOR = "Eclipse OSGi Technology";
private ServiceRegistration<ClientBuilder> registerClientBuilderService;
private ServiceRegistration<SseEventSourceFactory> registerSseService;
@Reference
private RxInvokerProvider<PromiseRxInvoker> rxInvokerProvider;

@Activate
public void activate(BundleContext ctx) {
Expand All @@ -88,7 +93,7 @@ public void activate(BundleContext ctx) {
*/
@Override
public ClientBuilder getService(Bundle bundle, ServiceRegistration<ClientBuilder> registration) {
ClientBuilderService clientBuilder = new ClientBuilderService(rxInvokerProvider);
ClientBuilder clientBuilder = new JerseyClientBuilder().register(RxInvokerProviderImpl.class);
return clientBuilder;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@

import java.util.concurrent.ExecutorService;

import org.osgi.service.jakartars.client.PromiseRxInvoker;

import jakarta.ws.rs.client.RxInvokerProvider;
import jakarta.ws.rs.client.SyncInvoker;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.jakartars.client.PromiseRxInvoker;

/**
*
* @author ilenia
* @since Jun 12, 2020
*/
@Component(service = RxInvokerProvider.class)
public class RxInvokerProviderImpl implements RxInvokerProvider<PromiseRxInvoker> {

/*
Expand Down

0 comments on commit e45bfd5

Please sign in to comment.