public abstract class AbstractLocalContainer extends AbstractContainer implements LocalContainer
| Constructor and Description |
|---|
AbstractLocalContainer(LocalConfiguration configuration)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
executePostStartTasks()
Some containers may require some extra steps after startup.
|
protected void |
forceStopInternal()
Some containers may not fully stop and need to be forcibly stopped.
|
LocalConfiguration |
getConfiguration() |
FileHandler |
getFileHandler() |
String |
getOutput() |
State |
getState() |
long |
getTimeout() |
boolean |
isAppend() |
void |
restart()
Restarts the container.
|
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(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.
|
getLogger, setLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCapability, getId, getName, getTypepublic AbstractLocalContainer(LocalConfiguration configuration)
configuration - the configuration to associate to this container. It can be changed
later on by calling setConfiguration(LocalConfiguration)public void setOutput(String output)
setOutput in interface RunnableContaineroutput - 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 void setAppend(boolean isAppend)
setAppend in interface RunnableContainerisAppend - Whether output should be appended to or notRunnableContainer.setAppend(boolean)public String getOutput()
getOutput in interface RunnableContainerRunnableContainer.getOutput()public boolean isAppend()
isAppend in interface RunnableContainerRunnableContainer.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 stopprotected void forceStopInternal()
protected void executePostStartTasks()
throws Exception
Exception - if any error is raised during these executionspublic final void start()
start in interface RunnableContainerRunnableContainer.start()public final void stop()
stop in interface RunnableContainerRunnableContainer.stop()public void restart()
restart in interface RunnableContainerRunnableContainer.restart()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 LocalContainerconfiguration - the local configuration implementation to useLocalContainer.setConfiguration(LocalConfiguration)public LocalConfiguration getConfiguration()
getConfiguration in interface LocalContainerLocalContainer.getConfiguration()public void setTimeout(long timeout)
setTimeout in interface RunnableContainertimeout - the timeout (in ms) after which we consider the container cannot be started or
stopped.RunnableContainer.setTimeout(long)public long getTimeout()
getTimeout in interface RunnableContainerRunnableContainer.getTimeout()public State getState()
getState in interface ContainerContainer.getState()protected void setState(State state)
state - the container current statepublic FileHandler getFileHandler()
getFileHandler in interface LocalContainerpublic void setFileHandler(FileHandler fileHandler)
setFileHandler in interface LocalContainerfileHandler - 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.