From 4783adc14c2d6b96260052d3b634eafa500c6ddf Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 01 Mar 2007 03:27:06 +0000
Subject: [PATCH] This removes old debug logging framework method calls that are going to be automatically instrumented by AspectJ. Non instrumented debug method calls are updated to use the new debug framework methods. However, the new debug logging framework is not yet active as the Aspects are not weaved in. After this revision, debug logging will be disabled in the server until the new AOP framework is complete.
---
opendj-sdk/opends/src/server/org/opends/server/backends/BackupBackend.java | 121 ++++++++++++++++++---------------------
1 files changed, 56 insertions(+), 65 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/BackupBackend.java b/opendj-sdk/opends/src/server/org/opends/server/backends/BackupBackend.java
index 93440bd..58abefe 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/BackupBackend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/BackupBackend.java
@@ -75,7 +75,9 @@
import org.opends.server.types.SearchScope;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.Debug.*;
+import static org.opends.server.loggers.debug.DebugLogger.debugCought;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.BackendMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.ServerConstants.*;
@@ -95,11 +97,6 @@
extends Backend
implements ConfigurableComponent
{
- /**
- * The fully-qualified name of this class for debugging purposes.
- */
- private static final String CLASS_NAME =
- "org.opends.server.backends.BackupBackend";
@@ -135,7 +132,6 @@
{
super();
- assert debugConstructor(CLASS_NAME);
// Perform all initialization in initializeBackend.
@@ -162,8 +158,6 @@
public void initializeBackend(ConfigEntry configEntry, DN[] baseDNs)
throws ConfigException, InitializationException
{
- assert debugEnter(CLASS_NAME, "initializeBackend",
- String.valueOf(configEntry));
// Make sure that a configuration entry was provided. If not, then we will
@@ -186,7 +180,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "initializeBackend", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
int msgID = MSGID_BACKUP_CANNOT_DECODE_BACKUP_ROOT_DN;
String message = getMessage(msgID, stackTraceToSingleLineString(e));
@@ -223,11 +220,14 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "initializeBackend", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
msgID = MSGID_BACKUP_CANNOT_DETERMINE_BACKUP_DIR_LIST;
String message = getMessage(msgID, stackTraceToSingleLineString(e));
- throw new InitializationException(msgID, message,e);
+ throw new InitializationException(msgID, message, e);
}
@@ -281,7 +281,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "initializeBackend", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
msgID = MSGID_BACKEND_CANNOT_REGISTER_BASEDN;
String message = getMessage(msgID, backupBaseDN.toString(),
@@ -305,7 +308,6 @@
*/
public void finalizeBackend()
{
- assert debugEnter(CLASS_NAME, "finalizeBackend");
DirectoryServer.deregisterConfigurableComponent(this);
@@ -315,7 +317,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "finalizeBackend", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
}
}
@@ -328,7 +333,6 @@
*/
public DN[] getBaseDNs()
{
- assert debugEnter(CLASS_NAME, "getBaseDNs");
return baseDNs;
}
@@ -340,7 +344,6 @@
*/
public long getEntryCount()
{
- assert debugEnter(CLASS_NAME, "getEntryCount");
int numEntries = 1;
@@ -382,7 +385,6 @@
*/
public boolean isLocal()
{
- assert debugEnter(CLASS_NAME, "isLocal");
// For the purposes of this method, this is a local backend.
return true;
@@ -404,7 +406,6 @@
public Entry getEntry(DN entryDN)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "getEntry", String.valueOf(entryDN));
// If the requested entry was null, then throw an exception.
@@ -470,8 +471,6 @@
private Entry getBackupDirectoryEntry(DN entryDN)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "getBackupDirectoryEntry",
- String.valueOf(entryDN));
// Make sure that the DN specifies a backup directory.
@@ -497,9 +496,12 @@
}
catch (ConfigException ce)
{
- assert debugException(CLASS_NAME, "getBackupDirectoryEntry", ce);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, ce);
+ }
- int msgID = MSGID_BACKUP_INVALID_BACKUP_DIRECTORY;
+ int msgID = MSGID_BACKUP_INVALID_BACKUP_DIRECTORY;
String message = getMessage(msgID, String.valueOf(entryDN),
ce.getMessage());
throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message,
@@ -507,9 +509,12 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "getBackupDirectoryEntry", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
- int msgID = MSGID_BACKUP_ERROR_GETTING_BACKUP_DIRECTORY;
+ int msgID = MSGID_BACKUP_ERROR_GETTING_BACKUP_DIRECTORY;
String message = getMessage(msgID, stackTraceToSingleLineString(e));
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
message, msgID);
@@ -568,7 +573,6 @@
private Entry getBackupEntry(DN entryDN)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "getBackupEntry", String.valueOf(entryDN));
// First, get the backup ID from the entry DN.
@@ -615,18 +619,24 @@
}
catch (ConfigException ce)
{
- assert debugException(CLASS_NAME, "getBackupEntry", ce);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, ce);
+ }
- int msgID = MSGID_BACKUP_INVALID_BACKUP_DIRECTORY;
+ int msgID = MSGID_BACKUP_INVALID_BACKUP_DIRECTORY;
String message = getMessage(msgID, ce.getMessage());
throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message,
msgID);
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "getBackupEntry", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
- int msgID = MSGID_BACKUP_ERROR_GETTING_BACKUP_DIRECTORY;
+ int msgID = MSGID_BACKUP_ERROR_GETTING_BACKUP_DIRECTORY;
String message = getMessage(msgID, stackTraceToSingleLineString(e));
throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
message, msgID);
@@ -787,8 +797,6 @@
public void addEntry(Entry entry, AddOperation addOperation)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "addEntry", String.valueOf(entry),
- String.valueOf(addOperation));
int msgID = MSGID_BACKUP_ADD_NOT_SUPPORTED;
String message = getMessage(msgID);
@@ -815,8 +823,6 @@
public void deleteEntry(DN entryDN, DeleteOperation deleteOperation)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "deleteEntry", String.valueOf(entryDN),
- String.valueOf(deleteOperation));
int msgID = MSGID_BACKUP_DELETE_NOT_SUPPORTED;
String message = getMessage(msgID);
@@ -843,8 +849,6 @@
public void replaceEntry(Entry entry, ModifyOperation modifyOperation)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "replaceEntry", String.valueOf(entry),
- String.valueOf(modifyOperation));
int msgID = MSGID_BACKUP_MODIFY_NOT_SUPPORTED;
String message = getMessage(msgID);
@@ -873,8 +877,6 @@
ModifyDNOperation modifyDNOperation)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "renameEntry", String.valueOf(currentDN),
- String.valueOf(entry), String.valueOf(modifyDNOperation));
int msgID = MSGID_BACKUP_MODIFY_DN_NOT_SUPPORTED;
String message = getMessage(msgID);
@@ -897,7 +899,6 @@
public void search(SearchOperation searchOperation)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "search", String.valueOf(searchOperation));
// Get the base entry for the search, if possible. If it doesn't exist,
@@ -947,7 +948,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "search", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
continue;
}
@@ -986,7 +990,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "search", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
continue;
}
@@ -1040,7 +1047,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "search", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
continue;
}
@@ -1087,7 +1097,6 @@
*/
public HashSet<String> getSupportedControls()
{
- assert debugEnter(CLASS_NAME, "getSupportedControls");
return supportedControls;
}
@@ -1101,7 +1110,6 @@
*/
public HashSet<String> getSupportedFeatures()
{
- assert debugEnter(CLASS_NAME, "getSupportedFeatures");
return supportedFeatures;
}
@@ -1117,7 +1125,6 @@
*/
public boolean supportsLDIFExport()
{
- assert debugEnter(CLASS_NAME, "supportsLDIFExport");
// We do not support LDIF exports.
return false;
@@ -1142,7 +1149,6 @@
LDIFExportConfig exportConfig)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "exportLDIF", String.valueOf(exportConfig));
int msgID = MSGID_BACKUP_EXPORT_NOT_SUPPORTED;
String message = getMessage(msgID);
@@ -1161,7 +1167,6 @@
*/
public boolean supportsLDIFImport()
{
- assert debugEnter(CLASS_NAME, "supportsLDIFImport");
// This backend does not support LDIF imports.
return false;
@@ -1186,7 +1191,6 @@
LDIFImportConfig importConfig)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "importLDIF", String.valueOf(importConfig));
// This backend does not support LDIF imports.
@@ -1211,7 +1215,6 @@
*/
public boolean supportsBackup()
{
- assert debugEnter(CLASS_NAME, "supportsBackup");
// This backend does not provide a backup/restore mechanism.
return false;
@@ -1237,7 +1240,6 @@
public boolean supportsBackup(BackupConfig backupConfig,
StringBuilder unsupportedReason)
{
- assert debugEnter(CLASS_NAME, "supportsBackup");
// This backend does not provide a backup/restore mechanism.
@@ -1262,7 +1264,6 @@
public void createBackup(ConfigEntry configEntry, BackupConfig backupConfig)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "createBackup", String.valueOf(backupConfig));
// This backend does not provide a backup/restore mechanism.
@@ -1290,9 +1291,6 @@
String backupID)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "removeBackup",
- String.valueOf(backupDirectory),
- String.valueOf(backupID));
// This backend does not provide a backup/restore mechanism.
@@ -1312,7 +1310,6 @@
*/
public boolean supportsRestore()
{
- assert debugEnter(CLASS_NAME, "supportsRestore");
// This backend does not provide a backup/restore mechanism.
@@ -1338,8 +1335,6 @@
RestoreConfig restoreConfig)
throws DirectoryException
{
- assert debugEnter(CLASS_NAME, "restoreBackup",
- String.valueOf(restoreConfig));
// This backend does not provide a backup/restore mechanism.
@@ -1360,7 +1355,6 @@
*/
public DN getConfigurableComponentEntryDN()
{
- assert debugEnter(CLASS_NAME, "getConfigurableComponentEntryDN");
return configEntryDN;
}
@@ -1376,7 +1370,6 @@
*/
public List<ConfigAttribute> getConfigurationAttributes()
{
- assert debugEnter(CLASS_NAME, "getConfigurationAttributes");
LinkedList<ConfigAttribute> attrs = new LinkedList<ConfigAttribute>();
@@ -1415,8 +1408,6 @@
public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
List<String> unacceptableReasons)
{
- assert debugEnter(CLASS_NAME, "hasAcceptableConfiguration",
- String.valueOf(configEntry), "java.util.List<String>");
// We'll accept anything here. The only configurable attribute is the
@@ -1446,9 +1437,6 @@
public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry,
boolean detailedResults)
{
- assert debugEnter(CLASS_NAME, "applyNewConfiguration",
- String.valueOf(configEntry),
- String.valueOf(detailedResults));
ResultCode resultCode = ResultCode.SUCCESS;
@@ -1481,7 +1469,10 @@
}
catch (Exception e)
{
- assert debugException(CLASS_NAME, "initializeBackend", e);
+ if (debugEnabled())
+ {
+ debugCought(DebugLogLevel.ERROR, e);
+ }
msgID = MSGID_BACKUP_CANNOT_DETERMINE_BACKUP_DIR_LIST;
messages.add(getMessage(msgID, stackTraceToSingleLineString(e)));
--
Gitblit v1.10.0