use of io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module in project syndesis-qe by syndesisio.
the class AbstractStep method withCustomDatashape.
/**
* Sets the custom datashape to the action object.
* @param action action
* @param connectorDescriptor action's connector descriptor to fill other values
* @param direction "in" for InputDataShape, "out" for OutputDataShape
* @param kind {@link DataShapeKinds} value
* @param datashape Datashape specification
* @return action object with datashapes
*/
Action withCustomDatashape(Action action, ConnectorDescriptor connectorDescriptor, String direction, DataShapeKinds kind, String datashape) {
// This will set datashapes and property definitions from the connectorDescriptor
Action a = generateStepAction(action, connectorDescriptor);
ObjectMapper mapper = new ObjectMapper().registerModules(new Jdk8Module());
try {
JSONObject json = new JSONObject(mapper.writeValueAsString(a));
DataShape ds = new DataShape.Builder().name(kind.toString()).description(kind.toString()).kind(kind).specification(datashape).build();
json.getJSONObject("descriptor").put("in".equals(direction) ? "inputDataShape" : "outputDataShape", new JSONObject(mapper.writeValueAsString(ds)));
a = JsonUtils.reader().forType(Action.class).readValue(json.toString());
} catch (IOException ex) {
log.error("Error: " + ex);
}
return a;
}
use of io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module in project dcos-commons by mesosphere.
the class TaskStatusesTracker method getJson.
// CHECKSTYLE:ON NestedForDepth
public Response getJson(@QueryParam("plan") String filterPlan, @QueryParam("phase") String filterPhase, @QueryParam("step") String filterStep, @QueryParam("sync") boolean requireSync) {
ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.registerModule(new Jdk8Module());
jsonMapper.registerModule(new JsonOrgModule());
List<PlanResponse> serviceResponse = getTaskStatuses(filterPlan, filterPhase, filterStep);
JSONArray response = jsonMapper.convertValue(serviceResponse, JSONArray.class);
return ResponseUtils.jsonOkResponse(response);
}
use of io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module in project dcos-commons by mesosphere.
the class OfferOutcomeTrackerV2 method getJson.
public Response getJson(@QueryParam("plan") String plan, @QueryParam("phase") String phase, @QueryParam("step") String step, @QueryParam("sync") boolean sync) {
ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.registerModule(new Jdk8Module());
jsonMapper.registerModule(new JsonOrgModule());
JSONObject response = jsonMapper.convertValue(this.getSummary(), JSONObject.class);
response.put("offers", this.getSummary().toJson());
return ResponseUtils.jsonOkResponse(response);
}
use of io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module in project dcos-commons by mesosphere.
the class TaskReservationsTracker method getJson.
public Response getJson(@QueryParam("plan") String filterPlan, @QueryParam("phase") String filterPhase, @QueryParam("step") String filterStep, @QueryParam("sync") boolean requireSync) {
Map<String, Set<String>> resourceIdsByAgentHost = SchedulerUtils.getResourceIdsByAgentHost(stateStore);
ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.registerModule(new Jdk8Module());
jsonMapper.registerModule(new JsonOrgModule());
JSONObject response = jsonMapper.convertValue(resourceIdsByAgentHost, JSONObject.class);
return ResponseUtils.jsonOkResponse(response);
}
use of io.mantisrx.shaded.com.fasterxml.jackson.datatype.jdk8.Jdk8Module in project atlasdb by palantir.
the class TimeLockServerLauncher method initialize.
@Override
public void initialize(Bootstrap<TimeLockServerConfiguration> bootstrap) {
MetricRegistry metricRegistry = SharedMetricRegistries.getOrCreate("AtlasDbTest" + UUID.randomUUID().toString());
TaggedMetricRegistry taggedMetricRegistry = new DefaultTaggedMetricRegistry();
AtlasDbMetrics.setMetricRegistries(metricRegistry, taggedMetricRegistry);
bootstrap.setMetricRegistry(metricRegistry);
bootstrap.getObjectMapper().registerSubtypes(NonBlockingFileAppenderFactory.class);
bootstrap.getObjectMapper().registerModule(new Jdk8Module());
super.initialize(bootstrap);
}
Aggregations