public abstract class AbstractLocalContainer extends AbstractContainer implements LocalContainer
Constructor and Description |
---|
AbstractLocalContainer(LocalConfiguration configuration)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
LocalConfiguration |
getConfiguration() |
org.codehaus.cargo.util.FileHandler |
getFileHandler() |
String |
getOutput() |
State |
getState() |
long |
getTimeout() |
boolean |
isAppend() |
void |
setAppend(boolean isAppend)
Sets whether output of the container should be appended to an existing file, or the existing
file should be truncated.
|
void |
setConfiguration(LocalConfiguration configuration) |
void |
setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler) |
void |
setOutput(String output) |
protected void |
setState(State state) |
void |
setTimeout(long timeout) |
void |
start()
Starts the container.
|
protected abstract void |
startInternal()
Installed and Embedded containers do not have the same signature for their
doStart method. |
void |
stop()
Stops the container.
|
protected abstract void |
stopInternal()
Installed and Embedded containers do not have the same signature for their
doStop method. |
protected void |
verify()
Verify required properties have been set before executing any action.
|
protected void |
waitForCompletion(boolean waitForStarting)
Ping the WAR CPC to verify if the container is started or stopped.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCapability, getId, getName, getType
public AbstractLocalContainer(LocalConfiguration configuration)
configuration
- the configuration to associate to this container. It can be changed
later on by calling setConfiguration(LocalConfiguration)
public final void setOutput(String output)
setOutput
in interface RunnableContainer
output
- the file to which the container's output will be logged to. Note that we're
passing a String instead of a File because we want to leave the possibility of using
URIs for specifying the home location.RunnableContainer.setOutput(String)
public final void setAppend(boolean isAppend)
setAppend
in interface RunnableContainer
isAppend
- Whether output should be appended to or notRunnableContainer.setAppend(boolean)
public final String getOutput()
getOutput
in interface RunnableContainer
RunnableContainer.getOutput()
public final boolean isAppend()
isAppend
in interface RunnableContainer
RunnableContainer.isAppend()
protected void verify()
protected abstract void startInternal() throws Exception
doStart
method. Thus we need to abstract it.Exception
- if any error is raised during the container startprotected abstract void stopInternal() throws Exception
doStop
method. Thus we need to abstract it.Exception
- if any error is raised during the container stoppublic final void start()
start
in interface RunnableContainer
RunnableContainer.start()
public final void stop()
stop
in interface RunnableContainer
RunnableContainer.stop()
protected void waitForCompletion(boolean waitForStarting) throws InterruptedException
waitForStarting
- if true then wait for container start, if false wait for container
stopInterruptedException
- if the thread sleep is interruptedpublic void setConfiguration(LocalConfiguration configuration)
setConfiguration
in interface LocalContainer
configuration
- the local configuration implementation to useLocalContainer.setConfiguration(LocalConfiguration)
public LocalConfiguration getConfiguration()
getConfiguration
in interface LocalContainer
LocalContainer.getConfiguration()
public void setTimeout(long timeout)
setTimeout
in interface RunnableContainer
timeout
- the timeout (in ms) after which we consider the container cannot be started
or stopped.RunnableContainer.setTimeout(long)
public long getTimeout()
getTimeout
in interface RunnableContainer
RunnableContainer.getTimeout()
public State getState()
getState
in interface Container
Container.getState()
protected void setState(State state)
state
- the container current statepublic org.codehaus.cargo.util.FileHandler getFileHandler()
getFileHandler
in interface LocalContainer
public void setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler)
setFileHandler
in interface LocalContainer
fileHandler
- the Cargo file utility class to use. This method is useful for unit
testing with Mock objects as it can be passed a test file handler that doesn't perform
any real file action.Copyright © 2004-2013 Codehaus. All Rights Reserved.