Merge pull request #1545 from jclouds/style-1.6.x

Style 1.6.x
This commit is contained in:
Andrew Gaul 2013-04-17 18:25:48 -07:00
commit 44a939aa28
193 changed files with 345 additions and 243 deletions

View File

@ -225,8 +225,8 @@ public class AtmosAsyncBlobStore extends BaseAsyncBlobStore {
ListenableFuture<BoundedSet<? extends DirectoryEntry>> returnVal = async.listDirectory(container, nativeOptions);
ListenableFuture<PageSet<? extends StorageMetadata>> list = transform(returnVal, container2ResourceList,
userExecutor);
return (ListenableFuture<PageSet<? extends StorageMetadata>>) (options.isDetailed() ? transform(list,
fetchBlobMetadataProvider.get().setContainerName(container)) : list);
return options.isDetailed() ? transform(list,
fetchBlobMetadataProvider.get().setContainerName(container)) : list;
}
/**

View File

@ -63,7 +63,7 @@ public class AtmosUtils {
public AtmosError parseAtmosErrorFromContent(HttpCommand command, HttpResponse response, InputStream content)
throws HttpException {
AtmosError error = (AtmosError) factory.create(errorHandlerProvider.get()).parse(content);
AtmosError error = factory.create(errorHandlerProvider.get()).parse(content);
if (error.getCode() == 1032) {
error.setStringSigned(signer.createStringToSign(command.getCurrentRequest()));
}

View File

@ -103,7 +103,7 @@ public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest<AtmosAsyncCl
request,
"Accept: */*\nDate: Thu, 05 Jun 2008 16:38:19 GMT\nExpect: 100-continue\nx-emc-signature: 7Cbdnu+YA5rG9J/C9RlHk07mU7w=\nx-emc-uid: identity\n");
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 }, new Date(1000));
assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, new byte[] { 0, 2, 4, 8 }, new Date(1000));
assertEquals(request.getFilters().size(), 0);
}

View File

