cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1519978 - in /cxf/branches/2.7.x-fixes: services/xkms/xkms-client/ services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/ services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/ systests/ws-security/...
Date Wed, 04 Sep 2013 10:47:59 GMT
Author: coheigea
Date: Wed Sep  4 10:47:59 2013
New Revision: 1519978

URL: http://svn.apache.org/r1519978
Log:
Making additional JAXB Context classes available to XKMSInvoker + fixing X509 File handler


Conflicts:
	services/xkms/xkms-client/pom.xml

Modified:
    cxf/branches/2.7.x-fixes/services/xkms/xkms-client/pom.xml
    cxf/branches/2.7.x-fixes/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
    cxf/branches/2.7.x-fixes/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
    cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/xkms-server.xml

Modified: cxf/branches/2.7.x-fixes/services/xkms/xkms-client/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/xkms/xkms-client/pom.xml?rev=1519978&r1=1519977&r2=1519978&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/services/xkms/xkms-client/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/services/xkms/xkms-client/pom.xml Wed Sep  4 10:47:59 2013
@@ -45,9 +45,14 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-           <groupId>net.sf.ehcache</groupId>
-           <artifactId>ehcache-core</artifactId>
-    	   <version>${cxf.ehcache.version}</version>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>net.sf.ehcache</groupId>
+            <artifactId>ehcache-core</artifactId>
+            <version>${cxf.ehcache.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>

Modified: cxf/branches/2.7.x-fixes/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java?rev=1519978&r1=1519977&r2=1519978&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
(original)
+++ cxf/branches/2.7.x-fixes/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/client/XKMSInvoker.java
Wed Sep  4 10:47:59 2013
@@ -26,15 +26,17 @@ import java.security.cert.CertificateFac
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.xkms.exception.ExceptionMapper;
 import org.apache.cxf.xkms.exception.XKMSException;
 import org.apache.cxf.xkms.exception.XKMSLocateException;
@@ -42,6 +44,7 @@ import org.apache.cxf.xkms.exception.XKM
 import org.apache.cxf.xkms.exception.XKMSValidateException;
 import org.apache.cxf.xkms.handlers.Applications;
 import org.apache.cxf.xkms.handlers.XKMSConstants;
+import org.apache.cxf.xkms.model.extensions.ResultDetails;
 import org.apache.cxf.xkms.model.xkms.KeyBindingEnum;
 import org.apache.cxf.xkms.model.xkms.LocateRequestType;
 import org.apache.cxf.xkms.model.xkms.LocateResultType;
@@ -56,7 +59,6 @@ import org.apache.cxf.xkms.model.xmldsig
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3._2002._03.xkms_wsdl.XKMSPortType;
-import org.w3._2002._03.xkms_wsdl.XKMSService;
 
 public class XKMSInvoker {
     private static final Logger LOG = LoggerFactory.getLogger(XKMSInvoker.class);
@@ -81,20 +83,22 @@ public class XKMSInvoker {
     }
     
     public XKMSInvoker(String endpointAddress, Bus bus) {
-        
+
         if (bus != null) {
             SpringBusFactory.setDefaultBus(bus);
             SpringBusFactory.setThreadDefaultBus(bus);
         }
         
-        XKMSService xkmsService = new XKMSService();
-        xkmsConsumer = xkmsService.getPort(XKMSPortType.class);
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(XKMSPortType.class);
+        factory.setAddress(endpointAddress);
         
-        if (endpointAddress != null && !"".equals(endpointAddress)) {
-            ((BindingProvider)xkmsConsumer).getRequestContext().put(
-                BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress
-            );
-        }
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put("jaxb.additionalContextClasses", 
+                       new Class[] {ResultDetails.class});
+        factory.setProperties(properties);
+        
+        xkmsConsumer = (XKMSPortType)factory.create();
     }
     
     public X509Certificate getServiceCertificate(QName serviceName) {

Modified: cxf/branches/2.7.x-fixes/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java?rev=1519978&r1=1519977&r2=1519978&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
(original)
+++ cxf/branches/2.7.x-fixes/services/xkms/xkms-x509-handlers/src/main/java/org/apache/cxf/xkms/x509/repo/file/FileCertificateRepo.java
Wed Sep  4 10:47:59 2013
@@ -215,7 +215,10 @@ public class FileCertificateRepo impleme
             }
 
         }
-        return result.get(0);
+        if (!result.isEmpty()) {
+            return result.get(0);
+        }
+        return null;
     }
 
     @Override
@@ -239,6 +242,9 @@ public class FileCertificateRepo impleme
             }
 
         }
-        return result.get(0);
+        if (!result.isEmpty()) {
+            return result.get(0);
+        }
+        return null;
     }
 }

Modified: cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/xkms-server.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/xkms-server.xml?rev=1519978&r1=1519977&r2=1519978&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/xkms-server.xml
(original)
+++ cxf/branches/2.7.x-fixes/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/xkms/xkms-server.xml
Wed Sep  4 10:47:59 2013
@@ -99,10 +99,18 @@
         </property>
     </bean>
  
+    <bean id="additionalClasses"
+          class="org.apache.cxf.xkms.model.extensions.AdditionalClassesFactory" />
+        
     <jaxws:endpoint id="XKMSService"
         xmlns:serviceNamespace="http://www.w3.org/2002/03/xkms#wsdl"
         serviceName="serviceNamespace:XKMSService" endpointName="serviceNamespace:XKMSPort"
         implementor="#xkmsProviderBean" address="https://localhost:${testutil.ports.XKMSServer}/XKMS">
+        <jaxws:properties>
+            <entry key="jaxb.additionalContextClasses">
+                 <bean factory-bean="additionalClasses" factory-method="create" />
+            </entry>
+        </jaxws:properties>
     </jaxws:endpoint>
     
 </beans>



Mime
View raw message