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 hb...@apache.org on 2001/04/29 09:42:32 UTC

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

hbedi       01/04/29 00:42:32

  Modified:    src/org/apache/james Constants.java
  Added:       src/org/apache/james BaseConnectionHandler.java
  Log:
  The Hello Name(greeting) is obtained from the configuration file.
  james/BaseConnectionHandler handles the hello name and other
  ConnectionHandlers derive from it.
  
  Revision  Changes    Path
  1.5       +1 -1      jakarta-james/src/org/apache/james/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/org/apache/james/Constants.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Constants.java	2001/03/13 06:00:28	1.4
  +++ Constants.java	2001/04/29 07:42:32	1.5
  @@ -13,7 +13,7 @@
    */
   public class Constants {
   
  -    public static final String SOFTWARE_VERSION = "@@version@@";
  +    public static final String SOFTWARE_VERSION = "1.2.2alpha";
   
       public static final String SOFTWARE_NAME = "JAMES Mail Server";
   
  
  
  
  1.1                  jakarta-james/src/org/apache/james/BaseConnectionHandler.java
  
  Index: BaseConnectionHandler.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.james;
  
  import java.io.*;
  import java.net.*;
  import java.text.*;
  import java.util.*;
  import javax.mail.internet.*;
  import org.apache.avalon.framework.logger.AbstractLoggable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  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.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
  import org.apache.avalon.cornerstone.services.scheduler.PeriodicTimeTrigger;
  import org.apache.avalon.cornerstone.services.scheduler.Target;
  import org.apache.avalon.cornerstone.services.scheduler.TimeScheduler;
  import org.apache.james.AccessControlException;
  import org.apache.james.AuthenticationException;
  import org.apache.james.AuthorizationException;
  import org.apache.james.Constants;
  import org.apache.james.services.*;
  import org.apache.james.util.InternetPrintWriter;
  import org.apache.log.LogKit;
  import org.apache.log.Logger;
  
  /**
   * Different connection handlers extend this class
   * Common Connection Handler code could be factored into this class.
   * At present(April 28' 2001) there is not much in this class
   */
  public class BaseConnectionHandler extends AbstractLoggable implements Configurable {
      protected int timeout;
      protected String helloName = null;
  
      public void configure( final Configuration configuration )
          throws ConfigurationException {
  
          timeout = configuration.getChild( "connectiontimeout" ).getValueAsInteger( 1800000 );
          if ( helloName == null ) {
              String hostName = null;
              try {
                  hostName = InetAddress.getLocalHost().getHostName();
              } catch  (UnknownHostException ue) {
                  hostName = "localhost";
              }
  
              Configuration helloConf = configuration.getChild("helloName");
              if (helloConf.getAttribute("autodetect").equals("TRUE")) {
                  helloName = hostName;
              } else {
                  helloName = helloConf.getValue("localhost");
              }
              getLogger().info("Hello Name is: " + helloName);
          }
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org