[Tynstep-svn] r106 - in trunk: . step-data-loader/src step-data-loader/src/main step-data-loader/src/main/java step-server step-server/.settings step-server/src step-server/src/main step-server/src/main/java step-server/src/main/java/com/tyndalehouse/step/server step-server/src/main/resources step-tools step-tools/.settings step-tools/src step-tools/src/main step-tools/src/main/java

ChrisBurrell at crosswire.org ChrisBurrell at crosswire.org
Wed Apr 14 13:22:59 MST 2010


Author: ChrisBurrell
Date: 2010-04-14 13:22:59 -0700 (Wed, 14 Apr 2010)
New Revision: 106

Added:
   trunk/.project
   trunk/pom.xml
   trunk/step-checks.xml
   trunk/step-data-loader/
   trunk/step-data-loader/src/main/
   trunk/step-data-loader/src/main/java/
   trunk/step-data-loader/src/main/java/com/
   trunk/step-server/.settings/
   trunk/step-server/.settings/org.eclipse.jdt.core.prefs
   trunk/step-server/.settings/org.maven.ide.eclipse.prefs
   trunk/step-server/pom.xml
   trunk/step-server/src/main/
   trunk/step-server/src/main/java/
   trunk/step-server/src/main/java/com/
   trunk/step-server/src/main/resources/
   trunk/step-server/src/main/resources/jetty.xml
   trunk/step-server/src/main/resources/webapps/
   trunk/step-tools/
   trunk/step-tools/.classpath
   trunk/step-tools/.project
   trunk/step-tools/.settings/
   trunk/step-tools/.settings/org.eclipse.jdt.core.prefs
   trunk/step-tools/.settings/org.maven.ide.eclipse.prefs
   trunk/step-tools/pom.xml
   trunk/step-tools/src/
   trunk/step-tools/src/main/
   trunk/step-tools/src/main/java/
   trunk/step-tools/src/main/java/BibleFileGenerator.java
   trunk/step-tools/src/main/java/BibleStatsAnalyser.java
   trunk/step-tools/src/main/java/ScriptureReference.java
   trunk/step-tools/src/main/resources/
   trunk/step-web-app-old/
Removed:
   trunk/STEPTestGWT/
   trunk/StepDataLoader/
   trunk/StepTools/
   trunk/step-data-loader/src/com/
   trunk/step-server/bin/
   trunk/step-server/etc/
   trunk/step-server/lib/
   trunk/step-server/src/com/
   trunk/step-server/webapps/
   trunk/step-web-app/
Modified:
   trunk/step-server/.classpath
   trunk/step-server/.project
   trunk/step-server/src/main/java/com/tyndalehouse/step/server/StepServer.java
Log:
mavenizing step 1 - 3 of 4 project, but moving previous project to old directory

