Skip to content
Permalink
Browse files
ARIES-2029 Do not bundle CXF
  • Loading branch information
Carlos Sierra Andrés authored and rotty3000 committed Jan 12, 2021
1 parent b2db915 commit c59f4f939c4cf97194b74b8df07b1a5bc8b13492
Showing 14 changed files with 67 additions and 318 deletions.
@@ -79,12 +79,6 @@
<artifactId>org.apache.aries.jax.rs.whiteboard</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.itests-fragment</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.jaxb.json.cxf-jettison</artifactId>
@@ -113,11 +113,6 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.itests-fragment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.cm</artifactId>

This file was deleted.

This file was deleted.

@@ -93,12 +93,6 @@
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.whiteboard</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
<artifactId>org.apache.aries.jax.rs.itests-fragment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -15,46 +15,7 @@
# specific language governing permissions and limitations
# under the License.

Import-Package:\
!com.sun.*,\
!javax.cache.*,\
!javax.imageio.*,\
!javax.jws.*,\
!javax.security.*,\
!javax.tools.*,\
!javax.validation.*,\
!javax.wsdl.*,\
!net.sf.cglib.proxy.*,\
!org.apache.abdera.*,\
!org.apache.aries.*,\
!org.apache.commons.logging,\
!org.apache.cxf.*,\
!org.apache.log4j.*,\
!org.apache.neethi.*,\
!org.apache.velocity.*,\
!org.apache.xerces.*,\
!org.apache.xml.resolver.*,\
!org.apache.xmlbeans.*,\
!org.atmosphere.*,\
!org.dom4j.*,\
!org.junit.*,\
!org.jvnet.fastinfoset.*,\
!org.jvnet.staxex.*,\
!org.ietf.jgss.*,\
!org.objectweb.asm.*,\
!org.osgi.service.blueprint.*,\
!org.osgi.service.http,\
!org.relaxng.datatype.*,\
!org.slf4j.impl.*,\
!org.slf4j.spi.*,\
!org.springframework.*,\
!sun.misc,\
*
Conditional-Package: org.apache.aries.component.dsl.*
Import-Package: org.apache.cxf.jaxrs.client,*

Provide-Capability: osgi.implementation;osgi.implementation="aries.jax-rs";version:Version="${Bundle-Version}"

-includeresource:\
@${.}/../org.apache.aries.jax.rs.cxf.repackage/target/org.apache.aries.jax.rs.cxf.repackage-${project.version}.jar!/!org/apache/cxf/helpers/JavaUtils*.class,\
lib/stax2-api.jar=stax2-api-*.jar;lib:=true,\
lib/woodstox-core.jar=woodstox-core-*.jar;lib:=true,\
lib/xmlschema-core.jar=xmlschema-core-*.jar;lib:=true
Provide-Capability: osgi.implementation;osgi.implementation="aries.jax-rs";version:Version="${Bundle-Version}"
@@ -102,11 +102,6 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.util.function</artifactId>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs.cxf.repackage</groupId>
<artifactId>org.apache.aries.jax.rs.cxf.repackage</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -17,7 +17,7 @@
* under the License.
*/

package org.apache.cxf.helpers;
package org.apache.aries.jax.rs.whiteboard.cxf.helpers;

import java.util.Arrays;
import java.util.HashSet;
@@ -15,21 +15,28 @@
* limitations under the License.
*/

package org.apache.cxf.jaxrs.client;
package org.apache.aries.jax.rs.whiteboard.cxf.jaxrs.client;

import javax.ws.rs.HttpMethod;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;

import org.apache.cxf.jaxrs.client.WebClient;
import org.osgi.service.jaxrs.client.PromiseRxInvoker;
import org.osgi.util.promise.Deferred;
import org.osgi.util.promise.Promise;
import org.osgi.util.promise.PromiseFactory;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;

