Просмотр исходного кода

SEC-1132: Refactoring to remove package cycles in ACL module.

Luke Taylor 16 лет назад
Родитель
Сommit
d5f5b0860e

+ 32 - 0
acl/src/main/java/org/springframework/security/acls/AclDataAccessException.java

@@ -0,0 +1,32 @@
+package org.springframework.security.acls;
+
+/**
+ * Abstract base class for Acl data operations.
+ *
+ * @author Luke Taylor
+ * @version $Id$
+ * @since 2.5
+ */
+public abstract class AclDataAccessException extends RuntimeException {
+
+    /**
+     * Constructs an <code>AclDataAccessException</code> with the specified
+     * message and root cause.
+     *
+     * @param msg the detail message
+     * @param t the root cause
+     */
+    public AclDataAccessException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
+
+    /**
+     * Constructs an <code>AclDataAccessException</code> with the specified
+     * message and no root cause.
+     *
+     * @param msg the detail message
+     */
+    public AclDataAccessException(String msg) {
+        super(msg);
+    }
+}

+ 0 - 34
acl/src/main/java/org/springframework/security/acls/AclException.java

@@ -1,34 +0,0 @@
-package org.springframework.security.acls;
-
-import org.springframework.core.NestedRuntimeException;
-
-/**
- * Abstract superclass for all exceptions thrown in the acls package and subpackages.
- *
- * @author Luke Taylor
- * @version $Id$
- * @since 2.5
- */
-public abstract class AclException extends NestedRuntimeException {
-
-    /**
-     * Constructs an <code>AclException</code> with the specified
-     * message and root cause.
-     *
-     * @param msg the detail message
-     * @param t the root cause
-     */
-    public AclException(String msg, Throwable cause) {
-        super(msg, cause);
-    }
-
-    /**
-     * Constructs an <code>AclException</code> with the specified
-     * message and no root cause.
-     *
-     * @param msg the detail message
-     */
-    public AclException(String msg) {
-        super(msg);
-    }
-}

+ 1 - 1
acl/src/main/java/org/springframework/security/acls/AlreadyExistsException.java

@@ -20,7 +20,7 @@ package org.springframework.security.acls;
  * @author Ben Alex
  * @version $Id$
  */
-public class AlreadyExistsException extends AclException {
+public class AlreadyExistsException extends AclDataAccessException {
     //~ Constructors ===================================================================================================
 
     /**

+ 1 - 1
acl/src/main/java/org/springframework/security/acls/ChildrenExistException.java

@@ -20,7 +20,7 @@ package org.springframework.security.acls;
  * @author Ben Alex
  * @version $Id$
  */
-public class ChildrenExistException extends AclException {
+public class ChildrenExistException extends AclDataAccessException {
     //~ Constructors ===================================================================================================
 
     /**

+ 1 - 1
acl/src/main/java/org/springframework/security/acls/NotFoundException.java

@@ -20,7 +20,7 @@ package org.springframework.security.acls;
  * @author Ben Alex
  * @version $Id$
  */
-public class NotFoundException extends AclException {
+public class NotFoundException extends AclDataAccessException {
     //~ Constructors ===================================================================================================
 
     /**

+ 1 - 1
acl/src/main/java/org/springframework/security/acls/UnloadedSidException.java

@@ -21,7 +21,7 @@ package org.springframework.security.acls;
  * @author Ben Alex
  * @version $Id$
  */
-public class UnloadedSidException extends AclException {
+public class UnloadedSidException extends AclDataAccessException {
     //~ Constructors ===================================================================================================
 
     /**

+ 5 - 1
acl/src/main/java/org/springframework/security/acls/AclPermissionEvaluator.java → acl/src/main/java/org/springframework/security/acls/expression/AclPermissionEvaluator.java

@@ -1,4 +1,4 @@
-package org.springframework.security.acls;
+package org.springframework.security.acls.expression;
 
 import java.io.Serializable;
 import java.util.Arrays;
@@ -7,6 +7,10 @@ import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.security.access.expression.PermissionEvaluator;
+import org.springframework.security.acls.Acl;
+import org.springframework.security.acls.AclService;
+import org.springframework.security.acls.NotFoundException;
+import org.springframework.security.acls.Permission;
 import org.springframework.security.acls.domain.BasePermission;
 import org.springframework.security.acls.objectidentity.ObjectIdentity;
 import org.springframework.security.acls.objectidentity.ObjectIdentityGenerator;

+ 2 - 2
acl/src/main/java/org/springframework/security/acls/IdentityUnavailableException.java → acl/src/main/java/org/springframework/security/acls/objectidentity/IdentityUnavailableException.java

@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.springframework.security.acls;
+package org.springframework.security.acls.objectidentity;
 
 /**
  * Thrown if an ACL identity could not be extracted from an object.
@@ -20,7 +20,7 @@ package org.springframework.security.acls;
  * @author Ben Alex
  * @version $Id$
  */
-public class IdentityUnavailableException extends AclException {
+public class IdentityUnavailableException extends RuntimeException {
     //~ Constructors ===================================================================================================
 
     /**

+ 0 - 1
acl/src/main/java/org/springframework/security/acls/objectidentity/ObjectIdentityImpl.java

@@ -14,7 +14,6 @@
  */
 package org.springframework.security.acls.objectidentity;
 
-import org.springframework.security.acls.IdentityUnavailableException;
 import org.springframework.security.acls.jdbc.LookupStrategy;
 
 import org.springframework.util.Assert;

+ 4 - 1
acl/src/test/java/org/springframework/security/acls/AclPermissionEvaluatorTests.java → acl/src/test/java/org/springframework/security/acls/expression/AclPermissionEvaluatorTests.java

@@ -1,4 +1,4 @@
-package org.springframework.security.acls;
+package org.springframework.security.acls.expression;
 
 import static org.junit.Assert.assertTrue;
 
@@ -9,6 +9,9 @@ import org.jmock.Mockery;
 import org.jmock.integration.junit4.JUnit4Mockery;
 import org.junit.Before;
 import org.junit.Test;
+import org.springframework.security.acls.Acl;
+import org.springframework.security.acls.AclService;
+import org.springframework.security.acls.expression.AclPermissionEvaluator;
 import org.springframework.security.acls.objectidentity.ObjectIdentity;
 import org.springframework.security.acls.objectidentity.ObjectIdentityRetrievalStrategy;
 import org.springframework.security.acls.sid.SidRetrievalStrategy;

+ 0 - 1
acl/src/test/java/org/springframework/security/acls/objectidentity/ObjectIdentityTests.java

@@ -3,7 +3,6 @@ package org.springframework.security.acls.objectidentity;
 import static org.junit.Assert.*;
 
 import org.junit.Test;
-import org.springframework.security.acls.IdentityUnavailableException;
 
 /**
  * Tests for {@link ObjectIdentityImpl}.