Added: trunk/.project
===================================================================
--- trunk/.project	                        (rev 0)
+++ trunk/.project	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>step-parent</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: trunk/pom.xml
===================================================================
--- trunk/pom.xml	                        (rev 0)
+++ trunk/pom.xml	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,199 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.tyndalehouse</groupId>
+	<artifactId>step-parent</artifactId>
+	<packaging>pom</packaging>
+	<version>1.0-SNAPSHOT</version>
+	<name>step-parent</name>
+	
+	<properties>
+		<project.build.sourceEncoding>iso-8859-1
+		</project.build.sourceEncoding>
+		<project.reporting.outputEncoding>iso-8859-1
+		</project.reporting.outputEncoding>
+		<java.version>1.5</java.version>
+		<gwt.version>2.0.3</gwt.version>
+		<db.directory>${user.home}/TyndaleStep/StepDB</db.directory>
+		<derby.version>10.5.3.0_1</derby.version>
+		<db.driver>org.apache.derby.jdbc.EmbeddedDriver</db.driver>
+		<db.connection.string>jdbc:derby:${db.directory}</db.connection.string>
+	</properties>
+
+	<scm>
+		<connection>scm:svn:https://crosswire.org/svn/tynstep/trunk</connection>
+		<developerConnection>scm:svn:https://crosswire.org/svn/tynstep/trunk</developerConnection>
+		<url>https://crosswire.org/svn/tynstep/trunk/</url>
+	</scm>
+
+
+	<modules>
+		<module>step-web-app</module>
+		<module>step-dataloader</module>
+		<module>step-server</module>
+		<module>step-tools</module>
+	</modules>
+
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.crosswire</groupId>
+				<artifactId>jsword</artifactId>
+				<version>1.6.1-SNAPSHOT</version>
+			</dependency>
+
+			<dependency>
+				<groupId>com.google.gwt</groupId>
+				<artifactId>gwt-servlet</artifactId>
+				<version>${gwt.version}</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>com.google.gwt</groupId>
+				<artifactId>gwt-user</artifactId>
+				<version>${gwt.version}</version>
+				<scope>provided</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>com.googlecode.gwt.inject
+				</groupId>
+				<artifactId>gin</artifactId>
+				<version>1.0</version>
+			</dependency>
+			<dependency>
+				<groupId>com.google.inject</groupId>
+				<artifactId>guice</artifactId>
+				<version>2.0</version>
+			</dependency>
+
+			<dependency>
+				<groupId>com.google.inject.extensions
+				</groupId>
+				<artifactId>guice-servlet</artifactId>
+				<version>2.0</version>
+			</dependency>
+
+			<dependency>
+				<groupId>net.customware.gwt.dispatch
+				</groupId>
+				<artifactId>gwt-dispatch</artifactId>
+				<version>1.0.0</version>
+			</dependency>
+
+			<dependency>
+				<groupId>net.customware.gwt.presenter
+				</groupId>
+				<artifactId>gwt-presenter</artifactId>
+				<version>1.0.0</version>
+			</dependency>
+
+			<dependency>
+				<groupId>com.google.code.gwt-log</groupId>
+				<artifactId>gwt-log</artifactId>
+				<version>2.6.2</version>
+			</dependency>
+
+			<dependency>
+				<groupId>com.extjs</groupId>
+				<artifactId>gxt</artifactId>
+				<version>2.1.1</version>
+			</dependency>
+
+			<dependency>
+				<groupId>commons-logging</groupId>
+				<artifactId>commons-logging</artifactId>
+				<version>1.1.1</version>
+			</dependency>
+
+			<dependency>
+				<groupId>commons-dbcp</groupId>
+				<artifactId>commons-dbcp</artifactId>
+				<version>1.3</version>
+			</dependency>
+
+			<dependency>
+				<groupId>commons-io</groupId>
+				<artifactId>commons-io</artifactId>
+				<version>1.4</version>
+			</dependency>
+
+			<dependency>
+				<groupId>commons-dbutils</groupId>
+				<artifactId>commons-dbutils</artifactId>
+				<version>1.3</version>
+			</dependency>
+
+			<dependency>
+				<groupId>commons-lang</groupId>
+				<artifactId>commons-lang</artifactId>
+				<version>2.5</version>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jmock</groupId>
+				<artifactId>jmock</artifactId>
+				<version>2.5.1</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.jmock</groupId>
+				<artifactId>jmock-junit4</artifactId>
+				<version>2.5.1</version>
+				<scope>test</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.derby</groupId>
+				<artifactId>derbyclient</artifactId>
+				<version>${derby.version}</version>
+				<scope>runtime</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>org.apache.derby</groupId>
+				<artifactId>derby</artifactId>
+				<version>${derby.version}</version>
+				<scope>runtime</scope>
+			</dependency>
+
+			<dependency>
+				<groupId>net.sf.opencsv</groupId>
+				<artifactId>opencsv</artifactId>
+				<version>2.1</version>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+
+
+
+	<build>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-compiler-plugin</artifactId>
+					<configuration>
+						<encoding>iso-8859-1</encoding>
+						<source>${java.version}</source>
+						<target>${java.version}</target>
+					</configuration>
+				</plugin>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-surefire-plugin</artifactId>
+					<configuration>
+						<junitArtifactName>junit:junit-dep
+						</junitArtifactName>
+					</configuration>
+				</plugin>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-eclipse-plugin</artifactId>
+					<version>2.5</version>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+</project>

