[exo-jcr-commits] exo-jcr SVN: r1276 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jan 4 08:20:36 EST 2010


Author: tolusha
Date: 2010-01-04 08:20:35 -0500 (Mon, 04 Jan 2010)
New Revision: 1276

Modified:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
Log:
EXOJCR-363: get stream form tempFile if exists

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2010-01-04 12:51:33 UTC (rev 1275)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2010-01-04 13:20:35 UTC (rev 1276)
@@ -49,6 +49,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -1926,13 +1927,22 @@
             else
             {
                // it's StreamPersistedValueData
+               File file;
                StreamPersistedValueData streamData = (StreamPersistedValueData)vd;
-               stream = streamData.getStream();
 
-               // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
-               SwapFile swapFile = swapValueData(cid, i, data.getPersistedVersion(), stream);
+               if ((file = streamData.getTempFile()) != null)
+               {
+                  stream = new FileInputStream(streamData.getTempFile());
+               }
+               else
+               {
+                  stream = streamData.getStream();
 
-               long vlen = swapFile.length();
+                  // TODO spool on JDBC driver read - multiplexing the data to two stores, database and spool file, with one read.
+                  file = swapValueData(cid, i, data.getPersistedVersion(), stream);
+               }
+
+               long vlen = file.length();
                if (vlen < 0)
                {
                   // TODO not actual with SwapFile, but if it will be reworked can be so
@@ -1951,7 +1961,7 @@
                }
 
                // set persistent file to ValueData, will be available for saving Property.
-               streamData.setPersistedFile(swapFile);
+               streamData.setPersistedFile(file);
                stream = streamData.getAsStream();
             }
             storageId = null;



More information about the exo-jcr-commits mailing list