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 2014/02/11 09:48:04 UTC
[1/2] git commit: STRATOS-414 - [CLI] A Tenant can see the command
history of super admin and other tenants Now users have separate history
files
Updated Branches:
refs/heads/master 66f843e6c -> b9adfbf0c
STRATOS-414 - [CLI] A Tenant can see the command history of super admin and other tenants
Now users have separate history files
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/e5c87ce5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/e5c87ce5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/e5c87ce5
Branch: refs/heads/master
Commit: e5c87ce54d3de89c552a7631d7587aee733cd135
Parents: 033086a
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Tue Feb 11 14:15:15 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Tue Feb 11 14:15:15 2014 +0530
----------------------------------------------------------------------
.../java/org/apache/stratos/cli/CliTool.java | 2 +-
.../stratos/cli/CommandLineApplication.java | 32 +++++++++++++++-----
.../apache/stratos/cli/StratosApplication.java | 17 ++++++++---
.../stratos/cli/commands/ExitCommand.java | 12 --------
4 files changed, 39 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e5c87ce5/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
index d0dd7de..ac21579 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
@@ -52,7 +52,7 @@ public class CliTool {
if (logger.isInfoEnabled()) {
logger.info("Stratos CLI Started...");
}
- StratosApplication application = new StratosApplication();
+ StratosApplication application = new StratosApplication(arguments);
application.start(arguments);
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e5c87ce5/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 c0c2dce..a3284ac 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
@@ -33,14 +33,18 @@ public abstract class CommandLineApplication<T extends CommandContext> {
private static final Logger logger = LoggerFactory.getLogger(CommandLineApplication.class);
- protected final ConsoleReader reader;
+ protected ConsoleReader reader;
protected FileHistory history;
+ protected String userName;
- public CommandLineApplication() {
- reader = createConsoleReader();
- }
+ public CommandLineApplication(String[] args) {
+ if (args != null && args.length > 1) {
+ userName = args[1];
+ }
+ reader = createConsoleReader();
+ }
- /**
+ /**
* Creates new jline ConsoleReader.
*
* @return a jline ConsoleReader instance
@@ -50,7 +54,7 @@ public abstract class CommandLineApplication<T extends CommandContext> {
try {
consoleReader = new ConsoleReader();
consoleReader.setPrompt(getPrompt());
- history = new FileHistory(getHistoryFile());
+ history = new FileHistory(getHistoryFile(userName));
consoleReader.setHistory(history);
} catch (IOException e) {
throw new IllegalStateException("Cannot create jline console reader", e);
@@ -58,6 +62,20 @@ public abstract class CommandLineApplication<T extends CommandContext> {
return consoleReader;
}
+ protected ConsoleReader createConsoleReaderWhithoutArgs(String enteredUserName) {
+ ConsoleReader consoleReader = null;
+ history = null;
+ try {
+ consoleReader = new ConsoleReader();
+ consoleReader.setPrompt(getPrompt());
+ history = new FileHistory(getHistoryFile(enteredUserName));
+ consoleReader.setHistory(history);
+ } catch (IOException e) {
+ throw new IllegalStateException("Cannot create jline console reader", e);
+ }
+ return consoleReader;
+ }
+
public ConsoleReader getConsoleReader() {
return reader;
}
@@ -69,7 +87,7 @@ public abstract class CommandLineApplication<T extends CommandContext> {
*
* @return File for storing history
*/
- protected abstract File getHistoryFile();
+ 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/e5c87ce5/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 f0e2cf4..68730c3 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
@@ -50,14 +50,14 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
private final Options options;
- public StratosApplication() {
+ public StratosApplication(String[] args) {
+ super(args);
commands = new TreeMap<String, Command<StratosCommandContext>>();
context = new StratosCommandContext(this);
options = constructOptions();
createCommands();
- createAutocomplete();
}
/**
@@ -171,9 +171,9 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
}
@Override
- protected File getHistoryFile() {
+ protected File getHistoryFile(String userName) {
File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR);
- File historyFile = new File(stratosFile, STRATOS_HISTORY_DIR);
+ File historyFile = new File(stratosFile, STRATOS_HISTORY_DIR + "_" + userName);
return historyFile;
}
@@ -343,6 +343,15 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
String stratosURL = null;
stratosURL = context.getString(CliConstants.STRATOS_URL_ENV_PROPERTY);
+ // 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) {
+ reader = null;
+ reader = createConsoleReaderWhithoutArgs(usernameInput);
+ }
+
+ createAutocomplete();
+
try {
success = RestCommandLineService.getInstance().login(stratosURL, usernameInput, passwordInput, validateLogin);
//success = CommandLineService.getInstance().login(stratosURL, usernameInput, passwordInput, validateLogin);
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/e5c87ce5/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
index 412b125..4a3a801 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
@@ -60,18 +60,6 @@ public class ExitCommand implements Command<StratosCommandContext> {
logger.debug("Executing {} command...", getName());
}
if (args == null || args.length == 0) {
- // Delete the command history file on exit
- File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR);
- File historyFile = new File(stratosFile, STRATOS_HISTORY_DIR);
-
- historyFile.deleteOnExit();
-
- if(historyFile.delete()){
- logger.debug(historyFile.getName() + " is deleted!");
- }else{
- logger.debug("Delete operation is failed.");
- }
-
return CliConstants.SUCCESSFUL_CODE;
} else {
context.getStratosApplication().printUsage(getName());
[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/b9adfbf0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/b9adfbf0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/b9adfbf0
Branch: refs/heads/master
Commit: b9adfbf0c51313c22d4d3df562b0fe9e0cde5075
Parents: e5c87ce 66f843e
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Tue Feb 11 14:17:42 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Tue Feb 11 14:17:42 2014 +0530
----------------------------------------------------------------------
.gitignore | 3 +
.../cloud/controller/pojo/CartridgeConfig.java | 10 +
.../cloud/controller/pojo/CartridgeInfo.java | 10 +
.../console/cartridge_info.jag | 9 +
.../console/index.jag | 1 -
.../console/modules/pinch.min.js | 4 +
.../console/subscribe_cartridge.jag | 6 +-
.../themes/theme1/partials/cartridge_info.hbs | 37 ++
.../themes/theme1/partials/cartridges.hbs | 18 +-
.../themes/theme1/partials/mycartridges.hbs | 18 +-
.../theme1/partials/subscribe_cartridge.hbs | 53 +-
.../themes/theme1/renderers/cartridge_info.js | 42 ++
.../theme1/renderers/subscribe_cartridge.js | 8 +-
.../console/themes/theme1/ui/css/main.css | 6 +-
.../themes/theme1/ui/custom-fonts/style.css | 25 +-
.../console/util/utility.jag | 7 +
.../apache/stratos/manager/dto/Cartridge.java | 16 +-
.../manager/lookup/LookupDataHolder.java | 21 +
.../manager/lookup/SubscriptionContext.java | 2 +
.../manager/CartridgeSubscriptionManager.java | 10 +-
.../DataInsertionAndRetrievalManager.java | 15 +
.../service/ApplicationManagementService.java | 2 +-
.../subscription/CartridgeSubscription.java | 9 +
.../utils/CartridgeSubscriptionUtils.java | 4 +-
.../definition/CartridgeDefinitionBean.java | 2 +
.../bean/util/converter/PojoConverter.java | 3 +
.../rest/endpoint/services/ServiceUtils.java | 39 +-
.../rest/endpoint/services/StratosAdmin.java | 10 +
.../main/resources/CloudControllerService.wsdl | 604 ++++++++++---------
29 files changed, 621 insertions(+), 373 deletions(-)
----------------------------------------------------------------------