You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/10/12 20:38:21 UTC
[2/2] git commit: updated refs/heads/master to 5f497b9
BaseCmd.buildResponse methods removed
Both buildResponse methods were abandoned
Signed-off-by: Laszlo Hornyak <la...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6df77ec0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6df77ec0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6df77ec0
Branch: refs/heads/master
Commit: 6df77ec0ce66cb0e2d51997215c6d0d9e21db896
Parents: b344bb4
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sat Oct 12 11:16:38 2013 +0200
Committer: Laszlo Hornyak <la...@gmail.com>
Committed: Sat Oct 12 19:42:50 2013 +0200
----------------------------------------------------------------------
api/src/org/apache/cloudstack/api/BaseCmd.java | 59 ---------------------
1 file changed, 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6df77ec0/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 781b692..4f4d0db 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -302,65 +302,6 @@ public abstract class BaseCmd {
return lowercaseParams;
}
- public String buildResponse(ServerApiException apiException, String responseType) {
- StringBuffer sb = new StringBuffer();
- if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
- // JSON response
- sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
- sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
- } else {
- sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
- sb.append("<" + getCommandName() + ">");
- sb.append("<errorcode>" + apiException.getErrorCode() + "</errorcode>");
- sb.append("<description>" + escapeXml(apiException.getDescription()) + "</description>");
- sb.append("</" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
- }
- return sb.toString();
- }
-
- public String buildResponse(List<Pair<String, Object>> tagList, String responseType) {
- StringBuffer prefixSb = new StringBuffer();
- StringBuffer suffixSb = new StringBuffer();
-
- // set up the return value with the name of the response
- if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
- prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
- } else {
- prefixSb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
- prefixSb.append("<" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
- }
-
- int i = 0;
- for (Pair<String, Object> tagData : tagList) {
- String tagName = tagData.first();
- Object tagValue = tagData.second();
- if (tagValue instanceof Object[]) {
- Object[] subObjects = (Object[]) tagValue;
- if (subObjects.length < 1) {
- continue;
- }
- writeObjectArray(responseType, suffixSb, i++, tagName, subObjects);
- } else {
- writeNameValuePair(suffixSb, tagName, tagValue, responseType, i++);
- }
- }
-
- if (suffixSb.length() > 0) {
- if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // append comma only if we have some suffix else
- // not as per strict Json syntax.
- prefixSb.append(",");
- }
- prefixSb.append(suffixSb);
- }
- // close the response
- if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
- prefixSb.append("} }");
- } else {
- prefixSb.append("</" + getCommandName() + ">");
- }
- return prefixSb.toString();
- }
-
private void writeNameValuePair(StringBuffer sb, String tagName, Object tagValue, String responseType, int propertyCount) {
if (tagValue == null) {
return;