Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.opencms.core
Class OpenCms  view OpenCms download OpenCms.java

java.lang.Object
  extended bycom.opencms.core.A_OpenCms
      extended bycom.opencms.core.OpenCms
All Implemented Interfaces:
I_CmsConstants, com.opencms.boot.I_CmsLogChannels

public class OpenCms
extends A_OpenCms
implements I_CmsConstants, com.opencms.boot.I_CmsLogChannels

This class is the main class of the OpenCms system, think of it as the "operating system" of OpenCms.

Any request to an OpenCms resource will be processed by this class first. The class will try to map the request to a VFS (Virtual File System) resource, i.e. an URI. If the resource is found, it will be read anf forwarded to to a launcher, which is performs the output of the requested resource.

The OpenCms class is independent of access module to the OpenCms (e.g. Servlet, Command Shell), therefore this class is not responsible for user authentification. This is done by the access module to the OpenCms.

There will be only one instance of the OpenCms object created for any accessing class. This means that in the default configuration, where OpenCms is accessed through a servlet, there will be only one instance of this class running at a time.

Version:
$Revision: 1.124.2.1 $ $Date: 2004/01/06 12:45:53 $

Field Summary
private static java.lang.String C_DEFAULT_MIMETYPE
          The default mimetype
private static com.opencms.template.cache.CmsElementCache c_elementCache
          Reference to the CmsElementCache object containing locators for all URIs and elements in cache
private static CmsStaticExportProperties c_exportProperties
          The object to store the properties from the opencms.property file for the static export
private static java.lang.String c_passwordValidatingClass
          The name of the class used to validate a new password
private static java.util.Hashtable c_variantDeps
          In this hashtable the dependencies for all variants in the elementcache are stored.
private  java.util.List m_checkFile
          Member variable to store instances to modify resources
private static java.lang.String[] m_defaultFilenames
          List of default file names (for directories, e.g, "index.html")
private static com.opencms.flex.util.CmsResourceTranslator m_directoryTranslator
          Directory translator, used to translate all access to resources
private  boolean m_enableElementCache
          Indicates, if the element cache should be enabled by the configurations
private static com.opencms.flex.util.CmsResourceTranslator m_fileTranslator
          Filename translator, used only for the creation of new files
private  boolean m_isInitialized
          Flag to indicate if the startup classes have already been initialized
private  com.opencms.launcher.CmsLauncherManager m_launcherManager
          Reference to the OpenCms launcer manager
private  java.util.Hashtable m_mt
          Hashtable with all available Mimetypes.
private  CmsCronScheduler m_scheduler
          The cron scheduler to schedule the cronjobs
private  boolean m_sessionFailover
          Indicates, if the session-failover should be enabled or not
private  boolean m_streaming
          Indicates, if the streaming should be enabled by the configurations.
private  CmsCronTable m_table
          The cron table to use with the scheduler
 
Fields inherited from class com.opencms.core.A_OpenCms
m_resourceBroker
 
