You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/06/21 14:59:04 UTC
svn commit: r670191 -
/geronimo/gshell/trunk/gshell-rapture/src/main/java/org/apache/geronimo/gshell/rapture/DefaultCommandDocumenter.java
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();
}
//