You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/06/09 05:19:20 UTC
svn commit: r189695 [17/67] - in /incubator/roller/trunk: ./ contrib/
contrib/lib/ contrib/plugins/ contrib/plugins/src/ contrib/plugins/src/org/
contrib/plugins/src/org/roller/ contrib/plugins/src/org/roller/presentation/
contrib/plugins/src/org/roller/presentation/velocity/
contrib/plugins/src/org/roller/presentation/velocity/plugins/
contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/
contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/
contrib/plugins/src/org/roller/presentation/velocity/plugins/email/
contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/
contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/
contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/
contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/
contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/
contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/
custom/ custom/src/ custom/web/ docs/ docs/images/ docs/installguide/
docs/installguide/old/ docs/userguide/ docs/userguide/images/
docs/userguide/old/ metadata/ metadata/database/
metadata/database/hibernate/ metadata/xdoclet/ nbproject/ personal/
personal/eclipse/ personal/testing/ sandbox/ sandbox/planetroller/
sandbox/planetroller/metadata/ sandbox/planetroller/metadata/database/
sandbox/planetroller/src/ sandbox/planetroller/src/org/
sandbox/planetroller/src/org/roller/
sandbox/planetroller/src/org/roller/tools/
sandbox/planetroller/src/org/roller/tools/planet/
sandbox/planetroller/templates/ sandbox/planetroller/test/
sandbox/planetroller/test/org/ sandbox/planetroller/test/org/roller/
sandbox/planetroller/test/org/roller/model/
sandbox/planetroller/test/org/roller/tools/
sandbox/planetroller/test/org/roller/tools/planet/
sandbox/planetroller/testdata/ sandbox/planetroller/testdata/cache/
sandbox/planetroller/testdata/output/ sandbox/standalone/
sandbox/standalone/jspwiki/ sandbox/standalone/jspwiki/default/
sandbox/standalone/jspwiki/default/images/ sandbox/standalone/lib/
sandbox/standalone/src/ sandbox/standalone/src/org/
sandbox/standalone/src/org/roller/ sandbox/standalone/src/org/roller/jspwiki/
sandbox/standalone/src/org/roller/tomcat/
sandbox/standalone/src/org/roller/util/ sandbox/standalone/tests/
sandbox/standalone/tests/org/ sandbox/standalone/tests/org/roller/
sandbox/standalone/tests/org/roller/util/ sandbox/standalone/tomcat/ src/
src/org/ src/org/roller/ src/org/roller/business/
src/org/roller/business/hibernate/ src/org/roller/business/search/
src/org/roller/business/search/operations/ src/org/roller/business/utils/
src/org/roller/config/ src/org/roller/config/runtime/ src/org/roller/model/
src/org/roller/pojos/ src/org/roller/presentation/
src/org/roller/presentation/atomapi/ src/org/roller/presentation/bookmarks/
src/org/roller/presentation/bookmarks/actions/
src/org/roller/presentation/bookmarks/formbeans/
src/org/roller/presentation/bookmarks/tags/
src/org/roller/presentation/filters/ src/org/roller/presentation/forms/
src/org/roller/presentation/newsfeeds/ src/org/roller/presentation/pagecache/
src/org/roller/presentation/pagecache/rollercache/
src/org/roller/presentation/pings/ src/org/roller/presentation/planet/
src/org/roller/presentation/tags/ src/org/roller/presentation/tags/calendar/
src/org/roller/presentation/tags/menu/ src/org/roller/presentation/util/
src/org/roller/presentation/velocity/ src/org/roller/presentation/weblog/
src/org/roller/presentation/weblog/actions/
src/org/roller/presentation/weblog/formbeans/
src/org/roller/presentation/weblog/tags/ src/org/roller/presentation/website/
src/org/roller/presentation/website/actions/
src/org/roller/presentation/website/formbeans/
src/org/roller/presentation/website/tags/
src/org/roller/presentation/xmlrpc/ src/org/roller/util/
src/org/roller/util/rome/ tests/ tests/org/ tests/org/roller/
tests/org/roller/ant/ tests/org/roller/business/
tests/org/roller/presentation/ tests/org/roller/presentation/atomapi/
tests/org/roller/presentation/bookmarks/
tests/org/roller/presentation/filters/
tests/org/roller/presentation/velocity/
tests/org/roller/presentation/velocity/plugins/
tests/org/roller/presentation/velocity/plugins/smileys/
tests/org/roller/presentation/velocity/plugins/textile/
tests/org/roller/presentation/weblog/ tests/org/roller/presentation/xmlrpc/
tests/org/roller/util/ tests/org/roller/util/rome/ tools/ tools/buildtime/
tools/buildtime/ant-1.6.2/ tools/buildtime/findbugs/
tools/buildtime/findbugs/lib/ tools/buildtime/findbugs/plugin/
tools/buildtime/mockrunner-0.3/ tools/buildtime/mockrunner-0.3/lib/
tools/buildtime/mockrunner-0.35/ tools/buildtime/mockrunner-0.35/lib/
tools/buildtime/tomcat-4.1.24/ tools/buildtime/xdoclet-1.2/
tools/buildtime/xdoclet-1.2/lib/ tools/hibernate-2.1/
tools/hibernate-2.1/lib/ tools/lib/ tools/standard-1.0.3/
tools/standard-1.0.3/lib/ tools/standard-1.0.3/tld/ tools/struts-1.2.4/
tools/struts-1.2.4/lib/ web/ web/WEB-INF/ web/WEB-INF/classes/
web/WEB-INF/classes/flavors/ web/WEB-INF/classes/themes/ web/bookmarks/
web/editor/ web/editor/images/ web/images/ web/images/editor/
web/images/midas/ web/images/preview/ web/images/smileys/ web/planet/
web/tags/ web/templates/ web/theme/ web/theme/images/ web/theme/lavender/
web/theme/scripts/ web/theme/scripts/classes/ web/themes/ web/themes/basic/
web/themes/berkley/ web/themes/berkley/images/ web/themes/brushedmetal/
web/themes/brushedmetal/images/ web/themes/cheb/ web/themes/cheb/images/
web/themes/cheb/scripts/ web/themes/clean/ web/themes/currency-i18n/
web/themes/currency-i18n/images/ web/themes/currency/
web/themes/currency/images/ web/themes/grey2/ web/themes/moonshine/
web/themes/movablemanila/ web/themes/movablemanila/images/
web/themes/pacifica/ web/themes/robot/ web/themes/rolling/
web/themes/rolling/images/ web/themes/sotto/ web/themes/sotto/images/
web/themes/sotto/styles/ web/themes/sunsets/ web/themes/sunsets/images/
web/themes/sunsets/scripts/ web/themes/sunsets/styles/ web/themes/werner/
web/themes/x2/ web/themes/x2/images/ web/themes/x2/scripts/
web/themes/x2/styles/ web/weblog/ web/website/
Added: incubator/roller/trunk/sandbox/standalone/tests/org/roller/util/HSQLDBUtilityTest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tests/org/roller/util/HSQLDBUtilityTest.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tests/org/roller/util/HSQLDBUtilityTest.java (added)
+++ incubator/roller/trunk/sandbox/standalone/tests/org/roller/util/HSQLDBUtilityTest.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,52 @@
+
+package org.roller.util;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+
+public class HSQLDBUtilityTest extends TestCase {
+
+ public void testStartup() throws Exception {
+
+ final String port = "8808";
+ System.setProperty("hsqldb_database", "/tmp/testdb");
+ System.setProperty("hsqldb_port", "8808");
+ HSQLDBUtility.start();
+
+ Thread.sleep(2000); // give HSQLDB time to startup
+
+ Connection con = getConnection(port);
+ assertNotNull(con);
+
+ HSQLDBUtility.stop();
+
+ // TODO: test for shutdown
+ //Thread.sleep(2000); // give HSQLDB time to shutdown
+ //Connection nocon = getConnection(port);
+ //assertNull(nocon);
+ }
+
+ /**
+ * Return local HSQLDB connection or null on error.
+ */
+ private Connection getConnection(final String port) {
+ Connection con = null;
+ try {
+ Class.forName("org.hsqldb.jdbcDriver");
+ con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:"+port);
+ } catch (ClassNotFoundException e) {
+ System.out.println(e);
+ } catch (SQLException e) {
+ System.out.println(e);
+ }
+ return con;
+ }
+}
Added: incubator/roller/trunk/sandbox/standalone/tomcat/catalina.bat
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/catalina.bat?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/catalina.bat (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/catalina.bat Wed Jun 8 20:18:46 2005
@@ -0,0 +1,194 @@
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+rem ---------------------------------------------------------------------------
+rem Start/Stop Script for the CATALINA Server
+rem
+rem Environment Variable Prequisites
+rem
+rem CATALINA_HOME May point at your Catalina "build" directory.
+rem
+rem CATALINA_BASE (Optional) Base directory for resolving dynamic portions
+rem of a Catalina installation. If not present, resolves to
+rem the same directory that CATALINA_HOME points to.
+rem
+rem CATALINA_OPTS (Optional) Java runtime options used when the "start",
+rem "stop", or "run" command is executed.
+rem
+rem CATALINA_TMPDIR (Optional) Directory path location of temporary directory
+rem the JVM should use (java.io.tmpdir). Defaults to
+rem %CATALINA_BASE%\temp.
+rem
+rem JAVA_HOME Must point at your Java Development Kit installation.
+rem
+rem JAVA_OPTS (Optional) Java runtime options used when the "start",
+rem "stop", or "run" command is executed.
+rem
+rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
+rem (JSSE) installation, whose JAR files will be added to the
+rem system class path used to start Tomcat.
+rem
+rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
+rem command is executed. The default is "dt_shmem".
+rem
+rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
+rem command is executed. The default is "jdbconn".
+rem
+rem $Id: catalina.bat,v 1.9.2.1 2004/08/21 15:49:47 yoavs Exp $
+rem ---------------------------------------------------------------------------
+
+rem Guess CATALINA_HOME if not defined
+set CURRENT_DIR=%cd%
+if not "%CATALINA_HOME%" == "" goto gotHome
+set CATALINA_HOME=%CURRENT_DIR%
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+cd ..
+set CATALINA_HOME=%cd%
+cd %CURRENT_DIR%
+:gotHome
+if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
+echo The CATALINA_HOME environment variable is not defined correctly
+echo This environment variable is needed to run this program
+goto end
+:okHome
+
+rem Get standard environment variables
+if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
+
+rem Get standard Java environment variables
+if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
+echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat
+echo This file is needed to run this program
+goto end
+:okSetclasspath
+set BASEDIR=%CATALINA_HOME%
+call "%CATALINA_HOME%\bin\setclasspath.bat"
+
+rem Add on extra jar files to CLASSPATH
+if "%JSSE_HOME%" == "" goto noJsse
+set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar
+:noJsse
+set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar
+
+if not "%CATALINA_BASE%" == "" goto gotBase
+set CATALINA_BASE=%CATALINA_HOME%
+:gotBase
+
+if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
+set CATALINA_TMPDIR=%CATALINA_BASE%\temp
+:gotTmpdir
+
+rem ----- Execute The Requested Command ---------------------------------------
+
+echo Using CATALINA_BASE: %CATALINA_BASE%
+echo Using CATALINA_HOME: %CATALINA_HOME%
+echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR%
+echo Using JAVA_HOME: %JAVA_HOME%
+
+set JAVA_OPTS="-Dhsqldb_database=%CATALINA_HOME%/blogdata/rollerdb -Dhsqldb_port=8802 -DrollerPageDir=%CATALINA_HOME%/wikidata -DrollerStorageDir=%CATALINA_HOME%/wikiattachments"
+
+set _EXECJAVA=%_RUNJAVA%
+set MAINCLASS=org.apache.catalina.startup.Bootstrap
+set ACTION=start
+set SECURITY_POLICY_FILE=
+set DEBUG_OPTS=
+set JPDA=
+
+if not ""%1"" == ""jpda"" goto noJpda
+set JPDA=jpda
+if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
+set JPDA_TRANSPORT=dt_shmem
+:gotJpdaTransport
+if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
+set JPDA_ADDRESS=jdbconn
+:gotJpdaAddress
+shift
+:noJpda
+
+if ""%1"" == ""debug"" goto doDebug
+if ""%1"" == ""run"" goto doRun
+if ""%1"" == ""start"" goto doStart
+if ""%1"" == ""stop"" goto doStop
+if ""%1"" == ""version"" goto doVersion
+
+echo Usage: catalina ( commands ... )
+echo commands:
+echo debug Start Catalina in a debugger
+echo debug -security Debug Catalina with a security manager
+echo jpda start Start Catalina under JPDA debugger
+echo run Start Catalina in the current window
+echo run -security Start in the current window with security manager
+echo start Start Catalina in a separate window
+echo start -security Start in a separate window with security manager
+echo stop Stop Catalina
+echo version What version of tomcat are you running?
+goto end
+
+:doDebug
+shift
+set _EXECJAVA=%_RUNJDB%
+set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\jakarta-tomcat-catalina\catalina\src\share"
+if not ""%1"" == ""-security"" goto execCmd
+shift
+echo Using Security Manager
+set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
+goto execCmd
+
+:doRun
+shift
+if not ""%1"" == ""-security"" goto execCmd
+shift
+echo Using Security Manager
+set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
+goto execCmd
+
+:doStart
+shift
+if not "%OS%" == "Windows_NT" goto noTitle
+set _EXECJAVA=start "Tomcat" %_RUNJAVA%
+goto gotTitle
+:noTitle
+set _EXECJAVA=start %_RUNJAVA%
+:gotTitle
+if not ""%1"" == ""-security"" goto execCmd
+shift
+echo Using Security Manager
+set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy
+goto execCmd
+
+:doStop
+shift
+set ACTION=stop
+goto execCmd
+
+:doVersion
+%_EXECJAVA% -classpath "%CATALINA_HOME%\server\lib\catalina.jar" org.apache.catalina.util.ServerInfo
+goto end
+
+
+:execCmd
+rem Get remaining unshifted command line arguments and save them in the
+set CMD_LINE_ARGS=
+:setArgs
+if ""%1""=="""" goto doneSetArgs
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setArgs
+:doneSetArgs
+
+rem Execute Java with the applicable properties
+if not "%JPDA%" == "" goto doJpda
+if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+:doSecurity
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+:doJpda
+if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+:doSecurityJpda
+%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
+goto end
+
+:end
Added: incubator/roller/trunk/sandbox/standalone/tomcat/catalina.sh
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/catalina.sh?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/catalina.sh (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/catalina.sh Wed Jun 8 20:18:46 2005
@@ -0,0 +1,289 @@
+#!/bin/sh
+# -----------------------------------------------------------------------------
+# Start/Stop Script for the CATALINA Server
+#
+# Environment Variable Prequisites
+#
+# CATALINA_HOME May point at your Catalina "build" directory.
+#
+# CATALINA_BASE (Optional) Base directory for resolving dynamic portions
+# of a Catalina installation. If not present, resolves to
+# the same directory that CATALINA_HOME points to.
+#
+# CATALINA_OPTS (Optional) Java runtime options used when the "start",
+# "stop", or "run" command is executed.
+#
+# CATALINA_TMPDIR (Optional) Directory path location of temporary directory
+# the JVM should use (java.io.tmpdir). Defaults to
+# $CATALINA_BASE/temp.
+#
+# JAVA_HOME Must point at your Java Development Kit installation.
+#
+# JAVA_OPTS (Optional) Java runtime options used when the "start",
+# "stop", or "run" command is executed.
+#
+# JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
+# command is executed. The default is "dt_socket".
+#
+# JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
+# command is executed. The default is 8000.
+#
+# JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
+# (JSSE) installation, whose JAR files will be added to the
+# system class path used to start Tomcat.
+#
+# CATALINA_PID (Optional) Path of the file which should contains the pid
+# of catalina startup java process, when start (fork) is used
+#
+# $Id: catalina.sh,v 1.13.2.1 2004/08/21 15:49:49 yoavs Exp $
+# -----------------------------------------------------------------------------
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false
+os400=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+OS400*) os400=true;;
+esac
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+
+# Only set CATALINA_HOME if not already set
+[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
+
+if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
+ . "$CATALINA_HOME"/bin/setenv.sh
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
+ [ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"`
+ [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+ [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --unix "$JSSE_HOME"`
+fi
+
+# For OS400
+if $os400; then
+ # Set job priority to standard for interactive (interactive - 6) by using
+ # the interactive priority - 6, the helper threads that respond to requests
+ # will be running at the same priority as interactive jobs.
+ COMMAND='chgjob job('$JOBNAME') runpty(6)'
+ system $COMMAND
+
+ # Enable multi threading
+ export QIBM_MULTI_THREADED=Y
+fi
+
+# Get standard Java environment variables
+if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
+ BASEDIR="$CATALINA_HOME"
+ . "$CATALINA_HOME"/bin/setclasspath.sh
+else
+ echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+# Add on extra jar files to CLASSPATH
+if [ -n "$JSSE_HOME" ]; then
+ CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
+fi
+CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar
+
+if [ -z "$CATALINA_BASE" ] ; then
+ CATALINA_BASE="$CATALINA_HOME"
+fi
+
+if [ -z "$CATALINA_TMPDIR" ] ; then
+ # Define the java.io.tmpdir to use for Catalina
+ CATALINA_TMPDIR="$CATALINA_BASE"/temp
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
+ CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`
+ CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`
+ CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"`
+ JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
+fi
+
+# ----- Execute The Requested Command -----------------------------------------
+
+echo "Using CATALINA_BASE: $CATALINA_BASE"
+echo "Using CATALINA_HOME: $CATALINA_HOME"
+echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
+echo "Using JAVA_HOME: $JAVA_HOME"
+
+JAVA_OPTS="-Dhsqldb_database=${CATALINA_HOME}/blogdata/rollerdb -Dhsqldb_port=8802 -DrollerPageDir=${CATALINA_HOME}/wikidata -DrollerStorageDir=${CATALINA_HOME}/wikiattachments"
+
+if [ "$1" = "jpda" ] ; then
+ if [ -z "$JPDA_TRANSPORT" ]; then
+ JPDA_TRANSPORT="dt_socket"
+ fi
+ if [ -z "$JPDA_ADDRESS" ]; then
+ JPDA_ADDRESS="8000"
+ fi
+ if [ -z "$JPDA_OPTS" ]; then
+ JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n"
+ fi
+ CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
+ shift
+fi
+
+if [ "$1" = "debug" ] ; then
+
+ if $os400; then
+ echo "Debug command not available on OS400"
+ exit 1
+ else
+ shift
+ if [ "$1" = "-security" ] ; then
+ echo "Using Security Manager"
+ shift
+ exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \
+ -Djava.security.manager \
+ -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ else
+ exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ fi
+ fi
+
+elif [ "$1" = "run" ]; then
+
+ shift
+ if [ "$1" = "-security" ] ; then
+ echo "Using Security Manager"
+ shift
+ exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Djava.security.manager \
+ -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ else
+ exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start
+ fi
+
+elif [ "$1" = "start" ] ; then
+
+ shift
+ touch "$CATALINA_BASE"/logs/catalina.out
+ if [ "$1" = "-security" ] ; then
+ echo "Using Security Manager"
+ shift
+ "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Djava.security.manager \
+ -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start \
+ >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+
+ if [ ! -z "$CATALINA_PID" ]; then
+ echo $! > $CATALINA_PID
+ fi
+ else
+ "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" start \
+ >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+
+ if [ ! -z "$CATALINA_PID" ]; then
+ echo $! > $CATALINA_PID
+ fi
+ fi
+
+elif [ "$1" = "stop" ] ; then
+
+ shift
+ FORCE=0
+ if [ "$1" = "-force" ]; then
+ shift
+ FORCE=1
+ fi
+
+ "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
+ -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
+ -Dcatalina.base="$CATALINA_BASE" \
+ -Dcatalina.home="$CATALINA_HOME" \
+ -Djava.io.tmpdir="$CATALINA_TMPDIR" \
+ org.apache.catalina.startup.Bootstrap "$@" stop
+
+ if [ $FORCE -eq 1 ]; then
+ if [ ! -z "$CATALINA_PID" ]; then
+ echo "Killing: `cat $CATALINA_PID`"
+ kill -9 `cat $CATALINA_PID`
+ fi
+ fi
+
+elif [ "$1" = "version" ] ; then
+
+ "$_RUNJAVA" \
+ -classpath "$CATALINA_HOME/server/lib/catalina.jar" \
+ org.apache.catalina.util.ServerInfo
+
+else
+
+ echo "Usage: catalina.sh ( commands ... )"
+ echo "commands:"
+ if $os400; then
+ echo " debug Start Catalina in a debugger (not available on OS400)"
+ echo " debug -security Debug Catalina with a security manager (not available on OS400)"
+ else
+ echo " debug Start Catalina in a debugger"
+ echo " debug -security Debug Catalina with a security manager"
+ fi
+ echo " jpda start Start Catalina under JPDA debugger"
+ echo " run Start Catalina in the current window"
+ echo " run -security Start in the current window with security manager"
+ echo " start Start Catalina in a separate window"
+ echo " start -security Start in a separate window with security manager"
+ echo " stop Stop Catalina"
+ echo " stop -force Stop Catalina (followed by kill -KILL)"
+ echo " version What version of tomcat are you running?"
+ exit 1
+
+fi
Added: incubator/roller/trunk/sandbox/standalone/tomcat/hibernate.cfg.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/hibernate.cfg.xml?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/hibernate.cfg.xml (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/hibernate.cfg.xml Wed Jun 8 20:18:46 2005
@@ -0,0 +1,39 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 2.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
+<hibernate-configuration>
+ <session-factory name="java:comp/env/hibernate/SessionFactory">
+ <property name="show_sql">false</property>
+
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost:7475</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+ <property name="hibernate.dialect">net.sf.hibernate.dialect.HSQLDialect</property>
+
+ <mapping resource="org/roller/business/HitCountData.hbm.xml" />
+ <mapping resource="org/roller/pojos/BookmarkData.hbm.xml" />
+ <mapping resource="org/roller/pojos/CommentData.hbm.xml" />
+ <mapping resource="org/roller/pojos/EntryAttributeData.hbm.xml" />
+ <mapping resource="org/roller/pojos/FolderAssoc.hbm.xml" />
+ <mapping resource="org/roller/pojos/FolderData.hbm.xml" />
+ <mapping resource="org/roller/pojos/PageData.hbm.xml" />
+ <mapping resource="org/roller/pojos/RefererData.hbm.xml" />
+ <mapping resource="org/roller/pojos/RoleData.hbm.xml" />
+ <mapping resource="org/roller/pojos/RollerConfigData.hbm.xml" />
+ <mapping resource="org/roller/pojos/UserData.hbm.xml" />
+ <mapping resource="org/roller/pojos/UserCookieData.hbm.xml" />
+ <mapping resource="org/roller/pojos/WeblogCategoryData.hbm.xml" />
+ <mapping resource="org/roller/pojos/WeblogCategoryAssoc.hbm.xml" />
+ <mapping resource="org/roller/pojos/WeblogEntryData.hbm.xml" />
+ <mapping resource="org/roller/pojos/WebsiteData.hbm.xml" />
+
+ <mapping resource="org/roller/pojos/PlanetConfigData.hbm.xml" />
+ <mapping resource="org/roller/pojos/PlanetGroupData.hbm.xml" />
+ <mapping resource="org/roller/pojos/PlanetEntryData.hbm.xml" />
+ <mapping resource="org/roller/pojos/PlanetSubscriptionData.hbm.xml" />
+ <mapping resource="org/roller/pojos/PlanetGroupSubscriptionAssoc.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Added: incubator/roller/trunk/sandbox/standalone/tomcat/roller.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/roller.xml?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/roller.xml (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/roller.xml Wed Jun 8 20:18:46 2005
@@ -0,0 +1,54 @@
+<Context path="/roller" docBase="roller" debug="0">
+ <Resources
+ className="org.apache.naming.resources.FileDirContext"
+ allowLinking="true" caseSensitive="true" />
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="org.hsqldb.jdbcDriver"
+ connectionURL="jdbc:hsqldb:hsql://localhost:7475"
+ connectionName="sa" connectionPassword=""
+ userTable="rolleruser" userNameCol="username" userCredCol="passphrase"
+ userRoleTable="userrole" roleNameCol="rolename" />
+ <Resource name="jdbc/rollerdb" auth="Container" type="javax.sql.DataSource"/>
+ <ResourceParams name="jdbc/rollerdb">
+ <parameter>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </parameter>
+ <parameter>
+ <name>maxActive</name>
+ <value>10</value>
+ </parameter>
+ <parameter>
+ <name>maxIdle</name>
+ <value>30000</value>
+ </parameter>
+ <parameter>
+ <name>maxWait</name>
+ <value>100</value>
+ </parameter>
+ <parameter>
+ <name>username</name>
+ <value>sa</value>
+ </parameter>
+ <parameter>
+ <name>password</name>
+ <value></value>
+ </parameter>
+ <parameter>
+ <name>driverClassName</name>
+ <value>org.hsqldb.jdbcDriver</value>
+ </parameter>
+ <parameter>
+ <name>url</name>
+ <value>jdbc:hsqldb:hsql://localhost:7475</value>
+ </parameter>
+ </ResourceParams>
+ <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
+ <ResourceParams name="mail/Session">
+ <parameter>
+ <name>mail.smtp.host</name>
+ <value>localhost</value>
+ </parameter>
+ </ResourceParams>
+</Context>
+
Added: incubator/roller/trunk/sandbox/standalone/tomcat/server.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/server.xml?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/server.xml (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/server.xml Wed Jun 8 20:18:46 2005
@@ -0,0 +1,385 @@
+<!-- Example Server Configuration File -->
+<!-- Note that component elements are nested corresponding to their
+ parent-child relationships with each other -->
+
+<!-- A "Server" is a singleton element that represents the entire JVM,
+ which may contain one or more "Service" instances. The Server
+ listens for a shutdown command on the indicated port.
+
+ Note: A "Server" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+<Server port="8005" shutdown="SHUTDOWN" debug="0">
+
+
+ <!-- Comment these entries out to disable JMX MBeans support -->
+ <!-- You may also configure custom components (e.g. Valves/Realms) by
+ including your own mbean-descriptor file(s), and setting the
+ "descriptors" attribute to point to a ';' seperated list of paths
+ (in the ClassLoader sense) of files to add to the default list.
+ e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"
+ -->
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
+ debug="0"/>
+ <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
+ debug="0"/>
+ <Listener className="org.roller.tomcat.TomcatHSQLDBPlugin"
+ debug="0"/>
+
+ <!-- Global JNDI resources -->
+ <GlobalNamingResources>
+
+ <!-- Test entry for demonstration purposes -->
+ <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
+
+ <!-- Editable user database that can also be used by
+ UserDatabaseRealm to authenticate users -->
+ <Resource name="UserDatabase" auth="Container"
+ type="org.apache.catalina.UserDatabase"
+ description="User database that can be updated and saved">
+ </Resource>
+ <ResourceParams name="UserDatabase">
+ <parameter>
+ <name>factory</name>
+ <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
+ </parameter>
+ <parameter>
+ <name>pathname</name>
+ <value>conf/tomcat-users.xml</value>
+ </parameter>
+ </ResourceParams>
+
+ </GlobalNamingResources>
+
+ <!-- A "Service" is a collection of one or more "Connectors" that share
+ a single "Container" (and therefore the web applications visible
+ within that Container). Normally, that Container is an "Engine",
+ but this is not required.
+
+ Note: A "Service" is not itself a "Container", so you may not
+ define subcomponents such as "Valves" or "Loggers" at this level.
+ -->
+
+ <!-- Define the Tomcat Stand-Alone Service -->
+ <Service name="Catalina">
+
+ <!-- A "Connector" represents an endpoint by which requests are received
+ and responses are returned. Each Connector passes requests on to the
+ associated "Container" (normally an Engine) for processing.
+
+ By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
+ You can also enable an SSL HTTP/1.1 Connector on port 8443 by
+ following the instructions below and uncommenting the second Connector
+ entry. SSL support requires the following steps (see the SSL Config
+ HOWTO in the Tomcat 5 documentation bundle for more detailed
+ instructions):
+ * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
+ later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
+ * Execute:
+ %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
+ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
+ with a password value of "changeit" for both the certificate and
+ the keystore itself.
+
+ By default, DNS lookups are enabled when a web application calls
+ request.getRemoteHost(). This can have an adverse impact on
+ performance, so you can disable it by setting the
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
+ request.getRemoteHost() will return the String version of the
+ IP address of the remote client.
+ -->
+
+ <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
+ <Connector port="8080"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" redirectPort="8443" acceptCount="100"
+ debug="0" connectionTimeout="20000"
+ disableUploadTimeout="true" />
+ <!-- Note : To disable connection timeouts, set connectionTimeout value
+ to 0 -->
+
+ <!-- Note : To use gzip compression you could set the following properties :
+
+ compression="on"
+ compressionMinSize="2048"
+ noCompressionUserAgents="gozilla, traviata"
+ compressableMimeType="text/html,text/xml"
+ -->
+
+ <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
+ <!--
+ <Connector port="8443"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false" disableUploadTimeout="true"
+ acceptCount="100" debug="0" scheme="https" secure="true"
+ clientAuth="false" sslProtocol="TLS" />
+ -->
+
+ <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
+ <Connector port="8009"
+ enableLookups="false" redirectPort="8443" debug="0"
+ protocol="AJP/1.3" />
+
+ <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
+ <!-- See proxy documentation for more information about using this. -->
+ <!--
+ <Connector port="8082"
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+ enableLookups="false"
+ acceptCount="100" debug="0" connectionTimeout="20000"
+ proxyPort="80" disableUploadTimeout="true" />
+ -->
+
+ <!-- An Engine represents the entry point (within Catalina) that processes
+ every request. The Engine implementation for Tomcat stand alone
+ analyzes the HTTP headers included with the request, and passes them
+ on to the appropriate Host (virtual host). -->
+
+ <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :
+ <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">
+ -->
+
+ <!-- Define the top level container in our container hierarchy -->
+ <Engine name="Catalina" defaultHost="localhost" debug="0">
+
+ <!-- The request dumper valve dumps useful debugging information about
+ the request headers and cookies that were received, and the response
+ headers and cookies that were sent, for all requests received by
+ this instance of Tomcat. If you care only about requests to a
+ particular virtual host, or a particular application, nest this
+ element inside the corresponding <Host> or <Context> entry instead.
+
+ For a similar mechanism that is portable to all Servlet 2.4
+ containers, check out the "RequestDumperFilter" Filter in the
+ example application (the source for this filter may be found in
+ "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
+
+ Request dumping is disabled by default. Uncomment the following
+ element to enable it. -->
+ <!--
+ <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
+ -->
+
+ <!-- Global logger unless overridden at lower levels -->
+ <Logger className="org.apache.catalina.logger.FileLogger"
+ prefix="catalina_log." suffix=".txt"
+ timestamp="true"/>
+
+ <!-- Because this Realm is here, an instance will be shared globally -->
+
+ <!-- This Realm uses the UserDatabase configured in the global JNDI
+ resources under the key "UserDatabase". Any edits
+ that are performed against this UserDatabase are immediately
+ available for use by the Realm. -->
+ <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+ debug="0" resourceName="UserDatabase"/>
+
+ <!-- Comment out the old realm but leave here for now in case we
+ need to go back quickly -->
+ <!--
+ <Realm className="org.apache.catalina.realm.MemoryRealm" />
+ -->
+
+ <!-- Replace the above Realm with one of the following to get a Realm
+ stored in a database and accessed via JDBC -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="org.gjt.mm.mysql.Driver"
+ connectionURL="jdbc:mysql://localhost/authority"
+ connectionName="test" connectionPassword="test"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="oracle.jdbc.driver.OracleDriver"
+ connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
+ connectionName="scott" connectionPassword="tiger"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!--
+ <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
+ driverName="sun.jdbc.odbc.JdbcOdbcDriver"
+ connectionURL="jdbc:odbc:CATALINA"
+ userTable="users" userNameCol="user_name" userCredCol="user_pass"
+ userRoleTable="user_roles" roleNameCol="role_name" />
+ -->
+
+ <!-- Define the default virtual host
+ Note: XML Schema validation will not work with Xerces 2.2.
+ -->
+ <Host name="localhost" debug="0" appBase="webapps"
+ unpackWARs="true" autoDeploy="true"
+ xmlValidation="false" xmlNamespaceAware="false">
+
+ <!-- Defines a cluster for this node,
+ By defining this element, means that every manager will be changed.
+ So when running a cluster, only make sure that you have webapps in there
+ that need to be clustered and remove the other ones.
+ A cluster has the following parameters:
+
+ className = the fully qualified name of the cluster class
+
+ name = a descriptive name for your cluster, can be anything
+
+ debug = the debug level, higher means more output
+
+ mcastAddr = the multicast address, has to be the same for all the nodes
+
+ mcastPort = the multicast port, has to be the same for all the nodes
+
+ mcastBindAddr = bind the multicast socket to a specific address
+
+ mcastTTL = the multicast TTL if you want to limit your broadcast
+
+ mcastSoTimeout = the multicast readtimeout
+
+ mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
+
+ mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
+
+ tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
+
+ tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
+ in case of multiple ethernet cards.
+ auto means that address becomes
+ InetAddress.getLocalHost().getHostAddress()
+
+ tcpListenPort = the tcp listen port
+
+ tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
+ has a wakup bug in java.nio. Set to 0 for no timeout
+
+ printToScreen = true means that managers will also print to std.out
+
+ expireSessionsOnShutdown = true means that
+
+ useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
+ false means to replicate the session after each request.
+ false means that replication would work for the following piece of code:
+ <%
+ HashMap map = (HashMap)session.getAttribute("map");
+ map.put("key","value");
+ %>
+ replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
+ * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
+ * Synchronous means that the thread that executes the request, is also the
+ thread the replicates the data to the other nodes, and will not return until all
+ nodes have received the information.
+ * Asynchronous means that there is a specific 'sender' thread for each cluster node,
+ so the request thread will queue the replication request into a "smart" queue,
+ and then return to the client.
+ The "smart" queue is a queue where when a session is added to the queue, and the same session
+ already exists in the queue from a previous request, that session will be replaced
+ in the queue instead of replicating two requests. This almost never happens, unless there is a
+ large network delay.
+ -->
+ <!--
+ When configuring for clustering, you also add in a valve to catch all the requests
+ coming in, at the end of the request, the session may or may not be replicated.
+ A session is replicated if and only if all the conditions are met:
+ 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
+ 2. a session exists (has been created)
+ 3. the request is not trapped by the "filter" attribute
+
+ The filter attribute is to filter out requests that could not modify the session,
+ hence we don't replicate the session after the end of this request.
+ The filter is negative, ie, anything you put in the filter, you mean to filter out,
+ ie, no replication will be done on requests that match one of the filters.
+ The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
+
+ filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
+ ending with .gif and .js are intercepted.
+
+ The deployer element can be used to deploy apps cluster wide.
+ Currently the deployment only deploys/undeploys to working members in the cluster
+ so no WARs are copied upons startup of a broken node.
+ The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
+ When a new war file is added the war gets deployed to the local instance,
+ and then deployed to the other instances in the cluster.
+ When a war file is deleted from the watchDir the war is undeployed locally
+ and cluster wide
+ -->
+
+ <!--
+ <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
+ managerClassName="org.apache.catalina.cluster.session.DeltaManager"
+ expireSessionsOnShutdown="false"
+ useDirtyFlag="true">
+
+ <Membership
+ className="org.apache.catalina.cluster.mcast.McastService"
+ mcastAddr="228.0.0.4"
+ mcastPort="45564"
+ mcastFrequency="500"
+ mcastDropTime="3000"/>
+
+ <Receiver
+ className="org.apache.catalina.cluster.tcp.ReplicationListener"
+ tcpListenAddress="auto"
+ tcpListenPort="4001"
+ tcpSelectorTimeout="100"
+ tcpThreadCount="6"/>
+
+ <Sender
+ className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
+ replicationMode="pooled"/>
+
+ <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
+ filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
+
+ <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
+ tempDir="/tmp/war-temp/"
+ deployDir="/tmp/war-deploy/"
+ watchDir="/tmp/war-listen/"
+ watchEnabled="false"/>
+ </Cluster>
+ -->
+
+
+
+ <!-- Normally, users must authenticate themselves to each web app
+ individually. Uncomment the following entry if you would like
+ a user to be authenticated the first time they encounter a
+ resource protected by a security constraint, and then have that
+ user identity maintained across *all* web applications contained
+ in this virtual host. -->
+ <!--
+ <Valve className="org.apache.catalina.authenticator.SingleSignOn"
+ debug="0"/>
+ -->
+
+ <!-- Access log processes all requests for this virtual host. By
+ default, log files are created in the "logs" directory relative to
+ $CATALINA_HOME. If you wish, you can specify a different
+ directory with the "directory" attribute. Specify either a relative
+ (to $CATALINA_HOME) or absolute path to the desired directory.
+ -->
+ <!--
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ -->
+
+ <!-- Logger shared by all Contexts related to this virtual host. By
+ default (when using FileLogger), log files are created in the "logs"
+ directory relative to $CATALINA_HOME. If you wish, you can specify
+ a different directory with the "directory" attribute. Specify either a
+ relative (to $CATALINA_HOME) or absolute path to the desired
+ directory.-->
+ <Logger className="org.apache.catalina.logger.FileLogger"
+ directory="logs" prefix="localhost_log." suffix=".txt"
+ timestamp="true"/>
+
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
Added: incubator/roller/trunk/sandbox/standalone/tomcat/setenv.bat
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/setenv.bat?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/setenv.bat (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/setenv.bat Wed Jun 8 20:18:46 2005
@@ -0,0 +1 @@
+set JAVA_OPTS=-Dhsqldb_database=%CATALINA_HOME%\blogdata\rollerdb -Dhsqldb_port=7475 -DrollerPageDir=%CATALINA_HOME%\wikidata -DrollerStorageDir=%CATALINA_HOME%\wikiattachments
Added: incubator/roller/trunk/sandbox/standalone/tomcat/setenv.sh
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/sandbox/standalone/tomcat/setenv.sh?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/sandbox/standalone/tomcat/setenv.sh (added)
+++ incubator/roller/trunk/sandbox/standalone/tomcat/setenv.sh Wed Jun 8 20:18:46 2005
@@ -0,0 +1,3 @@
+#
+JAVA_OPTS="-Dhsqldb_database=${CATALINA_HOME}/blogdata/rollerdb -Dhsqldb_port=7475 -DrollerPageDir=${CATALINA_HOME}/wikidata -DrollerStorageDir=${CATALINA_HOME}/wikiattachments"
+export JAVA_OPTS
\ No newline at end of file
Added: incubator/roller/trunk/src/org/roller/RollerException.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/RollerException.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/RollerException.java (added)
+++ incubator/roller/trunk/src/org/roller/RollerException.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,91 @@
+
+package org.roller;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * Generic RollerException
+ */
+public class RollerException extends Exception
+{
+ private Throwable mRootCause = null;
+
+ public RollerException(String s,Throwable t)
+ {
+ super(s);
+ mRootCause = t;
+ }
+ public RollerException(Throwable t)
+ {
+ mRootCause = t;
+ }
+ public RollerException(String s)
+ {
+ super(s);
+ }
+ public RollerException()
+ {
+ super();
+ }
+ public Throwable getRootCause()
+ {
+ return mRootCause;
+ }
+
+ /**
+ * @see java.lang.Throwable#printStackTrace()
+ */
+ public void printStackTrace()
+ {
+ super.printStackTrace();
+ if (mRootCause != null)
+ {
+ System.out.println("--- ROOT CAUSE ---");
+ mRootCause.printStackTrace();
+ }
+ }
+
+ /**
+ * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
+ */
+ public void printStackTrace(PrintStream s)
+ {
+ super.printStackTrace(s);
+ if (mRootCause != null)
+ {
+ s.println("--- ROOT CAUSE ---");
+ mRootCause.printStackTrace(s);
+ }
+ }
+
+ /**
+ * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
+ */
+ public void printStackTrace(PrintWriter s)
+ {
+ super.printStackTrace(s);
+ if (null != mRootCause)
+ {
+ s.println("--- ROOT CAUSE ---");
+ mRootCause.printStackTrace(s);
+ }
+ }
+
+ public String getRootCauseMessage()
+ {
+ String rcmessage = null;
+ if (getRootCause()!=null)
+ {
+ if (getRootCause().getCause()!=null)
+ {
+ rcmessage = getRootCause().getCause().getMessage();
+ }
+ rcmessage = (rcmessage == null) ? getRootCause().getMessage() : rcmessage;
+ rcmessage = (rcmessage == null) ? super.getMessage() : rcmessage;
+ rcmessage = (rcmessage == null) ? "NONE" : rcmessage;
+ }
+ return rcmessage;
+ }
+}
+
Added: incubator/roller/trunk/src/org/roller/RollerPermissionsException.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/RollerPermissionsException.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/RollerPermissionsException.java (added)
+++ incubator/roller/trunk/src/org/roller/RollerPermissionsException.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,21 @@
+package org.roller;
+
+/**
+ * Throw when persistence session user lacks one or more required permissions.
+ */
+public class RollerPermissionsException extends RollerException
+{
+ public RollerPermissionsException(String s,Throwable t)
+ {
+ super(s,t);
+ }
+ public RollerPermissionsException(Throwable t)
+ {
+ super(t);
+ }
+ public RollerPermissionsException(String s)
+ {
+ super(s);
+ }
+}
+
Added: incubator/roller/trunk/src/org/roller/business/AutoPingManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/AutoPingManagerImpl.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/AutoPingManagerImpl.java (added)
+++ incubator/roller/trunk/src/org/roller/business/AutoPingManagerImpl.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger Project under the terms of the Roller Software
+ * License
+ */
+
+package org.roller.business;
+
+import org.roller.model.AutoPingManager;
+import org.roller.model.Roller;
+import org.roller.model.PingQueueManager;
+import org.roller.model.RollerFactory;
+import org.roller.pojos.AutoPingData;
+import org.roller.pojos.PingTargetData;
+import org.roller.pojos.WebsiteData;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.RollerException;
+import org.roller.config.PingConfig;
+import org.roller.config.PingConfig;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.Collection;
+
+public abstract class AutoPingManagerImpl implements AutoPingManager
+{
+ protected PersistenceStrategy persistenceStrategy;
+
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(AutoPingManagerImpl.class);
+
+ public AutoPingManagerImpl(PersistenceStrategy persistenceStrategy)
+ {
+ this.persistenceStrategy = persistenceStrategy;
+ }
+
+ public void release()
+ {
+ }
+
+ public AutoPingData createAutoPing(PingTargetData pingTarget, WebsiteData website) throws RollerException
+ {
+ return new AutoPingData(null, pingTarget, website);
+ }
+
+ public AutoPingData retrieveAutoPing(String id) throws RollerException
+ {
+ return (AutoPingData) persistenceStrategy.load(id, AutoPingData.class);
+ }
+
+ public void storeAutoPing(AutoPingData autoPing) throws RollerException
+ {
+ persistenceStrategy.store(autoPing);
+ }
+
+ public void removeAutoPing(String id) throws RollerException
+ {
+ //TODO: first remove all related category restrictions (category restrictions are not yet implemented)
+ persistenceStrategy.remove(id, AutoPingData.class);
+ }
+
+ public void removeAutoPing(AutoPingData autoPing) throws RollerException
+ {
+ //TODO: first remove all related category restrictions (category restrictions are not yet implemented)
+ persistenceStrategy.remove(autoPing);
+ }
+
+ public void removeAutoPings(Collection autopings) throws RollerException
+ {
+ for(Iterator i = autopings.iterator(); i.hasNext(); ) {
+ removeAutoPing((AutoPingData) i.next());
+ }
+ }
+
+ public void queueApplicableAutoPings(WeblogEntryData changedWeblogEntry) throws RollerException
+ {
+ if (PingConfig.getSuspendPingProcessing())
+ {
+ if (mLogger.isDebugEnabled()) mLogger.debug("Ping processing is suspended. No auto pings will be queued.");
+ return;
+ }
+
+ PingQueueManager pingQueueMgr = RollerFactory.getRoller().getPingQueueManager();
+ List applicableAutopings = getApplicableAutoPings(changedWeblogEntry);
+ for (Iterator i = applicableAutopings.iterator(); i.hasNext(); ) {
+ AutoPingData autoPing = (AutoPingData) i.next();
+ pingQueueMgr.addQueueEntry(autoPing);
+ }
+ }
+
+}
Added: incubator/roller/trunk/src/org/roller/business/BookmarkManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/BookmarkManagerImpl.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/BookmarkManagerImpl.java (added)
+++ incubator/roller/trunk/src/org/roller/business/BookmarkManagerImpl.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,355 @@
+package org.roller.business;
+
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.roller.RollerException;
+import org.roller.model.BookmarkManager;
+import org.roller.model.Roller;
+import org.roller.pojos.Assoc;
+import org.roller.pojos.BookmarkData;
+import org.roller.pojos.FolderAssoc;
+import org.roller.pojos.FolderData;
+import org.roller.pojos.WebsiteData;
+import org.roller.util.Utilities;
+
+
+/**
+ * Abstract base implementation using PersistenceStrategy.
+ * @author Dave Johnson
+ * @author Lance Lavandowska
+ */
+public abstract class BookmarkManagerImpl implements BookmarkManager
+{
+ protected PersistenceStrategy mStrategy;
+
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(BookmarkManagerImpl.class);
+
+ public BookmarkManagerImpl(PersistenceStrategy pstrategy)
+ {
+ mStrategy = pstrategy;
+ }
+
+ //---------------------------------------------------------- Bookmark CRUD
+
+ public BookmarkData createBookmark()
+ {
+ BookmarkData bd = new BookmarkData();
+ return bd;
+ }
+
+ public BookmarkData createBookmark(
+ FolderData parent,
+ String name,
+ String desc,
+ String url,
+ String feedUrl,
+ Integer weight,
+ Integer priority,
+ String image)
+ {
+ BookmarkData bd = new BookmarkData(
+ parent, name, desc, url, feedUrl, weight, priority, image);
+ return bd;
+ }
+
+ public BookmarkData retrieveBookmark(String id) throws RollerException
+ {
+ BookmarkData bd = (BookmarkData)
+ mStrategy.load(id, BookmarkData.class);
+ if (bd != null) bd.setBookmarkManager(this);
+ return bd;
+ }
+
+// public void storeBookmark(BookmarkData data) throws RollerException
+// {
+// mStrategy.store(data);
+// }
+
+ public void removeBookmark(String id) throws RollerException
+ {
+ mStrategy.remove(id, BookmarkData.class);
+ }
+
+ //------------------------------------------------------------ Folder CRUD
+
+ /**
+ * @see org.roller.model.BookmarkManager#createFolder()
+ */
+ public FolderData createFolder()
+ {
+ FolderData fd = new FolderData();
+ return fd;
+ }
+
+ /**
+ * @see org.roller.model.BookmarkManager#createFolder()
+ */
+ public FolderData createFolder(
+ FolderData parent,
+ String name,
+ String desc,
+ WebsiteData website)
+ {
+ FolderData fd = new FolderData(parent, name, desc, website);
+ return fd;
+ }
+
+ /**
+ * Retrieve folder and lazy-load it's sub-folders and bookmarks.
+ */
+ public FolderData retrieveFolder(String id) throws RollerException
+ {
+ return (FolderData)mStrategy.load(id, FolderData.class);
+ }
+
+ //------------------------------------------------------------ Operations
+
+ public void importBookmarks(
+ WebsiteData website, String folderName, String opml)
+ throws RollerException
+ {
+ String msg = "importBookmarks";
+ try
+ {
+ FolderData newFolder = getFolder(website, folderName);
+ if (newFolder == null)
+ {
+ newFolder = createFolder(
+ getRootFolder(website), folderName, folderName, website);
+ newFolder.save();
+ }
+
+ // Build JDOC document OPML string
+ SAXBuilder builder = new SAXBuilder();
+ StringReader reader = new StringReader( opml );
+ Document doc = builder.build( reader );
+
+ // Iterate through children of OPML body, importing each
+ Element body = doc.getRootElement().getChild("body");
+ Iterator iter = body.getChildren().iterator();
+ while (iter.hasNext())
+ {
+ Element elem = (Element)iter.next();
+ importOpmlElement( website, elem, newFolder );
+ }
+ }
+ catch (Exception e)
+ {
+ mLogger.error(msg,e);
+ throw new RollerException(msg,e);
+ }
+ }
+
+ //----------------------------------------------------------------
+ private void importOpmlElement(
+ WebsiteData website, Element elem, FolderData parent)
+ throws RollerException
+ {
+ String text = elem.getAttributeValue("text");
+ String title = elem.getAttributeValue("title");
+ String desc = elem.getAttributeValue("description");
+ String url = elem.getAttributeValue("url");
+ //String type = elem.getAttributeValue("type");
+ String xmlUrl = elem.getAttributeValue("xmlUrl");
+ String htmlUrl = elem.getAttributeValue("htmlUrl");
+
+ title = null!=title ? title : text;
+ desc = null!=desc ? desc : title;
+ xmlUrl = null!=xmlUrl ? xmlUrl : url;
+ url = null!=htmlUrl ? htmlUrl : url;
+
+ if (elem.getChildren().size()==0)
+ {
+ // Leaf element. Store a bookmark
+ // Currently bookmarks must have at least a name and HTML url to be stored. Previous logic was
+ // trying to skip invalid ones, but was letting ones with an xml url and no html url through
+ // which could result in a db exception.
+ // TODO: Consider providing error feedback instead of silently skipping the invalid bookmarks here.
+ if (null != title && null != url)
+ {
+ BookmarkData bd = createBookmark(parent,
+ title,
+ desc,
+ url,
+ xmlUrl,
+ new Integer(0),
+ new Integer(100),
+ null);
+ parent.addBookmark(bd);
+ }
+ }
+ else
+ {
+ // Store a folder
+ FolderData fd = createFolder(
+ parent,
+ title,
+ desc,
+ parent.getWebsite());
+ fd.save();
+
+ // Import folder's children
+ Iterator iter = elem.getChildren("outline").iterator();
+ while ( iter.hasNext() )
+ {
+ Element subelem = (Element)iter.next();
+ importOpmlElement( website, subelem, fd );
+ }
+ }
+ }
+
+ //----------------------------------------------------------------
+ public void moveFolderContents(FolderData src, FolderData dest)
+ throws RollerException
+ {
+ if (dest.descendentOf(src))
+ {
+ throw new RollerException(
+ "ERROR cannot move parent folder into it's own child");
+ }
+
+ // Add to destination folder
+ LinkedList deleteList = new LinkedList();
+ Iterator srcBookmarks = src.getBookmarks().iterator();
+ while (srcBookmarks.hasNext())
+ {
+ BookmarkData bd = (BookmarkData)srcBookmarks.next();
+ deleteList.add(bd);
+
+ BookmarkData movedBd = new BookmarkData();
+ movedBd.setData(bd);
+ movedBd.setId(null);
+
+ dest.addBookmark(movedBd);
+ }
+
+ // Remove from source folder
+ Iterator deleteIter = deleteList.iterator();
+ while (deleteIter.hasNext())
+ {
+ BookmarkData bd = (BookmarkData)deleteIter.next();
+ src.removeBookmark(bd);
+ removeBookmark(bd.getId());
+ }
+ }
+
+ //----------------------------------------------------------------
+ public void deleteFolderContents(FolderData src)
+ throws RollerException
+ {
+ Iterator srcBookmarks = src.getBookmarks().iterator();
+ while (srcBookmarks.hasNext())
+ {
+ BookmarkData bd = (BookmarkData)srcBookmarks.next();
+ removeBookmark(bd.getId());
+
+ }
+ }
+
+ //---------------------------------------------------------------- Queries
+
+ public FolderData getFolder(WebsiteData website, String folderPath)
+ throws RollerException
+ {
+ return getFolderByPath(website, null, folderPath);
+ }
+
+ public String getPath(FolderData folder) throws RollerException
+ {
+ if (null == folder.getParent())
+ {
+ return "/";
+ }
+ else
+ {
+ String parentPath = getPath(folder.getParent());
+ parentPath = "/".equals(parentPath) ? "" : parentPath;
+ return parentPath + "/" + folder.getName();
+ }
+ }
+
+ public FolderData getFolderByPath(
+ WebsiteData website, FolderData folder, String path)
+ throws RollerException
+ {
+ final Iterator folders;
+ final String[] pathArray = Utilities.stringToStringArray(path, "/");
+
+ if (folder == null && (null == path || "".equals(path.trim())))
+ {
+ throw new RollerException("Bad arguments.");
+ }
+
+ if (path.trim().equals("/"))
+ {
+ return getRootFolder(website);
+ }
+ else if (folder == null || path.trim().startsWith("/"))
+ {
+ folders = getRootFolder(website).getFolders().iterator();
+ }
+ else
+ {
+ folders = folder.getFolders().iterator();
+ }
+
+ while (folders.hasNext())
+ {
+ FolderData possibleMatch = (FolderData)folders.next();
+ if (possibleMatch.getName().equals(pathArray[0]))
+ {
+ if (pathArray.length == 1)
+ {
+ return possibleMatch;
+ }
+ else
+ {
+ String[] subpath = new String[pathArray.length - 1];
+ System.arraycopy(pathArray, 1, subpath, 0, subpath.length);
+
+ String pathString= Utilities.stringArrayToString(subpath,"/");
+ return getFolderByPath(website, possibleMatch, pathString);
+ }
+ }
+ }
+
+ // The folder did not match and neither did any subfolders
+ return null;
+ }
+
+ //----------------------------------------------- FolderAssoc CRUD
+
+ public Assoc createFolderAssoc()
+ {
+ return new FolderAssoc();
+ }
+
+ public Assoc createFolderAssoc(
+ FolderData folder,
+ FolderData ancestor,
+ String relation) throws RollerException
+ {
+ return new FolderAssoc(null, folder, ancestor, relation);
+ }
+
+ public FolderAssoc retrieveFolderAssoc(String id) throws RollerException
+ {
+ return (FolderAssoc)mStrategy.load(id, FolderAssoc.class);
+ }
+
+ public void release()
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
+
+
Added: incubator/roller/trunk/src/org/roller/business/ConfigManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/ConfigManagerImpl.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/ConfigManagerImpl.java (added)
+++ incubator/roller/trunk/src/org/roller/business/ConfigManagerImpl.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,138 @@
+/*
+ * Created on Feb 4, 2004
+ */
+package org.roller.business;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.RollerException;
+import org.roller.model.ConfigManager;
+import org.roller.model.Roller;
+import org.roller.pojos.RollerConfigData;
+import org.roller.util.OldRollerConfig;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.math.BigDecimal;
+
+/**
+ * Abstract base implementation using PersistenceStrategy.
+ * @author Dave Johnson
+ * @author Lance Lavandowska
+ */
+public abstract class ConfigManagerImpl implements ConfigManager {
+
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(ConfigManagerImpl.class);
+
+ protected PersistenceStrategy mStrategy;
+
+ public ConfigManagerImpl(PersistenceStrategy strategy)
+ {
+ mStrategy = strategy;
+ }
+
+ public void release()
+ {
+ }
+
+ /**
+ * @see org.roller.model.ConfigManager#storeRollerConfig(org.roller.pojos.RollerConfig)
+ */
+ public void storeRollerConfig(RollerConfigData data) throws RollerException
+ {
+ mStrategy.store(data);
+ }
+
+ /**
+ * Take the RollerConfigFile read from roller-config.xml
+ * and set the values into a new RollerConfig instance.
+ * Some values will need be converted from List to comma-delimited String.
+ */
+ private RollerConfigData newConfigFromFile(OldRollerConfig file) throws RollerException
+ {
+ RollerConfigData config = new RollerConfigData();
+ config.setAbsoluteURL ( file.getAbsoluteURL() );
+ config.setRssUseCache ( Boolean.valueOf(file.getRssUseCache()) );
+ config.setRssCacheTime ( new Integer(file.getRssCacheTime()) );
+ config.setNewUserAllowed ( Boolean.valueOf(file.getNewUserAllowed()) );
+ config.setAdminUsers ( StringUtils.join( file.getAdminUsers().toArray(), ",") );
+ config.setUserThemes ( file.getNewUserThemes() );
+ config.setEditorPages ( StringUtils.join( file.getEditorPages().toArray(), ",") );
+ config.setEnableAggregator ( Boolean.valueOf(file.getEnableAggregator()) );
+ config.setUploadEnabled ( Boolean.valueOf(file.getUploadEnabled()) );
+ config.setUploadMaxDirMB ( new BigDecimal(file.getUploadMaxDirMB().doubleValue()).setScale(2) );
+ config.setUploadMaxFileMB ( new BigDecimal(file.getUploadMaxFileMB().doubleValue()).setScale(2) );
+ config.setUploadAllow ( StringUtils.join( file.getUploadAllow().toArray(), ",") );
+ config.setUploadForbid ( StringUtils.join( file.getUploadForbid().toArray(), ",") );
+ config.setUploadDir ( file.getUploadDir() );
+ config.setUploadPath ( file.getUploadPath() );
+ config.setMemDebug ( Boolean.valueOf(file.getMemDebug()) );
+ config.setAutoformatComments ( Boolean.valueOf(file.getAutoformatComments()) );
+ config.setEscapeCommentHtml ( Boolean.valueOf(file.getEscapeCommentHtml()) );
+ config.setEmailComments ( Boolean.valueOf(file.getEmailComments()) );
+ config.setEnableLinkback ( Boolean.valueOf(file.isEnableLinkback()) );
+ config.setSiteName ( file.getSiteName() );
+ config.setSiteDescription ( file.getSiteDescription() );
+ config.setEmailAddress ( file.getEmailAddress() );
+ config.setIndexDir ( file.getIndexDir() );
+ config.setEncryptPasswords( Boolean.valueOf(file.getEncryptPasswords()) );
+ return config;
+ }
+
+ /**
+ * Read in RollerConfig from the indicated filePath or, if the file cannot be found
+ * returns a freshly initialized RollerConfig object.
+ * @param filePath where roller-config.xml can be found.
+ */
+ public RollerConfigData readFromFile(String filePath) throws RollerException
+ {
+ // Try to read roller-config.xml
+ OldRollerConfig file = null;
+ java.io.InputStream in = null;
+ try
+ {
+ in = new FileInputStream(filePath);
+ file = OldRollerConfig.readConfig(in);
+ }
+ catch (FileNotFoundException fnf)
+ {
+ mLogger.info("roller-config.xml not found, creating new: "+ filePath);
+ return new RollerConfigData();
+ }
+ catch (SecurityException se)
+ {
+ throw new RuntimeException(se);
+ }
+ finally
+ {
+ try
+ {
+ if (in != null)
+ in.close();
+ }
+ catch (java.io.IOException ioe)
+ {
+ mLogger.warn("ERROR closing InputStream", ioe);
+ }
+ }
+
+ if (file == null)
+ {
+ file = new OldRollerConfig();
+ mLogger.warn("Unable to read in roller-config.xml, creating 'blank' RollerConfigFile");
+ }
+ return newConfigFromFile(file);
+ }
+
+ /**
+ * This isn't part of the ConfigManager Interface, because really
+ * we shouldn't ever delete the RollerConfig. This is mostly here
+ * to assist with unit testing.
+ */
+ public void removeRollerConfig(String id) throws RollerException
+ {
+ mStrategy.remove(id,RollerConfigData.class);
+ }
+}
Added: incubator/roller/trunk/src/org/roller/business/FileManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/FileManagerImpl.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/FileManagerImpl.java (added)
+++ incubator/roller/trunk/src/org/roller/business/FileManagerImpl.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,314 @@
+package org.roller.business;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.util.Map;
+import org.apache.commons.lang.StringUtils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.RollerException;
+import org.roller.config.RollerConfig;
+import org.roller.model.FileManager;
+import org.roller.model.Roller;
+import org.roller.model.RollerFactory;
+import org.roller.pojos.RollerPropertyData;
+import org.roller.pojos.WebsiteData;
+import org.roller.util.RollerMessages;
+
+/**
+ * Responsible for managing website resources. This base implementation
+ * writes resources to a filesystem.
+ *
+ * @author David M Johnson
+ * @author Allen Gilliland
+ */
+public class FileManagerImpl implements FileManager
+{
+ private String upload_dir = null;
+ private String upload_url = null;
+
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(FileManagerImpl.class);
+
+
+ /**
+ * Create file manager.
+ * @param roller Roller instance.
+ * @param realPath Path to Servlet context directory
+ */
+ public FileManagerImpl()
+ {
+ String uploaddir = RollerConfig.getProperty("uploads.dir");
+ String uploadurl = RollerConfig.getProperty("uploads.url");
+
+ if(uploaddir == null || uploaddir.trim().length() < 1)
+ uploaddir = "${user.home}/roller_data/uploads";
+
+ if(uploaddir.startsWith("${user.home}"))
+ uploaddir = System.getProperty("user.home") + uploaddir.substring(12);
+
+ if( ! uploaddir.endsWith(File.separator))
+ uploaddir += File.separator;
+
+ if(uploadurl == null || uploadurl.trim().length() < 1)
+ uploadurl = "/resources";
+
+ this.upload_dir = uploaddir;
+ this.upload_url = uploadurl;
+ }
+
+
+ /**
+ * Get the upload directory being used by this file manager
+ **/
+ public String getUploadDir() {
+ return this.upload_dir;
+ }
+
+ /**
+ * Get the upload path being used by this file manager
+ **/
+ public String getUploadUrl() {
+ return this.upload_url;
+ }
+
+
+ /**
+ * Determine if file can be saved given current RollerConfig settings.
+ */
+ public boolean canSave(
+ WebsiteData site, String name, long size, RollerMessages messages)
+ throws RollerException
+ {
+ Roller mRoller = RollerFactory.getRoller();
+ Map config = mRoller.getPropertiesManager().getProperties();
+
+ if (!((RollerPropertyData)config.get("uploads.enabled")).getValue().equalsIgnoreCase("true")) {
+ messages.addError("error.upload.disabled");
+ return false;
+ }
+
+ String allows = ((RollerPropertyData)config.get("uploads.types.allowed")).getValue();
+ String forbids = ((RollerPropertyData)config.get("uploads.types.forbid")).getValue();
+ String[] allowFiles = StringUtils.split(StringUtils.deleteWhitespace(allows), ",");
+ String[] forbidFiles = StringUtils.split(StringUtils.deleteWhitespace(forbids), ",");
+ if (!checkFileType(allowFiles, forbidFiles, name)) {
+ messages.addError("error.upload.forbiddenFile", allows);
+ return false;
+ }
+
+ BigDecimal maxDirMB = new BigDecimal(
+ ((RollerPropertyData)config.get("uploads.dir.maxsize")).getValue());
+ int maxDirBytes = (int)(1024000 * maxDirMB.doubleValue());
+ int userDirSize = getUserDirSize(site.getUser().getUserName(), this.upload_dir);
+ if (userDirSize + size > maxDirBytes) {
+ messages.addError("error.upload.dirmax", maxDirMB.toString());
+ return false;
+ }
+
+ BigDecimal maxFileMB = new BigDecimal(
+ ((RollerPropertyData)config.get("uploads.file.maxsize")).getValue());
+ int maxFileBytes = (int)(1024000 * maxFileMB.doubleValue());
+ mLogger.debug(""+maxFileBytes);
+ mLogger.debug(""+size);
+ if (size > maxFileBytes) {
+ messages.addError("error.upload.filemax", maxFileMB.toString());
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Get collection files in website's resource directory.
+ * @param site Website
+ * @return Collection of files in website's resource directory
+ */
+ public File[] getFiles(WebsiteData site) throws RollerException
+ {
+ String dir = this.upload_dir + site.getUser().getUserName();
+ File uploadDir = new File(dir);
+ return uploadDir.listFiles();
+ }
+
+ /**
+ * Delete named file from website's resource area.
+ */
+ public void deleteFile(WebsiteData site, String name)
+ throws RollerException
+ {
+ String dir = this.upload_dir + site.getUser().getUserName();
+ File f = new File(dir + File.separator + name);
+ f.delete();
+ }
+
+ /**
+ * Save file to website's resource directory.
+ * @param site Website to save to
+ * @param name Name of file to save
+ * @param size Size of file to be saved
+ * @param is Read file from input stream
+ */
+ public void saveFile(WebsiteData site, String name, long size, InputStream is)
+ throws RollerException
+ {
+ if (!canSave(site, name, size, new RollerMessages()))
+ {
+ throw new RollerException("ERROR: upload denied");
+ }
+
+ byte[] buffer = new byte[8192];
+ int bytesRead = 0;
+ String dir = this.upload_dir;
+ String userName = site.getUser().getUserName();
+
+ File dirPath = new File(dir + File.separator + userName);
+ if (!dirPath.exists())
+ {
+ dirPath.mkdirs();
+ }
+ OutputStream bos = null;
+ try
+ {
+ bos = new FileOutputStream(
+ dirPath.getAbsolutePath() + File.separator + name);
+ while ((bytesRead = is.read(buffer, 0, 8192)) != -1)
+ {
+ bos.write(buffer, 0, bytesRead);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new RollerException("ERROR uploading file", e);
+ }
+ finally
+ {
+ try
+ {
+ bos.flush();
+ bos.close();
+ }
+ catch (Exception ignored) {}
+ }
+ if (mLogger.isDebugEnabled())
+ {
+ mLogger.debug("The file has been written to \"" + dir + userName + "\"");
+ }
+ }
+
+ /**
+ * Get upload directory path.
+ * @return Upload directory path.
+ * @throws RollerException
+ */
+ /* old method ... no longer used -- Allen G
+ private String getUploadDir() throws RollerException
+ {
+ if(this.upload_dir != null)
+ {
+ return this.upload_dir;
+ }
+ else
+ {
+ Roller mRoller = RollerFactory.getRoller();
+ RollerConfigData config = RollerFactory.getRoller().getConfigManager().getRollerConfig();
+ String dir = config.getUploadDir();
+ if (dir == null || dir.trim().length()==0)
+ {
+ dir = mRealPath + File.separator + USER_RESOURCES;
+ }
+
+ return dir;
+ }
+ }
+ */
+
+ /**
+ * Returns current size of file uploads owned by specified user.
+ * @param username User
+ * @param dir Upload directory
+ * @return Size of user's uploaded files in bytes.
+ */
+ private int getUserDirSize(String username, String dir)
+ {
+ int userDirSize = 0;
+ File d = new File(dir + File.separator + username);
+ if (d.mkdirs() || d.exists())
+ {
+ File[] files = d.listFiles();
+ long dirSize = 0l;
+ for (int i=0; i<files.length; i++)
+ {
+ if (!files[i].isDirectory())
+ {
+ dirSize = dirSize + files[i].length();
+ }
+ }
+ userDirSize = new Long(dirSize).intValue();
+ }
+ return userDirSize;
+ }
+
+ /**
+ * Return true if file is allowed to be uplaoded given specified allowed and
+ * forbidden file types.
+ * @param allowFiles File types (i.e. extensions) that are allowed
+ * @param forbidFiles File types that are forbidden
+ * @param fileName Name of file to be uploaded
+ * @return True if file is allowed to be uploaded
+ */
+ private boolean checkFileType(
+ String[] allowFiles, String[] forbidFiles, String fileName)
+ {
+ // default to false
+ boolean allowFile = false;
+
+ // if this person hasn't listed any allows, then assume they want
+ // to allow *all* filetypes, except those listed under forbid
+ if(allowFiles == null || allowFiles.length < 1)
+ allowFile = true;
+
+ // check for allowed types
+ if (allowFiles != null && allowFiles.length > 0)
+ {
+ for (int y=0; y<allowFiles.length; y++)
+ {
+ if (fileName.toLowerCase().endsWith(
+ allowFiles[y].toLowerCase()))
+ {
+ allowFile = true;
+ break;
+ }
+ }
+ }
+
+ // check for forbidden types ... this overrides any allows
+ if (forbidFiles != null && forbidFiles.length > 0)
+ {
+ for (int x=0; x<forbidFiles.length; x++)
+ {
+ if (fileName.toLowerCase().endsWith(
+ forbidFiles[x].toLowerCase()))
+ {
+ allowFile = false;
+ break;
+ }
+ }
+ }
+
+ return allowFile;
+ }
+
+ /* (non-Javadoc)
+ * @see org.roller.model.FileManager#release()
+ */
+ public void release()
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: incubator/roller/trunk/src/org/roller/business/HitCountData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/HitCountData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/HitCountData.java (added)
+++ incubator/roller/trunk/src/org/roller/business/HitCountData.java Wed Jun 8 20:18:46 2005
@@ -0,0 +1,167 @@
+package org.roller.business;
+
+/**
+ * Hit count bean.
+ * @author David M Johnson
+ *
+ * @castor:class name="HitCount" table="referer" id="id" key-generator="UUID"
+ * @hibernate.class table="referer"
+ */
+public class HitCountData
+ extends org.roller.pojos.PersistentObject
+ implements java.io.Serializable
+{
+ static final long serialVersionUID = -7998453141931097201L;
+
+ protected java.lang.String id;
+ protected java.lang.Integer dayHitCount;
+ protected java.lang.Integer totalHitCount;
+ protected org.roller.pojos.WebsiteData website;
+
+ public HitCountData()
+ {
+ }
+
+ public HitCountData( java.lang.String id,
+ java.lang.Integer dayHitCount, java.lang.Integer totalHitCount )
+ {
+ this.id = id;
+ this.totalHitCount = totalHitCount;
+ this.dayHitCount = dayHitCount;
+ }
+
+ public HitCountData( HitCountData otherData )
+ {
+ this.id = otherData.id;
+ this.totalHitCount = otherData.totalHitCount;
+ this.dayHitCount = otherData.dayHitCount;
+ }
+
+ /** @castor:field set-method="setId"
+ * @castor:field-sql name="id" sql-dirty="check" dirty="check"
+ * @castor:field-xml node="attribute"
+ * @hibernate.id column="id" type="string"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public java.lang.String getId()
+ {
+ return this.id;
+ }
+ public void setId( java.lang.String id )
+ {
+ this.id = id;
+ }
+
+ /** Day hit count.
+ * @castor:field set-method="setDayHitCount"
+ * @castor:field-sql name="dayhits" sql-dirty="check" dirty="check"
+ * @hibernate.property column="dayhits" non-null="true" unique="false"
+ */
+ public java.lang.Integer getDayHitCount()
+ {
+ return this.dayHitCount;
+ }
+ public void setDayHitCount( java.lang.Integer dayHitCount )
+ {
+ this.dayHitCount = dayHitCount;
+ }
+
+ /** Total hit count.
+ * @castor:field set-method="setTotalHitCount"
+ * @castor:field-sql name="totalhits" sql-dirty="check" dirty="check"
+ * @hibernate.property column="totalhits" non-null="true" unique="false"
+ */
+ public java.lang.Integer getTotalHitCount()
+ {
+ return this.totalHitCount;
+ }
+ public void setTotalHitCount( java.lang.Integer hitCount )
+ {
+ this.totalHitCount = hitCount;
+ }
+
+ /**
+ * ID of website that this referer refers to.
+ * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+ */
+ public org.roller.pojos.WebsiteData getWebsite()
+ {
+ return this.website;
+ }
+ public void setWebsite( org.roller.pojos.WebsiteData website )
+ {
+ this.website = website;
+ }
+
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer("{");
+
+ str.append("id=" + id + " " + "dayHitCount=" + dayHitCount);
+ str.append('}');
+
+ return(str.toString());
+ }
+
+ public boolean equals( Object pOther )
+ {
+ if( pOther instanceof HitCountData )
+ {
+ HitCountData lTest = (HitCountData) pOther;
+ boolean lEquals = true;
+
+ if( this.id == null )
+ {
+ lEquals = lEquals && ( lTest.id == null );
+ }
+ else
+ {
+ lEquals = lEquals && this.id.equals( lTest.id );
+ }
+ if( this.dayHitCount == null )
+ {
+ lEquals = lEquals && ( lTest.dayHitCount == null );
+ }
+ else
+ {
+ lEquals = lEquals && this.dayHitCount.equals( lTest.dayHitCount );
+ }
+ if( this.totalHitCount == null )
+ {
+ lEquals = lEquals && ( lTest.totalHitCount == null );
+ }
+ else
+ {
+ lEquals= lEquals && this.totalHitCount.equals(lTest.totalHitCount);
+ }
+
+ return lEquals;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
+ result = 37*result + ((this.dayHitCount != null) ? this.dayHitCount.hashCode() : 0);
+ result = 37*result + ((this.totalHitCount != null) ? this.totalHitCount.hashCode() : 0);
+ return result;
+ }
+
+ /**
+ * Setter is needed in RollerImpl.storePersistentObject()
+ */
+ public void setData( org.roller.pojos.PersistentObject otherData )
+ {
+
+ this.id = ((HitCountData)otherData).id;
+
+ this.dayHitCount = ((HitCountData)otherData).dayHitCount;
+ this.totalHitCount = ((HitCountData)otherData).totalHitCount;
+ }
+
+}