@ -37,7 +37,7 @@ import org.testng.annotations.Test;
public class ErrorHandlerTest extends BaseHandlerTest {
ParseSax<AtmosError> createParser() {
ParseSax<AtmosError> parser = (ParseSax<AtmosError>) factory.create(injector
ParseSax<AtmosError> parser = factory.create(injector
.getInstance(ErrorHandler.class));
return parser;
}

View File

@ -41,7 +41,7 @@ import com.google.common.collect.Sets;
public class ListDirectoryResponseHandlerTest extends BaseHandlerTest {
ParseSax<Set<DirectoryEntry>> createParser() {
ParseSax<Set<DirectoryEntry>> parser = (ParseSax<Set<DirectoryEntry>>) factory
ParseSax<Set<DirectoryEntry>> parser = factory
.create(injector.getInstance(ListDirectoryResponseHandler.class));
return parser;
}

View File

@ -48,6 +48,7 @@ import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.util.concurrent.Atomics;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.UncheckedTimeoutException;
@ -97,7 +98,7 @@ public class CloudServersImageExtension implements ImageExtension {
org.jclouds.cloudservers.domain.Image csImage = client.createImageFromServer(cloneTemplate.getName(),
Integer.parseInt(cloneTemplate.getSourceNodeId()));
final AtomicReference<Image> image = new AtomicReference<Image>(new ImageBuilder()
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
.location(location.get())
.ids(csImage.getId() + "")
.description(cloneTemplate.getName())

View File

@ -67,7 +67,7 @@ public class MapToServerInfoTest {
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
.devices(
ImmutableMap.of("ide:0:0",
new IDEDevice.Builder((int) 0, (int) 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
new IDEDevice.Builder(0, 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
))
.metrics(
@ -95,7 +95,7 @@ public class MapToServerInfoTest {
.devices(
ImmutableMap.of(
"ide:0:0",
new IDEDevice.Builder((int) 0, (int) 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
new IDEDevice.Builder(0, 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
.mediaType(MediaType.CDROM).build()))
.metrics(
new ServerMetrics.Builder().driveMetrics(ImmutableMap.of("ide:0:0", new DriveMetrics.Builder().build()))
@ -143,7 +143,7 @@ public class MapToServerInfoTest {
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
.devices(
ImmutableMap.of("ide:0:0",
new IDEDevice.Builder((int) 0, (int) 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
new IDEDevice.Builder(0, 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
))
.metrics(

View File

@ -38,7 +38,7 @@ public final class EncryptedPasswordAndPrivateKey {
return builder().fromEncryptedPasswordAndPrivateKey(this);
}
public final static class Builder {
public static final class Builder {
protected String encryptedPassword;
protected String privateKey;

View File

@ -53,7 +53,7 @@ public abstract class BaseCloudStackExpectTest<S> extends BaseRestClientExpectTe
@Override
public S createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
return (S) clientFrom(createInjector(fn, module, props).getInstance(CloudStackContext.class));
return clientFrom(createInjector(fn, module, props).getInstance(CloudStackContext.class));
}
protected abstract S clientFrom(CloudStackContext context);

View File

@ -93,7 +93,7 @@ public class EC2ApiMetadata extends BaseRestApiMetadata {
return properties;
}
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
@SuppressWarnings("deprecation")
protected Builder() {
this(EC2Client.class, EC2AsyncClient.class);

View File

@ -50,4 +50,4 @@ public final class EC2Fallbacks {
throw propagate(t);
}
}
}
}

View File

@ -55,6 +55,7 @@ import org.jclouds.logging.Logger;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.util.concurrent.Atomics;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.UncheckedTimeoutException;
@ -110,7 +111,7 @@ public class EC2ImageExtension implements ImageExtension {
String imageId = ec2Client.getAMIServices().createImageInRegion(region, cloneTemplate.getName(), instanceId,
CreateImageOptions.NONE);
final AtomicReference<Image> image = new AtomicReference<Image>(new ImageBuilder()
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
.location(find(locations.get(), idEquals(region)))
.id(region + "/" + imageId)
.providerId(imageId)

View File

@ -161,7 +161,7 @@ public final class Subnet {
return builder().from(this);
}
public final static class Builder {
public static final class Builder {
private String subnetId;
private State subnetState;
private String vpcId;

View File

@ -38,4 +38,4 @@ public class BindResourceIdsToIndexedFormParamsTest {
HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
binder.bindToRequest(request, null);
}
}
}

View File

@ -61,4 +61,4 @@ public class BindTagsToIndexedFormParamsTest {
HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
binder.bindToRequest(request, null);
}
}
}

View File

@ -124,7 +124,7 @@ public class DescribeImagesResponseHandlerTest {
}
});
ParseSax<Set<Image>> parser = (ParseSax<Set<Image>>) injector.getInstance(ParseSax.Factory.class).create(
ParseSax<Set<Image>> parser = injector.getInstance(ParseSax.Factory.class).create(
injector.getInstance(DescribeImagesResponseHandler.class));
return parser;
}

View File

@ -162,7 +162,7 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
}
});
ParseSax<Set<Reservation<? extends RunningInstance>>> parser = (ParseSax<Set<Reservation<? extends RunningInstance>>>) injector
ParseSax<Set<Reservation<? extends RunningInstance>>> parser = injector
.getInstance(ParseSax.Factory.class)
.create(injector.getInstance(DescribeInstancesResponseHandler.class));
return parser;

View File

@ -67,7 +67,7 @@ public class MapToServerInfoTest {
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
.devices(
ImmutableMap.of("ide:0:0",
new IDEDevice.Builder((int) 0, (int) 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
new IDEDevice.Builder(0, 0).uuid("4af85ed3-0caa-4736-8a26-a33d7de0a122").build()
))
.metrics(
@ -95,7 +95,7 @@ public class MapToServerInfoTest {
.devices(
ImmutableMap.of(
"ide:0:0",
new IDEDevice.Builder((int) 0, (int) 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
new IDEDevice.Builder(0, 0).uuid("853bb98a-4fff-4c2f-a265-97c363f19ea5")
.mediaType(MediaType.CDROM).build()))
.metrics(
new ServerMetrics.Builder().driveMetrics(ImmutableMap.of("ide:0:0", new DriveMetrics.Builder().build()))
@ -149,7 +149,7 @@ public class MapToServerInfoTest {
"tcp/23", "tcp/25", "tcp/110", "tcp/143", "tcp/43595")).build()))
.devices(
ImmutableMap.of("ide:0:0",
new IDEDevice.Builder((int) 0, (int) 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
new IDEDevice.Builder(0, 0).uuid("403c9a86-0aab-4e47-aa95-e9768021c4c1").build()
))
.metrics(

View File

@ -135,4 +135,4 @@ public class SnapshotPredicates {
return snapshotApi.get(snapshot.getId()) == null;
}
}
}
}

View File

@ -146,4 +146,4 @@ public class VolumePredicates {
return volumeApi.get(volume.getId()) == null;
}
}
}
}

View File

@ -73,7 +73,7 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata {
return properties;
}
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
@SuppressWarnings("deprecation")
protected Builder() {
this(KeystoneApi.class, KeystoneAsyncApi.class);

View File

@ -48,4 +48,4 @@ public final class KeystoneFallbacks {
}
}
}
}

View File

@ -178,4 +178,4 @@ public class ProviderModuleExpectTest extends BaseRestApiExpectTest<ProviderModu
return responseWithKeystoneAccess;
}
}
}
}

View File

@ -46,4 +46,4 @@ public class BindKeyPairToJsonPayload extends BindToJsonPayload {
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
return bindToRequest(request, (Object) ImmutableMap.of("keypair", ImmutableSortedMap.copyOf(postParams)));
}
}
}

View File

@ -53,6 +53,7 @@ import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.util.concurrent.Atomics;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.UncheckedTimeoutException;
@ -109,7 +110,7 @@ public class NovaImageExtension implements ImageExtension {
logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
final AtomicReference<Image> image = new AtomicReference<Image>(new ImageBuilder()
final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
.location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
.id(targetImageZoneAndId.slashEncode())
.providerId(targetImageZoneAndId.getId())

View File

@ -47,7 +47,7 @@ public class ServerCreated extends Resource {
return builder().fromServerCreated(this);
}
public final static class Builder extends Resource.Builder<Builder> {
public static final class Builder extends Resource.Builder<Builder> {
protected String adminPass;
/**

View File

@ -86,4 +86,4 @@ public interface VolumeAttachmentApi {
* @return true if successful
*/
boolean detachVolumeFromServer(String volumeId, String serverId);
}
}

View File

@ -91,4 +91,4 @@ public class OverLimitParser implements Function<String, Map<String, String>> {
return ImmutableMap.of();
}
}
}
}

View File

@ -167,4 +167,4 @@ public class VolumeAttachmentApiExpectTest extends BaseNovaApiExpectTest {
protected VolumeAttachment testAttachment() {
return VolumeAttachment.builder().device("/dev/vdc").serverId("b4785058-cb80-491b-baa3-e4ee6546450e").id("1").volumeId("1").build();
}
}
}

