Class VirtualServerFacade

  • All Implemented Interfaces:
    VirtualServer

    public class VirtualServerFacade
    extends Object
    implements VirtualServer
    Facade object which masks the internal VirtualServer object from the web application.
    Author:
    Amy Roh
    • Constructor Detail

      • VirtualServerFacade

        public VirtualServerFacade​(String id,
                                   File docRoot,
                                   WebListener... webListeners)
    • Method Detail

      • setDocRoot

        public void setDocRoot​(File docRoot)
        Sets the docroot of this VirtualServer.
        Specified by:
        setDocRoot in interface VirtualServer
        Parameters:
        docRoot - the docroot of this VirtualServer.
      • getDocRoot

        public File getDocRoot()
        Gets the docroot of this VirtualServer.
        Specified by:
        getDocRoot in interface VirtualServer
        Returns:
        the docroot of this VirtualServer
      • getID

        public String getID()
        Return the virtual server identifier.
        Specified by:
        getID in interface VirtualServer
        Returns:
        the id of this VirtualServer
      • setID

        public void setID​(String id)
        Set the virtual server identifier string.
        Specified by:
        setID in interface VirtualServer
        Parameters:
        id - New identifier for this virtual server
      • setWebListeners

        public void setWebListeners​(WebListener... webListeners)
        Sets the collection of WebListener instances from which this VirtualServer receives requests.
        Parameters:
        webListeners - the collection of WebListener instances from which this VirtualServer receives requests.
      • getWebListeners

        public Collection<WebListener> getWebListeners()
        Gets the collection of WebListener instances from which this VirtualServer receives requests.
        Specified by:
        getWebListeners in interface VirtualServer
        Returns:
        the collection of WebListener instances from which this VirtualServer receives requests.
      • addContext

        public void addContext​(Context context,
                               String contextRoot)
                        throws ConfigException,
                               GlassFishException
        Registers the given Context with this VirtualServer at the given context root.

        If this VirtualServer has already been started, the given context will be started as well.

        Specified by:
        addContext in interface VirtualServer
        Parameters:
        context - the Context to register
        contextRoot - the context root at which to register
        Throws:
        ConfigException - if a Context already exists at the given context root on this VirtualServer
        GlassFishException - if the given context fails to be started
      • removeContext

        public void removeContext​(Context context)
                           throws GlassFishException
        Stops the given context and removes it from this VirtualServer.
        Specified by:
        removeContext in interface VirtualServer
        Parameters:
        context - the Context to be stopped and removed
        Throws:
        GlassFishException - if an error occurs during the stopping or removal of the given context
      • getContext

        public Context getContext​(String contextRoot)
        Finds the Context registered at the given context root.
        Specified by:
        getContext in interface VirtualServer
        Parameters:
        contextRoot - the context root whose Context to get
        Returns:
        the Context registered at the given context root, or null if no Context exists at the given context root
      • getContexts

        public Collection<Context> getContexts()
        Gets the collection of Context instances registered with this VirtualServer.
        Specified by:
        getContexts in interface VirtualServer
        Returns:
        the (possibly empty) collection of Context instances registered with this VirtualServer
      • setConfig

        public void setConfig​(VirtualServerConfig config)
                       throws ConfigException
        Reconfigures this VirtualServer with the given configuration.

        In order for the given configuration to take effect, this VirtualServer may be stopped and restarted.

        Specified by:
        setConfig in interface VirtualServer
        Parameters:
        config - the configuration to be applied
        Throws:
        ConfigException - if the configuration requires a restart, and this VirtualServer fails to be restarted
      • getConfig

        public VirtualServerConfig getConfig()
        Gets the current configuration of this VirtualServer.
        Specified by:
        getConfig in interface VirtualServer
        Returns:
        the current configuration of this VirtualServer, or null if no special configuration was ever applied to this VirtualServer
      • setVirtualServer

        public void setVirtualServer​(VirtualServer vs)