Author: adietish
Date: 2010-12-26 16:59:03 -0500 (Sun, 26 Dec 2010)
New Revision: 27742
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/utils/UrlBuilder.java
Log:
[JBIDE-7763] corrected key request to send commit=create
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java 2010-12-26
21:57:37 UTC (rev 27741)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java 2010-12-26
21:59:03 UTC (rev 27742)
@@ -24,8 +24,8 @@
private String imageId;
private String profileId;
- private String realmId ;
- private String name ;
+ private String realmId;
+ private String name;
private String keyName;
private String memory;
private String storage;
@@ -33,7 +33,7 @@
public CreateInstanceRequest(URL baseUrl, String imageId) {
this(baseUrl, imageId, null, null, null, null, null, null);
}
-
+
public CreateInstanceRequest(URL baseUrl, String imageId, String profileId, String
realmId, String name,
String keyname, String memory, String storage) {
super(baseUrl, HttpMethod.POST);
@@ -48,20 +48,15 @@
@Override
protected String doCreateUrl(UrlBuilder urlBuilder) {
- urlBuilder.path("instances").parameter("image_id", imageId);
- appendParameter("hwp_id", profileId, urlBuilder);
- appendParameter("realm_id", realmId, urlBuilder);
- appendParameter("name", name, urlBuilder);
- appendParameter("hwp_memory", memory, urlBuilder);
- appendParameter("hwp_storage", storage, urlBuilder);
- appendParameter("keyname", keyName, urlBuilder);
- appendParameter("commit", "create", urlBuilder);
- return urlBuilder.toString();
+ return urlBuilder.path("instances")
+ .parameter("image_id", imageId)
+ .parameter("hwp_id", profileId)
+ .parameter("realm_id", realmId)
+ .parameter("name", name)
+ .parameter("hwp_memory", memory)
+ .parameter("hwp_storage", storage)
+ .parameter("keyname", keyName)
+ .parameter("commit", "create")
+ .toString();
}
-
- private void appendParameter(String parameterName, String parameterValue, UrlBuilder
urlBuilder) {
- if (parameterValue != null) {
- urlBuilder.parameter(parameterName, parameterValue);
- }
- }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java 2010-12-26
21:57:37 UTC (rev 27741)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java 2010-12-26
21:59:03 UTC (rev 27742)
@@ -31,6 +31,9 @@
@Override
protected String doCreateUrl(UrlBuilder urlBuilder) {
- return urlBuilder.path("keys").parameter("name",
keyName).toString();
+ return urlBuilder.path("keys")
+ .parameter("name", keyName)
+ .parameter("commit", "create")
+ .toString();
}
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/utils/UrlBuilder.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/utils/UrlBuilder.java 2010-12-26
21:57:37 UTC (rev 27741)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/utils/UrlBuilder.java 2010-12-26
21:59:03 UTC (rev 27742)
@@ -33,11 +33,11 @@
public UrlBuilder() {
}
-
+
public UrlBuilder(URL baseUrl) {
urlStringBuilder.append(baseUrl.toString());
}
-
+
/**
* adds a host to .
*
@@ -86,11 +86,14 @@
}
return this;
}
-
+
public UrlBuilder parameter(String name, String value) {
- appendParameterDelimiter();
- urlStringBuilder.append(name).append(PARAMETER_NAME_VALUE_DELIMITER).append(value);
+ if (value != null) {
+ appendParameterDelimiter();
+ urlStringBuilder.append(name).append(PARAMETER_NAME_VALUE_DELIMITER).append(value);
+ }
return this;
+
}
private void appendParameterDelimiter() {
@@ -108,13 +111,13 @@
}
return this;
}
-
+
public UrlBuilder parameter(String parameter) {
appendParameterDelimiter();
urlStringBuilder.append(parameter);
return this;
}
-
+
public URL toUrl() throws MalformedURLException {
return new URL(urlStringBuilder.toString());
}