cziegeler 2003/01/31 06:02:02 Modified: src/webapp/WEB-INF Tag: cocoon_2_0_3_branch cocoon.xconf src/java/org/apache/cocoon/components/treeprocessor Tag: cocoon_2_0_3_branch TreeProcessor.java Log: Making treeprocessor the default engine Backporting configuration possibilities for the treeprocessor Revision Changes Path No revision No revision 1.4.2.6 +26 -10 xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf Index: cocoon.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf,v retrieving revision 1.4.2.5 retrieving revision 1.4.2.6 diff -u -r1.4.2.5 -r1.4.2.6 --- cocoon.xconf 8 Jan 2003 11:02:18 -0000 1.4.2.5 +++ cocoon.xconf 31 Jan 2003 14:01:58 -0000 1.4.2.6 @@ -451,11 +451,29 @@ <!-- ======================== The sitemap ============================== --> <!-- + New implementation of the sitemap. It is interpreted, so load times are super-fast, + and request processing is slightly faster than with the compiled engine thanks to + the HotSpot VM. + + Reloading of the sitemap: + The check-reload attribute determines if the sitemap is reloaded on change. + Set to "no", the sitemap is generated once at startup. + Set to "yes", the sitemap is regenerated if it changes. + + For development environment, set the check-reload to yes. + For production environment, it is advisable to set the check-reload to no. + --> + <sitemap logger="sitemap" file="sitemap.xmap" check-reload="yes"/> + + <!-- Compiled sitemap engine. This is the original engine, that is now replaced - by the interpreted engine (see above). + by the interpreted engine (see above). + + WARNING: THIS VERSION HAS BEEN DEPRECATED AND WILL BE REMOVED IN ONE OF + THE NEXT RELEASES! So we advice you to not use it any longer. If you want to use this engine, uncomment this element and comment the - defaut one below. + defaut one above. Reloading of the sitemap: The check-reload attribute determines if the sitemap is reloaded on change. @@ -471,16 +489,14 @@ For development environment, set the check-reload to yes. For production environment, it is advisable to set the check-reload to no. - --> - <sitemap class="org.apache.cocoon.sitemap.SitemapManager" - file="sitemap.xmap" reload-method="synchron" check-reload="yes" logger="sitemap"/> - <!-- - New implementation of the sitemap. It is interpreted, so load times are super-fast, - and request processing is slightly faster than with the compiled engine thanks to - the HotSpot VM. + To use this engine, comment the declaration above and uncomment the declaration below. + --> + <!-- + <sitemap class="org.apache.cocoon.sitemap.SitemapManager" + file="sitemap.xmap" reload-method="synchron" check-reload="yes" logger="sitemap"/> --> - <!-- sitemap logger="sitemap"/ --> + </cocoon> No revision No revision 1.4.2.5 +22 -9 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java Index: TreeProcessor.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v retrieving revision 1.4.2.4 retrieving revision 1.4.2.5 diff -u -r1.4.2.4 -r1.4.2.5 --- TreeProcessor.java 30 Jan 2003 16:20:18 -0000 1.4.2.4 +++ TreeProcessor.java 31 Jan 2003 14:02:00 -0000 1.4.2.5 @@ -139,6 +139,12 @@ /** The current language configuration */ protected Configuration currentLanguage; + /** The file to process */ + protected String fileName; + + /** Check for reload? */ + protected boolean checkReload; + protected SourceHandler sourceHandler; /** component configurations */ @@ -150,6 +156,9 @@ public TreeProcessor() { // Language can be overriden in the configuration. this.language = "sitemap"; + + this.checkReload = true; + this.lastModifiedDelay = 1000; } /** @@ -163,6 +172,8 @@ this.context = parent.context; this.logKit = parent.logKit; this.builderSelector = parent.builderSelector; + this.checkReload = parent.checkReload; + this.lastModifiedDelay = parent.lastModifiedDelay; // We have our own CM this.manager = manager; @@ -183,11 +194,11 @@ Source source) throws Exception { + // FIXME(VG): Why child isn't configure()d/contextualize(d)/etc ??? TreeProcessor child = new TreeProcessor(this, manager, language); child.setLogger(getLogger()); child.initialize(); - // FIXME : make delay configurable - child.source = new DelayedRefreshSourceWrapper(source, 1000L); + child.source = new DelayedRefreshSourceWrapper(source, lastModifiedDelay); return child; } @@ -215,7 +226,10 @@ <language>...</language> </processor> */ - public void configure(Configuration config) throws ConfigurationException { + public void configure(Configuration config) + throws ConfigurationException { + this.fileName = config.getAttribute("file", null); + this.checkReload = config.getAttributeAsBoolean("check-reload", true); Configuration rootLangConfig = config.getChild("root-language", false); if (rootLangConfig != null) { @@ -247,7 +261,6 @@ } } catch(Exception e) { String msg = "Error while reading " + xconfURL + ": " + e.getMessage(); - getLogger().error(msg, e); throw new ConfigurationException(msg, e); } @@ -367,15 +380,16 @@ ((Recomposable)builder).recompose(this.manager); } builder.setProcessor(this); + if (this.fileName == null) { + this.fileName = builder.getFileName(); + } if (this.source == null) { - // FIXME : make the delay configurable - this.source = new DelayedRefreshSourceWrapper(env.resolve(builder.getFileName()), 1000L); + this.source = new DelayedRefreshSourceWrapper(env.resolve(this.fileName), lastModifiedDelay); } root = builder.build(this.source); this.disposableNodes = builder.getDisposableNodes(); - } finally { this.builderSelector.release(builder); } @@ -385,7 +399,6 @@ if (getLogger().isDebugEnabled()) { double time = (this.lastModified - startTime) / 1000.0; getLogger().debug("TreeProcessor built in " + time + " secs from " + source.getSystemId()); - //System.out.println("TreeProcessor built in " + time + " secs from " + source.getSystemId()); } // Finished
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]