I am sorry Sergiu,
I just received the mail digest that has the messages from you and Artem. I
apologize.
Thanks to both of you for the responses. Seems like I am on track, but I
would really need guidance from you as I am trying to understand exactly
what I need to do.
Regarding your question on whether we want to replace the DB table for
attachments with an SVN store or use both of these, I think we want to use
both (I am not sure. I will discuss this with my team and let you know).
But, say if we wanted to keep both, SVN would be the primary storage
(because for the application we are designing, users may have many versions
of the same file and we want all of them to be available for future
references.) and the DB would mirror the SVN store.
But, at any time, the Attachments table wil only have the latest uploaded
file right, and not its previous versions? Am I right?
Also you mentioned this : "The notification mechanism will allow you to also
store the attachment
in SVN, but the attachment will go in the database, as it is done now.
If you want to also update the wiki when the SVN is changed, you can
write a SVN hook that notifies XWiki of the change. If you need more
details, ask."
Here when you say if you want to update the wiki, are u assuming that the
SVN repo. will be modified outside of the wiki interface?
In this regard, can you please point out the specific code packages I need
to look at to understand the notification mecahninsm.
Thanks a lot.
On 3/21/08, Sergiu Dumitriu <sergiu(a)xwiki.com> wrote:
Already sent, didn't you receive it?
-------- Original Message --------
Subject: Re: [xwiki-devs] XWiki Attachments
Date: Fri, 21 Mar 2008 12:42:27 +0100
From: Sergiu Dumitriu <sergiu(a)xwiki.com>
Organization: XWiki
To: XWiki Developers <devs(a)xwiki.org>
References:
<fb681d280803200948m79336289j221ed581c0890f94(a)mail.gmail.com>
<47E398BE.1020009(a)gmail.com>
Hi,
The best approach depends on what exactly do you want to do. Is the SVN
the only place where you want attachments, or should the SVN be just a
"backup", or alternate storage.
If you want to completely replace the database with SVN for attachments,
then implementing XWikiAttachmentStoreInterface is the way to go.
If you want to use the DB inside XWiki, but have a mirror on an SVN
server, then the notification mechanism is better.
Read below.
Artem Melentyev wrote:
Hi.
Kamna Jain wrote:
> I want to refer back to my thread on adding XWiki attachments to SVN.
> Artem and Vincent both suggested implementing the
>
> XWikiAttachmentStoreInterface.
>
> In this regard, I have a few Questions:
>
> 1)If I chose this option, do I have to follow the implementaion as done
> for
>
> XWikiHibernateAttachmentStore (Is this the class that handles adding
the
attachments to the DB?)
Yes.
You can just extend this class and override needed methods.
You also have to register your implementation as the attachment storage
in xwiki.cfg:
xwiki.store.attachment.class=some.package.SvnAttachmentStorage
2) would
that be enough - just implementing the interface, so that the
functions like saveAttachementContent() will add it to SVN and
loadAttachmentContent() will load it into XWiki from SVN. or would I
have to do something with other classes like the XWikiAction class (in
the Web package)
Yes. It would be enough.
> 3) Sergiu suggested that I could also use the notification mechanism
for
the
Fileupload action. Is this referring to the UploadAction class in
the Web ackage or the fileupload plugin?
I'm not much familiar with notification mechanism in xwiki, but I think
it is more simpler and better way than writing AttachmentStore.
The notification mechanism will allow you to also store the attachment
in SVN, but the attachment will go in the database, as it is done now.
If you want to also update the wiki when the SVN is changed, you can
write a SVN hook that notifies XWiki of the change. If you need more
details, ask.
> I am sorry if I am being naive, I am just
trying to undertsand the code
> structure and dependencies, call hierarchies etc. Is there any place
> where I can go in to understand the code better?
Yes, the code :p
4) Also,
my understanding is that the API package has all the classes
whose objects can be used in the velocity scripts at the presentation
layer. Am I right?
yes
Almost, there is also the request, response and different plugin APIs
that you can use. Also, using programming rights you can get to the
internal objects behind the API, as each API class has a method that
allows getting the wrapped object. But for the start the main API should
be enough, playing with the internal stuff is dangerous and not
recommended.
5) Can
the SVN integration be done at the presentation layer (with
velocity scripts...I doubt it, but just wanted to confirm)
I think no.
Not directly. You can put a svn client jar in the lib directory, and
write a Groovy class that acts as a Notification Listener and uses that
svn client to perform the changes. It is the same as writing a java
class, just that it is written in a wiki document, and uses the
(simpler?) Groovy language instead of Java. You cannot write an
attachment storage in Groovy, though.
6) this
is something to do with Eclispe and Subclipse I guess. I used
subclipse to download the xwiki core and then checked it out into my
workspace. The first time I did it, I had the Lucene plugin class in
there. The second time I re-did it, the plugin class was no more there.
(That is just one of the classes I noticed). could you think of
something I might have missed out?
try to clean, update eclipse projects.
no ideas more.
The Lucene plugin was recently moved to another place, so this is normal.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
--
Sergiu Dumitriu
http://purl.org/net/sergiu/