From dc4ca1efbd8ce43ff54dd8430c2f68e331c59314 Mon Sep 17 00:00:00 2001 From: adriancole Date: Sat, 19 Jan 2013 08:32:45 -0800 Subject: [PATCH] removed deprecated methods which were easy to do --- .../jclouds/cloudstack/CloudStackContext.java | 4 - .../internal/CloudStackContextImpl.java | 7 - .../jclouds/cloudstack/util/ApiKeyPairs.java | 2 +- .../PasswordAuthenticationExpectTest.java | 12 +- .../features/AccountClientExpectTest.java | 3 +- .../features/FirewallClientExpectTest.java | 3 +- .../features/ISOAsyncClientTest.java | 2 +- .../features/ISOClientExpectTest.java | 4 +- .../features/SSHKeyPairClientExpectTest.java | 3 +- .../features/SessionClientExpectTest.java | 3 +- .../VirtualMachineClientExpectTest.java | 3 +- .../features/ZoneClientExpectTest.java | 3 +- .../org/jclouds/ec2/domain/Reservation.java | 8 - .../jclouds/ec2/domain/RunningInstance.java | 8 - .../org/jclouds/ec2/domain/SecurityGroup.java | 8 - .../compute/EC2ComputeServiceLiveTest.java | 2 +- .../keystone/v2_0/domain/Access.java | 25 -- .../keystone/v2_0/domain/Service.java | 16 - .../openstack/keystone/v2_0/domain/User.java | 17 - .../jclouds/blobstore/BlobStoreContext.java | 10 - .../blobstore/BlobStoreContextFactory.java | 131 -------- .../internal/BlobStoreContextImpl.java | 6 - .../blobstore/util/BlobStoreUtils.java | 7 - .../clojure/org/jclouds/blobstore2_test.clj | 3 +- .../blobstore/util/BlobStoreUtilsTest.java | 16 +- .../jclouds/openstack/domain/Resource.java | 14 +- .../openstack/keystone/v1_1/domain/Auth.java | 47 +-- .../compute/ComputeServiceContext.java | 31 -- .../compute/ComputeServiceContextFactory.java | 133 -------- .../jclouds/compute/domain/ExecResponse.java | 10 - .../org/jclouds/compute/domain/Image.java | 17 - .../jclouds/compute/domain/NodeMetadata.java | 25 +- .../compute/domain/NodeMetadataBuilder.java | 11 - .../org/jclouds/compute/domain/NodeState.java | 101 ------ .../compute/domain/internal/ImageImpl.java | 10 - .../domain/internal/NodeMetadataImpl.java | 18 - .../internal/ComputeServiceContextImpl.java | 21 -- .../reference/ComputeServiceConstants.java | 65 ---- .../compute/util/ComputeServiceUtils.java | 11 +- .../main/java/org/jclouds/ssh/SshClient.java | 9 - .../src/test/clojure/org/jclouds/ssh_test.clj | 4 - core/src/main/java/org/jclouds/Context.java | 51 +-- .../org/jclouds/internal/ContextImpl.java | 40 --- .../main/java/org/jclouds/rest/Providers.java | 59 ---- .../org/jclouds/rest/RestContextFactory.java | 135 -------- .../java/org/jclouds/util/ProvidersTest.java | 42 --- .../ssh/jsch/config/JschSshClientModule.java | 6 - .../sshj/config/SshjSshClientModule.java | 5 - .../domain/infrastructure/StoragePool.java | 95 +----- .../azure/management/features/RoleApi.java | 86 ++--- .../management/features/RoleAsyncApi.java | 169 ++++------ .../config/BindBackendComputeServiceTest.java | 8 - .../director/v1_5/domain/Reference.java | 8 - .../BaseVCloudDirectorApiLiveTest.java | 10 - .../BaseVCloudDirectorExpectTest.java | 85 ----- .../LoadBalancerServiceContext.java | 10 - .../LoadBalancerServiceContextFactory.java | 131 -------- .../LoadBalancerServiceContextImpl.java | 7 - .../java/org/jclouds/aws/ec2/domain/Tag.java | 159 --------- .../org/jclouds/aws/ec2/util/TagFilters.java | 312 ------------------ ...BindTagFiltersToIndexedFormParamsTest.java | 105 ------ .../compute/AWSEC2ComputeServiceLiveTest.java | 2 +- .../jclouds/scriptbuilder/InitBuilder.java | 182 ---------- .../statements/java/InstallJDK.java | 12 - .../scriptbuilder/InitBuilderTest.java | 96 ------ 65 files changed, 138 insertions(+), 2510 deletions(-) delete mode 100644 blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java delete mode 100644 compute/src/main/java/org/jclouds/compute/ComputeServiceContextFactory.java delete mode 100644 compute/src/main/java/org/jclouds/compute/domain/NodeState.java delete mode 100644 core/src/main/java/org/jclouds/rest/Providers.java delete mode 100644 core/src/main/java/org/jclouds/rest/RestContextFactory.java delete mode 100644 core/src/test/java/org/jclouds/util/ProvidersTest.java delete mode 100644 loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContextFactory.java delete mode 100644 providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/domain/Tag.java delete mode 100644 providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/util/TagFilters.java delete mode 100644 providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/binders/BindTagFiltersToIndexedFormParamsTest.java delete mode 100644 scriptbuilder/src/main/java/org/jclouds/scriptbuilder/InitBuilder.java delete mode 100644 scriptbuilder/src/test/java/org/jclouds/scriptbuilder/InitBuilderTest.java diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java index 591f14cae9..376a16b02b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackContext.java @@ -33,10 +33,6 @@ import com.google.inject.ImplementedBy; @ImplementedBy(CloudStackContextImpl.class) public interface CloudStackContext extends ComputeServiceContext { - @SuppressWarnings("unchecked") - @Override - RestContext getProviderSpecificContext(); - RestContext getDomainContext(); RestContext getGlobalContext(); diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java index 118bc7c8dc..5bc86587d7 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/internal/CloudStackContextImpl.java @@ -22,8 +22,6 @@ import javax.inject.Inject; import javax.inject.Singleton; import org.jclouds.Context; -import org.jclouds.cloudstack.CloudStackAsyncClient; -import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.CloudStackContext; import org.jclouds.cloudstack.CloudStackDomainAsyncClient; import org.jclouds.cloudstack.CloudStackDomainClient; @@ -55,11 +53,6 @@ public class CloudStackContextImpl extends ComputeServiceContextImpl implements this.globalContext = globalContext; } - @Override - public RestContext getProviderSpecificContext() { - return unwrap(); - } - @Override public RestContext getDomainContext() { return domainContext; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/util/ApiKeyPairs.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/util/ApiKeyPairs.java index d5bd2bd5da..5032b8e65f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/util/ApiKeyPairs.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/util/ApiKeyPairs.java @@ -67,7 +67,7 @@ public class ApiKeyPairs { .credentials(String.format("%s/%s", checkNotNull(domain, "domain"), checkNotNull(username, "username")), password) .overrides(overrides).build(CloudStackContext.class); - CloudStackClient client = context.getProviderSpecificContext().getApi(); + CloudStackClient client = context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi(); Set listOfAccounts = client.getAccountClient().listAccounts(); domain = (domain.equals("") || domain.equals("/")) ? "ROOT" : domain; diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java index f4c125436d..af8767c4a7 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java @@ -38,7 +38,7 @@ import com.google.common.net.HttpHeaders; * @author Adrian Cole */ @Test(groups = "unit", testName = "PasswordAuthenticationExpectTest") -public class PasswordAuthenticationExpectTest extends BaseCloudStackExpectTest { +public class PasswordAuthenticationExpectTest extends BaseCloudStackExpectTest { /** * this reflects the properties that a user would pass to createContext @@ -52,7 +52,7 @@ public class PasswordAuthenticationExpectTest extends BaseCloudStackExpectTest { @Override protected ISOClient clientFrom(CloudStackContext context) { - return context.getProviderSpecificContext().getApi().getISOClient(); + return context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi().getISOClient(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairClientExpectTest.java index c77a4f652b..064dc03435 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SSHKeyPairClientExpectTest.java @@ -24,6 +24,7 @@ import static org.testng.Assert.assertTrue; import java.io.UnsupportedEncodingException; import java.net.URI; +import org.jclouds.cloudstack.CloudStackApiMetadata; import org.jclouds.cloudstack.CloudStackContext; import org.jclouds.cloudstack.domain.SshKeyPair; import org.jclouds.cloudstack.internal.BaseCloudStackExpectTest; @@ -181,6 +182,6 @@ public class SSHKeyPairClientExpectTest extends BaseCloudStackExpectTest { @Override protected ZoneClient clientFrom(CloudStackContext context) { - return context.getProviderSpecificContext().getApi().getZoneClient(); + return context.unwrap(CloudStackApiMetadata.CONTEXT_TOKEN).getApi().getZoneClient(); } } diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/domain/Reservation.java b/apis/ec2/src/main/java/org/jclouds/ec2/domain/Reservation.java index 5a621b290d..24d4e96e67 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/domain/Reservation.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/domain/Reservation.java @@ -165,14 +165,6 @@ public class Reservation extends ForwardingSet imp public String getRegion() { return region; } - - /** - * @see #getGroupNames() - */ - @Deprecated - public Set getGroupIds() { - return groupNames; - } /** * Names of the security groups. diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/domain/RunningInstance.java b/apis/ec2/src/main/java/org/jclouds/ec2/domain/RunningInstance.java index f062c93448..7d614c6007 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/domain/RunningInstance.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/domain/RunningInstance.java @@ -473,14 +473,6 @@ public class RunningInstance implements Comparable { public Map getEbsBlockDevices() { return ebsBlockDevices; } - - /** - * @see #getGroupNames() - */ - @Deprecated - public Set getGroupIds() { - return getGroupNames(); - } /** * Names of the security groups. diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java b/apis/ec2/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java index 34cade9369..af1f3ab21e 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/domain/SecurityGroup.java @@ -194,14 +194,6 @@ public class SecurityGroup extends ForwardingSet { return description; } - /** - * Please use this class as a collection - */ - @Deprecated - public Set getIpPermissions() { - return ipPermissions; - } - @Override public int hashCode() { return Objects.hashCode(region, id, name, ownerId); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java index d6d84f9296..087a0886f7 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java @@ -158,7 +158,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest { // make sure our dummy group has no rules SecurityGroup secgroup = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(null, "jclouds#" + group + "#" + instance.getRegion())); - assert secgroup.getIpPermissions().size() == 0 : secgroup; + assert secgroup.size() == 0 : secgroup; // try to run a script with the original keyPair runScriptWithCreds(group, first.getOperatingSystem(), diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java index d4c6f17ca7..c415318f41 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java @@ -87,23 +87,6 @@ public class Access extends ForwardingSet implements Comparable return self(); } - /** - * @see #services(Iterable) - */ - @Deprecated - public T serviceCatalog(Set serviceCatalog) { - this.serviceCatalog.addAll(serviceCatalog); - return self(); - } - - /** - * @see #services(Iterable) - */ - @Deprecated - public T serviceCatalog(Service... in) { - return serviceCatalog(ImmutableSet.copyOf(in)); - } - public Access build() { return new Access(token, user, serviceCatalog.build()); } @@ -145,14 +128,6 @@ public class Access extends ForwardingSet implements Comparable return this.user; } - /** - * Please access the service catalog via normal collection mechanisms - */ - @Deprecated - public Set getServiceCatalog() { - return this.serviceCatalog; - } - @Override public int hashCode() { return Objects.hashCode(token, user, serviceCatalog); diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java index 72a0c3d9e3..1cb3752aac 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java @@ -86,14 +86,6 @@ public class Service extends ForwardingSet { return self(); } - /** - * @see #endpoints(Iterable) - */ - @Deprecated - public T endpoints(Endpoint... in) { - return endpoints(ImmutableSet.copyOf(in)); - } - public Service build() { return new Service(type, name, endpoints.build()); } @@ -141,14 +133,6 @@ public class Service extends ForwardingSet { return this.name; } - /** - * Please use this as a Set - */ - @Deprecated - public Set getEndpoints() { - return this.endpoints; - } - @Override public int hashCode() { return Objects.hashCode(type, name, endpoints); diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java index 2091a19385..b5b49b32f7 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java @@ -90,14 +90,6 @@ public class User extends ForwardingSet { return self(); } - /** - * @see #roles(Iterable) - */ - @Deprecated - public T roles(Role... in) { - return roles(ImmutableSet.copyOf(in)); - } - public User build() { return new User(id, name, roles.build()); } @@ -146,15 +138,6 @@ public class User extends ForwardingSet { return this.name; } - /** - * Please use User as a Set - * @return the roles assigned to the user - */ - @Deprecated - public Set getRoles() { - return this.roles; - } - @Override public int hashCode() { return Objects.hashCode(id, name, roles); diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java index 2d716c69b6..4f6b57ab3d 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContext.java @@ -24,7 +24,6 @@ import org.jclouds.View; import org.jclouds.blobstore.attr.ConsistencyModel; import org.jclouds.blobstore.internal.BlobStoreContextImpl; import org.jclouds.blobstore.options.ListContainerOptions; -import org.jclouds.rest.RestContext; import org.jclouds.rest.Utils; import com.google.inject.ImplementedBy; @@ -116,15 +115,6 @@ public interface BlobStoreContext extends Closeable, View { */ Utils utils(); - /** - * will be removed in jclouds 1.6 - * - * @see View#getInputType - * @see View#unwrap - */ - @Deprecated - RestContext getProviderSpecificContext(); - /** * closes threads and resources related to this connection. * diff --git a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java b/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java deleted file mode 100644 index e014115fe1..0000000000 --- a/blobstore/src/main/java/org/jclouds/blobstore/BlobStoreContextFactory.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.blobstore; - -import java.util.NoSuchElementException; -import java.util.Properties; - -import org.jclouds.ContextBuilder; -import org.jclouds.apis.Apis; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.Providers; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * This class is deprecated in favor of {@link ContextBuilder}. Please view - * sample usage below: - * - *
- * context = ContextBuilder.newBuilder("aws-s3")
- *                         .credentials(apikey, secret)
- *                         .buildView(BlobStoreContext.class);
- * 
- * - * @see ContextBuilder - * @deprecated As of version 1.5, replaced by {@link ContextBuilder} - * @author Adrian Cole - */ -@Deprecated -public class BlobStoreContextFactory { - - /** - * for porting old code to {@link ContextBuilder} - */ - public BlobStoreContextFactory() { - } - - /** - * for porting old code to {@link ContextBuilder} - */ - public BlobStoreContextFactory(Properties properties) { - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public BlobStoreContext createContext(String providerOrApi, String identity, String credential) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), new Properties()); - } - - /** - * @see #createContext(String, String, String, Iterable, Properties) - */ - public BlobStoreContext createContext(String providerOrApi, Properties overrides) { - return createContext(providerOrApi, null, null, ImmutableSet. of(), overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public BlobStoreContext createContext(String providerOrApi, Iterable wiring, - Properties overrides) { - return createContext(providerOrApi, null, null, wiring, overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public BlobStoreContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Properties overrides) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), overrides); - } - - /** - * @see createContext(String, String,String, Iterable, Properties) - */ - public BlobStoreContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring) { - return createContext(providerOrApi, identity, credential, wiring, new Properties()); - } - - /** - * for porting old code to {@link ContextBuilder} - * - * @param providerOrApi - * @param identity - * nullable, if credentials are present in the overrides - * @param credential - * nullable, if credentials are present in the overrides - * @param wiring - * Configuration you'd like to pass to the context. Ex. - * ImmutableSet.of(new ExecutorServiceModule(myexecutor)) - * @param overrides - * properties to override defaults with. - * @return initialized context ready for use - */ - public BlobStoreContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring, Properties overrides) { - ContextBuilder builder = null; - try { - ProviderMetadata pm = Providers.withId(providerOrApi); - builder = ContextBuilder.newBuilder(pm); - } catch (NoSuchElementException e) { - builder = ContextBuilder.newBuilder(Apis.withId(providerOrApi)); - } - builder.modules(wiring); - builder.overrides(overrides); - if (identity != null) - builder.credentials(identity, credential); - return builder.build(BlobStoreContext.class); - } - -} diff --git a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java index 64ab7f718f..ba16fcad33 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/internal/BlobStoreContextImpl.java @@ -118,12 +118,6 @@ public class BlobStoreContextImpl extends BaseView implements BlobStoreContext { return blobRequestSigner; } - @SuppressWarnings("unchecked") - @Override - public RestContext getProviderSpecificContext() { - return (RestContext) delegate(); - } - @Override public void close() { Closeables.closeQuietly(delegate()); diff --git a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java index b5a2b3979f..aaafe1ced2 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java @@ -26,7 +26,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jclouds.blobstore.AsyncBlobStore; -import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.MutableBlobMetadata; import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl; @@ -36,7 +35,6 @@ import org.jclouds.http.HttpRequestFilter; import org.jclouds.rest.internal.GeneratedHttpRequest; import com.google.common.collect.Maps; -import com.google.common.reflect.TypeToken; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -93,11 +91,6 @@ public class BlobStoreUtils { return Futures.immediateFuture(null); } } - - @Deprecated - public static Iterable getSupportedProviders() { - return org.jclouds.rest.Providers.getSupportedProvidersOfType(TypeToken.of(BlobStoreContext.class)); - } public static MutableBlobMetadata copy(MutableBlobMetadata in) { MutableBlobMetadata metadata = new MutableBlobMetadataImpl(in); diff --git a/blobstore/src/test/clojure/org/jclouds/blobstore2_test.clj b/blobstore/src/test/clojure/org/jclouds/blobstore2_test.clj index 4d5f0decef..ef6275be27 100644 --- a/blobstore/src/test/clojure/org/jclouds/blobstore2_test.clj +++ b/blobstore/src/test/clojure/org/jclouds/blobstore2_test.clj @@ -20,8 +20,7 @@ (ns org.jclouds.blobstore2-test (:use [org.jclouds.blobstore2] :reload-all) (:use [clojure.test]) - (:import [org.jclouds.blobstore BlobStoreContextFactory] - [java.io ByteArrayInputStream ByteArrayOutputStream + (:import [java.io ByteArrayInputStream ByteArrayOutputStream StringBufferInputStream] [org.jclouds.util Strings2])) diff --git a/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java b/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java index 666c7c5d69..fe9f7a5381 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java @@ -33,14 +33,12 @@ import org.jclouds.blobstore.AsyncBlobStore; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.MutableBlobMetadata; import org.jclouds.reflect.Invocation; -import com.google.common.reflect.Invokable; -import org.jclouds.rest.Providers; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.testng.annotations.Test; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; +import com.google.common.reflect.Invokable; /** * Tests behavior of {@code BlobStoreUtils} @@ -50,18 +48,6 @@ import com.google.common.collect.Iterables; @Test(groups = "unit") public class BlobStoreUtilsTest { - @Test - public void testSupportedBlobStoreProviders() { - Iterable providers = BlobStoreUtils.getSupportedProviders(); - assert Iterables.contains(providers, "transient") : providers; - } - - @Test - public void testSupportedProviders() { - Iterable providers = Providers.getSupportedProviders(); - assert Iterables.contains(providers, "transient") : providers; - } - public void testCreateParentIfNeededAsyncNoPath() { AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class); String container = "container"; diff --git a/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java b/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java index e40ba87f6a..ee6e2b0558 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/domain/Resource.java @@ -87,14 +87,11 @@ public class Resource implements Comparable { } public Resource build() { - return new Resource(this); + return new Resource(id, name, links); } public T fromResource(Resource in) { - return this - .id(in.getId()) - .name(in.getName()) - .links(in.getLinks()); + return id(in.getId()).name(in.getName()).links(in.getLinks()); } } @@ -115,13 +112,6 @@ public class Resource implements Comparable { this.links = links == null ? ImmutableSet.of() : ImmutableSet.copyOf(links); } - @Deprecated - protected Resource(Builder builder) { - this.id = checkNotNull(builder.id, "id"); - this.name = builder.name; - this.links = ImmutableSet.copyOf(checkNotNull(builder.links, "links")); - } - /** * When providing an ID, it is assumed that the resource exists in the current OpenStack * deployment diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java index ca95ebf6e7..fe75f3f424 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/domain/Auth.java @@ -22,13 +22,8 @@ import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.toStringHelper; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.Map; -import java.util.Set; - import com.google.common.base.Objects; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; /** @@ -77,49 +72,15 @@ public class Auth implements Comparable { return token(from.getToken()).serviceCatalog(from.getServiceCatalog()); } } - - protected Auth() { - // we want serializers like Gson to work w/o using sun.misc.Unsafe, - // prohibited in GAE. This also implies fields are not final. - // see http://code.google.com/p/jclouds/issues/detail?id=925 - } - protected Token token; - // TODO: get gson multimap adapter! - protected Map> serviceCatalog = ImmutableMap.of(); + protected final Token token; + protected final Multimap serviceCatalog; public Auth(Token token, Multimap serviceCatalog) { this.token = checkNotNull(token, "token"); - this.serviceCatalog = toOldSchool(ImmutableMultimap.copyOf(checkNotNull(serviceCatalog, "serviceCatalog"))); + this.serviceCatalog = ImmutableMultimap.copyOf(checkNotNull(serviceCatalog, "serviceCatalog")); } - /** - * The traditional way to represent a graph in Java is Map>, which is awkward in a number of ways. Guava's - * Multimap framework makes it easy to handle a mapping from keys to multiple values. - *

- * Until we write or discover a gson Multimap deserializer, we may be stuck with this. - * - * TODO: ask on stackoverflow and/or jesse wilson - */ - @Deprecated - private static Map> toOldSchool(Multimap in) { - ImmutableMap.Builder> out = ImmutableMap.builder(); - for (K type : in.keySet()) - out.put(type, ImmutableSet.copyOf(in.get(type))); - return out.build(); - } - - /** - * @see #toOldSchool - */ - @Deprecated - private static ImmutableMultimap fromOldSchool(Map> in) { - ImmutableMultimap.Builder out = ImmutableMultimap.builder(); - for (K type : in.keySet()) - out.putAll(type, ImmutableSet.copyOf(in.get(type))); - return out.build(); - } - /** * TODO */ @@ -131,7 +92,7 @@ public class Auth implements Comparable { * TODO */ public Multimap getServiceCatalog() { - return fromOldSchool(serviceCatalog); + return serviceCatalog; } @Override diff --git a/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java b/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java index 237f704ed4..65b094a2c2 100644 --- a/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java +++ b/compute/src/main/java/org/jclouds/compute/ComputeServiceContext.java @@ -19,14 +19,10 @@ package org.jclouds.compute; import java.io.Closeable; -import java.util.Map; import org.jclouds.View; import org.jclouds.compute.internal.ComputeServiceContextImpl; -import org.jclouds.domain.Credentials; -import org.jclouds.rest.RestContext; -import com.google.common.annotations.Beta; import com.google.inject.ImplementedBy; /** @@ -41,24 +37,6 @@ public interface ComputeServiceContext extends Closeable, View { ComputeService getComputeService(); - /** - * will be removed in jclouds 1.6 - * - * @see Utils#getCredentialStore() - */ - @Deprecated - @Beta - Map getCredentialStore(); - - /** - * will be removed in jclouds 1.6 - * - * @see Utils#credentialStore() - */ - @Deprecated - @Beta - Map credentialStore(); - Utils getUtils(); /** @@ -66,15 +44,6 @@ public interface ComputeServiceContext extends Closeable, View { */ Utils utils(); - /** - * will be removed in jclouds 1.6 - * - * @see View#getInputType - * @see View#unwrap - */ - @Deprecated - RestContext getProviderSpecificContext(); - @Override void close(); } diff --git a/compute/src/main/java/org/jclouds/compute/ComputeServiceContextFactory.java b/compute/src/main/java/org/jclouds/compute/ComputeServiceContextFactory.java deleted file mode 100644 index bc10f57c5f..0000000000 --- a/compute/src/main/java/org/jclouds/compute/ComputeServiceContextFactory.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.compute; - -import java.util.NoSuchElementException; -import java.util.Properties; - -import org.jclouds.ContextBuilder; -import org.jclouds.apis.Apis; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.Providers; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * This class is deprecated in favor of {@link ContextBuilder}. Please view - * sample usage below: - * - *

- * context = ContextBuilder.newBuilder("openstack-nova")
- *                         .endpoint("http://10.10.10.10:5000/v2.0")
- *                         .credentials(user, pass)
- *                         .modules(singleton(new SshjSshClientModule()))
- *                         .buildView(ComputeServiceContext.class);
- * 
- * - * @see ContextBuilder - * @deprecated As of version 1.5, replaced by {@link ContextBuilder} - * @author Adrian Cole - */ -@Deprecated -public class ComputeServiceContextFactory { - - /** - * for porting old code to {@link ContextBuilder} - */ - public ComputeServiceContextFactory() { - } - - /** - * for porting old code to {@link ContextBuilder} - */ - public ComputeServiceContextFactory(Properties properties) { - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public ComputeServiceContext createContext(String providerOrApi, String identity, String credential) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), new Properties()); - } - - /** - * @see #createContext(String, String, String, Iterable, Properties) - */ - public ComputeServiceContext createContext(String providerOrApi, Properties overrides) { - return createContext(providerOrApi, null, null, ImmutableSet. of(), overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public ComputeServiceContext createContext(String providerOrApi, Iterable wiring, - Properties overrides) { - return createContext(providerOrApi, null, null, wiring, overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public ComputeServiceContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Properties overrides) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), overrides); - } - - /** - * @see createContext(String, String,String, Iterable, Properties) - */ - public ComputeServiceContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring) { - return createContext(providerOrApi, identity, credential, wiring, new Properties()); - } - - /** - * for porting old code to {@link ContextBuilder} - * - * @param providerOrApi - * @param identity - * nullable, if credentials are present in the overrides - * @param credential - * nullable, if credentials are present in the overrides - * @param wiring - * Configuration you'd like to pass to the context. Ex. - * ImmutableSet.of(new ExecutorServiceModule(myexecutor)) - * @param overrides - * properties to override defaults with. - * @return initialized context ready for use - */ - public ComputeServiceContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring, Properties overrides) { - ContextBuilder builder = null; - try { - ProviderMetadata pm = Providers.withId(providerOrApi); - builder = ContextBuilder.newBuilder(pm); - } catch (NoSuchElementException e) { - builder = ContextBuilder.newBuilder(Apis.withId(providerOrApi)); - } - builder.modules(wiring); - builder.overrides(overrides); - if (identity != null) - builder.credentials(identity, credential); - return builder.build(ComputeServiceContext.class); - } - -} diff --git a/compute/src/main/java/org/jclouds/compute/domain/ExecResponse.java b/compute/src/main/java/org/jclouds/compute/domain/ExecResponse.java index 10c7e0a178..178dcfd983 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/ExecResponse.java +++ b/compute/src/main/java/org/jclouds/compute/domain/ExecResponse.java @@ -45,16 +45,6 @@ public class ExecResponse implements CustomizationResponse { return output; } - /** - *

will be removed in jclouds 1.6.0


- * - * @see #getExitStatus - */ - @Deprecated - public int getExitCode() { - return exitStatus; - } - public int getExitStatus() { return exitStatus; } diff --git a/compute/src/main/java/org/jclouds/compute/domain/Image.java b/compute/src/main/java/org/jclouds/compute/domain/Image.java index 4c7f0f320c..ebfc8adcec 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/Image.java +++ b/compute/src/main/java/org/jclouds/compute/domain/Image.java @@ -20,7 +20,6 @@ package org.jclouds.compute.domain; import org.jclouds.compute.domain.internal.ImageImpl; import org.jclouds.domain.LoginCredentials; -import org.jclouds.javax.annotation.Nullable; import com.google.common.annotations.Beta; import com.google.inject.ImplementedBy; @@ -73,22 +72,6 @@ public interface Image extends ComputeMetadataIncludingStatus { */ String getDescription(); - /** - *

will be removed in jclouds 1.4.0

- * - * secures access to root with a password. This password is required to access either the console - * or run sudo as root. - *

- * ex. {@code echo 'password' |sudo -S command} - * - * - * @return root or console password, if configured, or null. - * @see LoginCredentials#shouldAuthenticateSudo - */ - @Nullable - @Deprecated - String getAdminPassword(); - /** * Default credentials for the current image */ diff --git a/compute/src/main/java/org/jclouds/compute/domain/NodeMetadata.java b/compute/src/main/java/org/jclouds/compute/domain/NodeMetadata.java index 7be89cc606..7d49fa68d4 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/NodeMetadata.java +++ b/compute/src/main/java/org/jclouds/compute/domain/NodeMetadata.java @@ -20,6 +20,7 @@ package org.jclouds.compute.domain; import java.util.Set; +import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.domain.internal.NodeMetadataImpl; import org.jclouds.domain.LoginCredentials; import org.jclouds.javax.annotation.Nullable; @@ -102,35 +103,11 @@ public interface NodeMetadata extends ComputeMetadataIncludingStatusNote - * will be removed in jclouds 1.6! - * @see #getStatus() - */ - @Deprecated - NodeState getState(); - /** * @return the TCP port used for terminal connections. Generally, this is port 22 for ssh. */ int getLoginPort(); - /** - *

will be removed in jclouds 1.4.0

- * - * secures access to root with a password. This password is required to access either the console - * or run sudo as root. - *

- * ex. {@code echo 'password' |sudo -S command} - * - * @return root or console password, if configured, or null. - * @see LoginCredentials#shouldAuthenticateSudo - */ - @Nullable - @Deprecated - String getAdminPassword(); - /** * If possible, these are returned upon all detail requests. However, it is often the case that * credentials are only available when a node is initially created. diff --git a/compute/src/main/java/org/jclouds/compute/domain/NodeMetadataBuilder.java b/compute/src/main/java/org/jclouds/compute/domain/NodeMetadataBuilder.java index efacad2a6e..5fa210eb99 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/NodeMetadataBuilder.java +++ b/compute/src/main/java/org/jclouds/compute/domain/NodeMetadataBuilder.java @@ -73,17 +73,6 @@ public class NodeMetadataBuilder extends ComputeMetadataBuilder { this.backendStatus = backendStatus; return this; } - - /** - *

Note

- * will be removed in jclouds 1.6! - * @see #status - */ - @Deprecated - public NodeMetadataBuilder state(NodeState state) { - this.status = checkNotNull(state, "state").toStatus(); - return this; - } public NodeMetadataBuilder publicAddresses(Iterable publicAddresses) { this.publicAddresses = ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses")); diff --git a/compute/src/main/java/org/jclouds/compute/domain/NodeState.java b/compute/src/main/java/org/jclouds/compute/domain/NodeState.java deleted file mode 100644 index cdce83caf4..0000000000 --- a/compute/src/main/java/org/jclouds/compute/domain/NodeState.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.compute.domain; - -import org.jclouds.compute.domain.NodeMetadata.Status; - -/** - * Indicates the status of a node. Replaced by {@link Status} - * - * @author Adrian Cole - * @see NodeMetadata#getStatus() - */ -@Deprecated -public enum NodeState { - /** - * The node is in transition - * - * @see Status#PENDING - */ - PENDING, - /** - * The node is visible, and in the process of being deleted. - * - * @see Status#TERMINATED - */ - TERMINATED, - /** - * The node is deployed, but suspended or stopped. - * - * @see Status#SUSPENDED - */ - SUSPENDED, - /** - * The node is available for requests - * - * @see Status#RUNNING - */ - RUNNING, - /** - * There is an error on the node - * - * @see Status#ERROR - */ - ERROR, - /** - * The state of the node is unrecognized. - * - * @see Status#UNRECOGNIZED - */ - UNRECOGNIZED; - - public static NodeState from(Status in) { - switch (in) { - case PENDING: - return PENDING; - case TERMINATED: - return TERMINATED; - case SUSPENDED: - return SUSPENDED; - case RUNNING: - return RUNNING; - case ERROR: - return ERROR; - default: - return UNRECOGNIZED; - } - } - - public Status toStatus() { - switch (this) { - case PENDING: - return Status.PENDING; - case TERMINATED: - return Status.TERMINATED; - case SUSPENDED: - return Status.SUSPENDED; - case RUNNING: - return Status.RUNNING; - case ERROR: - return Status.ERROR; - default: - return Status.UNRECOGNIZED; - } - } -} diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java index 9f8a3060a8..08b7b9de25 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/ImageImpl.java @@ -107,16 +107,6 @@ public class ImageImpl extends ComputeMetadataImpl implements Image { return defaultCredentials; } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public String getAdminPassword() { - return (defaultCredentials != null && defaultCredentials.shouldAuthenticateSudo()) ? defaultCredentials - .getPassword() : null; - } - // equals and toString from super are sufficient to establish identity equivalence protected ToStringHelper string() { diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java index 58ff61e013..46dedf1f3f 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/NodeMetadataImpl.java @@ -95,15 +95,6 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat return hardware; } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public String getAdminPassword() { - return (credentials != null && credentials.shouldAuthenticateSudo()) ? credentials.getPassword() : null; - } - /** * {@inheritDoc} */ @@ -128,15 +119,6 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat return privateAddresses; } - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public org.jclouds.compute.domain.NodeState getState() { - return org.jclouds.compute.domain.NodeState.from(status); - } - /** * {@inheritDoc} */ diff --git a/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java b/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java index a2c3235bdd..a5aaf956b7 100644 --- a/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java +++ b/compute/src/main/java/org/jclouds/compute/internal/ComputeServiceContextImpl.java @@ -20,8 +20,6 @@ package org.jclouds.compute.internal; import static com.google.common.base.Preconditions.checkNotNull; -import java.util.Map; - import javax.inject.Inject; import javax.inject.Singleton; @@ -29,10 +27,8 @@ import org.jclouds.Context; import org.jclouds.compute.ComputeService; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.Utils; -import org.jclouds.domain.Credentials; import org.jclouds.internal.BaseView; import org.jclouds.location.Provider; -import org.jclouds.rest.RestContext; import com.google.common.reflect.TypeToken; @@ -57,12 +53,6 @@ public class ComputeServiceContextImpl extends BaseView implements ComputeServic return computeService; } - @SuppressWarnings("unchecked") - @Override - public RestContext getProviderSpecificContext() { - return (RestContext) delegate(); - } - @Override public void close() { delegate().close(); @@ -77,15 +67,4 @@ public class ComputeServiceContextImpl extends BaseView implements ComputeServic public Utils utils() { return utils; } - - @Override - public Map credentialStore() { - return utils().credentialStore(); - } - - @Override - public Map getCredentialStore() { - return utils().credentialStore(); - } - } diff --git a/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java b/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java index 11dddae7c3..b321f8f8ff 100644 --- a/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java +++ b/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java @@ -17,10 +17,6 @@ * under the License. */ package org.jclouds.compute.reference; -import static org.jclouds.compute.config.ComputeServiceProperties.BLACKLIST_NODES; -import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_AUTHENTICATE_SUDO; -import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_ID; -import static org.jclouds.compute.config.ComputeServiceProperties.IMAGE_LOGIN_USER; import static org.jclouds.compute.config.ComputeServiceProperties.INIT_STATUS_INITIAL_PERIOD; import static org.jclouds.compute.config.ComputeServiceProperties.INIT_STATUS_MAX_PERIOD; import static org.jclouds.compute.config.ComputeServiceProperties.OS_VERSION_MAP_JSON; @@ -54,67 +50,6 @@ public interface ComputeServiceConstants { public static final String COMPUTE_LOGGER = "jclouds.compute"; public static final String LOCAL_PARTITION_GB_PATTERN = "disk_drive/%s/gb"; - - /** - * @see ComputeServiceProperties#TIMEOUT_NODE_TERMINATED - */ - @Deprecated - public static final String PROPERTY_TIMEOUT_NODE_TERMINATED = TIMEOUT_NODE_TERMINATED; - /** - * @see ComputeServiceProperties#TIMEOUT_NODE_RUNNING - */ - @Deprecated - public static final String PROPERTY_TIMEOUT_NODE_RUNNING = TIMEOUT_NODE_RUNNING; - /** - * @see ComputeServiceProperties#TIMEOUT_NODE_SUSPENDED - */ - @Deprecated - public static final String PROPERTY_TIMEOUT_NODE_SUSPENDED = TIMEOUT_NODE_SUSPENDED; - /** - * @see ComputeServiceProperties#TIMEOUT_SCRIPT_COMPLETE - */ - @Deprecated - public static final String PROPERTY_TIMEOUT_SCRIPT_COMPLETE = TIMEOUT_SCRIPT_COMPLETE; - /** - * @see ComputeServiceProperties#TIMEOUT_PORT_OPEN - */ - @Deprecated - public static final String PROPERTY_TIMEOUT_PORT_OPEN = TIMEOUT_PORT_OPEN; - /** - * @see ComputeServiceProperties#INIT_STATUS_INITIAL_PERIOD - */ - @Deprecated - public static final String PROPERTY_INIT_STATUS_INITIAL_PERIOD = INIT_STATUS_INITIAL_PERIOD; - /** - * @see ComputeServiceProperties#INIT_STATUS_MAX_PERIOD - */ - @Deprecated - public static final String PROPERTY_INIT_STATUS_MAX_PERIOD = INIT_STATUS_MAX_PERIOD; - /** - * @see ComputeServiceProperties#IMAGE_ID - */ - @Deprecated - public static final String PROPERTY_IMAGE_ID = IMAGE_ID; - /** - * @see ComputeServiceProperties#IMAGE_LOGIN_USER - */ - @Deprecated - public static final String PROPERTY_IMAGE_LOGIN_USER = IMAGE_LOGIN_USER; - /** - * @see ComputeServiceProperties#IMAGE_AUTHENTICATE_SUDO - */ - @Deprecated - public static final String PROPERTY_IMAGE_AUTHENTICATE_SUDO = IMAGE_AUTHENTICATE_SUDO; - /** - * @see ComputeServiceProperties#BLACKLIST_NODES - */ - @Deprecated - public static final String PROPERTY_BLACKLIST_NODES = BLACKLIST_NODES; - /** - * @see ComputeServiceProperties#OS_VERSION_MAP_JSON - */ - @Deprecated - public static final String PROPERTY_OS_VERSION_MAP_JSON = OS_VERSION_MAP_JSON; @Singleton public static class NamingConvention { diff --git a/compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java b/compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java index a895eb56ea..50375c2ceb 100644 --- a/compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java +++ b/compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java @@ -29,11 +29,10 @@ import static org.jclouds.scriptbuilder.domain.Statements.pipeHttpResponseToBash import java.net.URI; import java.util.Formatter; import java.util.Map; -import java.util.NoSuchElementException; import java.util.Map.Entry; +import java.util.NoSuchElementException; import java.util.regex.Pattern; -import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.domain.ComputeMetadata; import org.jclouds.compute.domain.ComputeMetadataIncludingStatus; import org.jclouds.compute.domain.Hardware; @@ -51,9 +50,8 @@ import com.google.common.base.Joiner; import com.google.common.base.Predicate; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; import com.google.common.collect.ImmutableMap.Builder; -import com.google.common.reflect.TypeToken; +import com.google.common.collect.Iterables; /** * @@ -172,11 +170,6 @@ public class ComputeServiceUtils { } }); } - - @Deprecated - public static Iterable getSupportedProviders() { - return org.jclouds.rest.Providers.getSupportedProvidersOfType(TypeToken.of(ComputeServiceContext.class)); - } /** * For cloud apis that have a pattern of using empty strings as tags, return a map that contains diff --git a/compute/src/main/java/org/jclouds/ssh/SshClient.java b/compute/src/main/java/org/jclouds/ssh/SshClient.java index 35e3d69e27..ab207454d0 100644 --- a/compute/src/main/java/org/jclouds/ssh/SshClient.java +++ b/compute/src/main/java/org/jclouds/ssh/SshClient.java @@ -20,7 +20,6 @@ package org.jclouds.ssh; import org.jclouds.compute.domain.ExecChannel; import org.jclouds.compute.domain.ExecResponse; -import org.jclouds.domain.Credentials; import org.jclouds.domain.LoginCredentials; import org.jclouds.io.Payload; @@ -33,14 +32,6 @@ public interface SshClient { interface Factory { - /** - * To be removed in jclouds 1.5.0 - * - * @see #create(com.google.common.net.HostAndPort, LoginCredentials) - */ - @Deprecated - SshClient create(HostAndPort socket, Credentials credentials); - SshClient create(HostAndPort socket, LoginCredentials credentials); } diff --git a/compute/src/test/clojure/org/jclouds/ssh_test.clj b/compute/src/test/clojure/org/jclouds/ssh_test.clj index 54b001cf97..bd905b60d0 100644 --- a/compute/src/test/clojure/org/jclouds/ssh_test.clj +++ b/compute/src/test/clojure/org/jclouds/ssh_test.clj @@ -77,10 +77,6 @@ (deftype SshClientFactory [factory-fn] org.jclouds.ssh.SshClient$Factory - (^org.jclouds.ssh.SshClient - create - [_ ^HostAndPort socket ^Credentials credentials] - (factory-fn socket (.identity credentials) (.credential credentials))) (^org.jclouds.ssh.SshClient create [_ ^HostAndPort socket ^LoginCredentials credentials] diff --git a/core/src/main/java/org/jclouds/Context.java b/core/src/main/java/org/jclouds/Context.java index 3fd85d2d7b..5236a093c1 100644 --- a/core/src/main/java/org/jclouds/Context.java +++ b/core/src/main/java/org/jclouds/Context.java @@ -19,17 +19,13 @@ package org.jclouds; import java.io.Closeable; -import java.net.URI; -import java.util.Map; -import org.jclouds.domain.Credentials; +import org.jclouds.apis.ApiMetadata; import org.jclouds.domain.Location; import org.jclouds.internal.ContextImpl; -import org.jclouds.javax.annotation.Nullable; import org.jclouds.providers.ProviderMetadata; import org.jclouds.rest.Utils; -import com.google.common.annotations.Beta; import com.google.inject.ImplementedBy; /** @@ -53,24 +49,6 @@ public interface Context extends Location, Closeable { */ String getName(); - /** - * will be removed in jclouds 1.6 - * - * @see Utils#getCredentialStore() - */ - @Deprecated - @Beta - Map getCredentialStore(); - - /** - * will be removed in jclouds 1.6 - * - * @see Utils#credentialStore() - */ - @Deprecated - @Beta - Map credentialStore(); - /** * @return the providerMetadata used to create this context * @see ContextBuilder#newBuilder(org.jclouds.providers.ProviderMetadata) @@ -82,33 +60,6 @@ public interface Context extends Location, Closeable { * @see ApiMetadata#getDefaultIdentity */ String getIdentity(); - - /** - * will be removed in jclouds 1.6 - * @see #getProviderMetadata() - * @see ProviderMetadata#getEndpoint() - */ - @Deprecated - URI getEndpoint(); - - /** - * will be removed in jclouds 1.6 - * @see #getProviderMetadata() - * @see ProviderMetadata#getApiMetadata() - * @see ApiMetadata#getVersion() - */ - @Deprecated - String getApiVersion(); - - /** - * will be removed in jclouds 1.6 - * @see #getProviderMetadata() - * @see ProviderMetadata#getApiMetadata() - * @see ApiMetadata#getBuildVersion() - */ - @Deprecated - @Nullable - String getBuildVersion(); Utils getUtils(); diff --git a/core/src/main/java/org/jclouds/internal/ContextImpl.java b/core/src/main/java/org/jclouds/internal/ContextImpl.java index cc92e7f87d..cd5eef88cc 100644 --- a/core/src/main/java/org/jclouds/internal/ContextImpl.java +++ b/core/src/main/java/org/jclouds/internal/ContextImpl.java @@ -98,14 +98,6 @@ public class ContextImpl implements Context { return creds.get().identity; } - /** - * {@inheritDoc} - */ - @Override - public URI getEndpoint() { - return URI.create(providerMetadata.getEndpoint()); - } - /** * {@inheritDoc} */ @@ -119,22 +111,6 @@ public class ContextImpl implements Context { return utils; } - /** - * {@inheritDoc} - */ - @Override - public String getApiVersion() { - return providerMetadata.getApiMetadata().getVersion(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getBuildVersion() { - return providerMetadata.getApiMetadata().getBuildVersion().orNull(); - } - /** * {@inheritDoc} */ @@ -216,20 +192,4 @@ public class ContextImpl implements Context { return LocationScope.PROVIDER; } - /** - * {@inheritDoc} - */ - @Override - public Map credentialStore() { - return utils().credentialStore(); - } - - /** - * {@inheritDoc} - */ - @Override - public Map getCredentialStore() { - return utils().credentialStore(); - } - } diff --git a/core/src/main/java/org/jclouds/rest/Providers.java b/core/src/main/java/org/jclouds/rest/Providers.java deleted file mode 100644 index 200aef7f63..0000000000 --- a/core/src/main/java/org/jclouds/rest/Providers.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.rest; - -import org.jclouds.Context; -import org.jclouds.View; -import org.jclouds.apis.Apis; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.ImmutableSet.Builder; -import com.google.common.reflect.TypeToken; - -/** - * @see org.jclouds.providers.Providers - * @see org.jclouds.apis.Apis - * @author Adrian Cole - */ -@Deprecated -public class Providers { - - /** - * Gets a set of supported providers. Idea stolen from pallets (supported-clouds). - */ - public static Iterable getSupportedProviders() { - return getSupportedProvidersOfType(TypeToken.of(View.class)); - } - - /** - * Gets a set of supported providers. Idea stolen from pallets - * (supported-clouds). - * - */ - public static Iterable getSupportedProvidersOfType(TypeToken type) { - Builder builder = ImmutableSet. builder(); - builder.addAll(Iterables.transform(Apis.viewableAs(type), Apis.idFunction())); - builder.addAll(Iterables.transform(org.jclouds.providers.Providers.viewableAs(type), - org.jclouds.providers.Providers.idFunction())); - return builder.build(); - } - - -} diff --git a/core/src/main/java/org/jclouds/rest/RestContextFactory.java b/core/src/main/java/org/jclouds/rest/RestContextFactory.java deleted file mode 100644 index 49d3dbd698..0000000000 --- a/core/src/main/java/org/jclouds/rest/RestContextFactory.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.rest; - -import java.util.NoSuchElementException; -import java.util.Properties; - -import org.jclouds.ContextBuilder; -import org.jclouds.View; -import org.jclouds.apis.Apis; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.Providers; - -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; -import com.google.inject.Module; - -/** - * - * @see ContextBuilder - * @author Adrian Cole - */ -@Deprecated -public class RestContextFactory { - - /** - * for porting old code to {@link ContextBuilder} - */ - public RestContextFactory() { - } - - /** - * for porting old code to {@link ContextBuilder} - */ - public RestContextFactory(Properties properties) { - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public RestContext createContext(String providerOrApi, String identity, String credential) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), new Properties()); - } - - /** - * @see #createContext(String, String, String, Iterable, Properties) - */ - public RestContext createContext(String providerOrApi, Properties overrides) { - return createContext(providerOrApi, null, null, ImmutableSet. of(), overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public RestContext createContext(String providerOrApi, Iterable wiring, - Properties overrides) { - return createContext(providerOrApi, null, null, wiring, overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public RestContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Properties overrides) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), overrides); - } - - /** - * @see createContext(String, String,String, Iterable, Properties) - */ - public RestContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring) { - return createContext(providerOrApi, identity, credential, wiring, new Properties()); - } - - /** - * for porting old code to {@link ContextBuilder} - * - * @param providerOrApi - * @param identity - * nullable, if credentials are present in the overrides - * @param credential - * nullable, if credentials are present in the overrides - * @param wiring - * Configuration you'd like to pass to the context. Ex. - * ImmutableSet.of(new ExecutorServiceModule(myexecutor)) - * @param overrides - * properties to override defaults with. - * @return initialized context ready for use - */ - @SuppressWarnings("unchecked") - public RestContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring, Properties overrides) { - ContextBuilder builder = null; - try { - ProviderMetadata pm = Providers.withId(providerOrApi); - builder = ContextBuilder.newBuilder(pm); - } catch (NoSuchElementException e) { - builder = ContextBuilder.newBuilder(Apis.withId(providerOrApi)); - } - builder.modules(Iterable.class.cast(wiring)); - builder.overrides(overrides); - if (identity != null) - builder.credentials(identity, credential); - Object context = builder.build(); - if (context instanceof RestContext) { - return RestContext.class.cast(context); - } else if (context instanceof View) { - View tctx = View.class.cast(context); - return (RestContext) tctx.unwrap(TypeToken.of(RestContext.class)); - } else { - throw new IllegalArgumentException("provider " + providerOrApi + " contains an unknown context type: " - + context.getClass().getSimpleName()); - } - - } - -} diff --git a/core/src/test/java/org/jclouds/util/ProvidersTest.java b/core/src/test/java/org/jclouds/util/ProvidersTest.java deleted file mode 100644 index b265eb4f0c..0000000000 --- a/core/src/test/java/org/jclouds/util/ProvidersTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.util; - -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -/** - * @author Adrian Cole - */ -@Test(groups = "unit") -public class ProvidersTest { - - @Test - @Deprecated - public void testSupportedProviders() { - Iterable providers = org.jclouds.rest.Providers.getSupportedProviders(); - assertEquals(Sets.newLinkedHashSet(providers), ImmutableSet. of("test-blobstore-api", "test-compute-api", - "test-yet-another-compute-api", "test-yet-another-compute-provider")); - } - -} diff --git a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java index 0ec9a1ea89..58ca3b1f0f 100644 --- a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java +++ b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java @@ -21,7 +21,6 @@ package org.jclouds.ssh.jsch.config; import javax.inject.Named; import org.jclouds.Constants; -import org.jclouds.domain.Credentials; import org.jclouds.domain.LoginCredentials; import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import org.jclouds.ssh.SshClient; @@ -65,10 +64,5 @@ public class JschSshClientModule extends AbstractModule { injector.injectMembers(client);// add logger return client; } - - @Override - public SshClient create(HostAndPort socket, Credentials credentials) { - return create(socket, LoginCredentials.fromCredentials(credentials)); - } } } diff --git a/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java b/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java index 3f50add98b..38c60696fe 100644 --- a/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java +++ b/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java @@ -65,10 +65,5 @@ public class SshjSshClientModule extends AbstractModule { injector.injectMembers(client);// add logger return client; } - - @Override - public SshClient create(HostAndPort socket, Credentials credentials) { - return create(socket, LoginCredentials.fromCredentials(credentials)); - } } } diff --git a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/StoragePool.java b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/StoragePool.java index c0ad9ba4bd..a137391576 100644 --- a/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/StoragePool.java +++ b/labs/abiquo/src/main/java/org/jclouds/abiquo/domain/infrastructure/StoragePool.java @@ -52,8 +52,6 @@ import com.google.inject.TypeLiteral; */ @EnterpriseEdition public class StoragePool extends DomainWrapper { - /** The default value for the used space. */ - private static final long DEFAULT_USED_SIZE = 0; /** The datacenter where the storage device is. */ // Package protected to allow the storage device to be set automatically when @@ -185,22 +183,10 @@ public class StoragePool extends DomainWrapper { public static class Builder { private RestContext context; - private StorageDevice storageDevice; - - private Long availableSizeInMb; - - // The enabled flag is still not used. It will be added when Abiquo - // includes anstorage - // allocator - - // private Boolean enabled; - private String name; - private Long totalSizeInMb; - private Long usedSizeInMb = DEFAULT_USED_SIZE; public Builder(final RestContext context, final StorageDevice storageDevice) { super(); @@ -215,61 +201,22 @@ public class StoragePool extends DomainWrapper { return this; } - /** - * @deprecated This value is no longer used in Abiquo and will be removed - * in future versions. - */ - @Deprecated - public Builder availableSizeInMb(final long availableSizeInMb) { - this.availableSizeInMb = availableSizeInMb; - return this; - } - public Builder name(final String name) { this.name = name; return this; } - // The enabled flag is still not used. It will be added when Abiquo - // includes anstorage - // allocator - - // public Builder enabled(final boolean enabled) - // { - // this.enabled = enabled; - // return this; - // } public Builder totalSizeInMb(final long totalSizeInMb) { this.totalSizeInMb = totalSizeInMb; - if (availableSizeInMb == null) { - availableSizeInMb = totalSizeInMb; - } return this; } - /** - * @deprecated This value is no longer used in Abiquo and will be removed - * in future versions. - */ - @Deprecated - public Builder usedSizeInMb(final long usedSizeInMb) { - this.usedSizeInMb = usedSizeInMb; - return this; - } public StoragePool build() { StoragePoolDto dto = new StoragePoolDto(); - dto.setAvailableSizeInMb(availableSizeInMb); - - // The enabled flag is still not used. It will be added when Abiquo - // includes anstorage - // allocator - // dto.setEnabled(enabled); - dto.setName(name); dto.setTotalSizeInMb(totalSizeInMb); - dto.setUsedSizeInMb(usedSizeInMb); StoragePool storagePool = new StoragePool(context, dto); storagePool.storageDevice = storageDevice; return storagePool; @@ -277,11 +224,7 @@ public class StoragePool extends DomainWrapper { public static Builder fromStoragePool(final StoragePool in) { Builder builder = StoragePool.builder(in.context, in.getStorageDevice()) - .availableSizeInMb(in.getAvailableSizeInMb())/* - * .enabled(in. - * getEnabled()) - */ - .totalSizeInMb(in.getTotalSizeInMb()).usedSizeInMb(in.getUsedSizeInMb()); + .totalSizeInMb(in.getTotalSizeInMb()); return builder; } @@ -289,24 +232,6 @@ public class StoragePool extends DomainWrapper { // Delegate methods - /** - * @deprecated This value is no longer used in Abiquo and will be removed in - * future versions. - */ - @Deprecated - public long getAvailableSizeInMb() { - return target.getAvailableSizeInMb(); - } - - // The enabled flag is still not used. It will be added when Abiquo includes - // anstorage - // allocator - - // public boolean getEnabled() - // { - // return target.getEnabled(); - // } - public String getName() { return target.getName(); } @@ -315,24 +240,6 @@ public class StoragePool extends DomainWrapper { return target.getTotalSizeInMb(); } - /** - * @deprecated This value is no longer used in Abiquo and will be removed in - * future versions. - */ - @Deprecated - public long getUsedSizeInMb() { - return target.getUsedSizeInMb(); - } - - // The enabled flag is still not used. It will be added when Abiquo includes - // anstorage - // allocator - - // public void setEnabled(final boolean enabled) - // { - // target.setEnabled(enabled); - // } - public void setName(final String name) { target.setName(name); } diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java index d637ad41ec..a388995f03 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleApi.java @@ -31,61 +31,45 @@ import org.jclouds.azure.management.domain.role.PersistentVMRole; */ public interface RoleApi { - // FUUUUUU this is not the good REST call !!! Use getDeployment instead :@ - PersistentVMRole getRole(String serviceName, String deploymentName, - String roleName); + // TODO: this is not the good REST call !!! Use getDeployment instead :@ + PersistentVMRole getRole(String serviceName, String deploymentName, String roleName); - // This is a PaaS REST service ! - // void addRole(String serviceName, String deploymentName, PersistentVMRole - // role); + String restartRole(String serviceName, String deploymentName, String roleName); - // This is a PaaS REST service ! => Delete the deployment instead - // void deleteRole(String serviceName, String deploymentName, String - // roleName); + /** + * http://msdn.microsoft.com/en-us/library/jj157194 + * + * @param serviceName + * @param deploymentParams + * @return + */ + String createDeployment(String serviceName, DeploymentParams deploymentParams); - String restartRole(String serviceName, String deploymentName, - String roleName); + /** + * http://msdn.microsoft.com/en-us/library/jj157201 + * + * @return + */ + String captureRole(String serviceName, String deploymentName, String roleName, String imageName, String imageLabel); -// @Deprecated -// String createVirtualMachineDeployment(String serviceName, -// Deployment deployment); + /** + * http://msdn.microsoft.com/en-us/library/jj157195 + * + * @param serviceName + * @param deploymentName + * @param roleName + * @return + */ + String shutdownRole(String serviceName, String deploymentName, String roleName); - /** - * http://msdn.microsoft.com/en-us/library/jj157194 - * - * @param serviceName - * @param deploymentParams - * @return - */ - String createDeployment(String serviceName, - DeploymentParams deploymentParams); - - /** - * http://msdn.microsoft.com/en-us/library/jj157201 - * - * @return - */ - String captureRole(String serviceName, String deploymentName, - String roleName, String imageName, String imageLabel); - - /** - * http://msdn.microsoft.com/en-us/library/jj157195 - * @param serviceName - * @param deploymentName - * @param roleName - * @return - */ - String shutdownRole(String serviceName, String deploymentName, - String roleName); - - /** - * http://msdn.microsoft.com/en-us/library/jj157189 - * @param serviceName - * @param deploymentName - * @param roleName - * @return - */ - String startRole(String serviceName, String deploymentName, - String roleName); + /** + * http://msdn.microsoft.com/en-us/library/jj157189 + * + * @param serviceName + * @param deploymentName + * @param roleName + * @return + */ + String startRole(String serviceName, String deploymentName, String roleName); } diff --git a/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java b/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java index 03e2a2759a..70e2868f1b 100644 --- a/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java +++ b/labs/azure-management/src/main/java/org/jclouds/azure/management/features/RoleAsyncApi.java @@ -52,109 +52,76 @@ import com.google.common.util.concurrent.ListenableFuture; @Headers(keys = "x-ms-version", values = "2012-03-01") public interface RoleAsyncApi { - @GET - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles/{roleName}") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getRole(@PathParam("serviceName") - String serviceName, - @PathParam("deploymentName") String deploymentName, - @PathParam("roleName") String roleName); + @GET + @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles/{roleName}") + @Consumes(MediaType.APPLICATION_ATOM_XML) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ListenableFuture getRole(@PathParam("serviceName") + String serviceName, + @PathParam("deploymentName") String deploymentName, + @PathParam("roleName") String roleName); - // This is a PaaS REST service ! => Delete the deployment instead - // @DELETE - // @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles/{roleName}") - // @Consumes(MediaType.APPLICATION_ATOM_XML) - // @JAXBResponseParser - // @Fallback(NullOnNotFoundOr404.class) - // ListenableFuture deleteRole(@PathParam("serviceName") String - // serviceName, - // @PathParam("deploymentName") String deploymentName, - // @PathParam("roleName") String roleName); + @POST + // Warning : the url in the documentation is WRONG ! @see + // http://social.msdn.microsoft.com/Forums/pl-PL/WAVirtualMachinesforWindows/thread/7ba2367b-e450-49e0-89e4-46c240e9d213 + @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") + @Consumes(MediaType.APPLICATION_ATOM_XML) + @Produces(MediaType.APPLICATION_ATOM_XML) + @Fallback(NullOnNotFoundOr404.class) + @ResponseParser(ParseRequestIdHeader.class) + @Payload(value = "RestartRoleOperation") + ListenableFuture restartRole( + @PathParam("serviceName") String serviceName, + @PathParam("deploymentName") String deploymentName, + @PathParam("roleName") String roleName); - @POST - // Warning : the url in the documentation is WRONG ! @see - // http://social.msdn.microsoft.com/Forums/pl-PL/WAVirtualMachinesforWindows/thread/7ba2367b-e450-49e0-89e4-46c240e9d213 - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - @Payload(value = "RestartRoleOperation") - ListenableFuture restartRole( - @PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, - @PathParam("roleName") String roleName); + @POST + @Path("/services/hostedservices/{serviceName}/deployments") + @Produces(MediaType.APPLICATION_ATOM_XML) + @Consumes(MediaType.APPLICATION_ATOM_XML) + @Fallback(NullOnNotFoundOr404.class) + @ResponseParser(ParseRequestIdHeader.class) + ListenableFuture createDeployment( + @PathParam("serviceName") String serviceName, + @BinderParam(BindDeploymentParamsToXmlPayload.class) DeploymentParams deploymentParams); - // This is a PaaS REST service ! - // @POST - // @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roles") - // @Produces(MediaType.APPLICATION_ATOM_XML) - // @Consumes(MediaType.TEXT_PLAIN) - // @Fallback(NullOnNotFoundOr404.class) - // ListenableFuture addRole(@PathParam("serviceName") String - // serviceName, - // @PathParam("deploymentName") String deploymentName, - // @BinderParam(BindToXMLPayload.class) PersistentVMRole role); - -// @Deprecated -// @POST -// @Path("/services/hostedservices/{serviceName}/deployments") -// @Produces(MediaType.APPLICATION_ATOM_XML) -// @Consumes(MediaType.TEXT_PLAIN) -// @Fallback(NullOnNotFoundOr404.class) -// @ResponseParser(ParseRequestIdHeader.class) -// ListenableFuture createVirtualMachineDeployment( -// @PathParam("serviceName") String serviceName, -// @BinderParam(BindToXMLPayload.class) Deployment deployment); - - @POST - @Path("/services/hostedservices/{serviceName}/deployments") - @Produces(MediaType.APPLICATION_ATOM_XML) - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - ListenableFuture createDeployment( - @PathParam("serviceName") String serviceName, - @BinderParam(BindDeploymentParamsToXmlPayload.class) DeploymentParams deploymentParams); - - @POST - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - @Payload(value = "CaptureRoleOperationDelete{imageLabel}{imageName}") - ListenableFuture captureRole( - @PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, - @PathParam("roleName") String roleName, - @PayloadParam("imageName") String imageName, - @PayloadParam("imageLabel") String imageLabel); - - @POST - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - @Payload(value = "ShutdownRoleOperation") - ListenableFuture shutdownRole( - @PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, - @PathParam("roleName") String roleName); - - @POST - @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") - @Consumes(MediaType.APPLICATION_ATOM_XML) - @Produces(MediaType.APPLICATION_ATOM_XML) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ParseRequestIdHeader.class) - @Payload(value = "StartRoleOperation") - ListenableFuture startRole( - @PathParam("serviceName") String serviceName, - @PathParam("deploymentName") String deploymentName, - @PathParam("roleName") String roleName); + @POST + @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") + @Consumes(MediaType.APPLICATION_ATOM_XML) + @Produces(MediaType.APPLICATION_ATOM_XML) + @Fallback(NullOnNotFoundOr404.class) + @ResponseParser(ParseRequestIdHeader.class) + @Payload(value = "CaptureRoleOperationDelete{imageLabel}{imageName}") + ListenableFuture captureRole( + @PathParam("serviceName") String serviceName, + @PathParam("deploymentName") String deploymentName, + @PathParam("roleName") String roleName, + @PayloadParam("imageName") String imageName, + @PayloadParam("imageLabel") String imageLabel); + + @POST + @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") + @Consumes(MediaType.APPLICATION_ATOM_XML) + @Produces(MediaType.APPLICATION_ATOM_XML) + @Fallback(NullOnNotFoundOr404.class) + @ResponseParser(ParseRequestIdHeader.class) + @Payload(value = "ShutdownRoleOperation") + ListenableFuture shutdownRole( + @PathParam("serviceName") String serviceName, + @PathParam("deploymentName") String deploymentName, + @PathParam("roleName") String roleName); + + @POST + @Path("/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleName}/Operations") + @Consumes(MediaType.APPLICATION_ATOM_XML) + @Produces(MediaType.APPLICATION_ATOM_XML) + @Fallback(NullOnNotFoundOr404.class) + @ResponseParser(ParseRequestIdHeader.class) + @Payload(value = "StartRoleOperation") + ListenableFuture startRole( + @PathParam("serviceName") String serviceName, + @PathParam("deploymentName") String deploymentName, + @PathParam("roleName") String roleName); } diff --git a/labs/nodepool/src/test/java/org/jclouds/nodepool/config/BindBackendComputeServiceTest.java b/labs/nodepool/src/test/java/org/jclouds/nodepool/config/BindBackendComputeServiceTest.java index 43c6b6eaa2..76108c7196 100644 --- a/labs/nodepool/src/test/java/org/jclouds/nodepool/config/BindBackendComputeServiceTest.java +++ b/labs/nodepool/src/test/java/org/jclouds/nodepool/config/BindBackendComputeServiceTest.java @@ -27,7 +27,6 @@ import java.util.Properties; import org.jclouds.ContextBuilder; import org.jclouds.compute.ComputeService; -import org.jclouds.domain.Credentials; import org.jclouds.domain.LoginCredentials; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import org.jclouds.nodepool.Backend; @@ -80,16 +79,9 @@ public class BindBackendComputeServiceTest { } private static class Factory implements SshClient.Factory { - - @Override public SshClient create(HostAndPort socket, LoginCredentials credentials) { return createNiceMock(SshClient.class); } - - @Override - public SshClient create(HostAndPort socket, Credentials credentials) { - return createNiceMock(SshClient.class); - } } } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java index dcab26cf7d..d9550baa6e 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Reference.java @@ -204,12 +204,4 @@ public class Reference { return Objects.toStringHelper("").add("href", href).add("name", name).add("type", type); } - /** - * @see VCloudDirectorApi#resolveEntity - */ - @Deprecated - public Reference toAdminReference(String endpoint) { - return toBuilder().type(null).href(URI.create(getHref().toASCIIString().replace(endpoint, endpoint + "/admin"))) - .build(); - } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java index 070415eb9f..94328d4916 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorApiLiveTest.java @@ -567,16 +567,6 @@ public abstract class BaseVCloudDirectorApiLiveTest extends BaseContextLiveTest< return vAppTemplate; } - @Deprecated - public URI toAdminUri(Reference ref) { - return toAdminUri(ref.getHref()); - } - - @Deprecated - public URI toAdminUri(URI uri) { - return Reference.builder().href(uri).build().toAdminReference(endpoint).getHref(); - } - protected void assertTaskSucceeds(Task task) { assertTrue(retryTaskSuccess.apply(task), String.format(TASK_COMPLETE_TIMELY, task)); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java index 8a6f3cd69b..3c8ac67a2e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorExpectTest.java @@ -21,7 +21,6 @@ package org.jclouds.vcloud.director.v1_5.internal; import static com.google.common.base.Preconditions.checkNotNull; import static org.testng.Assert.assertNotNull; -import java.net.URI; import java.util.Properties; import org.jclouds.Constants; @@ -97,90 +96,6 @@ public abstract class BaseVCloudDirectorExpectTest extends BaseRestApiExpectT .build()) .payload(payloadFromResourceWithContentType("/session.xml", VCloudDirectorMediaType.SESSION + ";version=1.5")) .build(); - - - @Deprecated - protected HttpRequest getStandardRequest(String method, String path) { - return getStandardRequest(method, path, VCloudDirectorMediaType.ANY); - } - - @Deprecated - protected HttpRequest getStandardRequest(String method, URI uri) { - return getStandardRequest(method, uri, VCloudDirectorMediaType.ANY); - } - - @Deprecated - protected HttpRequest getStandardRequest(String method, String path, String mediaType) { - return getStandardRequest(method, URI.create(endpoint + path), VCloudDirectorMediaType.ANY); - } - - @Deprecated - protected HttpRequest getStandardPayloadRequest(String method, String command, String relativeFilePath, - String postMediaType) { - return getStandardPayloadRequest(method, URI.create(endpoint + command), relativeFilePath, postMediaType); - } - - @Deprecated - protected HttpRequest getStandardPayloadRequest(String method, URI uri, String relativeFilePath, - String postMediaType) { - return getStandardRequestWithPayload(method, uri, VCloudDirectorMediaType.ANY, relativeFilePath, postMediaType); - } - - @Deprecated - protected HttpRequest getStandardRequest(String method, URI uri, String mediaType) { - return HttpRequest.builder() - .method(method) - .endpoint(uri) - .headers(ImmutableMultimap. builder() - .put("Accept", mediaType) - .put("x-vcloud-authorization", token) - .put(HttpHeaders.COOKIE, "vcloud-token=" + token) - .build()) - .build(); - } - - @Deprecated - protected HttpRequest getStandardRequestWithPayload(String method, String path, String relativeFilePath, String mediaType) { - return getStandardRequestWithPayload(method, path, VCloudDirectorMediaType.ANY, relativeFilePath, mediaType); - } - - @Deprecated - protected HttpRequest getStandardRequestWithPayload(String method, URI uri, String relativeFilePath, String mediaType) { - return getStandardRequestWithPayload(method, uri, VCloudDirectorMediaType.ANY, relativeFilePath, mediaType); - } - - @Deprecated - protected HttpRequest getStandardRequestWithPayload(String method, String path, String acceptType, String relativeFilePath, String mediaType) { - URI uri = URI.create(endpoint + path); - return getStandardRequestWithPayload(method, uri, acceptType, relativeFilePath, mediaType); - } - - @Deprecated - protected HttpRequest getStandardRequestWithPayload(String method, URI uri, String acceptType, String relativeFilePath, String mediaType) { - return HttpRequest.builder() - .method(method) - .endpoint(uri) - .headers(ImmutableMultimap. builder() - .put("Accept", acceptType) - .put("x-vcloud-authorization", token) - .put(HttpHeaders.COOKIE, "vcloud-token=" + token) - .build()) - .payload(payloadFromResourceWithContentType(relativeFilePath, mediaType)) - .build(); - } - - @Deprecated - protected HttpResponse getStandardPayloadResponse(String relativeFilePath, String mediaType) { - return getStandardPayloadResponse(200, relativeFilePath, mediaType); - } - - @Deprecated - protected HttpResponse getStandardPayloadResponse(int statusCode, String relativeFilePath, String mediaType) { - return HttpResponse.builder() - .statusCode(statusCode) - .payload(payloadFromResourceWithContentType(relativeFilePath, mediaType + ";version=1.5")) - .build(); - } /** * Implicitly adds x-vcloud-authorization header with token. diff --git a/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java b/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java index 562c3c9ede..1ea0345faf 100644 --- a/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java +++ b/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContext.java @@ -22,7 +22,6 @@ import java.io.Closeable; import org.jclouds.View; import org.jclouds.loadbalancer.internal.LoadBalancerServiceContextImpl; -import org.jclouds.rest.RestContext; import org.jclouds.rest.Utils; import com.google.inject.ImplementedBy; @@ -46,15 +45,6 @@ public interface LoadBalancerServiceContext extends Closeable, View { * @see #getUtils */ Utils utils(); - - /** - * will be removed in jclouds 1.6 - * - * @see View#getInputType - * @see View#unwrap - */ - @Deprecated - RestContext getProviderSpecificContext(); @Override void close(); diff --git a/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContextFactory.java b/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContextFactory.java deleted file mode 100644 index 16a329c1d5..0000000000 --- a/loadbalancer/src/main/java/org/jclouds/loadbalancer/LoadBalancerServiceContextFactory.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.loadbalancer; - -import java.util.NoSuchElementException; -import java.util.Properties; - -import org.jclouds.ContextBuilder; -import org.jclouds.apis.Apis; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.Providers; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * This class is deprecated in favor of {@link ContextBuilder}. Please view - * sample usage below: - * - *
- * context = ContextBuilder.newBuilder("aws-elb")
- *                         .credentials(apikey, secret)
- *                         .buildView(LoadBalancerServiceContext.class);
- * 
- * - * @see ContextBuilder - * @deprecated As of version 1.5, replaced by {@link ContextBuilder} - * @author Adrian Cole - */ -@Deprecated -public class LoadBalancerServiceContextFactory { - - /** - * for porting old code to {@link ContextBuilder} - */ - public LoadBalancerServiceContextFactory() { - } - - /** - * for porting old code to {@link ContextBuilder} - */ - public LoadBalancerServiceContextFactory(Properties properties) { - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public LoadBalancerServiceContext createContext(String providerOrApi, String identity, String credential) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), new Properties()); - } - - /** - * @see #createContext(String, String, String, Iterable, Properties) - */ - public LoadBalancerServiceContext createContext(String providerOrApi, Properties overrides) { - return createContext(providerOrApi, null, null, ImmutableSet. of(), overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public LoadBalancerServiceContext createContext(String providerOrApi, Iterable wiring, - Properties overrides) { - return createContext(providerOrApi, null, null, wiring, overrides); - } - - /** - * @see #createContext(String, String,String, Iterable, Properties) - */ - public LoadBalancerServiceContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Properties overrides) { - return createContext(providerOrApi, identity, credential, ImmutableSet. of(), overrides); - } - - /** - * @see createContext(String, String,String, Iterable, Properties) - */ - public LoadBalancerServiceContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring) { - return createContext(providerOrApi, identity, credential, wiring, new Properties()); - } - - /** - * for porting old code to {@link ContextBuilder} - * - * @param providerOrApi - * @param identity - * nullable, if credentials are present in the overrides - * @param credential - * nullable, if credentials are present in the overrides - * @param wiring - * Configuration you'd like to pass to the context. Ex. - * ImmutableSet.of(new ExecutorServiceModule(myexecutor)) - * @param overrides - * properties to override defaults with. - * @return initialized context ready for use - */ - public LoadBalancerServiceContext createContext(String providerOrApi, @Nullable String identity, - @Nullable String credential, Iterable wiring, Properties overrides) { - ContextBuilder builder = null; - try { - ProviderMetadata pm = Providers.withId(providerOrApi); - builder = ContextBuilder.newBuilder(pm); - } catch (NoSuchElementException e) { - builder = ContextBuilder.newBuilder(Apis.withId(providerOrApi)); - } - builder.modules(wiring); - builder.overrides(overrides); - if (identity != null) - builder.credentials(identity, credential); - return builder.build(LoadBalancerServiceContext.class); - } - -} diff --git a/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java b/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java index 47b295cddf..f9a8eefd16 100644 --- a/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java +++ b/loadbalancer/src/main/java/org/jclouds/loadbalancer/internal/LoadBalancerServiceContextImpl.java @@ -28,7 +28,6 @@ import org.jclouds.internal.BaseView; import org.jclouds.loadbalancer.LoadBalancerService; import org.jclouds.loadbalancer.LoadBalancerServiceContext; import org.jclouds.location.Provider; -import org.jclouds.rest.RestContext; import org.jclouds.rest.Utils; import com.google.common.io.Closeables; @@ -65,12 +64,6 @@ public class LoadBalancerServiceContextImpl extends BaseView implements LoadBala return utils; } - @SuppressWarnings("unchecked") - @Override - public RestContext getProviderSpecificContext() { - return (RestContext) delegate(); - } - @Override public void close() { Closeables.closeQuietly(delegate()); diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/domain/Tag.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/domain/Tag.java deleted file mode 100644 index 6ab1d11eca..0000000000 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/domain/Tag.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.aws.ec2.domain; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.aws.ec2.util.TagFilters.ResourceType; - -import com.google.common.base.Objects; -import com.google.common.collect.ComparisonChain; - -/** - *

Important

- * This will be removed in jclouds version 1.6 - * - * @see - * @see org.jclouds.ec2.domain.Tag - * @author grkvlt@apache.org - */ -@Deprecated -public class Tag implements Comparable { - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String resourceId; - private ResourceType resourceType; - private String key; - private String value; - - public void clear() { - this.resourceId = null; - this.resourceType = null; - this.key = null; - this.value = null; - } - - public Builder resourceId(String resourceId) { - this.resourceId = resourceId; - return this; - } - - public Builder resourceType(ResourceType resourceType) { - this.resourceType = resourceType; - return this; - } - - public Builder key(String key) { - this.key = key; - return this; - } - - public Builder value(String value) { - this.value = value; - return this; - } - - public Tag build() { - return new Tag(resourceId, resourceType, key, value); - } - } - - private final String resourceId; - private final ResourceType resourceType; - private final String key; - private final String value; - - public Tag(String resourceId, ResourceType resourceType, String key, String value) { - this.resourceId = checkNotNull(resourceId, "resourceId"); - this.resourceType = checkNotNull(resourceType, "resourceType"); - this.key = checkNotNull(key, "key"); - this.value = checkNotNull(value, "value"); - } - - public String getResourceId() { - return resourceId; - } - - public ResourceType getResourceType() { - return resourceType; - } - - public String getKey() { - return key; - } - - public String getValue() { - return value; - } - - @Override - public int compareTo(Tag t) { - return ComparisonChain.start() - .compare(resourceId, t.resourceId) - .compare(resourceType, t.resourceType) - .compare(key, t.key) - .compare(value, t.value) - .result(); - } - - @Override - public int hashCode() { - return Objects.hashCode(resourceId, resourceType, key, value); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Tag other = (Tag) obj; - if (resourceId == null) { - if (other.resourceId != null) - return false; - } else if (!resourceId.equals(other.resourceId)) - return false; - if (resourceType == null) { - if (other.resourceType != null) - return false; - } else if (!resourceType.equals(other.resourceType)) - return false; - if (value == null) { - if (other.value != null) - return false; - } else if (!value.equals(other.value)) - return false; - if (key == null) { - if (other.key != null) - return false; - } else if (!key.equals(other.key)) - return false; - return true; - } - - @Override - public String toString() { - return "[resourceId=" + resourceId + ", resourceType=" + resourceType + ", key=" + key + ", value=" + value + "]"; - } -} diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/util/TagFilters.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/util/TagFilters.java deleted file mode 100644 index 94275867b6..0000000000 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/util/TagFilters.java +++ /dev/null @@ -1,312 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.aws.ec2.util; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; - -import org.jclouds.ec2.features.TagApi; - -import com.google.common.base.CaseFormat; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -/** - *

Important

- * This will be removed in jclouds version 1.6 - * - * @author grkvlt@apache.org - * - * @see TagApi - */ -@Deprecated -public class TagFilters { - public static enum FilterName { - KEY, RESOURCE_ID, RESOURCE_TYPE, VALUE; - - public String value() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); - } - - @Override - public String toString() { - return value(); - } - - public static FilterName fromValue(String name) { - try { - return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(name, "name"))); - } catch (IllegalArgumentException e) { - return null; - } - } - } - - /** - *

Important

This will be removed in jclouds version 1.6 - * - * @see TagApi - */ - @Deprecated - public static enum ResourceType { - CUSTOMER_GATEWAY, DHCP_OPTIONS, IMAGE, INSTANCE, INTERNET_GATEWAY, NETWORK_ACL, RESERVED_INSTANCES, ROUTE_TABLE, SECURITY_GROUP, SNAPSHOT, SPOT_INSTANCES_REQUEST, SUBNET, VOLUME, VPC, VPN_CONNECTION, VPN_GATEWAY; - - public String value() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); - } - - @Override - public String toString() { - return value(); - } - - public static ResourceType fromValue(String name) { - try { - return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(name, "name"))); - } catch (IllegalArgumentException e) { - return null; - } - } - } - - protected final Map> map; - - protected TagFilters() { - map = Maps.> newLinkedHashMap(); - } - - public static TagFilters filters() { - return new TagFilters(); - } - - public Map> build() { - return ImmutableMap.copyOf(map); - } - - public TagFilters resourceId(String resourceId) { - put(FilterName.RESOURCE_ID, resourceId); - return this; - } - - public TagFilters key(String key) { - put(FilterName.KEY, key); - return this; - } - - public TagFilters keys(String... keys) { - put(FilterName.KEY, ImmutableSet. copyOf(keys)); - return this; - } - - public TagFilters keys(Iterable keys) { - putAll(FilterName.KEY, ImmutableSet. copyOf(keys)); - return this; - } - - public TagFilters value(String value) { - put(FilterName.VALUE, value); - return this; - } - - public TagFilters values(String... values) { - putAll(FilterName.VALUE, ImmutableSet. copyOf(values)); - return this; - } - - public TagFilters values(Iterable values) { - putAll(FilterName.VALUE, ImmutableSet. copyOf(values)); - return this; - } - - public TagFilters keyContains(String key) { - return key(String.format("*%s*", key)); - } - - public TagFilters valueContains(String value) { - return value(String.format("*%s*", value)); - } - - public TagFilters resourceIdContains(String value) { - return resourceId(String.format("*%s*", value)); - } - - public TagFilters keyStartsWith(String key) { - return key(String.format("%s*", key)); - } - - public TagFilters valueStartsWith(String value) { - return value(String.format("%s*", value)); - } - - public TagFilters resourceIdStartsWith(String value) { - return resourceId(String.format("%s*", value)); - } - - public TagFilters keyEndsWith(String key) { - return key(String.format("*%s", key)); - } - - public TagFilters valueEndsWith(String value) { - return value(String.format("*%s", value)); - } - - public TagFilters resourceIdEndsWith(String value) { - return resourceId(String.format("*%s", value)); - } - - public TagFilters keyValuePair(String key, String value) { - return key(key).value(value); - } - - public TagFilters keyValueSet(String key, Iterable values) { - return key(key).values(values); - } - - public TagFilters keyValueSet(String key, String... values) { - return key(key).values(values); - } - - public TagFilters anyKey() { - putAll(FilterName.KEY, ImmutableSet. of()); - return this; - } - - public TagFilters anyValue() { - putAll(FilterName.VALUE, ImmutableSet. of()); - return this; - } - - public TagFilters anyResourceId() { - putAll(FilterName.RESOURCE_TYPE, ImmutableSet. of()); - return this; - } - - public TagFilters anyResourceType() { - putAll(FilterName.RESOURCE_TYPE, ImmutableSet. of()); - return this; - } - - public TagFilters resourceType(ResourceType resourceType) { - put(FilterName.RESOURCE_TYPE, resourceType); - return this; - } - - public TagFilters customerGateway() { - put(FilterName.RESOURCE_TYPE, ResourceType.CUSTOMER_GATEWAY); - return this; - } - - public TagFilters dhcpOptions() { - put(FilterName.RESOURCE_TYPE, ResourceType.DHCP_OPTIONS); - return this; - } - - public TagFilters image() { - put(FilterName.RESOURCE_TYPE, ResourceType.IMAGE); - return this; - } - - public TagFilters instance() { - put(FilterName.RESOURCE_TYPE, ResourceType.INSTANCE); - return this; - } - - public TagFilters internetGateway() { - put(FilterName.RESOURCE_TYPE, ResourceType.INTERNET_GATEWAY); - return this; - } - - public TagFilters networkAcl() { - put(FilterName.RESOURCE_TYPE, ResourceType.NETWORK_ACL); - return this; - } - - public TagFilters reservedInstance() { - put(FilterName.RESOURCE_TYPE, ResourceType.RESERVED_INSTANCES); - return this; - } - - public TagFilters routeTable() { - put(FilterName.RESOURCE_TYPE, ResourceType.ROUTE_TABLE); - return this; - } - - public TagFilters securityGroup() { - put(FilterName.RESOURCE_TYPE, ResourceType.SECURITY_GROUP); - return this; - } - - public TagFilters snapshot() { - put(FilterName.RESOURCE_TYPE, ResourceType.SNAPSHOT); - return this; - } - - public TagFilters instancesRequest() { - put(FilterName.RESOURCE_TYPE, ResourceType.SPOT_INSTANCES_REQUEST); - return this; - } - - public TagFilters subnet() { - put(FilterName.RESOURCE_TYPE, ResourceType.SUBNET); - return this; - } - - public TagFilters volume() { - put(FilterName.RESOURCE_TYPE, ResourceType.VOLUME); - return this; - } - - public TagFilters vpc() { - put(FilterName.RESOURCE_TYPE, ResourceType.VPC); - return this; - } - - public TagFilters vpnConnection() { - put(FilterName.RESOURCE_TYPE, ResourceType.VPN_CONNECTION); - return this; - } - - public TagFilters vpnGateway() { - put(FilterName.RESOURCE_TYPE, ResourceType.VPN_GATEWAY); - return this; - } - - private void put(FilterName key, Object value) { - putAll(key, Sets.newHashSet(value)); - } - - private void putAll(FilterName key, Iterable values) { - if (values == null || Iterables.isEmpty(values)) { - // If we add an empty or null set of values, replace the value in the - // map entirely - map.put(key, ImmutableSet.of()); - } else { - // Add the values, to a new set if required - if (!map.containsKey(key)) { - map.put(key, Sets.newHashSet()); - } - Iterable entries = map.get(key); - map.put(key, Iterables.concat(entries, values)); - } - } -} diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/binders/BindTagFiltersToIndexedFormParamsTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/binders/BindTagFiltersToIndexedFormParamsTest.java deleted file mode 100644 index 7008a8b17c..0000000000 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/binders/BindTagFiltersToIndexedFormParamsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.aws.ec2.binders; - -import static org.testng.Assert.assertEquals; - -import java.io.File; - -import org.jclouds.aws.ec2.util.TagFilters; -import org.jclouds.aws.ec2.util.TagFilters.FilterName; -import org.jclouds.aws.ec2.util.TagFilters.ResourceType; -import org.jclouds.http.HttpRequest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * Tests behavior of {@code BindTagFiltersToIndexedFormParams} - * - * @author grkvlt@apache.org - */ -@Test(groups = "unit") -public class BindTagFiltersToIndexedFormParamsTest { - Injector injector = Guice.createInjector(); - BindTagFiltersToIndexedFormParams binder = injector.getInstance(BindTagFiltersToIndexedFormParams.class); - - public void testMultipleResourceTypes() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, ImmutableMap.>builder().put(FilterName.RESOURCE_TYPE, ImmutableSet.of(ResourceType.VPN_GATEWAY, ResourceType.INTERNET_GATEWAY)).build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=resource-type&Filter.1.Value.1=vpn-gateway&Filter.1.Value.2=internet-gateway"); - } - - public void testMultipleKeys() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, ImmutableMap.>builder().put(FilterName.KEY, ImmutableSet.of("one", "two")).build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=key&Filter.1.Value.1=one&Filter.1.Value.2=two"); - } - - public void testkeyWithValue() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, ImmutableMap.>builder().put(FilterName.KEY, ImmutableSet.of("one")).put(FilterName.VALUE, ImmutableSet.of("alpha")).build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=key&Filter.1.Value.1=one&Filter.2.Name=value&Filter.2.Value.1=alpha"); - } - - public void testAnyKey() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, ImmutableMap.>builder().put(FilterName.KEY, ImmutableSet.of()).build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=key"); - } - - public void testMultipleResourceTypesBuilder() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, TagFilters.filters().vpnGateway().internetGateway().build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=resource-type&Filter.1.Value.1=vpn-gateway&Filter.1.Value.2=internet-gateway"); - } - - public void testMultipleKeysBuilder() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, TagFilters.filters().key("one").key("two").build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=key&Filter.1.Value.1=one&Filter.1.Value.2=two"); - } - - public void testKeyWithValueBuilder() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, TagFilters.filters().keyValuePair("one", "alpha").build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=key&Filter.1.Value.1=one&Filter.2.Name=value&Filter.2.Value.1=alpha"); - } - - public void testAnyKeyBuilder() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build(); - request = binder.bindToRequest(request, TagFilters.filters().anyKey().build()); - assertEquals(request.getPayload().getRawContent(), "Filter.1.Name=key"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testMustBeArray() { - HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();; - binder.bindToRequest(request, new File("foo")); - } - - @Test(expectedExceptions = NullPointerException.class) - public void testNullIsBad() { - HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build(); - binder.bindToRequest(request, null); - } -} diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java index 7b01bbd48f..ded151b904 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java @@ -186,7 +186,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest { SecurityGroup secgroup = getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(instance .getRegion(), "jclouds#" + group)); - assert secgroup.getIpPermissions().size() == 0 : secgroup; + assert secgroup.size() == 0 : secgroup; // try to run a script with the original keyPair runScriptWithCreds(group, first.getOperatingSystem(), LoginCredentials.builder().user( diff --git a/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/InitBuilder.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/InitBuilder.java deleted file mode 100644 index 11cb677472..0000000000 --- a/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/InitBuilder.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.scriptbuilder; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.scriptbuilder.domain.Statements.createRunScript; -import static org.jclouds.scriptbuilder.domain.Statements.interpret; -import static org.jclouds.scriptbuilder.domain.Statements.kill; -import static org.jclouds.scriptbuilder.domain.Statements.newStatementList; -import static org.jclouds.scriptbuilder.domain.Statements.switchArg; - -import java.util.Map; - -import org.jclouds.scriptbuilder.domain.CreateRunScript; -import org.jclouds.scriptbuilder.domain.Statement; -import org.jclouds.scriptbuilder.domain.StatementList; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -/** - * will be removed in jclouds 1.6 - * - * Creates an init script file - * - * @see InitScript - * @author Adrian Cole - */ -@Deprecated -public class InitBuilder extends ScriptBuilder { - - private final String instanceName; - private final String instanceHome; - private final String logDir; - private final StatementList initStatement; - private final CreateRunScript createRunScript; - - public InitBuilder(String instanceName, Statement initStatement, Statement runStatement) { - this(instanceName, ImmutableSet.of(initStatement), ImmutableSet.of(runStatement)); - } - - public InitBuilder(String instanceName, Iterable initStatements, Iterable statements) { - this(instanceName, String.format("{tmp}{fs}{varl}INSTANCE_NAME{varr}", instanceName), String.format( - "{tmp}{fs}{varl}INSTANCE_NAME{varr}", instanceName), ImmutableMap. of(), initStatements, - statements); - } - - public InitBuilder(String instanceName, String instanceHome, String logDir, Map variables, - Iterable statements) { - this(instanceName, instanceHome, logDir, variables, ImmutableSet. of(), statements); - } - - /** - * @param variables keys are the variables to export in UPPER_UNDERSCORE case format - */ - public InitBuilder(String instanceName, String instanceHome, String logDir, Map variables, - Iterable initStatements, Iterable statements) { - Map defaultVariables = ImmutableMap.of("INSTANCE_NAME", instanceName, "INSTANCE_HOME", - instanceHome, "LOG_DIR", logDir); - this.initStatement = new StatementList(initStatements); - this.createRunScript = createRunScript(instanceName,// TODO: convert - // so - // that - // createRunScript - // can take from a - // variable - Iterables.concat(variables.keySet(), defaultVariables.keySet()), "{varl}INSTANCE_HOME{varr}", statements); - this.instanceName = checkNotNull(instanceName, "INSTANCE_NAME"); - this.instanceHome = checkNotNull(instanceHome, "INSTANCE_HOME"); - this.logDir = checkNotNull(logDir, "LOG_DIR"); - - addEnvironmentVariableScope("default", defaultVariables) - .addEnvironmentVariableScope(instanceName, variables) - .addStatement( - switchArg( - 1, - new ImmutableMap.Builder() - .put("init", - newStatementList(call("default"), call(instanceName), initStatement, - createRunScript)) - .put("status", - newStatementList(call("default"), findPid("{varl}INSTANCE_NAME{varr}"), - interpret("echo {varl}FOUND_PID{varr}{lf}"))) - .put("stop", - newStatementList(call("default"), findPid("{varl}INSTANCE_NAME{varr}"), kill())) - .put("start", - newStatementList( - call("default"), - forget("{varl}INSTANCE_NAME{varr}", - "{varl}INSTANCE_HOME{varr}{fs}{varl}INSTANCE_NAME{varr}.{sh}", - "{varl}LOG_DIR{varr}"))) - .put("tail", - newStatementList(call("default"), - interpret("tail {varl}LOG_DIR{varr}{fs}stdout.log{lf}"))) - .put("tailerr", - newStatementList(call("default"), - interpret("tail {varl}LOG_DIR{varr}{fs}stderr.log{lf}"))) - .put("run", - newStatementList(call("default"), - interpret("{varl}INSTANCE_HOME{varr}{fs}{varl}INSTANCE_NAME{varr}.{sh}{lf}"))) - .build())); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((instanceHome == null) ? 0 : instanceHome.hashCode()); - result = prime * result + ((instanceName == null) ? 0 : instanceName.hashCode()); - result = prime * result + ((logDir == null) ? 0 : logDir.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - InitBuilder other = (InitBuilder) obj; - if (instanceHome == null) { - if (other.instanceHome != null) - return false; - } else if (!instanceHome.equals(other.instanceHome)) - return false; - if (instanceName == null) { - if (other.instanceName != null) - return false; - } else if (!instanceName.equals(other.instanceName)) - return false; - if (logDir == null) { - if (other.logDir != null) - return false; - } else if (!logDir.equals(other.logDir)) - return false; - return true; - } - - public String getInstanceName() { - return instanceName; - } - - public String getInstanceHome() { - return instanceHome; - } - - public String getLogDir() { - return logDir; - } - - @Override - public String toString() { - return "[instanceName=" + instanceName + ", instanceHome=" + instanceHome + ", logDir=" + logDir + "]"; - } - - public StatementList getInitStatement() { - return initStatement; - } - - public CreateRunScript getCreateRunScript() { - return createRunScript; - } -} diff --git a/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/statements/java/InstallJDK.java b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/statements/java/InstallJDK.java index c189188674..b07ae63362 100644 --- a/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/statements/java/InstallJDK.java +++ b/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/statements/java/InstallJDK.java @@ -31,23 +31,11 @@ import org.jclouds.scriptbuilder.domain.StatementList; * @author Adrian Cole */ public class InstallJDK { - // TODO: this doesn't work - public static Statement fromOracle() { - throw new UnsupportedOperationException("Oracle JDK install doesn't currently work due to license agreement"); - } public static Statement fromOpenJDK() { return new FromOpenJDK(); } - /** - * @see fromOpenJDK - */ - @Deprecated - public static Statement fromURL() { - return fromOpenJDK(); - } - public static Statement fromURL(URI url) { return new FromURL(url); } diff --git a/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/InitBuilderTest.java b/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/InitBuilderTest.java deleted file mode 100644 index ce12b926bc..0000000000 --- a/scriptbuilder/src/test/java/org/jclouds/scriptbuilder/InitBuilderTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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.scriptbuilder; - -import static org.jclouds.scriptbuilder.domain.Statements.appendFile; -import static org.jclouds.scriptbuilder.domain.Statements.exec; -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.net.MalformedURLException; - -import org.jclouds.scriptbuilder.domain.OsFamily; -import org.jclouds.scriptbuilder.domain.ShellToken; -import org.jclouds.scriptbuilder.domain.Statement; -import org.jclouds.scriptbuilder.domain.Statements; -import org.testng.annotations.Test; - -import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.io.Resources; - -/** - * Tests possible uses of InitBuilder - * - * @author Adrian Cole - */ -@Deprecated -public class InitBuilderTest { - - InitBuilder testInitBuilder = new InitBuilder("mkebsboot", "/mnt/tmp", "/mnt/tmp", ImmutableMap.of("TMP_DIR", - "/mnt/tmp"), ImmutableList. of( - appendFile("{tmp}{fs}{uid}{fs}scripttest{fs}temp.txt", ImmutableList. of("hello world")), - exec("find /"))); - - @Test(expectedExceptions = UnsupportedOperationException.class) - public void testBuildSimpleWindows() throws MalformedURLException, IOException { - testInitBuilder.render(OsFamily.WINDOWS); - } - - @Test - public void testBuildSimpleUNIX() throws MalformedURLException, IOException { - assertEquals( - testInitBuilder.render(OsFamily.UNIX), - Resources.toString(Resources.getResource("test_init." + ShellToken.SH.to(OsFamily.UNIX)), Charsets.UTF_8)); - } - - @Test - public void testBuildEBS() throws MalformedURLException, IOException { - assertEquals( - new InitBuilder("mkebsboot",// name of the script - "/tmp",// working directory - "/tmp/logs",// location of stdout.log and stderr.log - ImmutableMap.of("IMAGE_DIR", "/mnt/tmp", "EBS_DEVICE", "/dev/sdh", "EBS_MOUNT_POINT", "/mnt/ebs"),// variables - // used - // inside - // of - // the - // script - ImmutableList. of(Statements - .interpret( - "echo creating a filesystem and mounting the ebs volume",// what - // to - // execute - "{md} {varl}IMAGE_DIR{varr} {varl}EBS_MOUNT_POINT{varr}", - "rm -rf {varl}IMAGE_DIR{varr}/*", - "yes| mkfs -t ext3 {varl}EBS_DEVICE{varr} 2>&-", - "mount {varl}EBS_DEVICE{varr} {varl}EBS_MOUNT_POINT{varr}", - "echo making a local working copy of the boot disk", - "rsync -ax --exclude /ubuntu/.bash_history --exclude /home/*/.bash_history --exclude /etc/ssh/ssh_host_* --exclude /etc/ssh/moduli --exclude /etc/udev/rules.d/*persistent-net.rules --exclude /var/lib/ec2/* --exclude=/mnt/* --exclude=/proc/* --exclude=/tmp/* --exclude=/dev/log / {varl}IMAGE_DIR{varr}", - "echo preparing the local working copy", - "touch {varl}IMAGE_DIR{varr}/etc/init.d/ec2-init-user-data", - "echo copying the local working copy to the ebs mount", "{cd} {varl}IMAGE_DIR{varr}", - "tar -cSf - * | tar xf - -C {varl}EBS_MOUNT_POINT{varr}", "echo size of ebs", - "du -sk {varl}EBS_MOUNT_POINT{varr}", "echo size of source", - "du -sk {varl}IMAGE_DIR{varr}", "rm -rf {varl}IMAGE_DIR{varr}/*", - "umount {varl}EBS_MOUNT_POINT{varr}", "echo ----COMPLETE----"))).render(OsFamily.UNIX), - Resources.toString(Resources.getResource("test_ebs." + ShellToken.SH.to(OsFamily.UNIX)), Charsets.UTF_8)); - } -}