View File

@ -155,4 +155,4 @@ public class VolumeAttachmentApiLiveTest extends BaseNovaApiLiveTest {
}
}
}
}

View File

@ -30,4 +30,4 @@ public enum SessionPersistence {
return UNRECOGNIZED;
}
}
}
}

View File

@ -109,4 +109,4 @@ public interface AccessRuleApi {
@Path("/accesslist")
@Consumes("*/*")
boolean deleteAll();
}
}

View File

@ -118,4 +118,4 @@ public interface ConnectionApi {
@Payload("{\"connectionLogging\":{\"enabled\":false}}")
@Path("/connectionlogging")
void disableConnectionLogging();
}
}

View File

@ -81,4 +81,4 @@ public interface ContentCachingApi {
@Payload("{\"contentCaching\":{\"enabled\":false}}")
@Path("/contentcaching")
void disable();
}
}

View File

@ -81,4 +81,4 @@ public interface ErrorPageApi {
@Fallback(FalseOnNotFoundOr404.class)
@Path("/errorpage")
boolean delete();
}
}

View File

@ -83,4 +83,4 @@ public interface HealthMonitorApi {
@Path("/healthmonitor")
@Consumes("*/*")
boolean delete();
}
}

View File

@ -167,4 +167,4 @@ public interface ReportApi {
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/algorithms")
Iterable<String> listAlgorithms();
}
}

View File

@ -116,4 +116,4 @@ public interface SSLTerminationApi {
@Path("/ssltermination")
@Consumes("*/*")
boolean delete();
}
}

View File

@ -86,4 +86,4 @@ public interface SessionPersistenceApi {
@Fallback(VoidOnNotFoundOr404.class)
@Path("/sessionpersistence")
void delete();
}
}

View File

@ -102,4 +102,4 @@ public interface VirtualIPApi {
@Path("/virtualips")
@Consumes("*/*")
boolean delete(@QueryParam("id") Iterable<Integer> ids);
}
}

View File

