Package org.codehaus.cargo.container.spi
Class AbstractInstalledLocalContainer
- 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.AbstractInstalledLocalContainer
 
 
 
 
- 
- All Implemented Interfaces:
- Container,- InstalledLocalContainer,- RunnableContainer,- SpawnedContainer,- LocalContainer,- Loggable
 - Direct Known Subclasses:
- AbstractCatalinaInstalledLocalContainer,- AbstractGlassFishInstalledLocalContainer,- AbstractJBossInstalledLocalContainer,- AbstractJonasInstalledLocalContainer,- AbstractJRunInstalledLocalContainer,- AbstractOc4j10xInstalledLocalContainer,- AbstractOrionInstalledLocalContainer,- AbstractResinInstalledLocalContainer,- AbstractWebLogicInstalledLocalContainer,- AbstractWildFlyInstalledLocalContainer,- AbstractWildFlySwarmInstalledLocalContainer,- Geronimo1xInstalledLocalContainer,- JBoss7xInstalledLocalContainer,- Jetty6xInstalledLocalContainer,- Jo1xInstalledLocalContainer,- LibertyInstalledLocalContainer,- WebSphere85xInstalledLocalContainer
 
 public abstract class AbstractInstalledLocalContainer extends AbstractLocalContainer implements InstalledLocalContainer Default container implementation that all local installed container implementations must extend.
- 
- 
Constructor SummaryConstructors Constructor Description AbstractInstalledLocalContainer(LocalConfiguration configuration)Default constructor.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddExtraClasspath(String location)protected voidaddExtraClasspath(JvmLauncher java)Add extra container classpath entries specified by the user.protected voidaddMemoryArguments(JvmLauncher java)Adds the JVM memory arguments.protected voidaddRuntimeArgs(JvmLauncher java)Add command line arguments to the java command.voidaddSharedClasspath(String location)protected voidaddToolsJarToClasspath(JvmLauncher java)Adds the tools.jar to the classpath, except for Mac OSX and Java 9 or above - As these JVMs do not need the tools.jar.protected JvmLaunchercreateJvmLauncher(boolean server)Creates a preinitialized instance of a JVM launcher to be used for starting, stopping and controlling the container.protected abstract voiddoStart(JvmLauncher java)Implementation ofRunnableContainer.start()that all containers extending this class must implement.protected abstract voiddoStop(JvmLauncher java)Implementation ofRunnableContainer.stop()that all containers extending this class must implement.protected voidforceStopInternal()Some containers may not fully stop and need to be forcibly stopped.String[]getExtraClasspath()StringgetHome()protected HttpUtilsgetHttpUtils()protected StringgetJavaHome()Gets the Java home directory to use for this container.JvmLauncherFactorygetJvmLauncherFactory()Gets the factory used to spawn the container JVM.protected ResourceUtilsgetResourceUtils()String[]getSharedClasspath()Map<String,String>getSystemProperties()ContainerTypegetType()voidifPresentAddPathToList(String location, List<String> list)adds the location to the list, if the file exists.voidsetExtraClasspath(String[] classpath)voidsetHome(String home)voidsetJvmLauncherFactory(JvmLauncherFactory jvmLauncherFactory)Sets the factory used to spawn the container JVM.voidsetJvmToLaunchContainerIn(JvmLauncher java)Determines which java virtual machine will run the container.voidsetLogger(Logger logger)Overriden in order to set the logger on ancillary components.voidsetSharedClasspath(String[] classpath)voidsetSystemProperties(Map<String,String> properties)protected voidstartInternal()Installed and Embedded containers do not have the same signature for theirdoStartmethod.protected voidstopInternal()Installed and Embedded containers do not have the same signature for theirdoStopmethod.protected voidverify()Verify required properties have been set before executing any action.- 
Methods inherited from class org.codehaus.cargo.container.spi.AbstractLocalContainerexecutePostStartTasks, getConfiguration, getFileHandler, getOutput, getState, getTimeout, isAppend, restart, setAppend, setConfiguration, setFileHandler, setOutput, setState, setTimeout, start, stop, waitForCompletion, waitForPortShutdown, waitForStarting
 - 
