KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > descriptors > WrapperPolicy


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
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
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 in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.descriptors;
23
24 import java.io.Serializable JavaDoc;
25 import oracle.toplink.essentials.exceptions.*;
26 import oracle.toplink.essentials.internal.sessions.AbstractSession;
27
28 /**
29  * <p><b>Purpose</b>: The wrapper policy can be used to wrap all objects read from the database in another object.
30  * This allows for TopLink to utilize one version of the class for its purposes and allows for the
31  * application to deal with another version of the object.
32  * The wrapper policy is used for things such as EJB Entity Beans and is directly used by the
33  * TopLink for WebLogic product for EJB Container Managed Persistence.
34  *
35  * It is assumed that relationships must be through the wrapper objects.
36  * Object identity is not maintained on the wrapper objects, only the wrapped object.
37  */

38 public interface WrapperPolicy extends Serializable JavaDoc {
39
40     /**
41      * PUBLIC:
42      * Required: Lets the policy perform initialization.
43      * @param session the session to initialize against
44      */

45     void initialize(AbstractSession session) throws DescriptorException;
46
47     /**
48      * PUBLIC:
49      * Required: Return true if the wrapped value should be traversed.
50      * Normally the wrapped value is looked after independently, it is not required to be traversed.
51      */

52     boolean isTraversable();
53
54     /**
55      * PUBLIC:
56      * Required: Return true if the object is already wrapped.
57      */

58     boolean isWrapped(Object JavaDoc object);
59
60     /**
61      * PUBLIC:
62      * Required: Set the descriptor.
63      * @param descriptor the descriptor for the object being wrapped
64      */

65     void setDescriptor(ClassDescriptor descriptor);
66
67     /**
68      * PUBLIC:
69      * Required: Unwrap the object to return the implementation that is meant to be used by TopLink.
70      * The object may already be unwrapped in which case the object should be returned.
71      * @param proxy the wrapped object
72      * @param session the session to unwrap into
73      */

74     Object JavaDoc unwrapObject(Object JavaDoc proxy, AbstractSession session);
75
76     /**
77      * PUBLIC:
78      * Required: Wrap the object to return the implementation that the application requires.
79      * The object may already be wrapped in which case the object should be returned.
80      * @param original, the object to be wrapped
81      * @param session the session to wrap the object against.
82      * @return java.lang.Object the wrapped object
83      */

84     Object JavaDoc wrapObject(Object JavaDoc original, AbstractSession session);
85 }
86
Popular Tags