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 Gao Jun <ga...@yahoo.com> on 2004/10/29 15:43:45 UTC

How to add more internal node properties

Hi everybody,
I have a question on using slide. We want to add one more internal property - "nodeId" to each node of slide. This property should be managed (set the value) inside of the slide server, just like other properties like displayname, getcontentlength, etc, so that when users, with any webdav client, upload a file to slide server, the file's "nodeId" property value can be set by slide server automatically - it will be a sequence no actually. My question is 
 
How could I achieve this by modifying slide code as clean as I can?

Which part of the slide code (or which class) should I go to modify? 
Is it in StructureImpl?

Is there some Factory pattern which I can take use of so that I can apply my
changes by extending some interface or abstract class instead of changing slide's code directly?
 
Is there anyone who has done similar things before? Thanks in advance for all the advices and suggestions.
 
regards,
 
Jun

		
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

Re: How to add more internal node properties

Posted by lixin chu <li...@yahoo.com>.
I just tried - I wanted to add a 'accessTimes'
property:

public void create (ContentEvent event) {      
    // create a new node property
    NodeRevisionDescriptor revision =
event.getRevisionDescriptor();
    if (revision != null) {
      	revision.setProperty("accessTimes", new Integer
(0));        	
    }                        
}

I can see that the new property os created in the
metadata file; then I added:

public void retrieve (ContentEvent event) {
    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));
        System.out.println ("accessTimes =
"+Integer.toString(l));
       	}
   }                                
}

the problem is that I always get accessTimes 1 or 2

 the metadata property value is not updated. anything
wrong ?





--- lixin chu <li...@yahoo.com> wrote:

> Hi Stefan,
> thanks for your advice. I am also trying to so
> something similar. 
> 
> any documents regarding custom property creation,
> etc
> ?
> 
> will listBasic() return the custom property ? in
> what
> order ?
> 
> thanks
> lixin
> --- Stefan L�tzkendorf <lu...@apache.org>
> wrote:
> 
> > Gao,
> > 
> > the best way I think is to use slides event
> > mechanics. You can implement
> > a ContentListener. This listener can create the
> new
> > property in the create
> > method which is called if a new resource is
> created.
> > 
> > So you don't need to change slides code (:-)
> > 
> > Have a look in the package org.apacha.slide.event.
> > 
> > Listeners are registered in the Domain.xml, you
> can
> > find samples in the
> > default Domain.xml i think.
> > 
> > Hope, this helps
> > Stefan
> > 
> > 
> > 
> > Gao Jun wrote:
> > > Hi everybody,
> > > I have a question on using slide. We want to add
> > one more internal property - "nodeId" to each node
> > of slide. This property should be managed (set the
> > value) inside of the slide server, just like other
> > properties like displayname, getcontentlength,
> etc,
> > so that when users, with any webdav client, upload
> a
> > file to slide server, the file's "nodeId" property
> > value can be set by slide server automatically -
> it
> > will be a sequence no actually. My question is 
> > >  
> > > How could I achieve this by modifying slide code
> > as clean as I can?
> > > 
> > > Which part of the slide code (or which class)
> > should I go to modify? 
> > > Is it in StructureImpl?
> > > 
> > > Is there some Factory pattern which I can take
> use
> > of so that I can apply my
> > > changes by extending some interface or abstract
> > class instead of changing slide's code directly?
> > >  
> > > Is there anyone who has done similar things
> > before? Thanks in advance for all the advices and
> > suggestions.
> > >  
> > > regards,
> > >  
> > > Jun
> > > 
> > > 		
> > > ---------------------------------
> > > Do you Yahoo!?
> > > Yahoo! Mail Address AutoComplete - You start. We
> > finish.
> > 
> > -- 
> > Stefan L�tzkendorf  -- luetzkendorf@apache.org
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > slide-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > slide-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Check out the new Yahoo! Front Page. 
> www.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!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: How to add more internal node properties

Posted by lixin chu <li...@yahoo.com>.
Hi Stefan,
thanks for your advice. I am also trying to so
something similar. 

any documents regarding custom property creation, etc
?

will listBasic() return the custom property ? in what
order ?

thanks
lixin
--- Stefan L�tzkendorf <lu...@apache.org>
wrote:

