Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@
</licenses>

<properties>
<slf4j.version>1.7.2</slf4j.version>
<slf4j.version>1.7.25</slf4j.version>
<junit.version>4.11</junit.version>
<jackson.version>2.2.0-rc1</jackson.version>
<jackson.version>2.9.4</jackson.version>

<jdk.version>1.6</jdk.version>
<compiler.fork>1.6</compiler.fork>
<jdk.version>1.8</jdk.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -126,7 +125,6 @@
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<maxmem>512M</maxmem>
<fork>${compiler.fork}</fork>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class ExecutionQueueObject {

/**
* A unique idefntifer for this object in the queue (should only be set by queue).
* A unique identifier for this object in the queue (should only be set by queue).
*/
private Object _id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public Channel deserialize(JsonParser jp, DeserializationContext ctxt)
}

if (type == null) {
throw ctxt.mappingException(Channel.class);
ctxt.handleUnexpectedToken(Channel.class, jp);
}

if (id < 0) {
throw ctxt.mappingException(Channel.class);
ctxt.handleUnexpectedToken(Channel.class, jp);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver;
Expand All @@ -45,6 +47,8 @@
*/
public class ChannelProxySerializer extends StdSerializer<ChannelProxy>{

private static final long serialVersionUID = -3021202839880017806L;

private final Set<Integer> serializedChannels = new LinkedHashSet<Integer>();

protected ChannelProxySerializer() {
Expand All @@ -65,9 +69,10 @@ public void serializeWithType(ChannelProxy value, JsonGenerator jgen, Serializer
TypeSerializer typeSer)
throws IOException, JsonGenerationException
{
typeSer.writeTypePrefixForObject(value, jgen);
WritableTypeId typeId = typeSer.typeId(value, JsonToken.START_OBJECT);
typeSer.writeTypePrefix(jgen, typeId);
serializeContents(value, jgen, provider);
typeSer.writeTypeSuffixForObject(value, jgen);
typeSer.writeTypeSuffix(jgen, typeId);
}

private void serializeContents(ChannelProxy value, JsonGenerator jgen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public Continuation deserialize(JsonParser jp,
}

if (target == null) {
throw ctxt.mappingException(Continuation.class);
ctxt.handleUnexpectedToken(Continuation.class, jp);
}

if (methodName == null) {
throw ctxt.mappingException(Continuation.class);
ctxt.handleUnexpectedToken(Continuation.class, jp);
}

return new Continuation(target, target.getMethod(methodName), args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
Expand All @@ -37,6 +39,8 @@
*/
public class ContinuationSerializer extends StdSerializer<Continuation> {

private static final long serialVersionUID = 850057543258259908L;

public ContinuationSerializer() {
super(Continuation.class);
}
Expand All @@ -55,9 +59,10 @@ public void serialize(Continuation value, JsonGenerator jgen,
public void serializeWithType(Continuation value, JsonGenerator jgen,
SerializerProvider provider, TypeSerializer typeSer)
throws IOException, JsonProcessingException {
typeSer.writeTypePrefixForObject(value, jgen);
WritableTypeId typeId = typeSer.typeId(value, JsonToken.START_OBJECT);
typeSer.writeTypePrefix(jgen, typeId);
serializeContents(value, jgen, provider);
typeSer.writeTypeSuffixForObject(value, jgen);
typeSer.writeTypeSuffix(jgen, typeId);
}

private void serializeContents(Continuation value, JsonGenerator jgen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
Expand All @@ -59,6 +60,8 @@ public JacksonExecutionQueueImpl() {

public static class ExecutionQueueImplSerializer extends StdSerializer<JacksonExecutionQueueImpl> {

private static final long serialVersionUID = -3984361231954521934L;

private ChannelProxySerializer channelProxySerializer;

public ExecutionQueueImplSerializer(ChannelProxySerializer cps) {
Expand All @@ -80,9 +83,10 @@ public void serialize(JacksonExecutionQueueImpl value, JsonGenerator jgen,
public void serializeWithType(JacksonExecutionQueueImpl value, JsonGenerator jgen,
SerializerProvider provider, TypeSerializer typeSer)
throws IOException, JsonProcessingException {
typeSer.writeTypePrefixForObject(value, jgen);
WritableTypeId typeId = typeSer.typeId(value, JsonToken.START_OBJECT);
typeSer.writeTypePrefix(jgen, typeId);
serializeContents(value, jgen, provider);
typeSer.writeTypeSuffixForObject(value, jgen);
typeSer.writeTypeSuffix(jgen, typeId);
}

private void serializeContents(JacksonExecutionQueueImpl value, JsonGenerator jgen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
package org.apache.ode.jacob.soup.jackson;

import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.annotation.SimpleObjectIdResolver;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
Expand All @@ -46,7 +48,7 @@ public class JacobJacksonAnnotationIntrospector extends
/* enable object ids for all objects. */
@Override
public ObjectIdInfo findObjectIdInfo(Annotated ann) {
return new ObjectIdInfo("@id", Object.class, ObjectIdGenerators.IntSequenceGenerator.class);
return new ObjectIdInfo(PropertyName.construct("@id"), Object.class, ObjectIdGenerators.IntSequenceGenerator.class, SimpleObjectIdResolver.class);
}

/* use custom type resolver */
Expand All @@ -61,7 +63,8 @@ public TypeResolverBuilder<?> findTypeResolver(MapperConfig<?> config,
@Override
public VisibilityChecker<?> findAutoDetectVisibility(AnnotatedClass ac,
VisibilityChecker<?> checker) {
return VisibilityChecker.Std.defaultInstance().with(Visibility.NONE).withVisibility(PropertyAccessor.FIELD, Visibility.ANY);
// return VisibilityChecker.Std.defaultInstance().withCreatorVisibility(Visibility.NONE).withFieldVisibility(Visibility.ANY);
return checker.withOverrides(JsonAutoDetect.Value.construct(Visibility.ANY, Visibility.NONE, Visibility.NONE, Visibility.NONE, Visibility.NONE));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.ode.jacob.soup.jackson;

import java.io.IOException;
import java.util.Collection;

import org.apache.ode.jacob.Channel;
Expand All @@ -28,6 +29,7 @@

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
import com.fasterxml.jackson.databind.DatabindContext;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.SerializationConfig;
Expand Down Expand Up @@ -121,8 +123,8 @@ public String idFromValueAndType(Object value, Class<?> suggestedType) {
return delegate.idFromValueAndType(value, suggestedType);
}

public JavaType typeFromId(String id) {
return delegate.typeFromId(id);
public JavaType typeFromId(DatabindContext context, String id) throws IOException {
return delegate.typeFromId(context, id);
}

public Id getMechanism() {
Expand Down
Loading