aboutsummaryrefslogtreecommitdiff
path: root/textproc/jaxup
diff options
context:
space:
mode:
authorHerve Quiroz <hq@FreeBSD.org>2004-11-17 16:54:29 +0000
committerHerve Quiroz <hq@FreeBSD.org>2004-11-17 16:54:29 +0000
commit6ef2256b14e6e3b1e90b2dd4b1b4335fc4362df7 (patch)
treee5dbf4d0d206d8e7cb93e0f68c6ddcbb48fbcebd /textproc/jaxup
parentcae1d33e56ee9bb19faaf4ee6e9e5d7670197857 (diff)
downloadports-6ef2256b14e6e3b1e90b2dd4b1b4335fc4362df7.tar.gz
ports-6ef2256b14e6e3b1e90b2dd4b1b4335fc4362df7.zip
Notes
Diffstat (limited to 'textproc/jaxup')
-rw-r--r--textproc/jaxup/Makefile27
-rw-r--r--textproc/jaxup/files/DOMXUpdater.java52
-rw-r--r--textproc/jaxup/files/jaxup-xupdater.sh5
3 files changed, 81 insertions, 3 deletions
diff --git a/textproc/jaxup/Makefile b/textproc/jaxup/Makefile
index f0370d779ef8..c21006e6d046 100644
--- a/textproc/jaxup/Makefile
+++ b/textproc/jaxup/Makefile
@@ -6,6 +6,7 @@
PORTNAME= jaxup
PORTVERSION= 1.01
+PORTREVISION= 1
CATEGORIES= textproc java
MASTER_SITES= http://klomp.org/jaxup/
DISTNAME= ${PORTNAME}-${PORTVERSION}-src
@@ -13,9 +14,11 @@ DISTNAME= ${PORTNAME}-${PORTVERSION}-src
MAINTAINER= hq@FreeBSD.org
COMMENT= Java XUpdate engine
+BUILD_DEPENDS= classpath:${PORTSDIR}/java/javavmwrapper
RUN_DEPENDS= ${JAVALIBDIR}/jdom.jar:${PORTSDIR}/java/jdom \
${JAVALIBDIR}/jaxen-core.jar:${PORTSDIR}/java/jaxen \
- ${JAVALIBDIR}/xercesImpl.jar:${PORTSDIR}/textproc/xerces-j
+ ${JAVALIBDIR}/xercesImpl.jar:${PORTSDIR}/textproc/xerces-j \
+ java:${PORTSDIR}/java/javavmwrapper
USE_ZIP= yes
WRKSRC= ${WRKDIR}/${PORTNAME}
@@ -23,13 +26,17 @@ WRKSRC= ${WRKDIR}/${PORTNAME}
USE_JAVA= yes
JAVA_VERSION= 1.3+
+DATADIR= ${JAVASHAREDIR}/${PORTNAME}
+
USE_ANT= yes
ALL_TARGET= jar
.if !defined(NOPORTDOCS)
ALL_TARGET+= docs
.endif
-PLIST_FILES+= %%JAVAJARDIR%%/${PORTNAME}.jar
+PLIST_FILES+= %%DATADIR%%/jaxup-xupdater.jar bin/jaxup-xupdater \
+ %%JAVAJARDIR%%/${PORTNAME}.jar
+PLIST_DIRS= %%DATADIR%%
.if !defined(NOPORTDOCS)
PORTDOCS= LICENSE.txt api index.html jaxup_files xupdate-wd.html xupdate-wd_files
@@ -37,12 +44,26 @@ PORTDOCS= LICENSE.txt api index.html jaxup_files xupdate-wd.html xupdate-wd_file
post-extract:
@${CP} ${FILESDIR}/build.xml ${WRKSRC}/
+ @${CP} ${FILESDIR}/DOMXUpdater.java ${WRKDIR}/
+ @${SED} -e 's,%%LOCALBASE%%,${LOCALBASE},g ; s,%%DATADIR%%,${DATADIR},g' \
+ ${FILESDIR}/jaxup-xupdater.sh >${WRKDIR}/jaxup-xupdater
+
+post-build:
+ @${ECHO_MSG} ">> Building utility classes..."
+ cd ${WRKDIR} && ${JAVAC} -classpath "`${LOCALBASE}/bin/classpath`:${WRKSRC}/build/lib/jaxup.jar" DOMXUpdater.java
+ ${ECHO_CMD} "Main-Class: DOMXUpdater" >${WRKDIR}/MANIFEST
+ cd ${WRKDIR} && ${JAR} -cmf MANIFEST jaxup-xupdater.jar DOMXUpdater.class
do-install:
- @${ECHO_MSG} -n ">> Installing JAR files as ${JAVAJARDIR}/${PORTNAME}.jar..."
+ @${ECHO_MSG} -n ">> Installing JAR file as ${JAVAJARDIR}/${PORTNAME}.jar..."
@${MKDIR} ${JAVAJARDIR}
@${INSTALL_DATA} ${WRKSRC}/build/lib/${PORTNAME}.jar ${JAVAJARDIR}/
@${ECHO_MSG} " [ DONE ]"
+ @${ECHO_MSG} ">> Installing utility scripts and classes..."
+ ${MKDIR} ${DATADIR}
+ ${INSTALL_DATA} ${WRKDIR}/jaxup-xupdater.jar ${DATADIR}/
+ ${INSTALL_SCRIPT} ${WRKDIR}/jaxup-xupdater ${PREFIX}/bin/
+ @${ECHO_MSG} " [ DONE ]"
.if !defined(NOPORTDOCS)
@${ECHO_MSG} -n ">> Installing documentation in ${DOCSDIR}..."
@${MKDIR} ${DOCSDIR}
diff --git a/textproc/jaxup/files/DOMXUpdater.java b/textproc/jaxup/files/DOMXUpdater.java
new file mode 100644
index 000000000000..ebafa3735c4d
--- /dev/null
+++ b/textproc/jaxup/files/DOMXUpdater.java
@@ -0,0 +1,52 @@
+/**
+ * DOMXUpdater: a command-line XUpdate processor.
+ *
+ * $FreeBSD$
+ */
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.jaxen.dom.DocumentNavigator;
+import org.jaxup.dom.DOMDocumentUpdater;
+import org.jaxup.xupdate.XUpdate;
+import org.w3c.dom.Document;
+
+public class DOMXUpdater
+{
+ public static void main(String[] args)
+ {
+ if (args.length != 2)
+ {
+ System.out.println("usage: DOMXUpdater <source document url> <XUpdate document url>");
+ System.exit(1);
+ }
+
+ try
+ {
+ DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder=factory.newDocumentBuilder();
+
+ Document doc=builder.parse(args[0]);
+ Document updateDoc=builder.parse(args[1]);
+
+ XUpdate updater=new XUpdate(new DOMDocumentUpdater(), DocumentNavigator.getInstance());
+ updater.runUpdate(doc, updateDoc.getDocumentElement());
+
+ OutputFormat o=new OutputFormat("xml", "ISO-8859-1", true);
+ o.setIndenting(true);
+ o.setIndent(2);
+ o.setPreserveSpace(true);
+ XMLSerializer serial=new XMLSerializer(System.out, o);
+ serial.serialize(doc);
+ System.out.println();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/textproc/jaxup/files/jaxup-xupdater.sh b/textproc/jaxup/files/jaxup-xupdater.sh
new file mode 100644
index 000000000000..aabc8ca05828
--- /dev/null
+++ b/textproc/jaxup/files/jaxup-xupdater.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+JAVA_VERSION="1.3+" %%LOCALBASE%%/bin/java -cp "`"%%LOCALBASE%%/bin/classpath"`:%%DATADIR%%/jaxup-xupdater.jar" "DOMXUpdater" "$@"