Methods inherited from class org.codehaus.cargo.util.log.LoggedObjectgetLogger
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.codehaus.cargo.container.ContainergetCapability, getId, getName, getState
 - 
Methods inherited from interface org.codehaus.cargo.container.LocalContainergetConfiguration, getFileHandler, setConfiguration, setFileHandler
 - 
Methods inherited from interface org.codehaus.cargo.container.internal.RunnableContainergetOutput, getTimeout, isAppend, restart, setAppend, setOutput, setTimeout, start, stop
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractInstalledLocalContainerpublic AbstractInstalledLocalContainer(LocalConfiguration configuration) Default constructor.- Parameters:
- configuration- the configuration to associate to this container. It can be changed later on by calling- AbstractLocalContainer.setConfiguration(LocalConfiguration)
 
 
- 
 - 
Method Detail- 
setLoggerpublic void setLogger(Logger logger) Overriden in order to set the logger on ancillary components.- Specified by:
- setLoggerin interface- Loggable
- Overrides:
- setLoggerin class- LoggedObject
- Parameters:
- logger- the logger to set and set in the ancillary objects
 
 - 
getHttpUtilsprotected final HttpUtils getHttpUtils() - Returns:
- the HTTP utility class
 
 - 
getResourceUtilsprotected final ResourceUtils getResourceUtils() - Returns:
- the Resource utility class
 
 - 
setHomepublic void setHome(String home) - Specified by:
- setHomein interface- InstalledLocalContainer
- Parameters:
- home- the directory where the container is installed. 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. IMPORTANT: While some containers can deal with this parameter being set as a relative path, some others require this path to be set to an absolute directory. Please refer to the documentation of the server to ensure you give the path in the appropriate way. If in doubt, you can use absolute paths -that is known to work with all containers.
 
 - 
setSystemPropertiespublic void setSystemProperties(Map<String,String> properties) - Specified by:
- setSystemPropertiesin interface- SpawnedContainer
- Parameters:
- properties- the System properties to set in the container executing VM.
 
 - 
getSystemPropertiespublic Map<String,String> getSystemProperties() - Specified by:
- getSystemPropertiesin interface- SpawnedContainer
- Returns:
- the System properties to set in the container executing VM.
 
 - 
setExtraClasspathpublic void setExtraClasspath(String[] classpath) - Specified by:
- setExtraClasspathin interface- SpawnedContainer
- Parameters:
- classpath- the extra classpath that is added to the container's classpath when it is started.
 
 - 
getExtraClasspathpublic String[] getExtraClasspath() - Specified by:
- getExtraClasspathin interface- SpawnedContainer
- Returns:
- the extra classpath that is added to the container's classpath when it is started.
 
 - 
setSharedClasspathpublic void setSharedClasspath(String[] classpath) - Specified by:
- setSharedClasspathin interface- SpawnedContainer
- Parameters:
- classpath- the shared classpath that is shared by the container applications.
 
 - 
getSharedClasspathpublic String[] getSharedClasspath() - Specified by:
- getSharedClasspathin interface- SpawnedContainer
- Returns:
- the extra classpath that is shared by the container applications.
 
 - 
getHomepublic String getHome() - Specified by:
- getHomein interface- InstalledLocalContainer
- Returns:
- the directory where the container is installed. Note that we're returning a String instead of a File because we want to leave the possibility of using URIs for specifying the home location.
 
 - 
getJvmLauncherFactorypublic JvmLauncherFactory getJvmLauncherFactory() Gets the factory used to spawn the container JVM.- Specified by:
- getJvmLauncherFactoryin interface- SpawnedContainer
- Returns:
- The factory used to spawn the container JVM, never null.
 
 - 
