diff --git a/brooklyn-library/software/nosql/pom.xml b/brooklyn-library/software/nosql/pom.xml index f409e4b2e5..8866243020 100644 --- a/brooklyn-library/software/nosql/pom.xml +++ b/brooklyn-library/software/nosql/pom.xml @@ -116,7 +116,7 @@ com.netflix.astyanax - astyanax + astyanax-thrift ${astyanax.version} test diff --git a/brooklyn-server/camp/camp-server/pom.xml b/brooklyn-server/camp/camp-server/pom.xml index 502c83e526..1ef149d4a8 100644 --- a/brooklyn-server/camp/camp-server/pom.xml +++ b/brooklyn-server/camp/camp-server/pom.xml @@ -142,11 +142,6 @@ org.apache.commons commons-lang3 - - - org.codehaus.jackson - jackson-core-asl - org.slf4j slf4j-api diff --git a/brooklyn-server/core/pom.xml b/brooklyn-server/core/pom.xml index 3be573dc3c..fadc68900d 100644 --- a/brooklyn-server/core/pom.xml +++ b/brooklyn-server/core/pom.xml @@ -65,10 +65,6 @@ com.thoughtworks.xstream xstream - - org.codehaus.jackson - jackson-mapper-asl - com.google.code.gson gson @@ -138,10 +134,6 @@ org.slf4j slf4j-api - - org.codehaus.jackson - jackson-core-asl - com.google.guava guava diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java index 0ddc79ae5d..7a0171eaa7 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTags.java @@ -23,9 +23,9 @@ import java.util.List; import org.apache.brooklyn.util.collections.MutableList; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.annotations.Beta; import com.google.common.base.Function; import com.google.common.base.Objects; @@ -40,7 +40,8 @@ public class BrooklynTags { public static class NamedStringTag implements Serializable { private static final long serialVersionUID = 7932098757009051348L; - @JsonProperty final String kind; + @JsonProperty + final String kind; @JsonProperty final String contents; public NamedStringTag(@JsonProperty("kind") String kind, @JsonProperty("contents") String contents) { this.kind = kind; diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java index 1fba49d5ee..0ce9a2ec09 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java @@ -42,10 +42,10 @@ import org.apache.brooklyn.util.stream.Streams; import org.apache.brooklyn.util.text.StringEscapes.BashStringEscapes; import org.apache.brooklyn.util.text.Strings; -import org.codehaus.jackson.annotate.JsonProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.annotations.Beta; import com.google.common.base.Functions; import com.google.common.base.Objects; diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java index d8f18b1ae8..265540c0f0 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/dto/BasicManagementNodeSyncRecord.java @@ -25,9 +25,8 @@ import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord; import org.apache.brooklyn.core.BrooklynVersion; import org.apache.brooklyn.util.time.Time; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.google.common.base.Objects; /** @@ -36,7 +35,7 @@ * * @author aled */ -@JsonAutoDetect(fieldVisibility=Visibility.ANY, getterVisibility=Visibility.NONE) +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE) public class BasicManagementNodeSyncRecord implements ManagementNodeSyncRecord, Serializable { private static final long serialVersionUID = 4918161834047884244L; diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java index bf252e059a..3651267cb9 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicCatalogItemMemento.java @@ -29,8 +29,8 @@ import org.apache.brooklyn.api.objs.SpecParameter; import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; -import org.codehaus.jackson.annotate.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java index 82945626c1..f06ff3618d 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/BasicEntityMemento.java @@ -30,8 +30,6 @@ import org.apache.brooklyn.api.mgmt.rebind.mementos.TreeNode; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.Sensor; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.brooklyn.config.ConfigKey; @@ -41,6 +39,7 @@ import org.apache.brooklyn.core.objs.BrooklynTypes; import org.apache.brooklyn.core.sensor.Sensors; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -54,7 +53,7 @@ * * @author aled */ -@JsonAutoDetect(fieldVisibility=Visibility.ANY, getterVisibility=Visibility.NONE) +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility= JsonAutoDetect.Visibility.NONE) public class BasicEntityMemento extends AbstractTreeNodeMemento implements EntityMemento, Serializable { private static final Logger log = LoggerFactory.getLogger(BasicEntityMemento.class); diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java index 293207bd77..fa0fe1939f 100644 --- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java +++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/dto/MutableBrooklynMemento.java @@ -31,9 +31,8 @@ import org.apache.brooklyn.api.mgmt.rebind.mementos.FeedMemento; import org.apache.brooklyn.api.mgmt.rebind.mementos.LocationMemento; import org.apache.brooklyn.api.mgmt.rebind.mementos.PolicyMemento; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -44,7 +43,7 @@ /** * @deprecated since 0.7.0; this code will move to src/tests/java */ -@JsonAutoDetect(fieldVisibility=Visibility.ANY, getterVisibility=Visibility.NONE) +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE) public class MutableBrooklynMemento implements BrooklynMemento { // TODO Is this class pulling its weight? Do we really need it? diff --git a/brooklyn-server/karaf/features/src/main/history/dependencies.xml b/brooklyn-server/karaf/features/src/main/history/dependencies.xml new file mode 100644 index 0000000000..e834e289b8 --- /dev/null +++ b/brooklyn-server/karaf/features/src/main/history/dependencies.xml @@ -0,0 +1,103 @@ + + + + brooklyn-api + brooklyn-api + brooklyn-camp-base + brooklyn-camp-base + brooklyn-camp-base + brooklyn-camp-brooklyn + brooklyn-core + brooklyn-core + brooklyn-rest-api + brooklyn-utils-common + brooklyn-utils-common + brooklyn-utils-common + brooklyn-utils-common + brooklyn-utils-rest-swagger + brooklyn-utils-rest-swagger + jetty + swagger-crippled + war + war + mvn:ch.qos.logback/logback-classic/1.0.7 + mvn:ch.qos.logback/logback-core/1.0.7 + mvn:com.fasterxml.jackson.core/jackson-annotations/2.7.0 + mvn:com.fasterxml.jackson.core/jackson-annotations/2.7.0 + mvn:com.fasterxml.jackson.core/jackson-core/2.7.0 + mvn:com.fasterxml.jackson.core/jackson-core/2.7.0 + mvn:com.fasterxml.jackson.core/jackson-databind/2.7.0 + mvn:com.fasterxml.jackson.core/jackson-databind/2.7.0 + mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.7.0 + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.7.0 + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.7.0 + mvn:com.google.code.gson/gson/2.3 + mvn:com.google.guava/guava/17.0 + mvn:com.jayway.jsonpath/json-path/2.0.0 + mvn:com.sun.jersey.contribs/jersey-multipart/1.19 + mvn:com.sun.jersey/jersey-core/1.19 + mvn:com.sun.jersey/jersey-core/1.19 + mvn:com.sun.jersey/jersey-server/1.19 + mvn:com.sun.jersey/jersey-server/1.19 + mvn:com.sun.jersey/jersey-servlet/1.19 + mvn:com.sun.jersey/jersey-servlet/1.19 + mvn:com.sun.jersey/jersey-servlet/1.19 + mvn:com.thoughtworks.xstream/xstream/1.4.7 + mvn:commons-beanutils/commons-beanutils/1.9.1 + mvn:commons-codec/commons-codec/1.9 + mvn:commons-codec/commons-codec/1.9 + mvn:commons-collections/commons-collections/3.2.1 + mvn:commons-io/commons-io/2.4 + mvn:commons-lang/commons-lang/2.4 + mvn:io.swagger/swagger-annotations/1.5.3 + mvn:io.swagger/swagger-models/1.5.3 + mvn:javax.servlet/javax.servlet-api/3.1.0 + mvn:javax.servlet/javax.servlet-api/3.1.0 + mvn:javax.ws.rs/jsr311-api/1.1.1 + mvn:net.minidev/asm/1.0.2 + mvn:net.minidev/json-smart/2.1.1 + mvn:net.schmizz/sshj/0.8.1 + mvn:org.apache.brooklyn.camp/camp-base/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn.camp/camp-server/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-api/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-camp/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-commands/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-core/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-jsgui/0.9.0-SNAPSHOT/war + mvn:org.apache.brooklyn/brooklyn-logback-includes/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-rest-api/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-rest-server/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-rt-osgi/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-utils-common/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-utils-common/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-utils-groovy/0.9.0-SNAPSHOT + mvn:org.apache.brooklyn/brooklyn-utils-rest-swagger/0.9.0-SNAPSHOT + mvn:org.apache.commons/commons-compress/1.4 + mvn:org.apache.commons/commons-lang3/3.1 + mvn:org.apache.commons/commons-lang3/3.1 + mvn:org.apache.commons/commons-lang3/3.1 + mvn:org.apache.commons/commons-lang3/3.1 + mvn:org.apache.httpcomponents/httpclient-osgi/4.4.1 + mvn:org.apache.httpcomponents/httpcore-osgi/4.4.1 + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jzlib/1.1.3_2 + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/0.9.9_1 + mvn:org.bouncycastle/bcpkix-jdk15on/1.49 + mvn:org.bouncycastle/bcprov-ext-jdk15on/1.49 + mvn:org.codehaus.groovy/groovy-all/2.3.7 + mvn:org.codehaus.jackson/jackson-core-asl/${jackson.version} + mvn:org.codehaus.jackson/jackson-core-asl/${jackson.version} + mvn:org.codehaus.jackson/jackson-core-asl/${jackson.version} + mvn:org.codehaus.jackson/jackson-jaxrs/${jackson.version} + mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson.version} + mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson.version} + mvn:org.freemarker/freemarker/2.3.22 + mvn:org.jvnet.mimepull/mimepull/1.9.3 + mvn:org.slf4j/jul-to-slf4j/1.6.6 + mvn:org.yaml/snakeyaml/1.11 + wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc + wrap:mvn:com.maxmind.geoip2/geoip2/0.8.1 + wrap:mvn:javax.validation/validation-api/1.1.0.Final + wrap:mvn:org.tukaani/xz/1.4 + wrap:mvn:xpp3/xpp3_min/1.1.4c + + diff --git a/brooklyn-server/parent/pom.xml b/brooklyn-server/parent/pom.xml index 6c1817e0bd..89b17f8d2c 100644 --- a/brooklyn-server/parent/pom.xml +++ b/brooklyn-server/parent/pom.xml @@ -173,26 +173,6 @@ jetty-schemas ${jetty-schemas.version} - - org.codehaus.jackson - jackson-core-asl - ${jackson.version} - - - org.codehaus.jackson - jackson-mapper-asl - ${jackson.version} - - - org.codehaus.jackson - jackson-jaxrs - ${jackson.version} - - - org.codehaus.jackson - jackson-xc - ${jackson.version} - com.fasterxml.jackson.core jackson-annotations @@ -402,7 +382,7 @@ org.jboss.resteasy - resteasy-jackson-provider + resteasy-jackson2-provider ${resteasy.version} diff --git a/brooklyn-server/pom.xml b/brooklyn-server/pom.xml index 4e6012ba8c..38cf522655 100644 --- a/brooklyn-server/pom.xml +++ b/brooklyn-server/pom.xml @@ -95,8 +95,7 @@ 1.6.6 17.0 1.4.7 - 1.9.13 - 2.4.5 + 2.7.0 1.19 4.4.1 3.3.2 @@ -125,12 +124,12 @@ 1.1.1 5.0.34 1.2 - 1.56.24 + 3.8.0 0.11.0-1 4.7.0 r8-20060801 1.0-b01-ea - 3.0.8.Final + 3.0.14.Final 4.3 1.0_jdk5 3.1.0 diff --git a/brooklyn-server/rest/rest-api/pom.xml b/brooklyn-server/rest/rest-api/pom.xml index b379b95e01..fc61f97716 100644 --- a/brooklyn-server/rest/rest-api/pom.xml +++ b/brooklyn-server/rest/rest-api/pom.xml @@ -34,6 +34,11 @@ + + org.apache.brooklyn + brooklyn-core + ${project.version} + com.fasterxml.jackson.core jackson-annotations diff --git a/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogEntitySummary.java b/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogEntitySummary.java index b5f686d8eb..61724bc6ac 100644 --- a/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogEntitySummary.java +++ b/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogEntitySummary.java @@ -23,6 +23,7 @@ import java.util.Objects; import java.util.Set; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -39,6 +40,7 @@ public class CatalogEntitySummary extends CatalogItemSummary { @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY) private final Set effectors; + @JsonCreator public CatalogEntitySummary( @JsonProperty("symbolicName") String symbolicName, @JsonProperty("version") String version, diff --git a/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogItemSummary.java b/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogItemSummary.java index 70b44ed6ae..b2555a13ec 100644 --- a/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogItemSummary.java +++ b/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/CatalogItemSummary.java @@ -26,8 +26,6 @@ import java.util.Objects; import java.util.Set; -import org.apache.commons.lang.builder.EqualsBuilder; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; diff --git a/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java b/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java new file mode 100644 index 0000000000..5ec2a1581a --- /dev/null +++ b/brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/EntityDetail.java @@ -0,0 +1,102 @@ +/* + * 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.brooklyn.rest.domain; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +public class EntityDetail extends EntitySummary { + + private static final long serialVersionUID = 100490507982229165L; + + private final String parentId; + @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY) + private final List children; + private final List groupIds; + private final Map members; + + public EntityDetail( + @JsonProperty("id") String id, + @JsonProperty("parentId") String parentId, + @JsonProperty("name") String name, + @JsonProperty("type") String type, + @JsonProperty("catalogItemId") String catalogItemId, + @JsonProperty("children") List children, + @JsonProperty("groupIds") List groupIds, + @JsonProperty("members") Map members) { + super(id, name, type, catalogItemId, null); + this.parentId = parentId; + this.children = (children == null) ? ImmutableList.of() : ImmutableList.copyOf(children); + this.groupIds = (groupIds == null) ? ImmutableList.of() : ImmutableList.copyOf(groupIds); + this.members = (members == null) ? ImmutableMap. of() : ImmutableMap.copyOf(members); + } + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public String getParentId() { + return parentId; + } + + public List getChildren() { + return children; + } + + public List getGroupIds() { + return groupIds; + } + + public Map getMembers() { + return members; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof EntityDetail)) return false; + if (!super.equals(o)) return false; + EntityDetail that = (EntityDetail) o; + return Objects.equals(parentId, that.parentId) && + Objects.equals(children, that.children) && + Objects.equals(groupIds, that.groupIds) && + Objects.equals(members, that.members); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), parentId, children, groupIds, members); + } + + @Override + public String toString() { + return "EntityDetail{" + + "parentId='" + parentId + '\'' + + ", children=" + children + + ", groupIds=" + groupIds + + ", members=" + members + + '}'; + } +} diff --git a/brooklyn-server/rest/rest-client/pom.xml b/brooklyn-server/rest/rest-client/pom.xml index 5b2714831b..1981975e4f 100644 --- a/brooklyn-server/rest/rest-client/pom.xml +++ b/brooklyn-server/rest/rest-client/pom.xml @@ -56,7 +56,7 @@ org.jboss.resteasy - resteasy-jackson-provider + resteasy-jackson2-provider org.slf4j diff --git a/brooklyn-server/rest/rest-server/pom.xml b/brooklyn-server/rest/rest-server/pom.xml index fdee3a5af4..f208d8f6a9 100644 --- a/brooklyn-server/rest/rest-server/pom.xml +++ b/brooklyn-server/rest/rest-server/pom.xml @@ -7,9 +7,9 @@ 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 @@ -39,11 +39,6 @@ brooklyn-rest-api ${project.version} - - org.apache.brooklyn - brooklyn-core - ${project.version} - org.apache.brooklyn brooklyn-camp @@ -100,14 +95,9 @@ slf4j-api - com.sun.jersey - jersey-json - - - com.sun.xml.bind - jaxb-impl - - + com.fasterxml.jackson.datatype + jackson-datatype-guava + ${fasterxml.jackson.version} com.sun.jersey @@ -133,23 +123,7 @@ org.eclipse.jetty jetty-servlet - - org.codehaus.jackson - jackson-core-asl - - - org.codehaus.jackson - jackson-mapper-asl - - - org.codehaus.jackson - jackson-jaxrs - - - org.codehaus.jackson - jackson-xc - - + org.apache.brooklyn brooklyn-test-support diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java index a8cc909f82..9057a2cf5e 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/AbstractBrooklynRestResource.java @@ -33,7 +33,8 @@ import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.time.Duration; -import org.codehaus.jackson.map.ObjectMapper; + +import com.fasterxml.jackson.databind.ObjectMapper; public abstract class AbstractBrooklynRestResource implements ManagementContextInjectable { diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java index aa31dcba3d..df92e1c7b0 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java @@ -76,12 +76,12 @@ import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.javalang.JavaClassNames; import org.apache.brooklyn.util.text.Strings; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.node.ArrayNode; -import org.codehaus.jackson.node.ObjectNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.base.Throwables; import com.google.common.collect.FluentIterable; import com.google.common.collect.Iterables; diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/WebResourceUtils.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/WebResourceUtils.java index 1a74a339fe..da72c6f74f 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/WebResourceUtils.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/WebResourceUtils.java @@ -27,7 +27,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; @@ -37,6 +36,7 @@ import org.apache.brooklyn.util.net.Urls; import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.ImmutableMap; import com.sun.jersey.spi.container.ContainerResponse; diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BidiSerialization.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BidiSerialization.java index d53e10011c..93cae3fe7a 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BidiSerialization.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BidiSerialization.java @@ -25,15 +25,14 @@ import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.api.objs.BrooklynObject; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.JsonDeserializer; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; -import org.codehaus.jackson.map.module.SimpleModule; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; public class BidiSerialization { @@ -65,14 +64,14 @@ public abstract static class AbstractWithManagementContextSerialization { protected class Serializer extends JsonSerializer { @Override - public void serialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + public void serialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException { AbstractWithManagementContextSerialization.this.serialize(value, jgen, provider); } } protected class Deserializer extends JsonDeserializer { @Override - public T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + public T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { return AbstractWithManagementContextSerialization.this.deserialize(jp, ctxt); } } @@ -95,27 +94,27 @@ public JsonDeserializer getDeserializer() { return deserializer; } - public void serialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + public void serialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStartObject(); writeBody(value, jgen, provider); jgen.writeEndObject(); } - protected void writeBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException, JsonProcessingException { + protected void writeBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStringField("type", value.getClass().getCanonicalName()); customWriteBody(value, jgen, provider); } - public abstract void customWriteBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException; + public abstract void customWriteBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException; - public T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + public T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { @SuppressWarnings("unchecked") Map values = jp.readValueAs(Map.class); String type = (String) values.get("type"); return customReadBody(type, values, jp, ctxt); } - protected abstract T customReadBody(String type, Map values, JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException; + protected abstract T customReadBody(String type, Map values, JsonParser jp, DeserializationContext ctxt) throws IOException; public void install(SimpleModule module) { module.addSerializer(type, serializer); @@ -126,9 +125,9 @@ public void install(SimpleModule module) { public static class ManagementContextSerialization extends AbstractWithManagementContextSerialization { public ManagementContextSerialization(ManagementContext mgmt) { super(ManagementContext.class, mgmt); } @Override - public void customWriteBody(ManagementContext value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {} + public void customWriteBody(ManagementContext value, JsonGenerator jgen, SerializerProvider provider) throws IOException {} @Override - protected ManagementContext customReadBody(String type, Map values, JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + protected ManagementContext customReadBody(String type, Map values, JsonParser jp, DeserializationContext ctxt) throws IOException { return mgmt; } } @@ -138,16 +137,16 @@ public AbstractBrooklynObjectSerialization(Class type, ManagementContext mgmt super(type, mgmt); } @Override - protected void writeBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException, JsonProcessingException { + protected void writeBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStringField("type", type.getCanonicalName()); customWriteBody(value, jgen, provider); } @Override - public void customWriteBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + public void customWriteBody(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStringField("id", value.getId()); } @Override - protected T customReadBody(String type, Map values, JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + protected T customReadBody(String type, Map values, JsonParser jp, DeserializationContext ctxt) throws IOException { return getInstanceFromId((String) values.get("id")); } protected abstract T getInstanceFromId(String id); diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java index 053e8b4f50..a45960daca 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonJsonProvider.java @@ -25,20 +25,18 @@ import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; -import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.ManagementContextInjectable; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.core.server.BrooklynServiceAttributes; import org.apache.brooklyn.rest.util.OsgiCompat; -import org.codehaus.jackson.Version; -import org.codehaus.jackson.jaxrs.JacksonJsonProvider; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.module.SimpleModule; -import org.codehaus.jackson.map.type.TypeFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + public class BrooklynJacksonJsonProvider extends JacksonJsonProvider implements ManagementContextInjectable { private static final Logger log = LoggerFactory.getLogger(BrooklynJacksonJsonProvider.class); @@ -136,11 +134,11 @@ public static ObjectMapper newPrivateObjectMapper(ManagementContext mgmt) { if (mgmt == null) { throw new IllegalStateException("No management context available for creating ObjectMapper"); } - +/* SerializationConfig defaultConfig = new ObjectMapper().getSerializationConfig(); SerializationConfig sc = new SerializationConfig( - defaultConfig.getClassIntrospector() /* ObjectMapper.DEFAULT_INTROSPECTOR */, - defaultConfig.getAnnotationIntrospector() /* ObjectMapper.DEFAULT_ANNOTATION_INTROSPECTOR */, + defaultConfig.getClassIntrospector() /* ObjectMapper.DEFAULT_INTROSPECTOR *, + defaultConfig.getAnnotationIntrospector() /* ObjectMapper.DEFAULT_ANNOTATION_INTROSPECTOR *, new PossiblyStrictPreferringFieldsVisibilityChecker(), null, null, TypeFactory.defaultInstance(), null); @@ -148,6 +146,8 @@ public static ObjectMapper newPrivateObjectMapper(ManagementContext mgmt) { sp.setUnknownTypeSerializer(new ErrorAndToStringUnknownTypeSerializer()); ObjectMapper mapper = new ObjectMapper(null, sp, null, sc, null); +*/ + ObjectMapper mapper = new ObjectMapper(); SimpleModule mapperModule = new SimpleModule("Brooklyn", new Version(0, 0, 0, "ignored")); new BidiSerialization.ManagementContextSerialization(mgmt).install(mapperModule); diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java index 3078524819..12b978c5f8 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ConfigurableSerializerProvider.java @@ -21,16 +21,17 @@ import java.io.IOException; import org.apache.brooklyn.util.exceptions.Exceptions; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.JsonStreamContext; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.SerializerFactory; -import org.codehaus.jackson.map.ser.StdSerializerProvider; -import org.codehaus.jackson.type.JavaType; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonStreamContext; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializationConfig; +import com.fasterxml.jackson.databind.ser.SerializerFactory; /** allows the serializer-of-last-resort to be customized, ie used for unknown-types */ +/* final class ConfigurableSerializerProvider extends StdSerializerProvider { public ConfigurableSerializerProvider() {} @@ -91,3 +92,4 @@ protected void onSerializationException(JsonStreamContext ctxt, JsonGenerator jg } } } +*/ diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ErrorAndToStringUnknownTypeSerializer.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ErrorAndToStringUnknownTypeSerializer.java index 8d18c8ab19..e008be067f 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ErrorAndToStringUnknownTypeSerializer.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/ErrorAndToStringUnknownTypeSerializer.java @@ -27,17 +27,18 @@ import org.apache.brooklyn.util.collections.MutableSet; import org.apache.brooklyn.util.javalang.Reflections; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.JsonStreamContext; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.SerializerProvider; -import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.codehaus.jackson.map.ser.impl.UnknownSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonStreamContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.impl.UnknownSerializer; + /** * for non-json-serializable classes (quite a lot of them!) simply provide a sensible error message and a toString. * TODO maybe we want to attempt to serialize fields instead? (but being careful not to be self-referential!) diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java deleted file mode 100644 index 1c2f8c180f..0000000000 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/MultimapSerializer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.brooklyn.rest.util.json; - -import java.io.IOException; -import java.util.Collection; -import java.util.Map; - -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.SerializerProvider; -import org.codehaus.jackson.map.ser.std.SerializerBase; - -import com.google.common.annotations.Beta; -import com.google.common.collect.Lists; -import com.google.common.collect.Multimap; - -/** - * Provides a serializer for {@link Multimap} instances. - * - * When Brooklyn's Jackson dependency is updated from org.codehaus.jackson:1.9.13 to - * com.fasterxml.jackson:2.3+ then this class should be replaced with a dependency on - * jackson-datatype-guava and a GuavaModule registered with Brooklyn's ObjectMapper. - */ -@Beta -public class MultimapSerializer extends SerializerBase> { - - @SuppressWarnings({ "unchecked", "rawtypes" }) - protected MultimapSerializer() { - super((Class>) (Class) Multimap.class); - } - - @Override - public void serialize(Multimap, ?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - jgen.writeStartObject(); - writeEntries(value, jgen, provider); - jgen.writeEndObject(); - } - - private void writeEntries(Multimap, ?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - for (Map.Entry, ? extends Collection>> entry : value.asMap().entrySet()) { - provider.findKeySerializer(provider.constructType(String.class), null) - .serialize(entry.getKey(), jgen, provider); - provider.defaultSerializeValue(Lists.newArrayList(entry.getValue()), jgen); - } - } -} diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java index 502f0638e8..e47446752b 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java @@ -22,13 +22,14 @@ import java.lang.reflect.Member; import java.lang.reflect.Method; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; -import org.codehaus.jackson.annotate.JsonMethod; -import org.codehaus.jackson.map.introspect.AnnotatedField; -import org.codehaus.jackson.map.introspect.AnnotatedMember; -import org.codehaus.jackson.map.introspect.AnnotatedMethod; -import org.codehaus.jackson.map.introspect.VisibilityChecker; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.introspect.AnnotatedField; +import com.fasterxml.jackson.databind.introspect.AnnotatedMember; +import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; +import com.fasterxml.jackson.databind.introspect.VisibilityChecker; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.*; /** a visibility checker which disables getters, but allows private access, * unless {@link BidiSerialization#isStrictSerialization()} is enabled in which case public fields or annotations must be used. @@ -39,13 +40,13 @@ * causes infinite recursion) **/ public class PossiblyStrictPreferringFieldsVisibilityChecker implements VisibilityChecker { - VisibilityChecker> + VisibilityChecker> vizDefault = new VisibilityChecker.Std(Visibility.NONE, Visibility.NONE, Visibility.NONE, Visibility.ANY, Visibility.ANY), vizStrict = new VisibilityChecker.Std(Visibility.NONE, Visibility.NONE, Visibility.NONE, Visibility.PUBLIC_ONLY, Visibility.PUBLIC_ONLY); @Override public PossiblyStrictPreferringFieldsVisibilityChecker with(JsonAutoDetect ann) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker with(Visibility v) { throw new UnsupportedOperationException(); } - @Override public PossiblyStrictPreferringFieldsVisibilityChecker withVisibility(JsonMethod method, Visibility v) { throw new UnsupportedOperationException(); } + @Override public PossiblyStrictPreferringFieldsVisibilityChecker withVisibility(PropertyAccessor method, Visibility v) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker withGetterVisibility(Visibility v) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker withIsGetterVisibility(Visibility v) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker withSetterVisibility(Visibility v) { throw new UnsupportedOperationException(); } diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java index a8748a74c1..3f42c8d591 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java @@ -37,8 +37,6 @@ import org.apache.brooklyn.rest.testing.mocks.RestMockSimpleEntity; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.text.StringEscapes; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; @@ -63,7 +61,7 @@ public class DescendantsTest extends BrooklynRestResourceTest { build(); @Test - public void testDescendantsInSimpleDeployedApplication() throws InterruptedException, TimeoutException, JsonGenerationException, JsonMappingException, UniformInterfaceException, ClientHandlerException, IOException { + public void testDescendantsInSimpleDeployedApplication() throws InterruptedException, TimeoutException, UniformInterfaceException, ClientHandlerException, IOException { ClientResponse response = clientDeploy(simpleSpec); assertTrue(response.getStatus()/100 == 2, "response is "+response); Application application = Iterables.getOnlyElement( getManagementContext().getApplications() ); diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java index d6857fb544..1c091da5f5 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java @@ -38,14 +38,14 @@ import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.http.HttpAsserts; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.TypeReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java index e63a2397b5..45aec4ab86 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java @@ -26,10 +26,10 @@ import org.apache.brooklyn.core.mgmt.ManagementContextInjectable; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.codehaus.jackson.map.ObjectMapper; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Preconditions; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java index c644643168..b94e73c185 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java @@ -28,7 +28,6 @@ import javax.ws.rs.core.MediaType; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -43,6 +42,7 @@ import org.apache.brooklyn.util.repeat.Repeater; import org.apache.brooklyn.util.time.Duration; +import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.UniformInterfaceException; import com.sun.jersey.spi.inject.Errors; diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java index 7a255a32bf..9542eda085 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java @@ -28,9 +28,6 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.utils.URIBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.annotate.JsonSerialize; import org.eclipse.jetty.server.Server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,6 +49,9 @@ import org.apache.brooklyn.util.stream.Streams; import org.apache.brooklyn.util.text.Strings; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder;
- * When Brooklyn's Jackson dependency is updated from org.codehaus.jackson:1.9.13 to - * com.fasterxml.jackson:2.3+ then this class should be replaced with a dependency on - * jackson-datatype-guava and a GuavaModule registered with Brooklyn's ObjectMapper. - */ -@Beta -public class MultimapSerializer extends SerializerBase> { - - @SuppressWarnings({ "unchecked", "rawtypes" }) - protected MultimapSerializer() { - super((Class>) (Class) Multimap.class); - } - - @Override - public void serialize(Multimap, ?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - jgen.writeStartObject(); - writeEntries(value, jgen, provider); - jgen.writeEndObject(); - } - - private void writeEntries(Multimap, ?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - for (Map.Entry, ? extends Collection>> entry : value.asMap().entrySet()) { - provider.findKeySerializer(provider.constructType(String.class), null) - .serialize(entry.getKey(), jgen, provider); - provider.defaultSerializeValue(Lists.newArrayList(entry.getValue()), jgen); - } - } -} diff --git a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java index 502f0638e8..e47446752b 100644 --- a/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java +++ b/brooklyn-server/rest/rest-server/src/main/java/org/apache/brooklyn/rest/util/json/PossiblyStrictPreferringFieldsVisibilityChecker.java @@ -22,13 +22,14 @@ import java.lang.reflect.Member; import java.lang.reflect.Method; -import org.codehaus.jackson.annotate.JsonAutoDetect; -import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility; -import org.codehaus.jackson.annotate.JsonMethod; -import org.codehaus.jackson.map.introspect.AnnotatedField; -import org.codehaus.jackson.map.introspect.AnnotatedMember; -import org.codehaus.jackson.map.introspect.AnnotatedMethod; -import org.codehaus.jackson.map.introspect.VisibilityChecker; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.introspect.AnnotatedField; +import com.fasterxml.jackson.databind.introspect.AnnotatedMember; +import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; +import com.fasterxml.jackson.databind.introspect.VisibilityChecker; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.*; /** a visibility checker which disables getters, but allows private access, * unless {@link BidiSerialization#isStrictSerialization()} is enabled in which case public fields or annotations must be used. @@ -39,13 +40,13 @@ * causes infinite recursion) **/ public class PossiblyStrictPreferringFieldsVisibilityChecker implements VisibilityChecker { - VisibilityChecker> + VisibilityChecker> vizDefault = new VisibilityChecker.Std(Visibility.NONE, Visibility.NONE, Visibility.NONE, Visibility.ANY, Visibility.ANY), vizStrict = new VisibilityChecker.Std(Visibility.NONE, Visibility.NONE, Visibility.NONE, Visibility.PUBLIC_ONLY, Visibility.PUBLIC_ONLY); @Override public PossiblyStrictPreferringFieldsVisibilityChecker with(JsonAutoDetect ann) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker with(Visibility v) { throw new UnsupportedOperationException(); } - @Override public PossiblyStrictPreferringFieldsVisibilityChecker withVisibility(JsonMethod method, Visibility v) { throw new UnsupportedOperationException(); } + @Override public PossiblyStrictPreferringFieldsVisibilityChecker withVisibility(PropertyAccessor method, Visibility v) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker withGetterVisibility(Visibility v) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker withIsGetterVisibility(Visibility v) { throw new UnsupportedOperationException(); } @Override public PossiblyStrictPreferringFieldsVisibilityChecker withSetterVisibility(Visibility v) { throw new UnsupportedOperationException(); } diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java index a8748a74c1..3f42c8d591 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/DescendantsTest.java @@ -37,8 +37,6 @@ import org.apache.brooklyn.rest.testing.mocks.RestMockSimpleEntity; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.text.StringEscapes; -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Test; @@ -63,7 +61,7 @@ public class DescendantsTest extends BrooklynRestResourceTest { build(); @Test - public void testDescendantsInSimpleDeployedApplication() throws InterruptedException, TimeoutException, JsonGenerationException, JsonMappingException, UniformInterfaceException, ClientHandlerException, IOException { + public void testDescendantsInSimpleDeployedApplication() throws InterruptedException, TimeoutException, UniformInterfaceException, ClientHandlerException, IOException { ClientResponse response = clientDeploy(simpleSpec); assertTrue(response.getStatus()/100 == 2, "response is "+response); Application application = Iterables.getOnlyElement( getManagementContext().getApplications() ); diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java index d6857fb544..1c091da5f5 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/resources/EntityResourceTest.java @@ -38,14 +38,14 @@ import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.http.HttpAsserts; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.TypeReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java index e63a2397b5..45aec4ab86 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestApiTest.java @@ -26,10 +26,10 @@ import org.apache.brooklyn.core.mgmt.ManagementContextInjectable; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.codehaus.jackson.map.ObjectMapper; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeMethod; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Preconditions; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java index c644643168..b94e73c185 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/testing/BrooklynRestResourceTest.java @@ -28,7 +28,6 @@ import javax.ws.rs.core.MediaType; -import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -43,6 +42,7 @@ import org.apache.brooklyn.util.repeat.Repeater; import org.apache.brooklyn.util.time.Duration; +import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.UniformInterfaceException; import com.sun.jersey.spi.inject.Errors; diff --git a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java index 7a255a32bf..9542eda085 100644 --- a/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java +++ b/brooklyn-server/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerTest.java @@ -28,9 +28,6 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.utils.URIBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.annotate.JsonSerialize; import org.eclipse.jetty.server.Server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,6 +49,9 @@ import org.apache.brooklyn.util.stream.Streams; import org.apache.brooklyn.util.text.Strings; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder;