Class HttpdTomcatSiteManager<T extends TomcatCommon>
java.lang.Object
com.aoindustries.aoserv.daemon.httpd.HttpdSiteManager
com.aoindustries.aoserv.daemon.httpd.tomcat.HttpdTomcatSiteManager<T>
- All Implemented Interfaces:
StopStartable
- Direct Known Subclasses:
HttpdJBossSiteManager
public abstract class HttpdTomcatSiteManager<T extends TomcatCommon>
extends HttpdSiteManager
implements StopStartable
Manages Site configurations.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.aoindustries.aoserv.daemon.httpd.HttpdSiteManager
HttpdSiteManager.JkSetting, HttpdSiteManager.Location, HttpdSiteManager.PermanentRewriteRule, HttpdSiteManager.WebAppSettings -
Field Summary
FieldsFields inherited from class com.aoindustries.aoserv.daemon.httpd.HttpdSiteManager
httpdSite -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidbuildSiteDirectory(PosixFile siteDirectory, String optSlash, Set<Site> sitesNeedingRestarted, Set<SharedTomcat> sharedTomcatsNeedingRestarted, Set<PosixFile> restorecon) Every Tomcat site is built through the same overall set of steps.protected abstract voidbuildSiteDirectoryContents(String optSlash, PosixFile siteDirectory, boolean isUpgrade) Builds the complete directory tree for a new site.protected abstract voidenableDisable(PosixFile siteDirectory) Enables/disables the site by adding/removing symlinks, if appropriate for the type of site.protected abstract voidflagNeedsRestart(Set<Site> sitesNeedingRestarted, Set<SharedTomcat> sharedTomcatsNeedingRestarted) Flags that the site needs restarted.protected abstract byte[]generateReadmeTxt(String optSlash, String apacheTomcatDir, PosixFile installDir) Generates the README.txt that is used to detect major version changes to rebuild the Tomcat installation.protected abstract WorkerGets the Jk worker for the site.static HttpdTomcatSiteManager<? extends TomcatCommon> getInstance(Site tomcatSite) Gets the specific manager for one type of web site.Gets the JkMount and JkUnmounts for this site.abstract PosixFileGets the PID file for the wrapper script.In addition to the standard values, also protects the /WEB-INF/ and /META-INF/ directories of all contexts.protected Set<PackageManager.PackageName> Gets any packages that must be installed for this site.abstract PosixPathGets the path to the start/stop script.abstract User.NameGets the username to run the start/stop script as.abstract FileGets the working directory to run the start/stop script in.abstract TGets all the webapps for this site.protected abstract booleanrebuildConfigFiles(PosixFile siteDirectory, Set<PosixFile> restorecon) Rebuilds any config files that need updated.start()Starts all processes for this website if it is not running.stop()Stops all processes for this website if it is running.protected abstract booleanupgradeSiteDirectoryContents(String optSlash, PosixFile siteDirectory) Upgrades the site directory contents for an auto-upgrade.Methods inherited from class com.aoindustries.aoserv.daemon.httpd.HttpdSiteManager
blockAllTraceAndTrackRequests, configureFtpDirectory, createCgiPhpScript, createTestIndex, enableAnonymousFtp, enableCgi, enablePhp, getApacheUid, getAutoWarningXml, getAutoWarningXmlOld, getInstance, getPermanentRewriteRules, startHttpdSite, stopAndDisableDaemons, stopHttpdSiteMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.aoindustries.aoserv.daemon.httpd.StopStartable
isStartable
-
Field Details
-
tomcatSite
-
-
Constructor Details
-
HttpdTomcatSiteManager
- Throws:
IOExceptionSQLException
-
-
Method Details
-
getInstance
public static HttpdTomcatSiteManager<? extends TomcatCommon> getInstance(Site tomcatSite) throws IOException, SQLException Gets the specific manager for one type of web site.- Throws:
IOExceptionSQLException
-
getTomcatCommon
-
getRejectedLocations
public Map<String,List<HttpdSiteManager.Location>> getRejectedLocations() throws IOException, SQLExceptionIn addition to the standard values, also protects the /WEB-INF/ and /META-INF/ directories of all contexts. This is only done when the "use_apache" flag is on. Otherwise, Tomcat should protect the necessary paths.- Overrides:
getRejectedLocationsin classHttpdSiteManager- Throws:
IOExceptionSQLException
-
getHttpdWorker
Gets the Jk worker for the site.- Throws:
IOExceptionSQLException
-
stop
Description copied from interface:StopStartableStops all processes for this website if it is running.- Specified by:
stopin interfaceStopStartable- Returns:
trueif actually stopped orfalseif was already stopped ornullwhen unknown- Throws:
IOExceptionSQLException
-
start
Description copied from interface:StopStartableStarts all processes for this website if it is not running.- Specified by:
startin interfaceStopStartable- Returns:
trueif actually started orfalseif was already started ornullwhen unknown- Throws:
IOExceptionSQLException
-
getJkSettings
Description copied from class:HttpdSiteManagerGets the JkMount and JkUnmounts for this site.This default implementation returns an empty set.
- Overrides:
getJkSettingsin classHttpdSiteManager- Returns:
- An empty set if no Jk enabled.
- Throws:
IOExceptionSQLException
-
getWebapps
public SortedMap<String,HttpdSiteManager.WebAppSettings> getWebapps() throws IOException, SQLExceptionDescription copied from class:HttpdSiteManagerGets all the webapps for this site. The key is the webapp path and the value is the settings for that path. If any webapp enables CGI, then this site overall must allow CGI.- Specified by:
getWebappsin classHttpdSiteManager- Throws:
IOExceptionSQLException
-
getPidFile
Gets the PID file for the wrapper script. When this file exists the script is assumed to be running. This PID file may be shared between multiple sites in the case of a shared Tomcat. Also, it is possible that the JVM may be disabled while the site overall is not.- Returns:
- the .pid file or
nullif should not be running - Throws:
IOExceptionSQLException
-
getStartStopScriptPath
Gets the path to the start/stop script.- Throws:
IOExceptionSQLException
-
getStartStopScriptUsername
Gets the username to run the start/stop script as.- Throws:
IOExceptionSQLException
-
getStartStopScriptWorkingDirectory
Gets the working directory to run the start/stop script in.- Throws:
IOExceptionSQLException
-
getRequiredPackages
Description copied from class:HttpdSiteManagerGets any packages that must be installed for this site.By default, no specific packages are required.
- Overrides:
getRequiredPackagesin classHttpdSiteManager- Throws:
IOExceptionSQLException
-
buildSiteDirectory
protected final void buildSiteDirectory(PosixFile siteDirectory, String optSlash, Set<Site> sitesNeedingRestarted, Set<SharedTomcat> sharedTomcatsNeedingRestarted, Set<PosixFile> restorecon) throws IOException, SQLException Every Tomcat site is built through the same overall set of steps.- Specified by:
buildSiteDirectoryin classHttpdSiteManager- Throws:
IOExceptionSQLException
-
buildSiteDirectoryContents
protected abstract void buildSiteDirectoryContents(String optSlash, PosixFile siteDirectory, boolean isUpgrade) throws IOException, SQLException Builds the complete directory tree for a new site. This should not include the siteDirectory itself, which has already been created. This should also not include any files that enable/disable the site.This doesn't need to create the cgi-bin, cgi-bin/test, or index.html
- Parameters:
optSlash- Relative path from the CATALINA_HOME to /opt/, including trailing slash, such as../../opt/.- Throws:
IOExceptionSQLException
-
upgradeSiteDirectoryContents
protected abstract boolean upgradeSiteDirectoryContents(String optSlash, PosixFile siteDirectory) throws IOException, SQLException Upgrades the site directory contents for an auto-upgrade.- Parameters:
optSlash- Relative path from the CATALINA_HOME to /opt/, including trailing slash, such as../../opt/.- Returns:
trueif the site needs to be restarted.- Throws:
IOExceptionSQLException
-
rebuildConfigFiles
protected abstract boolean rebuildConfigFiles(PosixFile siteDirectory, Set<PosixFile> restorecon) throws IOException, SQLException Rebuilds any config files that need updated. This should not include any files/symlinks that enable/disable this site.- Returns:
trueif the site needs to be restarted.- Throws:
IOExceptionSQLException
-
enableDisable
Enables/disables the site by adding/removing symlinks, if appropriate for the type of site.- Throws:
IOExceptionSQLException
-
flagNeedsRestart
protected abstract void flagNeedsRestart(Set<Site> sitesNeedingRestarted, Set<SharedTomcat> sharedTomcatsNeedingRestarted) throws SQLException, IOException Flags that the site needs restarted.- Throws:
SQLExceptionIOException
-
generateReadmeTxt
protected abstract byte[] generateReadmeTxt(String optSlash, String apacheTomcatDir, PosixFile installDir) throws IOException, SQLException Generates the README.txt that is used to detect major version changes to rebuild the Tomcat installation.TODO: Generate and use these readme.txt files to detect when version changed
- Returns:
- The README.txt file contents or
nullif no README.txt used for change detection - Throws:
IOExceptionSQLException- See Also:
-
