jmslexamples
Class PluginScannerExample

java.lang.Object
  extended by com.softsynth.jmsl.view.PVFrameAdapter
      extended by jmslexamples.PluginScannerExample
All Implemented Interfaces:
PVComponent, PVFrame, HierarchicalMenuListener

public class PluginScannerExample
extends PVFrameAdapter
implements HierarchicalMenuListener

Scans a folder named "jmsl_plugins" which must be in the CLASSPATH.
Searches for classes implementing the Instrument interface.
Prints a list of found classes to the console.
Builds a HierarchicalMenu from the found classes.
Select an item from the HierarchicalMenu and get notified of the fully qualified classname.
This can be used to instantiate an instance of the selected item.

The design of this example is at the heart of the JMSL plugins model.

Author:
Nick Didkovsky, (c) 2004 All rights reserved, Email: didkovn@mail.rockefeller.edu

Constructor Summary
PluginScannerExample()
           
 
Method Summary
 void buildHierarchicalMenuFromClasses()
           
 java.util.Vector getFoundInstrumentList()
           
 void hierarchicalMenuItemSelected(PVMenu topMenu, java.lang.String hierarchicalName)
           
static void main(java.lang.String[] args)
           
 java.lang.String scanForClasses(java.util.Vector searchPaths)
           
 
Methods inherited from class com.softsynth.jmsl.view.PVFrameAdapter
add, add, addKeyListener, addWindowListener, dispose, equals, getBackground, getBounds, getComponent, getFont, getFontMetrics, getParent, getPVMenuBar, hashCode, isEnabled, isShowing, pack, removeAll, removeKeyListener, setBackground, setEnabled, setFont, setFrameLayout, setLocation, setPVMenuBar, setResizable, setSize, setSize, setTitle, setVisible, toBack, toFront, toString, validate
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PluginScannerExample

public PluginScannerExample()
Method Detail

buildHierarchicalMenuFromClasses

public void buildHierarchicalMenuFromClasses()

scanForClasses

public java.lang.String scanForClasses(java.util.Vector searchPaths)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.IllegalAccessException,
                                       java.lang.InstantiationException,
                                       java.io.IOException
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.io.IOException

hierarchicalMenuItemSelected

public void hierarchicalMenuItemSelected(PVMenu topMenu,
                                         java.lang.String hierarchicalName)
Specified by:
hierarchicalMenuItemSelected in interface HierarchicalMenuListener

getFoundInstrumentList

public java.util.Vector getFoundInstrumentList()
Returns:
Returns the foundInstrumentList.

main

public static void main(java.lang.String[] args)