Hello!
While implementing something I came around the BaseProperty and while
reading the code I found several strange things. I agree with the
comment above BaseProperty that this class should be abstract, mainly
because getValue() always returns null. Then PropertyClass can be made
abstract as well.
But then I'm stuck a bit with the stuff in XWikiHibernateStore, which
creates also new instances of BaseProperty and PropertyClass. It looks
to me like the code there is simply cloning those objects - but why is
it not using clone() then? Well, it is doing some strange stuff there
anyway.
While looking at all this stuff, I also found several other things which
could be cleaned up to avoid bugs, to increase performance and to make
things easier understandable.
But before I get really started: is this kind of work wanted? I am aware
that with a code base of this size it is easy to break things...
--
Michael Reinsch <mr(a)uue.org> http://mr.uue.org/
------------------------------------------------------------------------
Hi XWiki developers,
I'm preparing a small plugin for thumbnails as explain in my previous mail.
The image is resized by adding a parameter heigth at this end of a download
URL (eg :xwiki/bin/download/Photos/Seychelles1999/DSC04010.JPG?height=550)
To call the plugin I need to add a piece of code in DownloadAction class.
Do you think :
- is it better to add the dependancy to the plugin in the DownloadAction class
such as :
// Sending the content of the attachment
- byte[] data = attachment.getContent(context);
+ byte[] data = null;
+
+ // Resize if imageplugin is on
+ ImagePlugin imageplugin = (ImagePlugin)
context.getWiki().getPlugin(
+ "image", context);
+ if ((request.getParameter("height") != null) &&
(imageplugin != null)) {
+ try {
+ int height =
Integer.parseInt(request.getParameter("height"));
+ data = imageplugin.createThumbnail(attachment,
height, context);
+ response.setContentType("image/png");
+ } catch (NumberFormatException e) {
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (data == null) data = attachment.getContent(context);
+
- or is it better to add a generic method in the plugin Interface class
(XWikiPluginInterface) with a method : startDownloading(byte[] data,
XWikiContext context) and to call it after in DownloadAction ?
Regards
--
Xavier MOGHRABI - Consortium ObjectWeb
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,
Assuming "Always Authenticate on Viewing" is enabled in the wiki
preferences, should XWikiAuthServiceImpl.authenticate(user, password,
context) actually get called on every page view? Or is some cookie
used to prevent this?
I ask because this behaviour seems to have changed on my local xwiki
installation, and I'm not what I've done to cause the change (it used
to get called on every page view, and doesn't any more).
Thanks,
Robin.
I'm running into an issue with the 200K character limit for
xwikidoc.xwd_archive.
Normally, a diff is generated, so this column doesn't grow too big.
However, if the document is always a single long line, the diff is
just that line everytime, and xwd_archive grows very quickly.
Any thoughts on how I can fix this aside from just increasing the limit?
Matt