Package org.exoplatform.services.jcr.impl.dataflow.persistent

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


         out.write(data);
      }
      else
      {
         // write file content
         FilePersistedValueData streamed = (FilePersistedValueData)vd;

         InputStream in = null;

         if (streamed.getFile() == null && vd instanceof StreamPersistedValueData)
         {
            if (((StreamPersistedValueData)vd).getTempFile() != null)
            {
               in = PrivilegedFileHelper.fileInputStream(((StreamPersistedValueData)vd).getTempFile());
            }
         }
         else
         {
            in = streamed.getAsStream();
         }

         if (streamed.getFile() instanceof SerializationSpoolFile)
         {
            SerializationSpoolFile ssf = (SerializationSpoolFile)streamed.getFile();
            out.writeString(ssf.getId());
            out.writeLong(0);
         }
         else
         {
View Full Code Here


                        return false;
                     }
                  }
                  else if (another instanceof FilePersistedValueData)
                  {
                     FilePersistedValueData persisted = (FilePersistedValueData)another;

                     // if other persistent - check file
                     dataFile = persisted.getFile();
                  }
                  else
                  {
                     return false;
                  }
View Full Code Here

      long fileSize = file.length();

      if (fileSize > maxBufferSize)
      {
         return new FilePersistedValueData(orderNum, file);
      }
      else
      {
         FileInputStream is = new FileInputStream(file);
         try
View Full Code Here

      long fileSize = file.length();

      if (fileSize > maxBufferSize)
      {
         return new FilePersistedValueData(orderNum, file);
      }
      else
      {
         FileInputStream is = new FileInputStream(file);
         try
View Full Code Here

                        return false;
                     }
                  }
                  else if (another instanceof FilePersistedValueData)
                  {
                     FilePersistedValueData persisted = (FilePersistedValueData)another;

                     // if other persistent - check file
                     dataFile = persisted.getFile();
                  }
                  else
                  {
                     return false;
                  }
View Full Code Here

         out.write(data);
      }
      else
      {
         // write file content
         FilePersistedValueData streamed = (FilePersistedValueData)vd;

         InputStream in = null;
        
         if (streamed.getFile() == null && vd instanceof StreamPersistedValueData)
         {
            in = new FileInputStream(((StreamPersistedValueData)vd).getTempFile());
         }
         else
         {
           in = streamed.getAsStream();
         }

         // TODO optimize it, use channels
         if (streamed.getFile() instanceof SerializationSpoolFile)
         {
            SerializationSpoolFile ssf = (SerializationSpoolFile)streamed.getFile();
            out.writeString(ssf.getId());
            out.writeLong(0);
         }
         else
         {
View Full Code Here

         out.write(data);
      }
      else
      {
         // write file content
         FilePersistedValueData streamed = (FilePersistedValueData)vd;

         InputStream in = null;

         if (streamed.getFile() == null && vd instanceof StreamPersistedValueData)
         {
            in = PrivilegedFileHelper.fileInputStream(((StreamPersistedValueData)vd).getTempFile());
         }
         else
         {
            in = streamed.getAsStream();
         }

         // TODO optimize it, use channels
         if (streamed.getFile() instanceof SerializationSpoolFile)
         {
            SerializationSpoolFile ssf = (SerializationSpoolFile)streamed.getFile();
            out.writeString(ssf.getId());
            out.writeLong(0);
         }
         else
         {
View Full Code Here

                        return false;
                     }
                  }
                  else if (another instanceof FilePersistedValueData)
                  {
                     FilePersistedValueData persisted = (FilePersistedValueData)another;

                     // if other persistent - check file
                     dataFile = persisted.getFile();
                  }
                  else
                  {
                     return false;
                  }
View Full Code Here

   {
      long fileSize = PrivilegedFileHelper.length(file);

      if (fileSize > maxBufferSize)
      {
         return new FilePersistedValueData(orderNum, file);
      }
      else
      {
         FileInputStream is = PrivilegedFileHelper.fileInputStream(file);
         try
View Full Code Here

         file.delete();
      FileOutputStream out = new FileOutputStream(file);
      out.write(buf);
      out.close();

      FilePersistedValueData vd = new FilePersistedValueData(0, file);
      assertFalse(vd.isByteArray());
      assertEquals(10, vd.getLength());
      assertEquals(0, vd.getOrderNumber());
      try
      {
         vd.getAsByteArray();
      }
      catch (IllegalStateException e)
      {
         fail("IllegalStateException should not have been thrown!");
      }
      assertTrue(vd.getAsStream() instanceof FileInputStream);
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.dataflow.persistent.FilePersistedValueData

Copyright © 2018 www.massapicom. 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.