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 Swaminathan Palani <sw...@coliaudit.com> on 2004/11/09 23:14:08 UTC

Update Metadata from PROPPATCH

I want to update a property value in metadata file using value coming from
'PROPPATCH' request sent by client.

Using 'ContentInterceptor' doesn't seem to help because 'PROPPATCH' request
comes after interception. 	

Alternatively I tried to update property value using
'NodeRevisionDescriptor' 'set' methods in 'PropPatchMethod.java' class, the
value is updated in memory but not written on metadata file. 

Any ideas?  Thanks in advance.
	 
Swaminathan Palani



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


RE: Update Metadata from PROPPATCH

Posted by lixin chu <li...@yahoo.com>.
1) You can check the server doc, it has pretty detail
write-up: check the "Package summary of
org.apache.slide.event"

2) yes, you need to modify the Domain.xml, but that's
very simple: add your listener class. You can also
find the sample in the event package description.

3) here is my listener code. I created a Jar and put
it into slide server. I want to add a number of access
to a file property. However, the problem is that it
only updates upto 2. I still do not know why.
-----
package net.canal.core.slide;

import org.apache.slide.event.ContentAdapter;
import org.apache.slide.event.ContentEvent;
import org.apache.slide.common.Domain;
import
org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeProperty;

/**
 * @author chulx
 *
 */
public class CanalContentListener extends
ContentAdapter {
    protected static final String LOG_CHANNEL =
CanalContentListener.class.getName();

    public void create (ContentEvent event) {
        System.out.println ("in Canal listener :
create ");
        
        // create a new node property
        NodeRevisionDescriptor revision =
event.getRevisionDescriptor();
        if (revision != null) {
        	revision.setProperty("accessTimes", new
String ("0"));        	
        }                        
    }
    
    public void retrieve (ContentEvent event) {
        System.out.println ("in Canal listener :
retrieve ");
        NodeRevisionDescriptor revision =
event.getRevisionDescriptor();
        if (revision != null) {
        	NodeProperty n =
revision.getProperty("accessTimes");
        	if (n != null) {
        		int l = ((Integer)
n.getValue()).intValue()+1;
        		revision.setProperty("accessTimes", new
Integer (l));       	
        	}
        }                                
    }
    
    public void remove(ContentEvent event) {
        System.out.println ("in Canal listener :
remove ");
    }        
}


-----
btw, could you pls share your ContentInterceptor code
? I do not know anything about this. 

Now I am thinking of using client side
propfindMethod() and proppatchMethod() to handle the
custom properties.


--- Swaminathan Palani <sw...@coliaudit.com> wrote:

> Lixin Chu thank you,
> 
> 	I like to try that approach, does this require any
> configuration on
> 'Domain.xml'. Is it possible to share
> code/configuration example plz.
> 
> 	Thank you very much, 
> 
> Swaminathan Palani
> 
> -----Original Message-----
> From: lixin chu [mailto:lixin_chu@yahoo.com] 
> Sent: Tuesday, November 09, 2004 8:57 PM
> To: Slide Users Mailing List; swam@coliaudit.com
> Subject: Re: Update Metadata from PROPPATCH
> 
> I am also trying something similar, but using
> ContentAdapter, yet to complete trsoubleshooting...
> 
> --- Swaminathan Palani <sw...@coliaudit.com> wrote:
> 
> > 
> > I want to update a property value in metadata file
> > using value coming from
> > 'PROPPATCH' request sent by client.
> > 
> > Using 'ContentInterceptor' doesn't seem to help
> > because 'PROPPATCH' request
> > comes after interception. 	
> > 
> > Alternatively I tried to update property value
> using
> > 'NodeRevisionDescriptor' 'set' methods in
> > 'PropPatchMethod.java' class, the
> > value is updated in memory but not written on
> > metadata file. 
> > 
> > Any ideas?  Thanks in advance.
> > 	 
> > Swaminathan Palani
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > slide-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > slide-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> slide-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


RE: Update Metadata from PROPPATCH

Posted by Swaminathan Palani <sw...@coliaudit.com>.
Lixin Chu thank you,

	I like to try that approach, does this require any configuration on
'Domain.xml'. Is it possible to share code/configuration example plz.

	Thank you very much, 

Swaminathan Palani

-----Original Message-----
From: lixin chu [mailto:lixin_chu@yahoo.com] 
Sent: Tuesday, November 09, 2004 8:57 PM
To: Slide Users Mailing List; swam@coliaudit.com
Subject: Re: Update Metadata from PROPPATCH

I am also trying something similar, but using
ContentAdapter, yet to complete trsoubleshooting...

--- Swaminathan Palani <sw...@coliaudit.com> wrote:

> 
> I want to update a property value in metadata file
> using value coming from
> 'PROPPATCH' request sent by client.
> 
> Using 'ContentInterceptor' doesn't seem to help
> because 'PROPPATCH' request
> comes after interception. 	
> 
> Alternatively I tried to update property value using
> 'NodeRevisionDescriptor' 'set' methods in
> 'PropPatchMethod.java' class, the
> value is updated in memory but not written on
> metadata file. 
> 
> Any ideas?  Thanks in advance.
> 	 
> Swaminathan Palani
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> slide-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




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


Re: Update Metadata from PROPPATCH

Posted by lixin chu <li...@yahoo.com>.
I am also trying something similar, but using
ContentAdapter, yet to complete trsoubleshooting...

--- Swaminathan Palani <sw...@coliaudit.com> wrote:

> 
> I want to update a property value in metadata file
> using value coming from
> 'PROPPATCH' request sent by client.
> 
> Using 'ContentInterceptor' doesn't seem to help
> because 'PROPPATCH' request
> comes after interception. 	
> 
> Alternatively I tried to update property value using
> 'NodeRevisionDescriptor' 'set' methods in
> 'PropPatchMethod.java' class, the
> value is updated in memory but not written on
> metadata file. 
> 
> Any ideas?  Thanks in advance.
> 	 
> Swaminathan Palani
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> slide-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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