alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Glassfish example source code file (VirtualServer.java)

This example Glassfish source code file (VirtualServer.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Glassfish tags/keywords

collection, collection, configexception, configexception, context, file, glassfishexception, glassfishexception, id, io, lifecycle, string, string, util, virtualserver, virtualserverconfig

The Glassfish VirtualServer.java source code

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 1997-2011 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.
 */

package org.glassfish.embeddable.web;

import java.io.File;
import java.util.Collection;
import org.glassfish.embeddable.web.config.VirtualServerConfig;
import org.glassfish.embeddable.GlassFishException;

/**
 * Representation of a virtual server.
 *
 * <p>Instances of VirtualServer may be in one of two states:
 * <i>stopped or started. Any requests mapped to a 
 * <tt>VirtualServer that was stopped will result in a response with
 * a status code equal to
 * javax.servlet.http.HttpServletResponse#SC_NOT_FOUND.
 *
 * <p/>See {@link WebContainer} for usage example.
 * 
 * @author Rajiv Mordani
 * @author Jan Luehe
 */
public interface VirtualServer extends Lifecycle {


    /**
     * Sets the id of this <tt>VirtualServer.
     *
     * @param ID id of this <tt>VirtualServer.
     */
    public void setID(String ID);

    /**
     * Gets the id of this <tt>VirtualServer.
     * 
     * @return the id of this <tt>VirtualServer
     */
    public String getID();

    /**
     * Sets the docroot of this <tt>VirtualServer.
     *
     * @param docRoot the docroot of this <tt>VirtualServer.
     */
    public void setDocRoot(File docRoot);

    /**
     * Gets the docroot of this <tt>VirtualServer.
     * 
     * @return the docroot of this <tt>VirtualServer
     */
    public File getDocRoot();

    /**
     * Gets the collection of <tt>WebListener instances from which
     * this <tt>VirtualServer receives requests.
     * 
     * @return the collection of <tt>WebListener instances from which
     * this <tt>VirtualServer receives requests.
     */
    public Collection<WebListener> getWebListeners();

    /**
     * Adds the given <tt>Valve to this VirtualServer
     * 
     * @param valve the <tt>Valve to be added
     */
    //public void addValve(Valve valve);

    /**
     * Registers the given <tt>Context with this VirtualServer
     * at the given context root.
     *
     * <p>If this VirtualServer has already been started, the
     * given <tt>context will be started as well.
     *
     * @param context the <tt>Context to register
     * @param contextRoot the context root at which to register
     *
     * @throws ConfigException if a <tt>Context already exists
     * at the given context root on this <tt>VirtualServer
     * @throws GlassFishException if the given <tt>context fails
     * to be started
     */
    public void addContext(Context context, String contextRoot)
        throws ConfigException, GlassFishException;

    /**
     * Stops the given <tt>context and removes it from this
     * <tt>VirtualServer.
     *
     * @param context the <tt>Context to be stopped and removed
     *
     * @throws GlassFishException if an error occurs during the stopping
     * or removal of the given <tt>context
     */
    public void removeContext(Context context)
            throws GlassFishException;

    /**
     * Finds the <tt>Context registered at the given context root.
     *
     * @param contextRoot the context root whose <tt>Context to get
     *
     * @return the <tt>Context registered at the given context root,
     * or <tt>null if no Context exists at the given context
     * root
     */
    public Context getContext(String contextRoot);

    /**
     * Gets the collection of <tt>Context instances registered with
     * this <tt>VirtualServer.
     * 
     * @return the (possibly empty) collection of <tt>Context
     * instances registered with this <tt>VirtualServer
     */
    public Collection<Context> getContexts();

    /**
     * Reconfigures this <tt>VirtualServer with the given
     * configuration.
     *
     * <p>In order for the given configuration to take effect, this
     * <tt>VirtualServer may be stopped and restarted.
     *
     * @param config the configuration to be applied
     * 
     * @throws ConfigException if the configuration requires a restart,
     * and this <tt>VirtualServer fails to be restarted
     */
    public void setConfig(VirtualServerConfig config)
        throws ConfigException;

    /**
     * Gets the current configuration of this <tt>VirtualServer.
     *
     * @return the current configuration of this <tt>VirtualServer,
     * or <tt>null if no special configuration was ever applied to this
     * <tt>VirtualServer
     */
    public VirtualServerConfig getConfig();
}

Other Glassfish examples (source code examples)

Here is a short list of links related to this Glassfish VirtualServer.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.