diff --git a/aws/core/src/test/resources/log4j.xml b/aws/core/src/test/resources/log4j.xml
index a97df723b7..23deb5a816 100644
--- a/aws/core/src/test/resources/log4j.xml
+++ b/aws/core/src/test/resources/log4j.xml
@@ -33,6 +33,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -58,22 +80,36 @@
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
\ No newline at end of file
diff --git a/aws/s3/core/src/main/java/org/jclouds/aws/s3/S3ContextBuilder.java b/aws/s3/core/src/main/java/org/jclouds/aws/s3/S3ContextBuilder.java
index 2ded8eccf3..355e21cf9a 100644
--- a/aws/s3/core/src/main/java/org/jclouds/aws/s3/S3ContextBuilder.java
+++ b/aws/s3/core/src/main/java/org/jclouds/aws/s3/S3ContextBuilder.java
@@ -110,11 +110,6 @@ public class S3ContextBuilder extends
return (S3ContextBuilder) super.withHttpMaxRetries(httpMaxRetries);
}
- @Override
- public S3ContextBuilder withJsonDebug() {
- return (S3ContextBuilder) super.withJsonDebug();
- }
-
@Override
public S3ContextBuilder withModule(Module module) {
return (S3ContextBuilder) super.withModule(module);
@@ -150,11 +145,6 @@ public class S3ContextBuilder extends
return (S3ContextBuilder) super.withPoolRequestInvokerThreads(poolRequestInvokerThreads);
}
- @Override
- public S3ContextBuilder withSaxDebug() {
- return (S3ContextBuilder) (S3ContextBuilder) super.withSaxDebug();
- }
-
@Override
public S3ContextBuilder withEndpoint(URI endpoint) {
properties.setProperty(S3Constants.PROPERTY_S3_ENDPOINT, checkNotNull(endpoint, "endpoint")
diff --git a/aws/s3/core/src/test/java/org/jclouds/aws/s3/integration/S3TestInitializer.java b/aws/s3/core/src/test/java/org/jclouds/aws/s3/integration/S3TestInitializer.java
index ce742c7632..becf33a6a7 100644
--- a/aws/s3/core/src/test/java/org/jclouds/aws/s3/integration/S3TestInitializer.java
+++ b/aws/s3/core/src/test/java/org/jclouds/aws/s3/integration/S3TestInitializer.java
@@ -48,8 +48,8 @@ public class S3TestInitializer extends
protected BlobStoreContext createLiveContext(
Module configurationModule, String url, String app, String account, String key) {
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
- return new S3ContextBuilder(account, key).withSaxDebug().relaxSSLHostname().withModules(
- configurationModule, new Log4JLoggingModule()).buildContext();
+ return new S3ContextBuilder(account, key).relaxSSLHostname().withModules(configurationModule,
+ new Log4JLoggingModule()).buildContext();
}
@Override
diff --git a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/AzureBlobContextBuilder.java b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/AzureBlobContextBuilder.java
index 4106928262..9478f1a270 100755
--- a/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/AzureBlobContextBuilder.java
+++ b/azure/storage/blob/core/src/main/java/org/jclouds/azure/storage/blob/AzureBlobContextBuilder.java
@@ -78,11 +78,11 @@ public class AzureBlobContextBuilder extends
"https://{account}.blob.core.windows.net");
}
-// @Override
-// protected void addBlobStoreModule(List modules) {
-// modules.add(BlobStoreMapsModule.Builder.newBuilder(containerMetadataType, blobMetadataType,
-// blobType).withClearContainerStrategy(RecreateClearContainerStrategy.class).build());
-// }
+ // @Override
+ // protected void addBlobStoreModule(List modules) {
+ // modules.add(BlobStoreMapsModule.Builder.newBuilder(containerMetadataType, blobMetadataType,
+ // blobType).withClearContainerStrategy(RecreateClearContainerStrategy.class).build());
+ // }
public AzureBlobContextBuilder(String id, String secret) {
this(new Properties());
@@ -115,11 +115,6 @@ public class AzureBlobContextBuilder extends
return (AzureBlobContextBuilder) super.withHttpMaxRetries(httpMaxRetries);
}
- @Override
- public AzureBlobContextBuilder withJsonDebug() {
- return (AzureBlobContextBuilder) super.withJsonDebug();
- }
-
@Override
public AzureBlobContextBuilder withModule(Module module) {
return (AzureBlobContextBuilder) super.withModule(module);
@@ -161,11 +156,6 @@ public class AzureBlobContextBuilder extends
.withPoolRequestInvokerThreads(poolRequestInvokerThreads);
}
- @Override
- public AzureBlobContextBuilder withSaxDebug() {
- return (AzureBlobContextBuilder) super.withSaxDebug();
- }
-
@Override
public AzureBlobContextBuilder withEndpoint(URI endpoint) {
properties.setProperty(AzureBlobConstants.PROPERTY_AZUREBLOB_ENDPOINT, checkNotNull(endpoint,
diff --git a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobConnectionTest.java b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobConnectionTest.java
index 3b8bf7bca9..ca18226fdc 100644
--- a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobConnectionTest.java
+++ b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobConnectionTest.java
@@ -53,6 +53,8 @@ import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.functions.ReturnTrueOn404;
import org.jclouds.http.functions.ReturnVoidIf2xx;
+import org.jclouds.logging.Logger;
+import org.jclouds.logging.Logger.LoggerFactory;
import org.jclouds.rest.config.RestModule;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.util.Jsr330;
@@ -350,6 +352,11 @@ public class AzureBlobConnectionTest {
bindConstant().annotatedWith(
Jsr330.named(BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX)).to(
"x-ms-meta-");
+ bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
+ public Logger getLogger(String category) {
+ return Logger.NULL;
+ }
+ });
}
}, new RestModule(), new ExecutorServiceModule(new WithinThreadExecutorService()),
new JavaUrlHttpCommandExecutorServiceModule());
diff --git a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobStoreTest.java b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobStoreTest.java
index 6b133b9e07..916e459940 100644
--- a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobStoreTest.java
+++ b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/AzureBlobStoreTest.java
@@ -49,6 +49,8 @@ import org.jclouds.http.functions.ParseETagHeader;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.http.functions.ReturnTrueIf2xx;
import org.jclouds.http.functions.ReturnVoidIf2xx;
+import org.jclouds.logging.Logger;
+import org.jclouds.logging.Logger.LoggerFactory;
import org.jclouds.rest.config.RestModule;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.util.Jsr330;
@@ -181,6 +183,11 @@ public class AzureBlobStoreTest {
HttpUtils.toBase64String("key".getBytes()));
bindConstant().annotatedWith(
Jsr330.named(BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX)).to("prefix");
+ bind(Logger.LoggerFactory.class).toInstance(new LoggerFactory() {
+ public Logger getLogger(String category) {
+ return Logger.NULL;
+ }
+ });
}
@SuppressWarnings("unused")
diff --git a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/integration/AzureBlobTestInitializer.java b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/integration/AzureBlobTestInitializer.java
index b35489223d..71577c2c48 100644
--- a/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/integration/AzureBlobTestInitializer.java
+++ b/azure/storage/blob/core/src/test/java/org/jclouds/azure/storage/blob/integration/AzureBlobTestInitializer.java
@@ -46,8 +46,8 @@ public class AzureBlobTestInitializer extends
@Override
protected BlobStoreContext createLiveContext(
Module configurationModule, String url, String app, String account, String key) {
- return new AzureBlobContextBuilder(account, key).withSaxDebug().relaxSSLHostname()
- .withModules(configurationModule, new Log4JLoggingModule()).buildContext();
+ return new AzureBlobContextBuilder(account, key).relaxSSLHostname().withModules(
+ configurationModule, new Log4JLoggingModule()).buildContext();
}
@Override
diff --git a/azure/storage/core/src/test/resources/log4j.xml b/azure/storage/core/src/test/resources/log4j.xml
index a97df723b7..23deb5a816 100755
--- a/azure/storage/core/src/test/resources/log4j.xml
+++ b/azure/storage/core/src/test/resources/log4j.xml
@@ -33,6 +33,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -58,22 +80,36 @@
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
\ No newline at end of file
diff --git a/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/AzureQueueContextBuilder.java b/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/AzureQueueContextBuilder.java
index 4db521f949..838213b3c9 100755
--- a/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/AzureQueueContextBuilder.java
+++ b/azure/storage/queue/core/src/main/java/org/jclouds/azure/storage/queue/AzureQueueContextBuilder.java
@@ -126,11 +126,6 @@ public class AzureQueueContextBuilder extends CloudContextBuilder withRequestTimeout(long milliseconds) {
- properties.setProperty(BlobStoreConstants.PROPERTY_BLOBSTORE_TIMEOUT, Long.toString(milliseconds));
+ public BlobStoreContextBuilder withRequestTimeout(long milliseconds) {
+ properties.setProperty(BlobStoreConstants.PROPERTY_BLOBSTORE_TIMEOUT, Long
+ .toString(milliseconds));
return this;
}
-
- @SuppressWarnings("unchecked")
- @Override
- public BlobStoreContextBuilder withHttpMaxRetries(int httpMaxRetries) {
- return (BlobStoreContextBuilder) super.withHttpMaxRetries(httpMaxRetries);
- }
@SuppressWarnings("unchecked")
@Override
- public BlobStoreContextBuilder withJsonDebug() {
- return (BlobStoreContextBuilder) super.withJsonDebug();
+ public BlobStoreContextBuilder withHttpMaxRetries(int httpMaxRetries) {
+ return (BlobStoreContextBuilder) super.withHttpMaxRetries(httpMaxRetries);
}
@SuppressWarnings("unchecked")
@@ -122,12 +117,6 @@ public abstract class BlobStoreContextBuilder withSaxDebug() {
- return (BlobStoreContextBuilder) super.withSaxDebug();
- }
-
@SuppressWarnings("unchecked")
@Override
public BlobStoreContextBuilder relaxSSLHostname() {
diff --git a/core/src/main/java/org/jclouds/cloud/CloudContextBuilder.java b/core/src/main/java/org/jclouds/cloud/CloudContextBuilder.java
index ab94c74206..7f317decaf 100644
--- a/core/src/main/java/org/jclouds/cloud/CloudContextBuilder.java
+++ b/core/src/main/java/org/jclouds/cloud/CloudContextBuilder.java
@@ -27,8 +27,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_MAX_REDIRECTS;
import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_MAX_RETRIES;
import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_RELAX_HOSTNAME;
-import static org.jclouds.http.HttpConstants.PROPERTY_JSON_DEBUG;
-import static org.jclouds.http.HttpConstants.PROPERTY_SAX_DEBUG;
import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_IO_WORKER_THREADS;
import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_MAX_CONNECTIONS;
import static org.jclouds.http.pool.PoolConstants.PROPERTY_POOL_MAX_CONNECTION_REUSE;
@@ -91,16 +89,6 @@ public abstract class CloudContextBuilder {
this.properties = properties;
}
- public CloudContextBuilder withSaxDebug() {
- properties.setProperty(PROPERTY_SAX_DEBUG, "true");
- return this;
- }
-
- public CloudContextBuilder withJsonDebug() {
- properties.setProperty(PROPERTY_JSON_DEBUG, "true");
- return this;
- }
-
/**
* allow mismatches between the certificate and the hostname of ssl requests.
*/
@@ -266,9 +254,6 @@ public abstract class CloudContextBuilder {
public CloudContext buildContext() {
Injector injector = buildInjector();
return (CloudContext) injector.getInstance(Key.get(Types.newParameterizedType(
- CloudContext.class, connectionType.getType())));
- // return (CloudContext) this.buildInjector().getInstance(
- // Key.get(new TypeLiteral>() {
- // }));
+ CloudContext.class, connectionType.getType())));
}
}
diff --git a/core/src/main/java/org/jclouds/http/HttpConstants.java b/core/src/main/java/org/jclouds/http/HttpConstants.java
index aea6ded902..9555567e63 100644
--- a/core/src/main/java/org/jclouds/http/HttpConstants.java
+++ b/core/src/main/java/org/jclouds/http/HttpConstants.java
@@ -31,8 +31,8 @@ package org.jclouds.http;
public interface HttpConstants {
public static final String PROPERTY_HTTP_MAX_RETRIES = "jclouds.http.max-retries";
public static final String PROPERTY_HTTP_MAX_REDIRECTS = "jclouds.http.max-redirects";
- public static final String PROPERTY_SAX_DEBUG = "jclouds.http.sax.debug";
- public static final String PROPERTY_JSON_DEBUG = "jclouds.http.json.debug";
+ public static final String HTTP_HEADERS_LOGGER = "jclouds.http.headers";
+ public static final String HTTP_WIRE_LOGGER = "jclouds.http.wire";
/**
* longest time a single request can take before throwing an exception.
diff --git a/core/src/main/java/org/jclouds/http/HttpRequest.java b/core/src/main/java/org/jclouds/http/HttpRequest.java
index af59e2b411..272dddd4a6 100644
--- a/core/src/main/java/org/jclouds/http/HttpRequest.java
+++ b/core/src/main/java/org/jclouds/http/HttpRequest.java
@@ -88,21 +88,8 @@ public class HttpRequest extends HttpMessage implements Request {
setEntity(entity);
}
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("HttpRequest");
- sb.append("{endPoint='").append(endpoint).append('\'');
- sb.append(", method='").append(method).append('\'');
- sb.append(", headers=").append(headers);
- sb.append(", filters=").append(requestFilters);
- if (entity != null && entity instanceof String) {
- sb.append(", entity=").append(entity);
- } else {
- sb.append(", entity set=").append(entity != null);
- }
- sb.append('}');
- return sb.toString();
+ public String getRequestLine() {
+ return String.format("%s %s HTTP/1.1", getMethod(), endpoint.toASCIIString());
}
/**
diff --git a/core/src/main/java/org/jclouds/http/HttpResponse.java b/core/src/main/java/org/jclouds/http/HttpResponse.java
index 777c083d51..d540b728c3 100644
--- a/core/src/main/java/org/jclouds/http/HttpResponse.java
+++ b/core/src/main/java/org/jclouds/http/HttpResponse.java
@@ -35,18 +35,6 @@ public class HttpResponse extends HttpMessage {
private String message;
private InputStream content;
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("HttpResponse");
- sb.append("{statusCode=").append(statusCode);
- sb.append(", headers=").append(headers);
- sb.append(", message='").append(message).append('\'');
- sb.append(", content set=").append(content != null);
- sb.append('}');
- return sb.toString();
- }
-
public int getStatusCode() {
return statusCode;
}
@@ -71,4 +59,8 @@ public class HttpResponse extends HttpMessage {
this.content = content;
}
+ public String getStatusLine() {
+ return String.format("HTTP/1.1 %d %s", getStatusCode(), getMessage());
+ }
+
}
\ No newline at end of file
diff --git a/core/src/main/java/org/jclouds/http/HttpUtils.java b/core/src/main/java/org/jclouds/http/HttpUtils.java
index ea830b7f21..3aa88d6ad7 100644
--- a/core/src/main/java/org/jclouds/http/HttpUtils.java
+++ b/core/src/main/java/org/jclouds/http/HttpUtils.java
@@ -30,6 +30,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
@@ -177,6 +178,26 @@ public class HttpUtils {
}
+
+
+ public static void copy(InputStream input, OutputStream output) throws IOException {
+ byte[] buffer = new byte[1024];
+ long length = 0;
+ int numRead = -1;
+ try {
+ do {
+ numRead = input.read(buffer);
+ if (numRead > 0) {
+ length += numRead;
+ output.write(buffer, 0, numRead);
+ }
+ } while (numRead != -1);
+ } finally {
+ output.close();
+ IOUtils.closeQuietly(input);
+ }
+ }
+
public static MD5InputStreamResult generateMD5Result(InputStream toEncode) throws IOException {
MD5Digest eTag = new MD5Digest();
byte[] resBuf = new byte[eTag.getDigestSize()];
diff --git a/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java b/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java
index b578282637..10078dd82f 100644
--- a/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java
+++ b/core/src/main/java/org/jclouds/http/TransformingHttpCommandExecutorServiceImpl.java
@@ -28,6 +28,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import org.jclouds.concurrent.FutureFunctionCallable;
+import org.jclouds.logging.Logger.LoggerFactory;
import com.google.common.base.Function;
import javax.inject.Inject;
@@ -42,12 +43,14 @@ public class TransformingHttpCommandExecutorServiceImpl implements
TransformingHttpCommandExecutorService {
private final HttpCommandExecutorService client;
private final ExecutorService executorService;
+ private final LoggerFactory logFactory;
@Inject
public TransformingHttpCommandExecutorServiceImpl(HttpCommandExecutorService client,
- ExecutorService executorService) {
+ ExecutorService executorService, LoggerFactory logFactory) {
this.client = client;
this.executorService = executorService;
+ this.logFactory = logFactory;
}
/**
@@ -57,7 +60,7 @@ public class TransformingHttpCommandExecutorServiceImpl implements
Function exceptionTransformer) {
Future responseFuture = client.submit(command);
Callable valueCallable = new FutureFunctionCallable(responseFuture,
- responseTransformer);
+ responseTransformer, logFactory.getLogger(responseTransformer.getClass().getName()));
return executorService.submit(valueCallable);
}
diff --git a/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java b/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java
index 0613680ca9..425cb46fcc 100644
--- a/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java
+++ b/core/src/main/java/org/jclouds/http/TransformingHttpCommandImpl.java
@@ -30,13 +30,13 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.annotation.Resource;
+import javax.inject.Inject;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.UriBuilder;
import org.jclouds.logging.Logger;
import com.google.common.base.Function;
-import javax.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.internal.Nullable;
@@ -66,7 +66,7 @@ public class TransformingHttpCommandImpl implements TransformingHttpCommand
- *
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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 org.jclouds.http;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.SynchronousQueue;
-
-import com.google.common.base.Function;
-
-public class TransformingHttpUtils {
-
- public static HttpCommandRendezvous submitHttpCommand(HttpCommand command,
- final Function responseTransformer, ExecutorService executorService) {
- final SynchronousQueue> channel = new SynchronousQueue