@ -133,7 +133,7 @@ public class ChangeBatch extends ForwardingList<ActionOnResourceRecordSet> {
return new Builder();
}
public final static class Builder {
public static final class Builder {
private Optional<String> comment = Optional.absent();
private ImmutableList.Builder<ActionOnResourceRecordSet> changes = ImmutableList.builder();

View File

@ -108,7 +108,7 @@ public final class HostedZone {
return builder().from(this);
}
public final static class Builder {
public static final class Builder {
private String id;
private String name;
private String callerReference;

View File

@ -95,7 +95,7 @@ public class ResourceRecordSet {
/**
* A portion of a RRs who share the same name and type
*/
public static abstract class RecordSubset extends ResourceRecordSet {
public abstract static class RecordSubset extends ResourceRecordSet {
public static final class Weighted extends RecordSubset {
private final int weight;
@ -261,7 +261,7 @@ public class ResourceRecordSet {
return builder().from(this);
}
public final static class Builder {
public static final class Builder {
private String id;
private String name;
private String type;

View File

@ -94,7 +94,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
return properties;
}
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
@SuppressWarnings("deprecation")
protected Builder() {
this(S3Client.class, S3AsyncClient.class);

View File

@ -51,4 +51,4 @@ public final class S3Fallbacks {
throw propagate(t);
}
}
}
}

View File

@ -42,7 +42,7 @@ public class AccessControlListHandlerTest extends BaseHandlerTest {
public static final String aclExtreme = "<AccessControlPolicy xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Owner><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>WRITE</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>READ_ACP</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Grantee><Permission>WRITE</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>WRITE_ACP</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AllUsers</URI></Grantee><Permission>READ</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI></Grantee><Permission>READ</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"Group\"><URI>http://acs.amazonaws.com/groups/s3/LogDelivery</URI></Grantee><Permission>WRITE</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Grantee><Permission>READ</Permission></Grant><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c</ID><DisplayName>jamesmurty</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>";
ParseSax<AccessControlList> createParser() {
ParseSax<AccessControlList> parser = (ParseSax<AccessControlList>) factory.create(injector
ParseSax<AccessControlList> parser = factory.create(injector
.getInstance(AccessControlListHandler.class));
return parser;
}

View File

@ -55,7 +55,7 @@ public class CopyObjectHandlerTest extends BaseHandlerTest {
.iso8601DateParse("2009-03-19T13:23:27.000Z"),
"\"92836a3ea45a6984d1b4d23a747d46bb\"");
ObjectMetadata result = (ObjectMetadata) factory.create(
ObjectMetadata result = factory.create(
injector.getInstance(CopyObjectHandler.class)).parse(is);
assertEquals(result, expected);

View File

@ -37,7 +37,7 @@ import org.testng.annotations.Test;
public class PayerHandlerTest extends BaseHandlerTest {
ParseSax<Payer> createParser() {
ParseSax<Payer> parser = (ParseSax<Payer>) factory.create(injector
ParseSax<Payer> parser = factory.create(injector
.getInstance(PayerHandler.class));
return parser;
}

View File

@ -139,7 +139,7 @@ public class S3ParserTest extends PerformanceTest {
}
private ListBucketResponse runParseListContainerResult() throws HttpException {
return (ListBucketResponse) factory.create(injector.getInstance(ListBucketHandler.class)).setContext(
return factory.create(injector.getInstance(ListBucketHandler.class)).setContext(
HttpRequest.builder().method("GET").endpoint("http://bucket.com").build()).parse(
Strings2.toInputStream(listContainerResult));
}
@ -147,7 +147,7 @@ public class S3ParserTest extends PerformanceTest {
public static final String successfulCopyObject200 = "<CopyObjectResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><LastModified>2009-03-19T13:23:27.000Z</LastModified><ETag>\"92836a3ea45a6984d1b4d23a747d46bb\"</ETag></CopyObjectResult>";
private ObjectMetadata runParseCopyObjectResult() throws HttpException {
return (ObjectMetadata) factory.create(injector.getInstance(CopyObjectHandler.class)).parse(
return factory.create(injector.getInstance(CopyObjectHandler.class)).parse(
Strings2.toInputStream(successfulCopyObject200));
}

View File

@ -42,7 +42,7 @@ public class BindChangeMessageVisibilityBatchRequestEntryToIndexedFormParams ext
}
public Map<String, String> idReceiptHandle(Iterable<String> input) {
return Maps.uniqueIndex((Iterable<String>) input, new Function<String, String>() {
return Maps.uniqueIndex(input, new Function<String, String>() {
int index = 1;
@Override

View File

@ -41,7 +41,7 @@ public class BindSendMessageBatchRequestEntryWithDelaysToIndexedFormParams exten
}
public Map<String, String> idMessageBody(Iterable<String> input) {
return Maps.uniqueIndex((Iterable<String>) input, new Function<String, String>() {
return Maps.uniqueIndex(input, new Function<String, String>() {
int index = 1;
@Override

View File

@ -109,7 +109,7 @@ public final class SessionCredentials extends Credentials {
return builder().from(this);
}
public final static class Builder extends Credentials.Builder<SessionCredentials> {
public static final class Builder extends Credentials.Builder<SessionCredentials> {
private String accessKeyId;
private String secretAccessKey;
private String sessionToken;

View File

@ -26,7 +26,8 @@ import static com.google.common.io.BaseEncoding.base64;
import static com.google.common.io.ByteStreams.readBytes;
import static org.jclouds.aws.reference.FormParameters.ACTION;
import static org.jclouds.aws.reference.FormParameters.AWS_ACCESS_KEY_ID;
import static org.jclouds.aws.reference.FormParameters.*;
import static org.jclouds.aws.reference.FormParameters.SECURITY_TOKEN;
import static org.jclouds.aws.reference.FormParameters.SIGNATURE;
import static org.jclouds.aws.reference.FormParameters.SIGNATURE_METHOD;
import static org.jclouds.aws.reference.FormParameters.SIGNATURE_VERSION;
import static org.jclouds.aws.reference.FormParameters.TIMESTAMP;

View File

@ -37,7 +37,7 @@ public final class UserAndSessionCredentials {
return builder().from(this);
}
public final static class Builder {
public static final class Builder {
private User user;
private SessionCredentials credentials;
private int packedPolicySize;

View File

@ -38,7 +38,7 @@ public class ErrorHandlerTest extends BaseHandlerTest {
public static final String errorFromAmazonIfYouDontRemoveTransferEncodingHeader = "<Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header><RequestId>7C59925D75D15561</RequestId><HostId>fbskVU51OZJg2yZS/wNIxoE2PmCf0ZqFd0iH6Vrzw0uKG3KmokswBytL/Bfp/GWb</HostId></Error>";
ParseSax<AWSError> createParser() {
ParseSax<AWSError> parser = (ParseSax<AWSError>) factory.create(injector.getInstance(ErrorHandler.class));
ParseSax<AWSError> parser = factory.create(injector.getInstance(ErrorHandler.class));
return parser;
}

View File

@ -78,7 +78,7 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
return properties;
}
public static abstract class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
public abstract static class Builder<T extends Builder<T>> extends BaseRestApiMetadata.Builder<T> {
@SuppressWarnings("deprecation")
protected Builder() {
this(SwiftClient.class, SwiftAsyncClient.class);

View File

@ -75,7 +75,7 @@ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata {
return properties;
}
public static abstract class Builder<T extends Builder<T>> extends SwiftApiMetadata.Builder<T> {
public abstract static class Builder<T extends Builder<T>> extends SwiftApiMetadata.Builder<T> {
protected Builder() {
this(SwiftKeystoneClient.class, SwiftKeystoneAsyncClient.class);
}

View File

@ -74,7 +74,7 @@ public class MultipartUploadSlicingAlgorithm {
long unitPartSize = defaultPartSize; // first try with default part size
int parts = (int)(length / unitPartSize);
long partSize = unitPartSize;
int magnitude = (int) (parts / magnitudeBase);
int magnitude = parts / magnitudeBase;
if (magnitude > 0) {
partSize = magnitude * unitPartSize;
if (partSize > MultipartUpload.MAX_PART_SIZE) {

View File

@ -68,7 +68,7 @@ public class CreateContainerOptions extends BaseHttpRequestOptions {
public static CreateContainerOptions withMetadata(Map<String, String> metadata) {
CreateContainerOptions options = new CreateContainerOptions();
return (CreateContainerOptions) options.withMetadata(metadata);
return options.withMetadata(metadata);
}
}

View File

@ -53,4 +53,4 @@ public class BasePayloadTest {
throw Throwables.propagate(e);
}
}
}
}

View File

@ -59,7 +59,7 @@ public class VCloudUtils {
String contentType = response.getPayload().getContentMetadata().getContentType();
if (contentType != null && contentType.startsWith(VCloudMediaType.ERROR_XML)) {
try {
return (VCloudError) factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
} catch (RuntimeException e) {
logger.warn(e, "error parsing error");
}

View File

@ -50,4 +50,4 @@ public class BasePayloadTest {
throw Throwables.propagate(e);
}
}
}
}

View File

@ -55,7 +55,7 @@ public class CatalogHandlerTest {
InputStream is = getClass().getResourceAsStream("/catalog-blank.xml");
injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class);
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
assertEquals(result, new CatalogImpl("Jclouds-private", "application/vnd.vmware.vcloud.catalog+xml", URI
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081"), new ReferenceTypeImpl(null,
"application/vnd.vmware.vcloud.org+xml", URI
@ -67,7 +67,7 @@ public class CatalogHandlerTest {
InputStream is = getClass().getResourceAsStream("/catalog.xml");
injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class);
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
assertEquals(result.getName(), "Miami Environment 1");
assert result.getDescription() == null;

View File

@ -55,7 +55,7 @@ public class OrgHandlerTest {
Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class);
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
assertEquals(result.getName(), "ExampleOrg");
assertEquals(result.getFullName(), "ExampleOrg");
assertEquals(result.getDescription(), "Example Corp's Primary Organization.");
@ -80,7 +80,7 @@ public class OrgHandlerTest {
Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class);
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
assertEquals(result.getName(), "adrian@jclouds.org");
assertEquals(result.getFullName(), "adrian@jclouds.org");
assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
@ -98,7 +98,7 @@ public class OrgHandlerTest {
InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class);
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
assertEquals(result.getName(), "Customer 188849");
assertEquals(result.getFullName(), "Customer 188849");
assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
@ -115,7 +115,7 @@ public class OrgHandlerTest {
InputStream is = getClass().getResourceAsStream("/org-savvis.xml");
Injector injector = Guice.createInjector(new SaxParserModule());
Factory factory = injector.getInstance(ParseSax.Factory.class);
Org result = (Org) factory.create(injector.getInstance(OrgHandler.class)).parse(is);
Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
assertEquals(result, new OrgImpl("607968.0", null, null, "607968.0", "Gravitant Inc", ImmutableMap
.<String, ReferenceType> of(), ImmutableMap.<String, ReferenceType> of("GravDataCenter1(Saved)",
new ReferenceTypeImpl("GravDataCenter1(Saved)", "application/vnd.vmware.vcloud.vdc+xml", URI

View File

@ -83,7 +83,7 @@ public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalAsy
assertNonPayloadHeadersEqual(
request,
"Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\nContent-Length: 2\nContent-MD5: AAIECA==\nContent-Type: text/plain\n");
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 2l, new byte[] { 0, 2, 4, 8 }, null);
assertContentHeadersEqual(request, "text/plain", null, null, null, 2L, new byte[] { 0, 2, 4, 8 }, null);
assertEquals(request.getFilters().size(), 0);
}
@ -101,7 +101,7 @@ public class TransientBlobRequestSignerTest extends BaseAsyncClientTest<LocalAsy
assertNonPayloadHeadersEqual(
request,
"Authorization: Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==\nContent-Length: 3\nContent-MD5: rL0Y20zC+Fzt72VPzMSk2A==\nContent-Type: text/plain\n");
assertContentHeadersEqual(request, "text/plain", null, null, null, (long) 3l, md5, null);
assertContentHeadersEqual(request, "text/plain", null, null, null, 3L, md5, null);
assertEquals(request.getFilters().size(), 0);
}

View File

@ -37,7 +37,7 @@ import org.testng.annotations.Test;
public class ErrorHandlerTest extends BaseHandlerTest {
ParseSax<AzureStorageError> createParser() {
ParseSax<AzureStorageError> parser = (ParseSax<AzureStorageError>) factory.create(injector
ParseSax<AzureStorageError> parser = factory.create(injector
.getInstance(ErrorHandler.class));
return parser;
}

View File

@ -63,4 +63,4 @@ public final class TerremarkVCloudFallbacks {
}
}
}
}

View File

@ -403,7 +403,7 @@ public class InstantiateVAppTemplateOptions {
*/
public static InstantiateVAppTemplateOptions productProperty(String key, String value) {
InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
return (InstantiateVAppTemplateOptions) options.productProperty(key, value);
return options.productProperty(key, value);
}
/**
@ -412,7 +412,7 @@ public class InstantiateVAppTemplateOptions {
*/
public static InstantiateVAppTemplateOptions productProperties(Map<String, String> properties) {
InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
return (InstantiateVAppTemplateOptions) options.productProperties(properties);
return options.productProperties(properties);
}
}

View File

@ -56,7 +56,7 @@ public class VCloudUtils {
return null;
if (TerremarkVCloudMediaType.ERROR_XML.equals(response.getPayload().getContentMetadata().getContentType())) {
try {
return (VCloudError) factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
} catch (RuntimeException e) {
logger.warn(e, "error parsing error");
}

View File

@ -39,4 +39,4 @@ public class BasePayloadTest {
throw Throwables.propagate(e);
}
}
}
}

View File

@ -50,7 +50,7 @@ public class CatalogHandlerTest {
InputStream is = getClass().getResourceAsStream("/catalog.xml");
injector = Guice.createInjector(new SaxParserModule());
factory = injector.getInstance(ParseSax.Factory.class);
Catalog result = (Catalog) factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
assertEquals(result.getName(), "Miami Environment 1");
assert result.getDescription() == null;

View File

@ -64,7 +64,7 @@ public class CatalogItemHandlerTest extends BaseHandlerTest {
InputStream is = getClass().getResourceAsStream("/catalogItem-terremark.xml");
CatalogItem result = (CatalogItem) factory.create(
CatalogItem result = factory.create(
injector.getInstance(CatalogItemHandler.class)).parse(is);
assertEquals(
result,

View File

@ -40,7 +40,7 @@ public class CustomizationParametersHandlerTest extends BaseHandlerTest {
InputStream is = getClass().getResourceAsStream(
"/CustomizationParameters.xml");
CustomizationParameters result = (CustomizationParameters) factory
CustomizationParameters result = factory
.create(injector.getInstance(CustomizationParametersHandler.class))
.parse(is);
assertEquals(result, new CustomizationParameters(true, false, false));

View File

@ -49,7 +49,7 @@ public class InternetServiceHandlerTest extends BaseHandlerTest {
public void test1() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/InternetService.xml");
InternetService result = (InternetService) factory.create(injector.getInstance(InternetServiceHandler.class))
InternetService result = factory.create(injector.getInstance(InternetServiceHandler.class))
.parse(is);
assertEquals(result, new InternetService("IS_for_Jim", null, new PublicIpAddress("10.1.22.159", null), 80,
Protocol.HTTP, false, 1, "Some test service"));
@ -58,7 +58,7 @@ public class InternetServiceHandlerTest extends BaseHandlerTest {
public void test2() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/InternetService2.xml");
InternetService result = (InternetService) factory.create(injector.getInstance(InternetServiceHandler.class))
InternetService result = factory.create(injector.getInstance(InternetServiceHandler.class))
.parse(is);
assertEquals(result, new InternetService("IS_for_Jim2", URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/InternetServices/524"), new PublicIpAddress(

View File

@ -40,7 +40,7 @@ public class NodeHandlerTest extends BaseHandlerTest {
public void test1() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/NodeService.xml");
Node result = (Node) factory.create(injector.getInstance(NodeHandler.class)).parse(is);
Node result = factory.create(injector.getInstance(NodeHandler.class)).parse(is);
assertEquals(result, new Node("Node for Jim", URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/NodeServices/242"), "172.16.20.3", 80,
false, "Some test node"));

View File

@ -78,7 +78,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testApplyInputStream() {
InputStream is = getClass().getResourceAsStream("/launched_vapp.xml");
VApp result = (VApp) factory.create(
VApp result = factory.create(
injector.getInstance(VAppHandler.class)).parse(is);
assertEquals(result.getName(), "adriantest");
@ -95,7 +95,7 @@ public class VAppHandlerTest extends BaseHandlerTest {
public void testGetVApp() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/get_vapp.xml");
VApp result = (VApp) factory.create(
VApp result = factory.create(
injector.getInstance(VAppHandler.class)).parse(is);
assertEquals(result.getName(), "centos-53");

View File

@ -20,7 +20,8 @@ package org.jclouds.compute.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.CaseFormat.*;
import static com.google.common.base.CaseFormat.LOWER_HYPHEN;
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
/**
* Running Operating system

View File

@ -335,7 +335,7 @@ public class Sha512Crypt {
StringBuilder result = new StringBuilder();
while (--size >= 0) {
result.append(itoa64.charAt((int) (v & 0x3f)));
result.append(itoa64.charAt(v & 0x3f));
v >>>= 6;
}

View File

@ -585,7 +585,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
assert node.getLocation() != null : node;
assertEquals(node.getType(), ComputeType.NODE);
assert node instanceof NodeMetadata;
NodeMetadata nodeMetadata = (NodeMetadata) node;
NodeMetadata nodeMetadata = node;
assert nodeMetadata.getProviderId() != null : nodeMetadata;
// nullable
// assert nodeMetadata.getImage() != null : node;

View File

@ -42,4 +42,4 @@ public interface Fallback<V> extends FutureFallback<V> {
* the exception that made the call fail.
*/
V createOrPropagate(Throwable t) throws Exception;
}
}

View File

@ -204,4 +204,4 @@ public final class Fallbacks {
return getFirstThrowableOfType(from, ResourceNotFoundException.class) != null;
}
}
}

View File

@ -77,7 +77,7 @@ public abstract class BaseApiMetadata implements ApiMetadata {
return props;
}
public static abstract class Builder<T extends Builder<T>> implements ApiMetadata.Builder<T> {
public abstract static class Builder<T extends Builder<T>> implements ApiMetadata.Builder<T> {
protected abstract T self();
private String id;

View File

@ -88,7 +88,7 @@ public class IterableWithMarkers {
}
}
private static abstract class ForwardingIterableWithMarker<T> extends IterableWithMarker<T> {
private abstract static class ForwardingIterableWithMarker<T> extends IterableWithMarker<T> {
protected abstract IterableWithMarker<T> delegate();

View File

@ -97,7 +97,7 @@ public abstract class Arg0ToPagedIterable<T, I extends Arg0ToPagedIterable<T, I>
*
* @author Adrian Cole
*/
public static abstract class FromCaller<T, I extends FromCaller<T, I>> extends Arg0ToPagedIterable<T, I> {
public abstract static class FromCaller<T, I extends FromCaller<T, I>> extends Arg0ToPagedIterable<T, I> {
@Override
protected List<Object> getArgs(GeneratedHttpRequest request) {
return request.getCaller().get().getArgs();

View File

@ -113,7 +113,7 @@ public class WithSubmissionTrace {
}
}
private final static Set<String> stackTracesToTrim = ImmutableSet.of(WithSubmissionTrace.class.getName(),
private static final Set<String> stackTracesToTrim = ImmutableSet.of(WithSubmissionTrace.class.getName(),
ListeningExecutorService.class.getName(), ListenableFuture.class.getName(),
ListeningScheduledExecutorService.class.getName(), ScheduledFuture.class.getName());

View File

@ -123,4 +123,4 @@ public final class HeaderToRetryAfterException implements PropagateIfRetryAfter
return Optional.absent();
}
}
}

View File

@ -37,4 +37,4 @@ public interface PropagateIfRetryAfter extends FutureFallback<Object> {
@Override
ListenableFuture<Object> create(Throwable t);
}
}

View File

@ -77,7 +77,7 @@ public class HttpResponseException extends RuntimeException {
public HttpResponseException(HttpCommand command, HttpResponse response) {
this(String.format("request: %s %sfailed with response: %s", command.getCurrentRequest().getRequestLine(),
requestPayloadIfStringOrFormIfNotReturnEmptyString((HttpRequest) command.getCurrentRequest()),
requestPayloadIfStringOrFormIfNotReturnEmptyString(command.getCurrentRequest()),
response.getStatusLine()), command, response);
}

View File

@ -18,7 +18,7 @@
*/
package org.jclouds.http;
import static com.google.common.base.Preconditions.*;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
@ -72,4 +72,4 @@ public class UriTemplates {
}
return builder.toString();
}
}
}

View File

@ -214,7 +214,7 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactory imp
private T newInstance(Object[] ctorParams) throws AssertionError {
try {
return (T) parameterizedCtor.invoke(null, ctorParams);
return parameterizedCtor.invoke(null, ctorParams);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e) {

View File

@ -199,7 +199,7 @@ public class NamingStrategies {
/**
* Determines field naming from constructor annotations
*/
public final static class AnnotationConstructorNamingStrategy extends AnnotationBasedNamingStrategy {
public static final class AnnotationConstructorNamingStrategy extends AnnotationBasedNamingStrategy {
private final Predicate<Invokable<?, ?>> hasMarker;
private final Collection<? extends Class<? extends Annotation>> markers;

View File

@ -59,4 +59,4 @@ public interface ProxyConfig {
*/
Optional<Credentials> getCredentials();
}
}

View File

@ -144,4 +144,4 @@ public final class FunctionalReflection {
return invocationFunction.toString();
}
}
}
}

View File

@ -289,7 +289,9 @@ public class Reflection2 {
if (raw == Object.class)
continue;
for (Method method : raw.getDeclaredMethods()) {
method.setAccessible(true);
if (!coreJavaClass(raw)) {
method.setAccessible(true);
}
builder.add(key.method(method));
}
}
@ -297,6 +299,17 @@ public class Reflection2 {
}
});
private static boolean coreJavaClass(Class<?> clazz) {
// treat null packages (e.g. for proxy objects) as "non-core"
Package clazzPackage = clazz.getPackage();
if (clazzPackage == null) {
return false;
}
String packageName = clazzPackage.getName();
return packageName.startsWith("com.sun.") || packageName.startsWith("java.")
|| packageName.startsWith("javax.") || packageName.startsWith("sun.");
}
/**
* ensures that exceptions are not doubly-wrapped
*/
@ -309,4 +322,4 @@ public class Reflection2 {
throw propagate(e.getCause());
}
}
}
}

View File

@ -42,4 +42,4 @@ public class Types2 {
"unbound type variable: %s, use ctor that explicitly assigns this", type);
return type;
}
}
}

View File

@ -52,4 +52,4 @@ public interface InvocationConfig {
* fallback used for Sync or Async commands.
*/
Fallback<?> getFallback(Invocation invocation);
}
}

View File

@ -115,4 +115,4 @@ public class ReadAnnotationsAndProperties implements InvocationConfig {
}
});
}
}
}

View File

@ -147,4 +147,4 @@ public class SyncToAsyncHttpInvocationModule extends AbstractModule {
}
}), Class.class);
}
}
}

View File

@ -61,7 +61,7 @@ public abstract class BaseHttpApiMetadata<A> extends BaseApiMetadata implements
}, apiToken);
}
public static abstract class Builder<A, T extends Builder<A, T>> extends BaseApiMetadata.Builder<T> implements
public abstract static class Builder<A, T extends Builder<A, T>> extends BaseApiMetadata.Builder<T> implements
HttpApiMetadata.Builder<A, T> {
protected Class<A> api;

Some files were not shown because too many files have changed in this diff Show More