W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2009

2006/unicorn/src/org/w3c/unicorn/tests CommandLine.java,1.1,1.2 UnicornClient.java,1.1,1.2 HiepTest.java,1.1,1.2 UnicornClientDirectInputTest.java,1.1,1.2 XMLBeansTest.java,1.1,1.2 TaskTest.java,1.1,1.2 UnicornCallTest.java,1.1,1.2

From: Jean-Guilhem Rouel via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 28 Aug 2009 12:40:01 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Mh0kL-0005vw-8T@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/tests
In directory hutz:/tmp/cvs-serv22368/src/org/w3c/unicorn/tests

Added Files:
	CommandLine.java UnicornClient.java HiepTest.java 
	UnicornClientDirectInputTest.java XMLBeansTest.java 
	TaskTest.java UnicornCallTest.java 
Log Message:
Merging dev2 in HEAD

--- NEW FILE: UnicornClient.java ---
package org.w3c.unicorn.tests;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.Map;

import org.w3c.unicorn.UnicornCall;
import org.w3c.unicorn.contract.EnumInputMethod;
import org.w3c.unicorn.output.OutputFactory;
import org.w3c.unicorn.output.OutputFormater;
import org.w3c.unicorn.output.OutputModule;
import org.w3c.unicorn.util.Property;

public class UnicornClient {

	/**
	 * Prints help contents on the standard output.
	 * 
	 */
	public static void print_help() {
		System.out
				.println("[Usage] UnicornClient task inputType=[mimetype=]pageToValid templateLanguage outputTemplate [otherParameters]");
		System.out.println("");
		System.out
				.println("* tasks = one of task in tasklist.xml (eg: markup, css...)");
		System.out.println("* inputType       : uri|file");
		System.out
				.println("* mimetype        : text/html|text/css|... (required only if inputType='file')");
		System.out
				.println("* pageToValid     : an uri or a path to a file (depend on inputType)");
		System.out.println("* otherParameters : param1=val1,param2=val2...");
		System.out.println("");
		System.out
				.println("[Example] UnicornClient markup uri=http://w3.org en xhtml10");
		System.out
				.println("[Example] UnicornClient calculator uri=http://flyingman.sophia.w3.org/test en text10 x2=on,ptoto=titi");
		System.out
				.println("[Example] UnicornClient css file=text/css=./style/base.css fr text10 profile=css2,usermedium=screen,warning=2,lang=en");
	}

