From b0f365bddf17663096a7e09f2c3f673e1b2484b7 Mon Sep 17 00:00:00 2001 From: pb Date: Mon, 14 Feb 2011 01:47:47 +0000 Subject: [PATCH] ccm-core kommt jetzt ohne enterprise.ini aus, old style initializers sind eliminiert bis auf formbuilder.installer.Initialializer, die von ccm-cms und ccm-cms-types-survey genutzt werden. git-svn-id: https://svn.libreccm.org/ccm/trunk@749 8810af33-2d31-482b-a856-94f89814c4df --- ccm-core/src/ccm-core.config | 2 + .../auditing/AuditingSaveFactory.java | 21 +- ...a => LegacyInitializer.java.nolongerInUse} | 8 + .../src/com/arsdigita/core/Initializer.java | 50 +++-- .../src/com/arsdigita/core/enterprise.init | 177 ----------------- .../core/enterprise.init.nolongerInUse | 186 +++++++++++++----- .../core/enterpriseold.init.nolongerInUse | 83 ++++++++ .../SimpleDomainObjectTraversalAdapter.java | 5 +- ...ctTraversalInitializer.java.nolongerInUse} | 0 ...ackage.html => package.html.nolongerInUse} | 2 +- ...er.java => Initializer.java.nolongerInUse} | 22 ++- .../formbuilder/installer/package.html | 2 +- .../com/arsdigita/globalization/Charset.java | 2 +- .../globalization/ClientLocaleProvider.java | 20 +- .../arsdigita/globalization/Globalized.java | 15 +- ...a => LegacyInitializer.java.nolongerInUse} | 8 +- .../globalization/LocaleNegotiator.java | 7 +- .../src/com/arsdigita/kernel/Initializer.java | 60 +++++- .../com/arsdigita/kernel/KernelConfig.java | 76 ++++--- .../LegacyInitializer.java.nolongerInUse | 16 +- .../src/com/arsdigita/loader/CoreLoader.java | 182 ++++++++++++++++- .../loader/CoreLoader_parameter.properties | 10 + ...a => LegacyInitializer.java.nolongerInUse} | 14 +- 23 files changed, 646 insertions(+), 322 deletions(-) rename ccm-core/src/com/arsdigita/auditing/{Initializer.java => LegacyInitializer.java.nolongerInUse} (90%) delete mode 100755 ccm-core/src/com/arsdigita/core/enterprise.init mode change 100644 => 100755 ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse create mode 100644 ccm-core/src/com/arsdigita/core/enterpriseold.init.nolongerInUse rename ccm-core/src/com/arsdigita/domain/installer/{DomainObjectTraversalInitializer.java => DomainObjectTraversalInitializer.java.nolongerInUse} (100%) rename ccm-core/src/com/arsdigita/domain/installer/{package.html => package.html.nolongerInUse} (88%) rename ccm-core/src/com/arsdigita/formbuilder/{Initializer.java => Initializer.java.nolongerInUse} (89%) rename ccm-core/src/com/arsdigita/globalization/{LegacyInitializer.java => LegacyInitializer.java.nolongerInUse} (97%) mode change 100755 => 100644 ccm-core/src/com/arsdigita/kernel/LegacyInitializer.java.nolongerInUse rename ccm-core/src/com/arsdigita/webdevsupport/{Initializer.java => LegacyInitializer.java.nolongerInUse} (86%) diff --git a/ccm-core/src/ccm-core.config b/ccm-core/src/ccm-core.config index 47cafd2b2..8101cbbe1 100755 --- a/ccm-core/src/ccm-core.config +++ b/ccm-core/src/ccm-core.config @@ -10,6 +10,8 @@ storage="ccm-core/domain.properties"/> + - * - *

