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/20 22:14:19 UTC

[2/2] git commit: Adds User feature to the Reddwarf APIs https://issues.apache.org/jira/browse/JCLOUDS-33

Adds User feature to the Reddwarf APIs
https://issues.apache.org/jira/browse/JCLOUDS-33


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

Branch: refs/heads/master
Commit: d0fdbe3d20a010b9d6c44b20bff9782ea5881611
Parents: e26d4a9
Author: zack-shoylev <za...@rackspace.com>
Authored: Thu May 2 22:46:52 2013 -0500
Committer: Everett Toews <ev...@rackspace.com>
Committed: Mon May 20 15:12:12 2013 -0500

----------------------------------------------------------------------
 openstack-reddwarf/pom.xml                         |   30 +-
 .../v1/binders/BindCreateInstanceToJson.java       |   52 --
 .../jclouds/openstack/reddwarf/v1/RedDwarfApi.java |   25 +-
 .../openstack/reddwarf/v1/RedDwarfApiMetadata.java |   12 +-
 .../v1/binders/BindCreateInstanceToJson.java       |   52 ++
 .../reddwarf/v1/binders/BindCreateUserToJson.java  |   65 +++
 .../reddwarf/v1/binders/BindGrantUserToJson.java   |   63 +++
 .../reddwarf/v1/config/RedDwarfHttpApiModule.java  |   12 +-
 .../reddwarf/v1/config/RedDwarfParserModule.java   |   12 +-
 .../openstack/reddwarf/v1/domain/Flavor.java       |   10 +-
 .../openstack/reddwarf/v1/domain/Instance.java     |   10 +-
 .../jclouds/openstack/reddwarf/v1/domain/User.java |  189 ++++++++
 .../openstack/reddwarf/v1/features/FlavorApi.java  |   10 +-
 .../reddwarf/v1/features/InstanceApi.java          |   12 +-
 .../openstack/reddwarf/v1/features/UserApi.java    |  210 ++++++++
 .../v1/functions/ParseDatabaseListForUser.java     |   56 +++
 .../functions/ParsePasswordFromRootedInstance.java |   12 +-
 .../reddwarf/v1/handlers/RedDwarfErrorHandler.java |   12 +-
 .../openstack/reddwarf/v1/internal/Volume.java     |   18 +
 .../reddwarf/v1/predicates/InstancePredicates.java |   12 +-
 .../openstack/reddwarf/v1/domain/FlavorTest.java   |   12 +-
 .../openstack/reddwarf/v1/domain/InstanceTest.java |   12 +-
 .../openstack/reddwarf/v1/domain/UserTest.java     |   49 ++
 .../reddwarf/v1/features/FlavorApiExpectTest.java  |   12 +-
 .../reddwarf/v1/features/FlavorApiLiveTest.java    |   12 +-
 .../v1/features/InstanceApiExpectTest.java         |   12 +-
 .../reddwarf/v1/features/InstanceApiLiveTest.java  |   27 +-
 .../reddwarf/v1/features/UserApiExpectTest.java    |  372 +++++++++++++++
 .../reddwarf/v1/features/UserApiLiveTest.java      |  207 ++++++++
 .../v1/internal/BaseRedDwarfApiExpectTest.java     |   12 +-
 .../v1/internal/BaseRedDwarfApiLiveTest.java       |   12 +-
 .../v1/internal/BaseRedDwarfExpectTest.java        |   12 +-
 .../reddwarf/v1/parse/ParseFlavorListTest.java     |   12 +-
 .../reddwarf/v1/parse/ParseInstanceListTest.java   |   12 +-
 .../reddwarf/v1/parse/ParseUserListTest.java       |   66 +++
 .../src/test/resources/reddwarf_user_list.json     |   31 ++
 .../src/test/resources/user_create_request.json    |   34 ++
 .../test/resources/user_create_simple_request.json |   13 +
 .../src/test/resources/user_get.json               |   13 +
 .../src/test/resources/user_grant_request.json     |   10 +
 .../test/resources/user_grant_simple_request.json  |    7 +
 .../src/test/resources/user_list_access.json       |   10 +
 .../src/test/resources/user_password_request.json  |   12 +
 43 files changed, 1642 insertions(+), 203 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/pom.xml
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/pom.xml b/openstack-reddwarf/pom.xml
index ef7491c..5c53760 100644
--- a/openstack-reddwarf/pom.xml
+++ b/openstack-reddwarf/pom.xml
@@ -1,22 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-Licensed to jclouds, Inc. (jclouds) under one or more
-contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  jclouds licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
+  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
 
-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.
+  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.
 
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/redddwarf/v1/binders/BindCreateInstanceToJson.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/redddwarf/v1/binders/BindCreateInstanceToJson.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/redddwarf/v1/binders/BindCreateInstanceToJson.java
deleted file mode 100644
index ff161a0..0000000
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/redddwarf/v1/binders/BindCreateInstanceToJson.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  jclouds licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jclouds.openstack.redddwarf.v1.binders;
-
-import java.util.Map;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.openstack.reddwarf.v1.internal.Volume;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.inject.Inject;
-
-/**
- * @author Zack Shoylev
- */
-public class BindCreateInstanceToJson implements MapBinder {
-    
-    @Inject
-    private BindToJsonPayload jsonBinder;
-    
-    @Override    
-    public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
-       Map<String, Object> databaseInstance = Maps.newHashMap();
-       databaseInstance.put("flavorRef", postParams.get("flavorRef"));
-       databaseInstance.put("volume", new Volume((Integer) postParams.get("size")));
-       if (postParams.get("name") != null)
-           databaseInstance.put("name", postParams.get("name"));
-       return jsonBinder.bindToRequest(request, ImmutableMap.of("instance", databaseInstance));
-    }
-
-    @Override
-    public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
-       throw new IllegalStateException("CreateInstance is a POST operation");
-    }    
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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 089cee4..b7d79f3 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
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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
@@ -20,16 +20,17 @@ package org.jclouds.openstack.reddwarf.v1;
 
 import java.io.Closeable;
 import java.util.Set;
-
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 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.FlavorApi;
 import org.jclouds.openstack.reddwarf.v1.features.InstanceApi;
+import org.jclouds.openstack.reddwarf.v1.features.UserApi;
 import org.jclouds.rest.annotations.Delegate;
 import org.jclouds.rest.annotations.EndpointParam;
-
 import com.google.common.base.Optional;
 import com.google.inject.Provides;
 