class PromiseRxInvokerImpl implements PromiseRxInvoker {

private final Method _doInvokeAsyncMethod;

private static final class DeferredHandler<R> implements InvocationCallback<R> {
private final Deferred<R> deferred;

@@ -50,6 +57,14 @@ public void failed(Throwable throwable) {
public PromiseRxInvokerImpl(
WebClient webClient, PromiseFactory promiseFactory) {
_webClient = webClient;
try {
_doInvokeAsyncMethod = WebClient.class.getDeclaredMethod(
"doInvokeAsync",
String.class, Object.class, Class.class, Type.class, Class.class, Type.class, InvocationCallback.class);
} catch (NoSuchMethodException nsme) {
throw new RuntimeException(nsme);
}
_doInvokeAsyncMethod.setAccessible(true);
_promiseFactory = promiseFactory;
}

@@ -90,35 +105,48 @@ public Promise<Response> head() {

@Override
public <R> Promise<R> method(String s, Class<R> responseType) {

Deferred<R> deferred = _promiseFactory.deferred();

_webClient.doInvokeAsync(s, null, null, null, responseType, responseType,
new DeferredHandler<R>(deferred));

Deferred<R> deferred = _promiseFactory.deferred();

try {
_doInvokeAsyncMethod.invoke(
_webClient, s, null, null, null, responseType, responseType,
new DeferredHandler<R>(deferred));
} catch (Exception e) {
throw new RuntimeException(e);
}

return deferred.getPromise();
}

@Override
public <R> Promise<R> method(String s, Entity<?> entity, Class<R> responseType) {

Deferred<R> deferred = _promiseFactory.deferred();

_webClient.doInvokeAsync(s, entity, null, null, responseType, responseType,

try {
_doInvokeAsyncMethod.invoke(
_webClient, s, entity, null, null, responseType, responseType,
new DeferredHandler<R>(deferred));

return deferred.getPromise();
} catch (Exception e) {
throw new RuntimeException(e);
}

return deferred.getPromise();
}

@Override
public <R> Promise<R> method(
String s, Entity<?> entity, GenericType<R> genericType) {

Deferred<R> deferred = _promiseFactory.deferred();

_webClient.doInvokeAsync(s, entity, null, null, genericType.getRawType(), genericType.getType(),
new DeferredHandler<R>(deferred));

Deferred<R> deferred = _promiseFactory.deferred();

try {
_doInvokeAsyncMethod.invoke(
_webClient, s, entity, null, null, genericType.getRawType(),
genericType.getType(), new DeferredHandler<R>(deferred));
} catch (Exception e) {
throw new RuntimeException(e);
}

return deferred.getPromise();
}

@@ -130,10 +158,15 @@ public Promise<Response> method(String s, Entity<?> entity) {
@Override
public <R> Promise<R> method(String s, GenericType<R> genericType) {
Deferred<R> deferred = _promiseFactory.deferred();

_webClient.doInvokeAsync(s, null, null, null, genericType.getRawType(), genericType.getType(),
new DeferredHandler<R>(deferred));


try {
_doInvokeAsyncMethod.invoke(
_webClient, s, null, null, null, genericType.getRawType(),
genericType.getType(), new DeferredHandler<R>(deferred));
} catch (Exception e) {
throw new RuntimeException(e);
}

return deferred.getPromise();
}

@@ -15,13 +15,14 @@
* limitations under the License.
*/

package org.apache.cxf.jaxrs.client;
package org.apache.aries.jax.rs.whiteboard.cxf.jaxrs.client;

import java.util.concurrent.ExecutorService;

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

import org.apache.cxf.jaxrs.client.SyncInvokerImpl;
import org.osgi.service.jaxrs.client.PromiseRxInvoker;
import org.osgi.util.promise.PromiseFactory;

@@ -17,7 +17,7 @@

package org.apache.aries.jax.rs.whiteboard.internal.client;

import org.apache.cxf.jaxrs.client.PromiseRxInvokerProviderImpl;
import org.apache.aries.jax.rs.whiteboard.cxf.jaxrs.client.PromiseRxInvokerProviderImpl;

import aQute.bnd.annotation.spi.ServiceProvider;

0 comments on commit c59f4f9

Please sign in to comment.