org.fhcrc.cpl.viewer.commandline
Class CommandLineModuleDiscoverer

java.lang.Object
  extended by org.fhcrc.cpl.viewer.commandline.CommandLineModuleDiscoverer

public class CommandLineModuleDiscoverer
extends java.lang.Object

Utility class for finding all command-line modules. See comments on method discoverAllCommandLineModules() for important details.


Field Summary
protected static org.apache.log4j.Logger _log
           
protected static java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule> allCommandLineModuleMap
           
static java.lang.String[] modulePackageDescriptionsLong
           
static java.lang.String[] modulePackageDescriptionsShort
           
static java.lang.String[] modulePackageIdentifiers
           
static java.lang.String[] modulePackageNames
           
 
Constructor Summary
CommandLineModuleDiscoverer()
           
 
Method Summary
protected static java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule> discoverAllCommandLineModules()
          Attempts to discover all the classes in the package org.fhcrc.cpl.viewer.commandline.modules, and other declared packages, that implement the CommandLineModule interface, as determined by the context class loader
static java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule> findAllCommandLineModules()
          Return all known commandline modules, initializing if necessary
static java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule>> findAllCommandLineModulesByPackage()
          Broken up by package.
static org.fhcrc.cpl.toolbox.commandline.CommandLineModule getCommandLineModule(java.lang.String command)
          Return the commandline module for the specified command.
static java.lang.String getPackageIdentifier(java.lang.String packageName)
          This could be implemented much more efficiently
static java.lang.String getPackageLongDescription(java.lang.String packageName)
          This could be implemented much more efficiently
static java.lang.String getPackageShortDescription(java.lang.String packageName)
          This could be implemented much more efficiently
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static org.apache.log4j.Logger _log

allCommandLineModuleMap

protected static java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule> allCommandLineModuleMap

modulePackageNames

public static final java.lang.String[] modulePackageNames

modulePackageIdentifiers

public static final java.lang.String[] modulePackageIdentifiers

modulePackageDescriptionsShort

public static final java.lang.String[] modulePackageDescriptionsShort

modulePackageDescriptionsLong

public static final java.lang.String[] modulePackageDescriptionsLong
Constructor Detail

CommandLineModuleDiscoverer

public CommandLineModuleDiscoverer()
Method Detail

findAllCommandLineModules

public static java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule> findAllCommandLineModules()
Return all known commandline modules, initializing if necessary

Returns:

findAllCommandLineModulesByPackage

public static java.util.Map<java.lang.String,java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule>> findAllCommandLineModulesByPackage()
Broken up by package. Probably it would be better to store this structure rather than the simple map. Would take some reorganization

Returns:

getPackageShortDescription

public static java.lang.String getPackageShortDescription(java.lang.String packageName)
This could be implemented much more efficiently

Parameters:
packageName -
Returns:

getPackageIdentifier

public static java.lang.String getPackageIdentifier(java.lang.String packageName)
This could be implemented much more efficiently

Parameters:
packageName -
Returns:

getPackageLongDescription

public static java.lang.String getPackageLongDescription(java.lang.String packageName)
This could be implemented much more efficiently

Parameters:
packageName -
Returns:

discoverAllCommandLineModules

protected static java.util.Map<java.lang.String,org.fhcrc.cpl.toolbox.commandline.CommandLineModule> discoverAllCommandLineModules()
Attempts to discover all the classes in the package org.fhcrc.cpl.viewer.commandline.modules, and other declared packages, that implement the CommandLineModule interface, as determined by the context class loader

Returns:
a map of CommandLineModule-implementing classes that exist within the correct package

getCommandLineModule

public static org.fhcrc.cpl.toolbox.commandline.CommandLineModule getCommandLineModule(java.lang.String command)
                                                                                throws java.io.FileNotFoundException
Return the commandline module for the specified command. If that module doesn't exist, throw a FileNotFoundExcption. That's a bit of a hack, but it's necessary for an exception to be thrown that's not a RunTimeException, to make the calling code handle it explicitly

Parameters:
command -
Returns:
Throws:
java.io.FileNotFoundException - if no module exists for the specified command


Fred Hutchinson Cancer Research Center