diff --git a/ccm-core/src/com/arsdigita/packaging/BaseCheck.java b/ccm-core/src/com/arsdigita/packaging/BaseCheck.java index 9ebfe19a6..ae217aa6f 100755 --- a/ccm-core/src/com/arsdigita/packaging/BaseCheck.java +++ b/ccm-core/src/com/arsdigita/packaging/BaseCheck.java @@ -42,15 +42,11 @@ import org.apache.log4j.Logger; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #4 $ $Date: 2004/08/16 $ + * @version $Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic */ - abstract public class BaseCheck extends Check { private static final Logger logger = Logger.getLogger(BaseCheck.class); - public static final String versionId = - "$Id: BaseCheck.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; public static final MessageMap s_messages = new MessageMap(); diff --git a/ccm-core/src/com/arsdigita/packaging/Check.java b/ccm-core/src/com/arsdigita/packaging/Check.java index bfb8df9d3..6999c2796 100755 --- a/ccm-core/src/com/arsdigita/packaging/Check.java +++ b/ccm-core/src/com/arsdigita/packaging/Check.java @@ -24,7 +24,7 @@ import com.arsdigita.runtime.AbstractScript; * The Check class provides a developer callback for performing * validation checks during various points in the package loading and * server startup process. This functionality is accessed by creating - * a package-key.checklist file in the src dir of the package + * a package-key checklist file in the src dir of the package * that wishes to add checks. This must be a valid xml file that * conforms to the following format: * @@ -65,15 +65,10 @@ import com.arsdigita.runtime.AbstractScript; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #5 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Check.java 736 2005-09-01 10:46:05Z sskracic $ + */ public abstract class Check extends AbstractScript { - public final static String versionId = - "$Id: Check.java 736 2005-09-01 10:46:05Z sskracic $" + - "by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - public static final class Status { private String m_name; @@ -101,8 +96,7 @@ public abstract class Check extends AbstractScript { * the Check class. * * @param status The status, one of PASS, FAIL, or WARN. - **/ - + */ protected void status(Status status) { if (m_status == null) { m_status = status; @@ -116,8 +110,7 @@ public abstract class Check extends AbstractScript { * #run(ScriptContext)} method. * * @return The status, one of PASS, FAIL, or WARN. - **/ - + */ public Status getStatus() { return m_status; } diff --git a/ccm-core/src/com/arsdigita/packaging/CheckDB.java b/ccm-core/src/com/arsdigita/packaging/CheckDB.java index a1c1710b4..34b548f55 100755 --- a/ccm-core/src/com/arsdigita/packaging/CheckDB.java +++ b/ccm-core/src/com/arsdigita/packaging/CheckDB.java @@ -32,23 +32,17 @@ import org.apache.log4j.Logger; /** - * CheckDB - * helper class for the load command worker class Load, checks for - * existence of a database and verifies accessibility - * - * Subject to change! + * CheckDB is a helper class for the load command worker class Load, checks for + * existence of a database and verifies accessibility. * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #7 $ $Date: 2004/08/16 $ + * @version $Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $ */ public class CheckDB extends BaseCheck { private static final Logger logger = Logger.getLogger(CheckDB.class); - public final static String versionId = - "$Id: DBCheck.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; // Integration of service class packaging.MessageMap. // Specifies a package specific message file overriding BaseCheck diff --git a/ccm-core/src/com/arsdigita/packaging/Checklist.java b/ccm-core/src/com/arsdigita/packaging/Checklist.java index 46df0a12d..2905aea73 100755 --- a/ccm-core/src/com/arsdigita/packaging/Checklist.java +++ b/ccm-core/src/com/arsdigita/packaging/Checklist.java @@ -35,15 +35,15 @@ import org.xml.sax.helpers.DefaultHandler; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #8 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Checklist.java 736 2005-09-01 10:46:05Z sskracic $ + */ class Checklist { - public final static String versionId = - "$Id: Checklist.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - + /** + * + * @param pkg + * @return + */ public static Checklist get(String pkg) { ClassLoader ldr = Checklist.class.getClassLoader(); InputStream is = ldr.getResourceAsStream(pkg + ".checklist"); @@ -60,10 +60,21 @@ class Checklist { private List m_groups = new ArrayList(); + /** + * Constructor + * + * @param is + */ public Checklist(InputStream is) { XML.parse(is, new ChecklistHandler()); } + /** + * + * @param type + * @param ctx + * @return + */ public boolean run(int type, ScriptContext ctx) { boolean result = true; for (Iterator it = m_groups.iterator(); it.hasNext(); ) { @@ -75,6 +86,9 @@ class Checklist { return result; } + /** + * + */ private class Group { private int m_type; @@ -122,6 +136,9 @@ class Checklist { private static final String CHECK = "check"; private static final String CLASS = "class"; + /** + * + */ private class ChecklistHandler extends DefaultHandler { private Group m_group = null; diff --git a/ccm-core/src/com/arsdigita/packaging/Clear.java b/ccm-core/src/com/arsdigita/packaging/Clear.java index 82fe21b7d..2a49c532d 100755 --- a/ccm-core/src/com/arsdigita/packaging/Clear.java +++ b/ccm-core/src/com/arsdigita/packaging/Clear.java @@ -30,27 +30,28 @@ import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; /** - * Clear - * - * Implements the command line interface to clear one or more values - * in a CCM configuration database (registry) + * Clear implements the command line interface to clear one or more values + * in a CCM configuration database (registry). * @author Justin Ross <jross@redhat.com> * @version $Id: Clear.java 736 2005-09-01 10:46:05Z sskracic $ + * @version $Id: Clear.java 736 2005-09-01 10:46:05Z sskracic $ */ class Clear extends Command { - public final static String versionId = - "$Id: Clear.java 736 2005-09-01 10:46:05Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Options s_options = getOptions(); + /** + * Constructor + */ public Clear() { super("clear", "Clear one or more values in a CCM configuration database"); } + /** + * Invoked from the central tool "MasterTool" to perform the clear process. + */ public boolean run(final String[] args) { final CommandLine line; diff --git a/ccm-core/src/com/arsdigita/packaging/Command.java b/ccm-core/src/com/arsdigita/packaging/Command.java index b8cd870cc..381fccf09 100755 --- a/ccm-core/src/com/arsdigita/packaging/Command.java +++ b/ccm-core/src/com/arsdigita/packaging/Command.java @@ -31,8 +31,7 @@ import org.apache.commons.cli.Options; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Id: Command.java 1324 2006-09-21 22:13:16Z apevec $ - **/ - + */ abstract class Command { private String m_name; diff --git a/ccm-core/src/com/arsdigita/packaging/Config.java b/ccm-core/src/com/arsdigita/packaging/Config.java index fe5f299c9..a7e75baf6 100755 --- a/ccm-core/src/com/arsdigita/packaging/Config.java +++ b/ccm-core/src/com/arsdigita/packaging/Config.java @@ -45,15 +45,11 @@ import java.util.Properties; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #7 $ $Date: 2004/08/16 $ + * @version $Id: Config.java 736 2005-09-01 10:46:05Z sskracic $ **/ public final class Config extends ParameterMap { - public final static String versionId = - "$Id: Config.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - private ConfigRegistry m_reg; /** diff --git a/ccm-core/src/com/arsdigita/packaging/Files.java.deprecated b/ccm-core/src/com/arsdigita/packaging/Files.java.deprecated deleted file mode 100755 index 59350195d..000000000 --- a/ccm-core/src/com/arsdigita/packaging/Files.java.deprecated +++ /dev/null @@ -1,52 +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.packaging; - -import java.io.File; -import java.io.IOException; - -/** - * Commonly used file utilities. - * - * @author Rafael H. Schloming <rhs@mit.edu> - * @version $Revision: #5 $ $Date: 2004/08/16 $ - * - * @deprecated use com.arsdigita.util.Files - **/ - -final class Files { - - public final static String versionId = "$Id: Files.java 736 2005-09-01 10:46:05Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; - - private Files() {} - - /** - * @deprecated use com.arsdigita.util.Files.delete(File file) - */ - public static void delete(File file) { - com.arsdigita.util.Files.delete(file); - } - - /** - * @deprecated use com.arsdigita.util.Files.copy(File from, File to) - */ - public static void copy(File from, File to) throws IOException { - com.arsdigita.util.Files.copy(from, to); - } -} diff --git a/ccm-core/src/com/arsdigita/packaging/Get.java b/ccm-core/src/com/arsdigita/packaging/Get.java index 625526da3..402c51756 100755 --- a/ccm-core/src/com/arsdigita/packaging/Get.java +++ b/ccm-core/src/com/arsdigita/packaging/Get.java @@ -40,23 +40,18 @@ import org.apache.commons.cli.PosixParser; import org.apache.log4j.Logger; /** - * Get - * - * Implements the command line interface to list one or more values + * Get class implements the command line interface to list one or more values * from a CCM configuration database (registry) * * Called by ccm get command * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #6 $ $Date: 2004/08/16 $ + * @version $Id: Get.java 1324 2006-09-21 22:13:16Z apevec $ **/ class Get extends Command { public static final Logger logger = Logger.getLogger(Get.class); - public final static String versionId = - "$Id: Get.java 1324 2006-09-21 22:13:16Z apevec $" - + " by $Author: apevec $, " - + "$DateTime: 2004/08/16 18:10:38 $"; private static final Options OPTIONS = getOptions(); static { @@ -72,11 +67,17 @@ class Get extends Command { logger.debug("Static initalizer finished."); } + /** + * Constructor + */ public Get() { super("get", "Print one or more values from a CCM " + "configuration database"); } + /** + * Invoked from the central tool "MasterTool" to perform get. + */ public boolean run(String[] args) { CommandLine line; try { @@ -162,6 +163,12 @@ class Get extends Command { return true; } + /** + * + * @param properties + * @param out + * @throws IOException + */ private void write(Properties properties, PrintStream out) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/ccm-core/src/com/arsdigita/packaging/Help.java b/ccm-core/src/com/arsdigita/packaging/Help.java index 2ce55fcd5..aaf6a15fc 100755 --- a/ccm-core/src/com/arsdigita/packaging/Help.java +++ b/ccm-core/src/com/arsdigita/packaging/Help.java @@ -23,19 +23,20 @@ package com.arsdigita.packaging; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #4 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Help.java 287 2005-02-22 00:29:02Z sskracic $ + */ class Help extends Command { - public final static String versionId = - "$Id: Help.java 287 2005-02-22 00:29:02Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - + /** + * Constructor + */ public Help() { super("--help", "Print generic help"); } + /** + * Invoked from the central tool "MasterTool" to write help message. + */ public boolean run(String[] args) { // XXX: Should do something better eventually. return new Usage().run(args); diff --git a/ccm-core/src/com/arsdigita/packaging/HostInit.java b/ccm-core/src/com/arsdigita/packaging/HostInit.java index 78b702a75..20183a72c 100755 --- a/ccm-core/src/com/arsdigita/packaging/HostInit.java +++ b/ccm-core/src/com/arsdigita/packaging/HostInit.java @@ -67,15 +67,10 @@ import org.apache.log4j.Logger; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #16 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: HostInit.java 736 2005-09-01 10:46:05Z sskracic $ + */ public class HostInit { - public final static String versionId = - "$Id: HostInit.java 736 2005-09-01 10:46:05Z sskracic $" + - "by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - private static final Logger s_log = Logger.getLogger(HostInit.class); diff --git a/ccm-core/src/com/arsdigita/packaging/Load.java b/ccm-core/src/com/arsdigita/packaging/Load.java index beb2596a5..f5be1c6a4 100755 --- a/ccm-core/src/com/arsdigita/packaging/Load.java +++ b/ccm-core/src/com/arsdigita/packaging/Load.java @@ -26,23 +26,14 @@ import com.arsdigita.persistence.Session; import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.metadata.MetadataRoot; import com.arsdigita.persistence.pdl.PDLCompiler; -// pboy (Jan.09): deprecated classes and methods removed, -// comments should be deleted after extensiv testing -// deprecated, no replacement specified by author, -// created InteractiveParameterReader analogous to CompoundParameterReader -//import com.arsdigita.runtime.InteractiveParameterLoader; import com.arsdigita.runtime.InteractiveParameterReader; import com.arsdigita.runtime.ConfigRegistry; import com.arsdigita.runtime.RegistryConfig; import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.runtime.Startup; import com.arsdigita.util.UncheckedWrapperException; -// deprecated, use c.ad.util.JavaPropertyReader instead -// import com.arsdigita.util.config.JavaPropertyLoader; import com.arsdigita.util.JavaPropertyReader; import com.arsdigita.util.jdbc.Connections; -// deprecated: -// import com.arsdigita.util.parameter.CompoundParameterLoader; import com.arsdigita.util.parameter.CompoundParameterReader; import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.ParameterContext; @@ -76,9 +67,27 @@ import org.apache.log4j.Logger; /** * PackageTool worker class, implements the "load" command. * - * Loads the database schema and initial content. + * It is called by class MasterTols and loads the database schema and initial + * content. + * + * MasterTool provides the following parameters (usually provided by an + * invokation script 'ccm') + * + * ccm load PACKAGE-KEYS [options] + * PACKAGE-KEYS one or more space separated names of modules (package-key, e.g. + * ccm-cms-types-event) which should be loaded into database and + * configuration registry + * Options: [-usage] Display a usage message for load command + * [-help|--help] Display a help message for load command + * [--recursive] Recursively load required packages + * [--data] + * [--config] + * [--interactive] + * [--schema] + * [--parameters KEY=VALUE ...] + * [--init] + * [--parameter-file FILE] * - * Called by PackageTool * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Id: Load.java 736 2005-09-01 10:46:05Z sskracic $ @@ -168,8 +177,8 @@ class Load extends Command { * @return */ public boolean run(String[] args) { + CommandLine line; - try { line = new PosixParser().parse(OPTIONS, args); } catch (ParseException e) { @@ -195,23 +204,22 @@ class Load extends Command { || line.hasOption("data") || line.hasOption("init")); - // RegistryConfig contains a list of package-keys of packages to be - // installed. - // Constructs a new and empty config object. - RegistryConfig rc = new RegistryConfig(); - rc.load(); - List loaded = Arrays.asList(rc.getPackages()); + // RegistryConfig contains a list of package-keys of loaded packages + RegistryConfig rc = new RegistryConfig(); // Create a new (empty) config object. + rc.load(); // Load config values from file + List loaded = Arrays.asList(rc.getPackages()); // retrieve list of installed packages Map loaders = new HashMap(); List keys = new ArrayList(); - keys.addAll(packages); + keys.addAll(packages); // from command line parameters packages to be installed + boolean err = false; while (!keys.isEmpty()) { String key = (String) keys.remove(0); if (loaders.containsKey(key)) { continue; } Loader l = Loader.get(key); if (l == null) { - System.err.println("unable to locate package: " + key); + System.err.println("unable to locate package: " + key); err = true; } else { loaders.put(key, l); diff --git a/ccm-core/src/com/arsdigita/packaging/Loader.java b/ccm-core/src/com/arsdigita/packaging/Loader.java index ea99fc000..756b7a86c 100755 --- a/ccm-core/src/com/arsdigita/packaging/Loader.java +++ b/ccm-core/src/com/arsdigita/packaging/Loader.java @@ -34,8 +34,6 @@ import com.arsdigita.runtime.ScriptContext; import com.arsdigita.runtime.Startup; import com.arsdigita.util.Classes; import com.arsdigita.util.UncheckedWrapperException; -// ParameterLoader is deprecated -// import com.arsdigita.util.parameter.ParameterLoader; import com.arsdigita.util.parameter.ParameterReader; import java.io.IOException; import java.io.InputStream; @@ -56,7 +54,7 @@ import org.apache.log4j.Logger; * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #13 $ $Date: 2004/08/16 $ * @version $Id: Loader.java 2115 2011-01-13 17:11:50Z pboy $ - **/ + */ class Loader { private static final Logger s_log = Logger.getLogger(Loader.class); diff --git a/ccm-core/src/com/arsdigita/packaging/LoaderInfo.java b/ccm-core/src/com/arsdigita/packaging/LoaderInfo.java index 309668075..fd1d0cd7c 100755 --- a/ccm-core/src/com/arsdigita/packaging/LoaderInfo.java +++ b/ccm-core/src/com/arsdigita/packaging/LoaderInfo.java @@ -32,15 +32,10 @@ import org.xml.sax.helpers.DefaultHandler; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #6 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: LoaderInfo.java 287 2005-02-22 00:29:02Z sskracic $ + */ class LoaderInfo { - public final static String versionId = - "$Id: LoaderInfo.java 287 2005-02-22 00:29:02Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - private List m_requiredTables = new ArrayList(); private List m_providedTables = new ArrayList(); private List m_requiredInitializers = new ArrayList(); @@ -49,6 +44,10 @@ class LoaderInfo { private List m_dataScripts = new ArrayList(); private List m_requiredPackages = new ArrayList(); + /** + * Constructor. + * @param is + */ public LoaderInfo(InputStream is) { XML.parse(is, new LoaderInfoHandler()); } diff --git a/ccm-core/src/com/arsdigita/packaging/MasterTool.java b/ccm-core/src/com/arsdigita/packaging/MasterTool.java index 9420f41bf..43e72fb42 100755 --- a/ccm-core/src/com/arsdigita/packaging/MasterTool.java +++ b/ccm-core/src/com/arsdigita/packaging/MasterTool.java @@ -51,7 +51,8 @@ public class MasterTool { out.println(" --help Display help"); out.println(" --usage Print this message"); out.println(); - out.println("To show debugging output set the CCM_TOOLS_DEBUG environmental variable"); + out.println("To show debugging output set the CCM_TOOLS_DEBUG "+ + "environmental variable"); out.println(); out.println("Commands:"); out.print(cmds.getCommands()); diff --git a/ccm-core/src/com/arsdigita/packaging/Menu.java b/ccm-core/src/com/arsdigita/packaging/Menu.java index 89c100640..c94a140fc 100755 --- a/ccm-core/src/com/arsdigita/packaging/Menu.java +++ b/ccm-core/src/com/arsdigita/packaging/Menu.java @@ -33,15 +33,10 @@ import java.util.Map; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #6 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Menu.java 736 2005-09-01 10:46:05Z sskracic + */ class Menu { - public final static String versionId = - "$Id: Menu.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - static final class Layout { private Layout() {} } diff --git a/ccm-core/src/com/arsdigita/packaging/MessageMap.java b/ccm-core/src/com/arsdigita/packaging/MessageMap.java index 044f5e616..5c97cb2bc 100755 --- a/ccm-core/src/com/arsdigita/packaging/MessageMap.java +++ b/ccm-core/src/com/arsdigita/packaging/MessageMap.java @@ -29,17 +29,11 @@ import org.apache.log4j.Logger; /** * Helper class which can be used by the packaging classes and others. Manages * messages to be printed and makes it easier to handle multi line messages. - * - * Subject to change. * * @author Justin Ross <jross@redhat.com> * @version $Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $ */ public final class MessageMap { - public static final String versionId = - "$Id: MessageMap.java 287 2005-02-22 00:29:02Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(MessageMap.class); diff --git a/ccm-core/src/com/arsdigita/packaging/ParameterEditor.java b/ccm-core/src/com/arsdigita/packaging/ParameterEditor.java index c918d5d93..dabd894e6 100755 --- a/ccm-core/src/com/arsdigita/packaging/ParameterEditor.java +++ b/ccm-core/src/com/arsdigita/packaging/ParameterEditor.java @@ -44,15 +44,10 @@ import java.util.Properties; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #8 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: ParameterEditor.java 736 2005-09-01 10:46:05Z sskracic $ + */ class ParameterEditor { - public final static String versionId = - "$Id: ParameterEditor.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - private ParameterMap m_map; private BufferedReader m_in; private PrintStream m_out; @@ -63,6 +58,13 @@ class ParameterEditor { private List m_topics; private Map m_help; + /** + * + * + * @param map + * @param in + * @param out + */ ParameterEditor(ParameterMap map, InputStream in, PrintStream out) { m_map = map; m_in = new BufferedReader(new InputStreamReader(in)); @@ -209,6 +211,9 @@ class ParameterEditor { loadHelp(); } + /** + * + */ private void loadHelp() { Properties props = new Properties(); InputStream is = @@ -352,8 +357,11 @@ class ParameterEditor { return m_valid; } - // XXX: for testing - public static final void main(String[] args) { + /** + * Method main added for testing only! + * @param args + */ + public static void main(String[] args) { ParameterMap map = new ParameterMap(); map.addContext( com.arsdigita.runtime.RuntimeConfig.getConfig()); map.addContext(new com.arsdigita.web.WebConfig()); diff --git a/ccm-core/src/com/arsdigita/packaging/ParameterMap.java b/ccm-core/src/com/arsdigita/packaging/ParameterMap.java index 04eff4bf3..b5f5b8723 100755 --- a/ccm-core/src/com/arsdigita/packaging/ParameterMap.java +++ b/ccm-core/src/com/arsdigita/packaging/ParameterMap.java @@ -36,15 +36,10 @@ import java.util.Map; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #4 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: ParameterMap.java 736 2005-09-01 10:46:05Z sskracic + */ class ParameterMap { - public final static String versionId = - "$Id: ParameterMap.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - private List m_contexts = new ArrayList(); private List m_parameters = new ArrayList(); private Map m_containers = new HashMap(); diff --git a/ccm-core/src/com/arsdigita/packaging/Set.java b/ccm-core/src/com/arsdigita/packaging/Set.java index 23ef5c096..b9e7d32c4 100755 --- a/ccm-core/src/com/arsdigita/packaging/Set.java +++ b/ccm-core/src/com/arsdigita/packaging/Set.java @@ -40,15 +40,11 @@ import org.apache.log4j.Logger; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #7 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Set.java 736 2005-09-01 10:46:05Z sskracic $ + */ class Set extends Command { private final static Logger logger = Logger.getLogger(Set.class); - public final static String versionId = - "$Id: Set.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Options OPTIONS = getOptions(); @@ -63,10 +59,18 @@ class Set extends Command { logger.debug("Static initalizer finished."); } + /** + * Constructor + */ public Set() { super("set", "Set one or more values in a CCM configuration database"); } + /** + * Run script. + * @param args + * @return + */ public boolean run(String[] args) { CommandLine line; try { diff --git a/ccm-core/src/com/arsdigita/packaging/Status.java b/ccm-core/src/com/arsdigita/packaging/Status.java index 7b65efcb9..c78d88dcc 100755 --- a/ccm-core/src/com/arsdigita/packaging/Status.java +++ b/ccm-core/src/com/arsdigita/packaging/Status.java @@ -29,19 +29,20 @@ import com.arsdigita.runtime.Startup; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #5 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Status.java 736 2005-09-01 10:46:05Z sskracic + */ class Status extends Command { - public final static String versionId = - "$Id: Status.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - + /** + * Constructor + */ public Status() { super("status", "Report on the status of a CCM instance"); } + /** + * Invoked from the central tool "MasterTool" to perform the status check. + */ public boolean run(String[] args) { String[] packages; if (args.length == 0) { diff --git a/ccm-core/src/com/arsdigita/packaging/Unload.java b/ccm-core/src/com/arsdigita/packaging/Unload.java index 1c14ae409..540eb9004 100755 --- a/ccm-core/src/com/arsdigita/packaging/Unload.java +++ b/ccm-core/src/com/arsdigita/packaging/Unload.java @@ -36,15 +36,11 @@ import org.apache.log4j.Logger; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #6 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $ + */ class Unload extends Command { private static final Logger logger = Logger.getLogger(Unload.class); - public final static String versionId = - "$Id: Unload.java 736 2005-09-01 10:46:05Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Options OPTIONS = new Options(); @@ -69,10 +65,16 @@ class Unload extends Command { logger.debug("Static initalizer finished."); } + /** + * Constructor + */ public Unload() { super("unload", "Unload configuration"); } + /** + * Invoked from the central tool "MasterTool" to perform the unload process. + */ public boolean run(String[] args) { CommandLine line; try { diff --git a/ccm-core/src/com/arsdigita/packaging/Upgrade.java b/ccm-core/src/com/arsdigita/packaging/Upgrade.java index a7d8c0193..2a74448c8 100755 --- a/ccm-core/src/com/arsdigita/packaging/Upgrade.java +++ b/ccm-core/src/com/arsdigita/packaging/Upgrade.java @@ -85,6 +85,9 @@ class Upgrade extends Command { logger.debug("Static initalizer finished."); } + /** + * Constructor + */ public Upgrade() { super("upgrade", "Upgrade a CCM package"); @@ -92,6 +95,9 @@ class Upgrade extends Command { m_scripts = new ArrayList(); } + /** + * Invoked from the central tool "MasterTool" to perform the upgrade step. + */ public boolean run(final String[] args) { final CommandLine line; @@ -228,6 +234,9 @@ class Upgrade extends Command { return true; } + /** + * + */ private class Parser extends DefaultHandler { private String m_version; diff --git a/ccm-core/src/com/arsdigita/packaging/Usage.java b/ccm-core/src/com/arsdigita/packaging/Usage.java index a70b8b47b..39981403e 100755 --- a/ccm-core/src/com/arsdigita/packaging/Usage.java +++ b/ccm-core/src/com/arsdigita/packaging/Usage.java @@ -23,19 +23,20 @@ package com.arsdigita.packaging; * * @author Rafael H. Schloming <rhs@mit.edu> * @version $Revision: #4 $ $Date: 2004/08/16 $ - **/ - + * @version $Id: Usage.java 287 2005-02-22 00:29:02Z sskracic $ + */ class Usage extends Command { - public final static String versionId = - "$Id: Usage.java 287 2005-02-22 00:29:02Z sskracic $" + - " by $Author: sskracic $, " + - "$DateTime: 2004/08/16 18:10:38 $"; - + /** + * Constructor + */ public Usage() { super("--usage", "Print this message"); } + /** + * Invoked from the central tool "MasterTool" to display a usage message. + */ public boolean run(String[] args) { if (args.length > 0) { System.err.print("unrecognized options:"); diff --git a/ccm-core/src/com/arsdigita/packaging/Which.java b/ccm-core/src/com/arsdigita/packaging/Which.java index 7c03a8f27..f258ddcc0 100755 --- a/ccm-core/src/com/arsdigita/packaging/Which.java +++ b/ccm-core/src/com/arsdigita/packaging/Which.java @@ -37,10 +37,6 @@ import org.apache.log4j.Logger; * @version $Id: Which.java 736 2005-09-01 10:46:05Z sskracic $ */ class Which extends Command { - public static final String versionId = - "$Id: Which.java 736 2005-09-01 10:46:05Z sskracic $" + - "$Author: sskracic $" + - "$DateTime: 2004/08/16 18:10:38 $"; private static final Logger s_log = Logger.getLogger(Which.class); @@ -74,6 +70,9 @@ class Which extends Command { return list; } + /** + * Invoked from the central tool "MasterTool" to perform the which task. + */ public boolean run(final String[] args) { CommandLine line; try { diff --git a/ccm-core/src/com/arsdigita/packaging/package.html b/ccm-core/src/com/arsdigita/packaging/package.html index d102e5115..f104b5bdc 100644 --- a/ccm-core/src/com/arsdigita/packaging/package.html +++ b/ccm-core/src/com/arsdigita/packaging/package.html @@ -1,7 +1,16 @@ + + + + + Runtime APIs + + +

