Updated Branches: refs/heads/master de633a65d -> dd2b5a68f
Clouddatabases javadocs fixes Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/commit/dd2b5a68 Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/tree/dd2b5a68 Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/diff/dd2b5a68 Branch: refs/heads/master Commit: dd2b5a68fd184efbdcb9ccedbee37eb922efdc6a Parents: de633a6 Author: Zack Shoylev <[email protected]> Authored: Thu Jul 25 16:23:25 2013 -0500 Committer: Everett Toews <[email protected]> Committed: Sat Jul 27 21:05:41 2013 -0500 ---------------------------------------------------------------------- .../jclouds/openstack/trove/v1/TroveApi.java | 4 +- .../openstack/trove/v1/domain/Flavor.java | 6 +-- .../openstack/trove/v1/domain/Instance.java | 44 ++++++++++---------- .../jclouds/openstack/trove/v1/domain/User.java | 32 +++++++------- .../trove/v1/features/DatabaseApi.java | 7 ++-- .../openstack/trove/v1/features/FlavorApi.java | 12 +++--- .../trove/v1/features/InstanceApi.java | 38 +++++++++-------- .../openstack/trove/v1/features/UserApi.java | 42 ++++++++++--------- .../trove/v1/predicates/InstancePredicates.java | 17 ++++++-- .../openstack/trove/v1/utils/TroveUtils.java | 21 ++++++---- 10 files changed, 125 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/TroveApi.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/TroveApi.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/TroveApi.java index 2154c30..cd193b9 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/TroveApi.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/TroveApi.java @@ -41,6 +41,8 @@ import com.google.inject.Provides; */ public interface TroveApi extends Closeable{ /** + * Provides a set of all zones available. + * * @return the Zone codes configured */ @Provides @@ -78,7 +80,7 @@ public interface TroveApi extends Closeable{ @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** - * Provides the Tenant + * Provides the Tenant. */ @Provides Optional<Tenant> getCurrentTenantId(); http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Flavor.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Flavor.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Flavor.java index 17a97e5..df31ac8 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Flavor.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Flavor.java @@ -49,21 +49,21 @@ public class Flavor implements Comparable<Flavor>{ } /** - * @return the id of this flavor + * @return the id of this flavor. */ public int getId() { return this.id; } /** - * @return the name of this flavor + * @return the name of this flavor. */ public String getName() { return this.name.orNull(); } /** - * @return the RAM amount for this flavor + * @return the RAM amount for this flavor. */ public int getRam() { return this.ram; http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Instance.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Instance.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Instance.java index 0ec874b..cf6616b 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Instance.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/Instance.java @@ -58,14 +58,14 @@ public class Instance implements Comparable<Instance>{ } /** - * @return the id of this instance + * @return the id of this instance. */ public String getId() { return this.id; } /** - * @return the name of this instance + * @return the name of this instance. * @see Instance.Builder#name(String) */ public String getName() { @@ -73,7 +73,7 @@ public class Instance implements Comparable<Instance>{ } /** - * @return the flavor of this instance + * @return the flavor of this instance. * @see Instance.Builder#flavor(Flavor) */ public Flavor getFlavor() { @@ -81,7 +81,7 @@ public class Instance implements Comparable<Instance>{ } /** - * @return the volume size for this instance in gigabytes (GB) + * @return the volume size for this instance in gigabytes (GB). * @see Instance.Builder#size(int) */ public int getSize() { @@ -89,7 +89,7 @@ public class Instance implements Comparable<Instance>{ } /** - * @return the status for this instance + * @return the status for this instance. * @see Instance.Builder#status(Instance.Status) */ public Status getStatus() { @@ -97,7 +97,7 @@ public class Instance implements Comparable<Instance>{ } /** - * @return the Links for this instance + * @return the Links for this instance. * @see Instance.Builder#links(ImmutableList) */ public List<Link> getLinks() { @@ -105,7 +105,7 @@ public class Instance implements Comparable<Instance>{ } /** - * @return the hostname of this instance. The hostname is null unless this Instance was obtained with {@link InstanceApi#get(String)} + * @return the hostname of this instance. The hostname is null unless this Instance was obtained with {@link InstanceApi#get(String)}. * @see Instance.Builder#hostname(String) */ public String getHostname() { @@ -113,7 +113,7 @@ public class Instance implements Comparable<Instance>{ } /** - * Lists possible Instance status + * Lists possible Instance status. * @author zack-shoylev * */ @@ -143,7 +143,7 @@ public class Instance implements Comparable<Instance>{ */ SHUTDOWN, /** - * Unrecognized status response + * Unrecognized status response. */ UNRECOGNIZED; @@ -206,8 +206,8 @@ public class Instance implements Comparable<Instance>{ protected String hostname; /** - * @param id The id of this instance - * @return The builder object + * @param id The id of this instance. + * @return The builder object. * @see Instance#getId() */ public Builder id(String id) { @@ -216,8 +216,8 @@ public class Instance implements Comparable<Instance>{ } /** - * @param name The name of this instance - * @return The builder object + * @param name The name of this instance. + * @return The builder object. * @see Instance#getName() */ public Builder name(String name) { @@ -227,7 +227,7 @@ public class Instance implements Comparable<Instance>{ /** * @param size Specifies the volume size in gigabytes (GB). - * @return The builder object + * @return The builder object. * @see Instance#getSize() */ public Builder size(int size) { @@ -237,7 +237,7 @@ public class Instance implements Comparable<Instance>{ /** * @param flavor The Flavor of this instance as specified in the response from the List Flavors API call. - * @return The builder object + * @return The builder object. * @see Instance#getFlavor() */ public Builder flavor(Flavor flavor) { @@ -246,8 +246,8 @@ public class Instance implements Comparable<Instance>{ } /** - * @param status The status of this instance - * @return The builder object + * @param status The status of this instance. + * @return The builder object. * @see Instance#getStatus() */ public Builder status(Status status) { @@ -256,8 +256,8 @@ public class Instance implements Comparable<Instance>{ } /** - * @param links The links to this instance - * @return The builder object + * @param links The links to this instance. + * @return The builder object. * @see Instance#getLinks() */ public Builder links(ImmutableList<Link> links) { @@ -266,8 +266,8 @@ public class Instance implements Comparable<Instance>{ } /** - * @param name The hostname of this instance - * @return The builder object + * @param name The hostname of this instance. + * @return The builder object. * @see Instance#getHostname() */ public Builder hostname(String hostname) { @@ -277,7 +277,7 @@ public class Instance implements Comparable<Instance>{ /** * - * @return A new Instance object + * @return A new Instance object. */ public Instance build() { return new Instance(id, name, flavor, new Volume(size), status, links, hostname); http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/User.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/User.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/User.java index 8bb43ac..965e6e0 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/User.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/domain/User.java @@ -65,7 +65,7 @@ public class User implements Comparable<User>{ } else { // Using List<Map<String,String>> as the internal representation makes it easy to serialize properly - // with less code; this code is to present databases as List<String> to the user + // with less code; this code is to present databases as List<String> to the user. List<Map<String,String>> databaseList = Lists.newArrayList(); for(String databaseName : databases) { Map<String,String> singleDatabase = Maps.newHashMap(); @@ -86,7 +86,7 @@ public class User implements Comparable<User>{ } /** - * @return the password for this user + * @return the password for this user. * @see User.Builder#password(String) */ public String getPassword() { @@ -94,7 +94,7 @@ public class User implements Comparable<User>{ } /** - * @return the host for this user + * @return the host for this user. * @see User.Builder#host(String) */ public String getHost() { @@ -102,7 +102,7 @@ public class User implements Comparable<User>{ } /** - * @return a unique identifier for this user. In most cases, this is just the name. If the user is restricted to connections from a specific host, the hostname must be appended to the user name with a "@" + * @return a unique identifier for this user. In most cases, this is just the name. If the user is restricted to connections from a specific host, the hostname must be appended to the user name with a "@". */ public String getIdentifier() { if(host==null || "%".equals(host)) @@ -112,7 +112,7 @@ public class User implements Comparable<User>{ } /** - * @return the databases for this user + * @return the databases for this user. * @see User.Builder#databases(String) */ public List<String> getDatabases() { @@ -167,8 +167,8 @@ public class User implements Comparable<User>{ protected Set<String> databases; /** - * @param name The name of this user - * @return The builder object + * @param name The name of this user. + * @return The builder object. * @see User#getName() */ public Builder name(String name) { @@ -177,8 +177,8 @@ public class User implements Comparable<User>{ } /** - * @param name The password for this user - * @return The builder object + * @param name The password for this user. + * @return The builder object. * @see User#getPassword() */ public Builder password(String password) { @@ -187,8 +187,12 @@ public class User implements Comparable<User>{ } /** - * @param host Specifies the host from which a user is allowed to connect to the database. Possible values are a string containing an IPv4 address or "%" to allow connecting from any host. Refer to Section 3.11.1, âUser Access Restriction by Hostâ for details. If host is not specified, it defaults to "%". - * @return The builder object + * @param host Specifies the host from which a user is allowed to connect to the database. + * Possible values are a string containing an IPv4 address or "%" to allow connecting from any host. + * Refer to Section 3.11.1, âUser Access Restriction by Hostâ in the Rackspace Cloud Databases Developer Guide for details. + * If host is not specified, it defaults to "%". + * @return The builder object. + * @see <a href="http://docs.rackspace.com/cdb/api/v1.0/cdb-devguide/content/user_access_restrict_by_host-dle387.html">User Access Restriction by Host</a> * @see User#getHost() */ public Builder host(String host) { @@ -197,8 +201,8 @@ public class User implements Comparable<User>{ } /** - * @param name The databases for this user - * @return The builder object + * @param name The databases for this user. + * @return The builder object. * @see User#getDatabases() */ public Builder databases(Set<String> databases) { @@ -208,7 +212,7 @@ public class User implements Comparable<User>{ /** * - * @return A new User object + * @return A new User object. */ public User build() { return new User(name, password, host, databases); http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/DatabaseApi.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/DatabaseApi.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/DatabaseApi.java index 0c854a1..cf6c869 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/DatabaseApi.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/DatabaseApi.java @@ -66,13 +66,12 @@ public interface DatabaseApi { boolean create(@PayloadParam("database") String database); /** - * Create database * This operation creates a new database within the specified instance. * * @param database The name of the database to be created * @param character_set Optional. Set of symbols and encodings. The default character set is utf8. * @param collate Optional. Set of rules for comparing characters in a character set. The default value for collate is utf8_general_ci. - * @return true if successful + * @return true if successful. */ @Named("database:create") @POST @@ -86,7 +85,7 @@ public interface DatabaseApi { * This operation deletes the specified database for the specified database instance. * * @param databaseName The name for the specified database. - * @return true if successful + * @return true if successful. */ @Named("databases:delete") @DELETE @@ -98,7 +97,7 @@ public interface DatabaseApi { /** * This operation lists the databases for the specified database instance. * - * @return The list of Databases + * @return The list of Databases. */ @Named("database:list") @GET http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/FlavorApi.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/FlavorApi.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/FlavorApi.java index 31e445b..f32f059 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/FlavorApi.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/FlavorApi.java @@ -52,7 +52,7 @@ public interface FlavorApi { /** * Returns a summary list of Flavors. * - * @return The list of Flavors + * @return The list of Flavors. */ @Named("flavor:list") @GET @@ -63,9 +63,10 @@ public interface FlavorApi { FluentIterable<Flavor> list(); /** - * Returns a Flavor by id + * Returns a Flavor by id. * - * @return Flavor + * @param flavorId The id of the Flavor. + * @return Flavor The Flavor for the specified id. */ @Named("flavors:get/{id}") @GET @@ -76,9 +77,10 @@ public interface FlavorApi { Flavor get(@PathParam("id") int flavorId); /** - * Returns a list of Flavors by Account ID (Tenant Id) + * Returns a list of Flavors by Account ID (Tenant Id). * - * @return The list of Flavors for Account/Tenant Id + * @param flavorId The id of the tenant. + * @return The list of Flavors for Account/Tenant Id. */ @Named("flavors:get/{id}") @GET http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/InstanceApi.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/InstanceApi.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/InstanceApi.java index 7a285cf..624115b 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/InstanceApi.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/InstanceApi.java @@ -59,11 +59,11 @@ import com.google.common.collect.FluentIterable; public interface InstanceApi { /** - * Same as {@link #create(String, int, String)} but accept an integer Flavor ID + * Same as {@link #create(String, int, String)} but accept an integer Flavor ID. * - * @param flavor The flavor ID - * @param volumeSize The size in GB of the instance volume - * @param name The name of the instance + * @param flavor The flavor ID. + * @param volumeSize The size in GB of the instance volume. + * @param name The name of the instance. * @return The instance created. * * @see InstanceApi#create(String, int, String) @@ -77,11 +77,11 @@ public interface InstanceApi { Instance create(@PayloadParam("flavorRef") int flavor, @PayloadParam("size") int volumeSize, @PayloadParam("name") String name); /** - * Create a database instance by flavor type and volume size + * Create a database instance by flavor type and volume size. * - * @param flavor The flavor URL or flavor id as string - * @param volumeSize The size in GB of the instance volume - * @param name The name of the instance + * @param flavor The flavor URL or flavor id as string. + * @param volumeSize The size in GB of the instance volume. + * @param name The name of the instance. * @return The instance created. */ @Named("instance:create") @@ -93,9 +93,10 @@ public interface InstanceApi { Instance create(@PayloadParam("flavorRef") String flavor, @PayloadParam("size") int volumeSize, @PayloadParam("name") String name); /** - * Deletes an Instance by id + * Deletes an Instance by id. * - * @return true if successful + * @param instanceId The instance id. + * @return true if successful. */ @Named("instances:delete/{id}") @DELETE @@ -105,9 +106,10 @@ public interface InstanceApi { boolean delete(@PathParam("id") String instanceId); /** - * Enables root for an instance + * Enables root for an instance. * - * @return String password + * @param instanceId The instance id. + * @return String The password for the root user. */ @Named("instances/{id}/root") @POST @@ -118,10 +120,11 @@ public interface InstanceApi { String enableRoot(@PathParam("id") String instanceId); /** - * Checks to see if root is enabled for an instance + * Checks to see if root is enabled for an instance. * + * @param instanceId The instance id. * @throws ResourceNotFoundException - * @return boolean + * @return boolean True if root is enabled. */ @Named("instances/{id}/root") @GET @@ -133,7 +136,7 @@ public interface InstanceApi { /** * Returns a summary list of Instances. * - * @return The list of Instances + * @return The list of Instances. */ @Named("instance:list") @GET @@ -144,9 +147,10 @@ public interface InstanceApi { FluentIterable<Instance> list(); /** - * Returns an Instance by id + * Returns an Instance by id. * - * @return Instance or Null on not found + * @param instanceId The instance id. + * @return Instance or Null on not found. */ @Named("instances:get/{id}") @GET http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/UserApi.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/UserApi.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/UserApi.java index 3736660..c153358 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/UserApi.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/features/UserApi.java @@ -63,12 +63,14 @@ import com.google.common.collect.FluentIterable; public interface UserApi { /** - * Create database users + * Create database users. * A user is granted all privileges on the specified databases. * The following user name is reserved and cannot be used for creating users: root. + * This method can be used to create users with access restrictions by host * - * @param users List of users to be created - * @return true if successful + * @param users List of users to be created. + * @return true if successful. + * @see <a href="http://docs.rackspace.com/cdb/api/v1.0/cdb-devguide/content/user_access_restrict_by_host-dle387.html">User Access Restriction by Host</a> */ @Named("user:create") @POST @@ -79,12 +81,12 @@ public interface UserApi { boolean create(@PayloadParam("users") Set<User> users); /** - * Create a database user by name, password, and database name. Simpler overload for {@link #create(String, Set)} + * Create a database user by name, password, and database name. Simpler overload for {@link #create(String, Set)}. * * @param userName Name of the user for the database. * @param password User password for database access. * @param databaseName Name of the database that the user can access. - * @return true if successful + * @return true if successful. */ @Named("user:create") @POST @@ -95,13 +97,13 @@ public interface UserApi { boolean create(@PayloadParam("name") String userName, @PayloadParam("password") String password, @PayloadParam("databaseName") String databaseName); /** - * Create a database user by name, password, and database name. Simpler overload for {@link #create(String, Set)} + * Create a database user by name, password, and database name. Simpler overload for {@link #create(String, Set)}. * * @param userName Name of the user for the database. * @param password User password for database access. * @param host Specifies the host from which a user is allowed to connect to the database. Possible values are a string containing an IPv4 address or "%" to allow connecting from any host. Refer to Section 3.11.1, âUser Access Restriction by Hostâ for details. If host is not specified, it defaults to "%". * @param databaseName Name of the database that the user can access. - * @return true if successful + * @return true if successful. */ @Named("user:create") @POST @@ -117,7 +119,7 @@ public interface UserApi { * * @param userName The name of the specified user. * @param databases List of the databases that the user should be granted access to. - * @return true if successful + * @return true if successful. */ @Named("user:grant") @PUT @@ -128,12 +130,12 @@ public interface UserApi { boolean grant(@PathParam("name") String userName, @PayloadParam("databases") List<String> databases); /** - * This operation grants access for the specified user to a database for the specified instance. Simpler overload for {@link #create(String, Set)} + * This operation grants access for the specified user to a database for the specified instance. Simpler overload for {@link #create(String, Set)}. * The user is granted all privileges. * * @param userName Name of the user for the database. * @param databaseName Name of the database that the user can access. - * @return true if successful + * @return true if successful. */ @Named("user:grant") @PUT @@ -149,7 +151,7 @@ public interface UserApi { * * @param userName Name of the user for the database. * @param databaseName Name of the database that the user can access. - * @return true if successful + * @return true if successful. */ @Named("user:revoke") @DELETE @@ -162,7 +164,7 @@ public interface UserApi { * This operation deletes the specified user for the specified database instance. * * @param userName The name for the specified user. - * @return true if successful + * @return true if successful. */ @Named("users:delete/{name}") @DELETE @@ -175,7 +177,7 @@ public interface UserApi { * This operation lists the users in the specified database instance. * This operation does not return the system users (database administrators that administer the health of the database). Also, this operation returns the "root" user only if "root" user has been enabled. * - * @return The list of Users + * @return The list of Users. */ @Named("user:list") @GET @@ -186,11 +188,11 @@ public interface UserApi { FluentIterable<User> list(); /** - * This operation shows a list of all databases a user has access to. + * This operation shows a list of all databases to which a user has access. * * @param instanceId The instance ID for the specified database instance. * @param userName The name for the specified user. - * @return The list of Users + * @return The list of Users. */ @Named("user:getDatabaseList/{name}") @GET @@ -201,10 +203,10 @@ public interface UserApi { FluentIterable<String> getDatabaseList(@PathParam("name") String userName); /** - * Returns a User by identifier + * Returns a User by identifier. * * @param name The name or identifier for the specified user. - * @return User or Null on not found + * @return User or Null on not found. */ @Named("user:get/{name}") @GET @@ -217,11 +219,11 @@ public interface UserApi { User get(@PathParam("name") String name); /** - * Returns a User by name and allowed host + * Returns a User by name and allowed host. * * @param name The name for the specified user. - * @param host The associated hostname - * @return User or Null on not found + * @param host The associated hostname. + * @return User or Null on not found. */ @Named("user:get/{name}@{hostname}") @GET http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/predicates/InstancePredicates.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/predicates/InstancePredicates.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/predicates/InstancePredicates.java index cab20eb..6149eff 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/predicates/InstancePredicates.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/predicates/InstancePredicates.java @@ -43,7 +43,7 @@ import com.google.common.base.Predicate; * } * </pre> * - * You can also use the static convenience methods as so. + * You can also use the static convenience methods as follows. * * <pre> * {@code @@ -73,7 +73,7 @@ public class InstancePredicates { * Wait until an Instance no longer exists. * * @param instanceApi The InstanceApi in the zone where your Instance resides. - * @return RetryablePredicate That will check the whether the Instance exists + * @return RetryablePredicate That will check whether the Instance exists. * every 5 seconds for a maxiumum of 10 minutes. */ public static Predicate<Instance> awaitDeleted(InstanceApi instanceApi) { @@ -81,6 +81,15 @@ public class InstancePredicates { return retry(deletedPredicate, 600, 5, 5, SECONDS); } + /** + * Wait until instance is in the status specified. + * + * @param instanceApi The InstanceApi in the zone where your Instance resides. + * @param status Wait until instance in in this status. + * @param maxWaitInSec Maximum time to wait. + * @param periodInSec Interval between retries. + * @return RetryablePredicate That will check whether the Instance exists. + */ public static Predicate<Instance> awaitStatus( InstanceApi instanceApi, Instance.Status status, long maxWaitInSec, long periodInSec) { StatusUpdatedPredicate statusPredicate = new StatusUpdatedPredicate(instanceApi, status); @@ -97,7 +106,7 @@ public class InstancePredicates { } /** - * @return boolean Return true when the instance reaches status, false otherwise + * @return boolean Return true when the instance reaches status, false otherwise. */ @Override public boolean apply(Instance instance) { @@ -123,7 +132,7 @@ public class InstancePredicates { } /** - * @return boolean Return true when the snapshot is deleted, false otherwise + * @return boolean Return true when the snapshot is deleted, false otherwise. */ @Override public boolean apply(Instance instance) { http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/dd2b5a68/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/utils/TroveUtils.java ---------------------------------------------------------------------- diff --git a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/utils/TroveUtils.java b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/utils/TroveUtils.java index df674d8..dbc17f2 100644 --- a/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/utils/TroveUtils.java +++ b/openstack-trove/src/main/java/org/jclouds/openstack/trove/v1/utils/TroveUtils.java @@ -32,8 +32,7 @@ import com.google.common.util.concurrent.Uninterruptibles; /** * @author Zack Shoylev * - * Helper methods for dealing with instances that get created with - * errors + * Helper methods for dealing with instances that get created with errors. */ public class TroveUtils { private final TroveApi api; @@ -45,19 +44,19 @@ public class TroveUtils { } /** - * Create an ACTIVE operational instance + * Create an ACTIVE operational instance. * * @see InstanceApi#create(String, int, String) * * @param zone - * The instance zone or region + * The instance zone or region. * @param name - * Instance name + * Instance name. * @param flavorId - * Id of the flavor to be used when creating the instance + * Id of the flavor to be used when creating the instance. * @param size - * Size of the instance - * @return Instance object in active state or NULL + * Size of the instance. + * @return Instance object in active state or NULL. */ public Instance getWorkingInstance(String zone, String name, String flavorId, int size) { InstanceApi instanceApi = api.getInstanceApiForZone(zone); @@ -84,6 +83,12 @@ public class TroveUtils { return null; } + /** + * This will return a small working instance. + * + * @param zone The zone where the instance should be created. + * @return A working database instance. + */ public Instance getWorkingInstance(String zone) { return getWorkingInstance(zone, UUID.randomUUID().toString(), "1", 1); }
