It would be good if you could make this a generic CLI tooling framework for
Carbon. We need it not only in Stratos 2, but in many other areas. We can
provide CLI tooling to deploy artifacts into a server, for example.

On Fri, May 10, 2013 at 1:23 AM, Isuru Perera <isu...@wso2.com> wrote:

> Hi,
>
> For Stratos 2.0 release, we are planning to improve the existing CLI Tool
> [1].
>
> We are planning to support following features in Stratos2 CLI Tool
>
>
>    - Command history [2]
>    - Auto-completion of commands
>    - Character masking (for passwords) [3]
>
>
> For above features, we are planning to use jline2 library [4].
>
> *Existing Design*
>
> Currently the CLI tool has two modes. (Stratos2 CLI source can be found at
> [5])
>
> 1. Interactive Mode - In this mode, user is logged in by passing only
> username & password as arguments.
>
> $stratos <username> <password>
> After successful login, the user get a prompt as "stratos>"
>
> 2. Single Command Line Mode - In this mode, all the commands are passed as
> arguments including username and password
>
> $stratos <username> <password> list
> This will list all the cartridges.
>
> AFAIK, we can support above features only when the CLI tool is in prompt
> mode. In order to provide auto-complete features at the terminal, we need
> to use OS specific functions, for example /etc/bash_completion [6]
>
> *Drawbacks of existing Beta 2 CLI Tool & Possible Solutions*
>
> 1. A drawback of existing design is that we have to login every time the
> stratos command is executed.
>
> Solution: Login only once. The back-end service is an admin service and we
> login as a tenant. I'm thinking of a way to save session in the file
> system. For example inside <user.home>/.stratos/
>
> If we can save the session id, then we use the same for authenticate next
> requests. In this way, the user can use the CLI tool, until the session
> times out.
>
> Or else we can keep the username and password cached (encrypted form). In
> this way, user can keep using the tool without worrying about the session
> time out.
>
> Which is the better way?
>
> 2. Currently the password is entered in the command line itself
>
> Solution: With jline2, we can use masking for password input.
>
> 3. Command history not support.
>
> Solution: jline2 can provide command history. Additionally if we can login
> only once, user can execute commands directly in terminal and use the
> history available in the terminal environment.
>
> *New Design*
>
> I'm going to introduce following commands to the tool
>
> 1. $stratos setup
> This will prompt for Stratos Controller hostname & port. These values will
> be saved in <user.home>/.stratos/stratos.config
>
> 2. $stratos login
> This will have arguments for username and password. Password will be
> prompted with masked character. Authentication details will be saved in
> <user.home>/.stratos/
>
> 3. $stratos logout
> Logout user.
>
> After successful login, user can go into interactive mode by just entering
> "stratos" or user can execute commands in single line. For example "stratos
> list", "stratos subscribe" etc.
>
> CLI Tool will also be improved to use a single '-' for short option names
> and '--' for longer option names [7].
>
> WDYT?
>
> [1] https://wso2.org/jira/browse/SPI-234
> [2] https://wso2.org/jira/browse/SPI-111
> [3] https://wso2.org/jira/browse/SPI-241
> [4] http://jline.github.io/jline2/
> [5]
> https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.1
> [6] http://www.debian-administration.org/articles/316
> [7] https://wso2.org/jira/browse/SPI-240
>
> --
> Isuru Perera
> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> Twitter: http://twitter.com/chrishantha | LinkedIn:
> http://lk.linkedin.com/in/chrishantha/
>
> _______________________________________________
> Architecture mailing list
> Architecture@wso2.org
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com
Member; Apache Software Foundation; http://www.apache.org/
* <http://www.apache.org/>**
email: **az...@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to