001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.openjpa.persistence;
020:
021: import java.io.Serializable;
022: import java.util.Map;
023: import java.util.Properties;
024: import javax.persistence.EntityManagerFactory;
025:
026: /**
027: * Interface implemented by OpenJPA entity manager factories.
028: *
029: * @author Abe White
030: * @since 0.4.0
031: * @published
032: */
033: public interface OpenJPAEntityManagerFactory extends
034: EntityManagerFactory, Serializable {
035:
036: /**
037: * Return properties describing this runtime.
038: */
039: public Properties getProperties();
040:
041: /**
042: * Put the specified key-value pair into the map of user objects.
043: */
044: public Object putUserObject(Object key, Object val);
045:
046: /**
047: * Get the value for the specified key from the map of user objects.
048: */
049: public Object getUserObject(Object key);
050:
051: /**
052: * Access the level 2 store cache. This cache acts as a proxy to all
053: * named caches.
054: */
055: public StoreCache getStoreCache();
056:
057: /**
058: * Access a named level 2 store cache.
059: */
060: public StoreCache getStoreCache(String name);
061:
062: /**
063: * Access query result cache.
064: */
065: public QueryResultCache getQueryResultCache();
066:
067: public OpenJPAEntityManager createEntityManager();
068:
069: /**
070: * Return an entity manager with the provided additional configuration
071: * settings. OpenJPA recognizes the following configuration settings in this
072: * method:
073: * <ul>
074: * <li>openjpa.ConnectionUsername</li>
075: * <li>openjpa.ConnectionPassword</li>
076: * <li>openjpa.ConnectionRetainMode</li>
077: * <li>openjpa.TransactionMode</li>
078: * </ul>
079: */
080: public OpenJPAEntityManager createEntityManager(Map props);
081:
082: /**
083: * @deprecated use {@link ConnectionRetainMode} enums instead.
084: */
085: public static final int CONN_RETAIN_DEMAND = 0;
086:
087: /**
088: * @deprecated use {@link ConnectionRetainMode} enums instead.
089: */
090: public static final int CONN_RETAIN_TRANS = 1;
091:
092: /**
093: * @deprecated use {@link ConnectionRetainMode} enums instead.
094: */
095: public static final int CONN_RETAIN_ALWAYS = 2;
096:
097: /**
098: * @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
099: * method pierces the published-API boundary, as does the SPI cast.
100: */
101: public org.apache.openjpa.conf.OpenJPAConfiguration getConfiguration();
102:
103: /**
104: * @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
105: * method pierces the published-API boundary, as does the SPI cast.
106: */
107: public void addLifecycleListener(Object listener, Class... classes);
108:
109: /**
110: * @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
111: * method pierces the published-API boundary, as does the SPI cast.
112: */
113: public void removeLifecycleListener(Object listener);
114:
115: /**
116: * @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
117: * method pierces the published-API boundary, as does the SPI cast.
118: */
119: public void addTransactionListener(Object listener);
120:
121: /**
122: * @deprecated cast to {@link OpenJPAEntityManagerFactorySPI} instead. This
123: * method pierces the published-API boundary, as does the SPI cast.
124: */
125: public void removeTransactionListener(Object listener);
126: }
|