/** * A tool method : builds the coder loader from its configuration file. */ public static XmlCoderLoader buildCoderLoader (final String pathToCoderConf) throws ServiceException { final XmlCoderLoader cl = new XmlCoderLoader(); final java.util.Map clParams = new java.util.HashMap(); clParams.put(XmlCoderLoader.CONFIGURATION_FILE, pathToCoderConf); cl.init ("coderLoader", new ApplicationContext(), clParams); return cl; }
protected void loadConfigurationFile (final String fileName) throws ServiceException { if (this.map == null) this.map = new java.util.HashMap(); try { log.info("loadConfigurationFile() raw "+fileName); final String fn = FileUtils.expandUrl(fileName); log.info("loadConfigurationFile() "+fn); final org.jdom.Element root = XmlUtils.extractXml(fn, false); java.util.Iterator it = root.getChildren("workitem-coder").iterator(); while (it.hasNext()) { buildCoderConfiguration((org.jdom.Element)it.next()); } } catch (ServiceException se) { throw se; } catch (Exception e) { throw new ServiceException ("Failed to build AttributeCoder list "+ "from file '"+fileName+"'", e); } }
public void init (final String serviceName, final ApplicationContext context, final java.util.Map serviceParams) throws ServiceException { super.init(serviceName, context, serviceParams); Object oConf = serviceParams.get(CONFIGURATION_FILE); if (oConf == null) { throw new ServiceException ("parameter "+CONFIGURATION_FILE+ "' is mandatory for service "+getName()+ " ("+this.getClass().getName()+")"); } log.debug("init() oConf is instance of "+oConf.getClass().getName()); java.util.List confFileNames = null; if (oConf instanceof java.util.List) { java.util.Iterator it = ((java.util.List)oConf).iterator(); while (it.hasNext()) loadConfigurationFile((String)it.next()); } else { loadConfigurationFile((String)oConf); } }
.buildCoderLoader("etc/engine/coder-configuration.xml"); final XmlWorkItemCoder wic = (XmlWorkItemCoder)cl.getXmlCoder();
buildAttributeCoder(workItemCoder, (org.jdom.Element)it.next());
final XmlCoderLoader coderLoader = new XmlCoderLoader(); final java.util.Map clParams = new java.util.HashMap(1); clParams.put(coderLoader.CONFIGURATION_FILE, "resource:/coder-configuration.xml"); coderLoader.init (Definitions.S_WORKITEM_CODER_LOADER, this.applicationContext,
final XmlCoderLoader coderLoader = new XmlCoderLoader(); coderLoader.init (Definitions.S_WORKITEM_CODER_LOADER, ac, clParams);