Fields Summary |
---|
private boolean | authRequiredWhether authentication is required to access this NNTP server |
private org.apache.james.nntpserver.repository.NNTPRepository | repoThe repository that stores the news articles for this NNTP server. |
private org.apache.james.services.UsersRepository | userRepositoryThe repository that stores the local users. Used for authentication. |
private org.apache.avalon.excalibur.pool.Pool | theHandlerPoolThe pool used to provide NNTP Handler objects |
private org.apache.avalon.excalibur.pool.ObjectFactory | theHandlerFactoryThe pool used to provide NNTP Handler objects |
private org.apache.james.util.watchdog.WatchdogFactory | theWatchdogFactoryThe factory used to generate Watchdog objects |
private NNTPHandlerConfigurationData | 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");
authRequired =
handlerConfiguration.getChild("authRequired").getValueAsBoolean(false);
if (getLogger().isDebugEnabled()) {
if (authRequired) {
getLogger().debug("NNTP Server requires authentication.");
} else {
getLogger().debug("NNTP Server doesn't require authentication.");
}
}
}
|
protected int | getDefaultPort()
return 119;
|
public java.lang.String | getServiceType()
return "NNTP 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 NNTP 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 NNTP 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()
NNTPHandler theHandler = (NNTPHandler)theHandlerPool.get();
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 NNTPHandler)) {
throw new IllegalArgumentException("Attempted to return non-NNTPHandler to pool.");
}
theHandlerPool.put((Poolable)connectionHandler);
|
public void | service(org.apache.avalon.framework.service.ServiceManager componentManager)
super.service(componentManager);
userRepository = (UsersRepository)componentManager.lookup(UsersRepository.ROLE);
repo = (NNTPRepository)componentManager
.lookup("org.apache.james.nntpserver.repository.NNTPRepository");
|