setJvmLauncherFactorypublic void setJvmLauncherFactory(JvmLauncherFactory jvmLauncherFactory) Sets the factory used to spawn the container JVM.- Specified by:
- setJvmLauncherFactoryin interface- SpawnedContainer
- Parameters:
- jvmLauncherFactory- The factory used to spawn the container JVM, must not be- null.
 
 - 
doStartprotected abstract void doStart(JvmLauncher java) throws Exception Implementation ofRunnableContainer.start()that all containers extending this class must implement.- Parameters:
- java- the predefined JVM launcher to use to start the container
- Throws:
- Exception- if any error is raised during the container start
 
 - 
doStopprotected abstract void doStop(JvmLauncher java) throws Exception Implementation ofRunnableContainer.stop()that all containers extending this class must implement.- Parameters:
- java- the predefined JVM launcher to use to stop the container
- Throws:
- Exception- if any error is raised during the container stop
 
 - 
startInternalprotected void startInternal() throws ExceptionInstalled and Embedded containers do not have the same signature for theirdoStartmethod. Thus we need to abstract it.- Specified by:
- startInternalin class- AbstractLocalContainer
- Throws:
- Exception- if any error is raised during the container start
 
 - 
stopInternalprotected void stopInternal() throws ExceptionInstalled and Embedded containers do not have the same signature for theirdoStopmethod. Thus we need to abstract it.- Specified by:
- stopInternalin class- AbstractLocalContainer
- Throws:
- Exception- if any error is raised during the container stop
 
 - 
forceStopInternalprotected final void forceStopInternal() Some containers may not fully stop and need to be forcibly stopped. This method should be overridden for containers that support forcibly stopping the container.- Overrides:
- forceStopInternalin class- AbstractLocalContainer
 
 - 
createJvmLauncherprotected JvmLauncher createJvmLauncher(boolean server) Creates a preinitialized instance of a JVM launcher to be used for starting, stopping and controlling the container.- Parameters:
- server-- trueto launch a server process,- falseto launch a client/utility process.
- Returns:
- The created JVM launcher, never null.
 
 - 
getJavaHomeprotected String getJavaHome() Gets the Java home directory to use for this container.- Returns:
- The Java home directory to use, never null.
 
 - 
setJvmToLaunchContainerInpublic void setJvmToLaunchContainerIn(JvmLauncher java) Determines which java virtual machine will run the container.- Parameters:
- java- the java command that will start the container
 
 - 
addToolsJarToClasspathprotected final void addToolsJarToClasspath(JvmLauncher java) throws FileNotFoundException Adds the tools.jar to the classpath, except for Mac OSX and Java 9 or above - As these JVMs do not need the tools.jar.- Parameters:
- java- the JVM launcher to which to add the tools.jar
- Throws:
- FileNotFoundException- in case the tools.jar file cannot be found
 
 - 
addExtraClasspathprotected void addExtraClasspath(JvmLauncher java) Add extra container classpath entries specified by the user.- Parameters:
- java- the java command used to start/stop the container
 
 - 
addRuntimeArgsprotected void addRuntimeArgs(JvmLauncher java) Add command line arguments to the java command.- Parameters:
- java- The java command
 
 - 
addMemoryArgumentsprotected void addMemoryArguments(JvmLauncher java) Adds the JVM memory arguments.- Parameters:
- java- the predefined JVM launcher on which to add memory-related arguments
 
 - 
verifyprotected void verify() Verify required properties have been set before executing any action.- Overrides:
- verifyin class- AbstractLocalContainer
 
 - 
getTypepublic ContainerType getType() 
 - 
addExtraClasspathpublic void addExtraClasspath(String location) - Specified by:
- addExtraClasspathin interface- SpawnedContainer
- Parameters:
- location- the extra classpath that is added to the container's classpath when it is started.
 
 - 
addSharedClasspathpublic void addSharedClasspath(String location) - Specified by:
- addSharedClasspathin interface- SpawnedContainer
- Parameters:
- location- the shared classpath that is added to the container's classpath when it is started.
 
 
- 
 
-