enabled = conf.getAttributeAsBoolean("enabled", false);
if (enabled)
{
scheduler = (TimeScheduler) m_manager.lookup(TimeScheduler.ROLE);
Configuration[] fetchConfs = conf.getChildren("fetch");
for (int i = 0; i < fetchConfs.length; i++)
{
FetchMail fetcher = new FetchMail();
Configuration fetchConf = fetchConfs[i];
String fetchTaskName = fetchConf.getAttribute("name");
ContainerUtil.enableLogging(fetcher,getLogger().getChildLogger(fetchTaskName));
ContainerUtil.service(fetcher,m_manager);
ContainerUtil.configure(fetcher,fetchConf);
Integer interval =
new Integer(fetchConf.getChild("interval").getValue());
PeriodicTimeTrigger fetchTrigger =
new PeriodicTimeTrigger(0, interval.intValue());
scheduler.addTrigger(fetchTaskName, fetchTrigger, fetcher);
theFetchTaskNames.add(fetchTaskName);
}
if (getLogger().isInfoEnabled())
getLogger().info("FetchMail Started");
System.out.println("FetchMail Started");
}
else
{
if (getLogger().isInfoEnabled())
getLogger().info("FetchMail Disabled");
System.out.println("FetchMail Disabled");
}