You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/03/27 13:29:07 UTC

[01/10] git commit: Organized imports in org.apache.stratos.cli

Repository: incubator-stratos
Updated Branches:
  refs/heads/master 785efe510 -> 90a0f44ff


Organized imports in org.apache.stratos.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/153a06f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/153a06f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/153a06f0

Branch: refs/heads/master
Commit: 153a06f0294ffbe8e8642a284a55254b8661ec4a
Parents: b0d3939
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Tue Mar 25 14:29:26 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Tue Mar 25 14:29:26 2014 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/Command.java    |  2 +-
 .../stratos/cli/CommandLineApplication.java     |  2 +-
 .../apache/stratos/cli/CommandLineService.java  | 10 ++--
 .../java/org/apache/stratos/cli/RestClient.java |  9 ++--
 .../stratos/cli/RestCommandLineService.java     | 30 +++++++----
 .../apache/stratos/cli/StratosApplication.java  | 56 +++++++++++++++-----
 .../apache/stratos/cli/WebClientWrapper.java    |  1 +
 7 files changed, 75 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
index 91338d3..6516556 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
@@ -18,8 +18,8 @@
  */
 package org.apache.stratos.cli;
 
-import org.apache.stratos.cli.exception.CommandException;
 import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.exception.CommandException;
 
 public interface Command<T extends CommandContext> {
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
index a3284ac..d1b644e 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
@@ -24,8 +24,8 @@ import java.io.IOException;
 import jline.console.ConsoleReader;
 import jline.console.history.FileHistory;
 
-import org.apache.stratos.cli.utils.CliConstants;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.stratos.cli.utils.CliConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
index 28f9370..3939a4d 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
@@ -38,8 +38,9 @@ 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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CommandLineUtils;
+import org.apache.stratos.cli.utils.RowMapper;
 import org.apache.stratos.manager.dto.Cartridge;
 import org.apache.stratos.manager.dto.PolicyDefinition;
 import org.apache.stratos.manager.dto.SubscriptionInfo;
@@ -56,9 +57,8 @@ import org.apache.stratos.manager.stub.ApplicationManagementServiceRepositoryReq
 import org.apache.stratos.manager.stub.ApplicationManagementServiceRepositoryTransportExceptionException;
 import org.apache.stratos.manager.stub.ApplicationManagementServiceStub;
 import org.apache.stratos.manager.stub.ApplicationManagementServiceUnregisteredCartridgeExceptionException;
-import org.apache.stratos.cli.exception.CommandException;
-import org.apache.stratos.cli.utils.CommandLineUtils;
-import org.apache.stratos.cli.utils.RowMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.gson.Gson;
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/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 32b18a2..b83813d 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
@@ -18,21 +18,18 @@
  */
 package org.apache.stratos.cli;
 
-import java.io.BufferedReader;
 import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.*;
+import java.net.ConnectException;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
-import org.apache.stratos.cli.utils.CliConstants;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
 
 public class RestClient implements GenericRestClient{
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/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 890e888..c83dd89 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
@@ -18,8 +18,24 @@
  */
 package org.apache.stratos.cli;
 
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.ConnectException;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
@@ -48,14 +64,8 @@ import org.apache.stratos.cli.utils.RowMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.net.ssl.*;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.ConnectException;
-import java.net.SocketException;
-import java.util.*;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 
 public class RestCommandLineService {
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
index a77807b..2a0a0a5 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
@@ -18,29 +18,61 @@
  */
 package org.apache.stratos.cli;
 
-import org.apache.commons.cli.*;
+import static org.apache.stratos.cli.utils.CliConstants.STRATOS_DIR;
+import static org.apache.stratos.cli.utils.CliConstants.STRATOS_HISTORY_DIR;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.text.StrTokenizer;
 import org.apache.commons.validator.routines.UrlValidator;
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
-import org.apache.stratos.cli.commands.*;
+import org.apache.stratos.cli.commands.ActivateTenantCommand;
+import org.apache.stratos.cli.commands.AddTenantCommand;
+import org.apache.stratos.cli.commands.AutoscalePolicyCommand;
+import org.apache.stratos.cli.commands.AutoscalingPolicyDeploymentCommand;
+import org.apache.stratos.cli.commands.CartridgeDeploymentCommand;
+import org.apache.stratos.cli.commands.DeactivateTenantCommand;
+import org.apache.stratos.cli.commands.DeployServiceDeploymentCommand;
+import org.apache.stratos.cli.commands.DeploymentPolicyCommand;
+import org.apache.stratos.cli.commands.DeploymentPolicyDeploymentCommand;
+import org.apache.stratos.cli.commands.DescribeAutoScalingPolicyCommand;
+import org.apache.stratos.cli.commands.DescribeCartridgeCommand;
+import org.apache.stratos.cli.commands.DescribeDeploymentPolicyCommand;
+import org.apache.stratos.cli.commands.DescribePartitionCommand;
+import org.apache.stratos.cli.commands.ExitCommand;
+import org.apache.stratos.cli.commands.HelpCommand;
+import org.apache.stratos.cli.commands.ListAllTenants;
+import org.apache.stratos.cli.commands.ListCartridgesCommand;
+import org.apache.stratos.cli.commands.ListDeployServiceCommand;
+import org.apache.stratos.cli.commands.ListMemberCommand;
+import org.apache.stratos.cli.commands.ListSubscribedCartridgesCommand;
+import org.apache.stratos.cli.commands.PartitionCommand;
+import org.apache.stratos.cli.commands.PartitionDeploymentCommand;
+import org.apache.stratos.cli.commands.SubscribeCommand;
+import org.apache.stratos.cli.commands.SubscribedCartridgeInfoCommand;
+import org.apache.stratos.cli.commands.UndeployCartridgeDefinitionCommand;
+import org.apache.stratos.cli.commands.UndeployServiceDefinitionCommand;
+import org.apache.stratos.cli.commands.UnsubscribeCommand;
 import org.apache.stratos.cli.completer.CommandCompleter;
 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.File;
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Map;
-import java.util.TreeMap;
-
-import static org.apache.stratos.cli.utils.CliConstants.STRATOS_DIR;
-import static org.apache.stratos.cli.utils.CliConstants.STRATOS_HISTORY_DIR;
-
 public class StratosApplication extends CommandLineApplication<StratosCommandContext> {
 
 	private static final Logger logger = LoggerFactory.getLogger(StratosApplication.class);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/153a06f0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/WebClientWrapper.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/WebClientWrapper.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/WebClientWrapper.java
index 20270ae..03584b3 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/WebClientWrapper.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/WebClientWrapper.java
@@ -20,6 +20,7 @@ package org.apache.stratos.cli;
 
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
+
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;


[02/10] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@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/ace7b25e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/ace7b25e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/ace7b25e

Branch: refs/heads/master
Commit: ace7b25e9ab42e93bbae1c886e12ee9ed662f7f1
Parents: 153a06f fb97ac9
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Tue Mar 25 14:29:32 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Tue Mar 25 14:29:32 2014 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 43 +-------------------
 .../cli/beans/cartridge/CartridgeInfoBean.java  | 19 ---------
 .../stratos/cli/commands/SubscribeCommand.java  | 32 +--------------
 .../apache/stratos/cli/utils/CliConstants.java  |  3 --
 4 files changed, 3 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ace7b25e/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------


[03/10] git commit: Using proper variable names for username & password

Posted by is...@apache.org.
Using proper variable names for username & password


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/770acad6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/770acad6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/770acad6

Branch: refs/heads/master
Commit: 770acad67c18547f5ba80622a93e5d62edd57cce
Parents: ace7b25
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Tue Mar 25 14:32:16 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Tue Mar 25 14:32:16 2014 +0530

----------------------------------------------------------------------
 .../stratos/cli/CommandLineApplication.java     |  8 +++----
 .../apache/stratos/cli/GenericRestClient.java   | 14 ++++++-------
 .../java/org/apache/stratos/cli/RestClient.java | 22 ++++++++++----------
 .../apache/stratos/cli/StratosApplication.java  |  6 +++---
 4 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/770acad6/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
index d1b644e..6b80c57 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
@@ -35,11 +35,11 @@ public abstract class CommandLineApplication<T extends CommandContext> {
 
 	protected ConsoleReader reader;
 	protected FileHistory history;
-    protected String userName;
+    protected String username;
 
 	public CommandLineApplication(String[] args) {
         if (args != null && args.length > 1) {
-            userName = args[1];
+            username = args[1];
         }
         reader = createConsoleReader();
     }
@@ -54,7 +54,7 @@ public abstract class CommandLineApplication<T extends CommandContext> {
 		try {
 			consoleReader = new ConsoleReader();
 			consoleReader.setPrompt(getPrompt());
-			history = new FileHistory(getHistoryFile(userName));
+			history = new FileHistory(getHistoryFile(username));
 			consoleReader.setHistory(history);
 		} catch (IOException e) {
 			throw new IllegalStateException("Cannot create jline console reader", e);
@@ -87,7 +87,7 @@ public abstract class CommandLineApplication<T extends CommandContext> {
 	 * 
 	 * @return File for storing history
 	 */
-	protected abstract File getHistoryFile(String userName);
+	protected abstract File getHistoryFile(String username);
 
 	public final void start(String[] args) {
 		Thread shutdownHookThread = new Thread("CLI Shutdown Hook") {

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/770acad6/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 0d9b5a6..1a11f9a 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
@@ -30,33 +30,33 @@ public interface GenericRestClient {
      *              This should be REST endpoint
      * @param jsonParamString
      *              The json string which should be executed from the post request
-     * @param userName
+     * @param username
      *              User name for basic auth
-     * @param passWord
+     * @param password
      *              Password for basic auth
      * @return The HttpResponse
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
     public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString,
-                               String userName, String passWord) throws Exception;
+                               String username, String password) throws Exception;
 
     /**
      * Handle http get request. Return String
      *
      * @param resourcePath
      *              This should be REST endpoint
-     * @param userName
+     * @param username
      *              User name for basic auth
-     * @param passWord
+     * @param password
      *              Password for basic auth
      * @return The HttpResponse
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath, String userName, String passWord) throws Exception;
+    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath, String username, String password) throws Exception;
 
-    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath, String userName, String passWord);
+    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath, String username, String password);
 
     public void doPut();
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/770acad6/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 b83813d..30432fb 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
@@ -54,16 +54,16 @@ public class RestClient implements GenericRestClient{
      *              This should be REST endpoint
      * @param jsonParamString
      *              The json string which should be executed from the post request
-     * @param userName
+     * @param username
      *              User name for basic auth
-     * @param passWord
+     * @param password
      *              Password for basic auth
      * @return The HttpResponse
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString, String userName,
-                               String passWord) throws Exception{
+    public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString, String username,
+                               String password) throws Exception{
         try {
             HttpPost postRequest = new HttpPost(resourcePath);
 
@@ -71,7 +71,7 @@ public class RestClient implements GenericRestClient{
             input.setContentType("application/json");
             postRequest.setEntity(input);
 
-            String userPass = userName + ":" + passWord;
+            String userPass = username + ":" + password;
             String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             postRequest.addHeader("Authorization", basicAuth);
 
@@ -102,20 +102,20 @@ public class RestClient implements GenericRestClient{
      *              This should be httpClient which used to connect to rest endpoint
      * @param resourcePath
      *              This should be REST endpoint
-     * @param userName
+     * @param username
      *              User name for basic auth
-     * @param passWord
+     * @param password
      *              Password for basic auth
      * @return The HttpResponse
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath, String userName, String passWord) throws Exception{
+    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath, String username, String password) throws Exception{
         try {
             HttpGet getRequest = new HttpGet(resourcePath);
             getRequest.addHeader("Content-Type", "application/json");
 
-            String userPass = userName + ":" + passWord;
+            String userPass = username + ":" + password;
             String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             getRequest.addHeader("Authorization", basicAuth);
 
@@ -138,12 +138,12 @@ public class RestClient implements GenericRestClient{
         }
     }
 
-    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath, String userName, String passWord) {
+    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath, String username, String password) {
         try {
             HttpDelete httpDelete = new HttpDelete(resourcePath);
             httpDelete.addHeader("Content-Type", "application/json");
 
-            String userPass = userName + ":" + passWord;
+            String userPass = username + ":" + password;
             String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userPass.getBytes("UTF-8"));
             httpDelete.addHeader("Authorization", basicAuth);
 

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/770acad6/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
index 2a0a0a5..9d435d7 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
@@ -227,9 +227,9 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 	}
 
 	@Override
-	protected File getHistoryFile(String userName) {
+	protected File getHistoryFile(String username) {
 		File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR);
-		File historyFile = new File(stratosFile, STRATOS_HISTORY_DIR + "_" + userName);
+		File historyFile = new File(stratosFile, STRATOS_HISTORY_DIR + "_" + username);
 		return historyFile;
 	}
 
@@ -401,7 +401,7 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 
         // This is to create the history file.
         // This section execute only when user didn't enter the username as command line arguments
-        if (userName == null) {
+        if (username == null) {
             reader = null;
             reader = createConsoleReaderWhithoutArgs(usernameInput);
         }


[10/10] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@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/90a0f44f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/90a0f44f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/90a0f44f

Branch: refs/heads/master
Commit: 90a0f44ff28a90d0bdbf2c0914727c5c2567d443
Parents: bf70f20 785efe5
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Thu Mar 27 17:58:35 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Thu Mar 27 17:58:35 2014 +0530

----------------------------------------------------------------------
 .../topology/TopologyEventMessageQueue.java     |  21 +-
 .../cloud/controller/pojo/Cartridge.java        |  12 +
 .../cloud/controller/pojo/CartridgeConfig.java  |  12 +
 .../controller/util/CloudControllerUtil.java    |   2 +-
 .../console/controllers/mycartridges.jag        |  15 +
 .../console/data/clusters.json                  | 391 +++++--------------
 .../themes/theme1/partials/cartridges.hbs       | 107 +++--
 .../themes/theme1/partials/mycartridges.hbs     |  86 ++--
 .../themes/theme1/renderers/cartridges.js       |  30 +-
 .../console/themes/theme1/renderers/index.js    |  45 ++-
 .../console/themes/theme1/ui/css/main.css       |   9 +
 .../console/themes/theme1/ui/js/mycartridges.js |  11 +
 .../console/util/utility.jag                    |   6 +
 .../apache/stratos/manager/dto/Cartridge.java   |  10 +
 .../manager/service/RepositoryInfoBean.java     |  11 +-
 .../InternalRepoBasedCartridgeSubscription.java |  78 ++++
 .../manager/subscription/SubscriptionData.java  |   9 +
 .../factory/CartridgeSubscriptionFactory.java   |   3 +
 .../manager/utils/CartridgeConstants.java       |   3 +
 .../manager/utils/RepositoryCreator.java        |  18 +-
 .../ClusterCreatedMessageProcessor.java         |  15 +-
 .../topology/TopologyMessageProcessorChain.java |   1 +
 .../topology/TopologyEventMessageDelegator.java |   2 +-
 .../rest/endpoint/bean/CartridgeInfoBean.java   |   9 +
 .../definition/CartridgeDefinitionBean.java     |   2 +
 .../bean/util/converter/PojoConverter.java      |   2 +-
 .../rest/endpoint/services/ServiceUtils.java    |   3 +-
 .../main/resources/CloudControllerService.wsdl  |   1 +
 tools/puppet3/manifests/nodes.pp                |   1 +
 .../jndi.properties.activemq.template.erb       |  25 --
 .../conf/templates/jndi.properties.template.erb |  15 +-
 tools/puppet3/modules/lb/manifests/init.pp      |   1 +
 .../conf/templates/jndi.properties.template.erb |  33 ++
 33 files changed, 576 insertions(+), 413 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/90a0f44f/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------


[07/10] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@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/d052ada5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/d052ada5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/d052ada5

Branch: refs/heads/master
Commit: d052ada51b429f9fa76c72e05dbc78ac0a8b3063
Parents: e71e22f fc59089
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Wed Mar 26 12:04:51 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Wed Mar 26 12:04:51 2014 +0530

----------------------------------------------------------------------
 .../impl/CloudControllerServiceImpl.java        |   5 +
 .../interfaces/CloudControllerService.java      |  13 +-
 .../main/resources/CloudControllerService.wsdl  | 391 +++++-----
 .../puppet/manifests/nodes.pp.sample.multinode  | 107 +++
 .../puppet/manifests/nodes.pp.sample.singlenode | 112 +++
 tools/puppet/modules/agent/LICENSE              |  16 +
 tools/puppet/modules/agent/manifests/init.pp    |  76 ++
 .../modules/agent/manifests/initialize.pp       |  63 ++
 .../modules/agent/manifests/push_templates.pp   |  31 +
 tools/puppet/modules/agent/manifests/start.pp   |  31 +
 .../modules/agent/templates/bin/stratos.sh.erb  |  44 ++
 .../conf/templates/jndi.properties.template.erb |  26 +
 .../templates/extensions/addons/_mysql.erb      |  21 +
 .../templates/extensions/addons/_nodejs.erb     |   4 +
 .../agent/templates/extensions/addons/_php.erb  |   1 +
 .../extensions/artifacts-updated.sh.erb         |  33 +
 .../agent/templates/extensions/clean.sh.erb     |  28 +
 .../extensions/instance-activated.sh.erb        |  28 +
 .../extensions/instance-started.sh.erb          |  33 +
 .../templates/extensions/start-servers.sh.erb   |  31 +
 tools/puppet/modules/autoscaler/LICENSE         |  16 +
 .../autoscaler/files/configs/bin/stratos.sh     | 298 ++++++++
 .../modules/autoscaler/manifests/clean.pp       |  50 ++
 .../modules/autoscaler/manifests/deploy.pp      |  47 ++
 .../puppet/modules/autoscaler/manifests/init.pp | 102 +++
 .../modules/autoscaler/manifests/initialize.pp  |  64 ++
 .../modules/autoscaler/manifests/params.pp      |  43 ++
 .../autoscaler/manifests/push_templates.pp      |  31 +
 .../modules/autoscaler/manifests/start.pp       |  33 +
 .../templates/conf/autoscaler.xml.erb           |  42 ++
 .../templates/conf/axis2/axis2.xml.erb          | 701 ++++++++++++++++++
 .../autoscaler/templates/conf/carbon.xml.erb    | 625 ++++++++++++++++
 .../templates/conf/jndi.properties.erb          |   4 +
 tools/puppet/modules/cc/LICENSE                 |  16 +
 tools/puppet/modules/cc/manifests/clean.pp      |  49 ++
 tools/puppet/modules/cc/manifests/deploy.pp     |  47 ++
 tools/puppet/modules/cc/manifests/init.pp       | 102 +++
 tools/puppet/modules/cc/manifests/initialize.pp |  63 ++
 tools/puppet/modules/cc/manifests/params.pp     |  71 ++
 .../modules/cc/manifests/push_templates.pp      |  31 +
 tools/puppet/modules/cc/manifests/start.pp      |  32 +
 .../cc/templates/conf/axis2/axis2.xml.erb       | 703 ++++++++++++++++++
 .../modules/cc/templates/conf/carbon.xml.erb    | 625 ++++++++++++++++
 .../cc/templates/conf/cloud-controller.xml.erb  |  61 ++
 .../cc/templates/conf/cloud-controller/_ec2.erb |  13 +
 .../conf/cloud-controller/_openstack.erb        |  14 +
 .../cc/templates/conf/jndi.properties.erb       |   4 +
 tools/puppet/modules/cep/LICENSE                |  13 +
 .../modules/cep/files/configs/bin/wso2server.sh | 304 ++++++++
 .../dropins/activemq_client_5.8.0_1.0.0.jar     | Bin 0 -> 1032400 bytes
 .../dropins/andes_client_0.13.wso2v8_1.0.0.jar  | Bin 0 -> 1854829 bytes
 ...che.stratos.cep.extension-1.0.0-SNAPSHOT.jar | Bin 0 -> 16495 bytes
 .../repository/conf/siddhi/siddhi.extension     |   3 +
 .../repository/conf/stream-manager-config.xml   | 269 +++++++
 .../HealthStatisticsEventBuilder.xml            |  10 +
 .../InstanceStatusStatisticsBuilder.xml         |  10 +
 .../LoadBalancerStatisticsEventBuilder.xml      |  10 +
 .../AverageInFlightRequestsEventFormatter.xml   |  11 +
 .../AverageLoadAverageEventFormatter.xml        |  11 +
 .../AverageMemoryConsumptionEventFormatter.xml  |  11 +
 .../FaultMessageEventFormatter.xml              |  11 +
 .../GradientInFlightRequestsEventFormatter.xml  |  11 +
 .../GradientLoadAverageEventFormatter.xml       |  11 +
 .../GradientMemoryConsumptionEventFormatter.xml |  11 +
 .../MemberAverageLoadAverageEventFormatter.xml  |  11 +
 ...erAverageMemoryConsumptionEventFormatter.xml |  11 +
 .../MemberGradientLoadAverageEventFormatter.xml |  11 +
 ...rGradientMemoryConsumptionEventFormatter.xml |  11 +
 ...econdDerivativeLoadAverageEventFormatter.xml |  11 +
 ...erivativeMemoryConsumptionEventFormatter.xml |  11 +
 ...DerivativeInFlightRequestsEventFormatter.xml |  11 +
 ...econdDerivativeLoadAverageEventFormatter.xml |  11 +
 ...erivativeMemoryConsumptionEventFormatter.xml |  11 +
 .../executionplans/AverageHeathRequest.xml      |  29 +
 .../AverageInFlightRequestsFinder.xml           |  19 +
 .../executionplans/GradientOfHealthRequest.xml  |  30 +
 .../GradientOfRequestsInFlightFinder.xml        |  18 +
 .../SecondDerivativeOfHealthRequest.xml         |  27 +
 ...SecondDerivativeOfRequestsInFlightFinder.xml |  19 +
 .../DefaultWSO2EventInputAdaptor.xml            |   3 +
 .../DefaultWSO2EventOutputAdaptor.xml           |   8 +
 .../outputeventadaptors/JMSOutputAdaptor.xml    |   8 +
 tools/puppet/modules/cep/manifests/clean.pp     |  45 ++
 tools/puppet/modules/cep/manifests/deploy.pp    |  43 ++
 tools/puppet/modules/cep/manifests/init.pp      | 101 +++
 .../puppet/modules/cep/manifests/initialize.pp  |  59 ++
 tools/puppet/modules/cep/manifests/params.pp    |  69 ++
 .../modules/cep/manifests/push_templates.pp     |  26 +
 tools/puppet/modules/cep/manifests/start.pp     |  27 +
 .../cep/templates/conf/axis2/axis2.xml.erb      | 698 ++++++++++++++++++
 .../modules/cep/templates/conf/carbon.xml.erb   | 609 ++++++++++++++++
 .../cep/templates/conf/jndi.properties.erb      |  32 +
 .../JMSOutputAdaptor.xml.erb                    |   8 +
 tools/puppet/modules/haproxy/LICENSE            |  16 +
 tools/puppet/modules/haproxy/manifests/init.pp  |  71 ++
 .../modules/haproxy/manifests/initialize.pp     |  64 ++
 .../modules/haproxy/manifests/push_templates.pp |  31 +
 tools/puppet/modules/haproxy/manifests/start.pp |  31 +
 .../templates/bin/haproxy-extension.sh.erb      |  48 ++
 .../haproxy/templates/conf/jndi.properties.erb  |  23 +
 tools/puppet/modules/lb/LICENSE                 |  16 +
 tools/puppet/modules/lb/manifests/clean.pp      |  50 ++
 tools/puppet/modules/lb/manifests/deploy.pp     |  48 ++
 tools/puppet/modules/lb/manifests/init.pp       |  95 +++
 tools/puppet/modules/lb/manifests/initialize.pp |  64 ++
 tools/puppet/modules/lb/manifests/params.pp     |  43 ++
 .../modules/lb/manifests/push_templates.pp      |  31 +
 tools/puppet/modules/lb/manifests/start.pp      |  32 +
 .../lb/templates/conf/axis2/axis2.xml.erb       | 527 ++++++++++++++
 .../lb/templates/conf/loadbalancer.conf.erb     | 142 ++++
 tools/puppet/modules/manager/LICENSE            |  16 +
 tools/puppet/modules/manager/README             |   3 +
 .../lib/copy_mysql-connector-jar_here           |   0
 tools/puppet/modules/manager/manifests/clean.pp |  49 ++
 .../puppet/modules/manager/manifests/deploy.pp  |  48 ++
 tools/puppet/modules/manager/manifests/init.pp  | 104 +++
 .../modules/manager/manifests/initialize.pp     |  63 ++
 .../puppet/modules/manager/manifests/params.pp  |  46 ++
 .../modules/manager/manifests/push_templates.pp |  31 +
 tools/puppet/modules/manager/manifests/start.pp |  33 +
 .../manager/templates/conf/axis2/axis2.xml.erb  | 702 ++++++++++++++++++
 .../manager/templates/conf/carbon.xml.erb       | 625 ++++++++++++++++
 .../conf/cartridge-config.properties.erb        |  73 ++
 .../conf/datasources/master-datasources.xml.erb |  27 +
 .../datasources/stratos-datasources.xml.erb     |  66 ++
 .../manager/templates/conf/jndi.properties.erb  |   4 +
 tools/puppet/modules/messagebroker/LICENSE      |  13 +
 .../files/configs/bin/wso2server.sh             | 300 ++++++++
 .../modules/messagebroker/manifests/clean.pp    |  45 ++
 .../modules/messagebroker/manifests/deploy.pp   |  43 ++
 .../modules/messagebroker/manifests/init.pp     |  99 +++
 .../messagebroker/manifests/initialize.pp       |  59 ++
 .../modules/messagebroker/manifests/params.pp   |  66 ++
 .../messagebroker/manifests/push_templates.pp   |  26 +
 .../modules/messagebroker/manifests/start.pp    |  27 +
 .../templates/conf/axis2/axis2.xml.erb          | 719 +++++++++++++++++++
 .../messagebroker/templates/conf/carbon.xml.erb | 583 +++++++++++++++
 137 files changed, 12688 insertions(+), 168 deletions(-)
----------------------------------------------------------------------



[08/10] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@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/5e2fac62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/5e2fac62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/5e2fac62

Branch: refs/heads/master
Commit: 5e2fac62f38f9a50a00b67c4af135bc3c1063011
Parents: d052ada cbf7c38
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Wed Mar 26 16:25:01 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Wed Mar 26 16:25:01 2014 +0530

----------------------------------------------------------------------
 .../topology/AutoscalerTopologyReceiver.java    |   5 +-
 .../topology/TopologyEventMessageListener.java  |  53 +++++++++
 .../topology/TopologyEventMessageQueue.java     |  45 +++++++
 .../cloud/controller/iaases/AWSEC2Iaas.java     |   5 +
 .../controller/iaases/OpenstackNovaIaas.java    |  94 +++++++++++++++
 .../cloud/controller/iaases/VCloudIaas.java     |   5 +
 .../impl/CloudControllerServiceImpl.java        | 118 +++++++++++++++----
 .../cloud/controller/interfaces/Iaas.java       |  10 ++
 .../util/CloudControllerConstants.java          |   2 +
 .../utils/CartridgeSubscriptionUtils.java       |  50 ++++++--
 .../broker/publish/TopicPublisher.java          |  12 +-
 .../health/stat/HealthStatReceiver.java         |   4 +-
 .../topology/TopologyEventMessageDelegator.java |  12 +-
 .../receiver/topology/TopologyReceiver.java     |  18 ++-
 .../jndi.properties.activemq.template.erb       |  25 ++++
 15 files changed, 416 insertions(+), 42 deletions(-)
----------------------------------------------------------------------



[06/10] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by is...@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/e71e22f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/e71e22f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/e71e22f1

Branch: refs/heads/master
Commit: e71e22f1b17579482dd856a9243b7d35dc351b5b
Parents: da94da3 0cc553b
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Wed Mar 26 11:39:35 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Wed Mar 26 11:39:35 2014 +0530

----------------------------------------------------------------------
 .../stratos/manager/lb/category/DefaultLoadBalancerCategory.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------



[09/10] git commit: STRATOS-561 Added CLI command and back-end implementation

Posted by is...@apache.org.
STRATOS-561 Added CLI command and back-end implementation


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/bf70f20f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/bf70f20f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/bf70f20f

Branch: refs/heads/master
Commit: bf70f20f9198b1f32b07eea85401e5e1c801df5a
Parents: 5e2fac6
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Thu Mar 27 17:58:28 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Thu Mar 27 17:58:28 2014 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 27 ++++++++++++++
 .../apache/stratos/cli/StratosApplication.java  |  5 ++-
 .../stratos/cli/commands/SyncCommand.java       |  8 ++--
 .../repository/RepositoryNotification.java      | 39 +++++++++++---------
 .../rest/endpoint/services/ServiceUtils.java    | 15 ++++++++
 .../rest/endpoint/services/StratosAdmin.java    | 11 ++++++
 6 files changed, 82 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bf70f20f/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 61c5314..b49f1c9 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
@@ -82,6 +82,7 @@ public class RestCommandLineService {
     private final String addTenantEndPoint = "/stratos/admin/tenant";
     private final String unsubscribeTenantEndPoint = "/stratos/admin/cartridge/unsubscribe";
     private final String cartridgeDeploymentEndPoint = "/stratos/admin/cartridge/definition";
+    private final String syncEndPoint = "/stratos/admin/sync";
     private final String partitionDeploymentEndPoint = "/stratos/admin/policy/deployment/partition";
     private final String autoscalingPolicyDeploymentEndPoint = "/stratos/admin/policy/autoscale";
     private final String deploymentPolicyDeploymentEndPoint = "/stratos/admin/policy/deployment";
@@ -1648,6 +1649,32 @@ public class RestCommandLineService {
             httpClient.getConnectionManager().shutdown();
         }
     }
+    
+	public void sync(String alias) throws CommandException {
+		DefaultHttpClient httpClient = new DefaultHttpClient();
+		try {
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL() + syncEndPoint, alias);
+
+			String responseCode = "" + response.getStatusLine().getStatusCode();
+
+			if (responseCode.equals(CliConstants.RESPONSE_OK)) {
+				System.out.format("Synchronizing repository for alias: %s%n", alias);
+				return;
+			} else {
+				GsonBuilder gsonBuilder = new GsonBuilder();
+				Gson gson = gsonBuilder.create();
+				String resultString = getHttpResponseString(response);
+				ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
+				System.out.println(exception);
+				return;
+			}
+
+		} catch (Exception e) {
+			handleException("Exception when synchronizing repository for alias: " + alias, e);
+		} finally {
+			httpClient.getConnectionManager().shutdown();
+		}
+	}
 
     // This class convert JSON string to deploymentpolicylist object
     private class DeploymentPolicyList {

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bf70f20f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
index 9d435d7..8a888ee 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
@@ -64,6 +64,7 @@ import org.apache.stratos.cli.commands.PartitionCommand;
 import org.apache.stratos.cli.commands.PartitionDeploymentCommand;
 import org.apache.stratos.cli.commands.SubscribeCommand;
 import org.apache.stratos.cli.commands.SubscribedCartridgeInfoCommand;
+import org.apache.stratos.cli.commands.SyncCommand;
 import org.apache.stratos.cli.commands.UndeployCartridgeDefinitionCommand;
 import org.apache.stratos.cli.commands.UndeployServiceDefinitionCommand;
 import org.apache.stratos.cli.commands.UnsubscribeCommand;
@@ -206,8 +207,8 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 		//command = new RemoveDomainMappingCommand();
 		//commands.put(command.getName(), command);
 		
-		//command = new SyncCommand();
-		//commands.put(command.getName(), command);
+		command = new SyncCommand();
+		commands.put(command.getName(), command);
 		
 		//command = new PoliciesCommand();
 		//commands.put(command.getName(), command);

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bf70f20f/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
index 7c32a27..f866813 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
@@ -19,13 +19,13 @@
 package org.apache.stratos.cli.commands;
 
 import org.apache.commons.cli.Options;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.stratos.cli.Command;
-import org.apache.stratos.cli.CommandLineService;
+import org.apache.stratos.cli.RestCommandLineService;
 import org.apache.stratos.cli.StratosCommandContext;
 import org.apache.stratos.cli.exception.CommandException;
 import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class SyncCommand implements Command<StratosCommandContext> {
 
@@ -60,7 +60,7 @@ public class SyncCommand implements Command<StratosCommandContext> {
 				logger.debug("Synchronizing repository for alias {}", alias);
 			}
 
-			CommandLineService.getInstance().sync(alias);
+			RestCommandLineService.getInstance().sync(alias);
 			return CliConstants.SUCCESSFUL_CODE;
 		} else {
 			context.getStratosApplication().printUsage(getName());

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bf70f20f/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/repository/RepositoryNotification.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/repository/RepositoryNotification.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/repository/RepositoryNotification.java
index 6b543d2..a814055 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/repository/RepositoryNotification.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/repository/RepositoryNotification.java
@@ -48,24 +48,29 @@ public class RepositoryNotification {
             }
 
             for (CartridgeSubscription cartridgeSubscription : cartridgeSubscriptions) {
-
-                if (cartridgeSubscription.getRepository() != null) {
-                    InstanceNotificationPublisher publisher = new InstanceNotificationPublisher();
-                    publisher.sendArtifactUpdateEvent(cartridgeSubscription.getRepository(), String.valueOf(cartridgeSubscription.getCluster().getId()),
-                            String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));
-
-                    if (log.isDebugEnabled()) {
-                        log.debug("Git pull request from " + cartridgeSubscription.getRepository() + "repository, for the tenant " +
-                                String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));
-                    }
-
-                } else {
-                    if(log.isDebugEnabled()) {
-                        log.debug("No repository found for subscription with alias: " + cartridgeSubscription.getAlias() + ", type: " + cartridgeSubscription.getType()+
-                                ". Not sending the Artifact Updated event");
-                    }
-                }
+            	updateRepository(cartridgeSubscription);
             }
         }
     }
+    
+	public void updateRepository(CartridgeSubscription cartridgeSubscription) {
+		if (cartridgeSubscription.getRepository() != null) {
+			InstanceNotificationPublisher publisher = new InstanceNotificationPublisher();
+			publisher.sendArtifactUpdateEvent(cartridgeSubscription.getRepository(),
+					String.valueOf(cartridgeSubscription.getCluster().getId()),
+					String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));
+
+			if (log.isDebugEnabled()) {
+				log.debug("Git pull request from " + cartridgeSubscription.getRepository()
+						+ "repository, for the tenant "
+						+ String.valueOf(cartridgeSubscription.getSubscriber().getTenantId()));
+			}
+
+		} else {
+			if (log.isDebugEnabled()) {
+				log.debug("No repository found for subscription with alias: " + cartridgeSubscription.getAlias()
+						+ ", type: " + cartridgeSubscription.getType() + ". Not sending the Artifact Updated event");
+			}
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bf70f20f/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index ce3bcf1..54eb15b 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -954,6 +954,10 @@ public class ServiceUtils {
         }
         return true;
     }
+    
+    public static CartridgeSubscription getCartridgeSubscription(String alias, ConfigurationContext configurationContext) {
+    	return cartridgeSubsciptionManager.getCartridgeSubscription(ApplicationManagementUtil.getTenantId(configurationContext), alias);
+    }
 
     static SubscriptionInfo subscribeToCartridge (CartridgeInfoBean cartridgeInfoBean, ConfigurationContext configurationContext, String tenantUsername,
                                                   String tenantDomain) throws RestAPIException {
@@ -1164,5 +1168,16 @@ public class ServiceUtils {
             throw new RestAPIException(msg, e);
         }
     }
+    
+    static void sendRepositoryNotification(CartridgeSubscription cartridgeSubscription) throws RestAPIException {
+        try {
+            RepositoryNotification repoNotification = new RepositoryNotification();
+            repoNotification.updateRepository(cartridgeSubscription);
+        } catch (Exception e) {
+            String msg = "Failed to get git repository notifications. Cause : " + e.getMessage();
+            log.error(msg, e);
+            throw new RestAPIException(msg, e);
+        }
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bf70f20f/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
index 8198848..5f411dc 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
@@ -26,6 +26,7 @@ import org.apache.stratos.common.util.ClaimsMgtUtil;
 import org.apache.stratos.common.util.CommonUtil;
 import org.apache.stratos.manager.dto.Cartridge;
 import org.apache.stratos.manager.dto.SubscriptionInfo;
+import org.apache.stratos.manager.subscription.CartridgeSubscription;
 import org.apache.stratos.rest.endpoint.ServiceHolder;
 import org.apache.stratos.rest.endpoint.Utils;
 import org.apache.stratos.rest.endpoint.annotation.AuthorizationAction;
@@ -61,6 +62,7 @@ import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
@@ -961,6 +963,15 @@ public class StratosAdmin extends AbstractAdmin {
 
         ServiceUtils.getGitRepositoryNotification(payload);
     }
+    
+	@POST
+	@Path("/sync")
+	@Consumes("application/json")
+	@AuthorizationAction("/permission/protected/manage/monitor/tenants")
+	public void synchronizeRepository(String alias) throws RestAPIException {
+		CartridgeSubscription cartridgeSubscription = ServiceUtils.getCartridgeSubscription(alias, getConfigContext());
+		ServiceUtils.sendRepositoryNotification(cartridgeSubscription);
+	}
 
     private List<TenantInfoBean> getAllTenants() throws RestAPIException {
         TenantManager tenantManager = ServiceHolder.getTenantManager();


[04/10] git commit: Organized imports in org.apache.stratos.cli

Posted by is...@apache.org.
Organized imports in org.apache.stratos.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/e8bb7830
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/e8bb7830
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/e8bb7830

Branch: refs/heads/master
Commit: e8bb78301f73678c20cdf9ca812af9142f371c2d
Parents: 770acad
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Tue Mar 25 14:33:21 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Tue Mar 25 14:33:21 2014 +0530

----------------------------------------------------------------------
 .../main/java/org/apache/stratos/cli/RestCommandLineService.java    | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e8bb7830/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 9513c42..1d27570 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
@@ -42,7 +42,6 @@ import org.apache.axis2.context.ConfigurationContext;
 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.http.impl.client.DefaultHttpClient;


[05/10] git commit: Code cleanup. Removed unnecessary getters for Username and Password as those are already available in RestClient.

Posted by is...@apache.org.
Code cleanup. Removed unnecessary getters for Username and Password as
those are already available in RestClient.

Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/da94da33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/da94da33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/da94da33

Branch: refs/heads/master
Commit: da94da3322c23c2167990ccd1e39e0ece83d7589
Parents: e8bb783
Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Authored: Tue Mar 25 14:55:47 2014 +0530
Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
Committed: Tue Mar 25 14:55:47 2014 +0530

----------------------------------------------------------------------
 .../apache/stratos/cli/GenericRestClient.java   |  15 +-
 .../java/org/apache/stratos/cli/RestClient.java |  50 ++-----
 .../stratos/cli/RestCommandLineService.java     | 140 ++++++++-----------
 3 files changed, 78 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/da94da33/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 1a11f9a..15bc3d6 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
@@ -30,33 +30,24 @@ public interface GenericRestClient {
      *              This should be REST endpoint
      * @param jsonParamString
      *              The json string which should be executed from the post request
-     * @param username
-     *              User name for basic auth
-     * @param password
-     *              Password for basic auth
      * @return The HttpResponse
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString,
-                               String username, String password) throws Exception;
+    public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString) throws Exception;
 
     /**
      * Handle http get request. Return String
      *
      * @param resourcePath
      *              This should be REST endpoint
-     * @param username
-     *              User name for basic auth
-     * @param password
-     *              Password for basic auth
      * @return The HttpResponse
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath, String username, String password) throws Exception;
+    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath) throws Exception;
 
-    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath, String username, String password);
+    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath);
 
     public void doPut();
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/da94da33/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 30432fb..a33dbf1 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
@@ -33,19 +33,23 @@ import org.apache.http.params.HttpParams;
 
 public class RestClient implements GenericRestClient{
 
-    private String url;
+    private String baseURL;
     private String username;
     private String password;
 
     private final int TIME_OUT_PARAM = 6000000;
 
-    RestClient(String url, String username, String password) {
-        this.setUrl(url);
-        this.setUsername(username);
-        this.setPassword(password);
+    public RestClient(String baseURL, String username, String password) {
+        this.baseURL = baseURL;
+        this.username = username;
+        this.password = password;
     }
 
-    /**
+    public String getBaseURL() {
+		return baseURL;
+	}
+
+	/**
      * Handle http post request. Return String
      *
      * @param  httpClient
@@ -62,8 +66,7 @@ public class RestClient implements GenericRestClient{
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString, String username,
-                               String password) throws Exception{
+    public HttpResponse doPost(DefaultHttpClient httpClient, String resourcePath, String jsonParamString) throws Exception{
         try {
             HttpPost postRequest = new HttpPost(resourcePath);
 
@@ -110,7 +113,7 @@ public class RestClient implements GenericRestClient{
      * @throws org.apache.http.client.ClientProtocolException and IOException
      *             if any errors occur when executing the request
      */
-    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath, String username, String password) throws Exception{
+    public HttpResponse doGet(DefaultHttpClient httpClient, String resourcePath) throws Exception{
         try {
             HttpGet getRequest = new HttpGet(resourcePath);
             getRequest.addHeader("Content-Type", "application/json");
@@ -138,7 +141,7 @@ public class RestClient implements GenericRestClient{
         }
     }
 
-    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath, String username, String password) {
+    public HttpResponse doDelete(DefaultHttpClient httpClient, String resourcePath) {
         try {
             HttpDelete httpDelete = new HttpDelete(resourcePath);
             httpDelete.addHeader("Content-Type", "application/json");
@@ -167,30 +170,7 @@ public class RestClient implements GenericRestClient{
     }
 
     public void doPut() {
-        //To change body of implemented methods use File | Settings | File Templates.
+        // Not implemented
     }
 
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/da94da33/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 1d27570..61c5314 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
@@ -70,10 +70,9 @@ public class RestCommandLineService {
 
 	private static final Logger logger = LoggerFactory.getLogger(RestCommandLineService.class);
 
-    private RestClient restClientService;
+    private RestClient restClient;
 
     // REST endpoints
-    private final String initializeEndpoint = "/stratos/admin/init";
     private final String initializeCookieEndpoint = "/stratos/admin/cookie";
     private final String listAvailableCartridgesRestEndpoint = "/stratos/admin/cartridge/available/list";
     private final String listSubscribedCartridgesRestEndpoint = "/stratos/admin/cartridge/list/subscribed";
@@ -139,6 +138,10 @@ public class RestCommandLineService {
         // Initialized client
         try {
             initializeRestClient(serverURL, username, password);
+            
+            if (logger.isDebugEnabled()) {
+                logger.debug("Initialized REST Client for user {}", username);
+            }
         } catch (AxisFault e) {
             System.out.println("Error connecting to the back-end");
             throw new CommandException(e);
@@ -147,8 +150,7 @@ public class RestCommandLineService {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
             if (validateLogin) {
-                HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + initializeCookieEndpoint,
-                        restClientService.getUsername(), restClientService.getPassword());
+                HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL() + initializeCookieEndpoint);
 
                 if (response != null) {
                     String responseCode = "" + response.getStatusLine().getStatusCode();
@@ -160,11 +162,6 @@ public class RestCommandLineService {
                         return false;
                     }
                 }
-
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Tenant Domain {}", restClientService.getUsername());
-                }
-
                 return true;
             } else {
                 // Just return true as we don't need to validate
@@ -209,15 +206,14 @@ public class RestCommandLineService {
         //option.setManageSession(true);
         //option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator);
         //option.setTimeOutInMilliSeconds(300000);
-        this.restClientService = restClient;
+        this.restClient = restClient;
     }
 
     // List currently available multi tenant and single tenant cartridges
     public void listAvailableCartridges() throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listAvailableCartridgesRestEndpoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL() + listAvailableCartridgesRestEndpoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -317,8 +313,7 @@ public class RestCommandLineService {
     public void describeAvailableCartridges(String type) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listAvailableCartridgesRestEndpoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL() + listAvailableCartridgesRestEndpoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -361,8 +356,7 @@ public class RestCommandLineService {
     public void listSubscribedCartridges(final boolean full) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listSubscribedCartridgesRestEndpoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL() + listSubscribedCartridgesRestEndpoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -455,8 +449,8 @@ public class RestCommandLineService {
     public void listSubscribedCartridgeInfo(String alias) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listSubscribedCartridgeInfoRestEndpoint
-            		+alias, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listSubscribedCartridgeInfoRestEndpoint + alias);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -538,8 +532,8 @@ public class RestCommandLineService {
 
             // Invoke  cluster/{clusterId}
             for (String clusterId : lbClusterIdSet) {
-                HttpResponse responseCluster = restClientService.doGet(httpClient, restClientService.getUrl() + listClusterRestEndpoint
-                        +"clusterId/"+ clusterId, restClientService.getUsername(), restClientService.getPassword());
+				HttpResponse responseCluster = restClient.doGet(httpClient, restClient.getBaseURL()
+						+ listClusterRestEndpoint + "clusterId/" + clusterId);
 
                 String responseCode = "" + responseCluster.getStatusLine().getStatusCode();
                 String resultStringCluster = getHttpResponseString(responseCluster);
@@ -619,8 +613,8 @@ public class RestCommandLineService {
             
             // Invoke  cluster/{clusterId}
             for (Member m : members) {
-            	HttpResponse responseCluster = restClientService.doGet(httpClient, restClientService.getUrl() + listClusterRestEndpoint
-                        +"clusterId/"+ m.getLbClusterId(), restClientService.getUsername(), restClientService.getPassword());
+            	HttpResponse responseCluster = restClient.doGet(httpClient, restClient.getBaseURL() + listClusterRestEndpoint
+                        +"clusterId/"+ m.getLbClusterId());
 
                 String responseCode = "" + responseCluster.getStatusLine().getStatusCode();
                 String resultStringCluster = getHttpResponseString(responseCluster);
@@ -646,9 +640,8 @@ public class RestCommandLineService {
 
 	private Member[] getMembers(String cartridgeType, String alias, DefaultHttpClient httpClient) throws Exception{
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listClusterRestEndpoint
-                    + cartridgeType + "/" + alias,
-                    restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listClusterRestEndpoint + cartridgeType + "/" + alias);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             
@@ -752,12 +745,6 @@ public class RestCommandLineService {
 
         String jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
 
-        SubscriptionInfo subcriptionConnectInfo = null;
-
-        if (httpClient == null) {
-            httpClient = new DefaultHttpClient();
-        }
-
         try {
             cartridgeInfoBean.setCartridgeType(cartridgeType);
             cartridgeInfoBean.setAlias(alias);
@@ -774,8 +761,8 @@ public class RestCommandLineService {
             
             jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
 
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + subscribCartridgeRestEndpoint,
-                    jsonSubscribeString, restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL() + subscribCartridgeRestEndpoint,
+                    jsonSubscribeString);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -811,12 +798,6 @@ public class RestCommandLineService {
                 }
             }
 
-            if (subcriptionConnectInfo != null) {
-                hostnames += ", " + subcriptionConnectInfo.getHostname();
-                hostnamesLabel = "host names";
-
-            }
-
             if (externalRepoURL != null) {
                 String takeTimeMsg = "(this might take few minutes... depending on repo size)\n";
                 System.out.println(takeTimeMsg);
@@ -848,8 +829,8 @@ public class RestCommandLineService {
 
             String jsonString = gson.toJson(tenantInfo, TenantInfoBean.class);
 
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + addTenantEndPoint,
-                    jsonString, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ addTenantEndPoint, jsonString);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -874,8 +855,8 @@ public class RestCommandLineService {
     public void deleteTenant(String tenantDomain) throws CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doDelete(httpClient, restClientService.getUrl()
-                    + addTenantEndPoint + "/" + tenantDomain, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doDelete(httpClient, restClient.getBaseURL()
+					+ addTenantEndPoint + "/" + tenantDomain);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -903,8 +884,8 @@ public class RestCommandLineService {
     public void deactivateTenant(String tenantDomain) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl()
-                    + deactivateTenantRestEndPoint + "/" + tenantDomain, "", restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ deactivateTenantRestEndPoint + "/" + tenantDomain, "");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -932,8 +913,8 @@ public class RestCommandLineService {
     public void activateTenant(String tenantDomain) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl()
-                    + activateTenantRestEndPoint + "/" + tenantDomain, "", restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ activateTenantRestEndPoint + "/" + tenantDomain, "");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -961,8 +942,8 @@ public class RestCommandLineService {
     public void listAllTenants() throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listAllTenantRestEndPoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listAllTenantRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -1029,8 +1010,7 @@ public class RestCommandLineService {
     public void unsubscribe(String alias) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + unsubscribeTenantEndPoint, alias,
-                    restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL() + unsubscribeTenantEndPoint, alias);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1058,8 +1038,8 @@ public class RestCommandLineService {
     public void deployCartridgeDefinition (String cartridgeDefinition) throws CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + cartridgeDeploymentEndPoint,
-                    cartridgeDefinition, restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL() + cartridgeDeploymentEndPoint,
+                    cartridgeDefinition);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1087,8 +1067,8 @@ public class RestCommandLineService {
     public void undeployCartrigdeDefinition (String id) throws CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doDelete(httpClient, restClientService.getUrl()
-                    + cartridgeDeploymentEndPoint + "/" + id, restClientService.getUsername(), restClientService.getPassword());
+            HttpResponse response = restClient.doDelete(httpClient, restClient.getBaseURL()
+                    + cartridgeDeploymentEndPoint + "/" + id);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1116,8 +1096,8 @@ public class RestCommandLineService {
     public void deployPartition (String partitionDefinition) throws CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + partitionDeploymentEndPoint,
-                    partitionDefinition, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ partitionDeploymentEndPoint, partitionDefinition);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -1145,8 +1125,8 @@ public class RestCommandLineService {
     public void deployAutoscalingPolicy (String autoScalingPolicy) throws CommandException{
         DefaultHttpClient httpClient= new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + autoscalingPolicyDeploymentEndPoint,
-                    autoScalingPolicy, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ autoscalingPolicyDeploymentEndPoint, autoScalingPolicy);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1174,8 +1154,8 @@ public class RestCommandLineService {
     public void deployService (String deployService) throws CommandException{
         DefaultHttpClient httpClient= new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + deployServiceEndPoint,
-                    deployService, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ deployServiceEndPoint, deployService);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1203,8 +1183,8 @@ public class RestCommandLineService {
     public void undeployService(String id) throws  CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doDelete(httpClient, restClientService.getUrl()
-                    + deployServiceEndPoint + "/" + id, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doDelete(httpClient, restClient.getBaseURL()
+					+ deployServiceEndPoint + "/" + id);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1232,8 +1212,8 @@ public class RestCommandLineService {
     public void listDeployServices() throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listDeployServicesRestEndPoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listDeployServicesRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1310,8 +1290,8 @@ public class RestCommandLineService {
     public void deployDeploymentPolicy (String deploymentPolicy) throws CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doPost(httpClient, restClientService.getUrl() + deploymentPolicyDeploymentEndPoint,
-                    deploymentPolicy, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
+					+ deploymentPolicyDeploymentEndPoint, deploymentPolicy);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1339,8 +1319,8 @@ public class RestCommandLineService {
     public void listPartitions() throws CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listParitionRestEndPoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listParitionRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
             String resultString = getHttpResponseString(response);
@@ -1404,8 +1384,8 @@ public class RestCommandLineService {
     public void listAutoscalePolicies() throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listAutoscalePolicyRestEndPoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listAutoscalePolicyRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1469,8 +1449,8 @@ public class RestCommandLineService {
     public void listDeploymentPolicies() throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listDeploymentPolicyRestEndPoint,
-                    restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listDeploymentPolicyRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1534,8 +1514,8 @@ public class RestCommandLineService {
     public void describeDeploymentPolicies(String id) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl()
-                    + listDeploymentPolicyRestEndPoint, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listDeploymentPolicyRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1582,8 +1562,8 @@ public class RestCommandLineService {
     public void describePartition(String id) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl()
-                    + listParitionRestEndPoint, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listParitionRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1624,8 +1604,8 @@ public class RestCommandLineService {
     public void describeAutoScalingPolicy(String id) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl()
-                    + listAutoscalePolicyRestEndPoint, restClientService.getUsername(), restClientService.getPassword());
+			HttpResponse response = restClient.doGet(httpClient, restClient.getBaseURL()
+					+ listAutoscalePolicyRestEndPoint);
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1785,7 +1765,7 @@ public class RestCommandLineService {
     }
 
     // This method gives the HTTP response string
-    private String getHttpResponseString (HttpResponse response) {
+	private String getHttpResponseString (HttpResponse response) {
         try {
             BufferedReader reader = new BufferedReader(new InputStreamReader((response.getEntity().getContent())));