You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2014/03/21 22:13:38 UTC
[1/3] git commit: Update to the latest Woodstox releases
Repository: cxf
Updated Branches:
refs/heads/2.7.x-fixes 7a4c219fa -> 4399f9286
Update to the latest Woodstox releases
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6bb263b2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6bb263b2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6bb263b2
Branch: refs/heads/2.7.x-fixes
Commit: 6bb263b2f44ed9ab150cb9af4572e172c1b8709e
Parents: 7a4c219
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 21 14:06:20 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 21 17:11:20 2014 -0400
----------------------------------------------------------------------
parent/pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/6bb263b2/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index d5c512c..d084783 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -150,8 +150,8 @@
<cxf.spring.mock>spring-test</cxf.spring.mock>
<cxf.swagger.version>1.3.0</cxf.swagger.version>
<cxf.velocity.version>1.7</cxf.velocity.version>
- <cxf.woodstox.core.version>4.2.0</cxf.woodstox.core.version>
- <cxf.woodstox.stax2-api.version>3.1.1</cxf.woodstox.stax2-api.version>
+ <cxf.woodstox.core.version>4.2.1</cxf.woodstox.core.version>
+ <cxf.woodstox.stax2-api.version>3.1.4</cxf.woodstox.stax2-api.version>
<cxf.wsdl4j.version>1.6.3</cxf.wsdl4j.version>
<cxf.wss4j.version>1.6.14</cxf.wss4j.version>
<cxf.xerces.version>2.11.0</cxf.xerces.version>
[3/3] git commit: Recording .gitmergeinfo Changes
Posted by dk...@apache.org.
Recording .gitmergeinfo Changes
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4399f928
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4399f928
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4399f928
Branch: refs/heads/2.7.x-fixes
Commit: 4399f9286fcb9890230dd2d90976b9eab179560e
Parents: 545a6fc
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 21 17:11:27 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 21 17:11:27 2014 -0400
----------------------------------------------------------------------
.gitmergeinfo | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/4399f928/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 04b21cf..7b8a9be 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -1020,6 +1020,7 @@ M 26fd9b739b9d83c7eb995302a6bff1f66203167b
M 276343f2bbe1daecefcc1c18d5cb5e48b75a90d4
M 276c35ea9bca26339f009cb50b64e54bf563ea4d
M 288f6816795d85804ab5eb13307d49f7b4596554
+M 2ac673f922b01f76055aa329c0bac4b77764d224
M 2b0565d07974a9880c62900dc41b489bb118defa
M 2b33266fd9dc0e0b323fff13ae7bfe2ef3e74135
M 2c0d2a841135f4ae2bcf50920122a8045824d063
@@ -1049,6 +1050,7 @@ M 37e455e3c6f6986099fb05903a25daec8dd9a75b
M 380d4620d613a30ba436c5131065ec2393f7179e
M 38798e5e4da5eb2c8370920602727ccd3286f6b7
M 3889d046ace523adf2e22a0020cc95adbaac560c
+M 391ab2c4655aa7a1b58fa33ee73b90011ae9c1db
M 39e35f4f5b57aabbb7b6e391107ce3787ca34358
M 3aaac231eed2eb123e71afb3d354b1d23169b228
M 3acbca4221ae1d75e31b16ab077a0b8361b4df86
[2/3] git commit: Update the Blueprint parsing for JAXB objects to
allow propertly placeholders.
Posted by dk...@apache.org.
Update the Blueprint parsing for JAXB objects to allow propertly placeholders.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/545a6fca
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/545a6fca
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/545a6fca
Branch: refs/heads/2.7.x-fixes
Commit: 545a6fcaf9d503d4e0b08bb4ce4cba12893b7b2c
Parents: 6bb263b
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Mar 21 17:07:54 2014 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Mar 21 17:11:27 2014 -0400
----------------------------------------------------------------------
.../AbstractBPBeanDefinitionParser.java | 107 ++++++++++++-------
.../blueprint/AuthorizationPolicyHolder.java | 76 -------------
.../http/blueprint/HTTPClientPolicyHolder.java | 99 -----------------
.../http/blueprint/HTTPServerPolicyHolder.java | 86 ---------------
.../transport/http/blueprint/HolderUtils.java | 90 ----------------
.../HttpConduitBPBeanDefinitionParser.java | 23 ++--
.../HttpDestinationBPBeanDefinitionParser.java | 28 +----
.../ProxyAuthorizationPolicyHolder.java | 78 --------------
8 files changed, 87 insertions(+), 500 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java b/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
index f58eada..d2b57de 100644
--- a/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
+++ b/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
@@ -18,15 +18,21 @@
*/
package org.apache.cxf.configuration.blueprint;
+import java.io.StringReader;
+import java.io.StringWriter;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -42,7 +48,6 @@ import org.apache.aries.blueprint.mutable.MutableValueMetadata;
import org.apache.cxf.bus.blueprint.BlueprintBus;
import org.apache.cxf.common.jaxb.JAXBContextCache;
import org.apache.cxf.common.jaxb.JAXBContextCache.CachedContextAndSchemas;
-import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.PackageUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.DOMUtils;
@@ -61,8 +66,6 @@ public abstract class AbstractBPBeanDefinitionParser {
private static final String XMLNS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
private static final String COMPONENT_ID = "component-id";
- private static final Logger LOG = LogUtils.getL7dLogger(AbstractBPBeanDefinitionParser.class);
-
private JAXBContext jaxbContext;
private Set<Class<?>> jaxbClasses;
@@ -321,46 +324,78 @@ public abstract class AbstractBPBeanDefinitionParser {
mapElementToJaxbProperty(ctx, bean, data, propertyName, c);
}
+
+ public static class JAXBBeanFactory {
+ final JAXBContext ctx;
+ final Class<?> cls;
+ public JAXBBeanFactory(JAXBContext c, Class<?> c2) {
+ ctx = c;
+ cls = c2;
+ }
+
+
+ public Object createJAXBBean(String v) {
+ XMLStreamReader reader = StaxUtils.createXMLStreamReader(new StringReader(v));
+ try {
+ return ctx.createUnmarshaller().unmarshal(reader, cls);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ reader.close();
+ } catch (XMLStreamException e) {
+ //ignore
+ }
+ }
+ }
+ }
protected void mapElementToJaxbProperty(ParserContext ctx,
- MutableBeanMetadata bean, Element data,
+ MutableBeanMetadata bean,
+ Element data,
String propertyName,
- Class<?> c) {
+ Class<?> c) {
try {
- Unmarshaller unmarshaller = getContext(c).createUnmarshaller();
- MutablePassThroughMetadata value = ctx.createMetadata(MutablePassThroughMetadata.class);
- value.setObject(unmarshaller.unmarshal(data, c).getValue());
- bean.addProperty(propertyName, value);
+ XMLStreamWriter xmlWriter = null;
+ try {
+ StringWriter writer = new StringWriter();
+ xmlWriter = StaxUtils.createXMLStreamWriter(writer);
+ StaxUtils.copy(data, xmlWriter);
+ xmlWriter.flush();
+
+
+ MutableBeanMetadata factory = ctx.createMetadata(MutableBeanMetadata.class);
+ factory.setClassName(c.getName());
+ factory.setFactoryComponent(createPassThrough(ctx, new JAXBBeanFactory(getContext(c), c)));
+ factory.setFactoryMethod("createJAXBBean");
+ factory.addArgument(createValue(ctx, writer.toString()), String.class.getName(), 0);
+ bean.addProperty(propertyName, factory);
+
+ } catch (Exception ex) {
+ Unmarshaller u = getContext(c).createUnmarshaller();
+ Object obj;
+ if (c != null) {
+ obj = u.unmarshal(data, c);
+ } else {
+ obj = u.unmarshal(data);
+ }
+ if (obj instanceof JAXBElement<?>) {
+ JAXBElement<?> el = (JAXBElement<?>)obj;
+ obj = el.getValue();
+ }
+ if (obj != null) {
+ MutablePassThroughMetadata value = ctx.createMetadata(MutablePassThroughMetadata.class);
+ value.setObject(obj);
+ bean.addProperty(propertyName, value);
+ }
+ } finally {
+ StaxUtils.close(xmlWriter);
+ }
} catch (JAXBException e) {
- LOG.warning("Unable to parse property " + propertyName + " due to " + e);
+ throw new RuntimeException("Could not parse configuration.", e);
}
}
- protected void mapElementToHolder(ParserContext ctx, MutableBeanMetadata bean, Element parent, QName name,
- String propertyName, Class<?> cls) {
- Element data = DOMUtils.getFirstChildWithName(parent, name);
- if (data == null) {
- return;
- }
- MutableBeanMetadata ef = ctx.createMetadata(MutableBeanMetadata.class);
-
- ef.setRuntimeClass(cls);
-
- try {
- // Print the DOM node
-
- String xmlString = StaxUtils.toString(data);
- ef.addProperty("parsedElement", createValue(ctx, xmlString));
- ef.setInitMethod("init");
-
- ef.setActivation(ComponentMetadata.ACTIVATION_EAGER);
- bean.addProperty(propertyName, ef);
-
- } catch (Exception e) {
- throw new RuntimeException("Could not process configuration.", e);
- }
-
- }
protected synchronized JAXBContext getContext(Class<?> cls) {
if (jaxbContext == null || jaxbClasses == null || !jaxbClasses.contains(cls)) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/AuthorizationPolicyHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/AuthorizationPolicyHolder.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/AuthorizationPolicyHolder.java
deleted file mode 100644
index b2100af..0000000
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/AuthorizationPolicyHolder.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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.cxf.transport.http.blueprint;
-
-import java.io.ByteArrayInputStream;
-import java.util.Set;
-import javax.xml.bind.JAXBContext;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Element;
-
-
-import org.apache.cxf.configuration.security.AuthorizationPolicy;
-
-public class AuthorizationPolicyHolder extends AuthorizationPolicy {
-
- private String parsedElement;
- private AuthorizationPolicy authorizationPolicy;
-
- private JAXBContext jaxbContext;
- private Set<Class<?>> jaxbClasses;
-
- public AuthorizationPolicyHolder() {
- }
-
- public void init() {
- try {
-
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true);
-
- Element element = docFactory.newDocumentBuilder()
- .parse(new ByteArrayInputStream(parsedElement.getBytes())).getDocumentElement();
-
- authorizationPolicy = (AuthorizationPolicy)HolderUtils.getJaxbObject(
- element, AuthorizationPolicy.class,
- jaxbContext, jaxbClasses, getClass().getClassLoader());
- this.setAuthorization(authorizationPolicy.getAuthorization());
- this.setAuthorizationType(authorizationPolicy.getAuthorizationType());
- this.setPassword(authorizationPolicy.getPassword());
- this.setUserName(authorizationPolicy.getUserName());
-
- } catch (Exception e) {
- throw new RuntimeException("Could not process configuration.", e);
- }
- }
-
- public void destroy() {
-
- }
-
- public String getParsedElement() {
- return parsedElement;
- }
-
- public void setParsedElement(String parsedElement) {
- this.parsedElement = parsedElement;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPClientPolicyHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPClientPolicyHolder.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPClientPolicyHolder.java
deleted file mode 100644
index a7dd3b9..0000000
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPClientPolicyHolder.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * 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.cxf.transport.http.blueprint;
-
-import java.io.ByteArrayInputStream;
-import java.util.Set;
-import javax.xml.bind.JAXBContext;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
-
-
-public class HTTPClientPolicyHolder extends HTTPClientPolicy {
-
- private String parsedElement;
- private HTTPClientPolicy clientPolicy;
-
- private JAXBContext jaxbContext;
- private Set<Class<?>> jaxbClasses;
-
- public HTTPClientPolicyHolder() {
- }
-
- public void init() {
- try {
-
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true);
-
- Element element = docFactory.newDocumentBuilder()
- .parse(new ByteArrayInputStream(parsedElement.getBytes())).getDocumentElement();
-
- clientPolicy = (HTTPClientPolicy)HolderUtils.getJaxbObject(element, HTTPClientPolicy.class,
- jaxbContext, jaxbClasses, getClass().getClassLoader());
-
- this.setAccept(clientPolicy.getAccept());
- this.setAcceptEncoding(clientPolicy.getAcceptEncoding());
- this.setAcceptLanguage(clientPolicy.getAcceptLanguage());
- this.setAllowChunking(clientPolicy.isAllowChunking());
- this.setAsyncExecuteTimeout(clientPolicy.getAsyncExecuteTimeout());
- this.setAsyncExecuteTimeoutRejection(clientPolicy.isAsyncExecuteTimeoutRejection());
- this.setAutoRedirect(clientPolicy.isAutoRedirect());
- this.setBrowserType(clientPolicy.getBrowserType());
- this.setCacheControl(clientPolicy.getCacheControl());
- this.setChunkingThreshold(clientPolicy.getChunkingThreshold());
- this.setConnection(clientPolicy.getConnection());
- this.setConnectionTimeout(clientPolicy.getConnectionTimeout());
- this.setContentType(clientPolicy.getContentType());
- this.setCookie(clientPolicy.getCookie());
- this.setDecoupledEndpoint(clientPolicy.getDecoupledEndpoint());
- this.setHost(clientPolicy.getHost());
- this.setMaxRetransmits(clientPolicy.getMaxRetransmits());
- this.setNonProxyHosts(clientPolicy.getNonProxyHosts());
- this.setProxyServer(clientPolicy.getProxyServer());
- // need to check if the property is set to avoid NPE
- if (clientPolicy.isSetProxyServerPort()) {
- this.setProxyServerPort(clientPolicy.getProxyServerPort());
- }
- this.setProxyServerType(clientPolicy.getProxyServerType());
- this.setReceiveTimeout(clientPolicy.getReceiveTimeout());
- this.setReferer(clientPolicy.getReferer());
-
- } catch (Exception e) {
- throw new RuntimeException("Could not process configuration.", e);
- }
- }
-
- public void destroy() {
-
- }
-
- public String getParsedElement() {
- return parsedElement;
- }
-
- public void setParsedElement(String parsedElement) {
- this.parsedElement = parsedElement;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPServerPolicyHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPServerPolicyHolder.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPServerPolicyHolder.java
deleted file mode 100644
index 026b6e3..0000000
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HTTPServerPolicyHolder.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * 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.cxf.transport.http.blueprint;
-
-import java.io.ByteArrayInputStream;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
-
-
-public class HTTPServerPolicyHolder extends HTTPServerPolicy {
-
- private String parsedElement;
- private HTTPServerPolicy serverPolicy;
-
- private JAXBContext jaxbContext;
- private Set<Class<?>> jaxbClasses;
-
- public HTTPServerPolicyHolder() {
- }
-
- public void init() {
- try {
-
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true);
-
- Element element = docFactory.newDocumentBuilder()
- .parse(new ByteArrayInputStream(parsedElement.getBytes())).getDocumentElement();
-
- serverPolicy = (HTTPServerPolicy)HolderUtils.getJaxbObject(
- element, HTTPServerPolicy.class,
- jaxbContext, jaxbClasses, getClass().getClassLoader());
- this.setCacheControl(serverPolicy.getCacheControl());
- this.setContentEncoding(serverPolicy.getContentEncoding());
- this.setContentLocation(serverPolicy.getContentLocation());
- this.setContentType(serverPolicy.getContentType());
- this.setHonorKeepAlive(serverPolicy.isHonorKeepAlive());
- this.setKeepAliveParameters(serverPolicy.getKeepAliveParameters());
- this.setReceiveTimeout(serverPolicy.getReceiveTimeout());
- this.setRedirectURL(serverPolicy.getRedirectURL());
- this.setServerType(serverPolicy.getServerType());
- this.setSuppressClientReceiveErrors(serverPolicy.isSuppressClientReceiveErrors());
- this.setSuppressClientSendErrors(serverPolicy.isSuppressClientSendErrors());
-
- } catch (Exception e) {
- throw new RuntimeException("Could not process configuration.", e);
- }
- }
-
- public void destroy() {
-
- }
-
- public String getParsedElement() {
- return parsedElement;
- }
-
- public void setParsedElement(String parsedElement) {
- this.parsedElement = parsedElement;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HolderUtils.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HolderUtils.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HolderUtils.java
deleted file mode 100644
index a6cb06b..0000000
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HolderUtils.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * 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.cxf.transport.http.blueprint;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.common.jaxb.JAXBContextCache;
-import org.apache.cxf.common.util.PackageUtils;
-
-public final class HolderUtils {
-
- private HolderUtils() {
-
- }
-
-
- public static Object getJaxbObject(Element parent, Class<?> c,
- JAXBContext jaxbContext,
- Set<Class<?>> jaxbClasses,
- ClassLoader cl) {
-
- try {
- Unmarshaller umr = getContext(c, jaxbContext, jaxbClasses, cl).createUnmarshaller();
- JAXBElement<?> ele = (JAXBElement<?>) umr.unmarshal(parent, c);
-
- return ele.getValue();
- } catch (JAXBException e) {
- return null;
- }
- }
-
- public static synchronized JAXBContext getContext(Class<?> cls,
- JAXBContext jaxbContext,
- Set<Class<?>> jaxbClasses,
- ClassLoader cl) {
- if (jaxbContext == null || jaxbClasses == null || !jaxbClasses.contains(cls)) {
- try {
- Set<Class<?>> tmp = new HashSet<Class<?>>();
- if (jaxbClasses != null) {
- tmp.addAll(jaxbClasses);
- }
- JAXBContextCache.addPackage(tmp, PackageUtils.getPackageName(cls),
- cls == null ? cl : cls.getClassLoader());
- if (cls != null) {
- boolean hasOf = false;
- for (Class<?> c : tmp) {
- if (c.getPackage() == cls.getPackage() && "ObjectFactory".equals(c.getSimpleName())) {
- hasOf = true;
- }
- }
- if (!hasOf) {
- tmp.add(cls);
- }
- }
- JAXBContextCache.scanPackages(tmp);
- JAXBContextCache.CachedContextAndSchemas ccs
- = JAXBContextCache.getCachedContextAndSchemas(tmp, null, null, null, false);
- jaxbClasses = ccs.getClasses();
- jaxbContext = ccs.getContext();
- } catch (JAXBException e) {
- throw new RuntimeException(e);
- }
- }
- return jaxbContext;
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
index db8c285..4e51e44 100755
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpConduitBPBeanDefinitionParser.java
@@ -19,7 +19,6 @@
package org.apache.cxf.transport.http.blueprint;
-import javax.xml.namespace.QName;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
@@ -30,21 +29,22 @@ import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser;
import org.apache.cxf.configuration.jsse.TLSClientParametersConfig;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
import org.apache.cxf.configuration.security.CertificateConstraintsType;
import org.apache.cxf.configuration.security.CipherSuites;
import org.apache.cxf.configuration.security.FiltersType;
import org.apache.cxf.configuration.security.KeyManagersType;
+import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
import org.apache.cxf.configuration.security.SecureRandomParameters;
import org.apache.cxf.configuration.security.TLSClientParametersType;
import org.apache.cxf.configuration.security.TrustManagersType;
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;
public class HttpConduitBPBeanDefinitionParser extends AbstractBPBeanDefinitionParser {
- private static final String HTTP_NS =
- "http://cxf.apache.org/transports/http/configuration";
private static final String SECURITY_NS =
"http://cxf.apache.org/configuration/security";
@@ -52,14 +52,6 @@ public class HttpConduitBPBeanDefinitionParser extends AbstractBPBeanDefinitionP
MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class);
bean.setRuntimeClass(HTTPConduit.class);
-
- mapElementToHolder(context, bean, element,
- new QName(HTTP_NS, "client"), "client", HTTPClientPolicyHolder.class);
- mapElementToHolder(context, bean, element,
- new QName(HTTP_NS, "proxyAuthorization"), "proxyAuthorization",
- ProxyAuthorizationPolicyHolder.class);
- mapElementToHolder(context, bean, element,
- new QName(HTTP_NS, "authorization"), "authorization", AuthorizationPolicyHolder.class);
parseAttributes(element, context, bean);
parseChildElements(element, context, bean);
@@ -84,6 +76,15 @@ public class HttpConduitBPBeanDefinitionParser extends AbstractBPBeanDefinitionP
mapBeanOrClassElement(ctx, bean, el, MessageTrustDecider.class);
} else if ("authSupplier".equals(name)) {
mapBeanOrClassElement(ctx, bean, el, HttpAuthSupplier.class);
+ } else if ("client".equals(name)) {
+ mapElementToJaxbProperty(ctx, bean, el, name,
+ HTTPClientPolicy.class);
+ } else if ("proxyAuthorization".equals(name)) {
+ mapElementToJaxbProperty(ctx, bean, el, name,
+ ProxyAuthorizationPolicy.class);
+ } else if ("authorization".equals(name)) {
+ mapElementToJaxbProperty(ctx, bean, el, name,
+ AuthorizationPolicy.class);
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpDestinationBPBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpDestinationBPBeanDefinitionParser.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpDestinationBPBeanDefinitionParser.java
index e0004fc..b0371e6 100755
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpDestinationBPBeanDefinitionParser.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/HttpDestinationBPBeanDefinitionParser.java
@@ -19,24 +19,19 @@
package org.apache.cxf.transport.http.blueprint;
-import java.util.logging.Logger;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
import org.apache.aries.blueprint.ParserContext;
import org.apache.aries.blueprint.mutable.MutableBeanMetadata;
-import org.apache.aries.blueprint.mutable.MutableValueMetadata;
-import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.configuration.blueprint.AbstractBPBeanDefinitionParser;
import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
import org.osgi.service.blueprint.reflect.Metadata;
public class HttpDestinationBPBeanDefinitionParser extends AbstractBPBeanDefinitionParser {
- private static final Logger LOG = LogUtils.getL7dLogger(HttpDestinationBPBeanDefinitionParser.class);
private static final String HTTP_NS =
"http://cxf.apache.org/transports/http/configuration";
@@ -46,8 +41,8 @@ public class HttpDestinationBPBeanDefinitionParser extends AbstractBPBeanDefinit
bean.setRuntimeClass(AbstractHTTPDestination.class);
- mapElementToHolder(context, bean, element, new QName(HTTP_NS, "server"), "server",
- HTTPServerPolicyHolder.class);
+ mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "server"), "server",
+ HTTPServerPolicy.class);
mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "fixedParameterOrder"),
"fixedParameterOrder", Boolean.class);
mapElementToJaxbProperty(context, bean, element, new QName(HTTP_NS, "contextMatchStrategy"),
@@ -66,21 +61,6 @@ public class HttpDestinationBPBeanDefinitionParser extends AbstractBPBeanDefinit
String val) {
bean.setId(val);
}
-
- @Override
- protected void mapElementToJaxbProperty(ParserContext ctx,
- MutableBeanMetadata bean, Element data,
- String propertyName,
- Class<?> c) {
- try {
- Unmarshaller unmarshaller = getContext(c).createUnmarshaller();
- MutableValueMetadata value = ctx.createMetadata(MutableValueMetadata.class);
- value.setStringValue(unmarshaller.unmarshal(data, c).getValue().toString());
- bean.addProperty(propertyName, value);
- } catch (JAXBException e) {
- LOG.warning("Unable to parse property " + propertyName + " due to " + e);
- }
- }
-
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/545a6fca/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/ProxyAuthorizationPolicyHolder.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/ProxyAuthorizationPolicyHolder.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/ProxyAuthorizationPolicyHolder.java
deleted file mode 100644
index 1978644..0000000
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/blueprint/ProxyAuthorizationPolicyHolder.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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.cxf.transport.http.blueprint;
-
-import java.io.ByteArrayInputStream;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
-
-public class ProxyAuthorizationPolicyHolder extends ProxyAuthorizationPolicy {
-
- private String parsedElement;
- private ProxyAuthorizationPolicy proxyAuthorizationPolicy;
-
- private JAXBContext jaxbContext;
- private Set<Class<?>> jaxbClasses;
-
- public ProxyAuthorizationPolicyHolder() {
- }
-
- public void init() {
- try {
-
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true);
-
- Element element = docFactory.newDocumentBuilder()
- .parse(new ByteArrayInputStream(parsedElement.getBytes())).getDocumentElement();
-
- proxyAuthorizationPolicy = (ProxyAuthorizationPolicy)HolderUtils.getJaxbObject(
- element, ProxyAuthorizationPolicy.class,
- jaxbContext, jaxbClasses, getClass().getClassLoader());
- this.setAuthorization(proxyAuthorizationPolicy.getAuthorization());
- this.setAuthorizationType(proxyAuthorizationPolicy.getAuthorizationType());
- this.setPassword(proxyAuthorizationPolicy.getPassword());
- this.setUserName(proxyAuthorizationPolicy.getUserName());
-
- } catch (Exception e) {
- throw new RuntimeException("Could not process configuration.", e);
- }
- }
-
- public void destroy() {
-
- }
-
- public String getParsedElement() {
- return parsedElement;
- }
-
- public void setParsedElement(String parsedElement) {
- this.parsedElement = parsedElement;
- }
-
-
-
-}