You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Lixin Chu <li...@gmail.com> on 2006/06/12 11:11:34 UTC

Re: common practice of managing metadata with Slide

I realized that proppatchmethod will create a new version for a versioned
resource.

if this is true, I am afraid that I cannot make use of this mechanism to
support custome properties.

Is it really true ?

The specific custome property I would like to have is a list of users who
are interested in the update of the resource (file or folder). I wanted to
do something when the watched resource is changed (new version uploaded, or
deleted for example).

I notice that there is a subscribe method, but do not know how to program
it; googled but did not find detailed enough examples.

any idea ?



On 3/7/06, Max Pfingsthorn <m....@hippo.nl> wrote:
>
> Hi!
>
> Slide already takes care of almost all your meta data:
>
> >  - manage file version
> This is done by the deltav versioning extension to webdav, see
> http://www.webdav.org/deltav/protocol/rfc3253.html
>
> >  - show submitter information, file type, file size info
> This information is contained in <DAV:owner/>, <DAV:getcontenttype/>,
> <DAV:getcontentlength/>
>
> >  - show locked by
> If a resource (document) is locked, it will have a <DAV:lockdiscovery/>
> property. In that property, there is some xml which also mentions the owner
> of the lock. Be aware that reading a locked resource is always possible,
> however writing to it (or affecting is state in any other way) is only
> possible when you specify the lock token, which is also mentioned in the
> lockdiscovery property. So someone can hijack your lock. It is really up to
> your application to get this right, but generally it is not a problem.
> See http://www.webdav.org/specs/rfc2518.html#METHOD_LOCK and
> http://www.webdav.org/specs/rfc2518.html#locking for more information.
>
> >  - support folder structure
> Webdav organizes documents into folders, called "collections" in webdav
> terms. So does slide, of course.
>
> As I mentioned before, the PROPPATCH method can be used to set arbitrary
> properties, custom ones as well. See
> http://www.webdav.org/specs/rfc2518.html#METHOD_PROPPATCH for more
> information.
>
> Bye and good luck!
> max
>
> > -----Original Message-----
> > From: Lixin Chu [mailto:lixin.chu@gmail.com]
> > Sent: Tuesday, March 07, 2006 10:55
> > To: Slide User
> > Subject: common practice of managing metadata with Slide
> >
> >
> > Hello,
> > would like to seek advice on the common practice of managing
> > metadata with
> > Slide.
> >
> > i am working on a typical (hopefully) doc management
> > appliaction, which
> > requires:
> >  - manage file version
> >  - show submitter information, file type, file size info
> >  - show locked by
> >  - support folder structure
> >
> > so what's the common way of managing these meta-data info ?
> > should I leave
> > them to Slide or should I create a database table to manager these
> > information ?
> >
> > and which solution gives better performance ?
> >
> > thanks in advance!
> > lixin
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>

Re: common practice of managing metadata with Slide

Posted by Marco Ferretti <ma...@gmail.com>.
On 6/13/06, Lixin Chu <li...@gmail.com> wrote:
> Hi Marco,
> thanks for your info. some questions: the webdavResoruce has one method:
>
> public Subscription
> <http://jakarta.apache.org/slide/clientjavadoc/org/apache/webdav/lib/Subscription.html>
> *subscribeMethod*(java.lang.String path,
>                                     java.lang.String notificationType,
>                                     java.lang.String callback,
>                                     long notificationDelay,
>                                     int depth,
>                                     long lifetime)
>
>
> I suppose this is used to tell Slide that I am interested in the change made
> to the 'path'. But I do not know how to register the Subscriber. and also
> what do we have in the Map information ? the API doc does not tell us more
> abt this though.

