/** * Create from a spring resource. * * @param res * the spring resource * @return the paxml resource */ public static PaxmlResource createFromResource(Resource res) { URL url; try { url = res.getURL(); } catch (IOException e) { throw new PaxmlRuntimeException("Cannot create paxmlResource from spring resource: " + res, e); } return createFromPath(url.toString()); }
/** * Create from a spring resource. * * @param res * the spring resource * @return the paxml resource */ public static PaxmlResource createFromResource(Resource res) { URL url; try { url = res.getURL(); } catch (IOException e) { throw new PaxmlRuntimeException("Cannot create paxmlResource from spring resource: " + res, e); } return createFromPath(url.toString()); }
private void buildResources(OMElement root, boolean detach) { for (OMElement ele : AxiomUtils.getElements(root, "resource")) { ResourceMatcher matcher = parseIncludeAndExclude(ele); Set<PaxmlResource> include = new LinkedHashSet<PaxmlResource>(0); Set<PaxmlResource> exclude = new LinkedHashSet<PaxmlResource>(0); for (String pattern : matcher.include) { include.addAll(ResourceLocator.findResources(pattern, planFile)); } for (String pattern : matcher.exclude) { exclude.addAll(ResourceLocator.findResources(pattern, planFile)); } include.removeAll(exclude); final PaxmlResource planFileResource; try { planFileResource = PaxmlResource.createFromPath(planFile.getURI().toString()); } catch (IOException e) { throw new PaxmlRuntimeException(e); } include.remove(planFileResource); model.getConfig().getResources().addAll(include); if (detach) { ele.detach(); } } }
private void buildResources(OMElement root, boolean detach) { for (OMElement ele : AxiomUtils.getElements(root, "resource")) { ResourceMatcher matcher = parseIncludeAndExclude(ele); Set<PaxmlResource> include = new LinkedHashSet<PaxmlResource>(0); Set<PaxmlResource> exclude = new LinkedHashSet<PaxmlResource>(0); for (String pattern : matcher.include) { include.addAll(ResourceLocator.findResources(pattern, planFile)); } for (String pattern : matcher.exclude) { exclude.addAll(ResourceLocator.findResources(pattern, planFile)); } include.removeAll(exclude); final PaxmlResource planFileResource; try { planFileResource = PaxmlResource.createFromPath(planFile.getURI().toString()); } catch (IOException e) { throw new PaxmlRuntimeException(e); } include.remove(planFileResource); model.getConfig().getResources().addAll(include); if (detach) { ele.detach(); } } }
private Plan processPlan(OMElement root, Properties props) { final Paxml paxml = new Paxml(0); paxml.addStaticConfig(model.getConfig()); // add the plan tag lib temporarily paxml.getParser().addTagLibrary(new PlanTagLibrary(), false); final PaxmlResource planFileResource; try { planFileResource = PaxmlResource.createFromPath(planFile.getURI().toString()); } catch (IOException e) { throw new PaxmlRuntimeException(e); } // add resource for execution paxml.addResources(planFileResource); IEntity entity = paxml.getParser().parseXml(root, planFileResource, null); if (entity == null) { throw new PaxmlRuntimeException("Internal error: should not be null!"); } props.put(LaunchModel.class, model); paxml.execute(entity, System.getProperties(), props); Plan plan = (Plan) entity; return plan; }
private Plan processPlan(OMElement root, Properties props) { final long pid = LaunchModel.generateNextPid(); model.setPlanProcessId(pid); final Paxml paxml = new Paxml(pid, PaxmlUtils.getNextExecutionId()); paxml.addStaticConfig(model.getConfig()); // add the plan tag lib temporarily paxml.getParser().addTagLibrary(new PlanTagLibrary(), false); final PaxmlResource planFileResource; try { planFileResource = PaxmlResource.createFromPath(planFile.getURI().toString()); } catch (IOException e) { throw new PaxmlRuntimeException(e); } // add resource for execution paxml.addResources(planFileResource); IEntity entity = paxml.getParser().parseXml(root, planFileResource, null); if (entity == null) { throw new PaxmlRuntimeException("Internal error: should not be null!"); } props.put(LaunchModel.class, model); paxml.execute(entity, System.getProperties(), props); Plan plan = (Plan) entity; return plan; }