org.hibernate.bytecode.enhance.spi.EnhancementContext Java Examples

The following examples show how to use org.hibernate.bytecode.enhance.spi.EnhancementContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseEntityManagerFunctionalTestCase.java    From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void pushClassTransformer(EnhancementContext enhancementContext) {
}
 
Example #2
Source File: LightPersistenceXmlDescriptor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public void pushClassTransformer(final EnhancementContext enhancementContext) {
    // has never been supported
}
 
Example #3
Source File: EnhancingClassTransformerImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public EnhancingClassTransformerImpl(EnhancementContext enhancementContext) {
	this.enhancementContext = enhancementContext;
}
 
Example #4
Source File: EntityManagerFactoryBuilderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private EntityManagerFactoryBuilderImpl(
		PersistenceUnitDescriptor persistenceUnit,
		Map integrationSettings,
		ClassLoader providedClassLoader,
		ClassLoaderService providedClassLoaderService) {

	LogHelper.logPersistenceUnitInformation( persistenceUnit );

	this.persistenceUnit = persistenceUnit;

	if ( integrationSettings == null ) {
		integrationSettings = Collections.emptyMap();
	}

	// Build the boot-strap service registry, which mainly handles class loader interactions
	final BootstrapServiceRegistry bsr = buildBootstrapServiceRegistry( integrationSettings, providedClassLoader, providedClassLoaderService);

	// merge configuration sources and build the "standard" service registry
	final StandardServiceRegistryBuilder ssrBuilder = new StandardServiceRegistryBuilder( bsr );
	final MergedSettings mergedSettings = mergeSettings( persistenceUnit, integrationSettings, ssrBuilder );
	this.configurationValues = mergedSettings.getConfigurationValues();

	// Build the "standard" service registry
	ssrBuilder.applySettings( configurationValues );
	configure( ssrBuilder );
	this.standardServiceRegistry = ssrBuilder.build();
	configure( standardServiceRegistry, mergedSettings );

	final MetadataSources metadataSources = new MetadataSources( bsr );
	List<AttributeConverterDefinition> attributeConverterDefinitions = populate(
			metadataSources,
			mergedSettings,
			standardServiceRegistry
	);
	this.metamodelBuilder = (MetadataBuilderImplementor) metadataSources.getMetadataBuilder( standardServiceRegistry );
	populate( metamodelBuilder, mergedSettings, standardServiceRegistry, attributeConverterDefinitions );

	// todo : would be nice to have MetadataBuilder still do the handling of CfgXmlAccessService here
	//		another option is to immediately handle them here (probably in mergeSettings?) as we encounter them...
	final CfgXmlAccessService cfgXmlAccessService = standardServiceRegistry.getService( CfgXmlAccessService.class );
	if ( cfgXmlAccessService.getAggregatedConfig() != null ) {
		if ( cfgXmlAccessService.getAggregatedConfig().getMappingReferences() != null ) {
			for ( MappingReference mappingReference : cfgXmlAccessService.getAggregatedConfig().getMappingReferences() ) {
				mappingReference.apply( metadataSources );
			}
		}
	}

	this.managedResources = MetadataBuildingProcess.prepare(
			metadataSources,
			metamodelBuilder.getBootstrapContext()
	);

	applyMetadataBuilderContributor();


	withValidatorFactory( configurationValues.get( org.hibernate.cfg.AvailableSettings.JPA_VALIDATION_FACTORY ) );

	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// push back class transformation to the environment; for the time being this only has any effect in EE
	// container situations, calling back into PersistenceUnitInfo#addClassTransformer

	final boolean dirtyTrackingEnabled = readBooleanConfigurationValue( AvailableSettings.ENHANCER_ENABLE_DIRTY_TRACKING );
	final boolean lazyInitializationEnabled = readBooleanConfigurationValue( AvailableSettings.ENHANCER_ENABLE_LAZY_INITIALIZATION );
	final boolean associationManagementEnabled = readBooleanConfigurationValue( AvailableSettings.ENHANCER_ENABLE_ASSOCIATION_MANAGEMENT );

	if ( dirtyTrackingEnabled || lazyInitializationEnabled || associationManagementEnabled ) {
		EnhancementContext enhancementContext = getEnhancementContext(
				dirtyTrackingEnabled,
				lazyInitializationEnabled,
				associationManagementEnabled
		);

		persistenceUnit.pushClassTransformer( enhancementContext );
	}

	// for the time being we want to revoke access to the temp ClassLoader if one was passed
	metamodelBuilder.applyTempClassLoader( null );
}
 
Example #5
Source File: ParsedPersistenceXmlDescriptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void pushClassTransformer(EnhancementContext enhancementContext) {
	// todo : log a message that this is currently not supported...
}
 
Example #6
Source File: PersistenceUnitInfoDescriptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void pushClassTransformer(EnhancementContext enhancementContext) {
	persistenceUnitInfo.addTransformer( new EnhancingClassTransformerImpl( enhancementContext ) );
}
 
Example #7
Source File: JavassistEnhancementContext.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public JavassistEnhancementContext(EnhancementContext enhancementContext) {
	this.enhancementContext = enhancementContext;
}
 
Example #8
Source File: ByteBuddyEnhancementContext.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
ByteBuddyEnhancementContext(EnhancementContext enhancementContext) {
	this.enhancementContext = enhancementContext;
}
 
Example #9
Source File: BytecodeProviderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Enhancer getEnhancer(EnhancementContext enhancementContext) {
	return new EnhancerImpl( enhancementContext );
}
 
Example #10
Source File: BytecodeProviderImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Enhancer getEnhancer(EnhancementContext enhancementContext) {
	return new EnhancerImpl( enhancementContext, byteBuddyState );
}
 
Example #11
Source File: CustomDescriptor.java    From rapidoid with Apache License 2.0 4 votes vote down vote up
@Override
public void pushClassTransformer(EnhancementContext enhancementContext) {
	descriptor.pushClassTransformer(enhancementContext);
}
 
Example #12
Source File: EnhancerImpl.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs the Enhancer, using the given context.
 *
 * @param enhancementContext Describes the context in which enhancement will occur so as to give access
 * to contextual/environmental information.
 */
public EnhancerImpl(EnhancementContext enhancementContext) {
	this.enhancementContext = new JavassistEnhancementContext( enhancementContext );
	this.classPool = buildClassPool( this.enhancementContext );
}
 
Example #13
Source File: EnhancerImpl.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs the Enhancer, using the given context.
 *
 * @param enhancementContext Describes the context in which enhancement will occur so as to give access
 * to contextual/environmental information.
 * @param byteBuddyState refers to the ByteBuddy instance to use
 */
public EnhancerImpl(final EnhancementContext enhancementContext, final ByteBuddyState byteBuddyState) {
	this.enhancementContext = new ByteBuddyEnhancementContext( enhancementContext );
	this.byteBuddyState = byteBuddyState;
	this.typePool = buildTypePool( this.enhancementContext );
}
 
Example #14
Source File: BytecodeProvider.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.
 *
 * @param enhancementContext The enhancement context that describes the enhancements to apply.
 *
 * @return An enhancer to perform byte code manipulations.
 */
Enhancer getEnhancer(EnhancementContext enhancementContext);
 
Example #15
Source File: PersistenceUnitDescriptor.java    From lams with GNU General Public License v2.0 votes vote down vote up
public void pushClassTransformer(EnhancementContext enhancementContext);