Actually, what I do is I create a listener and then add subscribers to
it so that I can get the callbacks ... I don't create subscriptions
but Subscriber(s)
>
> One more question, does this subscribeMethod is valid for the current http
> session ? I am developing a Struts+Spring based web application. The feature
> is something like this:
>
>     user can subscribe to the changes made to the resources (files/folders)
>     when something happened, a notification msg is sent by Slide to my web
> application; the web application then log necessary information, like who
> and what action was done to the resource.
I use it as a process instantiated by the server ; it is a servlet
that runs in background, so I suppose yes
>
> Does your solution work in this way:
>  - when we start the web application, we check a special folder in Slide to
> get any existing subscritions, then webdavResource.subscribeMethod() one by
> one with a long enough lifetime;
>  - when user wants to monitor a resource, the web application add the
> request into the special folder, and also webdavResource.subscribeMethod()
> it.
>  - when a notification arrives, the registered Subscriber class will get the
> user list and send msg to all subscribers
>
Exactly .
> thanks !
>
no probs .

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: common practice of managing metadata with Slide

Posted by Lixin Chu <li...@gmail.com>.
Hi Marco,
thanks for your info. some questions: the webdavResoruce has one method:

public Subscription
<http://jakarta.apache.org/slide/clientjavadoc/org/apache/webdav/lib/Subscription.html>
*subscribeMethod*(java.lang.String path,
                                    java.lang.String notificationType,
                                    java.lang.String callback,
                                    long notificationDelay,
                                    int depth,
                                    long lifetime)


I suppose this is used to tell Slide that I am interested in the change made
to the 'path'. But I do not know how to register the Subscriber. and also
what do we have in the Map information ? the API doc does not tell us more
abt this though.

One more question, does this subscribeMethod is valid for the current http
session ? I am developing a Struts+Spring based web application. The feature
is something like this:

    user can subscribe to the changes made to the resources (files/folders)
    when something happened, a notification msg is sent by Slide to my web
application; the web application then log necessary information, like who
and what action was done to the resource.

Does your solution work in this way:
 - when we start the web application, we check a special folder in Slide to
get any existing subscritions, then webdavResource.subscribeMethod() one by
one with a long enough lifetime;
 - when user wants to monitor a resource, the web application add the
request into the special folder, and also webdavResource.subscribeMethod()
it.
 - when a notification arrives, the registered Subscriber class will get the
user list and send msg to all subscribers

thanks !

On 6/12/06, Marco Ferretti <ma...@gmail.com> wrote:
>
> On 6/12/06, Lixin Chu <li...@gmail.com> wrote:
> > I realized that proppatchmethod will create a new version for a
> versioned
> > resource.
> >
> > if this is true, I am afraid that I cannot make use of this mechanism to
> > support custome properties.
> >
> > Is it really true ?
> >
> > The specific custome property I would like to have is a list of users
> who
> > are interested in the update of the resource (file or folder). I wanted
> to
> > do something when the watched resource is changed (new version uploaded,
> or
> > deleted for example).
> >
> > I notice that there is a subscribe method, but do not know how to
> program
> > it; googled but did not find detailed enough examples.
> >
> > any idea ?
> >
>
> As of the notification :
>
> 2 make a long story short you have to implement your subscriber (
> implements org.apache.webdav.lib.Subscriber ) in order to reply to the
> listener. The method that's being called is  public void notify(String
> uri, Map information) ; This way you can implement your emailer .
>
> What I did was mantaining a list of users/resource/type of
> subscription in a private webdav folder so that I didn't have to
> bother with users deleting properties that mattered from the resources
> themselves .
>
> In my implementation of Subscriber I had something like
>
>         public void notify(String uri, Map information) {
>                 printInfos(uri,information,logger);
>                 if ( users != null && !users.isEmpty() ){
>                         sendSmtpMail(message + "\n\n" +
> createMessageBody(uri,information));
>                 } else {
>                         logger.warning("users list is empty");
>                 }
>         }
>
>
> Then you have to implement your own methods for sending email .
>
> I'll come back on this if you need more.
>
>
> Cheers
>
> Marco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>

Re: common practice of managing metadata with Slide

Posted by Marco Ferretti <ma...@gmail.com>.
On 6/13/06, Lixin Chu <li...@gmail.com> wrote:
> Hi Marco,
> I am also interested in how you organize your private folder where you keep
> the resource/user/type information.
>

Well, my problem was that I had to enable users to watch files in a
document management system,

 ROOT -
             |
              --- user ( as collection )
                              |
                              --- UrlEncoder.encode(path/to/resource)
( as collection )

where ROOT is the root path of your private directory ( collection ) .
The user collection has the same name as the username; I keep the
e-mail address as a property of the collection .
Each path has a property that says which type of subscriptions are
submitted for the current user.

