You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/09/24 13:36:19 UTC
[6/8] camel git commit: CAMEL-9157: JMX - Add dataformat as mbean
category
CAMEL-9157: JMX - Add dataformat as mbean category
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4c650d4c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4c650d4c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4c650d4c
Branch: refs/heads/master
Commit: 4c650d4c4d5dfb15318495fcf6ef3be8c18eafab
Parents: 9765d56
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 24 13:31:58 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Sep 24 13:31:58 2015 +0200
----------------------------------------------------------------------
.../univocity/AbstractUniVocityDataFormat.java | 14 +++++++++++++-
.../converter/xmlbeans/XmlBeansDataFormat.java | 14 +++++++++++++-
.../camel/dataformat/xmlrpc/XmlRpcDataFormat.java | 14 ++++++++++++--
.../xmlsecurity/XMLSecurityDataFormat.java | 16 +++++++++++++---
4 files changed, 51 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/4c650d4c/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
index b5d6959..f459377 100644
--- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
+++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java
@@ -31,6 +31,7 @@ import com.univocity.parsers.common.CommonWriterSettings;
import com.univocity.parsers.common.Format;
import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
+import org.apache.camel.support.ServiceSupport;
import static org.apache.camel.util.IOHelper.getCharsetName;
@@ -48,7 +49,8 @@ import static org.apache.camel.util.IOHelper.getCharsetName;
* @param <DF> the data format class (for providing a fluent API)
*/
public abstract class AbstractUniVocityDataFormat<F extends Format, CWS extends CommonWriterSettings<F>,
- W extends AbstractWriter<CWS>, CPS extends CommonParserSettings<F>, P extends AbstractParser<CPS>, DF extends AbstractUniVocityDataFormat<F, CWS, W, CPS, P, DF>> implements DataFormat {
+ W extends AbstractWriter<CWS>, CPS extends CommonParserSettings<F>, P extends AbstractParser<CPS>, DF extends AbstractUniVocityDataFormat<F, CWS, W, CPS, P, DF>>
+ extends ServiceSupport implements DataFormat {
protected String nullValue;
protected Boolean skipEmptyLines;
protected Boolean ignoreTrailingWhitespaces;
@@ -615,4 +617,14 @@ public abstract class AbstractUniVocityDataFormat<F extends Format, CWS extends
private DF self() {
return (DF) this;
}
+
+ @Override
+ protected void doStart() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ // noop
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/4c650d4c/components/camel-xmlbeans/src/main/java/org/apache/camel/converter/xmlbeans/XmlBeansDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlbeans/src/main/java/org/apache/camel/converter/xmlbeans/XmlBeansDataFormat.java b/components/camel-xmlbeans/src/main/java/org/apache/camel/converter/xmlbeans/XmlBeansDataFormat.java
index 41dd0ff..a357fc5 100644
--- a/components/camel-xmlbeans/src/main/java/org/apache/camel/converter/xmlbeans/XmlBeansDataFormat.java
+++ b/components/camel-xmlbeans/src/main/java/org/apache/camel/converter/xmlbeans/XmlBeansDataFormat.java
@@ -22,6 +22,7 @@ import java.util.concurrent.Callable;
import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
+import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.xmlbeans.XmlObject;
@@ -30,7 +31,7 @@ import org.apache.xmlbeans.XmlObject;
* A <a href="http://camel.apache.org/data-format.html">data format</a>
* ({@link DataFormat}) using XmlBeans to marshal to and from XML
*/
-public class XmlBeansDataFormat implements DataFormat {
+public class XmlBeansDataFormat extends ServiceSupport implements DataFormat {
public void marshal(final Exchange exchange, final Object body, final OutputStream stream) throws Exception {
ObjectHelper.callWithTCCL(new Callable<Void>() {
@@ -52,4 +53,15 @@ public class XmlBeansDataFormat implements DataFormat {
}
}, exchange);
}
+
+ @Override
+ protected void doStart() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ // noop
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/4c650d4c/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 b94db64..1e2be5a 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
@@ -23,6 +23,7 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
+import org.apache.camel.support.ServiceSupport;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@ -45,7 +46,7 @@ import org.apache.xmlrpc.parser.XmlRpcRequestParser;
import org.apache.xmlrpc.parser.XmlRpcResponseParser;
import org.apache.xmlrpc.util.SAXParsers;
-public class XmlRpcDataFormat implements DataFormat {
+public class XmlRpcDataFormat extends ServiceSupport implements DataFormat {
private XmlRpcStreamRequestConfig xmlRpcStreamRequestConfig = new XmlRpcHttpRequestConfigImpl();
private TypeFactory typeFactory = new TypeFactoryImpl(null);
private boolean isRequest;
@@ -76,7 +77,6 @@ public class XmlRpcDataFormat implements DataFormat {
// TODO write the fault message here
writer.write(xmlRpcStreamRequestConfig, graph);
}
-
}
protected int getErrorCode(Exchange exchange) {
@@ -167,4 +167,14 @@ public class XmlRpcDataFormat implements DataFormat {
return typeFactory;
}
+ @Override
+ protected void doStart() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ // noop
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/4c650d4c/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
index dc0713f..b7eed69 100755
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityDataFormat.java
@@ -40,6 +40,7 @@ import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.transform.dom.DOMSource;
+import org.apache.camel.support.ServiceSupport;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -65,7 +66,7 @@ import org.slf4j.LoggerFactory;
-public class XMLSecurityDataFormat implements DataFormat, CamelContextAware {
+public class XMLSecurityDataFormat extends ServiceSupport implements DataFormat, CamelContextAware {
/**
* @deprecated Use {@link #XMLSecurityDataFormat(String, Map, boolean, String, String, String, KeyStoreParameters)} instead.
@@ -368,7 +369,6 @@ public class XMLSecurityDataFormat implements DataFormat, CamelContextAware {
this.camelContext = camelContext;
try {
setDefaultsFromContext(camelContext);
-
} catch (Exception e) {
throw new IllegalStateException("Could not initialize XMLSecurityDataFormat with camelContext. ", e);
}
@@ -378,7 +378,17 @@ public class XMLSecurityDataFormat implements DataFormat, CamelContextAware {
public CamelContext getCamelContext() {
return camelContext;
}
-
+
+ @Override
+ protected void doStart() throws Exception {
+ // noop
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ // noop
+ }
+
/**
* Sets missing properties that are defined in the Camel context.
* @deprecated this operation populates the data format using depreciated properties and will be