You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Clay Leeds <cl...@medata.com> on 2004/05/05 18:10:41 UTC

Clear FOP image cache from cmd line

Is there a way to clear the FOP image cache from the command line? The 
only thing I can find is:

   http://xml.apache.org/fop/graphics.html#caching

Which indicates one should call:

   org.apache.fop.image.FopImageFactory.resetCache()

Unfortunately, attempting this via:

   java org.apache.fop.image.FopImageFactory.resetCache()

from fop-0.20.5/ & fop-0.20.5/build/ don't work. I had thought 
restarting the system might help, but it has no effect.

Web Maestro Clay

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


Re: Clear FOP image cache from cmd line

Posted by Clay Leeds <cl...@medata.com>.
Jeremias Maerki wrote:
> Just have. FOP 0.20.5 on WinXP Pro under JDK 1.4.2_03. Cannot reproduce
> your problem. :-(
> 
> Jeremias Maerki

Thanks for trying!

Web Maestro Clay

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


Re: Clear FOP image cache from cmd line

Posted by Jeremias Maerki <de...@greenmail.ch>.
Just have. FOP 0.20.5 on WinXP Pro under JDK 1.4.2_03. Cannot reproduce
your problem. :-(

On 05.05.2004 23:21:30 Clay Leeds wrote:
> Has anyone tried replacing an image, then running FOP to see if it's 
> 'cached'?


Jeremias Maerki


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


Re: Clear FOP image cache from cmd line

Posted by Clay Leeds <cl...@medata.com>.
Jeremias Maerki wrote:
> Clay,
> 
> that's almost spooky. It almost appears as if the file system cache is
> malfunctioning on your system since it's not recognizing if a file is
> replaced. I'm very confident when I'm saying that FOP itself has no
> means to cache anything if you're starting FOP from the command-line for
> each file you're processing. The only entity that is then capable of
> showing this behaviour is a faulty file system cache. But that seems to
> be unlikely. The only thing now coming to my mind is that you might be
> holding your logos on a remote file system like NFS or via SMB. If you
> do, try working on a local harddrive to see if it behaves differently.

Nope. Doing it all locally. Starting FOP from the command line for each 
file being processed. Even our clients doing 300,000+/month are 
essentially doing it from the command line (/*.sh script). I could 
probably improve performance by using some sort of java applet or some 
such, but they haven't complained yet (if it works, don't fix it!)...

> You're using relative URLs. You're not getting the logo from a webserver
> via HTTP or something, right? But even if you do, I couldn't explain why
> your system still appears to be caching the logos.

Nope.

> I could be wrong about some of this but it sounds real strange. Maybe
> someone else has a better idea about what's going on.

Maybe. It was frustrating...Perhaps it's a Java issue (currently running 
1.4.2_03-b02) and not a FOP or Windows XP issue (btw, I'm not W2k as I 
erroneously mentioned earlier).

I have an idea... FWIW it's worth, I just tried renaming my xsl-fo 
template file (xml_med7_default.fo => xml_med7_default_2.fo), and it 
*still* uses the 'cached' version of logo.jpg. D'oh!

I'd thought perhaps that the image is coming from some other directory, 
but if I specify a different image in the xsl-fo template, it grabs that 
from the directory in question (new image file that is *nowhere* else on 
the system except where 'logo.jpg' lies).

Has anyone tried replacing an image, then running FOP to see if it's 
'cached'?

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


Re: Clear FOP image cache from cmd line

Posted by Jeremias Maerki <de...@greenmail.ch>.
Clay,

that's almost spooky. It almost appears as if the file system cache is
malfunctioning on your system since it's not recognizing if a file is
replaced. I'm very confident when I'm saying that FOP itself has no
means to cache anything if you're starting FOP from the command-line for
each file you're processing. The only entity that is then capable of
showing this behaviour is a faulty file system cache. But that seems to
be unlikely. The only thing now coming to my mind is that you might be
holding your logos on a remote file system like NFS or via SMB. If you
do, try working on a local harddrive to see if it behaves differently.

You're using relative URLs. You're not getting the logo from a webserver
via HTTP or something, right? But even if you do, I couldn't explain why
your system still appears to be caching the logos.

I could be wrong about some of this but it sounds real strange. Maybe
someone else has a better idea about what's going on.

On 05.05.2004 21:15:48 Clay Leeds wrote:
> While it's true that I primarily call FOP from the command line, I've 
> been dabbling in other means as well. As for image caching, I've found 
> that FOP _appears_ to be caching my images when I call FOP through the 
> command line. I have an image url('images/logo.jpg') I use in my 
> template which puts the company logo in the upper-left corner of the 
> page. My thought was that FOP newbie clients could replace logo.jpg with 
> their own logo (assuming it's got the same dimensions), and they'd see 
> their company logo. Unfortunately, FOP caches 'logo.jpg' so that the 
> 'old' logo shows up on subsequent print jobs. I have to actually modify 
> the name of then image in my template (instead of logo.jpg I use 
> company_logl.jpg), to get it to work.
> 
> BTW, I just tried running FOP using logo.jpg, then replacing the 
> logo.jpg file with a different logo, and it continues to use some sort 
> of 'cached' logo.jpg file. Unfortunately, this means (as you correctly 
> infer) that 'resetCache()' doesn't *do* anything. However it also means 
> I don't have a way to clear the 'cache' (for lack of a better term).
> 
> If it's not caching, I don't know what it's doing, but the end result is 
> I can't easily replace an image file to get a different image to load.


Jeremias Maerki


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


Re: Clear FOP image cache from cmd line

Posted by Clay Leeds <cl...@medata.com>.
Jeremias,

Jeremias Maerki wrote:
> Clay,
> 
> you're using FOP from the command-line exclusively, right? In that case
> resetting the image cache will bring you absolutely nothing, because
> there's no cache between calls to FOP as each time a new VM is started.
> resetCache() is only having an effect if you're running FOP in a server
> process.
> 
> resetCache() simply releases the memory used by the cached images. When
> calling FOP from the command-line the memory is also released when the
> VM exits. So there's no point in creating a CLI for resetCache(), I'm
> afraid.

While it's true that I primarily call FOP from the command line, I've 
been dabbling in other means as well. As for image caching, I've found 
that FOP _appears_ to be caching my images when I call FOP through the 
command line. I have an image url('images/logo.jpg') I use in my 
template which puts the company logo in the upper-left corner of the 
page. My thought was that FOP newbie clients could replace logo.jpg with 
their own logo (assuming it's got the same dimensions), and they'd see 
their company logo. Unfortunately, FOP caches 'logo.jpg' so that the 
'old' logo shows up on subsequent print jobs. I have to actually modify 
the name of then image in my template (instead of logo.jpg I use 
company_logl.jpg), to get it to work.

BTW, I just tried running FOP using logo.jpg, then replacing the 
logo.jpg file with a different logo, and it continues to use some sort 
of 'cached' logo.jpg file. Unfortunately, this means (as you correctly 
infer) that 'resetCache()' doesn't *do* anything. However it also means 
I don't have a way to clear the 'cache' (for lack of a better term).

If it's not caching, I don't know what it's doing, but the end result is 
I can't easily replace an image file to get a different image to load.

Web Maestro Clay

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


Re: Clear FOP image cache from cmd line

Posted by Jeremias Maerki <de...@greenmail.ch>.
Clay,

you're using FOP from the command-line exclusively, right? In that case
resetting the image cache will bring you absolutely nothing, because
there's no cache between calls to FOP as each time a new VM is started.
resetCache() is only having an effect if you're running FOP in a server
process.

resetCache() simply releases the memory used by the cached images. When
calling FOP from the command-line the memory is also released when the
VM exits. So there's no point in creating a CLI for resetCache(), I'm
afraid.

On 05.05.2004 19:10:41 Clay Leeds wrote:
> Oop! Never mind. I didn't think it was a CLASSPATH issue, because 
> fop.bat worked fine (w2k). However, it was a CLASSPATH issue. I ended up 
> inserting the CLASSPATH call from fop.bat as follows in front of the 
> java call, and it seems to have worked:
> 
>    set CLASSPATH="C:/[insert_long_line_of_FOP_CLASSPATH_stuff]";
>    java org.apache.fop.image.FopImageFactory.resetCache()
> 
> and it didn't error out.
> 
> Thanks for listening!
> 
> Web Maestro Clay
> 
> p.s. It might be nice to add a CLI for resetting FOP's image cache. 
> (Maybe I'll do that some time... :-))


Jeremias Maerki


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


Re: Clear FOP image cache from cmd line

Posted by Clay Leeds <cl...@medata.com>.
Oop! Never mind. I didn't think it was a CLASSPATH issue, because 
fop.bat worked fine (w2k). However, it was a CLASSPATH issue. I ended up 
inserting the CLASSPATH call from fop.bat as follows in front of the 
java call, and it seems to have worked:

   set CLASSPATH="C:/[insert_long_line_of_FOP_CLASSPATH_stuff]";
   java org.apache.fop.image.FopImageFactory.resetCache()

and it didn't error out.

Thanks for listening!

Web Maestro Clay

p.s. It might be nice to add a CLI for resetting FOP's image cache. 
(Maybe I'll do that some time... :-))

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