diff --git a/ccm-core/src/main/java/com/arsdigita/dispatcher/DispatcherConfig.java b/ccm-core/src/main/java/com/arsdigita/dispatcher/DispatcherConfig.java new file mode 100755 index 000000000..4c792c827 --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/dispatcher/DispatcherConfig.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.dispatcher; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; +import com.arsdigita.util.parameter.IntegerParameter; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringParameter; +import org.apache.log4j.Logger; + +/** + * @author Randy Graebner + * @version $Id: DispatcherConfig.java 1169 2006-06-14 13:08:25Z fabrice $ + */ +public final class DispatcherConfig extends AbstractConfig { + + private static final Logger s_log = Logger.getLogger(DispatcherConfig.class); + + private final Parameter m_cachingActive; + private final Parameter m_defaultExpiry; + private final Parameter m_staticURLPrefix; + + /** Default top-level container for all Bebop components and containersPage + * to use for dispatching Bebop pages. A custom installation may provide + * it's own implementation. Use with care because all pages inherit from + * this class! + * Default is {@see com.arsdigita.bebop.Page} */ + private final Parameter m_defaultPageClass= new + StringParameter("waf.dispatcher.default_page_class", + Parameter.OPTIONAL, + "com.arsdigita.bebop.Page"); + + public DispatcherConfig() { + m_cachingActive = new BooleanParameter + ("waf.dispatcher.is_caching_active", + Parameter.REQUIRED, Boolean.TRUE); + + // defaults to three days + m_defaultExpiry = new IntegerParameter + ("waf.dispatcher.default_expiry", Parameter.REQUIRED, + new Integer(259200)); + + m_staticURLPrefix = new StringParameter + ("waf.dispatcher.static_url_prefix", Parameter.REQUIRED, + "/STATICII/"); + + register(m_staticURLPrefix); + register(m_cachingActive); + register(m_defaultExpiry); + register(m_defaultPageClass); + + loadInfo(); + } + + /** + * Get the URL for static items + */ + public String getStaticURLPrefix() { + return (String)get(m_staticURLPrefix); + } + + /** + * This returns Boolean.TRUE if the caching is active + */ + public Boolean getCachingActive() { + return (Boolean)get(m_cachingActive); + } + + public boolean isCachingActive() { + return Boolean.TRUE.equals(getCachingActive()); + } + + /** + * This returns the number of seconds something is cached for + */ + public Integer getDefaultExpiryTime() { + return (Integer)get(m_defaultExpiry); + } + + /** + * Retrieve the top-level container for all Bebop components and + * containersPage to use by dispatcher. + * Most installation should use the provided default implementation in + * {@see com.arsdigita.bebop.Page} + */ + public String getDefaultPageClass() { + return (String)get(m_defaultPageClass); + } +} diff --git a/ccm-core/src/main/java/com/arsdigita/formbuilder/FormBuilderConfig.java b/ccm-core/src/main/java/com/arsdigita/formbuilder/FormBuilderConfig.java new file mode 100755 index 000000000..ab2b7f1d9 --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/formbuilder/FormBuilderConfig.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.formbuilder; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringParameter; +import org.apache.log4j.Logger; + + +/** + * @see com.arsdigita.bebop.Bebop + * @author Justin Ross + * @version $Id: FormBuilderConfig.java 1498 2007-03-19 16:22:15Z apevec $ + */ +public final class FormBuilderConfig extends AbstractConfig { + + private static final Logger s_log = Logger.getLogger(FormBuilderConfig.class); + + private final Parameter m_actionsHelp; + private final Parameter m_controlsHelp; + private final BooleanParameter m_interpolateEmailActionsToAddress; + + public FormBuilderConfig() { + m_actionsHelp = new StringParameter + ("waf.formbuilder.actions_help_url", Parameter.REQUIRED, ""); + + m_controlsHelp = new StringParameter + ("waf.formbuilder.controls_help_url", Parameter.REQUIRED, ""); + + m_interpolateEmailActionsToAddress = new BooleanParameter + ("waf.formbuilder.interpolate_email_actions_to_address", + Parameter.OPTIONAL, Boolean.FALSE); + + register(m_actionsHelp); + register(m_controlsHelp); + register(m_interpolateEmailActionsToAddress); + + loadInfo(); + } + + /** + * This returns the string that can be used to create the URL to + * point to the help page. If it starts with "/" then it is + * assumed to be located on this server. If it starts with + * anything else, it is assumed to be a link to a foreign site. + * This can be null if no help link should appear. + * + * NOTE: As of version 6.6 and earlier the help function is not working. + * Returns null to deactivate the help link. + */ + public String getActionsHelpLink() { + // return (String) get(m_actionsHelp); + return null; + } + + /** + * This returns the string that can be used to create the URL to + * point to the help page. + * This can be null is no help link should appear + * + * NOTE: See deactivated help system above. + */ + public String getControlsHelpLink() { + // return (String)get(m_controlsHelp); + return null; + } + + public boolean getInterpolateEmailActionsToAddress() { + return get(m_interpolateEmailActionsToAddress).equals(Boolean.TRUE); + } +} diff --git a/ccm-core/src/main/java/com/arsdigita/globalization/GlobalizationConfig.java b/ccm-core/src/main/java/com/arsdigita/globalization/GlobalizationConfig.java new file mode 100644 index 000000000..0aa468cba --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/globalization/GlobalizationConfig.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.globalization; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.StringParameter; +import com.arsdigita.util.parameter.Parameter; + +import org.apache.log4j.Logger; + + +/** + * A configuration record for configuration of the core globalization package + * + * Accessors of this class may return null. Developers should take care + * to trap null return values in their code. + * + * @author Peter Boy <pboy@barkhof.uni-bremen.de> + * @version $Id: $ + */ +public class GlobalizationConfig extends AbstractConfig { + + /** A logger instance. */ + private static final Logger s_log = Logger.getLogger(GlobalizationConfig.class); + + /** Singelton config object. */ + private static GlobalizationConfig s_conf; + + /** + * Gain a UIConfig object. + * + * Singelton pattern, don't instantiate a lifecacle object using the + * constructor directly! + * @return + */ + public static synchronized GlobalizationConfig getConfig() { + if (s_conf == null) { + s_conf = new GlobalizationConfig(); + s_conf.load(); + } + + return s_conf; + } + + + + /** + * Default character set for locales not explicitly listed above in the + * locales parameter. + * This parameter is read each time the system starts. Therefore, modifications + * will take effect after a CCM restart. + */ + // In OLD initializer: DEFAULT_CHARSET as String + private final Parameter m_defaultCharset = + new StringParameter( + "core.globalization.default_charset", + Parameter.REQUIRED, "UTF-8"); + + + /** + * Constructs an empty RuntimeConfig object. + * + */ + public GlobalizationConfig() { + // pboy: According to the comment for the getConfig() method a singleton + // pattern is to be used. Therefore the constructor should be changed to + // private! + // private GlobalizationConfig() { + register(m_defaultCharset); + + loadInfo(); + + } + + + + /** + * Retrieve the default char set to be used for locales not explicitly + * listed in the supported locales list. + * + * @return root page url + */ + public String getDefaultCharset() { + return (String)get(m_defaultCharset) ; + } + +} diff --git a/ccm-core/src/main/java/com/arsdigita/notification/NotificationConfig.java b/ccm-core/src/main/java/com/arsdigita/notification/NotificationConfig.java new file mode 100644 index 000000000..b184e578c --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/notification/NotificationConfig.java @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2011 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.notification; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.IntegerParameter; +import com.arsdigita.util.parameter.Parameter; + +import org.apache.log4j.Logger; + +/** + * NotificationConfig + * + * @author Peter Boy <pboy@barkhof.uni-bremen.de> + * @version $Id: NotificationConfig.java $ + */ +public class NotificationConfig extends AbstractConfig { + + /** Private Logger instance. */ + private static final Logger s_log = Logger.getLogger(NotificationConfig.class); + + /** Private Object to hold one's own instance to return to users. */ + private static NotificationConfig s_conf; + + /** + * Returns the singleton configuration record for the content section + * environment. + * + * @return The ContentSectionConfig record; it cannot be null + */ + public static synchronized NotificationConfig getInstance() { + if (s_conf == null) { + s_conf = new NotificationConfig(); + s_conf.load(); + } + + return s_conf; + } + + +// ///////////////////////////////////////////////////////////////////////////// +// +// Set of parameters controlling Overdue Task alerts: +// Currently there is no way to persist it nor to persist on a per section base. +// Therefore Initializer has to create overdue task alert mechanism using a +// configuration applied to every content section. +// +// ///////////////////////////////////////////////////////////////////////////// + + + + /** + * Request manager's delay in seconds. + */ + private IntegerParameter m_requestManagerDelay = new IntegerParameter + ("waf.notification.request_manager_delay", Parameter.REQUIRED, + new Integer(900)); + + /** + * Request manager's period in seconds + */ + private IntegerParameter m_requestManagerPeriod = new IntegerParameter + ("waf.notification.request_manager_period", Parameter.REQUIRED, + new Integer(900)); + + /** + * Digest queue's delay in seconds. + */ + private IntegerParameter m_digestQueueDelay = new IntegerParameter + ("waf.notification.digest_queue_delay", Parameter.REQUIRED, + new Integer(900)); + + /** + * Digest queue's period in seconds + */ + private IntegerParameter m_digestQueuePeriod = new IntegerParameter + ("waf.notification.digest_queue_period", Parameter.REQUIRED, + new Integer(900)); + + /** + * Simple queue's delay in seconds. + */ + private IntegerParameter m_simpleQueueDelay = new IntegerParameter + ("waf.notification.simple_queue_delay", Parameter.REQUIRED, + new Integer(900)); + + /** + * Simple queue's period in seconds + */ + private IntegerParameter m_simpleQueuePeriod = new IntegerParameter + ("waf.notification.simple_queue_period", Parameter.REQUIRED, + new Integer(900)); + + /** + * Constructor. + * Do not use it directly! Singleton design pattern! + */ + public NotificationConfig() { + s_log.debug("Executing NotificationConfig Constructor."); + register(m_requestManagerDelay); + register(m_requestManagerPeriod); + register(m_simpleQueueDelay); + register(m_simpleQueuePeriod); + register(m_digestQueueDelay); + register(m_digestQueuePeriod); + s_log.debug("NotificationConfig register executed."); + + s_log.debug("Executing NotificationConfig loadinfo."); + loadInfo(); + s_log.debug("Leaving NotificationConfig Constructor."); + } + + + /** + * Retrieve request manager's delay in seconds. + * @return delay, in seconds. + */ + public int getRequestManagerDelay() { + s_log.debug("m_requestManagerDelay retrieved."); + // return ((Integer) get(m_requestManagerDelay)).intValue(); + return 900; + } + + /** + * Retrieve request manager's period in seconds + * @return period, in seconds + */ + public int getRequestManagerPeriod() { + s_log.debug("m_requestManagerPeriod retrieved."); + // return ((Integer) get(m_requestManagerPeriod)).intValue(); + return 900; + } + + /** + * Retrieve digest queue's delay in seconds. + * @return delay, in seconds. + */ + public int getDigestQueueDelay() { + s_log.debug("m_digestQueueDelay retrieved."); + // return ((Integer) get(m_digestQueueDelay)).intValue(); + return 900; + } + + /** + * Retrieve digest queue's period in seconds + * @return period, in seconds + */ + public int getDigestQueuePeriod() { + s_log.debug("m_digestQueuePeriod retrieved."); + // return ((Integer) get(m_digestQueuePeriod)).intValue(); + return 900; + } + + /** + * Retrieve simple queue's delay in seconds. + * @return delay, in seconds. + */ + public int getSimpleQueueDelay() { + s_log.debug("m_simpleQueueDelay retrieved."); + // return ((Integer) get(m_simpleQueueDelay)).intValue(); + return 900; + } + + /** + * Retrieve simple queue's period in seconds + * @return period, in seconds + */ + public int getSimpleQueuePeriod() { + s_log.debug("m_simpleQueuePeriod retrieved."); + // return ((Integer) get(m_simpleQueuePeriod)).intValue(); + return 900; + } + +} diff --git a/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java b/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java new file mode 100644 index 000000000..e21401122 --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.ui; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.StringUtils; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringArrayParameter; +import com.arsdigita.util.parameter.StringParameter; + +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +/** + * A configuration record for configuration of the core UI package + * (layout of main UI components). + * + * Accessors of this class may return null. Developers should take care + * to trap null return values in their code. + * + * @author Peter Boy <pboy@barkhof.uni-bremen.de> + * @version $Id: $ + */ +public class UIConfig extends AbstractConfig { + + /** A logger instance. */ + private static final Logger s_log = Logger.getLogger(UIConfig.class); + + /** Singelton config object. */ + private static UIConfig s_conf; + + /** + * Gain a UIConfig object. + * + * Singelton pattern, don't instantiate a lifecacle object using the + * constructor directly! + * @return + */ + public static synchronized UIConfig getConfig() { + if (s_conf == null) { + s_conf = new UIConfig(); + s_conf.load(); + } + + return s_conf; + } + + /** + * Default set of page component objects defining the default layout for the + * SimplePage class. + * + * Format expected by clients: + * list { { "margin_position", "class_name_of_bebop_component"} , + * { "margin_position", "class_name_of_bebop_component"} , + * ... + * { "margin_position", "class_name_of_bebop_component"} + * } + * Elements are optional and may have 0 ...n pairs of position/classname. + * + * Example: + * defaultLayout = { { "top", "com.arsdigita.ui.UserBanner" }, + * { "bottom", "com.arsdigita.ui.SiteBanner" }, + * { "bottom", "com.arsdigita.ui.DebugPanel" } + * { "left", "com.arsdigita.x.y.z" }, + * { "right", "com.arsdigita.x.y.z" } + * }; + * + * Currently there is no list parameter model available. We use a + * StringArrayParameter instead, where each String element contains a + * colon separated position:class entry. It is converted to a list by + * the getter method. + */ + // Quick 'md Dirty, we reeally need a StringListParameter class + private final Parameter m_defaultLayout = + new StringArrayParameter( + "core.ui.default_layout", + Parameter.REQUIRED, + new String[] + { "top:com.arsdigita.ui.UserBanner" + ,"bottom:com.arsdigita.ui.SiteBanner" + ,"bottom:com.arsdigita.ui.DebugPanel" + //,"left:com.arsdigita.x.y.zl", + //,"right:com.arsdigita.x.y.zr", + } + ); + + /** + * The customized layout for applications using the SimplePage class + * Format: list presumably same format as m_defaultLayout. details unknown + * + * According to a comment in old enterprise.init file: + * // Application specific page components + * // applicationLayouts = { + * // { "forums", + * // { + * // { "top", "com.arsdigita.x.y.z" }, + * // { "left", "com.arsdigita.x.y.z" }, + * // { "bottom", "com.arsdigita.x.y.z" }, + * // { "right", "com.arsdigita.x.y.z" } + * // } + * // }, + * // { "search", + * // { + * // { "top", "com.arsdigita.x.y.z" }, + * // { "left", "com.arsdigita.x.y.z" }, + * // { "bottom", "com.arsdigita.x.y.z" }, + * // { "right", "com.arsdigita.x.y.z" } + * // } + * // } + * // }; + * + */ + private final Parameter m_applicationLayouts = + new StringArrayParameter( + "core.ui.application_layouts", + Parameter.OPTIONAL, + null + ); + + /** String containing the relative URL for the top level page + * (or entry page / home page) of the site, Without leading slash but + * with trailing slash in case of a directory. + * By default it is the login page, but usually the root page of the + * main presentation application, e.g. portal, navigation, forum, etc. */ + private final Parameter m_rootPageURL = + new StringParameter("core.ui.pagemap.root_page_url", + Parameter.REQUIRED, "/register/"); + + /** String containing the URL of a page, a servlet or a jsp, to which a + * user after login will be redirected to. + * In case of a jsp or servlet it may contain user specific logic to + * redirect to a page specific for the user or a group of users. + * By default it is the /permissions/ page, but usually it is an + * application like personal-portal or content-center. */ + private final Parameter m_userRedirectURL = + new StringParameter("core.ui.pagemap.user_redirect_url", + Parameter.REQUIRED, "/permissions/"); + + /** String containing the URL for the workspace of the site. */ + // Old initializer: waf.pagemap.workspace + // XXX url pvt seems not to exist anymore! (pboy 2011-02-03) + private final Parameter m_workspaceURL = new StringParameter + ("core.ui.pagemap.workspace_url", Parameter.REQUIRED, "pvt/"); + + /** + * Constructs an empty RuntimeConfig object. + * + */ + public UIConfig() { + // pboy: According to the comment for the getConfig() method a singleton + // pattern is to be used. Therefore the constructor must be changed to + // private! + // private UIConfig() { + register(m_defaultLayout); + register(m_applicationLayouts); + + register(m_rootPageURL); + register(m_userRedirectURL); + register(m_workspaceURL); + + loadInfo(); + + } + + /** + * Retrieve the set of default page component objects defining + * the default layout for SimplePage class. + */ + public List getDefaultLayout() { + + /** List contain the default layout used to create a SimplePage. */ + ArrayList defaultLayout = new ArrayList(); + /** Value of the defaultLayout parameter, a string array of + pair of position:class strings */ + String[] layoutParameter = (String[]) get(m_defaultLayout) ; + + for (int i = 0; i < layoutParameter.length ; ++i) { + String[] layoutSection = StringUtils.split(layoutParameter[i],':'); + defaultLayout.add(Arrays.asList(layoutSection)); + } + return defaultLayout; + } + + /** + * Retrieve the set of customized layout for applications using the + * SimplePage class. + * Parameter is optional, method may return null! + */ + public List getApplicationLayouts() { + + /** Value of the customLayout parameter, a string array of + pair of position:class strings */ + String[] customParameter = (String[]) get(m_applicationLayouts) ; + + if (customParameter != null) { + // This part of method could NOT be tested yet! + /** List contain the application layout used to create a SimplePage. */ + ArrayList customLayout = new ArrayList(); + for (int i = 0; i < customParameter.length ; ++i) { + String[] layoutSection = StringUtils.split(customParameter[i],':'); + customLayout.add(Arrays.asList(layoutSection)); + } + return customLayout; + } else { + + return null; + + } + } + + /** + * Retrieve the site's root page url - i.e. the front page, the + * (usually public) top level entry page for the site. + * By default it is the login page, but usually the root page of the main + * presentation application, e.g. portal, navigation, forum, etc. + * + * @return root page url + */ + public String getRootPage() { + String rootPageURL = (String)get(m_rootPageURL) ; + // Previous configurations required NO leading slash. Just in case an + // old configuration is in place we have to translate. + return ( rootPageURL.startsWith("/") ? + rootPageURL : "/"+rootPageURL ); + } + + /** + * Retrieve systems user login redirect page url, that is the page, a + * servlet oder a JSP ti which a user is redirected to after login. + * By default it is the /permissions/ page, but usually it is an application + * like personal-portal or content-center. + * + * @return user login redirect page url + */ + public String getUserRedirect() { + String userRedirectURL = (String)get(m_userRedirectURL); + // Previous configurations required NO leading slash. Just in case an + // old configuration is in place we have to translate. + return ( userRedirectURL.startsWith("/") ? + userRedirectURL : "/"+userRedirectURL ); + } + + /** + * Retrieve systems workspace url. + * + * @return workspace page url + */ + public String getWorkspace() { + String workspaceURL = (String)get(m_workspaceURL); + // Previous configurations required NO leading slash. Just in case an + // old configuration is in place we have to translate. + return ( workspaceURL.startsWith("/") ? + workspaceURL : "/"+workspaceURL ); + } + +} diff --git a/ccm-core/src/main/java/com/arsdigita/workflow/simple/WorkflowConfig.java b/ccm-core/src/main/java/com/arsdigita/workflow/simple/WorkflowConfig.java new file mode 100755 index 000000000..95b2fde32 --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/workflow/simple/WorkflowConfig.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.workflow.simple; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.BooleanParameter; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringParameter; + +/** + * WorkflowConfig + * + * @author Rafael H. Schloming <rhs@mit.edu> + * @version $Id: WorkflowConfig.java 287 2005-02-22 00:29:02Z sskracic $ + */ +public final class WorkflowConfig extends AbstractConfig { + + /** Private Object to hold one's own instance to return to users. */ + private static WorkflowConfig s_config; + + /** + * Returns the singleton configuration record for the workflow + * configuration. + * + * @return The ContentSectionConfig record; it cannot be null + */ + public static synchronized WorkflowConfig getInstance() { + if (s_config == null) { + s_config = new WorkflowConfig(); + s_config.load(); + } + + return s_config; + } + + +// ///////////////////////////////////////////////////////////////////////////// +// +// Set of parameters controlling workflow alerts. +// +// ///////////////////////////////////////////////////////////////////////////// + + /** Turn on or off workflow alerts. */ + private BooleanParameter m_alerts = new BooleanParameter + ("waf.workflow.simple.alerts_enabled", Parameter.OPTIONAL, + Boolean.TRUE); + + /** Default sender for workflow alerts, e.g. workflow@example.com */ + private StringParameter m_sender = new StringParameter + ("waf.workflow.simple.alerts_sender", Parameter.OPTIONAL, null); + + /** + * Constructor + */ + public WorkflowConfig() { + register(m_alerts); + register(m_sender); + loadInfo(); + } + + /** + * Retrieve whether alerts are to be enabled or not. + * @return true if alerts are enabled. + */ + public boolean isAlertsEnabled() { + return get(m_alerts).equals(Boolean.TRUE); + } + + /** + * Retrieve alert senders default mail address. + * @return + */ + public String getAlertsSender() { + return (String) get(m_sender); + } + +} diff --git a/ccm-core/src/main/java/com/arsdigita/xml/XMLConfig.java b/ccm-core/src/main/java/com/arsdigita/xml/XMLConfig.java new file mode 100644 index 000000000..31b98dd94 --- /dev/null +++ b/ccm-core/src/main/java/com/arsdigita/xml/XMLConfig.java @@ -0,0 +1,237 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.xml; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.BooleanParameter; +import com.arsdigita.util.parameter.StringParameter; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.SAXParserFactory; + +import org.apache.log4j.Logger; + +/** + * Stores the configuration record for the XML functionality. + * + * Most important: Configuration of the XML factories: - Document Builder - Sax Parser - XSL + * Transformer + * + * @version $Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $ + */ +public final class XMLConfig extends AbstractConfig { + + /** + * Internal logger instance to faciliate debugging. Enable logging output by editing + * /WEB-INF/conf/log4j.properties int hte runtime environment and set + * com.arsdigita.xml.XMLConfig=DEBUG by uncommenting or adding the line. + */ + private static final Logger s_log = Logger.getLogger(XMLConfig.class); + + /** + * Private instance of this class to be returned after initialization. + */ + private static XMLConfig s_config; + + /** + * Returns the singleton configuration record for the XML functionality + * + * @return The XMLConfig record; it cannot be null + */ + public static final synchronized XMLConfig getConfig() { + if (s_config == null) { + s_config = new XMLConfig(); + // read values from the persistent storage + s_config.load(); + } + + return s_config; + } + + // supported XSL transformer implementations + private static final String RESIN = "com.caucho.xsl.Xsl"; + private static final String SAXON = "com.icl.saxon.TransformerFactoryImpl"; + private static final String SAXON_HE = "net.sf.saxon.TransformerFactoryImpl"; + private static final String XALAN = "org.apache.xalan.processor.TransformerFactoryImpl"; + private static final String XSLTC = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"; + + // supported documentBuilder implementations + private static final String DOM_XERCES = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; + private static final String DOM_RESIN = "com.caucho.xml.parsers.XmlDocumentBuilderFactory"; + + // supported SAX parser implementations + private static final String SAX_XERCES = "org.apache.xerces.jaxp.SAXParserFactoryImpl"; + private static final String SAX_RESIN = "com.caucho.xml.parsers.XmlSAXParserFactory"; + + private final Parameter m_xfmr = new StringParameter( + "waf.xml.xsl_transformer", + Parameter.REQUIRED, "saxon"); + private final Parameter m_builder = new StringParameter( + "waf.xml.dom_builder", + Parameter.REQUIRED, "xerces"); + private final Parameter m_parser = new StringParameter( + "waf.xml.sax_parser", + Parameter.REQUIRED, "xerces"); + + private final Parameter m_activateFullTimeFormatter = new BooleanParameter( + "waf.xml.activate_full_date_formatter", + Parameter.OPTIONAL, false); + + /** + * Constructs an empty XMLConfig object following the singleton pattern. + * + * They are meant as a singleton pattern (with private constructor), but it does not work with + * the associated classes AbstractConfig and ConfigRegistry because they can currently not deal + * with a private constructor + */ + // private XMLConfig() { + public XMLConfig() { + + super(); + + register(m_xfmr); + register(m_builder); + register(m_parser); + register(m_activateFullTimeFormatter); + + loadInfo(); + } + + /* ************ public getter / setter section ************ */ + /** + * Returns the XSL Transformer factory class name to use. + * + * The method assures that the return value is a valid class name. + * + * @return String XSL Transformer factory class name + */ + public String getXSLTransformerFactoryClassname() { + + final String key = (String) get(m_xfmr); + + // Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc + if (key.equalsIgnoreCase("xsltc")) { + return XSLTC; + } else if (key.equalsIgnoreCase("xalan")) { + return XALAN; + } else if (key.equalsIgnoreCase("resin")) { + return RESIN; + } else if (key.equalsIgnoreCase("saxonhe")) { + return SAXON_HE; + } else { + // return defaultValue + return getDefaultXSLTransformerFactoryClassname(); + } + } + + /** + * Returns the class name of the default {@link TransformerFactory}. This method encapsulates + * the default value so that is easy to change. The method is only for use by the + * classes in the {@code com.arsdigita.xml} package, therefore the method is {@code protected}. + * + * @return + */ + protected String getDefaultXSLTransformerFactoryClassname() { + return SAXON; + } + + /** + * Returns the Document Builder factory class name to use + * + * The method assures that the return value is a valid class name. + * + * Not used at the moment. + * + * @return String Document Builder factory class name + */ + public String getDOMBuilderFactoryClassname() { + + final String key = (String) get(m_builder); + + // Defined values: xerces (default)|resin + if (key.equalsIgnoreCase("resin")) { + return DOM_RESIN; + } else { + return getDefaultDOMBuilderFactoryClassname(); + } + } + + /** + * Returns the class name of the default {@link DocumentBuilderFactory}. + * This method encapsulates the default value so that is easy to change. The method is only for + * use by the classes in the {@code com.arsdigita.xml} package, therefore the method is + * {@code protected}. + * + * @return + */ + protected String getDefaultDOMBuilderFactoryClassname() { + return DOM_XERCES; + } + + /** + * Returns the Sax Parser factory class name to use. + * + * The method assures that the return value is a valid class name. + * + * Not used at the moment. + * + * @return String Sax Parser factory class name + */ + public String getSAXParserFactoryClassname() { + + final String key = (String) get(m_parser); + + // Defined values: xerces (default)|resin + if (key.equalsIgnoreCase("resin")) { + return SAX_RESIN; + } else { + return getDefaultSAXParserFactoryClassname(); + } + } + + /** + * Returns the class name of the default {@link SAXParserFactory}. + * This method encapsulates the default value so that is easy to change. The method is only for + * use by the classes in the {@code com.arsdigita.xml} package, therefore the method is + * {@code protected}. + * + * @return + */ + protected String getDefaultSAXParserFactoryClassname() { + return SAX_XERCES; + } + + /** + * Returns the activateFullTimeFormatter flag. + * + * @return + */ + public boolean getActivateFullTimeFormatter() { + return (Boolean) get(m_activateFullTimeFormatter); + } + + /** + * Sets the activateFullTimeFormatter flag. + * + * @param activateFullTimeFormatter + */ + public void setActivateFullTimeFormatter(final boolean activateFullTimeFormatter) { + set(m_activateFullTimeFormatter, activateFullTimeFormatter); + } +} diff --git a/ccm-core/src/main/resources/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties new file mode 100755 index 000000000..d48763e5b --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/dispatcher/DispatcherConfig_parameter.properties @@ -0,0 +1,19 @@ +waf.dispatcher.static_url_prefix.title=Static URL Prefix +waf.dispatcher.static_url_prefix.purpose=Prefix used for serving static files +waf.dispatcher.static_url_prefix.example=/STATIC/ +waf.dispatcher.static_url_prefix.format=[url] + +waf.dispatcher.is_caching_active.title=Dispatcher caching enabled +waf.dispatcher.is_caching_active.purpose=Toggle whether or not to use HTTP/1.1 caching +waf.dispatcher.is_caching_active.example=true +waf.dispatcher.is_caching_active.format=true|false + +waf.dispatcher.default_expiry.title=Default cache expiration +waf.dispatcher.default_expiry.purpose=Set the default expiration time for HTTP caching +waf.dispatcher.default_expiry.example=259200 +waf.dispatcher.default_expiry.format=[integer] + +waf.dispatcher.default_page_class.title=Default page class +waf.dispatcher.default_page_class.purpose=the default page class +waf.dispatcher.default_page_class.example=com.arsdigita.bebop.Page +waf.dispatcher.default_page_class.format=[String] diff --git a/ccm-core/src/main/resources/com/arsdigita/formbuilder/FormBuilderConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/formbuilder/FormBuilderConfig_parameter.properties new file mode 100755 index 000000000..0dd831058 --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/formbuilder/FormBuilderConfig_parameter.properties @@ -0,0 +1,12 @@ +waf.formbuilder.controls_help_url.title=Help link for creating FormBuilder controls +waf.formbuilder.controls_help_url.purpose=This is a string that can be used to create the URL to point to the help page that explains how to create controls within the formbuilder. If it starts with "/" then it is assumed to be located on this server. If it starts with anything else, it is assumed to be a link to a foreign site. +waf.formbuilder.controls_help_url.example=/help/formbuilder/creations-controls.jsp +waf.formbuilder.controls_help_url.format=[string] +waf.formbuilder.actions_help_url.title=Help link for creating FormBuilder actions +waf.formbuilder.actions_help_url.purpose=This is a string that can be used to create the URL to point to the help page that explains how to create actions within the formbuilder. If it starts with "/" then it is assumed to be located on this server. If it starts with anything else, it is assumed to be a link to a foreign site. +waf.formbuilder.actions_help_url.example=/help/formbuilder/creations-actions.jsp +waf.formbuilder.actions_help_url.format=[string] +waf.formbuilder.interpolate_email_actions_to_address.title=Interpolate the to: field +waf.formbuilder.interpolate_email_actions_to_address.purpose=Should the to: field of email actions be interpolated, ie translated using submitted form values +waf.formbuilder.interpolate_email_actions_to_address.example=boolean +waf.formbuilder.interpolate_email_actions_to_address.format=[true] diff --git a/ccm-core/src/main/resources/com/arsdigita/globalization/GlobalizationConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/globalization/GlobalizationConfig_parameter.properties new file mode 100644 index 000000000..50c9d090d --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/globalization/GlobalizationConfig_parameter.properties @@ -0,0 +1,4 @@ +core.globalization.default_charset.title=Default Charset +core.globalization.default_charset.purpose=Default character set for locales not explicitly listed in the locales parameter. +core.globalization.default_charset.example="UTF-8" +core.globalization.default_charset.format=[String] diff --git a/ccm-core/src/main/resources/com/arsdigita/notification/NotificationConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/notification/NotificationConfig_parameter.properties new file mode 100644 index 000000000..a7d7486ea --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/notification/NotificationConfig_parameter.properties @@ -0,0 +1,29 @@ +waf.notification.request_manager_delay.title=Request Manager Delay +waf.notification.request_manager_delay.purpose=Start of request manager's delay in seconds. +waf.notification.request_manager_delay.example=900 +waf.notification.request_manager_delay.format=[integer] + +waf.notification.request_manager_period.title=Request Manager Period +waf.notification.request_manager_period.purpose=Request manager's activities period in seconds +waf.notification.request_manager_period.example=900 +waf.notification.request_manager_period.format=[integer] + +waf.notification.digest_queue_delay.title=Digest Queue Delay +waf.notification.digest_queue_delay.purpose=Start of Digest Queue's delay in seconds. +waf.notification.digest_queue_delay.example=900 +waf.notification.digest_queue_delay.format=[integer] + +waf.notification.digest_queue_period.title=Digest Queue Period +waf.notification.digest_queue_period.purpose=Digest Queue's activities period in seconds +waf.notification.digest_queue_period.example=900 +waf.notification.digest_queue_period.format=[integer] + +waf.notification.simple_queue_delay.title=Simple Queue Delay +waf.notification.simple_queue_delay.purpose=Start of Simple Queue's delay in seconds. +waf.notification.simple_queue_delay.example=900 +waf.notification.simple_queue_delay.format=[integer] + +waf.notification.simple_queue_period.title=Simple Queue Period +waf.notification.simple_queue_period.purpose=Simple Queue's activities period in seconds +waf.notification.simple_queue_period.example=900 +waf.notification.simple_queue_period.format=[integer] diff --git a/ccm-core/src/main/resources/com/arsdigita/ui/UIConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/ui/UIConfig_parameter.properties new file mode 100644 index 000000000..fdbf3f7e2 --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/ui/UIConfig_parameter.properties @@ -0,0 +1,35 @@ +core.ui.default_layout.title=Default Layout +core.ui.default_layout.purpose=Default layout components for SimplePage class +core.ui.default_layout.example="top,com.arsdigita.ui.UserBanner","bottom,com.arsdigita.ui.SiteBanner","left,com.arsdigita.x.y.zl", +core.ui.default_layout.format=[StringArray] + +core.ui.application_layouts.title=Application Layouts +core.ui.application_layouts.purpose=The customized layout for applications using the SimplePage class +core.ui.application_layouts.example=unkown +core.ui.application_layouts.format=[StringArray] + +core.ui.pagemap.root_page_url.title=Root Page +core.ui.pagemap.root_page_url.purpose=Enter the relative URL for top-level page (to document root and without constant prefix if configured) +core.ui.pagemap.root_page_url.example=register/ +core.ui.pagemap.root_page_url.format=[string] + +core.ui.pagemap.user_redirect_url.title=User Redirect Page +core.ui.pagemap.user_redirect_url.purpose=Enter the relative URL to a page which redirects the request according to the logged in user (if exists) +core.ui.pagemap.user_redirect_url.example=pvt/ +core.ui.pagemap.user_redirect_url.format=[string] + +core.ui.pagemap.workspace_url.title=Workspace Page +core.ui.pagemap.workspace_url.purpose=Enter the relative URL for the Workspace Page (to document root and without constant prefix if configured) +core.ui.pagemap.workspace_url.example=pvt/ +core.ui.pagemap.workspace_url.format=[string] + + +#waf.pagemap.permission.title=Permissions Page +#waf.pagemap.permission.purpose=Enter the relative URL for the main Permissions administration page +#waf.pagemap.permission.example=permissions/ +#waf.pagemap.permission.format=[string] + +#waf.pagemap.perm_single.title=Single object Permissions Page +#waf.pagemap.perm_single.purpose=Enter the relative URL for the Single Object permissons administration page +#waf.pagemap.perm_single.example=permissions/one +#waf.pagemap.perm_single.format=[string] diff --git a/ccm-core/src/main/resources/com/arsdigita/workflow/simple/WorkflowConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/workflow/simple/WorkflowConfig_parameter.properties new file mode 100755 index 000000000..b83ba779e --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/workflow/simple/WorkflowConfig_parameter.properties @@ -0,0 +1,8 @@ +waf.workflow.simple.alerts_enabled.title=Workflow Alerts Enabled +waf.workflow.simple.alerts_enabled.purpose=Turn on and off workflow alerts +waf.workflow.simple.alerts_enabled.example=true +waf.workflow.simple.alerts_enabled.format=true|false +waf.workflow.simple.alerts_sender.title=Workflow Alerts Sender +waf.workflow.simple.alerts_sender.purpose=Default sender for workflow alerts +waf.workflow.simple.alerts_sender.example=workflow@example.com +waf.workflow.simple.alerts_sender.format=[email] \ No newline at end of file diff --git a/ccm-core/src/main/resources/com/arsdigita/xml/XMLConfig_parameter.properties b/ccm-core/src/main/resources/com/arsdigita/xml/XMLConfig_parameter.properties new file mode 100755 index 000000000..4ba793c76 --- /dev/null +++ b/ccm-core/src/main/resources/com/arsdigita/xml/XMLConfig_parameter.properties @@ -0,0 +1,19 @@ +waf.xml.xsl_transformer.title=XSLT transformer +waf.xml.xsl_transformer.purpose=Define the XSLT transformer factory to use +waf.xml.xsl_transformer.example=Choose one of: saxon (default)|jd.xslt|resin|xalan|xsltc +waf.xml.xsl_transformer.format=[string] + +waf.xml.dom_builder.title=DOM builder +waf.xml.dom_builder.purpose=Define the DOM builder factory to use +waf.xml.dom_builder.example=Choose one of: xerces (default)|resin +waf.xml.dom_builder.format=[string] + +waf.xml.sax_parser.title=SAX parser +waf.xml.sax_parser.purpose=Define the SAX parser factory to use +waf.xml.sax_parser.example=Choose one of: xerces (default)|resin +waf.xml.sax_parser.format=[string] + +waf.xml.activate_full_date_formatter.title=Activate FullDateFormatter +waf.xml.activate_full_date_formatter.purpose=Set this to true to make FullDateFormatter output semantic date XML; the XSL templates may need to be modified accordingly +waf.xml.activate_full_date_formatter.example=true +waf.xml.activate_full_date_formatter.format=[boolean]