diff --git a/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java b/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java
index ef434dcd72..f087d1deec 100644
--- a/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java
+++ b/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTask.java
@@ -18,6 +18,7 @@
*/
package org.jclouds.tools.ant.taskdefs.compute;
+import static org.jclouds.compute.util.ComputeServiceUtils.formatStatus;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.jclouds.tools.ant.taskdefs.compute.ComputeTaskUtils.buildComputeMap;
import static org.jclouds.tools.ant.taskdefs.compute.ComputeTaskUtils.createTemplateFromElement;
@@ -253,8 +254,7 @@ public class ComputeTask extends Task {
NodeMetadata metadata = node instanceof NodeMetadata ? NodeMetadata.class.cast(node) : computeService
.getNodeMetadata(node.getId());
log(String.format(" node id=%s, name=%s, group=%s, location=%s, state=%s, publicIp=%s, privateIp=%s, hardware=%s",
- metadata.getProviderId(), metadata.getName(), metadata.getGroup(), metadata.getLocation(), metadata
- .getState(), ComputeTaskUtils.ipOrEmptyString(metadata.getPublicAddresses()),
+ metadata.getProviderId(), metadata.getName(), metadata.getGroup(), metadata.getLocation(), formatStatus(metadata), ComputeTaskUtils.ipOrEmptyString(metadata.getPublicAddresses()),
ipOrEmptyString(metadata.getPrivateAddresses()), metadata.getHardware()));
}
diff --git a/apis/atmos/pom.xml b/apis/atmos/pom.xml
index 9ec2016cff..03e2d6ee85 100644
--- a/apis/atmos/pom.xml
+++ b/apis/atmos/pom.xml
@@ -39,6 +39,9 @@
FIXME
FIXME
+
+ *
+ org.jclouds.atmos*;version="${project.version}";-noimport:=true
@@ -108,21 +111,5 @@
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.atmos*;version="${project.version}"
- org.jclouds*;version="${project.version}",*
-
-
-
-
-
diff --git a/apis/byon/pom.xml b/apis/byon/pom.xml
index 92c9dc0243..3477244f66 100644
--- a/apis/byon/pom.xml
+++ b/apis/byon/pom.xml
@@ -35,7 +35,14 @@
file://c:/test.txt
-
+
+ org.jclouds.byon*;version="${project.version}"
+
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+
@@ -105,25 +112,4 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.byon*;version="${project.version}"
-
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
-
-
-
-
-
-
-
diff --git a/apis/byon/src/main/java/org/jclouds/byon/functions/NodeToNodeMetadata.java b/apis/byon/src/main/java/org/jclouds/byon/functions/NodeToNodeMetadata.java
index 878da381b3..8b9655fe5d 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/functions/NodeToNodeMetadata.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/functions/NodeToNodeMetadata.java
@@ -36,9 +36,9 @@ import org.jclouds.byon.Node;
import org.jclouds.collect.Memoized;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location;
@@ -90,7 +90,7 @@ public class NodeToNodeMetadata implements Function {
builder.operatingSystem(OperatingSystem.builder().arch(from.getOsArch()).family(
OsFamily.fromValue(from.getOsFamily())).description(from.getOsDescription())
.version(from.getOsVersion()).build());
- builder.state(NodeState.RUNNING);
+ builder.status(Status.RUNNING);
builder.publicAddresses(ImmutableSet. of(from.getHostname()));
if (from.getUsername() != null) {
diff --git a/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java b/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java
index 19837550e7..5496539fff 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java
@@ -45,7 +45,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.util.concurrent.UncheckedExecutionException;
-
/**
*
* @author Adrian Cole
@@ -118,6 +117,11 @@ public class BYONComputeServiceAdapter implements JCloudsNativeComputeServiceAda
return node != null ? converter.apply(node) : null;
}
+ @Override
+ public Image getImage(final String id) {
+ throw new UnsupportedOperationException();
+ }
+
@Override
public void destroyNode(final String id) {
throw new UnsupportedOperationException();
diff --git a/apis/byon/src/test/java/org/jclouds/byon/functions/NodeToNodeMetadataTest.java b/apis/byon/src/test/java/org/jclouds/byon/functions/NodeToNodeMetadataTest.java
index f3bb421920..8a5034fa24 100644
--- a/apis/byon/src/test/java/org/jclouds/byon/functions/NodeToNodeMetadataTest.java
+++ b/apis/byon/src/test/java/org/jclouds/byon/functions/NodeToNodeMetadataTest.java
@@ -27,9 +27,9 @@ import java.util.Set;
import org.jclouds.byon.suppliers.SupplyFromProviderURIOrNodesProperty;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder;
@@ -88,7 +88,7 @@ public class NodeToNodeMetadataTest {
.location(location)
.userMetadata(ImmutableMap.of("Name", "foo"))
.tags(ImmutableSet.of("vanilla"))
- .state(NodeState.RUNNING)
+ .status(Status.RUNNING)
.operatingSystem(
OperatingSystem.builder().description("redhat").family(OsFamily.RHEL).arch("x86").version("5.3")
.build())
diff --git a/apis/cloudfiles/pom.xml b/apis/cloudfiles/pom.xml
index 0b1ef22a34..65f0d61df3 100644
--- a/apis/cloudfiles/pom.xml
+++ b/apis/cloudfiles/pom.xml
@@ -39,6 +39,12 @@
${test.rackspace.identity}
${test.rackspace.credential}
+ org.jclouds.cloudfiles*;version="${project.version}"
+
+ org.jclouds*;version="${project.version}",
+ org.jclouds.openstack.swift.options;version="${project.version}",
+ *
+
@@ -123,25 +129,5 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.cloudfiles*;version="${project.version}"
-
- org.jclouds*;version="${project.version}",
- org.jclouds.openstack.swift.options;version="${project.version}",
- *
-
-
-
-
-
-
-
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
index d2211b8395..eea9a09b28 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
@@ -18,19 +18,15 @@
*/
package org.jclouds.cloudfiles;
-import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
-import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
-
import java.net.URI;
import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule;
import org.jclouds.cloudfiles.config.CloudFilesRestClientModule;
-import org.jclouds.openstack.OpenStackAuthAsyncClient;
+import org.jclouds.cloudfiles.config.CloudFilesRestClientModule.StorageAndCDNManagementEndpointModule;
+import org.jclouds.openstack.swift.SwiftApiMetadata;
import org.jclouds.rest.RestContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.TypeToken;
@@ -41,9 +37,10 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
-public class CloudFilesApiMetadata extends BaseRestApiMetadata {
+public class CloudFilesApiMetadata extends SwiftApiMetadata {
+
/** The serialVersionUID */
- private static final long serialVersionUID = 820062881469203616L;
+ private static final long serialVersionUID = -1572520638079261710L;
public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
private static final long serialVersionUID = -5070937833892503232L;
@@ -65,28 +62,25 @@ public class CloudFilesApiMetadata extends BaseRestApiMetadata {
protected CloudFilesApiMetadata(Builder builder) {
super(builder);
}
-
+
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
- properties.setProperty(PROPERTY_REGIONS, "DEFAULT");
- properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-");
+ Properties properties = SwiftApiMetadata.defaultProperties();
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder {
- protected Builder() {
+ public static class Builder extends SwiftApiMetadata.Builder {
+ protected Builder(){
super(CloudFilesClient.class, CloudFilesAsyncClient.class);
id("cloudfiles")
.name("Rackspace Cloud Files API")
.identityName("Username")
.credentialName("API Key")
.documentation(URI.create("http://docs.rackspacecloud.com/files/api/v1/cfdevguide_d5/content/ch01.html"))
- .version(OpenStackAuthAsyncClient.VERSION)
.defaultProperties(CloudFilesApiMetadata.defaultProperties())
- .view(TypeToken.of(BlobStoreContext.class))
- .defaultModules(ImmutableSet.>of(CloudFilesRestClientModule.class, CloudFilesBlobStoreContextModule.class));
+ .context(CONTEXT_TOKEN)
+ .defaultModules(ImmutableSet.>of(StorageAndCDNManagementEndpointModule.class, CloudFilesRestClientModule.class, CloudFilesBlobStoreContextModule.class));
}
-
+
@Override
public CloudFilesApiMetadata build() {
return new CloudFilesApiMetadata(this);
@@ -98,4 +92,5 @@ public class CloudFilesApiMetadata extends BaseRestApiMetadata {
return this;
}
}
+
}
\ No newline at end of file
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
index bbaffb58d4..bfcbd328db 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
@@ -27,77 +27,51 @@ import javax.inject.Singleton;
import org.jclouds.cloudfiles.CDNManagement;
import org.jclouds.cloudfiles.CloudFilesAsyncClient;
import org.jclouds.cloudfiles.CloudFilesClient;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.http.annotation.Redirection;
-import org.jclouds.http.annotation.ServerError;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
import org.jclouds.openstack.swift.CommonSwiftClient;
import org.jclouds.openstack.swift.Storage;
-import org.jclouds.openstack.swift.config.SwiftObjectModule;
-import org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse;
+import org.jclouds.openstack.swift.config.SwiftRestClientModule;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.rest.config.RestClientModule;
import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.reflect.TypeToken;
import com.google.inject.Provides;
+import com.google.inject.Scopes;
/**
*
* @author Adrian Cole
*/
@ConfiguresRestClient
-public class CloudFilesRestClientModule extends RestClientModule {
-
- @Provides
- @Singleton
- CommonSwiftClient provideCommonSwiftClient(CloudFilesClient in) {
- return in;
+public class CloudFilesRestClientModule extends SwiftRestClientModule {
+ public CloudFilesRestClientModule() {
+ super(TypeToken.of(CloudFilesClient.class), TypeToken.of(CloudFilesAsyncClient.class), ImmutableMap
+ ., Class>> of());
}
- @Provides
- @Singleton
- CommonSwiftAsyncClient provideCommonSwiftClient(CloudFilesAsyncClient in) {
- return in;
+ protected void bindResolvedClientsToCommonSwift() {
+ bind(CommonSwiftClient.class).to(CloudFilesClient.class).in(Scopes.SINGLETON);
+ bind(CommonSwiftAsyncClient.class).to(CloudFilesAsyncClient.class).in(Scopes.SINGLETON);
}
- @Override
- protected void configure() {
- install(new SwiftObjectModule());
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- super.configure();
- }
+ public static class StorageAndCDNManagementEndpointModule extends AuthenticationServiceModule {
+ @Provides
+ @Singleton
+ @CDNManagement
+ protected Supplier provideCDNUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
+ return getLastValueInMap(factory.createForApiTypeAndVersion("cloudFilesCDN", apiVersion));
+ }
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseSwiftErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseSwiftErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseSwiftErrorFromHttpResponse.class);
- }
-
- @Override
- protected void installLocations() {
- super.installLocations();
- install(new AuthenticationServiceModule());
- }
-
- @Provides
- @Singleton
- @CDNManagement
- protected Supplier provideCDNUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
- return getLastValueInMap(factory.createForApiTypeAndVersion("cloudFilesCDN", apiVersion));
- }
-
- @Provides
- @Singleton
- @Storage
- protected Supplier provideStorageUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
- return getLastValueInMap(factory.createForApiTypeAndVersion("cloudFiles", apiVersion));
+ @Provides
+ @Singleton
+ @Storage
+ protected Supplier provideStorageUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
+ return getLastValueInMap(factory.createForApiTypeAndVersion("cloudFiles", apiVersion));
+ }
}
}
diff --git a/apis/cloudloadbalancers/pom.xml b/apis/cloudloadbalancers/pom.xml
index 8f96a0b3a9..f2aeeca8e9 100644
--- a/apis/cloudloadbalancers/pom.xml
+++ b/apis/cloudloadbalancers/pom.xml
@@ -39,7 +39,10 @@
${test.rackspace.identity}
${test.rackspace.credential}
-
+
+ org.jclouds.cloudloadbalancers*;version="${project.version}"
+ org.jclouds*;version="${project.version}",*
+
org.jclouds
@@ -111,19 +114,4 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.cloudloadbalancers*;version="${project.version}"
- org.jclouds*;version="${project.version}",*
-
-
-
-
-
diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java
index 28c904566e..e59e3b9808 100644
--- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java
+++ b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java
@@ -25,7 +25,6 @@ import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudloadbalancers.config.CloudLoadBalancersRestClientModule;
import org.jclouds.cloudloadbalancers.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
import org.jclouds.loadbalancer.LoadBalancerServiceContext;
-import org.jclouds.openstack.OpenStackAuthAsyncClient;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.internal.BaseRestApiMetadata;
@@ -75,7 +74,7 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
.identityName("Username")
.credentialName("API Key")
.documentation(URI.create("http://docs.rackspacecloud.com/loadbalancers/api/v1.0/clb-devguide/content/ch01.html"))
- .version(OpenStackAuthAsyncClient.VERSION)
+ .version("1.0")
.defaultEndpoint("https://auth.api.rackspacecloud.com")
.defaultProperties(CloudLoadBalancersApiMetadata.defaultProperties())
.view(TypeToken.of(LoadBalancerServiceContext.class))
diff --git a/apis/cloudservers/pom.xml b/apis/cloudservers/pom.xml
index c10f22775f..6587497784 100644
--- a/apis/cloudservers/pom.xml
+++ b/apis/cloudservers/pom.xml
@@ -37,12 +37,19 @@
https://auth.api.rackspacecloud.com
1.0
-
+
${test.rackspace.identity}
${test.rackspace.credential}
-
-
-
+
+
+
+ org.jclouds.cloudservers*;version="${project.version}"
+
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+
@@ -126,26 +133,5 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.cloudservers*;version="${project.version}"
-
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
-
-
-
-
-
-
-
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
index 954355dfbe..0a394dbebe 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
@@ -25,7 +25,6 @@ import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.openstack.OpenStackAuthAsyncClient;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.internal.BaseRestApiMetadata;
@@ -74,7 +73,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
.identityName("Username")
.credentialName("API Key")
.documentation(URI.create("http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide/content/ch01.html"))
- .version(OpenStackAuthAsyncClient.VERSION)
+ .version("1.0")
.defaultEndpoint("https://auth.api.rackspacecloud.com")
.defaultProperties(CloudServersApiMetadata.defaultProperties())
.view(TypeToken.of(ComputeServiceContext.class))
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
index 2810f6012a..2ac13e1994 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
@@ -30,6 +30,7 @@ import org.jclouds.cloudservers.compute.functions.ServerToNodeMetadata;
import org.jclouds.cloudservers.compute.predicates.GetImageWhenStatusActivePredicateWithResult;
import org.jclouds.cloudservers.compute.strategy.CloudServersComputeServiceAdapter;
import org.jclouds.cloudservers.domain.Flavor;
+import org.jclouds.cloudservers.domain.ImageStatus;
import org.jclouds.cloudservers.domain.Server;
import org.jclouds.cloudservers.domain.ServerStatus;
import org.jclouds.compute.ComputeServiceAdapter;
@@ -37,7 +38,6 @@ import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.extensions.ImageExtension;
import org.jclouds.compute.internal.BaseComputeService;
@@ -93,36 +93,54 @@ public class CloudServersComputeServiceContextModule extends
}
@VisibleForTesting
- public static final Map serverToNodeState = ImmutableMap
- . builder().put(ServerStatus.ACTIVE, NodeState.RUNNING)//
- .put(ServerStatus.SUSPENDED, NodeState.SUSPENDED)//
- .put(ServerStatus.DELETED, NodeState.TERMINATED)//
- .put(ServerStatus.QUEUE_RESIZE, NodeState.PENDING)//
- .put(ServerStatus.PREP_RESIZE, NodeState.PENDING)//
- .put(ServerStatus.RESIZE, NodeState.PENDING)//
- .put(ServerStatus.VERIFY_RESIZE, NodeState.PENDING)//
- .put(ServerStatus.QUEUE_MOVE, NodeState.PENDING)//
- .put(ServerStatus.PREP_MOVE, NodeState.PENDING)//
- .put(ServerStatus.MOVE, NodeState.PENDING)//
- .put(ServerStatus.VERIFY_MOVE, NodeState.PENDING)//
- .put(ServerStatus.RESCUE, NodeState.PENDING)//
- .put(ServerStatus.ERROR, NodeState.ERROR)//
- .put(ServerStatus.BUILD, NodeState.PENDING)//
- .put(ServerStatus.RESTORING, NodeState.PENDING)//
- .put(ServerStatus.PASSWORD, NodeState.PENDING)//
- .put(ServerStatus.REBUILD, NodeState.PENDING)//
- .put(ServerStatus.DELETE_IP, NodeState.PENDING)//
- .put(ServerStatus.SHARE_IP_NO_CONFIG, NodeState.PENDING)//
- .put(ServerStatus.SHARE_IP, NodeState.PENDING)//
- .put(ServerStatus.REBOOT, NodeState.PENDING)//
- .put(ServerStatus.HARD_REBOOT, NodeState.PENDING)//
- .put(ServerStatus.UNKNOWN, NodeState.UNRECOGNIZED)//
- .put(ServerStatus.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
+ public static final Map toPortableNodeStatus = ImmutableMap
+ . builder()
+ .put(ServerStatus.ACTIVE, NodeMetadata.Status.RUNNING)
+ .put(ServerStatus.SUSPENDED, NodeMetadata.Status.SUSPENDED)
+ .put(ServerStatus.DELETED, NodeMetadata.Status.TERMINATED)
+ .put(ServerStatus.QUEUE_RESIZE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.PREP_RESIZE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.RESIZE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.VERIFY_RESIZE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.QUEUE_MOVE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.PREP_MOVE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.MOVE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.VERIFY_MOVE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.RESCUE, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.ERROR, NodeMetadata.Status.ERROR)
+ .put(ServerStatus.BUILD, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.RESTORING, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.PASSWORD, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.REBUILD, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.DELETE_IP, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.SHARE_IP_NO_CONFIG, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.SHARE_IP, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.REBOOT, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.HARD_REBOOT, NodeMetadata.Status.PENDING)
+ .put(ServerStatus.UNKNOWN, NodeMetadata.Status.UNRECOGNIZED)
+ .put(ServerStatus.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
@Singleton
@Provides
- Map provideServerToNodeState() {
- return serverToNodeState;
+ Map toPortableNodeStatus() {
+ return toPortableNodeStatus;
+ }
+
+ @VisibleForTesting
+ public static final Map toPortableImageStatus = ImmutableMap
+ . builder()
+ .put(ImageStatus.ACTIVE, Image.Status.AVAILABLE)
+ .put(ImageStatus.SAVING, Image.Status.PENDING)
+ .put(ImageStatus.PREPARING, Image.Status.PENDING)
+ .put(ImageStatus.QUEUED, Image.Status.PENDING)
+ .put(ImageStatus.FAILED, Image.Status.ERROR)
+ .put(ImageStatus.UNKNOWN, Image.Status.UNRECOGNIZED)
+ .put(ImageStatus.UNRECOGNIZED, Image.Status.UNRECOGNIZED).build();
+
+ @Singleton
+ @Provides
+ Map toPortableImageStatus() {
+ return toPortableImageStatus;
}
@Override
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java
index 946e6e1017..24f4e4e873 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/extensions/CloudServersImageExtension.java
@@ -52,7 +52,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* CloudServers implementation of {@link ImageExtension}
*
* @author David Alves
- *
+ * @see docs
*/
@Singleton
public class CloudServersImageExtension implements ImageExtension {
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java
index bedecffe6b..68727aca42 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImage.java
@@ -18,12 +18,16 @@
*/
package org.jclouds.cloudservers.compute.functions;
+import java.util.Map;
+
import javax.inject.Inject;
import javax.inject.Singleton;
+import org.jclouds.cloudservers.domain.ImageStatus;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.Image.Status;
import com.google.common.base.Function;
@@ -33,13 +37,15 @@ import com.google.common.base.Function;
*/
@Singleton
public class CloudServersImageToImage implements Function {
+ private final Map toPortableImageStatus;
private final Function imageToOs;
@Inject
- CloudServersImageToImage(Function imageToOs) {
+ CloudServersImageToImage(Map toPortableImageStatus, Function imageToOs) {
+ this.toPortableImageStatus=toPortableImageStatus;
this.imageToOs = imageToOs;
}
-
+
public Image apply(org.jclouds.cloudservers.domain.Image from) {
ImageBuilder builder = new ImageBuilder();
builder.ids(from.getId() + "");
@@ -47,6 +53,7 @@ public class CloudServersImageToImage implements Function {
protected Logger logger = Logger.NULL;
protected final Supplier location;
- protected final Map serverToNodeState;
+ protected final Map serverToNodeStatus;
protected final Supplier> images;
protected final Supplier> hardwares;
protected final GroupNamingConvention nodeNamingConvention;
@@ -93,12 +93,12 @@ public class ServerToNodeMetadata implements Function {
}
@Inject
- ServerToNodeMetadata(Map serverStateToNodeState,
+ ServerToNodeMetadata(Map serverStateToNodeStatus,
@Memoized Supplier> images, Supplier location,
@Memoized Supplier> hardwares,
GroupNamingConvention.Factory namingConvention) {
this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
- this.serverToNodeState = checkNotNull(serverStateToNodeState, "serverStateToNodeState");
+ this.serverToNodeStatus = checkNotNull(serverStateToNodeStatus, "serverStateToNodeStatus");
this.images = checkNotNull(images, "images");
this.location = checkNotNull(location, "location");
this.hardwares = checkNotNull(hardwares, "hardwares");
@@ -117,7 +117,7 @@ public class ServerToNodeMetadata implements Function {
builder.imageId(from.getImageId() + "");
builder.operatingSystem(parseOperatingSystem(from));
builder.hardware(parseHardware(from));
- builder.state(serverToNodeState.get(from.getStatus()));
+ builder.status(serverToNodeStatus.get(from.getStatus()));
builder.publicAddresses(from.getAddresses().getPublicAddresses());
builder.privateAddresses(from.getAddresses().getPrivateAddresses());
return builder.build();
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java
index df7a956be2..72d1a087b9 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/strategy/CloudServersComputeServiceAdapter.java
@@ -94,6 +94,12 @@ public class CloudServersComputeServiceAdapter implements ComputeServiceAdapter<
public Server getNode(String id) {
int serverId = Integer.parseInt(id);
return client.getServer(serverId);
+ }
+
+ @Override
+ public Image getImage(String id) {
+ int imageId = Integer.parseInt(id);
+ return client.getImage(imageId);
}
@Override
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModuleTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModuleTest.java
index b39995a26b..a3053da70e 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModuleTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModuleTest.java
@@ -30,7 +30,7 @@ public class CloudServersComputeServiceContextModuleTest {
public void testAllStatusCovered() {
for (ServerStatus state : ServerStatus.values()) {
- assert CloudServersComputeServiceContextModule.serverToNodeState.containsKey(state) : state;
+ assert CloudServersComputeServiceContextModule.toPortableNodeStatus.containsKey(state) : state;
}
}
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImageTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImageTest.java
index adda82530a..f84c00e379 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImageTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/CloudServersImageToImageTest.java
@@ -20,8 +20,7 @@ package org.jclouds.cloudservers.compute.functions;
import static org.testng.Assert.assertEquals;
-import java.net.UnknownHostException;
-
+import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
import org.jclouds.cloudservers.functions.ParseImageFromJsonResponseTest;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.Image;
@@ -38,23 +37,27 @@ import com.google.inject.Guice;
/**
* @author Adrian Cole
*/
-@Test(groups = "unit")
+@Test(groups = "unit", testName = "CloudServersImageToImageTest")
public class CloudServersImageToImageTest {
@Test
- public void testApplyWhereImageNotFound() throws UnknownHostException {
- assertEquals(convertImage(), new ImageBuilder().name("CentOS 5.2").operatingSystem(
+ public void test() {
+ Image toTest = convertImage();
+ assertEquals(toTest, new ImageBuilder().name("CentOS 5.2").operatingSystem(
new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(
- true).build()).description("CentOS 5.2").ids("2").version("1286712000000").build());
+ true).build()).description("CentOS 5.2").ids("2").status(Image.Status.PENDING).version(
+ "1286712000000").build());
+ assertEquals(toTest.getStatus(), Image.Status.PENDING);
}
public static Image convertImage() {
org.jclouds.cloudservers.domain.Image image = ParseImageFromJsonResponseTest.parseImage();
- CloudServersImageToImage parser = new CloudServersImageToImage(new CloudServersImageToOperatingSystem(
- new BaseComputeServiceContextModule() {
- }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice
- .createInjector(new GsonModule()).getInstance(Json.class))));
+ CloudServersImageToImage parser = new CloudServersImageToImage(
+ CloudServersComputeServiceContextModule.toPortableImageStatus, new CloudServersImageToOperatingSystem(
+ new BaseComputeServiceContextModule() {
+ }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(
+ new GsonModule()).getInstance(Json.class))));
return parser.apply(image);
}
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadataTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadataTest.java
index 855603afb8..2c46e9c395 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadataTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/functions/ServerToNodeMetadataTest.java
@@ -32,12 +32,12 @@ import org.jclouds.compute.domain.HardwareBuilder;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.domain.VolumeBuilder;
+import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.functions.GroupNamingConvention;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder;
@@ -60,12 +60,12 @@ public class ServerToNodeMetadataTest {
@Test
public void testApplyWhereImageAndHardwareNotFound() {
- Map serverStateToNodeState = CloudServersComputeServiceContextModule.serverToNodeState;
+ Map serverStateToNodeStatus = CloudServersComputeServiceContextModule.toPortableNodeStatus;
Set images = ImmutableSet.of();
Set hardwares = ImmutableSet.of();
Server server = ParseServerFromJsonResponseTest.parseServer();
- ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeState, Suppliers.> ofInstance(images), Suppliers
+ ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeStatus, Suppliers.> ofInstance(images), Suppliers
.ofInstance(provider), Suppliers.> ofInstance(hardwares), namingConvention);
NodeMetadata metadata = parser.apply(server);
@@ -73,7 +73,7 @@ public class ServerToNodeMetadataTest {
assertEquals(
metadata,
new NodeMetadataBuilder()
- .state(NodeState.PENDING)
+ .status(Status.PENDING)
.publicAddresses(ImmutableSet.of("67.23.10.132", "67.23.10.131"))
.privateAddresses(ImmutableSet.of("10.176.42.16"))
.imageId("2")
@@ -91,13 +91,13 @@ public class ServerToNodeMetadataTest {
@Test
public void testApplyWhereImageFoundAndHardwareNotFound() {
- Map serverStateToNodeState = CloudServersComputeServiceContextModule.serverToNodeState;
+ Map serverStateToNodeStatus = CloudServersComputeServiceContextModule.toPortableNodeStatus;
org.jclouds.compute.domain.Image jcImage = CloudServersImageToImageTest.convertImage();
Set images = ImmutableSet.of(jcImage);
Set hardwares = ImmutableSet.of();
Server server = ParseServerFromJsonResponseTest.parseServer();
- ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeState, Suppliers.> ofInstance(images), Suppliers
+ ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeStatus, Suppliers.> ofInstance(images), Suppliers
.ofInstance(provider), Suppliers.> ofInstance(hardwares), namingConvention);
NodeMetadata metadata = parser.apply(server);
@@ -105,7 +105,7 @@ public class ServerToNodeMetadataTest {
assertEquals(
metadata,
new NodeMetadataBuilder()
- .state(NodeState.PENDING)
+ .status(Status.PENDING)
.publicAddresses(ImmutableSet.of("67.23.10.132", "67.23.10.131"))
.privateAddresses(ImmutableSet.of("10.176.42.16"))
.imageId("2")
@@ -126,12 +126,12 @@ public class ServerToNodeMetadataTest {
@Test
public void testApplyWhereImageAndHardwareFound() {
- Map serverStateToNodeState = CloudServersComputeServiceContextModule.serverToNodeState;
+ Map serverStateToNodeStatus = CloudServersComputeServiceContextModule.toPortableNodeStatus;
Set images = ImmutableSet.of(CloudServersImageToImageTest.convertImage());
Set hardwares = ImmutableSet.of(FlavorToHardwareTest.convertFlavor());
Server server = ParseServerFromJsonResponseTest.parseServer();
- ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeState, Suppliers.> ofInstance(images), Suppliers
+ ServerToNodeMetadata parser = new ServerToNodeMetadata(serverStateToNodeStatus, Suppliers.> ofInstance(images), Suppliers
.ofInstance(provider), Suppliers.> ofInstance(hardwares), namingConvention);
NodeMetadata metadata = parser.apply(server);
@@ -139,7 +139,7 @@ public class ServerToNodeMetadataTest {
assertEquals(
metadata,
new NodeMetadataBuilder()
- .state(NodeState.PENDING)
+ .status(Status.PENDING)
.publicAddresses(ImmutableSet.of("67.23.10.132", "67.23.10.131"))
.privateAddresses(ImmutableSet.of("10.176.42.16"))
.imageId("2")
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/predicates/GetImageWhenStatusActivePredicateWithResultExpectTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/predicates/GetImageWhenStatusActivePredicateWithResultExpectTest.java
index e479d22897..b026aaa0f3 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/predicates/GetImageWhenStatusActivePredicateWithResultExpectTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/predicates/GetImageWhenStatusActivePredicateWithResultExpectTest.java
@@ -18,8 +18,8 @@
*/
package org.jclouds.cloudservers.compute.predicates;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
import java.net.URI;
import java.util.Map;
diff --git a/apis/cloudsigma/pom.xml b/apis/cloudsigma/pom.xml
index e44d5ac98e..5b49b23147 100644
--- a/apis/cloudsigma/pom.xml
+++ b/apis/cloudsigma/pom.xml
@@ -36,12 +36,20 @@
https://api.cloudsigma.com
1.0
-
+
FIXME
FIXME
f3c7c665-cd54-4a78-8fd2-7ec2f028cf29
-
-
+
+
+
+ org.jclouds.cloudsigma*;version="${project.version}"
+
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+
@@ -112,25 +120,4 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.cloudsigma*;version="${project.version}"
-
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
-
-
-
-
-
-
-
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java
index 74327d03b1..1299acc9d5 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java
@@ -210,7 +210,12 @@ public class CloudSigmaComputeServiceAdapter implements
public ServerInfo getNode(String id) {
return client.getServerInfo(id);
}
-
+
+ @Override
+ public DriveInfo getImage(String id) {
+ return client.getDriveInfo(id);
+ }
+
@Override
public void destroyNode(String id) {
ServerInfo server = getNode(id);
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java
index 356fc1bec9..56b827c167 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java
@@ -26,6 +26,7 @@ import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
+import org.jclouds.compute.domain.Image.Status;
import org.jclouds.compute.domain.OperatingSystem.Builder;
import org.jclouds.domain.Location;
@@ -61,6 +62,6 @@ public class PreinstalledDiskToImage implements Function {
return new ImageBuilder().ids(drive.getUuid())
.userMetadata(ImmutableMap. of("size", drive.getSize() / 1024 / 1024 / 1024 + ""))
.location(locationSupplier.get()).name(drive.getName()).description(description)
- .operatingSystem(builder.build()).version("").build();
+ .operatingSystem(builder.build()).status(Status.AVAILABLE).version("").build();
}
}
\ No newline at end of file
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/ServerInfoToNodeMetadata.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/ServerInfoToNodeMetadata.java
index d4f5dbd84f..5e131e6f30 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/ServerInfoToNodeMetadata.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/ServerInfoToNodeMetadata.java
@@ -38,10 +38,10 @@ import org.jclouds.compute.domain.HardwareBuilder;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.domain.VolumeBuilder;
+import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.functions.GroupNamingConvention;
import org.jclouds.domain.Location;
import org.jclouds.logging.Logger;
@@ -60,13 +60,13 @@ import com.google.common.util.concurrent.UncheckedExecutionException;
*/
@Singleton
public class ServerInfoToNodeMetadata implements Function {
- public static final Map serverStatusToNodeState = ImmutableMap
- . builder().put(ServerStatus.ACTIVE, NodeState.RUNNING)//
- .put(ServerStatus.STOPPED, NodeState.SUSPENDED)//
- .put(ServerStatus.PAUSED, NodeState.SUSPENDED)//
- .put(ServerStatus.DUMPED, NodeState.PENDING)//
- .put(ServerStatus.DEAD, NodeState.TERMINATED)//
- .put(ServerStatus.UNRECOGNIZED, NodeState.UNRECOGNIZED)//
+ public static final Map serverStatusToNodeStatus = ImmutableMap
+ . builder().put(ServerStatus.ACTIVE, Status.RUNNING)//
+ .put(ServerStatus.STOPPED, Status.SUSPENDED)//
+ .put(ServerStatus.PAUSED, Status.SUSPENDED)//
+ .put(ServerStatus.DUMPED, Status.PENDING)//
+ .put(ServerStatus.DEAD, Status.TERMINATED)//
+ .put(ServerStatus.UNRECOGNIZED, Status.UNRECOGNIZED)//
.build();
private final Function getImageIdFromServer;
@@ -104,7 +104,7 @@ public class ServerInfoToNodeMetadata implements Function of(from.getVnc().getIp()));
builder.privateAddresses(ImmutableSet. of());
return builder.build();
diff --git a/apis/cloudstack/pom.xml b/apis/cloudstack/pom.xml
index 7da9779f74..bef1c61535 100644
--- a/apis/cloudstack/pom.xml
+++ b/apis/cloudstack/pom.xml
@@ -50,16 +50,24 @@
http://localhost:8080/client/api
2.2.12
-
+
FIXME_apiKey
FIXME_secretKey
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ org.jclouds.cloudstack*;version="${project.version}"
+
+ org.jclouds.compute.internal;version="${project.version}",
+ org.jclouds.rest.internal;version="${project.version}",
+ org.jclouds*;version="${project.version}",
+ *
+
@@ -146,24 +154,4 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- ${project.artifactId}
- org.jclouds.cloudstack*;version="${project.version}"
-
- org.jclouds.compute.internal;version="${project.version}",
- org.jclouds.rest.internal;version="${project.version}",
- org.jclouds*;version="${project.version}",
- *
-
-
-
-
-
-
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java
index 18964f9e73..abcc733f0a 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/config/CloudStackComputeServiceContextModule.java
@@ -41,6 +41,7 @@ import org.jclouds.cloudstack.compute.strategy.AdvancedNetworkOptionsConverter;
import org.jclouds.cloudstack.compute.strategy.BasicNetworkOptionsConverter;
import org.jclouds.cloudstack.compute.strategy.CloudStackComputeServiceAdapter;
import org.jclouds.cloudstack.compute.strategy.OptionsConverter;
+import org.jclouds.cloudstack.domain.FirewallRule;
import org.jclouds.cloudstack.domain.IPForwardingRule;
import org.jclouds.cloudstack.domain.Network;
import org.jclouds.cloudstack.domain.NetworkType;
@@ -51,8 +52,11 @@ import org.jclouds.cloudstack.domain.User;
import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.Zone;
import org.jclouds.cloudstack.features.GuestOSClient;
+import org.jclouds.cloudstack.functions.GetFirewallRulesByVirtualMachine;
+import org.jclouds.cloudstack.functions.GetIPForwardingRulesByVirtualMachine;
import org.jclouds.cloudstack.functions.StaticNATVirtualMachineInNetwork;
import org.jclouds.cloudstack.functions.ZoneIdToZone;
+import org.jclouds.cloudstack.options.ListFirewallRulesOptions;
import org.jclouds.cloudstack.predicates.JobComplete;
import org.jclouds.cloudstack.suppliers.GetCurrentUser;
import org.jclouds.cloudstack.suppliers.NetworksForCurrentUser;
@@ -108,6 +112,8 @@ public class CloudStackComputeServiceContextModule extends
install(new FactoryModuleBuilder().build(StaticNATVirtualMachineInNetwork.Factory.class));
bind(new TypeLiteral>>() {
}).to(GetIPForwardingRulesByVirtualMachine.class);
+ bind(new TypeLiteral>>() {
+ }).to(GetFirewallRulesByVirtualMachine.class);
bind(new TypeLiteral>() {
}).to(ZoneIdToZone.class);
bind(new TypeLiteral>>() {
@@ -184,24 +190,12 @@ public class CloudStackComputeServiceContextModule extends
return CacheBuilder.newBuilder().build(getIPForwardingRules);
}
+
+ @Provides
@Singleton
- public static class GetIPForwardingRulesByVirtualMachine extends CacheLoader> {
- private final CloudStackClient client;
-
- @Inject
- public GetIPForwardingRulesByVirtualMachine(CloudStackClient client) {
- this.client = checkNotNull(client, "client");
- }
-
- /**
- * @throws ResourceNotFoundException
- * when there is no ip forwarding rule available for the VM
- */
- @Override
- public Set load(String input) {
- Set rules = client.getNATClient().getIPForwardingRulesForVirtualMachine(input);
- return rules != null ? rules : ImmutableSet.of();
- }
+ protected LoadingCache> getFirewallRulesByVirtualMachine(
+ CacheLoader> getFirewallRules) {
+ return CacheBuilder.newBuilder().build(getFirewallRules);
}
@Provides
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/TemplateToImage.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/TemplateToImage.java
index 5384178636..f3c1ba4614 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/TemplateToImage.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/TemplateToImage.java
@@ -31,6 +31,7 @@ import org.jclouds.collect.Memoized;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.Image.Status;
import org.jclouds.domain.Location;
import com.google.common.base.Function;
@@ -62,6 +63,8 @@ public class TemplateToImage implements Function {
if (!template.isCrossZones())
builder.location(findLocationForTemplate.apply(template));
+ //TODO: implement status mapping!!!
+ builder.status(Status.AVAILABLE);
return builder.build();
}
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
index 8c551f66f7..59a4418385 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java
@@ -41,8 +41,8 @@ import org.jclouds.compute.domain.HardwareBuilder;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.Processor;
+import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.functions.GroupNamingConvention;
import org.jclouds.domain.Location;
import org.jclouds.rest.ResourceNotFoundException;
@@ -64,17 +64,17 @@ import com.google.common.util.concurrent.UncheckedExecutionException;
@Singleton
public class VirtualMachineToNodeMetadata implements Function {
- public static final Map vmStateToNodeState = ImmutableMap
- . builder().put(VirtualMachine.State.STARTING, NodeState.PENDING)
- .put(VirtualMachine.State.RUNNING, NodeState.RUNNING).put(VirtualMachine.State.STOPPING, NodeState.PENDING)
- .put(VirtualMachine.State.STOPPED, NodeState.SUSPENDED)
- .put(VirtualMachine.State.DESTROYED, NodeState.TERMINATED)
- .put(VirtualMachine.State.EXPUNGING, NodeState.TERMINATED)
- .put(VirtualMachine.State.MIGRATING, NodeState.PENDING).put(VirtualMachine.State.ERROR, NodeState.ERROR)
- .put(VirtualMachine.State.UNKNOWN, NodeState.UNRECOGNIZED)
+ public static final Map vmStateToNodeStatus = ImmutableMap
+ . builder().put(VirtualMachine.State.STARTING, Status.PENDING)
+ .put(VirtualMachine.State.RUNNING, Status.RUNNING).put(VirtualMachine.State.STOPPING, Status.PENDING)
+ .put(VirtualMachine.State.STOPPED, Status.SUSPENDED)
+ .put(VirtualMachine.State.DESTROYED, Status.TERMINATED)
+ .put(VirtualMachine.State.EXPUNGING, Status.TERMINATED)
+ .put(VirtualMachine.State.MIGRATING, Status.PENDING).put(VirtualMachine.State.ERROR, Status.ERROR)
+ .put(VirtualMachine.State.UNKNOWN, Status.UNRECOGNIZED)
// TODO: is this really a state?
- .put(VirtualMachine.State.SHUTDOWNED, NodeState.PENDING)
- .put(VirtualMachine.State.UNRECOGNIZED, NodeState.UNRECOGNIZED).build();
+ .put(VirtualMachine.State.SHUTDOWNED, Status.PENDING)
+ .put(VirtualMachine.State.UNRECOGNIZED, Status.UNRECOGNIZED).build();
private final FindLocationForVirtualMachine findLocationForVirtualMachine;
private final FindImageForVirtualMachine findImageForVirtualMachine;
@@ -123,7 +123,7 @@ public class VirtualMachineToNodeMetadata implements Function publicAddresses = newHashSet(), privateAddresses = newHashSet();
if (from.getIPAddress() != null) {
@@ -134,6 +134,9 @@ public class VirtualMachineToNodeMetadata implements Function {
+ ComputeServiceAdapter {
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
@@ -86,6 +92,7 @@ public class CloudStackComputeServiceAdapter implements
private final BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult;
private final Factory staticNATVMInNetwork;
private final CreatePortForwardingRulesForIP setupPortForwardingRulesForIP;
+ private final CreateFirewallRulesForIP setupFirewallRulesForIP;
private final LoadingCache> vmToRules;
private final Map credentialStore;
private final Map optionsConverters;
@@ -93,19 +100,23 @@ public class CloudStackComputeServiceAdapter implements
@Inject
public CloudStackComputeServiceAdapter(CloudStackClient client, Predicate jobComplete,
- @Memoized Supplier