+ * Factory for auditing save information, i.e. an implementation of the + * AuditingSaveInfo interface. + * + * Currently there is only one implementation available: WebAuditingSaveInfo. + * Therefore there is no configuration object required. + * * * @author Joseph Bank * @version 1.0 */ - public class AuditingSaveFactory { // default to using WebAuditingSaveInfo + /** Static Auditing save info instance */ private static ThreadLocal s_proto = new ThreadLocal() { - public Object initialValue() { - return new WebAuditingSaveInfo(); - } - }; + @Override + public Object initialValue() { + return new WebAuditingSaveInfo(); + } + }; /** * Sets the prototype object for the factory. diff --git a/ccm-core/src/com/arsdigita/auditing/Initializer.java b/ccm-core/src/com/arsdigita/auditing/LegacyInitializer.java.nolongerInUse similarity index 90% rename from ccm-core/src/com/arsdigita/auditing/Initializer.java rename to ccm-core/src/com/arsdigita/auditing/LegacyInitializer.java.nolongerInUse index 8c5cdb81f..84b10884f 100755 --- a/ccm-core/src/com/arsdigita/auditing/Initializer.java +++ b/ccm-core/src/com/arsdigita/auditing/LegacyInitializer.java.nolongerInUse @@ -21,6 +21,14 @@ package com.arsdigita.auditing; import com.arsdigita.initializer.Configuration; import com.arsdigita.initializer.InitializationException; +// //////////////////////////////////////////////////////////////////////////// +// +// Obviously not used anymore. +// There is no entry in enterprise.init for this Initializer since several +// releases. +// +// //////////////////////////////////////////////////////////////////////////// + /** * Initializer for the auditing service. Currently the only available * configuration is AuditingSaveInfoClass, which must implement the diff --git a/ccm-core/src/com/arsdigita/core/Initializer.java b/ccm-core/src/com/arsdigita/core/Initializer.java index febd5409e..8f87920f6 100755 --- a/ccm-core/src/com/arsdigita/core/Initializer.java +++ b/ccm-core/src/com/arsdigita/core/Initializer.java @@ -33,9 +33,9 @@ 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.LegacyInitEvent; +// import com.arsdigita.runtime.LegacyInitializer; +// import com.arsdigita.runtime.OptionalLegacyInitializer; import com.arsdigita.runtime.PDLInitializer; import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.toolbox.CharsetEncodingProvider; @@ -63,8 +63,7 @@ import org.apache.log4j.Logger; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Id: Initializer.java 1547 2007-03-29 14:24:57Z chrisgilbert23 $ - **/ - + */ public class Initializer extends CompoundInitializer { private static Logger s_log = Logger.getLogger(Initializer.class); @@ -88,14 +87,15 @@ public class Initializer extends CompoundInitializer { add(new com.arsdigita.ui.Initializer()); add(new com.arsdigita.kernel.Initializer()); add(new com.arsdigita.kernel.security.Initializer()); + add(new com.arsdigita.globalization.Initializer()); add(new com.arsdigita.portal.Initializer()); add(new com.arsdigita.search.Initializer()); add(new com.arsdigita.search.lucene.Initializer()); add(new com.arsdigita.search.intermedia.Initializer()); add(new com.arsdigita.notification.Initializer()); - add(new LegacyInitializer("com/arsdigita/core/enterprise.init")); - add(new OptionalLegacyInitializer("enterprise.init")); + // add(new LegacyInitializer("com/arsdigita/core/enterprise.init")); + // add(new OptionalLegacyInitializer("enterprise.init")); } /** @@ -106,7 +106,9 @@ public class Initializer extends CompoundInitializer { public final void init(final DomainInitEvent e) { super.init(e); - s_log.info("Running core init(DomainInitEvent) ..."); + s_log.error("Running core init(DomainInitEvent) ..."); + + FactoriesSetup.setupFactories(); e.getFactory().registerInstantiator (Host.BASE_DATA_OBJECT_TYPE, @@ -223,6 +225,16 @@ public class Initializer extends CompoundInitializer { // Initialize the the CharsetEncodingProvider internal data structure URLRewriter.addParameterProvider(new CharsetEncodingProvider()); + + // Creates an entry in table web_hosts. Might be considered a loader + // task (and is already handled there). But configuration may be + // changed so we have to recheck here. + Session session = SessionManager.getSession(); + TransactionContext txn = session.getTransactionContext(); + txn.beginTxn(); + CoreLoader.loadHost(); + txn.commitTxn(); + s_log.info("Core init(DomainInitEvent) done"); } @@ -230,19 +242,19 @@ public class Initializer extends CompoundInitializer { * * @param e */ - public final void init(final LegacyInitEvent e) { - super.init(e); +// public final void init(final LegacyInitEvent e) { +// super.init(e); - s_log.info("Running core init(LegacyInitEvent) ..."); +// s_log.info("Running core init(LegacyInitEvent) ..."); - Session session = SessionManager.getSession(); - TransactionContext txn = session.getTransactionContext(); - txn.beginTxn(); - CoreLoader.loadHost(); - txn.commitTxn(); +// Session session = SessionManager.getSession(); +// TransactionContext txn = session.getTransactionContext(); +// txn.beginTxn(); +// CoreLoader.loadHost(); +// txn.commitTxn(); - FactoriesSetup.setupFactories(); +// FactoriesSetup.setupFactories(); - s_log.info("Core init(LegacyInitEvent) done"); - } +// s_log.info("Core init(LegacyInitEvent) done"); +// } } diff --git a/ccm-core/src/com/arsdigita/core/enterprise.init b/ccm-core/src/com/arsdigita/core/enterprise.init deleted file mode 100755 index a518d6193..000000000 --- a/ccm-core/src/com/arsdigita/core/enterprise.init +++ /dev/null @@ -1,177 +0,0 @@ -// ccm.core.enterprise.init -// -// Old initialization prozess configuration file. -// - - -// init com.arsdigita.globalization.Initializer { -init com.arsdigita.globalization.LegacyInitializer { - // See http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc - charsets = { - "ISO-8859-1", - "UTF-8" - }; - - // Each entry in the "locales" list is a 4-tuple of the form - // {language, country, variant, charset} - // The charset must be one of the values specified in the "charsets" - // parameter above. - locales = { - {"en", "", "", "UTF-8"}, - {"en", "GB", "", "UTF-8"}, - {"en", "US", "", "UTF-8"}, - {"es", "", "", "UTF-8"}, - {"es", "ES", "", "UTF-8"}, - {"da", "", "", "UTF-8"}, - {"da", "DK", "", "UTF-8"}, - {"de", "", "", "UTF-8"}, - {"de", "DE", "", "UTF-8"}, - {"fr", "", "", "UTF-8"}, - {"fr", "FR", "", "UTF-8"}, - {"ru", "", "", "UTF-8"} - }; - - // Default character set for locales not explicitly listed above. - defaultCharset = "UTF-8"; -} - - -// Should get integrated into the same configuration file as parameter -// waf.debug, i.e. ccm-core/kernel.properties. -init com.arsdigita.webdevsupport.Initializer { - active = false; -} - - - -// ///////////////////////////////////////////////////////////////// -// -// Initializer definitely replaced by new initialization system -// -// ///////////////////////////////////////////////////////////////// - -// Move configuration options to enterprise.init.nolongerInUse - -// init com.arsdigita.kernel.LegacyInitializer {} - -// -init com.arsdigita.kernel.security.LegacyInitializer { -// - securityHelperClass = "com.arsdigita.kernel.security.DefaultSecurityHelper"; -// - sessionTrackingMethod = "cookie"; -// - -// - excludedExtensions = { ".jpg", ".gif", ".png", ".pdf" }; -// - -// -} - - -// Set to true when using intermedia search -//-init com.arsdigita.mimetypes.LegacyMimeTypeInitializer { -//- INSOFilterEnabled = false; -//-} - - - -// init com.arsdigita.toolbox.CharsetEncodingProviderInitializer { } - -// init com.arsdigita.ui.LegacyInitializer { -// If using the default SimplePage class, the following -// two parameters specify the class names of the bebop -// components to (optionally) add to margins of pages - -// The is default set of page components -// 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" } -// }; - -// } - -// init com.arsdigita.portal.Initializer { } -// init com.arsdigita.portal.LegacyInitializer { } - - -// The formbuilder application is now deprecated and will -// be removed in the next release. Use the FormItem content -// type instead -// Method commend says: -// /** -// * Called on startup. Note. As you can not find a call -// * to this method in enterprise.ini, this method -// * may appear to execute mysteriously. -// * However, the process that runs through enterprise.ini -// * automitically calls the startup() method of any -// * class that implements com.arsdigita.util.initializer.Initializer -// * present in enterprise.ini -// **/ -// Has to be checked in detail. As of version 6.5 a lot of packages nevertheless -// are using it! -// -// init com.arsdigita.formbuilder.Initializer { } - -// This is an example initializer for populating -// the BebopObjectType & MetaObject stores -//init com.arsdigita.formbuilder.installer.Initializer { -// widgetTypes = { -// { "forms", "Checkbox group", "Checkbox groups", -// "com.arsdigita.formbuilder.PersistentCheckboxGroup", -// "com.arsdigita.formbuilder.ui.editors.CheckboxGroupEditor" }, -// { "forms", "Date field", "Date fields", -// "com.arsdigita.formbuilder.PersistentDate", -// "com.arsdigita.formbuilder.ui.editors.DateForm" } -// }; -// processListenerTypes = { -// { "forms", "Confirmation email", "Confirmation emails", -// "com.arsdigita.formbuilder.actions.ConfirmEmailListener", -// "com.arsdigita.formbuilder.ui.editors.ConfirmEmailForm" }, -// { "forms", "URL redirect", "URL redirects", -// "com.arsdigita.formbuilder.actions.ConfirmRedirectListener", -// "com.arsdigita.formbuilder.ui.editors.ConfirmRedirectForm" } -// }; -// dataQueries = { -// { "forms", "com.arsdigita.formbuilder.DataQueryUsers", -// "List of all registered users" }, -// { "forms", "com.arsdigita.formbuilder.DataQueryPackages", -// "List of all installed packages" } -// }; -//} - -// init com.arsdigita.populate.apps.Initializer { -// numApps=3; -// PopulateAppPair = { -// //populateForum args: numPosts, numMsgs per post -// { "com.arsdigita.forum.PopulateForum", {3, 5}}, -// //populateDocmgr args: numFolderLevels, numFolders, numFiles -// { "com.arsdigita.docmgr.PopulateDocmgr", {3, 2, 2}}, -// //populateFaq args: numQuestions -// { "com.arsdigita.faq.PopulateFaq", {5}}, -// //populateGlossary args: numWords -// { "com.arsdigita.glossary.PopulateGlossary", {5}}, -// //populateBookmarks args: numBookmarks -// { "com.arsdigita.bookmarks.PopulateBookmarks", {5}} -// }; -// } - -// no longer used - old versioning system? -// init com.arsdigita.versioning.Initializer { } - -// 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" } -// } -// } -// }; diff --git a/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse b/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse old mode 100644 new mode 100755 index 012fc3bea..26f538243 --- a/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse +++ b/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse @@ -1,10 +1,49 @@ -// ccm.core.enterprise.init.nolongerInUse +// ccm.core.enterprise.init // // Old initialization prozess configuration file. -// configurations definitely no longer used (refactored into new initializser system) // +// // init com.arsdigita.globalization.Initializer { +// init com.arsdigita.globalization.LegacyInitializer { +// // See http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc +// charsets = { +// "ISO-8859-1", +// "UTF-8" +// }; +// +// // Each entry in the "locales" list is a 4-tuple of the form +// // {language, country, variant, charset} +// // The charset must be one of the values specified in the "charsets" +// // parameter above. +// locales = { +// {"en", "", "", "UTF-8"}, +// {"en", "GB", "", "UTF-8"}, +// {"en", "US", "", "UTF-8"}, +// {"es", "", "", "UTF-8"}, +// {"es", "ES", "", "UTF-8"}, +// {"da", "", "", "UTF-8"}, +// {"da", "DK", "", "UTF-8"}, +// {"de", "", "", "UTF-8"}, +// {"de", "DE", "", "UTF-8"}, +// {"fr", "", "", "UTF-8"}, +// {"fr", "FR", "", "UTF-8"}, +// {"ru", "", "", "UTF-8"} +// }; +// +// // Default character set for locales not explicitly listed above. +// defaultCharset = "UTF-8"; +// } +// + +//- init com.arsdigita.kernel.LegacyInitializer {} + +// Should get integrated into the same configuration file as parameter +// waf.debug, i.e. ccm-core/kernel.properties. +//- init com.arsdigita.webdevsupport.LegacyInitializer { +//- active = false; +//- } + // ///////////////////////////////////////////////////////////////// @@ -13,48 +52,109 @@ // // ///////////////////////////////////////////////////////////////// +// Move configuration options to enterprise.init.nolongerInUse + +// -init com.arsdigita.kernel.security.LegacyInitializer { +// - securityHelperClass = "com.arsdigita.kernel.security.DefaultSecurityHelper"; +// - sessionTrackingMethod = "cookie"; +// - +// - excludedExtensions = { ".jpg", ".gif", ".png", ".pdf" }; +// - +// -} -// -- As of version 6.6.0 release 12 refactored into the new initializer system -// -- and no longer in use. -// -- As of version 6.5.x still in use! -//init com.arsdigita.notification.LegacyInitializer { -// RequestManagerDelay = 900; // in seconds -// RequestManagerPeriod = 900; // in seconds -// SimpleQueueDelay = 900; // in seconds -// SimpleQueuePeriod = 900; // in seconds -// DigestQueueDelay = 900; // in seconds -// DigestQueuePeriod = 900; // in seconds + +// Set to true when using intermedia search +//-init com.arsdigita.mimetypes.LegacyMimeTypeInitializer { +//- INSOFilterEnabled = false; +//-} + + + +// init com.arsdigita.toolbox.CharsetEncodingProviderInitializer { } + +// init com.arsdigita.ui.LegacyInitializer { +// If using the default SimplePage class, the following +// two parameters specify the class names of the bebop +// components to (optionally) add to margins of pages + +// The is default set of page components +// 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" } +// }; + +// } + +// init com.arsdigita.portal.Initializer { } +// init com.arsdigita.portal.LegacyInitializer { } + + +// The formbuilder application is now deprecated and will +// be removed in the next release. Use the FormItem content +// type instead +// Method commend says: +// /** +// * Called on startup. Note. As you can not find a call +// * to this method in enterprise.ini, this method +// * may appear to execute mysteriously. +// * However, the process that runs through enterprise.ini +// * automitically calls the startup() method of any +// * class that implements com.arsdigita.util.initializer.Initializer +// * present in enterprise.ini +// **/ +// Has to be checked in detail. As of version 6.5 a lot of packages nevertheless +// are using it! +// +// init com.arsdigita.formbuilder.Initializer { } + +// This is an example initializer for populating +// the BebopObjectType & MetaObject stores +//init com.arsdigita.formbuilder.installer.Initializer { +// widgetTypes = { +// { "forms", "Checkbox group", "Checkbox groups", +// "com.arsdigita.formbuilder.PersistentCheckboxGroup", +// "com.arsdigita.formbuilder.ui.editors.CheckboxGroupEditor" }, +// { "forms", "Date field", "Date fields", +// "com.arsdigita.formbuilder.PersistentDate", +// "com.arsdigita.formbuilder.ui.editors.DateForm" } +// }; +// processListenerTypes = { +// { "forms", "Confirmation email", "Confirmation emails", +// "com.arsdigita.formbuilder.actions.ConfirmEmailListener", +// "com.arsdigita.formbuilder.ui.editors.ConfirmEmailForm" }, +// { "forms", "URL redirect", "URL redirects", +// "com.arsdigita.formbuilder.actions.ConfirmRedirectListener", +// "com.arsdigita.formbuilder.ui.editors.ConfirmRedirectForm" } +// }; +// dataQueries = { +// { "forms", "com.arsdigita.formbuilder.DataQueryUsers", +// "List of all registered users" }, +// { "forms", "com.arsdigita.formbuilder.DataQueryPackages", +// "List of all installed packages" } +// }; //} +// init com.arsdigita.populate.apps.Initializer { +// numApps=3; +// PopulateAppPair = { +// //populateForum args: numPosts, numMsgs per post +// { "com.arsdigita.forum.PopulateForum", {3, 5}}, +// //populateDocmgr args: numFolderLevels, numFolders, numFiles +// { "com.arsdigita.docmgr.PopulateDocmgr", {3, 2, 2}}, +// //populateFaq args: numQuestions +// { "com.arsdigita.faq.PopulateFaq", {5}}, +// //populateGlossary args: numWords +// { "com.arsdigita.glossary.PopulateGlossary", {5}}, +// //populateBookmarks args: numBookmarks +// { "com.arsdigita.bookmarks.PopulateBookmarks", {5}} +// }; +// } -// As of version 6.5.x still in use! -// May be ommitted if ccm-ldn-search is used which sets the search engine -// by its own (Lucene) -// As of version 6.6.0 release 2 refactored into the new initializer system. -// Lucene is now initialized as a sub-initializer of ccm-core initializer. -// init com.arsdigita.search.LegacyInitializer {} - -// As of version 6.5.x still in use! -// As of version 6.6.0 release 2 refactored into the new initializer system. -// Lucene is now initialized as a sub-initializer of ccm-core initializer. -//-- init com.arsdigita.search.lucene.LegacyInitializer {} - -// As of version 6.5.x still in use! -// Comment in to use intermedia search -// As of version 6.6.0 release 2 refactored into the new initializer system. -// Intermedia is now initialized as a sub-initializer of ccm-core initializer. -// It is configured via waf.search.indexer Parameter (may be lucene or intermedia). -// If not enabled, initialization is skipped. -//init com.arsdigita.search.intermedia.LegacyInitializer { -// timerDelay = 60; // Parameters for search timer/indexing -// syncDelay = 60; // All units are time in seconds -// maxSyncDelay = 7200; // see com.arsdigita.search.BuildIndex.java -// maxIndexingTime = 7200; // for definitions -// indexingRetryDelay = 60; -//} - -// Package does no longer exist. -// init com.arsdigita.categorization.dispatch.Initializer { } +// no longer used - old versioning system? +// init com.arsdigita.versioning.Initializer { } // Application specific page components // applicationLayouts = { @@ -75,9 +175,3 @@ // } // } // }; - - -// init com.arsdigita.localization.demo.Initializer { } - -// Class no longer part of source code -// init com.arsdigita.bebop.jsp.Initializer { } diff --git a/ccm-core/src/com/arsdigita/core/enterpriseold.init.nolongerInUse b/ccm-core/src/com/arsdigita/core/enterpriseold.init.nolongerInUse new file mode 100644 index 000000000..012fc3bea --- /dev/null +++ b/ccm-core/src/com/arsdigita/core/enterpriseold.init.nolongerInUse @@ -0,0 +1,83 @@ +// ccm.core.enterprise.init.nolongerInUse +// +// Old initialization prozess configuration file. +// configurations definitely no longer used (refactored into new initializser system) +// + + + + +// ///////////////////////////////////////////////////////////////// +// +// Initializer definitely replaced by new initialization system +// +// ///////////////////////////////////////////////////////////////// + + +// -- As of version 6.6.0 release 12 refactored into the new initializer system +// -- and no longer in use. +// -- As of version 6.5.x still in use! +//init com.arsdigita.notification.LegacyInitializer { +// RequestManagerDelay = 900; // in seconds +// RequestManagerPeriod = 900; // in seconds +// SimpleQueueDelay = 900; // in seconds +// SimpleQueuePeriod = 900; // in seconds +// DigestQueueDelay = 900; // in seconds +// DigestQueuePeriod = 900; // in seconds +//} + + +// As of version 6.5.x still in use! +// May be ommitted if ccm-ldn-search is used which sets the search engine +// by its own (Lucene) +// As of version 6.6.0 release 2 refactored into the new initializer system. +// Lucene is now initialized as a sub-initializer of ccm-core initializer. +// init com.arsdigita.search.LegacyInitializer {} + +// As of version 6.5.x still in use! +// As of version 6.6.0 release 2 refactored into the new initializer system. +// Lucene is now initialized as a sub-initializer of ccm-core initializer. +//-- init com.arsdigita.search.lucene.LegacyInitializer {} + +// As of version 6.5.x still in use! +// Comment in to use intermedia search +// As of version 6.6.0 release 2 refactored into the new initializer system. +// Intermedia is now initialized as a sub-initializer of ccm-core initializer. +// It is configured via waf.search.indexer Parameter (may be lucene or intermedia). +// If not enabled, initialization is skipped. +//init com.arsdigita.search.intermedia.LegacyInitializer { +// timerDelay = 60; // Parameters for search timer/indexing +// syncDelay = 60; // All units are time in seconds +// maxSyncDelay = 7200; // see com.arsdigita.search.BuildIndex.java +// maxIndexingTime = 7200; // for definitions +// indexingRetryDelay = 60; +//} + +// Package does no longer exist. +// init com.arsdigita.categorization.dispatch.Initializer { } + +// 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" } +// } +// } +// }; + + +// init com.arsdigita.localization.demo.Initializer { } + +// Class no longer part of source code +// init com.arsdigita.bebop.jsp.Initializer { } diff --git a/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectTraversalAdapter.java b/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectTraversalAdapter.java index e157d20d9..9745b312c 100755 --- a/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectTraversalAdapter.java +++ b/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectTraversalAdapter.java @@ -36,9 +36,8 @@ import java.util.HashSet; public class SimpleDomainObjectTraversalAdapter implements DomainObjectTraversalAdapter { - private static final Logger s_log = - Logger.getLogger( - SimpleDomainObjectTraversalAdapter.class); + private static final Logger s_log = Logger.getLogger( + SimpleDomainObjectTraversalAdapter.class); /** * Rule that indicates the set of properties should be treated * as an inclusion list. ie, don't allow any properties except diff --git a/ccm-core/src/com/arsdigita/domain/installer/DomainObjectTraversalInitializer.java b/ccm-core/src/com/arsdigita/domain/installer/DomainObjectTraversalInitializer.java.nolongerInUse similarity index 100% rename from ccm-core/src/com/arsdigita/domain/installer/DomainObjectTraversalInitializer.java rename to ccm-core/src/com/arsdigita/domain/installer/DomainObjectTraversalInitializer.java.nolongerInUse diff --git a/ccm-core/src/com/arsdigita/domain/installer/package.html b/ccm-core/src/com/arsdigita/domain/installer/package.html.nolongerInUse similarity index 88% rename from ccm-core/src/com/arsdigita/domain/installer/package.html rename to ccm-core/src/com/arsdigita/domain/installer/package.html.nolongerInUse index 7aa459bfb..7a24b47c5 100755 --- a/ccm-core/src/com/arsdigita/domain/installer/package.html +++ b/ccm-core/src/com/arsdigita/domain/installer/package.html.nolongerInUse @@ -4,7 +4,7 @@ ccm-core: Domain Installer - +

Installer for domain system.

diff --git a/ccm-core/src/com/arsdigita/formbuilder/Initializer.java b/ccm-core/src/com/arsdigita/formbuilder/Initializer.java.nolongerInUse similarity index 89% rename from ccm-core/src/com/arsdigita/formbuilder/Initializer.java rename to ccm-core/src/com/arsdigita/formbuilder/Initializer.java.nolongerInUse index 8bf0be18e..b091dd3b3 100755 --- a/ccm-core/src/com/arsdigita/formbuilder/Initializer.java +++ b/ccm-core/src/com/arsdigita/formbuilder/Initializer.java.nolongerInUse @@ -31,10 +31,25 @@ import com.arsdigita.persistence.TransactionContext; import com.arsdigita.initializer.Configuration; import com.arsdigita.initializer.InitializationException; - - import org.apache.log4j.Logger; + + +// //////////////////////////////////////////////////////////////////////// +// +// This old style Initializer is obviously no longer used (for a long time +// and several releases. Formbuilder as an own application is deprecated and +// replaced by content type forms. +// +// Removed. +// +// It is a loader task (loading package type and instance) and should be +// handled there it required in the future. +// +// //////////////////////////////////////////////////////////////////////// + + + /** * Registers the formbuilder package type and creates an instance * that is mounted under formbuilder (this is done only once). @@ -43,8 +58,7 @@ import org.apache.log4j.Logger; * @version $Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $ */ public class Initializer - - implements com.arsdigita.initializer.Initializer { + implements com.arsdigita.initializer.Initializer { private Configuration m_conf = new Configuration(); diff --git a/ccm-core/src/com/arsdigita/formbuilder/installer/package.html b/ccm-core/src/com/arsdigita/formbuilder/installer/package.html index ffa244e88..bd85a5942 100755 --- a/ccm-core/src/com/arsdigita/formbuilder/installer/package.html +++ b/ccm-core/src/com/arsdigita/formbuilder/installer/package.html @@ -3,7 +3,7 @@ Package com.arsdigita. formbuilder.installer - +

Installer for formbuilder service.

diff --git a/ccm-core/src/com/arsdigita/globalization/Charset.java b/ccm-core/src/com/arsdigita/globalization/Charset.java index cba06a850..139441373 100755 --- a/ccm-core/src/com/arsdigita/globalization/Charset.java +++ b/ccm-core/src/com/arsdigita/globalization/Charset.java @@ -39,7 +39,7 @@ import java.math.BigDecimal; public class Charset extends DomainObject { public final static String BASE_DATA_OBJECT_TYPE = - "com.arsdigita.globalization.Charset"; + "com.arsdigita.globalization.Charset"; /** *

diff --git a/ccm-core/src/com/arsdigita/globalization/ClientLocaleProvider.java b/ccm-core/src/com/arsdigita/globalization/ClientLocaleProvider.java index 12e855271..1061ca774 100755 --- a/ccm-core/src/com/arsdigita/globalization/ClientLocaleProvider.java +++ b/ccm-core/src/com/arsdigita/globalization/ClientLocaleProvider.java @@ -34,6 +34,10 @@ public class ClientLocaleProvider implements LocaleProvider { private String m_targetBundle = ""; private String m_acceptLanguages = ""; + /** + * + * @return + */ public Locale getLocale() { ResourceBundle b = null; Locale l = null; @@ -58,9 +62,8 @@ public class ClientLocaleProvider implements LocaleProvider { defaultLocale = Locale.getDefault(); } - b = Globalization.getBundleNoFallback( - m_targetBundle, l, defaultLocale - ); + b = Globalization.getBundleNoFallback( m_targetBundle, l, + defaultLocale ); if (b != null) { break; @@ -75,11 +78,18 @@ public class ClientLocaleProvider implements LocaleProvider { return l; } + /** + * + * @param targetBundle + */ public void setTargetBundle(String targetBundle) { - m_targetBundle = - (targetBundle != null) ? targetBundle : ""; + m_targetBundle = (targetBundle != null) ? targetBundle : ""; } + /** + * + * @param acceptLanguages + */ public void setAcceptLanguages(String acceptLanguages) { m_acceptLanguages = (acceptLanguages != null) ? acceptLanguages : ""; diff --git a/ccm-core/src/com/arsdigita/globalization/Globalized.java b/ccm-core/src/com/arsdigita/globalization/Globalized.java index 36cf879d4..4eb081989 100755 --- a/ccm-core/src/com/arsdigita/globalization/Globalized.java +++ b/ccm-core/src/com/arsdigita/globalization/Globalized.java @@ -17,10 +17,9 @@ * */ package com.arsdigita.globalization; -import java.text.DateFormat; +// import java.text.DateFormat; /** - * * Standard, final constants used by the globalization APIs. This * interface is designed to be extended on a package-by-package basis * to include package-specific constants. A typical package specific @@ -42,19 +41,13 @@ import java.text.DateFormat; */ public interface Globalized { - /** - * The default format for displaying dates. - */ + /** The default format for displaying dates. */ public final static int DATE_DISPLAY_FORMAT = java.text.DateFormat.MEDIUM; - /** - * The default format for displaying time. - */ + /** The default format for displaying time. */ public final static int TIME_DISPLAY_FORMAT = java.text.DateFormat.SHORT; - /** - * Override the value of this string for your particular package. - */ + /** Override the value of this string for your particular package. */ public final static String BUNDLE_NAME = "com.arsdigita.globalization"; } diff --git a/ccm-core/src/com/arsdigita/globalization/LegacyInitializer.java b/ccm-core/src/com/arsdigita/globalization/LegacyInitializer.java.nolongerInUse similarity index 97% rename from ccm-core/src/com/arsdigita/globalization/LegacyInitializer.java rename to ccm-core/src/com/arsdigita/globalization/LegacyInitializer.java.nolongerInUse index f21f02326..271123f67 100755 --- a/ccm-core/src/com/arsdigita/globalization/LegacyInitializer.java +++ b/ccm-core/src/com/arsdigita/globalization/LegacyInitializer.java.nolongerInUse @@ -77,10 +77,10 @@ public class LegacyInitializer implements com.arsdigita.initializer.Initializer getTransactionContext(); txn.beginTxn(); - if ( ! isLoaded() ) { - s_log.info("Globalization Initializer is loading."); - load(); - } + // if ( ! isLoaded() ) { + // s_log.info("Globalization Initializer is loading."); + // load(); + // } LocaleNegotiator.setApplicationLocaleProvider (new ApplicationLocaleProvider()); LocaleNegotiator.setClientLocaleProvider(new ClientLocaleProvider()); diff --git a/ccm-core/src/com/arsdigita/globalization/LocaleNegotiator.java b/ccm-core/src/com/arsdigita/globalization/LocaleNegotiator.java index 0faafe2be..81823db46 100755 --- a/ccm-core/src/com/arsdigita/globalization/LocaleNegotiator.java +++ b/ccm-core/src/com/arsdigita/globalization/LocaleNegotiator.java @@ -101,9 +101,9 @@ import org.apache.log4j.Logger; *

* * @version $Revision: #10 $ $Date: 2004/08/16 $ + * @version $Id: LocaleNegotiator.java 287 2005-02-22 00:29:02Z sskracic $ */ public class LocaleNegotiator { - public final static String versionId = "$Id: LocaleNegotiator.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_cat = Logger.getLogger(LocaleNegotiator.class.getName()); @@ -200,9 +200,8 @@ public class LocaleNegotiator { locale = m_defaultLocale; } - bundle = Globalization.getBundleNoFallback( - targetBundle, locale, m_defaultLocale - ); + bundle = Globalization.getBundleNoFallback( targetBundle, locale, + m_defaultLocale ); // Find a charset we can use to display that Locale's language. charset = getCharsetForLocale(locale, acceptCharsets); diff --git a/ccm-core/src/com/arsdigita/kernel/Initializer.java b/ccm-core/src/com/arsdigita/kernel/Initializer.java index 836b51f57..444b3fa66 100755 --- a/ccm-core/src/com/arsdigita/kernel/Initializer.java +++ b/ccm-core/src/com/arsdigita/kernel/Initializer.java @@ -18,11 +18,18 @@ package com.arsdigita.kernel; +import com.arsdigita.developersupport.DeveloperSupport; import com.arsdigita.domain.DomainObject; import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.kernel.permissions.PermissionManager; import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.runtime.ContextInitEvent; import com.arsdigita.runtime.DomainInitEvent; import com.arsdigita.runtime.GenericInitializer; +import com.arsdigita.webdevsupport.WebDevSupport; + +import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -123,22 +130,71 @@ public class Initializer extends GenericInitializer { URLService.registerFinder(PackageInstance.BASE_DATA_OBJECT_TYPE, new GenericURLFinder("")); + if (Kernel.getSystemParty() == null) { + final DatabaseTransaction transaction = new DatabaseTransaction(); + + transaction.begin(); + + setupSystemParty(); + + transaction.end(); + } // READ-ONLY operation, during initializing a transaction should not // requirred. //TransactionContext txn = SessionManager.getSession() // .getTransactionContext(); //txn.beginTxn(); - s_log.debug("Initializing privilege descriptors..."); + s_log.error("c.ad.kernel.Initializer: Initializing privilege descriptors..."); // Initialize privilege descriptors used in permissions service // Recurring task, reads from database and stores in an internal Map // field. PrivilegeDescriptor.initialize(); - s_log.debug("Done."); + s_log.error("Done."); //txn.commitTxn(); s_log.debug("kernel security domain init completed"); } + /** + * Implementation of the {@link Initializer#init(ContextInitEvent)} + * method. + * + * @param evt The context init event. + */ + @Override + public void init(ContextInitEvent evt) { + s_log.debug("kernel context init begin."); + + Boolean active = KernelConfig.getConfig().isWebdevSupportActive(); + if (Boolean.TRUE.equals(active)) { + s_log.debug("Registering webdev listener"); + DeveloperSupport.addListener(WebDevSupport.getInstance()); + } + + s_log.debug("kernel context init completed"); + } + + /** + * + */ + // Should this be moved to central position for all Initializers? + // E.g. Compound Initializer or at least waf(core) initializer + private void setupSystemParty() { + Party party; + + party = new Party + (new OID(Party.BASE_DATA_OBJECT_TYPE, + new BigDecimal(PermissionManager.SYSTEM_PARTY))) { + public String getName() { + return "ACS System Party"; + } + }; + + party.disconnect(); + + Kernel.setSystemParty(party); + } + } diff --git a/ccm-core/src/com/arsdigita/kernel/KernelConfig.java b/ccm-core/src/com/arsdigita/kernel/KernelConfig.java index a271ae9fd..e6103916f 100755 --- a/ccm-core/src/com/arsdigita/kernel/KernelConfig.java +++ b/ccm-core/src/com/arsdigita/kernel/KernelConfig.java @@ -25,6 +25,8 @@ import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.StringParameter; import java.util.StringTokenizer; +import org.apache.log4j.Logger; + /** * @author Justin Ross * @see com.arsdigita.kernel.Kernel @@ -32,25 +34,55 @@ import java.util.StringTokenizer; */ public final class KernelConfig extends AbstractConfig { - private final Parameter m_debug; - private final Parameter m_permissions; - private final EnumerationParameter m_identifier; // email or "screenName"? - private final Parameter m_SSO; - private final Parameter m_remember; - private final Parameter m_secureLogin; - private final Parameter m_supportedLanguages; + /** A logger instance. */ + private static final Logger s_log = Logger.getLogger(KernelConfig.class); - public KernelConfig() { - m_debug = new BooleanParameter + /** Singelton config object. */ + private static KernelConfig s_conf; + + /** + * Gain a KernelConfig object. + * + * Singelton pattern, don't instantiate a KernelConfig object using the + * constructor directly! + * @return + */ + public static synchronized KernelConfig getConfig() { + if (s_conf == null) { + s_conf = new KernelConfig(); + s_conf.load(); + } + + return s_conf; + } + + /** */ + private static Parameter m_debug = new BooleanParameter ("waf.debug", Parameter.REQUIRED, Boolean.FALSE); - - m_permissions = new BooleanParameter + /** Whether WEB development support should be activated (true) or not. */ + // Handled in OLD initializer c.ad.webdevsupport.LegacyInitializer + private static Parameter m_webdevSupport = new BooleanParameter + ("waf.webdev_support", Parameter.REQUIRED, Boolean.FALSE); + private final Parameter m_permissions = new BooleanParameter ("waf.kernel.data_permission_check_enabled", Parameter.REQUIRED, Boolean.TRUE); - - m_identifier = new EnumerationParameter + /** User Login by screen name or email address */ + private final EnumerationParameter m_identifier = new EnumerationParameter ("waf.kernel.primary_user_identifier", Parameter.REQUIRED, "email"); + private final Parameter m_SSO; + private final Parameter m_remember; + private final Parameter m_secureLogin = new BooleanParameter + ("waf.kernel.secure_login", Parameter.REQUIRED, Boolean.FALSE); + /** String containing the supported languages. + The first one is considered default. */ + private final Parameter m_supportedLanguages = new StringParameter + ("waf.kernel.supported_languages", Parameter.REQUIRED, + "en,de,fr,nl,it,pt,es"); + + public KernelConfig() { + + // Add recognised Login user identification to enumeration parameter m_identifier.put("email", "email"); m_identifier.put("screen_name", "screenName"); @@ -59,18 +91,10 @@ public final class KernelConfig extends AbstractConfig { m_remember = new BooleanParameter ("waf.kernel.remember_login", Parameter.REQUIRED, Boolean.TRUE); - - m_secureLogin = new BooleanParameter - ("waf.kernel.secure_login", Parameter.REQUIRED, Boolean.FALSE); - /** - * String containing the supported languages. The first one is considered - * default. - */ - m_supportedLanguages = new StringParameter - ("waf.kernel.supported_languages", Parameter.REQUIRED, "en,de,fr,nl,it,pt,es"); register(m_debug); + register(m_webdevSupport); register(m_permissions); register(m_identifier); register(m_SSO); @@ -81,10 +105,18 @@ public final class KernelConfig extends AbstractConfig { loadInfo(); } + public final boolean isDebugEnabled() { return ((Boolean) get(m_debug)).booleanValue(); } + /** + * Return true, if WEB developer support should be activated. + */ + public final boolean isWebdevSupportActive() { + return ((Boolean) get(m_webdevSupport)).booleanValue(); + } + public final boolean isDataPermissionCheckEnabled() { return ((Boolean) get(m_permissions)).booleanValue(); } diff --git a/ccm-core/src/com/arsdigita/kernel/LegacyInitializer.java.nolongerInUse b/ccm-core/src/com/arsdigita/kernel/LegacyInitializer.java.nolongerInUse old mode 100755 new mode 100644 index 503021c91..53a0fcabf --- a/ccm-core/src/com/arsdigita/kernel/LegacyInitializer.java.nolongerInUse +++ b/ccm-core/src/com/arsdigita/kernel/LegacyInitializer.java.nolongerInUse @@ -36,6 +36,7 @@ import org.apache.log4j.Logger; * @version $Revision: #39 $ $Date: 2004/08/16 $ * @version $Id: Initializer.java 1169 2006-06-14 13:08:25Z fabrice $ */ +// BaseInitializer set System Party, required for permission critical actions! public class LegacyInitializer extends BaseInitializer { private static final Logger s_log = Logger.getLogger(LegacyInitializer.class); @@ -52,18 +53,19 @@ public class LegacyInitializer extends BaseInitializer { // setupDomainFactory(); // setupURLService(); - TransactionContext txn = SessionManager.getSession() - .getTransactionContext(); - txn.beginTxn(); +// TransactionContext txn = SessionManager.getSession() +// .getTransactionContext(); +// txn.beginTxn(); - s_log.debug("Initializing privilege descriptors..."); +// s_log.debug("Initializing privilege descriptors..."); + s_log.error("kernel LegacyInitializer: Initializing privilege descriptors..."); // Initialize privilege descriptors used in permissions service // Recurring task, reads from database and stores in an internal Map // field. - PrivilegeDescriptor.initialize(); - s_log.debug("Done."); +// PrivilegeDescriptor.initialize(); + s_log.error("kernel LegacyInitializer: Done."); - txn.commitTxn(); +// txn.commitTxn(); } private void setupDomainFactory() { diff --git a/ccm-core/src/com/arsdigita/loader/CoreLoader.java b/ccm-core/src/com/arsdigita/loader/CoreLoader.java index eda11d20d..604aadba6 100755 --- a/ccm-core/src/com/arsdigita/loader/CoreLoader.java +++ b/ccm-core/src/com/arsdigita/loader/CoreLoader.java @@ -19,6 +19,8 @@ package com.arsdigita.loader; import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.globalization.Charset; +import com.arsdigita.globalization.Locale; import com.arsdigita.kernel.EmailAddress; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.KernelExcursion; @@ -38,6 +40,7 @@ import com.arsdigita.mimetypes.MimeType; import com.arsdigita.mimetypes.MimeTypeExtension; import com.arsdigita.mimetypes.TextMimeType; import com.arsdigita.portal.Portal; +import com.arsdigita.runtime.ConfigError; import com.arsdigita.runtime.ScriptContext; import com.arsdigita.ui.admin.Admin; import com.arsdigita.ui.sitemap.SiteMap; @@ -48,17 +51,27 @@ import com.arsdigita.util.parameter.CSVParameterReader; import com.arsdigita.util.parameter.EmailParameter; import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.StringParameter; +import com.arsdigita.util.parameter.StringArrayParameter; import com.arsdigita.util.servlet.HttpHost; import com.arsdigita.web.Application; import com.arsdigita.web.ApplicationType; import com.arsdigita.web.Host; import com.arsdigita.web.Web; - +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; + +import java.util.Arrays; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; // import java.util.Locale; +import java.util.Map; import javax.mail.internet.InternetAddress; @@ -78,6 +91,7 @@ public class CoreLoader extends PackageLoader { private StringParameter m_screen = new StringParameter ("waf.admin.name.screen", Parameter.OPTIONAL, null) { + @Override public Object getDefaultValue() { String email = getEmail(); if (email == null) { @@ -116,6 +130,42 @@ public class CoreLoader extends PackageLoader { ("waf.mime.resource", Parameter.OPTIONAL, "com/arsdigita/loader/mimetypes.properties"); + /** + * Recognized character sets + */ + // In Old Initializer: CHARSETS as List.class + // charsets = {"ISO-8859-1","UTF-8"}; + private final Parameter m_charsets = + new StringArrayParameter( + "waf.globalization.charsets", + Parameter.REQUIRED, + new String[] { "ISO-8859-1","UTF-8" } + ); + + /** + * Each entry in the "locales" list is a 4-tuple of the form + * {language, country, variant, charset} + * The charset must be one of the values specified in the "charsets" + * parameter above. + * + * This parameter is only read once in the initial loading step and stored + * in the database (g11n_locales). Subsequent modifications will have no effect! + * + */ + // In OLD Initializer: LOCALES as List.class + private final Parameter m_locales = + new StringArrayParameter( + "waf.globalization.locales", + Parameter.REQUIRED, + new String[] {"en: : :UTF-8","en:GB: :UTF-8","en:US: :UTF-8" + ,"es: : :UTF-8","es:ES: :UTF-8" + ,"da: : :UTF-8","da:DK: :UTF-8" + ,"de: : :UTF-8","de:DE: :UTF-8" + ,"fr: : :UTF-8","fr:FR: :UTF-8" + ,"ru: : :UTF-8" + } + ); + public CoreLoader() { register(m_email); register(m_screen); @@ -126,6 +176,8 @@ public class CoreLoader extends PackageLoader { register(m_answer); register(m_dispatcher); register(m_resource); + register(m_charsets); + register(m_locales); loadInfo(); } @@ -165,23 +217,70 @@ public class CoreLoader extends PackageLoader { private String getResource() { return (String) get(m_resource); } + + /** + * Retrieve systems recognized character sets. + * + * @return List of recognized character sets. + */ + private List getCharsets() { + String[] charsets = (String[]) get(m_charsets) ; + return (List) Arrays.asList(charsets) ; + } + + /** + * Retrieve the list of supported locales + * + */ + private List getLocales() { + + /** Value of the locales parameter, a string array of + 4-tuple of locale values (see above) */ + String[] locales = (String[]) get(m_locales) ; + + if (locales != null) { + ArrayList localeTupel = new ArrayList(); + for (int i = 0; i < locales.length ; ++i) { + String[] localeSet = StringUtils.split(locales[i],':'); + localeTupel.add(Arrays.asList(localeSet)); + } + return localeTupel; + } else { + + return null; + + } + } public void run(final ScriptContext ctx) { + s_log.error("CoreLoader run method started."); new KernelExcursion() { public void excurse() { setEffectiveParty(Kernel.getSystemParty()); + s_log.error("CoreLoader: Going to init KeyStorage."); KeyStorage.KERNEL_KEY_STORE.init(); + s_log.error("CoreLoader: Going to execute loadHost()."); loadHost(); + s_log.error("CoreLoader: Going to execute loadSubsite()."); loadSubsite(loadKernel()); + s_log.error("CoreLoader: Going to execute loadBebop()."); loadBebop(); + s_log.error("CoreLoader: Going to execute loadWebDev()."); loadWebDev(); + s_log.error("CoreLoader: Going to execute loadSiteMapAdminApp()."); loadSiteMapAdminApp(loadAdminApp()); + s_log.error("CoreLoader: Going to execute loadPermissionsSiteNode()."); loadPermissionsSiteNode(); + s_log.error("CoreLoader: Going to execute loadPortal()."); loadPortal(); + s_log.error("CoreLoader: Going to execute loadMimeTypes()."); loadMimeTypes(); + s_log.error("CoreLoader: Going to execute loadGlobalization()."); + loadGlobalization(); } }.run(); + s_log.error("CoreLoader run method completed."); } /** @@ -204,7 +303,7 @@ public class CoreLoader extends PackageLoader { // the initializer each time the system starts. So it's redundant here. // Using initializer code is favourable because it may be conditionally // performed, depending on configuration (Lucene or Intermedia). - // But the currently given implementation requires the the loader + // But the currently given implementation requires the loader // instruction here to let the code initialization time (i.e. at each // startup) work properly. If left out here instantiation in // c.ad.search.lucene.Initializer (public final static Loader LOADER) @@ -215,21 +314,30 @@ public class CoreLoader extends PackageLoader { //--com.arsdigita.search.lucene.LegacyInitializer.LOADER.load(); } + /** + * Create Root Site Node + * @return root node + */ private SiteNode loadKernel() { // Create Root Site Node + s_log.error("CoreLoader: Going to execute method loadKernel()."); final SiteNode rootNode = SiteNode.createSiteNode(null, null); + s_log.error("loadKernel: creating system administrator."); createSystemAdministrator(); // Create Package Types and Instances + s_log.error("loadKernel: creating Package Types and Instances."); PackageType subsite = PackageType.create ("acs-subsite", "ACS Subsite", "ACS Subsites", "http://arsdigita.com/acs-subsite/"); PackageInstance subsiteInstance = subsite.createInstance("Main Site"); // Mount instances. + s_log.error("loadKernel: mount Instances."); rootNode.mountPackage(subsiteInstance); + s_log.error("CoreLoader: Going to complete method loadKernel()."); return rootNode; } @@ -237,6 +345,7 @@ public class CoreLoader extends PackageLoader { // exists after installation. private void createSystemAdministrator() { + s_log.error("CoreLoader: execution of method createSystemAdministrator()."); final String DO_NOT_CREATE = "*do not create*"; String emailAddress = getEmail(); @@ -246,6 +355,9 @@ public class CoreLoader extends PackageLoader { String password = getPassword(); String passwordQuestion = getQuestion(); String passwordAnswer = getAnswer(); + s_log.error("createSystemAdministrator: EmailAddr: " + emailAddress + + "\n screenName: " + screenName + + "\n givenName: " + givenName ); // Allow not creating system administrator account. // (Specified by setting parameter @@ -263,6 +375,7 @@ public class CoreLoader extends PackageLoader { // Create the system administrator user. + s_log.error("createSystemAdministrator(): going to create new User."); User sa = new User(); sa.setPrimaryEmail(new EmailAddress(emailAddress)); if (screenName != null && @@ -273,6 +386,7 @@ public class CoreLoader extends PackageLoader { sa.getPersonName().setFamilyName(familyName); // Save the system administrator's authentication credentials. + s_log.error("createSystemAdministrator(): going to save credentials."); UserAuthentication auth = UserAuthentication.createForUser(sa); auth.setPassword(password); auth.setPasswordQuestion(passwordQuestion); @@ -280,15 +394,19 @@ public class CoreLoader extends PackageLoader { // Grant the system administrator universal "admin" permission. + s_log.error("createSystemAdministrator(): going to grant admin perms."); PermissionService.grantPermission (new UniversalPermissionDescriptor (PrivilegeDescriptor.ADMIN, sa)); - s_log.info("Adding administrator: \"" + givenName + " " + + s_log.error("Adding administrator: \"" + givenName + " " + familyName + "\" <" + emailAddress + ">"); + s_log.error("CoreLoader: method createSystemAdministrator() completed."); + } private void loadSubsite(SiteNode rootNode) { + s_log.error("CoreLoader: Going to execute method loadSubsite()."); String sDispatcher = ""; PackageInstance packageInstance = rootNode.getPackageInstance(); @@ -453,4 +571,62 @@ public class CoreLoader extends PackageLoader { } } + private void loadGlobalization() throws ConfigError { + List charsets = (List) getCharsets(); + if ( charsets == null ) { + throw new ConfigError + ("You must specify at least one charset in the m_charsets " + + "parameter of the core loader parameter section. " + + "UTF-8 would be a good first choice."); + } + + Map charsetMap = new HashMap(); + + for (Iterator i=charsets.iterator(); i.hasNext(); ) { + String charsetName = (String) i.next(); + s_log.debug("Dealing with charset name: " + charsetName ); + + // Check if this is a valid charset. Is there a better way to do + // this? - vadimn@redhat.com, Mon 2002-07-29 14:47:41 -0400 + try { + new OutputStreamWriter(new ByteArrayOutputStream(), charsetName); + } catch (UnsupportedEncodingException ex) { + throw new ConfigError + (charsetName + " is not a supported charset"); + } + Charset charset = new Charset(); + charset.setCharset(charsetName); + charset.save(); + charsetMap.put(charsetName, charset); + } + + List locales = (List) getLocales(); + + if ( locales == null ) { + throw new ConfigError + ("You must specify at least one locale in the m_locales " + + "parameter of core loader parameter section. " + + "The \"en\" locale is probably required."); + } + + for (Iterator i=locales.iterator(); i.hasNext(); ) { + List localeData = (List) i.next(); + String language = (String) localeData.get(0); + String country = (String) localeData.get(1); + String variant = (String) localeData.get(2); + String charsetName = (String) localeData.get(3); + Locale locale = new Locale(language, country, variant); + + Charset defaultCharset = (Charset) charsetMap.get(charsetName); + if ( defaultCharset == null ) { + throw new ConfigError + ("You must list " + charsetName + " in the \"m_charsets\" " + + "parameter before using it in the \"m_locales\" " + + "\" parameter."); + } + locale.setDefaultCharset(defaultCharset); + locale.save(); + } + } + } diff --git a/ccm-core/src/com/arsdigita/loader/CoreLoader_parameter.properties b/ccm-core/src/com/arsdigita/loader/CoreLoader_parameter.properties index 94871efb6..98e296cce 100755 --- a/ccm-core/src/com/arsdigita/loader/CoreLoader_parameter.properties +++ b/ccm-core/src/com/arsdigita/loader/CoreLoader_parameter.properties @@ -37,3 +37,13 @@ waf.login.dispatcher.purpose=Implements the login ui. waf.mime.resource.title=Mime Types Resource waf.mime.resource.purpose=Mime types are loaded from this resource + +waf.globalization.charsets.title=Recognized Character Sets +waf.globalization.charsets.purpose=List containing the recognized character sets. +waf.globalization.charsets.example="ISO-8859-1,UTF-8" +waf.globalization.charsets.format=[StringArray] + +waf.globalization.locales.title=Locales +waf.globalization.locales.purpose=List of locales, each local is a UNIQUE 4-tuple of the form language:country:variant:charset +waf.globalization.locales.example="en: : :UTF-8, en:GB: :UTF-8, de: : :UTF-8, de:DE: :UTF-8" +waf.globalization.locales.format=[StringArray] diff --git a/ccm-core/src/com/arsdigita/webdevsupport/Initializer.java b/ccm-core/src/com/arsdigita/webdevsupport/LegacyInitializer.java.nolongerInUse similarity index 86% rename from ccm-core/src/com/arsdigita/webdevsupport/Initializer.java rename to ccm-core/src/com/arsdigita/webdevsupport/LegacyInitializer.java.nolongerInUse index c6520a944..33918ffb2 100755 --- a/ccm-core/src/com/arsdigita/webdevsupport/Initializer.java +++ b/ccm-core/src/com/arsdigita/webdevsupport/LegacyInitializer.java.nolongerInUse @@ -25,22 +25,30 @@ import com.arsdigita.initializer.InitializationException; import com.arsdigita.developersupport.DeveloperSupport; import org.apache.log4j.Logger; + +// /////////////////////////////////////////////////////////// +// +// Moved to core initializer +// +// /////////////////////////////////////////////////////////// + + /** * Initializer * * @version $Revision: #17 $ $Date: 2004/08/16 $ */ -public class Initializer extends BaseInitializer { +public class LegacyInitializer extends BaseInitializer { private Configuration m_conf = new Configuration(); public final static String ACTIVE = "active"; private static final Logger s_log = - Logger.getLogger(Initializer.class); + Logger.getLogger(LegacyInitializer.class); - public Initializer() throws InitializationException { + public LegacyInitializer() throws InitializationException { m_conf.initParameter(ACTIVE, "Flag to turn on/off developer support", Boolean.class);