KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > sqlstore > ejb > JDOEJB20Helper


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
26 /*
27  * JDOEJB20Helper.java
28  *
29  * Created on January 17, 2002
30  */

31
32 package com.sun.jdo.spi.persistence.support.sqlstore.ejb;
33
34 import java.util.Collection JavaDoc;
35 import java.util.Set JavaDoc;
36
37 import javax.ejb.EJBLocalObject JavaDoc;
38 import javax.ejb.EJBContext JavaDoc;
39
40 import com.sun.jdo.api.persistence.support.PersistenceManager;
41
42 /*
43  * This is the helper interface for conversion of persistence-capable instances
44  * to and from EJB objects of type EJBLocalObject and Collections of those.
45  * It extends generic interface JDOEJB11Helper for all other types of conversions.
46  *
47  * @author Marina Vatkina
48  */

49 public interface JDOEJB20Helper extends JDOEJB11Helper {
50
51     /**
52      * Converts persistence-capable instance to EJBLocalObject.
53      * @param pc the persistence-capable instance to be converted as an Object.
54      * @param pm the associated instance of PersistenceManager.
55      * @return instance of EJBLocalObject.
56      */

57     EJBLocalObject JavaDoc convertPCToEJBLocalObject (Object JavaDoc pc, PersistenceManager pm);
58
59     /**
60      * Converts persistence-capable instance to EJBLocalObject. Returns null if
61      * the instance is already removed via cascade-delete operation.
62      * @param pc the persistence-capable instance to be converted as an Object.
63      * @param pm the associated instance of PersistenceManager.
64      * @param context the EJBContext of the calling bean.
65      * @return instance of EJBLocalObject.
66      */

67     EJBLocalObject JavaDoc convertPCToEJBLocalObject (Object JavaDoc pc, PersistenceManager pm,
68         EJBContext JavaDoc context);
69
70     /**
71      * Converts EJBLocalObject to persistence-capable instance.
72      * @param o the EJBLocalObject instance to be converted.
73      * @param pm the associated instance of PersistenceManager.
74      * @param validate true if the existence of the instance is to be validated.
75      * @return persistence-capable instance.
76      * @throw IllegalArgumentException if validate is true and instance does
77      * not exist in the database or is deleted.
78      */

79     Object JavaDoc convertEJBLocalObjectToPC(EJBLocalObject JavaDoc o, PersistenceManager pm,
80         boolean validate);
81
82     /**
83      * Converts Collection of persistence-capable instances to a Collection of
84      * EJBLocalObjects.
85      * @param pcs the Collection of persistence-capable instance to be converted.
86      * @param pm the associated instance of PersistenceManager.
87      * @return Collection of EJBLocalObjects.
88      */

89     Collection JavaDoc convertCollectionPCToEJBLocalObject (Collection JavaDoc pcs, PersistenceManager pm);
90
91     /**
92      * Converts Collection of persistence-capable instances to a Set of
93      * EJBLocalObjects.
94      * @param pcs the Collection of persistence-capable instance to be converted.
95      * @param pm the associated instance of PersistenceManager.
96      * @return Set of EJBLocalObjects.
97      */

98     Set JavaDoc convertCollectionPCToEJBLocalObjectSet (Collection JavaDoc pcs, PersistenceManager pm);
99
100     /**
101      * Converts Collection of EJBLocalObjects to a Collection of
102      * persistence-capable instances.
103      * @param coll the Collection of EJBLocalObject instances to be converted.
104      * @param pm the associated instance of PersistenceManager.
105      * @param validate true if the existence of the instances is to be validated.
106      * @return Collection of persistence-capable instance.
107      * @throw IllegalArgumentException if validate is true and at least one instance does
108      * not exist in the database or is deleted.
109      */

110     Collection JavaDoc convertCollectionEJBLocalObjectToPC (Collection JavaDoc coll, PersistenceManager pm,
111         boolean validate);
112
113     /**
114      * Validates that this instance is of the correct implementation class
115      * of a local interface type.
116      *
117      * @param o the instance to validate.
118      * @return true if the type is correct.
119      * @throw IllegalArgumentException if validation fails.
120      */

121     void assertInstanceOfLocalInterfaceImpl(Object JavaDoc o);
122     
123 }
124
Popular Tags