You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by va...@apache.org on 2013/05/03 21:16:31 UTC

git commit: - unit test adedd. - some Javadocs added. - Missing Apache license headers added.

Updated Branches:
  refs/heads/master b24164026 -> b24cd01cc


- unit test adedd.
- some Javadocs added.
- Missing Apache license headers added.


Project: http://git-wip-us.apache.org/repos/asf/ode-jacob/repo
Commit: http://git-wip-us.apache.org/repos/asf/ode-jacob/commit/b24cd01c
Tree: http://git-wip-us.apache.org/repos/asf/ode-jacob/tree/b24cd01c
Diff: http://git-wip-us.apache.org/repos/asf/ode-jacob/diff/b24cd01c

Branch: refs/heads/master
Commit: b24cd01cc70e143357a2a30ebcbc9a9672d9e35a
Parents: b241640
Author: Tammo van Lessen <tv...@gmail.com>
Authored: Fri May 3 21:16:07 2013 +0200
Committer: Tammo van Lessen <tv...@gmail.com>
Committed: Fri May 3 21:16:07 2013 +0200

----------------------------------------------------------------------
 .../soup/jackson/ChannelProxyDeserializer.java     |    7 ++++
 .../jacob/soup/jackson/ChannelProxySerializer.java |    9 +++++
 .../soup/jackson/ContinuationDeserializer.java     |    6 +++
 .../jacob/soup/jackson/ContinuationSerializer.java |    6 +++
 .../soup/jackson/JacksonExecutionQueueImpl.java    |    3 ++
 .../JacobJacksonAnnotationIntrospector.java        |   25 +++++++++++++++
 .../apache/ode/jacob/soup/jackson/JacobModule.java |   25 +++++++++++++++
 .../soup/jackson/JacobTypeResolverBuilder.java     |    8 +++++
 .../ode/jacob/soup/jackson/NullJsonGenerator.java  |   20 +++++++++++-
 .../ode/jacob/examples/helloworld/HelloWorld.java  |   10 +++--
 10 files changed, 114 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxyDeserializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxyDeserializer.java b/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxyDeserializer.java
index 069882b..dc4b5f3 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxyDeserializer.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxyDeserializer.java
@@ -30,6 +30,13 @@ import com.fasterxml.jackson.core.JsonToken;
 import com.fasterxml.jackson.databind.DeserializationContext;
 import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
 