Then, in my servlet, I create a listener on the ROOT directory, so
that I am notified of every change in the tree and I can operate with
subscribing & unsubscribing in the servlet itself. The system operates
in the directory ( never directly on webdav subscriptions ) : there is
only one class that minds about the callbacks.

More, internally ( in memory ) data is organized a little differently
than on disk : since you get the callback for the resource ( a path )
you need to organize data in maps that have
UrlEncoder.encode(path/to/resource) as key and the list of users
subscribed as data.

Another pit : I had ( on a tomcat based server ) to put the
initialization of the servlet ( reading the dav tree and so on ) in a
separate thread ... it was stopping the server for too long making
impossible for the webdav server to start up properly.



cheers

Marco

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: common practice of managing metadata with Slide

Posted by Lixin Chu <li...@gmail.com>.
Hi Marco,
I am also interested in how you organize your private folder where you keep
the resource/user/type information.

thanks
lixin

On 6/12/06, Marco Ferretti <ma...@gmail.com> wrote:
>
> On 6/12/06, Lixin Chu <li...@gmail.com> wrote:
> > I realized that proppatchmethod will create a new version for a
> versioned
> > resource.
> >
> > if this is true, I am afraid that I cannot make use of this mechanism to
> > support custome properties.
> >
> > Is it really true ?
> >
> > The specific custome property I would like to have is a list of users
> who
> > are interested in the update of the resource (file or folder). I wanted
> to
> > do something when the watched resource is changed (new version uploaded,
> or
> > deleted for example).
> >
> > I notice that there is a subscribe method, but do not know how to
> program
> > it; googled but did not find detailed enough examples.
> >
> > any idea ?
> >
>
> As of the notification :
>
> 2 make a long story short you have to implement your subscriber (
> implements org.apache.webdav.lib.Subscriber ) in order to reply to the
> listener. The method that's being called is  public void notify(String
> uri, Map information) ; This way you can implement your emailer .
>
> What I did was mantaining a list of users/resource/type of
> subscription in a private webdav folder so that I didn't have to
> bother with users deleting properties that mattered from the resources
> themselves .
>
> In my implementation of Subscriber I had something like
>
>         public void notify(String uri, Map information) {
>                 printInfos(uri,information,logger);
>                 if ( users != null && !users.isEmpty() ){
>                         sendSmtpMail(message + "\n\n" +
> createMessageBody(uri,information));
>                 } else {
>                         logger.warning("users list is empty");
>                 }
>         }
>
>
> Then you have to implement your own methods for sending email .
>
> I'll come back on this if you need more.
>
>
> Cheers
>
> Marco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>

Re: common practice of managing metadata with Slide

Posted by Marco Ferretti <ma...@gmail.com>.
On 6/12/06, Lixin Chu <li...@gmail.com> wrote:
> I realized that proppatchmethod will create a new version for a versioned
> resource.
>
> if this is true, I am afraid that I cannot make use of this mechanism to
> support custome properties.
>
> Is it really true ?
>
> The specific custome property I would like to have is a list of users who
> are interested in the update of the resource (file or folder). I wanted to
> do something when the watched resource is changed (new version uploaded, or
> deleted for example).
>
> I notice that there is a subscribe method, but do not know how to program
> it; googled but did not find detailed enough examples.
>
> any idea ?
>

As of the notification :

2 make a long story short you have to implement your subscriber (
implements org.apache.webdav.lib.Subscriber ) in order to reply to the
listener. The method that's being called is  public void notify(String
uri, Map information) ; This way you can implement your emailer .

What I did was mantaining a list of users/resource/type of
subscription in a private webdav folder so that I didn't have to
bother with users deleting properties that mattered from the resources
themselves .

In my implementation of Subscriber I had something like

        public void notify(String uri, Map information) {
                printInfos(uri,information,logger);
                if ( users != null && !users.isEmpty() ){
                        sendSmtpMail(message + "\n\n" +
createMessageBody(uri,information));
                } else {
                        logger.warning("users list is empty");
                }
        }


Then you have to implement your own methods for sending email .

I'll come back on this if you need more.


Cheers

Marco

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org