You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2014/05/28 09:49:04 UTC

svn commit: r1597932 - in /tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/ReloadableEntityManagerFactory.java persistence/PersistenceUnitInfoImpl.java

Author: andygumbrecht
Date: Wed May 28 07:49:04 2014
New Revision: 1597932

URL: http://svn.apache.org/r1597932
Log:
Use SharedCacheMode.UNSPECIFIED when unspecified.

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java?rev=1597932&r1=1597931&r2=1597932&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ReloadableEntityManagerFactory.java Wed May 28 07:49:04 2014
@@ -279,12 +279,10 @@ public class ReloadableEntityManagerFact
 
     public synchronized void setSharedCacheMode(final SharedCacheMode mode) {
         final PersistenceUnitInfoImpl info = entityManagerFactoryCallable.getUnitInfo();
-        info.setSharedCacheMode(mode);
+        info.setSharedCacheMode(null != mode ? mode : SharedCacheMode.UNSPECIFIED);
 
         final Properties properties = entityManagerFactoryCallable.getUnitInfo().getProperties();
-        if (properties.containsKey(JAVAX_PERSISTENCE_SHARED_CACHE_MODE)) {
-            properties.setProperty(JAVAX_PERSISTENCE_SHARED_CACHE_MODE, mode.name());
-        }
+        properties.setProperty(JAVAX_PERSISTENCE_SHARED_CACHE_MODE, null != mode ? mode.name() : "UNSPECIFIED");
     }
 
     public synchronized void setValidationMode(final ValidationMode mode) {

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java?rev=1597932&r1=1597931&r2=1597932&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/persistence/PersistenceUnitInfoImpl.java Wed May 28 07:49:04 2014
@@ -66,8 +66,8 @@ public class PersistenceUnitInfoImpl imp
     private String persistenceProviderClassName;
 
     /**
-     * Does this persistence unti participate in JTA transactions or does it manage
-     * resource local tranactions using the JDBC APIs.
+     * Does this persistence unit participate in JTA transactions or does it manage
+     * resource local transactions using the JDBC APIs.
      */
     private PersistenceUnitTransactionType transactionType = PersistenceUnitTransactionType.JTA;
 
@@ -119,21 +119,33 @@ public class PersistenceUnitInfoImpl imp
     private ClassLoader classLoader;
 
     // JPA 2.0
-    /** Schema version of the persistence.xml file */
+    /**
+     * Schema version of the persistence.xml file
+     */
     private String persistenceXMLSchemaVersion;
 
-    /** Second-level cache mode for the persistence unit */
+    /**
+     * Second-level cache mode for the persistence unit
+     */
     private SharedCacheMode sharedCacheMode;
 
-    /** The validation mode to be used for the persistence unit */
+    /**
+     * The validation mode to be used for the persistence unit
+     */
     private ValidationMode validationMode;
 
-    /** just to be able to dump this PU at runtime */
+    /**
+     * just to be able to dump this PU at runtime
+     */
     private String jtaDataSourceName;
-    /** just to be able to dump this PU at runtime */
+    /**
+     * just to be able to dump this PU at runtime
+     */
     private String nonJtaDataSourceName;
 
-    /** does it need to be created lazily (not in constructor) */
+    /**
+     * does it need to be created lazily (not in constructor)
+     */
     private boolean lazilyInitialized;
 
     public PersistenceUnitInfoImpl() {
@@ -229,7 +241,7 @@ public class PersistenceUnitInfoImpl imp
 
     public void setRootUrlAndJarUrls(final String persistenceUnitRootUrl, final List<String> jarFiles) throws MalformedURLException {
         File root;
-        try{
+        try {
             final URI rootUri = URLs.uri(persistenceUnitRootUrl);
             root = new File(rootUri);
         } catch (final IllegalArgumentException e) {
@@ -347,6 +359,7 @@ public class PersistenceUnitInfoImpl imp
 
     // not the shouldSkip() method from UrlClassLoaderFirst since we skip more here
     // we just need JPA stuff so all the tricks we have for the server part are useless
+    @SuppressWarnings("RedundantIfStatement")
     public static boolean isServerClass(final String name) {
         if (name == null) {
             return false;
@@ -555,7 +568,7 @@ public class PersistenceUnitInfoImpl imp
      * @see javax.persistence.spi.PersistenceUnitInfo#getSharedCacheMode()
      */
     public SharedCacheMode getSharedCacheMode() {
-        return this.sharedCacheMode;
+        return null != this.sharedCacheMode ? this.sharedCacheMode : SharedCacheMode.UNSPECIFIED;
     }
 
     /**