You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by jo...@apache.org on 2012/06/15 18:58:29 UTC
svn commit: r1350693 [1/2] - in /cayenne/sandbox: ./ cayenne-migrations/
cayenne-migrations/.settings/ cayenne-migrations/src/
cayenne-migrations/src/main/ cayenne-migrations/src/main/java/
cayenne-migrations/src/main/java/org/ cayenne-migrations/src/m...
Author: johnthuss
Date: Fri Jun 15 16:58:25 2012
New Revision: 1350693
URL: http://svn.apache.org/viewvc?rev=1350693&view=rev
Log:
Add cayenne-migrations project for creating and updating database schema
Added:
cayenne/sandbox/.gitignore
cayenne/sandbox/cayenne-migrations/
cayenne/sandbox/cayenne-migrations/.classpath
cayenne/sandbox/cayenne-migrations/.project
cayenne/sandbox/cayenne-migrations/.settings/
cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.core.resources.prefs
cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.core.prefs
cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.ui.prefs
cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.m2e.core.prefs
cayenne/sandbox/cayenne-migrations/pom.xml
cayenne/sandbox/cayenne-migrations/src/
cayenne/sandbox/cayenne-migrations/src/main/
cayenne/sandbox/cayenne-migrations/src/main/java/
cayenne/sandbox/cayenne-migrations/src/main/java/org/
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/merge/
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/merge/ArbitrarySqlToDb.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/Migration.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumn.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnExisting.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnNew.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationDatabase.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationGenerator.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationRelationship.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationTable.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationTableExisting.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationTableNew.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/Migrator.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/SqlFileMigration.java
cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/package.html
cayenne/sandbox/cayenne-migrations/src/test/
cayenne/sandbox/cayenne-migrations/src/test/java/
cayenne/sandbox/cayenne-migrations/src/test/java/org/
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/merge/
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/merge/ArbitrarySqlToDbTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigrationColumnExistingTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigrationColumnNewTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigrationDatabaseTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigrationTableExistingTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigrationTableNewTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigrationTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MigratorTest.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/MyMap0.java
cayenne/sandbox/cayenne-migrations/src/test/java/org/apache/cayenne/migration/SqlFileMigrationTest.java
cayenne/sandbox/cayenne-migrations/src/test/resources/
cayenne/sandbox/cayenne-migrations/src/test/resources/org/
cayenne/sandbox/cayenne-migrations/src/test/resources/org/apache/
cayenne/sandbox/cayenne-migrations/src/test/resources/org/apache/cayenne/
cayenne/sandbox/cayenne-migrations/src/test/resources/org/apache/cayenne/migration/
cayenne/sandbox/cayenne-migrations/src/test/resources/org/apache/cayenne/migration/Node0.sql
cayenne/sandbox/cayenne-migrations/src/test/resources/org/apache/cayenne/migration/Node1-Postgres.sql
cayenne/sandbox/cayenne-migrations/src/test/resources/org/apache/cayenne/migration/testMigrationScript.sql
Added: cayenne/sandbox/.gitignore
URL: http://svn.apache.org/viewvc/cayenne/sandbox/.gitignore?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/.gitignore (added)
+++ cayenne/sandbox/.gitignore Fri Jun 15 16:58:25 2012
@@ -0,0 +1,3 @@
+.DS_Store
+bin/
+target/
Added: cayenne/sandbox/cayenne-migrations/.classpath
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/.classpath?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/.classpath (added)
+++ cayenne/sandbox/cayenne-migrations/.classpath Fri Jun 15 16:58:25 2012
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: cayenne/sandbox/cayenne-migrations/.project
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/.project?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/.project (added)
+++ cayenne/sandbox/cayenne-migrations/.project Fri Jun 15 16:58:25 2012
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>cayenne-di</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.core.resources.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.core.resources.prefs?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.core.resources.prefs (added)
+++ cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.core.resources.prefs Fri Jun 15 16:58:25 2012
@@ -0,0 +1,3 @@
+#Mon Jun 11 14:21:47 CDT 2012
+eclipse.preferences.version=1
+encoding//src/test/resources=UTF-8
Added: cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.core.prefs?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.core.prefs (added)
+++ cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.core.prefs Fri Jun 15 16:58:25 2012
@@ -0,0 +1,330 @@
+#Mon Jun 11 14:21:47 CDT 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+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.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=48
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=48
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=48
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=48
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=48
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
+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_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=48
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=48
+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.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=1
+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_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=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_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=true
+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=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=90
+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.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+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=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=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=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=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=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_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=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_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_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=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_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_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_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_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.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=90
+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_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
Added: cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.ui.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.ui.prefs?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.ui.prefs (added)
+++ cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.jdt.ui.prefs Fri Jun 15 16:58:25 2012
@@ -0,0 +1,8 @@
+#Sun Nov 30 14:02:13 EET 2008
+eclipse.preferences.version=1
+formatter_settings_version=11
+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.ondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"></template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"></template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"></template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecom
ment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment"></template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"></template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"></template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"></template><template autoinsert\="fal
se" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*****************************************************************\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * sp
ecific language governing permissions and limitations\n * under the License.\n ****************************************************************/\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\=
"true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="inter
facebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context"
deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${tags}\n
*/</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.d
elegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="
Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templ
ates>
Added: cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.m2e.core.prefs
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.m2e.core.prefs?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.m2e.core.prefs (added)
+++ cayenne/sandbox/cayenne-migrations/.settings/org.eclipse.m2e.core.prefs Fri Jun 15 16:58:25 2012
@@ -0,0 +1,5 @@
+#Mon Jun 11 14:21:46 CDT 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: cayenne/sandbox/cayenne-migrations/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/pom.xml?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/pom.xml (added)
+++ cayenne/sandbox/cayenne-migrations/pom.xml Fri Jun 15 16:58:25 2012
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.cayenne</groupId>
+ <artifactId>cayenne-parent</artifactId>
+ <version>3.2M1-SNAPSHOT</version>
+ </parent>
+ <artifactId>cayenne-migrations</artifactId>
+ <packaging>jar</packaging>
+ <name>cayenne-migrations</name>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cayenne.unpublished</groupId>
+ <artifactId>cayenne-jdk1.5-unpublished</artifactId>
+ <version>[3.1,)</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/merge/ArbitrarySqlToDb.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/merge/ArbitrarySqlToDb.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/merge/ArbitrarySqlToDb.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/merge/ArbitrarySqlToDb.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,63 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.merge;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cayenne.dba.DbAdapter;
+
+/**
+ * A MergerToken that simply executes an explicit sql string using no mapping information (DataMap).<br>
+ * This should be considered non-portable since it doesn't rely on the adapter to generate the SQL.
+ * However, in theory, standardized SQL statements would work in a portable manner.
+ *
+ * @author john
+ *
+ */
+public class ArbitrarySqlToDb extends AbstractToDbToken {
+
+ private String sql;
+
+ public ArbitrarySqlToDb(String sql) {
+ this.sql = sql;
+ }
+
+ public String getTokenName() {
+ return "Arbitrary SQL";
+ }
+
+ public String getTokenValue() {
+ return sql;
+ }
+
+ public MergerToken createReverse(MergerFactory factory) {
+ return new DummyReverseToken(this);
+ }
+
+ public int compareTo(MergerToken token) {
+ return (token instanceof ArbitrarySqlToDb) ? 0 : 1;
+ }
+
+ @Override
+ public List<String> createSql(DbAdapter adapter) {
+ return Collections.singletonList(sql);
+ }
+
+}
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/Migration.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/Migration.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/Migration.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/Migration.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,154 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import org.apache.cayenne.access.DataNode;
+
+/**
+ * <p>Abstract class for defining database migrations. Migrations are used to create a database
+ * schema initially and to update the schema over time while keeping track of the specific versions.</p>
+ *
+ * Subclasses must implement upgrade to perform the operations necessary to change the schema. For example:
+ *
+ * <code><pre>
+ * public class Tutorial0 extends Migration {
+ *
+ * public Tutorial0(DataNode node) {
+ * super(node);
+ * }
+ *
+ * public void upgrade(MigrationDatabase db) {
+ * MigrationTableNew artist = db.createTable("Artist");
+ * cardProcessor.addIntegerColumn("artist_id", true, null);
+ * cardProcessor.addVarcharColumn("name", true, null);
+ * cardProcessor.addDateColumn("date_of_birth");
+ * cardProcessor.addPrimaryKey("cardProcessor_id");
+ *
+ * MigrationTableExisting painting = db.alterTable("Painting");
+ * painting.alterColumn("price").drop();
+ * }
+ * }
+ * </pre></code>
+ *
+ * <p>The initial migration to create a database for the first time can be generated automatically
+ * by using {@link org.apache.cayenne.migration.MigrationGenerator}.</p>
+ *
+ * @author john
+ *
+ */
+public abstract class Migration {
+
+ private DataNode node;
+ private MigrationDatabase database;
+
+ public Migration(DataNode node) {
+ this.node = node;
+ this.database = new MigrationDatabase(node);
+ }
+
+ public DataNode getDataNode() {
+ return node;
+ }
+
+ /**
+ * Subclasses needs to override this and perform databases by using the passed in db object, or by executing SQL directly.
+ *
+ * @param db
+ */
+ public abstract void upgrade(MigrationDatabase db);
+
+ void run() {
+ upgrade(database);
+ }
+
+ MigrationDatabase getDatabase() {
+ return database;
+ }
+
+// void executeOperations() {
+// MergerContext ctx = new ExecutingMergerContext(database.getDataMap(), node);
+//
+// for (MergerToken token : database.getOperations()) {
+// token.execute(ctx);
+// }
+// }
+
+ /**
+ * Adds an explicit SQL statement to the queue of operations.
+ */
+ public void executeSqlStatement(String sql) {
+ database.execute(sql);
+ }
+
+ /**
+ * Adds sql from a file in the classpath to the queue of operations.
+ *
+ * @param filename
+ */
+ public void executeSqlScript(String filename) {
+ String sql;
+ try {
+ sql = loadTextResource(filename, getClass());
+ } catch (IOException e) {
+ throw new RuntimeException("Unable to load sql script '" + filename + "' for migration: " + getClass().getSimpleName(), e);
+ }
+
+ executeSqlStatement(sql);
+ }
+
+ /**
+ * Loads a text file in the classpath.
+ *
+ * @param filename
+ * @param clazz
+ * @return
+ * @throws IOException
+ */
+ protected static String loadTextResource(String filename, Class<?> clazz) throws IOException {
+ StringBuffer buffer = new StringBuffer();
+
+ InputStream stream = clazz.getResourceAsStream(filename);
+ if (stream == null) {
+ throw new FileNotFoundException(filename);
+ }
+
+ try {
+ Reader reader = new InputStreamReader(stream, "UTF-8");
+ try {
+ int character;
+ while ((character = reader.read()) != -1) {
+ buffer.append((char)character);
+ }
+ } finally {
+ reader.close();
+ }
+ } finally {
+ stream.close();
+ }
+
+ return buffer.toString();
+ }
+
+}
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumn.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumn.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumn.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumn.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,136 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.merge.MergerFactory;
+import org.apache.cayenne.merge.ValueForNullProvider;
+
+/**
+ * Represents a column in the database and provides operations for changing the schema.
+ *
+ * Internally this holds a DbAttribute and uses it along with a MergerFactory to queue up
+ * MergerTokens to perform the schema changes.
+ *
+ * @author john
+ *
+ */
+public abstract class MigrationColumn {
+
+ private final MigrationTable table;
+ private final DbAttribute attribute;
+ private Object defaultValue;
+
+ MigrationColumn(MigrationTable table, String name, int jdbcType, int maxLength, int precision, int scale, boolean isMandatory, Object defaultValue) {
+ this.table = table;
+
+ if (this.table.getColumns().containsKey(name)) {
+ throw new IllegalStateException(name + " has already been added to table: " + table.getEntity().getName());
+ }
+ this.table.getColumns().put(name, this);
+
+ this.attribute = new DbAttribute(name);
+ attribute.setEntity(table.getEntity());
+ table.getEntity().addAttribute(attribute);
+
+ attribute.setType(jdbcType);
+ attribute.setMandatory(isMandatory);
+ attribute.setScale(scale);
+ if (precision > -1) {
+ attribute.setAttributePrecision(precision);
+ attribute.setMaxLength(precision);
+ } else {
+ attribute.setMaxLength(maxLength);
+ }
+ this.defaultValue = defaultValue;
+ }
+
+ MigrationTable getTable() {
+ return table;
+ }
+
+ DbAttribute getAttribute() {
+ return attribute;
+ }
+
+ Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ MergerFactory factory() {
+ return table.factory();
+ }
+
+ abstract boolean isNew();
+
+ /**
+ * Changes the default value for a column. Pass NULL to remove the default.
+ * @param value the new default or NULL for no default
+ */
+ protected MigrationColumn setDefault(final Object value) {
+ getTable().getDatabase().addOperation(factory().createSetValueForNullToDb(getTable().getEntity(), getAttribute(), new ValueForNullProvider() {
+ public boolean hasValueFor(DbEntity entity, DbAttribute column) {
+ return value != null;
+ }
+ public List<String> createSql(DbEntity entity, DbAttribute column) {
+ return Collections.singletonList(alterColumnDefaultValue(getAttribute(), value));
+ }
+ }));
+ return this;
+ }
+
+ /**
+ * @return an SQL statement that will add or remove a default value to/from a column
+ */
+ protected String alterColumnDefaultValue(DbAttribute column, Object defaultValue) {
+ return String.format("ALTER TABLE %s ALTER %s SET DEFAULT %s",
+ column.getEntity().getName(),
+ column.getName(),
+ sqlForLiteral(defaultValue));
+ }
+
+ /**
+ * @return 'value' as a literal sql string
+ */
+ protected String sqlForLiteral(Object value) {
+ if (value == null) {
+ return "null";
+ } else if (value instanceof String) {
+ return "'" + value + "'";
+ } else if (value instanceof BigDecimal) {
+ return ((BigDecimal) value).toPlainString();
+ } else if (value instanceof Number) {
+ return value.toString();
+ } else if (value instanceof Date) {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ return "'" + dateFormat.format(value) + "'";
+ } else {
+ return value.toString();
+ }
+ }
+
+}
+
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnExisting.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnExisting.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnExisting.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnExisting.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,106 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import java.sql.Types;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.merge.ValueForNullProvider;
+
+
+
+/**
+ * Represents an existing column in the database and provides operations for changing the schema.
+ *
+ * Internally this holds a DbAttribute and uses it along with a MergerFactory to queue up
+ * MergerTokens to perform the schema changes.
+ *
+ * @author john
+ *
+ */
+public class MigrationColumnExisting extends MigrationColumn {
+
+ MigrationColumnExisting(MigrationTable table, String name) {
+ super(table, name, Types.OTHER, 0, 0, 0, false, null);
+ }
+
+ @Override
+ boolean isNew() {
+ return false;
+ }
+
+ /**
+ * Adds a "NOT NULL" constraint to an existing column.
+ */
+ public MigrationColumnExisting addNotNullConstraint() {
+ getAttribute().setMandatory(true);
+ getTable().getDatabase().addOperation(factory().createSetNotNullToDb(getTable().getEntity(), getAttribute()));
+ return this;
+ }
+
+ /**
+ * Removes a "NOT NULL" constraint from an existing column.
+ */
+ public MigrationColumnExisting dropNotNullConstraint() {
+ getAttribute().setMandatory(false);
+ getTable().getDatabase().addOperation(factory().createSetAllowNullToDb(getTable().getEntity(), getAttribute()));
+ return this;
+ }
+
+ /**
+ * Changes the data type for an existing column with configurable precision and scale.
+ * @param jdbcType
+ * @param precision
+ * @param scale
+ */
+ public MigrationColumnExisting setDataType(int jdbcType, int precision, int scale) {
+ getAttribute().setType(jdbcType);
+ getAttribute().setAttributePrecision(precision);
+ getAttribute().setMaxLength(precision);
+ getAttribute().setScale(scale);
+ getTable().getDatabase().addOperation(factory().createSetColumnTypeToDb(getTable().getEntity(), getAttribute(), getAttribute()));
+ return this;
+ }
+
+ /**
+ * Changes the data type for an existing column with configure width
+ * @param jdbcType
+ * @param width
+ */
+ public MigrationColumnExisting setDataType(int jdbcType, int width) {
+ getAttribute().setType(jdbcType);
+ getAttribute().setMaxLength(width);
+ getTable().getDatabase().addOperation(factory().createSetColumnTypeToDb(getTable().getEntity(), getAttribute(), getAttribute()));
+ return this;
+ }
+
+ /**
+ * Changes the data type for an existing column
+ * @param jdbcType
+ */
+ public MigrationColumnExisting setDataType(int jdbcType) {
+ getAttribute().setType(jdbcType);
+ getTable().getDatabase().addOperation(factory().createSetColumnTypeToDb(getTable().getEntity(), getAttribute(), getAttribute()));
+ return this;
+ }
+
+}
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnNew.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnNew.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnNew.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationColumnNew.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,55 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import org.apache.cayenne.merge.MergerToken;
+
+/**
+ * Represents a new column in the database.
+ *
+ * Internally this holds a DbAttribute and uses it along with a MergerFactory to queue up
+ * MergerTokens to perform the schema changes.
+ *
+ * @author john
+ *
+ */
+public class MigrationColumnNew extends MigrationColumn {
+
+ MigrationColumnNew(MigrationTable table, String name, int jdbcType, int maxLength, int precision, int scale, boolean isMandatory, Object defaultValue) {
+ super(table, name, jdbcType, maxLength, precision, scale, isMandatory, defaultValue);
+ if (!table.isNew()) {
+ create();
+ }
+
+ if (getDefaultValue() != null) {
+ setDefault(getDefaultValue());
+ }
+ }
+
+ @Override
+ boolean isNew() {
+ return true;
+ }
+
+ protected void create() {
+ MergerToken op = factory().createAddColumnToDb(getTable().getEntity(), getAttribute());
+ getTable().getDatabase().addOperation(op);
+ }
+
+}
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationDatabase.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationDatabase.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationDatabase.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationDatabase.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,131 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.merge.ArbitrarySqlToDb;
+import org.apache.cayenne.merge.MergerFactory;
+import org.apache.cayenne.merge.MergerToken;
+
+/**
+ * Represents the database and provides operations for changing the schema.
+ *
+ * Internally this holds a DataMap and uses it along with a MergerFactory to queue up
+ * MergerTokens to perform the schema changes.
+ *
+ * @author john
+ *
+ */
+public class MigrationDatabase {
+
+ private List<MergerToken> operations = new ArrayList<MergerToken>();
+ private DbAdapter adapter;
+ private DataMap map = new DataMap("GeneratedMigration");
+ private Map<String, MigrationTable> tables = new HashMap<String, MigrationTable>();
+
+ MigrationDatabase(DataNode node) {
+ this.adapter = node.getAdapter();
+ }
+
+ /**
+ * Creates a new table in the database.
+ * @param tableName
+ * @return
+ */
+ public MigrationTableNew createTable(String tableName) {
+ MigrationTable result;
+ if (tables.get(tableName) != null) {
+ if (!tables.get(tableName).isNew()) {
+ throw new IllegalArgumentException(tableName + " is an existing table, it cannot be created.");
+ } else {
+ throw new IllegalArgumentException(tableName + " has already been created.");
+ }
+ } else {
+ result = new MigrationTableNew(this, tableName);
+ tables.put(tableName, result);
+ }
+
+ return (MigrationTableNew) result;
+ }
+
+ /**
+ * Returns an existing table that can be modified.
+ * @param tableName
+ * @return
+ */
+ public MigrationTableExisting alterTable(String tableName) {
+ MigrationTable result;
+ if (tables.get(tableName) != null) {
+ result = tables.get(tableName);
+ if (result.isNew()) {
+ throw new IllegalArgumentException(tableName + " is a new table; it cannot be altered.");
+ }
+ } else {
+ result = new MigrationTableExisting(this, tableName);
+ tables.put(tableName, result);
+ }
+
+ return (MigrationTableExisting) result;
+ }
+
+ /**
+ * Removes a table from the database.
+ */
+ public void dropTable(String tableName) {
+ MigrationTable table = alterTable(tableName);
+ MergerToken op = factory().createDropTableToDb(table.getEntity());
+ addOperation(op);
+ }
+
+ DataMap getDataMap() {
+ return map;
+ }
+
+ DbAdapter getAdapter() {
+ return adapter;
+ }
+
+ MergerFactory factory() {
+ return adapter.mergerFactory();
+ }
+
+ void addOperation(MergerToken operation) {
+ operations.add(operation);
+ }
+
+ List<MergerToken> getOperations() {
+ return operations;
+ }
+
+ /**
+ * Add an arbitrary SQL operation to the list of operations to be performed
+ * @param sql
+ */
+ public void execute(String sql) {
+ addOperation(new ArbitrarySqlToDb(sql));
+ }
+
+}
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationGenerator.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationGenerator.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationGenerator.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,235 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+import java.sql.Types;
+
+import org.apache.cayenne.configuration.server.ServerRuntime;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.DbRelationship;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Given a Cayenne project file (model) this will generate a Migration subclass that
+ * includes all the operations to create a database from scratch for the first time.
+ *
+ * @author john
+ *
+ */
+public class MigrationGenerator {
+
+ /**
+ * Runs the generator. Expects 2 arguments:<br>
+ * 1) The name or path to the cayenne project file (for example, "cayenne-MyDomain.xml")<br>
+ * 2) The output path for the generated java source files.
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ if (args.length != 2) {
+ System.out.println("Usage:");
+ System.out.println("java " + MigrationGenerator.class.getName() + " <cayenne-Project.xml> <output-folder>");
+ return;
+ }
+
+ MigrationGenerator gen = new MigrationGenerator();
+ gen.generateInitialMigration(args[0], args[1]);
+ }
+
+ private StringBuilder buffer;
+ private ServerRuntime runtime;
+
+ public MigrationGenerator() {
+ }
+
+ /**
+ * Generates the migration code necessary to recreate the entire database as defined by the cayenne project (model).
+ *
+ * @param configurationLocation
+ * @param outputFolder
+ */
+ public void generateInitialMigration(String configurationLocation, String outputFolder) {
+ runtime = new ServerRuntime(configurationLocation);
+ for (DataMap map : runtime.getDataDomain().getDataMaps()) {
+ generateInitialMigration(map, outputFolder + "/" + className(map) + ".java");
+ };
+ }
+
+ private String className(DataMap map) {
+ return StringUtils.capitalize(map.getName()) + "0";
+ }
+
+ protected void generateInitialMigration(DataMap map, String outputFilename) {
+ buffer = new StringBuilder();
+ buffer.append(
+ "import org.apache.cayenne.access.DataNode;\n" +
+ "\n" +
+ "import org.apache.cayenne.migration.Migration;\n" +
+ "import org.apache.cayenne.migration.MigrationDatabase;\n" +
+ "import org.apache.cayenne.migration.MigrationTableNew;\n" +
+ "\n" +
+ "public class " + className(map) + " extends Migration {\n" +
+ "\n" +
+ "\tpublic " + className(map) + "(DataNode node) {\n" +
+ "\t\tsuper(node);\n" +
+ "\t}\n" +
+ "\n" +
+ "\tpublic void upgrade(MigrationDatabase db) {\n" +
+ "");
+
+ for (DbEntity entity : map.getDbEntities()) {
+ createTable(entity);
+ }
+
+ buffer.append("\n");
+
+ for (DbEntity entity : map.getDbEntities()) {
+ createForeignKeysForTable(entity);
+ }
+
+ buffer.append("\t}\n" +
+ "\n" +
+ "}");
+
+ try {
+ new File(outputFilename).getParentFile().mkdirs();
+
+ Writer writer = new FileWriter(outputFilename);
+ writer.write(buffer.toString());
+ writer.flush();
+ writer.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void createTable(DbEntity entity) {
+ String tableName = tableName(entity);
+ buffer.append("\t\tMigrationTableNew " + tableName + " = db.createTable(\"" + entity.getName() + "\");\n");
+
+ for (DbAttribute attribute : entity.getAttributes()) {
+ String type = nameForJdbcType(attribute.getType());
+ type = StringUtils.capitalize(type);
+
+ buffer.append("\t\t");
+
+ if (type == null) {
+ // fixed point
+ if (attribute.getScale() >= 0) {
+ buffer.append(String.format("%s.addColumn(\"%s\", %d, %d, %d", tableName, attribute.getName(), attribute.getType(), attribute.getMaxLength(), attribute.getScale()));
+
+ // character
+ } else if (attribute.getMaxLength() >= 0) {
+ buffer.append(String.format("%s.addColumn(\"%s\", %d, %d", tableName, attribute.getName(), attribute.getType(), attribute.getMaxLength()));
+
+ // other
+ } else {
+ buffer.append(String.format("%s.addColumn(\"%s\", %d", tableName, attribute.getName(), attribute.getType()));
+ }
+ } else {
+ // fixed point
+ if (isFixedPoint(attribute.getType()) && attribute.getScale() >= 0) {
+ buffer.append(String.format("%s.add%sColumn(\"%s\", %d, %d", tableName, type, attribute.getName(), attribute.getMaxLength(), attribute.getScale()));
+
+ // character
+ } else if (hasLength(attribute.getType()) && attribute.getMaxLength() >= 0) {
+ buffer.append(String.format("%s.add%sColumn(\"%s\", %d", tableName, type, attribute.getName(), attribute.getMaxLength()));
+
+ // other
+ } else {
+ buffer.append(String.format("%s.add%sColumn(\"%s\"", tableName, type, attribute.getName()));
+ }
+ }
+
+ if (attribute.isMandatory()) {
+ buffer.append(", true, null");
+ }
+
+ buffer.append(");\n");
+ }
+
+ for (DbAttribute attribute : entity.getPrimaryKeys()) {
+ buffer.append(String.format("\t\t%s.addPrimaryKey(\"%s\");\n", tableName, attribute.getName()));
+ }
+
+ buffer.append("\n");
+ }
+
+ protected void createForeignKeysForTable(DbEntity entity) {
+ String tableName = tableName(entity);
+
+ for (DbRelationship relationship : entity.getRelationships()) {
+ if (!relationship.isToMany() && relationship.isToPK()) {
+ buffer.append(String.format("\t\t%s.addForeignKey(\"%s\", \"%s\", \"%s\");\n", tableName,
+ relationship.getSourceAttributes().iterator().next().getName(),
+ relationship.getTargetEntity().getName(),
+ relationship.getTargetAttributes().iterator().next().getName()));
+ }
+ }
+ }
+
+ protected String tableName(DbEntity entity) {
+ return StringUtils.uncapitalize(entity.getName());
+ }
+
+ protected String nameForJdbcType(int type) {
+ switch (type) {
+ case Types.ARRAY: return "array";
+ case Types.BIGINT: return "bigInt";
+ case Types.BINARY: return "binary";
+ case Types.BIT: return "bit";
+ case Types.BLOB: return "blob";
+ case Types.BOOLEAN: return "boolean";
+ case Types.CHAR: return "char";
+ case Types.CLOB: return "clob";
+ case Types.DATE: return "date";
+ case Types.DECIMAL: return "decimal";
+ case Types.DOUBLE: return "double";
+ case Types.FLOAT: return "float";
+ case Types.INTEGER: return "integer";
+ case Types.LONGVARBINARY: return "longVarBinary";
+ case Types.LONGVARCHAR: return "longVarChar";
+ case Types.NUMERIC: return "numeric";
+ case Types.REAL: return "real";
+ case Types.SMALLINT: return "smallInt";
+ case Types.TIME: return "time";
+ case Types.TIMESTAMP: return "timestamp";
+ case Types.TINYINT: return "tinyInt";
+ case Types.VARBINARY: return "varBinary";
+ case Types.VARCHAR: return "varchar";
+ default:
+ return null;
+ }
+ }
+
+ protected boolean isFixedPoint(int type) {
+ return type == Types.DECIMAL || type == Types.NUMERIC;
+ }
+
+ protected boolean hasLength(int type) {
+ return type == Types.BINARY || type == Types.CHAR ||
+ type == Types.VARBINARY || type == Types.VARCHAR;
+ }
+
+}
Added: cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationRelationship.java
URL: http://svn.apache.org/viewvc/cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationRelationship.java?rev=1350693&view=auto
==============================================================================
--- cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationRelationship.java (added)
+++ cayenne/sandbox/cayenne-migrations/src/main/java/org/apache/cayenne/migration/MigrationRelationship.java Fri Jun 15 16:58:25 2012
@@ -0,0 +1,77 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.apache.cayenne.migration;
+
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.map.DbJoin;
+import org.apache.cayenne.map.DbRelationship;
+import org.apache.cayenne.merge.MergerFactory;
+
+/**
+ * Represents a foreign key constraint in the database and provides operations for changing the schema.
+ *
+ * Internally this holds a DbRelationship and uses it along with a MergerFactory to queue up
+ * MergerTokens to perform the schema changes.
+ *
+ * @author john
+ *
+ */
+class MigrationRelationship {
+
+ private final MigrationTable table;
+ private final DbRelationship relationship;
+
+ MigrationRelationship(MigrationTable table, String sourceColumnName, String destinationTable, String destinationColumnName) {
+ this.table = table;
+
+ if (table.getEntity().getAttribute(sourceColumnName) == null) {
+ DbAttribute sourceAttribute = new DbAttribute(sourceColumnName);
+ table.getEntity().addAttribute(sourceAttribute);
+ sourceAttribute.setEntity(table.getEntity());
+ }
+
+ relationship = new DbRelationship("relationship" + table.getEntity().getRelationships().size());
+ relationship.setSourceEntity(table.getEntity());
+ table.getEntity().addRelationship(relationship);
+
+ relationship.setTargetEntityName(destinationTable);
+ relationship.addJoin(new DbJoin(relationship, sourceColumnName, destinationColumnName));
+
+ if (table.getDatabase().getDataMap().getDbEntity(destinationTable) == null) {
+ DbEntity targetEntity = new DbEntity(destinationTable);
+ table.getDatabase().getDataMap().addDbEntity(targetEntity);
+ targetEntity.setDataMap(table.getDatabase().getDataMap());
+
+ DbAttribute targetAttribute = new DbAttribute(destinationColumnName);
+ targetEntity.addAttribute(targetAttribute);
+ targetAttribute.setEntity(targetEntity);
+ targetAttribute.setPrimaryKey(true);
+ }
+ }
+
+ DbRelationship getRelationship() {
+ return relationship;
+ }
+
+ MergerFactory factory() {
+ return table.factory();
+ }
+
+}