Commit 706ca087 authored by Fabien Triolet's avatar Fabien Triolet
Browse files

Moved code from TSerializer to PDFSerializer, WriteFile and StdOut.

Put the new copyright notice for 2003.
parent 4b3f1b5c
/*
* $Id: CSVXMLReader.java,v 1.2 2003-01-15 12:46:43 triolet Exp $
* $Id: CSVXMLReader.java,v 1.3 2003-02-11 15:41:01 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2001-2002 Fluxmedia and INRIA Rhne-Alpes.
* Copyright (C) INRIA Rhne-Alpes, 2003.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.fr
*
......@@ -112,7 +113,8 @@ public class CSVXMLReader extends AbstractXMLReader {
*@param separator The new separator value
*/
public void setSeparator(String separator) {
this.separator = separator.charAt(0);
if (separator!=null)
this.separator = separator.charAt(0);
}
/**
......
/*
* $Id: ReadCSV.java,v 1.5 2003-02-06 15:53:56 triolet Exp $
* $Id: ReadCSV.java,v 1.6 2003-02-11 15:41:01 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2001-2002 Fluxmedia and INRIA Rhône-Alpes.
* Copyright (C) INRIA Rhône-Alpes, 2003.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.fr
*
......
/**
* $Id: PDFSerializer.java,v 1.14 2002-11-08 07:42:21 triolet Exp $
/*
* $Id: PDFSerializer.java,v 1.15 2003-02-11 15:41:01 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2001-2002 Fluxmedia and INRIA Rhne-Alpes.
* Copyright (C) INRIA Rhne-Alpes, 2003.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.fr
*
......@@ -106,7 +107,9 @@ public final class PDFSerializer extends TSerializer {
MessageHandler.setScreenLogger(new org.apache.avalon.framework.logger.NullLogger());
driver.setLogger(new org.apache.avalon.framework.logger.NullLogger());
if (pParam.getParameter("format") != null) {
format = (String)pParam.getParameter("format");
}
driver.setRenderer(Driver.RENDER_PDF);
if ((format.toLowerCase()).equals("pdf")) {
driver.setRenderer(Driver.RENDER_PDF);
......
/**
* $Id: TSerializer.java,v 1.4 2002-11-14 15:46:45 triolet Exp $
/*
* $Id: TSerializer.java,v 1.5 2003-02-11 15:41:01 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2001-2002 Fluxmedia and INRIA Rhne-Alpes.
* Copyright (C) INRIA Rhne-Alpes, 2003.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.fr
*
......@@ -53,10 +54,6 @@ import org.xml.sax.helpers.DefaultHandler;
public abstract class TSerializer extends TProcessBasic {
/**
* Description of the Field
*/
public java.util.Properties Op = null;
/**
* Description of the Field
......@@ -102,60 +99,7 @@ public abstract class TSerializer extends TProcessBasic {
printOut = true;
}
}
String method = (String)pParam.getParameter("method");
if (pParam.getParameter("format") != null) {
format = (String)pParam.getParameter("format");
}
if (method == null) {
method = "xml";
}
if (method == "html") {
method = "xhtml";
}
if (Op == null) {
Op = new java.util.Properties();
}
Op.setProperty("method", method);
if (pParam.getParameter("version") != null) {
Op.setProperty("version", (String)pParam.getParameter("version"));
} else {
Op.setProperty("version", "1.0");
}
if (pParam.getParameter("encoding") != null) {
Op.setProperty("encoding", (String)pParam.getParameter("encoding"));
} else {
Op.setProperty("encoding", "UTF-8");
}
if (pParam.getParameter("omit-xml-declaration") != null) {
Op.setProperty("omit-xml-declaration", (String)pParam.getParameter("omit-xml-declaration"));
} else {
Op.setProperty("omit-xml-declaration", "no");
}
if (pParam.getParameter("standalone") != null) {
Op.setProperty("standalone", (String)pParam.getParameter("standalone"));
} else {
Op.setProperty("standalone", "yes");
}
if (pParam.getParameter("doctype-public") != null) {
Op.setProperty("doctype-public", (String)pParam.getParameter("doctype-public"));
}
if (pParam.getParameter("doctype-system") != null) {
Op.setProperty("doctype-system", (String)pParam.getParameter("doctype-system"));
}
if (pParam.getParameter("cdata-section-elements") != null) {
Op.setProperty("cdata-section-elements", (String)pParam.getParameter("cdata-section-elements"));
}
if (pParam.getParameter("indent") != null) {
Op.setProperty("indent", (String)pParam.getParameter("indent"));
} else {
Op.setProperty("indent", "no");
}
if (pParam.getParameter("media-type") != null) {
Op.setProperty("media-type", (String)pParam.getParameter("media-type"));
} else {
Op.setProperty("media-type", "text/xml");
}
}
/**
......
/**
* $Id: StdOut.java,v 1.2 2002-11-07 14:31:11 triolet Exp $
/*
* $Id: StdOut.java,v 1.3 2003-02-11 15:41:01 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2001-2002 Fluxmedia and INRIA Rhne-Alpes.
* Copyright (C) INRIA Rhne-Alpes, 2003.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.fr
*
......@@ -69,6 +70,11 @@ public final class StdOut extends TSerializer {
*/
protected SAXTransformerFactory tfactory = null;
/**
* Description of the Field
*/
public java.util.Properties Op = null;
/**
*Constructor for the StdOut object
*
......@@ -81,6 +87,57 @@ public final class StdOut extends TSerializer {
super(pIn, pParam, pStaticAttributes);
try {
handler = getTransformerFactory().newTransformerHandler();
String method = (String)pParam.getParameter("method");
if (method == null) {
method = "xml";
}
if (method == "html") {
method = "xhtml";
}
if (Op == null) {
Op = new java.util.Properties();
}
Op.setProperty("method", method);
if (pParam.getParameter("version") != null) {
Op.setProperty("version", (String)pParam.getParameter("version"));
} else {
Op.setProperty("version", "1.0");
}
if (pParam.getParameter("encoding") != null) {
Op.setProperty("encoding", (String)pParam.getParameter("encoding"));
} else {
Op.setProperty("encoding", "UTF-8");
}
if (pParam.getParameter("omit-xml-declaration") != null) {
Op.setProperty("omit-xml-declaration", (String)pParam.getParameter("omit-xml-declaration"));
} else {
Op.setProperty("omit-xml-declaration", "no");
}
if (pParam.getParameter("standalone") != null) {
Op.setProperty("standalone", (String)pParam.getParameter("standalone"));
} else {
Op.setProperty("standalone", "yes");
}
if (pParam.getParameter("doctype-public") != null) {
Op.setProperty("doctype-public", (String)pParam.getParameter("doctype-public"));
}
if (pParam.getParameter("doctype-system") != null) {
Op.setProperty("doctype-system", (String)pParam.getParameter("doctype-system"));
}
if (pParam.getParameter("cdata-section-elements") != null) {
Op.setProperty("cdata-section-elements", (String)pParam.getParameter("cdata-section-elements"));
}
if (pParam.getParameter("indent") != null) {
Op.setProperty("indent", (String)pParam.getParameter("indent"));
} else {
Op.setProperty("indent", "no");
}
if (pParam.getParameter("media-type") != null) {
Op.setProperty("media-type", (String)pParam.getParameter("media-type"));
} else {
Op.setProperty("media-type", "text/xml");
}
} catch (Exception e) {
throw new TMRuntimeException(e, "[StdOut] Cannot create object");
}
......
/**
* $Id: WriteFile.java,v 1.2 2002-11-07 14:31:11 triolet Exp $
/*
* $Id: WriteFile.java,v 1.3 2003-02-11 15:41:01 triolet Exp $
*
* Transmorpher
*
* Copyright (C) 2001-2002 Fluxmedia and INRIA Rhne-Alpes.
* Copyright (C) INRIA Rhne-Alpes, 2003.
*
* http://www.fluxmedia.fr - http://transmorpher.inrialpes.fr
*
......@@ -58,6 +59,11 @@ public final class WriteFile extends TSerializer {
final static int DEFAULT_BUFFER_SIZE = 8192;
/**
* Description of the Field
*/
public java.util.Properties Op = null;
/**
* The handler for the transformation
*/
......@@ -86,6 +92,57 @@ public final class WriteFile extends TSerializer {
super(pIn, pParam, pStaticAttributes);
try {
handler = getTransformerFactory().newTransformerHandler();
String method = (String)pParam.getParameter("method");
if (method == null) {
method = "xml";
}
if (method == "html") {
method = "xhtml";
}
if (Op == null) {
Op = new java.util.Properties();
}
Op.setProperty("method", method);
if (pParam.getParameter("version") != null) {
Op.setProperty("version", (String)pParam.getParameter("version"));
} else {
Op.setProperty("version", "1.0");
}
if (pParam.getParameter("encoding") != null) {
Op.setProperty("encoding", (String)pParam.getParameter("encoding"));
} else {
Op.setProperty("encoding", "UTF-8");
}
if (pParam.getParameter("omit-xml-declaration") != null) {
Op.setProperty("omit-xml-declaration", (String)pParam.getParameter("omit-xml-declaration"));
} else {
Op.setProperty("omit-xml-declaration", "no");
}
if (pParam.getParameter("standalone") != null) {
Op.setProperty("standalone", (String)pParam.getParameter("standalone"));
} else {
Op.setProperty("standalone", "yes");
}
if (pParam.getParameter("doctype-public") != null) {
Op.setProperty("doctype-public", (String)pParam.getParameter("doctype-public"));
}
if (pParam.getParameter("doctype-system") != null) {
Op.setProperty("doctype-system", (String)pParam.getParameter("doctype-system"));
}
if (pParam.getParameter("cdata-section-elements") != null) {
Op.setProperty("cdata-section-elements", (String)pParam.getParameter("cdata-section-elements"));
}
if (pParam.getParameter("indent") != null) {
Op.setProperty("indent", (String)pParam.getParameter("indent"));
} else {
Op.setProperty("indent", "no");
}
if (pParam.getParameter("media-type") != null) {
Op.setProperty("media-type", (String)pParam.getParameter("media-type"));
} else {
Op.setProperty("media-type", "text/xml");
}
} catch (Exception e) {
throw new TMRuntimeException(e, "[WriteFile] Cannot create object");
}
......@@ -116,7 +173,7 @@ public final class WriteFile extends TSerializer {
streamBuffer = new BufferedOutputStream(getOutputStream(), outputBufferSize);
handler.getTransformer().setOutputProperties(Op);
handler.setResult(new StreamResult(streamBuffer));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment