/** * Constructs a new {@link LocallyInstalledTomcatServer} instance. * * @param installPathBase the {@link Path} for the directory to install to (the actual * installation will land in a subdirectory) */ public LocallyInstalledTomcatServer(Path installPathBase) { this.installPath = install(installPathBase); Tomcat7xStandaloneLocalConfiguration configuration = (Tomcat7xStandaloneLocalConfiguration) new DefaultConfigurationFactory() .createConfiguration( "tomcat7x", ContainerType.INSTALLED, ConfigurationType.STANDALONE); configuration.setProperty(ServletPropertySet.PORT, "" + selectAvailablePort()); Tomcat7xInstalledLocalContainer container = (Tomcat7xInstalledLocalContainer) new DefaultContainerFactory() .createContainer("tomcat7x", ContainerType.INSTALLED, configuration); container.setHome(installPath.toAbsolutePath().toString()); this.container = container; }
/** @see com.justdavis.karl.tomcat.ITomcatServer#release() */ @Override public void release() { container.stop(); }
/** @see com.justdavis.karl.tomcat.ITomcatServer#start() */ @Override public ITomcatServer start() { container.start(); return this; }