Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AECBD99FB for ; Mon, 27 Feb 2012 15:46:38 +0000 (UTC) Received: (qmail 63244 invoked by uid 500); 27 Feb 2012 15:46:38 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 63188 invoked by uid 500); 27 Feb 2012 15:46:38 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 63179 invoked by uid 99); 27 Feb 2012 15:46:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 15:46:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2012 15:46:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 36B9123888D2; Mon, 27 Feb 2012 15:46:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1294190 - in /cxf/branches/2.5.x-fixes: ./ api/src/main/resources/schemas/configuration/security.xsd rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java Date: Mon, 27 Feb 2012 15:46:14 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120227154614.36B9123888D2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Mon Feb 27 15:46:13 2012 New Revision: 1294190 URL: http://svn.apache.org/viewvc?rev=1294190&view=rev Log: Merged revisions 1294188 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1294188 | ay | 2012-02-27 16:41:02 +0100 (Mon, 27 Feb 2012) | 1 line [CXF-4084] Blueprint (part 2 HTTPConduit) ........ Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Feb 27 15:46:13 2012 @@ -1 +1 @@ -/cxf/trunk:1291943,1292763,1292792,1292839,1293064,1293255,1293326,1293413,1293546 +/cxf/trunk:1291943,1292763,1292792,1292839,1293064,1293255,1293326,1293413,1293546,1294188 Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd?rev=1294190&r1=1294189&r2=1294190&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd (original) +++ cxf/branches/2.5.x-fixes/api/src/main/resources/schemas/configuration/security.xsd Mon Feb 27 15:46:13 2012 @@ -24,16 +24,10 @@ attributeFormDefault="unqualified" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:tns="http://cxf.apache.org/configuration/security" - xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pt="http://cxf.apache.org/configuration/parameterized-types" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd" jaxb:version="2.0"> - - Modified: cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java?rev=1294190&r1=1294189&r2=1294190&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java (original) +++ cxf/branches/2.5.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java Mon Feb 27 15:46:13 2012 @@ -19,17 +19,25 @@ package org.apache.cxf.transport.http.blueprint; +import java.io.StringWriter; + import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; import org.w3c.dom.Element; import org.apache.aries.blueprint.ParserContext; import org.apache.aries.blueprint.mutable.MutableBeanMetadata; +import org.apache.aries.blueprint.mutable.MutablePassThroughMetadata; import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser; -import org.apache.cxf.configuration.jsse.TLSClientParameters; +import org.apache.cxf.configuration.jsse.spring.TLSClientParametersConfig; import org.apache.cxf.configuration.security.AuthorizationPolicy; import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy; +import org.apache.cxf.staxutils.StaxUtils; import org.apache.cxf.transport.http.HTTPConduit; +import org.apache.cxf.transport.http.MessageTrustDecider; +import org.apache.cxf.transport.http.auth.HttpAuthSupplier; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.osgi.service.blueprint.reflect.Metadata; @@ -50,11 +58,6 @@ public class HttpConduitBPBeanDefinition mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "authorization"), "authorization", AuthorizationPolicy.class); - mapElementToJaxbProperty(context, bean, element, - new QName(HTTP_NS, "tlsClientParameters"), "tlsClientParameters", TLSClientParameters.class); - - //TODO handle those bean/ref dual entries (basicAuthSupplier and trustDecider) - parseAttributes(element, context, bean); parseChildElements(element, context, bean); @@ -68,4 +71,43 @@ public class HttpConduitBPBeanDefinition String val) { bean.setId(val); } + + @Override + protected void mapElement(ParserContext ctx, MutableBeanMetadata bean, Element el, String name) { + if ("tlsClientParameters".equals(name)) { + mapTLSClientParameters(ctx, bean, el); + } else if ("trustDecider".equals(name)) { + mapBeanOrClassElement(ctx, bean, el, MessageTrustDecider.class); + } else if ("authSupplier".equals(name)) { + mapBeanOrClassElement(ctx, bean, el, HttpAuthSupplier.class); + } + } + + private void mapTLSClientParameters(ParserContext ctx, MutableBeanMetadata bean, Element el) { + StringWriter writer = new StringWriter(); + XMLStreamWriter xmlWriter = StaxUtils.createXMLStreamWriter(writer); + try { + StaxUtils.copy(el, xmlWriter); + xmlWriter.flush(); + } catch (XMLStreamException e) { + throw new RuntimeException(e); + } + Object v = TLSClientParametersConfig.createTLSClientParameters(writer.toString()); + MutablePassThroughMetadata value = ctx.createMetadata(MutablePassThroughMetadata.class); + value.setObject(v); + bean.addProperty("tlsClientParameters", value); + } + + + private void mapBeanOrClassElement(ParserContext ctx, MutableBeanMetadata bean, Element el, + Class cls) { + String elementName = el.getLocalName(); + String classProperty = el.getAttribute("class"); + String beanref = el.getAttribute("bean"); + if (classProperty != null && !classProperty.equals("")) { + bean.addProperty(elementName, createObjectOfClass(ctx, classProperty)); + } else if (beanref != null && !beanref.equals("")) { + bean.addProperty(elementName, createRef(ctx, beanref)); + } + } }