public XProcStep newStep(XProcRuntime runtime,XAtomicStep step){ Class<?> klass = implementations.get(step.getType()); if (klass == null) { throw new XProcException("Misconfigured. No 'class' in configuration for " + step.getType()); } String className = klass.getName(); // FIXME: This isn't really very secure... if (runtime.getSafeMode() && !className.startsWith("com.xmlcalabash.")) { throw XProcException.dynamicError(21); } try { Constructor<? extends XProcStep> constructor = Class.forName(className).asSubclass(XProcStep.class).getConstructor(XProcRuntime.class, XAtomicStep.class); return constructor.newInstance(runtime,step); } catch (NoSuchMethodException nsme) { throw new UnsupportedOperationException("No such method: " + className, nsme); } catch (ClassNotFoundException cfne) { throw new UnsupportedOperationException("Class not found: " + className, cfne); } catch (InstantiationException ie) { throw new UnsupportedOperationException("Instantiation error", ie); } catch (IllegalAccessException iae) { throw new UnsupportedOperationException("Illegal access error", iae); } catch (InvocationTargetException ite) { throw new UnsupportedOperationException("Invocation target exception", ite); } }
public XProcStep newStep(XProcRuntime runtime,XAtomicStep step){ Class<?> klass = implementations.get(step.getType()); if (klass == null) { throw new XProcException("Misconfigured. No 'class' in configuration for " + step.getType()); } String className = klass.getName(); // FIXME: This isn't really very secure... if (runtime.getSafeMode() && !className.startsWith("com.xmlcalabash.")) { throw XProcException.dynamicError(21); } try { Constructor<? extends XProcStep> constructor = Class.forName(className).asSubclass(XProcStep.class).getConstructor(XProcRuntime.class, XAtomicStep.class); return constructor.newInstance(runtime,step); } catch (NoSuchMethodException nsme) { throw new UnsupportedOperationException("No such method: " + className, nsme); } catch (ClassNotFoundException cfne) { throw new UnsupportedOperationException("Class not found: " + className, cfne); } catch (InstantiationException ie) { throw new UnsupportedOperationException("Instantiation error", ie); } catch (IllegalAccessException iae) { throw new UnsupportedOperationException("Illegal access error", iae); } catch (InvocationTargetException ite) { throw new UnsupportedOperationException("Invocation target exception", ite); } }
public XdmNode loadDocument(Load load) { boolean validate = load.getOption(_dtd_validate, false); RuntimeValue href = load.getOption(_href); String base = href.getBaseURI().toASCIIString(); if (runtime.getSafeMode() && base.startsWith("file:")) { throw XProcException.dynamicError(21); } return runtime.parse(href.getString(), base, validate); }
public XdmNode loadDocument(Load load) { boolean validate = load.getOption(_dtd_validate, false); RuntimeValue href = load.getOption(_href); String base = href.getBaseURI().toASCIIString(); if (runtime.getSafeMode() && base.startsWith("file:")) { throw XProcException.dynamicError(21); } return runtime.parse(href.getString(), base, validate); }
public synchronized DataStore getDataStore() { if (dataStore == null) { DataStore fallback = new URLDataStore(new FallbackDataStore()); if (!getSafeMode()) { fallback = new FileDataStore(fallback); } dataStore = new HttpClientDataStore(getHttpClient(), fallback); } return dataStore; }
public synchronized DataStore getDataStore() { if (dataStore == null) { DataStore fallback = new URLDataStore(new FallbackDataStore()); if (!getSafeMode()) { fallback = new FileDataStore(fallback); } dataStore = new HttpClientDataStore(getHttpClient(), fallback); } return dataStore; }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } boolean failOnError = getOption(_fail_on_error, true); RuntimeValue href = getOption(_href); URI sourceUri= href.getBaseURI().resolve(href.getString()); href = getOption(_target); URI destUri = href.getBaseURI().resolve(href.getString()); File target=this.getFile(destUri,sourceUri); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(target.toURI().toASCIIString()); this.copy(sourceUri,target); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } boolean recursive = getOption(_recursive, false); boolean fail_on_error = getOption(_fail_on_error, true); RuntimeValue href = getOption(_href); String base = href.getBaseURI().toASCIIString(); URI uri = href.getBaseURI().resolve(href.getString()); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); performDelete(href, base, recursive, fail_on_error); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } boolean recursive = getOption(_recursive, false); boolean fail_on_error = getOption(_fail_on_error, true); RuntimeValue href = getOption(_href); String base = href.getBaseURI().toASCIIString(); URI uri = href.getBaseURI().resolve(href.getString()); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); tree.addText(uri.toASCIIString()); performDelete(href, base, recursive, fail_on_error); tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } RuntimeValue href = getOption(_href); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); try { DataStore store = runtime.getDataStore(); URI uri = store.createList(href.getString(), href.getBaseURI().toASCIIString()); tree.addText(uri.toASCIIString()); } catch (FileNotFoundException e) { throw new XProcException(step.getNode(), "Cannot mkdir: file exists: " + href.getString()); } catch (IOException e) { throw new XProcException(step.getNode(), "Mkdir failed for: " + href.getString()); } tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21); } RuntimeValue href = getOption(_href); TreeWriter tree = new TreeWriter(runtime); tree.startDocument(step.getNode().getBaseURI()); tree.addStartElement(XProcConstants.c_result); tree.startContent(); try { DataStore store = runtime.getDataStore(); URI uri = store.createList(href.getString(), href.getBaseURI().toASCIIString()); tree.addText(uri.toASCIIString()); } catch (FileNotFoundException e) { throw new XProcException(step.getNode(), "Cannot mkdir: file exists: " + href.getString()); } catch (IOException e) { throw new XProcException(step.getNode(), "Mkdir failed for: " + href.getString()); } tree.addEndElement(); tree.endDocument(); result.write(tree.getResult()); } }
public void run() throws SaxonApiException { super.run(); if (runtime.getSafeMode()) { throw XProcException.dynamicError(21);