Package org.jboss.security.acl
Class JPAPersistenceStrategy
- java.lang.Object
-
- org.jboss.security.acl.JPAPersistenceStrategy
-
- All Implemented Interfaces:
ACLPersistenceStrategy
public class JPAPersistenceStrategy extends Object implements ACLPersistenceStrategy
Implementation of
ACLPersistenceStrategythat uses the Java Persistence API (JPA) to persist theACLs.- Author:
- Stefan Guilhen
-
-
Constructor Summary
Constructors Constructor Description JPAPersistenceStrategy()JPAPersistenceStrategy(ACLResourceFactory resourceFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ACLcreateACL(Resource resource)Creates a newACLand associates it to the given resource.ACLcreateACL(Resource resource, Collection<ACLEntry> entries)Creates a newACLwith the specified entries and associates it to the given resource.ACLgetACL(Resource resource)Obtains a reference to theACLassociated to the given resource.Collection<ACL>getACLs()Obtains allACLs that are managed by thisACLPersistenceStrategy.booleanremoveACL(ACL acl)Removes the givenACL, breaking the existing association with the resource it relates to.booleanremoveACL(Resource resource)Removes theACLassociated with the specified resource.booleanupdateACL(ACL acl)Updates the givenACL.
-
-
-
Constructor Detail
-
JPAPersistenceStrategy
public JPAPersistenceStrategy()
-
JPAPersistenceStrategy
public JPAPersistenceStrategy(ACLResourceFactory resourceFactory)
-
-
Method Detail
-
createACL
public ACL createACL(Resource resource)
Description copied from interface:ACLPersistenceStrategyCreates a new
ACLand associates it to the given resource.- Specified by:
createACLin interfaceACLPersistenceStrategy- Parameters:
resource- theResourcefor which an ACL is to be created.- Returns:
- a reference to the created
ACL.
-
createACL
public ACL createACL(Resource resource, Collection<ACLEntry> entries)
Description copied from interface:ACLPersistenceStrategyCreates a new
ACLwith the specified entries and associates it to the given resource.- Specified by:
createACLin interfaceACLPersistenceStrategy- Parameters:
resource- theResourcefor which an ACL is to be created.entries- aCollectioncontaining the entries that must be added to theACL.- Returns:
- a reference to the created
ACL.
-
removeACL
public boolean removeACL(ACL acl)
Description copied from interface:ACLPersistenceStrategyRemoves the given
ACL, breaking the existing association with the resource it relates to.- Specified by:
removeACLin interfaceACLPersistenceStrategy- Parameters:
acl- a reference to theACLthat is to be removed.- Returns:
trueif the ACL was removed;falseotherwise.
-
removeACL
public boolean removeACL(Resource resource)
Description copied from interface:ACLPersistenceStrategyRemoves the
ACLassociated with the specified resource.- Specified by:
removeACLin interfaceACLPersistenceStrategy- Parameters:
resource- theResourcewhose associated ACL is to be removed.- Returns:
trueif the ACL was removed;falseotherwise.
-
getACL
public ACL getACL(Resource resource)
Description copied from interface:ACLPersistenceStrategyObtains a reference to the
ACLassociated to the given resource.- Specified by:
getACLin interfaceACLPersistenceStrategy- Parameters:
resource- theResourcefor which the associated ACL is wanted.- Returns:
- a reference to the
ACLassociated with the resource, or null if no ACL could be found.
-
getACLs
public Collection<ACL> getACLs()
Description copied from interface:ACLPersistenceStrategyObtains all
ACLs that are managed by thisACLPersistenceStrategy.- Specified by:
getACLsin interfaceACLPersistenceStrategy- Returns:
- a
Collectioncontaining allACLs retrieved by this strategy.
-
updateACL
public boolean updateACL(ACL acl)
Description copied from interface:ACLPersistenceStrategyUpdates the given
ACL. This usually means updating the repository where the ACLs are stored.- Specified by:
updateACLin interfaceACLPersistenceStrategy- Parameters:
acl- theACLthat needs to be updated.- Returns:
trueif the ACL was updated;falseotherwise.
-
-