| | |
| | | DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | |
| | | /** |
| | | * The database container. |
| | | * The database entryContainer. |
| | | */ |
| | | private Container container; |
| | | private EntryContainer entryContainer; |
| | | |
| | | /** |
| | | * The JE database configuration. |
| | |
| | | private DatabaseConfig dbConfig; |
| | | |
| | | /** |
| | | * The name of the database within the container. |
| | | * The name of the database within the entryContainer. |
| | | */ |
| | | private String name; |
| | | |
| | |
| | | new ThreadLocal<Database>(); |
| | | |
| | | /** |
| | | * Create a new object representing a referral database in a given container. |
| | | * Create a new object representing a referral database in a given |
| | | * entryContainer. |
| | | * |
| | | * @param container The container of the referral database. |
| | | * @param entryContainer The entryContainer of the referral database. |
| | | * @param dbConfig The JE database configuration which will be used to |
| | | * open the database. |
| | | * @param name The name of the referral database. |
| | | */ |
| | | public DN2URI(Container container, DatabaseConfig dbConfig, String name) |
| | | public DN2URI(EntryContainer entryContainer, DatabaseConfig dbConfig, |
| | | String name) |
| | | { |
| | | this.container = container; |
| | | this.entryContainer = entryContainer; |
| | | this.dbConfig = dbConfig; |
| | | this.name = name; |
| | | } |
| | |
| | | |
| | | /** |
| | | * Get a handle to the database. It returns a per-thread handle to avoid |
| | | * any thread contention on the database handle. The container is |
| | | * any thread contention on the database handle. The entryContainer is |
| | | * responsible for closing all handles. |
| | | * |
| | | * @return A database handle. |
| | |
| | | Database database = threadLocalDatabase.get(); |
| | | if (database == null) |
| | | { |
| | | database = container.openDatabase(dbConfig, name); |
| | | database = entryContainer.openDatabase(dbConfig, name); |
| | | threadLocalDatabase.set(database); |
| | | } |
| | | return database; |
| | |
| | | |
| | | // The JE insert method does not permit duplicate keys so we must use the |
| | | // put method. |
| | | status = Container.put(getDatabase(), txn, key, data); |
| | | status = EntryContainer.put(getDatabase(), txn, key, data); |
| | | if (status != OperationStatus.SUCCESS) |
| | | { |
| | | return false; |
| | |
| | | DatabaseEntry key = new DatabaseEntry(normDN); |
| | | OperationStatus status; |
| | | |
| | | status = Container.delete(getDatabase(), txn, key); |
| | | status = EntryContainer.delete(getDatabase(), txn, key); |
| | | if (status != OperationStatus.SUCCESS) |
| | | { |
| | | return false; |