Tracing getPlugin failure

37 views
Skip to first unread message

Stephan Steiner

unread,
Feb 8, 2012, 10:37:22 AM2/8/12
to jspf
Hi

I'm trying to get started with jspf. Created 3 projects:
PluginConsumer, which does the following:

PluginManager pm = PluginManagerFactory.createPluginManager();
PluginManagerUtil pmu = new PluginManagerUtil(pm);
pm.addPluginsFrom(new File("plugins/").toURI());
ISearchPlugin myPlugin = pm.getPlugin(ISearchPlugin.class);

Then a project PluginInterface which implements the Plugin Interface

public interface ISearchPlugin extends net.xeoh.plugins.base.Plugin
{
public InitializationResult Initialize();
}

and a SamplePlugin

public class MySamplePlugin implements ISearchPlugin
{

@Override
public InitializationResult Initialize()
{
throw new UnsupportedOperationException("Not supported yet.");
}

}


SamplePlugin links the project where ISearchPlugin is defined, and of
course the jspf lib - so compiled I get (standard Netbeans layout)

PluginSamplePlugin.jar
lib -
PluginInterface.jar
jspf.core-1.0.2.jar

and for the PluginInterface

PluginInterface.jar
lib -
jspf.core-1.0.2.jar

If I now create a plugins directory in the directory where the
PluginConsumer runs (directory layout follows)

PluginConsumer.jar
lib -
PluginInterface.jar
jspf.core-1.0.2.jar
plugins
PluginSamplePlugin.jar
lib -
PluginInterface.jar
jspf.core-1.0.2.jar

and I run the PluginConsumer, imyPlugin remains null, but there's no
errors logged either (if I rename the plugins directory to something
else I get an error telling me the plugins directory could not be
opened).

Any ideas what I'm missing here (I realize having duplicate jars is
not an ideal situation - but I'd tackle that with second priority).

Thanks
Stephan

Scott

unread,
Feb 8, 2012, 10:41:50 AM2/8/12
to jspf
I'm going to guess you've done the same thing I do every time I create
a new plugin... You left the @PluginImplementation off the plugin's
implementation class declaration.

@PluginImplementation
public class MySamplePlugin implements ISearchPlugin


Scott

Stephan Steiner

unread,
Feb 8, 2012, 10:54:46 AM2/8/12
to jspf
Wow that was fast - when i returned to post that I found what I did
wrong, you had already answered. As you correctly guessed, I left the
@PluginImplementation tag out.

Cheers
Stephan

Scott

unread,
Feb 8, 2012, 11:32:03 AM2/8/12
to jspf
Hehe - caught me at just the right time! Glad it was something
simple. Like I said, I do that *EVERY* time!

Scott

Ralf Biedert

unread,
Feb 8, 2012, 12:22:02 PM2/8/12
to js...@googlegroups.com

I take your posts as an indicator that future version of JSPF should probably get rid of the annotation …

Thanks for mentioning,
Ralf

Reply all
Reply to author
Forward
0 new messages