1 10 11 package org.nanocontainer.script.groovy.buildernodes; 12 13 import java.util.Map ; 14 import java.security.Permission ; 15 16 import org.nanocontainer.ClassPathElement; 17 import org.nanocontainer.script.NanoContainerMarkupException; 18 19 23 public class GrantNode extends AbstractBuilderNode { 24 25 public static final String NODE_NAME = "grant"; 26 27 public GrantNode() { 28 super(NODE_NAME); 29 } 30 31 32 33 public Object createNewNode(Object current, Map attributes) { 34 35 Permission perm = (Permission ) attributes.remove("class"); 36 37 if (!(current instanceof ClassPathElement)) { 38 throw new NanoContainerMarkupException("Don't know how to create a 'grant' child of a '" + current.getClass() + "' parent"); 39 } 40 41 ClassPathElement cpe = (ClassPathElement) current; 42 43 return cpe.grantPermission(perm); 44 } 45 46 } 47 | Popular Tags |