/*
 (C) 2004 Ibermatica S.A.

 This file is part of IberAgents.

 IberAgents is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 IberAgents 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 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with IberAgents; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package com.ibertest;

import com.iberagents.Configurable;
import com.iberagents.config.Configuration;
import com.iberagents.web.RequestParameters;
import com.iberagents.web.ResponsePage;
import com.iberagents.web.WebComponent;
import com.iberagents.web.page.TransformationPage;
import com.iberxml.Element;

/**
 * TestApp component. Does nothing but store a configuration and show a sample
 * web page.
 * @author Alex Fernandez.
 */
public class TestAppComponent implements Configurable, WebComponent
{
    private TestAppConfiguration configuration;

    /**
     * Store the configuration locally.
     */
    public void configure(Configuration newConfig)
    {
        this.configuration = (TestAppConfiguration) newConfig;
    }

    /**
     * Run a command.
     */
    public void command(String arg0, RequestParameters arg1)
    {
    }

    /**
     * Show a web page.
     */
    public ResponsePage show(String arg0, RequestParameters arg1)
    {
        Element element = new Element("platform", this.configuration
                .getStringValue());
        return new TransformationPage(element, "testPage.xsl");
    }

}