Nur Dokumentation / Formatierungen

git-svn-id: https://svn.libreccm.org/ccm/trunk@1037 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-07-31 13:54:56 +00:00
parent 4448038b62
commit 020cbd9dc7
31 changed files with 317 additions and 329 deletions

View File

@ -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();

View File

@ -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 <i>package-key</i>.checklist file in the src dir of the package
* a <i>package-key</i> 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 &lt;rhs@mit.edu&gt;
* @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;
}

View File

@ -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 &lt;rhs@mit.edu&gt;
* @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

View File

@ -35,15 +35,15 @@ import org.xml.sax.helpers.DefaultHandler;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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;

View File

@ -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 &lt;jross@redhat.com&gt;
* @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;

View File

@ -31,8 +31,7 @@ import org.apache.commons.cli.Options;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @version $Id: Command.java 1324 2006-09-21 22:13:16Z apevec $
**/
*/
abstract class Command {
private String m_name;

View File

@ -45,15 +45,11 @@ import java.util.Properties;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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;
/**

View File

@ -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 &lt;rhs@mit.edu&gt;
* @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);
}
}

View File

@ -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 &lt;rhs@mit.edu&gt;
* @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();

View File

@ -23,19 +23,20 @@ package com.arsdigita.packaging;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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);

View File

@ -67,15 +67,10 @@ import org.apache.log4j.Logger;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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);

View File

@ -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 &lt;rhs@mit.edu&gt;
* @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);

View File

@ -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 &lt;rhs@mit.edu&gt;
* @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);

View File

@ -32,15 +32,10 @@ import org.xml.sax.helpers.DefaultHandler;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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());
}

View File

@ -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());

View File

@ -33,15 +33,10 @@ import java.util.Map;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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() {}
}

View File

@ -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 &lt;jross@redhat.com&gt;
* @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);

View File

@ -44,15 +44,10 @@ import java.util.Properties;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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());

View File

@ -36,15 +36,10 @@ import java.util.Map;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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();

View File

@ -40,15 +40,11 @@ import org.apache.log4j.Logger;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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 {

View File

@ -29,19 +29,20 @@ import com.arsdigita.runtime.Startup;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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) {

View File

@ -36,15 +36,11 @@ import org.apache.log4j.Logger;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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 {

View File

@ -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;

View File

@ -23,19 +23,20 @@ package com.arsdigita.packaging;
*
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @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:");

View File

@ -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 {

View File

@ -1,7 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!-- /com/arsdigita/packaging/package.html -->
<html>
<head>
<title>Runtime APIs</title>
</head>
<body>
<p>
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.</p>
<p>
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.
</p>
</p>
</body>
</html>

View File

@ -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
* <code>new File(System.getProperty("ccm.conf")).toURL()</code>. 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 <code>new
* File(System.getProperty("ccm.conf")).toURL()</code>. The value of the
* ccm.conf system property may or may not include a trailing slash.
**/
*/
public ConfigRegistry() {
this(CCMResourceManager.getConfigURL());
}

View File

@ -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);
}

View File

@ -1,10 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Runtime APIs</title>
</head>
<body bgcolor="white">
<body>
<p>The com.arsdigita.runtime package provides classses and interfaces
for bootstrapping and manage the CCM runtime environment.</p>
@ -19,6 +19,5 @@ for bootstrapping and manage the CCM runtime environment.</p>
<p>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.</p>
</body>
</html>

View File

@ -1,9 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>com.arsdigita.toolbox</title>
</head>
<body bgcolor="white">
<body>
<p>
A collection of high-level classes useful for general development.
</p>

View File

@ -65,7 +65,7 @@ public class StringUtils {
* @return <code>true</code> if <code>s</code> is null or empty;
* otherwise <code>false</code>
*/
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 <code>true</code> if <code>o</code> is null or empty;
* otherwise <code>false</code>
*/
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 <pre>&lt;p></pre>
* 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/<p>/g", s);
s = s_re.substitute("s/\n\n/<p>/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 {
* &reg;
* </ul>
*/
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;
}
/**
* <p> 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. </p>
*
* <p> As an example, let's say the original string is: </p>
*
* <pre>
* s = "/packages/foo/xsl/::vhost::/foo_::locale::.xsl";
* </pre>
*
* <p> We call the function like this: </p>
*
* <pre>
* output = splitUp (s, "/::\\w+::/");
* </pre>
*
* <p> The result (<code>output</code>) will be the following list: </p>
*
* <pre>
* ("/packages/foo/xsl/", "::vhost::", "/foo_", "::locale::", ".xsl")
* </pre>
*
* <p> Notice the important property that concatenating all these
* strings together will restore the original string. </p>
*
* <p> Here is another useful example. To split up HTML into elements
* and content, do: </p>
*
* <pre>
* output = splitUp (html, "/<.*?>/");
* </pre>
*
* <p> You will end up with something like this: </p>
*
* <pre>
* ("The following text will be ", "<b>", "bold", "</b>", ".")
* </pre>
*
* @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
*
* <p> This is equivalent to the Perl "global match in array context",
* specifically: <code>@a = /(RE)|(.+)/g;</code> </p>
*
*/
public static List splitUp (String s, String re)
{
Perl5Util p5 = new Perl5Util ();
ArrayList list = new ArrayList ();
/**
* <p> 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. </p>
*
* <p> As an example, let's say the original string is: </p>
*
* <pre>
* s = "/packages/foo/xsl/::vhost::/foo_::locale::.xsl";
* </pre>
*
* <p> We call the function like this: </p>
*
* <pre>
* output = splitUp (s, "/::\\w+::/");
* </pre>
*
* <p> The result (<code>output</code>) will be the following list: </p>
*
* <pre>
* ("/packages/foo/xsl/", "::vhost::", "/foo_", "::locale::", ".xsl")
* </pre>
*
* <p> Notice the important property that concatenating all these
* strings together will restore the original string. </p>
*
* <p> Here is another useful example. To split up HTML into elements
* and content, do: </p>
*
* <pre>
* output = splitUp (html, "/<.*?>/");
* </pre>
*
* <p> You will end up with something like this: </p>
*
* <pre>
* ("The following text will be ", "<b>", "bold", "</b>", ".")
* </pre>
*
* @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
*
* <p> This is equivalent to the Perl "global match in array context",
* specifically: <code>@a = /(RE)|(.+)/g;</code> </p>
*
*/
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;