You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2008/01/28 00:15:01 UTC
svn commit: r615674 - in /jackrabbit/trunk/jackrabbit-core/src:
main/java/org/apache/jackrabbit/core/cluster/
main/java/org/apache/jackrabbit/core/config/
main/java/org/apache/jackrabbit/core/journal/
main/java/org/apache/jackrabbit/core/nodetype/ main...
Author: jukka
Date: Sun Jan 27 15:14:48 2008
New Revision: 615674
URL: http://svn.apache.org/viewvc?rev=615674&view=rev
Log:
Set svn:eol-style to native
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/AbstractClusterOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/Update.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AppendRecord.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseRecordIterator.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DefaultRecordProducer.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileJournal.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordIterator.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordLog.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Journal.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JournalException.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/LockableFileRevision.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ReadRecord.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Record.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/RecordConsumer.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/RecordIterator.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/RecordProducer.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/AbstractItemDefinitionTemplate.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionTemplateImpl.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionTemplateImpl.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AdaptingHits.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/BitSetHits.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/Hits.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/HitsIntersection.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/StateChangeDispatcher.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/RepositoryLock.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInTempFile.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/SimpleNamespaceRegistry.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHitsTest.java (contents, props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/RepositoryLockTest.java (props changed)
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/TestAll.java (props changed)
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/AbstractClusterOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/Update.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AbstractJournal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/AppendRecord.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseRecordIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DefaultRecordProducer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileJournal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRecordLog.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/FileRevision.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java Sun Jan 27 15:14:48 2008
@@ -1,97 +1,97 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.journal;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-/**
- * @deprecated
- * This class should not be used because it is not database vendor specific.
- * Each DatabaseJournal now supports getting the connection via JNDI
- * by setting the driver to javax.naming.InitialContext
- * and the URL to the JNDI name.
- * <p>
- * Database journal that uses JNDI to acquire the database connection.
- * The JNDI location of the {@link DataSource} to be used in given as
- * the <code>dataSourceLocation</code> configuration property.
- * <p>
- * <strong>WARNING:</strong> The acquired database connection is kept
- * for the entire lifetime of the journal instance. The configured data
- * source should be prepared for this.
- */
-public class JNDIDatabaseJournal extends DatabaseJournal {
-
- /**
- * JNDI location of the data source used to acquire database connections.
- */
- private String dataSourceLocation;
-
- //----------------------------------------------------< setters & getters >
-
- /**
- * Returns the JNDI location of the data source.
- *
- * @return data source location
- */
- public String getDataSourceLocation() {
- return dataSourceLocation;
- }
-
- /**
- * Sets the JNDI location of the data source.
- *
- * @param dataSourceLocation data source location
- */
- public void setDataSourceLocation(String dataSourceLocation) {
- this.dataSourceLocation = dataSourceLocation;
- }
-
- //-----------------------------------------------------< DatabaseJournal >
-
- /**
- * Returns a JDBC connection from a {@link DataSource} acquired from JNDI
- * with the configured data source location.
- *
- * @return new database connection
- * @throws SQLException if a database access error occurs
- * @see DatabaseJournal#getConnection()
- */
- protected Connection getConnection() throws SQLException {
- try {
- InitialContext ic = new InitialContext();
- DataSource dataSource = (DataSource) ic.lookup(dataSourceLocation);
- return dataSource.getConnection();
- } catch (NamingException e) {
- SQLException exception = new SQLException(
- "DataSource not found: " + dataSourceLocation);
- exception.initCause(e);
- throw exception;
- }
- }
-
- /**
- * Overridden to avoid the driver and url checks in DatabaseJournal.
- */
- protected void init() throws JournalException {
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.journal;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+/**
+ * @deprecated
+ * This class should not be used because it is not database vendor specific.
+ * Each DatabaseJournal now supports getting the connection via JNDI
+ * by setting the driver to javax.naming.InitialContext
+ * and the URL to the JNDI name.
+ * <p>
+ * Database journal that uses JNDI to acquire the database connection.
+ * The JNDI location of the {@link DataSource} to be used in given as
+ * the <code>dataSourceLocation</code> configuration property.
+ * <p>
+ * <strong>WARNING:</strong> The acquired database connection is kept
+ * for the entire lifetime of the journal instance. The configured data
+ * source should be prepared for this.
+ */
+public class JNDIDatabaseJournal extends DatabaseJournal {
+
+ /**
+ * JNDI location of the data source used to acquire database connections.
+ */
+ private String dataSourceLocation;
+
+ //----------------------------------------------------< setters & getters >
+
+ /**
+ * Returns the JNDI location of the data source.
+ *
+ * @return data source location
+ */
+ public String getDataSourceLocation() {
+ return dataSourceLocation;
+ }
+
+ /**
+ * Sets the JNDI location of the data source.
+ *
+ * @param dataSourceLocation data source location
+ */
+ public void setDataSourceLocation(String dataSourceLocation) {
+ this.dataSourceLocation = dataSourceLocation;
+ }
+
+ //-----------------------------------------------------< DatabaseJournal >
+
+ /**
+ * Returns a JDBC connection from a {@link DataSource} acquired from JNDI
+ * with the configured data source location.
+ *
+ * @return new database connection
+ * @throws SQLException if a database access error occurs
+ * @see DatabaseJournal#getConnection()
+ */
+ protected Connection getConnection() throws SQLException {
+ try {
+ InitialContext ic = new InitialContext();
+ DataSource dataSource = (DataSource) ic.lookup(dataSourceLocation);
+ return dataSource.getConnection();
+ } catch (NamingException e) {
+ SQLException exception = new SQLException(
+ "DataSource not found: " + dataSourceLocation);
+ exception.initCause(e);
+ throw exception;
+ }
+ }
+
+ /**
+ * Overridden to avoid the driver and url checks in DatabaseJournal.
+ */
+ protected void init() throws JournalException {
+ }
+
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JNDIDatabaseJournal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Journal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/JournalException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/LockableFileRevision.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java Sun Jan 27 15:14:48 2008
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.journal;
-
-import org.apache.jackrabbit.util.Text;
-
-/**
- * It has the following property in addition to those of the DatabaseJournal:
- * <ul>
- * <li><code>tableSpace</code>: the MS SQL tablespace to use</li>
- * </ul>
- */
-public class MSSqlDatabaseJournal extends DatabaseJournal {
-
- /** the MS SQL table space to use */
- protected String tableSpace = "";
-
- /**
- * Initialize this instance with the default schema and
- * driver values.
- */
- public MSSqlDatabaseJournal() {
- setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- setSchema("mssql");
- }
-
- /**
- * Returns the configured MS SQL table space.
- * @return the configured MS SQL table space.
- */
- public String getTableSpace() {
- return tableSpace;
- }
-
- /**
- * Sets the MS SQL table space.
- * @param tableSpace the MS SQL table space.
- */
- public void setTableSpace(String tableSpace) {
- if (tableSpace != null && tableSpace.length() > 0) {
- this.tableSpace = "on " + tableSpace.trim();
- } else {
- this.tableSpace = "";
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected String createSchemaSQL(String sql) {
- return Text.replace(
- super.createSchemaSQL(sql), "${tableSpace}", tableSpace);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.journal;
+
+import org.apache.jackrabbit.util.Text;
+
+/**
+ * It has the following property in addition to those of the DatabaseJournal:
+ * <ul>
+ * <li><code>tableSpace</code>: the MS SQL tablespace to use</li>
+ * </ul>
+ */
+public class MSSqlDatabaseJournal extends DatabaseJournal {
+
+ /** the MS SQL table space to use */
+ protected String tableSpace = "";
+
+ /**
+ * Initialize this instance with the default schema and
+ * driver values.
+ */
+ public MSSqlDatabaseJournal() {
+ setDriver("com.microsoft.sqlserver.jdbc.SQLServerDriver");
+ setSchema("mssql");
+ }
+
+ /**
+ * Returns the configured MS SQL table space.
+ * @return the configured MS SQL table space.
+ */
+ public String getTableSpace() {
+ return tableSpace;
+ }
+
+ /**
+ * Sets the MS SQL table space.
+ * @param tableSpace the MS SQL table space.
+ */
+ public void setTableSpace(String tableSpace) {
+ if (tableSpace != null && tableSpace.length() > 0) {
+ this.tableSpace = "on " + tableSpace.trim();
+ } else {
+ this.tableSpace = "";
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected String createSchemaSQL(String sql) {
+ return Text.replace(
+ super.createSchemaSQL(sql), "${tableSpace}", tableSpace);
+ }
+
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MSSqlDatabaseJournal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ReadRecord.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/Record.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/RecordConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/RecordIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/RecordProducer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/AbstractItemDefinitionTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeDefinitionTemplateImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/PropertyDefinitionTemplateImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AdaptingHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AdaptingHits.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AdaptingHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AdaptingHits.java Sun Jan 27 15:14:48 2008
@@ -1,123 +1,123 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import java.io.IOException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is an implementation of Hits which starts with marking hits in an
- * ArrayHits instance and switches to a BitSetHits instance if at least the
- * threshold of 8kb for the ArrayHits is reached and a BitSetHits instance
- * would consume less memory.
- */
-public class AdaptingHits implements Hits {
-
- /**
- * Logger instance for this class.
- */
- private static final Logger log = LoggerFactory.getLogger(AdaptingHits.class);
-
- /**
- * The lower threshold before a conversion is tried
- */
- private static final int DEFAULT_THRESHOLD = 2048;
-
- /**
- * Internal hits instance
- */
- private Hits hits;
-
- /**
- * The maximum doc number in hits. Used to calculate the expected
- * BitSetHits memory footprint.
- */
- private int maxDoc;
-
- /**
- * The total number of hits. Used to calculate the memory footprint of the
- * initial ArrayHits instance.
- */
- private int docCount;
-
- private int threshold;
-
- public AdaptingHits() {
- this(DEFAULT_THRESHOLD);
- }
-
- public AdaptingHits(int threshold) {
- this.threshold = threshold;
- hits = new ArrayHits();
- maxDoc = 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public int next() throws IOException {
- // delegate to the internal Hits instance
- return hits.next();
- }
-
- /**
- * {@inheritDoc}
- */
- public void set(int doc) {
- hits.set(doc);
- docCount++;
- if (doc > maxDoc) {
- maxDoc = doc;
- }
-
- if (docCount > threshold && (hits instanceof ArrayHits)) {
- int intArraySize = docCount * 4;
- int bitSetSize = maxDoc / 8;
- if (bitSetSize < intArraySize) {
- log.debug("BitSet is smaller than int[]: "
- + bitSetSize + " vs " + intArraySize);
- BitSetHits bitSetHits = new BitSetHits();
- int i = 0;
- while (i > -1) {
- try {
- i = hits.next();
- if (i > -1)
- bitSetHits.set(i);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- hits = bitSetHits;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public int skipTo(int target) throws IOException {
- // delegate to the internal Hits instance
- return hits.skipTo(target);
- }
-
- Hits getInternalHits() {
- return hits;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is an implementation of Hits which starts with marking hits in an
+ * ArrayHits instance and switches to a BitSetHits instance if at least the
+ * threshold of 8kb for the ArrayHits is reached and a BitSetHits instance
+ * would consume less memory.
+ */
+public class AdaptingHits implements Hits {
+
+ /**
+ * Logger instance for this class.
+ */
+ private static final Logger log = LoggerFactory.getLogger(AdaptingHits.class);
+
+ /**
+ * The lower threshold before a conversion is tried
+ */
+ private static final int DEFAULT_THRESHOLD = 2048;
+
+ /**
+ * Internal hits instance
+ */
+ private Hits hits;
+
+ /**
+ * The maximum doc number in hits. Used to calculate the expected
+ * BitSetHits memory footprint.
+ */
+ private int maxDoc;
+
+ /**
+ * The total number of hits. Used to calculate the memory footprint of the
+ * initial ArrayHits instance.
+ */
+ private int docCount;
+
+ private int threshold;
+
+ public AdaptingHits() {
+ this(DEFAULT_THRESHOLD);
+ }
+
+ public AdaptingHits(int threshold) {
+ this.threshold = threshold;
+ hits = new ArrayHits();
+ maxDoc = 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int next() throws IOException {
+ // delegate to the internal Hits instance
+ return hits.next();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void set(int doc) {
+ hits.set(doc);
+ docCount++;
+ if (doc > maxDoc) {
+ maxDoc = doc;
+ }
+
+ if (docCount > threshold && (hits instanceof ArrayHits)) {
+ int intArraySize = docCount * 4;
+ int bitSetSize = maxDoc / 8;
+ if (bitSetSize < intArraySize) {
+ log.debug("BitSet is smaller than int[]: "
+ + bitSetSize + " vs " + intArraySize);
+ BitSetHits bitSetHits = new BitSetHits();
+ int i = 0;
+ while (i > -1) {
+ try {
+ i = hits.next();
+ if (i > -1)
+ bitSetHits.set(i);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ hits = bitSetHits;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int skipTo(int target) throws IOException {
+ // delegate to the internal Hits instance
+ return hits.skipTo(target);
+ }
+
+ Hits getInternalHits() {
+ return hits;
+ }
+
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/AdaptingHits.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java Sun Jan 27 15:14:48 2008
@@ -1,95 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import java.util.Arrays;
-
-/**
- * Uses an integer array to store the hit set. This implementation uses less
- * memory than {@link BitSetHits} if the total number of documents is high and
- * and the number of hits is low or if your hits doc numbers are mostly in the
- * upper part of your doc number range.
- * If you don't know about your hit distribution in advance use
- * {@link AdaptingHits} instead.
- */
-public class ArrayHits implements Hits {
-
- private static final int INITIAL_SIZE = 100;
- private int[] hits;
- private int index;
- private boolean initialized;
-
- public ArrayHits() {
- this(INITIAL_SIZE);
- }
-
- public ArrayHits(int initialSize) {
- hits = new int[initialSize];
- index = 0;
- initialized = false;
- }
-
- private void initialize() {
- if (!initialized) {
- Arrays.sort(hits);
- index = hits.length - index;
- initialized = true;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void set(int doc) {
- if (initialized) {
- throw new IllegalStateException(
- "You must not call set() after next() or skipTo()");
- }
- if (index >= hits.length) {
- int[] resizedHits = new int[hits.length * 2];
- System.arraycopy(hits, 0, resizedHits, 0, hits.length);
- hits = resizedHits;
- }
- hits[index++] = doc;
- }
-
- /**
- * {@inheritDoc}
- */
- public int next() {
- initialize();
- if (index >= hits.length)
- return -1;
-
- return hits[index++];
- }
-
- /**
- * {@inheritDoc}
- */
- public int skipTo(int target) {
- initialize();
- for (int i = index; i < hits.length; i++) {
- int nextDocValue = hits[i];
- if (nextDocValue >= target) {
- index = i;
- return next();
- }
- }
- return -1;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import java.util.Arrays;
+
+/**
+ * Uses an integer array to store the hit set. This implementation uses less
+ * memory than {@link BitSetHits} if the total number of documents is high and
+ * and the number of hits is low or if your hits doc numbers are mostly in the
+ * upper part of your doc number range.
+ * If you don't know about your hit distribution in advance use
+ * {@link AdaptingHits} instead.
+ */
+public class ArrayHits implements Hits {
+
+ private static final int INITIAL_SIZE = 100;
+ private int[] hits;
+ private int index;
+ private boolean initialized;
+
+ public ArrayHits() {
+ this(INITIAL_SIZE);
+ }
+
+ public ArrayHits(int initialSize) {
+ hits = new int[initialSize];
+ index = 0;
+ initialized = false;
+ }
+
+ private void initialize() {
+ if (!initialized) {
+ Arrays.sort(hits);
+ index = hits.length - index;
+ initialized = true;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void set(int doc) {
+ if (initialized) {
+ throw new IllegalStateException(
+ "You must not call set() after next() or skipTo()");
+ }
+ if (index >= hits.length) {
+ int[] resizedHits = new int[hits.length * 2];
+ System.arraycopy(hits, 0, resizedHits, 0, hits.length);
+ hits = resizedHits;
+ }
+ hits[index++] = doc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int next() {
+ initialize();
+ if (index >= hits.length)
+ return -1;
+
+ return hits[index++];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int skipTo(int target) {
+ initialize();
+ for (int i = index; i < hits.length; i++) {
+ int nextDocValue = hits[i];
+ if (nextDocValue >= target) {
+ index = i;
+ return next();
+ }
+ }
+ return -1;
+ }
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHits.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/BitSetHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/BitSetHits.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/BitSetHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/BitSetHits.java Sun Jan 27 15:14:48 2008
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import java.util.BitSet;
-
-/**
- * Uses a BitSet instance to store the hit set. Keep in mind that this BitSet
- * is at least as large as the highest doc number in the hit set. This means it
- * might need of lot of memory for large indexes.
- */
-public class BitSetHits implements Hits {
- private BitSet hits;
- private int index;
-
- public BitSetHits() {
- hits = new BitSet();
- index = 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public void set(int doc) {
- hits.set(doc);
- }
-
- /**
- * {@inheritDoc}
- */
- public int next() {
- int result = hits.nextSetBit(index);
- index = result + 1;
- return result;
- }
-
- /**
- * {@inheritDoc}
- */
- public int skipTo(int target) {
- index = target;
- return next();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import java.util.BitSet;
+
+/**
+ * Uses a BitSet instance to store the hit set. Keep in mind that this BitSet
+ * is at least as large as the highest doc number in the hit set. This means it
+ * might need of lot of memory for large indexes.
+ */
+public class BitSetHits implements Hits {
+ private BitSet hits;
+ private int index;
+
+ public BitSetHits() {
+ hits = new BitSet();
+ index = 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void set(int doc) {
+ hits.set(doc);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int next() {
+ int result = hits.nextSetBit(index);
+ index = result + 1;
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int skipTo(int target) {
+ index = target;
+ return next();
+ }
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/BitSetHits.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/Hits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/Hits.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/Hits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/Hits.java Sun Jan 27 15:14:48 2008
@@ -1,46 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import java.io.IOException;
-
-/**
- * Representation of a set of hits
- */
-public interface Hits {
-
- /**
- * Marks the document with doc number <code>doc</code> as a hit.
- * Implementations may throw an exception if you call set() after next() or
- * skipTo() has been called.
- */
- void set(int doc);
-
- /**
- * Return the doc number of the next hit in the set. Subsequent calls never
- * return the same doc number.
- */
- int next() throws IOException;
-
- /**
- * Skips to the first match beyond the current whose document number is
- * greater than or equal to the given target. Returns -1 if there is no
- * matching document number greater than target.
- */
- int skipTo(int target) throws IOException;
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import java.io.IOException;
+
+/**
+ * Representation of a set of hits
+ */
+public interface Hits {
+
+ /**
+ * Marks the document with doc number <code>doc</code> as a hit.
+ * Implementations may throw an exception if you call set() after next() or
+ * skipTo() has been called.
+ */
+ void set(int doc);
+
+ /**
+ * Return the doc number of the next hit in the set. Subsequent calls never
+ * return the same doc number.
+ */
+ int next() throws IOException;
+
+ /**
+ * Skips to the first match beyond the current whose document number is
+ * greater than or equal to the given target. Returns -1 if there is no
+ * matching document number greater than target.
+ */
+ int skipTo(int target) throws IOException;
+
}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/Hits.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/HitsIntersection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/HitsIntersection.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/HitsIntersection.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/HitsIntersection.java Sun Jan 27 15:14:48 2008
@@ -1,80 +1,80 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import java.io.IOException;
-
-/**
- * Creates the intersection of two hit sets.
- */
-public class HitsIntersection implements Hits {
-
- private final Hits hits1;
- private final Hits hits2;
-
- private int nextChildrenHit = -1;
- private int nextNameTestHit = -1;
-
- public HitsIntersection(Hits hits1, Hits hits2) {
- this.hits1 = hits1;
- this.hits2 = hits2;
- }
-
- /**
- * {@inheritDoc}
- */
- public void set(int doc) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- */
- public int next() throws IOException {
- do {
- if (nextChildrenHit == nextNameTestHit) {
- nextNameTestHit = hits2.next();
- nextChildrenHit = hits1.next();
- } else if (nextNameTestHit < nextChildrenHit) {
- nextNameTestHit = hits2.skipTo(nextChildrenHit);
- } else {
- nextChildrenHit = hits1.skipTo(nextNameTestHit);
- }
- } while (nextChildrenHit > -1 && nextNameTestHit > -1
- && nextNameTestHit != nextChildrenHit);
-
- int nextDoc = -1;
- if (nextChildrenHit == nextNameTestHit) {
- nextDoc = nextChildrenHit;
- }
- return nextDoc;
- }
-
- /**
- * {@inheritDoc}
- */
- public int skipTo(int target) throws IOException {
- nextChildrenHit = hits1.skipTo(target);
- nextNameTestHit = hits2.skipTo(target);
- if (nextChildrenHit == nextNameTestHit) {
- return nextChildrenHit;
- } else {
- return next();
- }
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import java.io.IOException;
+
+/**
+ * Creates the intersection of two hit sets.
+ */
+public class HitsIntersection implements Hits {
+
+ private final Hits hits1;
+ private final Hits hits2;
+
+ private int nextChildrenHit = -1;
+ private int nextNameTestHit = -1;
+
+ public HitsIntersection(Hits hits1, Hits hits2) {
+ this.hits1 = hits1;
+ this.hits2 = hits2;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void set(int doc) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int next() throws IOException {
+ do {
+ if (nextChildrenHit == nextNameTestHit) {
+ nextNameTestHit = hits2.next();
+ nextChildrenHit = hits1.next();
+ } else if (nextNameTestHit < nextChildrenHit) {
+ nextNameTestHit = hits2.skipTo(nextChildrenHit);
+ } else {
+ nextChildrenHit = hits1.skipTo(nextNameTestHit);
+ }
+ } while (nextChildrenHit > -1 && nextNameTestHit > -1
+ && nextNameTestHit != nextChildrenHit);
+
+ int nextDoc = -1;
+ if (nextChildrenHit == nextNameTestHit) {
+ nextDoc = nextChildrenHit;
+ }
+ return nextDoc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int skipTo(int target) throws IOException {
+ nextChildrenHit = hits1.skipTo(target);
+ nextNameTestHit = hits2.skipTo(target);
+ if (nextChildrenHit == nextNameTestHit) {
+ return nextChildrenHit;
+ } else {
+ return next();
+ }
+ }
+
}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/HitsIntersection.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java Sun Jan 27 15:14:48 2008
@@ -1,62 +1,62 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import java.io.IOException;
-
-import org.apache.lucene.search.Scorer;
-
-/**
- * Wraps a {@link org.apache.lucene.search.Scorer} in a {@link Hits} instance.
- */
-public class ScorerHits implements Hits {
-
- private final Scorer scorer;
-
- public ScorerHits(Scorer scorer) {
- this.scorer = scorer;
- }
-
- /**
- * {@inheritDoc}
- */
- public void set(int doc) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * {@inheritDoc}
- */
- public int next() throws IOException {
- if (scorer.next()) {
- return scorer.doc();
- } else {
- return -1;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public int skipTo(int target) throws IOException {
- if (scorer.skipTo(target)) {
- return scorer.doc();
- } else {
- return -1;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import java.io.IOException;
+
+import org.apache.lucene.search.Scorer;
+
+/**
+ * Wraps a {@link org.apache.lucene.search.Scorer} in a {@link Hits} instance.
+ */
+public class ScorerHits implements Hits {
+
+ private final Scorer scorer;
+
+ public ScorerHits(Scorer scorer) {
+ this.scorer = scorer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void set(int doc) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int next() throws IOException {
+ if (scorer.next()) {
+ return scorer.doc();
+ } else {
+ return -1;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int skipTo(int target) throws IOException {
+ if (scorer.skipTo(target)) {
+ return scorer.doc();
+ } else {
+ return -1;
+ }
+ }
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/hits/ScorerHits.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/StateChangeDispatcher.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/RepositoryLock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInTempFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/TestAll.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/SimpleNamespaceRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java Sun Jan 27 15:14:48 2008
@@ -1,149 +1,149 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.query.InvalidQueryException;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-
-import org.apache.jackrabbit.core.query.lucene.QueryResultImpl;
-
-public class LimitAndOffsetTest extends AbstractQueryTest {
-
- private Node node1;
- private Node node2;
- private Node node3;
-
- private QueryImpl query;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- node1 = testRootNode.addNode("foo");
- node1.setProperty("name", "1");
- node2 = testRootNode.addNode("foo");
- node2.setProperty("name", "2");
- node3 = testRootNode.addNode("foo");
- node3.setProperty("name", "3");
-
- testRootNode.save();
-
- query = createXPathQuery("/jcr:root" + testRoot + "/* order by @name");
- }
-
- protected void tearDown() throws Exception {
- node1 = null;
- node2 = null;
- node3 = null;
- query = null;
- super.tearDown();
- }
-
- private QueryImpl createXPathQuery(String xpath)
- throws InvalidQueryException, RepositoryException {
- QueryManager queryManager = superuser.getWorkspace().getQueryManager();
- return (QueryImpl) queryManager.createQuery(xpath, Query.XPATH);
- }
-
- protected void checkResult(QueryResult result, Node[] expectedNodes) throws RepositoryException {
- assertEquals(expectedNodes.length, result.getNodes().getSize());
- }
-
- public void testLimit() throws Exception {
- query.setLimit(1);
- QueryResult result = query.execute();
- checkResult(result, new Node[] { node1 });
-
- query.setLimit(2);
- result = query.execute();
- checkResult(result, new Node[] { node1, node2 });
-
- query.setLimit(3);
- result = query.execute();
- checkResult(result, new Node[] { node1, node2, node3 });
- }
-
- public void testOffset() throws Exception {
- query.setOffset(0);
- QueryResult result = query.execute();
- checkResult(result, new Node[] { node1, node2, node3 });
-
- query.setOffset(1);
- result = query.execute();
- checkResult(result, new Node[] { node2, node3 });
-
- query.setOffset(2);
- result = query.execute();
- checkResult(result, new Node[] { node3 });
- }
-
- public void testOffsetAndLimit() throws Exception {
- query.setOffset(0);
- query.setLimit(1);
- QueryResult result = query.execute();
- checkResult(result, new Node[] { node1 });
-
- query.setOffset(1);
- query.setLimit(1);
- result = query.execute();
- checkResult(result, new Node[] { node2 });
-
- query.setOffset(1);
- query.setLimit(2);
- result = query.execute();
- checkResult(result, new Node[] { node2, node3 });
-
- query.setOffset(0);
- query.setLimit(2);
- result = query.execute();
- checkResult(result, new Node[] { node1, node2 });
-
- // Added for JCR-1323
- query.setOffset(0);
- query.setLimit(4);
- result = query.execute();
- checkResult(result, new Node[] { node1, node2, node3 });
- }
-
- public void testOffsetAndSkip() throws Exception {
- query.setOffset(1);
- QueryResult result = query.execute();
- NodeIterator nodes = result.getNodes();
- nodes.skip(1);
- assertTrue(nodes.nextNode() == node3);
- }
-
- public void testOffsetAndLimitWithGetSize() throws Exception {
- query.setOffset(1);
- QueryResult result = query.execute();
- NodeIterator nodes = result.getNodes();
- assertEquals(2, nodes.getSize());
- assertEquals(3, ((QueryResultImpl) result).getTotalSize());
-
- query.setOffset(1);
- query.setLimit(1);
- result = query.execute();
- nodes = result.getNodes();
- assertEquals(1, nodes.getSize());
- assertEquals(3, ((QueryResultImpl) result).getTotalSize());
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+
+import org.apache.jackrabbit.core.query.lucene.QueryResultImpl;
+
+public class LimitAndOffsetTest extends AbstractQueryTest {
+
+ private Node node1;
+ private Node node2;
+ private Node node3;
+
+ private QueryImpl query;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ node1 = testRootNode.addNode("foo");
+ node1.setProperty("name", "1");
+ node2 = testRootNode.addNode("foo");
+ node2.setProperty("name", "2");
+ node3 = testRootNode.addNode("foo");
+ node3.setProperty("name", "3");
+
+ testRootNode.save();
+
+ query = createXPathQuery("/jcr:root" + testRoot + "/* order by @name");
+ }
+
+ protected void tearDown() throws Exception {
+ node1 = null;
+ node2 = null;
+ node3 = null;
+ query = null;
+ super.tearDown();
+ }
+
+ private QueryImpl createXPathQuery(String xpath)
+ throws InvalidQueryException, RepositoryException {
+ QueryManager queryManager = superuser.getWorkspace().getQueryManager();
+ return (QueryImpl) queryManager.createQuery(xpath, Query.XPATH);
+ }
+
+ protected void checkResult(QueryResult result, Node[] expectedNodes) throws RepositoryException {
+ assertEquals(expectedNodes.length, result.getNodes().getSize());
+ }
+
+ public void testLimit() throws Exception {
+ query.setLimit(1);
+ QueryResult result = query.execute();
+ checkResult(result, new Node[] { node1 });
+
+ query.setLimit(2);
+ result = query.execute();
+ checkResult(result, new Node[] { node1, node2 });
+
+ query.setLimit(3);
+ result = query.execute();
+ checkResult(result, new Node[] { node1, node2, node3 });
+ }
+
+ public void testOffset() throws Exception {
+ query.setOffset(0);
+ QueryResult result = query.execute();
+ checkResult(result, new Node[] { node1, node2, node3 });
+
+ query.setOffset(1);
+ result = query.execute();
+ checkResult(result, new Node[] { node2, node3 });
+
+ query.setOffset(2);
+ result = query.execute();
+ checkResult(result, new Node[] { node3 });
+ }
+
+ public void testOffsetAndLimit() throws Exception {
+ query.setOffset(0);
+ query.setLimit(1);
+ QueryResult result = query.execute();
+ checkResult(result, new Node[] { node1 });
+
+ query.setOffset(1);
+ query.setLimit(1);
+ result = query.execute();
+ checkResult(result, new Node[] { node2 });
+
+ query.setOffset(1);
+ query.setLimit(2);
+ result = query.execute();
+ checkResult(result, new Node[] { node2, node3 });
+
+ query.setOffset(0);
+ query.setLimit(2);
+ result = query.execute();
+ checkResult(result, new Node[] { node1, node2 });
+
+ // Added for JCR-1323
+ query.setOffset(0);
+ query.setLimit(4);
+ result = query.execute();
+ checkResult(result, new Node[] { node1, node2, node3 });
+ }
+
+ public void testOffsetAndSkip() throws Exception {
+ query.setOffset(1);
+ QueryResult result = query.execute();
+ NodeIterator nodes = result.getNodes();
+ nodes.skip(1);
+ assertTrue(nodes.nextNode() == node3);
+ }
+
+ public void testOffsetAndLimitWithGetSize() throws Exception {
+ query.setOffset(1);
+ QueryResult result = query.execute();
+ NodeIterator nodes = result.getNodes();
+ assertEquals(2, nodes.getSize());
+ assertEquals(3, ((QueryResultImpl) result).getTotalSize());
+
+ query.setOffset(1);
+ query.setLimit(1);
+ result = query.execute();
+ nodes = result.getNodes();
+ assertEquals(1, nodes.getSize());
+ assertEquals(3, ((QueryResultImpl) result).getTotalSize());
+ }
+
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHitsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHitsTest.java?rev=615674&r1=615673&r2=615674&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHitsTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHitsTest.java Sun Jan 27 15:14:48 2008
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
-
-import junit.framework.TestCase;
-
-public class ArrayHitsTest extends TestCase {
-
- public void testSkipToDocumentNumberGreaterThanLastMatch() throws Exception {
- ArrayHits hits = new ArrayHits();
- hits.set(1);
- int doc = hits.skipTo(2);
- assertEquals(-1, doc);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.query.lucene.hits;
+
+import junit.framework.TestCase;
+
+public class ArrayHitsTest extends TestCase {
+
+ public void testSkipToDocumentNumberGreaterThanLastMatch() throws Exception {
+ ArrayHits hits = new ArrayHits();
+ hits.set(1);
+ int doc = hits.skipTo(2);
+ assertEquals(-1, doc);
+ }
+
+}
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/hits/ArrayHitsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/RepositoryLockTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/TestAll.java
------------------------------------------------------------------------------
svn:eol-style = native