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