From 0a91f5af5295a2d0f5cfdad0d529d4b5d532c181 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 10 Feb 2015 15:34:15 +0000
Subject: [PATCH] OPENDJ-1716 Various PluggableBackend/Storage refactorings
---
opendj3-server-dev/src/server/org/opends/server/api/Backend.java | 74 +++++++++++++-----------------------
1 files changed, 27 insertions(+), 47 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/Backend.java b/opendj3-server-dev/src/server/org/opends/server/api/Backend.java
index 8c4a4c5..7de701e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/Backend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/Backend.java
@@ -604,14 +604,36 @@
return supportedFeatures != null && supportedFeatures.contains(featureOID);
}
+ /** Enumeration of optional backend operations. */
+ public static enum BackendOperation
+ {
+ /** Indicates whether this backend supports indexing attributes to speed up searches. */
+ INDEXING,
+ /** Indicates whether this backend supports exporting the data it contains to an LDIF file. */
+ LDIF_EXPORT,
+ /** Indicates whether this backend supports importing its data from an LDIF file. */
+ LDIF_IMPORT,
+ /**
+ * Indicates whether this backend provides a backup mechanism of any kind. This method is used
+ * by the backup process when backing up all backends to determine whether this backend is one
+ * that should be skipped. It should only return {@code true} for backends that it is not
+ * possible to archive directly (e.g., those that don't store their data locally, but rather
+ * pass through requests to some other repository).
+ */
+ BACKUP,
+ /** Indicates whether this backend can restore a backup. */
+ RESTORE;
+ }
+
/**
- * Indicates whether this backend provides a mechanism to export the
- * data it contains to an LDIF file.
+ * Indicates whether this backend supports the provided backend operation.
*
- * @return {@code true} if this backend provides an LDIF export
- * mechanism, or {@code false} if not.
+ * @param backendOperation
+ * the backend operation
+ * @return {@code true} if this backend supports the provided backend operation, {@code false}
+ * otherwise.
*/
- public abstract boolean supportsLDIFExport();
+ public abstract boolean supports(BackendOperation backendOperation);
/**
* Exports the contents of this backend to LDIF. This method should
@@ -628,15 +650,6 @@
public abstract void exportLDIF(LDIFExportConfig exportConfig) throws DirectoryException;
/**
- * Indicates whether this backend provides a mechanism to import its
- * data from an LDIF file.
- *
- * @return {@code true} if this backend provides an LDIF import
- * mechanism, or {@code false} if not.
- */
- public abstract boolean supportsLDIFImport();
-
- /**
* Imports information from an LDIF file into this backend. This
* method should only be called if {@code supportsLDIFImport}
* returns {@code true}. Note that the server will not explicitly
@@ -654,16 +667,6 @@
throws DirectoryException;
/**
- * Indicates whether this backend supports indexing attributes to speed up searches.
- *
- * @return {@code true} if this backend supports indexing attributes, {@code false} otherwise
- */
- public boolean supportsIndexing()
- {
- return false;
- }
-
- /**
* Verify the integrity of the backend instance.
*
* @param verifyConfig
@@ -706,20 +709,6 @@
}
/**
- * Indicates whether this backend provides a backup mechanism of any
- * kind. This method is used by the backup process when backing up
- * all backends to determine whether this backend is one that should
- * be skipped. It should only return {@code true} for backends that
- * it is not possible to archive directly (e.g., those that don't
- * store their data locally, but rather pass through requests to
- * some other repository).
- *
- * @return {@code true} if this backend provides any kind of backup
- * mechanism, or {@code false} if it does not.
- */
- public abstract boolean supportsBackup();
-
- /**
* Creates a backup of the contents of this backend in a form that
* may be restored at a later date if necessary. This method should
* only be called if {@code supportsBackup} returns {@code true}.
@@ -754,15 +743,6 @@
throws DirectoryException;
/**
- * Indicates whether this backend provides a mechanism to restore a
- * backup.
- *
- * @return {@code true} if this backend provides a mechanism for
- * restoring backups, or {@code false} if not.
- */
- public abstract boolean supportsRestore();
-
- /**
* Restores a backup of the contents of this backend. This method
* should only be called if {@code supportsRestore} returns
* {@code true}. Note that the server will not explicitly
--
Gitblit v1.10.0