vgritsenko 02/03/08 22:27:16 Modified: . build.xml src/java/org/apache/cocoon/components/deli deli.xconf src/java/org/apache/cocoon/components/hsqldb hsqldb.xconf src/java/org/apache/cocoon/components/resolver resolver.xconf src/java/org/apache/cocoon/components/search lucene.xconf src/java/org/apache/cocoon/components/store jisp.xconf src/java/org/apache/cocoon/generation xmldb.xconf src/webapp cocoon.xconf sitemap.xmap tools/src XConfToolTask.java Added: src/java/org/apache/cocoon/components/search lucene.xpipe src/java/org/apache/cocoon/components/source xmldb.xpipe src/java/org/apache/cocoon/generation bsf.xmap php.xmap servlet.xmap tidy.xmap velocity.xmap xindice.xmap xmldb-generators.xpipe src/java/org/apache/cocoon/reading servlet.xmap src/java/org/apache/cocoon/samples/parentcm naming.xmap naming.xpipe src/java/org/apache/cocoon/transformation naming.xmap xt.xmap Removed: src/java/org/apache/cocoon/generation bsf.sitemap php.sitemap servlet.sitemap tidy.sitemap velocity.sitemap xindice.pipeline xindice.sitemap xmldb.pipeline src/java/org/apache/cocoon/reading servlet.sitemap src/java/org/apache/cocoon/samples/parentcm naming.pipeline naming.sitemap src/java/org/apache/cocoon/serialization HSSFSerializer.xconf fop.sitemap jfor.sitemap svg.sitemap src/java/org/apache/cocoon/transformation naming.sitemap xt.sitemap Log: rewrite xconf tool Revision Changes Path 1.180 +71 -85 xml-cocoon2/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/build.xml,v retrieving revision 1.179 retrieving revision 1.180 diff -u -r1.179 -r1.180 --- build.xml 7 Mar 2002 15:49:55 -0000 1.179 +++ build.xml 9 Mar 2002 06:27:15 -0000 1.180 @@ -385,10 +385,6 @@ property="servlet.present" classname="javax.servlet.http.HttpServlet"/> - <class-available classpathref="classpath" - property="servlet23.present" - classname="javax.servlet.http.HttpServletRequestWrapper"/> - <class-available classpathref="classpath" property="bsf.present" classname="com.ibm.bsf.BSFException"/> @@ -742,43 +738,43 @@ <exclude name="**/poi/**" unless="poi.present"/> <exclude name="**/HSSFSerializer.java" unless="poi.present"/> - <exclude name="**/HSSFSerializer.xconf" unless="poi.present"/> + <exclude name="**/poi.x*" unless="poi.present"/> <exclude name="**/POIFSSerializer.java" unless="poi.present"/> <exclude name="**/Pizza.java" unless="pizza.present"/> <exclude name="**/JSP*.java" unless="servlet.present"/> <exclude name="**/Jsp*.java" unless="servlet.present"/> - <exclude name="**/servlet.sitemap" unless="servlet.present"/> - <exclude name="**/components/deli/DeliImpl.java" unless="servlet.present"/> + <exclude name="**/servlet.x*" unless="servlet.present"/> + <exclude name="**/deli/DeliImpl.java" unless="servlet.present"/> <exclude name="**/servlet/*.java" unless="servlet.present"/> <exclude name="**/environment/http/*.java" unless="servlet.present"/> <exclude name="**/generation/StreamGenerator.java" unless="servlet.present"/> - <exclude name="**/ScriptAction.java" unless="bsf.present"/> - <exclude name="**/ScriptGenerator.java" unless="bsf.present"/> - <exclude name="**/bsf.sitemap" unless="bsf.present"/> + <exclude name="**/ScriptAction.java" unless="bsf.present"/> + <exclude name="**/ScriptGenerator.java" unless="bsf.present"/> + <exclude name="**/bsf.x*" unless="bsf.present"/> - <exclude name="**/components/deli/DeliImpl.java" unless="deli.present"/> - <exclude name="**/deli.xconf" unless="deli.present"/> + <exclude name="**/deli/DeliImpl.java" unless="deli.present"/> + <exclude name="**/deli.x*" unless="deli.present"/> - <exclude name="**/HTMLGenerator.java" unless="tidy.present"/> - <exclude name="**/tidy.sitemap" unless="tidy.present"/> + <exclude name="**/HTMLGenerator.java" unless="tidy.present"/> + <exclude name="**/tidy.x*" unless="tidy.present"/> <exclude name="**/VelocityGenerator.java" unless="velocity.present"/> - <exclude name="**/velocity.sitemap" unless="velocity.present"/> + <exclude name="**/velocity.x*" unless="velocity.present"/> <exclude name="**/SVG*.java" unless="svg.present"/> - <exclude name="**/svg.sitemap" unless="svg.present"/> + <exclude name="**/svg.x*" unless="svg.present"/> <exclude name="**/components/transcoder/**.java" unless="svg.present"/> <exclude name="**/components/url/Parsed**ProtocolHandler.java" unless="svg.present"/> - <exclude name="**/FOP*" unless="fop.present"/> - <exclude name="**/renderer/*" unless="fop.present"/> - <exclude name="**/fop.sitemap" unless="fop.present"/> + <exclude name="**/FOP*" unless="fop.present"/> + <exclude name="**/renderer/*" unless="fop.present"/> + <exclude name="**/fop.x*" unless="fop.present"/> - <exclude name="**/XT*.java" unless="xt.present"/> - <exclude name="**/xt.sitemap" unless="xt.present"/> + <exclude name="**/XT*.java" unless="xt.present"/> + <exclude name="**/xt.x*" unless="xt.present"/> <exclude name="**/CompiledJavascript*" unless="rhino.compiler.present"/> @@ -786,12 +782,12 @@ <exclude name="**/xsp/javascript/**" unless="rhino.interpreter.present"/> <exclude name="**/components/resolver/ResolverImpl.java" unless="resolver.present"/> - <exclude name="**/resolver.xconf" unless="resolver.present"/> + <exclude name="**/resolver.x*" unless="resolver.present"/> <exclude name="**/Jstyle*" unless="jstyle.present"/> <exclude name="**/Php*" unless="php.present"/> - <exclude name="**/php.sitemap" unless="php.present"/> + <exclude name="**/php.x*" unless="php.present"/> <exclude name="**/Ora*.java" unless="ora.driver.present"/> @@ -799,38 +795,33 @@ <exclude name="**/Sendmail*.java" unless="mail.present"/> - <exclude name="**/LDAPTransformer*.java" unless="naming.present"/> - <exclude name="**/samples/parentcm/*" unless="naming.present"/> - <exclude name="**/naming.sitemap" unless="naming.present"/> - <exclude name="**/naming.pipeline" unless="naming.present"/> - - <exclude name="**/JSPEngineImplWLS.java" unless="weblogic.present"/> - - <exclude name="**/XMLDB*.java" unless="xmldb.present"/> - <exclude name="**/xmldb.sitemap" unless="xmldb.present"/> - <exclude name="**/xmldb.pipeline" unless="xmldb.present"/> - <exclude name="**/xmldb.xconf" unless="xmldb.present"/> - - <exclude name="**/xindice.*" unless="xindice.present"/> + <exclude name="**/LDAPTransformer*" unless="naming.present"/> + <exclude name="**/samples/parentcm/*" unless="naming.present"/> + <exclude name="**/naming.x*" unless="naming.present"/> + + <exclude name="**/JSPEngineImplWLS.java" unless="weblogic.present"/> + + <exclude name="**/XMLDB*.java" unless="xmldb.present"/> + <exclude name="**/xmldb.x*" unless="xmldb.present"/> + <exclude name="**/xindice.x*" unless="xindice.present"/> - <exclude name="**/RTFSerializer.java" unless="jfor.present"/> - <exclude name="**/jfor.sitemap" unless="jfor.present"/> + <exclude name="**/RTFSerializer.java" unless="jfor.present"/> + <exclude name="**/jfor.x*" unless="jfor.present"/> <exclude name="**/xpath/XPathProcessorImpl*" unless="xpath.present"/> - - <exclude name="**/Jaxen*" unless="jaxen.present"/> + <exclude name="**/xpath/JaxenProcessorImpl*" unless="jaxen.present"/> <exclude name="**/components/hsqldb/ServerImpl.java" unless="hsqldb.present"/> - <exclude name="**/hsqldb.xconf" unless="hsqldb.present"/> + <exclude name="**/hsqldb.x*" unless="hsqldb.present"/> <exclude name="**/components/search/*" unless="lucene.present"/> <exclude name="**/generation/SearchGenerator.java" unless="lucene.present"/> - <exclude name="**/lucene.xconf" unless="lucene.present"/> + <exclude name="**/lucene.x*" unless="lucene.present"/> <exclude name="**/components/store/Jisp*.java" unless="jisp.present"/> - <exclude name="**/jisp.xconf" unless="jisp.present"/> - <exclude name="**/MaybeUpload*.java" unless="maybeupload.present"/> + <exclude name="**/jisp.x*" unless="jisp.present"/> + <exclude name="**/MaybeUpload*.java" unless="maybeupload.present"/> <exclude name="**/http/RequestWrapper*.java"/> <exclude name="**/browser/*.x*"/> </fileset> @@ -881,7 +872,6 @@ <include name="**/Manifest.mf"/> <include name="**/*.xsl"/> <include name="**/*.roles"/> - <include name="**/*.xconf"/> <include name="**/*.xml"/> <include name="META-INF/**"/> </fileset> @@ -904,7 +894,6 @@ <include name="**/Manifest.mf"/> <include name="**/*.xsl"/> <include name="**/*.roles"/> - <include name="**/*.xconf"/> <include name="META-INF/**"/> </fileset> </copy> @@ -945,7 +934,6 @@ <!-- Prepares the docs --> <!-- =================================================================== --> <target name="prepare-docs" depends="init"> - <mkdir dir="${build.context}"/> <mkdir dir="${build.context}/images"/> <mkdir dir="${build.docs}"/> @@ -971,15 +959,17 @@ <!-- Copy entity catalog and entities --> <copy todir="${build.context}/resources/entities" filtering="on"> - <fileset dir="${webapp.dir}/resources/entities"/> + <fileset dir="${webapp.dir}/resources/entities"> + <include name="**"/> + <exclude name="CatalogManager.properties"/> + </fileset> </copy> <mkdir dir="${build.context}/WEB-INF/classes"/> - <move todir="${build.context}/WEB-INF/classes"> - <fileset dir="${build.context}/resources/entities"> + <copy todir="${build.context}/WEB-INF/classes" filtering="on"> + <fileset dir="${webapp.dir}/resources/entities"> <include name="CatalogManager.properties"/> </fileset> - </move> - + </copy> </target> @@ -1028,7 +1018,6 @@ <pathelement location="${build.context}/WEB-INF/classes"/> </classpath> </java> - </target> <!-- =================================================================== --> @@ -1043,6 +1032,12 @@ <fileset dir="${build.src}" includes="org/apache/cocoon/samples/**"/> </copy> + <copy todir="${build.war}/WEB-INF/classes" filtering="on"> + <fileset dir="${webapp.dir}/resources/entities"> + <include name="CatalogManager.properties"/> + </fileset> + </copy> + <copy todir="${build.war}" filtering="on"> <fileset dir="${webapp.dir}"> <exclude name="**/*.gif"/> @@ -1050,6 +1045,7 @@ <exclude name="**/*.png"/> <exclude name="**/i18n/**"/> <exclude name="**/db/*"/> + <exclude name="**/CatalogManager.properties"/> </fileset> </copy> @@ -1071,52 +1067,46 @@ <!-- correct the image references --> <replace dir="${build.war}/documentation/svg" token="context://images" value="context://documentation/images"/> - </target> <!-- =================================================================== --> <!-- Prepares the webapp directories --> <!-- =================================================================== --> <target name="prepare-webapp" depends="copy-webapp"> - <!-- A task to change the sitemap. It is used to add optional components --> - <taskdef name="sitemap-tool" classname="SitemapToolTask" - classpath="${tools.dir}/anttasks"/> <!-- A task to change the xconf. It is used to add optional components --> <taskdef name="xconf-tool" classname="XConfToolTask" classpath="${tools.dir}/anttasks"/> - <taskdef name="manifest-tool" classname="ManifestToolTask" - classpath="${tools.dir}/anttasks"/> - - <!-- Invoke the SitemapToolTask to add optional entries --> - <sitemap-tool directory="${build.src}" - extension="sitemap" - pipelineExtension="pipeline" - sitemap="${build.war}/sitemap.xmap"/> - <!-- Invoke the XConfTool to add optional entries --> <xconf-tool directory="${build.src}" - extension="xconf" - configuration="${build.war}/cocoon.xconf"/> + extension="xmap" + configuration="${build.war}/sitemap.xmap"/> + + <xconf-tool directory="${build.src}" + extension="xpipe" + configuration="${build.war}/sitemap.xmap"/> + <xconf-tool directory="${build.src}" + extension="xconf" + configuration="${build.war}/cocoon.xconf"/> </target> <!-- =================================================================== --> <!-- Prepares the webapp directories for scratchpad --> <!-- =================================================================== --> <target name="prepare-webapp-scratchpad" depends="copy-webapp" if="include.scratchpad.libs"> - - <!-- Invoke the SitemapToolTask to add optional entries --> - <sitemap-tool directory="${build.scratchpad.src}" - extension="sitemap" - pipelineExtension="pipeline" - sitemap="${build.war}/sitemap.xmap"/> - <!-- Invoke the XConfTool to add optional entries --> <xconf-tool directory="${build.scratchpad.src}" - extension="xconf" - configuration="${build.war}/cocoon.xconf"/> + extension="xmap" + configuration="${build.war}/sitemap.xmap"/> + <xconf-tool directory="${build.scratchpad.src}" + extension="xpipe" + configuration="${build.war}/sitemap.xmap"/> + + <xconf-tool directory="${build.scratchpad.src}" + extension="xconf" + configuration="${build.war}/cocoon.xconf"/> </target> <!-- =================================================================== --> @@ -1156,14 +1146,6 @@ </fileset> </copy> - <mkdir dir="${build.war}/WEB-INF/classes"/> - - <move todir="${build.war}/WEB-INF/classes"> - <fileset dir="${build.war}/resources/entities"> - <include name="CatalogManager.properties"/> - </fileset> - </move> - <copy file="${build.dir}/${name}.jar" tofile="${build.war}/WEB-INF/lib/${name}-${version}.jar"/> </target> @@ -1193,6 +1175,10 @@ <!-- Creates the war file --> <!-- =================================================================== --> <target name="webapp" depends="prepare-webapp, prepare-webapp-scratchpad, prepare-webapp-libs, prepare-scratchpad-libs, prepare-xsp" description="* Generates the war package"> + <!-- A task to create manifest for webapp. --> + <taskdef name="manifest-tool" classname="ManifestToolTask" + classpath="${tools.dir}/anttasks"/> + <manifest-tool directory="${build.war}/WEB-INF/lib" manifest="${build.war}/WEB-INF/Manifest.mf"/> <jar jarfile="${build.dir}/${name}.war" basedir="${build.war}" includes="**" manifest="${build.war}/WEB-INF/Manifest.mf"/> </target> 1.8 +6 -0 xml-cocoon2/src/java/org/apache/cocoon/components/deli/deli.xconf Index: deli.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/deli/deli.xconf,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- deli.xconf 7 Mar 2002 14:05:30 -0000 1.7 +++ deli.xconf 9 Mar 2002 06:27:15 -0000 1.8 @@ -1,6 +1,12 @@ +<?xml version="1.0"?> + +<xconf xpath="/cocoon" + unless="comment()[contains(., ' Deli support ')]"> + <!-- Deli support --> <!-- Uncomment this section to enable DELI <deli class="org.apache.cocoon.components.deli.DeliImpl"> <parameter name="deli-config-file" value="resources/deli/config/deliConfig.xml"/> </deli> --> +</xconf> 1.2 +6 -1 xml-cocoon2/src/java/org/apache/cocoon/components/hsqldb/hsqldb.xconf Index: hsqldb.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/hsqldb/hsqldb.xconf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- hsqldb.xconf 16 Jan 2002 10:39:22 -0000 1.1 +++ hsqldb.xconf 9 Mar 2002 06:27:15 -0000 1.2 @@ -1,4 +1,8 @@ -<!-- HSQLDB Server for samples: +<?xml version="1.0"?> + +<xconf xpath="/cocoon" unless="hsqldb-server"> + + <!-- HSQLDB Server for samples: Comment this section out if you don't care about the samples. port : number port where the server is listening silent : true/false display all queries @@ -11,3 +15,4 @@ <parameter name="silent" value="true"/> <parameter name="trace" value="false"/> </hsqldb-server> +</xconf> 1.4 +5 -0 xml-cocoon2/src/java/org/apache/cocoon/components/resolver/resolver.xconf Index: resolver.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/resolver/resolver.xconf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- resolver.xconf 14 Feb 2002 15:47:54 -0000 1.3 +++ resolver.xconf 9 Mar 2002 06:27:15 -0000 1.4 @@ -1,3 +1,7 @@ +<?xml version="1.0"?> + +<xconf xpath="/cocoon" unless="entity-resolver"> + <!-- Entity resolution catalogs: ********************************************* catalog: The default catalog is distributed at /resources/entities/catalog @@ -34,3 +38,4 @@ <parameter name="catalog" value="/resources/entities/catalog"/> <parameter name="verbosity" value="1"/> </entity-resolver> +</xconf> 1.2 +5 -0 xml-cocoon2/src/java/org/apache/cocoon/components/search/lucene.xconf Index: lucene.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/search/lucene.xconf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- lucene.xconf 16 Jan 2002 11:12:54 -0000 1.1 +++ lucene.xconf 9 Mar 2002 06:27:15 -0000 1.2 @@ -1,3 +1,7 @@ +<?xml version="1.0"?> + +<xconf xpath="/cocoon" unless="cocoon-indexer"> + <!-- Search: These are the components that handle the search. @@ -10,3 +14,4 @@ <cocoon-searcher logger="core.search.searcher"/> <cocoon-crawler logger="core.search.crawler"/> <lucene-xml-indexer logger="core.search.lucene"/> +</xconf> 1.1 xml-cocoon2/src/java/org/apache/cocoon/components/search/lucene.xpipe Index: lucene.xpipe =================================================================== <?xml version="1.0"?> <xpipe xpath="/sitemap/pipelines/pipeline[@id='optional']" unless="match[@pattern='search/**']"> <!-- Mount search pages sitemap, for using indexing & searching --> <map:match pattern="search/**"> <map:mount check-reload="yes" src="search/" uri-prefix="search"/> </map:match> </xpipe> 1.1 xml-cocoon2/src/java/org/apache/cocoon/components/source/xmldb.xpipe Index: xmldb.xpipe =================================================================== <?xml version="1.0"?> <xpipe xpath="/sitemap/pipelines/pipeline[@id='optional']" unless="match[@pattern='xmldb/**']"> <!-- ======================= XML:DB ============================== --> <map:match pattern="xmldb/**"> <map:match type="request-parameter" pattern="xpath"> <map:generate src="xmldb:xindice://localhost:4080/db/{../1}#{1}"/> <map:serialize type="xml"/> </map:match> <map:generate src="xmldb:xindice://localhost:4080/db/{1}"/> <map:serialize type="xml"/> </map:match> </xpipe> 1.2 +6 -0 xml-cocoon2/src/java/org/apache/cocoon/components/store/jisp.xconf Index: jisp.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/store/jisp.xconf,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jisp.xconf 7 Feb 2002 04:17:46 -0000 1.1 +++ jisp.xconf 9 Mar 2002 06:27:15 -0000 1.2 @@ -1,3 +1,8 @@ +<?xml version="1.0"?> + +<xconf xpath="/cocoon" + unless="comment()[contains(., 'org.apache.cocoon.components.store.JispFilesystemStore')]"> + <!-- Persistent store for the cache. Two store implementations to choose from: * FilesystemStore: Simple. Dependable. Thorougly tested. @@ -19,3 +24,4 @@ <parameter name="order" value="1701"/> </cache-persistent> --> +</xconf> 1.4 +4 -9 xml-cocoon2/src/java/org/apache/cocoon/generation/xmldb.xconf Index: xmldb.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/xmldb.xconf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- xmldb.xconf 23 Feb 2002 16:47:39 -0000 1.3 +++ xmldb.xconf 9 Mar 2002 06:27:15 -0000 1.4 @@ -1,11 +1,6 @@ - <!-- Source Handler: - The source handler adds special url protocols to the system, they are - then available inside Cocoon, e.g. as a source argument for one of the - sitemap components. - --> - <source-handler logger="core.source-handler"> - <!-- file protocol : this is a WriteableSource --> - <protocol name="file" class="org.apache.cocoon.components.source.FileSourceFactory"/> +<?xml version="1.0"?> + +<xconf xpath="/cocoon/source-handler" unless="protocol[@name='xmldb']"> <!-- xmldb pseudo protocol --> <protocol name="xmldb" class="org.apache.cocoon.components.source.XMLDBSourceFactory"> @@ -13,4 +8,4 @@ <driver type="xindice" class="org.apache.xindice.client.xmldb.DatabaseImpl"/> <!-- Add here other XML:DB compliant databases drivers --> </protocol> - </source-handler> +</xconf> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/bsf.xmap Index: bsf.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='script']"> <map:generator name="script" src="org.apache.cocoon.generation.ScriptGenerator" label="content,data"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/php.xmap Index: php.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='php']"> <map:generator name="php" src="org.apache.cocoon.generation.PhpGenerator" label="content,data"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/servlet.xmap Index: servlet.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='jsp']"> <map:generator name="jsp" src="org.apache.cocoon.generation.JspGenerator" label="content,data"/> <map:generator name="stream" src="org.apache.cocoon.generation.StreamGenerator" label="content,data"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/tidy.xmap Index: tidy.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='html']"> <map:generator name="html" src="org.apache.cocoon.generation.HTMLGenerator" label="content,data"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/velocity.xmap Index: velocity.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='velocity']"> <map:generator name="velocity" src="org.apache.cocoon.generation.VelocityGenerator" label="content,data"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/xindice.xmap Index: xindice.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='xmldb']"> <map:generator name="xmldb" src="org.apache.cocoon.generation.XMLDBGenerator" label="content,data"> <driver>org.apache.xindice.client.xmldb.DatabaseImpl</driver> <base>xmldb:xindice:///db/</base> </map:generator> <map:generator name="xmldbcollection" src="org.apache.cocoon.generation.XMLDBCollectionGenerator" label="content,data"> <driver>org.apache.xindice.client.xmldb.DatabaseImpl</driver> <base>xmldb:xindice:///db/</base> </map:generator> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/generation/xmldb-generators.xpipe Index: xmldb-generators.xpipe =================================================================== <?xml version="1.0"?> <xpipe xpath="/sitemap/pipelines/pipeline[@id='optional']" unless="match[@pattern='xmldb-generator/db/**/']"> <!-- =================== XML:DB Generators ========================= --> <!-- BEWARE: the following examples use the unmaintained XML:DB --> <!-- generators, going to be deprecated soon. --> <!-- You might want to use the XML:DB pseudo protocol instead. --> <map:match pattern="xmldb-generator/db/**/"> <map:generate type="xmldbcollection" src="/{1}"/> <map:serialize type="xml"/> </map:match> <map:match pattern="xmldb-generator/db/**"> <map:generate type="xmldb" src="/{1}"/> <map:serialize type="xml"/> </map:match> </xpipe> 1.1 xml-cocoon2/src/java/org/apache/cocoon/reading/servlet.xmap Index: servlet.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/readers" unless="reader[@name='jsp']"> <map:reader name="jsp" src="org.apache.cocoon.reading.JSPReader"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/samples/parentcm/naming.xmap Index: naming.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/generators" unless="generator[@name='parentcm']"> <map:generator name="parentcm" src="org.apache.cocoon.samples.parentcm.Generator"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/samples/parentcm/naming.xpipe Index: naming.xpipe =================================================================== <?xml version="1.0"?> <xpipe xpath="/sitemap/pipelines/pipeline[@id='optional']" unless="match[@pattern='parentcm']"> <!-- =============== Parent Component Manager ====================== --> <map:match pattern="parentcm"> <map:generate type="parentcm" src="{1}"/> <map:transform src="stylesheets/parentcm/time.xsl"/> <map:serialize/> </map:match> </xpipe> 1.1 xml-cocoon2/src/java/org/apache/cocoon/transformation/naming.xmap Index: naming.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/transformers" unless="transformer[@name='ldap']"> <map:transformer name="ldap" src="org.apache.cocoon.transformation.LDAPTransformer"/> </xmap> 1.1 xml-cocoon2/src/java/org/apache/cocoon/transformation/xt.xmap Index: xt.xmap =================================================================== <?xml version="1.0"?> <xmap xpath="/sitemap/components/transformers" unless="transformer[@name='xt']"> <map:transformer name="xt" src="org.apache.cocoon.transformation.XTTransformer"/> </xmap> 1.36 +11 -1 xml-cocoon2/src/webapp/cocoon.xconf Index: cocoon.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/cocoon.xconf,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- cocoon.xconf 5 Mar 2002 13:11:54 -0000 1.35 +++ cocoon.xconf 9 Mar 2002 06:27:16 -0000 1.36 @@ -160,6 +160,17 @@ <!-- Add here protocol factories for your own protocols --> </url-factory> + <!-- Source Handler: + The source handler adds special url protocols to the system, they are + then available inside Cocoon, e.g. as a source argument for one of the + sitemap components. + --> + <source-handler logger="core.source-handler"> + <!-- file protocol : this is a WriteableSource --> + <protocol name="file" class="org.apache.cocoon.components.source.FileSourceFactory"/> + + </source-handler> + <!-- Program Generator: The ProgamGenerator builds programs from a XML document written in a MarkupLanguage. @@ -337,7 +348,6 @@ <parameter name="uri" value="http://apache.org/xsp/soap/3.0"/> <parameter name="href" value="resource://org/apache/cocoon/components/language/markup/xsp/java/soap.xsl"/> </builtin-logicsheet> - </target-language> <target-language name="js"> 1.38 +102 -107 xml-cocoon2/src/webapp/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/sitemap.xmap,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- sitemap.xmap 7 Mar 2002 21:02:34 -0000 1.37 +++ sitemap.xmap 9 Mar 2002 06:27:16 -0000 1.38 @@ -103,8 +103,6 @@ reader. They are useful for delivering binary content like images. --> <map:readers default="resource"> - <map:reader name="jsp" logger="sitemap.reader.jsp" - src="org.apache.cocoon.reading.JSPReader"/> </map:readers> <!-- @@ -415,122 +413,91 @@ <map:pipelines> - <!-- Utility for viewing source xml or html --> - <map:pipeline> - <!-- sample use of regexp equivalent to "**.source" using wildcard - this also shows the '\{' notation to escape sitemap values substitution --> - <map:match pattern="(.*)\.s\{1}ource" type="regexp"> - <map:generate src="cocoon:/{1}" /> - <map:transform src="stylesheets/simple-xml2html.xsl"/> - <map:serialize/> - </map:match> - </map:pipeline> - <!-- sub-sitemap example pipeline --> <map:pipeline> - <map:match pattern="sub/**"> - - <!-- matches all URIs starting with "sub". Have a look at - the docs for this matcher component. - - "*" means, anything that does not contain a path separator, - i.e. slash "/", "**" means anything including path - separators. What is matched by the wildcard is put into sitemap - variables. - - Sitemap variables are organized like a stack, a new set is placed - on top of the already present ones. Any existing variable can be - accessed through a simplified path expression. These simplified - path expression may only use any number of "../" to refer to the - previous levels. - - If a component completes successfully, it sets some sitemap - variables. Their scope is only within the element of that - component. Thus they can only be accessed by nested components. - --> - <map:mount uri-prefix="sub" src="sub/sitemap.xmap" check-reload="yes"/> - <!-- - Sitemaps may be organized hierarchically. Here such a subsitemap - is "mounted" (think: unix filesystems) to be responsible for all - URIs starting with "sub/". The file itself is by - coincidence located in a subdirectory named "sub/" as - well. There's no need to do that but it is good practice. The - check-reload attributes specifies, if changed to the subsitemap - should result in cocoon rereading the subsitemap or if they are to - be ignored. See docs for suggestions on this. - - Note here, that all component declarations are inherited to a - subsitemap. - --> - </map:match> - - <map:handle-errors> - <!-- - This pipeline specifies a different error handler. - --> - <map:transform src="stylesheets/system/error2html.xsl"/> - <map:serialize status-code="500"/> - </map:handle-errors> - </map:pipeline> - - <!-- protected webapp example pipeline --> - <map:pipeline> - <map:match pattern="protected/**"> - <map:mount uri-prefix="protected" src="protected/" check-reload="yes"/> - </map:match> - </map:pipeline> + <!-- Matcher: --> + <map:match pattern="sub/**"> + <!-- + matches all URIs starting with "sub". Have a look at + the docs for this matcher component. + + "*" means, anything that does not contain a path separator, + i.e. slash "/", "**" means anything including path + separators. What is matched by the wildcard is put into sitemap + variables. + + Sitemap variables are organized like a stack, a new set is placed + on top of the already present ones. Any existing variable can be + accessed through a simplified path expression. These simplified + path expression may only use any number of "../" to refer to the + previous levels. + + If a component completes successfully, it sets some sitemap + variables. Their scope is only within the element of that + component. Thus they can only be accessed by nested components. + --> + + <!-- Mount: --> + <map:mount uri-prefix="sub" src="sub/sitemap.xmap" check-reload="yes"/> + <!-- + Sitemaps may be organized hierarchically. Here such a subsitemap + is "mounted" (think: unix filesystems) to be responsible for all + URIs starting with "sub/". The file itself is by + coincidence located in a subdirectory named "sub/" as + well. There's no need to do that but it is good practice. The + check-reload attributes specifies, if changed to the subsitemap + should result in cocoon rereading the subsitemap or if they are to + be ignored. See docs for suggestions on this. + + Note here, that all component declarations are inherited to a + subsitemap. + --> + </map:match> - <!-- i18n examples pipeline --> - <map:pipeline> - <map:match pattern="i18n/**"> - <map:mount uri-prefix="i18n" src="i18n/" check-reload="yes"/> - </map:match> + <map:handle-errors> + <!-- + This pipeline specifies a different error handler. + --> + <map:transform src="stylesheets/system/error2html.xsl"/> + <map:serialize status-code="500"/> + </map:handle-errors> </map:pipeline> <!-- Cocoon documentation pipeline --> <map:pipeline> - <map:match pattern="documents/index"> - <map:redirect-to uri="index.html"/> - <!-- - You may direct a client to a more appropriate URI by the above - command. The above results in a redirect response to the - client. By redirecting to a ressource it would be handled by - cocoon internally. - - Since pipelines work on a first match basis, the above wins the - request although the match below would match as well. - --> - </map:match> - <map:match pattern="documents/**"> - <map:mount uri-prefix="documents" src="documentation/" check-reload="yes"/> - </map:match> - <map:match pattern="tutorial/**"> - <map:mount uri-prefix="tutorial/" src="tutorial/" check-reload="yes"/> - </map:match> - </map:pipeline> + <map:match pattern="documents/index"> + <map:redirect-to uri="index.html"/> + <!-- + You may direct a client to a more appropriate URI by the above + command. The above results in a redirect response to the + client. By redirecting to a ressource it would be handled by + cocoon internally. - - <!-- mount search pages, for using indexing&searching - --> - <map:pipeline> - <map:match pattern="search/**"> - <map:mount uri-prefix="search" src="search/" check-reload="yes"/> + Since pipelines work on a first match basis, the above wins the + request although the match below would match as well. + --> + </map:match> + <map:match pattern="documents/**"> + <map:mount uri-prefix="documents" src="documentation/" check-reload="yes"/> + </map:match> + <map:match pattern="tutorial/**"> + <map:mount uri-prefix="tutorial/" src="tutorial/" check-reload="yes"/> </map:match> </map:pipeline> - <!-- mount other sample pages - --> - <map:pipeline> - <map:match pattern="samples/*/**"> - <map:mount uri-prefix="samples/{1}" src="samples/{1}/" check-reload="yes"/> - </map:match> + <map:pipeline id="optional"> + <!-- Below goes entries added by Cocoon build system --> + </map:pipeline> + + <map:pipeline internal-only="true" id="optional-internal"> + <!-- Below goes entries added by Cocoon build system --> </map:pipeline> <!-- "automount" setup - This causes directories added under "mount" - (even with Cocoon already running) to be activated automagically - if they contain a sitemap.xmap, without having to modify the main - sitemap.xmap + This causes directories added under "mount" + (even with Cocoon already running) to be activated automagically + if they contain a sitemap.xmap, without having to modify the main + sitemap.xmap --> <map:pipeline> <map:match pattern="mount/*/**"> @@ -542,10 +509,38 @@ </map:match> </map:pipeline> + <!-- pipeline mounting samples sitemaps --> + <map:pipeline> + <!-- Utility for viewing source xml or html --> + <!-- sample use of regexp equivalent to "**.source" using wildcard + this also shows the '\{' notation to escape sitemap values substitution --> + <map:match pattern="(.*)\.s\{1}ource" type="regexp"> + <map:generate src="cocoon:/{1}" /> + <map:transform src="stylesheets/simple-xml2html.xsl"/> + <map:serialize/> + </map:match> + + <!-- protected webapp example pipeline --> + <map:match pattern="protected/**"> + <map:mount uri-prefix="protected" src="protected/" check-reload="yes"/> + </map:match> + + <!-- i18n examples sitemap --> + <map:match pattern="i18n/**"> + <map:mount uri-prefix="i18n" src="i18n/" check-reload="yes"/> + </map:match> + + <!-- mount other sample pages --> + <map:match pattern="samples/*/**"> + <map:mount uri-prefix="samples/{1}" src="samples/{1}/" check-reload="yes"/> + </map:match> + </map:pipeline> + + <!-- main samples pipeline --> <map:pipeline> - <map:match pattern=""> - <map:redirect-to uri="welcome"/> - </map:match> + <map:match pattern=""> + <map:redirect-to uri="welcome"/> + </map:match> <map:match pattern="welcome"> <map:generate src="docs/samples/samples.xml"/> 1.2 +94 -91 xml-cocoon2/tools/src/XConfToolTask.java Index: XConfToolTask.java =================================================================== RCS file: /home/cvs/xml-cocoon2/tools/src/XConfToolTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XConfToolTask.java 25 Jan 2002 02:31:53 -0000 1.1 +++ XConfToolTask.java 9 Mar 2002 06:27:16 -0000 1.2 @@ -6,18 +6,38 @@ * the LICENSE file. * *****************************************************************************/ -import java.io.*; -import java.util.*; -import org.apache.tools.ant.*; -import org.apache.tools.ant.taskdefs.*; -import org.apache.tools.ant.types.*; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.apache.xpath.XPathAPI; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.sax.SAXTransformerFactory; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.Source; +import javax.xml.transform.Result; +import javax.xml.transform.TransformerException; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; /** - * Add components to the cocoon.xconf - * This is only a ugly first shot + * Add components to the cocoon.xconf. + * This is an ugly second shot. * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Revision: 1.1 $ $Date: 2002/01/25 02:31:53 $ + * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> + * @version CVS $Revision: 1.2 $ $Date: 2002/03/09 06:27:16 $ */ public final class XConfToolTask extends Task { @@ -39,10 +59,10 @@ } public void execute() throws BuildException { + if (this.configuration == null) { throw new BuildException("configuration attribute is required", location); } - if (this.extension == null) { throw new BuildException("extension attribute is required", location); } @@ -51,8 +71,28 @@ } try { + final DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + final Transformer transformer = TransformerFactory.newInstance().newTransformer(); + final String file = new File(this.configuration).getCanonicalPath(); + + // load xml + System.out.println("Reading: " + file); + final Document configuration = builder.parse(file); + // process recursive - this.process(new File(this.directory), this.extension, this.configuration); + if (process(builder, configuration, new File(this.directory), this.extension)) { + // save xml + System.out.println("Writing: " + file); + transformer.transform(new DOMSource(configuration), new StreamResult(file)); + } else { + System.out.println("No Changes: " + file); + } + } catch (TransformerException e) { + throw new BuildException("TransformerException: " + e); + } catch (SAXException e) { + throw new BuildException("SAXException: " + e); + } catch (ParserConfigurationException e) { + throw new BuildException("ParserConfigurationException: " + e); } catch (IOException ioe) { throw new BuildException("IOException: " + ioe); } @@ -61,98 +101,61 @@ /** * Scan recursive */ - private void process(final File directoryFile, - final String ext, - final String configurationLocation) - throws IOException, BuildException { + private boolean process(final DocumentBuilder builder, + final Document configuration, + final File directoryFile, + final String ext) + throws IOException, BuildException, ParserConfigurationException, TransformerException, SAXException { + boolean hasChanged = false; final File[] files = directoryFile.listFiles(); - for(int i = 0; i < files.length; i++) { - - if (files[i].isDirectory() == true) { - this.process(files[i], ext, configurationLocation); - } else { - - if (files[i].getName().endsWith("."+ext) == true) { - System.out.println("Reading: " + files[i].getAbsolutePath()); - final String newComponent = this.load(files[i].getAbsolutePath()); - - this.add(configurationLocation, - newComponent); - } - } - } - } - - /** - * Add entry to sitemap - */ - private void add(final String configurationLocation, - final String newComponent) - throws IOException { - final String data = load( configurationLocation ); - - // first search if component already present: - if ( data.indexOf( newComponent ) == -1 ) { - int pos = data.indexOf( "<cocoon" ); - if (pos != -1) { - pos = data.indexOf( ">", pos); - - if (pos != -1) { - StringBuffer buffer = new StringBuffer( data.substring( 0, pos+1 ) ) - .append( "\n\n" ) - .append( newComponent ) - .append( data.substring( pos+1 ) ); - this.save( configurationLocation, buffer.toString() ); + if (files[i].isDirectory()) { + hasChanged |= process(builder, configuration, files[i], ext); + } else if (files[i].getName().endsWith("." + ext)) { + String file = files[i].getCanonicalPath(); + try { + hasChanged |= add(configuration, builder.parse(file), file); + } catch (SAXException e) { + System.out.println("Ignoring: " + file + "\n(not a valid XML)"); } } } + return hasChanged; } /** - * Load a file and return the content as a string. + * Add entry to cocoon.xconf */ - public String load( String filename ) - throws IOException { - FileInputStream fis; - - fis = new FileInputStream( filename ); - int available; - byte[] data = null; - byte[] tempData; - byte[] copyData; - do - { - available = 1024; - tempData = new byte[available]; - available = fis.read( tempData, 0, available ); - if ( available > 0 ) - { - copyData = new byte[( data == null ? 0 : data.length ) + available]; - if ( data != null ) - { - System.arraycopy( data, 0, copyData, 0, data.length ); - } - System.arraycopy( tempData, 0, copyData, ( data == null ? 0 : data.length ), available ); - data = copyData; - } - } while ( available > 0 ); - fis.close(); - - return ( data != null ? new String( data ) : "" ); - } - - /** - * Save the string to a file - */ - public void save( String filename, String data ) - throws IOException + private boolean add(final Document configuration, + final Document component, + String file) + throws TransformerException, IOException { - FileWriter fw = new FileWriter( filename ); - fw.write( data ); - fw.close(); + // Get Node + String xpath = component.getDocumentElement().getAttribute("xpath"); + NodeList configurationNodes = XPathAPI.selectNodeList(configuration, xpath); + if (configurationNodes.getLength() != 1) { + throw new IOException("XPath (" + xpath + ") returned not one node, but " + + configurationNodes.getLength() + " nodes"); + } + Node configurationNode = configurationNodes.item(0); + + // Test + String test = component.getDocumentElement().getAttribute("unless"); + if (test != null && test.length() > 0 && + XPathAPI.selectNodeList(configurationNode, test).getLength() != 0) { + System.out.println("Skipping: " + file); + return false; + } else { + // Apply + System.out.println("Processing: " + file); + NodeList componentNodes = component.getDocumentElement().getChildNodes(); + for (int i = 0; i < componentNodes.getLength(); i++ ){ + configurationNode.appendChild(configuration.importNode(componentNodes.item(i), true)); + } + return true; + } } - }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]