From ded7d5a275c4e3d8db30b1c4871f70bc015e51d3 Mon Sep 17 00:00:00 2001 From: pb Date: Thu, 14 Apr 2016 22:44:39 +0000 Subject: [PATCH] synchronize with fedorahosted, added debugging capability for ccm install & maintenance scripts. git-svn-id: https://svn.libreccm.org/ccm/trunk@3993 8810af33-2d31-482b-a856-94f89814c4df --- ccm-core/bin/ccm | 42 +++++++++++++++++-- ccm-core/bin/ccm-run | 38 ++++++++++++++++- ccm-core/src/com/arsdigita/db/DbHelper.java | 4 +- .../dispatcher/DispatcherConfig.java | 4 ++ .../runtime/CompoundInitializer.java | 22 +--------- ccm-core/src/com/arsdigita/web/WebConfig.java | 19 ++++++++- 6 files changed, 101 insertions(+), 28 deletions(-) diff --git a/ccm-core/bin/ccm b/ccm-core/bin/ccm index 8f4eeb542..99e9005f5 100644 --- a/ccm-core/bin/ccm +++ b/ccm-core/bin/ccm @@ -17,7 +17,31 @@ CCM_HOME_DIR="../.." if [[ -z "$CATALINA_HOME" ]] ; then echo CATALINE_HOME not set. Guessing ... - if [ -d /usr/share/tomcat6 ] + if [ -d /usr/share/tomcat ] + then + CATALINA_HOME="/usr/share/tomcat" + elif [ -d /opt/tomcat ] + then + CATALINA_HOME="/opt/tomcat" + elif [ -d /usr/share/tomcat8 ] + then + CATALINA_HOME="/usr/share/tomcat8" + elif [ -d /usr/share/tomcat-8 ] + then + CATALINA_HOME="/usr/share/tomcat-8" + elif [ -d /opt/tomcat8 ] + then + CATALINA_HOME="/opt/tomcat8" + elif [ -d /usr/share/tomcat7 ] + then + CATALINA_HOME="/usr/share/tomcat7" + elif [ -d /usr/share/tomcat-7 ] + then + CATALINA_HOME="/usr/share/tomcat-7" + elif [ -d /opt/tomcat7 ] + then + CATALINA_HOME="/opt/tomcat7" + elif [ -d /usr/share/tomcat6 ] then CATALINA_HOME="/usr/share/tomcat6" elif [ -d /usr/share/tomcat-6 ] @@ -45,6 +69,8 @@ if [[ -z "$CATALINA_HOME" ]] ; then echo If this doesn\'t work use echo export CATALINA_HOME=/path/to/tomcat/installation echo to point us to the correct location. + echo + sleep 3 fi CATALINA_LIB_DIR="${CATALINA_HOME}/lib" @@ -78,6 +104,16 @@ CCM_HOME_DIR=`cd ${CCM_HOME_DIR}; pwd` CCM_CLASSPATH="${CCM_LIB_DIR}/*:${CATALINA_LIB_DIR}/*:${CCM_RES_DIR}:${CCM_CLASS_DIR}/" echo "Classpath is: $CCM_CLASSPATH" +# Handling DEBUGGING request +# The parameter MUST be the first! +if [ "$1" = "-D" ] ; then + echo "Activating debug mode, waiting for debugger to attach after CCM-Tool startup." + debug="-Xdebug -Xnoagent -Djava.compiler.NONE -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y " + shift +else + debug="" +fi + echo "Starting CCM-Tool..." if [ "$1" = "prepare" ] ; then echo @@ -88,7 +124,7 @@ if [ "$1" = "prepare" ] ; then echo ===================================== echo param="load --interactive --packagekeys-file bundle/cfg/package-key.list --parameter-file bundle/cfg/integration.properties" - java -cp $CCM_CLASSPATH -Dccm.home=${CCM_HOME_DIR} "com.arsdigita.packaging.MasterTool" $param + java $debug -cp $CCM_CLASSPATH -Dccm.home=${CCM_HOME_DIR} "com.arsdigita.packaging.MasterTool" $param else - java -cp $CCM_CLASSPATH -Dccm.home=${CCM_HOME_DIR} "com.arsdigita.packaging.MasterTool" "$@" + java $debug -cp $CCM_CLASSPATH -Dccm.home=${CCM_HOME_DIR} "com.arsdigita.packaging.MasterTool" "$@" fi diff --git a/ccm-core/bin/ccm-run b/ccm-core/bin/ccm-run index 463c7c6fe..31509dfe8 100644 --- a/ccm-core/bin/ccm-run +++ b/ccm-core/bin/ccm-run @@ -15,7 +15,31 @@ CCM_HOME_DIR="../.." if [[ -z "$CATALINA_HOME" ]] ; then echo CATALINE_HOME not set. Guessing ... - if [ -d /usr/share/tomcat6 ] + if [ -d /usr/share/tomcat ] + then + CATALINA_HOME="/usr/share/tomcat" + elif [ -d /opt/tomcat ] + then + CATALINA_HOME="/opt/tomcat" + elif [ -d /usr/share/tomcat8 ] + then + CATALINA_HOME="/usr/share/tomcat8" + elif [ -d /usr/share/tomcat-8 ] + then + CATALINA_HOME="/usr/share/tomcat-8" + elif [ -d /opt/tomcat8 ] + then + CATALINA_HOME="/opt/tomcat8" + elif [ -d /usr/share/tomcat7 ] + then + CATALINA_HOME="/usr/share/tomcat7" + elif [ -d /usr/share/tomcat-7 ] + then + CATALINA_HOME="/usr/share/tomcat-7" + elif [ -d /opt/tomcat7 ] + then + CATALINA_HOME="/opt/tomcat7" + elif [ -d /usr/share/tomcat6 ] then CATALINA_HOME="/usr/share/tomcat6" elif [ -d /usr/share/tomcat-6 ] @@ -72,5 +96,15 @@ fi #Convert to absolute path: CCM_HOME_DIR=`cd ${CCM_HOME_DIR}; pwd` +# Handling DEBUGGING request +# The parameter MUST be the first! +if [ "$1" = "-D" ] ; then + echo "Activating debug mode, waiting for debugger to attach after CCM-Tool startup." + debug="-Xdebug -Xnoagent -Djava.compiler.NONE -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=y " + shift +else + debug="" +fi + echo "executing ccm-run" -java -cp ${CCM_LIB_DIR}/"*":${CATALINA_LIB_DIR}/"*" -Dccm.home=${CCM_HOME_DIR} "$@" \ No newline at end of file +java $debug -cp ${CCM_LIB_DIR}/"*":${CATALINA_LIB_DIR}/"*" -Dccm.home=${CCM_HOME_DIR} "$@" \ No newline at end of file diff --git a/ccm-core/src/com/arsdigita/db/DbHelper.java b/ccm-core/src/com/arsdigita/db/DbHelper.java index 30e5a38f3..f0229ae9c 100755 --- a/ccm-core/src/com/arsdigita/db/DbHelper.java +++ b/ccm-core/src/com/arsdigita/db/DbHelper.java @@ -178,7 +178,9 @@ public class DbHelper { } String driver = url.substring(5, pos); - s_log.debug("Got driver name " + driver, new Throwable()); + // ?? Why new Throwable here? No usefule information here, just junk + // s_log.debug("Got driver name " + driver, new Throwable()); + s_log.debug("Got driver name: " + driver ); if ("oracle".equals(driver)) { return DB_ORACLE; diff --git a/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java b/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java index 4c792c827..c3e2800f7 100755 --- a/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java +++ b/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java @@ -33,8 +33,11 @@ public final class DispatcherConfig extends AbstractConfig { private static final Logger s_log = Logger.getLogger(DispatcherConfig.class); + /* Toggle whether or not to use HTTP/1.1 caching */ private final Parameter m_cachingActive; + /* Set the default expiration time for HTTP caching. */ private final Parameter m_defaultExpiry; + /* Prefix used for serving static files. As of version 6.6 deprecated */ private final Parameter m_staticURLPrefix; /** Default top-level container for all Bebop components and containersPage @@ -57,6 +60,7 @@ public final class DispatcherConfig extends AbstractConfig { ("waf.dispatcher.default_expiry", Parameter.REQUIRED, new Integer(259200)); + /* @Deprecated */ m_staticURLPrefix = new StringParameter ("waf.dispatcher.static_url_prefix", Parameter.REQUIRED, "/STATICII/"); diff --git a/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java b/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java index 168a3ebf2..d4eb4ba07 100755 --- a/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java +++ b/ccm-core/src/com/arsdigita/runtime/CompoundInitializer.java @@ -116,30 +116,10 @@ public class CompoundInitializer implements Initializer { } } -// /** -// * Implementation of the {@link Initializer#init(LegacyInitEvent)} method. -// * This implementation proceeds through the list of sub initializers in -// * order and invokes the init(LegacyInitEvent) method of each sub initializer -// * in turn. -// * -// * @param evt The legacy init event. -// */ -// public void init(LegacyInitEvent evt) { -// int i = 1; -// for (Iterator it = m_inits.iterator(); it.hasNext(); i++) { -// Initializer init = (Initializer) it.next(); -// if (m_log.isInfoEnabled()) { -// m_log.info("Running Legacy Init for " + init.getClass() + -// " (" + i + " out of " + m_inits.size() + ")"); -// } -// init.init(evt); -// } -// } - /** * Implementation of the {@link Initializer#init(ContextInitEvent)} method. * This implementation proceeds through the list of sub initializers in - * order and invokes the init(LegacyInitEvent) method of each sub initializer + * order and invokes the init(ContextInitEvent) method of each sub initializer * in turn. * * @param evt The legacy init event. diff --git a/ccm-core/src/com/arsdigita/web/WebConfig.java b/ccm-core/src/com/arsdigita/web/WebConfig.java index 613ddf143..0c9bd32c3 100755 --- a/ccm-core/src/com/arsdigita/web/WebConfig.java +++ b/ccm-core/src/com/arsdigita/web/WebConfig.java @@ -150,7 +150,7 @@ public final class WebConfig extends AbstractConfig { /** * Constructor, but do NOT instantiate this class directly, use - * getInstanceOf() instead. (Singelton pattern!) + * getInstanceOf() instead. (Singelton pattern!) * */ public WebConfig() { @@ -175,6 +175,12 @@ public final class WebConfig extends AbstractConfig { return (String) get(m_scheme); } + /** + * Provide the name and port that users of a site will see in URLs generated + * by CCM for the site. (Value of parameter waf.web.server) + * E.g. example.com:80 + * @return HttpHost object, contains public name & port of the server (site) + */ public final HttpHost getServer() { return (HttpHost) get(m_server); } @@ -207,6 +213,17 @@ public final class WebConfig extends AbstractConfig { return false; } + /** + * Provide the name and port of the machine on which the CCM instance is + * running. (Value of parameter waf.web.host) + * + * Used to fetch some resources by a local URL avoiding external + * internet traffic (and delay). If not specified set to the servers's + * name redirecting all traffic to external internet address. + * + * @return HttpHost object, contains internal name & port of the machine + * hosting a CCM instance + */ public final HttpHost getHost() { return (HttpHost) get(m_host); }