You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2010/08/17 16:13:25 UTC
svn commit: r986315 - in /xmlgraphics/fop/trunk/src:
documentation/content/xdocs/trunk/running.xml
java/org/apache/fop/cli/CommandLineOptions.java
java/org/apache/fop/fonts/FontManager.java
Author: acumiskey
Date: Tue Aug 17 14:13:24 2010
New Revision: 986315
URL: http://svn.apache.org/viewvc?rev=986315&view=rev
Log:
-delete-cache command line argument replaced with -flush. Seems like a more common use case.
Modified:
xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/running.xml
xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontManager.java
Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/running.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/running.xml?rev=986315&r1=986314&r2=986315&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/running.xml (original)
+++ xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/running.xml Tue Aug 17 14:13:24 2010
@@ -135,7 +135,8 @@ Fop [options] [-fo|-xml] infile [-xsl fi
-conserve enable memory-conservation policy (trades memory-consumption for disk I/O)
(Note: currently only influences whether the area tree is serialized.)
- -delete-cache deletes the current font cache file
+ -cache specifies a file/directory path location
+ -flush flushes the current font cache file
[INPUT]
infile xsl:fo input file (the same as the next)
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=986315&r1=986314&r2=986315&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java Tue Aug 17 14:13:24 2010
@@ -130,6 +130,8 @@ public class CommandLineOptions {
private String mimicRenderer = null;
+ private boolean flushCache = false;
+
/**
* Construct a command line option object.
*/
@@ -167,7 +169,9 @@ public class CommandLineOptions {
}
checkSettings();
setUserConfig();
-
+ if (flushCache) {
+ flushCache();
+ }
//Factory config is set up, now we can create the user agent
foUserAgent = factory.newFOUserAgent();
foUserAgent.getRendererOptions().putAll(renderingOptions);
@@ -285,8 +289,8 @@ public class CommandLineOptions {
factory.setStrictValidation(false);
} else if (args[i].equals("-conserve")) {
conserveMemoryPolicy = true;
- } else if (args[i].equals("-delete-cache")) {
- parseDeleteCacheOption(args, i);
+ } else if (args[i].equals("-flush")) {
+ flushCache = true;
} else if (args[i].equals("-cache")) {
parseCacheOption(args, i);
} else if (args[i].equals("-dpi")) {
@@ -401,26 +405,6 @@ public class CommandLineOptions {
}
}
- private void parseDeleteCacheOption(String[] args, int i) throws FOPException {
- FontManager fontManager = factory.getFontManager();
- try {
- setUserConfig();
- File cacheFile = fontManager.getCacheFile();
- if (fontManager.deleteCache()) {
- System.out.println("Successfully deleted the font cache file '"
- + cacheFile + "'.");
- System.exit(0);
- } else {
- System.err.println("Failed to delete the font cache file '"
- + cacheFile + "'.");
- System.exit(1);
- }
- } catch (IOException e) {
- System.err.println("Failed to delete the font cache file");
- System.exit(1);
- }
- }
-
private int parseConfigurationOption(String[] args, int i) throws FOPException {
if ((i + 1 == args.length)
|| (isOption(args[i + 1]))) {
@@ -1205,9 +1189,9 @@ public class CommandLineOptions {
+ " (Note: currently only influences whether the area tree is"
+ " serialized.)\n\n"
- + " -delete-cache delete the current font cache file and exit\n"
+ " -cache specifies a file/directory path location"
- + " for the font cache file\n\n"
+ + " for the font cache file\n"
+ + " -flush flushes the current font cache file\n\n"
+ " [INPUT] \n"
+ " infile xsl:fo input file (the same as the next) \n"
@@ -1381,5 +1365,14 @@ public class CommandLineOptions {
}
}
+ private void flushCache() throws FOPException {
+ FontManager fontManager = factory.getFontManager();
+ File cacheFile = fontManager.getCacheFile();
+ if (!fontManager.deleteCache()) {
+ System.err.println("Failed to flush the font cache file '"
+ + cacheFile + "'.");
+ System.exit(1);
+ }
+ }
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontManager.java?rev=986315&r1=986314&r2=986315&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontManager.java Tue Aug 17 14:13:24 2010
@@ -202,7 +202,6 @@ public class FontManager {
if (useCache) {
if (cacheFile != null) {
deleted = cacheFile.delete();
- cacheFile = null;
} else {
deleted = FontCache.getDefaultCacheFile(true).delete();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org