com.opencms.core
Class A_OpenCms

java.lang.Object
  |
  +--com.opencms.core.A_OpenCms
All Implemented Interfaces:
I_CmsLogChannels
Direct Known Subclasses:
OpenCms

public abstract class A_OpenCms
extends Object
implements I_CmsLogChannels

Abstract class for the OpenCms "operating system" that provides public static methods which can be used by other classes to access basic features of OpenCms like logging etc.

Version:
$Revision: 1.35 $ $Date: 2003/04/10 15:54:53 $
Author:
Alexander Lucas, Michael Emmerich, Alexander Kandzior (a.kandzior@alkacon.com)
See Also:
OpenCms

Field Summary
protected static I_CmsResourceBroker m_resourceBroker
          The resource-broker to access the database
 
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
A_OpenCms()
           
 
Method Summary
static void addCmsEventListener(I_CmsEventListener listener)
          Add a cms event listener.
static void fireCmsEvent(CmsEvent event)
          Notify all container event listeners that a particular event has occurred for this Container.
static void fireCmsEvent(CmsObject cms, int type, Map data)
          Notify all container event listeners that a particular event has occurred for this Container.
 source.org.apache.java.util.Configurations getConfiguration()
          This method returns the runtime configuration.
static String getDefaultEncoding()
          Return the OpenCms default character encoding.
static String getLogFileName()
          Returns the filename of the logfile.
static String getOpenCmsContext()
          Returns the OpenCms request context.
static I_CmsRegistry getRegistry()
          Returns the registry to read values from it.
static Object getRuntimeProperty(Object key)
          This method looks up a value in the runtime property Map.
 Map getRuntimePropertyMap()
          This method returns the complete runtime property Map.
static int getUserDefaultAccessFlags()
          Returns the value for the default user access flags.
static String getUserDefaultLanguage()
          Returns the value of the user default language.
static String getVersionName()
          Returns a String containing the version information (version name and version number) of this OpenCms system.
static String getVersionNumber()
          Returns a String containing the version number of this OpenCms system.
static void initializeServletLogging(source.org.apache.java.util.Configurations config)
          Initializes the logging mechanism of OpenCms.
static boolean isLogging()
          Checks if the system logging is active.
static boolean isLogging(String channel)
          Checks if the system logging is active for the selected channel.
static void log(String channel, String message)
          Logs a message into the OpenCms logfile.
static void removeCmsEventListener(I_CmsEventListener listener)
          Remove a cms event listener.
 void setConfiguration(source.org.apache.java.util.Configurations conf)
          This method sets the runtime configuration.
protected  void setDefaultEncoding(String encoding)
          Sets the default encoding to the value specified.
protected static void setOpenCmsContext(String value)
          Sets the OpenCms request context.
 void setRuntimeProperty(Object key, Object value)
          This method adds an Object to the OpenCms runtime properties.
protected static void setUserDefaultAccessFlags(int flags)
          Seats the value of the user default access flags.
protected static void setUserDefaultLanguage(String language)
          Sets the value of the user default language.
