Package org.nasutekds.server.backends.ndb.OperationContainer

Examples of org.nasutekds.server.backends.ndb.OperationContainer.DN2IDSearchCursor


      }

      if (isSubtreeDelete) {
        AbstractTransaction cursorTxn =
          new AbstractTransaction(rootContainer);
        DN2IDSearchCursor cursor = dn2id.getSearchCursor(cursorTxn, entryDN);
        cursor.open();
        try {
          SearchCursorResult result = cursor.getNext();
          while (result != null) {
            // We have found a subordinate entry.
            // Enforce any subtree delete size limit.
            if (adminSizeLimit > 0 && countDeletedDN >= adminSizeLimit) {
              adminSizeLimitExceeded = true;
              break;
            }

            // Enforce any subtree delete batch size.
            if (deleteBatchSize > 0 &&
              deletedDNList.size() >= deleteBatchSize) {
              batchSizeExceeded = true;
              break;
            }

            /*
             * Delete this entry which by now must be a leaf because
             * we have been deleting from the bottom of the tree upwards.
             */
            long entryID = result.id;
            DN subordinateDN = DN.decode(result.dn);

            AbstractTransaction subTxn = new AbstractTransaction(rootContainer);
            try {
              deleteLeaf(subTxn, subordinateDN, entryID, deleteOperation);
            } finally {
              if (subTxn != null) {
                subTxn.commit();
              }
            }

            deletedDNList.add(subordinateDN);
            countDeletedDN++;

            if (deleteOperation != null) {
              deleteOperation.checkIfCanceled(false);
            }

            result = cursor.getNext();
          }
        } finally {
          cursor.close();
          cursorTxn.close();
        }
      }

      // Finally delete the target entry as it was not included
View Full Code Here


        renameApexEntry(txn, newID, oldApexEntry, newApexEntry);
      }

      AbstractTransaction cursorTxn =
          new AbstractTransaction(rootContainer);
      DN2IDSearchCursor cursor = dn2id.getSearchCursor(cursorTxn, oldApexDN);
      cursor.open();

      try {
        SearchCursorResult result = null;
        // Step forward until we pass the ending value.
        while ((result = cursor.getNext()) != null) {
          // We have found a subordinate entry.
          long oldID = result.id;
          String oldDN = result.dn;
          Entry oldEntry = null;
          AbstractTransaction subTxn = new AbstractTransaction(rootContainer);
          try {
            oldEntry = dn2id.get(subTxn, DN.decode(oldDN),
              NdbOperation.LockMode.LM_Exclusive);
            if (oldEntry != null) {
              if (!isManageDsaITOperation(modifyDNOperation)) {
                checkTargetForReferral(oldEntry, null);
              }

              // Construct the new DN of the entry.
              DN newDN = modDN(oldEntry.getDN(),
                oldApexDN.getNumComponents(),
                newApexEntry.getDN());

              if (requestedNewSuperiorDN != null) {
                // Assign a new entry ID if we are renumbering.
                long newID = oldID;
                if (newApexID != oldApexID) {
                  newID = rootContainer.getNextEntryID(subTxn.getNdb());
                }
                // Move this entry.
                moveSubordinateEntry(subTxn, newID, oldEntry, newDN);
              } else {
                // Rename this entry.
                renameSubordinateEntry(subTxn, oldID, oldEntry, newDN);
              }
            }
          } finally {
            if (subTxn != null) {
              subTxn.commit();
            }
          }

          if (modifyDNOperation != null) {
            modifyDNOperation.checkIfCanceled(false);
          }
        }
      } finally {
        cursor.close();
        cursorTxn.close();
      }
    }
View Full Code Here

    RootContainer rc = entryContainer.getRootContainer();
    DN baseDN = DN.NULL_DN;

    AbstractTransaction txn = new AbstractTransaction(rc);

    DN2IDSearchCursor cursor = dn2id.getSearchCursor(txn, baseDN);
    cursor.open();

    try {
      SearchCursorResult result = cursor.getNext();
      while (result != null) {
        if (exportConfig.isCancelled()) {
          break;
        }
        DN dn = null;
        try {
          dn = DN.decode(result.dn);
        } catch (DirectoryException ex) {
          if (debugEnabled()) {
            TRACER.debugCaught(DebugLogLevel.ERROR, ex);
          }
          skippedCount++;
          continue;
        }
        Entry entry = null;
        AbstractTransaction leafTxn = new AbstractTransaction(rc);
        try {
          entry = dn2id.get(leafTxn, dn,
            NdbOperation.LockMode.LM_CommittedRead);
        } finally {
          if (leafTxn != null) {
            leafTxn.close();
          }
        }
        if ((entry != null) && entry.toLDIF(exportConfig)) {
          exportedCount++;
        } else {
          skippedCount++;
        }
        // Move to the next record.
        result = cursor.getNext();
      }
    } finally {
      cursor.close();
      if (txn != null) {
        txn.close();
      }
    }
  }
View Full Code Here

        IndexFilter indexFilter = new IndexFilter(txn, this, searchOperation);
        if (indexFilter.evaluate()) {
          searchIndexed(searchOperation, indexFilter);
          completed = true;
        } else {
          DN2IDSearchCursor cursor = dn2id.getSearchCursor(txn, baseDN);
          searchNotIndexed(searchOperation, cursor);
          completed = true;
        }
      } catch (NdbApiTemporaryException databaseException) {
        if (txnRetries < BackendImpl.TXN_RETRY_LIMIT) {
View Full Code Here

TOP

Related Classes of org.nasutekds.server.backends.ndb.OperationContainer.DN2IDSearchCursor

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.