Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run CI for: #4438 #4439

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion clients/java/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</parent>

<properties>
<version.httpclient>5.3</version.httpclient>
<engine.runtime>${project.build.directory}/camunda-tomcat</engine.runtime>
<tomcat.runtime>${engine.runtime}/server/apache-tomcat-${version.tomcat}</tomcat.runtime>
<http.port>${tomcat.connector.http.port}</http.port>
Expand Down
16 changes: 6 additions & 10 deletions connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ camunda-connect
===============

<p>
<a href="http://camunda.com/">Home</a> |
<a href="https://camunda.com/">Home</a> |
<a href="https://docs.camunda.org/manual/latest/reference/connect/">Documentation</a> |
<a href="https://forum.camunda.org/">Forum</a> |
<a href="https://jira.camunda.com/browse/CAM">Issues</a> |
Expand All @@ -12,25 +12,21 @@ camunda-connect

Simple API for connecting HTTP Services and other things.

# List of connectors
# List of Connectors

* HTTP Connector
* SOAP HTTP Connector
* HTTP Connector (using Apache HttpClient 5.x)
* SOAP HTTP Connector (using Apache HttpClient 5.x)

# Using a Connector

camunda Connect API aims at two usage scenarios, usage in a generic system such as Camunda Platform
Camunda Connect API aims at two usage scenarios, usage in a generic system such as Camunda Platform
process engine and standalone usage via API. Please see the [official documentation](https://docs.camunda.org/manual/latest/reference/connect/) for more information.

# Contributing

Have a look at our [contribution guide](https://github.com/camunda/camunda-bpm-platform/blob/master/CONTRIBUTING.md) for how to contribute to this repository.


# License:
# License

The source files in this repository are made available under the <a href="../LICENSE">Apache License, Version 2.0</a>.



[CONTRIBUTING.md]: https://github.com/camunda/camunda-bpm-platform/blob/master/CONTRIBUTING.md
20 changes: 8 additions & 12 deletions connect/core/src/main/java/org/camunda/connect/Connectors.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Connectors {
public static String SOAP_HTTP_CONNECTOR_ID = "soap-http-connector";

/** The global instance of the manager */
static Connectors INSTANCE = new Connectors();
static final Connectors INSTANCE = new Connectors();

/**
* Provides the global instance of the Connectors manager.
Expand All @@ -54,27 +54,24 @@ public static Connectors getInstance() {
* @return the connector for the default http connector id or null if
* no connector is registered for this id
*/
@SuppressWarnings("unchecked")
public static <C extends Connector<? extends ConnectorRequest<?>>> C http() {
return (C) INSTANCE.getConnectorById(HTTP_CONNECTOR_ID);
return getConnector(HTTP_CONNECTOR_ID);
}

/**
* @return the connector for the default soap http connector id or null
* if no connector is registered for this id
*/
@SuppressWarnings("unchecked")
public static <C extends Connector<? extends ConnectorRequest<?>>> C soap() {
return (C) INSTANCE.getConnectorById(SOAP_HTTP_CONNECTOR_ID);
return getConnector(SOAP_HTTP_CONNECTOR_ID);
}

/**
* @return the connector for the given id or null if no connector is
* registered for this id
*/
@SuppressWarnings("unchecked")
public static <C extends Connector<? extends ConnectorRequest<?>>> C getConnector(String connectorId) {
return (C) INSTANCE.getConnectorById(connectorId);
return INSTANCE.getConnectorById(connectorId);
}

/**
Expand Down Expand Up @@ -126,7 +123,7 @@ protected static void unregisterConnector(String connectorId) {
*/
public Set<Connector<? extends ConnectorRequest<?>>> getAllAvailableConnectors() {
ensureConnectorProvidersInitialized();
return new HashSet<Connector<?>>(availableConnectors.values());
return new HashSet<>(availableConnectors.values());
}

/**
Expand All @@ -153,9 +150,9 @@ protected void ensureConnectorProvidersInitialized() {
}

protected void initializeConnectors(ClassLoader classLoader) {
Map<String, Connector<?>> connectors = new HashMap<String, Connector<?>>();
Map<String, Connector<?>> connectors = new HashMap<>();

if(classLoader == null) {
if (classLoader == null) {
classLoader = Connectors.class.getClassLoader();
}

Expand All @@ -181,8 +178,7 @@ protected void registerProvider(Map<String, Connector<?>> connectors, ConnectorP
String connectorId = provider.getConnectorId();
if (connectors.containsKey(connectorId)) {
throw LOG.multipleConnectorProvidersFound(connectorId);
}
else {
} else {
Connector<?> connectorInstance = provider.createConnectorInstance();
LOG.connectorProviderDiscovered(provider, connectorId, connectorInstance);
connectors.put(connectorId, connectorInstance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public abstract class AbstractCloseableConnectorResponse extends AbstractConnectorResponse implements CloseableConnectorResponse {

private final static ConnectCoreLogger LOG = ConnectLogger.CORE_LOGGER;
private static final ConnectCoreLogger LOG = ConnectLogger.CORE_LOGGER;

/**
* Implements the default close behavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@

import org.camunda.connect.spi.Connector;
import org.camunda.connect.spi.ConnectorRequest;
import org.camunda.connect.spi.ConnectorResponse;
import org.camunda.connect.spi.ConnectorRequestInterceptor;
import org.camunda.connect.spi.ConnectorResponse;

/**
* Abstract implementation of the connector interface.
*
* This implementation provides a linked list of interceptors and related methods for
* handling interceptor invocation.
*
Expand All @@ -41,9 +40,9 @@ public abstract class AbstractConnector<Q extends ConnectorRequest<R>, R extends
/**
* The {@link ConnectorRequestInterceptor} chain
*/
protected List<ConnectorRequestInterceptor> requestInterceptors = new LinkedList<ConnectorRequestInterceptor>();
protected List<ConnectorRequestInterceptor> requestInterceptors = new LinkedList<>();

public AbstractConnector(String connectorId) {
protected AbstractConnector(String connectorId) {
this.connectorId = connectorId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public abstract class AbstractConnectorRequest<R extends ConnectorResponse> impl

protected Connector connector;

protected Map<String, Object> requestParameters = new HashMap<String, Object>();
protected Map<String, Object> requestParameters = new HashMap<>();

public AbstractConnectorRequest(Connector connector) {
protected AbstractConnectorRequest(Connector connector) {
this.connector = connector;
}

@SuppressWarnings("unchecked")
public R execute() {
if(!isRequestValid()) {
if (!isRequestValid()) {
throw new RuntimeException("The request is invalid");
}
return (R) connector.execute(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public abstract class AbstractConnectorResponse implements ConnectorResponse {
protected Map<String, Object> responseParameters;

public Map<String, Object> getResponseParameters() {
if(responseParameters == null) {
responseParameters = new HashMap<String, Object>();
if (responseParameters == null) {
responseParameters = new HashMap<>();
collectResponseParameters(responseParameters);
}
return responseParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import java.util.List;

import org.camunda.connect.spi.ConnectorRequest;
import org.camunda.connect.spi.ConnectorInvocation;
import org.camunda.connect.spi.ConnectorRequest;
import org.camunda.connect.spi.ConnectorRequestInterceptor;

/**
Expand All @@ -40,7 +40,7 @@ public abstract class AbstractRequestInvocation<T> implements ConnectorInvocatio

protected ConnectorRequest<?> request;

public AbstractRequestInvocation(T target, ConnectorRequest<?> request, List<ConnectorRequestInterceptor> interceptorChain) {
protected AbstractRequestInvocation(T target, ConnectorRequest<?> request, List<ConnectorRequestInterceptor> interceptorChain) {
this.target = target;
this.request = request;
this.interceptorChain = interceptorChain;
Expand All @@ -57,7 +57,7 @@ public ConnectorRequest<?> getRequest() {

public Object proceed() throws Exception {
currentIndex++;
if(interceptorChain.size() > currentIndex) {
if (interceptorChain.size() > currentIndex) {
return interceptorChain.get(currentIndex).handleInvocation(this);

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public abstract class ConnectLogger extends BaseLogger {

public static final String PROJECT_CODE = "CNCT";

public static ConnectCoreLogger CORE_LOGGER = createLogger(ConnectCoreLogger.class, PROJECT_CODE, "org.camunda.bpm.connect", "01");
public static final ConnectCoreLogger CORE_LOGGER = createLogger(ConnectCoreLogger.class, PROJECT_CODE, "org.camunda.bpm.connect", "01");

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package org.camunda.connect.impl;

import org.camunda.connect.spi.ConnectorInvocation;
import org.camunda.connect.spi.ConnectorRequestInterceptor;
import org.camunda.connect.spi.ConnectorRequest;
import org.camunda.connect.spi.ConnectorRequestInterceptor;

/**
* <p>
Expand Down Expand Up @@ -60,8 +60,7 @@ public Object handleInvocation(ConnectorInvocation invocation) throws Exception
target = invocation.getTarget();
if (proceed) {
return invocation.proceed();
}
else {
} else {
return response;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
*/
public interface CloseableConnectorResponse extends ConnectorResponse {

public void close();
void close();

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ public interface Connector<Q extends ConnectorRequest<?>> {
* @return the result.
*/
ConnectorResponse execute(Q request);

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface ConnectorInvocation {
* The underlying raw request.
* @return the raw request as executed by the connector
*/
public Object getTarget();
Object getTarget();

/**
* <p>The connector request as created through the API. Accessing the request from an
Expand All @@ -42,7 +42,7 @@ public interface ConnectorInvocation {
*
* @return the connector request
*/
public ConnectorRequest<?> getRequest();
ConnectorRequest<?> getRequest();

/**
* Makes the request proceed through the interceptor chain.
Expand All @@ -52,6 +52,6 @@ public interface ConnectorInvocation {
* @return the result of the invocation.
* @throws Exception
*/
public Object proceed() throws Exception;
Object proceed() throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Set;

import org.camunda.connect.Connectors;
import org.camunda.connect.dummy.DummyConnector;
import org.junit.Test;
Expand Down
11 changes: 2 additions & 9 deletions connect/http-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- commons-codec is a transitive dependency of httpclient;
we override its version here in order to update the default commons-codec
version which has known vulnerabilities, see https://jira.camunda.com/browse/CAM-12774 -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@

public interface HttpConnector extends Connector<HttpRequest> {

static final String ID = Connectors.HTTP_CONNECTOR_ID;
String ID = Connectors.HTTP_CONNECTOR_ID;

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

public interface HttpResponse extends CloseableConnectorResponse {

static final String PARAM_NAME_STATUS_CODE = "statusCode";
static final String PARAM_NAME_RESPONSE = "response";
static final String PARAM_NAME_RESPONSE_HEADERS = "headers";
String PARAM_NAME_STATUS_CODE = "statusCode";
String PARAM_NAME_RESPONSE = "response";
String PARAM_NAME_RESPONSE_HEADERS = "headers";

/**
* @return the HTTP status code of the response
Expand Down
Loading