use of org.jboss.metadata.ejb.spec.SessionBeanMetaData in project wildfly by wildfly.
the class SessionSynchronizationMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription description) throws DeploymentUnitProcessingException {
final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX);
//if we implement SessionSynchronization we can ignore any DD information
if (SessionSynchronization.class.isAssignableFrom(componentClass)) {
final ClassReflectionIndex classIndex = reflectionIndex.getClassIndex(SessionSynchronization.class);
description.setAfterBegin(classIndex.getMethod(void.class, "afterBegin"));
description.setAfterCompletion(classIndex.getMethod(void.class, "afterCompletion", boolean.class));
description.setBeforeCompletion(classIndex.getMethod(void.class, "beforeCompletion"));
return;
}
SessionBeanMetaData data = description.getDescriptorData();
if (data instanceof SessionBean31MetaData) {
SessionBean31MetaData metaData = (SessionBean31MetaData) data;
if (metaData.getAfterBeginMethod() != null)
description.setAfterBegin(MethodResolutionUtils.resolveMethod(metaData.getAfterBeginMethod(), componentClass, reflectionIndex));
if (metaData.getAfterCompletionMethod() != null)
description.setAfterCompletion(MethodResolutionUtils.resolveMethod(metaData.getAfterCompletionMethod(), componentClass, reflectionIndex));
if (metaData.getBeforeCompletionMethod() != null)
description.setBeforeCompletion(MethodResolutionUtils.resolveMethod(metaData.getBeforeCompletionMethod(), componentClass, reflectionIndex));
}
}
use of org.jboss.metadata.ejb.spec.SessionBeanMetaData in project wildfly by wildfly.
the class StartupMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final SingletonComponentDescription description) throws DeploymentUnitProcessingException {
if (!description.isInitOnStartup()) {
SessionBeanMetaData data = description.getDescriptorData();
if (data instanceof SessionBean31MetaData) {
SessionBean31MetaData singletonBeanMetaData = (SessionBean31MetaData) data;
Boolean initOnStartup = singletonBeanMetaData.isInitOnStartup();
if (initOnStartup != null && initOnStartup) {
description.initOnStartup();
description.getModuleDescription().registerStartupBean();
}
}
}
// else skip. This is already marked as InitOnStartup by @Startup annotation.
}
use of org.jboss.metadata.ejb.spec.SessionBeanMetaData in project wildfly by wildfly.
the class StatefulTimeoutMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
final SessionBeanMetaData data = componentConfiguration.getDescriptorData();
if (data == null) {
return;
}
if (data instanceof SessionBean31MetaData) {
SessionBean31MetaData sessionBean31MetaData = (SessionBean31MetaData) data;
final StatefulTimeoutMetaData statefulTimeout = sessionBean31MetaData.getStatefulTimeout();
if (statefulTimeout != null) {
TimeUnit unit = TimeUnit.MINUTES;
if (statefulTimeout.getUnit() != null) {
unit = statefulTimeout.getUnit();
}
componentConfiguration.setStatefulTimeout(new StatefulTimeoutInfo(statefulTimeout.getTimeout(), unit));
}
}
}
use of org.jboss.metadata.ejb.spec.SessionBeanMetaData in project wildfly by wildfly.
the class ConcurrencyManagementMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final SessionBeanComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
if (componentConfiguration.getDescriptorData() == null) {
return;
}
SessionBeanMetaData data = componentConfiguration.getDescriptorData();
if (data instanceof SessionBean31MetaData) {
SessionBean31MetaData descriptor = (SessionBean31MetaData) data;
final ConcurrencyManagementType type = descriptor.getConcurrencyManagementType();
if (type != null) {
componentConfiguration.setConcurrencyManagementType(type);
}
}
}
use of org.jboss.metadata.ejb.spec.SessionBeanMetaData in project wildfly by wildfly.
the class InitMethodMergingProcessor method handleDeploymentDescriptor.
@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final StatefulComponentDescription description) throws DeploymentUnitProcessingException {
//first look for old school ejbCreate methods
//we are only looking on the bean class, not sure if that is correct or not
Class<?> clazz = componentClass;
while (clazz != Object.class && clazz != null) {
final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(clazz);
for (Method method : (Iterable<Method>) index.getMethods()) {
if (method.getName().startsWith("ejbCreate")) {
//it will be overridden below
if (!description.getInitMethods().containsKey(method)) {
description.addInitMethod(method, null);
}
}
}
clazz = clazz.getSuperclass();
}
SessionBeanMetaData data = description.getDescriptorData();
if (data instanceof SessionBean31MetaData) {
SessionBean31MetaData metaData = (SessionBean31MetaData) data;
final InitMethodsMetaData inits = metaData.getInitMethods();
if (inits != null) {
for (InitMethodMetaData method : inits) {
Method beanMethod = MethodResolutionUtils.resolveMethod(method.getBeanMethod(), componentClass, deploymentReflectionIndex);
if (method.getCreateMethod() != null) {
description.addInitMethod(beanMethod, method.getCreateMethod().getMethodName());
} else {
description.addInitMethod(beanMethod, null);
}
}
}
}
}
Aggregations