@@ -62,6 +63,14 @@ public interface RedDwarfApi extends Closeable{
          @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
    
    /**
+    * Provides access to User features.
+    */
+   @Delegate
+   @Path("/instances/{instanceId}")
+   UserApi getUserApiForInstanceInZone(@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/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApiMetadata.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApiMetadata.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApiMetadata.java
index 0ce1521..7dd4769 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApiMetadata.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/RedDwarfApiMetadata.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateInstanceToJson.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateInstanceToJson.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateInstanceToJson.java
new file mode 100644
index 0000000..198eb7b
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateInstanceToJson.java
@@ -0,0 +1,52 @@
+/*
+ * 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.openstack.reddwarf.v1.internal.Volume;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.Inject;
+
+/**
+ * @author Zack Shoylev
+ */
+public class BindCreateInstanceToJson implements MapBinder {
+    
+    @Inject
+    private BindToJsonPayload jsonBinder;
+    
+    @Override    
+    public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+       Map<String, Object> databaseInstance = Maps.newHashMap();
+       databaseInstance.put("flavorRef", postParams.get("flavorRef"));
+       databaseInstance.put("volume", new Volume((Integer) postParams.get("size")));
+       if (postParams.get("name") != null)
+           databaseInstance.put("name", postParams.get("name"));
+       return jsonBinder.bindToRequest(request, ImmutableMap.of("instance", databaseInstance));
+    }
+
+    @Override
+    public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+       throw new IllegalStateException("CreateInstance is a POST operation");
+    }    
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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
new file mode 100644
index 0000000..93c7e07
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindCreateUserToJson.java
@@ -0,0 +1,65 @@
+/*
+ * 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 java.util.Set;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.openstack.reddwarf.v1.domain.User;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+
+/**
+ * @author Zack Shoylev
+ */
+public class BindCreateUserToJson implements MapBinder {
+
+    @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));
+    }
+
+    @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/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindGrantUserToJson.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindGrantUserToJson.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindGrantUserToJson.java
new file mode 100644
index 0000000..436f129
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/binders/BindGrantUserToJson.java
@@ -0,0 +1,63 @@
+/*
+ * 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.List;
+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.Lists;
+import com.google.common.collect.Maps;
+import com.google.inject.Inject;
+
+/**
+ * @author Zack Shoylev
+ */
+public class BindGrantUserToJson implements MapBinder {
+    
+    @Inject
+    private BindToJsonPayload jsonBinder;
+    
+    @SuppressWarnings("unchecked")
+    @Override    
+    public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+       List<String> databases = Lists.newArrayList();
+       if( postParams.get("databaseName")!=null ) {
+          databases.add((String)postParams.get("databaseName"));
+       }
+       else if( postParams.get("databases")!=null ) {
+          databases = (List<String>) postParams.get("databases");
+       }
+       
+       List<Map<String,String>> databaseList = Lists.newArrayList();       
+       for(String databaseName : databases) {
+           Map<String,String> singleDatabase = Maps.newHashMap();
+           singleDatabase.put("name", databaseName);
+           databaseList.add(singleDatabase);
+       }
+       return jsonBinder.bindToRequest(request, ImmutableMap.of("databases", databaseList));
+    }
+
+    @Override
+    public <R extends HttpRequest> R bindToRequest(R request, Object toBind) {
+       throw new IllegalStateException("Grant user is a PUT operation");
+    }    
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfHttpApiModule.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfHttpApiModule.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfHttpApiModule.java
index 89a000f..b2da688 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfHttpApiModule.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfHttpApiModule.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfParserModule.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfParserModule.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfParserModule.java
index e023e8f..1d80c11 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfParserModule.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/config/RedDwarfParserModule.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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 210ac51..389eb4e 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
@@ -1,14 +1,14 @@
 /*
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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 60bcb83..6ca2382 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
@@ -1,14 +1,14 @@
 /*
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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
new file mode 100644
index 0000000..37c7b98
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/domain/User.java
@@ -0,0 +1,189 @@
+/*
+ * 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.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * An Openstack Reddwarf Database User.
+ * 
+ * @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());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApi.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApi.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApi.java
index 8001e67..bf6bf35 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApi.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApi.java
@@ -1,14 +1,14 @@
 /*
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApi.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApi.java
index d63c388..dca585b 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApi.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApi.java
@@ -1,14 +1,14 @@
 /*
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+ * 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.  jclouds licenses this file
+ * 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
@@ -32,7 +32,7 @@ import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
 import org.jclouds.Fallbacks.NullOnNotFoundOr404;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
-import org.jclouds.openstack.redddwarf.v1.binders.BindCreateInstanceToJson;
+import org.jclouds.openstack.reddwarf.v1.binders.BindCreateInstanceToJson;
 import org.jclouds.openstack.reddwarf.v1.domain.Instance;
 import org.jclouds.openstack.reddwarf.v1.functions.ParsePasswordFromRootedInstance;
 import org.jclouds.rest.ResourceNotFoundException;

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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
new file mode 100644
index 0000000..47ff64f
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/features/UserApi.java
@@ -0,0 +1,210 @@
+/*
+ * 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 java.util.List;
+import java.util.Set;
+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.PUT;
+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.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.reddwarf.v1.binders.BindCreateUserToJson;
+import org.jclouds.openstack.reddwarf.v1.binders.BindGrantUserToJson;
+import org.jclouds.openstack.reddwarf.v1.domain.User;
+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.SelectJson;
+import org.jclouds.rest.annotations.SkipEncoding;
+import com.google.common.collect.FluentIterable;
+
+/**
+ * This API is for creating, listing, and deleting a User. Also allows listing, granting, and revoking access permissions for users.
+ * @see org.jclouds.openstack.reddwarf.v1.domain.User
+ * User
+ * 
+ * @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 UserApi {
+    
+   /**
+    * 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.
+    *
+    * @param instanceId The instance ID for the specified database instance.
+    * @param users List of users to be created
+    * @return true if successful
+    */
+   @Named("user:create")
+   @POST
+   @Path("/users")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   @MapBinder(BindCreateUserToJson.class)
+   boolean create(@PayloadParam("users") Set<User> users);
+   
+   /**
+    * 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.
+    * @return true if successful
+    */
+   @Named("user:create")
+   @POST
+   @Path("/users")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   @MapBinder(BindCreateUserToJson.class)
+   boolean create(@PayloadParam("name") String userName, @PayloadParam("password") String password, @PayloadParam("databaseName") String databaseName);
+
+   /**
+    * 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
+    */
+   @Named("user:grant")
+   @PUT
+   @Path("/users/{name}/databases")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   @MapBinder(BindGrantUserToJson.class)
+   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)}
+    * 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
+    */
+   @Named("user:grant")
+   @PUT
+   @Path("/users/{name}/databases")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   @MapBinder(BindGrantUserToJson.class)
+   boolean grant(@PathParam("name") String userName, @PayloadParam("databaseName") String databaseName);
+   
+   /**
+    * 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
+    */
+   @Named("user:revoke")
+   @DELETE
+   @Path("/users/{name}/databases/{databaseName}")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   boolean revoke(@PathParam("name") String userName, @PathParam("databaseName") String databaseName);
+   
+   /**
+    * 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
+    */
+   @Named("users:delete/{name}")
+   @DELETE
+   @Path("/users/{name}")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(FalseOnNotFoundOr404.class)
+   boolean delete(@PathParam("name") String userName);
+   
+   /**
+    * 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}")
+   @GET
+   @Path("/users")
+   @SelectJson("users")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+   FluentIterable<User> list(@PathParam("instanceId") String instanceId);
+   
+   /**
+    * This operation shows a list of all databases a user has access to.
+    *
+    * @param instanceId The instance ID for the specified database instance.
+    * @param userName The name for the specified user.
+    * @return The list of Users
+    */
+   @Named("user:getDatabaseList/{instanceId}/{name}")
+   @GET
+   @Path("/users/{name}/databases")
+   @ResponseParser(ParseDatabaseListForUser.class)
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
+   FluentIterable<String> getDatabaseList(@PathParam("name") String userName);
+      
+   /**
+    * Returns a User by name
+    *
+    * @param instanceId The instance ID for the specified database instance.
+    * @param userName The name for the specified user.
+    * @return User or Null on not found
+    */
+   @Named("user:list/{instanceId}/{userName}")
+   @GET
+   @Path("/users/{name}")
+   @SelectJson("user")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(NullOnNotFoundOr404.class)
+   @Nullable
+   User get(@PathParam("name") String userName);
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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
new file mode 100644
index 0000000..646a052
--- /dev/null
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/functions/ParseDatabaseListForUser.java
@@ -0,0 +1,56 @@
+/*
+ * 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.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.List;
+import java.util.Map;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseJson;
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+/**
+ * This parses the password
+ * 
+ * @author Zack Shoylev
+ */
+public class ParseDatabaseListForUser implements Function<HttpResponse, FluentIterable<String>> {
+
+    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");
+    }
+
+    /**
+     * 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);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/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 716f055..69724ae 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
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/handlers/RedDwarfErrorHandler.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/handlers/RedDwarfErrorHandler.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/handlers/RedDwarfErrorHandler.java
index d68eac0..4915eb7 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/handlers/RedDwarfErrorHandler.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/handlers/RedDwarfErrorHandler.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/internal/Volume.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/internal/Volume.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/internal/Volume.java
index 07386e6..54848f2 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/internal/Volume.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/internal/Volume.java
@@ -1,3 +1,21 @@
+/*
+ * 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.internal;
 
 public class Volume{

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/predicates/InstancePredicates.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/predicates/InstancePredicates.java b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/predicates/InstancePredicates.java
index b8a64ef..0a3dfba 100644
--- a/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/predicates/InstancePredicates.java
+++ b/openstack-reddwarf/src/main/java/org/jclouds/openstack/reddwarf/v1/predicates/InstancePredicates.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/FlavorTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/FlavorTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/FlavorTest.java
index a30db18..2f72b39 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/FlavorTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/FlavorTest.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/InstanceTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/InstanceTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/InstanceTest.java
index 4c2fd68..b3f5e7d 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/InstanceTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/InstanceTest.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/UserTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/UserTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/UserTest.java
new file mode 100644
index 0000000..9c8fdc9
--- /dev/null
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/domain/UserTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.domain;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import org.testng.annotations.Test;
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "unit", testName = "UserTest")
+public class UserTest {
+   public void testUserForName() {
+      User user1 = forName("1");
+      User user2 = forName("2");
+      assertEquals(user1.getName(), "1");
+      assertEquals(user2.getName(), "2");
+      assertFalse(user1.equals(user2));
+   }
+   
+   /**
+    * Creates a dummy User when you need an User with just the userName.
+    */
+   public static User forName(String userName) {       
+       return User.builder()
+               .name(userName)
+               .password("password")
+               .databases( 
+                       ImmutableSet.of(
+                               "db1",
+                               "db2"
+                               ) ).build();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiExpectTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiExpectTest.java
index f3f52d9..877dc33 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiExpectTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiExpectTest.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiLiveTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiLiveTest.java
index ad15714..96f0963 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiLiveTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/FlavorApiLiveTest.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiExpectTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiExpectTest.java
index 53eeddb..4b23375 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiExpectTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiExpectTest.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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

http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs-openstack/blob/d0fdbe3d/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiLiveTest.java b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiLiveTest.java
index f585057..7ae4923 100644
--- a/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiLiveTest.java
+++ b/openstack-reddwarf/src/test/java/org/jclouds/openstack/reddwarf/v1/features/InstanceApiLiveTest.java
@@ -1,14 +1,14 @@
-/**
- * Licensed to jclouds, Inc. (jclouds) under one or more
- * contributor license agreements.  See the NOTICE file
+/*
+ * 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.  jclouds licenses this file
+ * 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
@@ -52,8 +52,8 @@ public class InstanceApiLiveTest extends BaseRedDwarfApiLiveTest {
         for (String zone : api.getConfiguredZones()) {
             List<Instance> zoneList = Lists.newArrayList();
             InstanceApi instanceApi = api.getInstanceApiForZone(zone);
-            zoneList.add(instanceApi.create("1", 1, "first"));
-            Instance second = instanceApi.create("1", 1, "second");
+            zoneList.add(instanceApi.create("1", 1, "first_instance_testing"));
+            Instance second = instanceApi.create("1", 1, "second_instance_testing");
             InstancePredicates.awaitAvailable(instanceApi).apply(second);
             instanceApi.enableRoot(second.getId());
             zoneList.add(second);            
@@ -119,9 +119,14 @@ public class InstanceApiLiveTest extends BaseRedDwarfApiLiveTest {
     public void testGetRootStatus() {
         for (String zone : api.getConfiguredZones()) {
             InstanceApi instanceApi = api.getInstanceApiForZone(zone);
-            Iterator<Instance> iterator = instanceApi.list().iterator(); 
-            Instance first = iterator.next();
-            Instance second = iterator.next();
+            Iterator<Instance> iterator = instanceApi.list().iterator();
+            Instance first, second;
+            do{
+               first = iterator.next(); 
+            } while(!first.getName().contains("instance_testing"));
+            do{
+               second = iterator.next(); 
+            } while(!second.getName().contains("instance_testing"));
             assertTrue(instanceApi.isRooted(first.getId()) || instanceApi.isRooted(second.getId()));
         }
     }