Package org.exoplatform.services.jcr.storage.value

Examples of org.exoplatform.services.jcr.storage.value.ValueIOChannel


   private void deleteValues(String cid, PropertyData pdata, Set<String> storageDescs, int totalOldValues)
      throws ValueStorageNotFoundException, IOException, SQLException
   {
      for (String storageId : storageDescs)
      {
         final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
         try
         {
            channel.delete(pdata.getIdentifier());
            valueChanges.add(channel);
         }
         finally
         {
            channel.close();
         }
      }
      if (pdata.getValues().size() < totalOldValues)
      {
         // Remove the extra values
View Full Code Here


            do
            {
               String storageDesc = resultSet.getString(DBConstants.COLUMN_VSTORAGE_DESC);

               ValueIOChannel channel = null;
               try
               {
                  channel = getIOChannel(storageDesc);
                  doCheckAndRepairValueData(channel, resultSet, autoRepair);
               }
               catch (IOException e)
               {
                  logExceptionAndSetInconsistency("Unexpected exception during checking.", e);
               }
               catch (SQLException e)
               {
                  logExceptionAndSetInconsistency("Unexpected exception during checking.", e);
               }
               finally
               {
                  if (channel != null)
                  {
                     channel.close();
                  }
               }
            }
            while (resultSet.next());
         }
View Full Code Here

      }
   }

   private ValueIOChannel getIOChannel(String storageDesc) throws IOException
   {
      ValueIOChannel channel = null;
      try
      {
         channel = vsPlugin.getChannel(storageDesc);
      }
      catch (ValueStorageNotFoundException e)
View Full Code Here

            do
            {
               final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
               if (!valueRecords.wasNull())
               {
                  final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
                  try
                  {
                     channel.delete(pdata.getIdentifier());
                     valueChanges.add(channel);
                  }
                  finally
                  {
                     channel.close();
                  }
               }
            }
            while (valueRecords.next());
         }
View Full Code Here

    *           if no such storage found with Value storageId
    */
   protected ValueData readValueData(String identifier, int orderNumber, String storageId) throws SQLException,
      IOException, ValueStorageNotFoundException
   {
      ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
      try
      {
         return channel.read(identifier, orderNumber, maxBufferSize);
      }
      finally
      {
         channel.close();
      }
   }
View Full Code Here

      List<ValueData> vdata = data.getValues();

      for (int i = 0; i < vdata.size(); i++)
      {
         ValueData vd = vdata.get(i);
         ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
         InputStream stream;
         int streamLength;
         String storageId;
         if (channel == null)
         {
            // prepare write of Value in database
            if (vd.isByteArray())
            {
               byte[] dataBytes = vd.getAsByteArray();
               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
         {
            // write Value in external VS
            channel.write(data.getIdentifier(), vd);
            valueChanges.add(channel);
            storageId = channel.getStorageId();
            stream = null;
            streamLength = 0;
         }
         addValueData(cid, i, stream, streamLength, storageId);
      }
View Full Code Here

            do
            {
               final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
               if (!valueRecords.wasNull())
               {
                  final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
                  try
                  {
                     channel.delete(pdata.getIdentifier());
                     valueChanges.add(channel);
                  }
                  finally
                  {
                     channel.close();
                  }
               }
            }
            while (valueRecords.next());
         }
View Full Code Here

    *           if no such storage found with Value storageId
    */
   protected ValueData readValueData(String identifier, int orderNumber, String storageId) throws SQLException,
      IOException, ValueStorageNotFoundException
   {
      ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
      try
      {
         return channel.read(identifier, orderNumber, maxBufferSize);
      }
      finally
      {
         channel.close();
      }
   }
View Full Code Here

      List<ValueData> vdata = data.getValues();

      for (int i = 0; i < vdata.size(); i++)
      {
         ValueData vd = vdata.get(i);
         ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
         InputStream stream;
         int streamLength;
         String storageId;
         if (channel == null)
         {
            // prepare write of Value in database
            if (vd.isByteArray())
            {
               byte[] dataBytes = vd.getAsByteArray();
               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
         {
            // write Value in external VS
            channel.write(data.getIdentifier(), vd);
            valueChanges.add(channel);
            storageId = channel.getStorageId();
            stream = null;
            streamLength = 0;
         }
         addValueData(cid, i, stream, streamLength, storageId);
      }
View Full Code Here

            do
            {
               final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
               if (!valueRecords.wasNull())
               {
                  final ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
                  try
                  {
                     channel.delete(pdata.getIdentifier());
                     valueChanges.add(channel);
                  }
                  finally
                  {
                     channel.close();
                  }
               }
            }
            while (valueRecords.next());
         }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.storage.value.ValueIOChannel

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.