KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > ejb > cmp3 > EntityManagerFactoryImpl


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, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.ejb.cmp3;
23
24 import java.util.Map JavaDoc;
25
26 import javax.persistence.EntityManager;
27 import javax.persistence.EntityManagerFactory;
28 import javax.persistence.PersistenceContextType;
29
30 import oracle.toplink.essentials.threetier.ServerSession;
31 import oracle.toplink.essentials.jndi.JNDIConnector;
32 import oracle.toplink.essentials.internal.localization.ExceptionLocalization;
33
34 /**
35 * <p>
36 * <b>Purpose</b>: Provides the implementation for the EntityManager Factory.
37 * <p>
38 * <b>Description</b>: This class will store a reference to the active ServerSession. When a request
39 * is made for an EntityManager an new EntityManager is created with the ServerSession and returned.
40 * The primary consumer of these EntityManager is assumed to be either the Container. There is
41 * one EntityManagerFactory per deployment.
42 * @see javax.persistence.EntityManager
43 * @see oracle.toplink.essentials.ejb.cmp3.EntityManager
44 * @see oracle.toplink.essentials.ejb.cmp3.EntityManagerFactory
45 */

46
47 /* @author gyorke
48  * @since TopLink 10.1.3 EJB 3.0 Preview
49  */

50 public class EntityManagerFactoryImpl
51     extends oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl
52     implements EntityManagerFactory
53 {
54
55     /**
56      * Will return an instance of the Factory. Should only be called by TopLink.
57      * @param serverSession
58      */

59     public EntityManagerFactoryImpl(ServerSession serverSession) {
60         super(serverSession);
61     }
62
63     /**
64      * Will return an instance of the Factory. Should only be called by TopLink.
65      * @param serverSession
66      */

67     public EntityManagerFactoryImpl(EntityManagerSetupImpl setupImpl, Map JavaDoc properties) {
68         super(setupImpl, properties);
69     }
70
71     /**
72      * PUBLIC:
73      * Returns an EntityManager for this deployment
74      */

75     public EntityManager createEntityManager() {
76         return (EntityManager) createEntityManagerImpl(false);
77     }
78     
79     /**
80      * PUBLIC:
81      * Returns an EntityManager for this deployment
82      */

83     public EntityManager createEntityManager(Map JavaDoc properties) {
84         return (EntityManager) createEntityManagerImpl(properties, false);
85     }
86
87     //TODO change the way create works to deal with how the specification works with persistence contexts
88
protected oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl createEntityManagerImplInternal(Map JavaDoc properties, boolean extended) {
89         return new EntityManagerImpl(this, properties, false, extended);
90     }
91 }
92
Popular Tags