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/25 11:12:35 UTC
[4/4] camel git commit: CAMEL-9157: JMX - Add explain to data format
so we can know how exactly they are configured at runtime
CAMEL-9157: JMX - Add explain to data format so we can know how exactly they are configured at runtime
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8ee52c74
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8ee52c74
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8ee52c74
Branch: refs/heads/master
Commit: 8ee52c74402ee1fa157bdd7616c18a064d3e85dd
Parents: d6ecb59
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Sep 25 11:14:05 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Sep 25 11:14:05 2015 +0200
----------------------------------------------------------------------
.../src/main/java/__name__DataFormat.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8ee52c74/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/main/java/__name__DataFormat.java
----------------------------------------------------------------------
diff --git a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/main/java/__name__DataFormat.java b/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/main/java/__name__DataFormat.java
index 84cd2f8..97d3b92 100644
--- a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/main/java/__name__DataFormat.java
+++ b/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/main/java/__name__DataFormat.java
@@ -21,20 +21,27 @@ import java.io.OutputStream;
import org.apache.camel.Exchange;
import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatName;
import org.apache.camel.support.ServiceSupport;
/**
* A <a href="http://camel.apache.org/data-format.html">data format</a> ({@link DataFormat})
* for ${name} data.
*/
-public class ${name}DataFormat extends ServiceSupport implements DataFormat {
+public class ${name}DataFormat extends ServiceSupport implements DataFormat, DataFormatName {
+
+ public String getDataFormatName() {
+ return "${scheme}";
+ }
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
+ // marshal from the Java object (graph) to the ${scheme} type
byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, graph);
stream.write(bytes);
}
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+ // unmarshal from the input stream of ${scheme} to Java object (graph)
byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, stream);
return bytes;
}