Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 24629 invoked from network); 27 Dec 2006 16:06:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Dec 2006 16:06:25 -0000 Received: (qmail 20377 invoked by uid 500); 27 Dec 2006 16:06:28 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 20306 invoked by uid 500); 27 Dec 2006 16:06:28 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 20282 invoked by uid 99); 27 Dec 2006 16:06:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Dec 2006 08:06:28 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Dec 2006 08:06:20 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 0A75C1A981A; Wed, 27 Dec 2006 08:05:28 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r490524 - in /cocoon/branches/BRANCH_2_1_X: src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java status.xml Date: Wed, 27 Dec 2006 16:05:27 -0000 To: cvs@cocoon.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061227160528.0A75C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Wed Dec 27 08:05:27 2006 New Revision: 490524 URL: http://svn.apache.org/viewvc?view=rev&rev=490524 Log: Block: Applied and improved patch for reloading bookmarks based on their (file) validity. Fixes bug COCOON-1776" Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java cocoon/branches/BRANCH_2_1_X/status.xml Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java?view=diff&rev=490524&r1=490523&r2=490524 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java Wed Dec 27 08:05:27 2006 @@ -46,6 +46,7 @@ import org.apache.cocoon.portal.acting.helpers.LayoutMapping; import org.apache.cocoon.portal.acting.helpers.Mapping; import org.apache.excalibur.source.Source; +import org.apache.excalibur.source.SourceValidity; import org.xml.sax.SAXException; /** @@ -79,11 +80,16 @@ protected String configurationFile; - /* (non-Javadoc) + protected SourceValidity oldValidity; + + protected boolean reloadCheck = true; + + /** * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters) */ public void parameterize(Parameters parameters) throws ParameterException { this.historyParameterName = parameters.getParameter("history-parameter-name", "history"); + this.reloadCheck = parameters.getParameterAsBoolean("check-reload", this.reloadCheck); this.configurationFile = parameters.getParameter("src", null); if ( this.configurationFile == null ) return; @@ -100,77 +106,94 @@ private void loadConfig() throws ParameterException { Configuration config; org.apache.excalibur.source.SourceResolver resolver = null; + Source source = null; try { - resolver = (org.apache.excalibur.source.SourceResolver) this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE); - Source source = null; - try { - source = resolver.resolveURI(configurationFile); - SAXConfigurationHandler handler = new SAXConfigurationHandler(); - SourceUtil.toSAX(source, handler); - config = handler.getConfiguration(); - } catch (ProcessingException se) { - throw new ParameterException("Unable to read configuration from " + configurationFile, se); - } catch (SAXException se) { - throw new ParameterException("Unable to read configuration from " + configurationFile, se); - } catch (IOException ioe) { - throw new ParameterException("Unable to read configuration from " + configurationFile, ioe); - } finally { - resolver.release(source); - } - } catch (ServiceException se) { - throw new ParameterException("Unable to lookup source resolver.", se); + try { + resolver = (org.apache.excalibur.source.SourceResolver) this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE); + source = resolver.resolveURI(configurationFile); + } catch (IOException ioe) { + throw new ParameterException("Unable to read configuration from " + configurationFile, ioe); + } catch (ServiceException se) { + throw new ParameterException("Unable to lookup source resolver.", se); + } + SourceValidity newValidity = source.getValidity(); + if ( this.oldValidity == null + || this.oldValidity.isValid() == SourceValidity.INVALID + || this.oldValidity.isValid(newValidity) == SourceValidity.INVALID) { + this.oldValidity = newValidity; + try { + SAXConfigurationHandler handler = new SAXConfigurationHandler(); + SourceUtil.toSAX(source, handler); + config = handler.getConfiguration(); + } catch (ProcessingException se) { + throw new ParameterException("Unable to read configuration from " + configurationFile, se); + } catch (SAXException se) { + throw new ParameterException("Unable to read configuration from " + configurationFile, se); + } catch (IOException ioe) { + throw new ParameterException("Unable to read configuration from " + configurationFile, ioe); + } + Configuration[] events = config.getChild("events").getChildren("event"); + + if ( events != null ) { + for(int i=0; i + + Portal Block: Applied and improved patch for reloading bookmarks based on their (file) validity. + Portal Block: Fix handling of missing special parameters for forms in NewEventLinkTransformer.