/* */
/* */ private static void addPermissions(EJBContainer container, PolicyConfiguration pc)
/* */ {
/* 169 */ SecurityDomain sd = (SecurityDomain)container.resolveAnnotation(SecurityDomain.class);
/* */
/* 171 */ PermitAll beanUnchecked = (PermitAll)container.resolveAnnotation(PermitAll.class);
/* 172 */ RolesAllowed beanPermissions = (RolesAllowed)container.resolveAnnotation(RolesAllowed.class);
/* */
/* 174 */ DeclareRoles beanDeclareRolesPerms = (DeclareRoles)container.resolveAnnotation(DeclareRoles.class);
/* */
/* 176 */ if ((beanUnchecked != null) && (beanPermissions != null))
/* */ {
/* 178 */ throw new RuntimeException("Cannot annotate a bean with both @Unchecked and @MethodPermissions");
/* */ }
/* */
/* 181 */ String ejbName = container.getEjbName();
/* */
/* 184 */ if (beanDeclareRolesPerms != null)
/* */ {
/* 186 */ String[] rolerefs = beanDeclareRolesPerms.value();
/* 187 */ int len = rolerefs != null ? rolerefs.length : 0;
/* 188 */ for (int i = 0; i < len; i++)
/* */ {
/* */ try
/* */ {
/* 192 */ pc.addToRole(rolerefs[i], new EJBRoleRefPermission(ejbName, rolerefs[i]));
/* */ }
/* */ catch (PolicyContextException e)
/* */ {
/* 196 */ throw new RuntimeException(e);
/* */ }
/* */
/* */ }
/* */
/* */ }
/* */
/* 203 */ for (Method m : container.getBeanClass().getMethods())
/* */ {
/* 205 */ EJBMethodPermission permission = new EJBMethodPermission(ejbName, null, m);
/* 206 */ log.trace("Creating permission: " + permission);
/* */
/* 208 */ PermitAll unchecked = (PermitAll)container.resolveAnnotation(m, PermitAll.class);
/* 209 */ RolesAllowed permissions = (RolesAllowed)container.resolveAnnotation(m, RolesAllowed.class);
/* 210 */ DenyAll exclude = (DenyAll)container.resolveAnnotation(m, DenyAll.class);
/* */
/* 212 */ int annotationCount = getAnnotationCount(unchecked, permissions, exclude);
/* */