aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csie...@apache.org
Subject [1/4] aries-jax-rs-whiteboard git commit: [JAXRS] fix contract dependency, per spec embed and provide client builder as a service, make embedded dependencies provided scope
Date Fri, 30 Jun 2017 15:59:39 GMT
Repository: aries-jax-rs-whiteboard
Updated Branches:
  refs/heads/master 712aff838 -> 5715c1236


[JAXRS] fix contract dependency, per spec embed and provide client builder as a service, make
embedded dependencies provided scope

Signed-off-by: Raymond Auge <raymond.auge@liferay.com>


Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/faf6b1f6
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/faf6b1f6
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/faf6b1f6

Branch: refs/heads/master
Commit: faf6b1f693533efb0c52156d987e467c5e9decbd
Parents: 712aff8
Author: Raymond Auge <raymond.auge@liferay.com>
Authored: Thu Jun 29 14:00:04 2017 -0400
Committer: Raymond Auge <raymond.auge@liferay.com>
Committed: Thu Jun 29 14:00:04 2017 -0400

----------------------------------------------------------------------
 jax-rs.whiteboard/bnd.bnd                       | 13 ++---
 jax-rs.whiteboard/pom.xml                       | 55 ++++++++++++++------
 .../activator/CXFJaxRsBundleActivator.java      |  7 +++
 .../internal/ClientBuilderFactory.java          | 37 +++++++++++++
 4 files changed, 87 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/faf6b1f6/jax-rs.whiteboard/bnd.bnd
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/bnd.bnd b/jax-rs.whiteboard/bnd.bnd
index c421f14..6e8a87e 100644
--- a/jax-rs.whiteboard/bnd.bnd
+++ b/jax-rs.whiteboard/bnd.bnd
@@ -9,9 +9,9 @@ Require-Capability: \
 Import-Package:\
     !com.sun.*,\
     !com.ctc.wstx.*,\
+    !javax.cache.*,\
     !javax.imageio.*,\
     !javax.jws.*,\
-    !javax.net.*,\
     !javax.security.*,\
     !javax.tools.*,\
     !javax.validation.*,\
@@ -37,15 +37,7 @@ Import-Package:\
     !org.springframework.*,\
     *
 
-#Provide-Capability:\
-#    osgi.contract;\
-#        osgi.contract=JavaJAXRS;\
-#            uses:="javax.ws.rs,javax.ws.rs.core,javax.ws.rs.client,javax.ws.rs.container,javax.ws.rs.ext";\
-#            version:Version=2,\
-#    osgi.contract;\
-#        osgi.contract=JavaJSONP;\
-#            uses:="javax.json,javax.json.spi,javax.json.stream";\
-#            version:Version=1
+-contract: JavaJAXRS, JavaServlet
 
 -exportcontents:\
     org.apache.aries.jax.rs.whiteboard,\
@@ -56,6 +48,7 @@ Import-Package:\
     lib/cxf-core.jar=cxf-core-*.jar;lib:=true,\
     lib/cxf-rt-databinding-jaxb.jar=cxf-rt-databinding-jaxb-*.jar;lib:=true,\
     lib/cxf-rt-frontend-jaxrs.jar=cxf-rt-frontend-jaxrs-*.jar;lib:=true,\
+    lib/cxf-rt-rs-client.jar=cxf-rt-rs-client-*.jar;lib:=true,\
     lib/cxf-rt-rs-extension-providers.jar=cxf-rt-rs-extension-providers-*.jar;lib:=true,\
     lib/cxf-rt-transports-http.jar=cxf-rt-transports-http-*.jar;lib:=true,\
     lib/cxf-tools-common.jar=cxf-tools-common-*.jar;lib:=true,\

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/faf6b1f6/jax-rs.whiteboard/pom.xml
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/pom.xml b/jax-rs.whiteboard/pom.xml
index bac9f1f..47b3f1f 100644
--- a/jax-rs.whiteboard/pom.xml
+++ b/jax-rs.whiteboard/pom.xml
@@ -33,44 +33,74 @@
 
     <dependencies>
         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>3.0.1</version>
