Revision 23de68fc
Added by Andreas Müller almost 2 years ago
cdmlib-print/src/main/java/eu/etaxonomy/cdm/print/out/xml/XMLOutputModule.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.print.out.xml; |
11 | 10 |
|
12 | 11 |
import java.io.File; |
... | ... | |
14 | 13 |
import java.io.FileOutputStream; |
15 | 14 |
import java.io.IOException; |
16 | 15 |
|
17 |
import org.apache.log4j.Logger; |
|
16 |
import org.apache.logging.log4j.LogManager; |
|
17 |
import org.apache.logging.log4j.Logger; |
|
18 | 18 |
import org.jdom.Document; |
19 | 19 |
import org.jdom.output.Format; |
20 | 20 |
import org.jdom.output.XMLOutputter; |
... | ... | |
23 | 23 |
import eu.etaxonomy.cdm.print.out.PublishOutputModuleBase; |
24 | 24 |
|
25 | 25 |
/** |
26 |
* Simple output module that writes the harvested xml data to disk without further processing.
|
|
27 |
*
|
|
26 |
* Simple output module that writes the harvested xml data to disk without further processing. |
|
27 |
* |
|
28 | 28 |
* @author n.hoffmann |
29 | 29 |
* @since Apr 8, 2010 |
30 |
* @version 1.0 |
|
31 | 30 |
*/ |
32 | 31 |
public class XMLOutputModule extends PublishOutputModuleBase{ |
33 |
private static final Logger logger = Logger |
|
34 |
.getLogger(XMLOutputModule.class); |
|
35 | 32 |
|
36 |
/* (non-Javadoc)
|
|
37 |
* @see eu.etaxonomy.printpublisher.IPublishOutputModule#output(org.jdom.Document) |
|
38 |
*/
|
|
39 |
public void output(Document document, File exportFolder, IProgressMonitor progressMonitor) {
|
|
40 |
|
|
33 |
private static final Logger logger = LogManager.getLogger(XMLOutputModule.class);
|
|
34 |
|
|
35 |
@Override
|
|
36 |
public void output(Document document, File exportFolder, IProgressMonitor progressMonitor) {
|
|
37 |
|
|
41 | 38 |
super.output(document, exportFolder, progressMonitor); |
42 |
|
|
39 |
|
|
43 | 40 |
try { |
44 | 41 |
String filePath = getFilePath(exportFolder); |
45 | 42 |
FileOutputStream outputStream = new FileOutputStream(filePath); |
46 | 43 |
//XMLOutputter xmlOutputter = new XMLOutputter(); |
47 |
|
|
44 |
|
|
48 | 45 |
Format format = Format.getPrettyFormat(); |
49 | 46 |
format.setEncoding("UTF-8"); |
50 |
XMLOutputter xmlOutputter = new XMLOutputter(format);
|
|
51 |
|
|
47 |
XMLOutputter xmlOutputter = new XMLOutputter(format); |
|
48 |
|
|
52 | 49 |
xmlOutputter.output(document, outputStream); |
53 | 50 |
logger.warn("XML output written to disk: " + filePath); |
54 | 51 |
} catch (FileNotFoundException e) { |
55 | 52 |
logger.error("A FileNotFoundException occured", e); |
56 | 53 |
} catch (IOException e) { |
57 |
|
|
54 |
|
|
58 | 55 |
} |
59 | 56 |
} |
60 | 57 |
|
61 |
/* |
|
62 |
* (non-Javadoc) |
|
63 |
* @see eu.etaxonomy.printpublisher.out.IPublishOutputModule#getOutputFileSuffix() |
|
64 |
*/ |
|
65 |
public String getOutputFileSuffix() { |
|
58 |
@Override |
|
59 |
public String getOutputFileSuffix() { |
|
66 | 60 |
return "xml"; |
67 | 61 |
} |
68 | 62 |
} |
Also available in: Unified diff
ref #9359 upgrade cdmlib to log4j 2