On Thursday 22 September 2005 15:59, Danny Angus wrote:
>
> If you want to have a go at making the change yourself look at this file:
>
> http://svn.apache.org/viewcvs.cgi/james/server/trunk/src/java/org/apache/ja
>mes/remotemanager/RemoteManagerHandler.java?view=markup
>
> and this block:
>
> while (parseCommand(in.readLine())) {
> theWatchdog.reset();
> }
>
> I think you need to output the prompt once before the while, and in the
> loop.
Wich is just what I've been writing last week :)
A patch against the trunk is attached, this adds an optional <prompt> element
to the remote manager handler block, like this:
<remotemanager>
<port>4555</port>
<handler>
<helloName autodetect="true">myMailServer</helloName>
<administrator_accounts>
<account login="root" password="root"/>
</administrator_accounts>
<connectiontimeout> 60000 </connectiontimeout>
<prompt>james></prompt>
</handler>
</remotemanager>
The prompt element is optional, when left out the prompt is set to an empty
string, so when the configuration is unchanged the behaviour also is
unchanged.
Arjan.
Index: /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java
===================================================================
--- /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java (revision 290830)
+++ /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java (working copy)
@@ -66,6 +66,11 @@
private UsersRepository users;
/**
+ * The service prompt to be displayed when waiting for input.
+ */
+ private String prompt = "";
+
+ /**
* The reference to the internal MailServer service
*/
private MailServer mailServer;
@@ -122,6 +127,10 @@
adminAccounts.put( accounts[ i ].getAttribute( "login" ),
accounts[ i ].getAttribute( "password" ) );
}
+ Configuration promtConfiguration = handlerConfiguration.getChild("prompt", false);
+ if (promtConfiguration != null) prompt = promtConfiguration.getValue();
+ if (prompt == null) prompt = "";
+ else if (!prompt.equals("") && !prompt.endsWith(" ")) prompt += " ";
}
}
@@ -261,5 +270,12 @@
return RemoteManager.this.adminAccounts;
}
+ /**
+ * @see org.apache.james.remotemanager.RemoteManagerHandlerConfigurationData#getPrompt()
+ */
+ public String getPrompt() {
+ return RemoteManager.this.prompt;
+ }
+
}
}
Index: /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
===================================================================
--- /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java (revision 290830)
+++ /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java (working copy)
@@ -298,9 +298,13 @@
}
try {
+ out.print(theConfigData.getPrompt());
+ out.flush();
theWatchdog.start();
while (parseCommand(in.readLine())) {
theWatchdog.reset();
+ out.print(theConfigData.getPrompt());
+ out.flush();
}
theWatchdog.stop();
} catch (IOException ioe) {
Index: /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandlerConfigurationData.java
===================================================================
--- /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandlerConfigurationData.java (revision 290830)
+++ /home/avee/eclipse/workspace/trunk/src/java/org/apache/james/remotemanager/RemoteManagerHandlerConfigurationData.java (working copy)
@@ -67,4 +67,11 @@
*/
HashMap getAdministrativeAccountData();
+ /**
+ * Returns the prompt to be displayed when waiting for input. e.g. "james> ".
+ *
+ * @return the configured prompt, or an empty string when the prompt is not configured.
+ */
+ String getPrompt();
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]