You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ev...@apache.org on 2013/05/31 17:39:12 UTC

git commit: Add support for Database in Reddwarf https://issues.apache.org/jira/browse/JCLOUDS-34

Updated Branches:
  refs/heads/master ebb845c15 -> a0934bfb3


Add support for Database in Reddwarf
https://issues.apache.org/jira/browse/JCLOUDS-34


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/a0934bfb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/tree/a0934bfb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/diff/a0934bfb

Branch: refs/heads/master
Commit: a0934bfb398cd7b63c693ec6b7ef353a00042915
Parents: ebb845c
Author: zack-shoylev <za...@rackspace.com>
Authored: Fri May 24 11:59:20 2013 -0500
Committer: Everett Toews <ev...@rackspace.com>
Committed: Fri May 31 11:36:43 2013 -0400

----------------------------------------------------------------------
 .../jclouds/openstack/reddwarf/v1/RedDwarfApi.java |    9 +
 .../v1/binders/BindCreateDatabaseToJson.java       |   58 ++
 .../reddwarf/v1/binders/BindCreateUserToJson.java  |   50 +-
 .../openstack/reddwarf/v1/domain/Flavor.java       |  269 +++++-----
 .../openstack/reddwarf/v1/domain/Instance.java     |  456 +++++++-------
 .../jclouds/openstack/reddwarf/v1/domain/User.java |  298 +++++-----
 .../reddwarf/v1/features/DatabaseApi.java          |  110 ++++
 .../openstack/reddwarf/v1/features/UserApi.java    |   11 +-
 .../v1/functions/ParseDatabaseListForUser.java     |   34 +-
 .../functions/ParsePasswordFromRootedInstance.java |   28 +-
 .../v1/features/DatabaseApiExpectTest.java         |  161 +++++
 .../reddwarf/v1/features/DatabaseApiLiveTest.java  |  120 ++++
 .../reddwarf/v1/features/UserApiExpectTest.java    |    4 +-
 .../reddwarf/v1/features/UserApiLiveTest.java      |   16 +-
 .../test/resources/database_create_request.json    |    9 +
 .../resources/database_create_simple_request.json  |    7 +
 .../src/test/resources/database_list.json          |   19 +
 17 files changed, 1073 insertions(+), 586 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApi.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApi.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApi.java
index c045273..b5a5349 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApi.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApi.java
@@ -24,6 +24,7 @@ import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.location.Zone;
 import org.jclouds.location.functions.ZoneToEndpoint;
 import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
+import org.jclouds.openstack.reddwarf.v1.features.DatabaseApi;
 import org.jclouds.openstack.reddwarf.v1.features.FlavorApi;
 import org.jclouds.openstack.reddwarf.v1.features.InstanceApi;
 import org.jclouds.openstack.reddwarf.v1.features.UserApi;
@@ -69,6 +70,14 @@ public interface RedDwarfApi extends Closeable{
          @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
    
    /**
+    * Provides access to Database features.
+    */
+   @Delegate
+   @Path("/instances/{instanceId}")
+   DatabaseApi getDatabaseApiForInstanceInZone(@PathParam("instanceId") String instanceId, 
+         @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+   
+   /**
     * Provides the Tenant
     */
    @Provides 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateDatabaseToJson.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateDatabaseToJson.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateDatabaseToJson.java
new file mode 100644
index 0000000..0a959e6
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateDatabaseToJson.java
@@ -0,0 +1,58 @@
+/*
+ * 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.openstack.reddwarf.v1.binders;
+
+import java.util.Map;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
+
+/**
+ * @author Zack Shoylev
+ */
+public class BindCreateDatabaseToJson implements MapBinder {
+
+   @Inject
+   private BindToJsonPayload jsonBinder;
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Builder<String, String> databaseBuilder = ImmutableMap.builder();
+
+      databaseBuilder.put("name", (String) postParams.get("database"));
+
+      if (postParams.get("character_set") != null) {
+         databaseBuilder.put("character_set", (String) postParams.get("character_set"));
+      }
+      if (postParams.get("collate") != null) {
+         databaseBuilder.put("collate", (String) postParams.get("collate"));
+      }
+
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("databases", ImmutableSet.of(databaseBuilder.build())));
+   }
+
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("Create database is a POST operation");
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateUserToJson.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateUserToJson.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateUserToJson.java
index 11b8b6c..d03d5e4 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateUserToJson.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateUserToJson.java
@@ -33,31 +33,31 @@ import com.google.inject.Inject;
  */
 public class BindCreateUserToJson implements MapBinder {
 
-    @Inject
-    private BindToJsonPayload jsonBinder;
+   @Inject
+   private BindToJsonPayload jsonBinder;
 
-    @SuppressWarnings("unchecked")
-    @Override    
-    public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-        Set<User> users = Sets.newHashSet();
-        if( postParams.get("name") != null ) {
-            Set<String> databases = Sets.newHashSet();
-            databases.add((String) postParams.get("databaseName"));
-            User user = User.builder()
-                    .name((String) postParams.get("name"))
-                    .password((String) postParams.get("password"))
-                    .databases(databases)
-                    .build();
-            users.add(user);
-        }
-        else if( postParams.get("users") != null ) {
-            users = (Set<User>) postParams.get("users");
-        }
-        return jsonBinder.bindToRequest(request, ImmutableMap.of("users", users));
-    }
+   @SuppressWarnings("unchecked")
+   @Override    
+   public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+      Set<User> users = Sets.newHashSet();
+      if( postParams.get("name") != null ) {
+         Set<String> databases = Sets.newHashSet();
+         databases.add((String) postParams.get("databaseName"));
+         User user = User.builder()
+               .name((String) postParams.get("name"))
+               .password((String) postParams.get("password"))
+               .databases(databases)
+               .build();
+         users.add(user);
+      }
+      else if( postParams.get("users") != null ) {
+         users = (Set<User>) postParams.get("users");
+      }
+      return jsonBinder.bindToRequest(request, ImmutableMap.of("users", users));
+   }
 
-    @Override
-    public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
-        throw new IllegalStateException("Create user is a POST operation");
-    }    
+   @Override
+   public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+      throw new IllegalStateException("Create user is a POST operation");
+   }    
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Flavor.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Flavor.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Flavor.java
index 3872cb0..ff06a51 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Flavor.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Flavor.java
@@ -16,10 +16,11 @@
  */
 package org.jclouds.openstack.reddwarf.v1.domain;
 
-import static com.google.common.base.Preconditions.checkNotNull;
 import java.beans.ConstructorProperties;
 import java.util.List;
