You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/03/04 17:42:17 UTC
svn commit: r633537 -
/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java
Author: andreas
Date: Tue Mar 4 08:42:17 2008
New Revision: 633537
URL: http://svn.apache.org/viewvc?rev=633537&view=rev
Log:
Removing extension cache from uuid2url transformer (will be replaced by global meta data cache).
Modified:
lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java
Modified: lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java?rev=633537&r1=633536&r2=633537&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java (original)
+++ lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/UuidToUrlTransformer.java Tue Mar 4 08:42:17 2008
@@ -30,7 +30,6 @@
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.commons.collections.map.LRUMap;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceValidity;
import org.apache.lenya.ac.AccessControlException;
@@ -38,8 +37,6 @@
import org.apache.lenya.cms.linking.LinkResolver;
import org.apache.lenya.cms.linking.LinkRewriter;
import org.apache.lenya.cms.linking.LinkTarget;
-import org.apache.lenya.cms.metadata.MetaData;
-import org.apache.lenya.cms.metadata.MetaDataException;
import org.apache.lenya.cms.publication.Area;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentFactory;
@@ -99,12 +96,6 @@
private String cacheKey;
private SourceValidity validity;
- private static LRUMap extensionCache;
-
- static {
- extensionCache = new LRUMap(10000);
- }
-
/**
* @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver,
* java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
@@ -237,39 +228,11 @@
* @return The required extension or, if it is null, the document's default extension.
*/
protected String getExtension(Document targetDocument, String requiredExtension) {
- String extension = requiredExtension != null ? requiredExtension : getExtension(targetDocument);
+ String extension = requiredExtension != null ? requiredExtension : targetDocument.getExtension();
if (extension.length() > 0) {
extension = "." + extension;
}
return extension;
- }
-
- /**
- * Get the extension of a document. The lookup of the extension requires loading the meta
- * data and is therefore very expensive, so we cache the extension.
- * @param targetDocument The target document.
- * @return A string.
- */
- protected String getExtension(Document targetDocument) {
- String key = targetDocument.getRepositoryNode().getSourceURI();
- Extension ex = null;
- try {
- MetaData meta = targetDocument.getMetaData("http://apache.org/lenya/metadata/document/1.0");
- if (extensionCache.containsKey(key)) {
- ex = (Extension) extensionCache.get(key);
- if (meta.getLastModified() > ex.lastModified) {
- ex = null;
- }
- }
- if (ex == null) {
- ex = new Extension(targetDocument.getExtension(), meta.getLastModified());
- extensionCache.put(key, ex);
- }
- } catch (MetaDataException e) {
- throw new RuntimeException(e);
- }
-
- return ex.extension;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org