Added: trunk/step-checks.xml
===================================================================
--- trunk/step-checks.xml	                        (rev 0)
+++ trunk/step-checks.xml	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!--
+    This configuration file was written by the eclipse-cs plugin configuration editor
+-->
+<!--
+    Checkstyle-Configuration: step-checks
+    Description: none
+-->
+<module name="Checker">
+  <property name="severity" value="warning"/>
+  <module name="TreeWalker">
+    <property name="tabWidth" value="4"/>
+    <module name="FileContentsHolder"/>
+    <module name="JavadocMethod">
+      <property name="logLoadErrors" value="true"/>
+      <property name="suppressLoadErrors" value="true"/>
+    </module>
+    <module name="JavadocType"/>
+    <module name="JavadocVariable"/>
+    <module name="JavadocStyle">
+      <property name="checkFirstSentence" value="false"/>
+    </module>
+    <module name="ConstantName"/>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName"/>
+    <module name="MethodName"/>
+    <module name="PackageName"/>
+    <module name="ParameterName"/>
+    <module name="StaticVariableName"/>
+    <module name="TypeName"/>
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="FileLength"/>
+    <module name="MethodLength"/>
+    <module name="ParameterNumber"/>
+    <module name="EmptyForIteratorPad"/>
+    <module name="MethodParamPad"/>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+    </module>
+    <module name="NoWhitespaceBefore"/>
+    <module name="OperatorWrap"/>
+    <module name="ParenPad">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="TypecastParenPad"/>
+    <module name="TabCharacter">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="WhitespaceAfter"/>
+    <module name="WhitespaceAround"/>
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier"/>
+    <module name="AvoidNestedBlocks"/>
+    <module name="EmptyBlock"/>
+    <module name="LeftCurly"/>
+    <module name="NeedBraces"/>
+    <module name="RightCurly"/>
+    <module name="AvoidInlineConditionals">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="DoubleCheckedLocking"/>
+    <module name="EmptyStatement"/>
+    <module name="EqualsHashCode"/>
+    <module name="HiddenField">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="IllegalInstantiation"/>
+    <module name="InnerAssignment"/>
+    <module name="MagicNumber"/>
+    <module name="MissingSwitchDefault"/>
+    <module name="RedundantThrows">
+      <property name="logLoadErrors" value="true"/>
+      <property name="suppressLoadErrors" value="true"/>
+    </module>
+    <module name="SimplifyBooleanExpression"/>
+    <module name="SimplifyBooleanReturn"/>
+    <module name="DesignForExtension">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="FinalClass"/>
+    <module name="HideUtilityClassConstructor"/>
+    <module name="InterfaceIsType"/>
+    <module name="VisibilityModifier"/>
+    <module name="ArrayTypeStyle"/>
+    <module name="FinalParameters"/>
+    <module name="GenericIllegalRegexp">
+      <property name="severity" value="ignore"/>
+      <property name="format" value="\s+$"/>
+      <property name="message" value="Line has trailing spaces."/>
+    </module>
+    <module name="TodoComment">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="UpperEll"/>
+    <module name="CyclomaticComplexity">
+      <metadata name="net.sf.eclipsecs.core.comment" value="Cyclomatic Complexity"/>
+    </module>
+  </module>
+  <module name="JavadocPackage">
+    <property name="severity" value="ignore"/>
+  </module>
+  <module name="NewlineAtEndOfFile"/>
+  <module name="Translation"/>
+  <module name="SuppressionCommentFilter">
+    <metadata name="net.sf.eclipsecs.core.comment" value="ignore checkstyle"/>
+  </module>
+</module>

Modified: trunk/step-server/.classpath
===================================================================
--- trunk/step-server/.classpath	2010-03-28 15:56:28 UTC (rev 105)
+++ trunk/step-server/.classpath	2010-04-14 20:22:59 UTC (rev 106)
@@ -1,10 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="lib" path="lib/jetty-6.1.19.jar"/>
-	<classpathentry kind="lib" path="lib/jetty-util-6.1.19.jar"/>
-	<classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/StepShared"/>
-	<classpathentry kind="output" path="bin"/>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: trunk/step-server/.project
===================================================================
--- trunk/step-server/.project	2010-03-28 15:56:28 UTC (rev 105)
+++ trunk/step-server/.project	2010-04-14 20:22:59 UTC (rev 106)
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>StepServer</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
+  <name>step-dataloader</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: trunk/step-server/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/step-server/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/step-server/.settings/org.eclipse.jdt.core.prefs	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,6 @@
+#Mon Apr 05 13:29:00 BST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5

