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

Valery Kharseko
15 hours ago 655132fb059cfa70fb338d54f1bb0fb48198fb0f
opendj-server-legacy/src/main/java/org/opends/server/backends/pdb/PDBStorage.java
@@ -468,6 +468,12 @@
    }
    @Override
    public boolean treeExists(TreeName treeName)
    {
      return PDBStorage.this.treeExists(treeName);
    }
    @Override
    public Cursor<ByteString, ByteString> openCursor(final TreeName treeName)
    {
      try
@@ -691,6 +697,12 @@
    }
    @Override
    public boolean treeExists(TreeName treeName)
    {
      return delegate.treeExists(treeName);
    }
    @Override
    public void openTree(TreeName treeName, boolean createOnDemand)
    {
      if (createOnDemand)
@@ -820,6 +832,13 @@
    }
    @Override
    public boolean treeExists(TreeName treeName)
    {
      // No volume was ever opened, so nothing is stored.
      return false;
    }
    @Override
    public <T> T read(ReadOperation<T> operation) throws Exception
    {
      return operation.run(this);
@@ -832,6 +851,27 @@
    }
  }
  /**
   * Tells whether the volume holds a tree of that name. Deliberately not implemented by asking for
   * an {@link Exchange}: {@code getExchange(volume, name, true)} would create the tree being tested,
   * and with {@code false} Persistit reports its absence by throwing.
   */
  boolean treeExists(final TreeName treeName)
  {
    if (volume == null)
    {
      return false;
    }
    try
    {
      return volume.getTree(treeName.toString(), false) != null;
    }
    catch (PersistitException e)
    {
      throw new StorageRuntimeException(e);
    }
  }
  Exchange getNewExchange(final TreeName treeName, final boolean create) throws PersistitException
  {
    final Exchange ex = db.getExchange(volume, treeName.toString(), create);