aboutsummaryrefslogtreecommitdiffstats
path: root/src/codegen
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-07-11 18:10:28 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-07-11 18:10:28 +0000
commit74567e49f4caf648926ab2ba7a034ae84c30b2e9 (patch)
tree5e23a9a14c950d08e590596d234baec87f333d7e /src/codegen
parent4c424cbe893d3e75675983710475cae1c4b61e07 (diff)
downloadxmlgraphics-fop-74567e49f4caf648926ab2ba7a034ae84c30b2e9.tar.gz
xmlgraphics-fop-74567e49f4caf648926ab2ba7a034ae84c30b2e9.zip
Merged revisions 675590,675604,675698,675845,675854 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r675590 | vhennebert | 2008-07-10 15:31:52 +0100 (Thu, 10 Jul 2008) | 2 lines Bugzilla #45369: footnotes were rendered at the top of the region-body when using the intermediate format ........ r675604 | jeremias | 2008-07-10 16:02:15 +0100 (Thu, 10 Jul 2008) | 1 line Beware! An evil tab character! But it's been eliminated. ;-) ........ r675698 | jeremias | 2008-07-10 20:47:12 +0100 (Thu, 10 Jul 2008) | 6 lines Added support for piping: - input from stdin (-imagein not supported) - output to stdout Syntax: fop -xml # -xsl mystylesheet.xsl -pdf # (reads the XML from stdin and sends the generated PDF to stdout) ........ r675845 | jeremias | 2008-07-11 08:22:29 +0100 (Fri, 11 Jul 2008) | 1 line Check the result of mkdirs() to see if the target directory could be created. ........ r675854 | jeremias | 2008-07-11 09:00:31 +0100 (Fri, 11 Jul 2008) | 1 line Ignore FindBugs preference file from Eclipse. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@676040 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java b/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
index 60ffaf103..743811142 100644
--- a/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
+++ b/src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
@@ -56,13 +56,17 @@ public class EventProducerCollectorTask extends Task {
private List filesets = new java.util.ArrayList();
private File modelFile;
private File translationFile;
-
+
/** {@inheritDoc} */
public void execute() throws BuildException {
try {
EventProducerCollector collector = new EventProducerCollector();
processFileSets(collector);
- getModelFile().getParentFile().mkdirs();
+ File parentDir = getModelFile().getParentFile();
+ if (!parentDir.exists() && !parentDir.mkdirs()) {
+ throw new BuildException(
+ "Could not create target directory for event model file: " + parentDir);
+ }
collector.saveModelToXML(getModelFile());
log("Event model written to " + getModelFile());
if (getTranslationFile() != null) {
@@ -76,10 +80,10 @@ public class EventProducerCollectorTask extends Task {
throw new BuildException(ioe);
}
}
-
+
private static final String MODEL2TRANSLATION = "model2translation.xsl";
private static final String MERGETRANSLATION = "merge-translation.xsl";
-
+
/**
* Updates the translation file with new entries for newly found event producer methods.
* @throws IOException if an I/O error occurs
@@ -89,7 +93,7 @@ public class EventProducerCollectorTask extends Task {
boolean resultExists = getTranslationFile().exists();
SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();
-
+
//Generate fresh generated translation file as template
Source src = new StreamSource(getModelFile());
StreamSource xslt1 = new StreamSource(
@@ -101,7 +105,7 @@ public class EventProducerCollectorTask extends Task {
Transformer transformer = tFactory.newTransformer(xslt1);
transformer.transform(src, domres);
final Node generated = domres.getNode();
-
+
Node sourceDocument;
if (resultExists) {
//Load existing translation file into memory (because we overwrite it later)
@@ -176,7 +180,7 @@ public class EventProducerCollectorTask extends Task {
public void addFileset(FileSet set) {
filesets.add(set);
}
-
+
/**
* Sets the model file to be written.
* @param f the model file
@@ -184,7 +188,7 @@ public class EventProducerCollectorTask extends Task {
public void setModelFile(File f) {
this.modelFile = f;
}
-
+
/**
* Returns the model file to be written.
* @return the model file
@@ -192,7 +196,7 @@ public class EventProducerCollectorTask extends Task {
public File getModelFile() {
return this.modelFile;
}
-
+
/**
* Sets the translation file for the event producer methods.
* @param f the translation file
@@ -200,7 +204,7 @@ public class EventProducerCollectorTask extends Task {
public void setTranslationFile(File f) {
this.translationFile = f;
}
-
+
/**
* Returns the translation file for the event producer methods.
* @return the translation file
@@ -208,7 +212,7 @@ public class EventProducerCollectorTask extends Task {
public File getTranslationFile() {
return this.translationFile;
}
-
+
/**
* Command-line interface for testing purposes.
* @param args the command-line arguments
@@ -222,15 +226,15 @@ public class EventProducerCollectorTask extends Task {
project.setName("Test");
FileSet fileset = new FileSet();
fileset.setDir(new File("test/java"));
-
+
FilenameSelector selector = new FilenameSelector();
selector.setName("**/*.java");
fileset.add(selector);
generator.addFileset(fileset);
-
+
File targetDir = new File("build/codegen1");
targetDir.mkdirs();
-
+
generator.setModelFile(new File("D:/out.xml"));
generator.setTranslationFile(new File("D:/out1.xml"));
generator.execute();