From: Kal A. <ka...@te...> - 2005-05-19 07:31:42
|
Hello again, I've checked in the source code with just a couple of minor changes 1) I changed the package to org.tm4j.ant.dbtasks...I'm not sure that I like the package name that much, but it was the best I could come up with, and it keeps the org.tm4j.ant package as a simple container for all Ant related stuff as subpackages 2) I've added the TM4J standard header with an acknowledgement to Peter. Great stuff! I guess I need to start thinking about really making that 1.0 release soon ;-) Cheers, Kal Kal Ahmed wrote: > Hi Peter, > > This stuff looks great! It would be really useful for doing scripted > maintenance / update tasks on topic maps. I'm going to check this > stuff in to the tree as soon as I get a chance to build it locally > (might not be until this evening). > > Thanks very much! > > Kal > > Peter Klotz wrote: > >> Hi, >> >> TM4j has already today one file-oriented topicmap merge task but I >> needed some more tasks especially some that manipulate topicmaps in >> the provider. I would like to donate this back the TM4J project as >> more people might be interested in these. Would somebody with >> committer rights please have a look at the tasks and integrate them >> into the CVS? >> >> All tasks work the same, a dburl must be specified for either a Ozone >> or Hibernate persistence backend as all tasks work on a provider not >> in memory. Topicmaps are referenced by a uri attribute. >> The following tasks are included: >> >> <antlib> >> <typedef name="create" classname="org.tm4j.ant.CreateTopicMap"/> >> <typedef name="exist" classname="org.tm4j.ant.ExistTopicMap"/> >> <typedef name="export" classname="org.tm4j.ant.ExportTopicMap"/> >> <typedef name="load" classname="org.tm4j.ant.LoadTopicMap"/> >> <typedef name="merge" classname="org.tm4j.ant.MergeTopicMap"/> >> <typedef name="remove" classname="org.tm4j.ant.RemoveTopicMap"/> >> <typedef name="list" classname="org.tm4j.ant.ListTopicMap"/> >> <typedef name="topic" classname="org.tm4j.ant.CreateTopic"/> >> <typedef name="association" >> classname="org.tm4j.ant.CreateAssociation"/> >> <typedef name="occurrence" classname="org.tm4j.ant.CreateOccurrence"/> >> <typedef name="rmtopic" classname="org.tm4j.ant.RemoveTopic"/> >> </antlib> >> >> I use the technique of antlib and namespaces as one can see in the >> included test build.xml. >> >> <?xml version="1.0"?> >> <project name="TM4J" default="usage" xmlns:tm="http://tm4j.org/ant"> >> >> ^^^^^^^^^^^^ >> <description> >> test case for tm4j ant tasks >> </description> >> ... >> <typedef resource="org/tm4j/ant/antlib.xml" uri="http://tm4j.org/ant"> >> ^^^^^^^^^^^^^^ >> ^^^^^^^^^^^^ >> <classpath> >> ... >> </classpath> >> </typedef> >> >> I put the tasks into the package org.tm4j.ant not .taskdefs in order >> to keep them separate from the still needed file-oriented merge task, >> but this can be changed of course. >> >> Regards, Peter >> >> ------------------------------------------------------------------------ >> >> <?xml version="1.0"?> >> <project name="TM4J" default="usage" xmlns:tm="http://tm4j.org/ant"> >> <description> >> test case for tm4j ant tasks >> </description> >> >> <property name="dir.base" value="../.."/> >> <property name="dir.build" value="${dir.base}/build"/> >> <property name="dir.lib" value="${dir.base}/lib"/> >> >> <tstamp/> >> <typedef resource="org/tm4j/ant/antlib.xml" uri="http://tm4j.org/ant"> >> <classpath> >> <fileset dir="${dir.build}/lib"> >> <include name="tm4*-${DSTAMP}.jar"/> >> </fileset> >> <fileset dir="${dir.lib}"> >> <include name="*.jar"/> >> </fileset> >> <fileset dir="${dir.lib}/ozone"> >> <include name="*.jar"/> >> </fileset> >> <fileset dir="${dir.lib}/hibernate"> >> <include name="*.jar"/> >> </fileset> >> </classpath> >> </typedef> >> >> <property name="dir.dest" value="."/> >> <property name="dir.src" value="../topicmaps"/> >> <property name="dir.res" value="../../resource/tests"/> >> >> <!-- >> - all the provider-oriented ant tasks need a DB URL >> - either ozone or hibernate, memory does not really make sense >> --> >> <property name="tm.dburl" value="ozonedb:remote://localhost:3333"/> >> <property name="tm.uri" >> value="http://www.tm4j.org/examples/topicmaps/kings_and_queens.xtm"/> >> >> <target name="test"> >> <antcall target="new"/> >> <antcall target="create"/> >> <antcall target="exist"/> >> <antcall target="load"/> >> <antcall target="export"/> >> <antcall target="list"/> >> <antcall target="merge"/> >> <antcall target="remove"/> >> </target> >> >> <!-- create a fresh new topicmap --> >> <target name="new" description="new topicmap"> >> <tm:create dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm"/> >> </target> >> >> <!-- create topics, occurrences and associations in topicmap --> >> <target name="create" description="create topics in topicmap"> >> <tm:topic dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="type1" >> name="atype"/> >> <tm:topic dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="topic1" >> name="aname"/> >> <tm:topic dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="topic2" >> name="anothername" type="atype"/> >> <tm:occurrence dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="topic1" >> occurrence="occ1" data="data in attribute"/> >> <tm:occurrence dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="topic1" >> occurrence="occ2" dataUri="http://www.tm4j.org"/> >> <tm:occurrence dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="topic1" >> occurrence="occ3">data as CDATA</tm:occurrence> >> <tm:topic dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="type2" >> name="aassoctype"/> >> <tm:association dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="assoc1" >> type="type2" roleType1="type1" rolePlayer1="topic1" roleType2="type1" >> rolePlayer2="topic2"/> >> </target> >> >> <!-- check for existence of topicmap --> >> <condition property="tm.exist"> >> <tm:exist dburl="${tm.dburl}" uri="${tm.uri}"/> >> </condition> >> <target name="exist" description="check existence of topicmap" >> if="tm.exist"> >> <echo message="topicmap exists"/> >> </target> >> >> <!-- load a topicmap from a XTM file --> >> <target name="load" description="load topicmap"> >> <tm:load dburl="${tm.dburl}" uri="${tm.uri}" >> srcfile="${dir.src}/kings_and_queens.xtm"/> >> <tm:load dburl="${tm.dburl}"> >> <fileset dir="${dir.res}"> >> <include name="simpsons.xtm"/> >> <include name="blockworld.xtm"/> >> </fileset> >> </tm:load> >> </target> >> >> <!-- export/dump a topicmap to a XTM file --> >> <target name="export" description="export topicmap"> >> <tm:export dburl="${tm.dburl}" uri="${tm.uri}" >> destFile="${dir.dest}/topicmap.xtm"/> >> <tm:export dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" >> destFile="${dir.dest}/test.xtm"/> >> </target> >> >> <!-- list available topicmaps --> >> <target name="list" description="list topicmaps"> >> <tm:list dburl="${tm.dburl}" outputproperty="topicmaps"/> >> <echo message="Available topicmaps: ${topicmaps}"/> >> </target> >> >> <!-- merge two topicmaps --> >> <target name="merge" description="merge topicmap"> >> <tm:load dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/merge.xtm" >> srcfile="${dir.res}/merge1.xml"/> >> <tm:merge dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/merge.xtm" >> srcfile="${dir.res}/merge2.xml"/> >> <tm:export dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/merge.xtm" >> destFile="${dir.dest}/merge.xtm"/> >> </target> >> >> <!-- remove topicmap --> >> <target name="remove" description="remove topicmap"> >> <tm:topic dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm" topic="assoc1"/> >> <tm:remove dburl="${tm.dburl}" uri="${tm.uri}"/> >> <tm:remove dburl="${tm.dburl}" >> uri="http://www.tm4j.org/examples/topicmaps/test.xtm"/> >> </target> >> </project> >> >> >> > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users > > |