Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-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 8D0581093B for ; Wed, 9 Oct 2013 04:28:22 +0000 (UTC) Received: (qmail 94368 invoked by uid 500); 9 Oct 2013 04:27:49 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 94030 invoked by uid 500); 9 Oct 2013 04:27:31 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 93889 invoked by uid 99); 9 Oct 2013 04:27:19 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Oct 2013 04:27:19 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 62FF68B2A41; Wed, 9 Oct 2013 04:27:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Wed, 09 Oct 2013 04:27:22 -0000 Message-Id: <288df041911b4bcea31888cdc3f177f8@git.apache.org> In-Reply-To: <40f852237eda4992bbc9f32b0cbcb18e@git.apache.org> References: <40f852237eda4992bbc9f32b0cbcb18e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [6/8] git commit: CAMEL-6842 XmlRpcDataFormat should support to access XmlRpcStreamRequestConfig and TypeFactory CAMEL-6842 XmlRpcDataFormat should support to access XmlRpcStreamRequestConfig and TypeFactory Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0a803b96 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0a803b96 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0a803b96 Branch: refs/heads/camel-2.12.x Commit: 0a803b960cab04c45d45fc1f9ac5f62278557404 Parents: b089ac6 Author: Willem Jiang Authored: Wed Oct 9 11:47:37 2013 +0800 Committer: Willem Jiang Committed: Wed Oct 9 11:55:33 2013 +0800 ---------------------------------------------------------------------- .../dataformat/xmlrpc/XmlRpcDataFormat.java | 29 +++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0a803b96/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java b/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java index 471ea38..b94db64 100644 --- a/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java +++ b/components/camel-xmlrpc/src/main/java/org/apache/camel/dataformat/xmlrpc/XmlRpcDataFormat.java @@ -46,11 +46,10 @@ import org.apache.xmlrpc.parser.XmlRpcResponseParser; import org.apache.xmlrpc.util.SAXParsers; public class XmlRpcDataFormat implements DataFormat { - private XmlRpcStreamRequestConfig config = new XmlRpcHttpRequestConfigImpl(); + private XmlRpcStreamRequestConfig xmlRpcStreamRequestConfig = new XmlRpcHttpRequestConfigImpl(); private TypeFactory typeFactory = new TypeFactoryImpl(null); private boolean isRequest; - protected XMLWriter getXMLWriter(Exchange exchange, OutputStream outputStream) throws XmlRpcException { XMLWriter writer = new CharSetXMLWriter(); String encoding = IOHelper.getCharsetName(exchange); @@ -69,13 +68,13 @@ public class XmlRpcDataFormat implements DataFormat { public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception { // need to check the object type XMLWriter control = getXMLWriter(exchange, stream); - XmlRpcWriter writer = new XmlRpcWriter(config, control, typeFactory); + XmlRpcWriter writer = new XmlRpcWriter(xmlRpcStreamRequestConfig, control, typeFactory); if (graph instanceof XmlRpcRequest) { - writer.writeRequest(config, (XmlRpcRequest)graph); + writer.writeRequest(xmlRpcStreamRequestConfig, (XmlRpcRequest)graph); } else { // write the result here directly // TODO write the fault message here - writer.write(config, graph); + writer.write(xmlRpcStreamRequestConfig, graph); } } @@ -98,7 +97,7 @@ public class XmlRpcDataFormat implements DataFormat { XMLReader xr = newXMLReader(); XmlRpcResponseParser xp; try { - xp = new XmlRpcResponseParser(config, typeFactory); + xp = new XmlRpcResponseParser(xmlRpcStreamRequestConfig, typeFactory); xr.setContentHandler(xp); xr.parse(isource); } catch (SAXException e) { @@ -128,7 +127,7 @@ public class XmlRpcDataFormat implements DataFormat { XMLReader xr = newXMLReader(); XmlRpcRequestParser xp; try { - xp = new XmlRpcRequestParser(config, typeFactory); + xp = new XmlRpcRequestParser(xmlRpcStreamRequestConfig, typeFactory); xr.setContentHandler(xp); xr.parse(isource); } catch (SAXException e) { @@ -151,5 +150,21 @@ public class XmlRpcDataFormat implements DataFormat { public void setRequest(boolean isRequest) { this.isRequest = isRequest; } + + public void setXmlRpcStreamRequestConfig(XmlRpcStreamRequestConfig config) { + this.xmlRpcStreamRequestConfig = config; + } + + public XmlRpcStreamRequestConfig getXmlRpcStreamRequestConfig() { + return xmlRpcStreamRequestConfig; + } + + public void setTypeFactory(TypeFactory typeFactory) { + this.typeFactory = typeFactory; + } + + public TypeFactory getTypeFactory() { + return typeFactory; + } }