/**
 *
 *
 * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
 *
 * @version $Id: Transformation.java,v 1.1 2003/02/11 00:56:36 jvanzyl Exp $
 */
package org.apache.maven.release;

import org.dom4j.Node;

public class Transformation
{
    /** Pom Transformer associated with this transformation. */
    private PomTransformer pomTransformer;

    /** Node to transform. */
    private Node node;

    public Transformation( PomTransformer pomTransformer )
    {
        this.pomTransformer = pomTransformer;
    }

    // ----------------------------------------------------------------------
    // Accessors
    // ----------------------------------------------------------------------

    /**
     *
     * @return
     */
    public Node getNode()
    {
        return node;
    }

    /**
     *
     * @param node
     */
    public void setNode( Node node )
    {
        this.node = node;
    }

    /**
     *
     * @throws Exception
     */
    public void transform()
        throws Exception
    {
        pomTransformer.transformNode( node );
    }

    /**
     *
     * @return
     * @throws Exception
     */
    public String getBeforeTransformation()
        throws Exception
    {
        return getNode().asXML();
    }

    /**
     *
     * @return
     * @throws Exception
     */
    public String getAfterTransformation()
        throws Exception
    {
        return pomTransformer.getTransformedNode( getNode() ).asXML();
    }
}
