You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2014/10/07 00:30:56 UTC
[19/52] [abbrv] git commit: JCLOUDS-296 unasync legacy cloudservers
provider.
JCLOUDS-296 unasync legacy cloudservers provider.
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/e3ada5b7
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/e3ada5b7
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/e3ada5b7
Branch: refs/heads/use-agentproxy-008
Commit: e3ada5b7268c87deddc7b4dfb619f05ebf1a872e
Parents: 0ab1988
Author: Adrian Cole <ac...@twitter.com>
Authored: Fri Oct 3 19:13:22 2014 -0700
Committer: Adrian Cole <ad...@apache.org>
Committed: Fri Oct 3 23:14:21 2014 -0700
----------------------------------------------------------------------
.../cloudservers/CloudServersApiMetadata.java | 28 +-
.../cloudservers/CloudServersAsyncClient.java | 387 --------
.../cloudservers/CloudServersClient.java | 240 ++++-
...CloudServersComputeServiceContextModule.java | 4 -
.../config/CloudServersHttpApiModule.java | 87 ++
.../config/CloudServersRestClientModule.java | 88 --
.../CloudServersAsyncClientTest.java | 902 -------------------
.../cloudservers/CloudServersClientTest.java | 898 ++++++++++++++++++
...aseCloudServersComputeServiceExpectTest.java | 10 +-
.../BaseCloudServersRestClientExpectTest.java | 10 +-
10 files changed, 1209 insertions(+), 1445 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
----------------------------------------------------------------------
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 8c6fbd8..04ed2e7 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
@@ -22,27 +22,14 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
-import org.jclouds.cloudservers.config.CloudServersRestClientModule;
+import org.jclouds.cloudservers.config.CloudServersHttpApiModule;
import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.rest.internal.BaseRestApiMetadata;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
-/**
- * Implementation of {@link ApiMetadata} for CloudServers 1.0 API
- */
-public class CloudServersApiMetadata extends BaseRestApiMetadata {
-
- /**
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudServersClient.class)} as
- * {@link CloudServersAsyncClient} interface will be removed in jclouds 1.7.
- */
- @Deprecated
- public static final TypeToken<org.jclouds.rest.RestContext<CloudServersClient, CloudServersAsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudServersClient, CloudServersAsyncClient>>() {
- private static final long serialVersionUID = 1L;
- };
+public class CloudServersApiMetadata extends BaseHttpApiMetadata {
@Override
public Builder toBuilder() {
@@ -58,15 +45,14 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
}
public static Properties defaultProperties() {
- Properties properties = BaseRestApiMetadata.defaultProperties();
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
return properties;
}
- public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
+ public static class Builder extends BaseHttpApiMetadata.Builder<CloudServersClient, Builder> {
- @SuppressWarnings("deprecation")
protected Builder() {
- super(CloudServersClient.class, CloudServersAsyncClient.class);
+ super(CloudServersClient.class);
id("cloudservers")
.name("Rackspace Cloud Servers API")
.identityName("Username")
@@ -76,7 +62,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://auth.api.rackspacecloud.com")
.defaultProperties(CloudServersApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))
- .defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersRestClientModule.class, CloudServersComputeServiceContextModule.class));
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersHttpApiModule.class, CloudServersComputeServiceContextModule.class));
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java
deleted file mode 100644
index 75aebdb..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersAsyncClient.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.cloudservers;
-
-import java.io.Closeable;
-import java.util.Set;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
-import org.jclouds.cloudservers.domain.Addresses;
-import org.jclouds.cloudservers.domain.BackupSchedule;
-import org.jclouds.cloudservers.domain.Flavor;
-import org.jclouds.cloudservers.domain.Image;
-import org.jclouds.cloudservers.domain.Limits;
-import org.jclouds.cloudservers.domain.RebootType;
-import org.jclouds.cloudservers.domain.Server;
-import org.jclouds.cloudservers.domain.SharedIpGroup;
-import org.jclouds.cloudservers.options.CreateServerOptions;
-import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
-import org.jclouds.cloudservers.options.ListOptions;
-import org.jclouds.cloudservers.options.RebuildServerOptions;
-import org.jclouds.openstack.filters.AddTimestampQuery;
-import org.jclouds.openstack.filters.AuthenticateRequest;
-import org.jclouds.openstack.services.Compute;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.Unwrap;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Cloud Servers via their REST API.
- * <p/>
- * All commands return a ListenableFuture of the result from Cloud Servers. Any exceptions incurred
- * during processing will be backend in an {@link ExecutionException} as documented in
- * {@link ListenableFuture#get()}.
- *
- * @see CloudServersClient
- *
- * @deprecated The Rackspace First-Gen Cloud Servers product has been deprecated. Please refer to the
- * <a href="http://jclouds.apache.org/guides/rackspace">Rackspace Getting Started Guide</a>
- * for accessing the Rackspace Cloud. This API will be removed in 2.0.
- */
-@Deprecated
-@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
-@Endpoint(Compute.class)
-public interface CloudServersAsyncClient extends Closeable {
-
- /**
- * @see CloudServersClient#getLimits
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/limits")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<Limits> getLimits();
-
- /**
- * @see CloudServersClient#listServers
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<Server>> listServers(ListOptions... options);
-
- /**
- * @see CloudServersClient#getServer
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Fallback(NullOnNotFoundOr404.class)
- @Path("/servers/{id}")
- ListenableFuture<Server> getServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#deleteServer
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}")
- ListenableFuture<Boolean> deleteServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#rebootServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
- ListenableFuture<Void> rebootServer(@PathParam("id") int id, @PayloadParam("type") RebootType rebootType);
-
- /**
- * @see CloudServersClient#resizeServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"resize\":%7B\"flavorId\":{flavorId}%7D%7D")
- ListenableFuture<Void> resizeServer(@PathParam("id") int id, @PayloadParam("flavorId") int flavorId);
-
- /**
- * @see CloudServersClient#confirmResizeServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"confirmResize\":null}")
- ListenableFuture<Void> confirmResizeServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#revertResizeServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("{\"revertResize\":null}")
- ListenableFuture<Void> revertResizeServer(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#createServer
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers")
- @MapBinder(CreateServerOptions.class)
- ListenableFuture<Server> createServer(@PayloadParam("name") String name, @PayloadParam("imageId") int imageId,
- @PayloadParam("flavorId") int flavorId, CreateServerOptions... options);
-
- /**
- * @see CloudServersClient#rebuildServer
- */
- @POST
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/action")
- @MapBinder(RebuildServerOptions.class)
- ListenableFuture<Void> rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
-
- /**
- * @see CloudServersClient#shareIp
- */
- @PUT
- @Path("/servers/{id}/ips/public/{address}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D")
- ListenableFuture<Void> shareIp(@PathParam("address") String addressToShare,
- @PathParam("id") int serverToTosignBindressTo, @PayloadParam("sharedIpGroupId") int sharedIpGroup,
- @PayloadParam("configureServer") boolean configureServer);
-
- /**
- * @see CloudServersClient#unshareIp
- */
- @DELETE
- @Path("/servers/{id}/ips/public/{address}")
- @Fallback(VoidOnNotFoundOr404.class)
- ListenableFuture<Void> unshareIp(@PathParam("address") String addressToShare,
- @PathParam("id") int serverToTosignBindressTo);
-
- /**
- * @see CloudServersClient#changeAdminPass
- */
- @PUT
- @Path("/servers/{id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
- ListenableFuture<Void> changeAdminPass(@PathParam("id") int id, @PayloadParam("adminPass") String adminPass);
-
- /**
- * @see CloudServersClient#renameServer
- */
- @PUT
- @Path("/servers/{id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
- ListenableFuture<Void> renameServer(@PathParam("id") int id, @PayloadParam("name") String newName);
-
- /**
- * @see CloudServersClient#listFlavors
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/flavors")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<Flavor>> listFlavors(ListOptions... options);
-
- /**
- * @see CloudServersClient#getFlavor
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/flavors/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<Flavor> getFlavor(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#listImages
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/images")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<Image>> listImages(ListOptions... options);
-
- /**
- * @see CloudServersClient#getImage
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @Fallback(NullOnNotFoundOr404.class)
- @QueryParams(keys = "format", values = "json")
- @Path("/images/{id}")
- ListenableFuture<Image> getImage(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#deleteImage
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/images/{id}")
- ListenableFuture<Boolean> deleteImage(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#createImageFromServer
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/images")
- @Produces(MediaType.APPLICATION_JSON)
- @Payload("%7B\"image\":%7B\"serverId\":{serverId},\"name\":\"{name}\"%7D%7D")
- ListenableFuture<Image> createImageFromServer(@PayloadParam("name") String imageName,
- @PayloadParam("serverId") int serverId);
-
- /**
- * @see CloudServersClient#listSharedIpGroups
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<SharedIpGroup>> listSharedIpGroups(ListOptions... options);
-
- /**
- * @see CloudServersClient#getSharedIpGroup
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups/{id}")
- @Fallback(NullOnNotFoundOr404.class)
- ListenableFuture<SharedIpGroup> getSharedIpGroup(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#createSharedIpGroup
- */
- @POST
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/shared_ip_groups")
- @MapBinder(CreateSharedIpGroupOptions.class)
- ListenableFuture<SharedIpGroup> createSharedIpGroup(@PayloadParam("name") String name,
- CreateSharedIpGroupOptions... options);
-
- /**
- * @see CloudServersClient#deleteSharedIpGroup
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/shared_ip_groups/{id}")
- ListenableFuture<Boolean> deleteSharedIpGroup(@PathParam("id") int id);
-
- /**
- * @see CloudServersClient#listBackupSchedule
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture<BackupSchedule> getBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#deleteBackupSchedule
- */
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture<Boolean> deleteBackupSchedule(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#replaceBackupSchedule
- */
- @POST
- @Path("/servers/{id}/backup_schedule")
- ListenableFuture<Void> replaceBackupSchedule(@PathParam("id") int id,
- @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
-
- /**
- * @see CloudServersClient#listAddresses
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips")
- ListenableFuture<Addresses> getAddresses(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#listPublicAddresses
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips/public")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<String>> listPublicAddresses(@PathParam("id") int serverId);
-
- /**
- * @see CloudServersClient#listPrivateAddresses
- */
- @GET
- @Unwrap
- @Consumes(MediaType.APPLICATION_JSON)
- @QueryParams(keys = "format", values = "json")
- @Path("/servers/{id}/ips/private")
- @Fallback(EmptySetOnNotFoundOr404.class)
- ListenableFuture<? extends Set<String>> listPrivateAddresses(@PathParam("id") int serverId);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
index 4fe9761..ff9b21e 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersClient.java
@@ -16,10 +16,24 @@
*/
package org.jclouds.cloudservers;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.jclouds.Fallbacks.*;
+
import java.io.Closeable;
import java.util.Set;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.jclouds.Fallbacks;
+import org.jclouds.cloudservers.binders.BindBackupScheduleToJsonPayload;
import org.jclouds.cloudservers.domain.Addresses;
import org.jclouds.cloudservers.domain.BackupSchedule;
import org.jclouds.cloudservers.domain.Flavor;
@@ -32,20 +46,31 @@ import org.jclouds.cloudservers.options.CreateServerOptions;
import org.jclouds.cloudservers.options.CreateSharedIpGroupOptions;
import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions;
+import org.jclouds.openstack.filters.AddTimestampQuery;
+import org.jclouds.openstack.filters.AuthenticateRequest;
+import org.jclouds.openstack.services.Compute;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.Payload;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.QueryParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.Unwrap;
+
+import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides access to Cloud Servers via their REST API.
- * <p/>
- * All commands return a Future of the result from Cloud Servers. Any exceptions incurred during
- * processing will be backend in an {@link ExecutionException} as documented in {@link Future#get()}.
- *
- * @see CloudServersAsyncClient
*
* @deprecated The Rackspace First-Gen Cloud Servers product has been deprecated. Please refer to the
* <a href="http://jclouds.apache.org/guides/rackspace">Rackspace Getting Started Guide</a>
* for accessing the Rackspace Cloud. This API will be removed in 2.0.
*/
@Deprecated
+@RequestFilters({ AuthenticateRequest.class, AddTimestampQuery.class })
+@Endpoint(Compute.class)
public interface CloudServersClient extends Closeable {
/**
* All accounts, by default, have a preconfigured set of thresholds (or limits) to manage
@@ -55,6 +80,12 @@ public interface CloudServersClient extends Closeable {
*
* @return limits on the account
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/limits")
+ @Fallback(NullOnNotFoundOr404.class)
Limits getLimits();
/**
@@ -67,6 +98,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Server> listServers(ListOptions... options);
/**
@@ -76,6 +113,12 @@ public interface CloudServersClient extends Closeable {
* @return null, if the server is not found
* @see Server
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Path("/servers/{id}")
Server getServer(@PathParam("id") int id);
/**
@@ -87,6 +130,9 @@ public interface CloudServersClient extends Closeable {
* @return false if the server is not found
* @see Server
*/
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/servers/{id}")
boolean deleteServer(@PathParam("id") int id);
/**
@@ -103,7 +149,12 @@ public interface CloudServersClient extends Closeable {
* graceful shutdown of all processes. A hard reboot is the equivalent of power cycling
* the server.
*/
- void rebootServer(int id, RebootType rebootType);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"reboot\":%7B\"type\":\"{type}\"%7D%7D")
+ void rebootServer(@PathParam("id") int id, @PayloadParam("type") RebootType rebootType);
/**
* The resize function converts an existing server to a different flavor, in essence, scaling the
@@ -118,7 +169,12 @@ public interface CloudServersClient extends Closeable {
* <p/>
* ACTIVE - QUEUE_RESIZE - ACTIVE (on error)
*/
- void resizeServer(int id, int flavorId);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"resize\":%7B\"flavorId\":{flavorId}%7D%7D")
+ void resizeServer(@PathParam("id") int id, @PayloadParam("flavorId") int flavorId);
/**
* The resize function converts an existing server to a different flavor, in essence, scaling the
@@ -131,7 +187,12 @@ public interface CloudServersClient extends Closeable {
* <p/>
* VERIFY_RESIZE - ACTIVE
*/
- void confirmResizeServer(int id);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("{\"confirmResize\":null}")
+ void confirmResizeServer(@PathParam("id") int id);
/**
* The resize function converts an existing server to a different flavor, in essence, scaling the
@@ -144,7 +205,12 @@ public interface CloudServersClient extends Closeable {
* <p/>
* VERIFY_RESIZE - ACTIVE
*/
- void revertResizeServer(int id);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @Produces(APPLICATION_JSON)
+ @Payload("{\"revertResize\":null}")
+ void revertResizeServer(@PathParam("id") int id);
/**
* This operation asynchronously provisions a new server. The progress of this operation depends
@@ -157,7 +223,14 @@ public interface CloudServersClient extends Closeable {
* @param options
* - used to specify extra files, metadata, or ip parameters during server creation.
*/
- Server createServer(String name, int imageId, int flavorId, CreateServerOptions... options);
+ @POST
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers")
+ @MapBinder(CreateServerOptions.class)
+ Server createServer(@PayloadParam("name") String name, @PayloadParam("imageId") int imageId,
+ @PayloadParam("flavorId") int flavorId, CreateServerOptions... options);
/**
* The rebuild function removes all data on the server and replaces it with the specified image.
@@ -174,7 +247,11 @@ public interface CloudServersClient extends Closeable {
* - imageId is an optional argument. If it is not specified, the server is rebuilt
* with the original imageId.
*/
- void rebuildServer(int id, RebuildServerOptions... options);
+ @POST
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/action")
+ @MapBinder(RebuildServerOptions.class)
+ void rebuildServer(@PathParam("id") int id, RebuildServerOptions... options);
/**
* /** This operation allows you share an IP address to the specified server
@@ -196,7 +273,12 @@ public interface CloudServersClient extends Closeable {
* (e.g. keepalived) can then be used within the servers to perform health checks and
* manage IP failover.
*/
- void shareIp(String addressToShare, int serverToTosignBindressTo, int sharedIpGroup, boolean configureServer);
+ @PUT
+ @Path("/servers/{id}/ips/public/{address}")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"shareIp\":%7B\"sharedIpGroupId\":{sharedIpGroupId},\"configureServer\":{configureServer}%7D%7D")
+ void shareIp(@PathParam("address") String addressToShare, @PathParam("id") int serverToTosignBindressTo,
+ @PayloadParam("sharedIpGroupId") int sharedIpGroup, @PayloadParam("configureServer") boolean configureServer);
/**
* This operation removes a shared IP address from the specified server.
@@ -207,7 +289,10 @@ public interface CloudServersClient extends Closeable {
* @param serverToTosignBindressTo
* @return
*/
- void unshareIp(String addressToShare, int serverToTosignBindressTo);
+ @DELETE
+ @Path("/servers/{id}/ips/public/{address}")
+ @Fallback(VoidOnNotFoundOr404.class)
+ void unshareIp(@PathParam("address") String addressToShare, @PathParam("id") int serverToTosignBindressTo);
/**
* This operation allows you to change the administrative password.
@@ -215,7 +300,11 @@ public interface CloudServersClient extends Closeable {
* Status Transition: ACTIVE - PASSWORD - ACTIVE
*
*/
- void changeAdminPass(int id, String adminPass);
+ @PUT
+ @Path("/servers/{id}")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"server\":%7B\"adminPass\":\"{adminPass}\"%7D%7D")
+ void changeAdminPass(@PathParam("id") int id, @PayloadParam("adminPass") String adminPass);
/**
* This operation allows you to update the name of the server. This operation changes the name of
@@ -224,7 +313,11 @@ public interface CloudServersClient extends Closeable {
* Status Transition: ACTIVE - PASSWORD - ACTIVE
*
*/
- void renameServer(int id, String newName);
+ @PUT
+ @Path("/servers/{id}")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"server\":%7B\"name\":\"{name}\"%7D%7D")
+ void renameServer(@PathParam("id") int id, @PayloadParam("name") String newName);
/**
*
@@ -233,6 +326,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/flavors")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Flavor> listFlavors(ListOptions... options);
/**
@@ -242,7 +341,13 @@ public interface CloudServersClient extends Closeable {
* @return null, if the flavor is not found
* @see Flavor
*/
- Flavor getFlavor(int id);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/flavors/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ Flavor getFlavor(@PathParam("id") int id);
/**
*
@@ -251,6 +356,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/images")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<Image> listImages(ListOptions... options);
/**
@@ -261,7 +372,13 @@ public interface CloudServersClient extends Closeable {
*
* @see Image
*/
- Image getImage(int id);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @Fallback(NullOnNotFoundOr404.class)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/images/{id}")
+ Image getImage(@PathParam("id") int id);
/**
*
@@ -273,7 +390,10 @@ public interface CloudServersClient extends Closeable {
* @return false if the image is not found
* @see Image
*/
- boolean deleteImage(int id);
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/images/{id}")
+ boolean deleteImage(@PathParam("id") int id);
/**
*
@@ -291,11 +411,17 @@ public interface CloudServersClient extends Closeable {
* Note: At present, image creation is an asynchronous operation, so coordinating the creation
* with data quiescence, etc. is currently not possible.
*
- * @throws ResourceNotFoundException
- * if the server is not found
+ * @throws ResourceNotFoundException if the server is not found
* @see Image
*/
- Image createImageFromServer(String imageName, int serverId);
+ @POST
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/images")
+ @Produces(APPLICATION_JSON)
+ @Payload("%7B\"image\":%7B\"serverId\":{serverId},\"name\":\"{name}\"%7D%7D")
+ Image createImageFromServer(@PayloadParam("name") String imageName, @PayloadParam("serverId") int serverId);
/**
*
@@ -304,6 +430,12 @@ public interface CloudServersClient extends Closeable {
* in order to retrieve all details, pass the option {@link ListOptions#withDetails()
* withDetails()}
*/
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/shared_ip_groups")
+ @Fallback(EmptySetOnNotFoundOr404.class)
Set<SharedIpGroup> listSharedIpGroups(ListOptions... options);
/**
@@ -314,7 +446,13 @@ public interface CloudServersClient extends Closeable {
*
* @see SharedIpGroup
*/
- SharedIpGroup getSharedIpGroup(int id);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/shared_ip_groups/{id}")
+ @Fallback(NullOnNotFoundOr404.class)
+ SharedIpGroup getSharedIpGroup(@PathParam("id") int id);
/**
* This operation creates a new shared IP group. Please note, all responses to requests for
@@ -322,7 +460,14 @@ public interface CloudServersClient extends Closeable {
* can be created empty or can be initially populated with a single server. Use
* {@link CreateSharedIpGroupOptions} to specify an server.
*/
- SharedIpGroup createSharedIpGroup(String name, CreateSharedIpGroupOptions... options);
+ @POST
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/shared_ip_groups")
+ @MapBinder(CreateSharedIpGroupOptions.class)
+ SharedIpGroup createSharedIpGroup(@PayloadParam("name") String name,
+ CreateSharedIpGroupOptions... options);
/**
* This operation deletes the specified shared IP group. This operation will ONLY succeed if 1)
@@ -332,15 +477,22 @@ public interface CloudServersClient extends Closeable {
* @return false if the shared ip group is not found
* @see SharedIpGroup
*/
- boolean deleteSharedIpGroup(int id);
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/shared_ip_groups/{id}")
+ boolean deleteSharedIpGroup(@PathParam("id") int id);
/**
* List the backup schedule for the specified server
*
- * @throws ResourceNotFoundException
- * , if the server doesn't exist
+ * @throws ResourceNotFoundException, if the server doesn't exist
*/
- BackupSchedule getBackupSchedule(int serverId);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/backup_schedule")
+ BackupSchedule getBackupSchedule(@PathParam("id") int serverId);
/**
* Delete backup schedule for the specified server.
@@ -349,33 +501,55 @@ public interface CloudServersClient extends Closeable {
*
* @return false if the schedule is not found
*/
- boolean deleteBackupSchedule(int serverId);
+ @DELETE
+ @Fallback(FalseOnNotFoundOr404.class)
+ @Path("/servers/{id}/backup_schedule")
+ boolean deleteBackupSchedule(@PathParam("id") int serverId);
/**
* Enable/update the backup schedule for the specified server
*
*/
- void replaceBackupSchedule(int id, BackupSchedule backupSchedule);
+ @POST
+ @Path("/servers/{id}/backup_schedule")
+ void replaceBackupSchedule(@PathParam("id") int id,
+ @BinderParam(BindBackupScheduleToJsonPayload.class) BackupSchedule backupSchedule);
/**
* List all server addresses
*
* returns empty set if the server doesn't exist
*/
- Addresses getAddresses(int serverId);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/ips")
+ Addresses getAddresses(@PathParam("id") int serverId);
/**
* List all public server addresses
*
* returns empty set if the server doesn't exist
*/
- Set<String> listPublicAddresses(int serverId);
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/ips/public")
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<String> listPublicAddresses(@PathParam("id") int serverId);
/**
* List all private server addresses
*
* returns empty set if the server doesn't exist
*/
- Set<String> listPrivateAddresses(int serverId);
-
+ @GET
+ @Unwrap
+ @Consumes(APPLICATION_JSON)
+ @QueryParams(keys = "format", values = "json")
+ @Path("/servers/{id}/ips/private")
+ @Fallback(EmptySetOnNotFoundOr404.class)
+ Set<String> listPrivateAddresses(@PathParam("id") int serverId);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
----------------------------------------------------------------------
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 44d9ec4..44cbb95 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
@@ -48,10 +48,6 @@ import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
-/**
- * Configures the {@link CloudServersComputeServiceContext}; requires {@link BaseComputeService}
- * bound.
- */
public class CloudServersComputeServiceContextModule extends
ComputeServiceAdapterContextModule<Server, Flavor, org.jclouds.cloudservers.domain.Image, Location> {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
new file mode 100644
index 0000000..71aa0a6
--- /dev/null
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersHttpApiModule.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudservers.config;
+
+import static com.google.common.base.Suppliers.memoizeWithExpiration;
+import static org.jclouds.util.Suppliers2.getLastValueInMap;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cloudservers.CloudServersClient;
+import org.jclouds.cloudservers.handlers.ParseCloudServersErrorFromHttpResponse;
+import org.jclouds.date.TimeStamp;
+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.services.Compute;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.rest.config.HttpApiModule;
+
+import com.google.common.base.Supplier;
+import com.google.inject.Provides;
+
+@ConfiguresHttpApi
+public class CloudServersHttpApiModule extends HttpApiModule<CloudServersClient> {
+
+ @Override
+ protected void configure() {
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ super.configure();
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseCloudServersErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseCloudServersErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseCloudServersErrorFromHttpResponse.class);
+ }
+
+ @Override
+ protected void installLocations() {
+ super.installLocations();
+ install(new AuthenticationServiceModule());
+ }
+
+ @Provides
+ @Singleton
+ @Compute
+ protected Supplier<URI> provideCloudServers(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
+ return getLastValueInMap(factory.createForApiTypeAndVersion("cloudServers", apiVersion));
+ }
+
+ // TODO: see if we still need this.
+ @Provides
+ @Singleton
+ @TimeStamp
+ protected Supplier<Date> provideCacheBusterDate() {
+ return memoizeWithExpiration(new Supplier<Date>() {
+ public Date get() {
+ return new Date();
+ }
+ }, 1, TimeUnit.SECONDS);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/e3ada5b7/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
deleted file mode 100644
index 82609b7..0000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.cloudservers.config;
-
-import static com.google.common.base.Suppliers.memoizeWithExpiration;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-import javax.inject.Singleton;
-
-import org.jclouds.cloudservers.CloudServersAsyncClient;
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.handlers.ParseCloudServersErrorFromHttpResponse;
-import org.jclouds.date.TimeStamp;
-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.services.Compute;
-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.inject.Provides;
-
-@ConfiguresRestClient
-public class CloudServersRestClientModule extends RestClientModule<CloudServersClient, CloudServersAsyncClient> {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(Iso8601DateAdapter.class);
- super.configure();
- }
-
- @Override
- protected void bindErrorHandlers() {
- bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseCloudServersErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseCloudServersErrorFromHttpResponse.class);
- bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseCloudServersErrorFromHttpResponse.class);
- }
-
- @Override
- protected void installLocations() {
- super.installLocations();
- install(new AuthenticationServiceModule());
- }
-
- @Provides
- @Singleton
- @Compute
- protected Supplier<URI> provideCloudServers(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
- return getLastValueInMap(factory.createForApiTypeAndVersion("cloudServers", apiVersion));
- }
-
- // TODO: see if we still need this.
- @Provides
- @Singleton
- @TimeStamp
- protected Supplier<Date> provideCacheBusterDate() {
- return memoizeWithExpiration(new Supplier<Date>() {
- public Date get() {
- return new Date();
- }
- }, 1, TimeUnit.SECONDS);
- }
-}