org.liquidsite.core.content
Class ContentSite

java.lang.Object
  extended byorg.liquidsite.core.content.PersistentObject
      extended byorg.liquidsite.core.content.Content
          extended byorg.liquidsite.core.content.ContentSite

public class ContentSite
extends Content

A web site.


Field Summary
 
Fields inherited from class org.liquidsite.core.content.Content
DOCUMENT_CATEGORY, FILE_CATEGORY, FOLDER_CATEGORY, FORUM_CATEGORY, NAME_CHARS, PAGE_CATEGORY, POST_CATEGORY, SECTION_CATEGORY, SITE_CATEGORY, TEMPLATE_CATEGORY, TOPIC_CATEGORY, TRANSLATOR_CATEGORY
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
protected ContentSite(ContentManager manager, ContentData data, DataSource src)
          Creates a new site.
  ContentSite(ContentManager manager, Domain domain)
          Creates a new site with default values.
 
Method Summary
protected  void doValidate()
          Validates the object data before writing to the database.
protected static ContentSite[] findByDomain(ContentManager manager, Domain domain)
          Returns an array of content site in the specified domain.
 java.lang.String getDirectory()
          Returns the base directory.
 java.lang.String getHost()
          Returns the host name or IP address.
 int getPort()
          Returns the port number.
 java.lang.String getProtocol()
          Returns the site protocol
 boolean isAdmin()
          Checks if the admin flag is set.
 int match(java.lang.String protocol, java.lang.String host, int port, java.lang.String path)
          Matches a set of request parameters to this site.
 void setAdmin(boolean admin)
          Sets the admin flag.
 void setDirectory(java.lang.String directory)
          Sets the base directory.
 void setHost(java.lang.String host)
          Sets the host name or IP address.
 void setPort(int port)
          Sets the port number.
 void setProtocol(java.lang.String protocol)
          Sets the site protocol.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class org.liquidsite.core.content.Content
deleteRevision, doDelete, doInsert, doUpdate, equals, equals, getAllRevisions, getAttribute, getAttributeNames, getAuthor, getAuthorName, getCategory, getComment, getDomain, getDomainName, getId, getLock, getMaxRevisionNumber, getModifiedDate, getName, getOfflineDate, getOnlineDate, getParent, getParentId, getPermissions, getRevision, getRevisionNumber, isLatestRevision, isOnline, isPublishedRevision, setAttribute, setAuthorName, setComment, setId, setModifiedDate, setName, setOfflineDate, setOnlineDate, setParent, setParentId, setRevisionNumber
 
Methods inherited from class org.liquidsite.core.content.PersistentObject
decodeMap, delete, delete, encodeMap, getContentManager, hasAdminAccess, hasPublishAccess, hasReadAccess, hasWriteAccess, isPersistent, restore, restore, save, save, validateChars, validateSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentSite

public ContentSite(ContentManager manager,
                   Domain domain)
Creates a new site with default values.

Parameters:
manager - the content manager to use
domain - the site domain

ContentSite

protected ContentSite(ContentManager manager,
                      ContentData data,
                      DataSource src)
               throws ContentException
Creates a new site.

Parameters:
manager - the content manager to use
data - the content data object
src - the data source to use
Throws:
ContentException - if the database couldn't be accessed properly
Method Detail

findByDomain

protected static ContentSite[] findByDomain(ContentManager manager,
                                            Domain domain)
                                     throws ContentException
Returns an array of content site in the specified domain. Only the latest revision of each content object will be returned. This method differs from the results returned by a search with findByCategory() in that offline objects can also be returned.

Parameters:
manager - the content manager to use
domain - the domain
Returns:
an array of content site objects found
Throws:
ContentException - if the database couldn't be accessed properly

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class Content
Returns:
a string representation of this object

getProtocol

public java.lang.String getProtocol()
Returns the site protocol

Returns:
the site protocol

setProtocol

public void setProtocol(java.lang.String protocol)
Sets the site protocol.

Parameters:
protocol - the new site protocol

getHost

public java.lang.String getHost()
Returns the host name or IP address.

Returns:
the host name, or "*" if any host matches this site

setHost

public void setHost(java.lang.String host)
Sets the host name or IP address. This value must be the fully qualified name with domain used in the URL:s to the site.

Parameters:
host - the new host name, or "*" for any

getPort

public int getPort()
Returns the port number.

Returns:
the port number, or zero (0) if any port matches this site

setPort

public void setPort(int port)
Sets the port number.

Parameters:
port - the new port number, or zero (0) for any

getDirectory

public java.lang.String getDirectory()
Returns the base directory. The base directory always starts and ends with a '/' character.

Returns:
the base directory

setDirectory

public void setDirectory(java.lang.String directory)
Sets the base directory.

Parameters:
directory - the new base directory

isAdmin

public boolean isAdmin()
Checks if the admin flag is set.

Returns:
true if the admin flag is set, or false otherwise

setAdmin

public void setAdmin(boolean admin)
Sets the admin flag.

Parameters:
admin - the new admin flag

match

public int match(java.lang.String protocol,
                 java.lang.String host,
                 int port,
                 java.lang.String path)
Matches a set of request parameters to this site. This method returns a numeric value that is higher for better matches. If the request parameters didn't match at all, zero (0) is always returned. The matching algorithm gives priority to exact matches for host and port, and longer matches for paths. An exact match for host or port is also always preferred over a longer path match.

Parameters:
protocol - the request protocol
host - the request host name (server name)
port - the request (server) port
path - the request path
Returns:
the match value (higher is better), or zero (0) for no match

doValidate

protected void doValidate()
                   throws ContentException
Validates the object data before writing to the database.

Overrides:
doValidate in class Content
Throws:
ContentException - if the object data wasn't valid