Added: trunk/step-server/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- trunk/step-server/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ trunk/step-server/.settings/org.maven.ide.eclipse.prefs	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,9 @@
+#Mon Apr 05 13:28:59 BST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: trunk/step-server/pom.xml
===================================================================
--- trunk/step-server/pom.xml	                        (rev 0)
+++ trunk/step-server/pom.xml	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<groupId>com.tyndalehouse</groupId>
+		<artifactId>step-parent</artifactId>
+		<version>1.0-SNAPSHOT</version>
+		<relativePath>..</relativePath>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.tyndalehouse</groupId>
+	<artifactId>step-server</artifactId>
+	<packaging>jar</packaging>
+	<name>step-server</name>
+
+	
+	<dependencies>
+		<dependency>
+			<groupId>org.mortbay.jetty</groupId>
+			<artifactId>jetty</artifactId>
+			<version>6.1.22</version>
+		</dependency>
+	</dependencies>
+</project>

Modified: trunk/step-server/src/main/java/com/tyndalehouse/step/server/StepServer.java
===================================================================
--- trunk/step-server/src/com/tyndalehouse/step/server/StepServer.java	2010-03-28 15:56:28 UTC (rev 105)
+++ trunk/step-server/src/main/java/com/tyndalehouse/step/server/StepServer.java	2010-04-14 20:22:59 UTC (rev 106)
@@ -24,7 +24,7 @@
 	// creates and configures the Jetty server
 	private Server start() throws Exception {
 		Server jetty = new Server();
-		String[] configFiles = { "etc/jetty.xml" };
+		String[] configFiles = { "jetty.xml" };
 				
 		for (String configFile : configFiles) {
 			

Added: trunk/step-server/src/main/resources/jetty.xml
===================================================================
--- trunk/step-server/src/main/resources/jetty.xml	                        (rev 0)
+++ trunk/step-server/src/main/resources/jetty.xml	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,204 @@
+<?xml version="1.0"?>
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<!-- =============================================================== -->
+<!-- Configure the Jetty Server                                      -->
+<!--                                                                 -->
+<!-- Documentation of this file format can be found at:              -->
+<!-- http://docs.codehaus.org/display/JETTY/jetty.xml                -->
+<!--                                                                 -->
+<!-- =============================================================== -->
+
+
+<Configure id="Server" class="org.mortbay.jetty.Server">
+
+    <!-- =========================================================== -->
+    <!-- Server Thread Pool                                          -->
+    <!-- =========================================================== -->
+    <Set name="ThreadPool">
+      <!-- Default bounded blocking threadpool 
+      -->
+      <New class="org.mortbay.thread.BoundedThreadPool">
+        <Set name="minThreads">10</Set>
+        <Set name="maxThreads">250</Set>
+      </New>
+
+      <!-- Optional Java 5 bounded threadpool with job queue 
+      <New class="org.mortbay.thread.concurrent.ThreadPool">
+        <Set name="corePoolSize">250</Set>
+        <Set name="maximumPoolSize">250</Set>
+      </New>
+      -->
+    </Set>
+
+
+
+    <!-- =========================================================== -->
+    <!-- Set connectors                                              -->
+    <!-- =========================================================== -->
+    <!-- One of each type!                                           -->
+    <!-- =========================================================== -->
+
+    <!-- Use this connector for many frequently idle connections
+         and for threadless continuations.
+    -->    
+    <Call name="addConnector">
+      <Arg>
+          <New class="org.mortbay.jetty.nio.SelectChannelConnector">
+            <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set>
+            <Set name="maxIdleTime">30000</Set>
+            <Set name="Acceptors">1</Set>
+            <Set name="statsOn">false</Set>
+            <Set name="confidentialPort">8443</Set>
+	    <Set name="lowResourcesConnections">1000</Set>
+	    <Set name="lowResourcesMaxIdleTime">500</Set>
+          </New>
+      </Arg>
+    </Call>
+
+    <!-- Use this connector if NIO is not available.
+    <Call name="addConnector">
+      <Arg>
+          <New class="org.mortbay.jetty.bio.SocketConnector">
+            <Set name="port">8081</Set>
+            <Set name="maxIdleTime">50000</Set>
+            <Set name="lowResourceMaxIdleTime">1500</Set>
+          </New>
+      </Arg>
+    </Call>
+    -->
+
+    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+    <!-- To add a HTTPS SSL listener                                     -->
+    <!-- see jetty-ssl.xml to add an ssl connector. use                  -->
+    <!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml             -->
+    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+    
+    <!-- =========================================================== -->
+    <!-- Set up global session ID manager                            -->
+    <!-- =========================================================== -->
+    <!--
+    <Set name="sessionIdManager">
+      <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
+        <Set name="workerName">node1</Set>
+      </New>
+    </Set>
+    -->
+
+    <!-- =========================================================== -->
+    <!-- Set handler Collection Structure                            --> 
+    <!-- =========================================================== -->
+    <Set name="handler">
+      <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
+        <Set name="handlers">
+         <Array type="org.mortbay.jetty.Handler">
+           <Item>
+             <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
+           </Item>
+           <Item>
+             <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
+           </Item>
+           <Item>
+             <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
+           </Item>
+         </Array>
+        </Set>
+      </New>
+    </Set>
+    
+    <!-- =========================================================== -->
+    <!-- Configure the context deployer                              -->
+    <!-- A context deployer will deploy contexts described in        -->
+    <!-- configuration files discovered in a directory.              -->
+    <!-- The configuration directory can be scanned for hot          -->
+    <!-- deployments at the configured scanInterval.                 -->
+    <!--                                                             -->
+    <!-- This deployer is configured to deploy contexts configured   -->
+    <!-- in the $JETTY_HOME/contexts directory                       -->
+    <!--                                                             -->
+    <!-- =========================================================== -->
+    <Call name="addLifeCycle">
+      <Arg>
+        <New class="org.mortbay.jetty.deployer.ContextDeployer">
+          <Set name="contexts"><Ref id="Contexts"/></Set>
+          <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
+          <Set name="scanInterval">1</Set>
+        </New>
+      </Arg>
+    </Call>
+
+    <!-- =========================================================== -->
+    <!-- Configure the webapp deployer.                              -->
+    <!-- A webapp  deployer will deploy standard webapps discovered  -->
+    <!-- in a directory at startup, without the need for additional  -->
+    <!-- configuration files.    It does not support hot deploy or   -->
+    <!-- non standard contexts (see ContextDeployer above).          -->
+    <!--                                                             -->
+    <!-- This deployer is configured to deploy webapps from the      -->
+    <!-- $JETTY_HOME/webapps directory                               -->
+    <!--                                                             -->
+    <!-- Normally only one type of deployer need be used.            -->
+    <!--                                                             -->
+    <!-- =========================================================== -->
+    <Call name="addLifeCycle">
+      <Arg>
+        <New class="org.mortbay.jetty.deployer.WebAppDeployer">
+          <Set name="contexts"><Ref id="Contexts"/></Set>
+          <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set>
+	  <Set name="parentLoaderPriority">false</Set>
+	  <Set name="extract">true</Set>
+	  <Set name="allowDuplicates">false</Set>
+          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
+        </New>
+      </Arg>
+    </Call>
+
+    <!-- =========================================================== -->
+    <!-- Configure Authentication Realms                             -->
+    <!-- Realms may be configured for the entire server here, or     -->
+    <!-- they can be configured for a specific web app in a context  -->
+    <!-- configuration (see $(jetty.home)/contexts/test.xml for an   -->
+    <!-- example).                                                   -->
+    <!-- =========================================================== -->
+    <Set name="UserRealms">
+      <Array type="org.mortbay.jetty.security.UserRealm">
+        <!--
+        <Item>
+          <New class="org.mortbay.jetty.security.HashUserRealm">
+            <Set name="name">Test Realm</Set>
+            <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
+          </New>
+        </Item>
+	-->
+      </Array>
+    </Set>
+
+    <!-- =========================================================== -->
+    <!-- Configure Request Log                                       -->
+    <!-- Request logs  may be configured for the entire server here, -->
+    <!-- or they can be configured for a specific web app in a       -->
+    <!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
+    <!-- for an example).                                            -->
+    <!-- =========================================================== -->
+    <Ref id="RequestLog">
+      <Set name="requestLog">
+        <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
+          <Arg><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Arg>
+          <Set name="retainDays">90</Set>
+          <Set name="append">true</Set>
+          <Set name="extended">false</Set>
+          <Set name="LogTimeZone">GMT</Set>
+        </New>
+      </Set>
+    </Ref>
+
+    <!-- =========================================================== -->
+    <!-- extra options                                               -->
+    <!-- =========================================================== -->
+    <Set name="stopAtShutdown">true</Set>
+    <!-- ensure/prevent Server: header being sent to browsers        -->
+    <Set name="sendServerVersion">true</Set>
+
+
+
+</Configure>

Added: trunk/step-tools/.classpath
===================================================================
--- trunk/step-tools/.classpath	                        (rev 0)
+++ trunk/step-tools/.classpath	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: trunk/step-tools/.project
===================================================================
--- trunk/step-tools/.project	                        (rev 0)
+++ trunk/step-tools/.project	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>step-tools</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: trunk/step-tools/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/step-tools/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/step-tools/.settings/org.eclipse.jdt.core.prefs	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,6 @@
+#Mon Apr 05 13:57:25 BST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5

Added: trunk/step-tools/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- trunk/step-tools/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ trunk/step-tools/.settings/org.maven.ide.eclipse.prefs	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,9 @@
+#Mon Apr 05 13:57:25 BST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: trunk/step-tools/pom.xml
===================================================================
--- trunk/step-tools/pom.xml	                        (rev 0)
+++ trunk/step-tools/pom.xml	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,31 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<groupId>com.tyndalehouse</groupId>
+		<artifactId>step-parent</artifactId>
+		<version>1.0-SNAPSHOT</version>
+		<relativePath>..</relativePath>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.tyndalehouse</groupId>
+	<artifactId>step-tools</artifactId>
+	<packaging>jar</packaging>
+	<name>step-tools</name>
+
+	<dependencies>
+				<dependency>
+			<groupId>org.crosswire</groupId>
+			<artifactId>jsword</artifactId>
+		</dependency>
+				<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+		</dependency>
+		
+		<dependency>
+			<groupId>commons-lang</groupId>
+			<artifactId>commons-lang</artifactId>
+		</dependency>
+	</dependencies>
+</project>

Added: trunk/step-tools/src/main/java/BibleFileGenerator.java
===================================================================
--- trunk/step-tools/src/main/java/BibleFileGenerator.java	                        (rev 0)
+++ trunk/step-tools/src/main/java/BibleFileGenerator.java	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,253 @@
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.crosswire.common.util.Language;
+import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookCategory;
+import org.crosswire.jsword.book.BookData;
+import org.crosswire.jsword.book.BookException;
+import org.crosswire.jsword.book.Books;
+import org.crosswire.jsword.book.OSISUtil;
+import org.crosswire.jsword.book.install.InstallException;
+import org.crosswire.jsword.book.install.sword.HttpSwordInstaller;
+import org.crosswire.jsword.passage.Key;
+import org.crosswire.jsword.passage.PassageKeyFactory;
+
+public class BibleFileGenerator extends Thread {
+	private final static String proxyHostProperty = "step.proxy.host";
+	private final static String proxyPortProperty = "step.proxy.port";
+	private String initials;
+
+
+	public BibleFileGenerator() {
+		this.initials = "";
+	}
+
+	
+	public BibleFileGenerator(String initials) {
+		this.initials = initials;
+	}
+
+	private String writeBible(String version) throws Exception {
+
+		StringBuffer sb = new StringBuffer(String.format("@%s%s", version, System.getProperty("line.separator")));
+		// check information has been passed in
+		if (StringUtils.isEmpty(version)) {
+			throw new Exception("Version was not provided");
+		}
+
+		Book currentBook = Books.installed().getBook(version);
+
+		Key global = currentBook.getGlobalKeyList();
+		int numVersesInVersion = global.getCardinality();
+
+		String formatBook = "";
+		String formatChapter = "";
+		String formatVerse = "";
+		
+		String previousBook = "none";
+		String previousChapter = "none";
+		String previousVerse = "none" ;
+		
+		String key = null;
+		boolean newBook = true;
+		for (int ii = 0; ii < numVersesInVersion; ii++) {
+			try {
+				key = global.get(ii).getOsisID();
+				
+				//assume just one verse?
+				String[] split = key.split("\\.");
+				formatBook = split[0];
+				formatChapter = split[1];
+				formatVerse = split[2];
+				
+				if(!formatBook.equals(previousBook)) {
+					previousBook = formatBook;
+					
+					sb.append('@');
+					sb.append(formatBook);
+					sb.append(System.getProperty("line.separator"));
+					
+					//if new book, also reset chapter
+					previousChapter = formatChapter;
+					sb.append("@Chapter ");
+					sb.append(formatChapter);
+					sb.append(System.getProperty("line.separator"));
+				} else if(!formatChapter.equals(previousChapter)) {
+					previousChapter = formatChapter;
+					sb.append("@Chapter ");
+					sb.append(formatChapter);
+					sb.append(System.getProperty("line.separator"));				
+				}
+				
+				BookData data = new BookData(currentBook, global.get(ii));
+				
+				sb.append(formatVerse);
+				sb.append(". ");
+				sb.append(OSISUtil.getCanonicalText(data.getOsis()).replace('\n', ' ').replace('\r', '\n'));
+				sb.append(System.getProperty("line.separator"));
+								
+				//ScriptureReference sr = new ScriptureReference(key);
+				
+//				if (!sr.getBook().equals(formatBook)) {
+//					sb.append(String.format("@%s%s", sr.getBook().toUpperCase(), System.getProperty("line.separator")));
+//					formatBook = sr.getBook();
+//					newBook = true;
+//				}
+//
+//				if (sr.getChapter() != null && !sr.getChapter().equals(formatChapter)) {
+//					sb.append(String.format("@Chapter %s%s", sr.getChapter(), System.getProperty("line.separator")));
+//					newBook = false;
+//					formatChapter = sr.getChapter();
+//				} else if(newBook) {
+//					sb.append(String.format("@Chapter 1%s", System.getProperty("line.separator")));
+//					newBook = false;
+//				}
+
+			} catch (BookException e) {
+				System.out
+						.println(initials + ":: A book exception has occurred whilte looking up the passage: " + key);
+				e.printStackTrace();
+				throw new Exception(e);
+			} catch (Exception ex) {
+				System.err.println(initials + ":: Could not parse key: " + key);
+				ex.printStackTrace();
+			} finally {
+				;
+			}
+		}
+		return sb.toString();
+
+	}
+
+	//TODO: here and elsewhere, ensure that the downloaders 
+	//are not hardcoded - there are at least two more sites to get 
+	//bible versions from.
+	private static HttpSwordInstaller getNewCustomInstaller() {
+		System.out.println("Creating new installer for JSword");
+		HttpSwordInstaller resourceInstaller = new HttpSwordInstaller();
+
+		System.out.println("Currently hardcoded installer host to:"
+				+ "www.crosswire.org");
+		System.out.println("Currently hardcoded property names for step");
+		String host = "www.crosswire.org";
+		String proxyHost = System.getProperty(proxyHostProperty);
+		String proxyPort = System.getProperty(proxyPortProperty);
+		System.out.println(String.format("Setting to (%1$s via %2$s:%3$s)",
+				"www.crosswire.org", proxyHost, proxyPort));
+
+		resourceInstaller.setHost(host);
+		if (proxyHost != null) {
+			resourceInstaller.setProxyHost(proxyHost);
+		}
+		if (proxyPort != null) {
+			resourceInstaller.setProxyPort(Integer.parseInt(proxyPort));
+		}
+
+		System.out.println("Setting package and catalog directories");
+		resourceInstaller
+				.setPackageDirectory("/ftpmirror/pub/sword/packages/rawzip");
+		resourceInstaller.setCatalogDirectory("/ftpmirror/pub/sword/raw");
+		return resourceInstaller;
+	}
+	
+	private void downloadAllBibles() throws InstallException {
+		HttpSwordInstaller installer = getNewCustomInstaller();
+
+		//TODO: ensure the comment in the comment of the function is in a warning
+		//somewhere...
+		installer.reloadBookList();
+		
+		List availableBooks = installer.getBooks();
+		
+		for(int ii = 0; ii < availableBooks.size(); ii++) {
+			Book b = (Book) availableBooks.get(ii);
+			Language en = new Language("en");
+			
+			//check book is a biblical text...
+			if(b.getBookCategory() == BookCategory.BIBLE &&
+					b.getBookMetaData().getLanguage().equals(en)
+					) {
+				String versionKey = b.getInitials();
+				
+				System.out.println("Downloading " + ((Book) availableBooks.get(ii)).getName() + "...");
+				if(Books.installed().getBook(versionKey) == null) {
+					installer.install(installer.getBook(versionKey));
+				}
+			}
+		}		
+	}
+
+	
+	@Override
+	public void run() {
+		try {
+			System.out.println("Starting thread for " + initials);
+			FileUtils.writeStringToFile(new File("output/" + initials + ".txt"), writeBible(initials));
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+	}
+
+	
+	
+	//TODO: could profile the application to figure out if we can speed things
+	//up with memory settings etc, more/less threads...
+	//could also investigate rewriting it so that disk IO happens
+	//during processing to allow other threads to execute.
+	//would be interesting to profile to find out where bottlenecks are.
+	public static void main(String args[]) throws Exception {
+		BibleFileGenerator bfg = new BibleFileGenerator();
+		int numThreads = 2;
+			
+		
+		
+		BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
+		ThreadPoolExecutor tpe = new ThreadPoolExecutor(numThreads, numThreads,1, TimeUnit.MINUTES, queue);
+		
+		//add processor thing, to kick off all the downloads, and then
+		//TODO:
+		//wait for the downloads to complete for each version, before it continues on to the 
+		//bible processing...
+		//bfg.downloadAllBibles();
+		List<Book> books = Books.installed().getBooks();
+		
+		//of the installed books
+		for(Book b : books) {
+			System.out.println(String.format("%s %s", b.getInitials(), b.getName()));
+		}
+		
+		System.out.println("of available:\n\n");
+
+		
+		
+		List<Book> availableBooks = getNewCustomInstaller().getBooks();
+		for(Book b : availableBooks) {
+			System.out.println(String.format("%s %s", b.getInitials(), b.getName()));
+		}
+
+		new BibleFileGenerator("ESV").start();
+		
+//		for(int ii = 0; ii < books.size(); ii++) {
+//			if(books.get(ii).getBookCategory().equals(BookCategory.BIBLE)) {
+//				
+//				String initials = books.get(ii).getInitials();
+//				Thread r = new BibleFileGenerator(initials);
+//				tpe.execute(r);
+//				System.out.println("Size of runnable queue: " + queue.size());
+//			}
+//		}
+	}
+}

Added: trunk/step-tools/src/main/java/BibleStatsAnalyser.java
===================================================================
--- trunk/step-tools/src/main/java/BibleStatsAnalyser.java	                        (rev 0)
+++ trunk/step-tools/src/main/java/BibleStatsAnalyser.java	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,34 @@
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Hashtable;
+
+import org.apache.commons.io.FileUtils;
+
+
+public class BibleStatsAnalyser {
+	public BibleStatsAnalyser() {
+		// TODO Auto-generated constructor stub
+	}
+	
+	
+	public static void main(String args[]) throws IOException {
+		String esv = FileUtils.readFileToString(new File("output/ESV.txt"));
+		String[] allWords = esv.split("[ ,\\.!;\\']");
+		Hashtable<String, Integer> count = new Hashtable<String, Integer>();
+		
+		for(String s : allWords) {
+			if(count.containsKey(s)) {
+				Integer i = count.get(s);
+				i++;
+				count.put(s, i);
+			} else {
+				count.put(s, 1);
+			}
+		}
+		
+		for(String s : allWords) {
+			System.out.println(String.format("%s,%d", s, count.get(s).intValue()));
+		}
+	}
+}

Added: trunk/step-tools/src/main/java/ScriptureReference.java
===================================================================
--- trunk/step-tools/src/main/java/ScriptureReference.java	                        (rev 0)
+++ trunk/step-tools/src/main/java/ScriptureReference.java	2010-04-14 20:22:59 UTC (rev 106)
@@ -0,0 +1,60 @@
+public class ScriptureReference {
+	private String book = null;
+	private String chapter = null;
+	private String verse = null;
+
+	/**
+	 * Given a key looking like 1 Samuel 2:13 or Philemon 1 it stores it
+	 * internally as book,chapter,verse
+	 * 
+	 * @param key
+	 */
+	public ScriptureReference(String key) {
+		int lastColon = key.lastIndexOf(":");
+		int lastSpace = key.lastIndexOf(' ');
+
+		// there are two types of formats:
+		// 1 Samuel 2:13 and Philemon 1 where 1 in this case is the verse
+
+		try {
+			// ie, reference not like Philemon 1
+			if (lastColon != -1) {
+				verse = key.substring(lastColon + 1);
+				chapter = key.substring(lastSpace + 1, lastColon);
+			} else {
+				verse = key.substring(lastSpace + 1);
+				chapter = null;
+			}
+
+			book = key.substring(0, lastSpace);
+		} catch (Exception ex) {
+			System.err.println("Key: " + key);
+			System.err.println("lastColon: " + lastColon);
+			System.err.println("lastSpace: " + lastSpace);
+			System.err.println("verse: " + verse);
+			System.err.println("chapter: " + chapter);
+			
+		}
+	}
+
+	/**
+	 * @return the book
+	 */
+	public String getBook() {
+		return book;
+	}
+
+	/**
+	 * @return the chapter
+	 */
+	public String getChapter() {
+		return chapter;
+	}
+
+	/**
+	 * @return the verse
+	 */
+	public String getVerse() {
+		return verse;
+	}
+}




More information about the Tynstep-svn mailing list