Fields inherited from interface com.opencms.core.I_CmsConstants
C_ACCESS_DEFAULT_FLAGS, C_ACCESS_GROUP, C_ACCESS_GROUP_READ, C_ACCESS_GROUP_VISIBLE, C_ACCESS_GROUP_WRITE, C_ACCESS_INTERNAL_READ, C_ACCESS_OWNER, C_ACCESS_OWNER_READ, C_ACCESS_OWNER_VISIBLE, C_ACCESS_OWNER_WRITE, C_ACCESS_PUBLIC, C_ACCESS_PUBLIC_READ, C_ACCESS_PUBLIC_VISIBLE, C_ACCESS_PUBLIC_WRITE, C_ACCESS_READ, C_ACCESS_VISIBLE, C_ACCESS_WRITE, C_ADDITIONAL_INFO_EXPLORERSETTINGS, C_ADDITIONAL_INFO_PREFERENCES, C_ADDITIONAL_INFO_STARTSETTINGS, C_ADDITIONAL_INFO_TASKSETTINGS, C_ADDITIONAL_INFO_TOWN, C_ADDITIONAL_INFO_ZIPCODE, C_AT_LEAST_ONCE, C_CLUSTERURL, C_CONFIGURATION_CACHE, C_CONFIGURATION_CLASS, C_CONFIGURATION_REGISTRY, C_CONFIGURATION_RESOURCEBROKER, C_COPYRIGHT, C_DEFAULT_SITE, C_DELETE_HISTORY, C_ENABLE_HISTORY, C_ERRPREFIX, C_ERRSPERATOR, C_EXPORT_TAG_ACCESS, C_EXPORT_TAG_ADDRESS, C_EXPORT_TAG_CREATOR, C_EXPORT_TAG_DATE, C_EXPORT_TAG_DEFAULTGROUP, C_EXPORT_TAG_DESCRIPTION, C_EXPORT_TAG_DESTINATION, C_EXPORT_TAG_EMAIL, C_EXPORT_TAG_EXPORT, C_EXPORT_TAG_FILE, C_EXPORT_TAG_FIRSTNAME, C_EXPORT_TAG_FLAGS, C_EXPORT_TAG_GROUP, C_EXPORT_TAG_GROUPDATA, C_EXPORT_TAG_GROUPNAME, C_EXPORT_TAG_INFO, C_EXPORT_TAG_LASTMODIFIED, C_EXPORT_TAG_LASTNAME, C_EXPORT_TAG_LAUNCHER_START_CLASS, C_EXPORT_TAG_MODULEXPORT, C_EXPORT_TAG_NAME, C_EXPORT_TAG_OC_VERSION, C_EXPORT_TAG_PARENTGROUP, C_EXPORT_TAG_PASSWORD, C_EXPORT_TAG_PROJECT, C_EXPORT_TAG_PROPERTIES, C_EXPORT_TAG_PROPERTY, C_EXPORT_TAG_RECOVERYPASSWORD, C_EXPORT_TAG_SECTION, C_EXPORT_TAG_SOURCE, C_EXPORT_TAG_TYPE, C_EXPORT_TAG_USER, C_EXPORT_TAG_USERDATA, C_EXPORT_TAG_USERGROUPDATA, C_EXPORT_TAG_USERGROUPS, C_EXPORT_TAG_USERINFO, C_EXPORT_TAG_VALUE, C_EXPORT_TAG_VERSION, C_EXPORT_VERSION, C_EXPORT_XMLFILENAME, C_EXPORTONLYFILES, C_EXPORTONLYUSERS, C_EXPORTPOINT, C_EXPORTPOINT_PATH, C_EXPORTUSERSFILES, C_FCONTENT, C_FELEMENT, C_FILE, C_FILECONTENT, C_FILES_IMPORTED, C_FLAG_DISABLED, C_FLAG_ENABLED, C_FLAG_GROUP_PROJECTCOWORKER, C_FLAG_GROUP_PROJECTMANAGER, C_FLAG_GROUP_ROLE, C_FOLDER, C_FOLDER_SEPARATOR, C_GROUP, C_GROUP_ADMIN, C_GROUP_GUEST, C_GROUP_PROJECTLEADER, C_GROUP_USERS, C_LINKCHECKTABLE_DATE, C_MAX_LENGTH_RESOURCE_NAME, C_MODULE_PROPERTY_ADDITIONAL_RESOURCES, C_MODULE_PROPERTY_ADDITIONAL_RESOURCES_SEPARATOR, C_MODUS_AUTO, C_MODUS_EXPORT, C_MODUS_EXTERN, C_MODUS_OFFLINE, C_MODUS_ONLINE, C_MOUNTPOINT_FILESYSTEM, C_MOUNTPOINT_MYSQL, C_NEVER, C_NO_FILES_IMPORTED, C_ORDER_AGENTUSER, C_ORDER_ENDTIME, C_ORDER_ID, C_ORDER_INITIATORUSER, C_ORDER_NAME, C_ORDER_ORIGINALUSER, C_ORDER_PERCENTAGE, C_ORDER_PRIORITY, C_ORDER_ROLE, C_ORDER_STARTTIME, C_ORDER_STATE, C_ORDER_TASKTYPE, C_ORDER_TIMEOUT, C_ORDER_WAKEUPTIME, C_PASSWORD_MINIMUMSIZE, C_PROJECT_ONLINE, C_PROJECT_ONLINE_ID, C_PROJECT_STATE_ARCHIVE, C_PROJECT_STATE_INVISIBLE, C_PROJECT_STATE_LOCKED, C_PROJECT_STATE_UNLOCKED, C_PROJECT_TYPE_INVISIBLE, C_PROJECT_TYPE_NORMAL, C_PROJECT_TYPE_TEMPORARY, C_PROPERTY_ACTIV, C_PROPERTY_CHANNELID, C_PROPERTY_CONTENT_ENCODING, C_PROPERTY_DEFAULT_FILE, C_PROPERTY_DESCRIPTION, C_PROPERTY_EXPORT, C_PROPERTY_EXPORTNAME, C_PROPERTY_KEYWORDS, C_PROPERTY_NAVPOS, C_PROPERTY_NAVTEXT, C_PROPERTY_RELATIVEROOT, C_PROPERTY_TEMPLATETYPE, C_PROPERTY_TITLE, C_PROPERTY_VISIBLE, C_PUBLISH_METHOD_LINK, C_REGISTRY_DESTINATION, C_REGISTRY_HISTORY, C_REGISTRY_KNOWNLAUNCHERS, C_REGISTRY_LAUNCHER, C_REGISTRY_SOURCE, C_REQUEST_CONSOLE, C_REQUEST_HTTP, C_RESPONSE_CONSOLE, C_RESPONSE_HTTP, C_ROOT, C_ROOT_TEMPLATE_NAME, C_ROOTNAME_COS, C_ROOTNAME_VFS, C_SESSION_ADMIN_POS, C_SESSION_BROADCASTMESSAGE, C_SESSION_CONTENT_ENCODING, C_SESSION_CURRENTGROUP, C_SESSION_DATA, C_SESSION_IS_DIRTY, C_SESSION_MESSAGEPENDING, C_SESSION_MODULE_VECTOR, C_SESSION_PROJECT, C_SESSION_THREAD_ERROR, C_SESSION_USERNAME, C_SORT_ASC, C_SORT_DESC, C_START_ACCESSFLAGS, C_START_DEFAULTGROUP, C_START_LANGUAGE, C_START_LOCKDIALOG, C_START_PROJECT, C_START_VIEW, C_STATE_CHANGED, C_STATE_DELETED, C_STATE_NEW, C_STATE_UNCHANGED, C_STATICEXPORT_PATH, C_STATICEXPORT_START, C_SYNCHRONISATION_PATH, C_SYNCHRONISATION_PROJECT, C_SYNCHRONISATION_RESOURCE, C_SYNCHRONISATION_RESOURCETAG, C_SYSTEMPROPERTY_CRONTABLE, C_SYSTEMPROPERTY_EXPORTPATH, C_SYSTEMPROPERTY_EXTENSIONS, C_SYSTEMPROPERTY_LINKCHECKTABLE, C_SYSTEMPROPERTY_MIMETYPES, C_SYSTEMPROPERTY_MOUNTPOINT, C_SYSTEMPROPERTY_RESOURCE_TYPE, C_TABLE_CHANNELID, C_TASK_FILTER, C_TASK_MESSAGES, C_TASK_MESSAGES_ACCEPTED, C_TASK_MESSAGES_COMPLETED, C_TASK_MESSAGES_FORWARDED, C_TASK_MESSAGES_MEMBERS, C_TASK_ORDER_BY_DATE, C_TASK_ORDER_BY_NAME, C_TASK_PRIORITY_HIGH, C_TASK_PRIORITY_LOW, C_TASK_PRIORITY_NORMAL, C_TASK_STATE_ENDED, C_TASK_STATE_HALTED, C_TASK_STATE_NOTENDED, C_TASK_STATE_PREPARE, C_TASK_STATE_START, C_TASK_STATE_STARTED, C_TASK_VIEW_ALL, C_TASKLOG_SYSTEM, C_TASKLOG_USER, C_TASKORDER_NONE, C_TASKORDER_STARTDATE, C_TASKORDER_TIMEOUT, C_TASKS_ACTIVE, C_TASKS_ALL, C_TASKS_DONE, C_TASKS_NEW, C_TASKS_OPEN, C_TASKSORDER_TASKNAME, C_TEMP_PREFIX, C_TFACCESS, C_TFGROUP, C_TFILEOBJ, C_TFILES, C_TFNAME, C_TFPROPERTYINFO, C_TFPROPERTYNAME, C_TFPROPERTYTYPE, C_TFPROPERTYVALUE, C_TFTYPE, C_TFTYPENAME, C_TFUSER, C_TGDESC, C_TGFLAG, C_TGNAME, C_TGPARENTGROUP, C_TGROUPOBJ, C_TGROUPS, C_TGROUPUSERS, C_TGUSER, C_TUADDINFO, C_TUDESC, C_TUDGROUP, C_TUDISABLED, C_TUEMAIL, C_TUFIRSTNAME, C_TUFLAG, C_TUGROUP, C_TUINFOKEY, C_TUINFOVALUE, C_TULOGIN, C_TUNAME, C_TUPASSWD, C_TUSERGROUPS, C_TUSEROBJ, C_TUSERS, C_TYPE_BODY_NAME, C_TYPE_COMPATIBLEPLAIN_NAME, C_TYPE_FOLDER, C_TYPE_FOLDER_NAME, C_TYPE_IMAGE_NAME, C_TYPE_LAST_INDEX, C_TYPE_PAGE_NAME, C_TYPE_PLAIN_NAME, C_UNKNOWN_ID, C_UNKNOWN_INT, C_UNKNOWN_LAUNCHER, C_UNKNOWN_LAUNCHER_ID, C_UNKNOWN_LONG, C_URL_PREFIX_EXPORT, C_URL_PREFIX_HTTP, C_URL_PREFIX_HTTPS, C_URL_PREFIX_SERVERNAME, C_USER, C_USER_ADMIN, C_USER_GUEST, C_USER_TYPE_SYSTEMANDWEBUSER, C_USER_TYPE_SYSTEMUSER, C_USER_TYPE_WEBUSER, C_WEB_APP_REPLACE_KEY, C_WEEKS_HISTORY, C_WHATEVER, C_XML_BODY_ELEMENT
 
