cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r434061 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/repository/conf/ src/blocks/repository/java/org/apache/cocoon/components/source/helpers/ src/blocks/repository/java/org/apache/cocoon/components/source/impl/
Date Wed, 23 Aug 2006 15:03:17 GMT
Author: vgritsenko
Date: Wed Aug 23 08:03:16 2006
New Revision: 434061

URL: http://svn.apache.org/viewvc?rev=434061&view=rev
Log:
    <action dev="VG" type="add">
      Repository: Add CachingSource source implementation (from trunk).
    </action>


Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-descriptor.xconf
      - copied, changed from r434054, cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/sourcedescriptor.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xconf
      - copied, changed from r434054, cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles
  (contents, props changed)
      - copied, changed from r434054, cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xroles
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
      - copied, changed from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/SourceRefresher.java
      - copied unchanged from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/helpers/SourceRefresher.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/CachedSourceResponse.java
      - copied unchanged from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/impl/CachedSourceResponse.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/CachingSource.java
      - copied unchanged from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/impl/CachingSource.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/CachingSourceFactory.java
      - copied unchanged from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/impl/CachingSourceFactory.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/InspectableTraversableCachingSource.java
      - copied unchanged from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/impl/InspectableTraversableCachingSource.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/TraversableCachingSource.java
      - copied unchanged from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/impl/TraversableCachingSource.java
Removed:
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xroles
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/sourcedescriptor.xconf
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-manager.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source.xconf
    cocoon/branches/BRANCH_2_1_X/status.xml

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf?rev=434061&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf
Wed Aug 23 08:03:16 2006
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+  - SVN $Id$
+  -->
+<xconf xpath="/cocoon/source-factories"
+       unless="component-instance[@name='cached']">
+    <!--+
+        | Caching source protocol.
+        | This protocol extension implements a proxy-like source
+        | that can cache the contents of its delegate source.
+        |
+        | The uri syntax is as follows:
+        | cached:subprotocol:/path[?cocoon:cache-expires=60][&cocoon:cache-name=main]
+        |
+        | Where:
+        | - 'cached' is the caching source protocol scheme name as defined below.
+        | - 'subprotcol:/path' identifies the source to get the actual contents from
+        |   eg. http://cocoon.apache.org/doco.html?version=1.2
+        | - optional query string parameters that start with 'cocoon:cache' represent
+        |   special instructions to pass to the implementation.
+        |
+        | The protocol can be parametrized as follows:
+        | - 'async' (false). When this is set to true cached source contents are updated
+        |   in the background, using SourceRefresher component.
+        | - 'cache-role' (org.apache.cocoon.caching.Cache). Use this if you want to use
+        |   a Cache other than the default one.
+        | - 'refresher-role' (org.apache.cocoon.components.source.DelaySourceRefresher).
+        |   Use this if you wish to use a SourceRefresher other than the default one.
+        |   A SourceRefresher is used when asynchronic caching is turned on. It is responsible
for
+        |   updating the cached contents in the background and can implement any refresh
algorithm.
+        | - 'default-expires' (-1). The expires value if it is not specified on the source
+        |    itself. The default value of -1 means to never expire.
+        +-->
+    <component-instance name="cached"
+                        class="org.apache.cocoon.components.source.impl.CachingSourceFactory"
+                        logger="core.source.cached">
+      <!--
+      <parameter name="async" value="true"/>
+      <parameter name="cache-role" value="org.apache.cocoon.caching.Cache"/>
+      <parameter name="default-expires" value="-1"/>
+      -->
+      <parameter name="refresher-role" value="org.apache.cocoon.components.source.helpers.SourceRefresher/Delay"/>
+    </component-instance>
+
+</xconf>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-caching-source.xconf
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-manager.xconf
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-manager.xconf?rev=434061&r1=434060&r2=434061&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-manager.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-manager.xconf Wed Aug
23 08:03:16 2006
@@ -16,16 +16,18 @@
   limitations under the License.
 -->
 
-<xconf xpath="/cocoon" unless="component[@role='org.apache.cocoon.components.repository.RepositoryManager']">
+<!--
+  - SVN $Id$
+  -->
+<xconf xpath="/cocoon"
+       unless="component[@role='org.apache.cocoon.components.repository.RepositoryManager']">
 
   <component role="org.apache.cocoon.components.repository.RepositoryManager" 
              class="org.apache.cocoon.components.repository.RepositoryManager"
              logger="core.repository">
-
     <!-- put your repository implementations here like
     <repository name="webdav" class="org.apache.cocoon.components.repository.impl.WebDAVRepository"/>
     -->