> Gao,
> 
> the best way I think is to use slides event
> mechanics. You can implement
> a ContentListener. This listener can create the new
> property in the create
> method which is called if a new resource is created.
> 
> So you don't need to change slides code (:-)
> 
> Have a look in the package org.apacha.slide.event.
> 
> Listeners are registered in the Domain.xml, you can
> find samples in the
> default Domain.xml i think.
> 
> Hope, this helps
> Stefan
> 
> 
> 
> Gao Jun wrote:
> > Hi everybody,
> > I have a question on using slide. We want to add
> one more internal property - "nodeId" to each node
> of slide. This property should be managed (set the
> value) inside of the slide server, just like other
> properties like displayname, getcontentlength, etc,
> so that when users, with any webdav client, upload a
> file to slide server, the file's "nodeId" property
> value can be set by slide server automatically - it
> will be a sequence no actually. My question is 
> >  
> > How could I achieve this by modifying slide code
> as clean as I can?
> > 
> > Which part of the slide code (or which class)
> should I go to modify? 
> > Is it in StructureImpl?
> > 
> > Is there some Factory pattern which I can take use
> of so that I can apply my
> > changes by extending some interface or abstract
> class instead of changing slide's code directly?
> >  
> > Is there anyone who has done similar things
> before? Thanks in advance for all the advices and
> suggestions.
> >  
> > regards,
> >  
> > Jun
> > 
> > 		
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Mail Address AutoComplete - You start. We
> finish.
> 
> -- 
> Stefan L�tzkendorf  -- luetzkendorf@apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> slide-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: How to add more internal node properties

Posted by Stefan Lützkendorf <lu...@apache.org>.
Gao,

the best way I think is to use slides event mechanics. You can implement
a ContentListener. This listener can create the new property in the create
method which is called if a new resource is created.

So you don't need to change slides code (:-)

Have a look in the package org.apacha.slide.event.

Listeners are registered in the Domain.xml, you can find samples in the
default Domain.xml i think.

Hope, this helps
Stefan



Gao Jun wrote:
> Hi everybody,
> I have a question on using slide. We want to add one more internal property - "nodeId" to each node of slide. This property should be managed (set the value) inside of the slide server, just like other properties like displayname, getcontentlength, etc, so that when users, with any webdav client, upload a file to slide server, the file's "nodeId" property value can be set by slide server automatically - it will be a sequence no actually. My question is 
>  
> How could I achieve this by modifying slide code as clean as I can?
> 
> Which part of the slide code (or which class) should I go to modify? 
> Is it in StructureImpl?
> 
> Is there some Factory pattern which I can take use of so that I can apply my
> changes by extending some interface or abstract class instead of changing slide's code directly?
>  
> Is there anyone who has done similar things before? Thanks in advance for all the advices and suggestions.
>  
> regards,
>  
> Jun
> 
> 		
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.

-- 
Stefan Lützkendorf  -- luetzkendorf@apache.org


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


AW: How to add more internal node properties

Posted by Daniel Florey <da...@web.de>.
Another idea:
Just add a property extractor that is registered on the root path so that
every incoming resource gets 'extracted'. In this content extractor simply
do nothing but return the new property. This should be enough and is the
simplest approach I can think of.
Daniel

> -----Ursprüngliche Nachricht-----
> Von: slide-user-return-9202-daniel.florey=web.de@jakarta.apache.org
> [mailto:slide-user-return-9202-daniel.florey=web.de@jakarta.apache.org] Im
> Auftrag von Gao Jun
> Gesendet: Freitag, 29. Oktober 2004 14:44
> An: slide-user@jakarta.apache.org
> Betreff: How to add more internal node properties
> 
> Hi everybody,
> I have a question on using slide. We want to add one more internal
> property - "nodeId" to each node of slide. This property should be managed
> (set the value) inside of the slide server, just like other properties
> like displayname, getcontentlength, etc, so that when users, with any
> webdav client, upload a file to slide server, the file's "nodeId" property
> value can be set by slide server automatically - it will be a sequence no
> actually. My question is
> 
> How could I achieve this by modifying slide code as clean as I can?
> 
> Which part of the slide code (or which class) should I go to modify?
> Is it in StructureImpl?
> 
> Is there some Factory pattern which I can take use of so that I can apply
> my
> changes by extending some interface or abstract class instead of changing
> slide's code directly?
> 
> Is there anyone who has done similar things before? Thanks in advance for
> all the advices and suggestions.
> 
> regards,
> 
> Jun
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.


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