KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > enhancer > ByteCodeEnhancer


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.jdo.api.persistence.enhancer;
26
27 import java.io.InputStream JavaDoc;
28 import java.io.OutputStream JavaDoc;
29
30 import java.util.zip.ZipInputStream JavaDoc;
31 import java.util.zip.ZipOutputStream JavaDoc;
32
33
34 /**
35  * A JDO enhancer, or byte-code enhancer, modifies the byte-codes of
36  * Java class files to enable transparent loading and storing of the
37  * fields of the persistent instances.
38  */

39 public interface ByteCodeEnhancer
40 {
41     /**
42      * Enhances a given class according to the JDO meta-data. If the
43      * input class has been enhanced or not - the output stream is
44      * always written, either with the enhanced class or with the
45      * non-enhanced class.
46      *
47      * @param inByteCode The byte-code of the class to be enhanced.
48      * @param outByteCode The byte-code of the enhanced class.
49      *
50      * @return <code>true</code> if the class has been enhanced,
51      * <code>false</code> otherwise.
52      */

53    boolean enhanceClassFile(InputStream JavaDoc inByteCode,
54                             OutputStream JavaDoc outByteCode)
55         throws EnhancerUserException, EnhancerFatalError;
56
57
58     /**
59      * Enhances a given class according to the JDO meta-data. If the
60      * input class has been enhanced or not - the output stream is
61      * always written, either with the enhanced class or with the
62      * non-enhanced class.
63      * <br>
64      * Furthermore the enhancer has to set the classname of
65      * the enhanced class to the output stream wrapper object (it's
66      * possible to get the input stream without knowing the classname).
67      *
68      * @param inByteCode The byte-code of the class to be enhanced.
69      * @param outByteCode The byte-code of the enhanced class.
70      *
71      * @return <code>true</code> if the class has been enhanced,
72      * <code>false</code> otherwise.
73      */

74     boolean enhanceClassFile (InputStream JavaDoc in,
75                               OutputStreamWrapper out)
76             throws EnhancerUserException,
77                    EnhancerFatalError;
78
79 }
80
Popular Tags