|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.cargo.util.log.LoggedObject
org.codehaus.cargo.container.spi.AbstractContainer
org.codehaus.cargo.container.spi.AbstractLocalContainer
public abstract class AbstractLocalContainer
Default container implementation that all local container implementations must extend.
Constructor Summary | |
---|---|
AbstractLocalContainer(LocalConfiguration configuration)
Default constructor. |
Method Summary | |
---|---|
LocalConfiguration |
getConfiguration()
|
FileHandler |
getFileHandler()
|
java.lang.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(FileHandler fileHandler)
|
void |
setOutput(java.lang.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. |
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.Container |
---|
getCapability, getId, getName, getType |
Methods inherited from interface org.codehaus.cargo.util.log.Loggable |
---|
getLogger, setLogger |
Constructor Detail |
---|
public AbstractLocalContainer(LocalConfiguration configuration)
configuration
- the configuration to associate to this container. It can be changed
later on by calling setConfiguration(LocalConfiguration)
Method Detail |
---|
public final void setOutput(java.lang.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 java.lang.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 java.lang.Exception
doStart
method. Thus we need to abstract it.
java.lang.Exception
- if any error is raised during the container startprotected abstract void stopInternal() throws java.lang.Exception
doStop
method. Thus we need to abstract it.
java.lang.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 java.lang.InterruptedException
waitForStarting
- if true then wait for container start, if false wait for container
stop
java.lang.InterruptedException
- 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 FileHandler getFileHandler()
getFileHandler
in interface LocalContainer
public void setFileHandler(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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |