diff --git a/ccm-core/src/com/arsdigita/core/Loader.java.nolongerInUse b/ccm-core/src/com/arsdigita/core/Loader.java.nolongerInUse deleted file mode 100755 index 4c97363b9..000000000 --- a/ccm-core/src/com/arsdigita/core/Loader.java.nolongerInUse +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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; - -/** - * 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 -} diff --git a/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse b/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse deleted file mode 100755 index 26f538243..000000000 --- a/ccm-core/src/com/arsdigita/core/enterprise.init.nolongerInUse +++ /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"; -// } -// - -//- 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; -//- } - - - -// ///////////////////////////////////////////////////////////////// -// -// Initializer definitely replaced by new initialization system -// -// ///////////////////////////////////////////////////////////////// - -// 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" }; -// - -// -} - - -// 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/enterpriseold.init.nolongerInUse b/ccm-core/src/com/arsdigita/core/enterpriseold.init.nolongerInUse deleted file mode 100644 index 012fc3bea..000000000 --- a/ccm-core/src/com/arsdigita/core/enterpriseold.init.nolongerInUse +++ /dev/null @@ -1,83 +0,0 @@ -// 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/dispatcher/ParameterProvider.java.nolongerInUse b/ccm-core/src/com/arsdigita/dispatcher/ParameterProvider.java.nolongerInUse deleted file mode 100755 index b51d78307..000000000 --- a/ccm-core/src/com/arsdigita/dispatcher/ParameterProvider.java.nolongerInUse +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2001-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; -/** - * @deprecated use com.arsdigita.util.ParameterProvider instead - * @see com.arsdigita.util.ParameterProvider - */ -public interface ParameterProvider extends com.arsdigita.util.ParameterProvider -{ -} diff --git a/ccm-core/src/com/arsdigita/initializer/Configuration.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/Configuration.java.nolongerInUse deleted file mode 100755 index b90f72985..000000000 --- a/ccm-core/src/com/arsdigita/initializer/Configuration.java.nolongerInUse +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2001-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.initializer; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * This class is used by the initialization system to pass configuration - * parameters to an initializer. Every initializer should contain a member - * variable with exactly one instance of this class. The initializer should - * instantiate this class in the constructor and set the types and optionally - * set default values for each parameter the initializer requires. - * - *
- *  public class MyInitializer implements Initializer {
- *
- *      Configuration m_config = new Configuration();
- *
- *      public MyInitializer() throws InitializationException {
- *          m_config.initParameter("stringParam", "This is a usage string.",
- *                                 String.class,"This is a string.");
- *          m_config.initParameter("intParam",
- *                                 "Please enter a value for the intParam.")
- *          m_config.initParameter("listParam", "Should be a list.",
- *                                 java.util.List.class, new ArrayList());
- *      }
- *
- *      public Configuration getConfiguration() {
- *          return m_config;
- *      }
- *
- *      public void startup() {
- *          // Run startup code here.
- *      }
- *
- *      public void shutdown() {
- *          // Run shutdown code here.
- *      }
- *
- *  }
- *  
- * - * @author rhs@mit.edu - * @version $Id: Configuration.java 287 2005-02-22 00:29:02Z sskracic $ - */ - -public class Configuration { - - Map m_parameters = new HashMap(); - Map m_types = new HashMap(); - Map m_usage = new HashMap(); - - /** - * Initializes the parameter to the default value. - * - * @param name The parameter name. - * @param usage Documentation on the parameter usage. - * @param type The parameter type. - * @param defaultValue The parameter default value. - **/ - - public void initParameter(String name, String usage, - Class type, Object defaultValue) - throws InitializationException { - if (m_parameters.containsKey(name)) - throw new InitializationException("Parameter " + name + - " already defined."); - m_types.put(name, type); - typeCheck(name, defaultValue); - m_parameters.put(name, defaultValue); - m_usage.put(name, usage); - } - - /** - * Initializes the parameter, passing in null as the default value. - * - * @param name The parameter name. - * @param usage Documentation on the parameter usage. - * @param type The parameter type. - **/ - - public void initParameter(String name, String usage, Class type) - throws InitializationException { - initParameter(name, usage, type, null); - } - - private void paramCheck(String name) throws InitializationException { - if (!m_parameters.containsKey(name)) - throw new InitializationException( - "No such parameter: " + name + ", legal parameters are: " + - getParameterNames() - ); - } - - private void typeCheck(String name, Object value) - throws InitializationException { - if (value == null) - return; - Class cls = (Class) m_types.get(name); - if (!cls.isInstance(value)) - throw new InitializationException( - "Parameter " + name + " must be of type " + cls.getName() - ); - } - - /** - * Sets the parameter specified by name to the value - * - * @param name The parameter name. - * @param value The parameter value. - **/ - - public void setParameter(String name, Object value) - throws InitializationException { - //paramCheck(name); - //typeCheck(name, value); - m_parameters.put(name, value); - } - - /** - * Returns the parameter value for the parameter specified by name. - * - * @param name The parameter name. - * - * @return The parameter value. - **/ - - public Object getParameter(String name) throws InitializationException { - //paramCheck(name); - return m_parameters.get(name); - } - - /** - * Returns true if this configuration has the specified parameter. - * - * @param name The parameter. - * - * @return True if the configuration contains the parameter, - * false otherwise. - **/ - - public boolean hasParameter(String name) { - return m_parameters.containsKey(name); - } - - /** - * Returns the legal parameter names for this Configuration object. - **/ - - public Set getParameterNames() { - return m_parameters.keySet(); - } - - public String toString() { - return ""; - } - -} diff --git a/ccm-core/src/com/arsdigita/initializer/GenericInitializer.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/GenericInitializer.java.nolongerInUse deleted file mode 100755 index 9182040e6..000000000 --- a/ccm-core/src/com/arsdigita/initializer/GenericInitializer.java.nolongerInUse +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.initializer; - -/** - * Subject to change. - * - * @author Justin Ross <jross@redhat.com> - */ -public final class GenericInitializer implements Initializer { - private final Configuration m_config = new Configuration(); - private final String m_name; - - public GenericInitializer(final String name) { - if (name == null) throw new IllegalArgumentException(); - - m_name = name; - } - - public Configuration getConfiguration() { - return m_config; - } - - public void startup() throws InitializationException { /* empty */ } - public void shutdown() throws InitializationException { /* empty */ } - - public String toString() { - return m_name; - } - - public boolean equals(final Object other) { - if (other != null && other instanceof GenericInitializer) { - return m_name.equals(((GenericInitializer) other).m_name); - } else { - return super.equals(other); - } - } - - public int hashCode() { - return m_name.hashCode(); - } -} diff --git a/ccm-core/src/com/arsdigita/initializer/InitializationException.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/InitializationException.java.nolongerInUse deleted file mode 100755 index 2ae387794..000000000 --- a/ccm-core/src/com/arsdigita/initializer/InitializationException.java.nolongerInUse +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2001-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.initializer; - -import com.arsdigita.util.UncheckedWrapperException; - -/** - * InitializationException - * - * @author rhs@mit.edu - * @version $Id: InitializationException.java 287 2005-02-22 00:29:02Z sskracic $ - */ - -public class InitializationException extends UncheckedWrapperException { - - public InitializationException(String message) { - super(message); - } - - public InitializationException(Throwable rootCause) { - super(rootCause); - } - - public InitializationException(String message, Throwable rootCause) { - super(message, rootCause); - } -} diff --git a/ccm-core/src/com/arsdigita/initializer/Initializer.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/Initializer.java.nolongerInUse deleted file mode 100755 index 2dd413b8f..000000000 --- a/ccm-core/src/com/arsdigita/initializer/Initializer.java.nolongerInUse +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2001-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.initializer; - -/** - * OLD INITIALIZATION SYSTEM - DEPRECATED - * - * Any class implementing this interface may appear in an initialization - * script read in by the Script class. A class that does this should construct - * its own configuration object and initialize the parameters with the - * appropriate types and default values. This object should be returned by the - * getConfiguration() method. This configuration object will then be filled - * out by the Script class with whatever values appear in the initialization - * script. - * - *
- *  public class MyInitializer implements Initializer {
- *
- *      Configuration m_config = new Configuration();
- *
- *      public MyInitializer() throws InitializationException {
- *          m_config.initParameter("stringParam", "This is a usage string.",
- *                                 String.class,"This is a string.");
- *          m_config.initParameter("intParam",
- *                                 "Please enter a value for the intParam.")
- *          m_config.initParameter("listParam", "Should be a list.",
- *                                 java.util.List.class, new ArrayList());
- *      }
- *
- *      public Configuration getConfiguration() {
- *          return m_config;
- *      }
- *
- *      public void startup() {
- *          // Run startup code here.
- *      }
- *
- *      public void shutdown() {
- *          // Run shutdown code here.
- *      }
- *
- *  }
- *  
- * - * The following syntax may then be used in an initialization script: - * - *
- *  init MyInitializer {
- *      stringParam = "foo";
- *      intParam = 3;
- *      listParam = { "foo", "bar", "baz" };
- *  }
- *  
- * - * @author rhs@mit.edu - * @version $Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $ - */ - -public interface Initializer { - - /** - * Returns the configuration object used by this initializer. - */ - Configuration getConfiguration(); - - /** - * Called on startup. - */ - void startup() throws InitializationException; - - /** - * Called on shutdown. It's probably not a good idea to depend on this - * being called. - */ - void shutdown()throws InitializationException; - -} diff --git a/ccm-core/src/com/arsdigita/initializer/InitializerErrorReport.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/InitializerErrorReport.java.nolongerInUse deleted file mode 100755 index fe33d681b..000000000 --- a/ccm-core/src/com/arsdigita/initializer/InitializerErrorReport.java.nolongerInUse +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.initializer; - -import com.arsdigita.logging.ErrorReport; -import java.util.ArrayList; -import java.util.Iterator; - - -/** - * This is an advanced servlet error report generator - * which dumps practically all the information it can - * find about the servlet request to the logs. It also - * sets a request attribute containing the ACS Error Report - * (guru meditation) code. - */ -public class InitializerErrorReport extends ErrorReport { - - private Initializer m_initializer; - - public InitializerErrorReport(Throwable throwable, - Initializer initializer) { - super(throwable); - - m_initializer = initializer; - - // Take great care such that if something goes - // wrong while creating the error report, we don't - // let the new exception propagate thus loosing the - // one we're actually trying to report on. - try { - addInitializer(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - addConfig(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void addInitializer() { - if (m_initializer == null) { - return; - } - - ArrayList lines = new ArrayList(); - - lines.add("Classname: "+ m_initializer.getClass().getName()); - - addSection("Initializer summary", lines); - } - - private void addConfig() { - if (m_initializer == null) { - return; - } - - ArrayList lines = new ArrayList(); - - Configuration config = m_initializer.getConfiguration(); - Iterator params = config.getParameterNames().iterator(); - while (params.hasNext()) { - String name = (String)params.next(); - Object value = config.getParameter(name); - - lines.add(name + ": " + value); - } - - addSection("Initializer parameters", lines); - } -} diff --git a/ccm-core/src/com/arsdigita/initializer/Script.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/Script.java.nolongerInUse deleted file mode 100755 index 1abc6b375..000000000 --- a/ccm-core/src/com/arsdigita/initializer/Script.java.nolongerInUse +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2001-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.initializer; - -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.Logger; - -import java.io.StringReader; -import java.io.Reader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Script - * - * @author rhs@mit.edu - * @version $Id: Script.java 738 2005-09-01 12:36:52Z sskracic $ - * @version $Id: Script.java 738 2005-09-01 12:36:52Z sskracic $ - */ - -public class Script { - - private static final Logger s_log = - Logger.getLogger(Script.class); - - private Map m_initMap = new HashMap(); - private List m_initializers = new ArrayList(); - private String m_lastInitializerToRun; - private boolean m_isStarted = false; - private boolean m_isShutdown = false; - - /** - * Constructs a new initialization script from the given string buffer. - * - * @param bs The script. - **/ - - public Script(StringBuffer bs) throws InitializationException { - this(bs, null); - } - - public Script(StringBuffer bs, String iniName) throws InitializationException { - this(new StringReader(bs.toString()), iniName); - } - - /** - * Constructs a new initialization script from the given string. - * - * @param s The script. - **/ - - public Script(String s) throws InitializationException { - this(s, null); - } - - public Script(String s, String iniName) throws InitializationException { - this(new StringReader(s), iniName); - } - - /** - * Constructs a new initialization script from the given input stream. - * - * @param is The script. - **/ - - public Script(InputStream is) throws InitializationException { - this(is, null); - } - - public Script(InputStream is, String iniName) throws InitializationException { - this(new InputStreamReader(is), iniName); - } - - /** - * Constructs a new initialization script from the given reader. - * - * @param r The script. - **/ - - public Script(Reader r) throws InitializationException { - this(r, null); - } - - /** - * Constructs a new Script - * - * @param r Reader for the script parser - * @param iniName Name of the last initializer to run, or null. - * Used to selectively run only part of the initialization script - * - * @throws InitializationException - */ - public Script(Reader r, String iniName) throws InitializationException { - m_lastInitializerToRun = iniName; - ScriptParser sp = new ScriptParser(r); - try { - sp.parse(this); - } catch (ParseException e) { - // FIXME: what's the purpose of the errTok variable? I'm commenting - // it out. -- 2002-11-26 - logInitializationFailure(null, false, e); - // Token errTok = e.currentToken.next; - throw new InitializationException(e.getMessage()); - } catch (InitializationException e) { - logInitializationFailure(null, false, e); - throw e; - } catch (RuntimeException e) { - logInitializationFailure(null, false, e); - throw e; - } - } - - private Script(final Reader r, final boolean configOnly) - throws InitializationException { - final ScriptParser sp = new ScriptParser(r); - sp.setConfigOnly(configOnly); - try { - sp.parse(this); - } catch (ParseException e) { - logInitializationFailure(null, false, e); - throw new InitializationException(e.getMessage()); - } - } - - public static final Script readConfig(final Reader reader) - throws InitializationException { - if (reader == null) throw new IllegalArgumentException(); - - return new Script(reader, true); - } - - /** - * Adds an initializer to the script. - * - * @param ini The initializer. - * @return true if the parser should continue adding initializers - **/ - public boolean addInitializer(Initializer ini) - throws InitializationException { - if (m_isStarted) { - throw new InitializationException( - "This script has already been started." - ); - } - String initializerName = ini.getClass().getName(); - - if (initializerName.equals(GenericInitializer.class.getName())) { - initializerName = ini.toString(); - } - - m_initializers.add(ini); - m_initMap.put(initializerName, ini); - - final boolean continueAddingInitializers = - !initializerName.equals(m_lastInitializerToRun); - - return continueAddingInitializers; - } - - public Initializer getInitializer(final String name) { - return (Initializer) m_initMap.get(name); - } - - /** - * Returns all the initializers specified in this script. - * - * @return A list of initializers. - **/ - - public List getInitializers() { - List result = new ArrayList(); - result.addAll(m_initializers); - return result; - } - - /** - * Starts up all initializers that this script contains. - **/ - - public Set startup() throws InitializationException { - return startup(null); - } - - /** - * Starts up the specified initializer and any initializers it requires in - * order to start. - * - * @param iniName The name of the initializer last to start. Note: - * This parameter is redundant, as if it is set in the constructor, - * only initializers up to the final one will be parsed. - * - * @return A Collection containing the names of all initalizers run - **/ - - public Set startup(String iniName) throws InitializationException { - HashSet initializersRun = new HashSet(); - Initializer ini = null; - - for (int i = 0; i < m_initializers.size(); i++) { - ini = (Initializer) m_initializers.get(i); - - if (s_log.isInfoEnabled()) { - s_log.info("Running initializer " + - ini.getClass().getName() + - " (" + (i + 1) + " of " + m_initializers.size() + ")"); - } - - final String name = ini.getClass().getName(); - - ini.startup(); - initializersRun.add(ini); - if (name.equals(iniName)) { - break; - } - } - - s_log.info("Initialization Complete"); - return initializersRun; - } - - /** - * Shuts down all initializers that this script contains. - **/ - - public void shutdown() throws InitializationException { - shutdown(null); - } - - /** - * Shuts down the specified initializer and any initializers it required - * in order to start. - * - * @param iniName The name of the initializer to stop. - **/ - - public void shutdown(String iniName) throws InitializationException { - if (m_isShutdown) { - throw new InitializationException( - "Shutdown has already been called." - ); - } - if (!m_isStarted) { - throw new InitializationException( - "Startup hasn't been called yet." - ); - } - - boolean shutdown = false; - if (iniName == null) { - shutdown = true; - } - for (int i = m_initializers.size() - 1; i >= 0; i--) { - Initializer ini = (Initializer) m_initializers.get(i); - - if (ini.getClass().getName().equals(iniName)) { - shutdown = true; - } - - if (shutdown) { - ini.shutdown(); - } - } - m_isShutdown = true; - } - - protected void finalize() throws Throwable { - try { - if (m_isStarted && !m_isShutdown) { - try { - shutdown(); - } catch (Throwable t) { - s_log.error("Error in Script.finalize:"); - t.printStackTrace(System.err); - } - } - - } finally { - super.finalize(); - } - - - } - - private void logInitializationFailure(Initializer initializer, - final boolean loggerIsInitialized, - Throwable t) { - InitializerErrorReport report = new InitializerErrorReport(t, initializer); - - String msg = "Fatal error loading initialization script"; - if (!loggerIsInitialized) { - BasicConfigurator.configure(); - } - report.logit(); - } -} diff --git a/ccm-core/src/com/arsdigita/initializer/ScriptParser.jj.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/ScriptParser.jj.nolongerInUse deleted file mode 100755 index d7fd96665..000000000 --- a/ccm-core/src/com/arsdigita/initializer/ScriptParser.jj.nolongerInUse +++ /dev/null @@ -1,190 +0,0 @@ -options { - STATIC = false; - DEBUG_PARSER = false; -} - -PARSER_BEGIN(ScriptParser) - -package com.arsdigita.initializer; - -import com.arsdigita.util.Classes; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -/** - * ScriptParser.java - * - * @author rhs@mit.edu - * @version $Revision: #6 $ $Date: 2004/03/01 $ - */ - -public class ScriptParser { - - public final static String versionId = "$Id: ScriptParser.jj 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/03/01 15:52:03 $"; - - boolean m_configOnly = false; - - public void setConfigOnly(boolean configOnly) { - m_configOnly = configOnly; - } - -} - -PARSER_END(ScriptParser) - -SKIP: -{ - " " - | "\t" - | "\n" - | "\r" -} - -TOKEN: -{ - - | - | - | - | - | - | -} - -TOKEN [IGNORE_CASE]: -{ - -} - -TOKEN: -{ - (|)*> - | <#CH: ["a" - "z", "A" - "Z", "_", "$"]> - | )+ ()+> - | )+> - | <#DIGIT: ["0" - "9"]> - | -} - -SPECIAL_TOKEN: -{ - -} - -void parse(Script s) throws InitializationException : -{ - Initializer i; -} -{ - ( i = initializer() { if ( !s.addInitializer(i)) return; } )* -} - -Initializer initializer() throws InitializationException : -{ - Initializer i; - Configuration c; -} -{ - i = initializerClass() { c = i.getConfiguration(); } - - ( assignment(c) )* - - { return i; } -} - -Initializer initializerClass() throws InitializationException : -{ - Token t; - StringBuffer className = new StringBuffer(); -} -{ - t = { className.append(t.image); } - ( t = { className.append("."); className.append(t.image); } ) * - { - if (m_configOnly) { - return (Initializer) Classes.newInstance - (GenericInitializer.class, - new Class[] {String.class}, - new Object[] {className.toString()}); - } - - try { - Class cls = Class.forName(className.toString()); - Constructor cons = cls.getConstructor(new Class[0]); - return (Initializer) cons.newInstance(new Object[0]); - } catch (ClassNotFoundException e) { - throw new InitializationException("Couldn't find " + className); - } catch (NoSuchMethodException e) { - throw new InitializationException( - className + - " must implement com.arsdigita.initializer.Initializer" - ); - } catch (InstantiationException e) { - throw new InitializationException( - "Error instantiating " + className + ": " + e.getMessage() - ); - } catch (ClassCastException e) { - throw new InitializationException( - className + - " must implement com.arsdigita.initializer.Initializer" - ); - } catch (IllegalAccessException e) { - throw new InitializationException(className + " must be public."); - } catch (InvocationTargetException e) { - throw new InitializationException( - "Error instantiating " + className + ": " + - e.getTargetException().getMessage() - ); - } - } -} - -void assignment(Configuration c) throws InitializationException : -{ - String param; - Object value; -} -{ - param = lhs() value = rhs() - { - c.setParameter(param, value); - } -} - -String lhs() : -{ - Token t; -} -{ - t = { return t.image; } -} - -Object rhs() : -{ - Token t; - Object result; -} -{ - t = { return t.image.substring(1, t.image.length() - 1); } - | t = { return new Integer(t.image); } - | t = { return new Float(t.image); } - | { return Boolean.TRUE; } - | { return Boolean.FALSE; } - | result = list() { return result; } -} - - -List list() : -{ - List l = new ArrayList(); - Object o; -} -{ - - [ o = rhs() { l.add(o); } ( o = rhs() { l.add(o); } )* ] - - { return l; } -} diff --git a/ccm-core/src/com/arsdigita/initializer/Startup.java.nolongerInUse b/ccm-core/src/com/arsdigita/initializer/Startup.java.nolongerInUse deleted file mode 100755 index 277c5cdcd..000000000 --- a/ccm-core/src/com/arsdigita/initializer/Startup.java.nolongerInUse +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2001-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.initializer; - -import com.arsdigita.util.ResourceManager; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.Reader; -import java.util.Set; - -/** - * Convenience class designed to run initializers. Either manually specify the - * values for web app root and script name, or set java properties with names - * WEB_APP_ROOT or SCRIPT_NAME. - * - * @author Michael Bryzek - * @author Dennis Gregorovic - * @version $Id: Startup.java 738 2005-09-01 12:36:52Z sskracic $ - * @since ACS 4.7 - * - **/ -public class Startup { - - /** The name of the property containing the web app root **/ - public static final String WEB_APP_ROOT = "webAppRoot"; - - /** The name of the property containing the script name **/ - public static final String SCRIPT_NAME = "scriptName"; - - private String m_webAppRoot; - private String m_scriptName; - private String m_lastInitializer; - private Script m_ini; - - /** - * Sets up environment variables. Example: - * - *
-     * String scriptName = "/WEB-INF/resources/enterprise.init";
-     * String webAppRoot =
-     *    "/usr/local/jakarta-tomcat-3.2.3/webapps/enterprise";
-     *
-     *  Startup startup = new Startup(webAppRoot, scriptName);
-     *  startup.init();
-     *
- * - * @param webAppRoot The web app root to use (e.g. $TOMCAT_HOME/webapps/enterprise); - * @param scriptName The relative (from web app root) path to the - * script that defines the initializers - * (e.g. /WEB-INF/resources/enterprise.init) - * - **/ - public Startup(String webAppRoot, String scriptName) { - m_webAppRoot = webAppRoot; - m_scriptName = scriptName; - } - - - /** - * Wrapper for {@link #Startup(String, String)} which looks for - * the system properties named WEB_APP_ROOT and SCRIPT_NAME. - * - * @exception InitializationException If we cannot find either property. - **/ - public Startup() throws InitializationException { - this(getProperty(WEB_APP_ROOT), getProperty(SCRIPT_NAME)); - } - - - /** - * Sets the name of the last initializer to run. If not set, all the - * initializers will run. - * - * @param lastInitializer The name of the last initializer to run - * (e.g. com.arsdigita.persistence.Initializer) - **/ - public void setLastInitializer(String lastInitializer) { - m_lastInitializer = lastInitializer; - } - - - /** - * Starts up the web environment for the ACS. - * - * @return Collection of the names of all initializers run. - **/ - public Set init() throws InitializationException { - ResourceManager rm = ResourceManager.getInstance(); - rm.setWebappRoot(new File(m_webAppRoot)); - - Reader r; - try { - r = new FileReader(m_scriptName); - } catch (FileNotFoundException e) { - throw new InitializationException("Couldn't find " + m_scriptName); - } - - Set initializersRun = null; - try { - if (m_lastInitializer == null) { - m_ini = new Script(r); - initializersRun = m_ini.startup(); - } else { - m_ini = new Script(r, m_lastInitializer); - initializersRun = m_ini.startup(m_lastInitializer); - } - } catch (InitializationException e) { - e.printStackTrace(System.err); - throw new InitializationException - ("Error loading init script: " + e.getMessage()); - } - - return initializersRun; - } - - - /** - * Shut down the startup script. - **/ - public void destroy() { - m_ini.shutdown(); - } - - /** - * Helper method to retrieve the specified property or throw an - * exception if the property doesn't exist or if the property was - * the empty string. - **/ - private static String getProperty(String propertyName) throws InitializationException { - String property = System.getProperty(propertyName); - if (property == null || property.trim().length() == 0) { - throw new InitializationException - ("The " + propertyName + " system property could not be " + - "found or was empty"); - } - return property; - } -} diff --git a/ccm-core/src/com/arsdigita/initializer/package.html b/ccm-core/src/com/arsdigita/initializer/package.html deleted file mode 100755 index 74a5c02e2..000000000 --- a/ccm-core/src/com/arsdigita/initializer/package.html +++ /dev/null @@ -1,19 +0,0 @@ - - - -Package X - - - -

- -Provides a simple framework for initializing components at system -startup time. -

-

- Old Initialization System - deprecated! - -

- - - diff --git a/ccm-core/src/com/arsdigita/search/LegacyInitializer.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/LegacyInitializer.java.nolongerInUse deleted file mode 100755 index 5f5921cab..000000000 --- a/ccm-core/src/com/arsdigita/search/LegacyInitializer.java.nolongerInUse +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - -import com.arsdigita.initializer.Configuration; -import com.arsdigita.initializer.InitializationException; - -import com.arsdigita.domain.GlobalObserverManager; - -import org.apache.log4j.Logger; - -/** - * This initializer (which will soon go away) activates - * the appropriate search engine. - * There are no APIs intended for public use in this class - */ -@Deprecated -public class LegacyInitializer - implements com.arsdigita.initializer.Initializer { - - private Configuration m_conf = new Configuration(); - - private static final Logger s_log = - Logger.getLogger(LegacyInitializer.class); - - public LegacyInitializer() throws InitializationException { - } - - public Configuration getConfiguration() { - return m_conf; - } - - public void startup() { - if (Search.getConfig().getIndexerType().getObserver() != null) { - s_log.info("registering observer for indexer: " + Search.getConfig().getIndexerType()); - GlobalObserverManager gom = GlobalObserverManager.getManager(); - gom.addObserver(new SearchObserver()); - } else { - s_log.info("Not registering a search observer"); - } - - } - - public void shutdown() {} - -} diff --git a/ccm-core/src/com/arsdigita/search/SearchDataQuery.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SearchDataQuery.java.nolongerInUse deleted file mode 100755 index 5f09577a2..000000000 --- a/ccm-core/src/com/arsdigita/search/SearchDataQuery.java.nolongerInUse +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - -import com.arsdigita.persistence.Session; - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchDataQuery - **/ - -public class SearchDataQuery - extends com.arsdigita.search.intermedia.SearchDataQuery { - - public SearchDataQuery(Session s, String sql, String[] columns) { - super(s, sql, columns); - } - -} diff --git a/ccm-core/src/com/arsdigita/search/SearchIndexHelp.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SearchIndexHelp.java.nolongerInUse deleted file mode 100755 index 8bd756c37..000000000 --- a/ccm-core/src/com/arsdigita/search/SearchIndexHelp.java.nolongerInUse +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchIndexHelp - **/ - -public class SearchIndexHelp - extends com.arsdigita.search.intermedia.SearchIndexHelp { -} diff --git a/ccm-core/src/com/arsdigita/search/SearchIndexHelpCustomize.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SearchIndexHelpCustomize.java.nolongerInUse deleted file mode 100755 index 28be99ce1..000000000 --- a/ccm-core/src/com/arsdigita/search/SearchIndexHelpCustomize.java.nolongerInUse +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchIndexHelpCustomize - **/ - -public interface SearchIndexHelpCustomize - extends com.arsdigita.search.intermedia.SearchIndexHelpCustomize { - -} diff --git a/ccm-core/src/com/arsdigita/search/SearchSpecification.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SearchSpecification.java.nolongerInUse deleted file mode 100755 index 405b20f79..000000000 --- a/ccm-core/src/com/arsdigita/search/SearchSpecification.java.nolongerInUse +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchSpecification - **/ - -public class SearchSpecification - extends com.arsdigita.search.intermedia.SearchSpecification{ - - - /** - * Create a SearchSpecification object. - * @param sql Sql select statement to perform the search. See - * example above. - * @param columns The names of columns returned by the - * search. - * @param maxRows The maximum number of result rows retrieved - * by the search. - * @param rowsPerPage The maximum number of rows per result - * page returned by method getPage. - **/ - public SearchSpecification(String sql, String[] columns, - int maxRows, int rowsPerPage) { - - super(sql, columns, maxRows, rowsPerPage); - } - - /** - * Create a SearchSpecification object, using the default values - * for maxRows and rowsPerPage. - * @param sql Sql select statement to perform the search. See - * example above. - * @param columns The names of columns returned by the - * search. - **/ - public SearchSpecification(String sql, String[] columns) { - super(sql, columns); - } - -} diff --git a/ccm-core/src/com/arsdigita/search/Searchable.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/Searchable.java.nolongerInUse deleted file mode 100755 index 50fde2c08..000000000 --- a/ccm-core/src/com/arsdigita/search/Searchable.java.nolongerInUse +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2001-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.search; -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchableACSObject - **/ - -public interface Searchable extends com.arsdigita.search.intermedia.Searchable { -} diff --git a/ccm-core/src/com/arsdigita/search/SearchableACSObject.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SearchableACSObject.java.nolongerInUse deleted file mode 100755 index 931b7c556..000000000 --- a/ccm-core/src/com/arsdigita/search/SearchableACSObject.java.nolongerInUse +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - -import com.arsdigita.domain.DataObjectNotFoundException; - -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.persistence.DataObject; -import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.metadata.ObjectType; - - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchableACSObject - **/ - -public abstract class SearchableACSObject - extends com.arsdigita.search.intermedia.SearchableACSObject { - - public SearchableACSObject(DataObject SearchableACSObjectData) { - super(SearchableACSObjectData); - } - public SearchableACSObject(String typeName) { - super(typeName); - } - public SearchableACSObject(ObjectType type) { - super(type); - } - public SearchableACSObject(OID oid) throws DataObjectNotFoundException { - super(oid); - } -} diff --git a/ccm-core/src/com/arsdigita/search/SearchableObserver.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SearchableObserver.java.nolongerInUse deleted file mode 100755 index 7de01e834..000000000 --- a/ccm-core/src/com/arsdigita/search/SearchableObserver.java.nolongerInUse +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SearchableObserver - **/ -public class SearchableObserver - extends com.arsdigita.search.intermedia.SearchableObserver { - - /** - * Constructor. Makes sure that only objects that implement Searchable - * use this observer. - **/ - - public SearchableObserver(Searchable searchableObject) { - super(searchableObject); - } - -} diff --git a/ccm-core/src/com/arsdigita/search/SimpleSearchSpecification.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/SimpleSearchSpecification.java.nolongerInUse deleted file mode 100755 index 28d393d04..000000000 --- a/ccm-core/src/com/arsdigita/search/SimpleSearchSpecification.java.nolongerInUse +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2001-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.search; - - -/** - * @deprecated moved to com.arsdigita.search.intermedia package - * @see com.arsdigita.search.intermedia.SimpleSearchSpecification - **/ -public class SimpleSearchSpecification - extends com.arsdigita.search.intermedia.SimpleSearchSpecification { - - public SimpleSearchSpecification(String object_type, - String searchString) { - super(object_type, searchString); - } -} diff --git a/ccm-core/src/com/arsdigita/search/lucene/LegacyInitializer.java.nolongerInUse b/ccm-core/src/com/arsdigita/search/lucene/LegacyInitializer.java.nolongerInUse deleted file mode 100755 index 9f5892ba3..000000000 --- a/ccm-core/src/com/arsdigita/search/lucene/LegacyInitializer.java.nolongerInUse +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.search.lucene; - -import com.arsdigita.initializer.Configuration; -import com.arsdigita.initializer.InitializationException; -import com.arsdigita.search.FilterType; -import com.arsdigita.search.IndexerType; -import com.arsdigita.search.QueryEngineRegistry; -import com.arsdigita.search.Search; -import com.arsdigita.search.filters.CategoryFilterType; -import com.arsdigita.search.filters.ObjectTypeFilterType; -import com.arsdigita.search.filters.PermissionFilterType; -import java.io.File; -import java.io.IOException; -import java.util.Date; -import org.apache.log4j.Logger; -import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.index.IndexReader; -import org.apache.lucene.index.IndexWriter; -import org.apache.lucene.search.BooleanQuery; - -/** - * LegacyInitializer - * - * Initializes the Lucene package - * - * @author Richard Su (richard.su@alum.mit.edu) - * @version $Id: LegacyInitializer.java 1044 2005-12-09 13:21:16Z sskracic $ - * - * @deprecated no longer in use, replaced by new Initializer. May be deleted. - */ -public class LegacyInitializer implements com.arsdigita.initializer.Initializer { - - private static final Logger LOG = Logger.getLogger(LegacyInitializer.class); - - // public final static Loader LOADER = new IndexId.LoaderImpl(); - - private Configuration m_conf = new Configuration(); - - /** - * - */ - public LegacyInitializer() {} - - /** - * - * @return - */ - public Configuration getConfiguration() { - return m_conf; - } - - /* - * Called on startup. - * @throws InitializationException - */ - public void startup() { - if (Search.getConfig().isLuceneEnabled()) { - LuceneConfig conf = LuceneConfig.getConfig(); - String location = conf.getIndexLocation(); - int interval = conf.getIndexerInterval(); - Analyzer analyzer = conf.getAnalyzer(); - LOG.info("Lucene index location: " + location); - LOG.info("Lucene Analyzer = " + analyzer.getClass().getName()); - BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE); - - try { - if (!IndexReader.indexExists(location)) { - File f = new File(location); - f.mkdirs(); - IndexWriter iw = new IndexWriter - (location, analyzer, true); - iw.close(); - LOG.info("Lucene created index directory"); - } - } catch (IOException ex) { - throw new InitializationException - ("lucene index id has not been initialized", ex); - } - - Index.setLocation(location); - // FIXME: This is a hack. Delay the start of the timer task by 5 - // seconds and keep your fingers crosses in hopes that - // Index.getIndexerID() will be ready to return a valid value by - // then. -- vadimn@redhat.com, 2004-01-07 - Date delayedStart = new Date(System.currentTimeMillis() + 5000L); - Index.getTimer().schedule - (new Indexer(Index.getLocation()), - delayedStart, - ((long)interval * 1000l)); - - QueryEngineRegistry.registerEngine - (IndexerType.LUCENE, new FilterType[] { - new CategoryFilterType(), - new ObjectTypeFilterType(), - new PermissionFilterType() - }, - new BaseQueryEngine()); - } - } - - /** - * Called on shutdown. It's probably not a good idea to depend on this - * being called. - **/ - public void shutdown() { - } - -// /** -// * Only used by CoreLoader. -// **/ -// public interface Loader { -// void load(); -// } -} diff --git a/ccm-core/src/com/arsdigita/search/lucene/enterprise.init.nolongerInUse b/ccm-core/src/com/arsdigita/search/lucene/enterprise.init.nolongerInUse deleted file mode 100644 index bc396b01e..000000000 --- a/ccm-core/src/com/arsdigita/search/lucene/enterprise.init.nolongerInUse +++ /dev/null @@ -1,7 +0,0 @@ -// file: com.arsdigita.search.lucene.enterprise.init - - - -// As of version 6.5.x still in use! -init com.arsdigita.search.lucene.LegacyInitializer {} - diff --git a/ccm-core/src/com/arsdigita/web/ApplicationSetup.java.nolongerInUse b/ccm-core/src/com/arsdigita/web/ApplicationSetup.java.nolongerInUse deleted file mode 100755 index 6eada1b71..000000000 --- a/ccm-core/src/com/arsdigita/web/ApplicationSetup.java.nolongerInUse +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 2002-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.web; - -import com.arsdigita.kernel.PackageType; -import com.arsdigita.domain.DomainObjectInstantiator; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.util.Assert; -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; -import org.apache.log4j.Category; - -/** - * Automates the creation and setup of ApplicationTypes. - * - *
- * ApplicationSetup setup = new ApplicationSetup(s_log); - * setup.setApplicationObjectType(SomeApp.BASE_DATA_OBJECT_TYPE); - * setup.setKey("some-app"); - * setup.setTitle("Some App"); - * setup.setInstantiator(new ACSObjectInstantiator() { - * protected DomainObject doNewInstance(DataObject dataObject) { - * return new SomeApp(dataObject); - * } - * }); - * setup.run(); - *
- * - * Important note. When Applications are used - * in the context of old-style apps that use SiteNodes and - * PackageTypes, it is important to use the - * setKey("some-string-key") so that your new applications can - * interoperate fluidly with the legacy applications. - * Use of the setKey method ensures that your application will, - * behind the scenes, use site nodes and package instances, in addition to the - * Application object, to represent each new mountable application. - * As a result, legacy code for managing and dispatching applications will work - * with both your old and your new applications. - * - * @see com.arsdigita.web.ApplicationType - * @author Justin Ross <jross@redhat.com> - * @version $Id: ApplicationSetup.java 287 2005-02-22 00:29:02Z sskracic $ - * @deprecated without direct replacement. - * Class requires ApplicationSetup.setInstantiator( ...) domain initialization - * code which is only useful in old legacy initialization code. Initialization - * now differentiates bitween one time loading step and recurring initialization - * step. - * Use ApplicationType apptype = new ApplicationType(...) and - * Application app Application.createApplication(...) instead to create - * new style legacy free applications. - */ -public class ApplicationSetup { - - /** Appender to enable writing to the löog file. */ - protected Category m_category; - protected String m_title = null; - protected String m_description = null; - protected String m_typeName = null; - protected DomainObjectInstantiator m_instantiator = null; - - // Legacy fields. - - protected String m_key = null; - protected PackageType m_packageType = null; - protected boolean m_isWorkspaceApplication = true; - protected boolean m_isSingleton = false; - protected String m_dispatcherClass = null; - - /** - * Constructor. - * - * @param category as appender to the log file. - */ - public ApplicationSetup(Category category) { - m_category = category; - } - - /** - * Sets a key for use in creating a package type and, later, site - * node objects, as used by older applications, to match the new - * application type. - * - * @param key the String key to use to generate a - * package type corresponding to the new application type - */ - public void setKey(String key) { - m_key = key; - } - - /** - * Sets the package type to use to represent your application - * under the older package instance and site node approach. - * - * @param packageType a PackageType to use behind the - * new application type - */ - public void setPackageType(PackageType packageType) { - m_packageType = packageType; - } - - /** - * Sets the title of the installed application type. - */ - public void setTitle(String title) { - m_title = title; - } - - /** - * Sets the description of the installed application type. - */ - public void setDescription(String description) { - m_description = description; - } - - /** - * Sets the object type of the application instances this - * application type represents. - */ - public void setApplicationObjectType(String typeName) { - m_typeName = typeName; - } - - /** - * Sets the instantiator used by {@link - * com.arsdigita.domain.DomainObjectFactory} to resurrect specific - * domain classes from data objects. - */ - public void setInstantiator(DomainObjectInstantiator instantiator) { - m_instantiator = instantiator; - } - - /** - * This method is an alternative to {@link - * #setPortalApplication(boolean)}. It does the same thing. - */ - public void setWorkspaceApplication(boolean isWorkspaceApplication) { - m_isWorkspaceApplication = isWorkspaceApplication; - } - - /** - * Marks this applications of this type as ones that do or do not belong to - * a "portal", a special application type that collects child applications - * together for presentation and navigation purposes. - * - * By default, this value is true. - */ - public void setPortalApplication(boolean isWorkspaceApplication) { - m_isWorkspaceApplication = isWorkspaceApplication; - } - - /** - * Sets whether there can be more than one application of this - * type in the system. - * - * The default is false. - */ - public void setSingleton(boolean isSingleton) { - m_isSingleton = isSingleton; - } - - /** - * Sets the dispatcher to use for appliactions of this type. - */ - public void setDispatcherClass(String dispatcherClass) { - m_dispatcherClass = dispatcherClass; - } - - protected void notice(String message) { - m_category.info("ApplicationType '" + m_title + "' - " + message); - } - - /** - * After all the properties are set, validates and installs the - * specified application type. - */ - public ApplicationType run() { - notice("Validating setup..."); - - List messages = validate(); - - if (messages.size() > 0) { - Iterator iter = messages.iterator(); - String errors = "Validation of ApplicationSetup data failed:\n"; - - while (iter.hasNext()) { - String msg = (String)iter.next(); - m_category.error(msg); - errors += msg + "\n"; - } - - throw new RuntimeException(errors); - } - - notice("Done validating."); - - ApplicationType applicationType = process(); - Assert.exists(applicationType, "applicationType is not null"); - applicationType.save(); - - return applicationType; - } - - protected List validate() { - final ArrayList messages = new ArrayList(); - - if (m_title == null) { - messages.add("Title is not set."); - } - - if (m_typeName == null) { - messages.add("ApplicationObjectType is not set."); - } - - if (m_instantiator == null) { - messages.add("Instantiator is not set."); - } - - return messages; - } - - protected ApplicationType process() { - notice("Starting setup..."); - - ApplicationType applicationType = null; - - if (ApplicationType.isInstalled(m_typeName)) { - // When migrating new code, sometimes an ApplicationType - // exists but its corresponding PackageType does not. - // This happens, for instance, when someone changes the - // package key but not the object type in their app setup - // script. To treat this case, we need to create the - // PackageType if it isn't there, even if the - // ApplicationType exists. - - if (m_key != null && !packageTypeIsInstalled(m_key)) { - Assert.isTrue(m_packageType == null); - - m_category.warn - ("ApplicationType " + m_typeName + " did not have " + - "its corresponding PackageType " + m_key + ". Adding " + - "one now."); - - PackageType packageType = new PackageType(); - - packageType.setKey(m_key); - packageType.setDisplayName(m_title); - packageType.setURI("http://arsdigita.com/" + m_key); - - applicationType = - ApplicationType.retrieveApplicationTypeForApplication - (m_typeName); - - applicationType.setPackageType(packageType); - applicationType.setDispatcherClass(m_dispatcherClass); - - packageType.save(); - applicationType.save(); - } else { - applicationType = - ApplicationType.retrieveApplicationTypeForApplication - (m_typeName); - } - } else { - // And, likewise, sometimes a package type is present, but - // the application type does not yet exist. - // ApplicationType's constructor knows how to handle this. - - notice("Not installed. Installing now..."); - - notice("Using the following properties to perform install."); - notice(" ApplicationObjectType: " + m_typeName); - notice(" Title: " + m_title); - notice(" Description: " + m_description); - notice(" Instantiator: " + m_instantiator); - notice(" IsWorkspaceApplication: " + m_isWorkspaceApplication); - notice(" IsSingleton: " + m_isSingleton); - notice(" Key: " + m_key); - notice(" PackageType: " + m_packageType); - notice(" DispatcherClass: " + m_dispatcherClass); - - if (m_key == null && m_packageType == null) { - // This is a new style / legacy free application - applicationType = new ApplicationType(m_title, m_typeName); - } else { - // This is a legacy application type. - - if (m_key == null) { - applicationType = ApplicationType.createApplicationType - (m_packageType, m_title, m_typeName); - } else if (m_packageType == null) { - applicationType = ApplicationType.createApplicationType - (m_key, m_title, m_typeName); - - if (m_dispatcherClass != null) { - applicationType.setDispatcherClass(m_dispatcherClass); - } - } - - applicationType.setWorkspaceApplication - (m_isWorkspaceApplication); - applicationType.setSingleton(m_isSingleton); - } - - applicationType.setDescription(m_description); - - notice("Done installing."); - } - - DomainObjectFactory.registerInstantiator(m_typeName, m_instantiator); - - notice("Done setting up."); - - return applicationType; - } - - private boolean packageTypeIsInstalled(String key) { - try { - PackageType.findByKey(key); - return true; - } catch (DataObjectNotFoundException nfe) { - return false; - } - } -} diff --git a/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java.nolongerInUse b/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java.nolongerInUse deleted file mode 100755 index c2bf3de7a..000000000 --- a/ccm-core/src/com/arsdigita/web/LegacyAdapterServlet.java.nolongerInUse +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2002-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.web; - -import com.arsdigita.util.Assert; -import com.arsdigita.util.UncheckedWrapperException; -import com.arsdigita.web.Application; -import com.arsdigita.kernel.PackageType; -import com.arsdigita.dispatcher.RequestContext; -import com.arsdigita.dispatcher.Dispatcher; -import com.arsdigita.dispatcher.DispatcherHelper; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; - -/** - *

An application servlet that does what SiteNodeDispatcher does - * but in the context of the newer CCM dispatcher. Gets the package - * type associated with an application and uses its dispatcher.

- * - *

Use web.xml entries like the following to deploy this - * servlet:

- * - *
- * <servlet>
- *   <servlet-name>legacy-adapter</servlet-name>
- *   <servlet-class>com.arsdigita.web.LegacyAdapterServlet</servlet-class>
- * </servlet>
- *
- * <servlet-mapping>
- *   <servlet-name>legacy-adapter</servlet-name>
- *   <url-pattern>/themes/servlet/legacy-adapter/*</url-pattern>
- * </servlet-mapping>
- * 
- * - * @see com.arsdigita.web.DispatcherServlet - * @see com.arsdigita.sitenode.SiteNodeDispatcher - * - * @author Justin Ross <jross@redhat.com> - * @version $Id: LegacyAdapterServlet.java 287 2005-02-22 00:29:02Z sskracic $ - */ -public class LegacyAdapterServlet extends BaseApplicationServlet { - - private static final Logger s_log = Logger.getLogger - (LegacyAdapterServlet.class); - - /** - *

Fetches the dispatcher for the package type of the current - * application and dispatches to it with the {@link - * RequestContext} constructed in {@link - * com.arsdigita.web.BaseApplicationServlet}.

- * - * @param app The application which is being served. - */ - public void doService(HttpServletRequest sreq, - HttpServletResponse sresp, - Application app) - throws ServletException, IOException { - s_log.debug("LegacyAdapterServlet.doService called for request " + - sreq); - - PackageType type = app.getApplicationType().getPackageType(); - - if (s_log.isDebugEnabled()) { - s_log.debug("Using package type '" + type.getKey() + "'"); - } - - Assert.exists(type, "PackageType type"); - - String jsp = "/packages/" + type.getKey() + "/www" + sreq.getPathInfo(); - File file = new File(getServletContext().getRealPath(jsp)); - - if (file.exists() && !file.isDirectory()) { - // XXX Need to handle welcome files. - - RequestDispatcher rd = sreq.getRequestDispatcher(jsp); - - Assert.exists(rd, "RequestDispatcher rd"); - - rd.forward(sreq, sresp); - } else { - try { - RequestContext rc = DispatcherHelper.getRequestContext(); - - Assert.exists(rc, "RequestContext rc"); - - Dispatcher dispatcher = type.getDispatcher(); - - Assert.exists(dispatcher, "Dispatcher dispatcher"); - - if (s_log.isDebugEnabled()) { - s_log.debug - ("Dispatching using dispatcher '" + dispatcher + "'"); - } - - dispatcher.dispatch(sreq, sresp, rc); - } catch (ClassNotFoundException cnfe) { - throw new UncheckedWrapperException(cnfe); - } catch (InstantiationException ie) { - throw new UncheckedWrapperException(ie); - } catch (IllegalAccessException iae) { - throw new UncheckedWrapperException(iae); - } catch (InvocationTargetException ite) { - throw new UncheckedWrapperException(ite); - } - } - } -} diff --git a/ccm-core/src/com/arsdigita/web/LegacyInitializerServlet.java.nolongerInUse b/ccm-core/src/com/arsdigita/web/LegacyInitializerServlet.java.nolongerInUse deleted file mode 100755 index db7a2e220..000000000 --- a/ccm-core/src/com/arsdigita/web/LegacyInitializerServlet.java.nolongerInUse +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.web; - - -// ////////////////////////////////////////////////////////////////////////// -// -// Old initializer system based on enterprise.init scripts is no longer -// available. -// -// ////////////////////////////////////////////////////////////////////////// - - -import com.arsdigita.developersupport.Debug; -import com.arsdigita.initializer.Script; -import com.arsdigita.util.ResourceManager; -import java.io.InputStream; -import javax.servlet.ServletException; - -/** - * @author Justin Ross <jross@redhat.com> - * @version $Id: LegacyInitializerServlet.java 287 2005-02-22 00:29:02Z sskracic $ - */ -public final class LegacyInitializerServlet extends BaseServlet { - - private Script m_initializer = null; - - /** - * Starts up the web environment for the ACS by loading the specified - * initializer script. - */ - @Override - protected final void doInit() throws ServletException { - Debug.setLevel("com.arsdigita.initializer.Script", "info"); - - final String script = getServletConfig().getInitParameter("init"); - - final ResourceManager rm = ResourceManager.getInstance(); - rm.setServletContext(getServletContext()); - - final InputStream is = rm.getResourceAsStream(script); - - if (is == null) { - throw new ServletException("Couldn't find " + script); - } - - m_initializer = new Script(is); - m_initializer.startup(); - } - - @Override - protected final void doDestroy() { - m_initializer.shutdown(); - m_initializer = null; - } -}