diff --git a/ccm-core/src/com/arsdigita/bebop/BebopConfig.java b/ccm-core/src/com/arsdigita/bebop/BebopConfig.java index 79a9b85b5..1efd8f35c 100755 --- a/ccm-core/src/com/arsdigita/bebop/BebopConfig.java +++ b/ccm-core/src/com/arsdigita/bebop/BebopConfig.java @@ -76,20 +76,21 @@ public final class BebopConfig extends AbstractConfig { Parameter.REQUIRED, Boolean.FALSE); - m_dhtmlEditor = new EnumerationParameter("waf.bebop.dhtml_editor", Parameter.REQUIRED, - BebopConstants.BEBOP_DHTMLEDITOR); - m_dhtmlEditor.put("HTMLArea", BebopConstants.BEBOP_DHTMLEDITOR); // for compatibility with old XSL + m_dhtmlEditor = new EnumerationParameter("waf.bebop.dhtml_editor", + Parameter.REQUIRED,BebopConstants.BEBOP_DHTMLEDITOR); + // HTMLArea for compatibility with old XSL + m_dhtmlEditor.put("HTMLArea", BebopConstants.BEBOP_DHTMLEDITOR); m_dhtmlEditor.put("FCKeditor", BebopConstants.BEBOP_FCKEDITOR); m_dhtmlEditor.put("Xinha", BebopConstants.BEBOP_XINHAEDITOR); m_dhtmlEditorSrcFile = new StringParameter - ("waf.bebop.dhtml_editor_src", Parameter.REQUIRED, - "/assets/xinha/XinhaLoader.js"); + ("waf.bebop.dhtml_editor_src", Parameter.REQUIRED, + "/assets/xinha/XinhaLoader.js"); m_dcpOnButtons = new BooleanParameter - ("waf.bebop.dcp_on_buttons", Parameter.REQUIRED, Boolean.TRUE); + ("waf.bebop.dcp_on_buttons", Parameter.REQUIRED, Boolean.TRUE); m_dcpOnLinks = new BooleanParameter - ("waf.bebop.dcp_on_links", Parameter.REQUIRED, Boolean.FALSE); + ("waf.bebop.dcp_on_links", Parameter.REQUIRED, Boolean.FALSE); m_showClassName = new BooleanParameter ("waf.bebop.show_class_name", Parameter.OPTIONAL, Boolean.FALSE); @@ -103,7 +104,7 @@ public final class BebopConfig extends AbstractConfig { register(m_dcpOnButtons); register(m_dcpOnLinks); register(m_enableTreeSelect); - register(m_showClassName); + register(m_showClassName); loadInfo(); } diff --git a/ccm-core/src/com/arsdigita/bebop/form/DHTMLEditor.java b/ccm-core/src/com/arsdigita/bebop/form/DHTMLEditor.java index 722b97103..4cfb4a215 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/DHTMLEditor.java +++ b/ccm-core/src/com/arsdigita/bebop/form/DHTMLEditor.java @@ -47,27 +47,32 @@ import com.arsdigita.xml.Element; */ public class DHTMLEditor extends TextArea { - public static final String versionId = "$Id: DHTMLEditor.java 1543 2007-03-27 09:11:02Z chrisgilbert23 $"; - /** - * Constant for specifying OFF value for the - * WRAP attribute of this image input. See here - * for a description of what this attribute does. */ + public static final String versionId = + "$Id: DHTMLEditor.java 1543 2007-03-27 09:11:02Z chrisgilbert23 $"; + /** + * Constant for specifying OFF value for the WRAP attribute + * of this image input. + * + * See here + * for a description of what this attribute does. */ public static final int OFF = 0; /** - * Constant for specifying HARD value for the - * WRAP attribute of this image input. * See here + * Constant for specifying HARD value for the WRAP attribute + * of this image input. + * + * See here * for a description of what this attribute does. */ public static final int HARD = 1; /** - * Constant for specifying SOFT value for the - * WRAP attribute of this image input. See here + * Constant for specifying SOFT value for the WRAP attribute + * of this image input. See here * for a description of what this attribute does. */ public static final int SOFT = 2; @@ -76,11 +81,13 @@ public class DHTMLEditor extends TextArea { public static final Config STANDARD = new Config("HTMLArea.Config", null); /** Example FCKEditor configuration. */ - public static final Config FCK_STANDARD = new Config("FCKEditor.Config.StyleDefault", - "/assets/fckeditor/config/fckconfigstyledefault.js"); + public static final Config FCK_STANDARD = + new Config("FCKEditor.Config.StyleDefault", + "/assets/fckeditor/config/fckconfigstyledefault.js"); - public static final Config FCK_CMSADMIN = new Config("FCKEditor.Config.StyleCMSAdmin", - "/assets/fckeditor/config/fckconfigstylecmsadmin.js"); + public static final Config FCK_CMSADMIN = + new Config("FCKEditor.Config.StyleCMSAdmin", + "/assets/fckeditor/config/fckconfigstylecmsadmin.js"); private String m_name; private String m_path; @@ -149,7 +156,8 @@ public class DHTMLEditor extends TextArea { } public String getEditorURL() { - return Bebop.getConfig().getDHTMLEditorSrcFile().substring(0, Bebop.getConfig().getDHTMLEditorSrcFile().lastIndexOf("/") + 1); + return Bebop.getConfig().getDHTMLEditorSrcFile().substring( + 0, Bebop.getConfig().getDHTMLEditorSrcFile().lastIndexOf("/") + 1); } public String getEditorSrc() { @@ -172,7 +180,7 @@ public class DHTMLEditor extends TextArea { m_plugins.add(name); } /** - * Prevent the specified button from being displayed in the editor toolbar + * Prevent the specified button from being displayed in the editor toolbar. * @param name name of the button, as specified in the btnList of the htmlarea.js file * */ diff --git a/ccm-core/src/com/arsdigita/bebop/util/BebopConstants.java b/ccm-core/src/com/arsdigita/bebop/util/BebopConstants.java index ce74f6c18..cfdf0832a 100755 --- a/ccm-core/src/com/arsdigita/bebop/util/BebopConstants.java +++ b/ccm-core/src/com/arsdigita/bebop/util/BebopConstants.java @@ -27,7 +27,10 @@ package com.arsdigita.bebop.util; * @version $Id: BebopConstants.java 1224 2006-06-18 22:28:30Z apevec $ */ public interface BebopConstants { - public static final String versionId = "$Id: BebopConstants.java 1224 2006-06-18 22:28:30Z apevec $ by $Author: apevec $, $DateTime: 2004/08/16 18:10:38 $"; + public static final String versionId = + "$Id: BebopConstants.java 1224 2006-06-18 22:28:30Z apevec $" + + " by $Author: apevec $, " + + "$DateTime: 2004/08/16 18:10:38 $"; String BEBOP_CHECKBOXGROUP = "bebop:checkboxGroup"; String BEBOP_CHECKBOX = "bebop:checkbox"; @@ -41,6 +44,7 @@ public interface BebopConstants { String BEBOP_TEXTAREA = "bebop:textarea"; String BEBOP_DHTMLEDITOR = "bebop:dhtmleditor"; String BEBOP_FCKEDITOR = "bebop:fckeditor"; + String BEBOP_XINHAEDITOR = "bebop:xinha"; String BEBOP_FORMWIDGET = "bebop:formWidget"; String BEBOP_FORMERRORS = "bebop:formErrors"; String BEBOP_PORTAL = "bebop:portal"; @@ -61,6 +65,5 @@ public interface BebopConstants { String BEBOP_SEGMENT = "bebop:segment"; String BEBOP_SEG_BODY = "bebop:segmentBody"; String BEBOP_SEG_HEADER = "bebop:segmentHeader"; - String BEBOP_XINHAEDITOR = "bebop:xinha"; } diff --git a/ccm-core/src/com/arsdigita/core/Initializer.java b/ccm-core/src/com/arsdigita/core/Initializer.java new file mode 100755 index 000000000..719879c56 --- /dev/null +++ b/ccm-core/src/com/arsdigita/core/Initializer.java @@ -0,0 +1,173 @@ +/* + * 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.core; + +import com.arsdigita.auditing.BasicAuditTrail; +import com.arsdigita.db.DbHelper; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.loader.CoreLoader; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.Session; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.TransactionContext; +import com.arsdigita.persistence.pdl.ManifestSource; +import com.arsdigita.persistence.pdl.NameFilter; +import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.DomainInitEvent; +import com.arsdigita.runtime.LegacyInitEvent; +import com.arsdigita.runtime.LegacyInitializer; +import com.arsdigita.runtime.OptionalLegacyInitializer; +import com.arsdigita.runtime.PDLInitializer; +import com.arsdigita.runtime.RuntimeConfig; +import com.arsdigita.ui.admin.Admin; +import com.arsdigita.ui.sitemap.SiteMap; +import com.arsdigita.util.xml.XML; +import com.arsdigita.web.Host; +import com.arsdigita.web.WebApp; +import com.arsdigita.web.ApplicationType; +import com.arsdigita.workflow.simple.TaskComment; +import com.arsdigita.search.converter.Converter; +import com.arsdigita.search.converter.ConverterRegistry; +import com.arsdigita.search.converter.PDFConverter; +import com.arsdigita.search.converter.ExcelConverter; +import com.arsdigita.search.converter.OOConverter; +import com.arsdigita.search.converter.WordConverter; +import com.arsdigita.search.converter.TextConverter; + + +/** + * CoreInitializer + * + * @author Rafael H. Schloming <rhs@mit.edu> + * @version $Revision: #15 $ $Date: 2004/08/16 $ + **/ + +public class Initializer extends CompoundInitializer { + + public final static String versionId = "$Id: Initializer.java 1547 2007-03-29 14:24:57Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $"; + + public Initializer() { + final String url = RuntimeConfig.getConfig().getJDBCURL(); + final int database = DbHelper.getDatabaseFromURL(url); + + add(new com.arsdigita.persistence.Initializer()); + + add(new PDLInitializer + (new ManifestSource + ("ccm-core.pdl.mf", + new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); + + add(new LegacyInitializer("com/arsdigita/core/enterprise.init")); + add(new OptionalLegacyInitializer("enterprise.init")); + } + + public final void init(final DomainInitEvent e) { + super.init(e); + + e.getFactory().registerInstantiator + (Host.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dobj) { + return new Host(dobj); + } + }); + + e.getFactory().registerInstantiator + (ApplicationType.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dobj) { + return new ApplicationType(dobj); + } + }); + + e.getFactory().registerInstantiator + (WebApp.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(final DataObject data) { + return new WebApp(data); + } + }); + + e.getFactory().registerInstantiator + (TaskComment.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(final DataObject data) { + return new TaskComment(data); + } + }); + + e.getFactory().registerInstantiator + (Admin.BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() { + public DomainObject doNewInstance(final DataObject data) { + return new Admin(data); + } + }); + + e.getFactory().registerInstantiator + (SiteMap.BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() { + public DomainObject doNewInstance(final DataObject data) { + return new SiteMap(data); + } + }); + + e.getFactory().registerInstantiator + (BasicAuditTrail.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(final DataObject data) { + return new BasicAuditTrail(data); + } + }); + // register the document converters + Converter converter = new PDFConverter(); + ConverterRegistry.registerConverter(converter, + converter.getMimeTypes()); + + converter = new ExcelConverter(); + ConverterRegistry.registerConverter(converter, + converter.getMimeTypes()); + + converter = new WordConverter(); + ConverterRegistry.registerConverter(converter, + converter.getMimeTypes()); + + converter = new OOConverter(); + ConverterRegistry.registerConverter(converter, + converter.getMimeTypes()); + + converter = new TextConverter(); + ConverterRegistry.registerConverter(converter, + converter.getMimeTypes()); + } + + public final void init(final LegacyInitEvent e) { + super.init(e); + + Session session = SessionManager.getSession(); + TransactionContext txn = session.getTransactionContext(); + txn.beginTxn(); + CoreLoader.loadHost(); + txn.commitTxn(); + + XML.setupFactories(); + } +} diff --git a/ccm-core/src/com/arsdigita/core/Loader.java b/ccm-core/src/com/arsdigita/core/Loader.java new file mode 100755 index 000000000..63ec52932 --- /dev/null +++ b/ccm-core/src/com/arsdigita/core/Loader.java @@ -0,0 +1,40 @@ +/* + * 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.core; + +import com.arsdigita.loader.CoreLoader; + +/** + * Loader used during the initial setup to load the database, used by + * c.ad.packaging.Load (invoked via "ccm load ..." command) + * + * The loader is specified in the file "/ccm-core.load" (which follows the + * general naming scheme .load). + * + * Currently just a wrapper for Class CoreLoader which does the actual work. + * + * ToDo: Should we move CoreLoader into Loader here for systematic reasons? All + * modules use a class Loader (or sometimes Loader) located in the + * base package of the module. Alternatively: put all Loader classes into a + * package "loader". + * + */ +public final class Loader extends CoreLoader { + // Empty +}