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:21 UTC

[8/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/d4228467
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d4228467
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d4228467

Branch: refs/heads/master
Commit: d4228467a5b2d5cea4bcbd926df5a950f6c0b59b
Parents: 73e4631
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 24 13:37:22 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Sep 24 13:37:22 2015 +0200

----------------------------------------------------------------------
 .../src/main/java/__name__DataFormat.java             | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d4228467/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 857be28..84cd2f8 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,12 +21,13 @@ import java.io.OutputStream;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.spi.DataFormat;
+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 implements DataFormat {
+public class ${name}DataFormat extends ServiceSupport implements DataFormat {
 
     public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
         byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, graph);
@@ -37,4 +38,15 @@ public class ${name}DataFormat implements DataFormat {
         byte[] bytes = exchange.getContext().getTypeConverter().mandatoryConvertTo(byte[].class, stream);
         return bytes;
     }
+
+    @Override
+    protected void doStart() throws Exception {
+        // init logic here
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        // cleanup logic here
+    }
+
 }