Dear XWiki Dev,
I try to create a plugin which should reduce the image size to have a kind of
thumbnail feature.
To do that I've created a plugin a part of the code is hereunder.
To call the plugin I've added in xwiki.cfg the complete name of the class (and
also a parameter about the cache size). The plugin uses the cache service.
At runtime my plugin is set by this code :
Plugin imageplugin = (ImagePlugin) context.getWiki().getPlugin("image",
context);
But I don't have the cache service working, the attribute imageCache is null.
It seems that the init method is never called.
Any idea is welcome.
Regards
--
Xavier MOGHRABI - Consortium ObjectWeb
package com.xpn.xwiki.plugin.image;
public class ImagePlugin extends XWikiDefaultPlugin implements
XWikiPluginInterface {
private static String name = "image";
private XWikiCache imageCache;
private int capacity = 50;
private static Log mLogger = LogFactory.getFactory().getInstance(
ImagePlugin.class);
public ImagePlugin(String name, String className, XWikiContext context) {
super(name, className, context);
}
/**
* Allow to get the plugin name
*
* @return plugin name
*/
public String getName() {
return name;
}
public void init(XWikiContext context) {
super.init(context);
try {
String capacityParam = context.getWiki().Param(
"xwiki.plugin.image.cache.capacity");
capacity = Integer.parseInt(capacityParam);
} catch (NumberFormatException e) {
}
imageCache = new OSCacheCache(capacity, true, "temp/imageCache");
}
public void flushCache() {
if (imageCache != null)
imageCache.flushAll();
}
...
}