You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2013/12/12 13:39:04 UTC
[1/2] git commit: Fixed issues in CLI
Updated Branches:
refs/heads/master 081f9fc95 -> 69e36903c
Fixed issues in CLI
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/df9d500f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/df9d500f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/df9d500f
Branch: refs/heads/master
Commit: df9d500f85922971bcb288b4b90591b35c1cf76e
Parents: 41e5f69
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Dec 12 18:08:20 2013 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Dec 12 18:08:20 2013 +0530
----------------------------------------------------------------------
.../apache/stratos/cli/CartridgeInfoBean.java | 20 +--
.../apache/stratos/cli/GenericRestClient.java | 6 +-
.../java/org/apache/stratos/cli/RestClient.java | 13 +-
.../stratos/cli/RestCommandLineService.java | 135 ++++++++++++++-----
.../stratos/cli/commands/AddTenantCommand.java | 20 +--
.../stratos/cli/commands/SubscribeCommand.java | 13 +-
.../apache/stratos/cli/utils/CliConstants.java | 7 +-
7 files changed, 145 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CartridgeInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CartridgeInfoBean.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CartridgeInfoBean.java
index a2b3511..67ca931 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CartridgeInfoBean.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CartridgeInfoBean.java
@@ -30,8 +30,8 @@ public class CartridgeInfoBean {
String repoPassword;
String dataCartridgeType;
String dataCartridgeAlias;
- private String asPolicy;
- private String depPolicy;
+ private String autoscalePolicy;
+ private String deploymentPolicy;
public String getCartridgeType() {
@@ -106,19 +106,19 @@ public class CartridgeInfoBean {
this.dataCartridgeAlias = dataCartridgeAlias;
}
- public String getAsPolicy() {
- return asPolicy;
+ public String getAutoscalePolicy() {
+ return autoscalePolicy;
}
- public void setAsPolicy(String asPolicy) {
- this.asPolicy = asPolicy;
+ public void setAutoscalePolicy(String autoscalePolicy) {
+ this.autoscalePolicy = autoscalePolicy;
}
- public String getDepPolicy() {
- return depPolicy;
+ public String getDeploymentPolicy() {
+ return deploymentPolicy;
}
- public void setDepPolicy(String depPolicy) {
- this.depPolicy = depPolicy;
+ public void setDeploymentPolicy(String deploymentPolicy) {
+ this.deploymentPolicy = deploymentPolicy;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
index 539ff1b..17213da 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
@@ -18,6 +18,8 @@
*/
package org.apache.stratos.cli;
+import org.apache.http.HttpResponse;
+
public interface GenericRestClient {
/**
@@ -35,7 +37,7 @@ public interface GenericRestClient {
* @throws org.apache.http.client.ClientProtocolException and IOException
* if any errors occur when executing the request
*/
- public String doPost(String resourcePath, String jsonParamString, String userName, String passWord) throws Exception;
+ public HttpResponse doPost(String resourcePath, String jsonParamString, String userName, String passWord) throws Exception;
/**
* Handle http get request. Return String
@@ -50,7 +52,7 @@ public interface GenericRestClient {
* @throws org.apache.http.client.ClientProtocolException and IOException
* if any errors occur when executing the request
*/
- public String doGet(String resourcePath, String userName, String passWord);
+ public HttpResponse doGet(String resourcePath, String userName, String passWord);
public void doDelete();
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
index 266591d..e27308e 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
@@ -58,7 +58,7 @@ public class RestClient implements GenericRestClient{
* @throws org.apache.http.client.ClientProtocolException and IOException
* if any errors occur when executing the request
*/
- public String doPost(String resourcePath, String jsonParamString, String userName, String passWord) throws Exception{
+ public HttpResponse doPost(String resourcePath, String jsonParamString, String userName, String passWord) throws Exception{
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
@@ -76,6 +76,7 @@ public class RestClient implements GenericRestClient{
httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient);
HttpResponse response = httpClient.execute(postRequest);
+ /*
int responseCode = response.getStatusLine().getStatusCode();
if (responseCode == CliConstants.RESPONSE_AUTHORIZATION_FAIL) {
@@ -95,9 +96,11 @@ public class RestClient implements GenericRestClient{
while ((output = br.readLine()) != null) {
result += output;
}
+ */
httpClient.getConnectionManager().shutdown();
- return result;
+ //return result;
+ return response;
} catch (ClientProtocolException e) {
throw new ClientProtocolException();
@@ -123,7 +126,7 @@ public class RestClient implements GenericRestClient{
* @throws org.apache.http.client.ClientProtocolException and IOException
* if any errors occur when executing the request
*/
- public String doGet(String resourcePath, String userName, String passWord) {
+ public HttpResponse doGet(String resourcePath, String userName, String passWord) {
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet getRequest = new HttpGet(resourcePath);
@@ -136,6 +139,7 @@ public class RestClient implements GenericRestClient{
httpClient = (DefaultHttpClient) WebClientWrapper.wrapClient(httpClient);
HttpResponse response = httpClient.execute(getRequest);
+ /*
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
}
@@ -147,9 +151,10 @@ public class RestClient implements GenericRestClient{
while ((output = br.readLine()) != null) {
result += output;
}
+ */
httpClient.getConnectionManager().shutdown();
- return result;
+ return response;
} catch (ClientProtocolException e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 72bcb44..9f0b696 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -26,12 +26,16 @@ import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.stratos.cli.exception.CommandException;
import org.apache.stratos.cli.utils.CliConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.ConnectException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -163,9 +167,11 @@ public class RestCommandLineService {
// List currently available multi tenant and single tenant cartridges
public void listAvailableCartridges() throws CommandException {
try {
- String resultString = restClientService.doGet(restClientService.getUrl() + listAvailableCartridgesRestEndpoint,
+ HttpResponse response = restClientService.doGet(restClientService.getUrl() + listAvailableCartridgesRestEndpoint,
restClientService.getUsername(), restClientService.getPassword());
+ String resultString = getHttpResponseString(response);
+
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
CartridgeList cartridgeList = gson.fromJson(resultString, CartridgeList.class);
@@ -241,9 +247,11 @@ public class RestCommandLineService {
public void listSubscribedCartridges(final boolean full) throws CommandException {
try {
- String resultString = restClientService.doGet(restClientService.getUrl() + listSubscribedCartridgesRestEndpoint,
+ HttpResponse response = restClientService.doGet(restClientService.getUrl() + listSubscribedCartridgesRestEndpoint,
restClientService.getUsername(), restClientService.getPassword());
+ String resultString = getHttpResponseString(response);
+
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
CartridgeList cartridgeList = gson.fromJson(resultString, CartridgeList.class);
@@ -316,8 +324,8 @@ public class RestCommandLineService {
cartridgeInfoBean.setPrivateRepo(false);
cartridgeInfoBean.setRepoUsername(null);
cartridgeInfoBean.setRepoPassword(null);
- cartridgeInfoBean.setAsPolicy(null);
- cartridgeInfoBean.setDepPolicy(null);
+ cartridgeInfoBean.setAutoscalePolicy(null);
+ cartridgeInfoBean.setDeploymentPolicy(null);
cartridgeInfoBean.setDataCartridgeType(dataCartridgeType);
cartridgeInfoBean.setDataCartridgeAlias(dataCartridgeAlias);
@@ -332,16 +340,20 @@ public class RestCommandLineService {
System.out.format("Subscribing to data cartridge %s with alias %s.%n", dataCartridgeType,
dataCartridgeAlias);
try {
- String subscription = restClientService.doPost(restClientService.getUrl() + subscribCartridgeRestEndpoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + subscribCartridgeRestEndpoint,
completeJsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
- if (subscription.equals("" + CliConstants.RESPONSE_NO_CONTENT)) {
+ String subscription = getHttpResponseString(response);
+
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+
+ if (responseCode.equals(CliConstants.RESPONSE_NO_CONTENT)) {
System.out.println("Duplicate alias. Please choose different alias");
return;
- } else if (subscription.equals("" + CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
+ } else if (responseCode.equals(CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
System.out.println("Error in backend");
return;
- } else if (subscription.equals("" + CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
+ } else if (responseCode.equals(CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operation. Authorization failed");
return;
}
@@ -368,22 +380,25 @@ public class RestCommandLineService {
cartridgeInfoBean.setRepoPassword(password);
cartridgeInfoBean.setDataCartridgeType(dataCartridgeType);
cartridgeInfoBean.setDataCartridgeAlias(dataCartridgeAlias);
- cartridgeInfoBean.setAsPolicy(asPolicy);
- cartridgeInfoBean.setDepPolicy(depPolicy);
+ cartridgeInfoBean.setAutoscalePolicy(asPolicy);
+ cartridgeInfoBean.setDeploymentPolicy(depPolicy);
jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
completeJsonSubscribeString = "{\"cartridgeInfoBean\":" + jsonSubscribeString + "}";
- String subscriptionOutput = restClientService.doPost(restClientService.getUrl() + subscribCartridgeRestEndpoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + subscribCartridgeRestEndpoint,
completeJsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
- if (subscriptionOutput.equals("" + CliConstants.RESPONSE_NO_CONTENT)) {
+ String subscriptionOutput = getHttpResponseString(response);
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+
+ if (responseCode.equals(CliConstants.RESPONSE_NO_CONTENT)) {
System.out.println("Duplicate alias. Please choose different alias");
return;
- } else if (subcriptionConnectInfo.equals("" + CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
+ } else if (responseCode.equals(CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
System.out.println("Error in backend");
return;
- } else if (subscriptionOutput.equals("" + CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
+ } else if (responseCode.equals(CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operation. Authorization failed");
return;
}
@@ -427,7 +442,7 @@ public class RestCommandLineService {
}
// This method helps to create the new tenant
- public void addTenant(String admin, String firstName, String lastaName, String password, String domain, String email, String active){
+ public void addTenant(String admin, String firstName, String lastaName, String password, String domain, String email){
try {
TenantInfoBean tenantInfo = new TenantInfoBean();
tenantInfo.setAdmin(admin);
@@ -436,7 +451,7 @@ public class RestCommandLineService {
tenantInfo.setAdminPassword(password);
tenantInfo.setTenantDomain(domain);
tenantInfo.setEmail(email);
- tenantInfo.setActive(active);
+ //tenantInfo.setActive(active);
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
@@ -444,15 +459,25 @@ public class RestCommandLineService {
String jsonString = gson.toJson(tenantInfo, TenantInfoBean.class);
String completeJsonString = "{\"tenantInfoBean\":" + jsonString + "}";
- String result = restClientService.doPost(restClientService.getUrl() + addTenantEndPoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + addTenantEndPoint,
completeJsonString, restClientService.getUsername(), restClientService.getPassword());
- if (Integer.parseInt(result) == CliConstants.RESPONSE_AUTHORIZATION_FAIL) {
+ String result = getHttpResponseString(response);
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+ System.out.println(responseCode);
+
+ if (responseCode.equals(CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operation. Authorization failed");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_NO_CONTENT) {
- System.out.println("Tenant added successfully");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_INTERNAL_SERVER_ERROR) {
+ return;
+ } else if (responseCode.equals(CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
System.out.println("Domain is not available to register. Please check domain name");
+ return;
+ } else if (responseCode.equals(CliConstants.RESPONSE_OK)){
+ System.out.println("Tenant added successfully");
+ return;
+ } else {
+ System.out.println ("Unhandle error");
+ return;
}
} catch (Exception e) {
e.printStackTrace();
@@ -473,10 +498,13 @@ public class RestCommandLineService {
// This method helps to deploy cartridge definitions
public void deployCartridgeDefinition (String cartridgeDefinition) {
try {
- String result = restClientService.doPost(restClientService.getUrl() + cartridgeDeploymentEndPoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + cartridgeDeploymentEndPoint,
cartridgeDefinition, restClientService.getUsername(), restClientService.getPassword());
- if (Integer.parseInt(result) == CliConstants.RESPONSE_AUTHORIZATION_FAIL) {
+ String result = getHttpResponseString(response);
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+
+ if (responseCode.equals(CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operations. Authorization failed");
}
else {
@@ -490,15 +518,24 @@ public class RestCommandLineService {
// This method helps to deploy partitions
public void deployPartition (String partitionDefinition) {
try {
- String result = restClientService.doPost(restClientService.getUrl() + partitionDeploymentEndPoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + partitionDeploymentEndPoint,
partitionDefinition, restClientService.getUsername(), restClientService.getPassword());
+ String result = getHttpResponseString(response);
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+
if (result.equals("true")) {
System.out.println("You have successfully deployed the partition");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_AUTHORIZATION_FAIL) {
+ return;
+ } else if (responseCode.equals(CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operations. Authorization failed");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_INTERNAL_SERVER_ERROR) {
+ return;
+ } else if (responseCode.equals(CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
System.out.println("Specified policy already exists");
+ return;
+ } else {
+ System.out.println ("Unhandle error");
+ return;
}
} catch (Exception e) {
@@ -509,15 +546,24 @@ public class RestCommandLineService {
// This method helps to deploy autoscalling polices
public void deployAutoscalingPolicy (String autoScalingPolicy) {
try {
- String result = restClientService.doPost(restClientService.getUrl() + autoscalingPolicyDeploymentEndPoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + autoscalingPolicyDeploymentEndPoint,
autoScalingPolicy, restClientService.getUsername(), restClientService.getPassword());
+ String result = getHttpResponseString(response);
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+
if (result.equals("true")) {
System.out.println("You have successfully deployed the autoscaling policy");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_AUTHORIZATION_FAIL) {
+ return;
+ } else if (responseCode.equals("" + CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operations. Authorization failed");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_INTERNAL_SERVER_ERROR) {
+ return;
+ } else if (responseCode.equals("" + CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
System.out.println("Specified policy already exists");
+ return;
+ } else {
+ System.out.println ("Unhandle error");
+ return;
}
} catch (Exception e) {
@@ -528,15 +574,24 @@ public class RestCommandLineService {
// This method helps to deploy deployment polices
public void deployDeploymentPolicy (String deploymentPolicy) {
try {
- String result = restClientService.doPost(restClientService.getUrl() + deploymentPolicyDeploymentEndPoint,
+ HttpResponse response = restClientService.doPost(restClientService.getUrl() + deploymentPolicyDeploymentEndPoint,
deploymentPolicy, restClientService.getUsername(), restClientService.getPassword());
+ String result = getHttpResponseString(response);
+ String responseCode = "" + response.getStatusLine().getStatusCode();
+
if (result.equals("true")) {
System.out.println("You have successfully deployed the deployment policy");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_AUTHORIZATION_FAIL) {
+ return;
+ } else if (responseCode.equals("" + CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
System.out.println("Invalid operations. Authorization failed");
- } else if (Integer.parseInt(result) == CliConstants.RESPONSE_INTERNAL_SERVER_ERROR) {
+ return;
+ } else if (responseCode.equals("" + CliConstants.RESPONSE_INTERNAL_SERVER_ERROR)) {
System.out.println("Specified policy already exists");
+ return;
+ } else {
+ System.out.println ("Unhandle error");
+ return;
}
} catch (Exception e) {
@@ -578,4 +633,20 @@ public class RestCommandLineService {
}
return urlBuilder.toString();
}
+
+ private String getHttpResponseString (HttpResponse response) {
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader((response.getEntity().getContent())));
+
+ String output;
+ String result = "";
+ while ((output = br.readLine()) != null) {
+ result += output;
+ }
+ return result;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
index 9f0eff2..4139866 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
@@ -153,19 +153,19 @@ public class AddTenantCommand implements Command<StratosCommandContext> {
email = commandLine.getOptionValue(CliConstants.EMAIL_OPTION);
}
- if (commandLine.hasOption(CliConstants.ACTIVE_OPTION)) {
- if (logger.isTraceEnabled()) {
- logger.trace("Tenat active option is passed");
- }
- active = commandLine.getOptionValue(CliConstants.ACTIVE_OPTION);
- }
-
- if (admin == null || firstName == null || lastaName == null || password == null || domain == null || email == null || active == null) {
- System.out.println("usage: " + getName() + " [-u <user name>] [-f <first name>] [-l <last name>] [-p <password>] [-d <domain name>] [-e <email>] [-a <active/deactivate>]");
+ //if (commandLine.hasOption(CliConstants.ACTIVE_OPTION)) {
+ // if (logger.isTraceEnabled()) {
+ // logger.trace("Tenat active option is passed");
+ // }
+ // active = commandLine.getOptionValue(CliConstants.ACTIVE_OPTION);
+ //}
+
+ if (admin == null || firstName == null || lastaName == null || password == null || domain == null || email == null) {
+ System.out.println("usage: " + getName() + " [-u <user name>] [-f <first name>] [-l <last name>] [-p <password>] [-d <domain name>] [-e <email>]");
return CliConstants.BAD_ARGS_CODE;
}
- RestCommandLineService.getInstance().addTenant(admin, firstName, lastaName, password, domain, email, active);
+ RestCommandLineService.getInstance().addTenant(admin, firstName, lastaName, password, domain, email);
return CliConstants.SUCCESSFUL_CODE;
} catch (ParseException e) {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribeCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribeCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribeCommand.java
index 8d90d0e..21bac0f 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribeCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SubscribeCommand.java
@@ -98,22 +98,18 @@ public class SubscribeCommand implements Command<StratosCommandContext> {
return options;
}
- @Override
public String getName() {
return CliConstants.SUBSCRIBE_ACTION;
}
- @Override
public String getDescription() {
return "Subscribe to a cartridge";
}
- @Override
public String getArgumentSyntax() {
return "[Cartridge type] [Cartridge alias]";
}
- @Override
public int execute(StratosCommandContext context, String[] args) throws CommandException {
if (logger.isDebugEnabled()) {
logger.debug("Executing {} command...", getName());
@@ -151,17 +147,18 @@ public class SubscribeCommand implements Command<StratosCommandContext> {
// }
// policy = commandLine.getOptionValue(CliConstants.POLICY_OPTION);
//}
- if (commandLine.hasOption(CliConstants.AUTOSCALING_POLICY_DEPLOYMENT)) {
+ if (commandLine.hasOption(CliConstants.AUTOSCALING_POLICY_OPTION)) {
if (logger.isTraceEnabled()) {
logger.trace("Autoscaling policy option is passed");
}
- asPolicy = commandLine.getOptionValue(CliConstants.AUTOSCALING_POLICY_DEPLOYMENT);
+ asPolicy = commandLine.getOptionValue(CliConstants.AUTOSCALING_POLICY_OPTION);
+ System.out.println(asPolicy);
}
- if (commandLine.hasOption(CliConstants.DEPLOYMENT_POLICY_DEPLOYMENT)) {
+ if (commandLine.hasOption(CliConstants.DEPLOYMENT_POLICY_OPTION)) {
if (logger.isTraceEnabled()) {
logger.trace("Deployment policy option is passed");
}
- depPolicy = commandLine.getOptionValue(CliConstants.DEPLOYMENT_POLICY_DEPLOYMENT);
+ depPolicy = commandLine.getOptionValue(CliConstants.DEPLOYMENT_POLICY_OPTION);
}
if (commandLine.hasOption(CliConstants.REPO_URL_OPTION)) {
if (logger.isTraceEnabled()) {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df9d500f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java
index 8a48353..47894ad 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/utils/CliConstants.java
@@ -178,7 +178,8 @@ public class CliConstants {
public static final String RESOURCE_PATH = "p";
public static final String RESOURCE_PATH_LONG_OPTION = "resource-path";
- public static final int RESPONSE_INTERNAL_SERVER_ERROR = 500;
- public static final int RESPONSE_AUTHORIZATION_FAIL = 403;
- public static final int RESPONSE_NO_CONTENT = 204;
+ public static final String RESPONSE_INTERNAL_SERVER_ERROR = "500";
+ public static final String RESPONSE_AUTHORIZATION_FAIL = "403";
+ public static final String RESPONSE_NO_CONTENT = "204";
+ public static final String RESPONSE_OK = "200";
}
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by ma...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/69e36903
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/69e36903
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/69e36903
Branch: refs/heads/master
Commit: 69e36903c7277ee6e9ce8ea931348c993c583448
Parents: df9d500 081f9fc
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Dec 12 18:08:45 2013 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Dec 12 18:08:45 2013 +0530
----------------------------------------------------------------------
.../src/conf/cartridge-config.properties | 2 +
.../manager/CartridgeSubscriptionManager.java | 2 +-
.../stratos/adc/mgt/payload/CarbonPayload.java | 8 +-
.../apache/stratos/adc/mgt/payload/Payload.java | 7 +-
.../adc/mgt/utils/CartridgeConstants.java | 1 +
.../impl/CloudControllerServiceImpl.java | 99 +++----
.../cloud/controller/pojo/Cartridge.java | 9 -
.../runtime/FasterLookUpDataHolder.java | 4 +
.../controller/topology/TopologyBuilder.java | 52 ++--
.../resources/conf/cartridge-config.properties | 2 +
.../puppet/etc/puppet/files/cartridge-agent.sh | 108 ++++++++
tools/puppet/etc/puppet/files/environment | 22 ++
.../puppet/etc/puppet/files/event-publisher.sh | 28 ++
.../puppet/etc/puppet/files/event-subscriber.sh | 28 ++
.../etc/puppet/files/get-launch-params.rb | 54 ++++
.../puppet/etc/puppet/files/health-publisher.sh | 33 +++
tools/puppet/etc/puppet/files/healthcheck.sh | 31 +++
tools/puppet/etc/puppet/fileserver.conf | 35 +++
tools/puppet/manifests/classes/apt.pp | 43 ++++
tools/puppet/manifests/classes/hosts.pp | 29 +++
tools/puppet/manifests/classes/java.pp | 65 +++++
tools/puppet/manifests/classes/mcollective.pp | 84 ++++++
tools/puppet/manifests/classes/php_cartridge.pp | 141 ++++++++++
tools/puppet/manifests/classes/ssh.pp | 61 +++++
tools/puppet/manifests/classes/system_config.pp | 77 ++++++
tools/puppet/manifests/nodes.pp | 63 +++++
tools/puppet/manifests/site.pp | 23 ++
tools/puppet/modules/apt/files/90forceyes | 23 ++
.../modules/commons/files/bin/puppet_init.sh | 53 ++++
.../modules/commons/files/bin/sign_jars.sh | 39 +++
.../configs/bin/native/wrapper-linux-x86-32 | Bin 0 -> 111027 bytes
.../commons/files/configs/lib/home/favicon.ico | Bin 0 -> 1150 bytes
tools/puppet/modules/commons/files/environment | 23 ++
.../java/files/jars/copy_java_patches_here | 22 ++
.../java/files/jdk-7u7-linux-x64.tar.gz.file | 22 ++
.../php_cartridge/etc/apache2/apache2.conf.erb | 256 +++++++++++++++++++
.../etc/apache2/sites-available/default-ssl.erb | 195 ++++++++++++++
.../etc/apache2/sites-available/default.erb | 64 +++++
.../resources/stratos_foundation.sql | 2 +-
39 files changed, 1694 insertions(+), 116 deletions(-)
----------------------------------------------------------------------