Set of classes which provide a command line interface to install, initialize and configure a CCM application instance with MasterTool.java as the central -entry point. +entry point.

Mastertool.java is the central entry point. It delegates the different tasks @@ -11,4 +20,6 @@ to specialized worker classes. The classes of this package are meant not to be called from within the application running in a servlet container. They serve as a dedicated, separate external command line interface for set up and configuration. -

\ No newline at end of file +

+ + \ No newline at end of file diff --git a/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java b/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java index 8f39bc41c..4c9fcf281 100755 --- a/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java +++ b/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java @@ -111,25 +111,26 @@ public class ConfigRegistry { } /** - * Invokes {@link #ConfigRegistry(URL, ClassLoader)} defaulting the - * loader to the context class loader. - * - * @param url The base url for registry locations. + * Convenience class which invokes {@link #ConfigRegistry(URL, ClassLoader)} + * defaulting the loader to the current context class loader. * * @see Thread#getContextClassLoader() - **/ + * + * @param url The base url for registry locations. + */ public ConfigRegistry(URL url) { this(url, Thread.currentThread().getContextClassLoader()); } /** - * Invokes {@link #ConfigRegistry(URL, ClassLoader)} defaulting the URL to + * Convenience class which invokes {@link #ConfigRegistry(URL, ClassLoader)} + * defaulting the URL to * new File(System.getProperty("ccm.conf")).toURL(). The value * of the ccm.conf system property may or may not include a trailing slash. * * @param loader The ClassLoader to use when searching for * registry configuration files. - **/ + */ public ConfigRegistry(ClassLoader loader) { this(CCMResourceManager.getConfigURL(), loader); } @@ -138,7 +139,7 @@ public class ConfigRegistry { * Invokes {@link #ConfigRegistry(URL)} defaulting the URL to new * File(System.getProperty("ccm.conf")).toURL(). The value of the * ccm.conf system property may or may not include a trailing slash. - **/ + */ public ConfigRegistry() { this(CCMResourceManager.getConfigURL()); } diff --git a/ccm-core/src/com/arsdigita/runtime/RegistryConfig.java b/ccm-core/src/com/arsdigita/runtime/RegistryConfig.java index 035b84481..31b789c9f 100755 --- a/ccm-core/src/com/arsdigita/runtime/RegistryConfig.java +++ b/ccm-core/src/com/arsdigita/runtime/RegistryConfig.java @@ -89,8 +89,7 @@ public class RegistryConfig extends AbstractConfig { /** * Constructs a new and empty config object. - **/ - + */ public RegistryConfig() { register(m_packages); register(m_parents); @@ -100,8 +99,7 @@ public class RegistryConfig extends AbstractConfig { * Returns the value of the waf.config.packages parameter. * * @return the value of the waf.config.packages parameter - **/ - + */ public String[] getPackages() { return (String[]) get(m_packages); } @@ -110,8 +108,7 @@ public class RegistryConfig extends AbstractConfig { * Returns the value of the waf.config.parents parameter. * * @return the value of the waf.config.parents parameter - **/ - + */ public URL[] getParents() { return (URL[]) get(m_parents); } diff --git a/ccm-core/src/com/arsdigita/runtime/package.html b/ccm-core/src/com/arsdigita/runtime/package.html index 47f8116f3..ba48cddd7 100755 --- a/ccm-core/src/com/arsdigita/runtime/package.html +++ b/ccm-core/src/com/arsdigita/runtime/package.html @@ -1,10 +1,10 @@ - + Runtime APIs - +

The com.arsdigita.runtime package provides classses and interfaces for bootstrapping and manage the CCM runtime environment.

@@ -19,6 +19,5 @@ for bootstrapping and manage the CCM runtime environment.

The classes in this package are used by the application running in a servlet container as well as by the installation and maintenance command line utilities outside a servlet container. They don't rely on a servlet context.

- diff --git a/ccm-core/src/com/arsdigita/toolbox/package.html b/ccm-core/src/com/arsdigita/toolbox/package.html index 1bac9410a..82540630b 100755 --- a/ccm-core/src/com/arsdigita/toolbox/package.html +++ b/ccm-core/src/com/arsdigita/toolbox/package.html @@ -1,9 +1,9 @@ - + com.arsdigita.toolbox - +

A collection of high-level classes useful for general development.

diff --git a/ccm-core/src/com/arsdigita/util/StringUtils.java b/ccm-core/src/com/arsdigita/util/StringUtils.java index c40355025..db4354d5e 100755 --- a/ccm-core/src/com/arsdigita/util/StringUtils.java +++ b/ccm-core/src/com/arsdigita/util/StringUtils.java @@ -65,7 +65,7 @@ public class StringUtils { * @return true if s is null or empty; * otherwise false */ - public final static boolean emptyString(String s) { + public static boolean emptyString(String s) { boolean expr = (s == null || s.trim().length() == 0); return expr; } @@ -76,7 +76,7 @@ public class StringUtils { * @return true if o is null or empty; * otherwise false */ - public final static boolean emptyString(Object o) { + public static boolean emptyString(Object o) { boolean expr = (o == null || (o instanceof String && ((String)o).length() ==0)); return expr; @@ -86,7 +86,7 @@ public class StringUtils { * If the String is null, returns an empty string. Otherwise, * returns the string unaltered */ - public final static String nullToEmptyString(String s) { + public static String nullToEmptyString(String s) { return (s == null) ? "" : s; } @@ -96,7 +96,7 @@ public class StringUtils { * @param s The plain-text string to quote * @return The string with special characters escpaed. */ - public final static String quoteHtml(String s) { + public static String quoteHtml(String s) { if (s != null) { StringBuffer result = new StringBuffer(s.length() + 10); for (int i = 0; i < s.length(); i++) { @@ -132,7 +132,7 @@ public class StringUtils { * @return A HTML string with blank lines coverted to
<p>
* and ampersands/angle brackets escaped. */ - public final static String textToHtml(String s) { + public static String textToHtml(String s) { s = quoteHtml(s); s = s_re.substitute("s/\r\n\r\n/

/g", s); s = s_re.substitute("s/\n\n/

/g", s); @@ -148,7 +148,7 @@ public class StringUtils { * more extensive conversion of HTML fragments to plain text * equivalents, see {@link HtmlToText}. */ - public final static String htmlToText(String s) { + public static String htmlToText(String s) { if (s != null) { // first take out new-lines s = s_re.substitute("s/\n//g", s); @@ -201,7 +201,7 @@ public class StringUtils { * ® * */ - public final static String smartTextToHtml(String s) { + public static String smartTextToHtml(String s) { ArrayList blocks = new ArrayList(); s_re.split(blocks, "/\\r?\\n(\\r?\\n)+/", s); @@ -353,7 +353,13 @@ public class StringUtils { return s; } - + /** + * + * @param subst + * @param pattern + * @param s + * @return + */ private static String smartTextReplace(Substitution subst, String pattern, String s) { @@ -375,6 +381,9 @@ public class StringUtils { return result.toString(); } + /** + * + */ private static class TitledLinkSubstitution implements Substitution { private Map m_hash; @@ -401,6 +410,9 @@ public class StringUtils { } } + /** + * + */ private static class UntitledLinkSubstitution implements Substitution { private Map m_hash; @@ -427,6 +439,9 @@ public class StringUtils { } } + /** + * + */ private static class UnobscureSubstitution implements Substitution { private Map m_hash; @@ -449,7 +464,9 @@ public class StringUtils { } } - + /** + * + */ private static class EntitySubstitution implements Substitution { public void appendSubstitution(StringBuffer appendBuffer, MatchResult match, @@ -474,7 +491,7 @@ public class StringUtils { * @param s string contains items separated by a separator character. * @param sep separator character. * @return Array of items. - **/ + */ public static String [] split(String s, char sep) { ArrayList al = new ArrayList(); int start_pos, end_pos; @@ -496,91 +513,88 @@ public class StringUtils { return returned_array; } - /** - *

Given a string, split it into substrings matching a regular - * expression that you supply. Parts of the original string which - * don't match the regular expression also appear as substrings. The - * upshot of this is that the final substrings can be concatenated - * to get the original string.

- * - *

As an example, let's say the original string is:

- * - *
-   * s = "/packages/foo/xsl/::vhost::/foo_::locale::.xsl";
-   * 
- * - *

We call the function like this:

- * - *
-   * output = splitUp (s, "/::\\w+::/");
-   * 
- * - *

The result (output) will be the following list:

- * - *
-   * ("/packages/foo/xsl/", "::vhost::", "/foo_", "::locale::", ".xsl")
-   * 
- * - *

Notice the important property that concatenating all these - * strings together will restore the original string.

- * - *

Here is another useful example. To split up HTML into elements - * and content, do:

- * - *
-   * output = splitUp (html, "/<.*?>/");
-   * 
- * - *

You will end up with something like this:

- * - *
-   * ("The following text will be ", "", "bold", "", ".")
-   * 
- * - * @param s The original string to split. - * @param re The regular expression in the format required by - * {@link org.apache.oro.text.perl.Perl5Util#match(String, String)}. - * @return List of substrings. - * - * @author Richard W.M. Jones - * - *

This is equivalent to the Perl "global match in array context", - * specifically: @a = /(RE)|(.+)/g;

- * - */ - public static List splitUp (String s, String re) - { - Perl5Util p5 = new Perl5Util (); - ArrayList list = new ArrayList (); + /** + *

Given a string, split it into substrings matching a regular + * expression that you supply. Parts of the original string which + * don't match the regular expression also appear as substrings. The + * upshot of this is that the final substrings can be concatenated + * to get the original string.

+ * + *

As an example, let's say the original string is:

+ * + *
+     * s = "/packages/foo/xsl/::vhost::/foo_::locale::.xsl";
+     * 
+ * + *

We call the function like this:

+ * + *
+     * output = splitUp (s, "/::\\w+::/");
+     * 
+ * + *

The result (output) will be the following list:

+ * + *
+     * ("/packages/foo/xsl/", "::vhost::", "/foo_", "::locale::", ".xsl")
+     * 
+ * + *

Notice the important property that concatenating all these + * strings together will restore the original string.

+ * + *

Here is another useful example. To split up HTML into elements + * and content, do:

+ * + *
+     * output = splitUp (html, "/<.*?>/");
+     * 
+ * + *

You will end up with something like this:

+ * + *
+     * ("The following text will be ", "", "bold", "", ".")
+     * 
+ * + * @param s The original string to split. + * @param re The regular expression in the format required by + * {@link org.apache.oro.text.perl.Perl5Util#match(String, String)}. + * @return List of substrings. + * + * @author Richard W.M. Jones + * + *

This is equivalent to the Perl "global match in array context", + * specifically: @a = /(RE)|(.+)/g;

+ * + */ + public static List splitUp (String s, String re) + { + Perl5Util p5 = new Perl5Util (); + ArrayList list = new ArrayList (); - while (s != null && s.length() > 0) - { - // Find the next match. - if (p5.match (re, s)) - { - MatchResult result = p5.getMatch (); + while (s != null && s.length() > 0) { + // Find the next match. + if (p5.match (re, s)) { + MatchResult result = p5.getMatch (); - // String up to the start of the match. - if (result.beginOffset (0) > 0) - list.add (s.substring (0, result.beginOffset (0))); + // String up to the start of the match. + if (result.beginOffset (0) > 0) + list.add (s.substring (0, result.beginOffset (0))); - // Matching part. - list.add (result.toString ()); + // Matching part. + list.add (result.toString ()); - // Update s to be the remainder of the string. - s = s.substring (result.endOffset (0)); - } - else - { - // Finished. - list.add (s); + // Update s to be the remainder of the string. + s = s.substring (result.endOffset (0)); + } + else { + // Finished. + list.add (s); - s = null; - } - } + s = null; + } + } - return list; - } + return list; + } /** * Converts an array of Strings into a single String separated by @@ -594,7 +608,7 @@ public class StringUtils { * @pre strings != null * * @return Joined String - **/ + */ public static String join(String[] strings, char joinChar) { StringBuffer result = new StringBuffer(); final int lastIdx = strings.length - 1; @@ -607,6 +621,7 @@ public class StringUtils { return result.toString(); } + /** * Converts an array of Strings into a single String separated by * a given string. @@ -619,7 +634,7 @@ public class StringUtils { * @pre strings != null * * @return Joined String - **/ + */ public static String join(String[] strings, String joinStr) { StringBuffer result = new StringBuffer(); final int lastIdx = strings.length - 1; @@ -632,6 +647,7 @@ public class StringUtils { return result.toString(); } + /** * Extract a parameter value from a packed list of parameter values. * Example: @@ -652,7 +668,7 @@ public class StringUtils { * @return the value corresponding to the key, or null if the key is not * present. If the key appears in the list more than once, * the first value is returned. - **/ + */ public static String getParameter(String key, String plist, char sep) { int key_end; int key_start = 0; @@ -900,7 +916,7 @@ public class StringUtils { * @param pattern the pattern String * @param repeatCount the number of time to repeat it */ - public final static String repeat(String pattern, int repeatCount) { + public static String repeat(String pattern, int repeatCount) { StringBuffer sb = new StringBuffer(repeatCount * pattern.length()); for (int i = 0; i < repeatCount; i++) { sb.append(pattern); @@ -915,7 +931,7 @@ public class StringUtils { * @param pattern the pattern character * @param repeatCount the number of time to repeat it */ - public final static String repeat(char pattern, int repeatCount) { + public static String repeat(char pattern, int repeatCount) { return repeat(String.valueOf(pattern), repeatCount); } @@ -928,7 +944,7 @@ public class StringUtils { * * @since 5.1.2 */ - public final static String wrap(String input) { + public static String wrap(String input) { return wrap(input,80); } @@ -955,7 +971,7 @@ public class StringUtils { * * @since 5.1.2 */ - public final static String wrap(String input, int maxLength) { + public static String wrap(String input, int maxLength) { final char SPACE = ' '; final char ENDL = '\n'; @@ -1130,7 +1146,7 @@ public class StringUtils { * * @pre find != null * @pre replace != null - **/ + */ public static String replace(final String str, final String find, final String replace) { @@ -1187,6 +1203,9 @@ public class StringUtils { + /** + * + */ private static class HashSubstitution implements Substitution { private Map m_hash;