Permalink
Browse files

New project! Let XQuery evaluate Java code within the MarkLogic envir…

…onment.

-jh-


git-svn-id: http://developer.marklogic.com/svn/mljam/trunk@452 e04f4502-82db-0310-b1af-f799f365da79
  • Loading branch information...
0 parents commit d33134fc0dc179b52e407435749b191ea37dd546 @hunterhacker hunterhacker committed May 10, 2006
Showing with 4,803 additions and 0 deletions.
  1. +17 −0 LICENSE.txt
  2. +48 −0 README.txt
  3. +186 −0 build.xml
  4. +678 −0 client/jam.xqy
  5. +3 −0 server/META-INF/context.xml
  6. +192 −0 server/MLJAM.iml
  7. +204 −0 server/MLJAM.ipr
  8. +578 −0 server/MLJAM.iws
  9. +43 −0 server/WEB-INF/web.xml
  10. BIN server/lib/bsh-2.0b4.jar
  11. +46 −0 server/lib/bsh.LICENSE.txt
  12. BIN server/lib/commons-codec-1.3.jar
  13. +202 −0 server/lib/commons-codec.LICENSE.txt
  14. BIN server/lib/jaxen-core.jar
  15. BIN server/lib/jaxen-jdom.jar
  16. +42 −0 server/lib/jaxen.LICENSE.txt
  17. +93 −0 server/lib/jaxen.README.txt
  18. BIN server/lib/jdom-1.0.jar
  19. +56 −0 server/lib/jdom.LICENSE.txt
  20. +1 −0 server/lib/saxpath.LICENSE.txt
  21. BIN server/lib/saxpath.jar
  22. BIN server/lib/servlet-api.jar
  23. +35 −0 server/src/com/xqdev/jam/Log.java
  24. +711 −0 server/src/com/xqdev/jam/MLJAM.java
  25. +376 −0 test/jamtest.xqy
  26. +471 −0 utils/jam-utils.xqy
  27. +12 −0 utils/lib/README.txt
  28. BIN utils/lib/avalon-framework-4.2.0.jar
  29. +175 −0 utils/lib/avalon-framework.LICENSE.txt
  30. +11 −0 utils/lib/avalon-framework.NOTICE.TXT
  31. BIN utils/lib/commons-io-1.1.jar
  32. +203 −0 utils/lib/commons-io.LICENSE.txt
  33. +3 −0 utils/lib/commons-io.NOTICE.txt
  34. BIN utils/lib/fop-0.92.jar
  35. +202 −0 utils/lib/fop.LICENSE.txt
  36. +7 −0 utils/lib/fop.NOTICE.txt
  37. BIN utils/lib/metadata-extractor-2.3.1.jar
  38. +4 −0 utils/lib/metadata-extractor.LICENSE.txt
  39. BIN utils/lib/xmlgraphics-commons-1.0.jar
  40. +202 −0 utils/lib/xmlgraphics-commons.LICENSE.txt
  41. +2 −0 utils/lib/xmlgraphics-commons.NOTICE.txt
