assert method != null : "method is null"; Method classMethod = resolveRealMethod(method); String[] methodParams = MethodInfoHelper.getCanonicalParameterTypes(classMethod); final String methodName = classMethod.getName(); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) return attr; attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) return attr; attr = get(perViewStyle1, methodIntf); if (attr != null) return attr; attr = get(get(get(style3, className), methodName), methodParamsKey); if (attr != null) return attr; attr = get(style2, methodName); if (attr != null) return attr; attr = get(style1, className); if (attr != null) return attr; return defaultAttribute; } else { return getAttribute(defaultMethodIntf, method);
private void processTransactionTimeoutAnnotation(final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, MethodIntf methodIntf, final EJBComponentDescription componentConfiguration) { final RuntimeAnnotationInformation<Integer> data = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, TransactionTimeout.class); for (Map.Entry<String, List<Integer>> entry : data.getClassAnnotations().entrySet()) { if (!entry.getValue().isEmpty()) { //we can't specify both methodIntf and class name final String className = methodIntf == null ? entry.getKey() : null; componentConfiguration.getTransactionTimeouts().setAttribute(methodIntf, className, entry.getValue().get(0)); } } for (Map.Entry<Method, List<Integer>> entry : data.getMethodAnnotations().entrySet()) { if (!entry.getValue().isEmpty()) { final String className = entry.getKey().getDeclaringClass().getName(); String[] parameterTypes = MethodInfoHelper.getCanonicalParameterTypes(entry.getKey()); componentConfiguration.getTransactionTimeouts().setAttribute(methodIntf, entry.getValue().get(0), className, entry.getKey().getName(), parameterTypes); } } }
assert method != null : "method is null"; Method classMethod = resolveRealMethod(method); String[] methodParams = MethodInfoHelper.getCanonicalParameterTypes(classMethod); final String methodName = classMethod.getName(); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) return true; attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) return true; attr = get(perViewStyle1, methodIntf); if (attr != null) return false; attr = get(get(get(style3, className), methodName), methodParamsKey); if (attr != null) return true; attr = get(style2, methodName); if (attr != null) return true; attr = get(style1, className); if (attr != null) return false; return false; } else { return isMethodLevel(defaultMethodIntf, method, null);
public T getViewAttribute(MethodIntf methodIntf, final Method method) { assert methodIntf != null : "methodIntf is null"; Method classMethod = resolveRealMethod(method); String[] methodParams = MethodInfoHelper.getCanonicalParameterTypes(classMethod); final String methodName = classMethod.getName(); ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) return attr; attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) return attr; attr = get(perViewStyle1, methodIntf); if (attr != null) return attr; return null; }
final MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf(), defaultMethodIntf); if (methodName.equals("*")) { final EJBMethodSecurityAttribute existingRoles = componentDescription.getDescriptorMethodPermissions().getAttributeStyle1(methodIntf, null); ejbMethodSecurityMetaData = mergeExistingRoles(ejbMethodSecurityMetaData, existingRoles); componentDescription.getDescriptorMethodPermissions().setAttribute(methodIntf, null, ejbMethodSecurityMetaData); } else { final EJBMethodSecurityAttribute existingRoles = componentDescription.getDescriptorMethodPermissions().getAttributeStyle2(methodIntf, methodName); ejbMethodSecurityMetaData = mergeExistingRoles(ejbMethodSecurityMetaData, existingRoles); componentDescription.getDescriptorMethodPermissions().setAttribute(methodIntf, ejbMethodSecurityMetaData, methodName); } else { final EJBMethodSecurityAttribute existingRoles = componentDescription.getDescriptorMethodPermissions().getAttributeStyle3(methodIntf, null, methodName, this.getMethodParams(methodParams)); ejbMethodSecurityMetaData = mergeExistingRoles(ejbMethodSecurityMetaData, existingRoles); componentDescription.getDescriptorMethodPermissions().setAttribute(methodIntf, ejbMethodSecurityMetaData, null, methodName, this.getMethodParams(methodParams));
private boolean handlePermissions(String contextID, ComponentConfiguration componentConfiguration, ViewConfiguration viewConfiguration, DeploymentReflectionIndex deploymentReflectionIndex, String viewClassName, EJBViewDescription ejbViewDescription, Method viewMethod, ApplicableMethodInformation<EJBMethodSecurityAttribute> permissions, boolean annotations, final EJBViewMethodSecurityAttributesService.Builder viewMethodSecurityAttributesServiceBuilder, EJBComponentDescription componentDescription) { EJBMethodSecurityAttribute ejbMethodSecurityMetaData = permissions.getViewAttribute(ejbViewDescription.getMethodIntf(), viewMethod); final List<EJBMethodSecurityAttribute> allAttributes = new ArrayList<EJBMethodSecurityAttribute>(); allAttributes.addAll(permissions.getAllAttributes(ejbViewDescription.getMethodIntf(), viewMethod)); ejbMethodSecurityMetaData = permissions.getViewAttribute(MethodIntf.BEAN, viewMethod); allAttributes.addAll(permissions.getAllAttributes(MethodIntf.BEAN, viewMethod)); ejbMethodSecurityMetaData = permissions.getAttribute(ejbViewDescription.getMethodIntf(), classMethod); if (ejbMethodSecurityMetaData == null) { ejbMethodSecurityMetaData = permissions.getAttribute(MethodIntf.BEAN, classMethod); allAttributes.addAll(permissions.getAllAttributes(ejbViewDescription.getMethodIntf(), classMethod)); allAttributes.addAll(permissions.getAllAttributes(MethodIntf.BEAN, classMethod));
EJBMethodSecurityAttribute ejbMethodSecurityMetaData = permissions.getViewAttribute(ejbViewConfiguration.getMethodIntf(), viewMethod); ejbMethodSecurityMetaData = permissions.getViewAttribute(MethodIntf.BEAN, viewMethod); methodIdentifier = MethodIdentifier.getIdentifierForMethod(classMethod); ejbMethodSecurityMetaData = permissions.getAttribute(ejbViewConfiguration.getMethodIntf(), classMethod); if (ejbMethodSecurityMetaData == null) { ejbMethodSecurityMetaData = permissions.getAttribute(MethodIntf.BEAN, classMethod);
protected void processTxAttr(final EJBComponentDescription ejbComponentDescription, final MethodIntf methodIntf, final Method method) { if (this.getTransactionManagementType().equals(TransactionManagementType.BEAN)) { // it's a BMT bean return; } MethodIntf defaultMethodIntf = (ejbComponentDescription instanceof MessageDrivenComponentDescription) ? MethodIntf.MESSAGE_ENDPOINT : MethodIntf.BEAN; TransactionAttributeType txAttr = ejbComponentDescription.getTransactionAttributes().getAttribute(methodIntf, method, defaultMethodIntf); MethodTransactionAttributeKey key = new MethodTransactionAttributeKey(methodIntf, MethodIdentifier.getIdentifierForMethod(method)); if(txAttr != null) { txAttrs.put(key, txAttr); txExplicitAttrs.put(key, ejbComponentDescription.getTransactionAttributes().isMethodLevel(methodIntf, method, defaultMethodIntf)); } Integer txTimeout = ejbComponentDescription.getTransactionTimeouts().getAttribute(methodIntf, method, defaultMethodIntf); if (txTimeout != null) { txTimeouts.put(key, txTimeout); } }
public T getViewAttribute(MethodIntf methodIntf, String methodName, String... methodParams) { assert methodIntf != null : "methodIntf is null"; assert methodName != null : "methodName is null"; assert methodParams != null : "methodParams is null"; ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) return attr; attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) return attr; attr = get(perViewStyle1, methodIntf); if (attr != null) return attr; return null; }
public T getAttribute(MethodIntf methodIntf, Method method) { return getAttribute(methodIntf, method, null); }
this.transactionAttributes = new ApplicableMethodInformation<TransactionAttributeType>(componentName, TransactionAttributeType.REQUIRED); this.transactionTimeouts = new ApplicableMethodInformation<Integer>(componentName, null); this.descriptorMethodPermissions = new ApplicableMethodInformation<EJBMethodSecurityAttribute>(componentName, null); this.annotationMethodPermissions = new ApplicableMethodInformation<EJBMethodSecurityAttribute>(componentName, null);
final MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf()); if (methodName.equals("*")) { componentConfiguration.getDescriptorMethodPermissions().setAttribute(methodIntf, null, EJBMethodSecurityAttribute.denyAll()); } else { componentConfiguration.getDescriptorMethodPermissions().setAttribute(methodIntf, EJBMethodSecurityAttribute.denyAll(), methodName); } else { componentConfiguration.getDescriptorMethodPermissions().setAttribute(methodIntf, EJBMethodSecurityAttribute.denyAll(), null, methodName, this.getMethodParams(methodParams)); final MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf()); if (methodName.equals("*")) { final EJBMethodSecurityAttribute existingRoles = componentConfiguration.getDescriptorMethodPermissions().getAttributeStyle1(methodIntf, null); ejbMethodSecurityMetaData = mergeExistingRoles(ejbMethodSecurityMetaData, existingRoles); componentConfiguration.getDescriptorMethodPermissions().setAttribute(methodIntf, null, ejbMethodSecurityMetaData); } else { final EJBMethodSecurityAttribute existingRoles = componentConfiguration.getDescriptorMethodPermissions().getAttributeStyle2(methodIntf, methodName); ejbMethodSecurityMetaData = mergeExistingRoles(ejbMethodSecurityMetaData, existingRoles); componentConfiguration.getDescriptorMethodPermissions().setAttribute(methodIntf, ejbMethodSecurityMetaData, methodName); } else { final EJBMethodSecurityAttribute existingRoles = componentConfiguration.getDescriptorMethodPermissions().getAttributeStyle3(methodIntf, null, methodName, this.getMethodParams(methodParams)); ejbMethodSecurityMetaData = mergeExistingRoles(ejbMethodSecurityMetaData, existingRoles); componentConfiguration.getDescriptorMethodPermissions().setAttribute(methodIntf, ejbMethodSecurityMetaData, null, methodName, this.getMethodParams(methodParams));
private boolean handlePermissions(String contextID, ComponentConfiguration componentConfiguration, ViewConfiguration viewConfiguration, DeploymentReflectionIndex deploymentReflectionIndex, String viewClassName, EJBViewDescription ejbViewDescription, Method viewMethod, ApplicableMethodInformation<EJBMethodSecurityAttribute> permissions, boolean annotations) { EJBMethodSecurityAttribute ejbMethodSecurityMetaData = permissions.getViewAttribute(ejbViewDescription.getMethodIntf(), viewMethod.getName(), MethodIdentifier.getIdentifierForMethod(viewMethod).getParameterTypes()); final List<EJBMethodSecurityAttribute> allAttributes = new ArrayList<EJBMethodSecurityAttribute>(); allAttributes.addAll(permissions.getAllAttributes(ejbViewDescription.getMethodIntf(), viewMethod.getDeclaringClass().getName(), viewMethod.getName(), MethodIdentifier.getIdentifierForMethod(viewMethod).getParameterTypes())); ejbMethodSecurityMetaData = permissions.getViewAttribute(MethodIntf.BEAN, viewMethod.getName(), MethodIdentifier.getIdentifierForMethod(viewMethod).getParameterTypes()); allAttributes.addAll(permissions.getAllAttributes(MethodIntf.BEAN, viewMethod.getDeclaringClass().getName(), viewMethod.getName(), MethodIdentifier.getIdentifierForMethod(viewMethod).getParameterTypes())); ejbMethodSecurityMetaData = permissions.getAttribute(ejbViewDescription.getMethodIntf(), classMethod.getDeclaringClass().getName(), classMethod.getName(), MethodIdentifier.getIdentifierForMethod(classMethod).getParameterTypes()); if (ejbMethodSecurityMetaData == null) { ejbMethodSecurityMetaData = permissions.getAttribute(MethodIntf.BEAN, classMethod.getDeclaringClass().getName(), classMethod.getName(), MethodIdentifier.getIdentifierForMethod(classMethod).getParameterTypes()); allAttributes.addAll(permissions.getAllAttributes(ejbViewDescription.getMethodIntf(), classMethod.getDeclaringClass().getName(), classMethod.getName(), MethodIdentifier.getIdentifierForMethod(classMethod).getParameterTypes())); allAttributes.addAll(permissions.getAllAttributes(MethodIntf.BEAN, classMethod.getDeclaringClass().getName(), classMethod.getName(), MethodIdentifier.getIdentifierForMethod(classMethod).getParameterTypes()));
EJBMethodSecurityAttribute ejbMethodSecurityMetaData = permissions.getViewAttribute(ejbViewConfiguration.getMethodIntf(), viewMethod.getName(), methodIdentifier.getParameterTypes()); ejbMethodSecurityMetaData = permissions.getViewAttribute(MethodIntf.BEAN, viewMethod.getName(), methodIdentifier.getParameterTypes()); methodIdentifier = methodIdentifier.getIdentifierForMethod(classMethod); ejbMethodSecurityMetaData = permissions.getAttribute(ejbViewConfiguration.getMethodIntf(), classMethod.getDeclaringClass().getName(), classMethod.getName(), methodIdentifier.getParameterTypes()); if (ejbMethodSecurityMetaData == null) { ejbMethodSecurityMetaData = permissions.getAttribute(MethodIntf.BEAN, classMethod.getDeclaringClass().getName(), classMethod.getName(), methodIdentifier.getParameterTypes());
public List<T> getAllAttributes(MethodIntf methodIntf, Method method) { assert methodIntf != null : "methodIntf is null"; Method classMethod = resolveRealMethod(method); String[] methodParams = MethodInfoHelper.getCanonicalParameterTypes(classMethod); final String methodName = classMethod.getName(); final String className = classMethod.getDeclaringClass().getName(); final List<T> ret = new ArrayList<T>(); ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) ret.add(attr); attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) ret.add(attr); attr = get(perViewStyle1, methodIntf); if (attr != null) ret.add(attr); attr = get(get(get(style3, className), methodName), methodParamsKey); if (attr != null) ret.add(attr); attr = get(style2, methodName); if (attr != null) ret.add(attr); attr = get(style1, className); if (attr != null) ret.add(attr); return ret; }
public T getAttribute(MethodIntf methodIntf, String className, String methodName, String... methodParams) { assert methodIntf != null : "methodIntf is null"; assert methodName != null : "methodName is null"; assert methodParams != null : "methodParams is null"; ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) return attr; attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) return attr; attr = get(perViewStyle1, methodIntf); if (attr != null) return attr; attr = get(get(get(style3, className), methodName), methodParamsKey); if (attr != null) return attr; attr = get(style2, methodName); if (attr != null) return attr; attr = get(style1, className); if (attr != null) return attr; return defaultAttribute; }
protected void processTxAttr(final EJBComponentDescription ejbComponentDescription, final MethodIntf methodIntf, final Method method) { if (this.getTransactionManagementType().equals(TransactionManagementType.BEAN)) { // it's a BMT bean return; } String className = method.getDeclaringClass().getName(); String methodName = method.getName(); TransactionAttributeType txAttr = ejbComponentDescription.getTransactionAttributes().getAttribute(methodIntf, className, methodName, toString(method.getParameterTypes())); if (txAttr != TransactionAttributeType.REQUIRED) { txAttrs.put(new MethodTransactionAttributeKey(methodIntf, MethodIdentifier.getIdentifierForMethod(method)), txAttr); } Integer txTimeout = ejbComponentDescription.getTransactionTimeouts().getAttribute(methodIntf, className, methodName, toString(method.getParameterTypes())); if (txTimeout != null) { txTimeouts.put(new MethodTransactionAttributeKey(methodIntf, MethodIdentifier.getIdentifierForMethod(method)), txTimeout); } }
this.transactionAttributes = new ApplicableMethodInformation<TransactionAttributeType>(componentName, TransactionAttributeType.REQUIRED); this.transactionTimeouts = new ApplicableMethodInformation<Integer>(componentName, null); this.descriptorMethodPermissions = new ApplicableMethodInformation<EJBMethodSecurityAttribute>(componentName, null); this.annotationMethodPermissions = new ApplicableMethodInformation<EJBMethodSecurityAttribute>(componentName, null);
private void processTransactionAttributeAnnotation(final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, MethodIntf methodIntf, final EJBComponentDescription componentConfiguration) { final RuntimeAnnotationInformation<TransactionAttributeType> data = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, TransactionAttribute.class); for (Map.Entry<String, List<TransactionAttributeType>> entry : data.getClassAnnotations().entrySet()) { if (!entry.getValue().isEmpty()) { //we can't specify both methodIntf and class name final String className = methodIntf == null ? entry.getKey() : null; componentConfiguration.getTransactionAttributes().setAttribute(methodIntf, className, entry.getValue().get(0)); } } for (Map.Entry<Method, List<TransactionAttributeType>> entry : data.getMethodAnnotations().entrySet()) { if (!entry.getValue().isEmpty()) { String[] parameterTypes = MethodInfoHelper.getCanonicalParameterTypes(entry.getKey()); componentConfiguration.getTransactionAttributes().setAttribute(methodIntf, entry.getValue().get(0), entry.getKey().getDeclaringClass().getName(), entry.getKey().getName(), parameterTypes); } } }
public List<T> getAllAttributes(MethodIntf methodIntf, String className, String methodName, String... methodParams) { assert methodIntf != null : "methodIntf is null"; assert methodName != null : "methodName is null"; assert methodParams != null : "methodParams is null"; final List<T> ret = new ArrayList<T>(); ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams); T attr = get(get(get(perViewStyle3, methodIntf), methodName), methodParamsKey); if (attr != null) ret.add(attr); attr = get(get(perViewStyle2, methodIntf), methodName); if (attr != null) ret.add(attr); attr = get(perViewStyle1, methodIntf); if (attr != null) ret.add(attr); attr = get(get(get(style3, className), methodName), methodParamsKey); if (attr != null) ret.add(attr); attr = get(style2, methodName); if (attr != null) ret.add(attr); attr = get(style1, className); if (attr != null) ret.add(attr); return ret; }