You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by pg...@apache.org on 2002/08/18 09:21:10 UTC
cvs commit: jakarta-james/src/java/org/apache/james/remotemanager package.html RemoteManager.java RemoteManagerHandler.java
pgoldstein 2002/08/18 00:21:10
Modified: src/java/org/apache/james/remotemanager RemoteManager.java
RemoteManagerHandler.java
Added: src/java/org/apache/james/remotemanager package.html
Log:
Added extensive commenting
Revision Changes Path
1.8 +20 -0 jakarta-james/src/java/org/apache/james/remotemanager/RemoteManager.java
Index: RemoteManager.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/remotemanager/RemoteManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RemoteManager.java 12 Aug 2002 18:51:11 -0000 1.7
+++ RemoteManager.java 18 Aug 2002 07:21:09 -0000 1.8
@@ -35,6 +35,12 @@
return new DefaultHandlerFactory( RemoteManagerHandler.class );
}
+ /**
+ * Pass the <code>Configuration</code> to the instance.
+ *
+ * @param configuration the class configurations.
+ * @throws ConfigurationException if an error occurs
+ */
public void configure( final Configuration configuration )
throws ConfigurationException {
@@ -61,6 +67,13 @@
super.configure( configuration.getChild( "handler" ) );
}
+ /**
+ * Initialize the component. Initialization includes
+ * allocating any resources required throughout the
+ * components lifecycle.
+ *
+ * @throws Exception if an error occurs
+ */
public void initialize() throws Exception {
getLogger().info( "RemoteManager init..." );
StringBuffer infoBuffer =
@@ -76,6 +89,13 @@
getLogger().info("RemoteManager ...init end");
}
+ /**
+ * The dispose operation is called at the end of a components lifecycle.
+ * Instances of this class use this method to release and destroy any
+ * resources that they own.
+ *
+ * @throws Exception if an error is encountered during shutdown
+ */
public void dispose()
{
getLogger().info( "RemoteManager dispose..." );
1.13 +67 -10 jakarta-james/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java
Index: RemoteManagerHandler.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/remotemanager/RemoteManagerHandler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- RemoteManagerHandler.java 10 Aug 2002 17:53:08 -0000 1.12
+++ RemoteManagerHandler.java 18 Aug 2002 07:21:09 -0000 1.13
@@ -55,15 +55,47 @@
private UsersStore usersStore;
private UsersRepository users;
- private boolean inLocalUsers = true;
+
+ /**
+ * The scheduler used to handle timeouts for the RemoteManager
+ * interaction
+ */
private TimeScheduler scheduler;
private MailServer mailServer;
+ /**
+ * Whether the local users repository should be used to store new
+ * users.
+ */
+ private boolean inLocalUsers = true;
+
+ /**
+ * The reader associated with incoming commands.
+ */
private BufferedReader in;
+
+ /**
+ * The writer to which outgoing messages are written.
+ */
private PrintWriter out;
- private HashMap admaccount = new HashMap();
+
+ /**
+ * The TCP/IP socket over which the RemoteManager interaction
+ * is occurring
+ */
private Socket socket;
+ /**
+ * A HashMap of (user id, passwords) for James administrators
+ */
+ private HashMap admaccount = new HashMap();
+
+ /**
+ * Pass the <code>Configuration</code> to the instance.
+ *
+ * @param configuration the class configurations.
+ * @throws ConfigurationException if an error occurs
+ */
public void configure( final Configuration configuration )
throws ConfigurationException {
@@ -78,6 +110,15 @@
}
}
+ /**
+ * Pass the <code>ComponentManager</code> to the <code>composer</code>.
+ * The instance uses the specified <code>ComponentManager</code> to
+ * acquire the components it needs for execution.
+ *
+ * @param componentManager The <code>ComponentManager</code> which this
+ * <code>Composable</code> uses.
+ * @throws ComponentException if an error occurs
+ */
public void compose( final ComponentManager componentManager )
throws ComponentException {
@@ -95,8 +136,8 @@
* This handler is responsible for processing connections as they occur.
*
* @param connection the connection
- * @exception IOException if an error reading from socket occurs
- * @exception ProtocolException if an error handling connection occurs
+ * @throws IOException if an error reading from socket occurs
+ * @throws ProtocolException if an error handling connection occurs
*/
public void handleConnection( final Socket connection )
throws IOException {
@@ -201,6 +242,13 @@
scheduler.removeTrigger(this.toString());
}
+ /**
+ * Callback method called when the the PeriodicTimeTrigger in
+ * handleConnection is triggered. In this case the trigger is
+ * being used as a timeout, so the method simply closes the connection.
+ *
+ * @param triggerName the name of the trigger
+ */
public void targetTriggered( final String triggerName ) {
getLogger().error("Connection timeout on socket");
try {
@@ -210,6 +258,17 @@
}
}
+ /**
+ * <p>This method parses and processes RemoteManager commands read off the
+ * wire in handleConnection. It returns true if expecting additional
+ * commands, false otherwise.</p>
+ *
+ * <p>TODO: Break this method into smaller methods.</p>
+ *
+ * @param command the raw command string passed in over the socket
+ *
+ * @return whether additional commands are expected.
+ */
private boolean parseCommand( String command ) {
if (command == null) {
return false;
@@ -404,8 +463,7 @@
return true;
}
- boolean success;
- success = user.setAlias(alias);
+ boolean success = user.setAlias(alias);
if (success) {
user.setAliasing(true);
users.updateUser(user);
@@ -457,8 +515,7 @@
return true;
}
- boolean success;
- success = user.setForwardingDestination(forwardAddr);
+ boolean success = user.setForwardingDestination(forwardAddr);
if (success) {
user.setForwarding(true);
users.updateUser(user);
1.1 jakarta-james/src/java/org/apache/james/remotemanager/package.html
Index: package.html
===================================================================
<body>
Provides classes implementing simple remote management facilities for James
</body>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>