From 6f6499543ef1c584fcdfc241fcb6a4e5be4dcb52 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
---
opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java | 355 +++++++++++++---------------------------------------------
1 files changed, 82 insertions(+), 273 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index 7bb5b20..a0260c1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -22,11 +22,10 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2013 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.extensions;
-import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -47,7 +46,7 @@
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
-import org.opends.server.admin.Configuration;
+import org.opends.server.admin.std.server.ConfigFileHandlerBackendCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.ConfigAddListener;
@@ -86,7 +85,7 @@
* that will read the server configuration from an LDIF file.
*/
public class ConfigFileHandler
- extends ConfigHandler
+ extends ConfigHandler<ConfigFileHandlerBackendCfg>
implements AlertGenerator
{
/**
@@ -102,24 +101,6 @@
private static final String CLASS_NAME =
"org.opends.server.extensions.ConfigFileHandler";
-
-
- /**
- * The set of supported control OIDs for this backend.
- */
- private static final Set<String> SUPPORTED_CONTROLS =
- new HashSet<String>(0);
-
-
-
- /**
- * The set of supported feature OIDs for this backend.
- */
- private static final Set<String> SUPPORTED_FEATURES =
- new HashSet<String>(0);
-
-
-
/**
* The privilege array containing both the CONFIG_READ and CONFIG_WRITE
* privileges.
@@ -187,12 +168,8 @@
super();
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void initializeConfigHandler(String configFile, boolean checkSchema)
throws InitializationException
{
@@ -920,12 +897,8 @@
changesFile.renameTo(newChanges);
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void finalizeConfigHandler()
{
try
@@ -941,79 +914,53 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void finalizeBackend()
{
// No implementation is required.
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public ConfigEntry getConfigRootEntry()
throws ConfigException
{
return configRootEntry;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public ConfigEntry getConfigEntry(DN entryDN)
throws ConfigException
{
return configEntries.get(entryDN);
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public String getServerRoot()
{
return serverRoot;
}
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public String getInstanceRoot()
{
return instanceRoot;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public void configureBackend(Configuration cfg)
+ /** {@inheritDoc} */
+ @Override
+ public void configureBackend(ConfigFileHandlerBackendCfg cfg)
throws ConfigException
{
// No action is required.
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void initializeBackend()
throws ConfigException, InitializationException
{
@@ -1021,58 +968,38 @@
// initializeConfigHandler method.
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public DN[] getBaseDNs()
{
return baseDNs;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public long getEntryCount()
{
return configEntries.size();
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean isLocal()
{
// The configuration information will always be local.
return true;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean isIndexed(AttributeType attributeType, IndexType indexType)
{
// All searches in this backend will always be considered indexed.
return true;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public ConditionResult hasSubordinates(DN entryDN)
throws DirectoryException
{
@@ -1091,12 +1018,8 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public long numSubordinates(DN entryDN, boolean subtree)
throws DirectoryException
{
@@ -1122,12 +1045,8 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public Entry getEntry(DN entryDN)
throws DirectoryException
{
@@ -1140,24 +1059,16 @@
return configEntry.getEntry().duplicate(true);
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean entryExists(DN entryDN)
throws DirectoryException
{
return configEntries.containsKey(entryDN);
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void addEntry(Entry entry, AddOperation addOperation)
throws DirectoryException
{
@@ -1317,12 +1228,8 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void deleteEntry(DN entryDN, DeleteOperation deleteOperation)
throws DirectoryException
{
@@ -1477,12 +1384,8 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void replaceEntry(Entry oldEntry, Entry newEntry,
ModifyOperation modifyOperation) throws DirectoryException
{
@@ -1643,12 +1546,8 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void renameEntry(DN currentDN, Entry entry,
ModifyDNOperation modifyDNOperation)
throws DirectoryException
@@ -1675,12 +1574,8 @@
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void search(SearchOperation searchOperation)
throws DirectoryException
{
@@ -1819,12 +1714,8 @@
return true;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void writeUpdatedConfig()
throws DirectoryException
{
@@ -2120,12 +2011,8 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void writeSuccessfulStartupConfig()
{
if (useLastKnownGoodConfig)
@@ -2280,46 +2167,30 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public Set<String> getSupportedControls()
{
- return SUPPORTED_CONTROLS;
+ return Collections.emptySet();
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public Set<String> getSupportedFeatures()
{
- return SUPPORTED_FEATURES;
+ return Collections.emptySet();
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean supportsLDIFExport()
{
// TODO We would need export-ldif to initialize this backend.
return false;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void exportLDIF(LDIFExportConfig exportConfig)
throws DirectoryException
{
@@ -2423,23 +2294,15 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean supportsLDIFImport()
{
return false;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public LDIFImportResult importLDIF(LDIFImportConfig importConfig)
throws DirectoryException
{
@@ -2447,24 +2310,16 @@
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean supportsBackup()
{
// We do support an online backup mechanism for the configuration.
return true;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean supportsBackup(BackupConfig backupConfig,
StringBuilder unsupportedReason)
{
@@ -2475,12 +2330,8 @@
return true;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void createBackup(BackupConfig backupConfig)
throws DirectoryException
{
@@ -2856,12 +2707,8 @@
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void removeBackup(BackupDirectory backupDirectory,
String backupID)
throws DirectoryException
@@ -2869,24 +2716,16 @@
// NYI
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public boolean supportsRestore()
{
// We will provide a restore, but only for offline operations.
return true;
}
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
+ /** {@inheritDoc} */
+ @Override
public void restoreBackup(RestoreConfig restoreConfig)
throws DirectoryException
{
@@ -3367,33 +3206,21 @@
logError(message);
}
-
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public DN getComponentEntryDN()
{
return configRootEntry.getDN();
}
-
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public String getClassName()
{
return CLASS_NAME;
}
-
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public Map<String,String> getAlerts()
{
@@ -3480,28 +3307,10 @@
}
}
-
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override
public void preloadEntryCache() throws UnsupportedOperationException {
throw new UnsupportedOperationException("Operation not supported.");
}
- private void close(Closeable toClose)
- {
- try
- {
- toClose.close();
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
- }
- }
- }
}
--
Gitblit v1.10.0