From e9d905d7ace118d7cb978966c93811bb050c8430 Mon Sep 17 00:00:00 2001
From: ctissot <ctissot@localhost>
Date: Mon, 26 May 2008 12:29:48 +0000
Subject: [PATCH] Fix for 3259: No messages support in example plugin
---
opends/resource/admin/example-plugin/ExamplePlugin.java | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/opends/resource/admin/example-plugin/ExamplePlugin.java b/opends/resource/admin/example-plugin/ExamplePlugin.java
index 3923b29..d833628 100644
--- a/opends/resource/admin/example-plugin/ExamplePlugin.java
+++ b/opends/resource/admin/example-plugin/ExamplePlugin.java
@@ -32,7 +32,7 @@
import java.util.Set;
import org.opends.server.api.plugin.PluginType;
-import org.opends.server.api.plugin.StartupPluginResult;
+import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.config.ConfigException;
import org.opends.server.types.ConfigChangeResult;
@@ -46,6 +46,8 @@
import com.example.opends.server.ExamplePluginCfg;
+import static com.example.opends.messages.ExamplePluginMessages.*;
+
/**
* The example plugin implementation class. This plugin will output
* the configured message to the error log during server start up.
@@ -95,8 +97,8 @@
// This is fine.
break;
default:
- throw new ConfigException(Message.raw("Invalid plugin type " + t
- + " for the example plugin."));
+ Message message = ERR_INITIALIZE_PLUGIN.get(String.valueOf(t));
+ throw new ConfigException(message);
}
}
@@ -119,11 +121,11 @@
* @return The result of the startup plugin processing.
*/
@Override
- public StartupPluginResult doStartup() {
+ public PluginResult.Startup doStartup() {
// Log the provided message.
- logError(Message.raw(Category.CONFIG, Severity.NOTICE,
- "Example plugin message '" + config.getMessage() + "'."));
- return StartupPluginResult.SUCCESS;
+ Message message = NOTE_DO_STARTUP.get(String.valueOf(config.getMessage()));
+ logError(message);
+ return PluginResult.Startup.continueStartup();
}
@@ -143,10 +145,10 @@
// Log a message to say that the configuration has changed. This
// isn't necessary, but we'll do it just to show that the change
// has taken effect.
- logError(Message.raw(Category.CONFIG, Severity.NOTICE,
- "Example plugin message has been changed from '"
- + this.config.getMessage() + "' to '"
- + config.getMessage() + "'"));
+ Message message = NOTE_APPLY_CONFIGURATION_CHANGE.get(
+ String.valueOf(this.config.getMessage()),
+ String.valueOf(config.getMessage()));
+ logError(message);
// Update the configuration.
this.config = config;
--
Gitblit v1.10.0