+
 import org.jclouds.openstack.v2_0.domain.Link;
+
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
 import com.google.common.base.Optional;
@@ -32,137 +33,137 @@ import com.google.common.collect.ImmutableList;
  */
 public class Flavor implements Comparable<Flavor>{
 
-    private final int id;
-    private final Optional<String> name;
-    private final int ram;
-    private final List<Link> links;
-
-    @ConstructorProperties({
-        "id", "name", "ram", "links"
-    })
-    protected Flavor(int id, String name, int ram, List<Link> links) {
-        this.id = checkNotNull(id);
-        this.name = Optional.fromNullable(name);
-        this.ram = ram;
-        this.links = links;
-    }
-
-    /**
-     * @return the id of this flavor
-     */
-    public int getId() {
-        return this.id;
-    }
-
-    /**
-     * @return the name of this flavor
-     */
-    public String getName() {
-        return this.name.orNull();
-    }
-
-    /**
-     * @return the RAM amount for this flavor
-     */
-    public int getRam() {
-        return this.ram;
-    }
-
-    /**
-     * @return the flavor links for this flavor. These are used during database instance creation.
-     */
-    public List<Link> getLinks() {
-        return this.links;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(id);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null || getClass() != obj.getClass()) return false;
-        Flavor that = Flavor.class.cast(obj);
-        return Objects.equal(this.id, that.id);
-    }
-
-    protected ToStringHelper string() {
-        return Objects.toStringHelper(this)
-                .add("id", id).add("name", name).add("ram", ram);
-    }
-
-    @Override
-    public String toString() {
-        return string().toString();
-    }
-
-    @Override
-    public int compareTo(Flavor that) {
-        if (that == null)
-            return 1;
-        if (this == that)
-            return 0;
-        return this.getId() > that.getId() ? +1 : this.getId() < this.getId() ? -1 : 0;
-    }
-
-    public static Builder builder() { 
-        return new Builder();
-    }
-
-    public Builder toBuilder() { 
-        return new Builder().fromFlavor(this);
-    }    
-    
-    public static class Builder {
-        protected int id;
-        protected String name;
-        protected int ram;
-        protected List<Link> links;
-
-        /** 
-         * @see Flavor#getId()
-         */
-        public Builder id(int id) {
-            this.id = id;
-            return this;
-        }
-
-        /** 
-         * @see Flavor#getName()
-         */
-        public Builder name(String name) {
-            this.name = name;
-            return this;
-        }
-
-        /** 
-         * @see Flavor#getRam()
-         */
-        public Builder ram(int ram) {
-            this.ram = ram;
-            return this;
-        }
-
-        /** 
-         * @see Flavor#getLinks()
-         */
-        public Builder links(List<Link> links) {
-            this.links = ImmutableList.copyOf(links);
-            return this;
-        }
-
-        public Flavor build() {
-            return new Flavor(id, name, ram, links);
-        }
-
-        public Builder fromFlavor(Flavor in) {
-            return this
-                    .id(in.getId())
-                    .name(in.getName())
-                    .ram(in.getRam())
-                    .links(in.getLinks());
-        }
-    }    
+   private final int id;
+   private final Optional<String> name;
+   private final int ram;
+   private final List<Link> links;
+
+   @ConstructorProperties({
+      "id", "name", "ram", "links"
+   })
+   protected Flavor(int id, String name, int ram, List<Link> links) {
+      this.id = id;
+      this.name = Optional.fromNullable(name);
+      this.ram = ram;
+      this.links = links;
+   }
+
+   /**
+    * @return the id of this flavor
+    */
+   public int getId() {
+      return this.id;
+   }
+
+   /**
+    * @return the name of this flavor
+    */
+   public String getName() {
+      return this.name.orNull();
+   }
+
+   /**
+    * @return the RAM amount for this flavor
+    */
+   public int getRam() {
+      return this.ram;
+   }
+
+   /**
+    * @return the flavor links for this flavor. These are used during database instance creation.
+    */
+   public List<Link> getLinks() {
+      return this.links;
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(id);
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this == obj) return true;
+      if (obj == null || getClass() != obj.getClass()) return false;
+      Flavor that = Flavor.class.cast(obj);
+      return Objects.equal(this.id, that.id);
+   }
+
+   protected ToStringHelper string() {
+      return Objects.toStringHelper(this)
+            .add("id", id).add("name", name).add("ram", ram);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   @Override
+   public int compareTo(Flavor that) {
+      if (that == null)
+         return 1;
+      if (this == that)
+         return 0;
+      return this.getId() > that.getId() ? +1 : this.getId() < this.getId() ? -1 : 0;
+   }
+
+   public static Builder builder() { 
+      return new Builder();
+   }
+
+   public Builder toBuilder() { 
+      return new Builder().fromFlavor(this);
+   }    
+
+   public static class Builder {
+      protected int id;
+      protected String name;
+      protected int ram;
+      protected List<Link> links;
+
+      /** 
+       * @see Flavor#getId()
+       */
+      public Builder id(int id) {
+         this.id = id;
+         return this;
+      }
+
+      /** 
+       * @see Flavor#getName()
+       */
+      public Builder name(String name) {
+         this.name = name;
+         return this;
+      }
+
+      /** 
+       * @see Flavor#getRam()
+       */
+      public Builder ram(int ram) {
+         this.ram = ram;
+         return this;
+      }
+
+      /** 
+       * @see Flavor#getLinks()
+       */
+      public Builder links(List<Link> links) {
+         this.links = ImmutableList.copyOf(links);
+         return this;
+      }
+
+      public Flavor build() {
+         return new Flavor(id, name, ram, links);
+      }
+
+      public Builder fromFlavor(Flavor in) {
+         return this
+               .id(in.getId())
+               .name(in.getName())
+               .ram(in.getRam())
+               .links(in.getLinks());
+      }
+   }    
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Instance.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Instance.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Instance.java
index 9b02215..bf386d7 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Instance.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/Instance.java
@@ -32,247 +32,247 @@ import com.google.common.collect.ImmutableList;
  * @author Zack Shoylev
  */
 public class Instance implements Comparable<Instance>{
-    
-    private final String id;
-    private final String name;
-    private final Flavor flavor;
-    private final Volume volume;
-    private final Status status;
-    private final List<Link> links;
 
-    @ConstructorProperties({
-        "id", "name", "flavor", "volume", "status", "links"
-    })
-    protected Instance(String id, String name, Flavor flavor, Volume volume, Status status, List<Link> links) {
-        this.id = checkNotNull(id, "id required");
-        this.name = name;
-        this.flavor = checkNotNull(flavor, "flavor required");
-        this.volume =  checkNotNull(volume, "volume required");
-        checkArgument(volume.getSize() > 0, "Size must be greater than 0");
-        this.status = checkNotNull(status, "status required");
-        this.links = checkNotNull(links, "links required");
-    }
+   private final String id;
+   private final String name;
+   private final Flavor flavor;
+   private final Volume volume;
+   private final Status status;
+   private final List<Link> links;
 
-    /**
-     * @return the id of this instance
-     */
-    public String getId() {
-        return this.id;
-    }
-    
-    /**
-     * @return the name of this instance
-     * @see Instance.Builder#name(String)
-     */
-    public String getName() {
-        return this.name;
-    }
+   @ConstructorProperties({
+      "id", "name", "flavor", "volume", "status", "links"
+   })
+   protected Instance(String id, String name, Flavor flavor, Volume volume, Status status, List<Link> links) {
+      this.id = checkNotNull(id, "id required");
+      this.name = name;
+      this.flavor = checkNotNull(flavor, "flavor required");
+      this.volume =  checkNotNull(volume, "volume required");
+      checkArgument(volume.getSize() > 0, "Size must be greater than 0");
+      this.status = checkNotNull(status, "status required");
+      this.links = checkNotNull(links, "links required");
+   }
 
-    /**
-     * @return the flavor of this instance
-     * @see Instance.Builder#flavor(Flavor)
-     */
-    public Flavor getFlavor() {
-        return this.flavor;
-    }
+   /**
+    * @return the id of this instance
+    */
+   public String getId() {
+      return this.id;
+   }
 
-    /**
-     * @return the volume size for this instance in gigabytes (GB)
-     * @see Instance.Builder#size(int)
-     */
-    public int getSize() {
-        return this.volume.getSize();
-    }
-    
-    /**
-     * @return the status for this instance
-     * @see Instance.Builder#status(Instance.Status)
-     */
-    public Status getStatus() {
-        return this.status;
-    }
-    
-    /**
-     * @return the Links for this instance
-     * @see Instance.Builder#links(ImmutableList)
-     */
-    public List<Link> getLinks() {
-        return this.links;
-    }
-    
-    /**
-     * Lists possible Instance status
-     * @author zack-shoylev
-     *
-     */
-    public enum Status {
-        /**
-         * The database instance is being provisioned.
-         * */
-        BUILD, 
-        /**
-         * The database instance is rebooting.
-         */
-        REBOOT,
-        /**
-         * The database instance is online and available to take requests.
-         * */
-        ACTIVE,
-        /**
-         * The database instance is unresponsive at the moment.
-         */
-        BLOCKED,
-        /**
-         * The database instance is being resized at the moment.
-         */
-        RESIZE,
-        /**
-         * The database instance is terminating services. Also, SHUTDOWN is returned if for any reason the instance is shut down but not the actual server.
-         */
-        SHUTDOWN, 
-        /**
-         * Unrecognized status response
-         */
-        UNRECOGNIZED;
+   /**
+    * @return the name of this instance
+    * @see Instance.Builder#name(String)
+    */
+   public String getName() {
+      return this.name;
+   }
 
-        public String value() {
-           return name();
-        }
+   /**
+    * @return the flavor of this instance
+    * @see Instance.Builder#flavor(Flavor)
+    */
+   public Flavor getFlavor() {
+      return this.flavor;
+   }
 
-        @Override
-        public String toString() {
-           return value();
-        }
+   /**
+    * @return the volume size for this instance in gigabytes (GB)
+    * @see Instance.Builder#size(int)
+    */
+   public int getSize() {
+      return this.volume.getSize();
+   }
 
-        public static Status fromValue(String status) {
-           try {
-              return valueOf(checkNotNull(status, "type"));
-           } catch (IllegalArgumentException e) {
-              return UNRECOGNIZED;
-           }
-        }
-     }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(id, name, volume.getSize(), flavor, status, links);
-    }
+   /**
+    * @return the status for this instance
+    * @see Instance.Builder#status(Instance.Status)
+    */
+   public Status getStatus() {
+      return this.status;
+   }
 
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null || getClass() != obj.getClass()) return false;
-        Instance that = Instance.class.cast(obj);
-        return Objects.equal(this.id, that.id);
-    }
+   /**
+    * @return the Links for this instance
+    * @see Instance.Builder#links(ImmutableList)
+    */
+   public List<Link> getLinks() {
+      return this.links;
+   }
 
