Browse files

Merge pull request #136 from shabanovd/develop

Remove xmlcalabash module.
  • Loading branch information...
2 parents 8ed0246 + 68e432a commit 0e85e25eb36d273dc5ee997e7c389be0f1277dfb @wolfgangmm wolfgangmm committed Jan 30, 2014
View
1 conf.xml.tmpl
@@ -865,7 +865,6 @@
<module uri="http://exist-db.org/xquery/versioning/svn" class="org.exist.versioning.svn.xquery.SVNModule" />
<module uri="http://exist-db.org/xquery/xmldiff" class="org.exist.xquery.modules.xmldiff.XmlDiffModule" />
<module uri="http://exist-db.org/xquery/xmpp" class="org.exist.xquery.modules.xmpp.XMPPModule" />
- <module uri="http://xmlcalabash.com" class="org.exist.xquery.modules.xmlcalabash.XMLCalabashModule" />
-->
<!--
View
27 extensions/modules/build.xml
@@ -35,10 +35,6 @@
</and>
</condition>
- <condition property="libs.available.calabash">
- <available file="${modules.lib}/calabash.jar"/>
- </condition>
-
<condition property="include.module.oracle_ext">
<and>
<istrue value="${include.module.oracle}"/>
@@ -130,23 +126,6 @@
</target>
<!--
- Special targets for xmlcalabash module
- -->
- <target name="prepare-xmlcalabash"
- unless="libs.available.calabash" if="${include.module.xmlcalabash}" >
- <echo message="------------------------------------------------------"/>
- <echo message="Downloading libraries required by the xmlcalabash module"/>
- <echo message="------------------------------------------------------"/>
- <echo message="Calabash: ${libs.available.calabash}"/>
- <fetch classpathref="classpath.core" dest="${modules.lib}"
- url="${include.module.xmlcalabash.url}">
- <patternset>
- <include name="**/calabash.jar"/>
- </patternset>
- </fetch>
- </target>
-
- <!--
Special targets for simpleql module
-->
<uptodate property="parser.uptodate" srcfile="${src}/org/exist/xquery/modules/simpleql/SimpleQLParser.g"
@@ -243,7 +222,7 @@
<ivy:retrieve xmlns:ivy="antlib:org.apache.ivy.ant" sync="false"/>
</target>
- <target name="prepare" depends="prepare-ivy,prepare-xslfo,prepare-simpleql,prepare-jfreechart,prepare-memcached,prepare-xmpp,prepare-xmlcalabash,prepare-expathrepo,prepare-cqlparser">
+ <target name="prepare" depends="prepare-ivy,prepare-xslfo,prepare-simpleql,prepare-jfreechart,prepare-memcached,prepare-xmpp,prepare-expathrepo,prepare-cqlparser">
<mkdir dir="${classes}"/>
</target>
@@ -286,7 +265,6 @@
<exclude name="org/exist/xquery/modules/xmldiff/**" unless="${include.module.xmldiff}"/>
<exclude name="org/exist/xquery/modules/xmpp/**" unless="${include.module.xmpp}"/>
<exclude name="org/exist/xquery/modules/xslfo/**" unless="${include.module.xslfo}"/>
- <exclude name="org/exist/xquery/modules/xmlcalabash/**" unless="${include.module.xmlcalabash}"/>
<exclude name="org/exist/xquery/modules/expathrepo/**" unless="${include.module.expathrepo}"/>
<exclude name="org/exist/xquery/modules/process/**" unless="${include.module.process}"/>
<exclude name="org/exist/xquery/modules/persistentlogin/**" unless="${include.module.persistentlogin}"/>
@@ -311,8 +289,5 @@
</target>
<target name="clean-all">
- <delete file="${modules.lib}/calabash.jar" failonerror="false"/>
</target>
-
-
</project>
View
112 extensions/modules/src/org/exist/xquery/modules/xmlcalabash/ProcessFunction.java
@@ -1,112 +0,0 @@
-package org.exist.xquery.modules.xmlcalabash;
-
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.StringReader;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.log4j.Logger;
-import org.exist.Namespaces;
-import org.exist.dom.QName;
-import org.exist.memtree.DocumentImpl;
-import org.exist.memtree.SAXAdapter;
-import org.exist.xquery.BasicFunction;
-import org.exist.xquery.Cardinality;
-import org.exist.xquery.FunctionSignature;
-import org.exist.xquery.XPathException;
-import org.exist.xquery.XQueryContext;
-import org.exist.xquery.value.FunctionParameterSequenceType;
-import org.exist.xquery.value.FunctionReturnSequenceType;
-import org.exist.xquery.value.Sequence;
-import org.exist.xquery.value.SequenceType;
-import org.exist.xquery.value.Type;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-import com.xmlcalabash.core.XProcRuntime;
-
-public class ProcessFunction extends BasicFunction {
-
- @SuppressWarnings("unused")
- private final static Logger logger = Logger.getLogger(ProcessFunction.class);
-
- private XProcRuntime runtime = null;
-
- String outputResult;
-
- public final static FunctionSignature signature =
- new FunctionSignature(
- new QName("process", XMLCalabashModule.NAMESPACE_URI, XMLCalabashModule.PREFIX),
- "Function which invokes xmlcalabash XProc processor.",
- new SequenceType[] {
- new FunctionParameterSequenceType("pipeline", Type.STRING, Cardinality.EXACTLY_ONE, "XProc Pipeline"),
- new FunctionParameterSequenceType("output", Type.STRING, Cardinality.EXACTLY_ONE, "Output result")
- },
- new FunctionReturnSequenceType(Type.ITEM, Cardinality.ZERO_OR_ONE, "return type"));
-
- public ProcessFunction(XQueryContext context) {
- super(context, signature);
- }
-
- public Sequence eval(Sequence[] args, Sequence contextSequence)
- throws XPathException {
-
- if (args[0].isEmpty()) {
- return Sequence.EMPTY_SEQUENCE;
- }
-
- String pipelineURI = args[0].getStringValue();
- String outputURI = args[1].getStringValue();
-
- try {
-
- String[] calabash_args = {"-oresult="+outputURI,pipelineURI};
-
- PrintStream stdout = System.out;
-
- com.xmlcalabash.drivers.Main main = new com.xmlcalabash.drivers.Main();
-
- ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
- System.setOut(new PrintStream(byteStream, true));
- main.run(calabash_args);
- outputResult = byteStream.toString();
- System.setOut(stdout);
-
- } catch (Exception e) {
- System.err.println(e);
- }
-
- StringReader reader = new StringReader(outputResult);
- try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setNamespaceAware(true);
- InputSource src = new InputSource(reader);
-
- XMLReader xr = null;
-
- if (xr == null) {
- SAXParser parser = factory.newSAXParser();
- xr = parser.getXMLReader();
- }
-
- SAXAdapter adapter = new SAXAdapter(context);
- xr.setContentHandler(adapter);
- xr.setProperty(Namespaces.SAX_LEXICAL_HANDLER, adapter);
- xr.parse(src);
-
- return (DocumentImpl) adapter.getDocument();
- } catch (ParserConfigurationException e) {
- throw new XPathException(this, "Error while constructing XML parser: " + e.getMessage(), e);
- } catch (SAXException e) {
- throw new XPathException(this, "Error while parsing XML: " + e.getMessage(), e);
- } catch (IOException e) {
- throw new XPathException(this, "Error while parsing XML: " + e.getMessage(), e);
- }
-
- }
-}
View
39 extensions/modules/src/org/exist/xquery/modules/xmlcalabash/XMLCalabashModule.java
@@ -1,39 +0,0 @@
-package org.exist.xquery.modules.xmlcalabash;
-
-import java.util.List;
-import java.util.Map;
-import org.exist.xquery.AbstractInternalModule;
-import org.exist.xquery.FunctionDef;
-
-public class XMLCalabashModule extends AbstractInternalModule {
-
- public final static String NAMESPACE_URI = "http://xmlcalabash.com";
- public final static String PREFIX = "xmlcalabash";
- public final static String INCLUSION_DATE = "2010-27-04";
- public final static String RELEASED_IN_VERSION = "eXist-1.5";
-
- private final static FunctionDef[] functions = {
- new FunctionDef(ProcessFunction.signature, ProcessFunction.class)
- };
-
- public XMLCalabashModule(Map<String, List<? extends Object>> parameters) {
- super(functions, parameters);
- }
-
- public String getNamespaceURI() {
- return NAMESPACE_URI;
- }
-
- public String getDefaultPrefix() {
- return PREFIX;
- }
-
- public String getDescription() {
- return "A module for performing XML Calabash XProc processing";
- }
-
- public String getReleaseVersion() {
- return RELEASED_IN_VERSION;
- }
-
-}
View
64 extensions/modules/src/org/exist/xquery/modules/xmlcalabash/readme.txt
@@ -1,64 +0,0 @@
------
-Build
------
-
-This module relies on the presence of the following jar files in your $EXIST_HOME/extensions/modules/lib folder:
-
- calabash.jar
-
-If you are building from source then the module build process will try and download
-these files for you if you enable the module.
-
-Please read XML Calabash documentation for information on other dependencies related to using specific
-optional XProc steps.
-
-To build set in local.build.properties:
-
- include.module.xmlcalabash = true
-
-To use xmlcalabash uncomment in conf.xml
-
- <module class="org.exist.xquery.modules.xmlcalabash.XMLCalabashModule"
- uri="http://xmlcalabash.com" />
-
-This has been tested with XML Calabash v1.0.9
-
-
------
-Usage
------
-
-upload an XProc pipeline somewhere into eXist (ex. /db/test/hello.xproc)
-
-<?xml version="1.0"?>
-<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc">
- <p:input port="source">
- <p:inline><doc>Helloworld</doc></p:inline>
- </p:input>
- <p:output port="result"/>
- <p:identity/>
-</p:declare-step>
-
-
-invoke using xmlcalabash:process (in sandbox for example)
-
-let $result := xmlcalabash:process("xmldb:exist:///db/test/hello.xproc","-")
-return
- $result
-
-
-------
-Status
-------
-
-Currently there are a few limitations with this extension
-
-* func signature will change soon to accept xml for pipeline, output, as well as specify input/output/parameter ports and options ... for now its primitive
-
-* p:xquery has no context with eXist ... this is a big limitation, but there are several ways around this
-
-* use xmldb:exist type URI
-
-* no documentation, will probably add to existing XProc area
-
-I wanted to 'throw over the wall' the draft version of this extension so I can get feedback now.

0 comments on commit 0e85e25

Please sign in to comment.