	/**
	 * Tests Unicorn client.
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		if (args.length == 0) {
			print_help();
		} else if (args.length == 1 && args[0].equals("help")) {
			print_help();
		} else {
			// read parameters
			String task = args[0];
			String pageToValid = args[1];
			String language = args[2];
			String outputTemplate = args[3];
			String pParams = "";
			if (args.length > 4) { // this argument is optional
				pParams = args[4];
			}

			UnicornCall aUnicornCall = new UnicornCall();

			// parse other parameters: "x2=on,toto=titi" to a
			// map<String,String[]>
			if (pParams.length() != 0) {
				Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>();
				String[] couples = pParams.split(",");
				for (int i = 0; i < couples.length; i++) {
					String[] couple = couples[i].split("=");
					if (couple.length == 2) {
						String[] tmp = { couple[1] };
						mapOfParameter.put(couple[0], tmp);
					} else {
						System.err.println("Error parameter!");
					}
				}
				aUnicornCall.setMapOfStringParameter(mapOfParameter);
			}

			// parse input type: "uri=http://flyingman.sophia.w3.org/test" or
			// "file=text/css=./style/base.css"
			String[] pInput = pageToValid.split("=");
			if (pInput[0].equals("uri")) {
				aUnicornCall.setEnumInputMethod(EnumInputMethod.URI);
				aUnicornCall.setDocumentName(pInput[1]);
				aUnicornCall.setInputParameterValue(pInput[1]);
			} else { // direct input
				try {
					aUnicornCall.setEnumInputMethod(EnumInputMethod.DIRECT);

					// read content in the file pInput[2], example:
					// pInput[2]=base.css alors content=".h1{color:#FA0012}";
					BufferedReader bfr = new BufferedReader(new FileReader(
							pInput[2]));
					String content = "";
					String line;
					while ((line = bfr.readLine()) != null) {
						content = content + line + "\n";
					}
					bfr.close();

					// Ajouter mime type dans map of parameter
					Map<String, String[]> mapOfParameter = aUnicornCall
							.getMapOfStringParameter();
					if (mapOfParameter == null) {
						mapOfParameter = new LinkedHashMap<String, String[]>();
						aUnicornCall.setMapOfStringParameter(mapOfParameter);
					}
					String[] tmp = { pInput[1] };
					mapOfParameter.put(Property.get("UNICORN_PARAMETER_PREFIX")
							+ "mime", tmp);

					aUnicornCall.setInputParameterValue(content);

				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			aUnicornCall.setTask(task); // task id
			aUnicornCall.setLang(language);

			long before = System.currentTimeMillis();
			try {
				aUnicornCall.doTask();

				Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
				mapOfStringObject.put("unicorncall", aUnicornCall);
				OutputFormater aOutputFormater = OutputFactory
						.getOutputFormater(outputTemplate, // text or xhtml10,
															// see
															// unicorn.properties
								language, "text/html"); // MIME Type
				OutputModule aOutputModule = OutputFactory
						.getOutputModule("simple");
				PrintWriter pw = new PrintWriter(System.out);
				aOutputModule.produceOutput(aOutputFormater, mapOfStringObject,
						null, pw);
				pw.flush();
			} catch (Exception e) {
				e.printStackTrace();
			}
			long after = System.currentTimeMillis();
			System.out.println("Elapsed time (s): " + (double) (after - before)
					/ 1000);
		}
	}
}

--- NEW FILE: UnicornCallTest.java ---
package org.w3c.unicorn.tests;

import java.io.InputStream;
import java.util.Iterator;

import javax.activation.MimeType;
import javax.xml.namespace.NamespaceContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.w3c.unicorn.contract.EnumInputMethod;
import org.w3c.unicorn.input.InputFactory;
import org.w3c.unicorn.input.InputModule;
import org.w3c.unicorn.request.Request;
import org.w3c.unicorn.response.Response;
import org.xml.sax.InputSource;

public class UnicornCallTest {

	public static Boolean evaluer(InputStream stream, String expression) {
		Boolean b = null;
		try {
			// cr�ation de la source
			InputSource source = new InputSource(stream);

			// cr�ation du XPath
			XPathFactory fabrique = XPathFactory.newInstance();

			XPath xpath = fabrique.newXPath();

			// test du namespace manuel

			NamespaceContext namespace = new NamespaceContext() {
				public String getNamespaceURI(String prefix) {
					if ("observationresponse".equals(prefix)) {
						return "http://www.w3.org/unicorn/observationresponse";
					} else {
						return null;
					}
				}

				public String getPrefix(String namespaceURI) {
					if ("http://www.w3.org/unicorn/observationresponse	"
							.equals(namespaceURI)) {
						return "observationresponse";
					} else {
						return null;
					}
				}

				public Iterator getPrefixes(String namespaceURI) {
					return null;
				}
			};
			xpath.setNamespaceContext(namespace);

			// �valuation de l'expression XPath
			XPathExpression exp = xpath.compile(expression);

			b = (Boolean) exp.evaluate(source, XPathConstants.BOOLEAN);
			System.out.println("namespace context : "
					+ xpath.getNamespaceContext());
		} catch (XPathExpressionException xpee) {
			xpee.printStackTrace();
		}
		return b;
	}

	public static void main(String[] args) {

		try {

			// First, the XML document

			/*
			 * String xmlStr =
			 *  "<?xml version=\"1.0\" ?>\n" +
			 *  "<Sales xmlns=\"http://www.davber.com/sales-format\">\n" +
			 *  "<Customer name=\"CostCo, Inc.\">\n" +
			 *  "<ord:Order xmlns:ord=\"http://www.davber.com/order-format\"
			 * price=\"12000\">\n" +
			 *  "<ord:Description>A bunch of stuff" +
			 *  "</ord:Description>\n" +
			 *  "</ord:Order>\n" +
			 *  "</Customer>\n" +
			 *  "</Sales>\n";
			 * 
			 */

