public void initScope(Context context, Scriptable scope) { for (ButterflyModule m : _dependencies.values()) { m.initScope(context, scope); } OrderedMapIterator i = _scripts.orderedMapIterator(); while (i.hasNext()) { URL url = (URL) i.next(); _logger.debug("Executing script: {}", url); Script s = (Script) _scripts.get(url); s.exec(context, scope); } }
public void loadRuleBase(){ log.debug("LOADRULEBASE == "+name); ArrayList<Element> dsElements = new ArrayList<Element>(); if (itemList != null){ OrderedMapIterator iter = itemList.orderedMapIterator(); while (iter.hasNext()) { String key = (String) iter.next(); //returns the key not the value. Needed to advance the iterator FlowSheetItem fsi = (FlowSheetItem) iter.getValue(); List<Recommendation> rules = fsi.getRecommendations(); if (rules !=null){ log.debug("# OF RULES FOR "+fsi.getItemName()+" "+rules.size()+" key "+key); for (Object obj: rules){ Recommendation rec = (Recommendation) obj; dsElements.add(rec.getRuleBaseElement()); } }else{ log.debug("NO RULES FOR "+fsi.getItemName()); } } } log.debug("LOADING RULES2"+name+" size + "+dsElements.size()+" rulebase "+ruleBase); if (dsElements != null && dsElements.size() > 0){ log.debug("LOADING RULES21"+dsElements.size()); RuleBaseCreator rcb = new RuleBaseCreator(); try{ log.debug("LOADING RULES22"); ruleBase = rcb.getRuleBase("rulesetName", dsElements); log.debug("LOADING RULES23"); rulesLoaded = true; }catch(Exception e){ log.debug("LOADING EXEPTION"); MiscUtils.getLogger().error("Error", e); } }else{ //empty } }