/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */
package org.jfox.deployment.web;

import org.jfox.framework.deploy.DeployException;
import org.jfox.framework.deploy.Deployable;
import org.jfox.framework.deploy.Deployer;
import org.jfox.system.AbstractComponent;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class WebDeployer extends AbstractComponent implements Deployer {
    private AbstractWebContainer webContainer;

//  private static WebDeployer instance = new WebDeployer(JettyWebContainer.getInstance());

    public WebDeployer(AbstractWebContainer webContainer) {
        this.webContainer = webContainer;
    }

/*
  public static WebDeployer getInstance(){
    return instance;
  }
*/

    public void deploy(Deployable comp) throws DeployException {
        if(!(comp instanceof WebModule)) {
            throw new DeployException("can not deploy non-WebModule " + comp.getClass().getName());
        }
        webContainer.deploy((WebModule) comp);
    }

    public void undeploy(Deployable comp) throws DeployException {
        webContainer.undeploy(comp);
    }

    protected void doInit() throws Exception {
    }

    protected void doDestroy() throws Exception {
    }

    public static void main(String[] args) {

    }
}

