org.apache.catalina.Deployer Maven / Gradle / Ivy
Show all versions of payara-embedded-web Show documentation
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina;
import java.io.IOException;
import java.net.URL;
/**
* A Deployer is a specialized Container into which web applications
* can be deployed and undeployed. Such a Container will create and install
* child Context instances for each deployed application. The unique key
* for each web application will be the context path to which it is attached.
*
* @author Craig R. McClanahan
* @version $Revision: 1.2 $ $Date: 2005/12/08 01:27:15 $
*/
/* public interface Deployer extends Container { */
public interface Deployer {
// ----------------------------------------------------- Manifest Constants
/**
* The ContainerEvent event type sent when a new application is
* being installed by install()
, before it has been
* started.
*/
public static final String PRE_INSTALL_EVENT = "pre-install";
/**
* The ContainerEvent event type sent when a new application is
* installed by install()
, after it has been started.
*/
public static final String INSTALL_EVENT = "install";
/**
* The ContainerEvent event type sent when an existing application is
* removed by remove()
.
*/
public static final String REMOVE_EVENT = "remove";
// --------------------------------------------------------- Public Methods
/**
* Return the name of the Container with which this Deployer is associated.
*/
public String getName();
/**
* Install a new web application, whose web application archive is at the
* specified URL, into this container with the specified context path.
* A context path of "" (the empty string) should be used for the root
* application for this container. Otherwise, the context path must
* start with a slash.
*
* If this application is successfully installed, a ContainerEvent of type
* INSTALL_EVENT
will be sent to all registered listeners,
* with the newly created Context
as an argument.
*
* @param contextPath The context path to which this application should
* be installed (must be unique)
* @param war A URL of type "jar:" that points to a WAR file, or type
* "file:" that points to an unpacked directory structure containing
* the web application to be installed
*
* @exception IllegalArgumentException if the specified context path
* is malformed (it must be "" or start with a slash)
* @exception IllegalStateException if the specified context path
* is already attached to an existing web application
* @exception IOException if an input/output error was encountered
* during installation
*/
public void install(String contextPath, URL war) throws IOException;
/**
*
Install a new web application, whose context configuration file
* (consisting of a <Context>
element) and web
* application archive are at the specified URLs.
*
* If this application is successfully installed, a ContainerEvent
* of type INSTALL_EVENT
will be sent to all registered
* listeners, with the newly created Context
as an argument.
*
*
* @param config A URL that points to the context configuration file to
* be used for configuring the new Context
* @param war A URL of type "jar:" that points to a WAR file, or type
* "file:" that points to an unpacked directory structure containing
* the web application to be installed
*
* @exception IllegalArgumentException if one of the specified URLs is
* null
* @exception IllegalStateException if the context path specified in the
* context configuration file is already attached to an existing web
* application
* @exception IOException if an input/output error was encountered
* during installation
*/
public void install(URL config, URL war) throws IOException;
/**
* Return the Context for the deployed application that is associated
* with the specified context path (if any); otherwise return
* null
.
*
* @param contextPath The context path of the requested web application
*/
public Context findDeployedApp(String contextPath);
/**
* Return the context paths of all deployed web applications in this
* Container. If there are no deployed applications, a zero-length
* array is returned.
*/
public String[] findDeployedApps();
/**
* Remove an existing web application, attached to the specified context
* path. If this application is successfully removed, a
* ContainerEvent of type REMOVE_EVENT
will be sent to all
* registered listeners, with the removed Context
as
* an argument.
*
* @param contextPath The context path of the application to be removed
*
* @exception IllegalArgumentException if the specified context path
* is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path does
* not identify a currently installed web application
* @exception IOException if an input/output error occurs during
* removal
*/
public void remove(String contextPath) throws IOException;
/**
* Remove an existing web application, attached to the specified context
* path. If this application is successfully removed, a
* ContainerEvent of type REMOVE_EVENT
will be sent to all
* registered listeners, with the removed Context
as
* an argument. Deletes the web application war file and/or directory
* if they exist in the Host's appBase.
*
* @param contextPath The context path of the application to be removed
* @param undeploy boolean flag to remove web application from server
*
* @exception IllegalArgumentException if the specified context path
* is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path does
* not identify a currently installed web application
* @exception IOException if an input/output error occurs during
* removal
*/
public void remove(String contextPath, boolean undeploy) throws IOException;
/**
* Start an existing web application, attached to the specified context
* path. Only starts a web application if it is not running.
*
* @param contextPath The context path of the application to be started
*
* @exception IllegalArgumentException if the specified context path
* is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path does
* not identify a currently installed web application
* @exception IOException if an input/output error occurs during
* startup
*/
public void start(String contextPath) throws IOException;
/**
* Stop an existing web application, attached to the specified context
* path. Only stops a web application if it is running.
*
* @param contextPath The context path of the application to be stopped
*
* @exception IllegalArgumentException if the specified context path
* is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path does
* not identify a currently installed web application
* @exception IOException if an input/output error occurs while stopping
* the web application
*/
public void stop(String contextPath) throws IOException;
}