You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/10/09 06:07:25 UTC
svn commit: r454271 - in /incubator/cayenne/sandbox/asm-enhancer: ./
.settings/ main/ main/src/ main/src/java/ main/src/java/org/
main/src/java/org/apache/ main/src/java/org/apache/cayenne/
main/src/java/org/apache/cayenne/jpa/ main/src/java/org/apache...
Author: aadamchik
Date: Sun Oct 8 21:07:23 2006
New Revision: 454271
URL: http://svn.apache.org/viewvc?view=rev&rev=454271
Log:
Prototyping ASM enahncer. Cglib is a mess, we need something that works and at least minimally documented.
Added:
incubator/cayenne/sandbox/asm-enhancer/.classpath
incubator/cayenne/sandbox/asm-enhancer/.project
incubator/cayenne/sandbox/asm-enhancer/.settings/
incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.core.prefs
incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.ui.prefs
incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.ltk.core.refactoring.prefs
incubator/cayenne/sandbox/asm-enhancer/main/
incubator/cayenne/sandbox/asm-enhancer/main/src/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/AsmEnhancer.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/EnhancerUtil.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistenceDelegate.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentClassVisitor.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentGetterVisitor.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentSetterVisitor.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapter.java
incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactory.java
incubator/cayenne/sandbox/asm-enhancer/main/test/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/AsmEnhancerTest.java
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/EnhancingClassLoader.java
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockEnhancedPojo.java
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPersistenceDelegate.java
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPojo1.java
incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactoryTest.java
incubator/cayenne/sandbox/asm-enhancer/pom.xml
Added: incubator/cayenne/sandbox/asm-enhancer/.classpath
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/.classpath?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/.classpath (added)
+++ incubator/cayenne/sandbox/asm-enhancer/.classpath Sun Oct 8 21:07:23 2006
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="main/src/java"/>
+ <classpathentry kind="src" path="main/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: incubator/cayenne/sandbox/asm-enhancer/.project
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/.project?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/.project (added)
+++ incubator/cayenne/sandbox/asm-enhancer/.project Sun Oct 8 21:07:23 2006
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>asm-enhancer</name>
+ <comment>ASM Enhancer</comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.core.prefs?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.core.prefs Sun Oct 8 21:07:23 2006
@@ -0,0 +1,303 @@
+#Sun Jul 23 18:13:04 EDT 2006
+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.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.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=error
+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.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=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.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=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=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+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.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_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.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_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_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.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
Added: incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.ui.prefs
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.ui.prefs?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.ui.prefs (added)
+++ incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.jdt.ui.prefs Sun Oct 8 21:07:23 2006
@@ -0,0 +1,8 @@
+#Sun Jul 23 18:13:03 EDT 2006
+eclipse.preferences.version=1
+formatter_settings_version=10
+internal.default.compliance=default
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+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\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author \n */</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><templ
ate autoinsert\="false" 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 Lic
ense for the\n * specific 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><t
emplate 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\="t
rue" context\="interfacebody_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></templates>
Added: incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.ltk.core.refactoring.prefs
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.ltk.core.refactoring.prefs?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.ltk.core.refactoring.prefs (added)
+++ incubator/cayenne/sandbox/asm-enhancer/.settings/org.eclipse.ltk.core.refactoring.prefs Sun Oct 8 21:07:23 2006
@@ -0,0 +1,3 @@
+#Sun Oct 08 21:44:07 EDT 2006
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/AsmEnhancer.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/AsmEnhancer.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/AsmEnhancer.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/AsmEnhancer.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,51 @@
+package org.apache.cayenne.jpa.enhancer;
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.security.ProtectionDomain;
+import java.util.Collection;
+import java.util.Map;
+
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+
+public class AsmEnhancer implements ClassFileTransformer {
+
+ protected Map<String, Collection<String>> persistentPropertiesByClass;
+
+ public AsmEnhancer(
+ Map<String, Collection<String>> persistentPropertiesByClass) {
+ this.persistentPropertiesByClass = persistentPropertiesByClass;
+ }
+
+ public byte[] transform(ClassLoader loader, String className,
+ Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
+ byte[] classfileBuffer) throws IllegalClassFormatException {
+
+ ClassReader reader = new ClassReader(classfileBuffer);
+ ClassWriter writer = new ClassWriter(reader, true);
+
+ ClassVisitor visitor = createVisitor(className, writer);
+ if (visitor == null) {
+ // per JPA spec if no transformation occured, we must return null
+ return null;
+ }
+
+ reader.accept(visitor, true);
+ return writer.toByteArray();
+ }
+
+ /**
+ * Builds a chain of ASM visitors.
+ */
+ protected ClassVisitor createVisitor(String className, ClassWriter writer) {
+ Collection<String> properties = persistentPropertiesByClass
+ .get(className);
+ if (properties == null || properties.isEmpty()) {
+ return null;
+ }
+
+ return new PersistentClassVisitor(writer, properties);
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/EnhancerUtil.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/EnhancerUtil.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/EnhancerUtil.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/EnhancerUtil.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,32 @@
+package org.apache.cayenne.jpa.enhancer;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+// duplicated from JpaClassDescriptor.
+class EnhancerUtil {
+ private static final Pattern GETTER_PATTERN = Pattern
+ .compile("^(is|get)([A-Z])(.*)$");
+
+ private static final Pattern SETTER_PATTERN = Pattern
+ .compile("^set([A-Z])(.*)$");
+
+ static String propertyNameForGetter(String getterName) {
+ Matcher getMatch = GETTER_PATTERN.matcher(getterName);
+ if (getMatch.matches()) {
+ return getMatch.group(2).toLowerCase() + getMatch.group(3);
+ }
+
+ return null;
+ }
+
+ static String propertyNameForSetter(String setterName) {
+ Matcher setMatch = SETTER_PATTERN.matcher(setterName);
+
+ if (setMatch.matches()) {
+ return setMatch.group(1).toLowerCase() + setMatch.group(2);
+ }
+
+ return null;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistenceDelegate.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistenceDelegate.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistenceDelegate.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistenceDelegate.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,32 @@
+/*****************************************************************
+ * 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.jpa.enhancer;
+
+/**
+ * An interface injected by the framework in the persisted objects that provides
+ * callback methods for lazy faulting and change tracking.
+ *
+ * @author Andrus Adamchik
+ */
+public interface PersistenceDelegate {
+
+ void prepareForAccess(String property);
+
+ void prepareForUpdate(String property);
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentClassVisitor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentClassVisitor.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentClassVisitor.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentClassVisitor.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,69 @@
+package org.apache.cayenne.jpa.enhancer;
+
+import java.util.Collection;
+
+import org.objectweb.asm.ClassAdapter;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+class PersistentClassVisitor extends ClassAdapter {
+
+ private String className;
+
+ private Collection<String> enhancedProperties;
+
+ PersistentClassVisitor(ClassVisitor visitor,
+ Collection<String> enhancedProperties) {
+ super(visitor);
+ this.enhancedProperties = enhancedProperties;
+ }
+
+ /**
+ * Handles injection of additional fields and Persistent interface
+ * properties.
+ */
+ @Override
+ public void visit(int version, int access, String name, String signature,
+ String superName, String[] interfaces) {
+
+ this.className = name;
+
+ super.visit(version, access, name, signature, superName, interfaces);
+
+ // inject persistence delegate field.
+ FieldVisitor fv = visitField(
+ Opcodes.ACC_PUBLIC + Opcodes.ACC_TRANSIENT,
+ PojoAdapterFactory.PERSISTENCE_DELEGATE_FIELD,
+ "Lorg/apache/cayenne/jpa/enhancer/PersistenceDelegate;", null,
+ null);
+ fv.visitEnd();
+ }
+
+ /**
+ * Handles getter and setter enhancements.
+ */
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc,
+ String signature, String[] exceptions) {
+
+ MethodVisitor mv = super.visitMethod(access, name, desc, signature,
+ exceptions);
+
+ // TODO: andrus, 10/8/2006 - check method sig for real... just checking
+ // the name is not enough
+
+ String getProperty = EnhancerUtil.propertyNameForGetter(name);
+ if (getProperty != null && enhancedProperties.contains(getProperty)) {
+ return new PersistentGetterVisitor(mv, className, getProperty);
+ }
+
+ String setProperty = EnhancerUtil.propertyNameForSetter(name);
+ if (setProperty != null && enhancedProperties.contains(setProperty)) {
+ return new PersistentSetterVisitor(mv, className, setProperty);
+ }
+
+ return mv;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentGetterVisitor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentGetterVisitor.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentGetterVisitor.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentGetterVisitor.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,40 @@
+package org.apache.cayenne.jpa.enhancer;
+
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodAdapter;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+class PersistentGetterVisitor extends MethodAdapter {
+
+ private String className;
+ private String propertyName;
+
+ PersistentGetterVisitor(MethodVisitor mv, String className,
+ String propertyName) {
+ super(mv);
+ this.className = className;
+ this.propertyName = propertyName;
+ }
+
+ @Override
+ public void visitCode() {
+ super.visitCode();
+
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, className,
+ "$cayenne_persistenceDelegate",
+ "Lorg/apache/cayenne/jpa/enhancer/PersistenceDelegate;");
+ Label l1 = new Label();
+ mv.visitJumpInsn(Opcodes.IFNULL, l1);
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, className,
+ PojoAdapterFactory.PERSISTENCE_DELEGATE_FIELD,
+ "Lorg/apache/cayenne/jpa/enhancer/PersistenceDelegate;");
+ mv.visitLdcInsn(propertyName);
+ mv.visitMethodInsn(Opcodes.INVOKEINTERFACE,
+ "org/apache/cayenne/jpa/enhancer/PersistenceDelegate",
+ "prepareForAccess", "(Ljava/lang/String;)V");
+ mv.visitLabel(l1);
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentSetterVisitor.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentSetterVisitor.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentSetterVisitor.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PersistentSetterVisitor.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,41 @@
+package org.apache.cayenne.jpa.enhancer;
+
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodAdapter;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+class PersistentSetterVisitor extends MethodAdapter {
+
+ private String className;
+
+ private String propertyName;
+
+ PersistentSetterVisitor(MethodVisitor mv, String className,
+ String propertyName) {
+ super(mv);
+ this.className = className;
+ this.propertyName = propertyName;
+ }
+
+ @Override
+ public void visitCode() {
+ super.visitCode();
+
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, className,
+ PojoAdapterFactory.PERSISTENCE_DELEGATE_FIELD,
+ "Lorg/apache/cayenne/jpa/enhancer/PersistenceDelegate;");
+ Label l1 = new Label();
+ mv.visitJumpInsn(Opcodes.IFNULL, l1);
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitFieldInsn(Opcodes.GETFIELD, className,
+ PojoAdapterFactory.PERSISTENCE_DELEGATE_FIELD,
+ "Lorg/apache/cayenne/jpa/enhancer/PersistenceDelegate;");
+ mv.visitLdcInsn(propertyName);
+ mv.visitMethodInsn(Opcodes.INVOKEINTERFACE,
+ "org/apache/cayenne/jpa/enhancer/PersistenceDelegate",
+ "prepareForUpdate", "(Ljava/lang/String;)V");
+ mv.visitLabel(l1);
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapter.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapter.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapter.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapter.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,75 @@
+/*****************************************************************
+ * 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.jpa.enhancer;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.Persistent;
+
+/**
+ * An adapter for a POJO that makes POJO's accessible to Cayenne.
+ *
+ * @author Andrus Adamchik
+ */
+public class PojoAdapter implements PersistenceDelegate, Persistent {
+
+ protected Object object;
+ protected ObjectContext objectContext;
+ protected int persistenceState;
+ protected ObjectId objectId;
+
+ public PojoAdapter(Object object) {
+ this.object = object;
+ }
+
+ public Object getObject() {
+ return object;
+ }
+
+ public void prepareForAccess(String property) {
+ objectContext.prepareForAccess(this, property);
+ }
+
+ public void prepareForUpdate(String property) {
+ }
+
+ public ObjectContext getObjectContext() {
+ return objectContext;
+ }
+
+ public ObjectId getObjectId() {
+ return objectId;
+ }
+
+ public int getPersistenceState() {
+ return persistenceState;
+ }
+
+ public void setObjectContext(ObjectContext objectContext) {
+ this.objectContext = objectContext;
+ }
+
+ public void setObjectId(ObjectId id) {
+ this.objectId = id;
+ }
+
+ public void setPersistenceState(int state) {
+ this.persistenceState = state;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactory.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactory.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/src/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactory.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,68 @@
+/*****************************************************************
+ * 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.jpa.enhancer;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cayenne.Persistent;
+import org.apache.cayenne.property.FieldAccessor;
+import org.apache.cayenne.property.PropertyAccessor;
+
+/**
+ * A factory that creates {@link PojoAdapter} instances.
+ *
+ * @author Andrus Adamchik
+ */
+public class PojoAdapterFactory {
+
+ static final String PERSISTENCE_DELEGATE_FIELD = "$cayenne_persistenceDelegate";
+
+ protected Map<String, PropertyAccessor> injectors;
+
+ public PojoAdapterFactory() {
+ injectors = new HashMap<String, PropertyAccessor>();
+ }
+
+ /**
+ * Wraps a pojo in an adapter instance, injecting adapter in the enhanced object for
+ * callbacks.
+ */
+ public Persistent makePersistent(Object object) {
+ if (object == null) {
+ throw new NullPointerException("Null pojo");
+ }
+ PropertyAccessor adapterInjector;
+
+ synchronized (injectors) {
+ adapterInjector = injectors.get(object.getClass().getName());
+ if (adapterInjector == null) {
+ adapterInjector = new FieldAccessor(
+ object.getClass(),
+ PERSISTENCE_DELEGATE_FIELD,
+ PersistenceDelegate.class);
+ }
+ }
+
+ PojoAdapter adapter = new PojoAdapter(object);
+ adapterInjector.writePropertyDirectly(object, null, adapter);
+
+ return adapter;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/AsmEnhancerTest.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/AsmEnhancerTest.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/AsmEnhancerTest.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/AsmEnhancerTest.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,82 @@
+package org.apache.cayenne.jpa.enhancer;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.cayenne.property.PropertyUtils;
+
+public class AsmEnhancerTest extends TestCase {
+
+ public static final String C1 = "org.apache.cayenne.jpa.enhancer.MockPojo1";
+
+ protected ClassLoader loader;
+
+ @Override
+ protected void setUp() throws Exception {
+ Collection<String> managedClasses = new ArrayList<String>();
+ managedClasses.add(C1);
+
+ Map<String, Collection<String>> enhancedPropertyMap = new HashMap<String, Collection<String>>();
+
+ Collection<String> c1 = new HashSet<String>();
+ c1.add("attribute1");
+ enhancedPropertyMap.put(C1, c1);
+
+ loader = new EnhancingClassLoader(new AsmEnhancer(enhancedPropertyMap));
+ }
+
+ public void testPersistenceDelegatePropertyInjected() throws Exception {
+
+ Class e1Class = Class.forName(C1, true, loader);
+ assertNotNull(e1Class);
+ assertEquals(C1, e1Class.getName());
+
+ Field f = e1Class
+ .getDeclaredField(PojoAdapterFactory.PERSISTENCE_DELEGATE_FIELD);
+ assertTrue(PersistenceDelegate.class.isAssignableFrom(f.getType()));
+ assertTrue(!Modifier.isStatic(f.getModifiers()));
+ assertTrue(Modifier.isPublic(f.getModifiers()));
+ assertTrue(!Modifier.isFinal(f.getModifiers()));
+ assertTrue(Modifier.isTransient(f.getModifiers()));
+ }
+
+ public void testGetterCallbackInjected() throws Exception {
+
+ Class e1Class = Class.forName(C1, true, loader);
+ assertNotNull(e1Class);
+ assertEquals(C1, e1Class.getName());
+
+ Object o = e1Class.newInstance();
+
+ // assert with no delegate (make sure no NPE is thrown)
+ assertNull(PropertyUtils.getProperty(o, "attribute1"));
+ PropertyUtils.setProperty(o, "attribute1", "x");
+ assertEquals("x", PropertyUtils.getProperty(o, "attribute1"));
+
+ // now test if callbacks are executed
+
+ Field f = e1Class
+ .getDeclaredField(PojoAdapterFactory.PERSISTENCE_DELEGATE_FIELD);
+
+ MockPersistenceDelegate delegate = new MockPersistenceDelegate();
+ f.set(o, delegate);
+
+ assertEquals("x", PropertyUtils.getProperty(o, "attribute1"));
+ assertEquals("attribute1", delegate.getPreparedForAccess());
+ assertNull(delegate.getPreparedForUpdate());
+
+ delegate = new MockPersistenceDelegate();
+ f.set(o, delegate);
+ PropertyUtils.setProperty(o, "attribute1", "y");
+ assertNull(delegate.getPreparedForAccess());
+ assertEquals("attribute1", delegate.getPreparedForUpdate());
+ assertEquals("y", PropertyUtils.getProperty(o, "attribute1"));
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/EnhancingClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/EnhancingClassLoader.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/EnhancingClassLoader.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/EnhancingClassLoader.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,132 @@
+/*****************************************************************
+ * 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.jpa.enhancer;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.security.SecureClassLoader;
+
+public class EnhancingClassLoader extends SecureClassLoader {
+
+ protected ClassFileTransformer transformer;
+
+ public EnhancingClassLoader(ClassFileTransformer transformer) {
+ super(Thread.currentThread().getContextClassLoader());
+ this.transformer = transformer;
+ }
+
+ /**
+ * Returns true if the class does not need to be enhanced.
+ */
+ protected boolean skipClassEnhancement(String className) {
+ return transformer == null;
+ }
+
+ @Override
+ protected synchronized Class<?> loadClass(String name, boolean resolve)
+ throws ClassNotFoundException {
+
+ if (skipClassEnhancement(name)) {
+ return super.loadClass(name, resolve);
+ }
+
+ Class c = findLoadedClass(name);
+
+ if (c == null) {
+ c = findClass(name);
+ }
+
+ if (resolve) {
+ resolveClass(c);
+ }
+
+ return c;
+ }
+
+ /**
+ * If a class name is one of the managed classes, loads it
+ */
+ @Override
+ protected Class<?> findClass(String name) throws ClassNotFoundException {
+ if (skipClassEnhancement(name)) {
+ return Class.forName(name, true, getParent());
+ } else {
+ return findEnhancedClass(name);
+ }
+ }
+
+ /**
+ * Loads class bytes, and passes them through the registered
+ * ClassTransformers.
+ */
+ protected Class<?> findEnhancedClass(String name)
+ throws ClassNotFoundException {
+ String path = name.replace('.', '/') + ".class";
+
+ InputStream in = getResourceAsStream(path);
+ if (in == null) {
+ return Class.forName(name, true, getParent());
+ }
+
+ try {
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
+ byte[] buffer = new byte[1024];
+ int read;
+
+ while ((read = in.read(buffer, 0, 1024)) > 0) {
+ out.write(buffer, 0, read);
+ }
+
+ out.close();
+ byte[] classBytes = out.toByteArray();
+
+ byte[] bytes;
+ try {
+ bytes = transformer.transform(getParent(), name, null, null,
+ classBytes);
+ } catch (IllegalClassFormatException e) {
+ throw new ClassNotFoundException("Could not transform class '"
+ + name + "' due to invalid format", e);
+ }
+
+ if (bytes != null) {
+ classBytes = bytes;
+ } else {
+ // if transformer didn't transform ... this is suboptimal as
+ // we've already read the bytes from classfile...
+ return Class.forName(name, true, getParent());
+ }
+
+ return defineClass(name, classBytes, 0, classBytes.length);
+ } catch (IOException e) {
+ throw new ClassNotFoundException(name, e);
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore close exceptions...
+ }
+ }
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockEnhancedPojo.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockEnhancedPojo.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockEnhancedPojo.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockEnhancedPojo.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,40 @@
+/*****************************************************************
+ * 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.jpa.enhancer;
+
+public class MockEnhancedPojo {
+
+ public transient PersistenceDelegate $cayenne_persistenceDelegate;
+
+ protected String attribute1;
+
+ public String getAttribute1() {
+ if ($cayenne_persistenceDelegate != null) {
+ $cayenne_persistenceDelegate.prepareForAccess("attribute1");
+ }
+ return attribute1;
+ }
+
+ public void setAttribute1(String attribute1) {
+ if ($cayenne_persistenceDelegate != null) {
+ $cayenne_persistenceDelegate.prepareForUpdate("attribute1");
+ }
+ this.attribute1 = attribute1;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPersistenceDelegate.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPersistenceDelegate.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPersistenceDelegate.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,24 @@
+package org.apache.cayenne.jpa.enhancer;
+
+public class MockPersistenceDelegate implements PersistenceDelegate {
+
+ protected String preparedForAccess;
+
+ protected String preparedForUpdate;
+
+ public void prepareForAccess(String property) {
+ preparedForAccess = property;
+ }
+
+ public void prepareForUpdate(String property) {
+ preparedForUpdate = property;
+ }
+
+ public String getPreparedForAccess() {
+ return preparedForAccess;
+ }
+
+ public String getPreparedForUpdate() {
+ return preparedForUpdate;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPojo1.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPojo1.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPojo1.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/MockPojo1.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,13 @@
+package org.apache.cayenne.jpa.enhancer;
+
+public class MockPojo1 {
+ protected String attribute1;
+
+ public String getAttribute1() {
+ return attribute1;
+ }
+
+ public void setAttribute1(String attribute1) {
+ this.attribute1 = attribute1;
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactoryTest.java?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactoryTest.java (added)
+++ incubator/cayenne/sandbox/asm-enhancer/main/test/java/org/apache/cayenne/jpa/enhancer/PojoAdapterFactoryTest.java Sun Oct 8 21:07:23 2006
@@ -0,0 +1,37 @@
+/*****************************************************************
+ * 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.jpa.enhancer;
+
+import org.apache.cayenne.Persistent;
+
+import junit.framework.TestCase;
+
+public class PojoAdapterFactoryTest extends TestCase {
+
+ public void testMakePersistent() {
+ PojoAdapterFactory factory = new PojoAdapterFactory();
+
+ MockEnhancedPojo o1 = new MockEnhancedPojo();
+ Persistent p1 = factory.makePersistent(o1);
+
+ assertNotNull(p1);
+ assertSame(p1, o1.$cayenne_persistenceDelegate);
+ assertSame(o1, ((PojoAdapter) p1).getObject());
+ }
+}
Added: incubator/cayenne/sandbox/asm-enhancer/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/asm-enhancer/pom.xml?view=auto&rev=454271
==============================================================================
--- incubator/cayenne/sandbox/asm-enhancer/pom.xml (added)
+++ incubator/cayenne/sandbox/asm-enhancer/pom.xml Sun Oct 8 21:07:23 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation
+
+ Licensed 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+
+ <groupId>org.apache.cayenne.core</groupId>
+ <version>3.0-incubating-SNAPSHOT</version>
+ <description>ASM Enhancer</description>
+ <artifactId>cayenne-jpa</artifactId>
+ <name>ASM Enhancer</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cayenne.core</groupId>
+ <artifactId>cayenne-jdk1.4</artifactId>
+ <version>3.0-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>