Author: mikedd
Date: Fri Jan 22 15:20:03 2010
New Revision: 902113

URL: http://svn.apache.org/viewvc?rev=902113&view=rev
Log:
OPENJPA-1150:  
Removing incomplete WriteBehind implementation.

Removed:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/writebehind/
    
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/writebehind/
Modified:
    
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
    
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
    
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java

Modified: 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java?rev=902113&r1=902112&r2=902113&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
 (original)
+++ 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfiguration.java
 Fri Jan 22 15:20:03 2010
@@ -55,8 +55,6 @@
 import org.apache.openjpa.util.ClassResolver;
 import org.apache.openjpa.util.ProxyManager;
 import org.apache.openjpa.util.StoreFacadeTypeRegistry;
-import org.apache.openjpa.writebehind.WriteBehindCacheManager;
-import org.apache.openjpa.writebehind.WriteBehindCallback;
 
 /**
  * Defines the properties necessary to configure runtime properties and
@@ -1732,54 +1730,6 @@
     public void setLifecycleEventManager(String eventMgr);
 
     /**
-     * The {...@link WriteBehindCache} configuration string.
-     * @since 2.0.0
-     */
-    public String getWriteBehindCache();
-
-    /**
-     * Set the {...@link WriteBehindCache} configuration string.
-     * @since 2.0.0
-     */
-    public void setWriteBehindCache(String writeBehindCache);
-    
-    /**
-     * Get the {...@link WriteBehindCacheManager} configuration string.
-     * @since 2.0.0
-     */
-    public String getWriteBehindCacheManager();
-
-    /**
-     * Set the {...@link WriteBehindCacheManager} configuration string.
-     * @since 2.0.0
-     */
-    public void setWriteBehindCacheManager(String writeBehindCache);
-    
-    /**
-     * Get the {...@link WriteBehindCacheManager} instance for this 
configuration.
-     * @since 2.0.0
-     */
-    public WriteBehindCacheManager getWriteBehindCacheManagerInstance();
-    
-    /**
-     * Get the {...@link WriteBehindCallback} configuration string.
-     * @since 2.0.0
-     */
-    public String getWriteBehindCallback();
-    
-    /**
-     * Get the {...@link WriteBehindCallback} instance for this configuration.
-     * @since 2.0.0 
-     */
-    public WriteBehindCallback getWriteBehindCallbackInstance();
-    
-    /**
-     * Set the {...@link WriteBehindCallback} configuration string.
-     * @since 2.0.0
-     */
-    public void setWriteBehindCallback(String wbcallback);
-
-    /**
      * Gets the validation groups for pre-persist
      * 
      * @Since 2.0.0

Modified: 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java?rev=902113&r1=902112&r2=902113&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
 (original)
+++ 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/OpenJPAConfigurationImpl.java
 Fri Jan 22 15:20:03 2010
@@ -70,11 +70,6 @@
 import org.apache.openjpa.util.ProxyManager;
 import org.apache.openjpa.util.StoreFacadeTypeRegistry;
 import org.apache.openjpa.validation.ValidatingLifecycleEventManager;
-import org.apache.openjpa.writebehind.SimpleWriteBehindCache;
-import org.apache.openjpa.writebehind.SimpleWriteBehindCallback;
-import org.apache.openjpa.writebehind.WriteBehindCacheManager;
-import org.apache.openjpa.writebehind.WriteBehindCacheManagerImpl;
-import org.apache.openjpa.writebehind.WriteBehindCallback;
 
 /**
  * Implementation of the {...@link OpenJPAConfiguration} interface.
@@ -584,32 +579,6 @@
         supportedOptions.add(OPTION_VALUE_INCREMENT);
         supportedOptions.add(OPTION_DATASTORE_CONNECTION);
         
-        writeBehindCacheManagerPlugin = addPlugin("WriteBehindCacheManager", 
true);
-        aliases = new String[] { "default", 
WriteBehindCacheManagerImpl.class.getName() };
-        writeBehindCacheManagerPlugin.setAliases(aliases);
-        writeBehindCacheManagerPlugin.setDefault(aliases[0]);
-        writeBehindCacheManagerPlugin.setString(aliases[0]);
-        
writeBehindCacheManagerPlugin.setInstantiatingGetter("getWriteBehindCacheManager");
-
-        writeBehindCachePlugin = addPlugin("WriteBehindCache", false);
-        aliases = new String[] { 
-            "false",  null, 
-            "true",   SimpleWriteBehindCache.class.getName(), 
-            "simple", SimpleWriteBehindCache.class.getName() };
-        writeBehindCachePlugin.setAliases(aliases);
-        writeBehindCachePlugin.setDefault(aliases[0]);
-        writeBehindCachePlugin.setString(aliases[0]);
-        
-        writeBehindCallbackPlugin = addPlugin("WriteBehindCallback", true); 
-        aliases = new String[] { 
-            "false",  null, 
-            "true",   SimpleWriteBehindCallback.class.getName(), 
-            "simple", SimpleWriteBehindCallback.class.getName() };
-        writeBehindCallbackPlugin.setAliases(aliases);
-        writeBehindCallbackPlugin.setDefault(aliases[0]);
-        writeBehindCallbackPlugin.setString(aliases[0]);
-        
-
         if (derivations)
             ProductDerivations.beforeConfigurationLoad(this);
         if (loadGlobals)
@@ -1709,50 +1678,6 @@
         dynamicEnhancementAgent.set(dynamic);
     }    
 
-    public String getWriteBehindCache() {
-        return writeBehindCachePlugin.getString();
-    }
-
-    public void setWriteBehindCache(String writeBehindCache) {
-        writeBehindCachePlugin.setString(writeBehindCache);
-    }
-    
-    public String getWriteBehindCacheManager() {
-        return writeBehindCacheManagerPlugin.getString();
-    }
-
-    public void setWriteBehindCacheManager(String writeBehindCacheManager) {
-        writeBehindCacheManagerPlugin.setString(writeBehindCacheManager);
-    }
-
-    public WriteBehindCacheManager getWriteBehindCacheManagerInstance() {
-        WriteBehindCacheManager wbcm =
-            (WriteBehindCacheManager) writeBehindCacheManagerPlugin.get();
-        if (wbcm == null) {
-            wbcm =
-                (WriteBehindCacheManager) writeBehindCacheManagerPlugin
-                    .instantiate(WriteBehindCacheManager.class, this);
-            wbcm.initialize(this, writeBehindCachePlugin); 
-        }
-        return wbcm;
-    }
-    
-    public String getWriteBehindCallback() { 
-        return writeBehindCallbackPlugin.getString();
-        
-    }
-    public WriteBehindCallback getWriteBehindCallbackInstance() {
-        WriteBehindCallback callback = (WriteBehindCallback) 
writeBehindCallbackPlugin.get();
-        if (callback == null) {
-            callback = (WriteBehindCallback) 
writeBehindCallbackPlugin.instantiate(WriteBehindCallback.class, this);
-        }
-        return callback;
-    }
-    
-    public void setWriteBehindCallback(String writeBehindCallback) {
-        writeBehindCallbackPlugin.setString(writeBehindCallback);
-    }
-    
     public void setEncryptionProvider(String p) {
         encryptionProvider.setString(p);
     }

Modified: 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java?rev=902113&r1=902112&r2=902113&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
 (original)
+++ 
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
 Fri Jan 22 15:20:03 2010
@@ -63,10 +63,6 @@
 import org.apache.openjpa.util.MetaDataException;
 import org.apache.openjpa.util.OpenJPAException;
 import org.apache.openjpa.util.UserException;
-import org.apache.openjpa.writebehind.WriteBehindCache;
-import org.apache.openjpa.writebehind.WriteBehindCallback;
-import org.apache.openjpa.writebehind.WriteBehindConfigurationException;
-import org.apache.openjpa.writebehind.WriteBehindStoreManager;
 
 /**
  * Abstract implementation of the {...@link BrokerFactory}
@@ -117,8 +113,6 @@
     // and later identified
     private Object _poolKey;   
     
-    private WriteBehindCallback _writeBehindCallback; 
-
     /**
      * Return an internal factory pool key for the given configuration.
      *
@@ -163,8 +157,6 @@
                _conf.isConnectionFactoryModeManaged(),
                 _conf.getConnectionRetainModeConstant(), false).close(); 
         }
-
-        initWriteBehindCallback();        
     }
 
     /**
@@ -189,13 +181,8 @@
     public Broker newBroker(String user, String pass, boolean managed, int 
connRetainMode) {
         return newBroker(user, pass, managed, connRetainMode, true);
     }
-
-    public Broker newBroker(String user, String pass, boolean managed, int 
connRetainMode, boolean findExisting) {
-        return newBroker(user, pass, managed, connRetainMode, findExisting, 
false);
-    }
     
-    public Broker newBroker(String user, String pass, boolean managed, int 
connRetainMode, boolean findExisting,
-        boolean writeBehindCallback) {
+    public Broker newBroker(String user, String pass, boolean managed, int 
connRetainMode, boolean findExisting) {
         try {
             assertOpen();
             makeReadOnly();
@@ -205,7 +192,7 @@
                 broker = findBroker(user, pass, managed);
             if (broker == null) {
                 broker = newBrokerImpl(user, pass);
-                initializeBroker(managed, connRetainMode, broker, false, 
writeBehindCallback);
+                initializeBroker(managed, connRetainMode, broker, false);
             }
             return broker;
         } catch (OpenJPAException ke) {
@@ -216,18 +203,12 @@
     }
 
     void initializeBroker(boolean managed, int connRetainMode, Broker broker, 
boolean fromDeserialization) {
-        initializeBroker(managed, connRetainMode, broker, fromDeserialization, 
false);
-    }    
-    
-    void initializeBroker(boolean managed, int connRetainMode, Broker broker, 
boolean fromDeserialization,
-        boolean fromWriteBehindCallback) {
         assertOpen();
         makeReadOnly();
         
         DelegatingStoreManager dsm = createDelegatingStoreManager();
 
-        ((BrokerImpl) broker).initialize(this, dsm, managed, connRetainMode, 
fromDeserialization,
-            fromWriteBehindCallback);
+        ((BrokerImpl) broker).initialize(this, dsm, managed, connRetainMode, 
fromDeserialization);
         if (!fromDeserialization)
             addListeners(broker);
 
@@ -377,10 +358,6 @@
     public void close() {
         lock();
 
-        if(_writeBehindCallback != null) {
-            _writeBehindCallback.close();
-        }
-        
         try {
             assertOpen();
             assertNoActiveTransaction();
@@ -828,11 +805,7 @@
     /**
      * <P>
      * Create a DelegatingStoreManager for use with a Broker created by this 
factory.
-     * </P>
-     * <P>
-     * If a DataCache has been enabled a DataCacheStoreManager will be 
returned. If a WriteBehind cache is also enabled 
-     * the DataCacheStoreManager will  delegate to a WriteBehindStoreManager. 
If no WriteBehindCache is in use the 
-     * DataCache will delegate to a StoreManager returned by 
newStoreManager(). 
+     * If a DataCache has been enabled a DataCacheStoreManager will be 
returned.
      * </P>
      * <P>
      * If no DataCache is in use an ROPStoreManager will be returned. 
@@ -849,54 +822,11 @@
         StoreManager sm = newStoreManager();
         DelegatingStoreManager dsm = null;
         if (_conf.getDataCacheManagerInstance().getSystemDataCache() != null) {
-            WriteBehindCache wbCache = 
_conf.getWriteBehindCacheManagerInstance().getSystemWriteBehindCache();
-            if (wbCache != null) {
-                dsm = new DataCacheStoreManager(new 
WriteBehindStoreManager(sm, wbCache));
-            } else {
-                dsm = new DataCacheStoreManager(sm);
-            }
+            dsm = new DataCacheStoreManager(sm);
         }
         dsm = new ROPStoreManager((dsm == null) ? sm : dsm);
         
         return dsm;
     }
-    
-    protected void initWriteBehindCallback() { 
-        WriteBehindCache cache = 
_conf.getWriteBehindCacheManagerInstance().getSystemWriteBehindCache();
-        if (cache != null) {
-            // Verify we are not missing one or more of the following required
-            // WriteBehind configuration parameters:
-            //   - openjpa.DataCache
-            //   - openjpa.WriteBehindCallback
-            if (_conf.getDataCacheManagerInstance().getSystemDataCache() == 
null) {
-                throw new WriteBehindConfigurationException(
-                    _loc.get("writebehind-cfg-err",
-                    "openjpa.DataCache").getMessage());
-            }
-            if (_conf.getWriteBehindCallbackInstance() == null ) {
-                throw new WriteBehindConfigurationException(
-                    _loc.get("writebehind-cfg-err",
-                    "openjpa.WriteBehindCallback").getMessage());
-            }
-    
-            Broker broker =
-                newBroker(_conf.getConnectionUserName(), 
-                          _conf.getConnectionPassword(), 
-                          false, // WriteBehind broker is always unmanaged.
-                          _conf.getConnectionRetainModeConstant(),
-                          false, true);
-
-            // The Broker used by the WriteBehind cache should not be tracked
-            // by the factory - we'll manually clean up when the factory is
-            // closed.
-            _transactional.remove(broker);
-            _brokers.remove(broker);
-            
-            _writeBehindCallback = _conf.getWriteBehindCallbackInstance();
-            _writeBehindCallback.initialize(broker, cache);
-
-            new Thread(_writeBehindCallback).start();
-        }
-    }
 }
 


Reply via email to