- * This client and all its child clients are bound to one specific value for the X-GCS-ClientMetaInfo header. - * To get a new client with a different header value, use {@link #withClientMetaInfo(String)}. - *
- * Thread-safe.
- */
-public interface GcClient extends Closeable, LoggingCapable {
-
- public static final String API_VERSION = "v1";
-
- /**
- * Returns a new {@link GcClient} which uses the passed meta data for the
- * X-GCS-ClientMetaInfo header.
- *
- * @param clientMetaInfo
- * JSON string containing the meta data for the client
- * @throws GcMarshallerSyntaxException
- * if the given clientMetaInfo is not a valid JSON string
- */
- GcClient withClientMetaInfo(String clientMetaInfo);
-
- /**
- * Releases any system resources associated with this object.
- */
- @Override
- void close() throws IOException;
-
- /**
- * Resource /{merchantId}
- *
- * @param merchantId String
- * @return Merchant
- */
- MerchantClient merchant(String merchantId);
-}
diff --git a/src/main/generated/com/globalcollect/gateway/sdk/java/gc/GcClientImpl.java b/src/main/generated/com/globalcollect/gateway/sdk/java/gc/GcClientImpl.java
deleted file mode 100644
index b6279d18a..000000000
--- a/src/main/generated/com/globalcollect/gateway/sdk/java/gc/GcClientImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.globalcollect.gateway.sdk.java.gc;
-
-import com.globalcollect.gateway.sdk.java.GcApiResource;
-import com.globalcollect.gateway.sdk.java.GcCommunicator;
-import com.globalcollect.gateway.sdk.java.gc.merchant.MerchantClient;
-import com.globalcollect.gateway.sdk.java.gc.merchant.MerchantClientImpl;
-import com.globalcollect.gateway.sdk.java.logging.GcCommunicatorLogger;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.Map;
-import java.util.TreeMap;
-import org.apache.commons.codec.binary.Base64;
-
-public class GcClientImpl extends GcApiResource implements GcClient {
-
- private static final Charset CHARSET = Charset.forName("UTF-8");
-
- public GcClientImpl(GcCommunicator communicator) {
- this(communicator, null);
- }
-
- private GcClientImpl(GcCommunicator communicator, String clientMetaInfo) {
- super(communicator, clientMetaInfo, Collections.singletonMap("apiVersion", API_VERSION));
- }
-
- @Override
- public GcClient withClientMetaInfo(String clientMetaInfo) {
-
- if (this.clientMetaInfo == null && clientMetaInfo == null) {
- return this;
- } else if (clientMetaInfo == null) {
- return new GcClientImpl(communicator, null);
- } else {
- // Checking to see if this is valid JSON (no JSON parse exceptions)
- communicator.getMarshaller().unmarshal(clientMetaInfo, Object.class);
-
- clientMetaInfo = Base64.encodeBase64String(clientMetaInfo.getBytes(CHARSET));
-
- if (clientMetaInfo.equals(this.clientMetaInfo)) {
- return this;
- } else {
- return new GcClientImpl(communicator, clientMetaInfo);
- }
- }
- }
-
- @Override
- public void enableLogging(GcCommunicatorLogger communicatorLogger) {
- // delegate to the communicator
- communicator.enableLogging(communicatorLogger);
- }
-
- @Override
- public void disableLogging() {
- // delegate to the communicator
- communicator.disableLogging();
- }
-
- @Override
- public void close() throws IOException {
- communicator.close();
- }
-
- @Override
- public MerchantClient merchant(String merchantId) {
- Map
+ * This client and all its child clients are bound to one specific value for the X-GCS-ClientMetaInfo header.
+ * To get a new client with a different header value, use {@link #withClientMetaInfo(String)}.
+ *
+ * Thread-safe.
+ */
+public class Client extends ApiResource implements Closeable, LoggingCapable {
+
+ public static final String API_VERSION = "v1";
+
+ private static final Charset CHARSET = Charset.forName("UTF-8");
+
+ public Client(Communicator communicator) {
+ this(communicator, null);
+ }
+
+ private Client(Communicator communicator, String clientMetaInfo) {
+ super(communicator, clientMetaInfo, Collections.singletonMap("apiVersion", API_VERSION));
+ }
+
+ /**
+ * Returns a new {@link Client} which uses the passed meta data for the
+ * X-GCS-ClientMetaInfo header.
+ *
+ * @param clientMetaInfo
+ * JSON string containing the meta data for the client
+ * @throws MarshallerSyntaxException
+ * if the given clientMetaInfo is not a valid JSON string
+ */
+ public Client withClientMetaInfo(String clientMetaInfo) {
+
+ if (this.clientMetaInfo == null && clientMetaInfo == null) {
+ return this;
+ } else if (clientMetaInfo == null) {
+ return new Client(communicator, null);
+ } else {
+ // Checking to see if this is valid JSON (no JSON parse exceptions)
+ communicator.getMarshaller().unmarshal(clientMetaInfo, Object.class);
+
+ clientMetaInfo = Base64.encodeBase64String(clientMetaInfo.getBytes(CHARSET));
+
+ if (clientMetaInfo.equals(this.clientMetaInfo)) {
+ return this;
+ } else {
+ return new Client(communicator, clientMetaInfo);
+ }
+ }
+ }
+
+ /**
+ * Utility method that delegates the call to this client's communicator.
+ * @see Communicator#closeIdleConnections(long, TimeUnit)
+ * @see PooledConnection#closeIdleConnections(long, TimeUnit)
+ */
+ public void closeIdleConnections(long idleTime, TimeUnit timeUnit) {
+ communicator.closeIdleConnections(idleTime, timeUnit);
+ }
+
+ /**
+ * Utility method that delegates the call to this client's communicator.
+ * @see Communicator#closeExpiredConnections()
+ * @see PooledConnection#closeExpiredConnections()
+ */
+ public void closeExpiredConnections() {
+ communicator.closeExpiredConnections();
+ }
+
+ @Override
+ public void enableLogging(CommunicatorLogger communicatorLogger) {
+ // delegate to the communicator
+ communicator.enableLogging(communicatorLogger);
+ }
+
+ @Override
+ public void disableLogging() {
+ // delegate to the communicator
+ communicator.disableLogging();
+ }
+
+ /**
+ * Releases any system resources associated with this object.
+ */
+ @Override
+ public void close() throws IOException {
+ communicator.close();
+ }
+
+ /**
+ * Resource /{merchantId}
+ *
+ * @param merchantId String
+ * @return MerchantClient
+ */
+ public MerchantClient merchant(String merchantId) {
+ Map
- * It contains all the logic to transform a request object to a HTTP request and
- * a HTTP response to a response object.
- *
- * Thread-safe.
- */
-public interface GcCommunicator extends Closeable, LoggingCapable {
-
- /**
- * Releases any system resources associated with this object.
- */
- @Override
- void close() throws IOException;
-
- /**
- * Corresponds to the HTTP GET method.
- *
- * @param relativePath The path to call, relative to the base URI.
- * @param requestHeaders An optional list of request headers.
- * @param requestParameters An optional set of request parameters.
- * @param responseType The type of response to return.
- * @param context The optional call context to use.
- * @throws GcCommunicationException when an exception occurred communicating with the GlobalCollect platform
- * @throws GcResponseException when an error response was received from the GlobalCollect platform
- * @throws GcApiException when an error response was received from the GlobalCollect platform which contained a list of errors
- */
- O get(String relativePath, List O delete(String relativePath, List O post(String relativePath, List