1 22 package org.jboss.deployment; 23 24 import org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer; 25 import org.jboss.deployers.spi.deployer.DeploymentUnit; 26 import org.jboss.logging.Logger; 27 28 import javax.security.jacc.PolicyConfiguration ; 29 import javax.security.jacc.PolicyConfigurationFactory ; 30 import javax.security.jacc.PolicyContextException ; 31 import java.util.Set ; 32 33 40 public class JaccCommitDeployer extends AbstractSimpleDeployer 41 { 42 private static final Logger log = Logger.getLogger(JaccCommitDeployer.class); 43 44 public void deploy(DeploymentUnit unit) throws org.jboss.deployers.spi.DeploymentException 45 { 46 PolicyConfiguration pc = unit.getDeploymentContext().getTransientAttachments().getAttachment("javax.security.jacc.PolicyConfiguration", PolicyConfiguration .class); 47 if (pc == null) return; 48 49 PolicyConfiguration parentPc = unit.getDeploymentContext().getParent().getDeploymentUnit().getAttachment("javax.security.jacc.PolicyConfiguration", PolicyConfiguration .class); 50 try 51 { 52 if (parentPc != null && pc != parentPc) 53 { 54 parentPc.linkConfiguration(pc); 55 } 56 pc.commit(); 57 } 58 catch (PolicyContextException e) 59 { 60 throw new RuntimeException ("Failed to commit PolicyConfiguration for unit: " + unit.getName(), e); 61 } 62 } 63 64 } 65 | Popular Tags |