Index: src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
===================================================================
--- src/java/org/apache/james/remotemanager/RemoteManagerHandler.java	(revision 453931)
+++ src/java/org/apache/james/remotemanager/RemoteManagerHandler.java	(working copy)
@@ -182,6 +182,8 @@
      */
     private UsersRepository users;
     
+    private CommandRegistry commandRegistry;
+    
     private final static String HEADER_IDENTIFIER = "header=";
     private final static String REGEX_IDENTIFIER = "regex=";
     private final static String KEY_IDENTIFIER = "key=";
@@ -197,6 +199,9 @@
 
             // Reset the users repository to the default.
             users = theConfigData.getUsersRepository();
+            
+            Command[] commands = theConfigData.getCommands();
+            commandRegistry = new CommandRegistry(commands);
         } else {
             throw new IllegalArgumentException("Configuration object does not implement RemoteManagerHandlerConfigurationData");
         }
@@ -364,7 +369,7 @@
         } else if (command.equals(COMMAND_SHUTDOWN)) {
             return doSHUTDOWN(argument);
         } else {
-            return doUnknownCommand(rawCommand);
+            return commandRegistry.execute(command, argument, out);
         }
         return true;
     }
Index: src/java/org/apache/james/remotemanager/RemoteManager.java
===================================================================
--- src/java/org/apache/james/remotemanager/RemoteManager.java	(revision 453931)
+++ src/java/org/apache/james/remotemanager/RemoteManager.java	(working copy)
@@ -22,6 +22,7 @@
 package org.apache.james.remotemanager;
 
 import org.apache.avalon.cornerstone.services.store.Store;
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.service.ServiceException;
@@ -33,6 +34,8 @@
 import org.apache.james.services.UsersRepository;
 import org.apache.james.services.UsersStore;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 
 /**
@@ -83,6 +86,8 @@
     
     private BayesianAnalyzerManagementService bayesianAnalyzerManagement;
     
+    private Command[] commands = {};
+    
     /**
      * Set the UserStore 
      * 
@@ -187,9 +192,38 @@
             if (promtConfiguration != null) prompt = promtConfiguration.getValue();
             if (prompt == null) prompt = ""; 
             else if (!prompt.equals("") && !prompt.endsWith(" ")) prompt += " "; 
+            configureCommands(configuration);
         }
     }
   
+    private void configureCommands(final Configuration configuration) throws ConfigurationException {
+        Collection commands = new ArrayList();
+        Configuration[] commandConfigurations = configuration.getChildren( "command" );
+        if (commandConfigurations != null) {
+            for(int i=0;i<commandConfigurations.length;i++) {
+                final Configuration commandConfiguration = commandConfigurations[i];
+                Configuration classConfiguration 
+                = commandConfiguration.getChild( "class-name" );
+                String className = classConfiguration.getValue();
+                if (className != null) {
+                    try {
+                        Command command 
+                        = (Command) Class.forName(className).newInstance();
+                        if (command instanceof Configurable) {
+                            Configurable configurable = (Configurable) command;
+                            configurable.configure(commandConfiguration);
+                        }
+                        commands.add(command);
+                    } catch (Exception e) {
+                        // TODO: error handling?
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+        this.commands = (Command[]) commands.toArray(this.commands);
+    }
+    
     /**
      * @see org.apache.james.core.AbstractJamesService#getDefaultPort()
      */
@@ -284,6 +318,13 @@
         public BayesianAnalyzerManagementService getBayesianAnalyzerManagement() {
             return RemoteManager.this.bayesianAnalyzerManagement;
         }
+        
+        /**
+         * @see org.apache.james.neo.remotemanager.RemoteManagerHandlerConfigurationData#getCommands()
+         */
+        public Command[] getCommands() {
+            return RemoteManager.this.commands;
+        }
     }
 
     /**
Index: src/java/org/apache/james/remotemanager/RemoteManagerHandlerConfigurationData.java
===================================================================
--- src/java/org/apache/james/remotemanager/RemoteManagerHandlerConfigurationData.java	(revision 453931)
+++ src/java/org/apache/james/remotemanager/RemoteManagerHandlerConfigurationData.java	(working copy)
@@ -102,4 +102,10 @@
      */
     BayesianAnalyzerManagementService getBayesianAnalyzerManagement();
 
+
+    /**
+     * Gets avaliable commands.
+     * @return <code>Command</code>'s, not null possibly empty
+     */
+    Command[] getCommands();
 }
Index: src/java/org/apache/james/remotemanager/CommandRegistry.java
===================================================================
--- src/java/org/apache/james/remotemanager/CommandRegistry.java	(revision 0)
+++ src/java/org/apache/james/remotemanager/CommandRegistry.java	(revision 0)
@@ -0,0 +1,55 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.remotemanager;
+
+import java.io.PrintWriter;
+
+
+public class CommandRegistry {
+
+    private final Command[] commands;
+    
+    public CommandRegistry(final Command[] commands) {
+        this.commands = commands;
+    }
+    
+    public boolean execute(final String commandName, final String args, final PrintWriter out) {
+        boolean result = true;
+        for (int i=0; i<commands.length;i++) {
+            final Command command = commands[i];
+            if (commandName.equalsIgnoreCase(command.getName())) {
+                command.execute(args, out);
+            }
+        }
+        return result;
+    }
+    
+    public void printHelp(final PrintWriter out) {
+        for (int i=0; i<commands.length;i++) {
+            final Command command = commands[i];
+            final StringBuffer buffer = new StringBuffer(command.getName());
+            while (buffer.length() <= 39) {
+                buffer.append(' ');
+            }
+            buffer.append(command.help());
+            out.println(buffer);
+        }
+    }
+}
Index: src/java/org/apache/james/remotemanager/Command.java
===================================================================
--- src/java/org/apache/james/remotemanager/Command.java	(revision 0)
+++ src/java/org/apache/james/remotemanager/Command.java	(revision 0)
@@ -0,0 +1,29 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.remotemanager;
+
+import java.io.PrintWriter;
+
+public interface Command {
+
+    public String getName();
+    public String help();
+    public boolean execute(String args, final PrintWriter out);
+}
