Java Doc for OpenCms.java in  » Content-Management-System » opencms » org » opencms » main » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » opencms » org.opencms.main 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.opencms.main.OpenCms

OpenCms
final public class OpenCms (Code)
The OpenCms "operating system" that provides public static methods which can be used by other classes to access basic system features of OpenCms like logging etc.

This Object provides singleton access to the initialized OpenCms runtime system. Some methods are for internal or advanced use only, but others are of also of interest for general OpenCms development.

For example, to generate a new instance of org.opencms.file.CmsObject class in your application, use org.opencms.main.OpenCms.initCmsObject(String) . The argument String should be the name of the guest user, usually "Guest" and more formally obtained by org.opencms.db.CmsDefaultUsers.getUserGuest . This will give you an initialized context with guest user permissions. Then use CmsObject.loginUser(StringString) to log in the user you want. Obviously you need the password for the new user.

Using OpenCms.getSiteManager() you can obtain the initialized org.opencms.site.CmsSiteManagerImpl which provides information about the sites configured in the running OpenCms instance.

The org.opencms.db.CmsDefaultUsers instance returned by OpenCms.getDefaultUsers() provides information about the names of the OpenCms default users.

Other objects of note that can be obtained by this class include the org.opencms.module.CmsModuleManager or the org.opencms.scheduler.CmsScheduleManager .

When using the instances returned by this object, keep in mind that applying changes to these may alter the basic OpenCms system configuration, which in turn may affect the systems performance or stability.


author:
   Alexander Kandzior
version:
   $Revision: 1.66 $
since:
   6.0.0



Field Summary
final public static  intRUNLEVEL_0_OFFLINE
     Runlevel 0: System is offline.
final public static  intRUNLEVEL_1_CORE_OBJECT
     Runlevel 1: Core object created, no database (some test cases run in this level).
final public static  intRUNLEVEL_2_INITIALIZING
     Runlevel 2: Initializing the system, required since this may take some seconds because of database connections.
final public static  intRUNLEVEL_3_SHELL_ACCESS
     Runlevel 3: Shell access to the database possible, but no servlet context available.
final public static  intRUNLEVEL_4_SERVLET_ACCESS
     Runlevel 4: Final runlevel where database and servlet are initialized.


Method Summary
public static  voidaddCmsEventListener(I_CmsEventListener listener)
    
public static  voidaddCmsEventListener(I_CmsEventListener listener, int[] eventTypes)
    
public static  voidfireCmsEvent(CmsEvent event)
    
public static  voidfireCmsEvent(int type, Map data)
    
public static  I_CmsAuthorizationHandlergetAuthorizationHandler()
    
public static  ListgetDefaultFiles()
    
public static  CmsDefaultUsersgetDefaultUsers()
    
public static  CmsEventManagergetEventManager()
    
public static  SetgetExportPoints()
    
public static  CmsImportExportManagergetImportExportManager()
    
public static  CmsLinkManagergetLinkManager()
    
public static  CmsLocaleManagergetLocaleManager()
    
public static  LoggetLog(Object obj)
     Returns the log for the selected object.

If the provided object is a String, this String will be used as channel name.

public static  CmsLoginManagergetLoginManager()
    
public static  CmsMemoryMonitorgetMemoryMonitor()
    
public static  CmsModuleManagergetModuleManager()
    
public static  CmsOrgUnitManagergetOrgUnitManager()
    
public static  I_CmsPasswordHandlergetPasswordHandler()
    
public static  CmsPublishManagergetPublishManager()
    
public static  CmsRepositoryManagergetRepositoryManager()
    
public static  CmsResourceManagergetResourceManager()
    
public static  CmsRoleManagergetRoleManager()
    
public static  intgetRunLevel()
     Returns the current OpenCms run level.

The following runlevels are defined:

Runlevel OpenCms.RUNLEVEL_0_OFFLINE :
OpenCms is in the process of being shut down, the system is offline.
Runlevel OpenCms.RUNLEVEL_1_CORE_OBJECT :
OpenCms instance available, but configuration has not been processed.
public static  ObjectgetRuntimeProperty(Object key)
    
public static  CmsScheduleManagergetScheduleManager()
    
public static  CmsSearchManagergetSearchManager()
    
public static  CmsSessionManagergetSessionManager()
    
public static  CmsSiteManagerImplgetSiteManager()
    
public static  CmsSqlManagergetSqlManager()
    
public static  CmsStaticExportManagergetStaticExportManager()
    
