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

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


            {
               String storageDesc = result.getString(DBConstants.COLUMN_VSTORAGE_DESC);
               String propertyId = result.getString(DBConstants.COLUMN_VPROPERTY_ID);
               int orderNum = result.getInt(DBConstants.COLUMN_VORDERNUM);

               ValueIOChannel channel = containerConfig.valueStorageProvider.getChannel(storageDesc);

               dataSize += channel.getValueSize(getIdentifier(propertyId), orderNum);
            }
         }
         finally
         {
            JDBCUtils.freeResources(result, null, null);
View Full Code Here


         }

         // delete all values in value storage
         for (String storageId : storages)
         {
            final ValueIOChannel channel = this.containerConfig.valueStorageProvider.getChannel(storageId);
            try
            {
               sizeHandler.accumulatePrevSize(channel.getValueSize(pdata.getIdentifier()));

               channel.delete(pdata.getIdentifier());
               valueChanges.add(channel);
            }
            finally
            {
               channel.close();
            }
         }

         // delete all Values in database
         deleteValueData(cid);
View Full Code Here

    *           if no such storage found with Value storageId
    */
   protected ValueDataWrapper readValueData(String identifier, int orderNumber, int type, String storageId)
      throws SQLException, IOException, ValueStorageNotFoundException
   {
      ValueIOChannel channel = this.containerConfig.valueStorageProvider.getChannel(storageId);
      try
      {
         return channel.read(identifier, orderNumber, type, containerConfig.spoolConfig);
      }
      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 = this.containerConfig.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(this.containerConfig.spoolConfig.tempDirectory,
                     cid + i + "." + data.getPersistedVersion(),this.containerConfig.spoolConfig.fileCleaner);
               try
               {
                  long vlen = WRITE_VALUE_HELPER.writeStreamedValue(swapFile, streamData);
                  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());
                  }
               }
               finally
               {
                  swapFile.spoolDone();
               }

               stream = streamData.getAsStream();
            }
            storageId = null;
            sizeHandler.accumulateNewSize(streamLength);
         }
         else
         {
            // write Value in external VS
            valueChanges.add(channel);
            channel.write(data.getIdentifier(), vd, sizeHandler);
            storageId = channel.getStorageId();
            stream = null;
            streamLength = 0;
         }
         addValueData(cid, i, stream, streamLength, storageId);
      }
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

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.