openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r740991 - in /openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence: EntityManagerFactoryImpl.java EntityManagerImpl.java OpenJPAEntityManagerFactory.java
Date Thu, 05 Feb 2009 03:31:15 GMT
Author: jrbauer
Date: Thu Feb  5 03:31:15 2009
New Revision: 740991

URL: http://svn.apache.org/viewvc?rev=740991&view=rev
Log:
OPENJPA-849 Committing code and corresponding tests contributed by Dianne Richards

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=740991&r1=740990&r2=740991&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
Thu Feb  5 03:31:15 2009
@@ -18,23 +18,18 @@
  */
 package org.apache.openjpa.persistence;
 
-import java.io.InputStream;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 import javax.persistence.Cache;
 import javax.persistence.EntityManagerFactory;
-import javax.persistence.QueryBuilder;
-
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.enhance.Reflection;
 import org.apache.openjpa.kernel.AutoDetach;
@@ -71,7 +66,6 @@
     private transient Constructor<FetchPlan> _plan = null;
     private transient StoreCache _cache = null;
     private transient QueryResultCache _queryCache = null;
-    private Set<String> _supportedPropertyKeys; 
 
     /**
      * Default constructor provided for auto-instantiation.
@@ -104,9 +98,20 @@
     public OpenJPAConfiguration getConfiguration() {
         return _factory.getConfiguration();
     }
-
-    public Properties getProperties() {
-        return _factory.getProperties();
+    
+    /* 
+     * @see javax.persistence.EntityManagerFactory#getProperties()
+     * 
+     * This does not return the password property.
+     */
+    public Map getProperties() {
+        Map properties = _factory.getAllProperties();
+        
+        // Remove the password property
+        properties.remove("javax.persistence.jdbc.password");
+        properties.remove("openjpa.ConnectionPassword");
+        
+        return properties;
     }
 
     public Object putUserObject(Object key, Object val) {
@@ -350,7 +355,6 @@
     }
 
     public Set<String> getSupportedProperties() {
-        throw new UnsupportedOperationException(
-            "JPA 2.0 - Method not yet implemented");
+        return _factory.getSupportedProperties();
     }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=740991&r1=740990&r2=740991&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Thu Feb  5 03:31:15 2009
@@ -31,6 +31,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.IdentityHashMap;
 import java.util.Map;
 import java.util.Set;
@@ -964,7 +965,7 @@
         return _broker.getCachePreparedQuery() ?
             getConfiguration().getQuerySQLCacheInstance() : null;
     }
-
+    
     /**
      * Gets the prepared query cached by the given key. 
      * 
@@ -975,7 +976,6 @@
         return (cache == null) ? null : cache.get(id);
     }
 
-    
     public void setFlushMode(FlushModeType flushMode) {
         assertNotCloseInvoked();
         _broker.assertOpen();
@@ -1442,9 +1442,23 @@
             "JPA 2.0 - Method not yet implemented");
     }
 
+    /* 
+     * @see javax.persistence.EntityManager#getProperties()
+     * 
+     * This does not return the password property.
+     */
     public Map<String, Object> getProperties() {
-        throw new UnsupportedOperationException(
-            "JPA 2.0 - Method not yet implemented");
+        Map<String, String> currentProperties = _broker.getProperties();
+        
+        // Convert the <String, String> map into a <String, Object> map
+        Map<String, Object> finalMap =
+            new HashMap<String, Object>(currentProperties);
+        
+        // Remove the password property
+        finalMap.remove("javax.persistence.jdbc.password");
+        finalMap.remove("openjpa.ConnectionPassword");
+        
+        return finalMap;
     }
 
     public OpenJPAQueryBuilder getQueryBuilder() {
@@ -1452,8 +1466,7 @@
     }
 
     public Set<String> getSupportedProperties() {
-        throw new UnsupportedOperationException(
-            "JPA 2.0 - Method not yet implemented");
+        return _broker.getSupportedProperties();
     }
 
     public void lock(Object entity, LockModeType lockMode, Map<String, 

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java?rev=740991&r1=740990&r2=740991&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/OpenJPAEntityManagerFactory.java
Thu Feb  5 03:31:15 2009
@@ -36,7 +36,7 @@
     /**
      * Return properties describing this runtime.
      */
-    public Properties getProperties();
+    public Map<String, Object> getProperties();
 
     /**
      * Put the specified key-value pair into the map of user objects.



Mime
View raw message