Fields inherited from interface com.opencms.boot.I_CmsLogChannels
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING
 
Constructor Summary
OpenCms(source.org.apache.java.util.Configurations conf)
          Constructor to create a new OpenCms object.
 
Method Summary
private  void createDynamicLinkRules()
          Creates the dynamic linkrules.
 void destroy()
          Destructor, called when the the servlet is shut down.
 com.opencms.flex.util.CmsResourceTranslator getFileTranslator()
          Returns the file name translator this OpenCms has read from the opencms.properties.
 com.opencms.launcher.CmsLauncherManager getLauncherManager()
          Returns the launcher manager used.
static com.opencms.template.cache.CmsElementCache getOnlineElementCache()
          Returns the ElementCache used for the online project.
static java.lang.String getPasswordValidatingClass()
          Returns the Class that is used for the password validation.
static CmsStaticExportProperties getStaticExportProperties()
          Returns the properties for the static export.
static java.util.Hashtable getVariantDependencies()
          Returns the hashtable with the variant dependencies used for the elementcache.
(package private)  com.opencms.file.CmsFile initResource(com.opencms.file.CmsObject cms)
          This method reads the requested document from the OpenCms request context and returns it to the calling module, which will usually be the running OpenCmsHttpServlet.
(package private)  void initStartupClasses(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Initialize the startup classes of this OpenCms object.
 void initUser(com.opencms.file.CmsObject cms, I_CmsRequest cmsReq, I_CmsResponse cmsRes, java.lang.String user, java.lang.String group, int project, CmsCoreSession sessionStorage)
          Inits a user and updates the given CmsObject withs this users information.
(package private)  java.util.Hashtable restoreSession(java.lang.String oldSessionId)
          This method loads old sessiondata from the database.
(package private)  void setResponse(com.opencms.file.CmsObject cms, com.opencms.file.CmsFile file)
          Sets the mimetype of the response.
 void showResource(com.opencms.file.CmsObject cms, com.opencms.file.CmsFile file)
          Selects the appropriate launcher for a given file by analyzing the file's launcher id and calls the initlaunch() method to initiate the generating of the output.
(package private)  void startScheduleJob(CmsCronEntry entry)
          Starts a schedule job with a correct instantiated CmsObject.
(package private)  void storeSession(java.lang.String sessionId, java.util.Hashtable sessionData)
          This method stores sessiondata into the database.
(package private)  void updateCronTable()
          Reads the actual entries from the database and updates the Crontable
 
Methods inherited from class com.opencms.core.A_OpenCms
addCmsEventListener, fireCmsEvent, fireCmsEvent, getConfiguration, getDefaultEncoding, getLogFileName, getOpenCmsContext, getRegistry, getRuntimeProperty, getRuntimePropertyMap, getUserDefaultAccessFlags, getUserDefaultLanguage, getVersionName, getVersionNumber, initializeServletLogging, initVersion, isLogging, isLogging, log, removeCmsEventListener, setConfiguration, setDefaultEncoding, setOpenCmsContext, setRuntimeProperty, setUserDefaultAccessFlags, setUserDefaultLanguage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C_DEFAULT_MIMETYPE

private static final java.lang.String C_DEFAULT_MIMETYPE
The default mimetype

See Also:
Constant Field Values

m_scheduler

private CmsCronScheduler m_scheduler
The cron scheduler to schedule the cronjobs


m_table

private CmsCronTable m_table
The cron table to use with the scheduler


m_launcherManager

private com.opencms.launcher.CmsLauncherManager m_launcherManager
Reference to the OpenCms launcer manager


m_mt

private java.util.Hashtable m_mt
Hashtable with all available Mimetypes.


m_sessionFailover

private boolean m_sessionFailover
Indicates, if the session-failover should be enabled or not


m_streaming

private boolean m_streaming
Indicates, if the streaming should be enabled by the configurations.


c_passwordValidatingClass

private static java.lang.String c_passwordValidatingClass
The name of the class used to validate a new password


m_enableElementCache

private boolean m_enableElementCache
Indicates, if the element cache should be enabled by the configurations


c_elementCache

private static com.opencms.template.cache.CmsElementCache c_elementCache
Reference to the CmsElementCache object containing locators for all URIs and elements in cache


c_exportProperties

private static CmsStaticExportProperties c_exportProperties
The object to store the properties from the opencms.property file for the static export


c_variantDeps

private static java.util.Hashtable c_variantDeps
In this hashtable the dependencies for all variants in the elementcache are stored. The keys are Strings with resourceNames like "/siteX/cos/ContentClass/news4" and the value is a Vector with strings (The elementvariants that depend on the keys) like "ElementClass|ElementTemplate|VariantCacheKey"


m_directoryTranslator

private static com.opencms.flex.util.CmsResourceTranslator m_directoryTranslator
Directory translator, used to translate all access to resources


m_fileTranslator

private static com.opencms.flex.util.CmsResourceTranslator m_fileTranslator
Filename translator, used only for the creation of new files


m_defaultFilenames

private static java.lang.String[] m_defaultFilenames
List of default file names (for directories, e.g, "index.html")


m_isInitialized

private boolean m_isInitialized
Flag to indicate if the startup classes have already been initialized


m_checkFile

private java.util.List m_checkFile
Member variable to store instances to modify resources

Constructor Detail

OpenCms

public OpenCms(source.org.apache.java.util.Configurations conf)
        throws java.lang.Exception
Constructor to create a new OpenCms object.

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.

Method Detail

createDynamicLinkRules

private void createDynamicLinkRules()
Creates the dynamic linkrules. The CmsStaticExport class needs a CmsObject to create them.


initStartupClasses

void initStartupClasses(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse res)
                  throws CmsException
Initialize the startup classes of this OpenCms object.

A startup class has to be configured in the registry.xml file of OpenCms. Startup classes are a way to create plug-in functions that required to be initialized once at OpenCms load time without the need to add initializing code to the constructor of this class.

This must be done only once per running OpenCms object instance. Usually this will be done by the OpenCms servlet.


destroy

public void destroy()
             throws CmsException
Destructor, called when the the servlet is shut down.

Specified by:
destroy in class A_OpenCms

getLauncherManager

public com.opencms.launcher.CmsLauncherManager getLauncherManager()
Returns the launcher manager used.


getOnlineElementCache

public static com.opencms.template.cache.CmsElementCache getOnlineElementCache()
Returns the ElementCache used for the online project.


getPasswordValidatingClass

public static java.lang.String getPasswordValidatingClass()
Returns the Class that is used for the password validation.


getStaticExportProperties

public static CmsStaticExportProperties getStaticExportProperties()
Returns the properties for the static export.


getVariantDependencies

public static java.util.Hashtable getVariantDependencies()
Returns the hashtable with the variant dependencies used for the elementcache.


getFileTranslator

public com.opencms.flex.util.CmsResourceTranslator getFileTranslator()
Returns the file name translator this OpenCms has read from the opencms.properties.


initResource

com.opencms.file.CmsFile initResource(com.opencms.file.CmsObject cms)
                                throws CmsException
This method reads the requested document from the OpenCms request context and returns it to the calling module, which will usually be the running OpenCmsHttpServlet.

In case a directory name is requested, the default files of the directory will be looked up and the first match is returned.


initUser

public void initUser(com.opencms.file.CmsObject cms,
                     I_CmsRequest cmsReq,
                     I_CmsResponse cmsRes,
                     java.lang.String user,
                     java.lang.String group,
                     int project,
                     CmsCoreSession sessionStorage)
              throws CmsException
Inits a user and updates the given CmsObject withs this users information.


setResponse

void setResponse(com.opencms.file.CmsObject cms,
                 com.opencms.file.CmsFile file)
Sets the mimetype of the response.

The mimetype is selected by the file extension of the requested document. If no available mimetype is found, it is set to the default "application/octet-stream".

Specified by:
setResponse in class A_OpenCms

showResource

public void showResource(com.opencms.file.CmsObject cms,
                         com.opencms.file.CmsFile file)
                  throws CmsException
Selects the appropriate launcher for a given file by analyzing the file's launcher id and calls the initlaunch() method to initiate the generating of the output.

Specified by:
showResource in class A_OpenCms

restoreSession

java.util.Hashtable restoreSession(java.lang.String oldSessionId)
                             throws CmsException
This method loads old sessiondata from the database. It is used for session failover.

Specified by:
restoreSession in class A_OpenCms

storeSession

void storeSession(java.lang.String sessionId,
                  java.util.Hashtable sessionData)
            throws CmsException
This method stores sessiondata into the database. It is used for session failover.

Specified by:
storeSession in class A_OpenCms

startScheduleJob

void startScheduleJob(CmsCronEntry entry)
Starts a schedule job with a correct instantiated CmsObject.

Specified by:
startScheduleJob in class A_OpenCms

updateCronTable

void updateCronTable()
Reads the actual entries from the database and updates the Crontable

Specified by:
updateCronTable in class A_OpenCms