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(); } ... }
Hi, You need to call "init" in you constructor Ludovic Xavier MOGHRABI a écrit :
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
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic
Thanks, It seems I was too tired to think well ! -- Xavier MOGHRABI - Consortium ObjectWeb Le Lundi 13 Février 2006 22:23, Ludovic Dubost a écrit :
Hi,
You need to call "init" in you constructor
Ludovic
Xavier MOGHRABI a écrit :
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
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
participants (2)
-
Ludovic Dubost -
Xavier MOGHRABI