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 2006/07/27 15:49:42 UTC
svn commit: r426076 - in /lenya/trunk/src:
java/org/apache/lenya/cms/cocoon/components/modules/input/ modules/lucene/
modules/lucene/config/cocoon-xconf/
modules/lucene/java/src/org/apache/lenya/cms/lucene/
Author: andreas
Date: Thu Jul 27 06:49:42 2006
New Revision: 426076
URL: http://svn.apache.org/viewvc?rev=426076&view=rev
Log:
Added documentUrl attribute to DocumentInfoModule
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java
lenya/trunk/src/modules/lucene/config/cocoon-xconf/index-updater.xconf
lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdater.java
lenya/trunk/src/modules/lucene/sitemap.xmap
Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java?rev=426076&r1=426075&r2=426076&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/DocumentInfoModule.java Thu Jul 27 06:49:42 2006
@@ -67,6 +67,7 @@
protected final static int MIN_MANDATORY_PARAMS = 5;
protected final static String WEBAPP_URL = "webappUrl";
+ protected final static String DOCUMENT_URL = "documentUrl";
protected final static String RESOURCE_TYPE = "resourceType";
protected final static String LAST_MODIFIED = "lastModified";
protected final static String MIME_TYPE = "mimeType";
@@ -76,7 +77,7 @@
protected final static String[] PARAMS = { PARAM_PUBLICATION_ID, PARAM_AREA, PARAM_DOCUMENT_ID,
PARAM_DOCUMENT_LANGUAGE, PARAM_PROPERTY, VISIBLE_IN_NAVIGATION, MIME_TYPE,
- CONTENT_LENGTH, WEBAPP_URL };
+ CONTENT_LENGTH, WEBAPP_URL, DOCUMENT_URL };
protected final static String META_RESOURCE_TYPE = "resourceType";
protected final static String META_EXPIRES = "expires";
@@ -138,6 +139,8 @@
value = Long.toString(document.getContentLength());
} else if (attribute.equals(WEBAPP_URL)) {
value = document.getCanonicalWebappURL();
+ } else if (attribute.equals(DOCUMENT_URL)) {
+ value = document.getCanonicalDocumentURL();
} else if (attribute.equals(EXPIRES)) {
try {
Date expires = document.getExpires();
Modified: lenya/trunk/src/modules/lucene/config/cocoon-xconf/index-updater.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/config/cocoon-xconf/index-updater.xconf?rev=426076&r1=426075&r2=426076&view=diff
==============================================================================
--- lenya/trunk/src/modules/lucene/config/cocoon-xconf/index-updater.xconf (original)
+++ lenya/trunk/src/modules/lucene/config/cocoon-xconf/index-updater.xconf Thu Jul 27 06:49:42 2006
@@ -16,8 +16,8 @@
-->
<xconf xpath="/cocoon"
- if-prop="patch.webapp"
unless="/cocoon/component[@role = 'org.apache.lenya.cms.lucene.IndexUpdater']">
+ <!-- if-prop="patch.webapp" -->
<component logger="lucene.indexupdater"
role="org.apache.lenya.cms.lucene.IndexUpdater"
Modified: lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdater.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdater.java?rev=426076&r1=426075&r2=426076&view=diff
==============================================================================
--- lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdater.java (original)
+++ lenya/trunk/src/modules/lucene/java/src/org/apache/lenya/cms/lucene/IndexUpdater.java Thu Jul 27 06:49:42 2006
@@ -24,9 +24,7 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.source.SourceUtil;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
import org.apache.lenya.cms.observation.ObservationRegistry;
import org.apache.lenya.cms.observation.RepositoryEvent;
import org.apache.lenya.cms.observation.RepositoryListener;
@@ -40,9 +38,8 @@
public void documentChanged(RepositoryEvent event) {
Document doc = event.getDocument();
- SourceResolver resolver = null;
- Source source = null;
+ String uri = null;
try {
String[] formats = doc.getResourceType().getFormats();
if (!Arrays.asList(formats).contains("luceneIndex")) {
@@ -51,22 +48,14 @@
+ doc.getResourceType().getName() + "] does not support indexing!");
return;
}
- resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-
- String docString =
- doc.getPublication().getId() + "/" + doc.getArea() + doc.getId() + "/" + doc.getLanguage();
-
- source = resolver.resolveURI("cocoon://modules/lucene/index-document-index/" + docString + ".xml");
- SourceUtil.getInputSource(source);
+
+ String docString = doc.getPublication().getId() + "/" + doc.getArea() + doc.getId()
+ + "/" + doc.getLanguage();
+ uri = "cocoon://modules/lucene/index-document-index/" + docString + ".xml";
+ SourceUtil.readDOM(uri, this.manager);
} catch (Exception e) {
+ getLogger().error("Invoking indexing failed for URL [" + uri + "]: ", e);
throw new RuntimeException(e);
- } finally {
- if (resolver != null) {
- if (source != null) {
- resolver.release(source);
- }
- this.manager.release(resolver);
- }
}
}
Modified: lenya/trunk/src/modules/lucene/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/sitemap.xmap?rev=426076&r1=426075&r2=426076&view=diff
==============================================================================
--- lenya/trunk/src/modules/lucene/sitemap.xmap (original)
+++ lenya/trunk/src/modules/lucene/sitemap.xmap Thu Jul 27 06:49:42 2006
@@ -116,7 +116,7 @@
<map:generate src="{resource-type:{doc-info:{2}:{3}:/{4}:{5}:resourceType}:format-luceneIndex}/{2}/{3}/{4}/{5}"/>
<map:transform src="fallback://lenya/modules/lucene/xslt/index.xsl">
<map:parameter name="index" value="{2}-{3}"/>
- <map:parameter name="id" value="{doc-info:{2}:{3}:/{4}:{5}:webappUrl}"/>
+ <map:parameter name="id" value="{doc-info:{2}:{3}:/{4}:{5}:documentUrl}"/>
</map:transform>
<map:transform type="index2"/>
<map:serialize type="xml"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org