Package com.sun.enterprise.web
Class VirtualServerFacade
- java.lang.Object
-
- com.sun.enterprise.web.VirtualServerFacade
-
- All Implemented Interfaces:
VirtualServer
public class VirtualServerFacade extends Object implements VirtualServer
Facade object which masks the internalVirtualServer
object from the web application.- Author:
- Amy Roh
-
-
Constructor Summary
Constructors Constructor Description VirtualServerFacade(String id, File docRoot, WebListener... webListeners)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContext(Context context, String contextRoot)
Registers the given Context with this VirtualServer at the given context root.VirtualServerConfig
getConfig()
Gets the current configuration of this VirtualServer.Context
getContext(String contextRoot)
Finds the Context registered at the given context root.Collection<Context>
getContexts()
Gets the collection of Context instances registered with this VirtualServer.File
getDocRoot()
Gets the docroot of this VirtualServer.String
getID()
Return the virtual server identifier.VirtualServer
getVirtualServer()
Collection<WebListener>
getWebListeners()
Gets the collection of WebListener instances from which this VirtualServer receives requests.void
removeContext(Context context)
Stops the given context and removes it from this VirtualServer.void
setConfig(VirtualServerConfig config)
Reconfigures this VirtualServer with the given configuration.void
setDocRoot(File docRoot)
Sets the docroot of this VirtualServer.void
setID(String id)
Set the virtual server identifier string.void
setVirtualServer(VirtualServer vs)
void
setWebListeners(WebListener... webListeners)
Sets the collection of WebListener instances from which this VirtualServer receives requests.
-
-
-
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 interfaceVirtualServer
- Parameters:
docRoot
- the docroot of this VirtualServer.
-
getDocRoot
public File getDocRoot()
Gets the docroot of this VirtualServer.- Specified by:
getDocRoot
in interfaceVirtualServer
- Returns:
- the docroot of this VirtualServer
-
getID
public String getID()
Return the virtual server identifier.- Specified by:
getID
in interfaceVirtualServer
- Returns:
- the id of this VirtualServer
-
setID
public void setID(String id)
Set the virtual server identifier string.- Specified by:
setID
in interfaceVirtualServer
- 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 interfaceVirtualServer
- 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 interfaceVirtualServer
- Parameters:
context
- the Context to registercontextRoot
- the context root at which to register- Throws:
ConfigException
- if a Context already exists at the given context root on this VirtualServerGlassFishException
- 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 interfaceVirtualServer
- 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 interfaceVirtualServer
- 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 interfaceVirtualServer
- 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 interfaceVirtualServer
- 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 interfaceVirtualServer
- 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)
-
getVirtualServer
public VirtualServer getVirtualServer()
-
-