			InputModule inputMod = InputFactory.createInputModule(
					(new MimeType()), EnumInputMethod.URI, "http://www.w3.org");
			Request req = Request.createRequest(inputMod,
					"http://validator.w3.org/check", "uri", false, "ucn");
			req.setLang("en");
			req.addParameter("output", "ucn");
			System.out.println("request created");
			System.out.println(req.getResponseType());
			Response res = req.doRequest();
			System.out.println("request done");

			DocumentBuilderFactory xmlFact = DocumentBuilderFactory
					.newInstance();
			xmlFact.setNamespaceAware(false);
			DocumentBuilder builder = xmlFact.newDocumentBuilder();
			Document doc = builder.parse(res.getXml().toString());

			// Now the XPath expression

			String xpathStr = "//false";

			XPathFactory xpathFact =

			XPathFactory.newInstance();

			XPath xpath = xpathFact.newXPath();

			String result = xpath.evaluate(xpathStr, doc);
			XPathExpression xpe = xpath.compile(xpathStr);
			boolean b = (Boolean) xpe.evaluate(doc, XPathConstants.BOOLEAN);
			System.out.println(b);
			System.out.println("xpath : " + (!result.equals("")));
			// System.out.println("XPath result is \"" +
			// result + "\"");

		}

		catch (Exception ex) {

			ex.printStackTrace();

		}

	}

}

/*
 * public static void main(String[] args) { try { System.out.println("Premier
 * test : URL"); // URL url = new //
 * URL("http://www.pms.ifi.lmu.de/forschung/xpath-eval.html");
 *  // String expression = "//category"; // String expression =
 * "//cadevraitetrefalse"; // (//doctype eq '-//W3C//DTD XHTML 1.0 Strict//EN') //
 * InputStream is = url.openStream(); // InputStreamReader isr = new
 * InputStreamReader(is); // BufferedReader br = new BufferedReader(isr); String
 * s = ""; // while ((s=br.readLine()) != null) // System.out.println(s); //
 * boolean b = evaluer(url.openStream(), expression); //
 * System.out.println(expression); // System.out.println("--> " + b);
 *  // System.out.println("Deuxi�me test : UPLOAD"); // Object fichier =
 * (Object) (new File("C:/w3.xht")); // FileItem f = (FileItem) fichier; //
 * expression = "//html";
 *  // � tester plus tard (voir firstservlet pour un exemple)
 *  // b = evaluer(f.getInputStream(),expression); // System.out.println("On
 * verra plus tard");
 *  // ystem.out.println("Troisi�me test : DIRECT");
 *  // System.out.println(b);
 *  // ObservationresponseDocument.Factory.parse();
 * 
 * //System.out.println("Premier test : URL");
 * 
 * String expr = "//result"; InputModule inputMod =
 * InputFactory.createInputModule( (new MimeType()), EnumInputMethod.URI,
 * "http://www.w3.org"); Request req = Request.createRequest(inputMod,
 * "http://validator.w3.org/check", "uri", false, "ucn"); req.setLang("en");
 * req.addParameter("output", "ucn"); System.out.println("request created");
 * System.out.println(req.getResponseType()); req.doRequest();
 * System.out.println("request done");
 *  // pour afficher le stream de response
 * 
 * InputStream resp = req.getResponseStream(); InputStreamReader isr = new
 * InputStreamReader(resp); BufferedReader br = new BufferedReader(isr); String
 * str = ""; while ((str=br.readLine()) != null) System.out.println(str);
 * 
 * 
 * br.close(); isr.close();resp.close();
 * 
 *  // trouver un moyen de // reset le responseStream de
 * 
 * //System.out.println(req.getResponseStream()); boolean xpathRes =
 * evaluer(req.getResponseStream(), expr); System.out.println(xpathRes);
 *  } catch (Exception e) { e.printStackTrace(); } }
 */

