- unit test adedd.
- some Javadocs added.
- Missing Apache license headers added.
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.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;
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.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>();
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.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;
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.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() {
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 @@
/**
* 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 {
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.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 {
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.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;
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.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() {
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 @@
/**
* No-op Json generator.
*
- * @author vanto
+ * @author Tammo van Lessen
*
*/
public class NullJsonGenerator extends JsonGeneratorImpl {
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 @@
*
* 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 @@
}
- private void simpleHelloWorld() {
+ protected void simpleHelloWorld() {
// new(out)
final Val out = newChannel(Val.class, "simpleHelloWorld-out");
// new(x)
@@ -178,7 +180,7 @@
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 @@
}
- private void sequencedHelloWorld() {
+ protected void sequencedHelloWorld() {
// send hello world as a sequence
// !out(hello).!out(world)
@@ -288,7 +290,7 @@
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;
}