Examples of StreamPersistedValueData


Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

            ValueData tvd =
               (propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));

            // re-init the value
            propertyData.getValues().set(listFixupStream.get(i).getValueDataId(),
                     new StreamPersistedValueData(tvd.getOrderNumber(), listFile.get(i)));
         }

         for (int i = 0; i < listFile.size(); i++)
            fileCleaner.addFile(listFile.get(i));
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

               stream = new ByteArrayInputStream(dataBytes);
               streamLength = dataBytes.length;
            }
            else
            {
               StreamPersistedValueData streamData = (StreamPersistedValueData)vd;

               SwapFile swapFile = SwapFile.get(swapDirectory, cid + i + "." + data.getPersistedVersion());
               try
               {
                  writeValueHelper.writeStreamedValue(swapFile, streamData);
               }
               finally
               {
                  swapFile.spoolDone();
               }

               long vlen = swapFile.length();
               if (vlen <= Integer.MAX_VALUE)
               {
                  streamLength = (int)vlen;
               }
               else
               {
                  throw new RepositoryException("Value data large of allowed by JDBC (Integer.MAX_VALUE) " + vlen
                     + ". Property " + data.getQPath().getAsString());
               }

               stream = streamData.getAsStream();
            }
            storageId = null;
         }
         else
         {
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

         {
            sf = new SerializationSpoolFile(tempDirectory, id, holder);
            // TODO optimize writeToFile - use channels or streams
            writeToFile(in, sf, length);
            holder.put(id, sf);
            return new StreamPersistedValueData(orderNumber, sf);
         }
         else
         {
            sf.acquire(this); // TODO workaround for AsyncReplication test
            try
            {
               AbstractPersistedValueData vd = new StreamPersistedValueData(orderNumber, sf);

               // skip data in input stream
               if (in.skip(length) != length)
                  throw new IOException("Content isn't skipped correctly.");
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

         {
            sf = new SerializationSpoolFile(tempDirectory, id, holder);
            // TODO optimize writeToFile - use channels or streams
            writeToFile(in, sf, length);
            holder.put(id, sf);
            return new StreamPersistedValueData(orderNumber, sf);
         }
         else
         {
            sf.acquire(this); // TODO workaround for AsyncReplication test
            try
            {
               AbstractPersistedValueData vd = new StreamPersistedValueData(orderNumber, sf);

               // skip data in input stream
               if (in.skip(length) != length)
                  throw new IOException("Content isn't skipped correctly.");
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

   {
      // do what you want
      // stream Value
      if (value instanceof StreamPersistedValueData)
      {
         StreamPersistedValueData streamed = (StreamPersistedValueData)value;

         if (streamed.isPersisted())
         {
            // already persisted in another Value, copy it to this Value
            copyClose(streamed.getAsStream(), PrivilegedFileHelper.fileOutputStream(file));
         }
         else
         {
            // the Value not yet persisted, i.e. or in client stream or spooled to a temp file
            File tempFile;
            if ((tempFile = streamed.getTempFile()) != null)
            {
               // it's spooled Value, try move its file to VS
               if (!PrivilegedFileHelper.renameTo(tempFile, file))
               {
                  // not succeeded - copy bytes, temp file will be deleted by transient ValueData
                  if (LOG.isDebugEnabled())
                  {
                     LOG
                        .debug("Value spool file move (rename) to Values Storage is not succeeded. Trying bytes copy. Spool file: "
                           + PrivilegedFileHelper.getAbsolutePath(tempFile)
                           + ". Destination: "
                           + PrivilegedFileHelper.getAbsolutePath(file));
                  }

                  copyClose(PrivilegedFileHelper.fileInputStream(tempFile), PrivilegedFileHelper.fileOutputStream(file));
               }
            }
            else
            {
               // not spooled, use client InputStream
               copyClose(streamed.getStream(), PrivilegedFileHelper.fileOutputStream(file));
            }

            // link this Value to file in VS
            streamed.setPersistedFile(file);
         }
      }
      else
      {
         // copy from Value stream to the file, e.g. from FilePersistedValueData to this Value
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

      {
         InputStream in;
         if (value instanceof StreamPersistedValueData)
         {

            StreamPersistedValueData streamed = (StreamPersistedValueData)value;
            if (streamed.isPersisted())
            {
               // already persisted in another Value, copy it to this Value
               in = streamed.getAsStream();
            }
            else
            {
               in = streamed.getStream();
               if (in == null)
               {
                  in = PrivilegedFileHelper.fileInputStream(streamed.getTempFile());
               }
            }
         }
         else
         {
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

               stream = new ByteArrayInputStream(dataBytes);
               streamLength = dataBytes.length;
            }
            else
            {
               StreamPersistedValueData streamData = (StreamPersistedValueData)vd;

               SwapFile swapFile = SwapFile.get(swapDirectory, cid + i + "." + data.getPersistedVersion());
               try
               {
                  writeValueHelper.writeStreamedValue(swapFile, streamData);
               }
               finally
               {
                  swapFile.spoolDone();
               }

               long vlen = PrivilegedFileHelper.length(swapFile);
               if (vlen <= Integer.MAX_VALUE)
               {
                  streamLength = (int)vlen;
               }
               else
               {
                  throw new RepositoryException("Value data large of allowed by JDBC (Integer.MAX_VALUE) " + vlen
                     + ". Property " + data.getQPath().getAsString());
               }

               stream = streamData.getAsStream();
            }
            storageId = null;
         }
         else
         {
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

            PersistedPropertyData propertyData = (PersistedPropertyData)itemData;
            ValueData vd = (propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));

            // re-init the value
            propertyData.getValues().set(listFixupStream.get(i).getValueDataId(),
               new StreamPersistedValueData(vd.getOrderNumber(), new SpoolFile(listFile.get(i).getAbsolutePath())));
         }

         for (int i = 0; i < listFile.size(); i++)
            fileCleaner.addFile(listFile.get(i));
      }
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

               stream = new ByteArrayInputStream(dataBytes);
               streamLength = dataBytes.length;
            }
            else
            {
               StreamPersistedValueData streamData = (StreamPersistedValueData)vd;

               SwapFile swapFile = SwapFile.get(swapDirectory, cid + i + "." + data.getPersistedVersion());
               try
               {
                  writeValueHelper.writeStreamedValue(swapFile, streamData);
               }
               finally
               {
                  swapFile.spoolDone();
               }

               long vlen = swapFile.length();
               if (vlen <= Integer.MAX_VALUE)
               {
                  streamLength = (int)vlen;
               }
               else
               {
                  throw new RepositoryException("Value data large of allowed by JDBC (Integer.MAX_VALUE) " + vlen
                     + ". Property " + data.getQPath().getAsString());
               }

               stream = streamData.getAsStream();
            }
            storageId = null;
         }
         else
         {
View Full Code Here

Examples of org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData

         PersistedPropertyData propertyData = (PersistedPropertyData)itemData;
         ValueData vd = (propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));

         // re-init the value
         propertyData.getValues().set(listFixupStream.get(i).getValueDataId(),
            new StreamPersistedValueData(vd.getOrderNumber(), new SpoolFile(listFile.get(i).getAbsolutePath())));
      }

      if (listRandomAccessFile != null)
         for (int i = 0; i < listRandomAccessFile.size(); i++)
            listRandomAccessFile.get(i).close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.