@@ -0,0 +1,17 @@
+Copyright 2006 Jason Hunter and Ryan Grimm
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+The use of the Apache License does not indicate that this project is
+affiliated with the Apache Software Foundation.
+
@@ -0,0 +1,48 @@
+MLJAM is an open source library that enables the evaluation of Java code from
+the MarkLogic Server environment. MLJAM gives XQuery programs access to the
+vast libraries and extensive capabilities of Java, without any difficult glue
+coding. Example uses for MLJAM:
+
+* Extracting image metadata
+* Resizing and reformatting an image
+* Running an XSLT transformation
+* Generating a PDF from XSL-FO
+* Calculating an MD5 hash
+* Interfacting into a user authentication system
+* Accessing a credit card purchasing system
+* Connecting to a secure HTTPS web site
+* Re-encoding content as UTF-8
+
+The MLJAM Tutorial has more information:
+http://xqzone.marklogic.com/howto/tutorials/2006-05-mljam.xqy
+
+
+Source Components
+-----------------
+
+The "client" directory holds the jam.xqy library module. That's the only file
+needed from XQuery.
+
+The "server" directory holds the servlet with which the XQuery communicates.
+The Java code is straightforward: it listens for requests from the XQuery
+client, transmits the request to a BeanShell interpreter held within, and
+returns any result to the XQuery client.
+
+The "utils" directory holds jam-utils.xqy, containing utility functions for
+PDF generation using Apache FOP, image resizing and conversion, image metadata
+extraction, MD5 hashing, and XSLT transformation. The "utils/lib" directory
+holds JARs needed by the server to support the jam-utils.xqy client.
+
+
+Building
+--------
+
+Just run "ant". It produces zip files under the "distribution" directory and
+a "buildtmp" support directory.
+
+
+Installation
+------------
+
+The tutorial above explains the basic steps of an install.
+
@@ -0,0 +1,186 @@
+<!--
+/*
+ * Copyright 2006 Jason Hunter and Ryan Grimm
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * The use of the Apache License does not indicate that this project is
+ * affiliated with the Apache Software Foundation.
+ */
+-->
+
+<project name="mljam" default="all" basedir=".">
+
+ <property name="product.name" value="mljam"/>
+ <property name="release.version" value="1.0"/>
+
+ <!-- Static definitions of where things are relative to the root -->
+ <property name="java.source" value="server/src"/>
+ <property name="doc.source" value="."/>
+ <property name="buildtmp" value="buildtmp"/>
+ <property name="compiled.classes.dir" value="${buildtmp}/classes"/>
+<!--
+ <property name="generated.files" value="${buildtmp}/generated"/>
+-->
+ <property name="javadoc.dir" value="${buildtmp}/mljam/javadocs"/>
+ <property name="web.dir" value="${buildtmp}/mljam/WEB-INF"/>
+ <property name="weblib.dir" value="${buildtmp}/mljam/WEB-INF/lib"/>
+
+ <property name="web.files" value="server/WEB-INF"/>
+ <property name="xqy.files" value="client"/>
+
+ <property name="utils.dir" value="utils"/>
+ <property name="utils.lib.dir" value="utils/lib"/>
+
+ <!-- Jar files that are under source control in this tree -->
+ <property name="jarlib" value="server/lib"/>
+ <property name="bsh.jar" value="${jarlib}/bsh-2.0b4.jar"/>
+ <property name="commons-codec.jar" value="${jarlib}/commons-codec-1.3.jar"/>
+ <property name="jaxen-core.jar" value="${jarlib}/jaxen-core.jar"/>
+ <property name="jaxen-jdom.jar" value="${jarlib}/jaxen-jdom.jar"/>
+ <property name="jdom.jar" value="${jarlib}/jdom-1.0.jar"/>
+ <property name="saxpath.jar" value="${jarlib}/saxpath.jar"/>
+ <property name="servlet-api.jar" value="${jarlib}/servlet-api.jar"/>
+
+ <!-- Intermediate generated files -->
+<!--
+ <property name="javadoc.zipfile" value="${generated.files}/${product.name}-api.zip"/>
+-->
+ <property name="code.output.jar" value="${weblib.dir}/${product.name}.jar"/>
+
+ <!-- Products of this build -->
+ <property name="products" value="deliverable"/>
+ <property name="release.bundle" value="${products}/${product.name}-${release.version}.zip"/>
+ <property name="source.bundle" value="${products}/${product.name}-src-${release.version}.zip"/>
+
+ <!-- Configurable flags that will affect how targets run -->
+ <property name="compile.debug.symbols.flag" value="on"/> <!-- on | off -->
+ <property name="junit.halt.on.error" value="off"/> <!-- on | off -->
+ <property name="junit.disabled" value="true"/> <!-- true | false -->
+
+ <!-- ********************************************************** -->
+
+
+ <target name="init">
+ <mkdir dir="${buildtmp}"/>
+ <mkdir dir="${compiled.classes.dir}"/>
+<!--
+ <mkdir dir="${generated.files}"/>
+-->
+ <mkdir dir="${web.dir}"/>
+ <mkdir dir="${weblib.dir}"/>
+ <mkdir dir="${products}"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${buildtmp}"/>
+ </target>
+
+ <target name="cleanest" depends="clean">
+ <delete dir="${products}"/>
+ </target>
+
+ <!-- ********************************************************** -->
+
+ <path id="code.compile.classpath">
+ <pathelement path="${bsh.jar}"/>
+ <pathelement path="${commons-codec.jar}"/>
+ <pathelement path="${jaxen-core.jar}"/>
+ <pathelement path="${jaxen-jdom.jar}"/>
+ <pathelement path="${jdom.jar}"/>
+ <pathelement path="${saxpath.jar}"/>
+ <pathelement path="${servlet-api.jar}"/>
+ <pathelement path="${compiled.classes.dir}"/>
+ </path>
+
+ <target name="compile.code" depends="init">
+ <javac classpathref="code.compile.classpath" srcdir="${java.source}"
+ destdir="${compiled.classes.dir}" deprecation="on"
+ debug="${compile.debug.symbols.flag}" />
+ </target>
+
+ <target name="generate.code.jar" depends="compile.code">
+ <jar jarfile="${code.output.jar}">
+ <fileset dir="${compiled.classes.dir}">
+ <exclude name="**/Test*.class"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="code" depends="generate.code.jar"/>
+
+ <target name="web">
+ <copy todir="${web.dir}">
+ <fileset dir="${web.files}"/>
+ </copy>
+ <copy todir="${weblib.dir}">
+ <fileset dir="${jarlib}">
+ <exclude name="**/servlet-api.jar"/>
+ </fileset>
+ <fileset dir="${utils.lib.dir}"/>
+ </copy>
+ </target>
+
+ <!-- ********************************************************** -->
+
+ <target name="javadoc" depends="code">
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc sourcepath="${java.source}" destdir="${javadoc.dir}" packagenames="*"
+ author="true" version="true" windowtitle="MLJAM">
+
+ <classpath refid="code.compile.classpath"/>
+ <doctitle><![CDATA[<h1>MLJAM Web Service</h1>]]></doctitle>
+ <bottom><![CDATA[<i>Copyright &copy; 2006 Jason Hunter and Ryan Grimm, Licensed Under Apache 2.0</i>]]></bottom>
+ </javadoc>
+
+ <!--
+ <zip zipfile="${javadoc.zipfile}" basedir="${javadoc.dir}"/>
+ -->
+ </target>
+
+ <!-- ********************************************************** -->
+
+ <target name="binarybundle" depends="init,code,web"> <!-- removed javadoc -->
+ <zip zipfile="${release.bundle}">
+ <fileset file="README.txt"/>
+ <fileset file="LICENSE.txt"/>
+ <fileset dir="${buildtmp}">
+ <include name="mljam/**"/>
+ </fileset>
+ <fileset dir="${xqy.files}"/>
+ <fileset dir="${utils.dir}">
+ <include name="*.xqy"/>
+ </fileset>
+ </zip>
+ </target>
+
+ <target name="srcbundle">
+ <zip zipfile="${source.bundle}">
+ <fileset file="build.xml"/>
+ <fileset file="README.txt"/>
+ <fileset file="LICENSE.txt"/>
+ <fileset dir=".">
+ <include name="client/**"/>
+ <include name="server/**"/>
+ <include name="utils/**"/>
+ <include name="test/**"/>
+ </fileset>
+ </zip>
+ </target>
+
+ <!-- ********************************************************** -->
+
+ <target name="all" depends="binarybundle,srcbundle">
+ </target>
+
+</project>
Oops, something went wrong.

0 comments on commit d33134f

Please sign in to comment.