1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jdo.impl.enhancer;
18
19 import java.io.InputStream;
20 import java.io.OutputStream;
21
22 /***
23 * A JDO enhancer, or byte-code enhancer, modifies the byte-codes of
24 * Java class files to enable transparent loading and storing of the
25 * fields of the persistent instances.
26 *
27 * @author Martin Zaun
28 */
29 public interface ClassFileEnhancer
30 {
31 /***
32 * Enhances a given class according to the JDO meta-data. If the
33 * input class has been enhanced or not - the output stream is
34 * always written, either with the enhanced class or with the
35 * non-enhanced class.
36 *
37 * @param in The byte-code of the class to be enhanced.
38 * @param out The byte-code of the enhanced class.
39 * @return <code>true</code> if the class has been enhanced,
40 * <code>false</code> otherwise.
41 */
42 boolean enhanceClassFile(InputStream in,
43 OutputStream out)
44 throws EnhancerUserException, EnhancerFatalError;
45
46
47 /***
48 * Enhances a given class according to the JDO meta-data. If the
49 * input class has been enhanced or not - the output stream is
50 * always written, either with the enhanced class or with the
51 * non-enhanced class.
52 * <p>
53 * Furthermore, the enhancer has to set the classname of
54 * the enhanced class to the output stream wrapper object (it's
55 * possible to get the input stream without knowing the classname).
56 *
57 * @param in The byte-code of the class to be enhanced.
58 * @param out The byte-code of the enhanced class.
59 * @return <code>true</code> if the class has been enhanced,
60 * <code>false</code> otherwise.
61 */
62 boolean enhanceClassFile(InputStream in,
63 OutputStreamWrapper out)
64 throws EnhancerUserException, EnhancerFatalError;
65 }