Class AbstractCatalinaEmbeddedLocalContainer
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.container.spi.AbstractContainer
-
- org.codehaus.cargo.container.spi.AbstractLocalContainer
-
- org.codehaus.cargo.container.spi.AbstractEmbeddedLocalContainer
-
- org.codehaus.cargo.container.tomcat.internal.AbstractCatalinaEmbeddedLocalContainer
-
- All Implemented Interfaces:
Container
,EmbeddedLocalContainer
,RunnableContainer
,LocalContainer
,Loggable
- Direct Known Subclasses:
Tomcat5xEmbeddedLocalContainer
,Tomcat8xEmbeddedLocalContainer
public abstract class AbstractCatalinaEmbeddedLocalContainer extends AbstractEmbeddedLocalContainer
Base support for Catalina based embedded local containers.
-
-
Field Summary
Fields Modifier and Type Field Description protected TomcatEmbedded.Connector
connector
Tomcat connector object.protected TomcatEmbedded.Embedded
controller
Root of the Tomcat object model.protected TomcatEmbedded.Host
host
Tomcat host object.
-
Constructor Summary
Constructors Constructor Description AbstractCatalinaEmbeddedLocalContainer(LocalConfiguration configuration)
Creates a TomcatEmbeddedLocalContainer
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
doStart()
Implementation ofRunnableContainer.start()
that all containers extending this class must implement.protected void
doStop()
Implementation ofRunnableContainer.stop()
that all containers extending this class must implement.ContainerCapability
getCapability()
TomcatEmbedded.Embedded
getController()
TomcatEmbedded.Host
getHost()
protected abstract void
prepareController(TomcatEmbedded wrapper, File home, int port)
Prepare the Tomcat controller.void
scheduleDeployment(Deployable deployable)
Used byTomcatEmbeddedLocalDeployer
to registerDeployable
s that are to be deployed once the container is started.protected void
waitForCompletion(boolean waitForStarting)
Embedded Tomcat's start method is synchronous, so no need for waiting when starting.-
Methods inherited from class org.codehaus.cargo.container.spi.AbstractEmbeddedLocalContainer
getClassLoader, getType, setClassLoader, startInternal, stopInternal
-
Methods inherited from class org.codehaus.cargo.container.spi.AbstractLocalContainer
executePostStartTasks, forceStopInternal, getConfiguration, getFileHandler, getOutput, getState, getTimeout, isAppend, restart, setAppend, setConfiguration, setFileHandler, setOutput, setState, setTimeout, start, stop, verify, waitForPortShutdown, waitForStarting
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.cargo.container.LocalContainer
getConfiguration, getFileHandler, setConfiguration, setFileHandler
-
Methods inherited from interface org.codehaus.cargo.container.internal.RunnableContainer
getOutput, getTimeout, isAppend, restart, setAppend, setOutput, setTimeout, start, stop
-
-
-
-
Field Detail
-
controller
protected TomcatEmbedded.Embedded controller
Root of the Tomcat object model.
-
host
protected TomcatEmbedded.Host host
Tomcat host object.
-
connector
protected TomcatEmbedded.Connector connector
Tomcat connector object.
-
-
Constructor Detail
-
AbstractCatalinaEmbeddedLocalContainer
public AbstractCatalinaEmbeddedLocalContainer(LocalConfiguration configuration)
Creates a TomcatEmbeddedLocalContainer
.- Parameters:
configuration
- the configuration of the newly created container.
-
-
Method Detail
-
getController
public TomcatEmbedded.Embedded getController()
- Returns:
- the Tomcat controller object. Always non-null.
-
getHost
public TomcatEmbedded.Host getHost()
- Returns:
- the Tomcat host object. Always non-null.
-
doStart
protected void doStart() throws Exception
Implementation ofRunnableContainer.start()
that all containers extending this class must implement.- Specified by:
doStart
in classAbstractEmbeddedLocalContainer
- Throws:
Exception
- if any error is raised during the container start
-
waitForCompletion
protected void waitForCompletion(boolean waitForStarting) throws InterruptedException
Embedded Tomcat's start method is synchronous, so no need for waiting when starting. CallsSystem.gc()
after container has stopped. Ping the WAR CPC to verify if the container is started or stopped.- Overrides:
waitForCompletion
in classAbstractEmbeddedLocalContainer
- Parameters:
waitForStarting
- iftrue
then wait for container start, iffalse
wait for container stop- Throws:
InterruptedException
- if the thread sleep is interrupted
-
doStop
protected void doStop() throws Exception
Implementation ofRunnableContainer.stop()
that all containers extending this class must implement.- Specified by:
doStop
in classAbstractEmbeddedLocalContainer
- Throws:
Exception
- if any error is raised during the container stop
-
getCapability
public ContainerCapability getCapability()
- Returns:
- the
ContainerCapability
of the container in term of ability to deploy such and such type ofDeployable
s (eg WAR, EAR, etc).
-
scheduleDeployment
public void scheduleDeployment(Deployable deployable)
Used byTomcatEmbeddedLocalDeployer
to registerDeployable
s that are to be deployed once the container is started.- Parameters:
deployable
-Deployable
to be deployed later.
-
prepareController
protected abstract void prepareController(TomcatEmbedded wrapper, File home, int port)
Prepare the Tomcat controller. After this method returns, thehost
andconnector
protected attributes must be set.- Parameters:
wrapper
- Tomcat wrapper.home
-CATALINA_BASE
directory.port
- HTTP port.
-
-