private void handleExcludeMethods(final EJBComponentDescription componentDescription, final ExcludeListMetaData excludeList) { for (final MethodMetaData method : excludeList.getMethods()) { final String methodName = method.getMethodName(); final MethodIntf defaultMethodIntf = (componentDescription instanceof MessageDrivenComponentDescription) ? MethodIntf.MESSAGE_ENDPOINT : MethodIntf.BEAN; final MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf(), defaultMethodIntf); if (methodName.equals("*")) { componentDescription.getDescriptorMethodPermissions().setAttribute(methodIntf, null, EJBMethodSecurityAttribute.denyAll()); } else { final MethodParametersMetaData methodParams = method.getMethodParams(); // update the session bean description with the tx attribute info if (methodParams == null) { componentDescription.getDescriptorMethodPermissions().setAttribute(methodIntf, EJBMethodSecurityAttribute.denyAll(), methodName); } else { componentDescription.getDescriptorMethodPermissions().setAttribute(methodIntf, EJBMethodSecurityAttribute.denyAll(), null, methodName, this.getMethodParams(methodParams)); } } } }
public static Method resolveMethod(final MethodMetaData methodData, final Class<?> componentClass, final DeploymentReflectionIndex reflectionIndex) throws DeploymentUnitProcessingException { return resolveMethod(methodData.getMethodName(), methodData.getMethodParams(), componentClass, reflectionIndex); }
if (mmd.getMethodParams() != null) params = mmd.getMethodParams().toArray(params); else params = null; String methodName = mmd.getMethodName(); if (methodName != null && methodName.equals("*")) methodName = null; MethodInterfaceType miType = mmd.getMethodIntf(); String iface = miType != null ? miType.name() : null; EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(), methodName, iface, params); if (perm.getUnchecked() != null) if (mmd.getMethodParams() != null) params = mmd.getMethodParams().toArray(params); else params = null; String methodName = mmd.getMethodName(); if (methodName != null && methodName.equals("*")) methodName = null; MethodInterfaceType miType = mmd.getMethodIntf(); String iface = miType != null ? miType.name() : null; EJBMethodPermission p = new EJBMethodPermission(mmd.getEjbName(), methodName, iface, params); pc.addToExcludedPolicy(p);
/** * Whether this matches * * @param methodName the method name * @param params the parameters * @param interfaceType the interface type * @param bestMatch the previous best match * @return best match */ public MethodMetaData bestMatch(String methodName, String[] params, MethodInterfaceType interfaceType, MethodMetaData bestMatch) { if (isEmpty()) return bestMatch; for (MethodMetaData method : this) { if (method.matches(methodName, params, interfaceType)) { // No previous best match if (bestMatch == null) bestMatch = method; // better match because the previous was a wildcard else if ("*".equals(bestMatch.getMethodName())) bestMatch = method; // better because it specifies parameters else if (method.getMethodParams() != null) bestMatch = method; } } return bestMatch; }
if (existingMethod.getMethodName().equals(mmd.getMethodName()) && existingMethod.getMethodParams().equals(mmd.getMethodParams())) perm.setRoles(roles); Descriptions descriptions = ProcessorUtils.getDescription("@RolesAllowed for: "+type); mmd.setDescriptions(descriptions); methods.add(mmd); metaData.add(perm);
if (method.getEjbName().equals(ejbName)) + method.getMethodName() + "(" + method.getMethodParams() + ") of EJB " + method.getEjbName() + ": " + Arrays.asList(annotation.value())); addAnnotations(RolesAllowed.class, annotation, container, method);
public static MethodMetaData createMethod(String ejbName, Method method) { MethodMetaData methodMetaData = new MethodMetaData(); methodMetaData.setEjbName(ejbName); if(method == null) methodMetaData.setMethodName("*"); else { methodMetaData.setMethodName(method.getName()); MethodParametersMetaData methodParameters = ProcessorUtils.getMethodParameters(method); if(methodParameters != null) methodMetaData.setMethodParams(methodParameters); } return methodMetaData; }
/** * Whether the parameters were given * * @return true when the parameters were given */ public boolean isParamGiven() { return methodDelegate.getMethodParams() != null; }
MethodMetaData method = new MethodMetaData(); method.setEjbName(container.getEjbName()); method.setMethodName("ejbCreate"); addAnnotations(annotationClass, annotation, container, method); method.setMethodName("ejbActivate"); addAnnotations(annotationClass, annotation, container, method); method.setMethodName("ejbPassivate"); addAnnotations(annotationClass, annotation, container, method); method.setMethodName("ejbRemove"); addAnnotations(annotationClass, annotation, container, method); method.setMethodName("setSessionContext");
/** * Get the method name * * @return the method name */ public String getMethodName() { return methodDelegate.getMethodName(); }
/** * Get the ejb name * * @return the ejb name */ public String getEjbName() { return methodDelegate.getEjbName(); }
private void addDependencies(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws Exception { Set<String> depends = enterpriseBean.getDepends(); if (depends != null && depends.size() > 0) { DependsImpl annotation = new DependsImpl(); Iterator<String> dependencies = enterpriseBean.getDepends() .iterator(); while (dependencies.hasNext()) { annotation.addDependency(dependencies.next()); } addClassAnnotation(container, Depends.class, annotation); } if (enterpriseBean.getIgnoreDependency() != null) { for(ResourceInjectionTargetMetaData ignore : enterpriseBean.getIgnoreDependency().getInjectionTargets()) { IgnoreDependencyImpl annotation = new IgnoreDependencyImpl(); MethodMetaData method = new MethodMetaData(); method.setMethodName(ignore.getInjectionTargetName()); addAnnotations(IgnoreDependency.class, annotation, container, method); } } }
/** * Whether the interface was given * * @return true when the interface was specified */ public boolean isIntfGiven() { return methodDelegate.getMethodIntf() != null; }
/** * Whether this is a local home method * * @return true when a local home method */ public boolean isLocalHomeMethod() { return methodDelegate.isLocalHomeMethod(); }
/** * Whether this is a home method * * @return true when a home method */ public boolean isHomeMethod() { return methodDelegate.isHomeMethod(); }
public static Method resolveMethod(final MethodMetaData methodData, final Class<?> componentClass, final DeploymentReflectionIndex reflectionIndex) throws DeploymentUnitProcessingException { return resolveMethod(methodData.getMethodName(), methodData.getMethodParams(), componentClass, reflectionIndex); }
/** * Whether this matches * * @param methodName the method name * @param params the parameters * @param interfaceType the interface type * @param bestMatch the previous best match * @return best match */ public MethodMetaData bestMatch(String methodName, String[] params, MethodInterfaceType interfaceType, MethodMetaData bestMatch) { if (isEmpty()) return bestMatch; for (MethodMetaData method : this) { if (method.matches(methodName, params, interfaceType)) { // No previous best match if (bestMatch == null) bestMatch = method; // better match because the previous was a wildcard else if ("*".equals(bestMatch.getMethodName())) bestMatch = method; // better because it specifies parameters else if (method.getMethodParams() != null) bestMatch = method; } } return bestMatch; }
public static MethodMetaData createMethod(String ejbName, Method method) { MethodMetaData methodMetaData = new MethodMetaData(); methodMetaData.setEjbName(ejbName); if(method == null) methodMetaData.setMethodName("*"); else { methodMetaData.setMethodName(method.getName()); MethodParametersMetaData methodParameters = ProcessorUtils.getMethodParameters(method); if(methodParameters != null) methodMetaData.setMethodParams(methodParameters); } return methodMetaData; }
/** * Whether the parameters were given * * @return true when the parameters were given */ public boolean isParamGiven() { return methodDelegate.getMethodParams() != null; }
/** * Get the method name * * @return the method name */ public String getMethodName() { return methodDelegate.getMethodName(); }