+/**
+ * Jackson deserializer for Channels.
+ * Creates ChannelProxy instances based on channel id and channel type.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class ChannelProxyDeserializer extends StdDeserializer<Channel> {
 
     private static final long serialVersionUID = 1L;

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxySerializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxySerializer.java b/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxySerializer.java
index a3cee06..133b189 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxySerializer.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/ChannelProxySerializer.java
@@ -34,6 +34,15 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
 import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 
+/**
+ * Jackson serializer for Channel Proxies.
+ * Serializes only channel id and channel type. Also keeps a
+ * list of serialized channels, which is needed for the garbage
+ * collection of unused channels in the ExecutionQueue serializer.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class ChannelProxySerializer extends StdSerializer<ChannelProxy>{
 
     private final Set<Integer> serializedChannels = new LinkedHashSet<Integer>();

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationDeserializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationDeserializer.java b/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationDeserializer.java
index bd72203..10a0a39 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationDeserializer.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationDeserializer.java
@@ -29,6 +29,12 @@ import com.fasterxml.jackson.core.JsonToken;
 import com.fasterxml.jackson.databind.DeserializationContext;
 import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
 
+/**
+ * Jackson deserializer for Continuation objects.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class ContinuationDeserializer extends StdDeserializer<Continuation> {
 
 	private static final long serialVersionUID = 1L;

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationSerializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationSerializer.java b/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationSerializer.java
index 594135a..80aaa9b 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationSerializer.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationSerializer.java
@@ -29,6 +29,12 @@ import com.fasterxml.jackson.databind.SerializerProvider;
 import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 
+/**
+ * Jackson serializer for Continuation objects.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class ContinuationSerializer extends StdSerializer<Continuation> {
 
     public ContinuationSerializer() {

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/JacksonExecutionQueueImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/JacksonExecutionQueueImpl.java b/src/main/java/org/apache/ode/jacob/soup/jackson/JacksonExecutionQueueImpl.java
index 3658a98..c3d100d 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/JacksonExecutionQueueImpl.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/JacksonExecutionQueueImpl.java
@@ -45,6 +45,9 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 /**
  * Variant of {@link org.apache.ode.jacob.vpu.ExecutionQueueImpl} that can be
  * serialized and deserialized with Jackson.
+ * 
+ * @author Tammo van Lessen
+ * 
  */
 public class JacksonExecutionQueueImpl extends ExecutionQueueImpl {
 

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/JacobJacksonAnnotationIntrospector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/JacobJacksonAnnotationIntrospector.java b/src/main/java/org/apache/ode/jacob/soup/jackson/JacobJacksonAnnotationIntrospector.java
index f3c16b6..2256537 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/JacobJacksonAnnotationIntrospector.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/JacobJacksonAnnotationIntrospector.java
@@ -1,3 +1,21 @@
+/*
+ * 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.ode.jacob.soup.jackson;
 
 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
@@ -12,6 +30,13 @@ import com.fasterxml.jackson.databind.introspect.ObjectIdInfo;
 import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
 import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
 
+/**
+ * Customized JacksonAnnotationIntrospector that configures Jackson
+ * to deal with some specialties of Jacob's execution queue.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class JacobJacksonAnnotationIntrospector extends
         JacksonAnnotationIntrospector {
 

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/JacobModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/JacobModule.java b/src/main/java/org/apache/ode/jacob/soup/jackson/JacobModule.java
index 52c3541..e71f26f 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/JacobModule.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/JacobModule.java
@@ -1,3 +1,21 @@
+/*
+ * 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.ode.jacob.soup.jackson;
 
 import org.apache.ode.jacob.Channel;
@@ -13,6 +31,13 @@ import com.fasterxml.jackson.databind.JsonDeserializer;
 import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
 import com.fasterxml.jackson.databind.module.SimpleModule;
 
+/**
+ * Jackson Module that can be registered to configure a Jackson ObjectMapper
+ * for serialization/deserialization of ExecutionQueues.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class JacobModule extends SimpleModule {
 
     private static final long serialVersionUID = 1L;

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/JacobTypeResolverBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/JacobTypeResolverBuilder.java b/src/main/java/org/apache/ode/jacob/soup/jackson/JacobTypeResolverBuilder.java
index 8a14a71..c2b2181 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/JacobTypeResolverBuilder.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/JacobTypeResolverBuilder.java
@@ -39,8 +39,16 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
 import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver;
 import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder;
 import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase;
+
 import com.fasterxml.jackson.databind.type.TypeFactory;
 
+/**
+ * Customized StdTypeResolverBuilder that enables a custom type id resolving
+ * mechanism for Channels.
+ * 
+ * @author Tammo van Lessen
+ *
+ */
 public class JacobTypeResolverBuilder extends StdTypeResolverBuilder {
 
     public JacobTypeResolverBuilder() {

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/main/java/org/apache/ode/jacob/soup/jackson/NullJsonGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ode/jacob/soup/jackson/NullJsonGenerator.java b/src/main/java/org/apache/ode/jacob/soup/jackson/NullJsonGenerator.java
index 08cd96a..e41ae37 100644
--- a/src/main/java/org/apache/ode/jacob/soup/jackson/NullJsonGenerator.java
+++ b/src/main/java/org/apache/ode/jacob/soup/jackson/NullJsonGenerator.java
@@ -1,3 +1,21 @@
+/*
+ * 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.ode.jacob.soup.jackson;
 
 import java.io.IOException;
@@ -13,7 +31,7 @@ import com.fasterxml.jackson.core.json.JsonGeneratorImpl;
 /**
  * No-op Json generator.
  * 
- * @author vanto
+ * @author Tammo van Lessen
  *
  */
 public class NullJsonGenerator extends JsonGeneratorImpl {

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b24cd01c/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java b/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java
index ece6ca8..3d21c4f 100644
--- a/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java
+++ b/src/test/java/org/apache/ode/jacob/examples/helloworld/HelloWorld.java
@@ -40,6 +40,8 @@ import com.fasterxml.jackson.dataformat.smile.SmileFactory;
  * 
  * Inspired by http://scienceblogs.com/goodmath/2007/04/16/back-to-calculus-a-better-intr-1/
  * 
+ * @author Tammo van Lessen
+ * 
  */
 @SuppressWarnings("serial")
 public class HelloWorld extends JacobRunnable {
@@ -163,7 +165,7 @@ public class HelloWorld extends JacobRunnable {
 
     }
 
-    private void simpleHelloWorld() {
+    protected void simpleHelloWorld() {
         // new(out)
         final Val out = newChannel(Val.class, "simpleHelloWorld-out");
         // new(x)
@@ -178,7 +180,7 @@ public class HelloWorld extends JacobRunnable {
         instance(new StringEmitterProcess("World", x));
     }
     
-    private void reliableHelloWorld() {
+    protected void reliableHelloWorld() {
         // reliable version of the code above
         // (new(callback).!out(hello).?callback) | (new(callback).!out(world).?callback)
         
@@ -194,7 +196,7 @@ public class HelloWorld extends JacobRunnable {
     }
     
     
-    private void sequencedHelloWorld() {
+    protected void sequencedHelloWorld() {
         // send hello world as a sequence
         // !out(hello).!out(world)
 
@@ -288,7 +290,7 @@ public class HelloWorld extends JacobRunnable {
     public static JacksonExecutionQueueImpl loadAndRestoreQueue(ObjectMapper mapper, JacksonExecutionQueueImpl in) throws Exception {
         byte[] json = mapper.writeValueAsBytes(in);
         // print json
-        System.out.println(new String(json));
+        //System.out.println(new String(json));
         JacksonExecutionQueueImpl q2 = mapper.readValue(json, JacksonExecutionQueueImpl.class);
         return q2;
     }