[Tynstep-svn] r102 - in trunk/step-web-app: . .settings eclipse src/main/java/com/tyndalehouse/step/web/client src/main/java/com/tyndalehouse/step/web/client/common src/main/java/com/tyndalehouse/step/web/client/event src/main/java/com/tyndalehouse/step/web/client/gin src/main/java/com/tyndalehouse/step/web/client/presenter src/main/java/com/tyndalehouse/step/web/client/service/eventbus src/main/java/com/tyndalehouse/step/web/client/service/refdata src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline src/main/java/com/tyndalehouse/step/web/server/common src/main/java/com/tyndalehouse/step/web/server/db/framework src/main/java/com/tyndalehouse/step/web/server/db/timeline src/main/java/com/tyndalehouse/step/web/server/guice src/main/java/com/tyndalehouse/step/web/server/handler src/main/java/com/tyndalehouse/step/web/server/handler/util src/main/java/com/tyndalehouse/step/web/server/jsword src/main/java/com/tyndalehouse/step/web/shared src/main/java/com/tyndalehouse/step/web/shared/command src/main/java/com/tyndalehouse/step/web/shared/common src/main/java/com/tyndalehouse/step/web/shared/result src/main/resources src/test/java/com/tyndalehouse/step/web/server/db src/test/java/com/tyndalehouse/step/web/server/db/helper src/test/java/com/tyndalehouse/step/web/server/handlers
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Tue Mar 16 11:49:07 MST 2010
Author: ChrisBurrell
Date: 2010-03-16 11:49:07 -0700 (Tue, 16 Mar 2010)
New Revision: 102
Added:
trunk/step-web-app/.fbprefs
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBusImpl.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/BibleTextLookupType.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBus.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/StepHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java
Modified:
trunk/step-web-app/.project
trunk/step-web-app/.settings/org.eclipse.jdt.core.prefs
trunk/step-web-app/eclipse/step-checks.xml
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
trunk/step-web-app/src/main/resources/log4j.properties
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java
Log:
removing warnings and documenting the client side code
Added: trunk/step-web-app/.fbprefs
===================================================================
--- trunk/step-web-app/.fbprefs (rev 0)
+++ trunk/step-web-app/.fbprefs 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,127 @@
+#FindBugs User Preferences
+#Sat Mar 13 11:38:06 GMT 2010
+detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
+detectorBadAppletConstructor=BadAppletConstructor|false
+detectorBadResultSetAccess=BadResultSetAccess|true
+detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
+detectorBadUseOfReturnValue=BadUseOfReturnValue|true
+detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
+detectorBooleanReturnNull=BooleanReturnNull|true
+detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false
+detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
+detectorCheckTypeQualifiers=CheckTypeQualifiers|true
+detectorCloneIdiom=CloneIdiom|true
+detectorComparatorIdiom=ComparatorIdiom|true
+detectorConfusedInheritance=ConfusedInheritance|true
+detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
+detectorCrossSiteScripting=CrossSiteScripting|true
+detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
+detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
+detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
+detectorDontUseEnum=DontUseEnum|true
+detectorDroppedException=DroppedException|true
+detectorDumbMethodInvocations=DumbMethodInvocations|true
+detectorDumbMethods=DumbMethods|true
+detectorDuplicateBranches=DuplicateBranches|true
+detectorEmptyZipFileEntry=EmptyZipFileEntry|true
+detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
+detectorFinalizerNullsFields=FinalizerNullsFields|true
+detectorFindBadCast2=FindBadCast2|true
+detectorFindBadForLoop=FindBadForLoop|true
+detectorFindCircularDependencies=FindCircularDependencies|false
+detectorFindDeadLocalStores=FindDeadLocalStores|true
+detectorFindDoubleCheck=FindDoubleCheck|true
+detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
+detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
+detectorFindFinalizeInvocations=FindFinalizeInvocations|true
+detectorFindFloatEquality=FindFloatEquality|true
+detectorFindHEmismatch=FindHEmismatch|true
+detectorFindInconsistentSync2=FindInconsistentSync2|true
+detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
+detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
+detectorFindMaskedFields=FindMaskedFields|true
+detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
+detectorFindNakedNotify=FindNakedNotify|true
+detectorFindNonSerializableStoreIntoSession=FindNonSerializableStoreIntoSession|true
+detectorFindNonSerializableValuePassedToWriteObject=FindNonSerializableValuePassedToWriteObject|true
+detectorFindNonShortCircuit=FindNonShortCircuit|true
+detectorFindNullDeref=FindNullDeref|true
+detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
+detectorFindOpenStream=FindOpenStream|true
+detectorFindPuzzlers=FindPuzzlers|true
+detectorFindRefComparison=FindRefComparison|true
+detectorFindReturnRef=FindReturnRef|true
+detectorFindRunInvocations=FindRunInvocations|true
+detectorFindSelfComparison=FindSelfComparison|true
+detectorFindSelfComparison2=FindSelfComparison2|true
+detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
+detectorFindSpinLoop=FindSpinLoop|true
+detectorFindSqlInjection=FindSqlInjection|true
+detectorFindTwoLockWait=FindTwoLockWait|true
+detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
+detectorFindUnconditionalWait=FindUnconditionalWait|true
+detectorFindUninitializedGet=FindUninitializedGet|true
+detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
+detectorFindUnreleasedLock=FindUnreleasedLock|true
+detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
+detectorFindUnsyncGet=FindUnsyncGet|true
+detectorFindUselessControlFlow=FindUselessControlFlow|true
+detectorFormatStringChecker=FormatStringChecker|true
+detectorHugeSharedStringConstants=HugeSharedStringConstants|true
+detectorIDivResultCastToDouble=IDivResultCastToDouble|true
+detectorIncompatMask=IncompatMask|true
+detectorInconsistentAnnotations=InconsistentAnnotations|true
+detectorInefficientMemberAccess=InefficientMemberAccess|false
+detectorInefficientToArray=InefficientToArray|true
+detectorInfiniteLoop=InfiniteLoop|true
+detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
+detectorInfiniteRecursiveLoop2=InfiniteRecursiveLoop2|false
+detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
+detectorInitializationChain=InitializationChain|true
+detectorInstantiateStaticClass=InstantiateStaticClass|true
+detectorInvalidJUnitTest=InvalidJUnitTest|true
+detectorIteratorIdioms=IteratorIdioms|true
+detectorLazyInit=LazyInit|true
+detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
+detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
+detectorMethodReturnCheck=MethodReturnCheck|true
+detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
+detectorMutableLock=MutableLock|true
+detectorMutableStaticFields=MutableStaticFields|true
+detectorNaming=Naming|true
+detectorNumberConstructor=NumberConstructor|true
+detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
+detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
+detectorPublicSemaphores=PublicSemaphores|false
+detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
+detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
+detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
+detectorRedundantInterfaces=RedundantInterfaces|true
+detectorRepeatedConditionals=RepeatedConditionals|true
+detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
+detectorSerializableIdiom=SerializableIdiom|true
+detectorStartInConstructor=StartInConstructor|true
+detectorStaticCalendarDetector=StaticCalendarDetector|true
+detectorStringConcatenation=StringConcatenation|true
+detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
+detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
+detectorSwitchFallthrough=SwitchFallthrough|true
+detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
+detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
+detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
+detectorURLProblems=URLProblems|true
+detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
+detectorUnnecessaryMath=UnnecessaryMath|true
+detectorUnreadFields=UnreadFields|true
+detectorUseObjectEquals=UseObjectEquals|false
+detectorUselessSubclassMethod=UselessSubclassMethod|false
+detectorVarArgsProblems=VarArgsProblems|true
+detectorVolatileUsage=VolatileUsage|true
+detectorWaitInLoop=WaitInLoop|true
+detectorWrongMapIterator=WrongMapIterator|true
+detectorXMLFactoryBypass=XMLFactoryBypass|true
+detector_threshold=2
+effort=default
+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false
+filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL|
+run_at_full_build=false
Modified: trunk/step-web-app/.project
===================================================================
--- trunk/step-web-app/.project 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/.project 2010-03-16 18:49:07 UTC (rev 102)
@@ -25,6 +25,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
@@ -33,5 +38,6 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.apache.derby.ui.derbyEngine</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
</natures>
</projectDescription>
Modified: trunk/step-web-app/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/step-web-app/.settings/org.eclipse.jdt.core.prefs 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/.settings/org.eclipse.jdt.core.prefs 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,4 +1,4 @@
-#Sat Mar 06 16:17:38 GMT 2010
+#Sat Mar 13 11:36:18 GMT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
@@ -57,8 +57,8 @@
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.continuation_indentation=1
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
@@ -246,7 +246,7 @@
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=110
+org.eclipse.jdt.core.formatter.lineSplit=100
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
Modified: trunk/step-web-app/eclipse/step-checks.xml
===================================================================
--- trunk/step-web-app/eclipse/step-checks.xml 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/eclipse/step-checks.xml 2010-03-16 18:49:07 UTC (rev 102)
@@ -37,9 +37,10 @@
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="FileLength"/>
- <module name="LineLength">
+<!-- <module name="LineLength">
<property name="max" value="120"/>
</module>
+-->
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,92 +0,0 @@
-package com.tyndalehouse.step.web.client;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.customware.gwt.dispatch.client.DispatchAsync;
-import net.customware.gwt.dispatch.shared.Action;
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.inject.Inject;
-
-//TODO: investigate the user of this client side cache
-/**
- * Dispatcher which support caching of data in memory
- *
- */
-public class CachingDispatchAsync implements DispatchAsync {
- /**
- *
- */
- private final Map<Action<Result>, Result> cache = new HashMap<Action<Result>, Result>();
-
- /**
- * The default dispatcher
- */
- private final DispatchAsync dispatcher;
-
- /**
- * The default constructor
- *
- * @param dispatcher uses the default dispatcher
- */
- @Inject
- public CachingDispatchAsync(final DispatchAsync dispatcher) {
- this.dispatcher = dispatcher;
- }
-
- /**
- * Clear the cache
- */
- public void clear() {
- cache.clear();
- }
-
- /**
- * This method is a simple wrapper around the DispatchAsync class at the
- * moment
- *
- * @param <A> Action implementation
- * @param <R> Result implementation
- * @param action the action
- * @param callback the callback
- * @see net.customware.gwt.dispatch.client.DispatchAsync#execute(A,
- * com.google.gwt.user.client.rpc.AsyncCallback)
- */
- public <A extends Action<R>, R extends Result> void execute(final A action,
- final AsyncCallback<R> callback) {
- dispatcher.execute(action, callback);
- }
-
- /**
- * Execute the given Action. If the Action was executed before it will get
- * fetched from the cache
- *
- * @param <A> Action implementation
- * @param <R> Result implementation
- * @param action the action
- * @param callback the callback
- */
- @SuppressWarnings("unchecked")
- public <A extends Action<R>, R extends Result> void executeWithCache(final A action,
- final AsyncCallback<R> callback) {
- final Result r = cache.get(action);
-
- if (r != null) {
- callback.onSuccess((R) r);
- } else {
- dispatcher.execute(action, new AsyncCallback<R>() {
-
- public void onFailure(final Throwable caught) {
- callback.onFailure(caught);
- }
-
- public void onSuccess(final R result) {
- cache.put((Action) action, (Result) result);
- callback.onSuccess(result);
- }
- });
- }
- }
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java (from rev 100, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,92 @@
+package com.tyndalehouse.step.web.client.common;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import net.customware.gwt.dispatch.client.DispatchAsync;
+import net.customware.gwt.dispatch.shared.Action;
+import net.customware.gwt.dispatch.shared.Result;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+
+//TODO: investigate the user of this client side cache
+/**
+ * Dispatcher which support caching of data in memory
+ *
+ */
+public class CachingDispatchAsync implements DispatchAsync {
+ /**
+ *
+ */
+ private final Map<Action<Result>, Result> cache = new HashMap<Action<Result>, Result>();
+
+ /**
+ * The default dispatcher
+ */
+ private final DispatchAsync dispatcher;
+
+ /**
+ * The default constructor
+ *
+ * @param dispatcher uses the default dispatcher
+ */
+ @Inject
+ public CachingDispatchAsync(final DispatchAsync dispatcher) {
+ this.dispatcher = dispatcher;
+ }
+
+ /**
+ * Clear the cache
+ */
+ public void clear() {
+ cache.clear();
+ }
+
+ /**
+ * This method is a simple wrapper around the DispatchAsync class at the
+ * moment
+ *
+ * @param <A> Action implementation
+ * @param <R> Result implementation
+ * @param action the action
+ * @param callback the callback
+ * @see net.customware.gwt.dispatch.client.DispatchAsync#execute(A,
+ * com.google.gwt.user.client.rpc.AsyncCallback)
+ */
+ public <A extends Action<R>, R extends Result> void execute(final A action,
+ final AsyncCallback<R> callback) {
+ dispatcher.execute(action, callback);
+ }
+
+ /**
+ * Execute the given Action. If the Action was executed before it will get
+ * fetched from the cache
+ *
+ * @param <A> Action implementation
+ * @param <R> Result implementation
+ * @param action the action
+ * @param callback the callback
+ */
+ @SuppressWarnings("unchecked")
+ public <A extends Action<R>, R extends Result> void executeWithCache(final A action,
+ final AsyncCallback<R> callback) {
+ final Result r = cache.get(action);
+
+ if (r != null) {
+ callback.onSuccess((R) r);
+ } else {
+ dispatcher.execute(action, new AsyncCallback<R>() {
+
+ public void onFailure(final Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ public void onSuccess(final R result) {
+ cache.put((Action) action, (Result) result);
+ callback.onSuccess(result);
+ }
+ });
+ }
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -16,7 +16,7 @@
* The default Type Handler Type is parameterized by the handler type in
* order to make the addHandler method type safe.
*/
- public static Type<BookSelectedEventHandler> TYPE = new Type<BookSelectedEventHandler>();
+ private static Type<BookSelectedEventHandler> TYPE = new Type<BookSelectedEventHandler>();
@Override
public Type<BookSelectedEventHandler> getAssociatedType() {
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -16,7 +16,7 @@
* The default Type Handler Type is parameterized by the handler type in
* order to make the addHandler method type safe.
*/
- public static Type<DictionaryDefinitionFoundHandler> TYPE = new Type<DictionaryDefinitionFoundHandler>();
+ private static Type<DictionaryDefinitionFoundHandler> TYPE = new Type<DictionaryDefinitionFoundHandler>();
/**
* the definition that was retrieved
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -14,6 +14,9 @@
*
*/
public class LemmaClickedEvent extends GwtEvent<LemmaClickedEventHandler> {
+ /**
+ * Type of event
+ */
public static Type<LemmaClickedEventHandler> TYPE = new Type<LemmaClickedEventHandler>();
/**
* The default Type Handler Type is parameterized by the handler type in
@@ -53,5 +56,4 @@
protected void dispatch(final LemmaClickedEventHandler handler) {
handler.onLemmaClicked(this);
}
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -15,7 +15,7 @@
* The default Type Handler Type is parameterized by the handler type in
* order to make the addHandler method type safe.
*/
- public static Type<ModuleChangeEventHandler> TYPE = new Type<ModuleChangeEventHandler>();
+ private static Type<ModuleChangeEventHandler> TYPE = new Type<ModuleChangeEventHandler>();
/** newly selected depth of stud */
private final String newDepth;
@@ -32,7 +32,8 @@
* @param newSubModule new sub module
* @param newDepth new depth of study
*/
- public ModuleChangeEvent(final String newModule, final String newSubModule, final String newDepth) {
+ public ModuleChangeEvent(final String newModule, final String newSubModule,
+ final String newDepth) {
this.newModule = newModule;
this.newSubModule = newSubModule;
this.newDepth = newDepth;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -13,7 +13,8 @@
* @author cjburrell
*
*/
-public class TimebandListUpdateRequiredEvent extends GwtEvent<TimebandListUpdateRequiredEventHandler> {
+public class TimebandListUpdateRequiredEvent extends
+ GwtEvent<TimebandListUpdateRequiredEventHandler> {
/**
* The default Type Handler Type is parameterized by the handler type in
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -5,7 +5,7 @@
import com.google.gwt.event.shared.GwtEvent;
import com.tyndalehouse.step.web.client.eventhandler.TimelineScrollEventHandler;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
+import com.tyndalehouse.step.web.shared.common.TimeBandVisibleDate;
/**
* Event signalling the timeline has been scrolled. This event contains the list
@@ -42,7 +42,8 @@
* @param maxDate the maximum date
*/
public void addTimebandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
- final TimeBandVisibleDate visibleDate = new TimeBandVisibleDate(timebandId, minDate, maxDate);
+ final TimeBandVisibleDate visibleDate = new TimeBandVisibleDate(timebandId, minDate,
+ maxDate);
addTimebandVisibleDate(visibleDate);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,12 +1,14 @@
package com.tyndalehouse.step.web.client.gin;
+import net.customware.gwt.dispatch.client.DefaultDispatchAsync;
+import net.customware.gwt.dispatch.client.DispatchAsync;
import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.gin.AbstractPresenterModule;
import net.customware.gwt.presenter.client.place.PlaceManager;
import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
-import com.tyndalehouse.step.web.client.CachingDispatchAsync;
+import com.tyndalehouse.step.web.client.common.CachingDispatchAsync;
import com.tyndalehouse.step.web.client.presenter.AppPresenter;
import com.tyndalehouse.step.web.client.presenter.HistoryModulePresenter;
import com.tyndalehouse.step.web.client.presenter.ModuleSelectorPresenter;
@@ -16,7 +18,7 @@
import com.tyndalehouse.step.web.client.presenter.StepPresenter;
import com.tyndalehouse.step.web.client.presenter.TimebandListPresenter;
import com.tyndalehouse.step.web.client.presenter.TimelinePresenter;
-import com.tyndalehouse.step.web.client.service.eventbus.StepEventBus;
+import com.tyndalehouse.step.web.client.service.eventbus.StepEventBusImpl;
import com.tyndalehouse.step.web.client.view.HistoryModuleView;
import com.tyndalehouse.step.web.client.view.ModuleSelectorView;
import com.tyndalehouse.step.web.client.view.ScriptureSelectorView;
@@ -39,15 +41,17 @@
// put the bindings in here
- bind(EventBus.class).to(StepEventBus.class).in(Singleton.class);
+ bind(EventBus.class).to(StepEventBusImpl.class).in(Singleton.class);
bind(AppPresenter.class).in(Singleton.class);
bind(PlaceManager.class).in(Singleton.class);
bindPresenter(StepPresenter.class, StepPresenter.Display.class, StepView.class);
bind(ScriptureSelectorPresenter.class);
- bind(ScriptureSelectorPresenter.Display.class).to(ScriptureSelectorView.class).in(Singleton.class);
+ bind(ScriptureSelectorPresenter.Display.class).to(ScriptureSelectorView.class).in(
+ Singleton.class);
bind(ModuleSelectorPresenter.class);
- bind(ModuleSelectorPresenter.Display.class).to(ModuleSelectorView.class).in(Singleton.class);
+ bind(ModuleSelectorPresenter.Display.class).to(ModuleSelectorView.class)
+ .in(Singleton.class);
bind(ScripturePresenter.class);
bind(ScripturePresenter.Display.class).to(ScriptureView.class); // .in(Singleton.class);
bind(TimelinePresenter.class);
@@ -68,8 +72,8 @@
// bind(StepModulePresenter<StepModulePresenter.Display>)
// bind(HistoryModulePresenter.Display.class).to(HistoryModuleView.class);
+ bind(DispatchAsync.class).to(DefaultDispatchAsync.class).in(Singleton.class);
bind(CachingDispatchAsync.class);
}
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,6 +1,5 @@
package com.tyndalehouse.step.web.client.gin;
-import net.customware.gwt.dispatch.client.gin.ClientDispatchModule;
import net.customware.gwt.presenter.client.place.PlaceManager;
import com.google.gwt.inject.client.GinModules;
@@ -13,7 +12,7 @@
* @author cjburrell
*
*/
- at GinModules( { ClientDispatchModule.class, StepClientModule.class })
+ at GinModules( { StepClientModule.class })
public interface StepInjector extends Ginjector {
/**
* Returns the App Presenter, the main presenter for STEP
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -24,6 +24,7 @@
import com.tyndalehouse.step.web.client.toolkit.HasSource;
import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
+import com.tyndalehouse.step.web.shared.common.BibleTextLookupType;
import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
import com.tyndalehouse.step.web.shared.scripture.Passage;
@@ -104,8 +105,9 @@
* with the reference in it), provided by Gin
*/
@Inject
- public ScripturePresenter(final Display display, final EventBus eventBus, final DispatchAsync dispatcher,
- final ScriptureSelectorPresenter.Display scriptureSelectorView) {
+ public ScripturePresenter(final Display display, final EventBus eventBus,
+ final DispatchAsync dispatcher,
+ final ScriptureSelectorPresenter.Display scriptureSelectorView) {
super(display, eventBus);
// TODO: remove dependency on scripture selector view
this.dispatcher = dispatcher;
@@ -139,13 +141,9 @@
*/
private void doRefreshScripture() {
final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(display
- .getSelectedBibleVersion(), scriptureSelectorView.getReference().getValue());
+ .getSelectedBibleVersion(), scriptureSelectorView.getReference().getValue());
// TODO: decide if this should be made static or UI driven
- cmd.setLogicalFormRequired(true);
- cmd.setSimpleTextRequired(false);
- cmd.setXsltRequired(false);
- cmd.setInterlinear(true);
- cmd.setInterlinearClassic(false);
+ cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
dispatcher.execute(cmd, new DisplayCallback<GetCurrentBibleTextResult>(display) {
@@ -168,17 +166,17 @@
Log.debug("Binding Scripture Presenter");
// get list of versions now...
dispatcher.execute(new GetAvailableBibleVersionsCommand(),
- new DisplayCallback<GetAvailableBibleVersionsResult>(display) {
- @Override
- protected void handleFailure(final Throwable e) {
- Log.error("An error occurred while retrieving bible versions: ", e);
- }
+ new DisplayCallback<GetAvailableBibleVersionsResult>(display) {
+ @Override
+ protected void handleFailure(final Throwable e) {
+ Log.error("An error occurred while retrieving bible versions: ", e);
+ }
- @Override
- protected void handleSuccess(final GetAvailableBibleVersionsResult result) {
- display.getSource().setSource(result.getBooks());
- }
- });
+ @Override
+ protected void handleSuccess(final GetAvailableBibleVersionsResult result) {
+ display.getSource().setSource(result.getBooks());
+ }
+ });
display.getChangeHandlers().addChangeHandler(new ChangeHandler() {
@Override
@@ -199,8 +197,16 @@
// TODO: this handler needs to be moved somewhere else, and fire off
// definition found
- eventBus.addHandler(LemmaClickedEvent.TYPE, new LemmaClickedEventHandler() {
+ // TODO: given the handler name, our event bus, should be able to derive
+ // the type of it,
+ // since the type = Type<HandlerName>, at which point we can probably
+ // get rid of
+ // the type variable in the event.
+ // we would have to change the event to return the static type declared
+ // in the
+ // event handler
+ final LemmaClickedEventHandler lceh = new LemmaClickedEventHandler() {
@Override
public void onLemmaClicked(final LemmaClickedEvent lemmaClickedEvent) {
Log.error("Lemma Clicked event handler invoked");
@@ -210,7 +216,8 @@
private void highlightAllLemmas(final List<String> lemmas) {
display.highlight(lemmas);
}
- });
+ };
+ eventBus.addHandler(LemmaClickedEvent.TYPE, lceh);
}
@Override
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -25,12 +25,12 @@
import com.tyndalehouse.step.web.client.toolkit.timeline.Timeline;
import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimelineConstants;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.TimeBandNotFoundException;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
-import com.tyndalehouse.step.web.shared.beans.TimelineBean;
-import com.tyndalehouse.step.web.shared.beans.TimelineEventBean;
import com.tyndalehouse.step.web.shared.command.GetEventsForDateRangeCommand;
import com.tyndalehouse.step.web.shared.command.GetTimelineOriginForScriptureCommand;
import com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand;
+import com.tyndalehouse.step.web.shared.common.TimeBandVisibleDate;
+import com.tyndalehouse.step.web.shared.common.TimelineBean;
+import com.tyndalehouse.step.web.shared.common.TimelineEventBean;
import com.tyndalehouse.step.web.shared.result.GetEventsForDateRangeResult;
import com.tyndalehouse.step.web.shared.result.GetTimelineOriginForScriptureResult;
import com.tyndalehouse.step.web.shared.result.GetTimelineUISetupResult;
@@ -240,6 +240,8 @@
* calling the server for the initial data setup
*/
private void doInitialSetup() {
+ // TODO: this result can be cached quite successfully on the server
+ // (perhaps in the dispatch module
dispatcher.execute(new GetTimelineUISetupCommand(), new DisplayCallback<GetTimelineUISetupResult>(
display) {
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBus.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBus.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBus.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,23 +0,0 @@
-package com.tyndalehouse.step.web.client.service.eventbus;
-
-import net.customware.gwt.presenter.client.DefaultEventBus;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.shared.GwtEvent;
-
-/**
- * Default Step event bus to be used. Provides extra logging and in flight
- * monitoring capability later
- *
- * @author cjburrell
- *
- */
-public class StepEventBus extends DefaultEventBus {
-
- @Override
- public void fireEvent(final GwtEvent<?> event) {
- Log.debug("StepEventBus:: firing event " + event.toDebugString());
- super.fireEvent(event);
- }
-
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBusImpl.java (from rev 99, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBus.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBusImpl.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/eventbus/StepEventBusImpl.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,23 @@
+package com.tyndalehouse.step.web.client.service.eventbus;
+
+import net.customware.gwt.presenter.client.DefaultEventBus;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.event.shared.GwtEvent;
+
+/**
+ * Default Step event bus to be used. Provides extra logging and in flight
+ * monitoring capability later
+ *
+ * @author cjburrell
+ *
+ */
+public class StepEventBusImpl extends DefaultEventBus {
+
+ @Override
+ public void fireEvent(final GwtEvent<?> event) {
+ Log.debug("StepEventBus:: firing event " + event.toDebugString());
+ super.fireEvent(event);
+ }
+
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -7,6 +7,7 @@
/**
* Client side service to serve the reference data to the user
*/
+// TODO: Ginify the singleton pattern
public final class ModuleRefData {
/**
* This class is a singleton, so this is the unique private instance
@@ -14,17 +15,6 @@
private static ModuleRefData instance;
/**
- * @return the instance
- */
- public static synchronized ModuleRefData getInstance() {
- if (instance == null) {
- instance = new ModuleRefData();
- }
-
- return instance;
- }
-
- /**
* List of depths populating the Depth dropdown (level at which the user
* wants to see articles)
*/
@@ -74,6 +64,17 @@
}
/**
+ * @return the instance
+ */
+ public static synchronized ModuleRefData getInstance() {
+ if (instance == null) {
+ instance = new ModuleRefData();
+ }
+
+ return instance;
+ }
+
+ /**
* @return the depths
*/
public List<String> getDepths() {
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -117,7 +117,7 @@
@Override
public void onClick(final ClickEvent event) {
- Log.error("Firing event");
+ Log.debug("Firing event");
eventBus.fireEvent(new LemmaClickedEvent(lemma));
}
});
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -16,7 +16,7 @@
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.CannotDeleteEventException;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.IncapableOfCalculatingRequestWindowException;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.TimeConversionUtil;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
+import com.tyndalehouse.step.web.shared.common.TimeBandVisibleDate;
import com.tyndalehouse.step.web.shared.timeline.Unit;
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -27,7 +27,7 @@
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.TimeBandNotFoundException;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.UnknownFiredElement;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
+import com.tyndalehouse.step.web.shared.common.TimeBandVisibleDate;
import com.tyndalehouse.step.web.shared.timeline.Unit;
/**
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java (from rev 97, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/StepHandler.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,45 @@
+package com.tyndalehouse.step.web.server.common;
+
+import java.lang.reflect.ParameterizedType;
+
+import net.customware.gwt.dispatch.server.ActionHandler;
+import net.customware.gwt.dispatch.shared.Action;
+import net.customware.gwt.dispatch.shared.Result;
+
+import org.apache.log4j.Logger;
+
+/**
+ * To abstract away the need for declaring getActionType every time.
+ *
+ * @author CJBurrell
+ *
+ * @param <A> the action in question
+ * @param <R> the response to be sent back to the client
+ */
+public abstract class AbstractStepHandler<A extends Action<R>, R extends Result> implements
+ ActionHandler<A, R> {
+
+ /**
+ * Logger for a particular instance of a handler
+ */
+ private final Logger logger = Logger.getLogger(this.getClass());
+
+ @SuppressWarnings("unchecked")
+ @Override
+ /*
+ * returns the type of the action
+ *
+ * @return the type of the action
+ */
+ public final Class<A> getActionType() {
+ final ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass();
+ return (Class<A>) pt.getActualTypeArguments()[0];
+ }
+
+ /**
+ * @return the logger
+ */
+ protected final Logger getLogger() {
+ return logger;
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,8 +1,7 @@
package com.tyndalehouse.step.web.server.db.framework;
-
/**
- * An issue occured during the parsing or running of a query
+ * An issue occurred during the parsing or running of a query
*
* @author CJBurrell
*
@@ -22,21 +21,21 @@
/**
* Pass in the root cause of the exception
*
- * @param t
+ * @param e the root exception
*/
- public UnableToRunQueryException(final Throwable t) {
- super(t);
+ public UnableToRunQueryException(final Exception e) {
+ super(e);
}
/**
* Unable to run a query exception, with the stepQuery itself, and the root
* exception
*
- * @param e
- * @param stepQuery
+ * @param e the exception to be wrapped
+ * @param stepQuery a step query that was attempted to be executed
*/
- public UnableToRunQueryException(final Throwable t, final StepQuery stepQuery) {
- this(t);
+ public UnableToRunQueryException(final Exception e, final StepQuery stepQuery) {
+ this(e);
this.stepQuery = stepQuery;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -12,7 +12,7 @@
import com.tyndalehouse.step.web.server.db.framework.Query;
import com.tyndalehouse.step.web.server.db.framework.QueryImpl;
import com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor;
-import com.tyndalehouse.step.web.shared.beans.TimelineEventBean;
+import com.tyndalehouse.step.web.shared.common.TimelineEventBean;
/**
* Processes a list of timebands from the database
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -13,19 +13,37 @@
import com.tyndalehouse.step.web.server.db.framework.QueryImpl;
import com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor;
+/**
+ * Step Processor to retrieve the origin event, given a scripture passage
+ *
+ * @author CJBurrell
+ *
+ */
public class TimelineOriginProcessor implements ResultSetProcessor<TimelineOriginDbBean> {
- private static final String UNIT = "unit";
+ /** result column origin */
private static final String ORIGIN = "origin";
- private static final String TIMEBAND = "timeband_id";
+
+ /** input qry end,, verse no for which to restrict the query */
private static final String QRY_END = "qry_end";
+
+ /** input qry start, verse no for which to restrict the query */
private static final String QRY_START = "qry_start";
- private Map<String, Object> params;
+ /** result column timeband id */
+ private static final String TIMEBAND = "timeband_id";
+
+ // TODO: move to enum
+ /** result column unit */
+ private static final String UNIT = "unit";
+
+ /** parameters to pass in to the query */
+ private final Map<String, Object> params;
+
/**
* Given a scripture range, it
*
- * @param qryStart
- * @param qryEnd
+ * @param qryStart minimum verse no to restrict range lookup
+ * @param qryEnd maximum verse no to restrict range lookup
*/
public TimelineOriginProcessor(final int qryStart, final int qryEnd) {
params = new HashMap<String, Object>();
@@ -34,11 +52,23 @@
}
@Override
- public List<TimelineOriginDbBean> process(final ResultSet rs) throws MalformedStepQueryException, ConfigNotLoadedException, SQLException {
- List<TimelineOriginDbBean> origins = new ArrayList<TimelineOriginDbBean>();
+ public Map<String, Object> getParameters() {
+ return params;
+ }
+
+ @Override
+ public Query getQuery() {
+ return QueryImpl.LOOKUP_TIMELINE_ORIGIN;
+ }
+
+ @Override
+ public List<TimelineOriginDbBean> process(final ResultSet rs) throws MalformedStepQueryException,
+ ConfigNotLoadedException, SQLException {
+ final List<TimelineOriginDbBean> origins = new ArrayList<TimelineOriginDbBean>();
+
while (rs.next()) {
- TimelineOriginDbBean bean = new TimelineOriginDbBean();
+ final TimelineOriginDbBean bean = new TimelineOriginDbBean();
bean.setOrigin(rs.getLong(ORIGIN));
bean.setUnit(rs.getString(UNIT));
bean.setTimebandId(rs.getInt(TIMEBAND));
@@ -47,15 +77,4 @@
return origins;
}
- @Override
- public Map<String, Object> getParameters() {
- return params;
-
- }
-
- @Override
- public Query getQuery() {
- return QueryImpl.LOOKUP_TIMELINE_ORIGIN;
- }
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -12,20 +12,32 @@
import com.tyndalehouse.step.web.server.db.framework.Query;
import com.tyndalehouse.step.web.server.db.framework.QueryImpl;
import com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor;
-import com.tyndalehouse.step.web.shared.beans.TimelineBean;
+import com.tyndalehouse.step.web.shared.common.TimelineBean;
+/**
+ * Data processor for the Step Query framework, to parse results from the
+ * timeline setup sql query
+ *
+ * @author CJBurrell
+ *
+ */
public class TimelineSetupDataProcessor implements ResultSetProcessor<TimelineBean> {
+ /**
+ * the result column timeband_description
+ */
private static final String TIMEBAND_DESCRIPTION = "timeband_description";
+
+ /** the result column timeband_id */
private static final String TIMEBAND_ID = "timeband_id";
+
+ /** the result column timeband unit */
private static final String TIMEBAND_UNIT = "timeband_unit";
+ /** the parameters to pass in to the query */
private final Map<String, Object> params;
/**
- * Given a scripture range, it
- *
- * @param qryStart
- * @param qryEnd
+ * public constructor
*/
public TimelineSetupDataProcessor() {
params = new HashMap<String, Object>();
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -8,25 +8,40 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
+/**
+ * Step dispatch servlet to use for the dispatchin of queries
+ *
+ * @author CJBurrell
+ *
+ */
@Singleton
public class CustomDispatchServiceServlet extends DispatchServiceServlet {
- private Log logger;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6063357416925075136L;
+ /**
+ * default logger
+ */
+ private final Log logger;
+
+ /**
+ * normal constructor
+ *
+ * @param dispatch dispath object
+ * @param logger logger to be provided
+ */
@Inject
- public CustomDispatchServiceServlet(Dispatch dispatch, Log logger) {
+ public CustomDispatchServiceServlet(final Dispatch dispatch, final Log logger) {
super(dispatch);
this.logger = logger;
- }
+ };
@Override
- protected void doUnexpectedFailure(Throwable e) {
+ protected void doUnexpectedFailure(final Throwable e) {
logger.error("An unexpected error happened on the bridge between server and client", e);
- };
+ }
- /**
- *
- */
- private static final long serialVersionUID = -6063357416925075136L;
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,6 +2,12 @@
import com.google.inject.servlet.ServletModule;
+/**
+ * Servlet module for the Jetty/Tomcat server
+ *
+ * @author CJBurrell
+ *
+ */
public class DispatchServletModule extends ServletModule {
@Override
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -6,16 +6,27 @@
import com.google.inject.Provider;
import com.google.inject.Singleton;
+/**
+ * A Gin provider for logging purposes.
+ *
+ * @author CJBurrell
+ *
+ */
@Singleton
public class LogProvider implements Provider<Log> {
// enforce singleton to allow static methods to get to the same log
+ /**
+ * TODO: there should be a logger per class really. All appending to the
+ * same file, but so that we can turn them on and off
+ *
+ */
private static Log logger = new Log4JLogger("step.jetty");
/**
* The static equivalent of the above, so that static contexts can log as
* well
*
- * @return
+ * @return the log to use
*/
public static Log getLogger() {
return logger;
@@ -23,6 +34,8 @@
/**
* The instantiated log to be returned
+ *
+ * @return the Log file to be used
*/
public Log get() {
return logger;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,6 +4,12 @@
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
+/**
+ * The servlet configuraiton for Guice, which creates an injector
+ *
+ * @author CJBurrell
+ *
+ */
public class MyGuiceServletConfig extends GuiceServletContextListener {
@Override
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -13,27 +13,38 @@
import org.crosswire.jsword.book.Books;
import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.handler.util.StepHandler;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
+/**
+ * Command handler returning all available bible versions
+ *
+ * @author CJBurrell TODO: add logging to this class
+ */
public class GetAvailableBibleVersionsHandler extends
- StepHandler<GetAvailableBibleVersionsCommand, GetAvailableBibleVersionsResult> {
+ AbstractStepHandler<GetAvailableBibleVersionsCommand, GetAvailableBibleVersionsResult> {
/**
* Default logger
*/
private final Log logger;
+ /**
+ * normal constructor
+ *
+ * @param logger provided by Gin
+ */
@Inject
public GetAvailableBibleVersionsHandler(final Log logger) {
this.logger = logger;
}
- @SuppressWarnings("unchecked")
@Override
- public GetAvailableBibleVersionsResult execute(final GetAvailableBibleVersionsCommand arg0,
- final ExecutionContext arg1) throws ActionException {
-
+ public GetAvailableBibleVersionsResult execute(final GetAvailableBibleVersionsCommand cmd,
+ final ExecutionContext arg1) throws ActionException {
+ // TODO: add handling of different types of book: bibles, commentaries,
+ // versions, etc.
+ @SuppressWarnings("unchecked")
final List<Book> books = Books.installed().getBooks();
final SortedMap<String, String> map = new TreeMap<String, String>();
for (final Book b : books) {
@@ -41,19 +52,14 @@
map.put(b.getInitials(), b.getName());
}
}
-
return new GetAvailableBibleVersionsResult(map);
-
}
@Override
public void rollback(final GetAvailableBibleVersionsCommand arg0,
- final GetAvailableBibleVersionsResult arg1, final ExecutionContext arg2) throws ActionException {
+ final GetAvailableBibleVersionsResult arg1, final ExecutionContext arg2)
+ throws ActionException {
logger.error("Rolling back GetAvailableBibleVersions");
}
- /**
- * @Override public Class<GetAvailableBibleVersionsCommand> getActionType()
- * { return GetAvailableBibleVersionsCommand.class; }
- */
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -3,111 +3,47 @@
import java.util.ArrayList;
import java.util.Locale;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
-import org.apache.commons.logging.Log;
import org.crosswire.jsword.passage.NoSuchVerseException;
import org.crosswire.jsword.versification.BibleInfo;
import org.crosswire.jsword.versification.BibleNames;
import org.crosswire.jsword.versification.BookName;
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.shared.command.GetBibleBooksCommand;
import com.tyndalehouse.step.web.shared.result.GetBibleBooksCommandResult;
-public class GetBibleBooksHandler implements ActionHandler<GetBibleBooksCommand, GetBibleBooksCommandResult> {
+/**
+ * Command handler for retrieving the different names of the books in a
+ * particular version TODO: only currently works for KJV
+ *
+ * @author CJBurrell
+ *
+ */
+public class GetBibleBooksHandler extends
+ AbstractStepHandler<GetBibleBooksCommand, GetBibleBooksCommandResult> {
/**
- * Default logger
+ * public constructor
*/
- private final Log logger;
-
@Inject
- public GetBibleBooksHandler(final Log logger) {
- this.logger = logger;
+ public GetBibleBooksHandler() {
}
- // private void checkJSwordInstalled() throws Throwable {
- // try {
- // logger.info("checkJSwordInstalled called");
- // logger.info("Eventually we want to do all of this at startup/installation/configuration time to save time");
- //
- // // An installer knows how to install books
- // HttpSwordInstaller installer = getNewCustomInstaller();
- // logger.info("got new custom installer");
- // // installer.reloadBookList();
- //
- // // check esv installed?
- // if (Books.installed().getBook("ESV") != null) {
- // logger.info("The ESV is already installed");
- // } else {
- // logger.info("Installing ESV");
- // installer.install(installer.getBook("ESV"));
- // }
- //
- // //TODO: this needs to be changed
- // // check random other book installed installed?
- // if (Books.installed().getBook("UMGreek") != null) {
- // logger.info("The UMGreek is already installed");
- // } else {
- // logger.info("Installing the UMGreek");
- // installer.install(installer.getBook("UMGreek"));
- // }
- // } catch (Throwable t) {
- // logger.info("An unknown error has occurred:", t);
- // throw t;
- // }
- // }
- //
- // private HttpSwordInstaller getNewCustomInstaller() {
- // logger.info("Creating new installer for JSword");
- // HttpSwordInstaller resourceInstaller = new HttpSwordInstaller();
- //
- // logger.info("Currently hardcoded installer host to:"
- // + "www.crosswire.org");
- // logger.info("Currently hardcoded property names for step");
- // String host = "www.crosswire.org";
- // String proxyHost = System.getProperty(proxyHostProperty);
- // String proxyPort = System.getProperty(proxyPortProperty);
- // logger.info(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));
- // }
- //
- // logger.info("Setting package and catalog directories");
- // resourceInstaller
- // .setPackageDirectory("/ftpmirror/pub/sword/packages/rawzip");
- // resourceInstaller.setCatalogDirectory("/ftpmirror/pub/sword/raw");
- // return resourceInstaller;
- // }
- // TODO: ensure we base this on a lookup of user's preferences
-
@Override
- public GetBibleBooksCommandResult execute(final GetBibleBooksCommand arg0, final ExecutionContext arg1)
- throws ActionException {
+ public GetBibleBooksCommandResult execute(final GetBibleBooksCommand command,
+ final ExecutionContext arg1) throws ActionException {
- logger.info("GetBibleBooksCommandResult has been called...");
- logger.info("========= We don't actually need to do this - this is simply a test");
- logger.info("Check that application has JSWord installed");
- // try {
- // checkJSwordInstalled();
- // } catch(Throwable t) {
- // logger.error(t);
- // throw new
- // ActionException("Installation of JSword has gone badly wrong:", t);
- // }
+ getLogger().debug("GetBibleBooksCommandResult has been called...");
+ // TODO: on start up, we should check a whole load of things: jsword
+ // installed, database can be started, database has got data
+
// find selection of books and then add stuff to the suggestbox.
final ArrayList<String> suggestions = new ArrayList<String>();
- // TODO:
// http://www.crosswire.org/jsword/java2html/org/crosswire/jsword/bridge/BibleScope.java.html
// TODO: currently based on KJV versification, when better to base it on
// preferred version
@@ -121,20 +57,15 @@
suggestions.add(bn.getPreferredName());
}
} catch (final NoSuchVerseException e) {
- logger.error("Failed to generate list of bible books", e);
+ getLogger().error("Failed to generate list of bible books", e);
}
return new GetBibleBooksCommandResult(suggestions);
}
@Override
- public Class<GetBibleBooksCommand> getActionType() {
- return GetBibleBooksCommand.class;
- }
-
- @Override
public void rollback(final GetBibleBooksCommand arg0, final GetBibleBooksCommandResult arg1,
- final ExecutionContext context) throws ActionException {
+ final ExecutionContext context) throws ActionException {
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -5,12 +5,10 @@
import javax.xml.transform.TransformerException;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
import org.crosswire.common.util.Reporter;
import org.crosswire.common.xml.SAXEventProvider;
import org.crosswire.common.xml.TransformingSAXEventProvider;
@@ -30,6 +28,7 @@
import org.xml.sax.SAXException;
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.server.common.JSwordConstants;
import com.tyndalehouse.step.web.server.handler.util.passage.StrongMorphMap;
import com.tyndalehouse.step.web.server.jsword.ConfigurableHTMLConverter;
@@ -46,21 +45,27 @@
import com.tyndalehouse.step.web.shared.scripture.VerseContent;
import com.tyndalehouse.step.web.shared.scripture.Word;
-public class GetCurrentBibleTextHandler implements
- ActionHandler<GetCurrentBibleTextCommand, GetCurrentBibleTextResult> {
+/**
+ * Command handler returning a portion of scripture in different formats
+ *
+ * @author CJBurrell
+ *
+ */
+public class GetCurrentBibleTextHandler extends
+ AbstractStepHandler<GetCurrentBibleTextCommand, GetCurrentBibleTextResult> {
+
/**
- * Default logger
+ * default constructor with the getLogger
+ *
*/
- private final Log logger;
+ @Inject
+ public GetCurrentBibleTextHandler() {
- @Inject
- public GetCurrentBibleTextHandler(final Log logger) {
- this.logger = logger;
}
@Override
public GetCurrentBibleTextResult execute(final GetCurrentBibleTextCommand command,
- final ExecutionContext arg1) throws ActionException {
+ final ExecutionContext arg1) throws ActionException {
final String version = command.getVersion();
final String reference = command.getReference();
@@ -75,72 +80,73 @@
final GetCurrentBibleTextResult result = new GetCurrentBibleTextResult();
- Passage p;
final BookData data = getBookData(version, reference);
- if (command.isLogicalFormRequired()) {
- p = parseForGwt(data);
- result.setPassage(p);
- if (command.isInterlinear()) {
- if (command.isInterlinearClassic()) {
-
- } else {
- doReverseInterlinear(p, reference);
- }
- }
- }
-
- if (command.isXsltRequired()) {
- result.setXsltedText(doXslt(data));
- }
-
- if (command.isSimpleTextRequired()) {
+ switch (command.getTypeOfLookup()) {
+ case CLASSIC_INTERLINEAR:
+ addClassicInterlinear(result.getPassage(), reference);
+ break;
+ case LOGICAL:
+ addLogicalLookup(result, data);
+ break;
+ case PLAIN_TEXT:
try {
result.setPassageText(OSISUtil.getCanonicalText(data.getOsis()));
} catch (final BookException e) {
throw new ActionException("Unable to get simple canonical text from book", e);
}
+ break;
+ case REVERSE_INTERLINEAR:
+ addLogicalLookup(result, data);
+ addReverseInterlinear(result.getPassage(), reference);
+ break;
+ case XSLT:
+ result.setXsltedText(doXslt(data));
+ break;
+ default:
+ // do nothing since nothing was requested
+ break;
}
-
return result;
}
@Override
- public Class<GetCurrentBibleTextCommand> getActionType() {
- return GetCurrentBibleTextCommand.class;
- }
+ public void rollback(final GetCurrentBibleTextCommand arg0,
+ final GetCurrentBibleTextResult arg1, final ExecutionContext arg2) throws ActionException {
+ getLogger().error("Get Current Bible Text rolling back");
- @Override
- public void rollback(final GetCurrentBibleTextCommand arg0, final GetCurrentBibleTextResult arg1,
- final ExecutionContext arg2) throws ActionException {
- logger.error("Get Current Bible Text rolling back");
-
}
/**
- * parsing a milestone into a logical element
+ * does a classic interlinear and populates the Passage
*
- * @param verseContent the Content on which to append the logical element
- * @param v the verse
+ * @param p the logical passage to be populated
+ * @param reference the reference
*/
- private void doMilestone(final Element verseContent, final Verse v) {
- final Milestone m = new Milestone();
- m.setMarker(verseContent.getAttributeValue(OSISConstants.MARKER));
- m.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
- v.addTextualElement(m);
+ private void addClassicInterlinear(final Passage p, final String reference) {
+ // TODO: feature
+ // identify the hebrew/greek version of the text, and get book data for
+ // the appropriate version
+ // final VerseRange vrf = VerseRangeFactory.fromString(reference);
+ // TODO updgrade to latest jsword version
+
+ // VerseRange.remainder(vrf, null);
+
+ // getBookData(version, reference);
}
/**
- * parsing a note into a logical element
+ * adds a logical lookup to the result objet
*
- * @param verseContent the Content on which to append the logical element
- * @param v the verse
+ * @param result the result object to populate
+ * @param data the data to base the lookup upon
+ * @throws ActionException an exception thrown if the parsing or lookup goes
+ * bad
*/
- private void doNote(final Element verseContent, final Verse v) {
- final Note n = new Note();
- n.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
- n.setText(verseContent.getText());
- v.addTextualElement(n);
+ private void addLogicalLookup(final GetCurrentBibleTextResult result, final BookData data)
+ throws ActionException {
+ final Passage p = parseForGwt(data);
+ result.setPassage(p);
}
/**
@@ -149,9 +155,11 @@
* @param translatedText the passage as looked up in an non-original version
* @param reference the reference of the text so we can add the original
* text onto it
+ * @throws ActionException action exception thrown during execution of the
+ * reverse interlinear process
*/
- private void doReverseInterlinear(final Passage translatedText, final String reference)
- throws ActionException {
+ private void addReverseInterlinear(final Passage translatedText, final String reference)
+ throws ActionException {
// first lookup passage from LXX or TODO user chosen version
// TODO: cope with Hebrew
String versionToUse;
@@ -179,6 +187,32 @@
}
/**
+ * parsing a milestone into a logical element
+ *
+ * @param verseContent the Content on which to append the logical element
+ * @param v the verse
+ */
+ private void doMilestone(final Element verseContent, final Verse v) {
+ final Milestone m = new Milestone();
+ m.setMarker(verseContent.getAttributeValue(OSISConstants.MARKER));
+ m.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
+ v.addTextualElement(m);
+ }
+
+ /**
+ * parsing a note into a logical element
+ *
+ * @param verseContent the Content on which to append the logical element
+ * @param v the verse
+ */
+ private void doNote(final Element verseContent, final Verse v) {
+ final Note n = new Note();
+ n.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
+ n.setText(verseContent.getText());
+ v.addTextualElement(n);
+ }
+
+ /**
* parses a title
*
* @param titleElement the xml title element
@@ -229,16 +263,16 @@
} else if (tagName.equals(OSISConstants.TRANS_CHANGE)) {
doTransChange(verseContent, v);
} else {
- logger.warn(String.format("Unexpected element %s", tagName));
+ getLogger().warn(String.format("Unexpected element %s", tagName));
}
} else if (c instanceof Text) {
final Text textElement = (Text) c;
final com.tyndalehouse.step.web.shared.scripture.Text t = new com.tyndalehouse.step.web.shared.scripture.Text(
- textElement.getText());
+ textElement.getText());
v.addTextualElement(t);
} else {
// we're in trouble
- logger.warn("Content c is not recognised: " + c.getClass().getCanonicalName());
+ getLogger().warn("Content c is not recognised: " + c.getClass().getCanonicalName());
}
}
}
@@ -287,7 +321,7 @@
final SAXEventProvider osissep = data.getSAXEventProvider();
final TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) new ConfigurableHTMLConverter()
- .convert(osissep);
+ .convert(osissep);
final String text = XMLUtil.writeToString(htmlsep);
return text;
} catch (final SAXException e) {
@@ -300,24 +334,46 @@
return "";
}
- private BookData getBookData(final String version, final String reference) throws ActionException {
+ /**
+ * returns the book data using the JSword API
+ *
+ * @param version version to be looked up
+ * @param reference reference of the passage
+ * @return the JSword BookData object
+ * @throws ActionException an exception should an problem happen
+ */
+ private BookData getBookData(final String version, final String reference)
+ throws ActionException {
try {
final Book currentBook = Books.installed().getBook(version);
final BookData data = new BookData(currentBook, currentBook.getKey(reference));
return data;
} catch (final NoSuchKeyException e) {
- logger.error("An error occurred looking up the passage", e);
+ getLogger().error("An error occurred looking up the passage", e);
throw new ActionException(e);
}
}
+ /**
+ * given a book data (referencing a biblical reference + a book), retrieves
+ * the morphs and the Strong numbers (lemmas) in the passage to help in the
+ * interlinear processing
+ *
+ * @param bookData the bookData from JSword specialised for the reference
+ * and bible book
+ * @return a map of strong numbers and morphs
+ * @throws BookException an exception occuring during parsing of the OSIS
+ * XML
+ */
+ @SuppressWarnings("unchecked")
private StrongMorphMap getStrongMorphMap(final BookData bookData) throws BookException {
final Element osis = bookData.getOsisFragment();
final StrongMorphMap strongMorphMap = new StrongMorphMap();
final Iterator<Element> it = osis.getDescendants(new Filter() {
@Override
public boolean matches(final Object obj) {
- return obj instanceof Element && ((Element) obj).getName().equals(OSISUtil.OSIS_ELEMENT_W);
+ return obj instanceof Element
+ && ((Element) obj).getName().equals(OSISUtil.OSIS_ELEMENT_W);
}
});
@@ -329,8 +385,8 @@
if (lemmaAttribute != null) {
if (morphAttribute != null) {
- strongMorphMap.addWord(lemmaAttribute.getValue(), morphAttribute.getValue(), word
- .getValue());
+ strongMorphMap.addWord(lemmaAttribute.getValue(), morphAttribute.getValue(),
+ word.getValue());
} else {
strongMorphMap.addWord(lemmaAttribute.getValue(), word.getValue());
}
@@ -354,7 +410,8 @@
if (te instanceof Word) {
final Word w = (Word) te;
if (w.getLemma() != null) {
- return w.getLemma().get(0).charAt(JSwordConstants.STRONG_PATTERN_START.length()) == JSwordConstants.STRONG_GREEK_MARKER;
+ return w.getLemma().get(0).charAt(
+ JSwordConstants.STRONG_PATTERN_START.length()) == JSwordConstants.STRONG_GREEK_MARKER;
}
}
}
@@ -445,7 +502,7 @@
}
} else {
// this shouldn't happen
- logger.warn("Unexpected text while parsing gwt");
+ getLogger().warn("Unexpected text while parsing gwt");
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,12 +4,10 @@
import javax.xml.transform.TransformerException;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
import org.crosswire.common.util.Reporter;
import org.crosswire.common.xml.SAXEventProvider;
import org.crosswire.common.xml.TransformingSAXEventProvider;
@@ -23,26 +21,32 @@
import org.xml.sax.SAXException;
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.server.common.JSwordConstants;
import com.tyndalehouse.step.web.server.jsword.ConfigurableHTMLConverter;
import com.tyndalehouse.step.web.shared.command.GetDictionaryDefinitionCommand;
import com.tyndalehouse.step.web.shared.result.GetDictionaryDefinitionResult;
-public class GetDictionaryDefinitionHandler implements
- ActionHandler<GetDictionaryDefinitionCommand, GetDictionaryDefinitionResult> {
+/**
+ * Looks up the dictionary definition in a JSword module and returns it to the
+ * client
+ *
+ * @author CJBurrell
+ *
+ */
+public class GetDictionaryDefinitionHandler extends
+ AbstractStepHandler<GetDictionaryDefinitionCommand, GetDictionaryDefinitionResult> {
+
/**
- * Default logger
+ * The dictionary definition handler's constructor
*/
- private final Log logger;
-
@Inject
- public GetDictionaryDefinitionHandler(final Log logger) {
- this.logger = logger;
+ public GetDictionaryDefinitionHandler() {
}
@Override
public GetDictionaryDefinitionResult execute(final GetDictionaryDefinitionCommand command,
- final ExecutionContext arg1) throws ActionException {
+ final ExecutionContext arg1) throws ActionException {
final List<String> referenceList = command.getLookupReferencce();
final GetDictionaryDefinitionResult result = new GetDictionaryDefinitionResult();
@@ -60,17 +64,20 @@
}
@Override
- public Class<GetDictionaryDefinitionCommand> getActionType() {
- return GetDictionaryDefinitionCommand.class;
- }
+ public void rollback(final GetDictionaryDefinitionCommand arg0,
+ final GetDictionaryDefinitionResult arg1, final ExecutionContext arg2)
+ throws ActionException {
+ getLogger().error("Get Dictionary definition Text rolling back");
- @Override
- public void rollback(final GetDictionaryDefinitionCommand arg0, final GetDictionaryDefinitionResult arg1,
- final ExecutionContext arg2) throws ActionException {
- logger.error("Get Dictionary definition Text rolling back");
-
}
+ /**
+ * does a simple xslt transformation to show the definition on the screen
+ *
+ * @param data data to be shown
+ * @param osisFragment osisFragment to transform
+ * @return the xslted definition ready to be displayed on the user's screen
+ */
private String doXslt(final BookData data, final Element osisFragment) {
if (data == null) {
return "";
@@ -78,9 +85,9 @@
try {
final SAXEventProvider osissep = data.getSAXEventProvider();
-
+ // TODO: do some work on the XSLT definition
final TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) new ConfigurableHTMLConverter()
- .convert(osissep);
+ .convert(osissep);
final String text = XMLUtil.writeToString(htmlsep);
return text;
} catch (final SAXException e) {
@@ -93,6 +100,16 @@
return "";
}
+ /**
+ * dependant on the reference, we return a different module to lookup the
+ * definition. For e.g. we use a Greek dictionary to lookup a reference
+ * starting strong:Gxxxxx
+ *
+ * @param reference reference to be looked up
+ * @return the module initials to use for the dictionary lookup
+ * @throws ActionException an exception to be thrown if the reference is not
+ * recognised
+ */
private String getInitialsFromReference(final String reference) throws ActionException {
if (reference.toLowerCase().startsWith(JSwordConstants.STRONG_PATTERN_START)) {
final int charPosition = JSwordConstants.STRONG_PATTERN_START.length();
@@ -103,9 +120,18 @@
}
// continuing will throw exception
}
- throw new ActionException(String.format("Dictionary reference not recognised: %s", reference));
+ throw new ActionException(String.format("Dictionary reference not recognised: %s",
+ reference));
}
+ /**
+ * returns the actual reference, removing the strong pattern + first
+ * initial. For e.g. removes strong:H from "strong:H00002"
+ *
+ * @param reference reference to parse
+ * @return the key in the dictionary to be used for lookup purposes
+ * @throws ActionException the action exception
+ */
private String getLookupKeyFromReference(final String reference) throws ActionException {
if (reference.toLowerCase().startsWith(JSwordConstants.STRONG_PATTERN_START)) {
// remove strong:H or strong:G
@@ -126,7 +152,7 @@
if (StringUtils.isEmpty(reference)) {
throw new ActionException("Reference was not provided");
}
- logger.error("definition lookup command");
+ getLogger().error("definition lookup command");
final String initials = getInitialsFromReference(reference);
final String lookupKey = getLookupKeyFromReference(reference);
@@ -138,10 +164,10 @@
final String xsltedDefinition = doXslt(data, data.getOsisFragment());
return xsltedDefinition;
} catch (final NoSuchKeyException e) {
- logger.error("An error occurred looking up the passage", e);
+ getLogger().error("An error occurred looking up the passage", e);
throw new ActionException(e);
} catch (final BookException e) {
- logger.error("A book exception has occurred whilte looking up the passage", e);
+ getLogger().error("A book exception has occurred whilte looking up the passage", e);
throw new ActionException(e);
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,19 +4,17 @@
import java.util.Date;
import java.util.List;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
-import org.apache.commons.logging.Log;
-
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
import com.tyndalehouse.step.web.server.db.timeline.TimeBandVisibleDateProcessor;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
-import com.tyndalehouse.step.web.shared.beans.TimelineEventBean;
import com.tyndalehouse.step.web.shared.command.GetEventsForDateRangeCommand;
+import com.tyndalehouse.step.web.shared.common.TimeBandVisibleDate;
+import com.tyndalehouse.step.web.shared.common.TimelineEventBean;
import com.tyndalehouse.step.web.shared.result.GetEventsForDateRangeResult;
/**
@@ -26,21 +24,21 @@
* @author CJBurrell
*
*/
-public class GetEventsForDateRangeHandler implements
- ActionHandler<GetEventsForDateRangeCommand, GetEventsForDateRangeResult> {
- /**
- * Default logger
- */
- private final Log logger;
+public class GetEventsForDateRangeHandler extends
+ AbstractStepHandler<GetEventsForDateRangeCommand, GetEventsForDateRangeResult> {
/**
* The step query runner to run queries against the database
*/
private final StepQueryRunner queryRunner;
+ /**
+ * public constructor for this handler
+ *
+ * @param queryRunner the query runner object to use for executing the query
+ */
@Inject
- public GetEventsForDateRangeHandler(final Log logger, final StepQueryRunner queryRunner) {
- this.logger = logger;
+ public GetEventsForDateRangeHandler(final StepQueryRunner queryRunner) {
this.queryRunner = queryRunner;
}
@@ -49,18 +47,19 @@
// of date precision but for now,
// let's get something working
public GetEventsForDateRangeResult execute(final GetEventsForDateRangeCommand event,
- final ExecutionContext arg1) throws ActionException {
+ final ExecutionContext arg1) throws ActionException {
final GetEventsForDateRangeResult result = new GetEventsForDateRangeResult();
final List<TimeBandVisibleDate> timebands = event.getVisbleDates();
try {
for (final TimeBandVisibleDate tvd : timebands) {
List<TimelineEventBean> events;
- events = queryRunner.run(new TimeBandVisibleDateProcessor(tvd.getMinDate(), tvd.getMaxDate(),
- tvd.getTimebandId()));
+ events = queryRunner.run(new TimeBandVisibleDateProcessor(tvd.getMinDate(), tvd
+ .getMaxDate(), tvd.getTimebandId()));
result.getEvents().addAll(events);
}
} catch (final UnableToRunQueryException e) {
- logger.error("An error occured while trying to retrieve new events from the datbase", e);
+ getLogger().error(
+ "An error occured while trying to retrieve new events from the datbase", e);
throw new ActionException(e);
}
@@ -69,14 +68,9 @@
}
@Override
- public Class<GetEventsForDateRangeCommand> getActionType() {
- return GetEventsForDateRangeCommand.class;
- }
+ public void rollback(final GetEventsForDateRangeCommand arg0,
+ final GetEventsForDateRangeResult arg1, final ExecutionContext arg2) throws ActionException {
- @Override
- public void rollback(final GetEventsForDateRangeCommand arg0, final GetEventsForDateRangeResult arg1,
- final ExecutionContext arg2) throws ActionException {
-
}
/**
@@ -87,22 +81,25 @@
private void logEventsRetrieved(final List<TimelineEventBean> events) {
final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy G");
- if (logger.isTraceEnabled()) {
+ if (getLogger().isTraceEnabled()) {
for (final TimelineEventBean teb : events) {
if (teb.getFromDate() != null && teb.getToDate() != null) {
- logger.trace(String.format("returning: %s %s-%s (tb_id: %d)", teb.getName(), sdf
- .format(new Date(teb.getFromDate())), sdf.format(new Date(teb.getToDate())), teb
- .getTimelineId()));
+ getLogger().trace(
+ String.format("returning: %s %s-%s (tb_id: %d)", teb.getName(), sdf
+ .format(new Date(teb.getFromDate())), sdf.format(new Date(teb
+ .getToDate())), teb.getTimelineId()));
} else if (teb.getFromDate() != null) {
- logger.trace(String.format("returning: %s %s (tb_id: %d)", teb.getName(), sdf
+ getLogger().trace(
+ String.format("returning: %s %s (tb_id: %d)", teb.getName(), sdf
.format(new Date(teb.getFromDate())), teb.getTimelineId()));
} else {
- logger.trace(String.format("returning: %s (tb_id: %d)", teb.getName(), teb
+ getLogger().trace(
+ String.format("returning: %s (tb_id: %d)", teb.getName(), teb
.getTimelineId()));
}
}
}
- logger.trace(String.format("Returning %d events to the client", events.size()));
+ getLogger().trace(String.format("Returning %d events to the client", events.size()));
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,11 +2,9 @@
import java.util.List;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
-import org.apache.commons.logging.Log;
import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.KeyFactory;
import org.crosswire.jsword.passage.NoSuchKeyException;
@@ -16,6 +14,7 @@
import org.crosswire.jsword.passage.VerseRange;
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor;
import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
@@ -24,20 +23,27 @@
import com.tyndalehouse.step.web.shared.command.GetTimelineOriginForScriptureCommand;
import com.tyndalehouse.step.web.shared.result.GetTimelineOriginForScriptureResult;
-public class GetTimelineOriginForScriptureHandler implements
- ActionHandler<GetTimelineOriginForScriptureCommand, GetTimelineOriginForScriptureResult> {
+/**
+ * returns the timeline origin, i.e the best (closest in time) event for a given
+ * verse range.
+ *
+ * @author CJBurrell
+ *
+ */
+public class GetTimelineOriginForScriptureHandler extends
+ AbstractStepHandler<GetTimelineOriginForScriptureCommand, GetTimelineOriginForScriptureResult> {
/**
- * Default logger
- */
- private final Log log;
- /**
* The step query runner to run queries against the database
*/
private final StepQueryRunner queryRunner;
+ /**
+ * constructor for this handler
+ *
+ * @param queryRunner the query runner framework
+ */
@Inject
- public GetTimelineOriginForScriptureHandler(final Log logger, final StepQueryRunner queryRunner) {
- this.log = logger;
+ public GetTimelineOriginForScriptureHandler(final StepQueryRunner queryRunner) {
this.queryRunner = queryRunner;
}
@@ -46,16 +52,17 @@
// TODO: this needs to change to take into account the three different types
// of date precision but for now,
// let's get something working
- public GetTimelineOriginForScriptureResult execute(final GetTimelineOriginForScriptureCommand event,
- final ExecutionContext arg1) throws ActionException {
+ public GetTimelineOriginForScriptureResult execute(
+ final GetTimelineOriginForScriptureCommand event, final ExecutionContext arg1)
+ throws ActionException {
try {
// TODO: this is bad - look at JSword to work out how to properly
// get the verserange out
final RocketPassage passage = (RocketPassage) resolveScriptureToVerseNumbers(event
- .getScriptureReference());
+ .getScriptureReference());
if (passage.isEmpty()) {
- log.warn("No passage was requested");
+ getLogger().warn("No passage was requested");
} else {
// TODO: we're doing only the first range - ignoring others...
@@ -66,7 +73,7 @@
final int endVerseNo = range.getEnd().getOrdinal();
final ResultSetProcessor<TimelineOriginDbBean> originProcessor = new TimelineOriginProcessor(
- startVerseNo, endVerseNo);
+ startVerseNo, endVerseNo);
// TODO: should be able to ensure this is implied, rather having
// to cast directly
@@ -74,43 +81,40 @@
if (originList.size() != 0) {
final TimelineOriginDbBean origin = originList.get(0);
- return new GetTimelineOriginForScriptureResult(origin.getOrigin(), origin.getUnit(),
- origin.getTimebandId());
- } else {
- // TODO: work out the nearest passage and redo this...
- }
+ return new GetTimelineOriginForScriptureResult(origin.getOrigin(), origin
+ .getUnit(), origin.getTimebandId());
+ } // else {
+ // // TODO: work out the nearest passage and redo this...
+ // }
}
} catch (final NoSuchKeyException e) {
- log.warn("Could not resolve verse number", e);
+ getLogger().warn("Could not resolve verse number", e);
// TODO: return a proper exception and show error message on the UI
return new GetTimelineOriginForScriptureResult(true);
} catch (final UnableToRunQueryException e) {
- log.error("An error occured while loading the config for the query", e);
+ getLogger().error("An error occured while loading the config for the query", e);
throw new ActionException(e);
}
return new GetTimelineOriginForScriptureResult(true);
}
- // This method is used to determine which type of command this handler
- // serves I believe...
@Override
- public Class<GetTimelineOriginForScriptureCommand> getActionType() {
- return GetTimelineOriginForScriptureCommand.class;
- }
-
- @Override
public void rollback(final GetTimelineOriginForScriptureCommand arg0,
- final GetTimelineOriginForScriptureResult arg1, final ExecutionContext arg2)
- throws ActionException {
+ final GetTimelineOriginForScriptureResult arg1, final ExecutionContext arg2)
+ throws ActionException {
}
/**
* resolves a string to a range of verses
*
- * @throws NoSuchKeyException
+ * @return the OSIS key to use to look up a particular scripture reference
+ * in a JSword module
+ * @throws NoSuchKeyException thrown if the passed in reference cannot be
+ * parsed //TODO: make into seperate util classes
*/
- private Key resolveScriptureToVerseNumbers(final String scriptureReference) throws NoSuchKeyException {
+ private Key resolveScriptureToVerseNumbers(final String scriptureReference)
+ throws NoSuchKeyException {
final KeyFactory keyFactory = PassageKeyFactory.instance();
return keyFactory.getKey(scriptureReference);
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,66 +2,66 @@
import java.util.List;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
-import org.apache.commons.logging.Log;
-
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
import com.tyndalehouse.step.web.server.db.timeline.TimelineSetupDataProcessor;
-import com.tyndalehouse.step.web.shared.beans.TimelineBean;
import com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand;
+import com.tyndalehouse.step.web.shared.common.TimelineBean;
import com.tyndalehouse.step.web.shared.result.GetTimelineUISetupResult;
-public class GetTimelineUISetupHandler implements
- ActionHandler<GetTimelineUISetupCommand, GetTimelineUISetupResult> {
+/**
+ * the timeline UI setup handler, which returns the initial set of data for the
+ * timeline module including the different bands, their recommended scales, etc.
+ *
+ * @author CJBurrell
+ *
+ */
+public class GetTimelineUISetupHandler extends
+ AbstractStepHandler<GetTimelineUISetupCommand, GetTimelineUISetupResult> {
/**
- * Default logger
- */
- private final Log logger;
- /**
* The step query runner to run queries against the database
*/
private final StepQueryRunner queryRunner;
+ /**
+ * Default constructor
+ *
+ * @param queryRunner a query runner
+ */
@Inject
- public GetTimelineUISetupHandler(final Log logger, final StepQueryRunner queryRunner) {
- this.logger = logger;
+ public GetTimelineUISetupHandler(final StepQueryRunner queryRunner) {
this.queryRunner = queryRunner;
}
+ // TODO: this can be cached quite succesfully on the server
@Override
- public GetTimelineUISetupResult execute(final GetTimelineUISetupCommand cmd, final ExecutionContext arg1)
- throws ActionException {
+ public GetTimelineUISetupResult execute(final GetTimelineUISetupCommand cmd,
+ final ExecutionContext arg1) throws ActionException {
try {
final List<TimelineBean> timelines = queryRunner.run(new TimelineSetupDataProcessor());
final GetTimelineUISetupResult r = new GetTimelineUISetupResult();
r.setTimelines(timelines);
- if (logger.isDebugEnabled()) {
- logger.debug(String.format("Returning %d timebands to the client.", timelines.size()));
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug(
+ String.format("Returning %d timebands to the client.", timelines.size()));
}
return r;
} catch (final UnableToRunQueryException e) {
- logger.error("An error occured while loading the config for the query", e);
+ getLogger().error("An error occured while loading the config for the query", e);
throw new ActionException(e);
}
}
- // This method is used to determine which type of command this handler
- // serves I believe...
@Override
- public Class<GetTimelineUISetupCommand> getActionType() {
- return GetTimelineUISetupCommand.class;
- }
-
- @Override
public void rollback(final GetTimelineUISetupCommand arg0, final GetTimelineUISetupResult arg1,
- final ExecutionContext arg2) throws ActionException {
- logger.error("Get Timeline UI Setup Handler rolling back");
+ final ExecutionContext arg2) throws ActionException {
+ getLogger().error("Get Timeline UI Setup Handler rolling back");
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,11 +2,9 @@
import java.util.Set;
-import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
-import org.apache.commons.logging.Log;
import org.crosswire.common.progress.JobManager;
import org.crosswire.common.progress.Progress;
import org.crosswire.jsword.book.Book;
@@ -15,28 +13,47 @@
import org.crosswire.jsword.book.install.sword.HttpSwordInstaller;
import com.google.inject.Inject;
+import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
import com.tyndalehouse.step.web.shared.command.InstallJswordModuleCommand;
import com.tyndalehouse.step.web.shared.result.InstallJswordModuleResult;
-public class InstallJswordModuleHandler implements
- ActionHandler<InstallJswordModuleCommand, InstallJswordModuleResult> {
+/**
+ * Handler that installs a JSword module (bible, etc.) on to the server (perhaps
+ * a localhost server)
+ *
+ * @author CJBurrell
+ *
+ */
+public class InstallJswordModuleHandler extends
+ AbstractStepHandler<InstallJswordModuleCommand, InstallJswordModuleResult> {
+
// TODO: move the lookup to properties file
- private final static String proxyHostProperty = "step.proxy.host";
+ /**
+ * proxy to use to access the internet from step
+ */
+ private static final String PROXY_HOST = "step.proxy.host";
- private final static String proxyPortProperty = "step.proxy.port";
/**
- * Default logger
+ * proxy port to use for accessing the internet form step
*/
- private final Log logger;
+ private static final String PROXY_PORT = "step.proxy.port";
+ /**
+ * the time to wait for installer to kick in, so that we can then wait for
+ * it
+ */
+ private static final int WAIT_TIME_FOR_INSTALLER = 2000;
+
+ /**
+ * constructor to create this handler, usually via Guice
+ */
@Inject
- public InstallJswordModuleHandler(final Log logger) {
- this.logger = logger;
+ public InstallJswordModuleHandler() {
}
@Override
public InstallJswordModuleResult execute(final InstallJswordModuleCommand cmd,
- final ExecutionContext context) throws ActionException {
+ final ExecutionContext context) throws ActionException {
final String initials = cmd.getInitials();
if (initials == null) {
@@ -52,7 +69,8 @@
// remove first
// Books.installed().removeBook(installed);
installed.getDriver().delete(installed);
- logger.debug(String.format("%s (%s) is already installed, so removing first", initials,
+ getLogger().debug(
+ String.format("%s (%s) is already installed, so removing first", initials,
installed.getName()));
}
@@ -60,12 +78,13 @@
final Book bookToBeInstalled = newCustomInstaller.getBook(initials);
newCustomInstaller.install(bookToBeInstalled);
- logger.debug(String.format("Installing %s", initials));
+ getLogger().debug(String.format("Installing %s", initials));
// finally wait for install to finish
// hack to wait for the thread to register with the manager
// TODO: check with jsword community
- Thread.sleep(2000);
+ // TODO: use a timer instead...
+ Thread.sleep(WAIT_TIME_FOR_INSTALLER);
@SuppressWarnings("unchecked")
final Set<Progress> jswordJobs = JobManager.getJobs();
@@ -75,14 +94,14 @@
// this will depend on the JSword community
while (!p.isFinished()) {
// sleep
- Thread.sleep(2000);
+ Thread.sleep(WAIT_TIME_FOR_INSTALLER);
}
}
}
} catch (final BookException e) {
- logger.error("An error occured during the installation of the book", e);
+ getLogger().error("An error occured during the installation of the book", e);
} catch (final InterruptedException e) {
- logger.error("An error occurred during the downloading of the book", e);
+ getLogger().error("An error occurred during the downloading of the book", e);
}
// wait for module to be completed
@@ -91,26 +110,28 @@
}
@Override
- public Class<InstallJswordModuleCommand> getActionType() {
- return InstallJswordModuleCommand.class;
+ public void rollback(final InstallJswordModuleCommand arg0,
+ final InstallJswordModuleResult arg1, final ExecutionContext arg2) throws ActionException {
+ getLogger().error("Rolling back InstallJswordModule");
}
- @Override
- public void rollback(final InstallJswordModuleCommand arg0, final InstallJswordModuleResult arg1,
- final ExecutionContext arg2) throws ActionException {
- logger.error("Rolling back InstallJswordModule");
- }
-
+ /**
+ * TODO: needs redoing to ensure we take all the installers provided by
+ * JSword
+ *
+ * @return a custom installer configured with the crosswire proxy
+ */
private HttpSwordInstaller getNewCustomInstaller() {
- logger.info("Creating new installer for JSword");
+ getLogger().info("Creating new installer for JSword");
final HttpSwordInstaller resourceInstaller = new HttpSwordInstaller();
- logger.info("Currently hardcoded installer host to:" + "www.crosswire.org");
- logger.info("Currently hardcoded property names for step");
+ getLogger().info("Currently hardcoded installer host to:" + "www.crosswire.org");
+ getLogger().info("Currently hardcoded property names for step");
final String host = "www.crosswire.org";
- final String proxyHost = System.getProperty(proxyHostProperty);
- final String proxyPort = System.getProperty(proxyPortProperty);
- logger.info(String.format("Setting to (%1$s via %2$s:%3$s)", "www.crosswire.org", proxyHost,
+ final String proxyHost = System.getProperty(PROXY_HOST);
+ final String proxyPort = System.getProperty(PROXY_PORT);
+ getLogger().info(
+ String.format("Setting to (%1$s via %2$s:%3$s)", "www.crosswire.org", proxyHost,
proxyPort));
resourceInstaller.setHost(host);
@@ -121,7 +142,7 @@
resourceInstaller.setProxyPort(Integer.parseInt(proxyPort));
}
- logger.info("Setting package and catalog directories");
+ getLogger().info("Setting package and catalog directories");
resourceInstaller.setPackageDirectory("/ftpmirror/pub/sword/packages/rawzip");
resourceInstaller.setCatalogDirectory("/ftpmirror/pub/sword/raw");
return resourceInstaller;
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/StepHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/StepHandler.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/StepHandler.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,29 +0,0 @@
-package com.tyndalehouse.step.web.server.handler.util;
-
-import java.lang.reflect.ParameterizedType;
-
-import net.customware.gwt.dispatch.server.ActionHandler;
-import net.customware.gwt.dispatch.shared.Action;
-import net.customware.gwt.dispatch.shared.Result;
-
-
-/**
- * To abstract away the need for declaring getActionType every time.
- * @author CJBurrell
- *
- * @param <A> the action in question
- * @param <R> the response to be sent back to the client
- */
-public abstract class StepHandler<A extends Action<R>, R extends Result> implements ActionHandler<A, R> {
- @SuppressWarnings("unchecked")
- @Override
- /**
- * returns the type of the action
- * @return the type of the action
- */
- public final Class<A> getActionType() {
- ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass();
- return (Class<A>) pt.getActualTypeArguments()[0];
- }
-
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -43,62 +43,32 @@
* @author Joe Walker [joe at eireneh dot com]
*/
public class ConfigurableHTMLConverter implements Converter {
- public ConfigurableHTMLConverter() {
+ /**
+ *
+ */
+ static final class XSLTFilter implements URIFilter {
+ @Override
+ public boolean accept(final String name) {
+ return name.endsWith(FileUtil.EXTENSION_XSLT);
+ }
}
/**
- * Get an array of the available style names for a given subject. Different
- * subjects are available for different contexts. For example - for
- * insertion into a web page we might want to use a set that had complex
- * HTML, or IE/NS specific HTML, where as a JFC HTMLDocument needs simpler
- * HTML - and special tags like the starting <HTML> tags.
- * <p>
- * If the protocol of the URL of the current directory is not file then we
- * can't use File.list to get the contents of the directory. This will
- * happen if this is being run as an applet. When we start doing that then
- * we will need to think up something smarter here. Until then we just
- * return a zero length array.
- *
- * @return An array of available style names
+ * The font to be used in OSIS->HTML generation
*/
- public String[] getStyles() {
- try {
- String search = "xsl/cswing/" + NetUtil.INDEX_FILE; //$NON-NLS-1$
- URL index = ResourceUtil.getResource(search);
- return NetUtil.listByIndexFile(NetUtil.toURI(index), new XSLTFilter());
- } catch (IOException ex) {
- return new String[0];
- }
- }
+ private static String font = "Serif-PLAIN-14"; //$NON-NLS-1$
- /*
- * (non-Javadoc)
- *
- * @seeorg.crosswire.common.xml.Converter#convert(org.crosswire.common.xml.
- * SAXEventProvider)
+ /**
+ * The stylesheet we are transforming using
*/
- public SAXEventProvider convert(SAXEventProvider xmlsep) throws TransformerException {
- try {
- String path = "xsl/cswing/" + style; //$NON-NLS-1$
- URL xslurl = ResourceUtil.getResource(path);
+ private static String style = "simple.xsl"; //$NON-NLS-1$
- TransformingSAXEventProvider tsep = new TransformingSAXEventProvider(NetUtil.toURI(xslurl), xmlsep);
- // We used to do:
- // tsep.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- // however for various reasons, now we don't but nothing seems to be
- // broken ...
- return tsep;
- } catch (MissingResourceException ex) {
- throw new TransformerException(ex);
- }
- }
-
/**
- * Accessor for the stylesheet we are transforming using
+ * ripped off JSWord: TODO: needs to be down properly
*/
- public static String getFont() {
- return font;
+ public ConfigurableHTMLConverter() {
+
}
//
@@ -122,39 +92,80 @@
/**
* Accessor for the stylesheet we are transforming using
+ *
+ * @return the font
*/
+ public static String getFont() {
+ return font;
+ }
+
+ /**
+ * Accessor for the stylesheet we are transforming using
+ *
+ * @return the resource name
+ */
public static String getResourceName() {
return style;
}
/**
* Accessor for the stylesheet we are transforming using
+ *
+ * @param style returns the resource name given a style
*/
- public static void setResourceName(String style) {
+ public static void setResourceName(final String style) {
ConfigurableHTMLConverter.style = style;
}
/**
- *
- */
- static final class XSLTFilter implements URIFilter {
- /*
- * (non-Javadoc)
- *
- * @see org.crosswire.common.util.URLFilter#accept(java.lang.String)
- */
- public boolean accept(String name) {
- return name.endsWith(FileUtil.EXTENSION_XSLT);
+ *
+ *
+ * @see org.crosswire.common.xml.Converter#convert(org.crosswire.common.xml.
+ * SAXEventProvider)
+ * @param xmlsep the sax event provider
+ * @return the converted SAX event provider
+ * @throws TransformerException thrown if something bad happens during the
+ * transformation of the xml
+ */
+ public SAXEventProvider convert(final SAXEventProvider xmlsep) throws TransformerException {
+ try {
+ final String path = "xsl/cswing/" + style; //$NON-NLS-1$
+ final URL xslurl = ResourceUtil.getResource(path);
+
+ final TransformingSAXEventProvider tsep = new TransformingSAXEventProvider(NetUtil.toURI(xslurl),
+ xmlsep);
+ // We used to do:
+ // tsep.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ // however for various reasons, now we don't but nothing seems to be
+ // broken ...
+ return tsep;
+ } catch (final MissingResourceException ex) {
+ throw new TransformerException(ex);
}
}
/**
- * The font to be used in OSIS->HTML generation
+ * Get an array of the available style names for a given subject. Different
+ * subjects are available for different contexts. For example - for
+ * insertion into a web page we might want to use a set that had complex
+ * HTML, or IE/NS specific HTML, where as a JFC HTMLDocument needs simpler
+ * HTML - and special tags like the starting <HTML> tags.
+ * <p>
+ * If the protocol of the URL of the current directory is not file then we
+ * can't use File.list to get the contents of the directory. This will
+ * happen if this is being run as an applet. When we start doing that then
+ * we will need to think up something smarter here. Until then we just
+ * return a zero length array.
+ *
+ * @return An array of available style names
*/
- private static String font = "Serif-PLAIN-14"; //$NON-NLS-1$
-
- /**
- * The stylesheet we are transforming using
- */
- private static String style = "simple.xsl"; //$NON-NLS-1$
+ public String[] getStyles() {
+ try {
+ final String search = "xsl/cswing/" + NetUtil.INDEX_FILE; //$NON-NLS-1$
+ final URL index = ResourceUtil.getResource(search);
+ return NetUtil.listByIndexFile(NetUtil.toURI(index), new XSLTFilter());
+ } catch (final IOException ex) {
+ return new String[0];
+ }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -14,7 +14,7 @@
public class GetBibleBooksCommand implements Action<GetBibleBooksCommandResult> {
/**
- *
+ * serial id
*/
private static final long serialVersionUID = 2749008090105331922L;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,6 +2,7 @@
import net.customware.gwt.dispatch.shared.Action;
+import com.tyndalehouse.step.web.shared.common.BibleTextLookupType;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
/**
@@ -27,36 +28,15 @@
private static final long serialVersionUID = -6828956918275592036L;
/**
- * whether the request is for an interlinear
+ * the biblical reference, for e.g. Gen 1:1
*/
- private boolean isInterlinear = false;
+ private String reference;
/**
- * whether the request for an interlinear is a classic interlinear
+ * type of lookup to make
*/
- private boolean isInterlinearClassic = false;
+ private BibleTextLookupType typeOfLookup;
- /**
- * whether plain text is required
- */
- private boolean isSimpleTextRequired;
-
- /**
- * the xslted form is required
- */
- private boolean isXsltRequired = false;
-
- /**
- * the logical form is required
- */
- private boolean logicalForm = false;
-
- /**
- * the biblical reference, for e.g. Gen 1:1
- */
- private String reference;
-
- // TODO: use enum instead of series of booleans
// TODO: add validation to the handler/client to ensure that
// version/interlinear matches correctly
/**
@@ -67,7 +47,6 @@
/**
* default constructor TODO: can this be made private? I think so
*/
- @SuppressWarnings("unused")
public GetCurrentBibleTextCommand() {
}
@@ -91,73 +70,20 @@
}
/**
- * @return the initials of the version to be used in the lookup
+ * @return the typeOfLookup
*/
- public String getVersion() {
- return version;
+ public final BibleTextLookupType getTypeOfLookup() {
+ return typeOfLookup;
}
/**
- * @return the isInterlinear
+ * @return the initials of the version to be used in the lookup
*/
- public boolean isInterlinear() {
- return isInterlinear;
+ public String getVersion() {
+ return version;
}
/**
- * @return the isInterlinearClassic
- */
- public boolean isInterlinearClassic() {
- return isInterlinearClassic;
- }
-
- /**
- * @return true if bean/logical-form is required
- */
- public boolean isLogicalFormRequired() {
- return this.logicalForm;
- }
-
- /**
- * @return true if plain text is required
- */
- public boolean isSimpleTextRequired() {
- return isSimpleTextRequired;
- }
-
- /**
- * @return true if the portion of scripture is to be xslt-ed after lookup
- */
- public boolean isXsltRequired() {
- return isXsltRequired;
- }
-
- /**
- * @param isInterlinear the isInterlinear to set
- */
- public void setInterlinear(final boolean isInterlinear) {
- this.isInterlinear = isInterlinear;
- }
-
- /**
- * @param isInterlinearClassic the isInterlinearClassic to set; if true,
- * then the interlinear is based on the original word order if
- * false, then interlinear is a reverse interlinear and based on
- * the English/other language
- */
- public void setInterlinearClassic(final boolean isInterlinearClassic) {
- this.isInterlinearClassic = isInterlinearClassic;
- }
-
- /**
- * @param logicalForm set to true to require a logical/bean-form back from
- * the server
- */
- public void setLogicalFormRequired(final boolean logicalForm) {
- this.logicalForm = logicalForm;
- }
-
- /**
* @param reference the reference to set
*/
public void setReference(final String reference) {
@@ -165,11 +91,10 @@
}
/**
- * @param simpleTextRequired set to true to require plain text
+ * @param typeOfLookup the typeOfLookup to set
*/
- public void setSimpleTextRequired(final boolean simpleTextRequired) {
- this.isSimpleTextRequired = simpleTextRequired;
-
+ public final void setTypeOfLookup(final BibleTextLookupType typeOfLookup) {
+ this.typeOfLookup = typeOfLookup;
}
/**
@@ -179,12 +104,4 @@
this.version = version;
}
- /**
- *
- * @param isXsltRequired set to true to require xslt transformation before
- * the end of the server call
- */
- public void setXsltRequired(final boolean isXsltRequired) {
- this.isXsltRequired = isXsltRequired;
- }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -6,14 +6,26 @@
import com.tyndalehouse.step.web.shared.result.GetDictionaryDefinitionResult;
+/**
+ * dictionary definition command, contains the references to lookup
+ *
+ * @author CJBurrell
+ *
+ */
public class GetDictionaryDefinitionCommand implements Action<GetDictionaryDefinitionResult> {
- private List<String> lookupReferencce;
-
/**
* serial id
*/
private static final long serialVersionUID = -6139208624046856543L;
+ /**
+ * references to be looked up
+ */
+ private List<String> lookupReferencce;
+
+ /**
+ * the public constructor
+ */
public GetDictionaryDefinitionCommand() {
}
@@ -26,8 +38,7 @@
}
/**
- * @param lookupReferencce
- * the lookupReferencce to set
+ * @param lookupReferences the list lookupReferencce to set
*/
public void setLookupReference(final List<String> lookupReferences) {
this.lookupReferencce = lookupReferences;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,7 +4,7 @@
import net.customware.gwt.dispatch.shared.Action;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
+import com.tyndalehouse.step.web.shared.common.TimeBandVisibleDate;
import com.tyndalehouse.step.web.shared.result.GetEventsForDateRangeResult;
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,6 +4,12 @@
import com.tyndalehouse.step.web.shared.result.GetTimelineOriginForScriptureResult;
+/**
+ * The command to retrieve the best event given a verse range
+ *
+ * @author CJBurrell
+ *
+ */
public class GetTimelineOriginForScriptureCommand implements Action<GetTimelineOriginForScriptureResult> {
/**
*
@@ -17,8 +23,10 @@
/**
* default constructor that should be used
+ *
+ * @param scriptureReference the biblical reference/range to be looked up
*/
- public GetTimelineOriginForScriptureCommand(String scriptureReference) {
+ public GetTimelineOriginForScriptureCommand(final String scriptureReference) {
this.scriptureReference = scriptureReference;
}
@@ -38,10 +46,9 @@
}
/**
- * @param scriptureReference
- * the scriptureReference to set
+ * @param scriptureReference the scriptureReference to set
*/
- public void setScriptureReference(String scriptureReference) {
+ public void setScriptureReference(final String scriptureReference) {
this.scriptureReference = scriptureReference;
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,16 +1,26 @@
package com.tyndalehouse.step.web.shared.command;
+import net.customware.gwt.dispatch.shared.Action;
+
import com.tyndalehouse.step.web.shared.result.GetTimelineUISetupResult;
-import net.customware.gwt.dispatch.shared.Action;
-
+/**
+ * command to request all the initial information useful to set up a timeline
+ * component, including the list of timebands, their recommended units, etc.
+ *
+ * @author CJBurrell
+ *
+ */
public class GetTimelineUISetupCommand implements Action<GetTimelineUISetupResult> {
/**
- *
+ * serial id
*/
private static final long serialVersionUID = 7813083800240239846L;
+ /**
+ * public constructor
+ */
public GetTimelineUISetupCommand() {
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,17 +1,30 @@
package com.tyndalehouse.step.web.shared.command;
+import net.customware.gwt.dispatch.shared.Action;
+
import com.tyndalehouse.step.web.shared.result.InstallJswordModuleResult;
-import net.customware.gwt.dispatch.shared.Action;
-
+/**
+ * Requests the server (or local server) to install a bible version
+ *
+ * @author CJBurrell
+ *
+ */
public class InstallJswordModuleCommand implements Action<InstallJswordModuleResult> {
/**
* serial id
*/
private static final long serialVersionUID = 3416377875572322721L;
+
+ /**
+ * the initials to be used to check/install the book
+ */
private String initials;
+ /**
+ * the install jsword module command constructor
+ */
public InstallJswordModuleCommand() {
}
@@ -24,10 +37,9 @@
}
/**
- * @param initials
- * the initials of the module to set
+ * @param initials the initials of the module to set
*/
- public void setInitials(String initials) {
+ public void setInitials(final String initials) {
this.initials = initials;
}
}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/BibleTextLookupType.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/BibleTextLookupType.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/BibleTextLookupType.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,20 @@
+package com.tyndalehouse.step.web.shared.common;
+
+/**
+ * This enum indicates what kind of lookup is required from the server
+ *
+ * @author CJBurrell
+ *
+ */
+public enum BibleTextLookupType {
+ /** a classic interlinear is required */
+ CLASSIC_INTERLINEAR,
+ /** a logical form, POJO form of the text is required */
+ LOGICAL,
+ /** only the text is required */
+ PLAIN_TEXT,
+ /** a reverse interlinear is required */
+ REVERSE_INTERLINEAR,
+ /** the text, using a default xslt is required */
+ XSLT,
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimeBandVisibleDate.java 2010-03-06 18:04:47 UTC (rev 97)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,124 +0,0 @@
-package com.tyndalehouse.step.web.shared.beans;
-
-import java.io.Serializable;
-
-/**
- * This object acts as a container of the current display window on an ether.
- * timebandId identifies the timeband and is associated with a minimum and a
- * maximum date which are generally used to request things off the database.
- *
- * @author cjburrell
- *
- */
-public class TimeBandVisibleDate implements Serializable {
-
- /**
- * default serial id
- */
- private static final long serialVersionUID = -7384255321830177509L;
-
- /**
- * time band id
- */
- private int timebandId;
-
- /**
- * min date visible on the time band
- */
- private long minDate;
-
- /**
- * max date visible on the timeband
- */
- private long maxDate;
-
- private boolean noRequest;
-
- private TimeBandVisibleDate() {
- }
-
- public static TimeBandVisibleDate getNoRequest() {
- TimeBandVisibleDate tvd = new TimeBandVisibleDate();
- tvd.setNoRequest(true);
- return tvd;
- }
-
- /**
- * so that
- *
- * @param timebandId
- * @param minDate
- * @param maxDate
- */
- public TimeBandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
- this.timebandId = timebandId;
- this.minDate = minDate;
- this.maxDate = maxDate;
- noRequest = false;
- }
-
- /**
- * @return the timebandId
- */
- public int getTimebandId() {
- return timebandId;
- }
-
- /**
- * @return the minDate
- */
- public long getMinDate() {
- return minDate;
- }
-
- /**
- * @return the maxDate
- */
- public long getMaxDate() {
- return maxDate;
- }
-
- /**
- * @param timebandId
- * the timebandId to set
- */
- public void setTimebandId(final int timebandId) {
- this.timebandId = timebandId;
- }
-
- /**
- * @param minDate
- * the minDate to set
- */
- public void setMinDate(long minDate) {
- this.minDate = minDate;
- }
-
- /**
- * @param maxDate
- * the maxDate to set
- */
- public void setMaxDate(long maxDate) {
- this.maxDate = maxDate;
- }
-
- /**
- * NoRequest determines whether the values in here should be sent back.
- * Perhaps we've got everything we need already, so we don't need to send
- * anything back to the server
- *
- * @return the noRequest
- */
- public boolean isNoRequest() {
- return noRequest;
- }
-
- /**
- * @param noRequest
- * the noRequest to set
- */
- public void setNoRequest(boolean noRequest) {
- this.noRequest = noRequest;
- }
-
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java (from rev 101, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimeBandVisibleDate.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimeBandVisibleDate.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,136 @@
+package com.tyndalehouse.step.web.shared.common;
+
+import java.io.Serializable;
+
+/**
+ * This object acts as a container of the current display window on an ether.
+ * timebandId identifies the timeband and is associated with a minimum and a
+ * maximum date which are generally used to request things off the database.
+ *
+ * TODO: harmonize capital letters to be TimebandVisibleDate
+ *
+ * @author cjburrell
+ *
+ */
+public class TimeBandVisibleDate implements Serializable {
+
+ /**
+ * default serial id
+ */
+ private static final long serialVersionUID = -7384255321830177509L;
+
+ /**
+ * max date visible on the timeband
+ */
+ private long maxDate;
+
+ /**
+ * min date visible on the time band
+ */
+ private long minDate;
+
+ /**
+ * true indicates no request is required on the server
+ */
+ private boolean noRequest;
+
+ /**
+ * time band id
+ */
+ private int timebandId;
+
+ /**
+ * so that
+ *
+ * @param timebandId the timebandId referred to in the module
+ * @param minDate minDate in the range of dates to ask the server
+ * @param maxDate maxDate in the range of dates to the ask the server
+ */
+ public TimeBandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
+ this.timebandId = timebandId;
+ this.minDate = minDate;
+ this.maxDate = maxDate;
+ noRequest = false;
+ }
+
+ /**
+ * removing default constructor from view of other callers. Only accessible
+ * through reflection, and therefore GWT
+ */
+ private TimeBandVisibleDate() {
+ }
+
+ /**
+ * returns a TimeBandVisibleDate object tagged to indicate no request is
+ * required on the server
+ *
+ * @return a marked TimeBandVisibleDate object, marked with a flag saying no
+ * request is required
+ */
+ public static TimeBandVisibleDate getNoRequest() {
+ final TimeBandVisibleDate tvd = new TimeBandVisibleDate();
+ tvd.setNoRequest(true);
+ return tvd;
+ }
+
+ /**
+ * @return the maxDate
+ */
+ public long getMaxDate() {
+ return maxDate;
+ }
+
+ /**
+ * @return the minDate
+ */
+ public long getMinDate() {
+ return minDate;
+ }
+
+ /**
+ * @return the timebandId
+ */
+ public int getTimebandId() {
+ return timebandId;
+ }
+
+ /**
+ * NoRequest determines whether the values in here should be sent back.
+ * Perhaps we've got everything we need already, so we don't need to send
+ * anything back to the server
+ *
+ * @return the noRequest
+ */
+ public boolean isNoRequest() {
+ return noRequest;
+ }
+
+ /**
+ * @param maxDate the maxDate to set
+ */
+ public void setMaxDate(final long maxDate) {
+ this.maxDate = maxDate;
+ }
+
+ /**
+ * @param minDate the minDate to set
+ */
+ public void setMinDate(final long minDate) {
+ this.minDate = minDate;
+ }
+
+ /**
+ * @param noRequest the noRequest to set
+ */
+ public void setNoRequest(final boolean noRequest) {
+ this.noRequest = noRequest;
+ }
+
+ /**
+ * @param timebandId the timebandId to set
+ */
+ public void setTimebandId(final int timebandId) {
+ this.timebandId = timebandId;
+ }
+
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineBean.java 2010-03-06 18:04:47 UTC (rev 97)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,113 +0,0 @@
-package com.tyndalehouse.step.web.shared.beans;
-
-import java.io.Serializable;
-
-/**
- * Timeline bean represents the different timelines on which events can be
- * found...
- *
- * @author CJBurrell
- *
- */
-public class TimelineBean implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -1734142151232501392L;
- private int timelineId;
-
- /**
- * @param timelineId
- * the timelineId to set
- */
- public void setTimelineId(int timelineId) {
- this.timelineId = timelineId;
- }
-
- /**
- * @param timelineDescription
- * the timelineDescription to set
- */
- public void setTimelineDescription(String timelineDescription) {
- this.timelineDescription = timelineDescription;
- }
-
- private String timelineDescription;
- private String unit;
-
- public TimelineBean() {
-
- }
-
- /**
- * @return the timelineId
- */
- public int getTimelineId() {
- return timelineId;
- }
-
- /**
- * @return the timelineDescription
- */
- public String getTimelineDescription() {
- return timelineDescription;
- }
-
- public void setUnit(String unit) {
- this.unit = unit;
-
- }
-
- /**
- * @return the unit
- */
- public String getUnit() {
- return unit;
- }
-
- // /**
- // * @return the minDate
- // */
- // public long getMinDate() {
- // return minDate;
- // }
- //
- // /**
- // * @param minDate the minDate to set
- // */
- // public void setMinDate(long minDate) {
- // this.minDate = minDate;
- // }
- //
- // /**
- // * @return the maxDate
- // */
- // public long getMaxDate() {
- // return maxDate;
- // }
- //
- // /**
- // * @param maxDate the maxDate to set
- // */
- // public void setMaxDate(long maxDate) {
- // this.maxDate = maxDate;
- // }
-
- // /**
- // * @return the timelineCode
- // */
- // public String getTimelineCode() {
- // return timelineCode;
- // }
- //
- // public void setEventCount(int eventCount) {
- // this.eventCount = eventCount;
- // }
- //
- // /**
- // * @return the eventCount
- // */
- // public int getEventCount() {
- // return eventCount;
- // }
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java (from rev 101, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineBean.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineBean.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,130 @@
+package com.tyndalehouse.step.web.shared.common;
+
+import java.io.Serializable;
+
+/**
+ * Timeline bean represents the different timelines on which events can be
+ * found... TODO: should this be renamed timeband?
+ *
+ * @author CJBurrell
+ *
+ */
+public class TimelineBean implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1734142151232501392L;
+
+ /**
+ * Timeline description from the server layer
+ */
+ private String timelineDescription;
+
+ /**
+ * timeline id sent across the wire
+ */
+ private int timelineId;
+
+ /**
+ * unit to be used when first display the timeband
+ */
+ private String unit;
+
+ /**
+ * default constructor made public
+ */
+ public TimelineBean() {
+
+ }
+
+ /**
+ * @return the timelineDescription
+ */
+ public String getTimelineDescription() {
+ return timelineDescription;
+ }
+
+ /**
+ * @return the timelineId
+ */
+ public int getTimelineId() {
+ return timelineId;
+ }
+
+ /**
+ * @return the unit
+ */
+ public String getUnit() {
+ return unit;
+ }
+
+ /**
+ * @param timelineDescription the timelineDescription to set
+ */
+ public void setTimelineDescription(final String timelineDescription) {
+ this.timelineDescription = timelineDescription;
+ }
+
+ /**
+ * @param timelineId the timelineId to set
+ */
+ public void setTimelineId(final int timelineId) {
+ this.timelineId = timelineId;
+ }
+
+ /**
+ * sets the unit field
+ *
+ * @param unit the unit to be set
+ */
+ public void setUnit(final String unit) {
+ this.unit = unit;
+
+ }
+
+ // /**
+ // * @return the minDate
+ // */
+ // public long getMinDate() {
+ // return minDate;
+ // }
+ //
+ // /**
+ // * @param minDate the minDate to set
+ // */
+ // public void setMinDate(long minDate) {
+ // this.minDate = minDate;
+ // }
+ //
+ // /**
+ // * @return the maxDate
+ // */
+ // public long getMaxDate() {
+ // return maxDate;
+ // }
+ //
+ // /**
+ // * @param maxDate the maxDate to set
+ // */
+ // public void setMaxDate(long maxDate) {
+ // this.maxDate = maxDate;
+ // }
+
+ // /**
+ // * @return the timelineCode
+ // */
+ // public String getTimelineCode() {
+ // return timelineCode;
+ // }
+ //
+ // public void setEventCount(int eventCount) {
+ // this.eventCount = eventCount;
+ // }
+ //
+ // /**
+ // * @return the eventCount
+ // */
+ // public int getEventCount() {
+ // return eventCount;
+ // }
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineEventBean.java 2010-03-06 18:04:47 UTC (rev 97)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,184 +0,0 @@
-package com.tyndalehouse.step.web.shared.beans;
-
-import java.io.Serializable;
-
-public class TimelineEventBean implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -7664806988001700477L;
- private int eventId;
- private Long fromDate;
- private Long toDate;
- private String fromPrecision;
- private String toPrecision;
- private String certainty;
- private int eventTypeId;
-
- private String name;
- private int timelineId;
-
- // for serialization
- public TimelineEventBean() {
-
- }
-
- /**
- *
- * @param eventId
- * @param fromDate
- * @param toDate
- * @param fromPrecision
- * @param toPrecision
- * @param name
- * @param timelineId
- * @param importanceId
- * @param certainty
- * @param eventTypeId
- */
- public TimelineEventBean(int eventId, Long fromDate, Long toDate, String fromPrecision, String toPrecision, String name, int timelineId,
- int importanceId, String certainty, int eventTypeId) {
- this.eventId = eventId;
- this.fromDate = fromDate;
- this.toDate = toDate;
- this.fromPrecision = fromPrecision;
- this.toPrecision = toPrecision;
- this.timelineId = timelineId;
- this.certainty = certainty;
- this.eventTypeId = eventTypeId;
- this.name = name;
- }
-
- /**
- * @return the eventId
- */
- public int getEventId() {
- return eventId;
- }
-
- /**
- * @param eventId
- * the eventId to set
- */
- public void setEventId(int eventId) {
- this.eventId = eventId;
- }
-
- /**
- * @return the fromDate
- */
- public Long getFromDate() {
- return fromDate;
- }
-
- /**
- * @param fromDate
- * the fromDate to set
- */
- public void setFromDate(Long fromDate) {
- this.fromDate = fromDate;
- }
-
- /**
- * @return the toDate
- */
- public Long getToDate() {
- return toDate;
- }
-
- /**
- * @param toDate
- * the toDate to set
- */
- public void setToDate(Long toDate) {
- this.toDate = toDate;
- }
-
- /**
- * @return the fromPrecision
- */
- public String getFromPrecision() {
- return fromPrecision;
- }
-
- /**
- * @param fromPrecision
- * the fromPrecision to set
- */
- public void setFromPrecision(String fromPrecision) {
- this.fromPrecision = fromPrecision;
- }
-
- /**
- * @return the toPrecision
- */
- public String getToPrecision() {
- return toPrecision;
- }
-
- /**
- * @param toPrecision
- * the toPrecision to set
- */
- public void setToPrecision(String toPrecision) {
- this.toPrecision = toPrecision;
- }
-
- /**
- * @return the certainty
- */
- public String getCertainty() {
- return certainty;
- }
-
- /**
- * @param certainty
- * the certainty to set
- */
- public void setCertainty(String certainty) {
- this.certainty = certainty;
- }
-
- /**
- * @return the eventTypeId
- */
- public int getEventTypeId() {
- return eventTypeId;
- }
-
- /**
- * @param eventTypeId
- * the eventTypeId to set
- */
- public void setEventTypeId(int eventTypeId) {
- this.eventTypeId = eventTypeId;
- }
-
- /**
- * @param name
- * the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- /**
- * @return the timelineId
- */
- public int getTimelineId() {
- return timelineId;
- }
-
- /**
- * @param timelineId
- * the timelineId to set
- */
- public void setTimelineId(int timelineId) {
- this.timelineId = timelineId;
- }
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java (from rev 101, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineEventBean.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/TimelineEventBean.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -0,0 +1,235 @@
+package com.tyndalehouse.step.web.shared.common;
+
+import java.io.Serializable;
+
+/**
+ * An Time Event bean, containing all the relevant fields passed from the server
+ * to the client. For e.g. the description of the event, its id, the dates, etc.
+ *
+ * @author cjburrell
+ *
+ */
+public class TimelineEventBean implements Serializable {
+
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -7664806988001700477L;
+
+ /**
+ * The certainty of dating, as provided in input CSV files
+ */
+ private String certainty;
+
+ /**
+ * the event id
+ */
+ private int eventId;
+
+ /**
+ * the type of the event, where we distinguish battles, from births, etc.
+ * (TODO: still to be done)
+ */
+ private int eventTypeId;
+
+ /**
+ * the from date
+ */
+ private Long fromDate;
+
+ /**
+ * how precise the date is, whether to the day, month, etc. see schema
+ * definition for details
+ */
+ private String fromPrecision;
+
+ /**
+ * Name/Description of the event
+ */
+ private String name;
+
+ /**
+ * The timeband/timeline on which the event should be displayed
+ */
+ private int timelineId;
+
+ /**
+ * the to-date in the case of a duration
+ */
+ private Long toDate;
+
+ /**
+ * the precision of the "to-date", whether to the day, month, etc. see
+ * schema definition for details
+ */
+ private String toPrecision;
+
+ /**
+ * making public
+ */
+ public TimelineEventBean() {
+
+ }
+
+ /**
+ * a constructor to set up everything in one go
+ *
+ * @param eventId the event id from the database
+ * @param fromDate the from date, at which the event starts/is
+ * @param toDate the to date, if the date is a duratio
+ * @param fromPrecision how precise the from date is (see schema for more
+ * details)
+ * @param toPrecision how precise the to date is (see schema for more
+ * details)
+ * @param name the description of the event
+ * @param timelineId the timeband on which to be located
+ * @param importanceId the importance id as defined in the input files
+ * @param certainty the certainty as defined in the input files
+ * @param eventTypeId the event type, describing different types, and
+ * therefore different representations of the event on the UI
+ *
+ */
+ // CHECKSTYLE:OFF
+ public TimelineEventBean(final int eventId, final Long fromDate, final Long toDate,
+ final String fromPrecision, final String toPrecision, final String name, final int timelineId,
+ final int importanceId, final String certainty, final int eventTypeId) {
+ // CHECKSTYLE:ON
+ this.eventId = eventId;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.fromPrecision = fromPrecision;
+ this.toPrecision = toPrecision;
+ this.timelineId = timelineId;
+ this.certainty = certainty;
+ this.eventTypeId = eventTypeId;
+ this.name = name;
+ }
+
+ /**
+ * @return the certainty
+ */
+ public String getCertainty() {
+ return certainty;
+ }
+
+ /**
+ * @return the eventId
+ */
+ public int getEventId() {
+ return eventId;
+ }
+
+ /**
+ * @return the eventTypeId
+ */
+ public int getEventTypeId() {
+ return eventTypeId;
+ }
+
+ /**
+ * @return the fromDate
+ */
+ public Long getFromDate() {
+ return fromDate;
+ }
+
+ /**
+ * @return the fromPrecision
+ */
+ public String getFromPrecision() {
+ return fromPrecision;
+ }
+
+ /**
+ * returns the name/description of the event
+ *
+ * @return the description of the event
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the timelineId
+ */
+ public int getTimelineId() {
+ return timelineId;
+ }
+
+ /**
+ * @return the toDate
+ */
+ public Long getToDate() {
+ return toDate;
+ }
+
+ /**
+ * @return the toPrecision
+ */
+ public String getToPrecision() {
+ return toPrecision;
+ }
+
+ /**
+ * @param certainty the certainty to set
+ */
+ public void setCertainty(final String certainty) {
+ this.certainty = certainty;
+ }
+
+ /**
+ * @param eventId the eventId to set
+ */
+ public void setEventId(final int eventId) {
+ this.eventId = eventId;
+ }
+
+ /**
+ * @param eventTypeId the eventTypeId to set
+ */
+ public void setEventTypeId(final int eventTypeId) {
+ this.eventTypeId = eventTypeId;
+ }
+
+ /**
+ * @param fromDate the fromDate to set
+ */
+ public void setFromDate(final Long fromDate) {
+ this.fromDate = fromDate;
+ }
+
+ /**
+ * @param fromPrecision the fromPrecision to set
+ */
+ public void setFromPrecision(final String fromPrecision) {
+ this.fromPrecision = fromPrecision;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * @param timelineId the timelineId to set
+ */
+ public void setTimelineId(final int timelineId) {
+ this.timelineId = timelineId;
+ }
+
+ /**
+ * @param toDate the toDate to set
+ */
+ public void setToDate(final Long toDate) {
+ this.toDate = toDate;
+ }
+
+ /**
+ * @param toPrecision the toPrecision to set
+ */
+ public void setToPrecision(final String toPrecision) {
+ this.toPrecision = toPrecision;
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -6,24 +6,46 @@
import net.customware.gwt.dispatch.shared.Result;
+/**
+ * Result from the GetBibleBooksCommand which contains the list of books
+ *
+ * @author CJBurrell
+ *
+ */
public class GetBibleBooksCommandResult implements Result {
/**
*
*/
private static final long serialVersionUID = -26170538247007172L;
+
+ /**
+ * the list of books
+ */
private List<String> books;
+ /**
+ * the list of bible books provided to the constructor
+ *
+ * @param books the list of books
+ */
public GetBibleBooksCommandResult(final List<String> books) {
this.books = books;
}
- // this constructor is used for reflection and must be present
+ /**
+ * this constructor is used for reflection and must be present
+ */
@SuppressWarnings("unused")
private GetBibleBooksCommandResult() {
}
+ /**
+ * returns a list of books
+ *
+ * @return the list of books
+ */
public Collection<String> getBooks() {
return Collections.unmodifiableList(books);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,14 +2,28 @@
import net.customware.gwt.dispatch.shared.Result;
+/**
+ * The dictionary definition that was looked up from the
+ * GetDictionaryDefinitionCommand
+ *
+ * @author CJBurrell
+ *
+ */
public class GetDictionaryDefinitionResult implements Result {
/**
* serial id
*/
private static final long serialVersionUID = 3121326970467885008L;
+
+ /**
+ * the xslted definition of the definition that was looked up
+ */
private String xsltedDefinition;
+ /**
+ * Default constructor
+ */
public GetDictionaryDefinitionResult() {
}
@@ -21,10 +35,13 @@
return xsltedDefinition;
}
+ /**
+ * sets the definition
+ *
+ * @param xsltedDefinition the definition to be set
+ */
public void setDefinition(final String xsltedDefinition) {
this.xsltedDefinition = xsltedDefinition;
- // TODO Auto-generated method stub
-
}
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -5,8 +5,14 @@
import net.customware.gwt.dispatch.shared.Result;
-import com.tyndalehouse.step.web.shared.beans.TimelineEventBean;
+import com.tyndalehouse.step.web.shared.common.TimelineEventBean;
+/**
+ * Result containing all events requested within a particular date range.
+ *
+ * @author CJBurrell
+ *
+ */
public class GetEventsForDateRangeResult implements Result {
/**
@@ -14,17 +20,29 @@
*/
private static final long serialVersionUID = 7118668612721569823L;
+ /** list of events */
private List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
+ /**
+ * public constructor
+ */
public GetEventsForDateRangeResult() {
}
+ /**
+ * Adds a new Event in Tim to the response
+ *
+ * @param teb the event to add to the response
+ */
public void add(final TimelineEventBean teb) {
getEvents().add(teb);
}
+ /**
+ * @return a list of events within a specified date range
+ */
public List<TimelineEventBean> getEvents() {
return events;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,20 +4,57 @@
import com.tyndalehouse.step.web.shared.timeline.Unit;
+/**
+ * Result from querying the server for the best event to use as the origin of
+ * the timeline. This event is the one that best suits the verse range provided
+ * by the user
+ *
+ * @author CJBurrell
+ *
+ */
public class GetTimelineOriginForScriptureResult implements Result {
/**
* generated serial version id
*/
private static final long serialVersionUID = 4256230588330550554L;
+
+ /**
+ * whether no data was returned, because no events matched the biblical
+ * reference
+ */
private boolean isEmpty;
+
+ /**
+ * the date of the recommended
+ */
private Long originDate;
+
+ /**
+ * the suggested timescale the UI should use
+ */
private Unit suggestedTimeScale;
+
+ /**
+ * the timeband id on which this date should be used
+ */
private int timebandId;
+ /**
+ * public constructor for this result object
+ *
+ * @param isEmpty true if no data was found
+ */
public GetTimelineOriginForScriptureResult(final boolean isEmpty) {
this.isEmpty = isEmpty;
}
+ /**
+ * another constructor to provide the correct origin information, including
+ *
+ * @param originDate the date at which the timeline should be positioned
+ * @param unit the unit that should be used for this timeband
+ * @param timebandId the timeband id
+ */
public GetTimelineOriginForScriptureResult(final Long originDate, final Unit unit, final int timebandId) {
this.originDate = originDate;
this.suggestedTimeScale = unit;
@@ -25,6 +62,9 @@
isEmpty = false;
}
+ /**
+ * private constructor, used by GWT serialisation
+ */
@SuppressWarnings("unused")
private GetTimelineOriginForScriptureResult() {
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,7 +4,7 @@
import net.customware.gwt.dispatch.shared.Result;
-import com.tyndalehouse.step.web.shared.beans.TimelineBean;
+import com.tyndalehouse.step.web.shared.common.TimelineBean;
/**
* Response from a @see
Modified: trunk/step-web-app/src/main/resources/log4j.properties
===================================================================
--- trunk/step-web-app/src/main/resources/log4j.properties 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/main/resources/log4j.properties 2010-03-16 18:49:07 UTC (rev 102)
@@ -1,5 +1,5 @@
# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1, A2
+log4j.rootLogger=DEBUG, A1, A2
# A1 is set to be a ConsoleAppender.
# A1 uses PatternLayout.
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -15,14 +15,23 @@
import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
import com.tyndalehouse.step.web.server.db.helper.TestProcessor;
+/**
+ * Tests the StepQueryRunner framework
+ *
+ * @author CJBurrell
+ *
+ */
@RunWith(JMock.class)
public class StepQueryRunnerImplTest {
- private Mockery context = new Mockery();
+ /** the mock object */
+ private final Mockery context = new Mockery();
+
+ /** tests running a query */
@Test
public void testRunQuery() throws UnableToRunQueryException {
// set up the test
- TestProcessor processor = new TestProcessor();
+ final TestProcessor processor = new TestProcessor();
final Log log = context.mock(Log.class);
context.checking(new Expectations() {
@@ -31,17 +40,23 @@
}
});
- StepQueryRunnerImpl impl = new StepQueryRunnerImpl(log);
+ final StepQueryRunnerImpl impl = new StepQueryRunnerImpl(log);
// Take an example ResultSet
- List<String> events = impl.run(processor);
+ final List<String> events = impl.run(processor);
Assert.assertNotNull(events);
Assert.assertEquals("Bantu expansion from Cameroon to Central Africa", events.get(0));
Assert.assertEquals("Events in Africa", events.get(1));
Assert.assertEquals("First date on the Mayan Long Count calendar", events.get(2));
}
+ /**
+ * tests and expects a exception to be returned
+ *
+ * @throws UnableToRunQueryException the query expected to be return on
+ * invalid query passed in
+ */
@Test(expected = UnableToRunQueryException.class)
public void testRunQueryWithNull() throws UnableToRunQueryException {
// set up the test
@@ -60,7 +75,7 @@
}
});
- StepQueryRunnerImpl impl = new StepQueryRunnerImpl(log);
+ final StepQueryRunnerImpl impl = new StepQueryRunnerImpl(log);
impl.run(null);
}
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -12,17 +12,27 @@
import com.tyndalehouse.step.web.server.db.framework.Query;
import com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor;
+/**
+ * Test processor, to test the retrieval of data from the database
+ *
+ * @author CJBurrell
+ *
+ */
public class TestProcessor implements ResultSetProcessor<String> {
+ /**
+ * simple constructor
+ */
public TestProcessor() {
}
@Override
public Map<String, Object> getParameters() {
- Map<String, Object> params = new HashMap<String, Object>();
+ final Map<String, Object> params = new HashMap<String, Object>();
params.put("event_name", "Events in Africa");
params.put("event_id", 2);
- params.put("date_of_event", (long) -160321161544388L);
+ final long l = -160321161544388L;
+ params.put("date_of_event", l);
return params;
}
@@ -32,8 +42,9 @@
}
@Override
- public List<String> process(ResultSet rs) throws MalformedStepQueryException, ConfigNotLoadedException, SQLException {
- List<String> events = new ArrayList<String>();
+ public List<String> process(final ResultSet rs) throws MalformedStepQueryException,
+ ConfigNotLoadedException, SQLException {
+ final List<String> events = new ArrayList<String>();
while (rs.next()) {
events.add(rs.getString("name"));
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -3,19 +3,25 @@
import com.tyndalehouse.step.web.server.db.framework.Query;
public enum TestQueryImpl implements Query {
+ /** a test query */
TEST_QUERY_PARAMS_DIFFERENT_TYPES("tests");
+ /**
+ * component, directory of the test queries
+ */
private final String component;
+ /**
+ * creates the enum
+ *
+ * @param component given a component/directory where the test sql script
+ * lives
+ */
TestQueryImpl(final String component) {
this.component = component;
}
- /*
- * (non-Javadoc)
- *
- * @see com.tyndalehouse.step.web.server.db.framework.Query#getComponent()
- */
+ @Override
public String getComponent() {
return component;
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -12,8 +12,15 @@
import com.tyndalehouse.step.web.server.handler.GetCurrentBibleTextHandler;
import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
+import com.tyndalehouse.step.web.shared.common.BibleTextLookupType;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
+/**
+ * Tests the handler that retrieves scripture from the server
+ *
+ * @author CJBurrell
+ *
+ */
@RunWith(JMock.class)
public class GetCurrentBibleTextHandlerTest {
/**
@@ -21,6 +28,11 @@
*/
private final Mockery context = new Mockery();
+ /**
+ * tests a greek reverse interlinear
+ *
+ * @throws ActionException exception during test
+ **/
@Test
public void testGreekReverseInterlinear() throws ActionException {
final Log log = context.mock(Log.class);
@@ -32,11 +44,9 @@
});
final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "acts 1:1");
- cmd.setLogicalFormRequired(true);
- cmd.setInterlinear(true);
- cmd.setInterlinearClassic(false);
+ cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(log);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
final GetCurrentBibleTextResult result = handler.execute(cmd, null);
Assert.assertNotNull(result.getPassage());
@@ -47,6 +57,11 @@
}
+ /**
+ * tests hebrew reverse interlinear
+ *
+ * @throws ActionException an exception during execution
+ */
@Test
public void testHebrewReverseInterlinear() throws ActionException {
final Log log = context.mock(Log.class);
@@ -58,11 +73,9 @@
});
final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "Gen 1:1");
- cmd.setLogicalFormRequired(true);
- cmd.setInterlinear(true);
- cmd.setInterlinearClassic(false);
+ cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(log);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
final GetCurrentBibleTextResult result = handler.execute(cmd, null);
Assert.assertNotNull(result.getPassage());
@@ -73,6 +86,11 @@
}
+ /**
+ * tests a logical lookup of the passage, as opposed to plain text
+ *
+ * @throws ActionException exception during running
+ */
@Test
public void testLogicalPassage() throws ActionException {
final Log log = context.mock(Log.class);
@@ -84,14 +102,20 @@
});
final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
- cmd.setLogicalFormRequired(true);
+ cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(log);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
final GetCurrentBibleTextResult result = handler.execute(cmd, null);
- Assert.assertEquals(result.getPassage().getText(), "In the beginning, God created the heavens and the earth.");
+ Assert.assertEquals(result.getPassage().getText(),
+ "In the beginning, God created the heavens and the earth.");
}
+ /**
+ * An lookup for plain text
+ *
+ * @throws ActionException exception during the retrieval of the text
+ */
@Test
public void testLookupText() throws ActionException {
final Log log = context.mock(Log.class);
@@ -103,12 +127,12 @@
});
final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
- cmd.setSimpleTextRequired(true);
+ cmd.setTypeOfLookup(BibleTextLookupType.PLAIN_TEXT);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(log);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
final GetCurrentBibleTextResult result = handler.execute(cmd, null);
- Assert.assertEquals(result.getPassageText(), "In the beginning, God created the heavens and the earth.");
+ Assert.assertEquals(result.getPassageText(),
+ "In the beginning, God created the heavens and the earth.");
}
-
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -4,7 +4,6 @@
import java.util.List;
import junit.framework.Assert;
-
import net.customware.gwt.dispatch.shared.ActionException;
import org.apache.commons.logging.Log;
@@ -18,21 +17,32 @@
import com.tyndalehouse.step.web.shared.command.GetDictionaryDefinitionCommand;
import com.tyndalehouse.step.web.shared.result.GetDictionaryDefinitionResult;
+/**
+ * Tests the retrieval of a dictionary definition from a dictionary module
+ *
+ * @author CJBurrell
+ *
+ */
@RunWith(JMock.class)
public class GetDictionaryDefinitionHandlerTest {
/**
* The standard context for mocking objects
*/
-private Mockery context = new Mockery();
+ private final Mockery context = new Mockery();
// TODO: add test to ensure that we have a negative,
// what happens when we lookup a reference that doesn't exist
// at the moment we get a false positive
+ /**
+ * looks up some text for two references, one greek, one hebrew
+ *
+ * @throws ActionException an exception during execution of the test
+ */
@Test
public void testLookupText() throws ActionException {
- List<String> lookupReferences = new ArrayList<String>();
+ final List<String> lookupReferences = new ArrayList<String>();
lookupReferences.add("strong:G00051");
lookupReferences.add("strong:H00052");
@@ -46,8 +56,8 @@
final GetDictionaryDefinitionCommand cmd = new GetDictionaryDefinitionCommand();
cmd.setLookupReference(lookupReferences);
- GetDictionaryDefinitionHandler handler = new GetDictionaryDefinitionHandler(log);
- GetDictionaryDefinitionResult result = handler.execute(cmd, null);
+ final GetDictionaryDefinitionHandler handler = new GetDictionaryDefinitionHandler();
+ final GetDictionaryDefinitionResult result = handler.execute(cmd, null);
Assert.assertTrue(result.getXsltedDefinition().contains(">00051<"));
Assert.assertTrue(result.getXsltedDefinition().contains("Abshay"));
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -13,18 +13,29 @@
import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
import com.tyndalehouse.step.web.server.handler.GetTimelineUISetupHandler;
-import com.tyndalehouse.step.web.shared.beans.TimelineBean;
+import com.tyndalehouse.step.web.shared.common.TimelineBean;
+/**
+ * Testing the timeline setup handler
+ *
+ * @author CJBurrell
+ *
+ */
@RunWith(JMock.class)
public class GetTimelineUISetupHandlerTest {
/**
* The standard context for mocking objects
*/
-private Mockery context = new Mockery();
+ private final Mockery context = new Mockery();
+ /**
+ * looks up
+ *
+ * @throws ActionException an exception during the running
+ */
@Test
- public void testLookupText() throws ActionException {
+ public void testTimelineUIHandler() throws ActionException {
final Log log = context.mock(Log.class);
context.checking(new Expectations() {
@@ -41,7 +52,7 @@
}
});
- new GetTimelineUISetupHandler(log, runner).execute(null, null);
+ new GetTimelineUISetupHandler(runner).execute(null, null);
// this test is purely to check we are not calling the database more
// than is required.
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java 2010-03-10 20:00:45 UTC (rev 101)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java 2010-03-16 18:49:07 UTC (rev 102)
@@ -2,10 +2,8 @@
import net.customware.gwt.dispatch.shared.ActionException;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.impl.Log4JLogger;
import org.crosswire.jsword.book.Books;
-import org.jmock.Mockery;
import org.jmock.integration.junit4.JMock;
import org.junit.Assert;
import org.junit.Test;
@@ -15,23 +13,28 @@
import com.tyndalehouse.step.web.shared.command.InstallJswordModuleCommand;
import com.tyndalehouse.step.web.shared.result.InstallJswordModuleResult;
+/**
+ * Tests JSword installation handler
+ *
+ * @author CJBurrell
+ *
+ */
@RunWith(JMock.class)
public class JSwordInstallTest {
-
/**
- * The standard context for mocking objects
+ * tests the installation of a bible version from JSword/crosswire.org
+ *
+ * @throws ActionException an exception during execution of the tests
*/
- private Mockery context = new Mockery();
-
@Test
public void testInstallESV() throws ActionException {
- final Log log = new Log4JLogger("TestInstallEsv");
+ new Log4JLogger("TestInstallEsv");
final String initials = "ESV";
final InstallJswordModuleCommand cmd = new InstallJswordModuleCommand();
cmd.setInitials(initials);
- InstallJswordModuleHandler ijmh = new InstallJswordModuleHandler(log);
- InstallJswordModuleResult result = ijmh.execute(cmd, null);
+ final InstallJswordModuleHandler ijmh = new InstallJswordModuleHandler();
+ final InstallJswordModuleResult result = ijmh.execute(cmd, null);
Assert.assertTrue(result.isSuccessful());
Assert.assertTrue(Books.installed().getBook(initials) != null);
More information about the Tynstep-svn
mailing list