Updated Branches:
  refs/heads/master 588a251bb -> b982c5d39

fixing line endings.


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

Branch: refs/heads/master
Commit: b982c5d39338857f3d7915f157898e45b305ff39
Parents: 588a251
Author: Tammo van Lessen <[email protected]>
Authored: Thu Feb 21 20:23:27 2013 +0100
Committer: Tammo van Lessen <[email protected]>
Committed: Thu Feb 21 20:23:27 2013 +0100

----------------------------------------------------------------------
 .../soup/jackson/ChannelProxyDeserializer.java     |  158 ++++----
 .../jacob/soup/jackson/ChannelProxySerializer.java |  136 +++---
 .../soup/jackson/ContinuationDeserializer.java     |  148 ++++----
 .../jacob/soup/jackson/ContinuationSerializer.java |  126 +++---
 .../jackson/ContinuationValueInstantiator.java     |  102 +++---
 .../soup/jackson/JacksonExecutionQueueImpl.java    |  330 +++++++-------
 .../soup/jackson/JacobTypeResolverBuilder.java     |  284 +++++++-------
 7 files changed, 642 insertions(+), 642 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/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 cab8380..1b85bcc 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
@@ -1,79 +1,79 @@
-/*
- * 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;
-
-import org.apache.ode.jacob.Channel;
-import org.apache.ode.jacob.soup.CommChannel;
-import org.apache.ode.jacob.vpu.ChannelFactory;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-public class ChannelProxyDeserializer extends StdDeserializer<Channel> {
-
-    private static final long serialVersionUID = 1L;
-
-    public ChannelProxyDeserializer() {
-        super(Channel.class);
-    }
-
-    @Override
-    public Channel deserialize(JsonParser jp, DeserializationContext ctxt)
-            throws IOException, JsonProcessingException {
-
-        String type = null;
-        int id = -1;
-        while (jp.nextToken() != JsonToken.END_OBJECT) {
-            String fieldname = jp.getCurrentName();
-            if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
-                // if we're not already on the field, advance by one.
-                jp.nextToken();
-            }
-            if ("channelType".equals(fieldname)) {
-                type = jp.getText();
-            } else if ("channelId".equals(fieldname)) {
-                id = jp.getIntValue();
-            } 
-        }
-        
-        if (type == null) {
-            throw ctxt.mappingException(Channel.class);
-        }
-        
-        if (id < 0) {
-            throw ctxt.mappingException(Channel.class);
-        }
-
-        
-        try {
-            CommChannel channel = new CommChannel(ctxt.findClass(type));
-            channel.setId(id);
-            return (Channel)ChannelFactory.createChannel(channel, 
channel.getType());
-
-        } catch (ClassNotFoundException e) {
-            throw ctxt.instantiationException(Channel.class, e);
-        }
-    }
-
-}
+/*
+ * 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;
+
+import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.soup.CommChannel;
+import org.apache.ode.jacob.vpu.ChannelFactory;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+
+public class ChannelProxyDeserializer extends StdDeserializer<Channel> {
+
+    private static final long serialVersionUID = 1L;
+
+    public ChannelProxyDeserializer() {
+        super(Channel.class);
+    }
+
+    @Override
+    public Channel deserialize(JsonParser jp, DeserializationContext ctxt)
+            throws IOException, JsonProcessingException {
+
+        String type = null;
+        int id = -1;
+        while (jp.nextToken() != JsonToken.END_OBJECT) {
+            String fieldname = jp.getCurrentName();
+            if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
+                // if we're not already on the field, advance by one.
+                jp.nextToken();
+            }
+            if ("channelType".equals(fieldname)) {
+                type = jp.getText();
+            } else if ("channelId".equals(fieldname)) {
+                id = jp.getIntValue();
+            } 
+        }
+        
+        if (type == null) {
+            throw ctxt.mappingException(Channel.class);
+        }
+        
+        if (id < 0) {
+            throw ctxt.mappingException(Channel.class);
+        }
+
+        
+        try {
+            CommChannel channel = new CommChannel(ctxt.findClass(type));
+            channel.setId(id);
+            return (Channel)ChannelFactory.createChannel(channel, 
channel.getType());
+
+        } catch (ClassNotFoundException e) {
+            throw ctxt.instantiationException(Channel.class, e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/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 eadb813..0817461 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
@@ -1,68 +1,68 @@
-/*
- * 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;
-
-import org.apache.ode.jacob.Channel;
-import org.apache.ode.jacob.ChannelProxy;
-import org.apache.ode.jacob.soup.CommChannel;
-import org.apache.ode.jacob.vpu.ChannelFactory;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-public class ChannelProxySerializer extends StdSerializer<ChannelProxy>{
-
-    protected ChannelProxySerializer() {
-        super(ChannelProxy.class);
-    }
-
-    @Override
-    public void serialize(ChannelProxy value, JsonGenerator jgen,
-            SerializerProvider provider) throws IOException,
-            JsonGenerationException {
-        jgen.writeStartObject();
-        serializeContents(value, jgen, provider);
-        jgen.writeEndObject();
-    }
-    
-    @Override
-    public void serializeWithType(ChannelProxy value, JsonGenerator jgen, 
SerializerProvider provider,
-            TypeSerializer typeSer)
-        throws IOException, JsonGenerationException
-    {
-        typeSer.writeTypePrefixForObject(value, jgen);
-        serializeContents(value, jgen, provider);
-        typeSer.writeTypeSuffixForObject(value, jgen);
-    }
-
-    private void serializeContents(ChannelProxy value, JsonGenerator jgen,
-            SerializerProvider provider) throws JsonGenerationException, 
IOException {
-        CommChannel commChannel = (CommChannel) 
ChannelFactory.getBackend((Channel)value);
-        ClassNameIdResolver idResolver = new 
ClassNameIdResolver(provider.constructType(commChannel.getType()), 
provider.getTypeFactory());
-        jgen.writeStringField("channelType", idResolver.idFromBaseType());
-        jgen.writeNumberField("channelId", (Integer)commChannel.getId());
-    }
-
-}
+/*
+ * 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;
+
+import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ChannelProxy;
+import org.apache.ode.jacob.soup.CommChannel;
+import org.apache.ode.jacob.vpu.ChannelFactory;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
+import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class ChannelProxySerializer extends StdSerializer<ChannelProxy>{
+
+    protected ChannelProxySerializer() {
+        super(ChannelProxy.class);
+    }
+
+    @Override
+    public void serialize(ChannelProxy value, JsonGenerator jgen,
+            SerializerProvider provider) throws IOException,
+            JsonGenerationException {
+        jgen.writeStartObject();
+        serializeContents(value, jgen, provider);
+        jgen.writeEndObject();
+    }
+    
+    @Override
+    public void serializeWithType(ChannelProxy value, JsonGenerator jgen, 
SerializerProvider provider,
+            TypeSerializer typeSer)
+        throws IOException, JsonGenerationException
+    {
+        typeSer.writeTypePrefixForObject(value, jgen);
+        serializeContents(value, jgen, provider);
+        typeSer.writeTypeSuffixForObject(value, jgen);
+    }
+
+    private void serializeContents(ChannelProxy value, JsonGenerator jgen,
+            SerializerProvider provider) throws JsonGenerationException, 
IOException {
+        CommChannel commChannel = (CommChannel) 
ChannelFactory.getBackend((Channel)value);
+        ClassNameIdResolver idResolver = new 
ClassNameIdResolver(provider.constructType(commChannel.getType()), 
provider.getTypeFactory());
+        jgen.writeStringField("channelType", idResolver.idFromBaseType());
+        jgen.writeNumberField("channelId", (Integer)commChannel.getId());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/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 75b7fba..bd72203 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
@@ -1,75 +1,75 @@
-/*
- * 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;
-
-import org.apache.ode.jacob.JacobObject;
-import org.apache.ode.jacob.soup.Continuation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-public class ContinuationDeserializer extends StdDeserializer<Continuation> {
-
-       private static final long serialVersionUID = 1L;
-
-       protected ContinuationDeserializer() {
-        super(Continuation.class);
-    }
-
-    @Override
-    public Continuation deserialize(JsonParser jp,
-            DeserializationContext ctxt) throws IOException,
-            JsonProcessingException {
-
-        JacobObject target = null;
-        String methodName = null;
-        Object[] args = null;
-        
-        while (jp.nextToken() != JsonToken.END_OBJECT) {
-            String fieldname = jp.getCurrentName();
-            if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
-                // if we're not already on the field, advance by one.
-                jp.nextToken();
-            }
-
-            if ("target".equals(fieldname)) {
-                target = jp.readValueAs(JacobObject.class); 
-            } else if ("method".equals(fieldname)) {
-                methodName = jp.getText();
-            } if ("args".equals(fieldname)) {
-                args = jp.readValueAs(Object[].class);
-            } 
-        }
-        
-        if (target == null) {
-            throw ctxt.mappingException(Continuation.class);
-        }
-        
-        if (methodName == null) {
-            throw ctxt.mappingException(Continuation.class);
-        }
-        
-        return new Continuation(target, target.getMethod(methodName), args);
-    }
+/*
+ * 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;
+
+import org.apache.ode.jacob.JacobObject;
+import org.apache.ode.jacob.soup.Continuation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+
+public class ContinuationDeserializer extends StdDeserializer<Continuation> {
+
+       private static final long serialVersionUID = 1L;
+
+       protected ContinuationDeserializer() {
+        super(Continuation.class);
+    }
+
+    @Override
+    public Continuation deserialize(JsonParser jp,
+            DeserializationContext ctxt) throws IOException,
+            JsonProcessingException {
+
+        JacobObject target = null;
+        String methodName = null;
+        Object[] args = null;
+        
+        while (jp.nextToken() != JsonToken.END_OBJECT) {
+            String fieldname = jp.getCurrentName();
+            if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
+                // if we're not already on the field, advance by one.
+                jp.nextToken();
+            }
+
+            if ("target".equals(fieldname)) {
+                target = jp.readValueAs(JacobObject.class); 
+            } else if ("method".equals(fieldname)) {
+                methodName = jp.getText();
+            } if ("args".equals(fieldname)) {
+                args = jp.readValueAs(Object[].class);
+            } 
+        }
+        
+        if (target == null) {
+            throw ctxt.mappingException(Continuation.class);
+        }
+        
+        if (methodName == null) {
+            throw ctxt.mappingException(Continuation.class);
+        }
+        
+        return new Continuation(target, target.getMethod(methodName), args);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/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 242b602..594135a 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
@@ -1,64 +1,64 @@
-/*
- * 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;
-
-import org.apache.ode.jacob.soup.Continuation;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-public class ContinuationSerializer extends StdSerializer<Continuation> {
-
-    public ContinuationSerializer() {
-        super(Continuation.class);
-    }
-    
-    @Override
-    public void serialize(Continuation value, JsonGenerator jgen,
-            SerializerProvider provider) throws IOException,
-            JsonGenerationException {
-        jgen.writeStartObject();
-        serializeContents(value, jgen, provider);
-        jgen.writeEndObject();
-    }
-
-    
-    @Override
-    public void serializeWithType(Continuation value, JsonGenerator jgen,
-            SerializerProvider provider, TypeSerializer typeSer)
-            throws IOException, JsonProcessingException {
-        typeSer.writeTypePrefixForObject(value, jgen);
-        serializeContents(value, jgen, provider);
-        typeSer.writeTypeSuffixForObject(value, jgen);
-    }
-    
-    private void serializeContents(Continuation value, JsonGenerator jgen,
-            SerializerProvider provider) throws JsonGenerationException, 
IOException {
-
-        jgen.writeObjectField("target", value.getClosure());
-        jgen.writeStringField("method", value.getMethod().getName());
-        jgen.writeObjectField("args", value.getArgs());
-    }
+/*
+ * 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;
+
+import org.apache.ode.jacob.soup.Continuation;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class ContinuationSerializer extends StdSerializer<Continuation> {
+
+    public ContinuationSerializer() {
+        super(Continuation.class);
+    }
+    
+    @Override
+    public void serialize(Continuation value, JsonGenerator jgen,
+            SerializerProvider provider) throws IOException,
+            JsonGenerationException {
+        jgen.writeStartObject();
+        serializeContents(value, jgen, provider);
+        jgen.writeEndObject();
+    }
+
+    
+    @Override
+    public void serializeWithType(Continuation value, JsonGenerator jgen,
+            SerializerProvider provider, TypeSerializer typeSer)
+            throws IOException, JsonProcessingException {
+        typeSer.writeTypePrefixForObject(value, jgen);
+        serializeContents(value, jgen, provider);
+        typeSer.writeTypeSuffixForObject(value, jgen);
+    }
+    
+    private void serializeContents(Continuation value, JsonGenerator jgen,
+            SerializerProvider provider) throws JsonGenerationException, 
IOException {
+
+        jgen.writeObjectField("target", value.getClosure());
+        jgen.writeStringField("method", value.getMethod().getName());
+        jgen.writeObjectField("args", value.getArgs());
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationValueInstantiator.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationValueInstantiator.java
 
b/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationValueInstantiator.java
index d17fcfa..d770ad1 100644
--- 
a/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationValueInstantiator.java
+++ 
b/src/main/java/org/apache/ode/jacob/soup/jackson/ContinuationValueInstantiator.java
@@ -1,52 +1,52 @@
-/*
- * 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.lang.reflect.Method;
-
-import org.apache.ode.jacob.JacobObject;
-import org.apache.ode.jacob.soup.Continuation;
-
-import com.fasterxml.jackson.databind.DeserializationConfig;
-import com.fasterxml.jackson.databind.deser.CreatorProperty;
-import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
-import com.fasterxml.jackson.databind.deser.ValueInstantiator;
-
-public class ContinuationValueInstantiator extends ValueInstantiator {
-
-    @Override
-    public String getValueTypeDesc() {
-        return Continuation.class.getName();
-    }
-
-    @Override
-    public boolean canCreateFromObjectWith() {
-        return true;
-    }
-
-    @Override
-    public SettableBeanProperty[] getFromObjectArguments(
-            DeserializationConfig config) {
-        return  new CreatorProperty[] {
-                new CreatorProperty("_closure", 
config.constructType(JacobObject.class), null, null, null, 0, null),
-                new CreatorProperty("_method", 
config.constructType(Method.class), null, null, null, 1, null),
-                new CreatorProperty("_args", 
config.constructType(Object[].class), null, null, null, 2, null)};
-
-    }
+/*
+ * 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.lang.reflect.Method;
+
+import org.apache.ode.jacob.JacobObject;
+import org.apache.ode.jacob.soup.Continuation;
+
+import com.fasterxml.jackson.databind.DeserializationConfig;
+import com.fasterxml.jackson.databind.deser.CreatorProperty;
+import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
+import com.fasterxml.jackson.databind.deser.ValueInstantiator;
+
+public class ContinuationValueInstantiator extends ValueInstantiator {
+
+    @Override
+    public String getValueTypeDesc() {
+        return Continuation.class.getName();
+    }
+
+    @Override
+    public boolean canCreateFromObjectWith() {
+        return true;
+    }
+
+    @Override
+    public SettableBeanProperty[] getFromObjectArguments(
+            DeserializationConfig config) {
+        return  new CreatorProperty[] {
+                new CreatorProperty("_closure", 
config.constructType(JacobObject.class), null, null, null, 0, null),
+                new CreatorProperty("_method", 
config.constructType(Method.class), null, null, null, 1, null),
+                new CreatorProperty("_args", 
config.constructType(Object[].class), null, null, null, 2, null)};
+
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/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 eeb1333..ea1376e 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
@@ -1,165 +1,165 @@
-/*
- * 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;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.apache.ode.jacob.Channel;
-import org.apache.ode.jacob.ChannelProxy;
-import org.apache.ode.jacob.soup.Continuation;
-import org.apache.ode.jacob.vpu.ExecutionQueueImpl;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-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.
- */
-public class JacksonExecutionQueueImpl extends ExecutionQueueImpl {
-
-       public JacksonExecutionQueueImpl() {
-               super(null);
-       }
-       
-    public static ObjectMapper configureMapper() {
-        
-        SimpleModule sm = new SimpleModule("jacobmodule");
-        sm.addSerializer(ChannelProxy.class, new ChannelProxySerializer());
-        sm.addSerializer(Continuation.class, new ContinuationSerializer());
-        sm.addSerializer(JacksonExecutionQueueImpl.class, new 
ExecutionQueueImplSerializer());
-        sm.addDeserializer(JacksonExecutionQueueImpl.class, new 
ExecutionQueueImplDeserializer());
-        sm.addDeserializer(Continuation.class, new ContinuationDeserializer());
-        sm.addDeserializer(Channel.class, new ChannelProxyDeserializer());
-        
-        ObjectMapper om = new ObjectMapper();
-        om.registerModule(sm);
-        om.disable(MapperFeature.AUTO_DETECT_CREATORS);
-        om.disable(MapperFeature.AUTO_DETECT_GETTERS);
-        om.disable(MapperFeature.AUTO_DETECT_IS_GETTERS);
-        om.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
-        
-        om.setDefaultTyping(new JacobTypeResolverBuilder());
-        
-        om.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX);
-        om.enable(SerializationFeature.INDENT_OUTPUT);
-        
-        return om;
-    }
-
-       
-    public static class ExecutionQueueImplSerializer extends 
StdSerializer<JacksonExecutionQueueImpl> {
-
-        public ExecutionQueueImplSerializer() {
-            super(JacksonExecutionQueueImpl.class);
-        }
-        
-        @Override
-        public void serialize(JacksonExecutionQueueImpl value, JsonGenerator 
jgen,
-                SerializerProvider provider) throws IOException,
-                JsonGenerationException {
-            jgen.writeStartObject();
-            serializeContents(value, jgen, provider);
-            jgen.writeEndObject();
-        }
-
-        
-        @Override
-        public void serializeWithType(JacksonExecutionQueueImpl value, 
JsonGenerator jgen,
-                SerializerProvider provider, TypeSerializer typeSer)
-                throws IOException, JsonProcessingException {
-            typeSer.writeTypePrefixForObject(value, jgen);
-            serializeContents(value, jgen, provider);
-            typeSer.writeTypeSuffixForObject(value, jgen);
-        }
-        
-        private void serializeContents(JacksonExecutionQueueImpl value, 
JsonGenerator jgen,
-                SerializerProvider provider) throws JsonGenerationException, 
IOException {
-
-               jgen.writeNumberField("objIdCounter", value._objIdCounter);
-            jgen.writeNumberField("currentCycle", value._currentCycle);
-            
-            jgen.writeObjectField("continuations", 
value._reactions.toArray(new Continuation[] {}));
-            jgen.writeObjectField("channels", 
value._channels.values().toArray(new ChannelFrame[] {}));
-            jgen.writeObjectField("global", value._gdata);
-        }
-    }
-
-    public static class ExecutionQueueImplDeserializer extends 
StdDeserializer<JacksonExecutionQueueImpl> {
-
-               private static final long serialVersionUID = 1L;
-
-               public ExecutionQueueImplDeserializer() {
-            super(JacksonExecutionQueueImpl.class);
-        }
-
-        @Override
-        public JacksonExecutionQueueImpl deserialize(JsonParser jp,
-                DeserializationContext ctxt) throws IOException,
-                JsonProcessingException {
-
-            JacksonExecutionQueueImpl soup = new JacksonExecutionQueueImpl();
-            
-            while (jp.nextToken() != JsonToken.END_OBJECT) {
-                String fieldname = jp.getCurrentName();
-                if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
-                    // if we're not already on the field, advance by one.
-                    jp.nextToken();
-                }
-
-                if ("objIdCounter".equals(fieldname)) {
-                    soup._objIdCounter = jp.getIntValue();
-                } else if ("currentCycle".equals(fieldname)) {
-                    soup._currentCycle = jp.getIntValue();
-                } else if ("continuations".equals(fieldname)) {
-                    Continuation[] cs = 
(Continuation[])jp.readValueAs(Continuation[].class);
-                    soup._reactions = new 
HashSet<Continuation>(Arrays.asList(cs));
-                } else if ("channels".equals(fieldname)) {
-                    soup._channels = new HashMap<Integer, ChannelFrame>();
-                    ChannelFrame[] frames = 
jp.readValueAs(ChannelFrame[].class); 
-                    for (ChannelFrame f : frames) {
-                        soup._channels.put(f.getId(), f);
-                    }
-                }
-
-            }
-            return soup;
-        }
-
-    }
-
-
-}
+/*
+ * 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;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ChannelProxy;
+import org.apache.ode.jacob.soup.Continuation;
+import org.apache.ode.jacob.vpu.ExecutionQueueImpl;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+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.
+ */
+public class JacksonExecutionQueueImpl extends ExecutionQueueImpl {
+
+       public JacksonExecutionQueueImpl() {
+               super(null);
+       }
+       
+    public static ObjectMapper configureMapper() {
+        
+        SimpleModule sm = new SimpleModule("jacobmodule");
+        sm.addSerializer(ChannelProxy.class, new ChannelProxySerializer());
+        sm.addSerializer(Continuation.class, new ContinuationSerializer());
+        sm.addSerializer(JacksonExecutionQueueImpl.class, new 
ExecutionQueueImplSerializer());
+        sm.addDeserializer(JacksonExecutionQueueImpl.class, new 
ExecutionQueueImplDeserializer());
+        sm.addDeserializer(Continuation.class, new ContinuationDeserializer());
+        sm.addDeserializer(Channel.class, new ChannelProxyDeserializer());
+        
+        ObjectMapper om = new ObjectMapper();
+        om.registerModule(sm);
+        om.disable(MapperFeature.AUTO_DETECT_CREATORS);
+        om.disable(MapperFeature.AUTO_DETECT_GETTERS);
+        om.disable(MapperFeature.AUTO_DETECT_IS_GETTERS);
+        om.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
+        
+        om.setDefaultTyping(new JacobTypeResolverBuilder());
+        
+        om.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX);
+        om.enable(SerializationFeature.INDENT_OUTPUT);
+        
+        return om;
+    }
+
+       
+    public static class ExecutionQueueImplSerializer extends 
StdSerializer<JacksonExecutionQueueImpl> {
+
+        public ExecutionQueueImplSerializer() {
+            super(JacksonExecutionQueueImpl.class);
+        }
+        
+        @Override
+        public void serialize(JacksonExecutionQueueImpl value, JsonGenerator 
jgen,
+                SerializerProvider provider) throws IOException,
+                JsonGenerationException {
+            jgen.writeStartObject();
+            serializeContents(value, jgen, provider);
+            jgen.writeEndObject();
+        }
+
+        
+        @Override
+        public void serializeWithType(JacksonExecutionQueueImpl value, 
JsonGenerator jgen,
+                SerializerProvider provider, TypeSerializer typeSer)
+                throws IOException, JsonProcessingException {
+            typeSer.writeTypePrefixForObject(value, jgen);
+            serializeContents(value, jgen, provider);
+            typeSer.writeTypeSuffixForObject(value, jgen);
+        }
+        
+        private void serializeContents(JacksonExecutionQueueImpl value, 
JsonGenerator jgen,
+                SerializerProvider provider) throws JsonGenerationException, 
IOException {
+
+               jgen.writeNumberField("objIdCounter", value._objIdCounter);
+            jgen.writeNumberField("currentCycle", value._currentCycle);
+            
+            jgen.writeObjectField("continuations", 
value._reactions.toArray(new Continuation[] {}));
+            jgen.writeObjectField("channels", 
value._channels.values().toArray(new ChannelFrame[] {}));
+            jgen.writeObjectField("global", value._gdata);
+        }
+    }
+
+    public static class ExecutionQueueImplDeserializer extends 
StdDeserializer<JacksonExecutionQueueImpl> {
+
+               private static final long serialVersionUID = 1L;
+
+               public ExecutionQueueImplDeserializer() {
+            super(JacksonExecutionQueueImpl.class);
+        }
+
+        @Override
+        public JacksonExecutionQueueImpl deserialize(JsonParser jp,
+                DeserializationContext ctxt) throws IOException,
+                JsonProcessingException {
+
+            JacksonExecutionQueueImpl soup = new JacksonExecutionQueueImpl();
+            
+            while (jp.nextToken() != JsonToken.END_OBJECT) {
+                String fieldname = jp.getCurrentName();
+                if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
+                    // if we're not already on the field, advance by one.
+                    jp.nextToken();
+                }
+
+                if ("objIdCounter".equals(fieldname)) {
+                    soup._objIdCounter = jp.getIntValue();
+                } else if ("currentCycle".equals(fieldname)) {
+                    soup._currentCycle = jp.getIntValue();
+                } else if ("continuations".equals(fieldname)) {
+                    Continuation[] cs = 
(Continuation[])jp.readValueAs(Continuation[].class);
+                    soup._reactions = new 
HashSet<Continuation>(Arrays.asList(cs));
+                } else if ("channels".equals(fieldname)) {
+                    soup._channels = new HashMap<Integer, ChannelFrame>();
+                    ChannelFrame[] frames = 
jp.readValueAs(ChannelFrame[].class); 
+                    for (ChannelFrame f : frames) {
+                        soup._channels.put(f.getId(), f);
+                    }
+                }
+
+            }
+            return soup;
+        }
+
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/b982c5d3/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 8e6a982..bb1153a 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
@@ -1,142 +1,142 @@
-/*
- * 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.util.Collection;
-
-import org.apache.ode.jacob.Channel;
-import org.apache.ode.jacob.ChannelProxy;
-import org.apache.ode.jacob.JacobObject;
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
-import com.fasterxml.jackson.databind.DeserializationConfig;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.SerializationConfig;
-import com.fasterxml.jackson.databind.cfg.MapperConfig;
-import com.fasterxml.jackson.databind.jsontype.NamedType;
-import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
-import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
-import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer;
-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;
-
-public class JacobTypeResolverBuilder extends StdTypeResolverBuilder {
-
-    public JacobTypeResolverBuilder() {
-        init(JsonTypeInfo.Id.CLASS, null);
-        inclusion(JsonTypeInfo.As.PROPERTY);
-        typeProperty("@class");
-    }
-    
-
-    @Override
-    protected TypeIdResolver idResolver(MapperConfig<?> config,
-            JavaType baseType, Collection<NamedType> subtypes, boolean forSer,
-            boolean forDeser) {
-        return new ChannelAwareTypeIdResolver(baseType, 
config.getTypeFactory());
-    }
-
-
-    @Override
-    public TypeSerializer buildTypeSerializer(SerializationConfig config,
-            JavaType baseType, Collection<NamedType> subtypes) {
-        
-        return useForType(baseType) ? super.buildTypeSerializer(config, 
baseType, subtypes) : null;
-    }
-    
-    private boolean useForType(JavaType t) {
-        if (JacobObject.class.isAssignableFrom(t.getRawClass())) {
-            //System.err.println("XXX: JO " + t);
-            return true;
-        }
-        
-        if (Channel.class.isAssignableFrom(t.getRawClass()))  {
-            //System.err.println("XXX: CH " + t);
-            return true;
-        }
-        
-        //if (!t.isConcrete()) {
-        if (t.getRawClass() == Object.class) {
-               //System.err.println("XXX: CON " + t + "- " + t.isConcrete());
-            return true;
-        }
-
-        return false;
-    }
-
-    @Override
-    public TypeDeserializer buildTypeDeserializer(DeserializationConfig config,
-            JavaType baseType, Collection<NamedType> subtypes) {
-        
-        if (useForType(baseType)) {
-            if (baseType.isInterface() && 
Channel.class.isAssignableFrom(baseType.getRawClass())) {
-                TypeIdResolver idRes = idResolver(config, baseType, subtypes, 
false, true);
-                return new AsPropertyTypeDeserializer(baseType, idRes,
-                        _typeProperty, _typeIdVisible, Channel.class);
-            } else {
-                return super.buildTypeDeserializer(config, baseType, 
subtypes);    
-            }
-        }
-        
-        return null;
-    }
-
-    public static class ChannelAwareTypeIdResolver extends TypeIdResolverBase {
-
-        private ClassNameIdResolver delegate;
-
-        protected ChannelAwareTypeIdResolver(JavaType baseType,
-                TypeFactory typeFactory) {
-            super(baseType, typeFactory);
-            delegate = new ClassNameIdResolver(baseType, typeFactory);
-        }
-
-        @Override
-        public String idFromValue(Object value) {
-            if (value instanceof ChannelProxy) {
-                return "<<channelproxy>>";
-            }
-            return delegate.idFromValue(value);
-        }
-
-        @Override
-        public String idFromValueAndType(Object value, Class<?> suggestedType) 
{
-            return delegate.idFromValueAndType(value, suggestedType);
-        }
-
-        @Override
-        public JavaType typeFromId(String id) {
-            if ("<<channelproxy>>".equals(id)) {
-                return null; // force jackson to use default impl
-            }
-            return delegate.typeFromId(id);
-        }
-
-        @Override
-        public Id getMechanism() {
-            return Id.CUSTOM;
-        }
-        
-    }
-    
-}
+/*
+ * 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.util.Collection;
+
+import org.apache.ode.jacob.Channel;
+import org.apache.ode.jacob.ChannelProxy;
+import org.apache.ode.jacob.JacobObject;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
+import com.fasterxml.jackson.databind.DeserializationConfig;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.SerializationConfig;
+import com.fasterxml.jackson.databind.cfg.MapperConfig;
+import com.fasterxml.jackson.databind.jsontype.NamedType;
+import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
+import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
+import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
+import com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer;
+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;
+
+public class JacobTypeResolverBuilder extends StdTypeResolverBuilder {
+
+    public JacobTypeResolverBuilder() {
+        init(JsonTypeInfo.Id.CLASS, null);
+        inclusion(JsonTypeInfo.As.PROPERTY);
+        typeProperty("@class");
+    }
+    
+
+    @Override
+    protected TypeIdResolver idResolver(MapperConfig<?> config,
+            JavaType baseType, Collection<NamedType> subtypes, boolean forSer,
+            boolean forDeser) {
+        return new ChannelAwareTypeIdResolver(baseType, 
config.getTypeFactory());
+    }
+
+
+    @Override
+    public TypeSerializer buildTypeSerializer(SerializationConfig config,
+            JavaType baseType, Collection<NamedType> subtypes) {
+        
+        return useForType(baseType) ? super.buildTypeSerializer(config, 
baseType, subtypes) : null;
+    }
+    
+    private boolean useForType(JavaType t) {
+        if (JacobObject.class.isAssignableFrom(t.getRawClass())) {
+            //System.err.println("XXX: JO " + t);
+            return true;
+        }
+        
+        if (Channel.class.isAssignableFrom(t.getRawClass()))  {
+            //System.err.println("XXX: CH " + t);
+            return true;
+        }
+        
+        //if (!t.isConcrete()) {
+        if (t.getRawClass() == Object.class) {
+               //System.err.println("XXX: CON " + t + "- " + t.isConcrete());
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public TypeDeserializer buildTypeDeserializer(DeserializationConfig config,
+            JavaType baseType, Collection<NamedType> subtypes) {
+        
+        if (useForType(baseType)) {
+            if (baseType.isInterface() && 
Channel.class.isAssignableFrom(baseType.getRawClass())) {
+                TypeIdResolver idRes = idResolver(config, baseType, subtypes, 
false, true);
+                return new AsPropertyTypeDeserializer(baseType, idRes,
+                        _typeProperty, _typeIdVisible, Channel.class);
+            } else {
+                return super.buildTypeDeserializer(config, baseType, 
subtypes);    
+            }
+        }
+        
+        return null;
+    }
+
+    public static class ChannelAwareTypeIdResolver extends TypeIdResolverBase {
+
+        private ClassNameIdResolver delegate;
+
+        protected ChannelAwareTypeIdResolver(JavaType baseType,
+                TypeFactory typeFactory) {
+            super(baseType, typeFactory);
+            delegate = new ClassNameIdResolver(baseType, typeFactory);
+        }
+
+        @Override
+        public String idFromValue(Object value) {
+            if (value instanceof ChannelProxy) {
+                return "<<channelproxy>>";
+            }
+            return delegate.idFromValue(value);
+        }
+
+        @Override
+        public String idFromValueAndType(Object value, Class<?> suggestedType) 
{
+            return delegate.idFromValueAndType(value, suggestedType);
+        }
+
+        @Override
+        public JavaType typeFromId(String id) {
+            if ("<<channelproxy>>".equals(id)) {
+                return null; // force jackson to use default impl
+            }
+            return delegate.typeFromId(id);
+        }
+
+        @Override
+        public Id getMechanism() {
+            return Id.CUSTOM;
+        }
+        
+    }
+    
+}

Reply via email to