-    protected ToStringHelper string() {
-        return Objects.toStringHelper(this)
-                .add("id", id).add("name", name).add("flavor", flavor).add("volume size", volume.getSize()).add("links", links);
-    }
+   /**
+    * Lists possible Instance status
+    * @author zack-shoylev
+    *
+    */
+   public enum Status {
+      /**
+       * The database instance is being provisioned.
+       * */
+      BUILD, 
+      /**
+       * The database instance is rebooting.
+       */
+      REBOOT,
+      /**
+       * The database instance is online and available to take requests.
+       * */
+      ACTIVE,
+      /**
+       * The database instance is unresponsive at the moment.
+       */
+      BLOCKED,
+      /**
+       * The database instance is being resized at the moment.
+       */
+      RESIZE,
+      /**
+       * The database instance is terminating services. Also, SHUTDOWN is returned if for any reason the instance is shut down but not the actual server.
+       */
+      SHUTDOWN, 
+      /**
+       * Unrecognized status response
+       */
+      UNRECOGNIZED;
 
-    @Override
-    public String toString() {
-        return string().toString();
-    }
+      public String value() {
+         return name();
+      }
 
-    public static Builder builder() { 
-        return new Builder();
-    }
+      @Override
+      public String toString() {
+         return value();
+      }
 
-    public Builder toBuilder() { 
-        return new Builder().fromInstance(this);
-    }
-    
-    public static class Builder {
-        protected String id;
-        protected String name;
-        protected int size;
-        protected Flavor flavor;
-        protected Status status;
-        protected ImmutableList<Link> links;
-        
-        /** 
-         * @param id The id of this instance
-         * @return The builder object
-         * @see Instance#getId()
-         */
-        public Builder id(String id) {
-            this.id = id;
-            return this;
-        }
-        
-        /** 
-         * @param name The name of this instance
-         * @return The builder object
-         * @see Instance#getName()
-         */
-        public Builder name(String name) {
-            this.name = name;
-            return this;
-        }
-        
-        /** 
-         * @param size Specifies the volume size in gigabytes (GB).
-         * @return The builder object
-         * @see Instance#getSize()
-         */
-        public Builder size(int size) {
-            this.size = size;
-            return this;
-        }
+      public static Status fromValue(String status) {
+         try {
+            return valueOf(checkNotNull(status, "type"));
+         } catch (IllegalArgumentException e) {
+            return UNRECOGNIZED;
+         }
+      }
+   }
 
-        /** 
-         * @param flavor The Flavor of this instance as specified in the response from the List Flavors API call.
-         * @return The builder object
-         * @see Instance#getFlavor()
-         */
-        public Builder flavor(Flavor flavor) {
-            this.flavor = flavor;
-            return this;
-        }
-        
-        /** 
-         * @param status The status of this instance
-         * @return The builder object
-         * @see Instance#getStatus()
-         */
-        public Builder status(Status status) {
-            this.status = status;
-            return this;
-        }
-        
-        /** 
-         * @param links The links to this instance
-         * @return The builder object
-         * @see Instance#getLinks()
-         */
-        public Builder links(ImmutableList<Link> links) {
-            this.links = links;
-            return this;
-        }
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(id, name, volume.getSize(), flavor, status, links);
+   }
 
