use of org.jboss.invocation.proxy.MethodIdentifier in project wildfly by wildfly.
the class PassivationAnnotationParsingProcessor method processPassivation.
private void processPassivation(final EEModuleDescription eeModuleDescription, final AnnotationTarget target, final DotName annotationType) throws DeploymentUnitProcessingException {
if (!(target instanceof MethodInfo)) {
throw EeLogger.ROOT_LOGGER.methodOnlyAnnotation(annotationType);
}
final MethodInfo methodInfo = MethodInfo.class.cast(target);
final ClassInfo classInfo = methodInfo.declaringClass();
final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
final Type[] args = methodInfo.args();
if (args.length > 1) {
ROOT_LOGGER.warn(EeLogger.ROOT_LOGGER.invalidNumberOfArguments(methodInfo.name(), annotationType, classInfo.name()));
return;
} else if (args.length == 1 && !args[0].name().toString().equals(InvocationContext.class.getName())) {
ROOT_LOGGER.warn(EeLogger.ROOT_LOGGER.invalidSignature(methodInfo.name(), annotationType, classInfo.name(), "void methodName(InvocationContext ctx)"));
return;
}
final MethodIdentifier methodIdentifier;
if (args.length == 0) {
methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodInfo.name());
} else {
methodIdentifier = MethodIdentifier.getIdentifier(Void.TYPE, methodInfo.name(), InvocationContext.class);
}
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder(classDescription.getInterceptorClassDescription());
if (annotationType == POST_ACTIVATE) {
builder.setPostActivate(methodIdentifier);
} else {
builder.setPrePassivate(methodIdentifier);
}
classDescription.setInterceptorClassDescription(builder.build());
}
use of org.jboss.invocation.proxy.MethodIdentifier in project wildfly by wildfly.
the class ContainerInterceptorBindingsDDProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EjbJarMetaData metaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (metaData == null || metaData.getAssemblyDescriptor() == null) {
return;
}
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
final DeploymentReflectionIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
// fetch the container-interceptors
final List<ContainerInterceptorsMetaData> containerInterceptorConfigurations = metaData.getAssemblyDescriptor().getAny(ContainerInterceptorsMetaData.class);
if (containerInterceptorConfigurations == null || containerInterceptorConfigurations.isEmpty()) {
return;
}
final ContainerInterceptorsMetaData containerInterceptorsMetaData = containerInterceptorConfigurations.get(0);
if (containerInterceptorsMetaData == null) {
return;
}
final InterceptorBindingsMetaData containerInterceptorBindings = containerInterceptorsMetaData.getInterceptorBindings();
// no interceptor-binding == nothing to do
if (containerInterceptorBindings == null || containerInterceptorBindings.isEmpty()) {
return;
}
// we have now found some container interceptors which are bound to certain Jakarta Enterprise Beans, start the real work!
final Map<String, List<InterceptorBindingMetaData>> bindingsPerEJB = new HashMap<String, List<InterceptorBindingMetaData>>();
final List<InterceptorBindingMetaData> bindingsForAllEJBs = new ArrayList<InterceptorBindingMetaData>();
for (final InterceptorBindingMetaData containerInterceptorBinding : containerInterceptorBindings) {
if (containerInterceptorBinding.getEjbName().equals("*")) {
// since all Jakarta Enterprise Beans having the same method is not really practical
if (containerInterceptorBinding.getMethod() != null) {
throw EjbLogger.ROOT_LOGGER.defaultInterceptorsNotBindToMethod();
}
if (containerInterceptorBinding.getInterceptorOrder() != null) {
throw EjbLogger.ROOT_LOGGER.defaultInterceptorsNotSpecifyOrder();
}
// Make a note that this container interceptor binding is applicable for all Jakarta Enterprise Beans
bindingsForAllEJBs.add(containerInterceptorBinding);
} else {
// fetch existing container interceptor bindings for the Jakarta Enterprise Beans, if any.
List<InterceptorBindingMetaData> bindings = bindingsPerEJB.get(containerInterceptorBinding.getEjbName());
if (bindings == null) {
bindings = new ArrayList<InterceptorBindingMetaData>();
bindingsPerEJB.put(containerInterceptorBinding.getEjbName(), bindings);
}
// Make a note that the container interceptor binding is applicable for this specific Jakarta Enterprise Beans
bindings.add(containerInterceptorBinding);
}
}
// At this point we now know which container interceptor bindings have been configured for which Jakarta Enterprise Beans.
// Next, we create InterceptorDescription(s) out of those.
final List<InterceptorDescription> interceptorDescriptionsForAllEJBs = new ArrayList<InterceptorDescription>();
// first process container interceptors applicable for all Jakarta Enterprise Beans
for (InterceptorBindingMetaData binding : bindingsForAllEJBs) {
if (binding.getInterceptorClasses() != null) {
for (final String clazz : binding.getInterceptorClasses()) {
interceptorDescriptionsForAllEJBs.add(new InterceptorDescription(clazz));
}
}
}
// Now process container interceptors for each Jakarta Enterprise Beans
for (final ComponentDescription componentDescription : eeModuleDescription.getComponentDescriptions()) {
if (!(componentDescription instanceof EJBComponentDescription)) {
continue;
}
final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentDescription;
final Class<?> componentClass;
try {
componentClass = module.getClassLoader().loadClass(ejbComponentDescription.getComponentClassName());
} catch (ClassNotFoundException e) {
throw EjbLogger.ROOT_LOGGER.failToLoadComponentClass(e, ejbComponentDescription.getComponentClassName());
}
final List<InterceptorBindingMetaData> bindingsApplicableForCurrentEJB = bindingsPerEJB.get(ejbComponentDescription.getComponentName());
final Map<Method, List<InterceptorBindingMetaData>> methodInterceptors = new HashMap<Method, List<InterceptorBindingMetaData>>();
final List<InterceptorBindingMetaData> classLevelBindings = new ArrayList<InterceptorBindingMetaData>();
// we only want to exclude default and class level interceptors if every binding
// has the exclude element.
boolean classLevelExcludeDefaultInterceptors = false;
Map<Method, Boolean> methodLevelExcludeDefaultInterceptors = new HashMap<Method, Boolean>();
Map<Method, Boolean> methodLevelExcludeClassInterceptors = new HashMap<Method, Boolean>();
// if an absolute order has been defined at any level then absolute ordering takes precedence
boolean classLevelAbsoluteOrder = false;
final Map<Method, Boolean> methodLevelAbsoluteOrder = new HashMap<Method, Boolean>();
if (bindingsApplicableForCurrentEJB != null) {
for (final InterceptorBindingMetaData binding : bindingsApplicableForCurrentEJB) {
if (binding.getMethod() == null) {
// The container interceptor is expected to be fired for all methods of that Jakarta Enterprise Beans
classLevelBindings.add(binding);
// if even one binding does not say exclude default then we do not exclude
if (binding.isExcludeDefaultInterceptors()) {
classLevelExcludeDefaultInterceptors = true;
}
if (binding.isTotalOrdering()) {
if (classLevelAbsoluteOrder) {
throw EjbLogger.ROOT_LOGGER.twoEjbBindingsSpecifyAbsoluteOrder(componentClass.toString());
} else {
classLevelAbsoluteOrder = true;
}
}
} else {
// Method level bindings
// First find the right method
final NamedMethodMetaData methodData = binding.getMethod();
final ClassReflectionIndex classIndex = index.getClassIndex(componentClass);
Method resolvedMethod = null;
if (methodData.getMethodParams() == null) {
final Collection<Method> methods = classIndex.getAllMethods(methodData.getMethodName());
if (methods.isEmpty()) {
throw EjbLogger.ROOT_LOGGER.failToFindMethodInEjbJarXml(componentClass.getName(), methodData.getMethodName());
} else if (methods.size() > 1) {
throw EjbLogger.ROOT_LOGGER.multipleMethodReferencedInEjbJarXml(methodData.getMethodName(), componentClass.getName());
}
resolvedMethod = methods.iterator().next();
} else {
final Collection<Method> methods = classIndex.getAllMethods(methodData.getMethodName(), methodData.getMethodParams().size());
for (final Method method : methods) {
boolean match = true;
for (int i = 0; i < method.getParameterCount(); ++i) {
if (!method.getParameterTypes()[i].getName().equals(methodData.getMethodParams().get(i))) {
match = false;
break;
}
}
if (match) {
resolvedMethod = method;
break;
}
}
if (resolvedMethod == null) {
throw EjbLogger.ROOT_LOGGER.failToFindMethodWithParameterTypes(componentClass.getName(), methodData.getMethodName(), methodData.getMethodParams());
}
}
List<InterceptorBindingMetaData> methodSpecificInterceptorBindings = methodInterceptors.get(resolvedMethod);
if (methodSpecificInterceptorBindings == null) {
methodSpecificInterceptorBindings = new ArrayList<InterceptorBindingMetaData>();
methodInterceptors.put(resolvedMethod, methodSpecificInterceptorBindings);
}
methodSpecificInterceptorBindings.add(binding);
if (binding.isExcludeDefaultInterceptors()) {
methodLevelExcludeDefaultInterceptors.put(resolvedMethod, true);
}
if (binding.isExcludeClassInterceptors()) {
methodLevelExcludeClassInterceptors.put(resolvedMethod, true);
}
if (binding.isTotalOrdering()) {
if (methodLevelAbsoluteOrder.containsKey(resolvedMethod)) {
throw EjbLogger.ROOT_LOGGER.twoEjbBindingsSpecifyAbsoluteOrder(resolvedMethod.toString());
} else {
methodLevelAbsoluteOrder.put(resolvedMethod, true);
}
}
}
}
}
// Now we have all the bindings in a format we can use
// Build the list of default interceptors
ejbComponentDescription.setDefaultContainerInterceptors(interceptorDescriptionsForAllEJBs);
if (classLevelExcludeDefaultInterceptors) {
ejbComponentDescription.setExcludeDefaultContainerInterceptors(true);
}
final List<InterceptorDescription> classLevelInterceptors = new ArrayList<InterceptorDescription>();
if (classLevelAbsoluteOrder) {
// We have an absolute ordering for the class level interceptors
for (final InterceptorBindingMetaData binding : classLevelBindings) {
// specify an ordering
if (binding.isTotalOrdering()) {
for (final String interceptor : binding.getInterceptorOrder()) {
classLevelInterceptors.add(new InterceptorDescription(interceptor));
}
break;
}
}
// We have merged the default interceptors into the class interceptors
ejbComponentDescription.setExcludeDefaultContainerInterceptors(true);
} else {
for (InterceptorBindingMetaData binding : classLevelBindings) {
if (binding.getInterceptorClasses() != null) {
for (final String interceptor : binding.getInterceptorClasses()) {
classLevelInterceptors.add(new InterceptorDescription(interceptor));
}
}
}
}
// We now know about the class level container interceptors for this Jakarta Enterprise Beans
ejbComponentDescription.setClassLevelContainerInterceptors(classLevelInterceptors);
// Now process method level container interceptors for the Jakarta Enterprise Beans
for (Map.Entry<Method, List<InterceptorBindingMetaData>> entry : methodInterceptors.entrySet()) {
final Method method = entry.getKey();
final List<InterceptorBindingMetaData> methodBindings = entry.getValue();
boolean totalOrder = methodLevelAbsoluteOrder.containsKey(method);
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method);
Boolean excludeDefaultInterceptors = methodLevelExcludeDefaultInterceptors.get(method);
excludeDefaultInterceptors = excludeDefaultInterceptors == null ? Boolean.FALSE : excludeDefaultInterceptors;
if (!excludeDefaultInterceptors) {
excludeDefaultInterceptors = ejbComponentDescription.isExcludeDefaultContainerInterceptors() || ejbComponentDescription.isExcludeDefaultContainerInterceptors(methodIdentifier);
}
Boolean excludeClassInterceptors = methodLevelExcludeClassInterceptors.get(method);
excludeClassInterceptors = excludeClassInterceptors == null ? Boolean.FALSE : excludeClassInterceptors;
if (!excludeClassInterceptors) {
excludeClassInterceptors = ejbComponentDescription.isExcludeClassLevelContainerInterceptors(methodIdentifier);
}
final List<InterceptorDescription> methodLevelInterceptors = new ArrayList<InterceptorDescription>();
if (totalOrder) {
// If there is a total order we just use it
for (final InterceptorBindingMetaData binding : methodBindings) {
if (binding.isTotalOrdering()) {
for (final String interceptor : binding.getInterceptorOrder()) {
methodLevelInterceptors.add(new InterceptorDescription(interceptor));
}
}
}
} else {
// the method specific interceptors
if (!excludeDefaultInterceptors) {
methodLevelInterceptors.addAll(interceptorDescriptionsForAllEJBs);
}
if (!excludeClassInterceptors) {
for (InterceptorDescription interceptor : classLevelInterceptors) {
methodLevelInterceptors.add(interceptor);
}
}
for (final InterceptorBindingMetaData binding : methodBindings) {
if (binding.getInterceptorClasses() != null) {
for (final String interceptor : binding.getInterceptorClasses()) {
methodLevelInterceptors.add(new InterceptorDescription(interceptor));
}
}
}
}
// We have already taken component and default interceptors into account
ejbComponentDescription.excludeClassLevelContainerInterceptors(methodIdentifier);
ejbComponentDescription.excludeDefaultContainerInterceptors(methodIdentifier);
ejbComponentDescription.setMethodContainerInterceptors(methodIdentifier, methodLevelInterceptors);
}
}
}
use of org.jboss.invocation.proxy.MethodIdentifier in project wildfly by wildfly.
the class DeploymentDescriptorMethodProcessor method handleSessionBean.
private void handleSessionBean(final EJBComponentDescription component, final Module module, final DeploymentReflectionIndex reflectionIndex) throws ClassNotFoundException, DeploymentUnitProcessingException {
if (component.getDescriptorData() == null) {
return;
}
final Class<?> componentClass = ClassLoadingUtils.loadClass(component.getComponentClassName(), module);
final EnterpriseBeanMetaData metaData = component.getDescriptorData();
AroundInvokesMetaData aroundInvokes = null;
if (metaData instanceof SessionBeanMetaData) {
aroundInvokes = ((SessionBeanMetaData) metaData).getAroundInvokes();
} else if (metaData instanceof MessageDrivenBeanMetaData) {
aroundInvokes = ((MessageDrivenBeanMetaData) metaData).getAroundInvokes();
}
if (aroundInvokes != null) {
for (AroundInvokeMetaData aroundInvoke : aroundInvokes) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = aroundInvoke.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Object.class, methodName, InvocationContext.class);
builder.setAroundInvoke(methodIdentifier);
if (aroundInvoke.getClassName() == null || aroundInvoke.getClassName().isEmpty()) {
final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName();
component.addInterceptorMethodOverride(className, builder.build());
} else {
component.addInterceptorMethodOverride(aroundInvoke.getClassName(), builder.build());
}
}
}
// post-construct(s) of the interceptor configured (if any) in the deployment descriptor
LifecycleCallbacksMetaData postConstructs = metaData.getPostConstructs();
if (postConstructs != null) {
for (LifecycleCallbackMetaData postConstruct : postConstructs) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = postConstruct.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
builder.setPostConstruct(methodIdentifier);
if (postConstruct.getClassName() == null || postConstruct.getClassName().isEmpty()) {
final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName();
component.addInterceptorMethodOverride(className, builder.build());
} else {
component.addInterceptorMethodOverride(postConstruct.getClassName(), builder.build());
}
}
}
// pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
final LifecycleCallbacksMetaData preDestroys = metaData.getPreDestroys();
if (preDestroys != null) {
for (final LifecycleCallbackMetaData preDestroy : preDestroys) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
final String methodName = preDestroy.getMethodName();
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
builder.setPreDestroy(methodIdentifier);
if (preDestroy.getClassName() == null || preDestroy.getClassName().isEmpty()) {
final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName();
component.addInterceptorMethodOverride(className, builder.build());
} else {
component.addInterceptorMethodOverride(preDestroy.getClassName(), builder.build());
}
}
}
if (component.isStateful()) {
final SessionBeanMetaData sessionBeanMetadata = (SessionBeanMetaData) metaData;
// pre-passivate(s) of the interceptor configured (if any) in the deployment descriptor
final LifecycleCallbacksMetaData prePassivates = sessionBeanMetadata.getPrePassivates();
if (prePassivates != null) {
for (final LifecycleCallbackMetaData prePassivate : prePassivates) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
final String methodName = prePassivate.getMethodName();
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
builder.setPrePassivate(methodIdentifier);
if (prePassivate.getClassName() == null || prePassivate.getClassName().isEmpty()) {
final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName();
component.addInterceptorMethodOverride(className, builder.build());
} else {
component.addInterceptorMethodOverride(prePassivate.getClassName(), builder.build());
}
}
}
final LifecycleCallbacksMetaData postActivates = sessionBeanMetadata.getPostActivates();
if (postActivates != null) {
for (final LifecycleCallbackMetaData postActivate : postActivates) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
final String methodName = postActivate.getMethodName();
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName);
builder.setPostActivate(methodIdentifier);
if (postActivate.getClassName() == null || postActivate.getClassName().isEmpty()) {
final String className = ClassReflectionIndexUtil.findRequiredMethod(reflectionIndex, componentClass, methodIdentifier).getDeclaringClass().getName();
component.addInterceptorMethodOverride(className, builder.build());
} else {
component.addInterceptorMethodOverride(postActivate.getClassName(), builder.build());
}
}
}
}
}
use of org.jboss.invocation.proxy.MethodIdentifier in project wildfly by wildfly.
the class InterceptorClassDeploymentDescriptorProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EjbJarMetaData metaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
if (metaData == null) {
return;
}
if (metaData.getInterceptors() == null) {
return;
}
for (InterceptorMetaData interceptor : metaData.getInterceptors()) {
String interceptorClassName = interceptor.getInterceptorClass();
AroundInvokesMetaData aroundInvokes = interceptor.getAroundInvokes();
if (aroundInvokes != null) {
for (AroundInvokeMetaData aroundInvoke : aroundInvokes) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = aroundInvoke.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Object.class, methodName, InvocationContext.class);
builder.setAroundInvoke(methodIdentifier);
if (aroundInvoke.getClassName() == null || aroundInvoke.getClassName().isEmpty()) {
eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
} else {
eeModuleDescription.addInterceptorMethodOverride(aroundInvoke.getClassName(), builder.build());
}
}
}
AroundTimeoutsMetaData aroundTimeouts = interceptor.getAroundTimeouts();
if (aroundTimeouts != null) {
for (AroundTimeoutMetaData aroundTimeout : aroundTimeouts) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = aroundTimeout.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(Object.class, methodName, InvocationContext.class);
builder.setAroundTimeout(methodIdentifier);
if (aroundTimeout.getClassName() == null || aroundTimeout.getClassName().isEmpty()) {
eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
} else {
eeModuleDescription.addInterceptorMethodOverride(aroundTimeout.getClassName(), builder.build());
}
}
}
// post-construct(s) of the interceptor configured (if any) in the deployment descriptor
LifecycleCallbacksMetaData postConstructs = interceptor.getPostConstructs();
if (postConstructs != null) {
for (LifecycleCallbackMetaData postConstruct : postConstructs) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = postConstruct.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
builder.setPostConstruct(methodIdentifier);
if (postConstruct.getClassName() == null || postConstruct.getClassName().isEmpty()) {
eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
} else {
eeModuleDescription.addInterceptorMethodOverride(postConstruct.getClassName(), builder.build());
}
}
}
// pre-destroy(s) of the interceptor configured (if any) in the deployment descriptor
LifecycleCallbacksMetaData preDestroys = interceptor.getPreDestroys();
if (preDestroys != null) {
for (LifecycleCallbackMetaData preDestroy : preDestroys) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = preDestroy.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
builder.setPreDestroy(methodIdentifier);
if (preDestroy.getClassName() == null || preDestroy.getClassName().isEmpty()) {
eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
} else {
eeModuleDescription.addInterceptorMethodOverride(preDestroy.getClassName(), builder.build());
}
}
}
// pre-passivates(s) of the interceptor configured (if any) in the deployment descriptor
LifecycleCallbacksMetaData prePassivates = interceptor.getPrePassivates();
if (prePassivates != null) {
for (LifecycleCallbackMetaData prePassivate : prePassivates) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = prePassivate.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
builder.setPrePassivate(methodIdentifier);
if (prePassivate.getClassName() == null || prePassivate.getClassName().isEmpty()) {
eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
} else {
eeModuleDescription.addInterceptorMethodOverride(prePassivate.getClassName(), builder.build());
}
}
}
// pre-passivates(s) of the interceptor configured (if any) in the deployment descriptor
LifecycleCallbacksMetaData postActivates = interceptor.getPostActivates();
if (postActivates != null) {
for (LifecycleCallbackMetaData postActivate : postActivates) {
final InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder();
String methodName = postActivate.getMethodName();
MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(void.class, methodName, InvocationContext.class);
builder.setPostActivate(methodIdentifier);
if (postActivate.getClassName() == null || postActivate.getClassName().isEmpty()) {
eeModuleDescription.addInterceptorMethodOverride(interceptorClassName, builder.build());
} else {
eeModuleDescription.addInterceptorMethodOverride(postActivate.getClassName(), builder.build());
}
}
}
if (interceptor.getJndiEnvironmentRefsGroup() != null) {
final DeploymentDescriptorEnvironment environment = new DeploymentDescriptorEnvironment("java:comp/env", interceptor.getJndiEnvironmentRefsGroup());
eeModuleDescription.addInterceptorEnvironment(interceptor.getInterceptorClass(), new InterceptorEnvironment(environment));
}
}
}
use of org.jboss.invocation.proxy.MethodIdentifier in project wildfly by wildfly.
the class EJBMethodIdentifier method fromMethodInfo.
public static EJBMethodIdentifier fromMethodInfo(final MethodInfo methodInfo) {
final String returnType = methodInfo.returnType().name().toString();
final String[] argTypes = new String[methodInfo.args().length];
int i = 0;
for (Type argType : methodInfo.args()) {
argTypes[i++] = argType.name().toString();
}
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifier(returnType, methodInfo.name(), argTypes);
return new EJBMethodIdentifier(methodIdentifier, methodInfo.declaringClass().name().toString());
}
Aggregations