/*
    PCS - A Framework For Java Web Applications
    Copyright (C) 2002 Patrick Carl, patrick.carl@web.de
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.
 
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
    $Id: JTidyThread.java,v 1.1.1.1 2002/12/27 23:49:49 pcs_org Exp $
 
 */

package de.spieleck.pcs.view;

import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;

/**
 * This class is used by View to transform XML via XSLT in an own Thread
 * @author  Patrick Carl
 */
public class XslTransformThread extends Thread {
    
    private Transformer trans;
    private StreamSource src;
    private StreamResult res;
    
    /** Creates a new instance of XslTransformThread */
    public XslTransformThread(Transformer trans, StreamSource src, StreamResult res) {
        this.trans = trans;
        this.src = src;
        this.res = res;
        System.out.println(this + ": constructed");
    }
    
    public void run(){
        try{
            System.out.println(this + ":run start");
            trans.transform(src, res);
            /*
            res.getOutputStream().flush();
            res.getOutputStream().close();
        */
            System.out.println(this + ":run end");
        } catch(Exception e){
            e.printStackTrace();
        }
    }
    
    
}