You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by vk...@apache.org on 2008/09/22 15:46:28 UTC
svn commit: r697824 - in
/portals/jetspeed-2/portal/branches/security-refactoring:
components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/
components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/
jetspeed-a...
Author: vkumar
Date: Mon Sep 22 06:46:28 2008
New Revision: 697824
URL: http://svn.apache.org/viewvc?rev=697824&view=rev
Log:
Simplifying exception hierarchy
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java?rev=697824&r1=697823&r2=697824&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalAssociationStorageManager.java Mon Sep 22 06:46:28 2008
@@ -21,6 +21,7 @@
import org.apache.jetspeed.security.PrincipalNotFoundException;
import org.apache.jetspeed.security.PrincipalAssociationRequiredException;
import org.apache.jetspeed.security.PrincipalAssociationUnsupportedException;
+import org.apache.jetspeed.security.SecurityException;
/**
* @version $Id$
@@ -28,8 +29,8 @@
public interface JetspeedPrincipalAssociationStorageManager
{
void addAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
- throws PrincipalNotFoundException, PrincipalAssociationUnsupportedException, PrincipalAssociationNotAllowedException;
+ throws SecurityException;
void removeAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
- throws PrincipalAssociationRequiredException, PrincipalNotFoundException;
+ throws SecurityException;
}
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java?rev=697824&r1=697823&r2=697824&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/JetspeedPrincipalStorageManager.java Mon Sep 22 06:46:28 2008
@@ -29,6 +29,7 @@
import org.apache.jetspeed.security.PrincipalReadOnlyException;
import org.apache.jetspeed.security.PrincipalUpdateException;
import org.apache.jetspeed.security.PrincipalAssociationRequiredException;
+import org.apache.jetspeed.security.SecurityException;
/**
* @version $Id$
@@ -38,10 +39,10 @@
boolean isMapped();
void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference> associations)
- throws PrincipalAssociationNotAllowedException, PrincipalAlreadyExistsException, PrincipalAssociationRequiredException, PrincipalNotFoundException, PrincipalAssociationUnsupportedException;
+ throws SecurityException;
- void updatePrincipal(JetspeedPrincipal principal) throws PrincipalUpdateException, PrincipalNotFoundException, PrincipalReadOnlyException;
+ void updatePrincipal(JetspeedPrincipal principal) throws SecurityException;
void removePrincipal(JetspeedPrincipal principal)
- throws PrincipalNotFoundException, PrincipalNotRemovableException, DependentPrincipalException;
+ throws SecurityException;
}
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java?rev=697824&r1=697823&r2=697824&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/BaseJetspeedPrincipalAssociationHandler.java Mon Sep 22 06:46:28 2008
@@ -21,10 +21,7 @@
import org.apache.jetspeed.security.JetspeedPrincipalAssociationHandler;
import org.apache.jetspeed.security.JetspeedPrincipalAssociationType;
import org.apache.jetspeed.security.JetspeedPrincipalManager;
-import org.apache.jetspeed.security.PrincipalAssociationNotAllowedException;
-import org.apache.jetspeed.security.PrincipalAssociationRequiredException;
-import org.apache.jetspeed.security.PrincipalAssociationUnsupportedException;
-import org.apache.jetspeed.security.PrincipalNotFoundException;
+import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.spi.JetspeedPrincipalAssociationStorageManager;
import org.apache.jetspeed.security.spi.JetspeedPrincipalManagerSPI;
import org.apache.jetspeed.security.spi.SynchronizationStateAccess;
@@ -74,8 +71,7 @@
return to;
}
- public void add(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalNotFoundException,
- PrincipalAssociationNotAllowedException, PrincipalAssociationUnsupportedException
+ public void add(JetspeedPrincipal from, JetspeedPrincipal to) throws SecurityException
{
if (from.getType().equals(associationType.getFromPrincipalType()) && to.getType().equals(associationType.getToPrincipalType()))
{
@@ -83,7 +79,7 @@
}
}
- public void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalAssociationRequiredException, PrincipalNotFoundException
+ public void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws SecurityException
{
if (from.getType().equals(associationType.getFromPrincipalType()) && to.getType().equals(associationType.getToPrincipalType()))
{
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java?rev=697824&r1=697823&r2=697824&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java Mon Sep 22 06:46:28 2008
@@ -27,10 +27,6 @@
import org.apache.jetspeed.security.JetspeedPrincipalAssociationReference;
import org.apache.jetspeed.security.JetspeedPrincipalType;
import org.apache.jetspeed.security.PasswordCredential;
-import org.apache.jetspeed.security.PrincipalAlreadyExistsException;
-import org.apache.jetspeed.security.PrincipalNotFoundException;
-import org.apache.jetspeed.security.PrincipalNotRemovableException;
-import org.apache.jetspeed.security.PrincipalUpdateException;
import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.impl.PersistentJetspeedPrincipal;
@@ -250,11 +246,11 @@
// JetspeedPrincipalStorageManager interface implementation
//
public void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference> associations)
- throws PrincipalAlreadyExistsException
+ throws SecurityException
{
if (principalExists(principal))
{
- throw new PrincipalAlreadyExistsException();
+ throw new SecurityException(SecurityException.PRINCIPAL_ALREADY_EXISTS.createScoped(principal.getName()));
}
try
{
@@ -276,12 +272,12 @@
return false;
}
- public void removePrincipal(JetspeedPrincipal principal) throws PrincipalNotFoundException,
- PrincipalNotRemovableException
+ public void removePrincipal(JetspeedPrincipal principal) throws SecurityException
+
{
if (!principalExists(principal))
{
- throw new PrincipalNotFoundException();
+ throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(principal.getName()));
}
try
{
@@ -292,7 +288,7 @@
if (pbe instanceof DataIntegrityViolationException)
{
logger.error(pbe.getMessage(), pbe);
- throw new PrincipalNotRemovableException();
+ throw new SecurityException(SecurityException.PRINCIPAL_NOT_REMOVABLE.createScoped(principal.getName()));
}
KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
@@ -303,12 +299,12 @@
}
}
- public void updatePrincipal(JetspeedPrincipal principal) throws PrincipalUpdateException,
- PrincipalNotFoundException
+ public void updatePrincipal(JetspeedPrincipal principal) throws SecurityException
+
{
if (!principalExists(principal))
{
- throw new PrincipalNotFoundException();
+ throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(principal.getName()));
}
try
{
@@ -319,7 +315,7 @@
if (pbe instanceof DataIntegrityViolationException)
{
logger.error(pbe.getMessage(), pbe);
- throw new PrincipalUpdateException();
+ throw new SecurityException(SecurityException.PRINCIPAL_UPDATE_FAILURE.createScoped(principal.getName()));
}
KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
@@ -417,7 +413,7 @@
// JetspeedPrincipalAssociationStorageManager interface implementation
//
public void addAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
- throws PrincipalNotFoundException
+ throws SecurityException
{
Criteria criteria = new Criteria();
criteria.addEqualTo("fromPrincipalId", from.getId());
@@ -435,7 +431,7 @@
if (pbe instanceof DataIntegrityViolationException)
{
logger.error(pbe.getMessage(), pbe);
- throw new PrincipalNotFoundException();
+ throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(from.getType().getName(), from.getName()));
}
KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java?rev=697824&r1=697823&r2=697824&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalAssociationHandler.java Mon Sep 22 06:46:28 2008
@@ -26,9 +26,9 @@
JetspeedPrincipalManager getManagerFrom();
JetspeedPrincipalManager getManagerTo();
- void add(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalNotFoundException, PrincipalAssociationNotAllowedException, PrincipalAssociationUnsupportedException;
+ void add(JetspeedPrincipal from, JetspeedPrincipal to) throws SecurityException;
- void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws PrincipalAssociationRequiredException, PrincipalNotFoundException;
+ void remove(JetspeedPrincipal from, JetspeedPrincipal to) throws SecurityException;
/**
* <p>
@@ -39,7 +39,7 @@
* or do so during the subsequent removal of the principal itself
* </p>
*/
- void beforeRemoveFrom(JetspeedPrincipal from) throws PrincipalNotRemovableException, DependentPrincipalException;
+ void beforeRemoveFrom(JetspeedPrincipal from) throws SecurityException;
/**
* <p>
@@ -50,5 +50,5 @@
* or do so during the subsequent removal of the principal itself
* </p>
*/
- void beforeRemoveTo(JetspeedPrincipal to) throws PrincipalNotRemovableException, DependentPrincipalException;
+ void beforeRemoveTo(JetspeedPrincipal to) throws SecurityException;
}
Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java?rev=697824&r1=697823&r2=697824&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipalManager.java Mon Sep 22 06:46:28 2008
@@ -127,22 +127,22 @@
List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType to, String associationName);
void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference> associations)
- throws PrincipalAssociationNotAllowedException, PrincipalAlreadyExistsException, PrincipalAssociationRequiredException, PrincipalNotFoundException, PrincipalAssociationUnsupportedException;
+ throws SecurityException;
- void updatePrincipal(JetspeedPrincipal principal) throws PrincipalUpdateException, PrincipalNotFoundException, PrincipalReadOnlyException;
+ void updatePrincipal(JetspeedPrincipal principal) throws SecurityException;
void removePrincipal(JetspeedPrincipal principal)
- throws PrincipalNotFoundException, PrincipalNotRemovableException, DependentPrincipalException;
+ throws SecurityException;
void addAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
- throws PrincipalNotFoundException, PrincipalAssociationUnsupportedException, PrincipalAssociationNotAllowedException;
+ throws SecurityException;
void transferAssociationTo(JetspeedPrincipal from, JetspeedPrincipal to, JetspeedPrincipal target, String associationName)
- throws PrincipalNotFoundException, PrincipalAssociationUnsupportedException, PrincipalAssociationNotAllowedException;
+ throws SecurityException;
void transferAssociationFrom(JetspeedPrincipal from, JetspeedPrincipal to, JetspeedPrincipal target, String associationName)
- throws PrincipalNotFoundException, PrincipalAssociationUnsupportedException, PrincipalAssociationNotAllowedException;
-
+ throws SecurityException;
+
void removeAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
- throws PrincipalAssociationRequiredException, PrincipalNotFoundException;
+ throws SecurityException;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org