- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<Site>
-
- com.aoindustries.aoserv.client.web.Site
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,Disablable,Removable,SingleTableObject<Integer,Site>
public final class Site extends CachedObjectIntegerKey<Site> implements Disablable, Removable
AnHttpdSiteis one unique set of web content and resides in its own directory under/www. EachHttpdSitehas a unique name per server, and may be served simultaneously on any number ofHttpdBinds through any number ofHttpdServers.An
HttpdSiteonly stores the information that is common to all site types. The site will always reference one, and only one, other type of entry, indicating the type of site and providing the rest of the information about the site.- Author:
- AO Industries, Inc.
- See Also:
VirtualHost,HttpdBind,HttpdServer,StaticSite,Site
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOLUMN_AO_SERVER_namestatic StringCOLUMN_NAME_namestatic StringDISABLEDThe site name used when an account is disabled.static intMAX_NAME_LENGTH-
Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description Site()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddHttpdSiteAuthenticatedLocation(String path, boolean isRegularExpression, String authName, PosixPath authGroupFile, PosixPath authUserFile, String require, String handler)booleancanDisable()booleancanEnable()voiddisable(DisableLog dl)voidenable()intgetAoServer_server_pkey()voidgetAWStatsFile(String path, String queryString, OutputStream out)StringgetAwstatsSkipFiles()booleangetBlockCoreDumps()Addedhttpd_sites.block_core_dumpscolumn, which enables blocking of core dumps.booleangetBlockEditorBackups()Enables blocking filename patterns associated with editor automatic backups.booleangetBlockScm()Enables the blocking of URL patterns associated with source control management systems.booleangetBlockTraceTrack()Enables the blocking of TRACE and TRACK HTTP methods.List<CannotRemoveReason<?>>getCannotRemoveReasons()Lists the reasons an object may not be removed.protected ObjectgetColumnImpl(int i)DisableLoggetDisableLog()IntegergetDisableLog_pkey()booleangetEnableAnonymousFtp()booleangetEnableCgi()booleangetEnableFollowSymlinks()booleangetEnableHtaccess()booleangetEnableIndexes()booleangetEnableSsi()List<Location>getHttpdSiteAuthenticatedLocations()List<VirtualHost>getHttpdSiteBinds()List<VirtualHost>getHttpdSiteBinds(HttpdServer server)StaticSitegetHttpdStaticSite()SitegetHttpdTomcatSite()intgetId()PosixPathgetInstallDirectory()Gets the directory where this site is installed.User.NamegetLinuxAccount_username()Group.NamegetLinuxGroup_name()ServergetLinuxServer()UserServergetLinuxServerAccount()GroupServergetLinuxServerGroup()booleangetListFirst()StringgetName()PackagegetPackage()Account.NamegetPackage_name()SoftwareVersiongetPhpVersion()IntegergetPhpVersion_pkey()VirtualHostNamegetPrimaryHttpdSiteURL()EmailgetServerAdmin()Table.TableIDgetTableID()voidinit(ResultSet result)Initializes this object from the raw database contents.booleanisDisabled()Checks if this object is disabled.booleanisManual()static booleanisValidSiteName(String name)Checks the format of the name of the site, as used in the/wwwdirectory.voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidremove()Removes this object, and all dependant objects, from the system.voidsetBlockCoreDumps(boolean blockCoreDumps)voidsetBlockEditorBackups(boolean blockEditorBackups)voidsetBlockScm(boolean blockScm)voidsetBlockTraceTrack(boolean blockTraceTrack)voidsetEnableAnonymousFtp(boolean enableAnonymousFtp)voidsetEnableCgi(boolean enableCgi)voidsetEnableFollowSymlinks(boolean enableFollowSymlinks)voidsetEnableHtaccess(boolean enableHtaccess)voidsetEnableIndexes(boolean enableIndexes)voidsetEnableSsi(boolean enableSsi)voidsetIsManual(boolean isManual)voidsetPhpVersion(SoftwareVersion phpVersion)voidsetServerAdmin(Email address)StringtoStringImpl()AOServObject.toString()implementation that is allowed to throw exceptions.voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
COLUMN_NAME_name
public static final String COLUMN_NAME_name
- See Also:
- Constant Field Values
-
COLUMN_AO_SERVER_name
public static final String COLUMN_AO_SERVER_name
- See Also:
- Constant Field Values
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTH
- See Also:
- Constant Field Values
-
DISABLED
public static final String DISABLED
The site name used when an account is disabled.- See Also:
- Constant Field Values
-
-
Method Detail
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,Site>
-
getId
public int getId()
-
getAoServer_server_pkey
public int getAoServer_server_pkey()
-
getLinuxServer
public Server getLinuxServer() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getName
public String getName()
-
getListFirst
public boolean getListFirst()
-
getPackage_name
public Account.Name getPackage_name()
-
getPackage
public Package getPackage() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getLinuxAccount_username
public User.Name getLinuxAccount_username()
-
getLinuxServerAccount
public UserServer getLinuxServerAccount() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getLinuxGroup_name
public Group.Name getLinuxGroup_name()
-
getLinuxServerGroup
public GroupServer getLinuxServerGroup() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getServerAdmin
public Email getServerAdmin()
-
getDisableLog_pkey
public Integer getDisableLog_pkey()
-
getDisableLog
public DisableLog getDisableLog() throws SQLException, IOException
- Specified by:
getDisableLogin interfaceDisablable- Throws:
SQLExceptionIOException
-
isManual
public boolean isManual()
-
getAwstatsSkipFiles
public String getAwstatsSkipFiles()
-
getPhpVersion_pkey
public Integer getPhpVersion_pkey()
-
getPhpVersion
public SoftwareVersion getPhpVersion() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEnableCgi
public boolean getEnableCgi()
-
getEnableSsi
public boolean getEnableSsi()
-
getEnableHtaccess
public boolean getEnableHtaccess()
-
getEnableIndexes
public boolean getEnableIndexes()
-
getEnableFollowSymlinks
public boolean getEnableFollowSymlinks()
-
getEnableAnonymousFtp
public boolean getEnableAnonymousFtp()
-
getBlockTraceTrack
public boolean getBlockTraceTrack()
Enables the blocking of TRACE and TRACK HTTP methods.
-
getBlockScm
public boolean getBlockScm()
Enables the blocking of URL patterns associated with source control management systems. It is possible for SCM files, such asCVS/Rootand.git/configto have authentication credentials. Leave this enabled when pulling web root content directly from revision control systems. Currently has protections for CVS, Subversion, and Git.
-
getBlockCoreDumps
public boolean getBlockCoreDumps()
Addedhttpd_sites.block_core_dumpscolumn, which enables blocking of core dumps. Core dumps could potentially expose sensitive information and have predictable filename patterns.
-
getBlockEditorBackups
public boolean getBlockEditorBackups()
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,Site>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,Site>- Throws:
IOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,Site>- Throws:
IOException
-
addHttpdSiteAuthenticatedLocation
public int addHttpdSiteAuthenticatedLocation(String path, boolean isRegularExpression, String authName, PosixPath authGroupFile, PosixPath authUserFile, String require, String handler) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
canDisable
public boolean canDisable() throws IOException, SQLException- Specified by:
canDisablein interfaceDisablable- Throws:
IOExceptionSQLException
-
canEnable
public boolean canEnable() throws SQLException, IOException- Specified by:
canEnablein interfaceDisablable- Throws:
SQLExceptionIOException
-
getCannotRemoveReasons
public List<CannotRemoveReason<?>> getCannotRemoveReasons()
Description copied from interface:RemovableLists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasonsin interfaceRemovable- Returns:
- an empty
List<CannotRemoveReason>if this object may be removed, or a list of descriptions
-
disable
public void disable(DisableLog dl) throws IOException, SQLException
- Specified by:
disablein interfaceDisablable- Throws:
IOExceptionSQLException
-
enable
public void enable() throws IOException, SQLException- Specified by:
enablein interfaceDisablable- Throws:
IOExceptionSQLException
-
getInstallDirectory
public PosixPath getInstallDirectory() throws SQLException, IOException
Gets the directory where this site is installed.- Throws:
SQLExceptionIOException
-
isDisabled
public boolean isDisabled()
Description copied from interface:DisablableChecks if this object is disabled. This should execute very quickly (not incur any round-trip to any database) and thus does not throw any checked exceptions.- Specified by:
isDisabledin interfaceDisablable
-
getHttpdSiteAuthenticatedLocations
public List<Location> getHttpdSiteAuthenticatedLocations() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdSiteBinds
public List<VirtualHost> getHttpdSiteBinds() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdSiteBinds
public List<VirtualHost> getHttpdSiteBinds(HttpdServer server) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getHttpdStaticSite
public StaticSite getHttpdStaticSite() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdTomcatSite
public Site getHttpdTomcatSite() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPrimaryHttpdSiteURL
public VirtualHostName getPrimaryHttpdSiteURL() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,Site>
-
isValidSiteName
public static boolean isValidSiteName(String name)
Checks the format of the name of the site, as used in the/wwwdirectory. The site name must be 255 characters or less, and comprised of onlya-z,0-9,.or-. The first character must bea-zor0-9.Note: This matches the check constraint on the httpd_sites table. Note: This matches keepWwwDirs in HttpdSiteManager.
TODO: Self-validating type for site names (Build on PosixPortableFilename, once it exists?)
-
remove
public void remove() throws IOException, SQLExceptionDescription copied from interface:RemovableRemoves this object, and all dependant objects, from the system.- Specified by:
removein interfaceRemovable- Throws:
IOExceptionSQLException
-
setIsManual
public void setIsManual(boolean isManual) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setServerAdmin
public void setServerAdmin(Email address) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setPhpVersion
public void setPhpVersion(SoftwareVersion phpVersion) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
setEnableCgi
public void setEnableCgi(boolean enableCgi) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setEnableSsi
public void setEnableSsi(boolean enableSsi) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setEnableHtaccess
public void setEnableHtaccess(boolean enableHtaccess) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setEnableIndexes
public void setEnableIndexes(boolean enableIndexes) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setEnableFollowSymlinks
public void setEnableFollowSymlinks(boolean enableFollowSymlinks) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setEnableAnonymousFtp
public void setEnableAnonymousFtp(boolean enableAnonymousFtp) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setBlockTraceTrack
public void setBlockTraceTrack(boolean blockTraceTrack) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setBlockScm
public void setBlockScm(boolean blockScm) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setBlockCoreDumps
public void setBlockCoreDumps(boolean blockCoreDumps) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setBlockEditorBackups
public void setBlockEditorBackups(boolean blockEditorBackups) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
toStringImpl
public String toStringImpl() throws SQLException, IOException
Description copied from class:AOServObjectAOServObject.toString()implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callsAOServObject.toString()on the key (fromAOServObject.getKey()). When the key isnull, uses the default implementation fromObject.toString().- Overrides:
toStringImplin classCachedObjectIntegerKey<Site>- Throws:
SQLExceptionIOException
-
getAWStatsFile
public void getAWStatsFile(String path, String queryString, OutputStream out) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
-