Codota Logo
JPADelegatingClassFileTransformer
Code IndexAdd Codota to your IDE (free)

How to use
JPADelegatingClassFileTransformer
in
org.jboss.as.jpa.classloader

Best Java code snippets using org.jboss.as.jpa.classloader.JPADelegatingClassFileTransformer (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.jboss.eap/wildfly-jpa

@Override
public byte[] transform(ClassLoader classLoader, String className, Class<?> aClass, ProtectionDomain protectionDomain, byte[] originalBuffer) {
  return getBytes(transform(classLoader, className, protectionDomain, ByteBuffer.wrap(originalBuffer)));
}
origin: org.wildfly/wildfly-jpa

@Override
public ByteBuffer transform(ClassLoader classLoader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes)
    throws IllegalArgumentException {
  byte[] transformedBuffer = getBytes(classBytes);
  boolean transformed = false;
  for (javax.persistence.spi.ClassTransformer transformer : persistenceUnitMetadata.getTransformers()) {
    if (ROOT_LOGGER.isTraceEnabled())
      ROOT_LOGGER.tracef("rewrite entity class '%s' using transformer '%s' for '%s'", className,
          transformer.getClass().getName(),
          persistenceUnitMetadata.getScopedPersistenceUnitName());
    byte[] result;
    try {
      // parameter classBeingRedefined is always passed as null
      // because we won't ever be called to transform already loaded classes.
      result = transformer.transform(classLoader, className, null, protectionDomain, transformedBuffer);
    } catch (IllegalClassFormatException e) {
      throw JpaLogger.ROOT_LOGGER.invalidClassFormat(e, className);
    }
    if (result != null) {
      transformedBuffer = result;
      transformed = true;
    if (ROOT_LOGGER.isTraceEnabled())
      ROOT_LOGGER.tracef("entity class '%s' was rewritten", className);
    }
  }
  return transformed ? ByteBuffer.wrap(transformedBuffer) : null;
}
origin: org.wildfly/wildfly-jpa

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());
    }
  }
}
origin: org.jboss.eap/wildfly-jpa

@Override
public ByteBuffer transform(ClassLoader classLoader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes)
    throws IllegalArgumentException {
  byte[] transformedBuffer = getBytes(classBytes);
  boolean transformed = false;
  for (javax.persistence.spi.ClassTransformer transformer : persistenceUnitMetadata.getTransformers()) {
    if (ROOT_LOGGER.isTraceEnabled())
      ROOT_LOGGER.tracef("rewrite entity class '%s' using transformer '%s' for '%s'", className,
          transformer.getClass().getName(),
          persistenceUnitMetadata.getScopedPersistenceUnitName());
    byte[] result;
    try {
      // parameter classBeingRedefined is always passed as null
      // because we won't ever be called to transform already loaded classes.
      result = transformer.transform(classLoader, className, null, protectionDomain, transformedBuffer);
    } catch (IllegalClassFormatException e) {
      throw JpaLogger.ROOT_LOGGER.invalidClassFormat(e, className);
    }
    if (result != null) {
      transformedBuffer = result;
      transformed = true;
    if (ROOT_LOGGER.isTraceEnabled())
      ROOT_LOGGER.tracef("entity class '%s' was rewritten", className);
    }
  }
  return transformed ? ByteBuffer.wrap(transformedBuffer) : null;
}
origin: org.jboss.eap/wildfly-jpa

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());
    }
  }
}
origin: org.wildfly/wildfly-jpa

@Override
public byte[] transform(ClassLoader classLoader, String className, Class<?> aClass, ProtectionDomain protectionDomain, byte[] originalBuffer) {
  return getBytes(transform(classLoader, className, protectionDomain, ByteBuffer.wrap(originalBuffer)));
}
org.jboss.as.jpa.classloaderJPADelegatingClassFileTransformer

Javadoc

Helps implement PersistenceUnitInfo.addClassTransformer() by using DelegatingClassFileTransformer

Most used methods

  • <init>
  • getBytes
  • transform

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now