Fields Summary |
---|
private HashMap | adminAccountsA HashMap of (user id, passwords) for James administrators |
private org.apache.james.services.UsersStore | usersStoreThe UsersStore that contains all UsersRepositories managed by this RemoteManager |
private org.apache.james.services.UsersRepository | usersThe current UsersRepository being managed/viewed/modified |
private String | promptThe service prompt to be displayed when waiting for input. |
private org.apache.james.services.MailServer | mailServerThe reference to the internal MailServer service |
private org.apache.avalon.excalibur.pool.Pool | theHandlerPoolThe pool used to provide RemoteManager Handler objects |
private org.apache.avalon.excalibur.pool.ObjectFactory | theHandlerFactoryThe pool used to provide RemoteManager Handler objects |
private org.apache.james.util.watchdog.WatchdogFactory | theWatchdogFactoryThe factory used to generate Watchdog objects |
private RemoteManagerHandlerConfigurationData | theConfigDataThe configuration data to be passed to the handler |
Methods Summary |
---|
public void | configure(org.apache.avalon.framework.configuration.Configuration configuration)
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 += " ";
}
|
protected int | getDefaultPort()
return 4555;
|
public java.lang.String | getServiceType()
return "Remote Manager Service";
|
public void | initialize()
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();
|
protected org.apache.avalon.cornerstone.services.connection.ConnectionHandler | newHandler()
RemoteManagerHandler theHandler = (RemoteManagerHandler)theHandlerPool.get();
theHandler.enableLogging(getLogger());
Watchdog theWatchdog = theWatchdogFactory.getWatchdog(theHandler.getWatchdogTarget());
theHandler.setConfigurationData(theConfigData);
theHandler.setWatchdog(theWatchdog);
return theHandler;
|
public void | releaseConnectionHandler(org.apache.avalon.cornerstone.services.connection.ConnectionHandler connectionHandler)
if (!(connectionHandler instanceof RemoteManagerHandler)) {
throw new IllegalArgumentException("Attempted to return non-RemoteManagerHandler to pool.");
}
theHandlerPool.put((Poolable)connectionHandler);
|
public void | service(org.apache.avalon.framework.service.ServiceManager componentManager)
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.");
}
|