abstract  void showResource(CmsObject cms, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_resourceBroker

protected static I_CmsResourceBroker m_resourceBroker
The resource-broker to access the database

Constructor Detail

A_OpenCms

public A_OpenCms()
Method Detail

initializeServletLogging

public static void initializeServletLogging(source.org.apache.java.util.Configurations config)
Initializes the logging mechanism of OpenCms.

Parameters:
config - The configurations read from opencms.properties

getLogFileName

public static String getLogFileName()
Returns the filename of the logfile.

Returns:
The filename of the logfile.

isLogging

public static boolean isLogging()
Checks if the system logging is active.

Returns:
true if the logging is active, false otherwise.

isLogging

public static boolean isLogging(String channel)
Checks if the system logging is active for the selected channel.

Returns:
true if the logging is active for the channel, false otherwise.

log

public static void log(String channel,
                       String message)
Logs a message into the OpenCms logfile.

If the logfile was not initialized (e.g. due tue a missing ServletConfig while working with the console) any log output will be written to System.err.

Parameters:
channel - The channel the message is logged into
message - The message to be logged.

showResource

public abstract void showResource(CmsObject cms,
                                  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.

Parameters:
cms - CmsObject containing all document and user information
file - CmsFile object representing the selected file.
Throws:
CmsException - In case of problems acessing the resource.

setRuntimeProperty

public void setRuntimeProperty(Object key,
                               Object value)
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.
value - The value of the Object to add.
Since:
FLEX alpha 1

getRuntimeProperty

public static Object getRuntimeProperty(Object key)
This method looks up a value in the runtime property Map.

Parameters:
key - The key to look up in the runtime properties.
Returns:
The value for the key, or null if the key was not found.
Since:
FLEX alpha 1

getRuntimePropertyMap

public Map getRuntimePropertyMap()
This method returns the complete runtime property Map.

Returns:
The Map of runtime properties.
Since:
FLEX alpha 1

setConfiguration

public void setConfiguration(source.org.apache.java.util.Configurations conf)
This method sets the runtime configuration.

Since:
FLEX alpha 1

getConfiguration

public source.org.apache.java.util.Configurations getConfiguration()
This method returns the runtime configuration.

Returns:
The runtime configuration.
Since:
FLEX alpha 1

fireCmsEvent

public static void fireCmsEvent(CmsObject cms,
                                int type,
                                Map data)
Notify all container event listeners that a particular event has occurred for this Container. The default implementation performs this notification synchronously using the calling thread.

Parameters:
cms - An initialized CmsObject
type - Event type
data - Event data
Since:
FLEX alpha 1

fireCmsEvent

public static void fireCmsEvent(CmsEvent event)
Notify all container event listeners that a particular event has occurred for this Container. The default implementation performs this notification synchronously using the calling thread.

Parameters:
event - A CmsEvent
Since:
FLEX beta 1

addCmsEventListener

public static void addCmsEventListener(I_CmsEventListener listener)
Add a cms event listener.

Parameters:
listener - The listener to add
Since:
FLEX alpha 1

removeCmsEventListener

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

Parameters:
listener - The listener to add
Since:
FLEX alpha 1

getDefaultEncoding

public static String getDefaultEncoding()
Return the OpenCms default character encoding. The default is set in the "opencms.properties" file. If this is not set in "opencms.properties" the default is "ISO-8859-1".

Returns:
The default encoding (e.g. "UTF-8" or "ISO-8859-1")

setDefaultEncoding

protected void setDefaultEncoding(String encoding)
Sets the default encoding to the value specified.

Parameters:
encoding - The value to set, e.g. "UTF-8" or "ISO-8859-1".

getVersionName

public static String getVersionName()
Returns a String containing the version information (version name and version number) of this OpenCms system.

Returns:
version a String containnig the version information

getVersionNumber

public static String getVersionNumber()
Returns a String containing the version number of this OpenCms system.

Returns:
version a String containnig the version number

setOpenCmsContext

protected static void setOpenCmsContext(String value)
Sets the OpenCms request context.

Parameters:
value - the OpenCms request context

getOpenCmsContext

public static String getOpenCmsContext()
Returns the OpenCms request context.

Returns:
String the OpenCms request context

getUserDefaultLanguage

public static String getUserDefaultLanguage()
Returns the value of the user default language.

Returns:
the value of the user default language

setUserDefaultLanguage

protected static void setUserDefaultLanguage(String language)
Sets the value of the user default language.

Parameters:
language - the new value of the user default language

getUserDefaultAccessFlags

public static int getUserDefaultAccessFlags()
Returns the value for the default user access flags.

Returns:
the value for the default user access flags

setUserDefaultAccessFlags

protected static void setUserDefaultAccessFlags(int flags)
Seats the value of the user default access flags.

Parameters:
flags - the new value of the user default access flags

getRegistry

public static I_CmsRegistry getRegistry()
                                 throws CmsException
Returns the registry to read values from it.

You don't have the permissions to write values. This is useful for modules to read module-parameters.

Returns:
The registry to READ values from it.
Throws:
CmsException, - if the registry can not be returned.
CmsException