You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2005/08/17 15:53:34 UTC
svn commit: r233174 - in /incubator/jackrabbit/trunk:
contrib/bdb-persistence/applications/test/
contrib/bdb-persistence/applications/test/workspaces/default/
contrib/bdb-persistence/applications/test/workspaces/test/
contrib/db-persistence/application...
Author: mreutegg
Date: Wed Aug 17 06:52:50 2005
New Revision: 233174
URL: http://svn.apache.org/viewcvs?rev=233174&view=rev
Log:
JCR-189: QueryHandler should use lucene Input-/OutputStream implementations
Modified:
incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/repository.xml
incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml
incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml
incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/repository.xml
incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/default/workspace.xml
incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/test/workspace.xml
incubator/jackrabbit/trunk/contrib/examples/src/repo/repository.xml
incubator/jackrabbit/trunk/contrib/jca/applications/test/repository.xml
incubator/jackrabbit/trunk/contrib/jcr-commands/applications/test/repository.xml
incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repository.xml
incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/test/workspace.xml
incubator/jackrabbit/trunk/contrib/tck-webapp/project.xml
incubator/jackrabbit/trunk/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml
incubator/jackrabbit/trunk/core/applications/test/repository.xml
incubator/jackrabbit/trunk/core/applications/test/workspaces/default/workspace.xml
incubator/jackrabbit/trunk/core/applications/test/workspaces/test/workspace.xml
incubator/jackrabbit/trunk/core/src/conf/repository.xml
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SearchManager.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/SearchConfig.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/RedoLog.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
incubator/jackrabbit/trunk/xdocs/firststeps.xml
Modified: incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -176,31 +176,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
-
- Supported parameters for lucene search index:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending
- queue until added to the index
- - forceConsistencyCheck: runs a consistency check on every startup. If
- false, a consistency check is only performed when the search index
- detects a prior forced shutdown.
- - autoRepair: errors detected by a consistency check are automatically
- repaired. If false, errors are only written to the log.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="forceConsistencyCheck" value="false"/>
- <param name="autoRepair" value="true"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml (original)
+++ incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/default/workspace.xml Wed Aug 17 06:52:50 2005
@@ -16,14 +16,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="1000" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index" />
- </FileSystem>
+ <param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml (original)
+++ incubator/jackrabbit/trunk/contrib/bdb-persistence/applications/test/workspaces/test/workspace.xml Wed Aug 17 06:52:50 2005
@@ -16,14 +16,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="1000" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index" />
- </FileSystem>
+ <param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -181,31 +181,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
-
- Supported parameters for lucene search index:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending
- queue until added to the index
- - forceConsistencyCheck: runs a consistency check on every startup. If
- false, a consistency check is only performed when the search index
- detects a prior forced shutdown.
- - autoRepair: errors detected by a consistency check are automatically
- repaired. If false, errors are only written to the log.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="forceConsistencyCheck" value="false"/>
- <param name="autoRepair" value="true"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/default/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/default/workspace.xml (original)
+++ incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/default/workspace.xml Wed Aug 17 06:52:50 2005
@@ -21,14 +21,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="1000" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index" />
- </FileSystem>
+ <param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/test/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/test/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/test/workspace.xml (original)
+++ incubator/jackrabbit/trunk/contrib/db-persistence/applications/test/workspaces/test/workspace.xml Wed Aug 17 06:52:50 2005
@@ -21,14 +21,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="1000" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index" />
- </FileSystem>
+ <param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/examples/src/repo/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/examples/src/repo/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/examples/src/repo/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/examples/src/repo/repository.xml Wed Aug 17 06:52:50 2005
@@ -13,9 +13,7 @@
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/versions">
Modified: incubator/jackrabbit/trunk/contrib/jca/applications/test/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jca/applications/test/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jca/applications/test/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jca/applications/test/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -194,31 +194,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
-
- Supported parameters for lucene search index:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending
- queue until added to the index
- - forceConsistencyCheck: runs a consistency check on every startup. If
- false, a consistency check is only performed when the search index
- detects a prior forced shutdown.
- - autoRepair: errors detected by a consistency check are automatically
- repaired. If false, errors are only written to the log.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="forceConsistencyCheck" value="false"/>
- <param name="autoRepair" value="true"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/jcr-commands/applications/test/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-commands/applications/test/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-commands/applications/test/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-commands/applications/test/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -190,23 +190,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
- Supported Parameters:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending queue until added to the index
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
-
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -197,20 +197,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
- Supported Parameters:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending queue until added to the index
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
-
+ <param name="path" value="${wsp.home}/index"/>
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}/index"/>
</FileSystem>
Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml (original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml Wed Aug 17 06:52:50 2005
@@ -20,11 +20,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="1000" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
+ <param name="path" value="${wsp.home}/index" />
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}/index" />
</FileSystem>
Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/test/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/test/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/test/workspace.xml (original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/test/workspace.xml Wed Aug 17 06:52:50 2005
@@ -20,11 +20,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="1000" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
+ <param name="path" value="${wsp.home}/index" />
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
<param name="path" value="${wsp.home}/index" />
</FileSystem>
Modified: incubator/jackrabbit/trunk/contrib/tck-webapp/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/tck-webapp/project.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/tck-webapp/project.xml (original)
+++ incubator/jackrabbit/trunk/contrib/tck-webapp/project.xml Wed Aug 17 06:52:50 2005
@@ -40,7 +40,7 @@
</dependency>
<dependency>
<id>commons-collections</id>
- <version>2.1</version>
+ <version>3.1</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
@@ -70,8 +70,25 @@
</dependency>
<!-- dependencies from jcr that we want to bundle -->
<dependency>
- <id>jackrabbit</id>
- <version>0.16.4.1-dev</version>
+ <groupId>jackrabbit</groupId>
+ <artifactId>jackrabbit-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>jackrabbit</groupId>
+ <artifactId>jackrabbit-commons</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>jackrabbit</groupId>
+ <artifactId>jackrabbit-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
<properties>
<war.bundle>true</war.bundle>
</properties>
Modified: incubator/jackrabbit/trunk/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml (original)
+++ incubator/jackrabbit/trunk/contrib/tck-webapp/src/webapp/WEB-INF/content-repository/repository.xml Wed Aug 17 06:52:50 2005
@@ -112,7 +112,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -187,23 +187,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
- Supported Parameters:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending queue until added to the index
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
-
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/core/applications/test/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/applications/test/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/applications/test/repository.xml (original)
+++ incubator/jackrabbit/trunk/core/applications/test/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -194,34 +194,9 @@
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
-
- Supported parameters for lucene search index:
- - useCompoundFile: advises lucene to use compound files for the index files
- - minMergeDocs: minimum number of nodes in an index until segments are merged
- - volatileIdleTime: idle time in seconds until the volatile index is
- moved to persistent index even though minMergeDocs is not reached.
- - maxMergeDocs: maximum number of nodes in segments that will be merged
- - mergeFactor: determines how often segment indices are merged
- - bufferSize: maximum number of documents that are held in a pending
- queue until added to the index
- - forceConsistencyCheck: runs a consistency check on every startup. If
- false, a consistency check is only performed when the search index
- detects a prior forced shutdown.
- - autoRepair: errors detected by a consistency check are automatically
- repaired. If false, errors are only written to the log.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
- <param name="volatileIdleTime" value="3"/>
- <param name="maxMergeDocs" value="100000"/>
- <param name="mergeFactor" value="10"/>
- <param name="bufferSize" value="10"/>
- <param name="forceConsistencyCheck" value="false"/>
- <param name="autoRepair" value="true"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/core/applications/test/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/applications/test/workspaces/default/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/applications/test/workspaces/default/workspace.xml (original)
+++ incubator/jackrabbit/trunk/core/applications/test/workspaces/default/workspace.xml Wed Aug 17 06:52:50 2005
@@ -19,14 +19,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="100" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index" />
- </FileSystem>
+ <param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/core/applications/test/workspaces/test/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/applications/test/workspaces/test/workspace.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/applications/test/workspaces/test/workspace.xml (original)
+++ incubator/jackrabbit/trunk/core/applications/test/workspaces/test/workspace.xml Wed Aug 17 06:52:50 2005
@@ -19,14 +19,7 @@
Search index and the file system it uses.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <param name="useCompoundFile" value="true" />
- <param name="minMergeDocs" value="100" />
- <param name="maxMergeDocs" value="100000" />
- <param name="mergeFactor" value="10" />
- <param name="bufferSize" value="10"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index" />
- </FileSystem>
+ <param name="path" value="${wsp.home}/index" />
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/core/src/conf/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/conf/repository.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/conf/repository.xml (original)
+++ incubator/jackrabbit/trunk/core/src/conf/repository.xml Wed Aug 17 06:52:50 2005
@@ -111,7 +111,7 @@
(used by the QueryHandler); the class attribute specifies the
FQN of the class implementing the QueryHandler interface.
-->
- <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ELEMENT SearchIndex (param*,FileSystem?)>
<!ATTLIST SearchIndex
class CDATA #REQUIRED>
@@ -195,7 +195,11 @@
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
+ If required by the QueryHandler implementation, one may configure
+ a FileSystem that the handler may use.
+
Supported parameters for lucene search index:
+ - path: location of the index. This parameter is mandatory!
- useCompoundFile: advises lucene to use compound files for the index files
- minMergeDocs: minimum number of nodes in an index until segments are merged
- volatileIdleTime: idle time in seconds until the volatile index is
@@ -209,19 +213,20 @@
detects a prior forced shutdown.
- autoRepair: errors detected by a consistency check are automatically
repaired. If false, errors are only written to the log.
+
+ Note: all parameters (except path) in this SearchIndex config are default
+ values and can be omitted.
-->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${wsp.home}/index"/>
<param name="useCompoundFile" value="true"/>
- <param name="minMergeDocs" value="1000"/>
+ <param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
<param name="maxMergeDocs" value="100000"/>
<param name="mergeFactor" value="10"/>
<param name="bufferSize" value="10"/>
<param name="forceConsistencyCheck" value="false"/>
<param name="autoRepair" value="true"/>
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
</SearchIndex>
</Workspace>
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SearchManager.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SearchManager.java Wed Aug 17 06:52:50 2005
@@ -29,7 +29,6 @@
import org.apache.jackrabbit.core.query.QueryImpl;
import org.apache.jackrabbit.core.state.ItemStateException;
import org.apache.jackrabbit.core.state.ItemStateManager;
-import org.apache.jackrabbit.core.state.NodeState;
import org.apache.jackrabbit.core.state.ItemState;
import org.apache.jackrabbit.name.Path;
import org.apache.log4j.Logger;
@@ -101,6 +100,7 @@
ItemStateManager itemMgr) throws RepositoryException {
this.fs = config.getFileSystem();
this.itemMgr = itemMgr;
+
// register namespaces
NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry();
try {
@@ -143,7 +143,9 @@
public void close() {
try {
handler.close();
- fs.close();
+ if (fs != null) {
+ fs.close();
+ }
} catch (IOException e) {
log.error("Exception closing QueryHandler.", e);
} catch (FileSystemException e) {
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java Wed Aug 17 06:52:50 2005
@@ -306,15 +306,18 @@
* <FileSystem ...>
* </Search>
* </pre>
- * <p>
+ * <p/>
* Both the <code>SearchIndex</code> and <code>FileSystem</code>
* elements are {@link #parseBeanConfig(Element,String) bean configuration}
* elements. If the search implementation class is not given, then
* a default implementation is used.
- * <p>
+ * <p/>
* The search index is an optional feature of workspace configuration.
* If the search configuration element is not found, then this method
* returns <code>null</code>.
+ * <p/>
+ * The FileSystem element in a search index configuration is optional.
+ * However some implementations may require a FileSystem.
*
* @param parent parent of the <code>SearchIndex</code> element
* @return search configuration, or <code>null</code>
@@ -336,9 +339,12 @@
// Search parameters
Properties parameters = parseParameters(element);
- // File system implementation
- FileSystemConfig fsc = new FileSystemConfig(
- parseBeanConfig(element, FILE_SYSTEM_ELEMENT));
+ // Optional file system implementation
+ FileSystemConfig fsc = null;
+ if (getElement(element, FILE_SYSTEM_ELEMENT, false) != null) {
+ fsc = new FileSystemConfig(
+ parseBeanConfig(element, FILE_SYSTEM_ELEMENT));
+ }
return new SearchConfig(className, parameters, fsc);
}
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/SearchConfig.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/SearchConfig.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/SearchConfig.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/config/SearchConfig.java Wed Aug 17 06:52:50 2005
@@ -25,7 +25,7 @@
* is used to create configured search index objects.
* <p>
* In addition to generic bean configuration information, this
- * class also contains a configured file system implementation
+ * class also contains an optionally configured file system implementation
* used by the search index.
*
* @see WorkspaceConfig#getSearchConfig()
@@ -33,7 +33,8 @@
public class SearchConfig extends BeanConfig {
/**
- * The search index file system configuration.
+ * The search index file system configuration, or <code>null</code> if
+ * none is provided.
*/
private final FileSystemConfig fsc;
@@ -42,7 +43,8 @@
*
* @param className search index implementation class
* @param properties search index properties
- * @param fsc search index file system configuration
+ * @param fsc search index file system configuration, or <code>null</code>
+ * if none is configured.
*/
SearchConfig(
String className, Properties properties, FileSystemConfig fsc) {
@@ -51,12 +53,14 @@
}
/**
- * Initializes the search index file system.
+ * Initializes the search index file system if one is configured.
*
* @throws ConfigurationException on file system configuration errors
*/
public void init() throws ConfigurationException {
- fsc.init();
+ if (fsc != null) {
+ fsc.init();
+ }
}
/**
@@ -69,11 +73,15 @@
}
/**
- * Returns the search index file system.
+ * Returns the search index file system, or <code>null</code> if none is
+ * configured.
*
* @return search index file system
*/
public FileSystem getFileSystem() {
+ if (fsc == null) {
+ return null;
+ }
return fsc.getFileSystem();
}
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/QueryHandlerContext.java Wed Aug 17 06:52:50 2005
@@ -56,7 +56,9 @@
* Creates a new context instance.
*
* @param fs a {@link FileSystem} this <code>QueryHandler</code> may
- * use to store its index.
+ * use to store its index. If no <code>FileSystem</code>
+ * has been configured <code>fs</code> is
+ * <code>null</code>.
* @param stateMgr provides persistent item states.
* @param rootUUID the uuid of the root node.
* @param ntRegistry the node type registry.
@@ -85,8 +87,9 @@
}
/**
- * Returns the {@link org.apache.jackrabbit.core.fs.FileSystem} instance
- * this <code>QueryHandler</code> may use to store its index.
+ * Returns the {@link FileSystem} instance this <code>QueryHandler</code>
+ * may use to store its index. If no <code>FileSystem</code> has been
+ * configured this method returns <code>null</code>.
*
* @return the <code>FileSystem</code> instance for this
* <code>QueryHandler</code>.
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/IndexInfos.java Wed Aug 17 06:52:50 2005
@@ -16,16 +16,19 @@
*/
package org.apache.jackrabbit.core.query.lucene;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
+ * Stores a sequence of index names.
*/
class IndexInfos {
@@ -59,6 +62,17 @@
}
/**
+ * Returns <code>true</code> if this index infos exists in
+ * <code>dir</code>.
+ *
+ * @param dir the directory where to look for the index infos.
+ * @return <code>true</code> if it exists; <code>false</code> otherwise.
+ */
+ boolean exists(File dir) {
+ return new File(dir, name).exists();
+ }
+
+ /**
* Returns the name of the file where infos are stored.
*
* @return the name of the file where infos are stored.
@@ -69,45 +83,55 @@
/**
* Reads the index infos.
- * @param fs the base file system
- * @throws FileSystemException if an error occurs.
+ *
+ * @param dir the directory from where to read the index infos.
* @throws IOException if an error occurs.
*/
- void read(FileSystem fs) throws FileSystemException, IOException {
- DataInputStream input = new DataInputStream(fs.getInputStream(name));
+ void read(File dir) throws IOException {
+ InputStream in = new FileInputStream(new File(dir, name));
try {
- counter = input.readInt();
- for (int i = input.readInt(); i > 0; i--) {
- indexes.add(input.readUTF());
+ DataInputStream di = new DataInputStream(in);
+ counter = di.readInt();
+ for (int i = di.readInt(); i > 0; i--) {
+ indexes.add(di.readUTF());
}
} finally {
- input.close();
+ in.close();
}
}
/**
* Writes the index infos to disk if they are dirty.
- * @param fs the base file system
- * @throws FileSystemException if an error occurs.
+ *
+ * @param dir the directory where to write the index infos.
* @throws IOException if an error occurs.
*/
- void write(FileSystem fs) throws FileSystemException, IOException {
+ void write(File dir) throws IOException {
// do not write if not dirty
if (!dirty) {
return;
}
- DataOutputStream output = new DataOutputStream(fs.getOutputStream(name + ".new"));
+ File nu = new File(dir, name + ".new");
+ OutputStream out = new FileOutputStream(nu);
try {
- output.writeInt(counter);
- output.writeInt(indexes.size());
+ DataOutputStream dataOut = new DataOutputStream(out);
+ dataOut.writeInt(counter);
+ dataOut.writeInt(indexes.size());
for (int i = 0; i < indexes.size(); i++) {
- output.writeUTF(getName(i));
+ dataOut.writeUTF(getName(i));
}
} finally {
- output.close();
+ out.close();
+ }
+ // delete old
+ File old = new File(dir, name);
+ if (old.exists() && !old.delete()) {
+ throw new IOException("Unable to delete file: " + old.getAbsolutePath());
+ }
+ if (!nu.renameTo(old)) {
+ throw new IOException("Unable to rename file: " + nu.getAbsolutePath());
}
- fs.move(name + ".new", name);
dirty = false;
}
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/MultiIndex.java Wed Aug 17 06:52:50 2005
@@ -17,10 +17,6 @@
package org.apache.jackrabbit.core.query.lucene;
import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.fs.BasedFileSystem;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-import org.apache.jackrabbit.core.fs.FileSystemResource;
import org.apache.jackrabbit.core.state.ItemStateException;
import org.apache.jackrabbit.core.state.ItemStateManager;
import org.apache.jackrabbit.core.state.NoSuchItemStateException;
@@ -33,6 +29,7 @@
import javax.jcr.RepositoryException;
import java.io.IOException;
+import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -99,7 +96,7 @@
/**
* The base filesystem to store the index.
*/
- private final FileSystem fs;
+ private final File indexDir;
/**
* The query handler
@@ -147,41 +144,42 @@
/**
* Creates a new MultiIndex.
*
- * @param fs the base file system
+ * @param indexDir the base file system
* @param handler the search handler
* @param stateMgr shared item state manager
* @param rootUUID uuid of the root node
- * @throws FileSystemException if an error occurs
* @throws IOException if an error occurs
*/
- MultiIndex(FileSystem fs,
+ MultiIndex(File indexDir,
SearchIndex handler,
ItemStateManager stateMgr,
- String rootUUID) throws FileSystemException, IOException {
+ String rootUUID) throws IOException {
- this.fs = fs;
+ this.indexDir = indexDir;
this.handler = handler;
boolean doInitialIndex = false;
- if (fs.exists(indexNames.getFileName())) {
- indexNames.read(fs);
+ if (indexNames.exists(indexDir)) {
+ indexNames.read(indexDir);
} else {
doInitialIndex = true;
}
- if (fs.exists(deletable.getFileName())) {
- deletable.read(fs);
+ if (deletable.exists(indexDir)) {
+ deletable.read(indexDir);
}
// try to remove deletable files if there are any
attemptDelete();
// read namespace mappings
- FileSystemResource mapFile = new FileSystemResource(fs, NS_MAPPING_FILE);
+ File mapFile = new File(indexDir, NS_MAPPING_FILE);
nsMappings = new NamespaceMappings(mapFile);
try {
// open persistent indexes
for (int i = 0; i < indexNames.size(); i++) {
- FileSystem sub = new BasedFileSystem(fs, indexNames.getName(i));
- sub.init();
+ File sub = new File(indexDir, indexNames.getName(i));
+ if (!sub.exists() && !sub.mkdir()) {
+ throw new IOException("Unable to create directory: " + sub.getAbsolutePath());
+ }
PersistentIndex index = new PersistentIndex(indexNames.getName(i), sub, false, handler.getAnalyzer());
index.setMaxMergeDocs(handler.getMaxMergeDocs());
index.setMergeFactor(handler.getMergeFactor());
@@ -192,7 +190,7 @@
// create volatile index and check / apply redo log
// init volatile index
- RedoLog redoLog = new RedoLog(new FileSystemResource(fs, REDO_LOG));
+ RedoLog redoLog = new RedoLog(new File(indexDir, REDO_LOG));
if (redoLog.hasEntries()) {
// when we have entries in the redo log there is no need to reindex
@@ -233,8 +231,6 @@
}
} catch (ItemStateException e) {
throw new IOException("Error indexing root node: " + e.getMessage());
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
} catch (RepositoryException e) {
throw new IOException("Error indexing root node: " + e.getMessage());
}
@@ -487,30 +483,20 @@
// check if volatile index contains documents at all
if (volatileIndex.getIndexReader().numDocs() > 0) {
- // create new index folder
- String name = indexNames.newName();
- FileSystem sub = new BasedFileSystem(fs, name);
- PersistentIndex index;
- try {
- sub.init();
- index = new PersistentIndex(name, sub, true, handler.getAnalyzer());
- index.setMaxMergeDocs(handler.getMaxMergeDocs());
- index.setMergeFactor(handler.getMergeFactor());
- index.setMinMergeDocs(handler.getMinMergeDocs());
- index.setUseCompoundFile(handler.getUseCompoundFile());
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+
+ File sub = newIndexFolder();
+ String name = sub.getName();
+ PersistentIndex index = new PersistentIndex(name, sub, true, handler.getAnalyzer());
+ index.setMaxMergeDocs(handler.getMaxMergeDocs());
+ index.setMergeFactor(handler.getMergeFactor());
+ index.setMinMergeDocs(handler.getMinMergeDocs());
+ index.setUseCompoundFile(handler.getUseCompoundFile());
index.mergeIndex(volatileIndex);
// if merge has been successful add index
- try {
- indexes.add(index);
- indexNames.addName(name);
- indexNames.write(fs);
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+ indexes.add(index);
+ indexNames.addName(name);
+ indexNames.write(indexDir);
// check if obsolete indexes can be deleted
// todo move to other place?
@@ -523,11 +509,8 @@
}
// reset redo log
- try {
- volatileIndex.getRedoLog().clear();
- } catch (FileSystemException e) {
- log.error("Internal error: Unable to clear redo log.", e);
- }
+ volatileIndex.getRedoLog().clear();
+
// create new volatile index
volatileIndex = new VolatileIndex(handler.getAnalyzer(), volatileIndex.getRedoLog());
volatileIndex.setUseCompoundFile(false);
@@ -580,21 +563,16 @@
}
// make sure at least one persistent index exists
if (indexes.size() == 0) {
- try {
- String name = indexNames.newName();
- FileSystem sub = new BasedFileSystem(fs, name);
- sub.init();
- PersistentIndex index = new PersistentIndex(name, sub, true, handler.getAnalyzer());
- index.setMaxMergeDocs(handler.getMaxMergeDocs());
- index.setMergeFactor(handler.getMergeFactor());
- index.setMinMergeDocs(handler.getMinMergeDocs());
- index.setUseCompoundFile(handler.getUseCompoundFile());
- indexes.add(index);
- indexNames.addName(name);
- indexNames.write(fs);
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+ File sub = newIndexFolder();
+ String name = sub.getName();
+ PersistentIndex index = new PersistentIndex(name, sub, true, handler.getAnalyzer());
+ index.setMaxMergeDocs(handler.getMaxMergeDocs());
+ index.setMergeFactor(handler.getMergeFactor());
+ index.setMinMergeDocs(handler.getMinMergeDocs());
+ index.setUseCompoundFile(handler.getUseCompoundFile());
+ indexes.add(index);
+ indexNames.addName(name);
+ indexNames.write(indexDir);
}
// add node to last index
PersistentIndex last = (PersistentIndex) indexes.get(indexes.size() - 1);
@@ -635,25 +613,16 @@
if (!index.hasDocuments()) {
indexes.remove(i);
indexNames.removeName(index.getName());
+ indexNames.write(indexDir);
index.close();
- try {
- fs.deleteFolder(index.getName());
- } catch (FileSystemException e) {
+ File dir = new File(indexDir, index.getName());
+ if (!deleteIndex(dir)) {
// try again later
deletable.addName(index.getName());
- try {
- deletable.write(fs);
- } catch (FileSystemException e1) {
- throw new IOException(e.getMessage());
- }
+ deletable.write(indexDir);
}
}
}
- try {
- indexNames.write(fs);
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
// only check for merge if there are more than mergeFactor indexes
if (indexes.size() >= handler.getMergeFactor()) {
@@ -693,19 +662,14 @@
*/
private void mergeIndex(int min) throws IOException {
// create new index
- String name = indexNames.newName();
- FileSystem sub = new BasedFileSystem(fs, name);
- PersistentIndex index;
- try {
- sub.init();
- index = new PersistentIndex(name, sub, true, handler.getAnalyzer());
- index.setMaxMergeDocs(handler.getMaxMergeDocs());
- index.setMergeFactor(handler.getMergeFactor());
- index.setMinMergeDocs(handler.getMinMergeDocs());
- index.setUseCompoundFile(handler.getUseCompoundFile());
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+ File sub = newIndexFolder();
+ String name = sub.getName();
+ PersistentIndex index = new PersistentIndex(name, sub, true, handler.getAnalyzer());
+ index.setMaxMergeDocs(handler.getMaxMergeDocs());
+ index.setMergeFactor(handler.getMergeFactor());
+ index.setMinMergeDocs(handler.getMinMergeDocs());
+ index.setUseCompoundFile(handler.getUseCompoundFile());
+
// the indexes to merge
List toMerge = indexes.subList(min, indexes.size());
IndexReader[] readers = new IndexReader[toMerge.size()];
@@ -716,30 +680,22 @@
index.getIndexWriter().addIndexes(readers);
index.getIndexWriter().optimize();
// close and remove obsolete indexes
+
for (int i = indexes.size() - 1; i >= min; i--) {
PersistentIndex pi = (PersistentIndex) indexes.get(i);
pi.close();
- try {
- fs.deleteFolder(pi.getName());
- } catch (FileSystemException e) {
+ File dir = new File(indexDir, pi.getName());
+ if (!deleteIndex(dir)) {
// try again later
deletable.addName(pi.getName());
- try {
- deletable.write(fs);
- } catch (FileSystemException e1) {
- throw new IOException(e.getMessage());
- }
}
indexNames.removeName(pi.getName());
indexes.remove(i);
}
indexNames.addName(name);
indexes.add(index);
- try {
- indexNames.write(fs);
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+ indexNames.write(indexDir);
+ deletable.write(indexDir);
}
/**
@@ -748,19 +704,60 @@
private void attemptDelete() {
for (int i = deletable.size() - 1; i >= 0; i--) {
String indexName = deletable.getName(i);
- try {
- fs.deleteFolder(indexName);
+ File dir = new File(indexDir, indexName);
+ if (deleteIndex(dir)) {
deletable.removeName(i);
- } catch (FileSystemException e) {
+ } else {
log.info("Unable to delete obsolete index: " + indexName);
}
}
try {
- deletable.write(fs);
- } catch (Exception e) {
- // catches IOException and FileSystemException
+ deletable.write(indexDir);
+ } catch (IOException e) {
log.warn("Exception while writing deletable indexes: " + e);
}
+ }
+
+ /**
+ * Deletes the index <code>directory</code>.
+ *
+ * @param directory the index directory to delete.
+ * @return <code>true</code> if the delete was successful,
+ * <code>false</code> otherwise.
+ */
+ private boolean deleteIndex(File directory) {
+ // trivial if it does not exist anymore
+ if (!directory.exists()) {
+ return true;
+ }
+ // delete files first
+ File[] files = directory.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ if (!files[i].delete()) {
+ return false;
+ }
+ }
+ // now delete directory itself
+ return directory.delete();
+ }
+
+ /**
+ * Returns an new index folder which is empty.
+ *
+ * @return the new index folder.
+ * @throws IOException if the folder cannot be created.
+ */
+ private File newIndexFolder() throws IOException {
+ // create new index folder. make sure it does not exist
+ File sub;
+ do {
+ sub = new File(indexDir, indexNames.newName());
+ } while (sub.exists());
+
+ if (!sub.mkdir()) {
+ throw new IOException("Unable to create directory: " + sub.getAbsolutePath());
+ }
+ return sub;
}
/**
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/NamespaceMappings.java Wed Aug 17 06:52:50 2005
@@ -16,8 +16,6 @@
*/
package org.apache.jackrabbit.core.query.lucene;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-import org.apache.jackrabbit.core.fs.FileSystemResource;
import org.apache.jackrabbit.name.IllegalNameException;
import org.apache.jackrabbit.name.NamespaceResolver;
import org.apache.jackrabbit.name.NoPrefixDeclaredException;
@@ -30,6 +28,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -55,7 +56,7 @@
/**
* Location of the file that persists the uri / prefix mappings
*/
- private final FileSystemResource storage;
+ private final File storage;
/**
* Map of uris indexed by prefixes
@@ -80,7 +81,7 @@
* @throws IOException if an error occurs while reading initial namespace
* mappings from <code>file</code>.
*/
- public NamespaceMappings(FileSystemResource file) throws IOException {
+ public NamespaceMappings(File file) throws IOException {
storage = file;
load();
}
@@ -158,31 +159,27 @@
* @throws IOException if an error occurs while reading from the file.
*/
private void load() throws IOException {
- try {
- if (storage.exists()) {
- InputStream in = storage.getInputStream();
- try {
- Properties props = new Properties();
- log.debug("loading namespace mappings...");
- props.load(in);
-
- // read mappings from properties
- Iterator iter = props.keySet().iterator();
- while (iter.hasNext()) {
- String prefix = (String) iter.next();
- String uri = props.getProperty(prefix);
- log.debug(prefix + " -> " + uri);
- prefixToURI.put(prefix, uri);
- uriToPrefix.put(uri, prefix);
- }
- prefixCount = props.size();
- log.debug("namespace mappings loaded.");
- } finally {
- in.close();
+ if (storage.exists()) {
+ InputStream in = new FileInputStream(storage);
+ try {
+ Properties props = new Properties();
+ log.debug("loading namespace mappings...");
+ props.load(in);
+
+ // read mappings from properties
+ Iterator iter = props.keySet().iterator();
+ while (iter.hasNext()) {
+ String prefix = (String) iter.next();
+ String uri = props.getProperty(prefix);
+ log.debug(prefix + " -> " + uri);
+ prefixToURI.put(prefix, uri);
+ uriToPrefix.put(uri, prefix);
}
+ prefixCount = props.size();
+ log.debug("namespace mappings loaded.");
+ } finally {
+ in.close();
}
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
}
}
@@ -202,13 +199,10 @@
props.setProperty(prefix, uri);
}
- OutputStream out = null;
+ OutputStream out = new FileOutputStream(storage);
try {
- storage.makeParentDirs();
- out = new BufferedOutputStream(storage.getOutputStream());
+ out = new BufferedOutputStream(out);
props.store(out, null);
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
} finally {
// make sure stream is closed
out.close();
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/PersistentIndex.java Wed Aug 17 06:52:50 2005
@@ -16,15 +16,15 @@
*/
package org.apache.jackrabbit.core.query.lucene;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.FileSystemException;
import org.apache.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.FSDirectory;
import java.io.IOException;
+import java.io.File;
/**
* Implements a lucene index which is based on a
@@ -41,9 +41,6 @@
/** Name of the commit lock file */
private static final String COMMIT_LOCK = IndexWriter.COMMIT_LOCK_NAME;
- /** The underlying filesystem to store the index */
- private final FileSystem fs;
-
/** The name of this persistent index */
private final String name;
@@ -52,39 +49,36 @@
/**
* Creates a new <code>PersistentIndex</code> based on the file system
- * <code>fs</code>.
+ * <code>indexDir</code>.
* @param name the name of this index.
- * @param fs the underlying file system.
+ * @param indexDir the directory to store the index.
* @param create if <code>true</code> an existing index is deleted.
* @param analyzer the analyzer for text tokenizing.
* @throws IOException if an error occurs while opening / creating the
* index.
- * @throws FileSystemException if an error occurs while opening / creating
+ * @throws IOException if an error occurs while opening / creating
* the index.
*/
- PersistentIndex(String name, FileSystem fs, boolean create, Analyzer analyzer)
- throws FileSystemException, IOException {
- super(analyzer, FileSystemDirectory.getDirectory(fs, create));
+ PersistentIndex(String name, File indexDir, boolean create, Analyzer analyzer)
+ throws IOException {
+ super(analyzer, FSDirectory.getDirectory(indexDir, create));
this.name = name;
- this.fs = fs;
// check if index is locked, probably from an unclean repository
// shutdown
- if (fs.exists(WRITE_LOCK)) {
+ File writeLock = new File(indexDir, WRITE_LOCK);
+ if (writeLock.exists()) {
lockEncountered = true;
log.warn("Removing write lock on search index.");
- try {
- fs.deleteFile(WRITE_LOCK);
- } catch (FileSystemException e) {
+ if (!writeLock.delete()) {
log.error("Unable to remove write lock on search index.");
}
}
- if (fs.exists(COMMIT_LOCK)) {
+ File commitLock = new File(indexDir, COMMIT_LOCK);
+ if (commitLock.exists()) {
lockEncountered = true;
log.warn("Removing commit lock on search index.");
- try {
- fs.deleteFile(COMMIT_LOCK);
- } catch (FileSystemException e) {
+ if (!commitLock.delete()) {
log.error("Unable to remove write lock on search index.");
}
}
@@ -117,15 +111,6 @@
index.getDirectory()
});
invalidateSharedReader();
- }
-
- /**
- * Returns the underlying directory.
- * @return the directory.
- * @throws IOException if an error occurs.
- */
- Directory getDirectory() throws IOException {
- return FileSystemDirectory.getDirectory(fs, false);
}
/**
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/RedoLog.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/RedoLog.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/RedoLog.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/RedoLog.java Wed Aug 17 06:52:50 2005
@@ -16,9 +16,6 @@
*/
package org.apache.jackrabbit.core.query.lucene;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-import org.apache.jackrabbit.core.fs.FileSystemResource;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
import org.apache.jackrabbit.uuid.Constants;
import org.apache.log4j.Logger;
@@ -29,6 +26,10 @@
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -57,7 +58,7 @@
};
/** The log file */
- private final FileSystemResource logFile;
+ private final File logFile;
/** The number of log enties in the log file */
private int entryCount = 0;
@@ -70,16 +71,12 @@
* <code>logFile</code>
* @param log the redo log file.
*/
- RedoLog(FileSystemResource log) throws FileSystemException {
+ RedoLog(File log) throws IOException {
this.logFile = log;
// create the log file if not there
if (!log.exists()) {
- log.makeParentDirs();
- try {
- log.getOutputStream().close();
- } catch (IOException e) {
- throw new FileSystemException("Unable to create redo log file:", e);
- }
+ log.getParentFile().mkdirs();
+ log.createNewFile();
}
read(DUMMY_COLLECTOR);
}
@@ -105,10 +102,10 @@
/**
* Returns a collection with all {@link Entry} instances in the redo log.
* @return an collection with all {@link Entry} instances in the redo log.
- * @throws FileSystemException if an error occurs while reading from the
+ * @throws IOException if an error occurs while reading from the
* redo log.
*/
- Collection getEntries() throws FileSystemException {
+ Collection getEntries() throws IOException {
final List entries = new ArrayList();
read(new EntryCollector() {
public void collect(Entry entry) {
@@ -121,84 +118,60 @@
/**
* Informs this redo log that a node has been added.
* @param uuid the uuid of the node.
- * @throws FileSystemException if the node cannot be written to the redo
+ * @throws IOException if the node cannot be written to the redo
* log.
*/
- void nodeAdded(String uuid) throws FileSystemException {
+ void nodeAdded(String uuid) throws IOException {
initOut();
- try {
- out.write(new Entry(uuid, Entry.NODE_ADDED).toString());
- out.write('\n');
- entryCount++;
- } catch (IOException e) {
- throw new FileSystemException(e.getMessage(), e);
- }
+ out.write(new Entry(uuid, Entry.NODE_ADDED).toString() + "\n");
+ entryCount++;
}
/**
* Informs this redo log that a node has been removed.
* @param uuid the uuid of the node.
- * @throws FileSystemException if the node cannot be written to the redo
+ * @throws IOException if the node cannot be written to the redo
* log.
*/
- void nodeRemoved(String uuid) throws FileSystemException {
+ void nodeRemoved(String uuid) throws IOException {
initOut();
- try {
- out.write(new Entry(uuid, Entry.NODE_REMOVED).toString());
- out.write('\n');
- entryCount++;
- } catch (IOException e) {
- throw new FileSystemException(e.getMessage(), e);
- }
+ out.write(new Entry(uuid, Entry.NODE_REMOVED).toString() + "\n");
+ entryCount++;
}
/**
* Flushes all pending writes to the underlying file.
- * @throws FileSystemException if an error occurs while writing.
+ * @throws IOException if an error occurs while writing.
*/
- void flush() throws FileSystemException {
- try {
- if (out != null) {
- out.flush();
- }
- } catch (IOException e) {
- throw new FileSystemException(e.getMessage(), e);
+ void flush() throws IOException {
+ if (out != null) {
+ out.flush();
}
}
/**
* Clears the redo log.
- * @throws FileSystemException if the redo log cannot be cleared.
+ * @throws IOException if the redo log cannot be cleared.
*/
- void clear() throws FileSystemException {
- try {
- if (out != null) {
- out.close();
- out = null;
- }
- // truncate file
- logFile.getOutputStream().close();
- entryCount = 0;
- } catch (IOException e) {
- throw new FileSystemException(e.getMessage(), e);
- }
+ void clear() throws IOException {
+ if (out != null) {
+ out.close();
+ out = null;
+ }
+ // truncate file
+ new FileOutputStream(logFile).close();
+ entryCount = 0;
}
/**
* Initializes the {@link #out} stream if it is not yet set.
- * @throws FileSystemException if an error occurs while creating the
+ * @throws IOException if an error occurs while creating the
* output stream.
*/
- private void initOut() throws FileSystemException {
+ private void initOut() throws IOException {
if (out == null) {
- RandomAccessOutputStream raf = logFile.getRandomAccessOutputStream();
- // seek to the end of the file
- try {
- raf.seek(logFile.length());
- } catch (IOException e) {
- throw new FileSystemException(e.getMessage(), e);
- }
- out = new BufferedWriter(new OutputStreamWriter(raf));
+ OutputStream os = new FileOutputStream(logFile, true);
+ out = new BufferedWriter(new OutputStreamWriter(os));
}
}
@@ -206,14 +179,14 @@
* Reads the log file and sets the {@link #entryCount} with the number
* of entries read.
* @param collector called back for each {@link Entry} read.
- * @throws FileSystemException if an error occurs while reading from the
+ * @throws IOException if an error occurs while reading from the
* log file.
*/
- private void read(EntryCollector collector) throws FileSystemException {
- InputStream in = logFile.getInputStream();
+ private void read(EntryCollector collector) throws IOException {
+ InputStream in = new FileInputStream(logFile);
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- String line = null;
+ String line;
while ((line = reader.readLine()) != null) {
try {
Entry e = Entry.fromString(line);
@@ -223,8 +196,6 @@
log.warn("Malformed redo entry: " + e.getMessage());
}
}
- } catch (IOException e) {
- throw new FileSystemException(e.getMessage(), e);
} finally {
if (in != null) {
try {
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java Wed Aug 17 06:52:50 2005
@@ -19,7 +19,6 @@
import org.apache.jackrabbit.Constants;
import org.apache.jackrabbit.core.ItemManager;
import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.fs.FileSystemException;
import org.apache.jackrabbit.core.query.AbstractQueryHandler;
import org.apache.jackrabbit.core.query.ExecutableQuery;
import org.apache.jackrabbit.core.query.QueryHandlerContext;
@@ -42,6 +41,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.query.InvalidQueryException;
import java.io.IOException;
+import java.io.File;
import java.util.Iterator;
import java.util.List;
@@ -65,9 +65,16 @@
private final Analyzer analyzer;
/**
+ * The location of the search index.
+ * <p/>
+ * Note: This is a <b>mandatory</b> parameter!
+ */
+ private String path;
+
+ /**
* minMergeDocs config parameter.
*/
- private int minMergeDocs = 1000;
+ private int minMergeDocs = 100;
/**
* volatileIdleTime config parameter.
@@ -124,37 +131,39 @@
}
/**
- * Initializes this <code>QueryHandler</code>.
+ * Initializes this <code>QueryHandler</code>. This implementation requires
+ * that a path parameter is set in the configuration. If this condition
+ * is not met, a <code>IOException</code> is thrown.
+ *
* @throws IOException if an error occurs while initializing this handler.
*/
protected void doInit() throws IOException {
- try {
- QueryHandlerContext context = getContext();
- index = new MultiIndex(context.getFileSystem(), this,
- context.getItemStateManager(), context.getRootUUID());
- if (index.getRedoLogApplied() || forceConsistencyCheck) {
- log.info("Running consistency check...");
- try {
- ConsistencyCheck check = ConsistencyCheck.run(index,
- context.getItemStateManager());
- if (autoRepair) {
- check.repair(true);
- } else {
- List errors = check.getErrors();
- if (errors.size() == 0) {
- log.info("No errors detected.");
- }
- for (Iterator it = errors.iterator(); it.hasNext(); ) {
- ConsistencyCheckError err = (ConsistencyCheckError) it.next();
- log.info(err.toString());
- }
+ QueryHandlerContext context = getContext();
+ if (path == null) {
+ throw new IOException("SearchIndex requires 'path' parameter in configuration!");
+ }
+ index = new MultiIndex(new File(path), this,
+ context.getItemStateManager(), context.getRootUUID());
+ if (index.getRedoLogApplied() || forceConsistencyCheck) {
+ log.info("Running consistency check...");
+ try {
+ ConsistencyCheck check = ConsistencyCheck.run(index,
+ context.getItemStateManager());
+ if (autoRepair) {
+ check.repair(true);
+ } else {
+ List errors = check.getErrors();
+ if (errors.size() == 0) {
+ log.info("No errors detected.");
+ }
+ for (Iterator it = errors.iterator(); it.hasNext(); ) {
+ ConsistencyCheckError err = (ConsistencyCheckError) it.next();
+ log.info(err.toString());
}
- } catch (Exception e) {
- log.warn("Failed to run consistency check on index: " + e);
}
+ } catch (Exception e) {
+ log.warn("Failed to run consistency check on index: " + e);
}
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
}
}
@@ -327,6 +336,25 @@
}
//--------------------------< properties >----------------------------------
+
+ /**
+ * Sets the location of the search index.
+ *
+ * @param path the location of the search index.
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * Returns the location of the search index. Returns <code>null</code> if
+ * not set.
+ *
+ * @return the location of the search index.
+ */
+ public String getPath() {
+ return path;
+ }
/**
* The lucene index writer property: useCompoundFile
Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/query/lucene/VolatileIndex.java Wed Aug 17 06:52:50 2005
@@ -17,7 +17,6 @@
package org.apache.jackrabbit.core.query.lucene;
import org.apache.commons.collections.map.LinkedMap;
-import org.apache.jackrabbit.core.fs.FileSystemException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -85,12 +84,9 @@
* or the index.
*/
void addDocument(Document doc) throws IOException {
- try {
- redoLog.nodeAdded(doc.get(FieldNames.UUID));
- redoLog.flush();
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+ redoLog.nodeAdded(doc.get(FieldNames.UUID));
+ redoLog.flush();
+
Document old = (Document) pending.put(doc.get(FieldNames.UUID), doc);
if (old != null) {
disposeDocument(old);
@@ -112,12 +108,9 @@
* @return the number of deleted documents
*/
int removeDocument(Term idTerm) throws IOException {
- try {
- redoLog.nodeRemoved(idTerm.text());
- redoLog.flush();
- } catch (FileSystemException e) {
- throw new IOException(e.getMessage());
- }
+ redoLog.nodeRemoved(idTerm.text());
+ redoLog.flush();
+
Document doc = (Document) pending.remove(idTerm.text());
if (doc != null) {
disposeDocument(doc);
Modified: incubator/jackrabbit/trunk/xdocs/firststeps.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/xdocs/firststeps.xml?rev=233174&r1=233173&r2=233174&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/xdocs/firststeps.xml (original)
+++ incubator/jackrabbit/trunk/xdocs/firststeps.xml Wed Aug 17 06:52:50 2005
@@ -93,9 +93,7 @@
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
- <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
- <param name="path" value="${wsp.home}/index"/>
- </FileSystem>
+ <param name="path" value="${wsp.home}/index"/>
</SearchIndex>
</Workspace>
<Versioning rootPath="${rep.home}/versions">