diff --git a/.baseline/checkstyle/checkstyle-suppressions.xml b/.baseline/checkstyle/checkstyle-suppressions.xml
new file mode 100644
index 00000000000..fb0d88a8b99
--- /dev/null
+++ b/.baseline/checkstyle/checkstyle-suppressions.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.baseline/checkstyle/checkstyle.xml b/.baseline/checkstyle/checkstyle.xml
new file mode 100644
index 00000000000..6f7e1c7ef3e
--- /dev/null
+++ b/.baseline/checkstyle/checkstyle.xml
@@ -0,0 +1,402 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.baseline/copyright/bsd-3.txt b/.baseline/copyright/bsd-3.txt
new file mode 100644
index 00000000000..95faa57bd2b
--- /dev/null
+++ b/.baseline/copyright/bsd-3.txt
@@ -0,0 +1,13 @@
+Copyright ${today.year} Palantir Technologies
+
+Licensed under the BSD-3 License (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://opensource.org/licenses/BSD-3-Clause
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/.baseline/eclipse/dynamic/dotfile.checkstyle b/.baseline/eclipse/dynamic/dotfile.checkstyle
new file mode 100644
index 00000000000..c176af2f34e
--- /dev/null
+++ b/.baseline/eclipse/dynamic/dotfile.checkstyle
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.baseline/eclipse/dynamic/dotfile.settings/edu.umd.cs.findbugs.core.prefs b/.baseline/eclipse/dynamic/dotfile.settings/edu.umd.cs.findbugs.core.prefs
new file mode 100644
index 00000000000..353d91daf5f
--- /dev/null
+++ b/.baseline/eclipse/dynamic/dotfile.settings/edu.umd.cs.findbugs.core.prefs
@@ -0,0 +1,171 @@
+#FindBugs User Preferences
+#Sun Mar 02 18:15:35 EST 2014
+cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
+detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
+detectorAtomicityProblem=AtomicityProblem|true
+detectorBadAppletConstructor=BadAppletConstructor|false
+detectorBadResultSetAccess=BadResultSetAccess|true
+detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
+detectorBadUseOfReturnValue=BadUseOfReturnValue|true
+detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
+detectorBooleanReturnNull=BooleanReturnNull|true
+detectorBuildInterproceduralCallGraph=BuildInterproceduralCallGraph|false
+detectorBuildObligationPolicyDatabase=BuildObligationPolicyDatabase|true
+detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false
+detectorCalledMethods=CalledMethods|true
+detectorCheckCalls=CheckCalls|false
+detectorCheckExpectedWarnings=CheckExpectedWarnings|false
+detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
+detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true
+detectorCheckTypeQualifiers=CheckTypeQualifiers|true
+detectorCloneIdiom=CloneIdiom|true
+detectorComparatorIdiom=ComparatorIdiom|true
+detectorConfusedInheritance=ConfusedInheritance|true
+detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
+detectorCovariantArrayAssignment=CovariantArrayAssignment|false
+detectorCrossSiteScripting=CrossSiteScripting|true
+detectorDefaultEncodingDetector=DefaultEncodingDetector|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
+detectorExplicitSerialization=ExplicitSerialization|true
+detectorFieldItemSummary=FieldItemSummary|true
+detectorFinalizerNullsFields=FinalizerNullsFields|true
+detectorFindBadCast2=FindBadCast2|true
+detectorFindBadForLoop=FindBadForLoop|true
+detectorFindBugsSummaryStats=FindBugsSummaryStats|true
+detectorFindCircularDependencies=FindCircularDependencies|false
+detectorFindComparatorProblems=FindComparatorProblems|true
+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
+detectorFindNonShortCircuit=FindNonShortCircuit|true
+detectorFindNullDeref=FindNullDeref|true
+detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
+detectorFindOpenStream=FindOpenStream|true
+detectorFindPuzzlers=FindPuzzlers|true
+detectorFindRefComparison=FindRefComparison|true
+detectorFindReturnRef=FindReturnRef|true
+detectorFindRoughConstants=FindRoughConstants|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
+detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true
+detectorFindUselessControlFlow=FindUselessControlFlow|true
+detectorFindUselessObjects=FindUselessObjects|true
+detectorFormatStringChecker=FormatStringChecker|true
+detectorFunctionsThatMightBeMistakenForProcedures=FunctionsThatMightBeMistakenForProcedures|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
+detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
+detectorInitializationChain=InitializationChain|true
+detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true
+detectorInstantiateStaticClass=InstantiateStaticClass|true
+detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true
+detectorInvalidJUnitTest=InvalidJUnitTest|true
+detectorIteratorIdioms=IteratorIdioms|true
+detectorLazyInit=LazyInit|true
+detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
+detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
+detectorMethodReturnCheck=MethodReturnCheck|true
+detectorMethods=Methods|true
+detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
+detectorMutableEnum=MutableEnum|true
+detectorMutableLock=MutableLock|true
+detectorMutableStaticFields=MutableStaticFields|true
+detectorNaming=Naming|true
+detectorNoise=Noise|false
+detectorNoiseNullDeref=NoiseNullDeref|false
+detectorNoteAnnotationRetention=NoteAnnotationRetention|true
+detectorNoteCheckReturnValueAnnotations=NoteCheckReturnValueAnnotations|true
+detectorNoteDirectlyRelevantTypeQualifiers=NoteDirectlyRelevantTypeQualifiers|true
+detectorNoteJCIPAnnotation=NoteJCIPAnnotation|true
+detectorNoteNonNullAnnotations=NoteNonNullAnnotations|true
+detectorNoteNonnullReturnValues=NoteNonnullReturnValues|true
+detectorNoteSuppressedWarnings=NoteSuppressedWarnings|true
+detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true
+detectorNumberConstructor=NumberConstructor|true
+detectorOptionalReturnNull=OptionalReturnNull|true
+detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
+detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
+detectorPublicSemaphores=PublicSemaphores|false
+detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
+detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
+detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
+detectorRedundantConditions=RedundantConditions|true
+detectorRedundantInterfaces=RedundantInterfaces|true
+detectorReflectiveClasses=ReflectiveClasses|true
+detectorRepeatedConditionals=RepeatedConditionals|true
+detectorResolveAllReferences=ResolveAllReferences|false
+detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
+detectorSerializableIdiom=SerializableIdiom|true
+detectorStartInConstructor=StartInConstructor|true
+detectorStaticCalendarDetector=StaticCalendarDetector|true
+detectorStringConcatenation=StringConcatenation|true
+detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
+detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
+detectorSwitchFallthrough=SwitchFallthrough|true
+detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true
+detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
+detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
+detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
+detectorTestASM=TestASM|false
+detectorTestDataflowAnalysis=TestDataflowAnalysis|false
+detectorTestingGround=TestingGround|false
+detectorTestingGround2=TestingGround2|false
+detectorTrainFieldStoreTypes=TrainFieldStoreTypes|true
+detectorTrainLongInstantfParams=TrainLongInstantfParams|true
+detectorTrainNonNullAnnotations=TrainNonNullAnnotations|true
+detectorTrainUnconditionalDerefParams=TrainUnconditionalDerefParams|true
+detectorURLProblems=URLProblems|true
+detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
+detectorUnnecessaryMath=UnnecessaryMath|true
+detectorUnreadFields=UnreadFields|true
+detectorUselessSubclassMethod=UselessSubclassMethod|true
+detectorVarArgsProblems=VarArgsProblems|true
+detectorVolatileUsage=VolatileUsage|true
+detectorWaitInLoop=WaitInLoop|true
+detectorWrongMapIterator=WrongMapIterator|true
+detectorXMLFactoryBypass=XMLFactoryBypass|true
+detector_threshold=2
+effort=max
+excludefilter0=${configDir}/findbugs/excludeFilter.xml|true
+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20
+filter_settings_neg=NOISE|
+plugin0=edu.umd.cs.findbugs.plugins.findbugsCommunalCloud|false
+plugin1=edu.umd.cs.findbugs.plugins.webCloud|false
+run_at_full_build=true
diff --git a/.baseline/eclipse/org.eclipse.jdt.core.prefs b/.baseline/eclipse/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..dc125f1d3f9
--- /dev/null
+++ b/.baseline/eclipse/org.eclipse.jdt.core.prefs
@@ -0,0 +1,313 @@
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
+org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.CheckForNull
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=${javaTargetVersion}
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=${javaTargetVersion}
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
+org.eclipse.jdt.core.compiler.processAnnotations=enabled
+org.eclipse.jdt.core.compiler.source=${javaSourceVersion}
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=32
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+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=120
+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
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/.baseline/eclipse/static/dotfile.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs b/.baseline/eclipse/static/dotfile.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs
new file mode 100644
index 00000000000..c513986b8b7
--- /dev/null
+++ b/.baseline/eclipse/static/dotfile.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerOfConcern=Warning
+edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerScariest=Error
+edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerScary=Warning
+edu.umd.cs.findbugs.plugin.eclipse.findbugsMarkerTroubling=Warning
diff --git a/.baseline/eclipse/static/dotfile.settings/org.eclipse.jdt.ui.prefs b/.baseline/eclipse/static/dotfile.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..e39f3fb909b
--- /dev/null
+++ b/.baseline/eclipse/static/dotfile.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,66 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Baseline Profile
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=false
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * ${tags}\n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n *//*\n * Copyright 2016 Palantir Technologies, Inc. All rights reserved.\n */\n\n${package_declaration}\n\n/**\n * \n */\n${typecomment}\n${type_declaration}\n\n\n\nthrow new RuntimeException(${exception_var});${body_statement}${body_statement}return ${field};${field} \= ${param};
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/.baseline/findbugs/excludeFilter.xml b/.baseline/findbugs/excludeFilter.xml
new file mode 100644
index 00000000000..5153e28525f
--- /dev/null
+++ b/.baseline/findbugs/excludeFilter.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.baseline/idea/intellij-java-palantir-style.xml b/.baseline/idea/intellij-java-palantir-style.xml
new file mode 100644
index 00000000000..6ced7a62630
--- /dev/null
+++ b/.baseline/idea/intellij-java-palantir-style.xml
@@ -0,0 +1,468 @@
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index d7e4ffb4e8b..f769a9870ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,13 +6,14 @@ Thumbs.db
*.swo
*.swn
*.log
-*.prefs
*.class
*.profile
*.iml
*.ipr
*.iws
fix-ivy.py
+.idea
+.checkstyle
.classpath
.ecbuild
.settings/
@@ -22,6 +23,7 @@ docs/build/
.gradle
bin/
userdict.txt
+.apt_generated/
generated_src/
generated_testSrc/
.factorypath
diff --git a/README.md b/README.md
index 12a29b9b5d6..26186282f0e 100644
--- a/README.md
+++ b/README.md
@@ -4,3 +4,6 @@
See more at [http://palantir.github.io/atlasdb/](http://palantir.github.io/atlasdb/).
We use [ZenHub](https://www.zenhub.io/) for tracking our work inside github. If you would like to better understand our progress/priorities we recommend installing the browser plugin.
+
+## Contributing
+Please see our docs on [Contributing to AtlasDB](http://palantir.github.io/atlasdb/html/miscellaneous/contributing.html)
\ No newline at end of file
diff --git a/atlasdb-api/build.gradle b/atlasdb-api/build.gradle
index 99b9d3a65ed..6046b8e1f23 100644
--- a/atlasdb-api/build.gradle
+++ b/atlasdb-api/build.gradle
@@ -1,10 +1,25 @@
+apply plugin: 'org.inferred.processors'
+
apply from: "../gradle/shared.gradle"
dependencies {
compile(project(":atlasdb-commons"))
+ compile(project(":timestamp-api"))
compile 'javax.ws.rs:javax.ws.rs-api:2.0.1'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:' + libVersions.jackson_annotation
+
+ processor 'org.immutables:value:2.0.21'
+ compile 'com.fasterxml.jackson.core:jackson-databind:' + libVersions.jackson
+ compile 'javax.validation:validation-api:1.1.0.Final'
+
+
+ testCompile(group: 'junit', name: 'junit', version: libVersions.junit) {
+ exclude group: 'org.hamcrest'
+ }
+
+ testCompile 'org.hamcrest:hamcrest-core:' + libVersions.hamcrest
+ testCompile 'org.hamcrest:hamcrest-library:' + libVersions.hamcrest
}
task versionInfo << {
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/cleaner/api/OnCleanupTask.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/cleaner/api/OnCleanupTask.java
index 4fe86a94961..412b934ca68 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/cleaner/api/OnCleanupTask.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/cleaner/api/OnCleanupTask.java
@@ -40,7 +40,8 @@ public interface OnCleanupTask {
*
* If the current transaction fills up this method should return true and it will be called
* again with a fresh transaction. This is useful if a large cleanup is needed.
- * @return true if this method should be called again with a fresh transaction.
+ *
+ * @return true if this method should be called again with a fresh transaction
*/
- boolean cellsCleanedUp(Transaction t, Set cells);
+ boolean cellsCleanedUp(Transaction transaction, Set cells);
}
diff --git a/atlasdb-config/src/main/java/com/palantir/atlasdb/config/LeaderConfig.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/config/LeaderConfig.java
similarity index 70%
rename from atlasdb-config/src/main/java/com/palantir/atlasdb/config/LeaderConfig.java
rename to atlasdb-api/src/main/java/com/palantir/atlasdb/config/LeaderConfig.java
index 57d39a5b146..b53af7281dd 100644
--- a/atlasdb-config/src/main/java/com/palantir/atlasdb/config/LeaderConfig.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/config/LeaderConfig.java
@@ -22,6 +22,7 @@
import org.immutables.value.Value;
+import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.base.Preconditions;
@@ -45,26 +46,41 @@ public File acceptorLogDir() {
public abstract String localServer();
- @Size(min=1)
+ @Size(min = 1)
public abstract Set leaders();
+ @JsonProperty("lockCreator")
+ @Value.Default
+ public String lockCreator() {
+ return leaders().stream()
+ .sorted()
+ .findFirst()
+ .orElseThrow(() -> new IllegalStateException("The leaders block cannot be empty"));
+ }
+
@Value.Default
public long pingRateMs() {
- return 5000l;
+ return 5000L;
}
@Value.Default
public long randomWaitBeforeProposingLeadershipMs() {
- return 1000l;
+ return 1000L;
}
@Value.Default
public long leaderPingResponseWaitMs() {
- return 5000l;
+ return 5000L;
}
@Value.Check
protected final void check() {
+ Preconditions.checkState(quorumSize() > leaders().size() / 2,
+ "The quorumSize '%s' must be over half the amount of leader entries %s.", quorumSize(), leaders());
+ Preconditions.checkState(leaders().size() >= quorumSize(),
+ "The quorumSize '%s' must be less than or equal to the amount of leader entries %s.",
+ quorumSize(), leaders());
+
Preconditions.checkArgument(leaders().contains(localServer()),
"The localServer '%s' must included in the leader entries %s.", localServer(), leaders());
Preconditions.checkArgument(learnerLogDir().exists() || learnerLogDir().mkdirs(),
@@ -73,4 +89,8 @@ protected final void check() {
"Acceptor log directory '%s' does not exist and cannot be created.", acceptorLogDir());
}
+ @Value.Derived
+ public LockLeader whoIsTheLockLeader() {
+ return LockLeader.fromBoolean(lockCreator().equals(localServer()));
+ }
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/config/LockLeader.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/config/LockLeader.java
new file mode 100644
index 00000000000..b6d9a3896de
--- /dev/null
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/config/LockLeader.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2016 Palantir Technologies
+ *
+ * Licensed under the BSD-3 License (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/BSD-3-Clause
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.palantir.atlasdb.config;
+
+public enum LockLeader {
+ SOMEONE_ELSE_IS_THE_LOCK_LEADER,
+ I_AM_THE_LOCK_LEADER;
+
+ public static LockLeader fromBoolean(boolean isLockLeader) {
+ return isLockLeader ? LockLeader.I_AM_THE_LOCK_LEADER : LockLeader.SOMEONE_ELSE_IS_THE_LOCK_LEADER;
+ }
+}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/encoding/PtBytes.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/encoding/PtBytes.java
index 0706abcac4b..a387c9a452d 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/encoding/PtBytes.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/encoding/PtBytes.java
@@ -15,7 +15,8 @@
*/
package com.palantir.atlasdb.encoding;
-import com.google.common.base.Charsets;
+import java.nio.charset.StandardCharsets;
+
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.cache.Cache;
@@ -67,56 +68,56 @@ public static byte[] toBytes(long val) {
/**
* Converts a string to a UTF-8 byte array.
*/
- public static byte[] toBytes(String s) {
- return s.getBytes(Charsets.UTF_8);
+ public static byte[] toBytes(String str) {
+ return str.getBytes(StandardCharsets.UTF_8);
}
/**
* Converts a string to a UTF-8 byte array. This method will cache results and return cached
* results, so the resulting byte arrays must not be modified.
*/
- public static byte[] toCachedBytes(String s) {
- byte[] bytes = cache.getIfPresent(s);
+ public static byte[] toCachedBytes(String str) {
+ byte[] bytes = cache.getIfPresent(str);
if (bytes == null) {
- bytes = toBytes(s);
- cache.put(s, bytes);
+ bytes = toBytes(str);
+ cache.put(str, bytes);
}
return bytes;
}
- public static byte[] tail(final byte[] a, final int length) {
- if (a.length < length) {
+ public static byte[] tail(final byte[] arr, final int length) {
+ if (arr.length < length) {
return null;
}
byte[] result = new byte[length];
- System.arraycopy(a, a.length - length, result, 0, length);
+ System.arraycopy(arr, arr.length - length, result, 0, length);
return result;
}
- public static byte[] head(final byte[] a, final int length) {
- if (a.length < length) {
+ public static byte[] head(final byte[] arr, final int length) {
+ if (arr.length < length) {
return null;
}
byte[] result = new byte[length];
- System.arraycopy(a, 0, result, 0, length);
+ System.arraycopy(arr, 0, result, 0, length);
return result;
}
- public static String toString(final byte[] b) {
- if (b == null) {
+ public static String toString(final byte[] arr) {
+ if (arr == null) {
return null;
}
- return toString(b, 0, b.length);
+ return toString(arr, 0, arr.length);
}
- public static String toString(final byte[] b, int off, int len) {
- if (b == null) {
+ public static String toString(final byte[] arr, int off, int len) {
+ if (arr == null) {
return null;
}
if (len == 0) {
return "";
}
- return new String(b, off, len, Charsets.UTF_8);
+ return new String(arr, off, len, StandardCharsets.UTF_8);
}
public static String encodeHexString(byte[] name) {
@@ -126,12 +127,7 @@ public static String encodeHexString(byte[] name) {
return BaseEncoding.base16().lowerCase().encode(name);
}
- public static final Function BYTES_TO_HEX_STRING = new Function() {
- @Override
- public String apply(byte[] input) {
- return encodeHexString(input);
- }
- };
+ public static final Function BYTES_TO_HEX_STRING = PtBytes::encodeHexString;
public static void addIfNotEmpty(MoreObjects.ToStringHelper helper, String name, byte[] bytes) {
if (bytes != null && bytes.length > 0) {
@@ -167,7 +163,9 @@ public static boolean startsWith(byte[] bytes, byte[] prefix) {
}
/**
- * @return 0 if equal, < 0 if left is less than right, etc.
+ * Compare two byte arrays.
+ *
+ * @return 0 if equal, < 0 if left is less than right, etc
*/
public static int compareTo(final byte[] left, final byte[] right) {
return UnsignedBytes.lexicographicalComparator().compare(left, right);
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Cell.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Cell.java
index 7c156a2640a..1ff819f59c6 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Cell.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Cell.java
@@ -59,7 +59,7 @@ public static Cell create(byte[] rowName, byte[] columnName, long ttlDuration, T
}
public static boolean isNameValid(byte[] name) {
- return name != null && name.length >0 && name.length <= MAX_NAME_LENGTH;
+ return name != null && name.length > 0 && name.length <= MAX_NAME_LENGTH;
}
public static void validateNameValid(byte[] name) {
@@ -116,18 +116,15 @@ private static long safeTimeConvert(long ttl, TimeUnit ttlUnit) {
}
}
- public static final Function IS_EXPIRING = new Function() {
- @Override
- public Boolean apply(Cell from) {
- return from.getTtlDurationMillis() != INVALID_TTL;
- }
- };
+ public static final Function IS_EXPIRING = from -> from.getTtlDurationMillis() != INVALID_TTL;
@Override
- public int compareTo(Cell o) {
- int cmp = UnsignedBytes.lexicographicalComparator().compare(rowName, o.rowName);
- if (cmp != 0) { return cmp; }
- return UnsignedBytes.lexicographicalComparator().compare(columnName, o.columnName);
+ public int compareTo(Cell other) {
+ int cmp = UnsignedBytes.lexicographicalComparator().compare(rowName, other.rowName);
+ if (cmp != 0) {
+ return cmp;
+ }
+ return UnsignedBytes.lexicographicalComparator().compare(columnName, other.columnName);
}
@Override
@@ -135,7 +132,7 @@ public boolean equals(Object obj) {
if (!(obj instanceof Cell)) {
return false;
}
- Cell other = (Cell)obj;
+ Cell other = (Cell) obj;
return Arrays.equals(rowName, other.rowName)
&& Arrays.equals(columnName, other.columnName);
}
@@ -158,7 +155,7 @@ public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("rowName", PtBytes.encodeHexString(rowName))
.add("columnName", PtBytes.encodeHexString(columnName))
- .addValue(((ttlDurationMillis == INVALID_TTL) ? "no TTL" : "ttlDurationMillis=" + ttlDurationMillis))
+ .addValue((ttlDurationMillis == INVALID_TTL) ? "no TTL" : "ttlDurationMillis=" + ttlDurationMillis)
.toString();
}
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnRangeSelection.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnRangeSelection.java
new file mode 100644
index 00000000000..bbe7285afdf
--- /dev/null
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnRangeSelection.java
@@ -0,0 +1,96 @@
+/**
+ * Copyright 2015 Palantir Technologies
+ *
+ * Licensed under the BSD-3 License (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/BSD-3-Clause
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.palantir.atlasdb.keyvalue.api;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.regex.Pattern;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Joiner;
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableList;
+import com.palantir.atlasdb.encoding.PtBytes;
+
+public class ColumnRangeSelection implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ // Inclusive start column name.
+ private final byte[] startCol;
+ // Exclusive end column name.
+ private final byte[] endCol;
+ private final int batchHint;
+
+ @JsonCreator
+ public ColumnRangeSelection(@JsonProperty("startInclusive") byte[] startCol,
+ @JsonProperty("endExclusive") byte[] endCol,
+ @JsonProperty("batchHint") int batchHint) {
+ this.startCol = MoreObjects.firstNonNull(startCol, PtBytes.EMPTY_BYTE_ARRAY);
+ this.endCol = MoreObjects.firstNonNull(endCol, PtBytes.EMPTY_BYTE_ARRAY);
+ this.batchHint = batchHint;
+ }
+
+ public byte[] getStartCol() {
+ return startCol;
+ }
+
+ public byte[] getEndCol() {
+ return endCol;
+ }
+
+ public int getBatchHint() {
+ return batchHint;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ ColumnRangeSelection that = (ColumnRangeSelection) obj;
+ return batchHint == that.batchHint
+ && Arrays.equals(startCol, that.startCol)
+ && Arrays.equals(endCol, that.endCol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(Arrays.hashCode(startCol), Arrays.hashCode(endCol), batchHint);
+ }
+
+ private static final Pattern deserializeRegex = Pattern.compile("\\s*,\\s*");
+
+ public static ColumnRangeSelection valueOf(String serialized) {
+ String[] split = deserializeRegex.split(serialized);
+ byte[] startCol = PtBytes.decodeBase64(split[0]);
+ byte[] endCol = PtBytes.decodeBase64(split[1]);
+ int batchHint = Integer.parseInt(split[2]);
+ return new ColumnRangeSelection(startCol, endCol, batchHint);
+ }
+
+ @Override
+ public String toString() {
+ String start = PtBytes.encodeBase64String(startCol);
+ String end = PtBytes.encodeBase64String(endCol);
+ String batch = String.valueOf(batchHint);
+ return Joiner.on(',').join(ImmutableList.of(start, end, batch));
+ }
+}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnRangeSelections.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnRangeSelections.java
new file mode 100644
index 00000000000..7e8b2c495fd
--- /dev/null
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnRangeSelections.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2015 Palantir Technologies
+ *
+ * Licensed under the BSD-3 License (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://opensource.org/licenses/BSD-3-Clause
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.palantir.atlasdb.keyvalue.api;
+
+import java.io.Serializable;
+
+import com.google.common.base.Preconditions;
+import com.palantir.common.persist.Persistable;
+
+public final class ColumnRangeSelections implements Serializable {
+ private ColumnRangeSelections() {
+ // Utility class
+ }
+
+ public static ColumnRangeSelection createPrefixRange(byte[] prefix, int batchSize) {
+ byte[] startCol = Preconditions.checkNotNull(prefix, "prefix cannot be null").clone();
+ byte[] endCol = RangeRequests.createEndNameForPrefixScan(prefix);
+ return new ColumnRangeSelection(startCol, endCol, batchSize);
+ }
+
+ public static ColumnRangeSelection createPrefixRange(Persistable persistable, int batchSize) {
+ return createPrefixRange(persistable.persistToBytes(), batchSize);
+ }
+}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnSelection.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnSelection.java
index 335249be441..0ce6d6f6c33 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnSelection.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ColumnSelection.java
@@ -21,7 +21,6 @@
import java.util.Set;
import java.util.SortedSet;
-import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSortedSet;
@@ -30,7 +29,7 @@
import com.google.common.primitives.UnsignedBytes;
import com.palantir.atlasdb.encoding.PtBytes;
-public class ColumnSelection implements Serializable {
+public final class ColumnSelection implements Serializable {
private static final long serialVersionUID = 1L;
private static final ColumnSelection allColumnsSelected = new ColumnSelection(null);
@@ -44,12 +43,12 @@ private ColumnSelection(SortedSet selectedColumns) {
public static ColumnSelection valueOf(String serialized) {
Set columns = Sets.newTreeSet(UnsignedBytes.lexicographicalComparator());
- for (String strColumn : serialized.split("\\s*,\\s*")) {
- strColumn = strColumn.trim();
- if (strColumn.equals("")) {
+ for (String columnString : serialized.split("\\s*,\\s*")) {
+ String trimmedColumnString = columnString.trim();
+ if (trimmedColumnString.isEmpty()) {
continue;
}
- byte[] column = PtBytes.decodeBase64(strColumn);
+ byte[] column = PtBytes.decodeBase64(trimmedColumnString);
assert !columns.contains(column);
columns.add(column);
}
@@ -64,13 +63,8 @@ public String toString() {
if (selectedColumns == null) {
return "";
}
- return Joiner.on(',').join(Iterables.transform(selectedColumns, new Function() {
- @Override
- public String apply(byte[] input) {
- return PtBytes.encodeBase64String(input);
- }
- }));
- };
+ return Joiner.on(',').join(Iterables.transform(selectedColumns, PtBytes::encodeBase64String));
+ }
// Factory methods.
public static ColumnSelection all() {
@@ -78,19 +72,18 @@ public static ColumnSelection all() {
}
public static ColumnSelection create(Iterable selectedColumns) {
- if (Iterables.isEmpty(Preconditions.checkNotNull(selectedColumns))) {
+ if (Iterables.isEmpty(Preconditions.checkNotNull(selectedColumns, "selectedColumns cannot be null"))) {
return allColumnsSelected;
}
// Copy contents of 'selectedColumns' into a new set with proper deep comparison semantics.
- return new ColumnSelection(ImmutableSortedSet.copyOf(UnsignedBytes.lexicographicalComparator(), selectedColumns));
+ return new ColumnSelection(ImmutableSortedSet.copyOf(
+ UnsignedBytes.lexicographicalComparator(),
+ selectedColumns));
}
public boolean contains(byte[] column) {
- if (selectedColumns == null) {
- return true;
- }
- return selectedColumns.contains(column);
+ return selectedColumns == null || selectedColumns.contains(column);
}
// allColumnsSelected() returns true if all columns are selected. getSelectedColumns() should
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ExpiringKeyValueService.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ExpiringKeyValueService.java
index cf8723f9b22..6d1486ed6b1 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ExpiringKeyValueService.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/ExpiringKeyValueService.java
@@ -27,23 +27,39 @@
*
* Contract with the user:
* - This is for space and deletion time savings only.
- * - This does not fulfill the same goals/legal requirements as hard delete for sensitive data. (though data written by this service can itself be deleted by normal hard delete routines)
- * - // todo Only tables marked with 'AllowsSelfExpiringData' in their schema may use these features
+ * - This does not fulfill the same goals/legal requirements as hard delete for sensitive data.
+ * (though data written by this service can itself be deleted by normal hard delete routines)
+ * - // TODO: Only tables marked with 'AllowsSelfExpiringData' in their schema may use these features
*
- * - Normal atlasdb guarantees may be broken. Data written with expiration times are:
+ * - Normal AtlasDB guarantees may be broken. Data written with expiration times are:
* 1. not guaranteed to expire atomically with the entire row or at any other level of granularity
- * 2. not guaranteed to exist at any time after being written (as this feature implicitly requires distributed wall clock time)
+ * 2. not guaranteed to exist at any time after being written (as this feature implicitly
+ * requires distributed wall clock time)
* 3. not guaranteed to be deleted after the specified expiration time
*
- * That said, points #2 and #3 are attempted on a best-effort basis and should work adequately with synchronized cluster clocks and expiration durations generously outside what is strictly necessary for the application.
+ * That said, points #2 and #3 are attempted on a best-effort basis and should work adequately with synchronized
+ * cluster clocks and expiration durations generously outside what is strictly necessary for the application.
*
* @author clockfort
*
*/
public interface ExpiringKeyValueService extends KeyValueService {
+ void multiPut(
+ Map> valuesByTable,
+ long timestamp,
+ long time,
+ TimeUnit unit) throws KeyAlreadyExistsException;
- public void multiPut(Map> valuesByTable, final long timestamp, final long time, final TimeUnit unit) throws KeyAlreadyExistsException;
- public void put(final TableReference tableRef, final Map values, final long timestamp, final long time, final TimeUnit unit);
- public void putWithTimestamps(TableReference tableRef, Multimap values, final long time, final TimeUnit unit);
+ void put(
+ TableReference tableRef,
+ Map values,
+ long timestamp,
+ long time,
+ TimeUnit unit);
+ void putWithTimestamps(
+ TableReference tableRef,
+ Multimap values,
+ long time,
+ TimeUnit unit);
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/InsufficientConsistencyException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/InsufficientConsistencyException.java
index c99594fae50..dc076cdd007 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/InsufficientConsistencyException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/InsufficientConsistencyException.java
@@ -28,7 +28,7 @@ public InsufficientConsistencyException(String msg) {
super(msg);
}
- public InsufficientConsistencyException(String msg, Throwable t) {
- super(msg, t);
+ public InsufficientConsistencyException(String msg, Throwable ex) {
+ super(msg, ex);
}
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyAlreadyExistsException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyAlreadyExistsException.java
index c392c32f04f..03332eb9a7e 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyAlreadyExistsException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyAlreadyExistsException.java
@@ -25,16 +25,16 @@ public class KeyAlreadyExistsException extends PalantirRuntimeException {
private final ImmutableList existingKeys;
- public KeyAlreadyExistsException(String msg, Throwable n) {
- this(msg, n, ImmutableList.of());
+ public KeyAlreadyExistsException(String msg, Throwable ex) {
+ this(msg, ex, ImmutableList.of());
}
public KeyAlreadyExistsException(String msg) {
- this(msg, ImmutableList.of());
+ this(msg, ImmutableList.of());
}
- public KeyAlreadyExistsException(String msg, Throwable n, Iterable keys) {
- super(msg, n);
+ public KeyAlreadyExistsException(String msg, Throwable ex, Iterable keys) {
+ super(msg, ex);
existingKeys = ImmutableList.copyOf(keys);
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyValueService.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyValueService.java
index 006137bf588..f4c41bc40ce 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyValueService.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/KeyValueService.java
@@ -100,6 +100,17 @@ Map getRows(@QueryParam("tableRef") TableReference tableRef,
@QueryParam("columnSelection") ColumnSelection columnSelection,
@QueryParam("timestamp") long timestamp);
+ @POST
+ @Path("get-rows-col-range")
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Idempotent
+ Map getRowsColumnRange(
+ @QueryParam("tableRef") TableReference tableRef,
+ Iterable rows,
+ @QueryParam("columnRangeSelection") ColumnRangeSelection columnRangeSelection,
+ @QueryParam("timestamp") long timestamp);
+
/**
* Gets values from the key-value store.
*
@@ -153,7 +164,7 @@ Map getLatestTimestamps(@QueryParam("tableRef") TableReference table
* try {@link #delete(TableReference, Multimap)}.
*
* May throw KeyAlreadyExistsException, if storing a different value to existing key,
- * but this is not guaranteed even if the key exists - see {@link putUnlessExists}.
+ * but this is not guaranteed even if the key exists - see {@link #putUnlessExists}}.
*
* Must not throw KeyAlreadyExistsException when overwriting a cell with the original value (idempotent).
* @param tableRef the name of the table to put values into.
@@ -181,7 +192,7 @@ void put(@QueryParam("tableRef") TableReference tableRef,
* try {@link #delete(TableReference, Multimap)}.
*
* May throw KeyAlreadyExistsException, if storing a different value to existing key,
- * but this is not guaranteed even if the key exists - see {@link putUnlessExists}.
+ * but this is not guaranteed even if the key exists - see {@link #putUnlessExists}.
*
* Must not throw KeyAlreadyExistsException when overwriting a cell with the original value (idempotent).
* @param valuesByTable map containing the key-value entries to put by table.
@@ -210,7 +221,7 @@ void multiPut(Map> valuesByTable,
* try {@link #delete(TableReference, Multimap)}.
*
* May throw KeyAlreadyExistsException, if storing a different value to existing key,
- * but this is not guaranteed even if the key exists - see {@link putUnlessExists}.
+ * but this is not guaranteed even if the key exists - see {@link #putUnlessExists}.
*
* Must not throw KeyAlreadyExistsException when overwriting a cell with the original value (idempotent).
* @param tableRef the name of the table to put values into.
@@ -236,7 +247,8 @@ void putWithTimestamps(@QueryParam("tableRef") TableReference tableRef,
*
* If the call completes successfully then you know that your value was written and no other value was written
* first. If a {@link KeyAlreadyExistsException} is thrown it may be because the underlying call did a retry and
- * your value was actually put successfully. It is recommended that you check the stored value to account for this case.
+ * your value was actually put successfully. It is recommended that you check the stored value to account
+ * for this case.
*
* Retry should be done by the underlying implementation to ensure that other exceptions besides
* {@link KeyAlreadyExistsException} are not thrown spuriously.
@@ -316,7 +328,6 @@ void putUnlessExists(@QueryParam("tableRef") TableReference tableRef,
* timestamp.
*
* Remember to close any {@link ClosableIterator}s you get in a finally block.
- * @param tableRef
* @param rangeRequest the range to load.
* @param timestamp specifies the maximum timestamp (exclusive) at which to retrieve each rows's
*/
@@ -336,7 +347,6 @@ ClosableIterator> getRange(@QueryParam("tableRef") TableReferen
* This has the same consistency guarantees that {@link #getRangeOfTimestamps(TableReference, RangeRequest, long)}.
*
* Remember to close any {@link ClosableIterator}s you get in a finally block.
- * @param tableRef
* @param rangeRequest the range to load.
* @param timestamp specifies the maximum timestamp (exclusive) at which to
*/
@@ -370,9 +380,10 @@ ClosableIterator>> getRangeWithHistory(@QueryParam("tableRe
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Idempotent
- ClosableIterator>> getRangeOfTimestamps(@QueryParam("tableRef") TableReference tableRef,
- RangeRequest rangeRequest,
- @QueryParam("timestamp") long timestamp) throws InsufficientConsistencyException;
+ ClosableIterator>> getRangeOfTimestamps(
+ @QueryParam("tableRef") TableReference tableRef,
+ RangeRequest rangeRequest,
+ @QueryParam("timestamp") long timestamp) throws InsufficientConsistencyException;
/**
* For each range passed in the result will have the first page of results for that range.
@@ -395,7 +406,8 @@ ClosableIterator>> getRangeOfTimestamps(@QueryParam("tableRe
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Idempotent
- Map, byte[]>> getFirstBatchForRanges(@QueryParam("tableRef") TableReference tableRef,
+ Map, byte[]>> getFirstBatchForRanges(
+ @QueryParam("tableRef") TableReference tableRef,
Iterable rangeRequests,
@QueryParam("timestamp") long timestamp);
@@ -405,7 +417,6 @@ Map, byte[]>> getFirs
/**
* Drop the table, and also delete its table metadata.
- * @param tableRef
*/
@DELETE
@Path("drop-table")
@@ -419,8 +430,6 @@ Map, byte[]>> getFirs
* Drops many tables in idempotent fashion. If you are dropping many tables at once,
* use this call as the implementation can be much faster/less error-prone on some KVSs.
* Also deletes corresponding table metadata.
- *
- * @param tableRefs
*/
@DELETE
@Path("drop-tables")
@@ -432,21 +441,18 @@ Map, byte[]>> getFirs
/**
* Creates a table with the specified name. If the table already exists, no action is performed
* (the table is left in its current state).
- * @param tableRef
- * @param tableMetadata
*/
@POST
@Path("create-table")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Idempotent
- void createTable(@QueryParam("tableRef") TableReference tableRef, byte[] tableMetadata) throws InsufficientConsistencyException;
+ void createTable(@QueryParam("tableRef") TableReference tableRef, byte[] tableMetadata)
+ throws InsufficientConsistencyException;
/**
* Creates many tables in idempotent fashion. If you are making many tables at once,
* use this call as the implementation can be much faster/less error-prone on some KVSs.
- *
- * @param tableRefToTableMetadata
*/
@POST
@Path("create-tables")
@@ -473,7 +479,6 @@ Map, byte[]>> getFirs
*
* @return a byte array representing the metadata for the table. Array is empty if no table
* with the given name exists. Consider {@link TableMetadata#BYTES_HYDRATOR} for hydrating.
- * @param tableRef
*/
@Idempotent
@POST
@@ -545,7 +550,6 @@ Multimap getAllTimestamps(@QueryParam("tableName") TableReference ta
* deletions are performed.
*
* This call must be implemented so that it completes synchronously.
- * @param tableRef
*/
@POST
@Path("compact-internally")
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Namespace.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Namespace.java
index 468497add9b..8f3395ff243 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Namespace.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Namespace.java
@@ -33,14 +33,14 @@ public final class Namespace {
*
* This will not protect you from creating namespace that are incompatible with your underlying datastore.
*
- * Use {@link Namespace.LOOSELY_CHECKED_NAME} or {@link Namespace.STRICTLY_CHECKED_NAME} if possible.
+ * Use {@link Namespace#LOOSELY_CHECKED_NAME} or {@link Namespace#STRICTLY_CHECKED_NAME} if possible.
*/
public static final Pattern UNCHECKED_NAME = Pattern.compile("^[^\\.\\s]+$");
/**
* Less restrictive name pattern (letters, numbers, underscores, and hyphens).
*
- * Use {@link Namespace.STRICTLY_CHECKED_NAME} if possible.
+ * Use {@link Namespace#STRICTLY_CHECKED_NAME} if possible.
*/
public static final Pattern LOOSELY_CHECKED_NAME = Pattern.compile("^[\\w-]+$");
@@ -55,10 +55,11 @@ public static Namespace create(String name) {
return create(name, STRICTLY_CHECKED_NAME);
}
- public static Namespace create(String name, Pattern p) {
+ public static Namespace create(String name, Pattern pattern) {
Validate.notEmpty(name, "namespace name cannot be empty (see Namespace.EMPTY_NAMESPACE instead).");
Validate.isTrue(!name.contains("."), "namespace cannot contain dots (atlas reserved).");
- Validate.isTrue(p.matcher(name).matches(), "'" + name + "' does not match namespace pattern '" + p + "'.");
+ Validate.isTrue(pattern.matcher(name).matches(),
+ "'" + name + "' does not match namespace pattern '" + pattern + "'.");
return new Namespace(name);
}
@@ -69,7 +70,7 @@ private Namespace(@JsonProperty("name") String name) {
@JsonIgnore
public boolean isEmptyNamespace() {
- return this == EMPTY_NAMESPACE;
+ return this.equals(EMPTY_NAMESPACE);
}
public String getName() {
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Prefix.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Prefix.java
index 34dbdd721d5..06aca4b6649 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Prefix.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Prefix.java
@@ -28,7 +28,7 @@ public class Prefix {
private final byte[] bytes;
public Prefix(byte[] bytes) {
- this.bytes = Preconditions.checkNotNull(bytes).clone();
+ this.bytes = Preconditions.checkNotNull(bytes, "bytes cannot be null").clone();
}
@Nonnull
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequest.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequest.java
index b361ce42571..bd0983411d2 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequest.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequest.java
@@ -17,6 +17,7 @@
import java.io.Serializable;
import java.util.Arrays;
+import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
@@ -50,7 +51,8 @@
* To restrict the rows or columns, call
* the methods on the RangeRequest class.
*/
-@Immutable public final class RangeRequest implements Serializable {
+@Immutable
+public final class RangeRequest implements Serializable {
private static final long serialVersionUID = 1L;
private final byte[] startInclusive;
@@ -69,14 +71,14 @@ public static Builder builder() {
return new Builder(false);
}
- public static Builder reverseBuilder() {
- return new Builder(true);
- }
-
public static Builder builder(boolean reverse) {
return new Builder(reverse);
}
+ public static Builder reverseBuilder() {
+ return new Builder(true);
+ }
+
public static RangeRequest all() {
return builder().build();
}
@@ -149,11 +151,15 @@ public boolean inRange(byte[] position) {
final boolean afterStart;
final boolean afterEnd;
if (reverse) {
- afterStart = getStartInclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) >= 0;
- afterEnd = getEndExclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) < 0;
+ afterStart = getStartInclusive().length == 0
+ || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) >= 0;
+ afterEnd = getEndExclusive().length == 0
+ || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) < 0;
} else {
- afterStart = getStartInclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) <= 0;
- afterEnd = getEndExclusive().length == 0 || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) > 0;
+ afterStart = getStartInclusive().length == 0
+ || UnsignedBytes.lexicographicalComparator().compare(getStartInclusive(), position) <= 0;
+ afterEnd = getEndExclusive().length == 0
+ || UnsignedBytes.lexicographicalComparator().compare(getEndExclusive(), position) > 0;
}
return afterStart && afterEnd;
@@ -183,13 +189,31 @@ public String toString() {
PtBytes.addIfNotEmpty(helper, "startInclusive", startInclusive);
PtBytes.addIfNotEmpty(helper, "endExclusive", endExclusive);
if (columns != null && !columns.isEmpty()) {
- helper.add("columns", FluentIterable.from(columns).filter(Predicates.notNull()).transform(PtBytes.BYTES_TO_HEX_STRING));
+ helper.add("columns", FluentIterable.from(columns)
+ .filter(Predicates.notNull())
+ .transform(PtBytes.BYTES_TO_HEX_STRING));
}
helper.add("batchHint", batchHint);
helper.add("reverse", reverse);
return helper.toString();
}
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ RangeRequest that = (RangeRequest) obj;
+ return reverse == that.reverse
+ && Arrays.equals(startInclusive, that.startInclusive)
+ && Arrays.equals(endExclusive, that.endExclusive)
+ && Objects.equals(columns, that.columns)
+ && Objects.equals(batchHint, that.batchHint);
+ }
+
@Override
public int hashCode() {
/*
@@ -198,48 +222,19 @@ public int hashCode() {
* allow for benign data races.
*/
if (hashCode == 0) {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((batchHint == null) ? 0 : batchHint.hashCode());
- result = prime * result + ((columns == null) ? 0 : columns.hashCode());
- result = prime * result + Arrays.hashCode(endExclusive);
- result = prime * result + (reverse ? 1231 : 1237);
- result = prime * result + Arrays.hashCode(startInclusive);
- hashCode = result;
+ hashCode = Objects.hash(
+ Arrays.hashCode(startInclusive),
+ Arrays.hashCode(endExclusive),
+ columns,
+ batchHint,
+ reverse);
}
return hashCode;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RangeRequest other = (RangeRequest) obj;
- if (batchHint == null) {
- if (other.batchHint != null)
- return false;
- } else if (!batchHint.equals(other.batchHint))
- return false;
- if (columns == null) {
- if (other.columns != null)
- return false;
- } else if (!columns.equals(other.columns))
- return false;
- if (!Arrays.equals(endExclusive, other.endExclusive))
- return false;
- if (reverse != other.reverse)
- return false;
- if (!Arrays.equals(startInclusive, other.startInclusive))
- return false;
- return true;
- }
-
private static ImmutableSortedSet cloneSet(Iterable set) {
- ImmutableSortedSet.Builder builder = ImmutableSortedSet.orderedBy(UnsignedBytes.lexicographicalComparator());
+ ImmutableSortedSet.Builder builder =
+ ImmutableSortedSet.orderedBy(UnsignedBytes.lexicographicalComparator());
for (byte[] col : set) {
builder.add(col.clone());
}
@@ -253,13 +248,15 @@ private static ImmutableSortedSet cloneSet(Iterable set) {
* start will be on the left hand side and will be greater lexicographically
*/
private static Pair createNamesForReversePrefixScan(@Nonnull byte[] name) {
- Preconditions.checkArgument(Preconditions.checkNotNull(name).length <= Cell.MAX_NAME_LENGTH, "name is too long");
+ Preconditions.checkNotNull(name, "name cannot be null");
+ Preconditions.checkArgument(name.length <= Cell.MAX_NAME_LENGTH, "name is too long");
+
if (name.length == 0) {
return Pair.create(name, name);
}
byte[] startName = new byte[Cell.MAX_NAME_LENGTH];
System.arraycopy(name, 0, startName, 0, name.length);
- for (int i = name.length ; i < startName.length ; i++) {
+ for (int i = name.length; i < startName.length; i++) {
startName[i] = (byte) 0xff;
}
byte[] endName = RangeRequests.previousLexicographicName(name);
@@ -292,19 +289,22 @@ public boolean isReverse() {
* This will set the start and the end to get all rows that have a given prefix.
*/
public Builder prefixRange(byte[] prefix) {
+ Preconditions.checkNotNull(prefix, "prefix cannot be null");
+
if (reverse) {
Pair pair = createNamesForReversePrefixScan(prefix);
this.startInclusive = pair.lhSide;
this.endExclusive = pair.rhSide;
} else {
- this.startInclusive = Preconditions.checkNotNull(prefix).clone();
+ this.startInclusive = prefix.clone();
this.endExclusive = RangeRequests.createEndNameForPrefixScan(prefix);
}
+
return this;
}
public Builder startRowInclusive(byte[] start) {
- this.startInclusive = Preconditions.checkNotNull(start).clone();
+ this.startInclusive = Preconditions.checkNotNull(start, "start cannot be null").clone();
return this;
}
@@ -317,7 +317,7 @@ public Builder startRowInclusive(Persistable start) {
}
public Builder endRowExclusive(byte[] end) {
- this.endExclusive = Preconditions.checkNotNull(end).clone();
+ this.endExclusive = Preconditions.checkNotNull(end, "end cannot be null").clone();
return this;
}
@@ -346,7 +346,8 @@ public Builder retainColumns(ColumnSelection selection) {
* read a lot from this range, then this should be pretty large for performance. If we are only going to read
* the first thing in a range, then this should be set to 1.
*
- * If hint is null then the range will use the default. Usually for {@link Transaction#getRange(TableReference, RangeRequest)}
+ * If hint is null then the range will use the default. Usually for
+ * {@link Transaction#getRange(TableReference, RangeRequest)}
* this means the batch size will be whatever is passed as the batch size to
* BatchingVisitable#batchAccept(int, com.palantir.common.base.AbortingVisitor)
*/
@@ -370,7 +371,8 @@ public boolean isInvalidRange() {
public RangeRequest build() {
RangeRequest rangeRequest = new RangeRequest(startInclusive, endExclusive, columns, batchHint, reverse);
if (isInvalidRange()) {
- throw new IllegalArgumentException("Invalid range request, check row byte ordering for reverse ordered values: " + rangeRequest);
+ throw new IllegalArgumentException(
+ "Invalid range request, check row byte ordering for reverse ordered values: " + rangeRequest);
}
return rangeRequest;
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequests.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequests.java
index d080239a1d4..a068979da63 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequests.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RangeRequests.java
@@ -20,7 +20,10 @@
import com.google.common.base.Preconditions;
import com.palantir.atlasdb.encoding.PtBytes;
-public class RangeRequests {
+public final class RangeRequests {
+ private RangeRequests() {
+ // Utility class
+ }
/**
* This will return the first byte[] less than the given byte[] lexicographically.
@@ -33,15 +36,15 @@ public class RangeRequests {
public static byte[] previousLexicographicName(@Nonnull byte[] name) {
Preconditions.checkArgument(name.length <= Cell.MAX_NAME_LENGTH, "name is too long");
Preconditions.checkArgument(name.length > 0, "name is empty");
- if (name[name.length-1] == 0) {
- byte[] ret = new byte[name.length-1];
+ if (name[name.length - 1] == 0) {
+ byte[] ret = new byte[name.length - 1];
System.arraycopy(name, 0, ret, 0, ret.length);
return ret;
}
byte[] ret = new byte[Cell.MAX_NAME_LENGTH];
System.arraycopy(name, 0, ret, 0, name.length);
- ret[name.length-1]--;
- for (int i = name.length ; i < ret.length ; i++) {
+ ret[name.length - 1]--;
+ for (int i = name.length; i < ret.length; i++) {
ret[i] = (byte) 0xff;
}
return ret;
@@ -54,11 +57,13 @@ public static byte[] previousLexicographicName(@Nonnull byte[] name) {
* @param rowName must be non-null
*/
public static byte[] createEndNameForPrefixScan(@Nonnull byte[] rowName) {
- Preconditions.checkArgument(Preconditions.checkNotNull(rowName).length <= Cell.MAX_NAME_LENGTH, "name is too long");
- for (int i = rowName.length-1 ; i >= 0 ; i--) {
+ Preconditions.checkNotNull(rowName, "name cannot be null");
+ Preconditions.checkArgument(rowName.length <= Cell.MAX_NAME_LENGTH, "name is too long");
+
+ for (int i = rowName.length - 1; i >= 0; i--) {
if ((rowName[i] & 0xff) != 0xff) {
- byte[] ret = new byte[i+1];
- System.arraycopy(rowName, 0, ret, 0, i+1);
+ byte[] ret = new byte[i + 1];
+ System.arraycopy(rowName, 0, ret, 0, i + 1);
ret[i]++;
return ret;
}
@@ -75,7 +80,8 @@ public static byte[] nextLexicographicName(@Nonnull byte[] name) {
return ret;
}
- final static byte[] ONE_AFTER_MAXIMUM_NAME;
+ static final byte[] ONE_AFTER_MAXIMUM_NAME;
+
static {
ONE_AFTER_MAXIMUM_NAME = new byte[Cell.MAX_NAME_LENGTH + 1];
for (int i = 0; i < Cell.MAX_NAME_LENGTH; ++i) {
@@ -90,8 +96,6 @@ public static byte[] oneAfterMaximumName() {
/**
* This is a replacement for endRow when doing a non-reverse range request.
- * @param rangeRequest
- * @return
*/
public static byte[] endRowExclusiveOrOneAfterMax(RangeRequest rangeRequest) {
Preconditions.checkArgument(!rangeRequest.isReverse());
@@ -103,8 +107,6 @@ public static byte[] endRowExclusiveOrOneAfterMax(RangeRequest rangeRequest) {
/**
* This is a replacement for startRow when doing reverse range request.
- * @param rangeRequest
- * @return
*/
public static byte[] startRowInclusiveOrLargestRow(RangeRequest rangeRequest) {
Preconditions.checkArgument(rangeRequest.isReverse());
@@ -124,15 +126,15 @@ public static ColumnSelection extractColumnSelection(RangeRequest rangeRequest)
private static byte[] nextLexicographicNameInternal(@Nonnull byte[] name) {
Preconditions.checkArgument(name.length <= Cell.MAX_NAME_LENGTH, "name is too long");
if (name.length < Cell.MAX_NAME_LENGTH) {
- byte[] ret = new byte[name.length+1];
+ byte[] ret = new byte[name.length + 1];
System.arraycopy(name, 0, ret, 0, name.length);
ret[name.length] = (byte) 0;
return ret;
} else {
- for (int i = name.length-1 ; i >= 0 ; i--) {
+ for (int i = name.length - 1; i >= 0; i--) {
if ((name[i] & 0xff) != 0xff) {
- byte[] ret = new byte[i+1];
- System.arraycopy(name, 0, ret, 0, i+1);
+ byte[] ret = new byte[i + 1];
+ System.arraycopy(name, 0, ret, 0, i + 1);
ret[i]++;
return ret;
}
@@ -147,7 +149,7 @@ public static byte[] getFirstRowName() {
public static byte[] getLastRowName() {
byte[] ret = new byte[Cell.MAX_NAME_LENGTH];
- for (int i = 0 ; i < ret.length ; i++) {
+ for (int i = 0; i < ret.length; i++) {
ret[i] = (byte) 0xff;
}
return ret;
diff --git a/commons-db/src/main/java/com/palantir/nexus/db/sql/ClearStyle.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowColumnRangeIterator.java
similarity index 57%
rename from commons-db/src/main/java/com/palantir/nexus/db/sql/ClearStyle.java
rename to atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowColumnRangeIterator.java
index 65290d8ff4a..d9fbfae4006 100644
--- a/commons-db/src/main/java/com/palantir/nexus/db/sql/ClearStyle.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowColumnRangeIterator.java
@@ -13,23 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.palantir.nexus.db.sql;
+package com.palantir.atlasdb.keyvalue.api;
-/**
- * Enumerates methods for clearing SQL tables.
- */
-enum ClearStyle {
- /**
- * Clear tables using TRUNCATE. Experts-only.
- *
- * NOTE: the semantics for executing a TRUNCATE TABLE statement within a
- * transaction are vendor-specific. You must exercise caution when using
- * this option!
- */
- TRUNCATE,
+import java.util.Iterator;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
- /**
- * Clear tables using DELETE. Always safe.
- */
- DELETE
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "@class")
+public interface RowColumnRangeIterator extends Iterator> {
+ //
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowResult.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowResult.java
index 6ad34f43d63..b9295682f16 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowResult.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/RowResult.java
@@ -34,7 +34,7 @@
import com.palantir.atlasdb.encoding.PtBytes;
import com.palantir.common.collect.Maps2;
-public class RowResult implements Serializable {
+public final class RowResult implements Serializable {
private static final long serialVersionUID = 1L;
private final byte[] row;
@@ -52,7 +52,8 @@ public static RowResult create(byte[] row, SortedMap columns)
private RowResult(byte[] row, SortedMap columns) {
Preconditions.checkArgument(Cell.isNameValid(row));
- Preconditions.checkArgument(UnsignedBytes.lexicographicalComparator().equals(columns.comparator()), "comparator for the map must be the bytes comparator");
+ Preconditions.checkArgument(UnsignedBytes.lexicographicalComparator().equals(columns.comparator()),
+ "comparator for the map must be the bytes comparator");
for (byte[] colName : columns.keySet()) {
Preconditions.checkArgument(Cell.isNameValid(colName));
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/SweepResults.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/SweepResults.java
index b920bf8b07b..a70d1795902 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/SweepResults.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/SweepResults.java
@@ -16,6 +16,7 @@
package com.palantir.atlasdb.keyvalue.api;
import java.util.Arrays;
+import java.util.Objects;
import javax.annotation.Nullable;
@@ -64,24 +65,22 @@ public String toString() {
}
@Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- SweepResults results = (SweepResults) o;
-
- if (cellsExamined != results.cellsExamined) return false;
- if (cellsSwept != results.cellsSwept) return false;
- if (sweptTimestamp != results.sweptTimestamp) return false;
- return Arrays.equals(nextStartRow, results.nextStartRow);
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ SweepResults that = (SweepResults) obj;
+ return cellsExamined == that.cellsExamined
+ && cellsSwept == that.cellsSwept
+ && sweptTimestamp == that.sweptTimestamp
+ && Arrays.equals(nextStartRow, that.nextStartRow);
}
@Override
public int hashCode() {
- int result = Arrays.hashCode(nextStartRow);
- result = 31 * result + (int) (cellsExamined ^ (cellsExamined >>> 32));
- result = 31 * result + (int) (cellsSwept ^ (cellsSwept >>> 32));
- result = 31 * result + (int) (sweptTimestamp ^ (sweptTimestamp >>> 32));
- return result;
+ return Objects.hash(Arrays.hashCode(nextStartRow), cellsExamined, cellsSwept, sweptTimestamp);
}
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/TableReference.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/TableReference.java
index 0882ff03572..29bb414ccce 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/TableReference.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/TableReference.java
@@ -15,6 +15,8 @@
*/
package com.palantir.atlasdb.keyvalue.api;
+import java.util.Objects;
+
import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -22,14 +24,16 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Preconditions;
-public class TableReference {
+public final class TableReference {
private final Namespace namespace;
private final String tablename;
public static TableReference createFromFullyQualifiedName(String fullTableName) {
int index = fullTableName.indexOf('.');
Preconditions.checkArgument(index > 0, "Table name %s is not a fully qualified table name.");
- return create(Namespace.create(fullTableName.substring(0, index), Namespace.UNCHECKED_NAME), fullTableName.substring(index + 1));
+ return create(
+ Namespace.create(fullTableName.substring(0, index), Namespace.UNCHECKED_NAME),
+ fullTableName.substring(index + 1));
}
public static TableReference create(Namespace namespace, String tablename) {
@@ -41,15 +45,15 @@ public static TableReference createWithEmptyNamespace(String tablename) {
}
public static TableReference createUnsafe(String fullTableName) {
- return fullTableName.indexOf('.') < 0 ? createWithEmptyNamespace(fullTableName) : createFromFullyQualifiedName(fullTableName);
- }
-
- public static boolean isFullyQualifiedName(String tableName) {
- return tableName.contains(".");
+ return fullTableName.indexOf('.') < 0
+ ? createWithEmptyNamespace(fullTableName)
+ : createFromFullyQualifiedName(fullTableName);
}
@JsonCreator
- private TableReference(@JsonProperty("namespace") Namespace namespace, @JsonProperty("tablename") String tablename) {
+ private TableReference(
+ @JsonProperty("namespace") Namespace namespace,
+ @JsonProperty("tablename") String tablename) {
this.namespace = namespace;
this.tablename = tablename;
}
@@ -64,7 +68,13 @@ public String getTablename() {
@JsonIgnore
public String getQualifiedName() {
- return namespace.isEmptyNamespace() || namespace.getName().equals("met") ? tablename : namespace.getName() + "." + tablename;
+ return namespace.isEmptyNamespace() || namespace.getName().equals("met")
+ ? tablename
+ : namespace.getName() + "." + tablename;
+ }
+
+ public static boolean isFullyQualifiedName(String tableName) {
+ return tableName.contains(".");
}
@JsonIgnore
@@ -72,35 +82,22 @@ public boolean isFullyQualifiedName() {
return getQualifiedName().contains(".");
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
- result = prime * result + ((tablename == null) ? 0 : tablename.hashCode());
- return result;
- }
-
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- TableReference other = (TableReference) obj;
- if (namespace == null) {
- if (other.namespace != null)
- return false;
- } else if (!namespace.equals(other.namespace))
- return false;
- if (tablename == null) {
- if (other.tablename != null)
- return false;
- } else if (!tablename.equals(other.tablename))
+ }
+ if (obj == null || getClass() != obj.getClass()) {
return false;
- return true;
+ }
+ TableReference that = (TableReference) obj;
+ return Objects.equals(namespace, that.namespace)
+ && Objects.equals(tablename, that.tablename);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(namespace, tablename);
}
@Override
@@ -108,14 +105,14 @@ public String toString() {
return getQualifiedName();
}
- public static TableReference fromString(String s) {
- int dotCount = StringUtils.countMatches(s, ".");
+ public static TableReference fromString(String tableReferenceAsString) {
+ int dotCount = StringUtils.countMatches(tableReferenceAsString, ".");
if (dotCount == 0) {
- return TableReference.createWithEmptyNamespace(s);
- } else if (dotCount == 1){
- return TableReference.createFromFullyQualifiedName(s);
+ return TableReference.createWithEmptyNamespace(tableReferenceAsString);
+ } else if (dotCount == 1) {
+ return TableReference.createFromFullyQualifiedName(tableReferenceAsString);
} else {
- throw new IllegalArgumentException(s + " is not a valid table reference.");
+ throw new IllegalArgumentException(tableReferenceAsString + " is not a valid table reference.");
}
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Value.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Value.java
index 08f88379741..f7870b1fdcb 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Value.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/keyvalue/api/Value.java
@@ -17,12 +17,14 @@
import java.io.Serializable;
import java.util.Arrays;
+import java.util.Objects;
import javax.annotation.Nonnull;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Function;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.palantir.atlasdb.encoding.PtBytes;
@@ -32,17 +34,14 @@
* Values are stored in {@link Cell}s.
* @see Cell
*/
-public class Value implements Serializable {
+public final class Value implements Serializable {
private static final long serialVersionUID = 1L;
public static final long INVALID_VALUE_TIMESTAMP = -1L;
@JsonCreator
public static Value create(@JsonProperty("contents") byte[] contents,
@JsonProperty("timestamp") long timestamp) {
- if (contents == null) {
- contents = PtBytes.EMPTY_BYTE_ARRAY;
- }
- return new Value(contents, timestamp);
+ return new Value(MoreObjects.firstNonNull(contents, PtBytes.EMPTY_BYTE_ARRAY), timestamp);
}
public static Value createWithCopyOfData(byte[] contents, long timestamp) {
@@ -68,68 +67,43 @@ public long getTimestamp() {
private final long timestamp;
private Value(byte[] contents, long timestamp) {
- Preconditions.checkArgument((timestamp >= 0 && timestamp < Long.MAX_VALUE) || (timestamp == INVALID_VALUE_TIMESTAMP), "timestamp out of bounds");
+ Preconditions.checkArgument(
+ (timestamp >= 0 && timestamp < Long.MAX_VALUE) || (timestamp == INVALID_VALUE_TIMESTAMP),
+ "timestamp out of bounds");
this.contents = contents;
this.timestamp = timestamp;
}
- public static final Function GET_TIMESTAMP = new Function() {
- @Override
- public Long apply(Value from) {
- return from.getTimestamp();
- }
- };
+ public static final Function GET_TIMESTAMP = Value::getTimestamp;
- public static final Function GET_VALUE = new Function() {
- @Override
- public byte[] apply(Value from) {
- return from.getContents();
- }
- };
+ public static final Function GET_VALUE = Value::getContents;
- public static final Predicate IS_EMPTY = new Predicate() {
- @Override
- public boolean apply(byte[] input) {
- return input.length == 0;
- }
- };
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(contents);
- result = prime * result + (int) (timestamp ^ (timestamp >>> 32));
- return result;
- }
+ public static final Predicate IS_EMPTY = input -> input.length == 0;
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Value other = (Value)obj;
- if (!Arrays.equals(contents, other.contents)) {
- return false;
- }
- if (timestamp != other.timestamp) {
+ if (obj == null || getClass() != obj.getClass()) {
return false;
}
- return true;
+ Value value = (Value) obj;
+ return timestamp == value.timestamp
+ && Arrays.equals(contents, value.contents);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(Arrays.hashCode(contents), timestamp);
}
@Override
public String toString() {
byte[] prefix = Arrays.copyOf(contents, Math.min(10, contents.length));
- return "Value [contents=" + PtBytes.encodeHexString(prefix) +
- ", contentsLength=" + contents.length +
- ", timestamp=" + timestamp + "]";
+ return "Value [contents=" + PtBytes.encodeHexString(prefix)
+ + ", contentsLength=" + contents.length
+ + ", timestamp=" + timestamp + "]";
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/persist/api/Persister.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/persist/api/Persister.java
index 21c9fe452b4..f68a7d57c10 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/persist/api/Persister.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/persist/api/Persister.java
@@ -21,6 +21,6 @@
* {@link Persister}s are required to have a no arg constructor.
*/
public interface Persister extends Hydrator {
- byte[] persistToBytes(T t);
+ byte[] persistToBytes(T objectToPersist);
Class getPersistingClassType();
}
diff --git a/atlasdb-spi/src/main/java/com/palantir/atlasdb/spi/AtlasDbFactory.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/AtlasDbFactory.java
similarity index 81%
rename from atlasdb-spi/src/main/java/com/palantir/atlasdb/spi/AtlasDbFactory.java
rename to atlasdb-api/src/main/java/com/palantir/atlasdb/spi/AtlasDbFactory.java
index 06748663765..658a983b53c 100644
--- a/atlasdb-spi/src/main/java/com/palantir/atlasdb/spi/AtlasDbFactory.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/AtlasDbFactory.java
@@ -1,12 +1,12 @@
/**
- * Copyright 2015 Palantir Technologies
- *
+ * Copyright 2016 Palantir Technologies
+ * ​
* Licensed under the BSD-3 License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ * ​
* http://opensource.org/licenses/BSD-3-Clause
- *
+ * ​
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,13 +15,15 @@
*/
package com.palantir.atlasdb.spi;
+import com.google.common.base.Optional;
+import com.palantir.atlasdb.config.LeaderConfig;
import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.timestamp.TimestampService;
public interface AtlasDbFactory {
String getType();
- KeyValueService createRawKeyValueService(KeyValueServiceConfig config);
+ KeyValueService createRawKeyValueService(KeyValueServiceConfig config, Optional leaderConfig);
TimestampService createTimestampService(KeyValueService rawKvs);
diff --git a/atlasdb-spi/src/main/java/com/palantir/atlasdb/spi/KeyValueServiceConfig.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/KeyValueServiceConfig.java
similarity index 97%
rename from atlasdb-spi/src/main/java/com/palantir/atlasdb/spi/KeyValueServiceConfig.java
rename to atlasdb-api/src/main/java/com/palantir/atlasdb/spi/KeyValueServiceConfig.java
index d513db701d6..ca7857a5418 100644
--- a/atlasdb-spi/src/main/java/com/palantir/atlasdb/spi/KeyValueServiceConfig.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/spi/KeyValueServiceConfig.java
@@ -1,12 +1,12 @@
/**
* Copyright 2015 Palantir Technologies
- *
+ * ​
* Licensed under the BSD-3 License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ * ​
* http://opensource.org/licenses/BSD-3-Clause
- *
+ * ​
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/AtlasDbConstraintCheckingMode.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/AtlasDbConstraintCheckingMode.java
index 966b01e7028..d6af1c0c8b1 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/AtlasDbConstraintCheckingMode.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/AtlasDbConstraintCheckingMode.java
@@ -16,25 +16,25 @@
package com.palantir.atlasdb.transaction.api;
public enum AtlasDbConstraintCheckingMode {
- FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS(ShouldThrowException.YES),
- FULL_CONSTRAINT_CHECKING_LOGS_EXCEPTIONS(ShouldThrowException.NO),
- PERFORMANCE_OPTIMAL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS(ShouldThrowException.YES),
- PERFORMANCE_OPTIMAL_CONSTRAINT_CHECKING_LOGS_EXCEPTIONS(ShouldThrowException.NO),
- NO_CONSTRAINT_CHECKING(ShouldThrowException.NO);
+ FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS(ShouldThrow.YES),
+ FULL_CONSTRAINT_CHECKING_LOGS_EXCEPTIONS(ShouldThrow.NO),
+ PERFORMANCE_OPTIMAL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS(ShouldThrow.YES),
+ PERFORMANCE_OPTIMAL_CONSTRAINT_CHECKING_LOGS_EXCEPTIONS(ShouldThrow.NO),
+ NO_CONSTRAINT_CHECKING(ShouldThrow.NO);
- private static enum ShouldThrowException {
+ private enum ShouldThrow {
YES,
NO
}
- private final ShouldThrowException shouldThrowException;
+ private final ShouldThrow shouldThrowException;
- private AtlasDbConstraintCheckingMode(ShouldThrowException shouldThrowException) {
+ AtlasDbConstraintCheckingMode(ShouldThrow shouldThrowException) {
this.shouldThrowException = shouldThrowException;
}
public boolean shouldThrowException() {
- return shouldThrowException == ShouldThrowException.YES;
+ return shouldThrowException == ShouldThrow.YES;
}
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckable.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckable.java
index 127bd0ee087..f57012eabdc 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckable.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckable.java
@@ -25,21 +25,19 @@ public interface ConstraintCheckable {
* This method checks row, table, and foreign-key constraints on the values given in writes.
* This method may require additional reads from the database, dependong on the value of
* constraintCheckingMode. This is intended to be used to check constraints on writes.
- * @param writes
- * @param transaction
- * @param constraintCheckingMode
- * @return
*/
- public List findConstraintFailures(Map writes, ConstraintCheckingTransaction transaction, AtlasDbConstraintCheckingMode constraintCheckingMode);
+ List findConstraintFailures(
+ Map writes,
+ ConstraintCheckingTransaction transaction,
+ AtlasDbConstraintCheckingMode constraintCheckingMode);
/**
* Calling this method will not cause any read calls from the database. It assumes that all necessary
* information for constraint checking is given in writes. For dynamic tables, any constraint between
* columns of a single row will probably require writes to have all columns for each given row. This
* is intended to be used for garbage collection (where all values are being read).
- * @param reads
- * @param constraintCheckingMode
- * @return
*/
- public List findConstraintFailuresNoRead(Map reads, AtlasDbConstraintCheckingMode constraintCheckingMode);
+ List findConstraintFailuresNoRead(
+ Map reads,
+ AtlasDbConstraintCheckingMode constraintCheckingMode);
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckingTransaction.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckingTransaction.java
index 01bbf961d9a..5c7f4de31e5 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckingTransaction.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/ConstraintCheckingTransaction.java
@@ -27,10 +27,10 @@ public interface ConstraintCheckingTransaction extends Transaction {
/**
* Returns the cell values in the key-value service, ignoring the cache of local writes.
*/
- public Map getIgnoringLocalWrites(TableReference tableRef, Set cells);
+ Map getIgnoringLocalWrites(TableReference tableRef, Set cells);
/**
* Returns the row result values in the key-value service, ignoring the cache of local writes.
*/
- public SortedMap> getRowsIgnoringLocalWrites(TableReference tableRef, Iterable rows);
+ SortedMap> getRowsIgnoringLocalWrites(TableReference tableRef, Iterable rows);
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/RuntimeTransactionTask.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/RuntimeTransactionTask.java
index 8595d34277d..6bd85e9bf34 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/RuntimeTransactionTask.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/RuntimeTransactionTask.java
@@ -17,5 +17,5 @@
public interface RuntimeTransactionTask extends TransactionTask {
@Override
- T execute(Transaction t);
+ T execute(Transaction transaction);
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/Transaction.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/Transaction.java
index 9c817383dc4..dd675f7633d 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/Transaction.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/Transaction.java
@@ -20,6 +20,7 @@
import java.util.SortedMap;
import com.palantir.atlasdb.keyvalue.api.Cell;
+import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection;
import com.palantir.atlasdb.keyvalue.api.ColumnSelection;
import com.palantir.atlasdb.keyvalue.api.RangeRequest;
import com.palantir.atlasdb.keyvalue.api.RowResult;
@@ -35,8 +36,16 @@
public interface Transaction {
@Idempotent
- SortedMap> getRows(TableReference tableRef, Iterable rows,
- ColumnSelection columnSelection);
+ SortedMap> getRows(
+ TableReference tableRef,
+ Iterable rows,
+ ColumnSelection columnSelection);
+
+ @Idempotent
+ Map>> getRowsColumnRange(
+ TableReference tableRef,
+ Iterable rows,
+ ColumnRangeSelection columnRangeSelection);
@Idempotent
Map get(TableReference tableRef, Set cells);
@@ -60,7 +69,9 @@ SortedMap> getRows(TableReference tableRef, Iterable>> getRanges(TableReference tableRef, Iterable rangeRequests);
+ Iterable>> getRanges(
+ TableReference tableRef,
+ Iterable rangeRequests);
/**
* Puts values into the key-value store. If you put a null or the empty byte array, then
@@ -90,9 +101,8 @@ enum TransactionType {
/**
* Hard delete transactions are different from regular transactions because they
- * must queue cells for "scrubbing" (i.e. not just write a value at the latest
- * timestamp, but also clean up values at older timestamps) on every cell that's
- * modified or deleted
+ * must queue cells for "scrubbing" on every cell that's modified or deleted.
+ * (i.e. not just write a value at the latest timestamp, but also clean up values at older timestamps)
*/
HARD_DELETE,
@@ -100,9 +110,9 @@ enum TransactionType {
* In addition to queuing cells for "scrubbing", we also:
* - (a) Scrub earlier than we would have otherwise, even at the cost of possibly
* causing open transactions to abort, and
- * - (b) Block until the scrub is complete
+ * - (b) Block until the scrub is complete.
*/
- AGGRESSIVE_HARD_DELETE;
+ AGGRESSIVE_HARD_DELETE
}
/**
@@ -134,13 +144,18 @@ enum TransactionType {
void commit(TransactionService transactionService) throws TransactionFailedException;
/**
+ * Gets whether the transaction has been aborted.
+ *
* @return true if abort() has been called, otherwise false
*/
@Idempotent
boolean isAborted();
/**
- * @return true if neither commit() or abort() have been called, otherwise false
+ * Gets whether the transaction has not been committed.
+ *
+ * @return true if neither commit() or abort() have been called,
+ * otherwise false
*/
@Idempotent
boolean isUncommitted();
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionCommitFailedException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionCommitFailedException.java
index 74ea823b66f..ed963975561 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionCommitFailedException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionCommitFailedException.java
@@ -38,7 +38,7 @@ public TransactionCommitFailedException(String message) {
}
@Override
- final public boolean canTransactionBeRetried() {
+ public final boolean canTransactionBeRetried() {
return false;
}
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionConflictException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionConflictException.java
index 5b9a1bd1629..c3c6a0b56b1 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionConflictException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionConflictException.java
@@ -26,13 +26,15 @@
/**
* Thrown if there is a conflict detected when a transaction is committed.
- * If two concurrent transactions make calls to {@link Transaction#put(com.palantir.atlasdb.keyvalue.api.TableReference, java.util.Map)} or
- * {@link Transaction#delete(com.palantir.atlasdb.keyvalue.api.TableReference, Set)} for the same Cell, then this is a write-write conflict.
+ * If two concurrent transactions make calls to
+ * {@link Transaction#put(com.palantir.atlasdb.keyvalue.api.TableReference, java.util.Map)} or
+ * {@link Transaction#delete(com.palantir.atlasdb.keyvalue.api.TableReference, Set)} for the same Cell,
+ * then this is a write-write conflict.
*
* The error message should be detailed about what caused the failure and what other transaction
* conflicted with this one.
*/
-public class TransactionConflictException extends TransactionFailedRetriableException {
+public final class TransactionConflictException extends TransactionFailedRetriableException {
private static final long serialVersionUID = 1L;
public static class CellConflict implements Serializable {
@@ -59,17 +61,13 @@ public CellConflict(Cell cell, String cellString, long theirStart, long theirCom
@Override
public String toString() {
- return "CellConflict [cell=" + cellString + ", theirStart=" + theirStart + ", theirCommit=" +
- theirCommit + "]";
+ return "CellConflict [cell=" + cellString
+ + ", theirStart=" + theirStart
+ + ", theirCommit=" + theirCommit + "]";
}
public static Function getCellFunction() {
- return new Function() {
- @Override
- public Cell apply(CellConflict input) {
- return input.cell;
- }
- };
+ return input -> input.cell;
}
}
@@ -78,7 +76,6 @@ public Cell apply(CellConflict input) {
/**
* These conflicts had a start timestamp before our start and a commit timestamp after our start.
- * @return
*/
public Collection getSpanningWrites() {
return spanningWrites;
@@ -92,11 +89,20 @@ public Collection getDominatingWrites() {
return dominatingWrites;
}
- public static TransactionConflictException create(TableReference tableRef, long timestamp,
- Collection spanningWrites, Collection dominatingWrites, long elapsedMillis) {
+ public static TransactionConflictException create(
+ TableReference tableRef,
+ long timestamp,
+ Collection spanningWrites,
+ Collection dominatingWrites,
+ long elapsedMillis) {
StringBuilder sb = new StringBuilder();
- sb.append("Transaction Conflict after " + elapsedMillis + " ms for table: "
- + tableRef.getQualifiedName() + " with start timestamp: " + timestamp + "\n");
+ sb.append("Transaction Conflict after ")
+ .append(elapsedMillis)
+ .append(" ms for table: ")
+ .append(tableRef.getQualifiedName())
+ .append(" with start timestamp: ")
+ .append(timestamp)
+ .append('\n');
if (!spanningWrites.isEmpty()) {
sb.append("Another transaction wrote values before our start timestamp and committed after. Cells:\n");
formatConflicts(spanningWrites, sb);
@@ -104,8 +110,8 @@ public static TransactionConflictException create(TableReference tableRef, long
}
if (!dominatingWrites.isEmpty()) {
- sb.append("Another transaction wrote and committed between our start and end ts. " +
- "It is possible we are a long running transaction. Cells:\n");
+ sb.append("Another transaction wrote and committed between our start and end ts.")
+ .append(" It is possible we are a long running transaction. Cells:\n");
formatConflicts(dominatingWrites, sb);
sb.append('\n');
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionFailedRetriableException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionFailedRetriableException.java
index 2b5de3d87fc..c43ee52ef4c 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionFailedRetriableException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionFailedRetriableException.java
@@ -34,8 +34,7 @@ public TransactionFailedRetriableException(String message) {
}
@Override
- final public boolean canTransactionBeRetried() {
+ public final boolean canTransactionBeRetried() {
return true;
}
-
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionLockTimeoutException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionLockTimeoutException.java
index 3d466fdc2c5..5fec5ae5042 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionLockTimeoutException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionLockTimeoutException.java
@@ -16,7 +16,7 @@
package com.palantir.atlasdb.transaction.api;
/**
- * The locks to the lock server have timed out
+ * The locks to the lock server have timed out.
*
* @author carrino
*/
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionManager.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionManager.java
index de2521cf892..91d515976bc 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionManager.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionManager.java
@@ -43,7 +43,8 @@ public interface TransactionManager {
T runTaskWithRetry(TransactionTask task) throws E;
/**
- * {@link #runTaskWithRetry(TransactionTask)} should be preferred over {@link #runTaskThrowOnConflict(TransactionTask)}
+ * {@link #runTaskWithRetry(TransactionTask)} should be preferred over
+ * {@link #runTaskThrowOnConflict(TransactionTask)}.
* This method should be used unless {@link #runTaskWithRetry(TransactionTask)} cannot be used becuase the arguments
* passed are not immutable and will be modified by the transaction so doing automatic retry is unsafe.
*
@@ -62,7 +63,8 @@ public interface TransactionManager {
*
* @throws TransactionConflictException if a write-write conflict occurs
*/
- T runTaskThrowOnConflict(TransactionTask task) throws E, TransactionFailedRetriableException;
+ T runTaskThrowOnConflict(TransactionTask task)
+ throws E, TransactionFailedRetriableException;
/**
* Most atlasdb TransactionManagers will provide {@link Transaction} objects that have less than full
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionSerializableConflictException.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionSerializableConflictException.java
index 3d2e83df1ff..e79c74cfbb0 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionSerializableConflictException.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionSerializableConflictException.java
@@ -25,10 +25,13 @@ public TransactionSerializableConflictException(String message) {
super(message);
}
- public static TransactionSerializableConflictException create(TableReference tableRef, long timestamp, long elapsedMillis) {
- String msg = String.format("There was a read-write conflict on table %s. This means that this table was " +
- "marked as Serializable and another transacton wrote a different value than this transaction read. " +
- "startTs: %d elapsedMillis: %d", tableRef.getQualifiedName(), timestamp, elapsedMillis);
+ public static TransactionSerializableConflictException create(
+ TableReference tableRef,
+ long timestamp,
+ long elapsedMillis) {
+ String msg = String.format("There was a read-write conflict on table %s. This means that this table was "
+ + "marked as Serializable and another transacton wrote a different value than this transaction read. "
+ + "startTs: %d elapsedMillis: %d", tableRef.getQualifiedName(), timestamp, elapsedMillis);
return new TransactionSerializableConflictException(msg);
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionTask.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionTask.java
index df7c6551e88..8edadeba961 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionTask.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/api/TransactionTask.java
@@ -25,5 +25,5 @@
* it will have no work to do, because the list was cleared.
*/
public interface TransactionTask {
- T execute(Transaction t) throws E;
+ T execute(Transaction transaction) throws E;
}
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/service/TransactionService.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/service/TransactionService.java
index f2f71792f8c..70c5430317f 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/service/TransactionService.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/transaction/service/TransactionService.java
@@ -22,12 +22,12 @@
import com.palantir.atlasdb.keyvalue.api.KeyAlreadyExistsException;
/**
- * Transaction service is used by the atlas protocol to determine is a given transction has been
+ * Transaction service is used by the atlas protocol to determine is a given transaction has been
* committed or aborted.
*
* A given startTimestamp will only ever have one non-null value. This means that anything
* returned from this service can be aggressively cached. Caching negative look ups should not be
- * done for performance reasons. If a null value is returned, that startTimestamp will liekly be
+ * done for performance reasons. If a null value is returned, that startTimestamp will likely be
* rolled back and set to TransactionConstants.FAILED_COMMIT_TS (-1).
*
* @author carrino
@@ -39,10 +39,10 @@ public interface TransactionService {
Map get(Iterable startTimestamps);
/**
- * This operation is guarenteed to be atomic and only set the value if it hasn't already been
+ * This operation is guaranteed to be atomic and only set the value if it hasn't already been
* set.
* @throws KeyAlreadyExistsException If this value was already set, but {@link #get(long)} should
- * be called to check what the value was set to. This may throw spurriously due to retry.
+ * be called to check what the value was set to. This may throw spuriously due to retry.
* @throws RuntimeException If a runtime exception is thrown, this operation may or may
* not have ran.
*/
diff --git a/atlasdb-api/src/main/java/com/palantir/atlasdb/versions/AtlasDbVersion.java b/atlasdb-api/src/main/java/com/palantir/atlasdb/versions/AtlasDbVersion.java
index b335c54c37d..272a73bfe89 100644
--- a/atlasdb-api/src/main/java/com/palantir/atlasdb/versions/AtlasDbVersion.java
+++ b/atlasdb-api/src/main/java/com/palantir/atlasdb/versions/AtlasDbVersion.java
@@ -19,8 +19,8 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
-import com.google.common.base.Charsets;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.io.CharStreams;
@@ -44,7 +44,10 @@ public static String ensureVersionReported() {
}
public static String ensureVersionReported(PrintStream writer) {
- if (!versionPrinted && Boolean.parseBoolean(System.getProperty(REPORT_VERSION_PROPERTY, REPORT_VERSION_DEFAULT))) {
+ boolean shouldReportVersion = Boolean.parseBoolean(System.getProperty(
+ REPORT_VERSION_PROPERTY,
+ REPORT_VERSION_DEFAULT));
+ if (!versionPrinted && shouldReportVersion) {
writer.println("AtlasDB Version: " + version.get());
versionPrinted = true;
}
@@ -56,7 +59,7 @@ public static String readVersion() {
if (is == null) {
return VERSION_UNKNOWN_STRING;
}
- return CharStreams.toString(new InputStreamReader(is, Charsets.UTF_8)).trim();
+ return CharStreams.toString(new InputStreamReader(is, StandardCharsets.UTF_8)).trim();
} catch (IOException e) {
return VERSION_UNKNOWN_STRING;
}
diff --git a/atlasdb-api/src/test/java/com/palantir/atlasdb/config/LeaderConfigTest.java b/atlasdb-api/src/test/java/com/palantir/atlasdb/config/LeaderConfigTest.java
new file mode 100644
index 00000000000..5196af93f32
--- /dev/null
+++ b/atlasdb-api/src/test/java/com/palantir/atlasdb/config/LeaderConfigTest.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2016 Palantir Technologies
+ *
+ * Licensed under the BSD-3 License (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *