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/23 10:00:30 UTC
cvs commit: jakarta-james/src/java/org/apache/james/userrepository UsersFileRepository.java
pgoldstein 2002/08/23 01:00:30
Modified: src/java/org/apache/james/mailrepository
AvalonMailRepository.java JDBCMailRepository.java
MimeMessageJDBCSource.java
src/java/org/apache/james/nntpserver LISTGroup.java
src/java/org/apache/james/pop3server POP3Server.java
POP3Handler.java
src/java/org/apache/james/remotemanager
RemoteManagerHandler.java
src/java/org/apache/james/transport/mailets
AvalonListservManager.java Forward.java
JDBCAlias.java JDBCListserv.java
NotifyPostmaster.java NotifySender.java
ToProcessor.java ToRepository.java
src/java/org/apache/james/userrepository
UsersFileRepository.java
Log:
Added comments. Some rearranging of methods to match the Avalon lifecycle
Revision Changes Path
1.18 +19 -15 jakarta-james/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
Index: AvalonMailRepository.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/AvalonMailRepository.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- AvalonMailRepository.java 18 Aug 2002 07:23:55 -0000 1.17
+++ AvalonMailRepository.java 23 Aug 2002 08:00:28 -0000 1.18
@@ -46,7 +46,11 @@
extends AbstractLogEnabled
implements MailRepository, Component, Configurable, Composable, Initializable {
+ /**
+ * Whether 'deep debugging' is turned on.
+ */
protected final static boolean DEEP_DEBUG = false;
+
private static final String TYPE = "MAIL";
private Lock lock;
@@ -58,6 +62,21 @@
private Set keys;
/**
+ * 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 {
+ store = (Store)componentManager.
+ lookup( "org.apache.avalon.cornerstone.services.store.Store" );
+ }
+
+ /**
* Pass the <code>Configuration</code> to the instance.
*
* @param configuration the class configurations.
@@ -78,21 +97,6 @@
throw new ConfigurationException(exceptionString);
}
// ignore model
- }
-
- /**
- * 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 {
- store = (Store)componentManager.
- lookup( "org.apache.avalon.cornerstone.services.store.Store" );
}
/**
1.24 +61 -59 jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
Index: JDBCMailRepository.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- JDBCMailRepository.java 18 Aug 2002 07:23:55 -0000 1.23
+++ JDBCMailRepository.java 23 Aug 2002 08:00:28 -0000 1.24
@@ -63,6 +63,9 @@
extends AbstractLogEnabled
implements MailRepository, Component, Contextualizable, Composable, Configurable, Initializable {
+ /**
+ * Whether 'deep debugging' is turned on.
+ */
private static final boolean DEEP_DEBUG = false;
@@ -111,6 +114,64 @@
}
/**
+ * 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 {
+ StringBuffer logBuffer = null;
+ if (getLogger().isDebugEnabled()) {
+ logBuffer =
+ new StringBuffer(64)
+ .append(this.getClass().getName())
+ .append(".compose()");
+ getLogger().debug(logBuffer.toString());
+ }
+ // Get the DataSourceSelector service
+ datasources = (DataSourceSelector)componentManager.lookup( DataSourceSelector.ROLE );
+
+ try {
+ if (filestore != null) {
+ Store store = (Store)componentManager.
+ lookup("org.apache.avalon.cornerstone.services.store.Store");
+ //prepare Configurations for stream repositories
+ DefaultConfiguration streamConfiguration
+ = new DefaultConfiguration( "repository",
+ "generated:JDBCMailRepository.compose()" );
+
+ streamConfiguration.setAttribute( "destinationURL", filestore );
+ streamConfiguration.setAttribute( "type", "STREAM" );
+ streamConfiguration.setAttribute( "model", "SYNCHRONOUS" );
+ sr = (StreamRepository) store.select(streamConfiguration);
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Got filestore for JdbcMailRepository: " + filestore);
+ }
+ }
+
+ lock = new Lock();
+ if (getLogger().isDebugEnabled()) {
+ logBuffer =
+ new StringBuffer(128)
+ .append(this.getClass().getName())
+ .append(" created according to ")
+ .append(destination);
+ getLogger().debug(logBuffer.toString());
+ }
+ } catch (Exception e) {
+ final String message = "Failed to retrieve Store component:" + e.getMessage();
+ getLogger().error(message, e);
+ e.printStackTrace();
+ throw new ComponentException(message, e);
+ }
+ }
+
+ /**
* Pass the <code>Configuration</code> to the instance.
*
* @param configuration the class configurations.
@@ -183,65 +244,6 @@
if (!sqlFileName.startsWith("file://")) {
throw new ConfigurationException
("Malformed sqlFile - Must be of the format 'file://<filename>'.");
- }
- }
-
- /**
- * 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 {
- StringBuffer logBuffer = null;
- if (getLogger().isDebugEnabled()) {
- logBuffer =
- new StringBuffer(64)
- .append(this.getClass().getName())
- .append(".compose()");
- getLogger().debug(logBuffer.toString());
- }
-
- // Get the DataSourceSelector service
- datasources = (DataSourceSelector)componentManager.lookup( DataSourceSelector.ROLE );
-
- try {
- if (filestore != null) {
- Store store = (Store)componentManager.
- lookup("org.apache.avalon.cornerstone.services.store.Store");
- //prepare Configurations for stream repositories
- DefaultConfiguration streamConfiguration
- = new DefaultConfiguration( "repository",
- "generated:JDBCMailRepository.compose()" );
-
- streamConfiguration.setAttribute( "destinationURL", filestore );
- streamConfiguration.setAttribute( "type", "STREAM" );
- streamConfiguration.setAttribute( "model", "SYNCHRONOUS" );
- sr = (StreamRepository) store.select(streamConfiguration);
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Got filestore for JdbcMailRepository: " + filestore);
- }
- }
-
- lock = new Lock();
- if (getLogger().isDebugEnabled()) {
- logBuffer =
- new StringBuffer(128)
- .append(this.getClass().getName())
- .append(" created according to ")
- .append(destination);
- getLogger().debug(logBuffer.toString());
- }
- } catch (Exception e) {
- final String message = "Failed to retrieve Store component:" + e.getMessage();
- getLogger().error(message, e);
- e.printStackTrace();
- throw new ComponentException(message, e);
}
}
1.10 +4 -0 jakarta-james/src/java/org/apache/james/mailrepository/MimeMessageJDBCSource.java
Index: MimeMessageJDBCSource.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/MimeMessageJDBCSource.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MimeMessageJDBCSource.java 18 Aug 2002 07:23:55 -0000 1.9
+++ MimeMessageJDBCSource.java 23 Aug 2002 08:00:28 -0000 1.10
@@ -26,6 +26,10 @@
* InputStream to the JDBC field/record, possibly sequenced with the file stream.
*/
public class MimeMessageJDBCSource extends MimeMessageSource {
+
+ /**
+ * Whether 'deep debugging' is turned on.
+ */
private static final boolean DEEP_DEBUG = false;
//Define how to get to the data
1.7 +10 -3 jakarta-james/src/java/org/apache/james/nntpserver/LISTGroup.java
Index: LISTGroup.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/LISTGroup.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LISTGroup.java 19 Aug 2002 18:57:07 -0000 1.6
+++ LISTGroup.java 23 Aug 2002 08:00:28 -0000 1.7
@@ -12,14 +12,21 @@
import java.io.PrintWriter;
/**
- * formatted Group Information.
- * Group information is displayed differently depending on the
- * LIST command parameter
+ * <p>Formatted Group Information.</p>
+ * <p>Group information is displayed differently depending on the
+ * LIST command parameter</p>
+ *
+ * <p>TODO: This badly needs refactoring.</p>
*
* @author Harmeet Bedi <ha...@kodemuse.com>
*/
interface LISTGroup {
+ /**
+ * List group information to some source
+ *
+ * @param group the group whose information is to be listed
+ */
void show(NNTPGroup group);
/**
1.8 +1 -2 jakarta-james/src/java/org/apache/james/pop3server/POP3Server.java
Index: POP3Server.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/pop3server/POP3Server.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- POP3Server.java 15 Aug 2002 21:57:28 -0000 1.7
+++ POP3Server.java 23 Aug 2002 08:00:28 -0000 1.8
@@ -100,8 +100,7 @@
*
* @throws Exception if an error is encountered during shutdown
*/
- public void dispose()
- {
+ public void dispose() {
getLogger().info( "POP3Server dispose..." );
getLogger().info( "POP3Server dispose..." + m_connectionName);
super.dispose();
1.11 +13 -14 jakarta-james/src/java/org/apache/james/pop3server/POP3Handler.java
Index: POP3Handler.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/pop3server/POP3Handler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- POP3Handler.java 18 Aug 2002 07:27:51 -0000 1.10
+++ POP3Handler.java 23 Aug 2002 08:00:28 -0000 1.11
@@ -110,20 +110,6 @@
// the connection timeout timer. Defaults to
// 20 seconds.
-
- /**
- * Pass the <code>Configuration</code> to the instance.
- *
- * @param configuration the class configurations.
- * @throws ConfigurationException if an error occurs
- */
- public void configure(Configuration configuration)
- throws ConfigurationException {
- super.configure(configuration);
-
- lengthReset = configuration.getChild("lengthReset").getValueAsInteger(20000);
- }
-
/**
* Pass the <code>ComponentManager</code> to the <code>composer</code>.
* The instance uses the specified <code>ComponentManager</code> to
@@ -142,6 +128,19 @@
users = usersStore.getRepository("LocalUsers");
scheduler = (TimeScheduler)componentManager.
lookup( "org.apache.avalon.cornerstone.services.scheduler.TimeScheduler" );
+ }
+
+ /**
+ * Pass the <code>Configuration</code> to the instance.
+ *
+ * @param configuration the class configurations.
+ * @throws ConfigurationException if an error occurs
+ */
+ public void configure(Configuration configuration)
+ throws ConfigurationException {
+ super.configure(configuration);
+
+ lengthReset = configuration.getChild("lengthReset").getValueAsInteger(20000);
}
/**
1.14 +22 -22 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- RemoteManagerHandler.java 18 Aug 2002 07:21:09 -0000 1.13
+++ RemoteManagerHandler.java 23 Aug 2002 08:00:29 -0000 1.14
@@ -91,26 +91,6 @@
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 {
-
- timeout = configuration.getChild( "connectiontimeout" ).getValueAsInteger( 120000 );
-
- final Configuration admin = configuration.getChild( "administrator_accounts" );
- final Configuration[] accounts = admin.getChildren( "account" );
- for ( int i = 0; i < accounts.length; i++ )
- {
- admaccount.put( accounts[ i ].getAttribute( "login" ),
- accounts[ i ].getAttribute( "password" ) );
- }
- }
-
- /**
* 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.
@@ -129,6 +109,26 @@
usersStore = (UsersStore)componentManager.
lookup( "org.apache.james.services.UsersStore" );
users = usersStore.getRepository("LocalUsers");;
+ }
+
+ /**
+ * 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 {
+
+ timeout = configuration.getChild( "connectiontimeout" ).getValueAsInteger( 120000 );
+
+ final Configuration admin = configuration.getChild( "administrator_accounts" );
+ final Configuration[] accounts = admin.getChildren( "account" );
+ for ( int i = 0; i < accounts.length; i++ )
+ {
+ admaccount.put( accounts[ i ].getAttribute( "login" ),
+ accounts[ i ].getAttribute( "password" ) );
+ }
}
/**
1.5 +5 -2 jakarta-james/src/java/org/apache/james/transport/mailets/AvalonListservManager.java
Index: AvalonListservManager.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/AvalonListservManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AvalonListservManager.java 19 Aug 2002 18:57:07 -0000 1.4
+++ AvalonListservManager.java 23 Aug 2002 08:00:29 -0000 1.5
@@ -30,6 +30,9 @@
private UsersRepository members;
+ /**
+ * Initialize the mailet
+ */
public void init() {
ComponentManager compMgr = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
try {
1.6 +3 -0 jakarta-james/src/java/org/apache/james/transport/mailets/Forward.java
Index: Forward.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Forward.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Forward.java 19 Aug 2002 18:57:07 -0000 1.5
+++ Forward.java 23 Aug 2002 08:00:29 -0000 1.6
@@ -26,6 +26,9 @@
private Collection newRecipients;
+ /**
+ * Initialize the mailet
+ */
public void init() throws MessagingException {
newRecipients = new HashSet();
StringTokenizer st = new StringTokenizer(getMailetConfig().getInitParameter("forwardto"), ",", false);
1.10 +3 -0 jakarta-james/src/java/org/apache/james/transport/mailets/JDBCAlias.java
Index: JDBCAlias.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/JDBCAlias.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JDBCAlias.java 19 Aug 2002 18:57:07 -0000 1.9
+++ JDBCAlias.java 23 Aug 2002 08:00:29 -0000 1.10
@@ -51,6 +51,9 @@
}
};
+ /**
+ * Initialize the mailet
+ */
public void init() throws MessagingException {
String mappingsURL = getInitParameter("mappings");
1.10 +3 -0 jakarta-james/src/java/org/apache/james/transport/mailets/JDBCListserv.java
Index: JDBCListserv.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/JDBCListserv.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JDBCListserv.java 19 Aug 2002 18:57:07 -0000 1.9
+++ JDBCListserv.java 23 Aug 2002 08:00:29 -0000 1.10
@@ -70,6 +70,9 @@
}
};
+ /**
+ * Initialize the mailet
+ */
public void init() throws MessagingException {
if (getInitParameter("data_source") == null) {
throw new MailetException("data_source not specified for JDBCListserv");
1.7 +1 -0 jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
Index: NotifyPostmaster.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NotifyPostmaster.java 19 Aug 2002 18:57:07 -0000 1.6
+++ NotifyPostmaster.java 23 Aug 2002 08:00:29 -0000 1.7
@@ -87,6 +87,7 @@
try {
attachStackTrace = new Boolean(getInitParameter("attachStackTrace")).booleanValue();
} catch (Exception e) {
+ // Ignore exception, default to false
}
}
1.8 +1 -0 jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java
Index: NotifySender.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NotifySender.java 19 Aug 2002 18:57:07 -0000 1.7
+++ NotifySender.java 23 Aug 2002 08:00:29 -0000 1.8
@@ -86,6 +86,7 @@
try {
attachStackTrace = new Boolean(getInitParameter("attachStackTrace")).booleanValue();
} catch (Exception e) {
+ // Ignore exception, default to false
}
}
1.5 +14 -1 jakarta-james/src/java/org/apache/james/transport/mailets/ToProcessor.java
Index: ToProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/ToProcessor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ToProcessor.java 19 Aug 2002 18:57:07 -0000 1.4
+++ ToProcessor.java 23 Aug 2002 08:00:29 -0000 1.5
@@ -27,9 +27,22 @@
* @author Serge Knystautas <se...@lokitech.com>
*/
public class ToProcessor extends GenericMailet {
+
+ /**
+ * The name of the processor to which this mailet forwards mail
+ */
String processor;
+
+ /**
+ * The error message to attach to the forwarded message
+ */
String noticeText = null;
+ /**
+ * Initialize the mailet
+ *
+ * @throws MailetException if the processor parameter is missing
+ */
public void init() throws MailetException {
processor = getInitParameter("processor");
if (processor == null) {
@@ -39,7 +52,7 @@
}
/**
- * Throw an exception if any mail is processed.
+ * Deliver a mail to the processor.
*
* @param mail the mail to process
*
1.7 +3 -2 jakarta-james/src/java/org/apache/james/transport/mailets/ToRepository.java
Index: ToRepository.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/ToRepository.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ToRepository.java 19 Aug 2002 18:57:07 -0000 1.6
+++ ToRepository.java 23 Aug 2002 08:00:29 -0000 1.7
@@ -53,6 +53,7 @@
try {
passThrough = new Boolean(getInitParameter("passThrough")).booleanValue();
} catch (Exception e) {
+ // Ignore exception, default to false
}
ComponentManager compMgr = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
1.8 +23 -18 jakarta-james/src/java/org/apache/james/userrepository/UsersFileRepository.java
Index: UsersFileRepository.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/userrepository/UsersFileRepository.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- UsersFileRepository.java 17 Aug 2002 18:33:28 -0000 1.7
+++ UsersFileRepository.java 23 Aug 2002 08:00:29 -0000 1.8
@@ -45,6 +45,11 @@
extends AbstractLogEnabled
implements UsersRepository, Component, Configurable, Composable, Initializable {
+ /**
+ * Whether 'deep debugging' is turned on.
+ *
+ * TODO: Shouldn't this be false by default?
+ */
protected static boolean DEEP_DEBUG = true;
/** @deprecated what was this for? */
@@ -55,22 +60,6 @@
private String destination;
/**
- * 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 {
-
- destination = configuration.getChild( "destination" ).getAttribute( "URL" );
-
- if (!destination.endsWith(File.separator)) {
- destination += File.separator;
- }
- }
-
- /**
* 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.
@@ -89,6 +78,22 @@
final String message = "Failed to retrieve Store component:" + e.getMessage();
getLogger().error( message, e );
throw new ComponentException( message, e );
+ }
+ }
+
+ /**
+ * 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 {
+
+ destination = configuration.getChild( "destination" ).getAttribute( "URL" );
+
+ if (!destination.endsWith(File.separator)) {
+ destination += File.separator;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>