private EJBBusinessMethod getEJBBusinessMethod(final MethodIdentifier method) { final ClassLoader classLoader = this.getComponentClass().getClassLoader(); final String methodName = method.getName(); final String[] types = method.getParameterTypes(); if (types == null || types.length == 0) { return new EJBBusinessMethod(methodName); } Class<?>[] paramTypes = new Class<?>[types.length]; int i = 0; for (String type : types) { try { paramTypes[i++] = PrimitiveClassLoaderUtil.loadClass(type, classLoader); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } return new EJBBusinessMethod(methodName, paramTypes); }
@Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final StatefulComponentDescription statefulComponentDescription = (StatefulComponentDescription) componentConfiguration.getComponentDescription(); final Collection<StatefulRemoveMethod> removeMethods = statefulComponentDescription.getRemoveMethods(); if (removeMethods.isEmpty()) { return; } for (final Method viewMethod : configuration.getProxyFactory().getCachedMethods()) { final MethodIdentifier viewMethodIdentifier = MethodIdentifier.getIdentifierForMethod(viewMethod); for (final StatefulRemoveMethod removeMethod : removeMethods) { if (removeMethod.methodIdentifier.equals(viewMethodIdentifier)) { //we do not want to add this if it is the Ejb(Local)Object.remove() method, as that is handed elsewhere final boolean object = EJBObject.class.isAssignableFrom(configuration.getViewClass()) || EJBLocalObject.class.isAssignableFrom(configuration.getViewClass()); if (!object || !viewMethodIdentifier.getName().equals("remove") || viewMethodIdentifier.getParameterTypes().length != 0) { configuration.addViewInterceptor(viewMethod, new ImmediateInterceptorFactory(new StatefulRemoveInterceptor(removeMethod.retainIfException)), InterceptorOrder.View.SESSION_REMOVE_INTERCEPTOR); } break; } } } } });
final EJBMethodPermission permission = new EJBMethodPermission(description.getEJBName(), methodIdentifier.getName(), interfaceType.name(), methodIdentifier.getParameterTypes());
/** * Get a method declared on this object. * * @param methodIdentifier the method identifier * @return the method, or {@code null} if no method of that description exists */ public Method getMethod(MethodIdentifier methodIdentifier) { final Map<ParamNameList, Map<String, Method>> nameMap = methodsByTypeName.get(methodIdentifier.getName()); if (nameMap == null) { return null; } final Map<String, Method> paramsMap = nameMap.get(createParamNameList(methodIdentifier.getParameterTypes())); if (paramsMap == null) { return null; } return paramsMap.get(methodIdentifier.getReturnType()); }
/** * Get a method declared on this object. * * @param methodIdentifier the method identifier * @return the method, or {@code null} if no method of that description exists */ public Method getMethod(MethodIdentifier methodIdentifier) { final Map<ParamNameList, Map<String, Method>> nameMap = methodsByTypeName.get(methodIdentifier.getName()); if (nameMap == null) { return null; } final Map<String, Method> paramsMap = nameMap.get(createParamNameList(methodIdentifier.getParameterTypes())); if (paramsMap == null) { return null; } return paramsMap.get(methodIdentifier.getReturnType()); }
/** * Get a method declared on this object. * * @param methodIdentifier the method identifier * @return the method, or {@code null} if no method of that description exists */ public Method getMethod(MethodIdentifier methodIdentifier) { final Map<ParamNameList, Map<String, Method>> nameMap = methodsByTypeName.get(methodIdentifier.getName()); if (nameMap == null) { return null; } final Map<String, Method> paramsMap = nameMap.get(createParamNameList(methodIdentifier.getParameterTypes())); if (paramsMap == null) { return null; } return paramsMap.get(methodIdentifier.getReturnType()); }
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()) { final MethodIdentifier method = MethodIdentifier.getIdentifierForMethod(entry.getKey()); componentConfiguration.getTransactionAttributes().setAttribute(methodIntf, entry.getValue().get(0), entry.getKey().getDeclaringClass().getName(), method.getName(), method.getParameterTypes()); } } }
/** * Get a method declared on this object. * * @param methodIdentifier the method identifier * @return the method, or {@code null} if no method of that description exists */ public Method getMethod(MethodIdentifier methodIdentifier) { final Map<ParamNameList, Map<String, Method>> nameMap = methodsByTypeName.get(methodIdentifier.getName()); if (nameMap == null) { return null; } final Map<String, Method> paramsMap = nameMap.get(createParamNameList(methodIdentifier.getParameterTypes())); if (paramsMap == null) { return null; } return paramsMap.get(methodIdentifier.getReturnType()); }
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 MethodIdentifier method = MethodIdentifier.getIdentifierForMethod(entry.getKey()); final String className = entry.getKey().getDeclaringClass().getName(); componentConfiguration.getTransactionTimeouts().setAttribute(methodIntf, entry.getValue().get(0), className, method.getName(), method.getParameterTypes()); } } }
private EJBBusinessMethod getEJBBusinessMethod(final MethodIdentifier method) { final ClassLoader classLoader = this.getComponentClass().getClassLoader(); final String methodName = method.getName(); final String[] types = method.getParameterTypes(); if (types == null || types.length == 0) { return new EJBBusinessMethod(methodName); } Class<?>[] paramTypes = new Class<?>[types.length]; int i = 0; for (String type : types) { try { paramTypes[i++] = PrimitiveClassLoaderUtil.loadClass(type, classLoader); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } return new EJBBusinessMethod(methodName, paramTypes); }
@Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final StatefulComponentDescription statefulComponentDescription = (StatefulComponentDescription) componentConfiguration.getComponentDescription(); final Collection<StatefulRemoveMethod> removeMethods = statefulComponentDescription.getRemoveMethods(); if (removeMethods.isEmpty()) { return; } for (final Method viewMethod : configuration.getProxyFactory().getCachedMethods()) { final MethodIdentifier viewMethodIdentifier = MethodIdentifier.getIdentifierForMethod(viewMethod); for (final StatefulRemoveMethod removeMethod : removeMethods) { if (removeMethod.methodIdentifier.equals(viewMethodIdentifier)) { //we do not want to add this if it is the Ejb(Local)Object.remove() method, as that is handed elsewhere final boolean object = EJBObject.class.isAssignableFrom(configuration.getViewClass()) || EJBLocalObject.class.isAssignableFrom(configuration.getViewClass()); if (!object || !viewMethodIdentifier.getName().equals("remove") || viewMethodIdentifier.getParameterTypes().length != 0) { configuration.addViewInterceptor(viewMethod, new ImmediateInterceptorFactory(new StatefulRemoveInterceptor(removeMethod.retainIfException)), InterceptorOrder.View.SESSION_REMOVE_INTERCEPTOR); } break; } } } } });
final EJBMethodPermission permission = new EJBMethodPermission(description.getEJBName(), methodIdentifier.getName(), interfaceType.name(), methodIdentifier.getParameterTypes());