コード例 #1
0
ファイル: ID2Entry.java プロジェクト: jiaoyk/OpenDJ
 /**
  * Check that a record entry exists in the entry tree.
  *
  * @param txn a non null transaction
  * @param entryID The entry ID which forms the key.
  * @return True if an entry with entryID exists
  * @throws StorageRuntimeException If an error occurs in the storage.
  */
 public boolean containsEntryID(ReadableTransaction txn, EntryID entryID) {
   checkNotNull(txn, "txn must not be null");
   checkNotNull(entryID, "entryID must not be null");
   try (final Cursor<ByteString, ByteString> cursor = txn.openCursor(getName())) {
     return cursor.positionToKey(entryID.toByteString());
   }
 }
コード例 #2
0
ファイル: ID2Entry.java プロジェクト: jiaoyk/OpenDJ
 /**
  * Fetch a record from the entry tree.
  *
  * @param txn a non null transaction
  * @param entryID The desired entry ID which forms the key.
  * @return The requested entry, or null if there is no such record.
  * @throws DirectoryException If a problem occurs while getting the entry.
  * @throws StorageRuntimeException If an error occurs in the storage.
  */
 public Entry get(ReadableTransaction txn, EntryID entryID)
     throws DirectoryException, StorageRuntimeException {
   try {
     return get0(txn.read(getName(), entryID.toByteString()));
   } catch (Exception e) {
     throw new DirectoryException(
         DirectoryServer.getServerErrorResultCode(), ERR_ENTRY_DATABASE_CORRUPT.get(entryID));
   }
 }
コード例 #3
0
ファイル: ID2Entry.java プロジェクト: jiaoyk/OpenDJ
 @Override
 public ByteString generateKey(String data) {
   EntryID entryID = new EntryID(Long.parseLong(data));
   return entryID.toByteString();
 }
コード例 #4
0
ファイル: ID2Entry.java プロジェクト: jiaoyk/OpenDJ
 /**
  * Remove a record from the entry tree.
  *
  * @param txn a non null transaction
  * @param entryID The entry ID which forms the key.
  * @return true if the entry was removed, false if it was not.
  * @throws StorageRuntimeException If an error occurs in the storage.
  */
 boolean remove(WriteableTransaction txn, EntryID entryID) throws StorageRuntimeException {
   return txn.delete(getName(), entryID.toByteString());
 }
コード例 #5
0
ファイル: ID2Entry.java プロジェクト: jiaoyk/OpenDJ
 public void put(WriteableTransaction txn, EntryID entryID, ByteSequence encodedEntry)
     throws StorageRuntimeException, DirectoryException {
   Reject.ifNull(txn, "txn must not be null.");
   txn.put(getName(), entryID.toByteString(), encodedEntry);
 }