KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openi > stat > r > RFunctionUIBuilder


1 /*********************************************************************************
2  * The contents of this file are subject to the OpenI Public License Version 1.0
3  * ("License"); You may not use this file except in compliance with the
4  * License. You may obtain a copy of the License at
5  * http://www.openi.org/docs/LICENSE.txt
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is: OpenI Open Source
12  *
13  * The Initial Developer of the Original Code is Loyalty Matrix, Inc.
14  * Portions created by Loyalty Matrix, Inc. are
15  * Copyright (C) 2005 Loyalty Matrix, Inc.; All Rights Reserved.
16  *
17  * Contributor(s): ______________________________________.
18  *
19  ********************************************************************************/

20
21
22 package org.openi.stat.r;
23
24 import java.util.Map JavaDoc;
25 import java.io.File JavaDoc;
26 import javax.xml.transform.stream.StreamSource JavaDoc;
27 import javax.xml.transform.Source JavaDoc;
28
29 import org.openi.xml.XMLTransformer;
30 import java.io.IOException JavaDoc;
31 import javax.xml.transform.TransformerException JavaDoc;
32 import org.openi.xml.BeanStorage;
33 import java.io.InputStream JavaDoc;
34 import java.io.ByteArrayInputStream JavaDoc;
35
36 /**
37  * @author Uddhab Pant <br>
38  * @version $Revision: 1.3 $ $Date: 2006/04/12 00:39:12 $ <br>
39  *
40  * Class responsible transform r task xml file with r task xsl file
41  * and generates UI for r task by using XMLTransformer class.
42  */

43
44 public class RFunctionUIBuilder {
45
46     /**
47      * Builds UI for R Function.
48      * @param funList RFunctionList
49      * @param xslFile String
50      * @param xslParam Map
51      * @return String
52      * @throws IOException
53      * @throws TransformerException
54      */

55     public static String JavaDoc build(RFunctionList funList, String JavaDoc xslFile, Map JavaDoc xslParam) throws
56             IOException JavaDoc, TransformerException JavaDoc {
57
58         BeanStorage storage = new BeanStorage();
59         InputStream JavaDoc is = new ByteArrayInputStream JavaDoc( storage.toXmlString(funList).getBytes());
60         Source JavaDoc xml = new StreamSource JavaDoc(is);
61         Source JavaDoc xslt = new StreamSource JavaDoc(new File JavaDoc(xslFile));
62
63         return XMLTransformer.transform(xslt, xml, xslParam);
64
65     }
66
67 }
68
Popular Tags