You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/09/28 21:55:13 UTC
svn commit: r292282 - in /cocoon/trunk/src/java: ./ org/apache/cocoon/
org/apache/cocoon/components/blocks/
org/apache/cocoon/components/classloader/
org/apache/cocoon/components/container/
org/apache/cocoon/components/crawler/ org/apache/cocoon/compon...
Author: vgritsenko
Date: Wed Sep 28 12:54:16 2005
New Revision: 292282
URL: http://svn.apache.org/viewcvs?rev=292282&view=rev
Log:
svn properties
Modified:
cocoon/trunk/src/java/Manifest.mf (props changed)
cocoon/trunk/src/java/org/apache/cocoon/cocoon.properties (props changed)
cocoon/trunk/src/java/org/apache/cocoon/cocoon.roles (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/blocks/Block.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockManager.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java (contents, props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/blocks/core-components.xconf (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/classloader/ReloadingClassLoaderFactory.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/container/CocoonServiceManager.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/crawler/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/fam/SitemapMonitor.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/fam/SitemapMonitorImpl.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java (contents, props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/BlockPathModule.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/BlockPropertyModule.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ContextPathModule.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/CookieModule.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ProjectPathModule.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/output/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/modules/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/resolver/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlockSource.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlockSourceFactory.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlocksSource.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlocksSourceFactory.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/store/default.ccf (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/CocoonStoreJanitor.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/ehcache.xml (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/AnnotationsFilter.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/VPCNode.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/VPCNodeBuilder.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/VPCsNodeBuilder.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/xpointer-fw.jj (props changed)
cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/core/container/util/PropertyHelper.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/environment/internal/PopEnvironmentChanger.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/environment/internal/PushEnvironmentChanger.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/generation/CSVGenerator.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/i18n/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/reading/VirtualPipelineReader.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/serialization/VirtualPipelineSerializer.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/servlet/SettingsHelper.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/transformation/TeeTransformer.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/transformation/VirtualPipelineTransformer.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java (contents, props changed)
cocoon/trunk/src/java/org/apache/cocoon/util/ReflectionUtils.java (props changed)
cocoon/trunk/src/java/org/apache/cocoon/util/log/package.html (props changed)
cocoon/trunk/src/java/org/apache/cocoon/util/mime.types (props changed)
cocoon/trunk/src/java/org/apache/cocoon/xml/StringXMLizable.java (props changed)
Propchange: cocoon/trunk/src/java/Manifest.mf
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/cocoon.properties
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/cocoon.roles
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/Block.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockManager.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java?rev=292282&r1=292281&r2=292282&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java Wed Sep 28 12:54:16 2005
@@ -1,295 +1,295 @@
-/*
- * Copyright 1999-2005 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.
- */
-package org.apache.cocoon.components.blocks;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.cocoon.components.LifecycleHelper;
-import org.apache.cocoon.components.container.CocoonServiceManager;
-import org.apache.cocoon.core.Core;
-import org.apache.cocoon.core.container.SingleComponentServiceManager;
-import org.apache.cocoon.environment.Environment;
-import org.apache.cocoon.environment.internal.EnvironmentHelper;
-import org.xml.sax.SAXException;
-
-/**
- * @version $Id:$
- */
-public class BlocksManager
- extends AbstractLogEnabled
- implements Configurable, Contextualizable, Disposable, Initializable, Serviceable, ThreadSafe {
-
- public static String ROLE = BlocksManager.class.getName();
- public static String CORE_COMPONENTS_XCONF =
- "resource://org/apache/cocoon/components/blocks/core-components.xconf";
- private ServiceManager serviceManager;
- private CocoonServiceManager blockServiceManager;
- private SourceResolver resolver;
- private Context context;
-
- private HashMap blockConfs = new HashMap();
- private HashMap blocks = new HashMap();
- private TreeMap mountedBlocks = new TreeMap(new InverseLexicographicalOrder());
-
- public void service(ServiceManager manager) throws ServiceException {
- this.serviceManager = manager;
- this.resolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE);
- }
-
- public void contextualize(Context context) throws ContextException {
- this.context = context;
- }
-
- public void configure(Configuration config)
- throws ConfigurationException {
- String file = config.getAttribute("file");
- Source source = null;
- Configuration wiring = null;
-
- // Read the wiring file
- try {
- source = this.resolver.resolveURI(file);
- DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
- wiring = builder.build( source.getInputStream() );
- } catch (SAXException se) {
- String msg = "SAXException while reading " + file + ": " + se.getMessage();
- throw new ConfigurationException(msg, se);
- } catch (IOException ie) {
- String msg = "IOException while reading " + file + ": " + ie.getMessage();
- throw new ConfigurationException(msg, ie);
- } finally {
- this.resolver.release(source);
- }
- Configuration[] blocks = wiring.getChildren("block");
- for (int i = 0; i < blocks.length; i++) {
- Configuration block = blocks[i];
- getLogger().debug("BlocksManager configure: " + block.getName() +
- " id=" + block.getAttribute("id") +
- " location=" + block.getAttribute("location"));
- this.blockConfs.put(block.getAttribute("id"), block);
- }
- }
-
- public void initialize() throws Exception {
- getLogger().debug("Initializing the Blocks Manager");
-
- // Create a root service manager for blocks. This should be
- // the minimal number of components that are needed for any
- // block. Only components that not are context dependent
- // should be defined here. Block that depends on e.g. the root
- // context path should be defined in the BlockManager instead.
-
- Core core = (Core)this.serviceManager.lookup(Core.ROLE);
- ServiceManager blockParentServiceManager =
- new SingleComponentServiceManager(null, core, Core.ROLE);
- this.blockServiceManager =
- new CocoonServiceManager(blockParentServiceManager);
-
- Source coreComponentsSource =
- this.resolver.resolveURI(CORE_COMPONENTS_XCONF);
- DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
- Configuration coreComponentsConf =
- builder.build(coreComponentsSource.getInputStream());
-
- LifecycleHelper.setupComponent(blockServiceManager,
- this.getLogger(),
- this.context,
- null,
- coreComponentsConf);
-
- // Create and store all blocks
-
- Iterator confIter = this.blockConfs.entrySet().iterator();
- while (confIter.hasNext()) {
- Map.Entry entry = (Map.Entry)confIter.next();
- Configuration blockConf = (Configuration)entry.getValue();
- getLogger().debug("Creating " + blockConf.getName() +
- " id=" + blockConf.getAttribute("id"));
- BlockManager blockManager = new BlockManager();
- LifecycleHelper.setupComponent(blockManager,
- this.getLogger(),
- this.context,
- blockServiceManager,
- blockConf);
- blockManager.setBlocksManager(this);
- this.blocks.put(entry.getKey(), blockManager);
- String mountPath = blockConf.getChild("mount").getAttribute("path", null);
- if (mountPath != null) {
- this.mountedBlocks.put(mountPath, blockManager);
- getLogger().debug("Mounted block " + blockConf.getAttribute("id") +
- " at " + mountPath);
- }
- }
- }
-
- public void dispose() {
- Iterator blocksIter = this.blocks.entrySet().iterator();
- while (blocksIter.hasNext()) {
- LifecycleHelper.dispose(blocksIter.next());
- }
- if (this.blockServiceManager != null) {
- LifecycleHelper.dispose(this.blockServiceManager);
- this.blockServiceManager = null;
- }
- this.blocks = null;
- this.mountedBlocks = null;
- if (this.serviceManager != null) {
- this.serviceManager.release(this.resolver);
- this.resolver = null;
- this.serviceManager = null;
- }
- }
-
- /*
- The BlocksManager could be merged with the Cocoon object and be
- responsible for all processing. In that case it should
- implement Processor, at the moment it is called from a protocol
- and delagates to a BlockManager, so there is no point in
- implementing the whole Processor interface.
-
- The largest mount point that is a prefix of the URI is
- chosen. The implementation could be made much more efficient.
- */
- public boolean process(Environment environment) throws Exception {
- String uri = environment.getURI();
- String oldPrefix = environment.getURIPrefix();
- String oldURI = uri;
- // The mount points start with '/' make sure that the URI also
- // does, so that they are compareable.
- if (uri.length() == 0 || uri.charAt(0) != '/') {
- uri = "/" + uri;
- }
- // All mount points that are before or equal to the URI in
- // lexicographical order. This includes all prefixes.
- Map possiblePrefixes = mountedBlocks.tailMap(uri);
- Iterator possiblePrefixesIt = possiblePrefixes.entrySet().iterator();
- BlockManager block = null;
- String mountPoint = null;
- // Find the largest prefix to the uri
- while (possiblePrefixesIt.hasNext()) {
- Map.Entry entry = (Map.Entry) possiblePrefixesIt.next();
- mountPoint = (String)entry.getKey();
- if (uri.startsWith(mountPoint)) {
- block = (BlockManager)entry.getValue();
- break;
- }
- }
- if (block == null) {
- return false;
- } else {
- // Resolve the URI relative to the mount point
- uri = uri.substring(mountPoint.length());
- getLogger().debug("Enter processing in block at " + mountPoint);
- try {
- environment.setURI("", uri);
- // It is important to set the current block each time
- // a new block is entered, this is used for the block
- // protocol
- EnvironmentHelper.enterProcessor(block, null, environment);
- return block.process(environment);
- } finally {
- EnvironmentHelper.leaveProcessor();
- environment.setURI(oldPrefix, oldURI);
- getLogger().debug("Leaving processing in block at " + mountPoint);
- }
- }
- }
-
- public String getProperty(String blockId, String name) {
- BlockManager block = (BlockManager)this.blocks.get(blockId);
- if (block != null) {
- return block.getProperty(name);
- } else {
- return null;
- }
- }
-
- public URI absolutizeURI(URI uri) throws URISyntaxException {
- String mountPath =
- ((Configuration)this.blockConfs.get(uri.getScheme())).getChild("mount").getAttribute("path", null);
- if (mountPath == null)
- throw new URISyntaxException(uri.toString(), "No mount point for this URI");
- if (mountPath.endsWith("/"))
- mountPath = mountPath.substring(0, mountPath.length() - 1);
- String absoluteURI = mountPath + uri.getSchemeSpecificPart();
- getLogger().debug("Resolving " + uri.toString() + " to " + absoluteURI);
- return new URI(absoluteURI);
- }
-
- public boolean process(String blockId, Environment environment) throws Exception {
- return process(blockId, environment, false);
- }
-
- public boolean process(String blockId, Environment environment, boolean superCall)
- throws Exception {
- BlockManager block = (BlockManager)this.blocks.get(blockId);
- if (block == null) {
- return false;
- } else if (superCall) {
- getLogger().debug("Enter processing in super block " + blockId);
- try {
- // A super block should be called in the context of
- // the called block to get polymorphic calls resolved
- // in the right way. Therefore no new current block is
- // set.
- return block.process(environment);
- } finally {
- getLogger().debug("Leaving processing in super block " + blockId);
- }
- } else {
- getLogger().debug("Enter processing in block " + blockId);
- try {
- // It is important to set the current block each time
- // a new block is entered, this is used for the block
- // protocol
- EnvironmentHelper.enterProcessor(block, null, environment);
- return block.process(environment);
- } finally {
- EnvironmentHelper.leaveProcessor();
- getLogger().debug("Leaving processing in block " + blockId);
- }
- }
- }
-
- private static class InverseLexicographicalOrder implements Comparator {
- public int compare(Object o1, Object o2) {
- return ((String)o2).compareTo((String)o1);
- }
- }
-}
+/*
+ * Copyright 1999-2005 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.
+ */
+package org.apache.cocoon.components.blocks;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.cocoon.components.LifecycleHelper;
+import org.apache.cocoon.components.container.CocoonServiceManager;
+import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.container.SingleComponentServiceManager;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.xml.sax.SAXException;
+
+/**
+ * @version $Id:$
+ */
+public class BlocksManager
+ extends AbstractLogEnabled
+ implements Configurable, Contextualizable, Disposable, Initializable, Serviceable, ThreadSafe {
+
+ public static String ROLE = BlocksManager.class.getName();
+ public static String CORE_COMPONENTS_XCONF =
+ "resource://org/apache/cocoon/components/blocks/core-components.xconf";
+ private ServiceManager serviceManager;
+ private CocoonServiceManager blockServiceManager;
+ private SourceResolver resolver;
+ private Context context;
+
+ private HashMap blockConfs = new HashMap();
+ private HashMap blocks = new HashMap();
+ private TreeMap mountedBlocks = new TreeMap(new InverseLexicographicalOrder());
+
+ public void service(ServiceManager manager) throws ServiceException {
+ this.serviceManager = manager;
+ this.resolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE);
+ }
+
+ public void contextualize(Context context) throws ContextException {
+ this.context = context;
+ }
+
+ public void configure(Configuration config)
+ throws ConfigurationException {
+ String file = config.getAttribute("file");
+ Source source = null;
+ Configuration wiring = null;
+
+ // Read the wiring file
+ try {
+ source = this.resolver.resolveURI(file);
+ DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+ wiring = builder.build( source.getInputStream() );
+ } catch (SAXException se) {
+ String msg = "SAXException while reading " + file + ": " + se.getMessage();
+ throw new ConfigurationException(msg, se);
+ } catch (IOException ie) {
+ String msg = "IOException while reading " + file + ": " + ie.getMessage();
+ throw new ConfigurationException(msg, ie);
+ } finally {
+ this.resolver.release(source);
+ }
+ Configuration[] blocks = wiring.getChildren("block");
+ for (int i = 0; i < blocks.length; i++) {
+ Configuration block = blocks[i];
+ getLogger().debug("BlocksManager configure: " + block.getName() +
+ " id=" + block.getAttribute("id") +
+ " location=" + block.getAttribute("location"));
+ this.blockConfs.put(block.getAttribute("id"), block);
+ }
+ }
+
+ public void initialize() throws Exception {
+ getLogger().debug("Initializing the Blocks Manager");
+
+ // Create a root service manager for blocks. This should be
+ // the minimal number of components that are needed for any
+ // block. Only components that not are context dependent
+ // should be defined here. Block that depends on e.g. the root
+ // context path should be defined in the BlockManager instead.
+
+ Core core = (Core)this.serviceManager.lookup(Core.ROLE);
+ ServiceManager blockParentServiceManager =
+ new SingleComponentServiceManager(null, core, Core.ROLE);
+ this.blockServiceManager =
+ new CocoonServiceManager(blockParentServiceManager);
+
+ Source coreComponentsSource =
+ this.resolver.resolveURI(CORE_COMPONENTS_XCONF);
+ DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+ Configuration coreComponentsConf =
+ builder.build(coreComponentsSource.getInputStream());
+
+ LifecycleHelper.setupComponent(blockServiceManager,
+ this.getLogger(),
+ this.context,
+ null,
+ coreComponentsConf);
+
+ // Create and store all blocks
+
+ Iterator confIter = this.blockConfs.entrySet().iterator();
+ while (confIter.hasNext()) {
+ Map.Entry entry = (Map.Entry)confIter.next();
+ Configuration blockConf = (Configuration)entry.getValue();
+ getLogger().debug("Creating " + blockConf.getName() +
+ " id=" + blockConf.getAttribute("id"));
+ BlockManager blockManager = new BlockManager();
+ LifecycleHelper.setupComponent(blockManager,
+ this.getLogger(),
+ this.context,
+ blockServiceManager,
+ blockConf);
+ blockManager.setBlocksManager(this);
+ this.blocks.put(entry.getKey(), blockManager);
+ String mountPath = blockConf.getChild("mount").getAttribute("path", null);
+ if (mountPath != null) {
+ this.mountedBlocks.put(mountPath, blockManager);
+ getLogger().debug("Mounted block " + blockConf.getAttribute("id") +
+ " at " + mountPath);
+ }
+ }
+ }
+
+ public void dispose() {
+ Iterator blocksIter = this.blocks.entrySet().iterator();
+ while (blocksIter.hasNext()) {
+ LifecycleHelper.dispose(blocksIter.next());
+ }
+ if (this.blockServiceManager != null) {
+ LifecycleHelper.dispose(this.blockServiceManager);
+ this.blockServiceManager = null;
+ }
+ this.blocks = null;
+ this.mountedBlocks = null;
+ if (this.serviceManager != null) {
+ this.serviceManager.release(this.resolver);
+ this.resolver = null;
+ this.serviceManager = null;
+ }
+ }
+
+ /*
+ The BlocksManager could be merged with the Cocoon object and be
+ responsible for all processing. In that case it should
+ implement Processor, at the moment it is called from a protocol
+ and delagates to a BlockManager, so there is no point in
+ implementing the whole Processor interface.
+
+ The largest mount point that is a prefix of the URI is
+ chosen. The implementation could be made much more efficient.
+ */
+ public boolean process(Environment environment) throws Exception {
+ String uri = environment.getURI();
+ String oldPrefix = environment.getURIPrefix();
+ String oldURI = uri;
+ // The mount points start with '/' make sure that the URI also
+ // does, so that they are compareable.
+ if (uri.length() == 0 || uri.charAt(0) != '/') {
+ uri = "/" + uri;
+ }
+ // All mount points that are before or equal to the URI in
+ // lexicographical order. This includes all prefixes.
+ Map possiblePrefixes = mountedBlocks.tailMap(uri);
+ Iterator possiblePrefixesIt = possiblePrefixes.entrySet().iterator();
+ BlockManager block = null;
+ String mountPoint = null;
+ // Find the largest prefix to the uri
+ while (possiblePrefixesIt.hasNext()) {
+ Map.Entry entry = (Map.Entry) possiblePrefixesIt.next();
+ mountPoint = (String)entry.getKey();
+ if (uri.startsWith(mountPoint)) {
+ block = (BlockManager)entry.getValue();
+ break;
+ }
+ }
+ if (block == null) {
+ return false;
+ } else {
+ // Resolve the URI relative to the mount point
+ uri = uri.substring(mountPoint.length());
+ getLogger().debug("Enter processing in block at " + mountPoint);
+ try {
+ environment.setURI("", uri);
+ // It is important to set the current block each time
+ // a new block is entered, this is used for the block
+ // protocol
+ EnvironmentHelper.enterProcessor(block, null, environment);
+ return block.process(environment);
+ } finally {
+ EnvironmentHelper.leaveProcessor();
+ environment.setURI(oldPrefix, oldURI);
+ getLogger().debug("Leaving processing in block at " + mountPoint);
+ }
+ }
+ }
+
+ public String getProperty(String blockId, String name) {
+ BlockManager block = (BlockManager)this.blocks.get(blockId);
+ if (block != null) {
+ return block.getProperty(name);
+ } else {
+ return null;
+ }
+ }
+
+ public URI absolutizeURI(URI uri) throws URISyntaxException {
+ String mountPath =
+ ((Configuration)this.blockConfs.get(uri.getScheme())).getChild("mount").getAttribute("path", null);
+ if (mountPath == null)
+ throw new URISyntaxException(uri.toString(), "No mount point for this URI");
+ if (mountPath.endsWith("/"))
+ mountPath = mountPath.substring(0, mountPath.length() - 1);
+ String absoluteURI = mountPath + uri.getSchemeSpecificPart();
+ getLogger().debug("Resolving " + uri.toString() + " to " + absoluteURI);
+ return new URI(absoluteURI);
+ }
+
+ public boolean process(String blockId, Environment environment) throws Exception {
+ return process(blockId, environment, false);
+ }
+
+ public boolean process(String blockId, Environment environment, boolean superCall)
+ throws Exception {
+ BlockManager block = (BlockManager)this.blocks.get(blockId);
+ if (block == null) {
+ return false;
+ } else if (superCall) {
+ getLogger().debug("Enter processing in super block " + blockId);
+ try {
+ // A super block should be called in the context of
+ // the called block to get polymorphic calls resolved
+ // in the right way. Therefore no new current block is
+ // set.
+ return block.process(environment);
+ } finally {
+ getLogger().debug("Leaving processing in super block " + blockId);
+ }
+ } else {
+ getLogger().debug("Enter processing in block " + blockId);
+ try {
+ // It is important to set the current block each time
+ // a new block is entered, this is used for the block
+ // protocol
+ EnvironmentHelper.enterProcessor(block, null, environment);
+ return block.process(environment);
+ } finally {
+ EnvironmentHelper.leaveProcessor();
+ getLogger().debug("Leaving processing in block " + blockId);
+ }
+ }
+ }
+
+ private static class InverseLexicographicalOrder implements Comparator {
+ public int compare(Object o1, Object o2) {
+ return ((String)o2).compareTo((String)o1);
+ }
+ }
+}
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/core-components.xconf
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/classloader/ReloadingClassLoaderFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/classloader/ReloadingClassLoaderFactory.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/container/CocoonServiceManager.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/crawler/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/fam/SitemapMonitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/fam/SitemapMonitor.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/fam/SitemapMonitorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/fam/SitemapMonitorImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java?rev=292282&r1=292281&r2=292282&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java Wed Sep 28 12:54:16 2005
@@ -1,93 +1,93 @@
-/*
- * Copyright 1999-2005 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.
- */
-package org.apache.cocoon.components.flow;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Access to continuation data for monitoring applications
- */
-public class WebContinuationDataBean {
-
- private static final String TYPE_JAVAFLOW = "javaflow";
- private static final String TYPE_FLOWSCRIPT = "flowscript";
- private static final String HAS_EXPIRED_NO = "no";
- private static final String HAS_EXPIRED_YES = "yes";
-
- private WebContinuation wc;
- private SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
- private List _children = new ArrayList();
-
- public WebContinuationDataBean(WebContinuation wc) {
- this.wc = wc;
- for (Iterator it = wc.getChildren().iterator(); it.hasNext();) {
- WebContinuationDataBean child = new WebContinuationDataBean(
- (WebContinuation) it.next());
- this._children.add(child);
- }
- }
-
- public String getId() {
- return wc.getId();
- }
-
- public String getLastAccessTime() {
- return formatter.format(new Date(wc.getLastAccessTime()));
- }
-
- public String getInterpreterId() {
- return wc.getInterpreterId();
- }
-
- public String getTimeToLiveInMinutes() {
- return Long.toString(wc.getTimeToLive() / 1000 / 60);
- }
-
- public String getTimeToLive() {
- return Long.toString(wc.getTimeToLive());
- }
-
- public String getExpireTime() {
- return formatter.format(new Date(wc.getLastAccessTime()
- + wc.getTimeToLive()));
- }
-
- public String hasExpired() {
- if ((wc.getLastAccessTime() + wc.getTimeToLive()) < System
- .currentTimeMillis()) {
- return HAS_EXPIRED_YES;
- }
- return HAS_EXPIRED_NO;
-
- }
-
- public String getType() {
- if (wc.getUserObject().getClass().getName().indexOf(
- "FOM_WebContinuation") > 0) {
- return TYPE_FLOWSCRIPT;
- }
- return TYPE_JAVAFLOW;
- }
-
- public List get_children() {
- return this._children;
- }
-
-}
+/*
+ * Copyright 1999-2005 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.
+ */
+package org.apache.cocoon.components.flow;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Access to continuation data for monitoring applications
+ */
+public class WebContinuationDataBean {
+
+ private static final String TYPE_JAVAFLOW = "javaflow";
+ private static final String TYPE_FLOWSCRIPT = "flowscript";
+ private static final String HAS_EXPIRED_NO = "no";
+ private static final String HAS_EXPIRED_YES = "yes";
+
+ private WebContinuation wc;
+ private SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
+ private List _children = new ArrayList();
+
+ public WebContinuationDataBean(WebContinuation wc) {
+ this.wc = wc;
+ for (Iterator it = wc.getChildren().iterator(); it.hasNext();) {
+ WebContinuationDataBean child = new WebContinuationDataBean(
+ (WebContinuation) it.next());
+ this._children.add(child);
+ }
+ }
+
+ public String getId() {
+ return wc.getId();
+ }
+
+ public String getLastAccessTime() {
+ return formatter.format(new Date(wc.getLastAccessTime()));
+ }
+
+ public String getInterpreterId() {
+ return wc.getInterpreterId();
+ }
+
+ public String getTimeToLiveInMinutes() {
+ return Long.toString(wc.getTimeToLive() / 1000 / 60);
+ }
+
+ public String getTimeToLive() {
+ return Long.toString(wc.getTimeToLive());
+ }
+
+ public String getExpireTime() {
+ return formatter.format(new Date(wc.getLastAccessTime()
+ + wc.getTimeToLive()));
+ }
+
+ public String hasExpired() {
+ if ((wc.getLastAccessTime() + wc.getTimeToLive()) < System
+ .currentTimeMillis()) {
+ return HAS_EXPIRED_YES;
+ }
+ return HAS_EXPIRED_NO;
+
+ }
+
+ public String getType() {
+ if (wc.getUserObject().getClass().getName().indexOf(
+ "FOM_WebContinuation") > 0) {
+ return TYPE_FLOWSCRIPT;
+ }
+ return TYPE_JAVAFLOW;
+ }
+
+ public List get_children() {
+ return this._children;
+ }
+
+}
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/flow/WebContinuationDataBean.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/BlockPathModule.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/BlockPropertyModule.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ContextPathModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ContextPathModule.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/CookieModule.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ProjectPathModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ProjectPathModule.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/output/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/modules/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/pipeline/VirtualProcessingPipeline.java
('svn:executable' removed)
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/resolver/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlockSource.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlockSourceFactory.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlocksSource.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/BlocksSourceFactory.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/store/default.ccf
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/CocoonStoreJanitor.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/store/impl/ehcache.xml
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/AnnotationsFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/AnnotationsFilter.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/VPCNode.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/VPCNodeBuilder.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/VPCsNodeBuilder.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/xpointer/parser/xpointer-fw.jj
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/container/util/PropertyHelper.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/environment/internal/BlockEnvironmentHelper.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/environment/internal/PopEnvironmentChanger.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/environment/internal/PushEnvironmentChanger.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/generation/CSVGenerator.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/i18n/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/reading/VirtualPipelineReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/serialization/VirtualPipelineSerializer.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/servlet/SettingsHelper.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/transformation/TeeTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/transformation/VirtualPipelineTransformer.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java?rev=292282&r1=292281&r2=292282&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java Wed Sep 28 12:54:16 2005
@@ -28,7 +28,7 @@
* here to make it more reusable.
*
* @author <a href="mailto:bh22351@i-one.at">Bernhard Huber</a>
- * @version CVS $Id: EncodeURLTransformer.java 153227 2005-02-10 15:00:57Z cziegeler $
+ * @version CVS $Id$
*/
public class ElementAttributeMatching {
/**
Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/ElementAttributeMatching.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/ReflectionUtils.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/log/package.html
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/util/mime.types
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/trunk/src/java/org/apache/cocoon/xml/StringXMLizable.java
------------------------------------------------------------------------------
svn:keywords = Id