You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jan Wielgus <li...@o2.pl> on 2003/12/05 18:42:46 UTC

DirectoryGenerator problem (was: Re: Listing files from a directory)

>You wouldn't want an Action to do that - but a Generator, and there
are 
>several included by default.  Look in the user docs under Generators - 
>you'll find at least DirectoryGenerator and ImageDirectoryGenerator 
>there.  I think there are others with more sophisticated options which 
>may be not as well documented.

Thank you for the tip. I use now the ImageDirectoryGenerator but I
have one problem with it. If I add a file to a directory given as a
parameter and then refresh the site, the xml generated doesn't show
the new file. But whenever I delete anything from this directory,
the changes are showed at once. When I copy new files to the
directory, the changes are showed only after I have restarted the
servlet engine (in my case Jetty, I am using Coccon 2.1.2). What can
cause this strange behaviour? I have tried to set the
"refreshDelay"-parameters for some different values, but the xml
generated by the ImageDirectoryGenerator never changes until I
restart the servlet engine...

Jan 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: DirectoryGenerator problem (was: Re: Listing files from a directory)

Posted by hed <he...@interia.pl>.
I think there is a bug in DirValidity class (nested in DirectoryGenerator
class):

public int isValid() {
if (System.currentTimeMillis() <= expiry) {
return 1;
}
expiry = System.currentTimeMillis() + delay;
int len = files.size();
for (int i = 0; i < len; i++) {
File f = (File)files.get(i);
if (!f.exists()) {
return -1; // File was removed
}
long oldDate = ((Long)fileDates.get(i)).longValue();
long newDate = f.lastModified();
if (oldDate != newDate) {
return -1;
}
}
// all content is up to date: update the expiry date
expiry = System.currentTimeMillis() + delay;
return 1;
}

directory isn't valid only when a file was removed or 'lastmodified' dates
aren't equal.
it is necessary to check a number of files in that directory also...



U�ytkownik "Jan Wielgus" <li...@o2.pl> napisa� w wiadomo�ci
news:20031205174246.687EE11544C@rekin4.o2.pl...
> >You wouldn't want an Action to do that - but a Generator, and there
> are
> >several included by default.  Look in the user docs under Generators -
> >you'll find at least DirectoryGenerator and ImageDirectoryGenerator
> >there.  I think there are others with more sophisticated options which
> >may be not as well documented.
>
> Thank you for the tip. I use now the ImageDirectoryGenerator but I
> have one problem with it. If I add a file to a directory given as a
> parameter and then refresh the site, the xml generated doesn't show
> the new file. But whenever I delete anything from this directory,
> the changes are showed at once. When I copy new files to the
> directory, the changes are showed only after I have restarted the
> servlet engine (in my case Jetty, I am using Coccon 2.1.2). What can
> cause this strange behaviour? I have tried to set the
> "refreshDelay"-parameters for some different values, but the xml
> generated by the ImageDirectoryGenerator never changes until I
> restart the servlet engine...
>
> Jan




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org