/*
 * public static void main(String[] args) throws Exception { Object ct; try { ct =
 * (new URL("http://www.w3.org")).openConnection().getContentType(); //XmlObject
 * bidule = XmlObject.Factory.parse("http://www.w3.org");
 * 
 * System.out.println(bidule); // System.out.println(ct);
 * //ct.selectPath(xPath); String xPath = "(//doctype eq '-//W3C//DTD XHTML 1.0
 * Strict//EN') or (//doctype eq '-//W3C//DTD HTML 4.01//EN')" ;
 * //System.out.println(ct.selectPath(xPath));
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 *  } catch (MalformedURLException e) { e.printStackTrace(); } catch
 * (IOException e) { e.printStackTrace(); }
 *  }
 */


--- NEW FILE: HiepTest.java ---
package org.w3c.unicorn.tests;

import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.Map;

import org.w3c.unicorn.UnicornCall;
import org.w3c.unicorn.contract.EnumInputMethod;
import org.w3c.unicorn.output.OutputFactory;
import org.w3c.unicorn.output.OutputFormater;
import org.w3c.unicorn.output.OutputModule;

public class HiepTest {

	public static void main(String[] args) {

		UnicornCall aUnicornCall = new UnicornCall();
		aUnicornCall.setTask("conformance"); // task id
		aUnicornCall.setEnumInputMethod(EnumInputMethod.URI);
		aUnicornCall.setDocumentName("http://w3.org");
		aUnicornCall.setInputParameterValue("http://w3.org");
		aUnicornCall.setLang("en");

		try {
			aUnicornCall.doTask();

			Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
			mapOfStringObject.put("unicorncall", aUnicornCall);
			OutputFormater aOutputFormater = OutputFactory.getOutputFormater(
					"xhtml10", // le template --> text ou xhtml10, see
								// unicorn.properties
					"en", // la langue
					"text/plain"); // MIME Type
			OutputModule aOutputModule = OutputFactory
					.getOutputModule("simple");
			PrintWriter pw = new PrintWriter(System.out);
			aOutputModule.produceOutput(aOutputFormater, mapOfStringObject,
					null, pw);
			pw.flush();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

--- NEW FILE: TaskTest.java ---
/**
 * 
 */
package org.w3c.unicorn.tests;

import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.xmlbeans.XmlException;
import org.w3.unicorn.tasklist.TaskType;
import org.w3.unicorn.tasklist.TasklistDocument;
import org.w3c.unicorn.exceptions.UnknownObserverException;
import org.w3c.unicorn.tasklist.Task;
import org.w3c.unicorn.tasklist.TaskListUnmarshallerBeans;

/**
 * @author shenril
 * 
 */
public class TaskTest {

	/**
	 * @param args
	 * @throws UnknownObserverException 
	 */
	public static void main(String[] args) throws UnknownObserverException {
		try {
			TasklistDocument tasklist = TasklistDocument.Factory
					.parse(new File("./resources/tasklist/new-tasklist.xml"));
			TaskListUnmarshallerBeans unmarshaller = new TaskListUnmarshallerBeans();
			Task aTask = new Task();
			aTask.setTree(unmarshaller.expandTree(tasklist.getTasklist().getTaskArray(0),
												  tasklist.getTasklist().getTaskArray(0).getRoutine()));
			Map<String, Task> mapOfTask = new LinkedHashMap<String, Task>();
			for (TaskType myTask : tasklist.getTasklist().getTaskList()) {
				Task bTask = new Task();
				aTask.setTree(unmarshaller.expandTree(myTask, myTask.getRoutine()));
				mapOfTask.put(bTask.getID(), bTask);
			}
			aTask.setTree(aTask.expandNode(mapOfTask, aTask.getTree()));
			aTask.displayTree(aTask.getTree());
		} catch (XmlException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (UnknownObserverException e) {
			e.printStackTrace();
		}
		
	}

}

--- NEW FILE: CommandLine.java ---
// $Id: CommandLine.java,v 1.2 2009/08/28 12:39:58 jean-gui Exp $
// Author: Damien LEROY.
// (c) COPYRIGHT MIT, ERCIM ant Keio, 2006.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.unicorn.tests;

import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.unicorn.UnicornCall;
import org.w3c.unicorn.contract.EnumInputMethod;
import org.w3c.unicorn.output.EnumOutputModule;
import org.w3c.unicorn.output.OutputFactory;
import org.w3c.unicorn.output.OutputModule;

/**
 * Class to call the framework by command line.
 * 
 * @author Damien LEROY
 */
public class CommandLine {

	private static final Log logger = LogFactory
			.getLog("org.w3c.unicorn.tests");

	private static String sTaskID = "all";

	private static Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>();

	private static EnumInputMethod aEnumInputMethod = null;

	private static String sEnumInputMethodValue = null;

	private static OutputModule aOutputModule = null;

	/**
	 * Launches the Unicorn Framework.
	 * 
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		CommandLine.logger.trace("Unicorn Framework Begin.");

		CommandLine.logger.info("Read command-line arguments.");
		for (int i = 0; i < args.length; i++) {
			if (CommandLine.logger.isDebugEnabled()) {
				CommandLine.logger.debug("Argument : " + args[i] + ".");
			}
			if ("-task".equals(args[i])) {
				i++;
				CommandLine.sTaskID = args[i];
				if (CommandLine.logger.isDebugEnabled()) {
					CommandLine.logger.debug("Task : " + CommandLine.sTaskID
							+ ".");
				}
			} else if ("-inputmethod".equals(args[i])) {
				i++;
				String[] tString = args[i].split("=");
				CommandLine.aEnumInputMethod = EnumInputMethod
						.fromValue(tString[0]);
				if (2 <= tString.length) {
					CommandLine.sEnumInputMethodValue = tString[1];
				}
				if (CommandLine.logger.isDebugEnabled()) {
					CommandLine.logger.debug("Input method : "
							+ CommandLine.aEnumInputMethod.toString()
							+ ", value : " + CommandLine.sEnumInputMethodValue
							+ ".");
				}
			} else if ("-outputmethod".equals(args[i])) {
				i++;
				String sOutputMethod = args[i];
				final EnumOutputModule aEnumOutputModule = EnumOutputModule
						.fromValue(sOutputMethod);
				if (null == aEnumOutputModule) {
					CommandLine.logger.error("Unknow output method : "
							+ sOutputMethod + ".");
					return;
				}
				CommandLine.aOutputModule = OutputFactory
						.getOutputModule(aEnumOutputModule);
			} else if (args[i].contains("=")) {
				String[] tString = args[i].split("=");
				String[] val = { tString[1] };
				CommandLine.mapOfParameter.put(tString[0], val);
			}
		}

		if (null == CommandLine.aEnumInputMethod) {
			CommandLine.logger.error("No input method specified.");
			return;
		}

		if (null == CommandLine.aOutputModule) {
			CommandLine.logger
					.info("No output method specified use SimpleOutputModule by default.");
			CommandLine.aOutputModule = OutputFactory
					.getOutputModule(EnumOutputModule.SIMPLE);
		}

		if (EnumInputMethod.DIRECT.equals(CommandLine.aEnumInputMethod)) {
			// read on standard input and add to Main.eimValue
			String sEnumInputMethodValue = "";
			for (int i = System.in.read(); -1 != i; i = System.in.read()) {
				sEnumInputMethodValue += (char) i;
			}
			if (CommandLine.logger.isDebugEnabled()) {
				CommandLine.logger.debug("Direct Input :\n"
						+ sEnumInputMethodValue);
			}
			CommandLine.sEnumInputMethodValue = sEnumInputMethodValue;
		}

		CommandLine.logger.info("Initialize framework.");
		UnicornCall aUnicornCall = new UnicornCall();
		aUnicornCall.setTask(CommandLine.sTaskID);
		aUnicornCall.setEnumInputMethod(CommandLine.aEnumInputMethod);
		// CommandLine.sEnumInputMethodValue
		aUnicornCall.setMapOfStringParameter(CommandLine.mapOfParameter);
		if (CommandLine.logger.isDebugEnabled()) {
			CommandLine.logger.debug("UnicornCall : " + aUnicornCall + ".");
		}

		CommandLine.logger.info("Process request.");
		// Main.mapOfParameter.put("warning", "2");
		aUnicornCall.doTask();

		CommandLine.logger.trace("Unicorn Framework End.");
	}

}

--- NEW FILE: XMLBeansTest.java ---
// $Id: XMLBeansTest.java,v 1.2 2009/08/28 12:39:59 jean-gui Exp $
// Author: Jean-Guilhem Rouel
// (c) COPYRIGHT MIT, ERCIM and Keio, 2006.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.unicorn.tests;

import java.io.IOException;

import org.apache.xmlbeans.XmlException;
import org.w3.unicorn.observationresponse.ObservationresponseDocument;

/**
 * XmlBeansTest<br />
 * Created: Jun 26, 2006 12:05:50 PM<br />
 * 
 * @author Batard Florent
 */
public class XMLBeansTest {

	public static void main(String[] args) throws XmlException, IOException {

		// Bind the instance to the generated XMLBeans types.
		ObservationresponseDocument ObsDoc = null;
		try {
			ObsDoc = ObservationresponseDocument.Factory
					.parse(new java.io.File("./target.xml"));
		} catch (XmlException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

		ObservationresponseDocument.Observationresponse obs = ObsDoc
				.getObservationresponse();
		// Get and print pieces of the XML instance.

		System.out.println(obs.getResult().getErrors().getErrorlistArray(0)
				.getErrorArray(0).getLongmessageArray(0));
		System.out.println(obs.getResult().getErrors().getErrorlistArray(0)
				.getErrorArray(0).getMessageArray(0));
	}

}

--- NEW FILE: UnicornClientDirectInputTest.java ---
package org.w3c.unicorn.tests;

import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.Map;

import org.w3c.unicorn.UnicornCall;
import org.w3c.unicorn.contract.EnumInputMethod;
import org.w3c.unicorn.output.OutputFactory;
import org.w3c.unicorn.output.OutputFormater;
import org.w3c.unicorn.output.OutputModule;
import org.w3c.unicorn.util.Property;

public class UnicornClientDirectInputTest {

	public static void main(String[] args) {

		UnicornCall aUnicornCall = new UnicornCall();
		aUnicornCall.setTask("css"); // task id
		aUnicornCall.setEnumInputMethod(EnumInputMethod.DIRECT);
		aUnicornCall.setLang("en");

		aUnicornCall
				.setDocumentName("D:/stageW3C/unicorn/style/base_result.css");

		Map<String, String[]> mapOfParameter = new LinkedHashMap<String, String[]>();
		String[] tmp = { "text/css" };
		mapOfParameter.put(Property.get("UNICORN_PARAMETER_PREFIX") + "mime",
				tmp);
		aUnicornCall.setMapOfStringParameter(mapOfParameter);

		aUnicornCall
				.setInputParameterValue("p#msie { /* msie-bug note for text/plain */ float: right; border: 1px solid black; background: white;}");

		try {

			aUnicornCall.doTask();

			Map<String, Object> mapOfStringObject = new LinkedHashMap<String, Object>();
			mapOfStringObject.put("unicorncall", aUnicornCall);
			OutputFormater aOutputFormater = OutputFactory.getOutputFormater(
					"text10", // le template --> text ou xhtml10, see
								// unicorn.properties
					"en", // la langue
					"text/plain"); // MIME Type
			OutputModule aOutputModule = OutputFactory
					.getOutputModule("simple");
			PrintWriter pw = new PrintWriter(System.out);
			aOutputModule.produceOutput(aOutputFormater, mapOfStringObject,
					null, pw);
			pw.flush();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
Received on Friday, 28 August 2009 12:40:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:38 UTC