Skip to content

Commit

Permalink
Spotless Apply
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Sep 26, 2023
1 parent 96f3ef0 commit fb2281e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import com.fasterxml.jackson.annotation.JsonProperty;

public class CreateUpdateDatasourceResponse{
@JsonProperty("status")
private String status;

public CreateUpdateDatasourceResponse(String status) {
this.status = status;
}
public class CreateUpdateDatasourceResponse {
@JsonProperty("status")
private String status;

public CreateUpdateDatasourceResponse(String status) {
this.status = status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

package org.opensearch.sql.datasources.transport;

import static org.opensearch.sql.protocol.response.format.JsonResponseFormatter.Style.PRETTY;

import org.opensearch.action.ActionType;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
Expand All @@ -17,13 +19,10 @@
import org.opensearch.sql.datasources.model.transport.CreateDataSourceActionRequest;
import org.opensearch.sql.datasources.model.transport.CreateDataSourceActionResponse;
import org.opensearch.sql.datasources.service.DataSourceServiceImpl;
import org.opensearch.sql.executor.ExecutionEngine;
import org.opensearch.sql.protocol.response.format.JsonResponseFormatter;
import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;

import static org.opensearch.sql.protocol.response.format.JsonResponseFormatter.Style.PRETTY;

public class TransportCreateDataSourceAction
extends HandledTransportAction<CreateDataSourceActionRequest, CreateDataSourceActionResponse> {
public static final String NAME = "cluster:admin/opensearch/ql/datasources/create";
Expand Down Expand Up @@ -61,14 +60,15 @@ protected void doExecute(
DataSourceMetadata dataSourceMetadata = request.getDataSourceMetadata();
dataSourceService.createDataSource(dataSourceMetadata);
String responseContent =
new JsonResponseFormatter<CreateUpdateDatasourceResponse>(PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
return response;
}
}.format(new CreateUpdateDatasourceResponse("Created DataSource with name " + dataSourceMetadata.getName()));
actionListener.onResponse(
new CreateDataSourceActionResponse(responseContent));
new JsonResponseFormatter<CreateUpdateDatasourceResponse>(PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
return response;
}
}.format(
new CreateUpdateDatasourceResponse(
"Created DataSource with name " + dataSourceMetadata.getName()));
actionListener.onResponse(new CreateDataSourceActionResponse(responseContent));
} catch (Exception e) {
actionListener.onFailure(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

package org.opensearch.sql.datasources.transport;

import static org.opensearch.sql.protocol.response.format.JsonResponseFormatter.Style.PRETTY;

import org.opensearch.action.ActionType;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
Expand All @@ -20,8 +22,6 @@
import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;

import static org.opensearch.sql.protocol.response.format.JsonResponseFormatter.Style.PRETTY;

public class TransportUpdateDataSourceAction
extends HandledTransportAction<UpdateDataSourceActionRequest, UpdateDataSourceActionResponse> {

Expand Down Expand Up @@ -59,14 +59,15 @@ protected void doExecute(
try {
dataSourceService.updateDataSource(request.getDataSourceMetadata());
String responseContent =
new JsonResponseFormatter<CreateUpdateDatasourceResponse>(PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
return response;
}
}.format(new CreateUpdateDatasourceResponse("Updated DataSource with name " + request.getDataSourceMetadata().getName()));
actionListener.onResponse(
new UpdateDataSourceActionResponse(responseContent));
new JsonResponseFormatter<CreateUpdateDatasourceResponse>(PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
return response;
}
}.format(
new CreateUpdateDatasourceResponse(
"Updated DataSource with name " + request.getDataSourceMetadata().getName()));
actionListener.onResponse(new UpdateDataSourceActionResponse(responseContent));
} catch (Exception e) {
actionListener.onFailure(e);
}
Expand Down

0 comments on commit fb2281e

Please sign in to comment.