public static  CmsSystemInfogetSystemInfo()
    
public static  ListgetSystemRoles()
    
public static  CmsThreadStoregetThreadStore()
    
public static  I_CmsValidationHandlergetValidationHandler()
    
public static  CmsWorkplaceManagergetWorkplaceManager()
    
public static  CmsXmlContentTypeManagergetXmlContentTypeManager()
    
public static  CmsObjectinitCmsObject(CmsObject cms)
     Returns an independent copy of the provided CmsObject.

This can be useful in case a permanent reference to a CmsObject is stored.

public static  CmsObjectinitCmsObject(CmsObject adminCms, CmsContextInfo contextInfo)
     Returns an initialized CmsObject with the user and context initialized as provided.

Note: Only if the provided adminCms CmsObject has admin permissions, this method allows the creation a CmsObject for any existing user.

public static  CmsObjectinitCmsObject(String user)
     Returns an initialized CmsObject (OpenCms user context) with the user initialized as provided, with the "Online" project selected and "/" set as the current site root.

Note: Only the default users 'Guest' and 'Export' can initialized with this method, all other user names will throw an Exception.

In order to initialize another user (for example, the CmsDefaultUsers.getUserAdmin ), you need to get the 'Guest' user context first, then login the target user with his user name and password, using CmsObject.loginUser(StringString) . There is no way to obtain a user context other then the 'Guest' or 'Export' user without the users password.

public static  CmsResourceinitResource(CmsObject cms, String resourceName, HttpServletRequest req, HttpServletResponse res)
     Reads the requested resource from the OpenCms VFS, and in case a directory name is requested, the default files of the directory will be looked up and the first match is returned.

The resource that is returned is always a org.opencms.file.CmsFile , even though the content will usually not be loaded in the result.

public static  voidremoveCmsEventListener(I_CmsEventListener listener)
    
public static  voidsetRuntimeProperty(Object key, Object value)
     This method adds an Object to the OpenCms runtime properties.
public static  voidwriteConfiguration(Class clazz)
    

Field Detail
RUNLEVEL_0_OFFLINE
final public static int RUNLEVEL_0_OFFLINE(Code)
Runlevel 0: System is offline.



RUNLEVEL_1_CORE_OBJECT
final public static int RUNLEVEL_1_CORE_OBJECT(Code)
Runlevel 1: Core object created, no database (some test cases run in this level).



RUNLEVEL_2_INITIALIZING
final public static int RUNLEVEL_2_INITIALIZING(Code)
Runlevel 2: Initializing the system, required since this may take some seconds because of database connections.



RUNLEVEL_3_SHELL_ACCESS
final public static int RUNLEVEL_3_SHELL_ACCESS(Code)
Runlevel 3: Shell access to the database possible, but no servlet context available.



RUNLEVEL_4_SERVLET_ACCESS
final public static int RUNLEVEL_4_SERVLET_ACCESS(Code)
Runlevel 4: Final runlevel where database and servlet are initialized.





Method Detail
addCmsEventListener
public static void addCmsEventListener(I_CmsEventListener listener)(Code)
Add a cms event listener that listens to all events.


Parameters:
  listener - the listener to add




addCmsEventListener
public static void addCmsEventListener(I_CmsEventListener listener, int[] eventTypes)(Code)
Add a cms event listener that listens only to particular events.


Parameters:
  listener - the listener to add
Parameters:
  eventTypes - the events to listen for




fireCmsEvent
public static void fireCmsEvent(CmsEvent event)(Code)
Notify all event listeners that a particular event has occurred.


Parameters:
  event - a CmsEvent




fireCmsEvent
public static void fireCmsEvent(int type, Map data)(Code)
Notify all event listeners that a particular event has occurred.

The event will be given to all registered I_CmsEventListener objects.


Parameters:
  type - event type
Parameters:
  data - event data




getAuthorizationHandler
public static I_CmsAuthorizationHandler getAuthorizationHandler()(Code)
Returns the configured authorization handler.

the configured authorization handler




getDefaultFiles
public static List getDefaultFiles()(Code)
Returns the configured list of default directory file names (instances of String ).

Caution: This list can not be modified.

the configured list of default directory file names




getDefaultUsers
public static CmsDefaultUsers getDefaultUsers()(Code)
Returns the default user and group name configuration.

the default user and group name configuration




getEventManager
public static CmsEventManager getEventManager()(Code)
Returns the event manger that handles all OpenCms events.

the event manger that handles all OpenCms events




