admin@glassfish.java.net

Re: Getting started with CLI

From: Byron Nevins <byron.nevins_at_oracle.com>
Date: Fri, 21 May 2010 14:36:20 -0700


On 5/21/2010 8:33 AM, Yamini K B wrote:
Hi,

I'm trying to port one of the v2 commands onto v3. This is the first time I'm writing a command in v3 and have some general questions:

1. Is there any document regarding the practices to be followed while writing commands? Looks like the v3 CLI spec wasn't updated for the final release and it mainly talks about features that were dropped. I've seen the v3 engineer's guide CLI section, but that too contains a very simple example.
And I would like to know all the secrets for laying down a perfect tile floor but I can't find a really good book.  Why?  Because people that are really good at doing that usually suck at documenting it.

If you are writing a CLI command look at commands written by Bill Shannon they are as close to perfect as you're likely to find and then ask specific questions and pass your ideas for early review preferably to Bill for CLI and to Jerome for remote

2. Where can I find documentation for the various annotations?
Documentation?  We don't need no stinkin' documentation!  Hint:  monkey see monkey do ;-)

3. From what I understand, there are 2 ways to introduce a command, one is by implementing the AdminCommand interface and other is writing a CRUD command, is that correct?
Don't even think about implementing a CRUD command unless you run it by Jerome and know exactly what you're doing.  CRUD is designed for things that have a 1:1 correspondence with elements in domain.xml  "start-instance" is not for CRUD.  create-instance IS.  CReate  Update  Delete. CRUD is designed (successfully) to stop the grudge work and unnecessary complexity of many almost-identical boiler-plated commands.

4. How/when to implement CRUD commands?
See above and more importantly look at the source

5. Whats the best way to debug any command? I made some changes in the config beans and now DAS isn't even starting, it just hangs after the launcher message. I'm at loss as to where to look! (Changing felix log level and admin logging to finest doesn't help since its in the very intial stage of startup)
QA and Managers use logging levels.  Engineers use debuggers and break points.  Set a breakpoint much earlier.  Go to ASMain in core/bootstrap  for extremely early debugging and in AppServerStartup (core/kernel) for "normal" early.  Run start-domain with the "--debug" arg.  Edit domain.xml and set 'suspend=y' in the java-options section then attach to your debugger as it sits there patiently waiting for you.

6. While porting a v2 command, I presume both the files, supported-legacy-command-names/unsupported-legacy-command-names need to be updated. Is that correct?
OK -- you have me confused now.  This is a question about **CLI** commands and your other questions sound like Remote AdminCommand's  which is it?  both?  What are you doing?

Thanks,
-Yamini
--------------------------------------------------------------------- To unsubscribe, e-mail: admin-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: admin-help@glassfish.dev.java.net

-- 
Byron Nevins  -  Oracle Corporation
Home: 650-359-1290
Cell: 650-784-4123
Sierra: 209-295-2188