HHH-6026 - Migrate bytecode provider integrations to api/spi/internal split
This commit is contained in:
parent
82d2ef4b1f
commit
19791a6c7d
|
@ -24,14 +24,15 @@
|
|||
package org.hibernate;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.engine.HibernateIterator;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.engine.jdbc.LobCreationContext;
|
||||
import org.hibernate.engine.jdbc.LobCreator;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
import org.hibernate.type.AnyType;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -21,18 +21,22 @@
|
|||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.buildtime;
|
||||
package org.hibernate.bytecode.buildtime.internal;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
import javassist.bytecode.ClassFile;
|
||||
import org.hibernate.bytecode.ClassTransformer;
|
||||
import org.hibernate.bytecode.javassist.BytecodeProviderImpl;
|
||||
import org.hibernate.bytecode.javassist.FieldHandled;
|
||||
import org.hibernate.bytecode.util.BasicClassFilter;
|
||||
import org.hibernate.bytecode.util.ClassDescriptor;
|
||||
|
||||
import org.hibernate.bytecode.buildtime.spi.AbstractInstrumenter;
|
||||
import org.hibernate.bytecode.buildtime.spi.BasicClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassDescriptor;
|
||||
import org.hibernate.bytecode.buildtime.spi.Logger;
|
||||
import org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl;
|
||||
import org.hibernate.bytecode.internal.javassist.FieldHandled;
|
||||
import org.hibernate.bytecode.spi.ClassTransformer;
|
||||
|
||||
/**
|
||||
* Strategy for performing build-time instrumentation of persistent classes in order to enable
|
||||
|
@ -81,9 +85,9 @@ public class JavassistInstrumenter extends AbstractInstrumenter {
|
|||
}
|
||||
|
||||
public boolean isInstrumented() {
|
||||
String[] intfs = classFile.getInterfaces();
|
||||
for ( int i = 0; i < intfs.length; i++ ) {
|
||||
if ( FieldHandled.class.getName().equals( intfs[i] ) ) {
|
||||
String[] interfaceNames = classFile.getInterfaces();
|
||||
for ( String interfaceName : interfaceNames ) {
|
||||
if ( FieldHandled.class.getName().equals( interfaceName ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -21,7 +21,7 @@
|
|||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.buildtime;
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
|
@ -31,16 +31,14 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import org.hibernate.bytecode.ClassTransformer;
|
||||
import org.hibernate.bytecode.util.ByteCodeHelper;
|
||||
import org.hibernate.bytecode.util.ClassDescriptor;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
|
||||
import org.hibernate.bytecode.spi.ByteCodeHelper;
|
||||
import org.hibernate.bytecode.spi.ClassTransformer;
|
||||
|
||||
/**
|
||||
* Provides the basic templating of how instrumentation should occur.
|
||||
|
@ -93,15 +91,14 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
*
|
||||
* @param files The files.
|
||||
*/
|
||||
public void execute(Set files) {
|
||||
Set classNames = new HashSet();
|
||||
public void execute(Set<File> files) {
|
||||
Set<String> classNames = new HashSet<String>();
|
||||
|
||||
if ( options.performExtendedInstrumentation() ) {
|
||||
logger.debug( "collecting class names for extended instrumentation determination" );
|
||||
try {
|
||||
Iterator itr = files.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
final File file = ( File ) itr.next();
|
||||
for ( Object file1 : files ) {
|
||||
final File file = (File) file1;
|
||||
collectClassNames( file, classNames );
|
||||
}
|
||||
}
|
||||
|
@ -115,9 +112,7 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
|
||||
logger.info( "starting instrumentation" );
|
||||
try {
|
||||
Iterator itr = files.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
final File file = ( File ) itr.next();
|
||||
for ( File file : files ) {
|
||||
processFile( file, classNames );
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +135,7 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
*
|
||||
* @throws Exception indicates problems accessing the file or its contents.
|
||||
*/
|
||||
private void collectClassNames(File file, final Set classNames) throws Exception {
|
||||
private void collectClassNames(File file, final Set<String> classNames) throws Exception {
|
||||
if ( isClassFile( file ) ) {
|
||||
byte[] bytes = ByteCodeHelper.readByteCode( file );
|
||||
ClassDescriptor descriptor = getClassDescriptor( bytes );
|
||||
|
@ -211,7 +206,7 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
*
|
||||
* @throws Exception Indicates an issue either access files or applying the transformations.
|
||||
*/
|
||||
protected void processFile(File file, Set classNames) throws Exception {
|
||||
protected void processFile(File file, Set<String> classNames) throws Exception {
|
||||
if ( isClassFile( file ) ) {
|
||||
logger.debug( "processing class file : " + file.getAbsolutePath() );
|
||||
processClassFile( file, classNames );
|
||||
|
@ -234,7 +229,7 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
*
|
||||
* @throws Exception Indicates an issue either access files or applying the transformations.
|
||||
*/
|
||||
protected void processClassFile(File file, Set classNames) throws Exception {
|
||||
protected void processClassFile(File file, Set<String> classNames) throws Exception {
|
||||
byte[] bytes = ByteCodeHelper.readByteCode( file );
|
||||
ClassDescriptor descriptor = getClassDescriptor( bytes );
|
||||
ClassTransformer transformer = getClassTransformer( descriptor, classNames );
|
||||
|
@ -276,7 +271,7 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
*
|
||||
* @throws Exception Indicates an issue either access files or applying the transformations.
|
||||
*/
|
||||
protected void processJarFile(final File file, final Set classNames) throws Exception {
|
||||
protected void processJarFile(final File file, final Set<String> classNames) throws Exception {
|
||||
File tempFile = File.createTempFile(
|
||||
file.getName(),
|
||||
null,
|
||||
|
@ -406,9 +401,9 @@ public abstract class AbstractInstrumenter implements Instrumenter {
|
|||
* Apply strategy to the given archive entry.
|
||||
*
|
||||
* @param entry The archive file entry.
|
||||
* @param byteCode
|
||||
* @param byteCode The bytes making up the entry
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws Exception Problem handling entry
|
||||
*/
|
||||
public void handleEntry(ZipEntry entry, byte[] byteCode) throws Exception;
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.util;
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -35,7 +36,7 @@ import java.util.Set;
|
|||
*/
|
||||
public class BasicClassFilter implements ClassFilter {
|
||||
private final String[] includedPackages;
|
||||
private final Set includedClassNames = new HashSet();
|
||||
private final Set<String> includedClassNames = new HashSet<String>();
|
||||
private final boolean isAllEmpty;
|
||||
|
||||
public BasicClassFilter() {
|
||||
|
@ -45,9 +46,7 @@ public class BasicClassFilter implements ClassFilter {
|
|||
public BasicClassFilter(String[] includedPackages, String[] includedClassNames) {
|
||||
this.includedPackages = includedPackages;
|
||||
if ( includedClassNames != null ) {
|
||||
for ( int i = 0; i < includedClassNames.length; i++ ) {
|
||||
this.includedClassNames.add( includedClassNames[i] );
|
||||
}
|
||||
this.includedClassNames.addAll( Arrays.asList( includedClassNames ) );
|
||||
}
|
||||
|
||||
isAllEmpty = ( this.includedPackages == null || this.includedPackages.length == 0 )
|
||||
|
@ -55,24 +54,15 @@ public class BasicClassFilter implements ClassFilter {
|
|||
}
|
||||
|
||||
public boolean shouldInstrumentClass(String className) {
|
||||
if ( isAllEmpty ) {
|
||||
return true;
|
||||
}
|
||||
else if ( includedClassNames.contains( className ) ) {
|
||||
return true;
|
||||
}
|
||||
else if ( isInIncludedPackage( className ) ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return isAllEmpty ||
|
||||
includedClassNames.contains( className ) ||
|
||||
isInIncludedPackage( className );
|
||||
}
|
||||
|
||||
private boolean isInIncludedPackage(String className) {
|
||||
if ( includedPackages != null ) {
|
||||
for ( int i = 0; i < includedPackages.length; i++ ) {
|
||||
if ( className.startsWith( includedPackages[i] ) ) {
|
||||
for ( String includedPackage : includedPackages ) {
|
||||
if ( className.startsWith( includedPackage ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.util;
|
||||
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
/**
|
||||
* Contract describing the information Hibernate needs in terms of instrumenting
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.util;
|
||||
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
/**
|
||||
* Used to determine whether a class should be instrumented.
|
||||
|
@ -31,5 +29,12 @@ package org.hibernate.bytecode.util;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface ClassFilter {
|
||||
public boolean shouldInstrumentClass(String className);
|
||||
/**
|
||||
* Should this class be included in instrumentation
|
||||
*
|
||||
* @param className The name of the class to check
|
||||
*
|
||||
* @return {@literal true} to include class in instrumentation; {@literal false} otherwise.
|
||||
*/
|
||||
public boolean shouldInstrumentClass(String className);
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -21,14 +21,14 @@
|
|||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.buildtime;
|
||||
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
/**
|
||||
* Indicates problem performing the instrumentation execution.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class ExecutionException extends RuntimeException {
|
||||
public ExecutionException(String message) {
|
||||
super( message );
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.util;
|
||||
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
/**
|
||||
* Used to determine whether a field reference should be instrumented.
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -21,18 +21,33 @@
|
|||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.buildtime;
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
* Basic contract for performing instrumentation
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface Instrumenter {
|
||||
public void execute(Set files);
|
||||
/**
|
||||
* Perform the instrumentation
|
||||
*
|
||||
* @param files The file on which to perform instrumentation
|
||||
*/
|
||||
public void execute(Set<File> files);
|
||||
|
||||
/**
|
||||
* Instrumentation options
|
||||
*/
|
||||
public static interface Options {
|
||||
/**
|
||||
* Should we enhance references to class fields outside the class itself?
|
||||
*
|
||||
* @return {@literal true}/{@literal false}
|
||||
*/
|
||||
public boolean performExtendedInstrumentation();
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2009-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -21,7 +21,7 @@
|
|||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.buildtime;
|
||||
package org.hibernate.bytecode.buildtime.spi;
|
||||
|
||||
/**
|
||||
* Provides an abstraction for how instrumentation does logging because it is usually run in environments (Ant/Maven)
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.instrumentation.internal;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.internal.javassist.JavassistHelper;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
||||
/**
|
||||
* Helper class for dealing with enhanced entity classes.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class FieldInterceptionHelper {
|
||||
private static final Set<Delegate> INSTRUMENTATION_DELEGATES = buildInstrumentationDelegates();
|
||||
|
||||
private static Set<Delegate> buildInstrumentationDelegates() {
|
||||
HashSet<Delegate> delegates = new HashSet<Delegate>();
|
||||
delegates.add( JavassistDelegate.INSTANCE );
|
||||
return delegates;
|
||||
}
|
||||
|
||||
private FieldInterceptionHelper() {
|
||||
}
|
||||
|
||||
public static boolean isInstrumented(Class entityClass) {
|
||||
for ( Delegate delegate : INSTRUMENTATION_DELEGATES ) {
|
||||
if ( delegate.isInstrumented( entityClass ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isInstrumented(Object entity) {
|
||||
return entity != null && isInstrumented( entity.getClass() );
|
||||
}
|
||||
|
||||
public static FieldInterceptor extractFieldInterceptor(Object entity) {
|
||||
if ( entity == null ) {
|
||||
return null;
|
||||
}
|
||||
FieldInterceptor interceptor = null;
|
||||
for ( Delegate delegate : INSTRUMENTATION_DELEGATES ) {
|
||||
interceptor = delegate.extractInterceptor( entity );
|
||||
if ( interceptor != null ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
||||
public static FieldInterceptor injectFieldInterceptor(
|
||||
Object entity,
|
||||
String entityName,
|
||||
Set uninitializedFieldNames,
|
||||
SessionImplementor session) {
|
||||
if ( entity == null ) {
|
||||
return null;
|
||||
}
|
||||
FieldInterceptor interceptor = null;
|
||||
for ( Delegate delegate : INSTRUMENTATION_DELEGATES ) {
|
||||
interceptor = delegate.injectInterceptor( entity, entityName, uninitializedFieldNames, session );
|
||||
if ( interceptor != null ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
public static void clearDirty(Object entity) {
|
||||
FieldInterceptor interceptor = extractFieldInterceptor( entity );
|
||||
if ( interceptor != null ) {
|
||||
interceptor.clearDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void markDirty(Object entity) {
|
||||
FieldInterceptor interceptor = extractFieldInterceptor( entity );
|
||||
if ( interceptor != null ) {
|
||||
interceptor.dirty();
|
||||
}
|
||||
}
|
||||
|
||||
private static interface Delegate {
|
||||
public boolean isInstrumented(Class classToCheck);
|
||||
public FieldInterceptor extractInterceptor(Object entity);
|
||||
public FieldInterceptor injectInterceptor(Object entity, String entityName, Set uninitializedFieldNames, SessionImplementor session);
|
||||
}
|
||||
|
||||
private static class JavassistDelegate implements Delegate {
|
||||
public static final JavassistDelegate INSTANCE = new JavassistDelegate();
|
||||
public static final String MARKER = "org.hibernate.bytecode.internal.javassist.FieldHandled";
|
||||
|
||||
@Override
|
||||
public boolean isInstrumented(Class classToCheck) {
|
||||
for ( Class definedInterface : classToCheck.getInterfaces() ) {
|
||||
if ( MARKER.equals( definedInterface.getName() ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldInterceptor extractInterceptor(Object entity) {
|
||||
for ( Class definedInterface : entity.getClass().getInterfaces() ) {
|
||||
if ( MARKER.equals( definedInterface.getName() ) ) {
|
||||
return JavassistHelper.extractFieldInterceptor( entity );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldInterceptor injectInterceptor(
|
||||
Object entity,
|
||||
String entityName,
|
||||
Set uninitializedFieldNames,
|
||||
SessionImplementor session) {
|
||||
for ( Class definedInterface : entity.getClass().getInterfaces() ) {
|
||||
if ( MARKER.equals( definedInterface.getName() ) ) {
|
||||
return JavassistHelper.injectFieldInterceptor( entity, entityName, uninitializedFieldNames, session );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,14 +20,15 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.intercept.javassist;
|
||||
package org.hibernate.bytecode.instrumentation.internal.javassist;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import org.hibernate.bytecode.javassist.FieldHandler;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.spi.AbstractFieldInterceptor;
|
||||
import org.hibernate.bytecode.internal.javassist.FieldHandler;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.intercept.AbstractFieldInterceptor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
|
||||
|
@ -45,15 +46,9 @@ import org.hibernate.proxy.LazyInitializer;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnnecessaryUnboxing", "UnnecessaryBoxing"})
|
||||
public final class FieldInterceptorImpl extends AbstractFieldInterceptor implements FieldHandler, Serializable {
|
||||
|
||||
/**
|
||||
* Package-protected constructor.
|
||||
*
|
||||
* @param session
|
||||
* @param uninitializedFields
|
||||
* @param entityName
|
||||
*/
|
||||
FieldInterceptorImpl(SessionImplementor session, Set uninitializedFields, String entityName) {
|
||||
super( session, uninitializedFields, entityName );
|
||||
}
|
||||
|
@ -67,35 +62,35 @@ public final class FieldInterceptorImpl extends AbstractFieldInterceptor impleme
|
|||
}
|
||||
|
||||
public byte readByte(Object target, String name, byte oldValue) {
|
||||
return ( ( Byte ) intercept( target, name, new Byte( oldValue ) ) ).byteValue();
|
||||
return ( ( Byte ) intercept( target, name, Byte.valueOf( oldValue ) ) ).byteValue();
|
||||
}
|
||||
|
||||
public char readChar(Object target, String name, char oldValue) {
|
||||
return ( ( Character ) intercept( target, name, new Character( oldValue ) ) )
|
||||
return ( ( Character ) intercept( target, name, Character.valueOf( oldValue ) ) )
|
||||
.charValue();
|
||||
}
|
||||
|
||||
public double readDouble(Object target, String name, double oldValue) {
|
||||
return ( ( Double ) intercept( target, name, new Double( oldValue ) ) )
|
||||
return ( ( Double ) intercept( target, name, Double.valueOf( oldValue ) ) )
|
||||
.doubleValue();
|
||||
}
|
||||
|
||||
public float readFloat(Object target, String name, float oldValue) {
|
||||
return ( ( Float ) intercept( target, name, new Float( oldValue ) ) )
|
||||
return ( ( Float ) intercept( target, name, Float.valueOf( oldValue ) ) )
|
||||
.floatValue();
|
||||
}
|
||||
|
||||
public int readInt(Object target, String name, int oldValue) {
|
||||
return ( ( Integer ) intercept( target, name, new Integer( oldValue ) ) )
|
||||
return ( ( Integer ) intercept( target, name, Integer.valueOf( oldValue ) ) )
|
||||
.intValue();
|
||||
}
|
||||
|
||||
public long readLong(Object target, String name, long oldValue) {
|
||||
return ( ( Long ) intercept( target, name, new Long( oldValue ) ) ).longValue();
|
||||
return ( ( Long ) intercept( target, name, Long.valueOf( oldValue ) ) ).longValue();
|
||||
}
|
||||
|
||||
public short readShort(Object target, String name, short oldValue) {
|
||||
return ( ( Short ) intercept( target, name, new Short( oldValue ) ) )
|
||||
return ( ( Short ) intercept( target, name, Short.valueOf( oldValue ) ) )
|
||||
.shortValue();
|
||||
}
|
||||
|
||||
|
@ -118,43 +113,43 @@ public final class FieldInterceptorImpl extends AbstractFieldInterceptor impleme
|
|||
|
||||
public byte writeByte(Object target, String name, byte oldValue, byte newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Byte( oldValue ) );
|
||||
intercept( target, name, Byte.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public char writeChar(Object target, String name, char oldValue, char newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Character( oldValue ) );
|
||||
intercept( target, name, Character.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public double writeDouble(Object target, String name, double oldValue, double newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Double( oldValue ) );
|
||||
intercept( target, name, Double.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public float writeFloat(Object target, String name, float oldValue, float newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Float( oldValue ) );
|
||||
intercept( target, name, Float.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public int writeInt(Object target, String name, int oldValue, int newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Integer( oldValue ) );
|
||||
intercept( target, name, Integer.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public long writeLong(Object target, String name, long oldValue, long newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Long( oldValue ) );
|
||||
intercept( target, name, Long.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
||||
public short writeShort(Object target, String name, short oldValue, short newValue) {
|
||||
dirty();
|
||||
intercept( target, name, new Short( oldValue ) );
|
||||
intercept( target, name, Short.valueOf( oldValue ) );
|
||||
return newValue;
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,13 +20,14 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.intercept.javassist;
|
||||
package org.hibernate.bytecode.instrumentation.internal.javassist;
|
||||
|
||||
import java.util.Set;
|
||||
import org.hibernate.bytecode.javassist.FieldHandled;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.bytecode.internal.javassist.FieldHandled;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
|
@ -1,10 +1,10 @@
|
|||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,16 +20,13 @@
|
|||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
~
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<p>
|
||||
This package implements an interception
|
||||
mechanism for lazy property fetching,
|
||||
based on CGLIB bytecode instrumentation.
|
||||
This package implements an interception mechanism for lazy property fetching, based on bytecode instrumentation.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.intercept;
|
||||
package org.hibernate.bytecode.instrumentation.spi;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import org.hibernate.LazyInitializationException;
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.intercept;
|
||||
package org.hibernate.bytecode.instrumentation.spi;
|
||||
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,11 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.intercept;
|
||||
package org.hibernate.bytecode.instrumentation.spi;
|
||||
|
||||
import java.io.Serializable;
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
||||
/**
|
||||
|
@ -48,8 +48,13 @@ public interface LazyPropertyInitializer {
|
|||
|
||||
/**
|
||||
* Initialize the property, and return its new value
|
||||
*
|
||||
* @param fieldName The name of the field being initialized
|
||||
* @param entity The entity on which the initialization is occurring
|
||||
* @param session The session from which the initialization originated.
|
||||
*
|
||||
* @return ?
|
||||
*/
|
||||
public Object initializeLazyProperty(String fieldName, Object entity, SessionImplementor session)
|
||||
throws HibernateException;
|
||||
public Object initializeLazyProperty(String fieldName, Object entity, SessionImplementor session);
|
||||
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,16 +20,17 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.PropertyAccessException;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
|
||||
/**
|
||||
* The {@link ReflectionOptimizer.AccessOptimizer} implementation for Javassist
|
||||
* which simply acts as an adpater to the {@link BulkAccessor} class.
|
||||
* which simply acts as an adapter to the {@link BulkAccessor} class.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
import java.io.Serializable;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* A JavaBean accessor.
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
/**
|
||||
* An exception thrown while generating a bulk accessor.
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,12 +20,13 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.bytecode.AccessFlag;
|
||||
import javassist.bytecode.Bytecode;
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,21 +20,22 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.bytecode.ClassTransformer;
|
||||
import org.hibernate.bytecode.ProxyFactoryFactory;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.FieldFilter;
|
||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||
import org.hibernate.bytecode.spi.ClassTransformer;
|
||||
import org.hibernate.bytecode.spi.ProxyFactoryFactory;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
/**
|
||||
* Bytecode provider implementation for Javassist.
|
||||
*
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
/**
|
||||
* Interface introduced to the enhanced class in order to be able to
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
/**
|
||||
* The interface defining how interception of a field should be handled.
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -30,6 +30,7 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.bytecode.AccessFlag;
|
||||
import javassist.bytecode.BadBytecode;
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,16 +20,17 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.InstantiationException;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
|
||||
/**
|
||||
* The {@link ReflectionOptimizer.InstantiationOptimizer} implementation for Javassist
|
||||
* which simply acts as an adpater to the {@link FastClass} class.
|
||||
* The {@link org.hibernate.bytecode.spi.ReflectionOptimizer.InstantiationOptimizer} implementation for Javassist
|
||||
* which simply acts as an adapter to the {@link FastClass} class.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,21 +20,23 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import javassist.bytecode.ClassFile;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.bytecode.AbstractClassTransformerImpl;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.spi.AbstractClassTransformerImpl;
|
||||
|
||||
/**
|
||||
* Enhance the classes allowing them to implements InterceptFieldEnabled
|
||||
|
@ -48,7 +50,7 @@ public class JavassistClassTransformer extends AbstractClassTransformerImpl {
|
|||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
JavassistClassTransformer.class.getName());
|
||||
|
||||
public JavassistClassTransformer(ClassFilter classFilter, org.hibernate.bytecode.util.FieldFilter fieldFilter) {
|
||||
public JavassistClassTransformer(ClassFilter classFilter, org.hibernate.bytecode.buildtime.spi.FieldFilter fieldFilter) {
|
||||
super( classFilter, fieldFilter );
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,18 +20,20 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javassist.util.proxy.MethodFilter;
|
||||
import javassist.util.proxy.MethodHandler;
|
||||
import javassist.util.proxy.ProxyObject;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.BasicProxyFactory;
|
||||
import org.hibernate.bytecode.ProxyFactoryFactory;
|
||||
import org.hibernate.bytecode.spi.BasicProxyFactory;
|
||||
import org.hibernate.bytecode.spi.ProxyFactoryFactory;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.pojo.javassist.JavassistProxyFactory;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,12 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.Serializable;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
|
||||
/**
|
||||
* ReflectionOptimizer implementation for Javassist.
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,14 +20,16 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode.javassist;
|
||||
package org.hibernate.bytecode.internal.javassist;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javassist.CannotCompileException;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.NotFoundException;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
~
|
||||
-->
|
||||
|
||||
<html>
|
||||
|
@ -45,9 +44,6 @@
|
|||
</li>
|
||||
</ol>
|
||||
</p>
|
||||
<p>
|
||||
Currently, both CGLIB and Javassist are supported out-of-the-box.
|
||||
</p>
|
||||
<p>
|
||||
Note that for field-level interception, simply plugging in a new {@link BytecodeProvider}
|
||||
is not enough for Hibernate to be able to recognize new providers. You would additionally
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,12 +20,13 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.FieldFilter;
|
||||
|
||||
/**
|
||||
* Basic implementation of the {@link ClassTransformer} contract.
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
/**
|
||||
* A proxy factory for "basic proxy" generation
|
|
@ -21,7 +21,8 @@
|
|||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.bytecode.util;
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,20 +20,19 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.FieldFilter;
|
||||
|
||||
/**
|
||||
* Contract for providers of bytecode services to Hibernate.
|
||||
* <p/>
|
||||
* Bytecode requirements break down into basically 3 areas<ol>
|
||||
* <li>proxy generation (both for runtime-lazy-loading and basic proxy generation)
|
||||
* {@link #getProxyFactoryFactory()}
|
||||
* <li>bean reflection optimization {@link #getReflectionOptimizer}
|
||||
* <li>field-access instrumentation {@link #getTransformer}
|
||||
* <li>proxy generation (both for runtime-lazy-loading and basic proxy generation) {@link #getProxyFactoryFactory()}</li>
|
||||
* <li>bean reflection optimization {@link #getReflectionOptimizer}</li>
|
||||
* <li>field-access instrumentation {@link #getTransformer}</li>
|
||||
* </ol>
|
||||
*
|
||||
* @author Steve Ebersole
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
import java.io.InputStream;
|
||||
import org.hibernate.bytecode.util.ByteCodeHelper;
|
||||
|
||||
/**
|
||||
* A specialized classloader which performs bytecode enhancement on class
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.bytecode;
|
||||
|
||||
package org.hibernate.bytecode.spi;
|
||||
|
||||
/**
|
||||
* Represents reflection optimization for a particular class.
|
|
@ -35,7 +35,7 @@ import java.util.Properties;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.Version;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||
import org.hibernate.internal.util.ConfigHelper;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
|
@ -796,10 +796,10 @@ public final class Environment {
|
|||
|
||||
private static BytecodeProvider buildBytecodeProvider(String providerName) {
|
||||
if ( "javassist".equals( providerName ) ) {
|
||||
return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
|
||||
return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
|
||||
}
|
||||
|
||||
LOG.unknownBytecodeProvider( providerName );
|
||||
return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
|
||||
return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ class PropertyContainer {
|
|||
//TODO make those hardcoded tests more portable (through the bytecode provider?)
|
||||
return property.isAnnotationPresent( Transient.class )
|
||||
|| "net.sf.cglib.transform.impl.InterceptFieldCallback".equals( property.getType().getName() )
|
||||
|| "org.hibernate.bytecode.javassist.FieldHandler".equals( property.getType().getName() );
|
||||
|| "org.hibernate.bytecode.internal.javassist.FieldHandler".equals( property.getType().getName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.hibernate.ConnectionReleaseMode;
|
|||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.cache.QueryCacheFactory;
|
||||
import org.hibernate.cache.RegionFactory;
|
||||
import org.hibernate.cache.impl.NoCachingRegionFactory;
|
||||
|
@ -254,11 +253,11 @@ public class SettingsFactory implements Serializable {
|
|||
|
||||
// protected BytecodeProvider buildBytecodeProvider(String providerName) {
|
||||
// if ( "javassist".equals( providerName ) ) {
|
||||
// return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
|
||||
// return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
|
||||
// }
|
||||
// else {
|
||||
// LOG.debugf("Using javassist as bytecode provider by default");
|
||||
// return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
|
||||
// return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.io.Serializable;
|
|||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.UniqueKeyLoadable;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
|
|
|
@ -25,7 +25,7 @@ package org.hibernate.engine;
|
|||
import java.io.Serializable;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
|
@ -186,7 +186,7 @@ public final class ForeignKeys {
|
|||
public static boolean isTransient(String entityName, Object entity, Boolean assumed, SessionImplementor session)
|
||||
throws HibernateException {
|
||||
|
||||
if (entity==LazyPropertyInitializer.UNFETCHED_PROPERTY) {
|
||||
if (entity== LazyPropertyInitializer.UNFETCHED_PROPERTY) {
|
||||
// an unfetched association can only point to
|
||||
// an entity that already exists in the db
|
||||
return false;
|
||||
|
|
|
@ -25,7 +25,7 @@ package org.hibernate.engine;
|
|||
import java.util.Iterator;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.PropertyValueException;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
@ -90,7 +90,7 @@ public final class Nullability {
|
|||
|
||||
for ( int i = 0; i < values.length; i++ ) {
|
||||
|
||||
if ( checkability[i] && values[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
|
||||
if ( checkability[i] && values[i]!= LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
|
||||
final Object value = values[i];
|
||||
if ( !nullability[i] && value == null ) {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.event.PostLoadEvent;
|
|||
import org.hibernate.event.PostLoadEventListener;
|
||||
import org.hibernate.event.PreLoadEvent;
|
||||
import org.hibernate.event.PreLoadEventListener;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.property.BackrefPropertyAccessor;
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.hibernate.LockMode;
|
|||
import org.hibernate.NonUniqueObjectException;
|
||||
import org.hibernate.action.EntityIdentityInsertAction;
|
||||
import org.hibernate.action.EntityInsertAction;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.classic.Lifecycle;
|
||||
import org.hibernate.classic.Validatable;
|
||||
import org.hibernate.engine.Cascade;
|
||||
|
@ -43,8 +44,7 @@ import org.hibernate.engine.Versioning;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.id.IdentifierGenerationException;
|
||||
import org.hibernate.id.IdentifierGeneratorHelper;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.Type;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.event.def;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
@ -87,7 +87,7 @@ public abstract class AbstractVisitor {
|
|||
}
|
||||
|
||||
boolean includeProperty(Object[] values, int i) {
|
||||
return values[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY;
|
||||
return values[i]!= LazyPropertyInitializer.UNFETCHED_PROPERTY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.hibernate.engine.Versioning;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.event.FlushEntityEvent;
|
||||
import org.hibernate.event.FlushEntityEventListener;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.hibernate.PropertyValueException;
|
|||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.WrongClassException;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.engine.Cascade;
|
||||
import org.hibernate.engine.CascadingAction;
|
||||
import org.hibernate.engine.EntityEntry;
|
||||
|
@ -45,8 +46,7 @@ import org.hibernate.engine.Status;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.event.MergeEvent;
|
||||
import org.hibernate.event.MergeEventListener;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.intercept;
|
||||
import java.util.Set;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.intercept.javassist.JavassistHelper;
|
||||
|
||||
/**
|
||||
* Helper class for dealing with enhanced entity classes.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class FieldInterceptionHelper {
|
||||
|
||||
// VERY IMPORTANT!!!! - This class needs to be free of any static references
|
||||
// to any CGLIB or Javassist classes. Otherwise, users will always need both
|
||||
// on their classpaths no matter which (if either) they use.
|
||||
//
|
||||
// Another option here would be to remove the Hibernate.isPropertyInitialized()
|
||||
// method and have the users go through the SessionFactory to get this information.
|
||||
|
||||
private FieldInterceptionHelper() {
|
||||
}
|
||||
|
||||
public static boolean isInstrumented(Class entityClass) {
|
||||
Class[] definedInterfaces = entityClass.getInterfaces();
|
||||
for ( int i = 0; i < definedInterfaces.length; i++ ) {
|
||||
if ( "net.sf.cglib.transform.impl.InterceptFieldEnabled".equals( definedInterfaces[i].getName() )
|
||||
|| "org.hibernate.bytecode.javassist.FieldHandled".equals( definedInterfaces[i].getName() ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isInstrumented(Object entity) {
|
||||
return entity != null && isInstrumented( entity.getClass() );
|
||||
}
|
||||
|
||||
public static FieldInterceptor extractFieldInterceptor(Object entity) {
|
||||
if ( entity == null ) {
|
||||
return null;
|
||||
}
|
||||
Class[] definedInterfaces = entity.getClass().getInterfaces();
|
||||
for ( int i = 0; i < definedInterfaces.length; i++ ) {
|
||||
if ( "org.hibernate.bytecode.javassist.FieldHandled".equals( definedInterfaces[i].getName() ) ) {
|
||||
// we have a Javassist enhanced entity
|
||||
return JavassistHelper.extractFieldInterceptor( entity );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FieldInterceptor injectFieldInterceptor(
|
||||
Object entity,
|
||||
String entityName,
|
||||
Set uninitializedFieldNames,
|
||||
SessionImplementor session) {
|
||||
if ( entity != null ) {
|
||||
Class[] definedInterfaces = entity.getClass().getInterfaces();
|
||||
for ( int i = 0; i < definedInterfaces.length; i++ ) {
|
||||
if ( "org.hibernate.bytecode.javassist.FieldHandled".equals( definedInterfaces[i].getName() ) ) {
|
||||
// we have a Javassist enhanced entity
|
||||
return JavassistHelper.injectFieldInterceptor( entity, entityName, uninitializedFieldNames, session );
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void clearDirty(Object entity) {
|
||||
FieldInterceptor interceptor = extractFieldInterceptor( entity );
|
||||
if ( interceptor != null ) {
|
||||
interceptor.clearDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void markDirty(Object entity) {
|
||||
FieldInterceptor interceptor = extractFieldInterceptor( entity );
|
||||
if ( interceptor != null ) {
|
||||
interceptor.dirty();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,6 +46,9 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.QueryException;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.StaleStateException;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
import org.hibernate.cache.access.EntityRegionAccessStrategy;
|
||||
import org.hibernate.cache.entry.CacheEntry;
|
||||
|
@ -71,9 +74,6 @@ import org.hibernate.id.PostInsertIdentityPersister;
|
|||
import org.hibernate.id.insert.Binder;
|
||||
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
|
||||
import org.hibernate.impl.FilterHelper;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.jdbc.Expectation;
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.TypedValue;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.metadata.ClassMetadata;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.Logger;
|
||||
|
|
|
@ -29,13 +29,15 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.DirectoryScanner;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.hibernate.bytecode.buildtime.Instrumenter;
|
||||
import org.hibernate.bytecode.buildtime.Logger;
|
||||
|
||||
import org.hibernate.bytecode.buildtime.spi.Instrumenter;
|
||||
import org.hibernate.bytecode.buildtime.spi.Logger;
|
||||
|
||||
/**
|
||||
* Super class for all Hibernate instrumentation tasks. Provides the basic templating of how instrumentation
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.tool.instrument.javassist;
|
||||
|
||||
import org.hibernate.bytecode.buildtime.Instrumenter;
|
||||
import org.hibernate.bytecode.buildtime.JavassistInstrumenter;
|
||||
import org.hibernate.bytecode.buildtime.Logger;
|
||||
import org.hibernate.bytecode.buildtime.internal.JavassistInstrumenter;
|
||||
import org.hibernate.bytecode.buildtime.spi.Instrumenter;
|
||||
import org.hibernate.bytecode.buildtime.spi.Logger;
|
||||
import org.hibernate.tool.instrument.BasicInstrumentationTask;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.lang.reflect.Constructor;
|
|||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.InstantiationException;
|
||||
import org.hibernate.PropertyNotFoundException;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
|
|
|
@ -27,8 +27,8 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Method;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.BasicProxyFactory;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.spi.BasicProxyFactory;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.hibernate.EntityMode;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.engine.EntityEntry;
|
||||
import org.hibernate.engine.EntityKey;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
|
@ -37,7 +38,6 @@ import org.hibernate.engine.SessionImplementor;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.event.PersistEvent;
|
||||
import org.hibernate.id.Assigned;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.hibernate.engine.CascadeStyle;
|
|||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.ValueInclusion;
|
||||
import org.hibernate.engine.Versioning;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
|
|
@ -34,14 +34,14 @@ import org.hibernate.EntityNameResolver;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.classic.Lifecycle;
|
||||
import org.hibernate.classic.Validatable;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
|
|
|
@ -24,8 +24,9 @@
|
|||
package org.hibernate.type;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.property.BackrefPropertyAccessor;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.text.ParseException;
|
|||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.bytecode.javassist.BytecodeProviderImpl;
|
||||
import org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl;
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.test.bytecode.javassist;
|
||||
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.javassist.BytecodeProviderImpl;
|
||||
import org.hibernate.bytecode.spi.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.test.instrument.buildtime;
|
||||
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.hibernate.test.instrument.cases;
|
||||
import java.util.HashSet;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
|
||||
import org.hibernate.test.instrument.domain.Document;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,8 @@ package org.hibernate.test.instrument.cases;
|
|||
import java.util.Iterator;
|
||||
import junit.framework.Assert;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
|
||||
import org.hibernate.test.instrument.domain.Problematic;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,10 +26,10 @@ package org.hibernate.test.instrument.runtime;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.bytecode.InstrumentedClassLoader;
|
||||
import org.hibernate.bytecode.util.BasicClassFilter;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.BasicClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.FieldFilter;
|
||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||
import org.hibernate.bytecode.spi.InstrumentedClassLoader;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.test.instrument.runtime;
|
||||
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.bytecode.javassist.BytecodeProviderImpl;
|
||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||
import org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.hibernate.Session;
|
|||
import org.hibernate.Transaction;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.hibernate.Session;
|
|||
import org.hibernate.Transaction;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ package org.hibernate.test.nonflushedchanges;
|
|||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -27,10 +27,10 @@ import org.hibernate.Hibernate;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.bytecode.util.ByteCodeHelper;
|
||||
import org.hibernate.bytecode.spi.ByteCodeHelper;
|
||||
import org.hibernate.internal.util.SerializationHelper;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
|
||||
|
|
|
@ -24,8 +24,10 @@ import java.lang.instrument.IllegalClassFormatException;
|
|||
import java.security.ProtectionDomain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.FieldFilter;
|
||||
import org.hibernate.bytecode.spi.ClassTransformer;
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
||||
/**
|
||||
|
@ -35,7 +37,7 @@ import org.hibernate.cfg.Environment;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class InterceptFieldClassFileTransformer implements javax.persistence.spi.ClassTransformer {
|
||||
private org.hibernate.bytecode.ClassTransformer classTransformer;
|
||||
private ClassTransformer classTransformer;
|
||||
|
||||
public InterceptFieldClassFileTransformer(List<String> entities) {
|
||||
final List<String> copyEntities = new ArrayList<String>( entities.size() );
|
||||
|
|
|
@ -14,8 +14,8 @@ import javax.persistence.PersistenceException;
|
|||
import javax.persistence.spi.LoadState;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class InterceptFieldClassFileTransformerTest extends TestCase {
|
|||
Class clazz = cl.loadClass( entities.get( 0 ) );
|
||||
|
||||
// javassist is our default byte code enhancer. Enhancing will eg add the method getFieldHandler()
|
||||
// see org.hibernate.bytecode.javassist.FieldTransformer
|
||||
// see org.hibernate.bytecode.internal.javassist.FieldTransformer
|
||||
Method method = clazz.getDeclaredMethod( "getFieldHandler" );
|
||||
assertNotNull( method );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue