Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * JBoss, Home of Professional Open Source.
   * Copyright 2008, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors. 
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site:
 import java.util.List;
 import java.util.Map;
 import java.util.Set;

The ACLConfiguration class contains all ACL definitions that have been specified in an XML file according to the jboss-acl-configuration schema. Each definition is used to construct an ACL instance that will protect the specified resource according to the permissions that are assigned to each identity.

Stefan Guilhen
 public class ACLConfiguration

the set of ACL definitions keyed by their resource identifier.
    private final Map<StringACLDefinitiondefinitions = new HashMap<StringACLDefinition>();


Adds a parsed ACLDefinition object to the map of definitions.

definition the ACLDefinition instance to be added.
    public void addDefinition(Object definition)
       if (definition instanceof ACLDefinition)
          ACLDefinition aclDefinition = (ACLDefinitiondefinition;
          this..put(aclDefinition.getResource(), aclDefinition);


Creates and returns the ACL objects that correspond to the acl-definitions specified in the XML configuration file.

a Collection<ACL> containing the generated ACLs.
    public Collection<ACLgetConfiguredACLs()
       Collection<ACLconfiguredACLs = new HashSet<ACL>();
       for (ACLDefinition definition : this..values())
          Set<ACLEntryentries = this.getEntries(definitionnew ArrayList<String>());
          ACLImpl acl = new ACLImpl(definition.getResource(), entries);
       return configuredACLs;


This method retrieves the set of ACLEntry objects that belong to an ACL, recursively getting the entries from the parent definitions when the extension configuration is used. An extending ACLDefinition "inherits" the entries from its parent and is free to add or override entries as needed.

definition the ACLDefinition that contains the data used to retrieve the entries.
visitedACLs a List of the visited ACLs to detect circular dependencies.
a Set<ACLEntry> containing the entries that will be used to create an ACL according to the specified definition.
java.lang.RuntimeException if a circular dependency is detected among the ACLDefinition objects.
   private Set<ACLEntrygetEntries(ACLDefinition definitionList<StringvisitedACLs)
      if (visitedACLs.contains(definition.getResource()))
         throw new RuntimeException("Circular dependency between ACLs has been detected");
      if (definition.getBaseResource() != null)
         ACLDefinition superDefinition = this..get(definition.getBaseResource());
         if (superDefinition != null)
            Set<ACLEntrysuperEntries = this.getEntries(superDefinitionvisitedACLs);
            Set<ACLEntryentries = definition.getEntries();
            return entries;
            throw new RuntimeException("Parent ACL not found: " + definition.getBaseResource());
         return definition.getEntries();
New to GrepCode? Check out our FAQ X