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
ACLPersistenceStrategy
that uses the Java Persistence API (JPA) to persist theACL
s.- 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 ACL
createACL(Resource resource)
Creates a newACL
and associates it to the given resource.ACL
createACL(Resource resource, Collection<ACLEntry> entries)
Creates a newACL
with the specified entries and associates it to the given resource.ACL
getACL(Resource resource)
Obtains a reference to theACL
associated to the given resource.Collection<ACL>
getACLs()
Obtains allACL
s that are managed by thisACLPersistenceStrategy
.boolean
removeACL(ACL acl)
Removes the givenACL
, breaking the existing association with the resource it relates to.boolean
removeACL(Resource resource)
Removes theACL
associated with the specified resource.boolean
updateACL(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:ACLPersistenceStrategy
Creates a new
ACL
and associates it to the given resource.- Specified by:
createACL
in interfaceACLPersistenceStrategy
- Parameters:
resource
- theResource
for 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:ACLPersistenceStrategy
Creates a new
ACL
with the specified entries and associates it to the given resource.- Specified by:
createACL
in interfaceACLPersistenceStrategy
- Parameters:
resource
- theResource
for which an ACL is to be created.entries
- aCollection
containing 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:ACLPersistenceStrategy
Removes the given
ACL
, breaking the existing association with the resource it relates to.- Specified by:
removeACL
in interfaceACLPersistenceStrategy
- Parameters:
acl
- a reference to theACL
that is to be removed.- Returns:
true
if the ACL was removed;false
otherwise.
-
removeACL
public boolean removeACL(Resource resource)
Description copied from interface:ACLPersistenceStrategy
Removes the
ACL
associated with the specified resource.- Specified by:
removeACL
in interfaceACLPersistenceStrategy
- Parameters:
resource
- theResource
whose associated ACL is to be removed.- Returns:
true
if the ACL was removed;false
otherwise.
-
getACL
public ACL getACL(Resource resource)
Description copied from interface:ACLPersistenceStrategy
Obtains a reference to the
ACL
associated to the given resource.- Specified by:
getACL
in interfaceACLPersistenceStrategy
- Parameters:
resource
- theResource
for which the associated ACL is wanted.- Returns:
- a reference to the
ACL
associated with the resource, or null if no ACL could be found.
-
getACLs
public Collection<ACL> getACLs()
Description copied from interface:ACLPersistenceStrategy
Obtains all
ACL
s that are managed by thisACLPersistenceStrategy
.- Specified by:
getACLs
in interfaceACLPersistenceStrategy
- Returns:
- a
Collection
containing allACL
s retrieved by this strategy.
-
updateACL
public boolean updateACL(ACL acl)
Description copied from interface:ACLPersistenceStrategy
Updates the given
ACL
. This usually means updating the repository where the ACLs are stored.- Specified by:
updateACL
in interfaceACLPersistenceStrategy
- Parameters:
acl
- theACL
that needs to be updated.- Returns:
true
if the ACL was updated;false
otherwise.
-
-