[larm-cvs] larm/src/java/larm/sources SourceManager.java,NONE,1.1
Brought to you by:
cmarschner,
otis
From: <ot...@us...> - 2003-07-29 15:11:44
|
Update of /cvsroot/larm/larm/src/java/larm/sources In directory sc8-pr-cvs1:/tmp/cvs-serv23925/src/java/larm/sources Added Files: SourceManager.java Log Message: - Big bad update, reorganization, etc. --- NEW FILE: SourceManager.java --- package larm.sources; import java.util.HashMap; import java.util.Iterator; import java.util.logging.Logger; import larm.framework.Context; import larm.framework.Contextualizable; import larm.framework.Lifecycle; import larm.framework.Startable; import larm.framework.config.ConfigList; import larm.framework.config.Configurable; import larm.framework.config.Configuration; import larm.framework.sources.Source; /** * SourceManager * * @author * @version $Id: SourceManager.java,v 1.1 2003/07/29 15:11:41 otis Exp $ */ public class SourceManager implements Configurable, Startable, Contextualizable { static Logger log = Logger.getLogger(SourceManager.class.getName()); HashMap sources = new HashMap(); public SourceManager() { } /* (non-Javadoc) * @see larm.config.Configurable#configure(larm.config.Configuration) */ public void configure(Configuration conf) { try { log.info("configuring SourceManager"); ConfigList list = conf.getSubConfigList("source"); for (int i = 0; i < list.length(); i++) { Configuration c = list.item(i); String type = c.getProperty("@type"); String name = c.getProperty("@name"); log.info("found source of type " + type + " with name " + name); Class clazz = Class.forName(type); Source p = (Source)clazz.newInstance(); Lifecycle.configure(p, c); sources.put(name, p); } if (list.length() == 0) { log.info("no pipelines to register"); } } catch(InstantiationException e) { } catch(ClassNotFoundException e) { } catch(IllegalAccessException e) { } } /* (non-Javadoc) * @see larm.framework.Startable#start() */ public void start() { for (Iterator it = sources.values().iterator(); it.hasNext();) { Lifecycle.start(it.next()); } } /** * @see larm.framework.Contextualizable#contextualize(larm.framework.Context) */ public void contextualize(Context ctx) { } } |