@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null || transformer == null) { return; } try { for (String transformerClassName : moduleSpecification.getClassFileTransformers()) { transformer.addTransformer((ClassFileTransformer) module.getClassLoader().loadClass(transformerClassName).newInstance()); } // activate transformer only after all delegate transformers have been added // so that transformers themselves are not instrumented transformer.setActive(true); } catch (Exception e) { throw ServerMessages.MESSAGES.failedToInstantiateClassFileTransformer(ClassFileTransformer.class.getSimpleName(), e); } }
private void setClassLoaderTransformer(DeploymentUnit deploymentUnit) { // (AS7-2233) each persistence unit can use a persistence provider, that might need // to use ClassTransformers. Providers that need class transformers will add them // during the call to CreateContainerEntityManagerFactory. DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); boolean appContainsPersistenceProviderJars = false; // remove when we revert WFLY-10520 if ( transformer != null) { for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) { PersistenceUnitMetadataHolder holder = resourceRoot.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS); if (holder != null) { for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { if (Configuration.needClassFileTransformer(pu)) { transformer.addTransformer(new JPADelegatingClassFileTransformer(pu)); } // remove this check when we revert WFLY-10520 String provider = pu.getProperties().getProperty(Configuration.PROVIDER_MODULE); if (provider != null) { if (provider.equals(Configuration.PROVIDER_MODULE_APPLICATION_SUPPLIED)) { appContainsPersistenceProviderJars = true; } } } } } // WFLY-10520 Add Hibernate ORM 5.3 compatibility transformer if(!appContainsPersistenceProviderJars && hibernate51CompatibilityTransformer) { transformer.addTransformer(Hibernate51CompatibilityTransformer.getInstance()); } } }
new FactoryPermissionCollection(permFactories.toArray(new PermissionFactory[permFactories.size()]))); final DelegatingClassFileTransformer delegatingClassFileTransformer = new DelegatingClassFileTransformer(); specBuilder.setClassFileTransformer(delegatingClassFileTransformer); deploymentUnit.putAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY, delegatingClassFileTransformer);
private void setClassLoaderTransformer(DeploymentUnit deploymentUnit) { // (AS7-2233) each persistence unit can use a persistence provider, that might need // to use ClassTransformers. Providers that need class transformers will add them // during the call to CreateContainerEntityManagerFactory. DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); boolean appContainsPersistenceProviderJars = false; // remove when we revert WFLY-10520 if ( transformer != null) { for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) { PersistenceUnitMetadataHolder holder = resourceRoot.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS); if (holder != null) { for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { if (Configuration.needClassFileTransformer(pu)) { transformer.addTransformer(new JPADelegatingClassFileTransformer(pu)); } // remove this check when we revert WFLY-10520 String provider = pu.getProperties().getProperty(Configuration.PROVIDER_MODULE); if (provider != null) { if (provider.equals(Configuration.PROVIDER_MODULE_APPLICATION_SUPPLIED)) { appContainsPersistenceProviderJars = true; } } } } } // WFLY-10520 Add Hibernate ORM 5.3 compatibility transformer if(!appContainsPersistenceProviderJars && hibernate51CompatibilityTransformer) { transformer.addTransformer(Hibernate51CompatibilityTransformer.getInstance()); } } }
deploymentUnit.putAttachment(Attachments.MODULE_PERMISSIONS, permissionCollection); final DelegatingClassFileTransformer delegatingClassFileTransformer = new DelegatingClassFileTransformer(); specBuilder.setClassFileTransformer(delegatingClassFileTransformer); deploymentUnit.putAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY, delegatingClassFileTransformer);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null || transformer == null) { return; } try { for (String transformerClassName : moduleSpecification.getClassFileTransformers()) { transformer.addTransformer((ClassFileTransformer) module.getClassLoader().loadClass(transformerClassName).newInstance()); } // activate transformer only after all delegate transformers have been added // so that transformers themselves are not instrumented transformer.setActive(true); } catch (Exception e) { throw ServerLogger.ROOT_LOGGER.failedToInstantiateClassFileTransformer(ClassFileTransformer.class.getSimpleName(), e); } }
deploymentUnit.putAttachment(Attachments.MODULE_PERMISSIONS, permissionCollection); final DelegatingClassFileTransformer delegatingClassFileTransformer = new DelegatingClassFileTransformer(); specBuilder.setClassFileTransformer(delegatingClassFileTransformer); deploymentUnit.putAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY, delegatingClassFileTransformer);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null || transformer == null) { return; } try { for (String transformerClassName : moduleSpecification.getClassFileTransformers()) { transformer.addTransformer((ClassFileTransformer) module.getClassLoader().loadClass(transformerClassName).newInstance()); } // activate transformer only after all delegate transformers have been added // so that transformers themselves are not instrumented transformer.setActive(true); } catch (Exception e) { throw ServerLogger.ROOT_LOGGER.failedToInstantiateClassFileTransformer(ClassFileTransformer.class.getSimpleName(), e); } }
final DelegatingClassFileTransformer delegatingClassFileTransformer = new DelegatingClassFileTransformer(); specBuilder.setClassFileTransformer(delegatingClassFileTransformer); deploymentUnit.putAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY, delegatingClassFileTransformer);
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null || transformer == null) { return; } try { for (String transformerClassName : moduleSpecification.getClassFileTransformers()) { transformer.addTransformer((ClassFileTransformer) module.getClassLoader().loadClass(transformerClassName).newInstance()); } // activate transformer only after all delegate transformers have been added // so that transformers themselves are not instrumented transformer.setActive(true); } catch (Exception e) { throw ServerMessages.MESSAGES.failedToInstantiateClassFileTransformer(ClassFileTransformer.class.getSimpleName(), e); } }