getExportPoints
public static Set getExportPoints()(Code)
Returns the configured export points, the returned set being an unmodifiable set.

an unmodifiable set of the configured export points




getImportExportManager
public static CmsImportExportManager getImportExportManager()(Code)
Returns the initialized import/export manager, which contains information about how to handle imported resources.

the initialized import/export manager




getLinkManager
public static CmsLinkManager getLinkManager()(Code)
Returns the link manager to resolve links in <link> tags.

the link manager to resolve links in <link> tags




getLocaleManager
public static CmsLocaleManager getLocaleManager()(Code)
Returns the locale manager used for obtaining the current locale.

the locale manager




getLog
public static Log getLog(Object obj)(Code)
Returns the log for the selected object.

If the provided object is a String, this String will be used as channel name. Otherwise the objects class name will be used as channel name.


Parameters:
  obj - the object channel to use the log for the selected object channel




getLoginManager
public static CmsLoginManager getLoginManager()(Code)
Returns the login manager used to check if a login is possible.

the login manager




getMemoryMonitor
public static CmsMemoryMonitor getMemoryMonitor()(Code)
Returns the memory monitor.

the memory monitor




getModuleManager
public static CmsModuleManager getModuleManager()(Code)
Returns the module manager.

the module manager




getOrgUnitManager
public static CmsOrgUnitManager getOrgUnitManager()(Code)
Returns the organizational unit manager.

the organizational unit manager




getPasswordHandler
public static I_CmsPasswordHandler getPasswordHandler()(Code)
Returns the password handler.

the password handler




getPublishManager
public static CmsPublishManager getPublishManager()(Code)
Returns the core publish manager class.

the publish manager instance




getRepositoryManager
public static CmsRepositoryManager getRepositoryManager()(Code)
Returns the repository manager.

the repository manager




getResourceManager
public static CmsResourceManager getResourceManager()(Code)
Returns the resource manager.

the resource manager




getRoleManager
public static CmsRoleManager getRoleManager()(Code)
Returns the role manager.

the role manager




getRunLevel
public static int getRunLevel()(Code)
Returns the current OpenCms run level.

The following runlevels are defined:

Runlevel OpenCms.RUNLEVEL_0_OFFLINE :
OpenCms is in the process of being shut down, the system is offline.
Runlevel OpenCms.RUNLEVEL_1_CORE_OBJECT :
OpenCms instance available, but configuration has not been processed. No database or VFS available.
Runlevel OpenCms.RUNLEVEL_2_INITIALIZING :
OpenCms is initializing, but the process is not finished. The database with the VFS is currently being connected but can't be accessed.
Runlevel OpenCms.RUNLEVEL_3_SHELL_ACCESS :
OpenCms database and VFS available, but http processing (i.e. servlet) not initialized. This is the runlevel the OpenCms shell operates in.
Runlevel OpenCms.RUNLEVEL_4_SERVLET_ACCESS :
OpenCms fully initialized, servlet and database available. This is the "default" when OpenCms is in normal operation.
the OpenCms run level



getRuntimeProperty
public static Object getRuntimeProperty(Object key)(Code)
Looks up a value in the runtime property Map.


Parameters:
  key - the key to look up in the runtime properties the value for the key, or null if the key was not found




getScheduleManager
public static CmsScheduleManager getScheduleManager()(Code)
Returns the configured schedule manager.

the configured schedule manager




getSearchManager
public static CmsSearchManager getSearchManager()(Code)
Returns the initialized search manager, which provides indexing and searching operations.

the initialized search manager




getSessionManager
public static CmsSessionManager getSessionManager()(Code)
Returns the session manager that keeps track of the active users.

the session manager that keeps track of the active users




getSiteManager
public static CmsSiteManagerImpl getSiteManager()(Code)
Returns the initialized site manager, which contains information about all configured sites.

the initialized site manager




getSqlManager
public static CmsSqlManager getSqlManager()(Code)
Returns an instance of the common sql manager.

an instance of the common sql manager




getStaticExportManager
public static CmsStaticExportManager getStaticExportManager()(Code)
Returns the properties for the static export.

the properties for the static export




getSystemInfo
public static CmsSystemInfo getSystemInfo()(Code)
Returns the system information storage.

the system information storage




getSystemRoles
public static List getSystemRoles()(Code)
Returns the list of system defined roles (instances of CmsRole ).

Caution: This list can not be modified.

the list of system defined roles




getThreadStore
public static CmsThreadStore getThreadStore()(Code)
Returns the OpenCms Thread store.

the OpenCms Thread store




getValidationHandler
public static I_CmsValidationHandler getValidationHandler()(Code)
Returns the runtime validation handler.

the validation handler




getWorkplaceManager
public static CmsWorkplaceManager getWorkplaceManager()(Code)
Returns the initialized workplace manager, which contains information about the global workplace settings.

the initialized workplace manager




getXmlContentTypeManager
public static CmsXmlContentTypeManager getXmlContentTypeManager()(Code)
Returns the XML content type manager.

the XML content type manager




initCmsObject
public static CmsObject initCmsObject(CmsObject cms) throws CmsException(Code)
Returns an independent copy of the provided CmsObject.

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.


Parameters:
  cms - the CmsObject to create a copy of an independent copy of the provided CmsObject
throws:
  CmsException - in case the intialization failed
See Also:   OpenCms.initCmsObject(CmsObject)
See Also:   OpenCms.initCmsObject(CmsObjectCmsContextInfo)
See Also:   OpenCms.initCmsObject(String)




initCmsObject
public static CmsObject initCmsObject(CmsObject adminCms, CmsContextInfo contextInfo) throws CmsException(Code)
Returns an initialized CmsObject with the user and context initialized as provided.

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.


Parameters:
  adminCms - must either be initialized with "Admin" permissions, or null
Parameters:
  contextInfo - the context info to create a CmsObject for an initialized CmsObject with the given users permissions
throws:
  CmsException - if an invalid user name was provided, or if something else goes wrong
See Also:   org.opencms.db.CmsDefaultUsers.getUserGuest
See Also:   org.opencms.db.CmsDefaultUsers.getUserExport
See Also:   OpenCms.initCmsObject(CmsObject)
See Also:   OpenCms.initCmsObject(CmsObjectCmsContextInfo)
See Also:   OpenCms.initCmsObject(String)




initCmsObject
public static CmsObject initCmsObject(String user) throws CmsException(Code)
Returns an initialized CmsObject (OpenCms user context) with the user initialized as provided, with the "Online" project selected and "/" set as the current site root.

Note: Only the default users 'Guest' and 'Export' can initialized with this method, all other user names will throw an Exception.

In order to initialize another user (for example, the CmsDefaultUsers.getUserAdmin ), you need to get the 'Guest' user context first, then login the target user with his user name and password, using CmsObject.loginUser(StringString) . There is no way to obtain a user context other then the 'Guest' or 'Export' user without the users password. This is a security feature.


Parameters:
  user - the user name to initialize, can only be org.opencms.db.CmsDefaultUsers.getUserGuest ororg.opencms.db.CmsDefaultUsers.getUserExport an initialized CmsObject with the given users permissions
throws:
  CmsException - if an invalid user name was provided, or if something else goes wrong
See Also:   org.opencms.db.CmsDefaultUsers.getUserGuest
See Also:   org.opencms.db.CmsDefaultUsers.getUserExport
See Also:   OpenCms.initCmsObject(CmsObject)
See Also:   OpenCms.initCmsObject(CmsObjectCmsContextInfo)
See Also:   OpenCms.initCmsObject(String)




initResource
public static CmsResource initResource(CmsObject cms, String resourceName, HttpServletRequest req, HttpServletResponse res) throws CmsException(Code)
Reads the requested resource from the OpenCms VFS, and in case a directory name is requested, the default files of the directory will be looked up and the first match is returned.

The resource that is returned is always a org.opencms.file.CmsFile , 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.

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 I_CmsResourceInit handler allows to customize the process of default resource selection.


Parameters:
  cms - the current users OpenCms context
Parameters:
  resourceName - the path of the requested resource in the OpenCms VFS
Parameters:
  req - the current http request
Parameters:
  res - the current http response the requested resource read from the VFS
throws:
  CmsException - in case the requested file does not exist or the user has insufficient access permissions




removeCmsEventListener
public static void removeCmsEventListener(I_CmsEventListener listener)(Code)
Removes a cms event listener.


Parameters:
  listener - the listener to remove




setRuntimeProperty
public static void setRuntimeProperty(Object key, Object value)(Code)
This method adds an Object to the OpenCms runtime properties. The runtime properties can be used to store Objects that are shared in the whole system.


Parameters:
  key - the key to add the Object with
Parameters:
  value - the value of the Object to add




writeConfiguration
public static void writeConfiguration(Class clazz)(Code)
Writes the XML configuration for the provided configuration class.


Parameters:
  clazz - the configuration class to write the XML for




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.