/** @see org.apache.avalon.framework.activity.Initializable#initialize() */
  public void initialize() throws Exception {
    super.initialize();
    if (!isEnabled()) {
      return;
    }

    if (connectionLimit != null) {
      theHandlerPool =
          new HardResourceLimitingPool(theHandlerFactory, 5, connectionLimit.intValue());
      getLogger()
          .debug(
              "Using a bounded pool for RemoteManager handlers with upper limit "
                  + connectionLimit.intValue());
    } else {
      // NOTE: The maximum here is not a real maximum.  The handler pool will continue to
      //       provide handlers beyond this value.
      theHandlerPool = new DefaultPool(theHandlerFactory, null, 5, 30);
      getLogger().debug("Using an unbounded pool for RemoteManager handlers.");
    }
    if (theHandlerPool instanceof LogEnabled) {
      ((LogEnabled) theHandlerPool).enableLogging(getLogger());
    }
    if (theHandlerPool instanceof Initializable) {
      ((Initializable) theHandlerPool).initialize();
    }

    theWatchdogFactory = getWatchdogFactory();
  }
 /** @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager) */
 public void service(final ServiceManager componentManager) throws ServiceException {
   super.service(componentManager);
   mailServer = (MailServer) componentManager.lookup(MailServer.ROLE);
   usersStore = (UsersStore) componentManager.lookup(UsersStore.ROLE);
   users = (UsersRepository) componentManager.lookup(UsersRepository.ROLE);
   if (users == null) {
     throw new ServiceException("", "The user repository could not be found.");
   }
 }
  /** @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration) */
  public void configure(final Configuration configuration) throws ConfigurationException {

    super.configure(configuration);
    if (isEnabled()) {
      Configuration handlerConfiguration = configuration.getChild("handler");
      Configuration admin = handlerConfiguration.getChild("administrator_accounts");
      Configuration[] accounts = admin.getChildren("account");
      for (int i = 0; i < accounts.length; i++) {
        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 += " ";
    }
  }