public PolicyContext build(EjbJarInfo ejbJar, HashMap<String, DeploymentInfo> deployments) throws OpenEJBException {
PolicyContext policyContext = new PolicyContext(ejbJar.moduleId);
for (EnterpriseBeanInfo enterpriseBean : ejbJar.enterpriseBeans) {
CoreDeploymentInfo deployment = (CoreDeploymentInfo) deployments.get(enterpriseBean.ejbDeploymentId);
Permissions permissions = new Permissions();
String ejbName = enterpriseBean.ejbName;
for (InterfaceType type : InterfaceType.values()) {
if (type == InterfaceType.UNKNOWN) continue;
for (Class interfce : deployment.getInterfaces(type)) {
addPossibleEjbMethodPermissions(permissions, ejbName, type.getSpecName(), interfce);
}
}
addDeclaredEjbPermissions(ejbJar, enterpriseBean, null, permissions, policyContext);