📄 a_opencms.java
字号:
*/
public static Object getRuntimeProperty(Object key) {
if (m_runtimeProperties == null) return null;
return m_runtimeProperties.get(key);
}
/** This method returns the complete runtime property Map.
*
* @since FLEX alpha 1
* @return The Map of runtime properties.
*/
public Map getRuntimePropertyMap() {
return m_runtimeProperties;
}
/** This method sets the runtime configuration.
*
* @since FLEX alpha 1
*/
public void setConfiguration(Configurations conf) {
m_conf = conf;
}
/** This method returns the runtime configuration.
*
* @since FLEX alpha 1
* @return The runtime configuration.
*/
public Configurations getConfiguration() {
return m_conf;
}
/**
* 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.
*
* @since FLEX alpha 1
* @param cms An initialized CmsObject
* @param type Event type
* @param data Event data
*/
public static void fireCmsEvent(CmsObject cms, int type, java.util.Map data) {
OpenCms.fireCmsEvent( new CmsEvent(cms, type, 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.
*
* @since FLEX beta 1
* @param cms An initialized CmsObject
* @param event A CmsEvent
*/
public static void fireCmsEvent(CmsEvent event) {
if (m_listeners.size() < 1)
return;
I_CmsEventListener list[] = new I_CmsEventListener[0];
synchronized (m_listeners) {
list = (I_CmsEventListener[]) m_listeners.toArray(list);
}
for (int i = 0; i < list.length; i++)
((I_CmsEventListener) list[i]).cmsEvent(event);
}
/**
* Add a cms event listener.
*
* @since FLEX alpha 1
* @param listener The listener to add
*/
public static void addCmsEventListener(I_CmsEventListener listener) {
synchronized (m_listeners) {
m_listeners.add(listener);
}
}
/**
* Remove a cms event listener.
*
* @since FLEX alpha 1
* @param listener The listener to add
*/
public static void removeCmsEventListener(I_CmsEventListener listener) {
synchronized (m_listeners) {
m_listeners.remove(listener);
}
}
/**
* 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".
*
* @return The default encoding (e.g. "UTF-8" or "ISO-8859-1")
*/
public static String getDefaultEncoding() {
return m_defaultEncoding;
}
/**
* Sets the default encoding to the value specified.
*
* @param encoding The value to set, e.g. "UTF-8" or "ISO-8859-1".
*/
protected void setDefaultEncoding(String encoding) {
m_defaultEncoding = encoding;
}
/**
* Returns a String containing the version information (version name and version number)
* of this OpenCms system.<p>
*
* @return version a String containnig the version information
*/
public static String getVersionName() {
return m_versionName;
}
/**
* Returns a String containing the version number
* of this OpenCms system.<p>
*
* @return version a String containnig the version number
*/
public static String getVersionNumber() {
return m_versionNumber;
}
/**
* Initializes the version for this OpenCms, will be called by
* CmsHttpServlet or CmsShell upon system startup.<p>
*
* @param o instance of calling object
*/
static void initVersion(Object o) {
// read the version-informations from properties, if not done
Properties props = new Properties();
try {
props.load(o.getClass().getClassLoader().getResourceAsStream("com/opencms/core/version.properties"));
} catch(java.io.IOException exc) {
// ignore this exception - no properties found
m_versionName = "unknown";
return;
}
m_versionNumber = props.getProperty("version.number", "5.x");
m_versionName = m_versionNumber + " " + props.getProperty("version.name", "??");
}
/**
* Sets the OpenCms request context.<p>
*
* @param value the OpenCms request context
*/
protected static void setOpenCmsContext(String value) {
if ((value != null) && (value.startsWith("/ROOT"))) {
value = value.substring("/ROOT".length());
}
m_openCmsContext = value;
}
/**
* Returns the OpenCms request context.<p>
*
* @return String the OpenCms request context
*/
public static String getOpenCmsContext() {
if (m_openCmsContext == null) {
throw new RuntimeException ("OpenCmsContext not initialised!");
}
return m_openCmsContext;
}
/**
* Returns the value of the user default language.<p>
*
* @return the value of the user default language
*/
public static String getUserDefaultLanguage() {
return m_userDefaultLanguage;
}
/**
* Sets the value of the user default language.<p>
*
* @param language the new value of the user default language
*/
protected static void setUserDefaultLanguage(String language) {
m_userDefaultLanguage = language;
}
/**
* Returns the value for the default user access flags.<p>
*
* @return the value for the default user access flags
*/
public static int getUserDefaultAccessFlags() {
return m_userDefaultaccessFlags;
}
/**
* Seats the value of the user default access flags.
*
* @param flags the new value of the user default access flags
*/
protected static void setUserDefaultAccessFlags(int flags) {
m_userDefaultaccessFlags = flags;
}
/**
* Returns the registry to read values from it.<p>
*
* You don't have the permissions to write values.
* This is useful for modules to read module-parameters.
*
* @return The registry to READ values from it.
*
* @throws CmsException, if the registry can not be returned.
*/
public static I_CmsRegistry getRegistry() throws CmsException {
if (m_resourceBroker == null) return null;
return m_resourceBroker.getRegistry(null, null, null);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -