I have a mutableacl service as follows:-

private MutableAclService mutableAclService;

public void setMutableAclService(MutableAclService mutableAclService) {
this.mutableAclService = mutableAclService;
}
And i have added the ObjectIdentity into it.

ObjectIdentity oid =new ObjectIdentityImpl(Message.class, message.getId());
MutableAcl acl = mutableAclService.createAcl(oid);

And set permission as follows:-

acl.insertAce(0, BasePermission.ADMINISTRATION,new PrincipalSid(request.getRemoteUser()), true);
acl.insertAce(1, BasePermission.DELETE,new GrantedAuthoritySid("ROLE_ADMIN"), true);
acl.insertAce(2, BasePermission.READ,new GrantedAuthoritySid("ROLE_USER"), true);

I need to know how to make the roles(ie "ROLE_ADMIN","ROLE_USER") dynamic from database.