+            <groupId>org.apache.aries.component-dsl</groupId>
+            <artifactId>org.apache.aries.component-dsl.component-dsl</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.jax.rs</groupId>
+            <artifactId>org.apache.aries.jax.rs.jaxrs.api</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-client</artifactId>
+            <version>${cxf.version}</version>
+            <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.ws.rs</groupId>
+                    <artifactId>javax.ws.rs-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-databinding-jaxb</artifactId>
             <version>${cxf.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-rs-extension-providers</artifactId>
             <version>${cxf.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
             <version>${cxf.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http</artifactId>
             <version>${cxf.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-common</artifactId>
             <version>${cxf.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-validator</artifactId>
             <version>${cxf.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.http.servlet-api</artifactId>
+            <version>1.1.2</version>
         </dependency>
         <dependency>
             <groupId>org.codehaus.jettison</groupId>
             <artifactId>jettison</artifactId>
             <version>1.3.8</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
@@ -84,29 +114,24 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-            <version>5.0.0</version>
+            <artifactId>org.osgi.service.http</artifactId>
+            <version>1.2.1</version>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.jaxrs</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
+            <artifactId>org.osgi.service.http.whiteboard</artifactId>
+            <version>1.0.0</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.http.api</artifactId>
-            <version>3.0.0</version>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.jaxrs</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
             <version>1.7.2</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.aries.component-dsl</groupId>
-            <artifactId>org.apache.aries.component-dsl.component-dsl</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/faf6b1f6/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CXFJaxRsBundleActivator.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CXFJaxRsBundleActivator.java
b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CXFJaxRsBundleActivator.java
index 3546496..0ede97d 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CXFJaxRsBundleActivator.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CXFJaxRsBundleActivator.java
@@ -18,10 +18,12 @@
 package org.apache.aries.jax.rs.whiteboard.activator;
 
 import javax.servlet.Servlet;
+import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.ext.RuntimeDelegate;
 
 import org.apache.aries.jax.rs.whiteboard.internal.CXFJaxRsServiceRegistrator;
+import org.apache.aries.jax.rs.whiteboard.internal.ClientBuilderFactory;
 import org.apache.aries.osgi.functional.OSGi;
 import org.apache.aries.osgi.functional.OSGiResult;
 import org.apache.cxf.Bus;
@@ -57,6 +59,7 @@ public class CXFJaxRsBundleActivator implements BundleActivator {
     private OSGiResult<?> _applicationSingletonsResult;
     private BundleContext _bundleContext;
     private Bus _bus;
+    private ServiceRegistration<ClientBuilder> _clientBuilder;
     private OSGiResult<?> _extensionsResult;
     private OSGiResult<?> _singletonsResult;
 
@@ -121,10 +124,14 @@ public class CXFJaxRsBundleActivator implements BundleActivator {
         );
 
         _singletonsResult = singletons.run(bundleContext);
+
+        _clientBuilder = _bundleContext.registerService(
+            ClientBuilder.class, new ClientBuilderFactory(), null);
     }
 
     @Override
     public void stop(BundleContext context) throws Exception {
+        _clientBuilder.unregister();
         _applicationsResult.close();
         _applicationSingletonsResult.close();
         _extensionsResult.close();

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/faf6b1f6/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/ClientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/ClientBuilderFactory.java
b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/ClientBuilderFactory.java
new file mode 100644
index 0000000..1d5ff81
--- /dev/null
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/ClientBuilderFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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 org.apache.aries.jax.rs.whiteboard.internal;
+
+import javax.ws.rs.client.ClientBuilder;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.PrototypeServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+public class ClientBuilderFactory implements PrototypeServiceFactory<ClientBuilder>
{
+
+    @Override
+    public ClientBuilder getService(Bundle bundle, ServiceRegistration<ClientBuilder>
registration) {
+        return new org.apache.cxf.jaxrs.client.spec.ClientBuilderImpl();
+    }
+
+    @Override
+    public void ungetService(Bundle bundle, ServiceRegistration<ClientBuilder> registration,
ClientBuilder service) {
+    }
+
+}
\ No newline at end of file


Mime
View raw message