Get Plugin Information

92 views
Skip to first unread message

James Bartlett

unread,
Feb 8, 2012, 12:27:23 AM2/8/12
to jspf
Hi all, i got silly question but its been bugging me a while, im
loading my plugins one by one using the getPlugin command:

Plugin tempModule = pm.getPlugin(ModuleRequirements.class, new
OptionCapabilities("Module:"+moduleName));

However i would like to get the information on the plugin in question
ie what other Capabilities the module has and who the auth is etc....
Has anyone got an example of how this could be done...

Thanks

Ralf

unread,
Feb 8, 2012, 12:30:23 AM2/8/12
to jspf
Hi, have a look at the PluginInformation interface. It should at least
give you the plugin's caps.

James Bartlett

unread,
Feb 8, 2012, 12:33:54 AM2/8/12
to jspf
I have the page up now, but still cant work out how to actually use
it... Im rather new to Java, still getting to grips with it:)

Ralf

unread,
Feb 8, 2012, 12:54:26 AM2/8/12
to jspf
Approx. like this:

Collection<String> caps =
pi.getInformation(PluginInformation.CAPABILITIES, somePlugin);

where pi is the PluginInformation plugin, which you would get through
the pluginManager.

James Bartlett

unread,
Feb 8, 2012, 1:08:43 AM2/8/12
to jspf
Could just me eclipse freaking up but i got this:

protected PluginManager pm;
protected PluginManagerUtil pmu;
protected PluginInformation pi;

public ModuleManager() {
pm = PluginManagerFactory.createPluginManager();
pm.addPluginsFrom(ClassURI.CLASSPATH);
pmu = new PluginManagerUtil(pm);
pi = new PluginInformation(pm); (test 1 failed - Cannot instantiate
the type PluginInformation)
pi = (PluginInformation) pm; (test 2 failed - PluginManagerImpl
cannot be cast to PluginInformation)
}

then in my module i got the following to get the data...

Example: moduleName = "MainMenu";

tempModule = pm.getPlugin(ModuleRequirements.class, new
OptionCapabilities("Module:"+moduleName));
Collection<String> caps =
pi.getInformation(PluginInformation.CAPABILITIES, tempModule);

Ralf Biedert

unread,
Feb 8, 2012, 1:28:25 AM2/8/12
to js...@googlegroups.com

Am 07.02.2012 um 22:08 schrieb James Bartlett:

> Could just me eclipse freaking up but i got this:
>
> protected PluginManager pm;
> protected PluginManagerUtil pmu;
> protected PluginInformation pi;
>
> public ModuleManager() {
> pm = PluginManagerFactory.createPluginManager();
> pm.addPluginsFrom(ClassURI.CLASSPATH);
> pmu = new PluginManagerUtil(pm);
> pi = new PluginInformation(pm); (test 1 failed - Cannot instantiate

Try:

pi = pm.getPlugin(PluginInformation.class);

Reply all
Reply to author
Forward
0 new messages