private void installRuleBaseElement(File artifact) throws RuleBaseException, IOException, SAXException, ParserConfigurationException { RuleBaseElementId id = getIdforFile(artifact); String code = FileUtils.readFileToString(artifact); ruleManager.addOrUpdate(id, code); if (id.getType().equals(RuleBaseElementType.Process)) { cache.put(artifact.getName(), id); } LOGGER.info("Successfully installed workflow file \"{}\"", artifact.getName()); }
public RuleBaseElement(RuleBaseElementId id) { name = id.getName(); packageName = id.getPackageName(); type = id.getType(); }
@Override public void add(RuleBaseElementId name, String code) throws RuleBaseException { getRessourceHandler(name.getType()).create(name, code); }
@Override public String get(RuleBaseElementId name) { return getRessourceHandler(name.getType()).get(name); }
@Override public void update(RuleBaseElementId name, String newCode) throws RuleBaseException { getRessourceHandler(name.getType()).update(name, newCode); }
@Override public void delete(RuleBaseElementId name) throws RuleBaseException { getRessourceHandler(name.getType()).delete(name); }
@Override public void update(File artifact) throws Exception { LOGGER.debug("WorkflowDeployer.update(\"{}\")", artifact.getAbsolutePath()); try { RuleBaseElementId id = getIdforFile(artifact); String code = FileUtils.readFileToString(artifact); boolean changed = false; if (id.getType().equals(RuleBaseElementType.Process)) { RuleBaseElementId cachedId = cache.get(artifact.getName()); if (!id.equals(cachedId)) { ruleManager.delete(cachedId); changed = true; } } ruleManager.addOrUpdate(id, code); if (changed) { cache.put(artifact.getName(), id); } } catch (Exception e) { LOGGER.error(e.getMessage()); throw e; } LOGGER.info("Successfully updated workflow file \"{}\"", artifact.getName()); }
private void doUninstall(File artifact) throws Exception { RuleBaseElementType type = getTypeFromFile(artifact); if (type != null) { RuleBaseElementId id = getIdforFile(artifact); if (id.getType().equals(RuleBaseElementType.Process)) { id = cache.remove(artifact.getName()); } ruleManager.delete(id); return; } String extension = FilenameUtils.getExtension(artifact.getName()); if (IMPORT_ENDING.equals(extension)) { unInstallImportFile(artifact); } else if (GLOBAL_ENDING.equals(extension)) { unInstallGlobalFile(artifact); } }