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:32:38 UTC

cvs commit: jakarta-james/src/java/org/apache/james BaseConnectionHandler.java Constants.java James.java Main.java

pgoldstein    2002/08/18 00:32:38

  Modified:    src/java/org/apache/james BaseConnectionHandler.java
                        Constants.java James.java Main.java
  Log:
  Added comments.
  Fixed a minor threading bug.
  Removed a few unused and undocumented constants.
  
  Revision  Changes    Path
  1.9       +6 -0      jakarta-james/src/java/org/apache/james/BaseConnectionHandler.java
  
  Index: BaseConnectionHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/BaseConnectionHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BaseConnectionHandler.java	17 Apr 2002 02:56:31 -0000	1.8
  +++ BaseConnectionHandler.java	18 Aug 2002 07:32:38 -0000	1.9
  @@ -27,6 +27,12 @@
       protected int timeout;
       protected String helloName;
   
  +    /**
  +     * 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 {
   
  
  
  
  1.5       +21 -9     jakarta-james/src/java/org/apache/james/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/Constants.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Constants.java	25 Sep 2001 04:51:19 -0000	1.4
  +++ Constants.java	18 Aug 2002 07:32:38 -0000	1.5
  @@ -19,21 +19,33 @@
    */
   public class Constants {
   
  +    /**
  +     * The version of James.
  +     */
       public static final String SOFTWARE_VERSION = "@@VERSION@@";
   
  +    /**
  +     * The name of the software (i.e. James).
  +     */
       public static final String SOFTWARE_NAME = "@@NAME@@";
   
  +    /**
  +     * Context key used to store the list of mail domains being
  +     * serviced by this James instance in the context.
  +     */
       public static final String SERVER_NAMES = "SERVER_NAMES";
   
  -    public static final String SPOOL_REPOSITORY = "SPOOL_REPOSITORY";
  -
  -    public static final String LOCAL_USERS = "LOCAL_USERS";
  -
  +    /**
  +     * Context key used to store the postmaster address for
  +     * this James instance in the context.
  +     */
       public static final String POSTMASTER = "POSTMASTER";
   
  -    public static final int HEADERLIMIT = 2048;
  -
  +    /**
  +     * Key used to store the component manager for
  +     * this James instance in a way accessible by
  +     * Avalon aware Mailets.
  +     */
       public static final String AVALON_COMPONENT_MANAGER = "AVALON_COMP_MGR";
   
  -    public static final String BUILD_DATE = "@@DATE@@";
   }
  
  
  
  1.26      +57 -6     jakarta-james/src/java/org/apache/james/James.java
  
  Index: James.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/James.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- James.java	15 Aug 2002 07:07:21 -0000	1.25
  +++ James.java	18 Aug 2002 07:32:38 -0000	1.26
  @@ -77,36 +77,83 @@
       private String inboxRootURL;
       private UsersRepository localusers;
       private Collection serverNames;
  +
  +    /**
  +     * Whether to ignore case when looking up user names on this server
  +     */
       private boolean ignoreCase;
  +
  +    /**
  +     * Whether to enable aliasing for users on this server
  +     */
       private boolean enableAliases;
  +
  +    /**
  +     * Whether to enable forwarding for users on this server
  +     */
       private boolean enableForwarding;
   
  -    // this used to be long, but increment operations on long are not
  -    // thread safe. Changed to int. 'int' should be ok, because id generation
  -    // is based on System time and count
  -    private static int count;
  +    /**
  +     * The number of mails generated.  Access needs to be synchronized for
  +     * thread safety and to ensure that all threads see the latest value.
  +     */
  +    private static long count;
       private MailAddress postmaster;
       private Map mailboxes; //Not to be shared!
  +
  +    /**
  +     * A hash table of server attributes
  +     */
       private Hashtable attributes = new Hashtable();
   
  +    /**
  +     * The Avalon context used by the instance
  +     */
       protected Context           myContext;
   
  +    /**
  +     * Pass the Context to the component.
  +     * This method is called after the setLogger()
  +     * method and before any other method.
  +     *
  +     * @param context the context
  +     * @throws ContextException if context is invalid
  +     */
       public void contextualize(final Context context) {
           this.myContext = context;
       }
   
  +    /**
  +     * Pass the <code>Configuration</code> to the instance.
  +     *
  +     * @param configuration the class configurations.
  +     * @throws ConfigurationException if an error occurs
  +     */
       public void configure(Configuration conf) {
           this.conf = conf;
       }
   
       /**
  +     * 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(ComponentManager comp) {
           compMgr = new DefaultComponentManager(comp);
           mailboxes = new HashMap(31);
       }
   
  +    /**
  +     * 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("JAMES init...");
  @@ -319,6 +366,10 @@
       }
   
       public String getId() {
  +        long localCount = -1;
  +        synchronized (James.class) {
  +            localCount = count++;
  +        }
           StringBuffer idBuffer =
               new StringBuffer(64)
                       .append("Mail")
  
  
  
  1.2       +7 -1      jakarta-james/src/java/org/apache/james/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/Main.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Main.java	11 May 2001 10:36:17 -0000	1.1
  +++ Main.java	18 Aug 2002 07:32:38 -0000	1.2
  @@ -18,6 +18,12 @@
   
   public class Main {
   
  +    /**
  +     * Displays an error message indicating that James requires an Avalon framework
  +     * compatible container.
  +     *
  +     * @param args the command line arguments, ignored
  +     */
       public static void main(String[] args) {
   
           System.out.println("ERROR!");
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>