Skip to content

Commit

Permalink
[HWKMETRICS-185] Add Jackson 1.9 annotations to the REST common classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Negrea committed Aug 13, 2015
1 parent 82ed6db commit df8481f
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 6 deletions.
6 changes: 6 additions & 0 deletions api/metrics-api-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>

<!-- test -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@
public class AvailabilityDataPoint {

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private long timestamp;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private String value;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private Map<String, String> tags = emptyMap();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@
*
* @author jsanda
*/
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
public class Counter {

@JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private String id;

@JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private List<CounterDataPoint> data;

public String getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,21 @@
public class CounterDataPoint {

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private long timestamp;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private Long value;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private Map<String, String> tags = Collections.emptyMap();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import org.hawkular.metrics.core.api.DataPoint;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
import com.wordnik.swagger.annotations.ApiModel;
Expand All @@ -33,14 +35,21 @@
public class GaugeDataPoint {

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
private long timestamp;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
private Double value;

@JsonProperty
@JsonInclude(Include.NON_EMPTY)
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private Map<String, String> tags = Collections.emptyMap();


/**
* Used by JAX-RS/Jackson to deserialize HTTP request data
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @author Thomas Segismont
* @see TagsConverter
*/
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
public class Tags {
public static final String LIST_DELIMITER = ",";
public static final String TAG_DELIMITER = ":";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,33 @@
* @author jsanda
*/
@ApiModel(description = "The definition of a metric to create")
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
public class MetricDefinition {

// TODO Do we need this?
@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private String tenantId;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private String id;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private Map<String, String> tags;

@JsonProperty
@org.codehaus.jackson.annotate.JsonProperty
@org.codehaus.jackson.map.annotate.JsonSerialize(
include = org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion.NON_EMPTY)
private Integer dataRetention;

public MetricDefinition() {
Expand Down
14 changes: 8 additions & 6 deletions api/metrics-api-jaxrs-1.1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,19 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.0.redhat-4</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.0.redhat-4</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.0.redhat-4</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -95,12 +103,6 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jettison-provider</artifactId>
<version>2.3.9.Final-redhat-7</version>
</dependency>

<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
Expand Down

0 comments on commit df8481f

Please sign in to comment.