Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 4954 invoked from network); 21 Jun 2008 12:59:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jun 2008 12:59:55 -0000 Received: (qmail 1297 invoked by uid 500); 21 Jun 2008 12:59:56 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 1287 invoked by uid 500); 21 Jun 2008 12:59:56 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 1278 invoked by uid 99); 21 Jun 2008 12:59:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jun 2008 05:59:56 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jun 2008 12:59:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4B17823889C1; Sat, 21 Jun 2008 05:59:04 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r670191 - /geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java Date: Sat, 21 Jun 2008 12:59:04 -0000 To: scm@geronimo.apache.org From: jdillon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080621125904.4B17823889C1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jdillon Date: Sat Jun 21 05:59:03 2008 New Revision: 670191 URL: http://svn.apache.org/viewvc?rev=670191&view=rev Log: More tidy Modified: geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java Modified: geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java?rev=670191&r1=670190&r2=670191&view=diff ============================================================================== --- geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java (original) +++ geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java Sat Jun 21 05:59:03 2008 @@ -49,6 +49,7 @@ private final Logger log = LoggerFactory.getLogger(getClass()); private GShellPlexusContainer container; + // Contextualizable public void contextualize(final Context context) throws ContextException { @@ -60,6 +61,24 @@ log.debug("Container: {}", container); } + /** + * Get the action instance for the given command context. + * + * @param info The command-info to previde an action for. + * @return The command action for the given information. + */ + private CommandAction getAction(final CommandInfo info) { + assert info != null; + assert container != null; + + try { + return container.lookupComponent(CommandAction.class, info.getId()); + } + catch (ComponentLookupException e) { + throw new RuntimeException(e); + } + } + // CommandDocumenter public String getName(final CommandInfo info) { @@ -82,30 +101,12 @@ // CommandAction action = getAction(info); - CommandComponent cmd = action.getClass().getAnnotation(CommandComponent.class); - if (cmd == null) { + CommandComponent annotation = action.getClass().getAnnotation(CommandComponent.class); + if (annotation == null) { throw new IllegalStateException("Command description not found"); } - return cmd.description(); - } - - /** - * Get the action instance for the given command context. - * - * @param info The command-info to previde an action for. - * @return The command action for the given information. - */ - private CommandAction getAction(final CommandInfo info) { - assert info != null; - assert container != null; - - try { - return container.lookupComponent(CommandAction.class, info.getId()); - } - catch (ComponentLookupException e) { - throw new RuntimeException(e); - } + return annotation.description(); } //