jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1176340 [1/2] - in /jackrabbit/branches/JCR-2272: ./ jackrabbit-api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/ jackrabbit-api/src/main/java/org/ap...
Date Tue, 27 Sep 2011 11:53:12 GMT
Author: jukka
Date: Tue Sep 27 11:53:10 2011
New Revision: 1176340

URL: http://svn.apache.org/viewvc?rev=1176340&view=rev
Log:
JCR-2272: Update branch to match latest trunk.

Added:
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java
      - copied unchanged from r1176315, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveContext.java
      - copied unchanged from r1176315, jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveContext.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveContextImpl.java
      - copied unchanged from r1176315, jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveContextImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveHandler.java
      - copied unchanged from r1176315, jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveHandler.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveManager.java
      - copied unchanged from r1176315, jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveManagerImpl.java
      - copied unchanged from r1176315, jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/CopyMoveManagerImpl.java
Modified:
    jackrabbit/branches/JCR-2272/   (props changed)
    jackrabbit/branches/JCR-2272/jackrabbit-api/pom.xml
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java
    jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/pom.xml
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ChangeLogRecord.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventListenerIteratorImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImporter.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserPerWorkspaceUserManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/ExcerptTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/SimpleCredentialsAuthenticationTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/CustomPrivilegeTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/ImpersonationImplTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/UserImporterTest.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/packaging/FilterContentPackage.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/io/DefaultHandler.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java
    jackrabbit/branches/JCR-2272/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/ResourceConfig.java
    jackrabbit/branches/JCR-2272/test/performance/base/src/main/java/org/apache/jackrabbit/performance/SmallFileWriteTest.java

Propchange: jackrabbit/branches/JCR-2272/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 27 11:53:10 2011
@@ -1 +1,2 @@
 /jackrabbit/sandbox/JCR-2415-lucene-3.0:1060860-1064038
+/jackrabbit/trunk:1173165-1176315

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/pom.xml?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/pom.xml (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/pom.xml Tue Sep 27 11:53:10 2011
@@ -50,40 +50,6 @@
           </excludes>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>clirr-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>verify</phase>
-            <goals>
-              <goal>check</goal>
-            </goals>
-            <configuration>
-<!-- NOTE: Clirr considers adding new methods to an interface a
-     potential backwards-compatibility issue, as it will break
-     source compatibility with code that implements the interface.
-     In our case that's acceptable, so such cases can simply be
-     excluded in the list below. Just remember to clear the exclude
-     list when updating the baseline version to a new minor release.
--->
-              <excludes>
-<exclude>org/apache/jackrabbit/api/JackrabbitWorkspace</exclude>
-<exclude>org/apache/jackrabbit/api/security/user/Authorizable</exclude>
-<exclude>org/apache/jackrabbit/api/security/user/QueryBuilder</exclude>
-<exclude>org/apache/jackrabbit/api/security/user/QueryBuilder$Direction</exclude>
-              </excludes>
-              <comparisonArtifacts>
-                <comparisonArtifact>
-                  <groupId>${project.groupId}</groupId>
-                  <artifactId>${project.artifactId}</artifactId>
-                  <version>${clirr.baseline.version}</version>
-                </comparisonArtifact>
-              </comparisonArtifacts>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
 
@@ -99,4 +65,34 @@
     </dependency>
   </dependencies>
 
+  <profiles>
+    <profile>
+      <id>clirr</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>clirr-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>verify</phase>
+                <goals>
+                  <goal>check</goal>
+                </goals>
+                <configuration>
+                  <comparisonArtifacts>
+                    <comparisonArtifact>
+                      <groupId>${project.groupId}</groupId>
+                      <artifactId>${project.artifactId}</artifactId>
+                      <version>${clirr.baseline.version}</version>
+                    </comparisonArtifact>
+                  </comparisonArtifacts>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/package-info.java Tue Sep 27 11:53:10 2011
@@ -18,5 +18,5 @@
 /**
  * Interfaces for managing a Jackrabbit repository.
  */
-@aQute.bnd.annotation.Version("2.2")
+@aQute.bnd.annotation.Version("2.3")
 package org.apache.jackrabbit.api.management;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/package-info.java Tue Sep 27 11:53:10 2011
@@ -18,5 +18,5 @@
 /**
  * Jackrabbit extensions for JCR observation.
  */
-@aQute.bnd.annotation.Version("2.2")
+@aQute.bnd.annotation.Version("2.3")
 package org.apache.jackrabbit.api.observation;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authentication/token/package-info.java Tue Sep 27 11:53:10 2011
@@ -18,6 +18,6 @@
 /**
  * Token credentials.
  */
-@aQute.bnd.annotation.Version("2.2")
+@aQute.bnd.annotation.Version("2.3")
 @aQute.bnd.annotation.Export(optional = "provide:=true")
 package org.apache.jackrabbit.api.security.authentication.token;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/authorization/package-info.java Tue Sep 27 11:53:10 2011
@@ -18,5 +18,5 @@
 /**
  * Jackrabbit extensions for authorization.
  */
-@aQute.bnd.annotation.Version("2.2")
+@aQute.bnd.annotation.Version("2.3")
 package org.apache.jackrabbit.api.security.authorization;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/package-info.java Tue Sep 27 11:53:10 2011
@@ -18,5 +18,5 @@
 /**
  * Jackrabbit extensions for access control.
  */
-@aQute.bnd.annotation.Version("2.2")
+@aQute.bnd.annotation.Version("2.3")
 package org.apache.jackrabbit.api.security;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/principal/package-info.java Tue Sep 27 11:53:10 2011
@@ -18,5 +18,5 @@
 /**
  * Jackrabbit extensions for JAAS principals.
  */
-@aQute.bnd.annotation.Version("2.2")
+@aQute.bnd.annotation.Version("2.3")
 package org.apache.jackrabbit.api.security.principal;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/User.java Tue Sep 27 11:53:10 2011
@@ -59,6 +59,16 @@ public interface User extends Authorizab
     void changePassword(String password) throws RepositoryException;
 
     /**
+     * Change the password of this user.
+     *
+     * @param password The new password.
+     * @param oldPassword The old password.
+     * @throws RepositoryException If the old password doesn't match or if
+     * an error occurs.
+     */
+    void changePassword(String password, String oldPassword) throws RepositoryException;
+
+    /**
      * Disable this user thus preventing future login if the <code>reason</code>
      * is a non-null String.<br>
      * Note however, that this user will still be accessible by

Modified: jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/user/UserManager.java Tue Sep 27 11:53:10 2011
@@ -23,7 +23,7 @@ import java.util.Iterator;
 
 /**
  * The <code>UserManager</code> provides access to and means to maintain
- * {@link Authorizable authoriable objects} i.e. {@link User users} and
+ * {@link Authorizable authorizable objects} i.e. {@link User users} and
  * {@link Group groups}. The <code>UserManager</code> is bound to a particular
  * <code>Session</code>.
  */
@@ -67,6 +67,19 @@ public interface UserManager {
     Authorizable getAuthorizable(Principal principal) throws RepositoryException;
 
     /**
+     * In accordance to {@link org.apache.jackrabbit.api.security.user.Authorizable#getPath()}
+     * this method allows to retrieve an given authorizable by it's path.
+     *
+     * @param path The path to an authorizable.
+     * @return Authorizable or <code>null</code>, if not present.
+     * @throws UnsupportedRepositoryOperationException If this implementation does
+     * support to retrieve authorizables by path.
+     * @throws RepositoryException If another error occurs.
+     * @see org.apache.jackrabbit.api.security.user.Authorizable#getPath()
+     */
+    Authorizable getAuthorizableByPath(String path) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
      * Returns all <code>Authorizable</code>s that have a
      * {@link Authorizable#getProperty(String) property} with the given relative
      * path (or name) that matches the specified value.

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/pom.xml?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/pom.xml (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/pom.xml Tue Sep 27 11:53:10 2011
@@ -107,6 +107,7 @@ org.apache.jackrabbit.test.api.Shareable
 org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodes
 org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodesByPattern
 org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodesByPattern
+org.apache.jackrabbit.core.data.ConcurrentGcTest#testDatabases
               </value>
             </property>
             <property>

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java Tue Sep 27 11:53:10 2011
@@ -68,7 +68,6 @@ public class RepositoryFactoryImpl imple
     private final Set<TransientRepository> ownRepositories =
         new HashSet<TransientRepository>();
 
-    @SuppressWarnings("unchecked")
     public Repository getRepository(Map parameters) throws RepositoryException {
         if (parameters == null) {
             return getRepository(null, Collections.emptyMap());

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java Tue Sep 27 11:53:10 2011
@@ -24,8 +24,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.Executor;
-
 import javax.jcr.NamespaceException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -38,7 +36,6 @@ import javax.jcr.query.qom.QueryObjectMo
 import org.apache.jackrabbit.core.config.SearchConfig;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.id.NodeId;
-import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.observation.EventImpl;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
 import org.apache.jackrabbit.core.persistence.PersistenceManager;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java Tue Sep 27 11:53:10 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.core;
 
-import java.util.Iterator;
-
 import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ChangeLogRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ChangeLogRecord.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ChangeLogRecord.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ChangeLogRecord.java Tue Sep 27 11:53:10 2011
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.core.clust
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.Map;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java Tue Sep 27 11:53:10 2011
@@ -16,11 +16,9 @@
  */
 package org.apache.jackrabbit.core.fs.db;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
 import org.apache.jackrabbit.core.persistence.PMContext;
 import org.apache.jackrabbit.core.util.db.CheckSchemaOperation;
 import org.apache.jackrabbit.core.util.db.ConnectionHelper;
@@ -40,7 +38,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.FileInputStream;
-import java.io.RandomAccessFile;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java Tue Sep 27 11:53:10 2011
@@ -19,9 +19,6 @@ package org.apache.jackrabbit.core.fs.db
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.util.db.ConnectionHelper;
 import org.apache.jackrabbit.core.util.db.DerbyConnectionHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.sql.SQLException;
 
 import javax.sql.DataSource;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeTypeCacheImpl.java Tue Sep 27 11:53:10 2011
@@ -254,7 +254,7 @@ public class EffectiveNodeTypeCacheImpl 
          * @param ntNames
          * @param weight
          */
-        WeightedKey(Collection ntNames, int weight) {
+        WeightedKey(Collection<Name> ntNames, int weight) {
             this((Name[]) ntNames.toArray(new Name[ntNames.size()]), weight);
         }
 

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/AdditionalNamespaceResolver.java Tue Sep 27 11:53:10 2011
@@ -43,7 +43,7 @@ public class AdditionalNamespaceResolver
      * @param namespaces namespace properties
      */
     public AdditionalNamespaceResolver(Properties namespaces) {
-        Enumeration prefixes = namespaces.propertyNames();
+        Enumeration<?> prefixes = namespaces.propertyNames();
         while (prefixes.hasMoreElements()) {
             String prefix = (String) prefixes.nextElement();
             addNamespace(prefix, namespaces.getProperty(prefix));

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java Tue Sep 27 11:53:10 2011
@@ -214,8 +214,8 @@ public final class NodeTypeWriter {
         // TODO do properly...
         String[] qops = def.getAvailableQueryOperators();
         if (qops != null && qops.length > 0) {
-            List ops = Arrays.asList(qops);
-            List defaultOps = Arrays.asList(Operator.getAllQueryOperators());
+            List<String> ops = Arrays.asList(qops);
+            List<String> defaultOps = Arrays.asList(Operator.getAllQueryOperators());
             if (!ops.containsAll(defaultOps)) {
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < qops.length; i++) {

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java Tue Sep 27 11:53:10 2011
@@ -39,7 +39,7 @@ public class DelegatingObservationDispat
     /**
      * the set of dispatchers
      */
-    private final HashSet dispatchers = new HashSet();
+    private final HashSet<ObservationDispatcher> dispatchers = new HashSet<ObservationDispatcher>();
 
     /**
      * Adds a new observation dispatcher to the set of dispatchers
@@ -110,7 +110,7 @@ public class DelegatingObservationDispat
      * @param pathPrefix event path prefix
      * @param userData the user data
      */
-    public void dispatch(List eventList, SessionImpl session,
+    public void dispatch(List<EventState> eventList, SessionImpl session,
                          Path pathPrefix, String userData) {
         ObservationDispatcher[] disp;
         synchronized (dispatchers) {

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventListenerIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventListenerIteratorImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventListenerIteratorImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventListenerIteratorImpl.java Tue Sep 27 11:53:10 2011
@@ -37,7 +37,7 @@ class EventListenerIteratorImpl implemen
     /**
      * Iterator over {@link EventConsumer} instances
      */
-    private final Iterator consumers;
+    private final Iterator<EventConsumer> consumers;
 
     /**
      * The next <code>EventListener</code> that belongs to the session
@@ -59,7 +59,7 @@ class EventListenerIteratorImpl implemen
      * @throws NullPointerException if <code>ticket</code> or <code>consumer</code>
      *                              is <code>null</code>.
      */
-    EventListenerIteratorImpl(Session session, Collection sConsumers, Collection aConsumers)
+    EventListenerIteratorImpl(Session session, Collection<EventConsumer> sConsumers, Collection<EventConsumer> aConsumers)
             throws NullPointerException {
         if (session == null) {
             throw new NullPointerException("session");
@@ -71,7 +71,7 @@ class EventListenerIteratorImpl implemen
             throw new NullPointerException("consumers");
         }
         this.session = session;
-        Collection allConsumers = new ArrayList(sConsumers);
+        Collection<EventConsumer> allConsumers = new ArrayList<EventConsumer>(sConsumers);
         allConsumers.addAll(aConsumers);
         this.consumers = allConsumers.iterator();
         fetchNext();

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java Tue Sep 27 11:53:10 2011
@@ -56,6 +56,7 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 /**
  * Abstract base class for database persistence managers. This class
@@ -106,7 +107,7 @@ public abstract class DatabasePersistenc
     protected static final int SLEEP_BEFORE_RECONNECT = 10000;
 
     // the map of prepared statements (key: sql stmt, value: prepared stmt)
-    private HashMap preparedStatements = new HashMap();
+    private Map<String, PreparedStatement> preparedStatements = new HashMap<String, PreparedStatement>();
 
     // SQL statements for NodeState management
     protected String nodeStateInsertSQL;
@@ -269,8 +270,8 @@ public abstract class DatabasePersistenc
 
         try {
             // close shared prepared statements
-            for (Iterator it = preparedStatements.values().iterator(); it.hasNext();) {
-                closeStatement((PreparedStatement) it.next());
+            for (PreparedStatement ps : preparedStatements.values()) {
+                closeStatement(ps);
             }
             preparedStatements.clear();
 
@@ -828,8 +829,8 @@ public abstract class DatabasePersistenc
         // gracefully in order to avoid potential memory leaks
 
         // close shared prepared statements
-        for (Iterator it = preparedStatements.values().iterator(); it.hasNext();) {
-            PreparedStatement stmt = ((PreparedStatement) it.next());
+        for (Iterator<PreparedStatement> it = preparedStatements.values().iterator(); it.hasNext();) {
+            PreparedStatement stmt = it.next();
             if (stmt != null) {
                 try {
                     stmt.close();

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/AbstractExcerpt.java Tue Sep 27 11:53:10 2011
@@ -16,30 +16,33 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.lucene.search.Query;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.analysis.tokenattributes.TermAttribute;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermDocs;
 import org.apache.lucene.index.TermFreqVector;
 import org.apache.lucene.index.TermPositionVector;
 import org.apache.lucene.index.TermVectorOffsetInfo;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Fieldable;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
-import org.apache.lucene.analysis.tokenattributes.TermAttribute;
-import org.apache.jackrabbit.core.id.NodeId;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.Reader;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.TreeMap;
-import java.util.SortedMap;
-import java.util.Arrays;
+import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.Query;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>AbstractExcerpt</code> implements base functionality for an excerpt
@@ -177,10 +180,32 @@ public abstract class AbstractExcerpt im
     /**
      * @return the extracted terms from the query.
      */
-    protected final Set<Term> getQueryTerms() {
-        Set<Term> extractedTerms = new HashSet<Term>();
-        Set<Term> relevantTerms = new HashSet<Term>();
-        query.extractTerms(extractedTerms);
+    protected final Set<Term[]> getQueryTerms() {
+        Set<Term[]> relevantTerms = new HashSet<Term[]>();
+        getQueryTerms(query, relevantTerms);
+        return relevantTerms;
+    }
+
+    private static void getQueryTerms(Query q, Set<Term[]> relevantTerms) {
+        if (q instanceof BooleanQuery) {
+            final BooleanQuery bq = (BooleanQuery) q;
+            for (BooleanClause clause : bq.getClauses()) {
+                getQueryTerms(clause.getQuery(), relevantTerms);
+            }
+            return;
+        }
+        //need to preserve insertion order
+        Set<Term> extractedTerms = new LinkedHashSet<Term>();
+        q.extractTerms(extractedTerms);
+        Set<Term> filteredTerms = filterRelevantTerms(extractedTerms);
+        if (!filteredTerms.isEmpty()) {
+            relevantTerms.add(filteredTerms.toArray(new Term[] {}));
+        }
+    }
+
+    private static Set<Term> filterRelevantTerms(Set<Term> extractedTerms) {
+      //need to preserve insertion order
+        Set<Term> relevantTerms = new LinkedHashSet<Term>();
         // only keep terms for fulltext fields
         for (Term t : extractedTerms) {
             if (t.field().equals(FieldNames.FULLTEXT)) {

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/DefaultHighlighter.java Tue Sep 27 11:53:10 2011
@@ -19,17 +19,19 @@ package org.apache.jackrabbit.core.query
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
+import org.apache.jackrabbit.util.Text;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermPositionVector;
 import org.apache.lucene.index.TermVectorOffsetInfo;
-import org.apache.lucene.index.Term;
-import org.apache.jackrabbit.util.Text;
 
 /**
  * This is an adapted version of the <code>FulltextHighlighter</code> posted in
@@ -93,7 +95,7 @@ public class DefaultHighlighter {
      *         highlighted
      */
     public static String highlight(TermPositionVector tvec,
-                                   Set<Term> queryTerms,
+                                   Set<Term[]> queryTerms,
                                    String text,
                                    String excerptStart,
                                    String excerptEnd,
@@ -120,7 +122,7 @@ public class DefaultHighlighter {
      *         highlighted
      */
     public static String highlight(TermPositionVector tvec,
-                                   Set<Term> queryTerms,
+                                   Set<Term[]> queryTerms,
                                    String text,
                                    int maxFragments,
                                    int surround)
@@ -134,7 +136,7 @@ public class DefaultHighlighter {
      * @see #highlight(TermPositionVector, Set, String, String, String, String, String, String, String, int, int)
      */
     protected String doHighlight(TermPositionVector tvec,
-                                 Set<Term> queryTerms,
+                                 Set<Term[]> queryTerms,
                                  String text,
                                  String excerptStart,
                                  String excerptEnd,
@@ -144,21 +146,102 @@ public class DefaultHighlighter {
                                  String hlEnd,
                                  int maxFragments,
                                  int surround) throws IOException {
-        String[] terms = new String[queryTerms.size()];
-        Iterator<Term> it = queryTerms.iterator();
-        for (int i = 0; it.hasNext(); i++) {
-            terms[i] = it.next().text();
-        }
-        List<TermVectorOffsetInfo> list = new ArrayList<TermVectorOffsetInfo>();
-        int[] tvecindexes = tvec.indexesOf(terms, 0, terms.length);
-        for (int tvecindex : tvecindexes) {
-            TermVectorOffsetInfo[] termoffsets = tvec.getOffsets(tvecindex);
-            list.addAll(Arrays.asList(termoffsets));
+
+        List<TermVectorOffsetInfo> termOffsetInfo = new ArrayList<TermVectorOffsetInfo>();
+
+        Iterator<Term[]> it = queryTerms.iterator();
+        while (it.hasNext()) {
+            Term[] qt = it.next();
+            final int qtLen = qt.length;
+            if (qt == null || qtLen == 0) {
+                continue;
+            }
+            String[] qtText = new String[qtLen];
+            for (int i = 0; i < qtLen; i++) {
+                qtText[i] = qt[i].text();
+            }
+            int[] tvecindexes = tvec.indexesOf(qtText, 0, qtText.length);
+            Map<Integer, TermVectorOffsetInfo[]> localTermOffsetInfo = new HashMap<Integer, TermVectorOffsetInfo[]>();
+            for (int tvecindex : tvecindexes) {
+                TermVectorOffsetInfo[] termoffsets = tvec.getOffsets(tvecindex);
+                if (termoffsets == null || termoffsets.length == 0) {
+                    continue;
+                }
+                localTermOffsetInfo.put(tvecindex, termoffsets);
+            }
+
+            // to keep the order of the keys, use tvecindexes,
+            // if a term is not found tvecindexes[] = -1
+            // when dealing with multiple terms that have to exist, just check
+            // if the first one is there
+            if (tvecindexes.length > 0 && tvecindexes[0] >= 0) {
+                // we have to build one interval TermVectorOffsetInfo for each
+                // hit;
+                List<TermVectorOffsetInfo> intervalTermOffsetInfo = new ArrayList<TermVectorOffsetInfo>();
+
+                // pick all the first key's hist as interval start
+                TermVectorOffsetInfo[] firstKeyTermOffsets = localTermOffsetInfo
+                        .get(tvecindexes[0]);
+                Arrays.sort(firstKeyTermOffsets,
+                        new TermVectorOffsetInfoSorter());
+                intervalTermOffsetInfo.addAll(Arrays
+                        .asList(firstKeyTermOffsets));                
+
+                // check if each key is part of an interval, if not, it is
+                // dropped from the list
+                for (int i = 1; i < tvecindexes.length; i++) {
+                    final Integer key = tvecindexes[i];
+                    TermVectorOffsetInfo[] termoffsets = localTermOffsetInfo
+                            .get(key);
+                    if (termoffsets == null) {
+                        continue;
+                    }
+                    Arrays.sort(termoffsets, new TermVectorOffsetInfoSorter());
+
+                    Iterator<TermVectorOffsetInfo> intervalIterator = intervalTermOffsetInfo
+                            .iterator();
+
+                    int index = 0;
+                    while (intervalIterator.hasNext()) {
+                        TermVectorOffsetInfo intervalOI = intervalIterator
+                                .next();
+                        if (index >= termoffsets.length) {
+                            intervalIterator.remove();
+                            continue;
+                        }
+                        boolean matchSearch = true;
+                        boolean matchFound = false;
+                        while (matchSearch) {
+                            TermVectorOffsetInfo localOI = termoffsets[index];
+                            // check interval match
+                            // CJK languages will have the tokens from the PhraseQuery glued together (see LUCENE-2458)
+                            int diff = localOI.getStartOffset()
+                                    - intervalOI.getEndOffset();
+                            // TODO we'll probably have to remove 'diff == 0'
+                            // after upgrading to lucene 3.1
+                            if (diff == 1 || diff == 0) {
+                                intervalOI.setEndOffset(localOI.getEndOffset());
+                                matchSearch = false;
+                                matchFound = true;
+                            }
+                            index++;
+                            if (index >= termoffsets.length) {
+                                matchSearch = false;
+                            }
+                        }
+                        if (!matchFound) {
+                            index--;
+                            intervalIterator.remove();
+                        }
+                    }
+                }
+                termOffsetInfo.addAll(intervalTermOffsetInfo);
+            }
         }
 
-        TermVectorOffsetInfo[] offsets = list.toArray(new TermVectorOffsetInfo[list.size()]);
+        TermVectorOffsetInfo[] offsets = termOffsetInfo.toArray(new TermVectorOffsetInfo[termOffsetInfo.size()]);
         // sort offsets
-        if (terms.length > 1) {
+        if (offsets != null && offsets.length > 1) {
             Arrays.sort(offsets, new TermVectorOffsetInfoSorter());
         }
 
@@ -248,8 +331,8 @@ public class DefaultHighlighter {
                     if (skippedChars > surround) {
                         skippedChars = surround;
                     }
-                    sb.append(Text.encodeIllegalXMLCharacters(
-                            new String(cbuf, 0, surround - skippedChars)));
+                    sb.append(escape(new String(cbuf, 0, surround
+                            - skippedChars)));
                     sb.append(fragmentEnd);
                 }
             }
@@ -296,8 +379,8 @@ public class DefaultHighlighter {
             if (!sentenceStart) {
                 sb.append("... ");
             }
-            sb.append(Text.encodeIllegalXMLCharacters(
-                    new String(cbuf, skippedChars, cbuf.length - skippedChars)));
+            sb.append(escape(new String(cbuf, skippedChars, cbuf.length
+                    - skippedChars)));
 
             // iterate terms
             for (Iterator<TermVectorOffsetInfo> iter = fi.iterator(); iter.hasNext();) {
@@ -307,8 +390,7 @@ public class DefaultHighlighter {
                     cbuf = new char[nextStart - pos];
                     int charsRead = reader.read(cbuf, 0, nextStart - pos);
                     pos += (nextStart - pos);
-                    sb.append(Text.encodeIllegalXMLCharacters(
-                            new String(cbuf, 0, charsRead)));
+                    sb.append(escape(new String(cbuf, 0, charsRead)));
                 }
                 sb.append(hlStart);
                 nextStart = ti.getEndOffset();
@@ -316,8 +398,7 @@ public class DefaultHighlighter {
                 cbuf = new char[nextStart - pos];
                 reader.read(cbuf, 0, nextStart - pos);
                 pos += (nextStart - pos);
-                sb.append(Text.encodeIllegalXMLCharacters(
-                        new String(cbuf)));
+                sb.append(escape(new String(cbuf)));
                 sb.append(hlEnd);
             }
         }
@@ -343,8 +424,8 @@ public class DefaultHighlighter {
                 } else {
                     skippedChars = 0;
                 }
-                sb.append(Text.encodeIllegalXMLCharacters(
-                        new String(cbuf, 0, EOF ? skip : (surround - skippedChars))));
+                sb.append(escape(new String(cbuf, 0, EOF ? skip
+                        : (surround - skippedChars))));
                 if (!EOF) {
                     char lastChar = sb.charAt(sb.length() - 1);
                     if (lastChar != '.' && lastChar != '!' && lastChar != '?') {
@@ -364,7 +445,7 @@ public class DefaultHighlighter {
      * @param text the text.
      * @param excerptStart the excerpt start.
      * @param excerptEnd the excerpt end.
-     * @param fragmentStart the fragement start.
+     * @param fragmentStart the fragment start.
      * @param fragmentEnd the fragment end.
      * @param maxLength the maximum length of the fragment.
      * @return a default excerpt.
@@ -393,10 +474,24 @@ public class DefaultHighlighter {
                 }
             }
         }
-        excerpt.append(Text.encodeIllegalXMLCharacters(tmp.toString()));
+        excerpt.append(escape(tmp.toString()));
         excerpt.append(fragmentEnd).append(excerptEnd);
         return excerpt.toString();
     }
+    
+    
+    /**
+     * Escapes input text suitable for the output format.
+     * <p>
+     * By default does XML-escaping. Can be overridden for
+     * other formats.
+     * 
+     * @param input raw text.
+     * @return text suitably escaped.
+     */
+    protected String escape(String input) {
+        return Text.encodeIllegalXMLCharacters(input);
+    }
 
     private static class FragmentInfo {
         List<TermVectorOffsetInfo> offsetInfosList;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/IndexFormatVersion.java Tue Sep 27 11:53:10 2011
@@ -102,7 +102,6 @@ public class IndexFormatVersion {
      * index reader.
      */
     public static IndexFormatVersion getVersion(IndexReader indexReader) {
-        @SuppressWarnings("unchecked")
         Collection<String> fields = indexReader.getFieldNames(
                 IndexReader.FieldOption.ALL);
         if (fields.contains(FieldNames.LOCAL_NAME) || indexReader.numDocs() == 0) {

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java Tue Sep 27 11:53:10 2011
@@ -506,7 +506,6 @@ public final class MoreLikeThis {
     public Query like(int docNum) throws IOException {
         if (fieldNames == null) {
             // gather list of valid fields from lucene
-            @SuppressWarnings("unchecked")
             Collection<String> fields = ir.getFieldNames(IndexReader.FieldOption.INDEXED);
             fieldNames = fields.toArray(new String[fields.size()]);
         }
@@ -522,7 +521,6 @@ public final class MoreLikeThis {
     public Query like(File f) throws IOException {
         if (fieldNames == null) {
             // gather list of valid fields from lucene
-            @SuppressWarnings("unchecked")
             Collection<String> fields = ir.getFieldNames(IndexReader.FieldOption.INDEXED);
             fieldNames = fields.toArray(new String[fields.size()]);
         }

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/WeightedHighlighter.java Tue Sep 27 11:53:10 2011
@@ -77,7 +77,7 @@ public class WeightedHighlighter extends
      *         highlighted
      */
     public static String highlight(TermPositionVector tvec,
-                                   Set<Term> queryTerms,
+                                   Set<Term[]> queryTerms,
                                    String text,
                                    String excerptStart,
                                    String excerptEnd,
@@ -103,7 +103,7 @@ public class WeightedHighlighter extends
      *         highlighted
      */
     public static String highlight(TermPositionVector tvec,
-                                   Set<Term> queryTerms,
+                                   Set<Term[]> queryTerms,
                                    String text,
                                    int maxFragments,
                                    int surround) throws IOException {
@@ -129,7 +129,7 @@ public class WeightedHighlighter extends
                     fragmentStart, fragmentEnd, surround * 2);
         }
 
-        PriorityQueue bestFragments = new FragmentInfoPriorityQueue(maxFragments);
+        PriorityQueue<FragmentInfo> bestFragments = new FragmentInfoPriorityQueue(maxFragments);
         for (int i = 0; i < offsets.length; i++) {
             if (offsets[i].getEndOffset() <= text.length()) {
                 FragmentInfo fi = new FragmentInfo(offsets[i], surround * 2);
@@ -195,14 +195,17 @@ public class WeightedHighlighter extends
                 TermVectorOffsetInfo oi = fIt.next();
                 if (lastOffsetInfo != null) {
                     // fill in text between terms
-                    sb.append(text.substring(lastOffsetInfo.getEndOffset(), oi.getStartOffset()));
+                    sb.append(escape(text.substring(
+                            lastOffsetInfo.getEndOffset(), oi.getStartOffset())));
                 }
                 sb.append(hlStart);
-                sb.append(text.substring(oi.getStartOffset(), oi.getEndOffset()));
+                sb.append(escape(text.substring(oi.getStartOffset(),
+                        oi.getEndOffset())));
                 sb.append(hlEnd);
                 lastOffsetInfo = oi;
             }
-            limit = Math.min(text.length(), fi.getStartOffset() - len + (surround * 2));
+            limit = Math.min(text.length(), fi.getStartOffset() - len
+                    + (surround * 2));
             endFragment(sb, text, fi.getEndOffset(), limit);
             sb.append(fragmentEnd);
         }
@@ -223,10 +226,10 @@ public class WeightedHighlighter extends
      * @return the length of the start fragment that was appended to
      *         <code>sb</code>.
      */
-    private static int startFragment(StringBuffer sb, String text, int offset, int limit) {
+    private int startFragment(StringBuffer sb, String text, int offset, int limit) {
         if (limit == 0) {
             // append all
-            sb.append(text.substring(0, offset));
+            sb.append(escape(text.substring(0, offset)));
             return offset;
         }
         String intro = "... ";
@@ -242,7 +245,7 @@ public class WeightedHighlighter extends
                 }
             }
         }
-        sb.append(intro).append(text.substring(start, offset));
+        sb.append(intro).append(escape(text.substring(start, offset)));
         return offset - start;
     }
 
@@ -256,10 +259,10 @@ public class WeightedHighlighter extends
      * @param offset the end offset of the last matching term in the fragment.
      * @param limit  do not go further than <code>limit</code>.
      */
-    private static void endFragment(StringBuffer sb, String text, int offset, int limit) {
+    private void endFragment(StringBuffer sb, String text, int offset, int limit) {
         if (limit == text.length()) {
             // append all
-            sb.append(text.substring(offset));
+            sb.append(escape(text.substring(offset)));
             return;
         }
         int end = offset;
@@ -269,7 +272,7 @@ public class WeightedHighlighter extends
                 end = i;
             }
         }
-        sb.append(text.substring(offset, end)).append(" ...");
+        sb.append(escape(text.substring(offset, end))).append(" ...");
     }
 
     private static class FragmentInfo {
@@ -333,7 +336,7 @@ public class WeightedHighlighter extends
 
     }
 
-    private static class FragmentInfoPriorityQueue extends PriorityQueue {
+    private static class FragmentInfoPriorityQueue extends PriorityQueue<FragmentInfo> {
 
         public FragmentInfoPriorityQueue(int size) {
             initialize(size);
@@ -347,9 +350,7 @@ public class WeightedHighlighter extends
          * {@link FragmentInfo} with the best quality.
          */
         @Override
-        protected boolean lessThan(Object a, Object b) {
-            FragmentInfo infoA = (FragmentInfo) a;
-            FragmentInfo infoB = (FragmentInfo) b;
+        protected boolean lessThan(FragmentInfo infoA, FragmentInfo infoB) {
             if (infoA.getQuality() == infoB.getQuality()) {
                 return infoA.getStartOffset() > infoB.getStartOffset();
             }

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java Tue Sep 27 11:53:10 2011
@@ -26,8 +26,6 @@ import org.apache.jackrabbit.core.securi
 import org.apache.jackrabbit.core.security.authorization.AccessControlProvider;
 import org.apache.jackrabbit.core.security.authorization.CompiledPermissions;
 import org.apache.jackrabbit.core.security.authorization.Permission;
-import org.apache.jackrabbit.core.security.authorization.PrivilegeManagerImpl;
-import org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry;
 import org.apache.jackrabbit.core.security.authorization.WorkspaceAccessManager;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AbstractCompiledPermissions.java Tue Sep 27 11:53:10 2011
@@ -16,15 +16,14 @@
  */
 package org.apache.jackrabbit.core.security.authorization;
 
-import org.apache.commons.collections.map.LRUMap;
-import org.apache.jackrabbit.spi.Path;
+import java.util.Map;
+import java.util.Set;
 
 import javax.jcr.RepositoryException;
-import javax.jcr.security.AccessControlException;
 import javax.jcr.security.Privilege;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
+
+import org.apache.commons.collections.map.LRUMap;
+import org.apache.jackrabbit.spi.Path;
 
 /**
  * <code>AbstractCompiledPermissions</code>...

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java Tue Sep 27 11:53:10 2011
@@ -30,9 +30,7 @@ import javax.jcr.security.Privilege;
 import java.security.Principal;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Simple, immutable implementation of the

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/PrivilegeRegistry.java Tue Sep 27 11:53:10 2011
@@ -134,7 +134,7 @@ public final class PrivilegeRegistry imp
 
     private final NameResolver resolver;
 
-    private PrivilegeBits nextBits = PrivilegeBits.getInstance(RETENTION_MNGMT).nextBits();
+    private PrivilegeBits nextBits = PrivilegeBits.getInstance(PRIVILEGE_MNGMT).nextBits();
 
     /**
      * Privilege event channel for clustering support.

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java Tue Sep 27 11:53:10 2011
@@ -31,7 +31,6 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.api.security.user.Impersonation;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyImpl;
-import org.apache.jackrabbit.core.security.SystemPrincipal;
 import org.apache.jackrabbit.core.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.core.security.principal.PrincipalIteratorAdapter;
 import org.apache.jackrabbit.value.StringValue;
@@ -139,23 +138,24 @@ class ImpersonationImpl implements Imper
             principalNames.add(p.getName());
         }
 
+        boolean allows;
         Set<String> impersonators = getImpersonatorNames();
-        if (impersonators.removeAll(principalNames)) {
-            return true;
-        } else {
-            // check if subject belongs to an administrator or the system
+        allows = impersonators.removeAll(principalNames);
+
+        if (!allows) {
+            // check if subject belongs to administrator user
             for (Principal p : subject.getPrincipals()) {
-                if (p instanceof SystemPrincipal) { 
-                    return true;
-                } else if (!(p instanceof Group)) {
-                    Authorizable a = userManager.getAuthorizable(p);
-                    if (a != null && userManager.isAdminId(a.getID())) {
-                        return true;
-                    }
+                if (p instanceof Group) {
+                    continue;
+                }
+                Authorizable a = userManager.getAuthorizable(p);
+                if (a != null && userManager.isAdminId(a.getID())) {
+                    allows = true;
+                    break;
                 }
             }
         }
-        return false;
+        return allows;
     }
 
     //------------------------------------------------------------< private >---

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImpl.java Tue Sep 27 11:53:10 2011
@@ -26,6 +26,7 @@ import org.apache.jackrabbit.core.securi
 
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
+import javax.jcr.SimpleCredentials;
 import javax.jcr.Value;
 import java.io.UnsupportedEncodingException;
 import java.security.NoSuchAlgorithmException;
@@ -130,6 +131,26 @@ public class UserImpl extends Authorizab
     }
 
     /**
+     * @see User#changePassword(String, String)
+     */
+    public void changePassword(String password, String oldPassword) throws RepositoryException {
+        // make sure the old password matches.
+        try {
+            CryptedSimpleCredentials csc = (CryptedSimpleCredentials) getCredentials();
+            SimpleCredentials creds = new SimpleCredentials(getID(), oldPassword.toCharArray());
+            if (!csc.matches(creds)) {
+                throw new RepositoryException("Failed to change password: Old password does not match.");
+            }
+        } catch (NoSuchAlgorithmException e) {
+            throw new RepositoryException("Cannot change password: failed to validate old password.");
+        } catch (UnsupportedEncodingException e) {
+            throw new RepositoryException("Cannot change password: failed to validate old password.");
+        }
+
+        changePassword(password);
+    }
+
+    /**
      * @see User#disable(String)
      */
     public void disable(String reason) throws RepositoryException {

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImporter.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImporter.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserImporter.java Tue Sep 27 11:53:10 2011
@@ -43,7 +43,6 @@ import org.apache.jackrabbit.core.NodeIm
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.security.principal.PrincipalImpl;
-import org.apache.jackrabbit.core.security.user.UserImporter.ImportBehavior;
 import org.apache.jackrabbit.core.session.SessionContext;
 import org.apache.jackrabbit.core.session.SessionWriteOperation;
 import org.apache.jackrabbit.core.state.NodeState;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java Tue Sep 27 11:53:10 2011
@@ -445,6 +445,17 @@ public class UserManagerImpl extends Pro
     }
 
     /**
+     * Always throws <code>UnsupportedRepositoryOperationException</code> since
+     * this implementation of the user management API does not allow to retrieve
+     * the path of an authorizable.
+     * 
+     * @see UserManager#getAuthorizableByPath(String)
+     */
+    public Authorizable getAuthorizableByPath(String path) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    /**
      * @see UserManager#findAuthorizables(String,String)
      */
     public Iterator<Authorizable> findAuthorizables(String relPath, String value) throws RepositoryException {
@@ -747,6 +758,15 @@ public class UserManagerImpl extends Pro
     }
 
     /**
+     * Returns the session associated with this user manager.
+     *
+     * @return the session.
+     */
+    SessionImpl getSession() {
+        return session;
+    }
+
+    /**
      * Test if a user or group exists that has the given principals name as ID,
      * which might happen if userID != principal-name.
      * In this case: generate another ID for the group to be created.

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserPerWorkspaceUserManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserPerWorkspaceUserManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserPerWorkspaceUserManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserPerWorkspaceUserManager.java Tue Sep 27 11:53:10 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.security.user;
 
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 
 import javax.jcr.Node;
@@ -78,6 +80,20 @@ public class UserPerWorkspaceUserManager
 
     //--------------------------------------------------------< UserManager >---
     /**
+     * @see org.apache.jackrabbit.api.security.user.UserManager#getAuthorizableByPath(String)
+     */
+    @Override
+    public Authorizable getAuthorizableByPath(String path) throws UnsupportedRepositoryOperationException, RepositoryException {
+        SessionImpl session = getSession();
+        if (session.nodeExists(path)) {
+            NodeImpl n = (NodeImpl) session.getNode(path);
+            return getAuthorizable(n);
+        } else {
+            return null;
+        }
+    }
+
+    /**
      * @see org.apache.jackrabbit.api.security.user.UserManager#isAutoSave()
      */
     @Override

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateMerger.java Tue Sep 27 11:53:10 2011
@@ -22,14 +22,10 @@ import org.apache.jackrabbit.core.id.Pro
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
-import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.nodetype.NodeDefinition;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.PropertyDefinition;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java Tue Sep 27 11:53:10 2011
@@ -781,14 +781,13 @@ public class SharedItemStateManager
 
             ISMLocking.ReadLock readLock = null;
             try {
+                // Let the shared item listeners know about the change
+                shared.persisted();
+
                 // downgrade to read lock
                 readLock = writeLock.downgrade();
                 writeLock = null;
 
-                // Let the shared item listeners know about the change
-                // JCR-2171: This must happen after downgrading the lock!
-                shared.persisted();
-
                 /* notify virtual providers about node references */
                 for (int i = 0; i < virtualNodeReferences.length; i++) {
                     ChangeLog virtualRefs = virtualNodeReferences[i];

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Tue Sep 27 11:53:10 2011
@@ -64,7 +64,7 @@ public class SessionImporter implements 
      */
     private final ReferenceChangeTracker refTracker;
 
-    private final List<ProtectedItemImporter> pItemImporters = new ArrayList();
+    private final List<ProtectedItemImporter> pItemImporters = new ArrayList<ProtectedItemImporter>();
 
     /**
      * Currently active importer for protected nodes.
@@ -106,7 +106,7 @@ public class SessionImporter implements 
         parents.push(importTargetNode);
 
         if (config != null) {
-            List<ProtectedItemImporter> iList = (List<ProtectedItemImporter>) config.getProtectedItemImporters();
+            List<? extends ProtectedItemImporter> iList = config.getProtectedItemImporters();
             for (ProtectedItemImporter importer : iList) {
                 if (importer.init(session, session, false, uuidBehavior, refTracker)) {
                     pItemImporters.add(importer);

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java Tue Sep 27 11:53:10 2011
@@ -40,7 +40,6 @@ import org.xml.sax.SAXException;
 /**
  * <code>SysViewImportHandler</code>  ...
  */
-@SuppressWarnings({"ThrowableInstanceNeverThrown"})
 class SysViewImportHandler extends TargetImportHandler {
 
     /**

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerTest.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerTest.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerTest.java Tue Sep 27 11:53:10 2011
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.api.securi
 import org.apache.jackrabbit.test.NotExecutableException;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import java.security.Principal;
 import java.util.Iterator;
 import java.util.Set;
@@ -53,4 +54,20 @@ public class UserManagerTest extends Abs
             }
         }
     }
+
+    public void testGetAuthorizableByPath() throws RepositoryException, NotExecutableException {
+        String uid = superuser.getUserID();
+        Authorizable a = userMgr.getAuthorizable(uid);
+        if (a == null) {
+            throw new NotExecutableException();
+        }
+        try {
+            String path = a.getPath();
+            Authorizable a2 = userMgr.getAuthorizableByPath(path);
+            assertNotNull(a2);
+            assertEquals(a.getID(), a2.getID());
+        } catch (UnsupportedRepositoryOperationException e) {
+            throw new NotExecutableException();
+        }
+    }
 }
\ No newline at end of file

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java Tue Sep 27 11:53:10 2011
@@ -104,6 +104,58 @@ public class UserTest extends AbstractUs
         }
     }
 
+    public void testChangePasswordWithOldPassword() throws RepositoryException, NotExecutableException {
+        String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd");
+        if (oldPw == null) {
+            // missing property
+            throw new NotExecutableException();
+        }
+
+        User user = getTestUser(superuser);
+        try {
+            try {
+                user.changePassword("pw", "wrongOldPw");
+                save(superuser);
+                fail("old password didn't match -> changePassword(String,String) should fail.");
+            } catch (RepositoryException e) {
+                // success.
+            }
+
+            user.changePassword("pw", oldPw);
+            save(superuser);
+
+            // make sure the user can login with the new pw
+            Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), "pw".toCharArray()));
+            s.logout();
+        } finally {
+            user.changePassword(oldPw);
+            save(superuser);
+        }
+    }
+
+    public void testChangePasswordWithOldPassword2() throws RepositoryException, NotExecutableException {
+        String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd");
+        if (oldPw == null) {
+            // missing property
+            throw new NotExecutableException();
+        }
+
+        User user = getTestUser(superuser);
+        try {
+            user.changePassword("pw", oldPw);
+            save(superuser);
+
+            Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), oldPw.toCharArray()));
+            s.logout();
+            fail("superuser pw has changed. login must fail.");
+        } catch (LoginException e) {
+            // success
+        } finally {
+            user.changePassword(oldPw);
+            save(superuser);
+        }
+    }
+
     public void testDisable() throws Exception {
         boolean remove = false;
         Session s = getHelper().getReadOnlySession();

Modified: jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java?rev=1176340&r1=1176339&r2=1176340&view=diff
==============================================================================
--- jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java (original)
+++ jackrabbit/branches/JCR-2272/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TestAll.java Tue Sep 27 11:53:10 2011
@@ -79,6 +79,8 @@ public class TestAll extends TestCase {
 
         suite.addTestSuite(OverlappingNodeAddTest.class);
 
+        suite.addTestSuite(NPEandCMETest.class);
+
         return suite;
     }
 }



Mime
View raw message