Hi Chris,
> Is it assumed that all plugin jars are already on the classpath?
Normally, yes. The SciJava plugin discovery works via class loaders.
> Is there some facility for limiting the search space to a specific
> directory?
You can pass your own ClassLoader which limits resource discovery however you wish:
PluginFinder pluginFinder = new DefaultPluginFinder(myClassLoader);
PluginIndex pluginIndex = new PluginIndex(pluginFinder);
Context context = new Context(pluginIndex);
Since you interface with ImageJ, though—I would highly recommend piggybacking off the existing Context, rather than spinning up your own. There are a few ways of doing that...
Not-ideal but tolerated IJ1-specific way:
Context context = (Context) IJ.runPlugIn("org.scijava.Context", "");
Better way is to pass the context object around wherever you need it, to avoid any static method calls, etc. This maintains the encapsulation of each application context. If you use parameterized SciJava commands and scripts, you can declare the context and its services as @Parameter inputs, which get autofilled by the framework.
Even nicer, you can declare singleton plugins as inputs too, and the user will be prompted to make a choice. For example: "@Parameter Codec codec;" and the user will see a drop-down box with a list of codecs to choose from. Of course, whether this scenario applies to your use case depends on the role of your new type of plugin.
Regards,
Curtis