Providing scripts to hide the concept of domain Back to Master Task List Introduction It has been observed that for basic server life cycle control like: start/shutdown/status-check/restart, the concept of "administrative domain" is rather too heavy-weight. Developers and users alike are impatient and want to quickly start the server and deploy their applications. This task proposes a script that is a short-cut for number of common operations. It's assumed that all of the operations happen on the default domain. If the default domain is not present, we simply fail. A possible Script and supported operations How about:
gfctl start/stop/restart/status/thread-dump/help
Controls the default server in a variety of ways.
start - starts it
stop - stops it
restart - stops it if running, simply starts it otherwise
status - provides basic status like running or not, provides the pid if it's running
status --verbose - provides its detailed status
thread-dump - provides its *Java* thread dump
help - prints this page
for starters? A suggestion for implementation Instead of creating a new script, we should just modify the asadmin help output as follows:
asadmin help
Administers the default server.
start - starts it
stop - stops it
restart - stops it if running, simply starts it otherwise
status - provides basic status like running or not, provides the pid if it's running
status --verbose - provides its detailed status
thread-dump - provides its *Java* thread dump
list-commands - provides a list of *all* commands supported by a particular instance
In order to support this, we need to entertain the alias concept for a command name. Command Aliasing This concept is to allow developers and users to create command aliases with asadmin by introducing 3 new commands.
create-alias - creates a command alias
Syntax:
create-alias <alias-name> <command>
Example:
>asadmin create-alias start 'start-domain --user admin ... domain-name'
an alias 'start' is created.
executing 'asadmin start' is the same as 'asadmin start-domain --user ... domain-name'
delete-alias - deletes a command alias
Syntax:
delete-alias <alias-name>
Example:
>asadmin delete-alias start
The alias start is removed.
list-aliases - lists all the command aliases
Syntax:
list-aliases
Example:
>asadmin list-aliasas
start
stop
...
The basic lifecycle commands will come with default aliases. The "start-domain domain1" command will have an alias "start". To override the default alias, user can execute create-alias command to override existing alias. Implementation of Command Aliasing The aliases are saved in the local file system or user-specific store. When a command is issued with asadmin, commands are searched in the following order: local-command, remote-command, and lastly, alias-command. Comments from Byron: Aliases – a GREAT idea and it should be fairly straight forward to implement. I.e. much bang for the buck.
- Aliases checked after a remote-command attempt introduces quite a bit of overhead – especially if DAS isn't running. I would go with the UNIX way of handling aliases. The alias is checked first. E.g. if I make an alias on UNIX: alias ls=ls -F --> it first goes with the alias, avoids the infinite loop, and calls the real 'ls'. Another example on UNIX: alias wc=cat then running 'wc file' results in cat getting called, not wc.
- Idea: saving the aliases via the Java Preferences API by default but also allowing them to be placed in a special, say, properties file. Or better – both – with one overriding the other. QE would love this. I've seen so many bug reports with these unbelievably long asadmin command lines. They are so complex that they have to be run in a script.
|