Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Develop plugins: getPlugin().getSetting() error #3450

reidrissi ·
Hello,
I trying to learn about QB plugings programming, I fellow the tutorials from this link: http://wiki.pmease.com/display/QB61/Wor ... n+Settings
but I'm stuck in this example:
Finally modify MyAnotherStep.java to make use of the configuration level prefix:

... // omitted for brevity
public class MyAnotherStep extends Step {

... // omitted for brevity

@Override
public void run() {
// You may also get the plugin setting object through PluginSettingHelper
MyPluginSetting pluginSetting = (MyPluginSetting) getPlugin().getSetting(Context.getConfiguration());
Context.getLogger().info(pluginSetting.getPrefix() + ": " + getMessage());
}

}

I have this error on eclipse:
The method getSetting(boolean) in the type Plugin is not applicable for the arguments (Configuration).

here's the javadoc of the function:

getSetting
java.lang.Object getSetting(boolean interpolate)
Get global plugin setting. The param determines whether or not to interpolate the setting. Return null if not defined


I'm using QuickBuild server 6.1.5 with jdk6u45

Could you please help me to fix this error?

Thank you very much.
  • replies 6
  • views 3736
  • stars 0
robinshen ADMIN ·
We've changed the method name and forget to update the turorial.

Ought to be:
MyPluginSetting pluginSetting = (MyPluginSetting) getPlugin().getConfigurationSetting(Context.getConfiguration(), true);

Tutorial has been updated as well. Thanks for the remind.
reidrissi ·
thank you,
it's working now <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
reidrissi ·
Hello,

another page need to be updated: http://wiki.pmease.com/display/QB61/Plugin+Data+Storage
this code is not working

new BuildDashboardContribution() {
public List<PanelCreator> getPanelCreators() {
List<PanelCreator> creators = new ArrayList<PanelCreator>();
if (new File(Context.getBuild().getPublishDir(), "myplugin").exists()) {
creators.add(new PanelCreator() {
public Panel getPanel(String id) {
return new MyPanel(id);
}
});
}
return creators;
}
public int getOrder() {
return 500;
}
}


The class BuildDashboardContribution() is not recognized.

regards,
reidrissi ·
and same for this Class BuildDashboardContribution, the import is not recognized !

import com.pmease.quickbuild.extensionpoint.BuildMetricsCollector;

//...

public void collectMetrics() {
Build build = Context.getBuild();
File msgFile = new File(build.getPublishDir(), "myplugin/message.txt");
if (msgFile.exists()) {
int msgLen = FileUtils.readFileAsString(msgFile).length();
File statsFile = new File(build.getConfiguration().getPublishDir(),
"myplugin/statistics.xml");
MyStatistics stats;
if (statsFile.exists())
stats = (MyStatistics) BeanUtils.readFile(statsFile);
else
stats = new MyStatistics();
stats.getMsgLens().put(build.getVersion(), msgLen);
BeanUtils.writeFile(stats, statsFile);
}
}
robinshen ADMIN ·
Get them fixed as well.
reidrissi ·
thanks a lot <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->