Skip to content

Commit

Permalink
Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisLainez committed Apr 24, 2024
1 parent 043840f commit 0fdc267
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 124 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/*
* Copyright 2024 Conductor Authors.
* <p>
* Licensed 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 com.netflix.conductor.client.exception;


import org.glassfish.jersey.client.ClientResponse;

/**
* This is a convenience class to capture response codes that are less than 200
* It was deprecated after Jersey1, but in order to avoid a bigger refactor, we keep something
* similar
* This is a convenience class to capture response codes that are less than 200 It was deprecated
* after Jersey1, but in order to avoid a bigger refactor, we keep something similar
*/
public class UniformInterfaceException extends RuntimeException {
private final transient ClientResponse r;
Expand All @@ -28,7 +38,8 @@ public UniformInterfaceException(String message, ClientResponse r) {
this(message, r, true);
}

public UniformInterfaceException(String message, ClientResponse r, boolean bufferResponseEntity) {
public UniformInterfaceException(
String message, ClientResponse r, boolean bufferResponseEntity) {
super(message);
if (bufferResponseEntity) {
r.bufferEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,16 @@

import javax.ws.rs.core.UriBuilder;

import com.netflix.conductor.client.exception.UniformInterfaceException;
import com.sun.jersey.api.client.ClientHandlerException;
import jakarta.ws.rs.client.Entity;
import org.glassfish.jersey.client.ClientResponse;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.GenericType;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.Validate;
import org.glassfish.jersey.client.ClientResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.netflix.conductor.client.config.ConductorClientConfiguration;
import com.netflix.conductor.client.config.DefaultConductorClientConfiguration;
import com.netflix.conductor.client.exception.ConductorClientException;
import com.netflix.conductor.client.exception.UniformInterfaceException;
import com.netflix.conductor.common.config.ObjectMapperProvider;
import com.netflix.conductor.common.model.BulkResponse;
import com.netflix.conductor.common.run.ExternalStorageLocation;
Expand All @@ -45,10 +41,12 @@
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.sun.jersey.api.client.ClientHandlerException;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.GenericType;

/**
* Abstract client for the REST server
*/
/** Abstract client for the REST server */
public abstract class ClientBase {

private static final Logger LOGGER = LoggerFactory.getLogger(ClientBase.class);
Expand Down Expand Up @@ -248,10 +246,10 @@ private <T> T getForEntity(
* Uses the {@link PayloadStorage} for storing large payloads. Gets the uri for storing the
* payload from the server and then uploads to this location
*
* @param payloadType the {@link
* com.netflix.conductor.common.utils.ExternalPayloadStorage.PayloadType} to be uploaded
* @param payloadType the {@link
* com.netflix.conductor.common.utils.ExternalPayloadStorage.PayloadType} to be uploaded
* @param payloadBytes the byte array containing the payload
* @param payloadSize the size of the payload
* @param payloadSize the size of the payload
* @return the path where the payload is stored in external storage
*/
protected String uploadToExternalPayloadStorage(
Expand All @@ -274,8 +272,8 @@ protected String uploadToExternalPayloadStorage(
* the uri of the payload fom the server and then downloads from this location.
*
* @param payloadType the {@link
* com.netflix.conductor.common.utils.ExternalPayloadStorage.PayloadType} to be downloaded
* @param path the relative of the payload in external storage
* com.netflix.conductor.common.utils.ExternalPayloadStorage.PayloadType} to be downloaded
* @param path the relative of the payload in external storage
* @return the payload object that is stored in external storage
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import java.net.URI;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientResponse;

import com.netflix.conductor.common.config.ObjectMapperProvider;
import com.netflix.conductor.common.model.BulkResponse;
Expand All @@ -22,21 +24,16 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;


import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.MediaType;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientResponse;

public class ClientRequestHandler {
private final Client client;

public ClientRequestHandler(
ClientConfig config, ClientRequestFilter... filters) {
public ClientRequestHandler(ClientConfig config, ClientRequestFilter... filters) {
ObjectMapper objectMapper = new ObjectMapperProvider().getObjectMapper();

// https://github.com/FasterXML/jackson-databind/issues/2683
Expand All @@ -47,7 +44,7 @@ public ClientRequestHandler(
JacksonJsonProvider provider = new JacksonJsonProvider(objectMapper);
config.register(provider);

this.client = ClientBuilder.newBuilder().newClient(config);
this.client = ClientBuilder.newBuilder().newClient(config);

for (ClientRequestFilter filter : filters) {
this.client.register(filter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@

import java.util.List;

import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.ClientFilter;
import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.core.GenericType;
import org.apache.commons.lang3.Validate;
import org.glassfish.jersey.client.ClientConfig;

import com.netflix.conductor.client.config.ConductorClientConfiguration;
import com.netflix.conductor.client.config.DefaultConductorClientConfiguration;
import com.netflix.conductor.common.metadata.events.EventHandler;
import org.glassfish.jersey.client.ClientConfig;

import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.core.GenericType;

// Client class for all Event Handler operations
public class EventClient extends ClientBase {
Expand All @@ -43,14 +41,12 @@ public EventClient(ClientConfig clientConfig) {
this(clientConfig, new DefaultConductorClientConfiguration(), null);
}


/**
* @param config config REST Client configuration
* @param filters Chain of client side filters to be applied per request
*/
public EventClient(ClientConfig config, ClientRequestFilter... filters) {
this(config, new DefaultConductorClientConfiguration(), filters);
this(config, new DefaultConductorClientConfiguration(), filters);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

import java.util.List;

import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.core.GenericType;
import org.apache.commons.lang3.Validate;
import org.glassfish.jersey.client.ClientConfig;

import com.netflix.conductor.client.config.ConductorClientConfiguration;
import com.netflix.conductor.client.config.DefaultConductorClientConfiguration;
import com.netflix.conductor.common.metadata.tasks.TaskDef;
import com.netflix.conductor.common.metadata.workflow.WorkflowDef;
import org.glassfish.jersey.client.ClientConfig;

import jakarta.ws.rs.client.ClientRequestFilter;
import jakarta.ws.rs.core.GenericType;

public class MetadataClient extends ClientBase {

Expand All @@ -46,8 +46,8 @@ public MetadataClient(ClientConfig clientConfig) {
* @param config config REST Client configuration
* @param filters Chain of client side filters to be applied per request
*/
public MetadataClient(ClientConfig config, ClientRequestFilter... filters) {
this(config, new DefaultConductorClientConfiguration(), filters);
public MetadataClient(ClientConfig config, ClientRequestFilter... filters) {
this(config, new DefaultConductorClientConfiguration(), filters);
}

/**
Expand Down
Loading

0 comments on commit 0fdc267

Please sign in to comment.