[ https://issues.apache.org/jira/browse/JDO-591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640581#action_12640581 ]
Richard Schilling commented on JDO-591: --------------------------------------- This is certainly needed for enhancers. I might add some methods to the API presented to interrogate a class after enhancement to answer the following questions: * what enhancer processed the class? * what methods/members were added to the class by the enhancer? * how many bytes were added to the class when it was enhanced? * what version of JDO does the enhanced class conform to? It might also be convenient to give the enhancer the ability to do on-demand enhancing of a single class. And, to specify a debugging level. Thoughts? I've added to the suggested API for discussion... package javax.jdo.enhancer; import java.lang.instrument.ClassFileTransformer; public interface JDOEnhancer extends ClassFileTransformer { public long bytesAdded(String enhancedClassName); // how many bytes were added to the class public String[] methodsAdded(String enhancedClassName); // list of method signatures added public static String enhancerVendor(); // whose enhancer is this? public String enhancedBy(String enhancedClassName); // who enhanced this class? public String[] membersAdded(String enhancedClassName); // list of member signautures added to the class public long enhanceDate(String enhancedClassName); // when was the class enhanced (ms since epoch) public Class enhance(String className, File jdoConfigFile); // enhance a single class given a config public Class enhance(String className); // enhance using config file found in default locations public void setDebugLevel(enum level); // set the debugging level to an enumaration/constant value void setVerbose(boolean arg); void setOutputDirectory(String dirName); void enhancePersistenceUnit(String persistenceUnit); void enhanceClasses(String[] classNames); void enhanceJdoFiles(String[] jdoFileNames); void enhanceJar(String jarFileName); } Would it also be useful to add some methods so that the enhancer reports what it plans on doing to a class that has not been processed yet? I'm not suggesting it, but I'm curious to know what people think. Something like: public String generatePlan(String className); > Enhancer Invocation API > ----------------------- > > Key: JDO-591 > URL: https://issues.apache.org/jira/browse/JDO-591 > Project: JDO > Issue Type: New Feature > Components: api2 > Reporter: Andy Jefferson > Assignee: Andy Jefferson > Fix For: JDO 2 maintenance release 3 > > > Having a standard interface to invoke the enhancer makes a lot of sense so we > can have interchangeability of enhancers (for implementations that support > BinaryCompatibility). > A start point (for discussions) could be > java -cp classpath {enhancer-class} [options] [jdo-files] [class-files] > where options can be > -persistenceUnit persistence-unit-name : Name of a "persistence-unit" > to enhance the classes for > -d target-dir-name : Write the enhanced classes to the specified > directory > -checkonly : Just check the classes for enhancement status > -v : verbose output > This then allows enhancement of the specified classes, or the classes defined > by the specified JDO files, or the classes defined by the specified > persistence-unit. > What other control would people like to see ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.