-        /**
-         * 
-         * @return A new Instance object
-         */
-        public Instance build() {
-            return new Instance(id, name, flavor, new Volume(size), status, links);
-        }
+   @Override
+   public boolean equals(Object obj) {
+      if (this == obj) return true;
+      if (obj == null || getClass() != obj.getClass()) return false;
+      Instance that = Instance.class.cast(obj);
+      return Objects.equal(this.id, that.id);
+   }
 
-        public Builder fromInstance(Instance in) {
-            return this
-                    .id(in.getId())
-                    .name(in.getName())
-                    .flavor(in.getFlavor())
-                    .size(in.getSize())
-                    .status(in.getStatus())
-                    .links(links);
-        }        
-    }
-    
-    @Override
-    public int compareTo(Instance that) {
-        return this.getId().compareTo(that.getId());
-    }   
+   protected ToStringHelper string() {
+      return Objects.toStringHelper(this)
+            .add("id", id).add("name", name).add("flavor", flavor).add("volume size", volume.getSize()).add("links", links);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   public static Builder builder() { 
+      return new Builder();
+   }
+
+   public Builder toBuilder() { 
+      return new Builder().fromInstance(this);
+   }
+
+   public static class Builder {
+      protected String id;
+      protected String name;
+      protected int size;
+      protected Flavor flavor;
+      protected Status status;
+      protected ImmutableList<Link> links;
+
+      /** 
+       * @param id The id of this instance
+       * @return The builder object
+       * @see Instance#getId()
+       */
+      public Builder id(String id) {
+         this.id = id;
+         return this;
+      }
+
+      /** 
+       * @param name The name of this instance
+       * @return The builder object
+       * @see Instance#getName()
+       */
+      public Builder name(String name) {
+         this.name = name;
+         return this;
+      }
+
+      /** 
+       * @param size Specifies the volume size in gigabytes (GB).
+       * @return The builder object
+       * @see Instance#getSize()
+       */
+      public Builder size(int size) {
+         this.size = size;
+         return this;
+      }
+
+      /** 
+       * @param flavor The Flavor of this instance as specified in the response from the List Flavors API call.
+       * @return The builder object
+       * @see Instance#getFlavor()
+       */
+      public Builder flavor(Flavor flavor) {
+         this.flavor = flavor;
+         return this;
+      }
+
+      /** 
+       * @param status The status of this instance
+       * @return The builder object
+       * @see Instance#getStatus()
+       */
+      public Builder status(Status status) {
+         this.status = status;
+         return this;
+      }
+
+      /** 
+       * @param links The links to this instance
+       * @return The builder object
+       * @see Instance#getLinks()
+       */
+      public Builder links(ImmutableList<Link> links) {
+         this.links = links;
+         return this;
+      }
+
+      /**
+       * 
+       * @return A new Instance object
+       */
+      public Instance build() {
+         return new Instance(id, name, flavor, new Volume(size), status, links);
+      }
+
+      public Builder fromInstance(Instance in) {
+         return this
+               .id(in.getId())
+               .name(in.getName())
+               .flavor(in.getFlavor())
+               .size(in.getSize())
+               .status(in.getStatus())
+               .links(links);
+      }        
+   }
+
+   @Override
+   public int compareTo(Instance that) {
+      return this.getId().compareTo(that.getId());
+   }   
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/User.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/User.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/User.java
index 4d04c38..9d9d9f4 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/User.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/User.java
@@ -34,153 +34,153 @@ import com.google.common.collect.Maps;
  * @author Zack Shoylev
  */
 public class User implements Comparable<User>{
-    private final String name;
-    private final String password;
-    private final List<Map<String,String>> databases;
-
-    @ConstructorProperties({
-        "name", "password", "databases"
-    })
-    protected User(String name, String password, List<Map<String,String>> databases) {
-        this.name = checkNotNull(name, "name required");
-        this.password = password;
-        if(databases == null)this.databases = Lists.newArrayList();
-        else {
-            this.databases = databases;
-        }
-    }    
-
-    protected User(String name, String password, Set<String> databases) {
-        this.name = checkNotNull(name, "name required");
-        this.password = password;
-        if(databases == null)this.databases = Lists.newArrayList();
-        else {
-            List<Map<String,String>> databaseList = Lists.newArrayList();
-            for(String databaseName : databases) {
-                Map<String,String> singleDatabase = Maps.newHashMap();
-                singleDatabase.put("name", databaseName);
-                databaseList.add(singleDatabase);
-            }
-            this.databases = ImmutableList.copyOf(databaseList);
-        }
-    }   
-
-    /**
-     * @return the name of this user
-     * @see User.Builder#name(String)
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * @return the password for this user
-     * @see User.Builder#password(String)
-     */
-    public String getPassword() {
-        return this.password;
-    }
-
-    /**
-     * @return the databases for this user
-     * @see User.Builder#databases(String)
-     */
-    public List<String> getDatabases() {
-        List<String> databaseList = Lists.newArrayList();
-        for(Map<String,String> database : this.databases) {
-            databaseList.add(database.get("name"));
-        }
-        return ImmutableList.copyOf(databaseList);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(name, password, databases);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if (obj == null || getClass() != obj.getClass()) return false;
-        User that = User.class.cast(obj);
-        return Objects.equal(this.name, that.name) && 
-                Objects.equal(this.password, that.password) &&
-                Objects.equal(this.databases, that.databases);
-    }
-
-    protected ToStringHelper string() {
-        return Objects.toStringHelper(this)
-                .add("name", name)
-                .add("password", password)
-                .add("databases", databases);
-    }
-
-    @Override
-    public String toString() {
-        return string().toString();
-    }
-
-    public static Builder builder() { 
-        return new Builder();
-    }
-
-    public Builder toBuilder() { 
-        return new Builder().fromUser(this);
-    }
-
-    public static class Builder {
-        protected String name;
-        protected String password;
-        protected Set<String> databases;
-
-        /** 
-         * @param name The name of this user
-         * @return The builder object
-         * @see User#getName()
-         */
-        public Builder name(String name) {
-            this.name = name;
-            return this;
-        }
-
-        /** 
-         * @param name The password for this user
-         * @return The builder object
-         * @see User#getPassword()
-         */
-        public Builder password(String password) {
-            this.password = password;
-            return this;
-        }
-
-        /** 
-         * @param name The databases for this user
-         * @return The builder object
-         * @see User#getDatabases()
-         */
-        public Builder databases(Set<String> databases) {
-            this.databases = databases;
-            return this;
-        }
-
-        /**
-         * 
-         * @return A new User object
-         */
-        public User build() {
-            return new User(name, password, databases);
-        }
-
-        public Builder fromUser(User in) {
-            return this
-                    .name(in.getName())
-                    .password(in.getPassword())
-                    .databases(ImmutableSet.copyOf( in.getDatabases() ));
-        }        
-    }
-
-    @Override
-    public int compareTo(User that) {
-        return this.getName().compareTo(that.getName());
-    }
+   private final String name;
+   private final String password;
+   private final List<Map<String,String>> databases;
+
+   @ConstructorProperties({
+      "name", "password", "databases"
+   })
+   protected User(String name, String password, List<Map<String,String>> databases) {
+      this.name = checkNotNull(name, "name required");
+      this.password = password;
+      if(databases == null)this.databases = Lists.newArrayList();
+      else {
+         this.databases = databases;
+      }
+   }    
+
+   protected User(String name, String password, Set<String> databases) {
+      this.name = checkNotNull(name, "name required");
+      this.password = password;
+      if(databases == null)this.databases = Lists.newArrayList();
+      else {
+         List<Map<String,String>> databaseList = Lists.newArrayList();
+         for(String databaseName : databases) {
+            Map<String,String> singleDatabase = Maps.newHashMap();
+            singleDatabase.put("name", databaseName);
+            databaseList.add(singleDatabase);
+         }
+         this.databases = ImmutableList.copyOf(databaseList);
+      }
+   }   
+
+   /**
+    * @return the name of this user
+    * @see User.Builder#name(String)
+    */
+   public String getName() {
+      return this.name;
+   }
+
+   /**
+    * @return the password for this user
+    * @see User.Builder#password(String)
+    */
+   public String getPassword() {
+      return this.password;
+   }
+
+   /**
+    * @return the databases for this user
+    * @see User.Builder#databases(String)
+    */
+   public List<String> getDatabases() {
+      List<String> databaseList = Lists.newArrayList();
+      for(Map<String,String> database : this.databases) {
+         databaseList.add(database.get("name"));
+      }
+      return ImmutableList.copyOf(databaseList);
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(name, password, databases);
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this == obj) return true;
+      if (obj == null || getClass() != obj.getClass()) return false;
+      User that = User.class.cast(obj);
+      return Objects.equal(this.name, that.name) && 
+            Objects.equal(this.password, that.password) &&
+            Objects.equal(this.databases, that.databases);
+   }
+
+   protected ToStringHelper string() {
+      return Objects.toStringHelper(this)
+            .add("name", name)
+            .add("password", password)
+            .add("databases", databases);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+   public static Builder builder() { 
+      return new Builder();
+   }
+
+   public Builder toBuilder() { 
+      return new Builder().fromUser(this);
+   }
+
+   public static class Builder {
+      protected String name;
+      protected String password;
+      protected Set<String> databases;
+
+      /** 
+       * @param name The name of this user
+       * @return The builder object
+       * @see User#getName()
+       */
+      public Builder name(String name) {
+         this.name = name;
+         return this;
+      }
+
+      /** 
+       * @param name The password for this user
+       * @return The builder object
+       * @see User#getPassword()
+       */
+      public Builder password(String password) {
+         this.password = password;
+         return this;
+      }
+
+      /** 
+       * @param name The databases for this user
+       * @return The builder object
+       * @see User#getDatabases()
+       */
+      public Builder databases(Set<String> databases) {
+         this.databases = databases;
+         return this;
+      }
+
+      /**
+       * 
+       * @return A new User object
+       */
+      public User build() {
+         return new User(name, password, databases);
+      }
+
+      public Builder fromUser(User in) {
+         return this
+               .name(in.getName())
+               .password(in.getPassword())
+               .databases(ImmutableSet.copyOf( in.getDatabases() ));
+      }        
+   }
+
+   @Override
+   public int compareTo(User that) {
+      return this.getName().compareTo(that.getName());
+   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApi.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApi.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApi.java
new file mode 100644
index 0000000..1a12d75
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApi.java
@@ -0,0 +1,110 @@
+/*
+ * 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.openstack.reddwarf.v1.features;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.reddwarf.v1.binders.BindCreateDatabaseToJson;
+import org.jclouds.openstack.reddwarf.v1.functions.ParseDatabaseListForUser;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.rest.annotations.SkipEncoding;
+
+import com.google.common.collect.FluentIterable;
+
+/**
+ * This API is for creating, listing, and deleting a Database
+ * 
+ * @see <a href="http://sourceforge.net/apps/trac/reddwarf/">api doc</a>
+ * @see <a
+ *      href="https://github.com/reddwarf-nextgen/reddwarf">api
+ *      src</a>
+ *      
+ * @author Zack Shoylev
+ */
+@SkipEncoding({'/', '='})
+@RequestFilters(AuthenticateRequest.class)
+public interface DatabaseApi {
+    
+   /**
+    * Same as create(String, null, null)
+    * @see DatabaseApi#create(String, String, String) 
+    */
+   @Named("database:create")
+   @POST
+   @Path("/databases")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   @MapBinder(BindCreateDatabaseToJson.class)
+   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
+    */
+   @Named("database:create")
+   @POST
+   @Path("/databases")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   @MapBinder(BindCreateDatabaseToJson.class)
+   boolean create(@PayloadParam("database") String database, @PayloadParam("character_set") String character_set, @PayloadParam("collate") String collate);
+   
+   /**
+    * This operation deletes the specified database for the specified database instance.
+    *
+    * @param databaseName The name for the specified database.
+    * @return true if successful
+    */
+   @Named("databases:delete")
+   @DELETE
+   @Path("/databases/{name}")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   boolean delete(@PathParam("name") String databaseName);
+   
+   /**
+    * This operation lists the databases for the specified database instance.
+    *
+    * @return The list of Databases
+    */
+   @Named("database:list")
+   @GET
+   @Path("/databases")   
+   @ResponseParser(ParseDatabaseListForUser.class)
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(EmptyFluentIterableOnNotFoundOr404.class)   
+   FluentIterable<String> list();   
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/UserApi.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/UserApi.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/UserApi.java
index 9e47b56..4a91457 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/UserApi.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/UserApi.java
@@ -66,7 +66,6 @@ public interface UserApi {
     * A user is granted all privileges on the specified databases.
     * The following user name is reserved and cannot be used for creating users: root.
     *
-    * @param instanceId The instance ID for the specified database instance.
     * @param users List of users to be created
     * @return true if successful
     */
@@ -81,7 +80,6 @@ public interface UserApi {
    /**
     * Create a database user by name, password, and database name. Simpler overload for {@link #create(String, Set)} 
     *
-    * @param instanceId The instance ID for the specified database instance.
     * @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.
@@ -99,7 +97,6 @@ public interface UserApi {
     * This operation grants access for the specified user to a database for the specified instance.
     * The user is granted all privileges.
     *
-    * @param instanceId The instance ID for the specified database instance.
     * @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
@@ -116,7 +113,6 @@ public interface UserApi {
     * 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 instanceId The instance ID for the specified database instance.
     * @param userName Name of the user for the database.
     * @param databaseName Name of the database that the user can access.
     * @return true if successful
@@ -133,7 +129,6 @@ public interface UserApi {
     * This operation grants access for the specified user to a database for the specified instance.
     * The user is granted all privileges.
     *
-    * @param instanceId The instance ID for the specified database instance.
     * @param userName Name of the user for the database.
     * @param databaseName Name of the database that the user can access.
     * @return true if successful
@@ -148,7 +143,6 @@ public interface UserApi {
    /**
     * This operation deletes the specified user for the specified database instance.
     *
-    * @param instanceId The instance ID for the specified database instance.
     * @param userName The name for the specified user.
     * @return true if successful
     */
@@ -163,16 +157,15 @@ 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.
     *
-    * @param instanceId The instance ID for the specified database instance.
     * @return The list of Users
     */
-   @Named("user:list/{instanceId}")
+   @Named("user:list")
    @GET
    @Path("/users")
    @SelectJson("users")
    @Consumes(MediaType.APPLICATION_JSON)
    @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
-   FluentIterable<User> list(@PathParam("instanceId") String instanceId);
+   FluentIterable<User> list();
    
    /**
     * This operation shows a list of all databases a user has access to.

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParseDatabaseListForUser.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParseDatabaseListForUser.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParseDatabaseListForUser.java
index 4915dde..a3d28cc 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParseDatabaseListForUser.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParseDatabaseListForUser.java
@@ -27,28 +27,28 @@ import com.google.common.collect.Lists;
 import com.google.inject.Inject;
 
 /**
- * This parses the password
+ * This parses the list of databases
  * 
  * @author Zack Shoylev
  */
 public class ParseDatabaseListForUser implements Function<HttpResponse, FluentIterable<String>> {
 
-    private final ParseJson<Map<String, List<Map<String, String>>>> json;
+   private final ParseJson<Map<String, List<Map<String, String>>>> json;
 
-    @Inject
-    ParseDatabaseListForUser(ParseJson<Map<String, List<Map<String, String>>>> json) {
-        this.json = checkNotNull(json, "json");
-    }
+   @Inject
+   ParseDatabaseListForUser(ParseJson<Map<String, List<Map<String, String>>>> json) {
+      this.json = checkNotNull(json, "json");
+   }
 
-    /**
-     * Extracts the user password from the json response
-     */
-    public FluentIterable<String> apply(HttpResponse from) {
-        List<String> resultDatabases = Lists.newArrayList();
-        Map<String, List<Map<String, String>>> result = json.apply(from);
-        for(Map<String, String> database : result.get("databases")) {
-            resultDatabases.add(database.get("name"));
-        }
-        return FluentIterable.from(resultDatabases);
-    }
+   /**
+    * Parses the database list from the json response
+    */
+   public FluentIterable<String> apply(HttpResponse from) {
+      List<String> resultDatabases = Lists.newArrayList();
+      Map<String, List<Map<String, String>>> result = json.apply(from);
+      for(Map<String, String> database : result.get("databases")) {
+         resultDatabases.add(database.get("name"));
+      }
+      return FluentIterable.from(resultDatabases);
+   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParsePasswordFromRootedInstance.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParsePasswordFromRootedInstance.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParsePasswordFromRootedInstance.java
index 40c0cbd..519e35c 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParsePasswordFromRootedInstance.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParsePasswordFromRootedInstance.java
@@ -30,20 +30,20 @@ import com.google.inject.Inject;
  */
 public class ParsePasswordFromRootedInstance implements Function<HttpResponse, String> {
 
-    private final ParseJson<Map<String, Map<String, String>>> json;
+   private final ParseJson<Map<String, Map<String, String>>> json;
 
-    @Inject
-    ParsePasswordFromRootedInstance(ParseJson<Map<String, Map<String, String>>> json) {
-        this.json = checkNotNull(json, "json");
-    }
+   @Inject
+   ParsePasswordFromRootedInstance(ParseJson<Map<String, Map<String, String>>> json) {
+      this.json = checkNotNull(json, "json");
+   }
 
-    /**
-     * Extracts the user password from the json response
-     */
-    public String apply(HttpResponse from) {
-        Map<String, Map<String, String>> result = json.apply(from);
-        if(result.get("user") == null) 
-            return null;
-        return result.get("user").get("password");
-    }
+   /**
+    * Extracts the user password from the json response
+    */
+   public String apply(HttpResponse from) {
+      Map<String, Map<String, String>> result = json.apply(from);
+      if(result.get("user") == null) 
+         return null;
+      return result.get("user").get("password");
+   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiExpectTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiExpectTest.java
new file mode 100644
index 0000000..8e308e7
--- /dev/null
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiExpectTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.openstack.reddwarf.v1.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.reddwarf.v1.internal.BaseRedDwarfApiExpectTest;
+import org.testng.annotations.Test;
+
+/**
+ * Tests DatabaseApi Guice wiring and parsing
+ *
+ * @author Zack Shoylev
+ */
+@Test(groups = "unit", testName = "DatabaseApiExpectTest")
+public class DatabaseApiExpectTest extends BaseRedDwarfApiExpectTest {
+
+   public void testCreateDatabaseSimple() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint)
+            .method("POST")
+            .payload(payloadFromResourceWithContentType("/database_create_simple_request.json", MediaType.APPLICATION_JSON))
+            .build(),
+            HttpResponse.builder().statusCode(202).build() // response
+            ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+
+      boolean result = api.create("testingdb");
+      assertTrue(result);
+   }
+
+   public void testCreateDatabaseSimpleFail() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint)
+            .method("POST")
+            .payload(payloadFromResourceWithContentType("/database_create_simple_request.json", MediaType.APPLICATION_JSON))
+            .build(),
+            HttpResponse.builder().statusCode(404).build() // response
+            ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+
+      boolean result = api.create("testingdb");
+      assertFalse(result);
+   }
+
+   public void testCreateDatabase() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint)
+            .method("POST")
+            .payload(payloadFromResourceWithContentType("/database_create_request.json", MediaType.APPLICATION_JSON))
+            .build(),
+            HttpResponse.builder().statusCode(202).build() // response
+            ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+
+      boolean result = api.create("testingdb", "utf8", "utf8_general_ci");
+      assertTrue(result);
+   }
+
+   public void testCreateDatabaseFail() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint)
+            .method("POST")
+            .payload(payloadFromResourceWithContentType("/database_create_request.json", MediaType.APPLICATION_JSON))
+            .build(),
+            HttpResponse.builder().statusCode(404).build() // response
+            ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+
+      boolean result = api.create("testingdb", "utf8", "utf8_general_ci");
+      assertFalse(result);
+   }
+   
+   public void testDeleteDatabase() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases/db1");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint) 
+            .method("DELETE")
+            .build(),
+            HttpResponse.builder().statusCode(202).build() // response
+            ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+      
+      boolean result = api.delete("db1");
+      assertTrue(result);
+   }
+   
+   public void testDeleteDatabaseFail() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases/db1");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint) 
+            .method("DELETE")
+            .build(),
+            HttpResponse.builder().statusCode(404).build() // response
+            ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+      
+      boolean result = api.delete("db1");
+      assertFalse(result);
+   }
+   
+   public void testListDatabases() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint).build(),
+            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/database_list.json")).build()
+      ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+
+      List<String> databases = api.list().toList();
+      assertEquals(databases.size(), 5);
+      assertEquals(databases.iterator().next(), "anotherdb");
+   }
+   
+   public void testListDatabasesFail() {
+      URI endpoint = URI.create("http://172.16.0.1:8776/v1/3456/instances/instanceId-1234-5678/databases");
+      DatabaseApi api = requestsSendResponses(
+            keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess,
+            authenticatedGET().endpoint(endpoint).build(),
+            HttpResponse.builder().statusCode(404).payload(payloadFromResource("/database_list.json")).build()
+      ).getDatabaseApiForInstanceInZone("instanceId-1234-5678","RegionOne");
+
+      Set<String> databases = api.list().toSet();
+      assertEquals(databases.size(), 0);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiLiveTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiLiveTest.java
new file mode 100644
index 0000000..8aa7dac
--- /dev/null
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/DatabaseApiLiveTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.openstack.reddwarf.v1.features;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertEquals;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.openstack.reddwarf.v1.domain.Instance;
+import org.jclouds.openstack.reddwarf.v1.internal.BaseRedDwarfApiLiveTest;
+import org.jclouds.openstack.reddwarf.v1.predicates.InstancePredicates;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Zack Shoylev
+ */
+@Test(groups = "live", testName = "DatabaseApiLiveTest", singleThreaded = true)
+public class DatabaseApiLiveTest extends BaseRedDwarfApiLiveTest {
+
+   // zone to instance
+   private static Map<String,List<Instance>> instancesToDelete = Maps.newHashMap();
+   // not deleting databases. they will be deleted when instances are deleted
+
+   @Override
+   @BeforeClass(groups = { "integration", "live" })
+   public void setup() {
+      super.setup();
+      for (String zone : api.getConfiguredZones()) {
+         // create instances
+         List<Instance> instanceList = Lists.newArrayList();
+         InstanceApi instanceApi = api.getInstanceApiForZone(zone);
+         Instance first = instanceApi.create("1", 1, "first_database_testing");
+         Instance second = instanceApi.create("1", 1, "second_database_testing");
+         instanceList.add(first);
+         instanceList.add(second);
+         InstancePredicates.awaitAvailable(instanceApi).apply(first);
+         InstancePredicates.awaitAvailable(instanceApi).apply(second);        
+         instancesToDelete.put(zone, instanceList);
+         
+         DatabaseApi databaseApiFirst = api.getDatabaseApiForInstanceInZone(first.getId(), zone);
+         DatabaseApi databaseApiSecond = api.getDatabaseApiForInstanceInZone(second.getId(), zone);         
+         databaseApiFirst.create("livetest_db1");
+         databaseApiFirst.create("livetest_db2");
+         databaseApiSecond.create("livetest_db3");
+      }
+   }
+
+   @Override
+   @AfterClass(groups = { "integration", "live" })
+   public void tearDown(){
+      for (String zone : api.getConfiguredZones()) {
+         InstanceApi instanceApi = api.getInstanceApiForZone(zone);
+         for(Instance instance : instancesToDelete.get(zone)){
+            if( !instanceApi.delete(instance.getId() ) )
+               throw new RuntimeException("Could not delete a database instance after tests!");
+         }
+      }
+      super.tearDown();
+   }
+
+   @Test
+   public void testListDatabases() {
+      for (String zone : api.getConfiguredZones()) {
+         InstanceApi instanceApi = api.getInstanceApiForZone(zone);
+         assertTrue(instanceApi.list().size() >= 2);
+         for(Instance instance : instanceApi.list() ) {
+            DatabaseApi databaseApi = api.getDatabaseApiForInstanceInZone(instance.getId(), zone);
+            if(!instance.getName().contains("database_testing"))continue;
+            assertTrue(databaseApi.list().size() >=1);
+            for(String database : databaseApi.list()){
+               assertNotNull(database);      
+            }
+         }  
+      }   
+   }
+   
+   @Test
+   public void testDeleteDatabases() {
+      for (String zone : api.getConfiguredZones()) {
+         InstanceApi instanceApi = api.getInstanceApiForZone(zone);
+         assertTrue(instanceApi.list().size() >= 2);
+         for(Instance instance : instanceApi.list() ) {
+            DatabaseApi databaseApi = api.getDatabaseApiForInstanceInZone(instance.getId(), zone);
+            if(!instance.getName().contains("database_testing"))continue;
+            assertTrue(databaseApi.list().size() >=1);
+            for(String database : databaseApi.list()){
+               assertNotNull(database);
+               assertTrue(database.equals("livetest_db1") || database.equals("livetest_db2") || database.equals("livetest_db3") );
+               assertEquals(instanceApi.get(instance.getId()).getStatus(), Instance.Status.ACTIVE);
+               assertTrue(databaseApi.delete(database));
+               assertEquals(instanceApi.get(instance.getId()).getStatus(), Instance.Status.ACTIVE);
+               assertTrue(databaseApi.create(database));
+               assertEquals(instanceApi.get(instance.getId()).getStatus(), Instance.Status.ACTIVE);
+            }
+         }  
+      }   
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiExpectTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiExpectTest.java
index 2d2aef1..484b087 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiExpectTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiExpectTest.java
@@ -294,7 +294,7 @@ public class UserApiExpectTest extends BaseRedDwarfApiExpectTest {
             HttpResponse.builder().statusCode(200).payload(payloadFromResource("/reddwarf_user_list.json")).build()
       ).getUserApiForInstanceInZone("instanceId-1234-5678","RegionOne");
 
-      Set<User> users = api.list("instanceId-1234-5678").toSet();
+      Set<User> users = api.list().toSet();
       assertEquals(users.size(), 4);
       assertEquals(users.iterator().next().getDatabases().size(), 0);
       assertEquals(users.iterator().next().getName(), "dbuser1");
@@ -309,7 +309,7 @@ public class UserApiExpectTest extends BaseRedDwarfApiExpectTest {
             HttpResponse.builder().statusCode(404).payload(payloadFromResource("/reddwarf_user_list.json")).build()
       ).getUserApiForInstanceInZone("instanceId-1234-5678","RegionOne");
 
-      Set<User> users = api.list("instanceId-1234-5678").toSet();
+      Set<User> users = api.list().toSet();
       assertEquals(users.size(), 0);
    }
    

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiLiveTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiLiveTest.java
index e2693a3..d9a4e7e 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiLiveTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/UserApiLiveTest.java
@@ -118,8 +118,8 @@ public class UserApiLiveTest extends BaseRedDwarfApiLiveTest {
          for(Instance instance : instanceApi.list() ) {
             UserApi userApi = api.getUserApiForInstanceInZone(instance.getId(), zone);
             if(!instance.getName().contains("user_testing"))continue;
-            assertTrue(userApi.list(instance.getId()).size() >=1);
-            for(User user : userApi.list(instance.getId())){
+            assertTrue(userApi.list().size() >=1);
+            for(User user : userApi.list()){
                checkUser(user);      
             }
          }  
@@ -134,8 +134,8 @@ public class UserApiLiveTest extends BaseRedDwarfApiLiveTest {
          for(Instance instance : instanceApi.list() ) {
             UserApi userApi = api.getUserApiForInstanceInZone(instance.getId(), zone);
             if(!instance.getName().contains("user_testing"))continue;
-            assertTrue(userApi.list(instance.getId()).size() >=1);
-            for(User user : userApi.list(instance.getId())){
+            assertTrue(userApi.list().size() >=1);
+            for(User user : userApi.list()){
                User userFromGet = userApi.get(user.getName());
                assertEquals(userFromGet.getName(), user.getName());
                assertEquals(userFromGet.getDatabases(), user.getDatabases());     
@@ -152,8 +152,8 @@ public class UserApiLiveTest extends BaseRedDwarfApiLiveTest {
          for(Instance instance : instanceApi.list() ) {
             UserApi userApi = api.getUserApiForInstanceInZone(instance.getId(), zone);
             if(!instance.getName().contains("user_testing"))continue;
-            assertTrue(userApi.list(instance.getId()).size() >=1);
-            for(User user : userApi.list(instance.getId())){
+            assertTrue(userApi.list().size() >=1);
+            for(User user : userApi.list()){
                assertTrue(userApi.getDatabaseList(user.getName()).size()>0);
             }
          }  
@@ -168,8 +168,8 @@ public class UserApiLiveTest extends BaseRedDwarfApiLiveTest {
          for(Instance instance : instanceApi.list() ) {
             UserApi userApi = api.getUserApiForInstanceInZone(instance.getId(), zone);
             if(!instance.getName().contains("user_testing"))continue;
-            assertTrue(userApi.list(instance.getId()).size() >=1);
-            for(User user : userApi.list(instance.getId())){
+            assertTrue(userApi.list().size() >=1);
+            for(User user : userApi.list()){
                userApi.grant(user.getName(), "dbA");
                userApi.grant(user.getName(), ImmutableList.of(
                      "dbB", 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/resources/database_create_request.json
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/resources/database_create_request.json b/openstack-reddwarf/src/test/resources/database_create_request.json
new file mode 100644
index 0000000..7766ac9
--- /dev/null
+++ b/openstack-reddwarf/src/test/resources/database_create_request.json
@@ -0,0 +1,9 @@
+{
+    "databases": [
+        {    
+            "character_set": "utf8", 
+            "collate": "utf8_general_ci", 
+            "name": "testingdb"
+        } 
+    ]
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/resources/database_create_simple_request.json
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/resources/database_create_simple_request.json b/openstack-reddwarf/src/test/resources/database_create_simple_request.json
new file mode 100644
index 0000000..02ad014
--- /dev/null
+++ b/openstack-reddwarf/src/test/resources/database_create_simple_request.json
@@ -0,0 +1,7 @@
+{
+    "databases": [
+        {   
+            "name": "testingdb"
+        } 
+    ]
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/a0934bfb/openstack-reddwarf/src/test/resources/database_list.json
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/resources/database_list.json b/openstack-reddwarf/src/test/resources/database_list.json
new file mode 100644
index 0000000..aca6447
--- /dev/null
+++ b/openstack-reddwarf/src/test/resources/database_list.json
@@ -0,0 +1,19 @@
+{
+    "databases": [
+        {
+            "name": "anotherdb"
+        }, 
+        {
+            "name": "nextround"
+        }, 
+        {
+            "name": "oneMoreDB"
+        }, 
+        {
+            "name": "sampledb"
+        }, 
+        {
+            "name": "testingdb"
+        }
+    ]
+}