From 1345ac0dfae9a555abb7b74ed48452d9bc92b8c3 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 22 Jul 2014 13:44:30 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1206 : Create a new ReplicationBackend/ChangelogBackend to support cn=changelog
---
opends/src/server/org/opends/server/backends/jeb/BackendImpl.java | 112 +++++++++++++++++++++-----------------------------------
1 files changed, 42 insertions(+), 70 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
index d830d56..fb2f8a9 100644
--- a/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -39,7 +39,6 @@
import java.util.zip.CheckedInputStream;
import org.opends.messages.Message;
-import org.opends.server.admin.Configuration;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.meta.LocalDBIndexCfgDefn;
import org.opends.server.admin.std.server.LocalDBBackendCfg;
@@ -74,8 +73,7 @@
* This is an implementation of a Directory Server Backend which stores entries
* locally in a Berkeley DB JE database.
*/
-public class BackendImpl
- extends Backend
+public class BackendImpl extends Backend<LocalDBBackendCfg>
implements ConfigurationChangeListener<LocalDBBackendCfg>, AlertGenerator,
DiskSpaceMonitorHandler
{
@@ -123,23 +121,12 @@
/**
* The controls supported by this backend.
*/
- private static HashSet<String> supportedControls;
-
- static
- {
- // Set our supported controls.
- supportedControls = new HashSet<String>();
- supportedControls.add(OID_SUBTREE_DELETE_CONTROL);
- supportedControls.add(OID_PAGED_RESULTS_CONTROL);
- supportedControls.add(OID_MANAGE_DSAIT_CONTROL);
- supportedControls.add(OID_SERVER_SIDE_SORT_REQUEST_CONTROL);
- supportedControls.add(OID_VLV_REQUEST_CONTROL);
- }
-
- /**
- * The features supported by this backend.
- */
- private static HashSet<String> supportedFeatures = new HashSet<String>();
+ private static final Set<String> supportedControls = new HashSet<String>(Arrays.asList(
+ OID_SUBTREE_DELETE_CONTROL,
+ OID_PAGED_RESULTS_CONTROL,
+ OID_MANAGE_DSAIT_CONTROL,
+ OID_SERVER_SIDE_SORT_REQUEST_CONTROL,
+ OID_VLV_REQUEST_CONTROL));
/**
* Begin a Backend API method that reads the database.
@@ -247,16 +234,7 @@
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
} finally {
- if (fis != null) {
- try {
- fis.close();
- } catch (Exception e) {
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
- }
- }
- }
+ close(fis);
}
}
@@ -265,21 +243,16 @@
/** {@inheritDoc} */
@Override
- public void configureBackend(Configuration cfg)
- throws ConfigException
+ public void configureBackend(LocalDBBackendCfg cfg) throws ConfigException
{
Validator.ensureNotNull(cfg);
- Validator.ensureTrue(cfg instanceof LocalDBBackendCfg);
- this.cfg = (LocalDBBackendCfg)cfg;
-
- Set<DN> dnSet = this.cfg.getBaseDN();
- baseDNs = new DN[dnSet.size()];
- dnSet.toArray(baseDNs);
+ this.cfg = cfg;
+ baseDNs = this.cfg.getBaseDN().toArray(new DN[0]);
}
/** {@inheritDoc} */
- @Override()
+ @Override
public void initializeBackend()
throws ConfigException, InitializationException
{
@@ -356,7 +329,7 @@
}
/** {@inheritDoc} */
- @Override()
+ @Override
public void finalizeBackend()
{
// Deregister as a change listener.
@@ -419,7 +392,7 @@
}
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean isLocal()
{
return true;
@@ -428,7 +401,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean isIndexed(AttributeType attributeType, IndexType indexType)
{
try
@@ -479,28 +452,28 @@
}
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean supportsLDIFExport()
{
return true;
}
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean supportsLDIFImport()
{
return true;
}
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean supportsBackup()
{
return true;
}
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean supportsBackup(BackupConfig backupConfig,
StringBuilder unsupportedReason)
{
@@ -508,35 +481,35 @@
}
/** {@inheritDoc} */
- @Override()
+ @Override
public boolean supportsRestore()
{
return true;
}
/** {@inheritDoc} */
- @Override()
- public HashSet<String> getSupportedFeatures()
+ @Override
+ public Set<String> getSupportedFeatures()
{
- return supportedFeatures;
+ return Collections.emptySet();
}
/** {@inheritDoc} */
- @Override()
- public HashSet<String> getSupportedControls()
+ @Override
+ public Set<String> getSupportedControls()
{
return supportedControls;
}
/** {@inheritDoc} */
- @Override()
+ @Override
public DN[] getBaseDNs()
{
return baseDNs;
}
/** {@inheritDoc} */
- @Override()
+ @Override
public long getEntryCount()
{
if (rootContainer != null)
@@ -560,7 +533,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public ConditionResult hasSubordinates(DN entryDN)
throws DirectoryException
{
@@ -582,7 +555,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public long numSubordinates(DN entryDN, boolean subtree)
throws DirectoryException
{
@@ -633,7 +606,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public Entry getEntry(DN entryDN) throws DirectoryException
{
readerBegin();
@@ -676,7 +649,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void addEntry(Entry entry, AddOperation addOperation)
throws DirectoryException, CanceledOperationException
{
@@ -719,7 +692,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void deleteEntry(DN entryDN, DeleteOperation deleteOperation)
throws DirectoryException, CanceledOperationException
{
@@ -761,7 +734,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void replaceEntry(Entry oldEntry, Entry newEntry,
ModifyOperation modifyOperation) throws DirectoryException,
CanceledOperationException
@@ -806,7 +779,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void renameEntry(DN currentDN, Entry entry,
ModifyDNOperation modifyDNOperation)
throws DirectoryException, CanceledOperationException
@@ -859,7 +832,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void search(SearchOperation searchOperation)
throws DirectoryException, CanceledOperationException
{
@@ -900,7 +873,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void exportLDIF(LDIFExportConfig exportConfig)
throws DirectoryException
{
@@ -957,7 +930,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public LDIFImportResult importLDIF(LDIFImportConfig importConfig)
throws DirectoryException
{
@@ -1285,7 +1258,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void createBackup(BackupConfig backupConfig)
throws DirectoryException
{
@@ -1299,7 +1272,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void removeBackup(BackupDirectory backupDirectory, String backupID)
throws DirectoryException
{
@@ -1311,7 +1284,7 @@
/** {@inheritDoc} */
- @Override()
+ @Override
public void restoreBackup(RestoreConfig restoreConfig)
throws DirectoryException
{
@@ -1325,11 +1298,10 @@
/** {@inheritDoc} */
- @Override()
- public boolean isConfigurationAcceptable(Configuration configuration,
+ @Override
+ public boolean isConfigurationAcceptable(LocalDBBackendCfg config,
List<Message> unacceptableReasons)
{
- LocalDBBackendCfg config = (LocalDBBackendCfg) configuration;
return isConfigurationChangeAcceptable(config, unacceptableReasons);
}
--
Gitblit v1.10.0