Package javax.jdo

Interface JDOEnhancer

All Superinterfaces:
ClassFileTransformer

public interface JDOEnhancer extends ClassFileTransformer
Interface for a JDO Enhancer.
Since:
3.0
  • Method Details

    • getProperties

      Properties getProperties()
      Return non-configurable properties of this JDOEnhancer. Properties with keys "VendorName" and "VersionNumber" are required. Other keys are optional.
      Returns:
      the non-configurable properties of this JDOEnhancer.
    • setVerbose

      JDOEnhancer setVerbose(boolean flag)
      Whether to provide verbose output
      Parameters:
      flag - Verbose?
      Returns:
      The enhancer
    • setOutputDirectory

      JDOEnhancer setOutputDirectory(String dirName)
      Mutator to set the location where enhanced classes are written. Mutator to set the location where enhanced classes are written. If this method is not called, classes will be enhanced in place, overwriting the existing classes. If overwriting classes in a jar file, the existing files in the jar file will be written unchanged except for the enhanced classes. The directory name can be absolute or relative.
      Parameters:
      dirName - Name of the directory
      Returns:
      The enhancer
    • setClassLoader

      JDOEnhancer setClassLoader(ClassLoader loader)
      Mutator to set the class loader to use for loading classes.
      Parameters:
      loader - ClassLoader to use
      Returns:
      The enhancer
    • addPersistenceUnit

      JDOEnhancer addPersistenceUnit(String persistenceUnit)
      Add a persistence-unit to the items to be enhanced.
      Parameters:
      persistenceUnit - Name of the persistence unit
      Returns:
      The enhancer
    • addClass

      JDOEnhancer addClass(String className, byte[] bytes)
      Add an in-memory class to the items to be enhanced. The class name should be of the form "mydomain.MyClass".
      Parameters:
      className - Name of the class
      bytes - The bytes of the class
      Returns:
      The enhancer
    • addClasses

      JDOEnhancer addClasses(String... classNames)
      Add class(es) to the items to be enhanced. The class names can be absolute file names, relative file names, or names of CLASSPATH resources.
      Parameters:
      classNames - Names of the classes
      Returns:
      The enhancer
    • addFiles

      JDOEnhancer addFiles(String... metadataFiles)
      Add metadata file(s) to the items to be enhanced. The metadata file names can be absolute file names, relative file names, or names of CLASSPATH resources. They should be JDO XML metadata files.
      Parameters:
      metadataFiles - Names of the files
      Returns:
      The enhancer
    • addJar

      JDOEnhancer addJar(String jarFileName)
      Add a jar file to the items to be enhanced. The jar file name can be absolute, or relative or a CLASSPATH resource.
      Parameters:
      jarFileName - Name of the jar file
      Returns:
      The enhancer
    • enhance

      int enhance()
      Method to enhance the items specified using addJar, addFiles, addClasses, addClass, addPersistenceUnit.
      Returns:
      Number of classes enhanced
      Throws:
      JDOEnhanceException - if an error occurs during enhancement. If multiple errors occur then the nested exceptions provides this detail.
    • validate

      int validate()
      Method to validate the items specified using addJar, addFiles, addClasses, addClass, addPersistenceUnit.
      Returns:
      Number of classes validated
      Throws:
      JDOEnhanceException - if an error occurs during validation. If multiple errors occur then the nested exceptions provides this detail.
    • getEnhancedBytes

      byte[] getEnhancedBytes(String className)
      Method to retrieve the (enhanced) bytes of the specified class. Only applies to the classes enhanced in the most recent enhance() call. If no enhance has yet been performed will throw a JDOEnhanceException. If the specified class hasn't been enhanced then will throw a JDOEnhanceException.
      Parameters:
      className - Name of the class (of the form "mydomain.MyClass")
      Returns:
      Enhanced bytes
    • registerMetadata

      void registerMetadata(JDOMetadata metadata)
      Method to register metadata with the enhancement process managed by this JDOEnhancer. Metadata can be created using the method newMetadata(). If there is already metadata registered for a class contained in this metadata object then a JDOUserException will be thrown.
      Parameters:
      metadata - The Metadata to register.
      Since:
      3.0
    • newMetadata

      JDOMetadata newMetadata()
      Method to return a new metadata object that can be subsequently modified and registered with the enhancement process using the method registerMetadata(javax.jdo.metadata.JDOMetadata).
      Returns:
      The metadata
      Since:
      3.0