|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.meshcms.core.WebSite
Field Summary | |
static java.lang.String |
ADMIN_ID_FILE
|
static java.lang.String |
ADMIN_THEME
Name of the default admin theme folder. |
protected Path |
adminModulesPath
|
protected Path |
adminPath
|
protected Path |
adminScriptsPath
|
protected Path |
adminThemePath
|
protected Path |
adminThemesPath
|
static java.lang.String |
APP_NAME
|
static java.lang.String |
BACKUP_DIR_PREFIX
A prefix to be used for every backup dir. |
static java.lang.String |
BACKUP_PREFIX
A prefix to be used for every backup file. |
static java.lang.String |
CMS_ID_FILE
|
protected Path |
cmsPath
|
protected Path |
configFilePath
|
protected Configuration |
configuration
|
protected Path |
customModulesPath
|
protected Path |
customThemesPath
|
protected Path |
generatedFilesPath
|
protected long |
lastAdminThemeBlock
|
protected Path |
moduleDataPath
|
protected Path |
privatePath
|
protected Path |
propertiesFilePath
|
protected Path |
repositoryPath
|
protected java.io.File |
rootFile
|
protected Path |
rootPath
|
protected javax.servlet.ServletContext |
sc
|
protected SiteInfo |
siteInfo
|
protected SiteMap |
siteMap
|
protected Path |
sitesFilePath
|
protected int |
statsLength
|
protected long |
statsZero
|
static java.lang.String |
TEMP_PREFIX
A prefix to be used for every temporary file created in the repository. |
protected Path |
usersPath
|
static java.lang.String |
VERSION_ID
|
protected Path |
virtualSitesPath
|
protected java.lang.String[] |
welcomeFiles
|
Constructor Summary | |
protected |
WebSite()
|
Method Summary | |
boolean |
copyFile(UserInfo user,
Path oldPath,
Path newPath)
Copies a file (or directory) to another file (or directory). |
boolean |
copyFile(UserInfo user,
Path filePath,
java.lang.String newName)
Copies a file to another file in the same directory. |
protected static WebSite |
create(javax.servlet.ServletContext sc,
java.lang.String[] welcomeFiles,
java.io.File rootFile,
Path rootPath,
Path cmsPath)
|
java.io.File |
createDir(Path path)
|
boolean |
createDirectory(UserInfo user,
Path dirPath)
Creates a new directory. |
boolean |
createFile(UserInfo user,
Path filePath)
Creates a new file. |
boolean |
delete(UserInfo user,
Path filePath,
boolean deleteNonEmptyDirectories)
Deletes a file or directory. |
Path |
findCurrentWelcome(Path dirPath)
Returns the current welcome file path for the given folder. |
java.lang.String |
getAbsoluteLink(PageInfo pageInfo)
|
java.lang.String |
getAbsoluteLink(Path path)
|
java.lang.String |
getAdminMetaThemeTag()
Returns the complete tag used by pages in the admin folder. |
Path |
getAdminModulesPath()
|
Path |
getAdminPath()
Returns the path of the admin directory. |
Path |
getAdminScriptsPath()
|
Path |
getAdminThemePath()
|
Path |
getAdminThemesPath()
|
Path |
getCMSPath()
|
Path |
getConfigFilePath()
|
Configuration |
getConfiguration()
Returns the current configuration of the web application. |
Path |
getCustomModulesPath()
|
Path |
getCustomThemesPath()
|
Path |
getDirectory(Path path)
Returns the directory that contains the given path. |
java.lang.String |
getDummyMetaThemeTag()
|
java.io.File |
getFile(Path path)
Returns the file object for a given path in the web application. |
Path |
getGeneratedFilesPath()
|
java.lang.String |
getHTMLTemplate(java.lang.String pageTitle)
Returns a string containing a basic HTML page. |
long |
getLastAdminThemeBlock()
|
Path |
getLink(PageInfo pageInfo,
Path pagePath)
|
Path |
getLink(Path path,
Path pagePath)
|
java.lang.String[] |
getLinkList(PageInfo[] pages,
Path pagePath,
java.lang.String target,
java.lang.String style)
|
Path |
getModuleDataPath()
|
Path |
getModulePath(java.lang.String moduleName)
Returns the path of the module file with the given name. |
Path |
getPath(java.io.File file)
Returns the Path of a file in the context. |
Path |
getPrivatePath()
|
Path |
getPropertiesFilePath()
|
java.io.File |
getRepositoryFile(Path filePath,
java.lang.String fileName)
Returns the correct file in the repository. |
Path |
getRepositoryPath()
|
Path |
getRequestedPath(javax.servlet.http.HttpServletRequest request)
|
java.io.File |
getRootFile()
|
Path |
getRootPath()
Returns the site root path. |
Path |
getServedPath(javax.servlet.http.HttpServletRequest request)
|
Path |
getServedPath(Path requestedPath)
|
protected javax.servlet.ServletContext |
getServletContext()
|
SiteInfo |
getSiteInfo()
Returns the instance of the SiteInfo class that is managing
the site information. |
SiteMap |
getSiteMap()
Returns the instance of the SiteMap that is currently manage
the site map. |
Path |
getSitesFilePath()
|
int |
getStatsIndex()
Returns the index of the current day in the array of stats included in any PageInfo instance. |
int |
getStatsLength()
Returns the length of stats (hit counts) measured in days. |
Path |
getThemePath(Path pagePath)
Returns the path of the theme to be applied to the given path. |
java.lang.String[] |
getTitles(PageInfo[] pages)
Returns an array of menu titles for the given pages. |
java.lang.String |
getTypeDescription()
|
Path |
getUsersPath()
|
Path |
getVirtualSitesPath()
|
WebSite |
getWebSite(javax.servlet.ServletRequest request)
|
java.lang.String[] |
getWelcomeFileNames()
Returns the array of welcome file names. |
protected void |
init(javax.servlet.ServletContext sc,
java.lang.String[] welcomeFiles,
java.io.File rootFile,
Path rootPath,
Path cmsPath)
|
boolean |
isDirectory(Path path)
Checks if the given path is a directory in the file system. |
boolean |
isInsideModules(Path path)
|
boolean |
isInsideThemes(Path path)
|
boolean |
isSystem(Path path)
Determines if the given path is a system directory, or is contained in a system directory. |
boolean |
isVirtual()
|
boolean |
isVisuallyEditable(Path path)
Returns true if the extension of the path is known to denote a type of file that can be edited using the wysiwyg editor. |
boolean |
isWelcomeFileName(java.lang.String fileName)
Checks if the file name is one of the welcome files. |
java.lang.Object |
loadFromXML(Path path)
|
protected void |
log(java.lang.String s)
Logs a string by calling ServletContext.log(s) |
void |
log(java.lang.String message,
java.lang.Throwable throwable)
Logs an exception by calling ServletContext.log(message, throwable) |
boolean |
move(UserInfo user,
Path oldPath,
Path newPath)
Moves (or renames) a file. |
void |
readConfig()
|
boolean |
rename(UserInfo user,
Path filePath,
java.lang.String newName)
Renames a file. |
boolean |
saveToFile(UserInfo user,
java.lang.Object saveThis,
Path filePath)
Stores an object into a file. |
boolean |
setFileTime(UserInfo user,
Path filePath,
long time)
|
void |
setLastAdminThemeBlock(long lastAdminThemeBlock)
|
boolean |
storeToXML(java.lang.Object o,
Path path)
|
java.lang.String |
toString()
|
boolean |
touch(UserInfo user,
Path filePath)
Sets the last modified date of the file to the current time. |
void |
updateSiteMap(boolean force)
Creates another instance of SiteMap . |
javax.servlet.http.HttpServletRequest |
wrapRequest(javax.servlet.ServletRequest request)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String APP_NAME
public static final java.lang.String VERSION_ID
public static final java.lang.String BACKUP_PREFIX
public static final java.lang.String BACKUP_DIR_PREFIX
public static final java.lang.String TEMP_PREFIX
public static final java.lang.String ADMIN_THEME
public static final java.lang.String CMS_ID_FILE
public static final java.lang.String ADMIN_ID_FILE
protected javax.servlet.ServletContext sc
protected java.lang.String[] welcomeFiles
protected java.io.File rootFile
protected long lastAdminThemeBlock
protected long statsZero
protected int statsLength
protected Configuration configuration
protected SiteInfo siteInfo
protected SiteMap siteMap
protected Path rootPath
protected Path cmsPath
protected Path adminPath
protected Path adminThemePath
protected Path adminModulesPath
protected Path adminThemesPath
protected Path adminScriptsPath
protected Path privatePath
protected Path usersPath
protected Path virtualSitesPath
protected Path repositoryPath
protected Path customModulesPath
protected Path generatedFilesPath
protected Path moduleDataPath
protected Path customThemesPath
protected Path configFilePath
protected Path propertiesFilePath
protected Path sitesFilePath
Constructor Detail |
protected WebSite()
Method Detail |
protected static WebSite create(javax.servlet.ServletContext sc, java.lang.String[] welcomeFiles, java.io.File rootFile, Path rootPath, Path cmsPath)
protected void init(javax.servlet.ServletContext sc, java.lang.String[] welcomeFiles, java.io.File rootFile, Path rootPath, Path cmsPath)
public void readConfig()
protected javax.servlet.ServletContext getServletContext()
public void updateSiteMap(boolean force)
SiteMap
. If force
is true, a new site map is always created and the method
returns after the new site map is completed. If it is false, a new site map
is created only if the current one is too old. In this case, the site map
is created asynchronously and the method returns immediately. The
repository will be cleaned too.
force
- it to force the SiteMap creation.public SiteMap getSiteMap()
SiteMap
that is currently manage
the site map. Since this object can be replaced with a new one at any
moment, a class that wants to use it should store it in a local variable
and use it for all the operation/method.
public Configuration getConfiguration()
public SiteInfo getSiteInfo()
SiteInfo
class that is managing
the site information.
SiteInfo
public int getStatsIndex()
public int getStatsLength()
public boolean createDirectory(UserInfo user, Path dirPath)
user
- the user that requests the creation of the directorydirPath
- the path of the new directory
public boolean createFile(UserInfo user, Path filePath)
user
- the user that requests the file creationfilePath
- the path of the new file
public boolean copyFile(UserInfo user, Path filePath, java.lang.String newName)
user
- the user that requests the operationfilePath
- the path of the old filenewName
- the name of the new file
public boolean copyFile(UserInfo user, Path oldPath, Path newPath)
user
- the user that requests the operationoldPath
- the location of the existing filenewPath
- the location of the new copy of the file
public boolean rename(UserInfo user, Path filePath, java.lang.String newName)
user
- the user that requests the operationfilePath
- the path of the filenewName
- the name of the new file
public boolean move(UserInfo user, Path oldPath, Path newPath)
user
- the user that requests the operationoldPath
- the current location of the filenewPath
- the new location of the file
public boolean delete(UserInfo user, Path filePath, boolean deleteNonEmptyDirectories)
user
- the user that requests the operationfilePath
- the path of the filedeleteNonEmptyDirectories
- if true, non-empty directories will be
deleted too
public boolean touch(UserInfo user, Path filePath)
user
- the user that requests the operationfilePath
- the path of the file
public boolean setFileTime(UserInfo user, Path filePath, long time)
public boolean saveToFile(UserInfo user, java.lang.Object saveThis, Path filePath)
org.apache.commons.fileupload.FileItem
(uploaded files)toString()
method is used in this
cases. This is compatible with many kinds of objects: strings,
string buffers and so on.
user
- the user that requests the operationsaveThis
- the object to be stored in the filefilePath
- the path of the file to be written. If the file exists, it
will be backed up and overwritten
public java.io.File getRepositoryFile(Path filePath, java.lang.String fileName)
filePath = /somedir/index.html
and
fileName = tmp.html
.
filePath
- the path where to searchfileName
- the file name
public java.io.File createDir(Path path)
public java.io.File getFile(Path path)
path
- the path representation of the file
public java.io.File getRootFile()
public Path getRootPath()
public Path getPath(java.io.File file)
Path
of a file in the context.
getFile(org.meshcms.util.Path)
public Path getRequestedPath(javax.servlet.http.HttpServletRequest request)
public Path getServedPath(javax.servlet.http.HttpServletRequest request)
public Path getServedPath(Path requestedPath)
public boolean isDirectory(Path path)
path
- the Path to check
public Path getDirectory(Path path)
Path.getParent()
, since if the path is known to
be a directory in the web application, the path itself is returned.
path
- the Path to check
public java.lang.String[] getLinkList(PageInfo[] pages, Path pagePath, java.lang.String target, java.lang.String style)
public java.lang.String getAbsoluteLink(Path path)
public java.lang.String getAbsoluteLink(PageInfo pageInfo)
public Path getLink(Path path, Path pagePath)
public Path getLink(PageInfo pageInfo, Path pagePath)
public java.lang.String[] getTitles(PageInfo[] pages)
SiteInfo
is used to get the titles.
pages
- an array of pages to be processed
public boolean isSystem(Path path)
checkAdmin
is true
path
- the given path(directory) to be checked
public boolean isVisuallyEditable(Path path)
public Path getModulePath(java.lang.String moduleName)
public Path getAdminPath()
public Path getCMSPath()
public boolean isVirtual()
public java.lang.String getAdminMetaThemeTag()
public java.lang.String getDummyMetaThemeTag()
public java.lang.String getHTMLTemplate(java.lang.String pageTitle) throws java.io.IOException
pageTitle
- the content of the <title> tag (if null, the title
will be "New Page")
java.io.IOException
public boolean isInsideModules(Path path)
public boolean isInsideThemes(Path path)
protected void log(java.lang.String s)
ServletContext.log(s)
public void log(java.lang.String message, java.lang.Throwable throwable)
ServletContext.log(message, throwable)
public boolean isWelcomeFileName(java.lang.String fileName)
fileName
- the file name to check
public java.lang.String[] getWelcomeFileNames()
public Path findCurrentWelcome(Path dirPath)
dirPath
- the folder where to search the welcome file
public WebSite getWebSite(javax.servlet.ServletRequest request)
public javax.servlet.http.HttpServletRequest wrapRequest(javax.servlet.ServletRequest request)
public java.lang.String getTypeDescription()
public java.lang.String toString()
public java.lang.Object loadFromXML(Path path)
public boolean storeToXML(java.lang.Object o, Path path)
public Path getThemePath(Path pagePath)
pagePath
- the path of the page who's theme is searched.
public Path getAdminThemePath()
public Path getAdminModulesPath()
public Path getModuleDataPath()
public Path getAdminThemesPath()
public Path getAdminScriptsPath()
public Path getPrivatePath()
public Path getUsersPath()
public Path getVirtualSitesPath()
public Path getRepositoryPath()
public Path getCustomModulesPath()
public Path getGeneratedFilesPath()
public Path getCustomThemesPath()
public Path getConfigFilePath()
public Path getPropertiesFilePath()
public Path getSitesFilePath()
public long getLastAdminThemeBlock()
public void setLastAdminThemeBlock(long lastAdminThemeBlock)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |