|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.main.OpenCmsCore
public final class OpenCmsCore
The internal implementation of the core OpenCms "operating system" functions.
All access to this class must be done through the public static methods
of the
object.
Under no circumstances should you ever try to access this class directly.OpenCms
This class is so OpenCms internal you should not even be reading this documentation ;-)
Any request to the
will be forwarded to this core class.
The core will then try to map the request to a VFS (Virtual File System) URI,
that is a OpenCmsServlet
in the OpenCms database.
If a resource is found, it will be read and forwarded to
to the corresponding CmsResource
,
which will then generate the output for the requested resource and return it to the requesting client.I_CmsResourceLoader
There will be only one singleton instance of this object created for this core class. This means that in the default configuration, where OpenCms is accessed through a servlet context, there will be only one instance of the core in that servlet context.
Method Summary | |
---|---|
protected void |
addRequestHandler(I_CmsRequestHandler handler)
Adds the specified request handler to the Map of OpenCms request handlers. |
protected I_CmsAuthorizationHandler |
getAuthorizationHandler()
Returns the configured authorization handler. |
protected CmsConfigurationManager |
getConfigurationManager()
Returns the initialized OpenCms configuration manager. |
protected java.util.List |
getDefaultFiles()
Returns the configured list of default directory file names. |
protected CmsDefaultUsers |
getDefaultUsers()
Returns the default user and group name configuration. |
protected CmsEventManager |
getEventManager()
Returns the OpenCms event manager. |
protected java.util.Set |
getExportPoints()
Returns the configured export points, the returned set being an unmodifiable set. |
protected CmsImportExportManager |
getImportExportManager()
Returns the initialized import/export manager, which contains information about the Cms import/export. |
protected static OpenCmsCore |
getInstance()
Returns the initialized OpenCms singleton instance. |
protected CmsLinkManager |
getLinkManager()
Returns the link manager to resolve links in <link> tags. |
protected CmsLocaleManager |
getLocaleManager()
Returns the locale manager used for obtaining the current locale. |
protected CmsLockManager |
getLockManager()
Returns the lock manager used for the locking mechanism. |
protected CmsLoginManager |
getLoginManager()
Returns the login manager used to check the validity of a login. |
protected CmsMemoryMonitor |
getMemoryMonitor()
Returns the memory monitor. |
protected CmsModuleManager |
getModuleManager()
Returns the module manager. |
protected CmsOrgUnitManager |
getOrgUnitManager()
Returns the organizational unit manager. |
protected I_CmsPasswordHandler |
getPasswordHandler()
Return the password handler. |
protected java.lang.String |
getPathInfo(javax.servlet.http.HttpServletRequest req)
Returns the path for the request. |
protected CmsPublishManager |
getPublishManager()
Returns the publish manager instance. |
protected CmsRepositoryManager |
getRepositoryManager()
Returns the repository manager. |
protected I_CmsRequestHandler |
getRequestHandler(java.lang.String name)
Returns the handler instance for the specified name, or null if the name does not match any handler name. |
protected CmsResourceManager |
getResourceManager()
Returns the resource manager. |
protected CmsRoleManager |
getRoleManager()
Returns the role manager. |
protected int |
getRunLevel()
Returns the runlevel of this OpenCmsCore object instance. |
protected java.lang.Object |
getRuntimeProperty(java.lang.Object key)
Looks up a value in the runtime property Map. |
protected CmsScheduleManager |
getScheduleManager()
Returns the configured schedule manager. |
protected CmsSearchManager |
getSearchManager()
Returns the initialized search manager, which provides indexing and searching operations. |
protected CmsSecurityManager |
getSecurityManager()
Returns the initialized OpenCms security manager. |
protected CmsSessionManager |
getSessionManager()
Returns the session manager. |
protected CmsSiteManagerImpl |
getSiteManager()
Returns the initialized site manager, which contains information about all configured sites. |
protected CmsSqlManager |
getSqlManager()
Returns an instance of the common sql manager. |
protected CmsStaticExportManager |
getStaticExportManager()
Returns the properties for the static export. |
protected CmsSystemInfo |
getSystemInfo()
Returns the system information storage. |
protected CmsThreadStore |
getThreadStore()
Returns the OpenCms Thread store. |
protected I_CmsValidationHandler |
getValidationHandler()
Returns the runtime validation handler. |
protected CmsWorkplaceManager |
getWorkplaceManager()
Returns the initialized workplace manager, which contains information about the global workplace settings. |
protected CmsXmlContentTypeManager |
getXmlContentTypeManager()
Returns the XML content type manager. |
protected CmsObject |
initCmsObject(CmsObject cms)
Returns an independent copy of the provided CmsObject. |
protected CmsObject |
initCmsObject(CmsObject adminCms,
CmsContextInfo contextInfo)
Returns an initialized CmsObject with the user and context initialized as provided. |
protected CmsObject |
initCmsObject(java.lang.String user)
Returns an initialized CmsObject with the user initialized as provided, with the "Online" project selected and "/" set as the current site root. |
protected CmsObject |
initCmsObjectFromSession(javax.servlet.http.HttpServletRequest req)
Initializes a new cms object from the session data of the request. |
protected void |
initConfiguration(org.apache.commons.collections.ExtendedProperties configuration)
Constructor to create a new OpenCms object. |
protected void |
initContext(javax.servlet.ServletContext context)
Initialization of the OpenCms runtime environment. |
protected void |
initMembers()
Initialize member variables. |
protected CmsResource |
initResource(CmsObject cms,
java.lang.String resourceName,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Reads the requested resource from the OpenCms VFS, in case a directory name is requested, the default files of the directory will be looked up and the first match is returned. |
protected void |
initServlet(OpenCmsServlet servlet)
Initializes the system with the OpenCms servlet. |
protected static void |
setErrorCondition(CmsMessageContainer errorCondition)
Sets the error condition. |
protected void |
setRuntimeProperty(java.lang.Object key,
java.lang.Object value)
This method adds an Object to the OpenCms runtime properties. |
protected void |
showResource(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Displays a resource from the OpenCms by writing the result to the provided Servlet response output stream. |
protected void |
shutDown()
Destroys this OpenCms instance, called if the servlet (or shell) is shut down. |
protected CmsObject |
updateContext(javax.servlet.http.HttpServletRequest request,
CmsObject cms)
This method updates the request context information. |
protected OpenCmsCore |
upgradeRunlevel(org.apache.commons.collections.ExtendedProperties configuration)
Upgrades to runlevel OpenCms.RUNLEVEL_3_SHELL_ACCESS ,
this is shell access to the database but no Servlet context. |
protected OpenCmsCore |
upgradeRunlevel(javax.servlet.ServletContext context)
Upgrades to runlevel OpenCms.RUNLEVEL_4_SERVLET_ACCESS ,
this is the final runlevel with an initialized database and Servlet context. |
protected void |
writeConfiguration(java.lang.Class clazz)
Writes the XML configuration for the provided configuration class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected static OpenCmsCore getInstance()
protected static void setErrorCondition(CmsMessageContainer errorCondition)
errorCondition
- the error condition to setprotected void addRequestHandler(I_CmsRequestHandler handler)
handler
- the handler to addprotected I_CmsAuthorizationHandler getAuthorizationHandler()
protected CmsConfigurationManager getConfigurationManager()
protected java.util.List getDefaultFiles()
protected CmsDefaultUsers getDefaultUsers()
protected CmsEventManager getEventManager()
protected java.util.Set getExportPoints()
protected CmsImportExportManager getImportExportManager()
protected CmsLinkManager getLinkManager()
protected CmsLocaleManager getLocaleManager()
protected CmsLockManager getLockManager()
protected CmsLoginManager getLoginManager()
protected CmsMemoryMonitor getMemoryMonitor()
protected CmsModuleManager getModuleManager()
protected CmsOrgUnitManager getOrgUnitManager()
protected I_CmsPasswordHandler getPasswordHandler()
protected java.lang.String getPathInfo(javax.servlet.http.HttpServletRequest req)
First checks the HttpServletRequest.getPathInfo()
, then
the configured request error page attribute (if set), and then
if still undefined the /
is returned as path info.
This is only needed when the HttpServletRequest.getPathInfo()
is not really working as expected like in BEA WLS 9.x, where we have
to use the 'weblogic.servlet.errorPage' request attribute.
req
- the http request context
protected CmsPublishManager getPublishManager()
protected CmsRepositoryManager getRepositoryManager()
protected I_CmsRequestHandler getRequestHandler(java.lang.String name)
name
- the name of the handler instance to return
protected CmsResourceManager getResourceManager()
protected CmsRoleManager getRoleManager()
protected int getRunLevel()
For a detailed description about the possible run levels,
please see OpenCms.getRunLevel()
.
OpenCms.getRunLevel()
protected java.lang.Object getRuntimeProperty(java.lang.Object key)
key
- the key to look up in the runtime properties
protected CmsScheduleManager getScheduleManager()
protected CmsSearchManager getSearchManager()
protected CmsSecurityManager getSecurityManager()
protected CmsSessionManager getSessionManager()
protected CmsSiteManagerImpl getSiteManager()
protected CmsSqlManager getSqlManager()
protected CmsStaticExportManager getStaticExportManager()
protected CmsSystemInfo getSystemInfo()
protected CmsThreadStore getThreadStore()
protected I_CmsValidationHandler getValidationHandler()
protected CmsWorkplaceManager getWorkplaceManager()
protected CmsXmlContentTypeManager getXmlContentTypeManager()
protected CmsObject initCmsObject(CmsObject cms) throws CmsException
This can be useful in case a permanent reference to a CmsObject is stored. Changing the request context values (for example project, siteroot) in the new CmsObject will have no side effects to the CmsObject it was copied form.
The request time (
)
is set to the current time.CmsRequestContext.getRequestTime()
cms
- the CmsObject to create a copy of
CmsException
- in case the initialization failedOpenCms.initCmsObject(CmsObject)
,
OpenCms.initCmsObject(CmsObject, CmsContextInfo)
,
OpenCms.initCmsObject(String)
protected CmsObject initCmsObject(CmsObject adminCms, CmsContextInfo contextInfo) throws CmsRoleViolationException, CmsException
Note: Only if the provided adminCms
CmsObject has admin permissions,
this method allows the creation a CmsObject for any existing user. Otherwise
only the default users 'Guest' and 'Export' can initialized with
this method, all other user names will throw an Exception.
adminCms
- must either be initialized with "Admin" permissions, or nullcontextInfo
- the context info to create a CmsObject for
CmsException
- if an invalid user name was provided
CmsRoleViolationException
- if the current user does not have the role permissions to create a context for the requested userCmsDefaultUsers.getUserGuest()
,
CmsDefaultUsers.getUserExport()
,
OpenCms.initCmsObject(CmsObject)
,
OpenCms.initCmsObject(CmsObject, CmsContextInfo)
,
OpenCms.initCmsObject(String)
protected CmsObject initCmsObject(java.lang.String user) throws CmsException
Note: Only the default users 'Guest' and 'Export' can initialized with this method, all other user names will throw an Exception.
user
- the user name to initialize, can only be
CmsDefaultUsers.getUserGuest()
or
CmsDefaultUsers.getUserExport()
CmsException
- if an invalid user name was provided, or if something else goes wrongCmsDefaultUsers.getUserGuest()
,
CmsDefaultUsers.getUserExport()
,
OpenCms.initCmsObject(String)
,
initCmsObject(CmsObject, CmsContextInfo)
protected CmsObject initCmsObjectFromSession(javax.servlet.http.HttpServletRequest req) throws CmsException
If no session data is found, null
is returned.
req
- the request
CmsException
- if something goes wrongprotected void initConfiguration(org.apache.commons.collections.ExtendedProperties configuration) throws CmsInitException
It reads the configurations from the opencms.properties
file in the config/
subdirectory. With the information
from this file is inits a ResourceBroker (Database access module),
various caching systems and other options.
This will only be done once per accessing class.
configuration
- the configurations from the opencms.properties
file
CmsInitException
- in case OpenCms can not be initializedprotected void initContext(javax.servlet.ServletContext context) throws CmsInitException
The connection information for the database is read
from the opencms.properties
configuration file and all
driver manager are initialized via the initializer,
which usually will be an instance of a OpenCms
class.
context
- configuration of OpenCms from web.xml
CmsInitException
- in case OpenCms can not be initializedprotected void initMembers()
protected CmsResource initResource(CmsObject cms, java.lang.String resourceName, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws CmsException
The resource that is returned is always a
,
even though the content will usually not be loaded in the result. Folders are never returned since
the point of this method is really to load the default file if just a folder name is requested.CmsFile
The URI stored in the given OpenCms user context will be changed to the URI of the resource that was found and returned.
Implementing and configuring an
handler
allows to customize the process of default resource selection.I_CmsResourceInit
cms
- the current users OpenCms contextresourceName
- the path of the requested resource in the OpenCms VFSreq
- the current http requestres
- the current http response
CmsException
- in case the requested file does not exist or the user has insufficient access permissionsOpenCms.initResource(CmsObject, String, HttpServletRequest, HttpServletResponse)
protected void initServlet(OpenCmsServlet servlet)
This is the final step that is called on the servlets "init()" method. It registers the servlets request handler and also outputs the final startup message. The servlet should auto-load since the <load-on-startup> parameter is set in the 'web.xml' by default.
servlet
- the OpenCms servletprotected void setRuntimeProperty(java.lang.Object key, java.lang.Object value)
key
- the key to add the Object withvalue
- the value of the Object to addprotected void showResource(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
req
- the current servlet requestres
- the current servlet responseprotected void shutDown()
protected CmsObject updateContext(javax.servlet.http.HttpServletRequest request, CmsObject cms) throws CmsException
The update information is:
request
- the current requestcms
- the cms object to update the request context for
CmsException
- if something goes wrongprotected OpenCmsCore upgradeRunlevel(org.apache.commons.collections.ExtendedProperties configuration) throws CmsInitException
OpenCms.RUNLEVEL_3_SHELL_ACCESS
,
this is shell access to the database but no Servlet context.
To upgrade the runlevel, the system must be in runlevel OpenCms.RUNLEVEL_1_CORE_OBJECT
,
otherwise an exception is thrown.
configuration
- the configuration
CmsInitException
- in case OpenCms can not be initializedprotected OpenCmsCore upgradeRunlevel(javax.servlet.ServletContext context) throws CmsInitException
OpenCms.RUNLEVEL_4_SERVLET_ACCESS
,
this is the final runlevel with an initialized database and Servlet context.
To upgrade the runlevel, the system must be in runlevel OpenCms.RUNLEVEL_1_CORE_OBJECT
,
otherwise an exception is thrown.
context
- the current servlet context
CmsInitException
- in case OpenCms can not be initializedprotected void writeConfiguration(java.lang.Class clazz)
clazz
- the configuration class to write the XML for
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |