You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/04/24 10:05:57 UTC
svn commit: r651187 - in
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security:
AccessManager.java DefaultAccessManager.java SimpleJBossAccessManager.java
simple/SimpleAccessManager.java
Author: angela
Date: Thu Apr 24 01:05:51 2008
New Revision: 651187
URL: http://svn.apache.org/viewvc?rev=651187&view=rev
Log:
AccessManager: improve javadoc and consistency of method declaration (throw clause)
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/SimpleJBossAccessManager.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleAccessManager.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java?rev=651187&r1=651186&r2=651187&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/AccessManager.java Thu Apr 24 01:05:51 2008
@@ -142,6 +142,7 @@
* </ul>
* @return <code>true</code> if the specified permissions are granted;
* otherwise <code>false</code>.
+ * @throws RepositoryException if an error occurs.
*/
boolean isGranted(Path absPath, int permissions) throws RepositoryException;
@@ -164,20 +165,18 @@
* </ul>
* @return <code>true</code> if the specified permissions are granted;
* otherwise <code>false</code>.
- * @throws ItemNotFoundException
- * @throws RepositoryException
+ * @throws RepositoryException if an error occurs.
*/
- boolean isGranted(Path parentPath, Name childName, int permissions) throws ItemNotFoundException, RepositoryException;
+ boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException;
/**
- * Determines whether the item with the specified id can be read.
+ * Determines whether the item at the specified absolute path can be read.
*
* @param itemPath
* @return <code>true</code> if the item can be read; otherwise <code>false</code>.
- * @throws ItemNotFoundException
- * @throws RepositoryException
+ * @throws RepositoryException if an error occurs.
*/
- boolean canRead(Path itemPath) throws ItemNotFoundException, RepositoryException;
+ boolean canRead(Path itemPath) throws RepositoryException;
/**
* Determines whether the subject of the current context is granted access
@@ -189,7 +188,7 @@
* @param workspaceName name of workspace
* @return <code>true</code> if the subject of the current context is
* granted access to the given workspace; otherwise <code>false</code>.
- * @throws RepositoryException if another error occurs.
+ * @throws RepositoryException if an error occurs.
*/
boolean canAccess(String workspaceName) throws RepositoryException;
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java?rev=651187&r1=651186&r2=651187&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/DefaultAccessManager.java Thu Apr 24 01:05:51 2008
@@ -42,7 +42,6 @@
import javax.jcr.AccessDeniedException;
import javax.jcr.ItemNotFoundException;
-import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.UnsupportedRepositoryOperationException;
@@ -227,7 +226,7 @@
return compiledPermissions.grants(absPath, permissions);
}
- public boolean isGranted(Path parentPath, Name childName, int permissions) throws ItemNotFoundException, RepositoryException {
+ public boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException {
Path p = PathFactoryImpl.getInstance().create(parentPath, childName, true);
return isGranted(p, permissions);
}
@@ -235,7 +234,7 @@
/**
* @see AccessManager#canRead(Path)
*/
- public boolean canRead(Path itemPath) throws ItemNotFoundException, RepositoryException {
+ public boolean canRead(Path itemPath) throws RepositoryException {
Path path;
if (compiledPermissions.canReadAll()) {
return true;
@@ -247,7 +246,7 @@
/**
* @see AccessManager#canAccess(String)
*/
- public boolean canAccess(String workspaceName) throws NoSuchWorkspaceException, RepositoryException {
+ public boolean canAccess(String workspaceName) throws RepositoryException {
checkInitialized();
return wspAccess.canAccess(workspaceName);
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/SimpleJBossAccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/SimpleJBossAccessManager.java?rev=651187&r1=651186&r2=651187&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/SimpleJBossAccessManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/SimpleJBossAccessManager.java Thu Apr 24 01:05:51 2008
@@ -27,7 +27,6 @@
import javax.jcr.AccessDeniedException;
import javax.jcr.RepositoryException;
-import javax.jcr.ItemNotFoundException;
import java.io.File;
import java.io.FileInputStream;
import java.security.Principal;
@@ -99,13 +98,13 @@
}
public void checkPermission(ItemId id, int permissions)
- throws AccessDeniedException {
+ throws AccessDeniedException, RepositoryException {
if (!isGranted(id, permissions)) {
throw new AccessDeniedException("Access denied");
}
}
- public boolean isGranted(ItemId id, int permissions) {
+ public boolean isGranted(ItemId id, int permissions) throws RepositoryException {
// system has always all permissions
// anonymous has only READ premissions
return system || (anonymous && ((permissions & (WRITE | REMOVE)) == 0));
@@ -115,15 +114,15 @@
return internalIsGranted(permissions);
}
- public boolean isGranted(Path parentPath, Name childName, int permissions) throws ItemNotFoundException, RepositoryException {
+ public boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException {
return internalIsGranted(permissions);
}
- public boolean canRead(Path itemPath) throws ItemNotFoundException, RepositoryException {
+ public boolean canRead(Path itemPath) throws RepositoryException {
return true;
}
- public boolean canAccess(String workspaceName) {
+ public boolean canAccess(String workspaceName) throws RepositoryException {
return system || anonymous;
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleAccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleAccessManager.java?rev=651187&r1=651186&r2=651187&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleAccessManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleAccessManager.java Thu Apr 24 01:05:51 2008
@@ -37,8 +37,6 @@
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
import javax.jcr.AccessDeniedException;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.UnsupportedRepositoryOperationException;
@@ -121,8 +119,7 @@
* {@inheritDoc}
*/
public void checkPermission(ItemId id, int permissions)
- throws AccessDeniedException, ItemNotFoundException,
- RepositoryException {
+ throws AccessDeniedException, RepositoryException {
if (!isGranted(id, permissions)) {
throw new AccessDeniedException("Access denied");
}
@@ -131,8 +128,7 @@
/**
* {@inheritDoc}
*/
- public boolean isGranted(ItemId id, int permissions)
- throws ItemNotFoundException, RepositoryException {
+ public boolean isGranted(ItemId id, int permissions) throws RepositoryException {
checkInitialized();
if (system) {
// system has always all permissions
@@ -153,15 +149,15 @@
return internalIsGranted(absPath, permissions);
}
- public boolean isGranted(Path parentPath, Name childName, int permissions) throws ItemNotFoundException, RepositoryException {
+ public boolean isGranted(Path parentPath, Name childName, int permissions) throws RepositoryException {
return internalIsGranted(parentPath, permissions);
}
- public boolean canRead(Path itemPath) throws ItemNotFoundException, RepositoryException {
+ public boolean canRead(Path itemPath) throws RepositoryException {
return true;
}
- private boolean internalIsGranted(Path absPath, int permissions) throws ItemNotFoundException, RepositoryException {
+ private boolean internalIsGranted(Path absPath, int permissions) throws RepositoryException {
if (!absPath.isAbsolute()) {
throw new RepositoryException("Absolute path expected");
}
@@ -181,7 +177,7 @@
/**
* {@inheritDoc}
*/
- public boolean canAccess(String workspaceName) throws NoSuchWorkspaceException, RepositoryException {
+ public boolean canAccess(String workspaceName) throws RepositoryException {
if (system || wspAccessMgr == null) {
return true;
}