mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
17.53.2014 7b11744dea26fe1d6d051fd68e7701a8b54f9d84
opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java
@@ -43,6 +43,7 @@
import org.opends.server.backends.pluggable.spi.Storage;
import org.opends.server.backends.pluggable.spi.StorageRuntimeException;
import org.opends.server.backends.pluggable.spi.TreeName;
import org.opends.server.backends.pluggable.spi.UpdateFunction;
import org.opends.server.backends.pluggable.spi.WriteOperation;
import org.opends.server.backends.pluggable.spi.WriteableStorage;
import org.opends.server.types.DN;
@@ -171,6 +172,27 @@
                throw new StorageRuntimeException(e);
            }
        }
        @Override
        public void update(TreeName treeName, ByteSequence key, UpdateFunction f)
        {
          try
          {
            final Exchange ex = getExchange(treeName);
            ex.getKey().clear().append(key.toByteArray());
            ex.fetch();
            final Value value = ex.getValue();
            final ByteSequence oldValue = value.isDefined() ? ByteString.wrap(value
                .getByteArray()) : null;
            final ByteSequence newValue = f.computeNewValue(oldValue);
            ex.getValue().clear().putByteArray(newValue.toByteArray());
            ex.store();
          }
          catch (Exception e)
          {
            throw new StorageRuntimeException(e);
          }
        }
        @Override
        public boolean delete(TreeName treeName, ByteSequence key) {