001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * // Copyright (c) 1998, 2007, Oracle. All rights reserved.
005: *
006: *
007: * The contents of this file are subject to the terms of either the GNU
008: * General Public License Version 2 only ("GPL") or the Common Development
009: * and Distribution License("CDDL") (collectively, the "License"). You
010: * may not use this file except in compliance with the License. You can obtain
011: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
012: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
013: * language governing permissions and limitations under the License.
014: *
015: * When distributing the software, include this License Header Notice in each
016: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
017: * Sun designates this particular file as subject to the "Classpath" exception
018: * as provided by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the License
020: * Header, with the fields enclosed by brackets [] replaced by your own
021: * identifying information: "Portions Copyrighted [year]
022: * [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * If you wish your version of this file to be governed by only the CDDL or
027: * only the GPL Version 2, indicate your decision by adding "[Contributor]
028: * elects to include this software in this distribution under the [CDDL or GPL
029: * Version 2] license." If you don't indicate a single choice of license, a
030: * recipient has the option to distribute your version of this file under
031: * either the CDDL, the GPL Version 2 or to extend the choice of license to
032: * its licensees as provided above. However, if you add GPL Version 2 code
033: * and therefore, elected the GPL Version 2 license, then the option applies
034: * only if the new code is made subject to such option by the copyright
035: * holder.
036: */
037: package oracle.toplink.essentials.internal.ejb.cmp3;
038:
039: import java.util.Map;
040:
041: import javax.persistence.EntityManager;
042: import javax.persistence.EntityManagerFactory;
043: import javax.persistence.PersistenceContextType;
044:
045: import oracle.toplink.essentials.threetier.ServerSession;
046: import oracle.toplink.essentials.jndi.JNDIConnector;
047: import oracle.toplink.essentials.internal.localization.ExceptionLocalization;
048:
049: /**
050: * <p>
051: * <b>Purpose</b>: Provides the implementation for the EntityManager Factory.
052: * <p>
053: * <b>Description</b>: This class will store a reference to the active ServerSession. When a request
054: * is made for an EntityManager an new EntityManager is created with the ServerSession and returned.
055: * The primary consumer of these EntityManager is assumed to be either the Container. There is
056: * one EntityManagerFactory per deployment.
057: * @see javax.persistence.EntityManager
058: * @see oracle.toplink.essentials.ejb.cmp3.EntityManager
059: * @see oracle.toplink.essentials.ejb.cmp3.EntityManagerFactory
060: */
061:
062: /* @author gyorke
063: * @since TopLink 10.1.3 EJB 3.0 Preview
064: */
065: public class EntityManagerFactoryImpl
066: extends
067: oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl
068: implements EntityManagerFactory {
069:
070: /**
071: * Will return an instance of the Factory. Should only be called by TopLink.
072: * @param serverSession
073: */
074: public EntityManagerFactoryImpl(ServerSession serverSession) {
075: super (serverSession);
076: }
077:
078: /**
079: * Will return an instance of the Factory. Should only be called by TopLink.
080: * @param serverSession
081: */
082: public EntityManagerFactoryImpl(EntityManagerSetupImpl setupImpl,
083: Map properties) {
084: super (setupImpl, properties);
085: }
086:
087: /**
088: * PUBLIC:
089: * Returns an EntityManager for this deployment
090: */
091: public EntityManager createEntityManager() {
092: return (EntityManager) createEntityManagerImpl(false);
093: }
094:
095: /**
096: * PUBLIC:
097: * Returns an EntityManager for this deployment
098: */
099: public EntityManager createEntityManager(Map properties) {
100: return (EntityManager) createEntityManagerImpl(properties,
101: false);
102: }
103:
104: //TODO change the way create works to deal with how the specification works with persistence contexts
105: protected oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl createEntityManagerImplInternal(
106: Map properties, boolean extended) {
107: return new EntityManagerImpl(this , properties, false, extended);
108: }
109: }
|