edu.jhu.ece.iacl.jist.pipeline
Class PipeLibrary

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PipeLibrary

public class PipeLibrary
extends java.lang.Object

Interface to open, edit, and save module definitions.

Author:
Blake Lucas (bclucas@jhu.edu)

Nested Class Summary
static class PipeLibrary.CompareFactories
          The Class CompareFactories.
static class PipeLibrary.CompareFiles
          The Class CompareFiles.
static class PipeLibrary.InitializeTask
          Worker to find and initialize module definitions in library directory.
static class PipeLibrary.RebuildTask
          Worker to rebuild library from module definitions in the library directory.
 
Field Summary
protected static PipeLibrary library
          Singleton reference to library.
 
Constructor Summary
protected PipeLibrary()
          Default constructor.
 
Method Summary
static java.io.File askForLibraryDirectory(java.io.File oldDir)
          Open file chooser to select directory.
 java.io.File createPath(java.io.File discoveredPath, java.lang.String category)
          Creates the path.
 void discoverAllMapsAndLoniModules(javax.swing.ProgressMonitor monitor)
          Discover all MAPS and LONI files.
 void discoverAllModules(javax.swing.ProgressMonitor monitor)
          Discover all modules that can be loaded by MAPS.
 void discoverInternalMapsModules(javax.swing.ProgressMonitor monitor)
          Discover new algorithms along source path.
static java.util.Vector<java.lang.Class> getAllClasses(java.lang.String rootPckg)
          Gets the all classes.
static java.util.Vector<java.lang.Class> getAllClasses(java.lang.String rootPckg, java.lang.String simpleName)
          Get all classes starting from root package name.
static java.lang.String getHostName()
          Gets the host name.
static PipeLibrary getInstance()
          Get singleton reference to library.
 java.io.File getLibraryPath()
          Get location of library.
 javax.swing.tree.DefaultMutableTreeNode getTreeRoot()
          Get tree representing algorithm factory hierarchy.
 void initModules(javax.swing.ProgressMonitor monitor)
          Find and initialize modules from library directory.
 boolean loadLibraryPath()
          Load library path from MIPAV preferences.
 boolean loadLibraryPath(boolean silentFailure)
          Load library path from MIPAV preferences.
 boolean loadPreferences()
          Load existing modules and add them to the tree.
 boolean loadPreferences(boolean silentFailure)
          Load existing modules and add them to the tree.
 void removeAtomicModules(javax.swing.ProgressMonitor monitor)
          Remove non-group modules that can be rebuilt from existing script/pipe files or from the source tree.
 void setLibraryPath(java.io.File libraryPath)
          Set library directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

library

protected static PipeLibrary library
Singleton reference to library.

Constructor Detail

PipeLibrary

protected PipeLibrary()
Default constructor.

Method Detail

getHostName

public static java.lang.String getHostName()
Gets the host name.

Returns:
the host name

askForLibraryDirectory

public static java.io.File askForLibraryDirectory(java.io.File oldDir)
Open file chooser to select directory.

Parameters:
oldDir - the old directory
Returns:
absolute path of the file

getAllClasses

public static java.util.Vector<java.lang.Class> getAllClasses(java.lang.String rootPckg)
Gets the all classes.

Parameters:
rootPckg - the root pckg
Returns:
the all classes

getAllClasses

public static java.util.Vector<java.lang.Class> getAllClasses(java.lang.String rootPckg,
                                                              java.lang.String simpleName)
Get all classes starting from root package name.

Parameters:
rootPckg - root package name
simpleName - the simple name
Returns:
the all classes

getInstance

public static PipeLibrary getInstance()
Get singleton reference to library.

Returns:
library

discoverAllMapsAndLoniModules

public void discoverAllMapsAndLoniModules(javax.swing.ProgressMonitor monitor)
Discover all MAPS and LONI files.

Parameters:
monitor - progress monitor

discoverAllModules

public void discoverAllModules(javax.swing.ProgressMonitor monitor)
Discover all modules that can be loaded by MAPS.

Parameters:
monitor - progress monitor

discoverInternalMapsModules

public void discoverInternalMapsModules(javax.swing.ProgressMonitor monitor)
Discover new algorithms along source path.

Parameters:
monitor - the monitor

createPath

public java.io.File createPath(java.io.File discoveredPath,
                               java.lang.String category)
Creates the path.

Parameters:
discoveredPath - the discovered path
category - the category
Returns:
the file

getLibraryPath

public java.io.File getLibraryPath()
Get location of library.

Returns:
library directory

getTreeRoot

public javax.swing.tree.DefaultMutableTreeNode getTreeRoot()
Get tree representing algorithm factory hierarchy.

Returns:
root tree node

initModules

public void initModules(javax.swing.ProgressMonitor monitor)
Find and initialize modules from library directory.

Parameters:
monitor - progress monitor

loadLibraryPath

public boolean loadLibraryPath()
Load library path from MIPAV preferences. If entry does not exist, ask user to specify library. Display a user popup dialog if the directory cannot be found

Returns:
true if library had to be specified by user

loadLibraryPath

public boolean loadLibraryPath(boolean silentFailure)
Load library path from MIPAV preferences. If entry does not exist, ask user to specify library.

Returns:
true if library had to be specified by user

loadPreferences

public boolean loadPreferences()
Load existing modules and add them to the tree.

Returns:
true, if load preferences

loadPreferences

public boolean loadPreferences(boolean silentFailure)
Load existing modules and add them to the tree.

Returns:
true, if load preferences

removeAtomicModules

public void removeAtomicModules(javax.swing.ProgressMonitor monitor)
Remove non-group modules that can be rebuilt from existing script/pipe files or from the source tree.

Parameters:
monitor - the monitor

setLibraryPath

public void setLibraryPath(java.io.File libraryPath)
Set library directory.

Parameters:
libraryPath - library path