-
   </component>
 
 </xconf>

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-descriptor.xconf
(from r434054, cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/sourcedescriptor.xconf)
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-descriptor.xconf?p2=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-descriptor.xconf&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/sourcedescriptor.xconf&r1=434054&r2=434061&rev=434061&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/sourcedescriptor.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-descriptor.xconf
Wed Aug 23 08:03:16 2006
@@ -15,7 +15,12 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<xconf xpath="/cocoon" unless="component[@role='org.apache.cocoon.components.source.SourceDescriptor']">
+
+<!--
+  - SVN $Id$
+  -->
+<xconf xpath="/cocoon"
+       unless="component[@role='org.apache.cocoon.components.source.SourceDescriptor']">
 
   <component role="org.apache.cocoon.components.source.SourceDescriptor" 
              class="org.apache.cocoon.components.source.impl.SourceDescriptorManager" 

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf?rev=434061&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf
Wed Aug 23 08:03:16 2006
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+  - SVN $Id$
+  -->
+<xconf xpath="/cocoon"
+       unless="component[@role='org.apache.cocoon.components.source.helpers.SourceRefresher/Delay']">
+  <!--+
+      | A SourceRefresher is a component that is used by the CachingSource protocol.
+      | It is responsible for updating the cached contents of sources that are
+      | registered with it by the protocol.
+      |
+      | The DelaySourceRefresher is an implementation that periodically updates the
+      | sources. It recognizes the following parameters:
+      | - 'write-interval' (0). The SourceRefresher can periodically persist its
+      |   list of registered sources. This parameter specifies how often
+      |   it should write this list to file. Specifying a value of 0 (the default)
+      |   means that target configurations will not be persisted at all.
+      | - 'write-file' (refresher-targets.xml). Specifying a different value
+      |   than the default for this parameter only makes sense if you configure
+      |   more than one DelayRefreshers. It represents the file name, relative to
+      |   the cocoon working directory of the file the refresher writes its list
+      |   of registered target configurations to.
+      +-->
+  <component role="org.apache.cocoon.components.source.helpers.SourceRefresher/Delay"
+             class="org.apache.cocoon.components.source.helpers.DelaySourceRefresher"
+             logger="core.refresher.delay">
+    <!--
+    <parameter name="write-interval" value="0"/>
+    <parameter name="write-file" value="refresher-targets.xml"/>
+    -->
+  </component>
+
+</xconf>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-refresher.xconf
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xconf
(from r434054, cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xconf)
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xconf?p2=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xconf&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xconf&r1=434054&r2=434061&rev=434061&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xconf
Wed Aug 23 08:03:16 2006
@@ -15,6 +15,11 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
+<!--
+  - SVN $Id$
+  -->
 <xconf xpath="/cocoon" unless="source-repository">
   <source-repository logger="core.source-repository" />
+
 </xconf>

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles
(from r434054, cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xroles)
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles?p2=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xroles&r1=434054&r2=434061&rev=434061&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/SourceRepository.xroles (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles
Wed Aug 23 08:03:16 2006
@@ -15,6 +15,10 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
+<!--
+  - SVN $Id$
+  -->
 <xroles xpath="/role-list" unless="role[@shorthand='source-repository']">
   
   <role name="org.apache.cocoon.components.repository.SourceRepository" 

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source-repository.xroles
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source.xconf
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source.xconf?rev=434061&r1=434060&r2=434061&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/conf/repository-source.xconf Wed Aug
23 08:03:16 2006
@@ -15,12 +15,14 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<xconf xpath="/cocoon/source-factories" unless="component-instance[@name='repository']">
 
+<!--
+  - SVN $Id$
+  -->
+<xconf xpath="/cocoon/source-factories"
+       unless="component-instance[@name='repository']">
     <!-- pseudo protocol for the repository source wrapper -->
-    <component-instance 
-      name="repository" 
-      class="org.apache.cocoon.components.source.impl.RepositorySourceFactory" 
-    />
+    <component-instance name="repository" 
+                        class="org.apache.cocoon.components.source.impl.RepositorySourceFactory"/>
     
 </xconf>

Copied: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
(from r434032, cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java)
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java?p2=cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java&p1=cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java&r1=434032&r2=434061&rev=434061&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-repository/cocoon-repository-impl/src/main/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/helpers/DelaySourceRefresher.java
Wed Aug 23 08:03:16 2006
@@ -21,6 +21,7 @@
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.net.MalformedURLException;
 import java.util.Collections;
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
@@ -30,6 +31,7 @@
 import org.apache.avalon.framework.CascadingException;
 import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.component.WrapperComponentManager;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -48,12 +50,11 @@
 import org.apache.excalibur.source.SourceResolver;
 
 import org.apache.cocoon.Constants;
-import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.Processor;
+import org.apache.cocoon.components.CocoonComponentManager;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.components.thread.RunnableManager;
 import org.apache.cocoon.environment.background.BackgroundEnvironment;
-import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.util.NetUtils;
 
 /**
@@ -364,6 +365,9 @@
                     env = new BackgroundEnvironment(getLogger(), ctx);
                 } catch (ContextException e) {
                     throw new CascadingRuntimeException("No context found", e);
+                } catch (MalformedURLException e) {
+                    // Unlikely to happen
+                    throw new CascadingRuntimeException("Invalid URL", e);
                 }
                 Processor processor;
                 try {
@@ -372,12 +376,8 @@
                     throw new CascadingRuntimeException("No processor found", e);
                 }
 
-                env.startingProcessing();
-                try {
-                    EnvironmentHelper.enterProcessor(processor, env);
-                } catch (ProcessingException e) {
-                    throw new CascadingRuntimeException("Can not enter processor", e);
-                }
+                final Object key = CocoonComponentManager.startProcessing(env);
+                CocoonComponentManager.enterEnvironment(env, new WrapperComponentManager(manager),
processor);
                 try {
                     // Refresh Source
                     Source source = null;
@@ -392,8 +392,8 @@
                         }
                     }
                 } finally {
-                    EnvironmentHelper.leaveProcessor();
-                    env.finishingProcessing();
+                    CocoonComponentManager.leaveEnvironment();
+                    CocoonComponentManager.endProcessing(env, key);
                     if (manager != null) {
                         manager.release(processor);
                     }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=434061&r1=434060&r2=434061&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Aug 23 08:03:16 2006
@@ -184,8 +184,11 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="VG" type="add">
+      Repository: Add CachingSource source implementation (from trunk).
+    </action>
     <action dev="JJ" type="fix">
-      ImageOp block: Send info/debug messages to the log rather than System.out.println
+      ImageOp: Send info/debug messages to the log rather than System.out.println
     </action>
     <action dev="AG" type="fix" fixes-bug="COCOON-1815" due-to="Frédéric Glorieux"
due-to-email="frederic.glorieux@ajlsm.com">
       Core: CopySourceAction generate NPE.



Mime
View raw message