Search in sources :

Example 1 with SessionBeanMetaData

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));
    }
}
Also used : SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) ClassReflectionIndex(org.jboss.as.server.deployment.reflect.ClassReflectionIndex) DeploymentReflectionIndex(org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Example 2 with SessionBeanMetaData

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.
}
Also used : SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Example 3 with SessionBeanMetaData

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));
        }
    }
}
Also used : SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) StatefulTimeoutInfo(org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo) TimeUnit(java.util.concurrent.TimeUnit) StatefulTimeoutMetaData(org.jboss.metadata.ejb.spec.StatefulTimeoutMetaData) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Example 4 with SessionBeanMetaData

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);
        }
    }
}
Also used : ConcurrencyManagementType(javax.ejb.ConcurrencyManagementType) SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Example 5 with SessionBeanMetaData

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);
                }
            }
        }
    }
}
Also used : InitMethodMetaData(org.jboss.metadata.ejb.spec.InitMethodMetaData) InitMethodsMetaData(org.jboss.metadata.ejb.spec.InitMethodsMetaData) SessionBeanMetaData(org.jboss.metadata.ejb.spec.SessionBeanMetaData) ClassReflectionIndex(org.jboss.as.server.deployment.reflect.ClassReflectionIndex) Method(java.lang.reflect.Method) SessionBean31MetaData(org.jboss.metadata.ejb.spec.SessionBean31MetaData)

Aggregations

SessionBeanMetaData (org.jboss.metadata.ejb.spec.SessionBeanMetaData)11 SessionBean31MetaData (org.jboss.metadata.ejb.spec.SessionBean31MetaData)7 Method (java.lang.reflect.Method)4 MethodIdentifier (org.jboss.invocation.proxy.MethodIdentifier)4 SessionBeanComponentDescription (org.jboss.as.ejb3.component.session.SessionBeanComponentDescription)2 StatefulComponentDescription (org.jboss.as.ejb3.component.stateful.StatefulComponentDescription)2 ClassReflectionIndex (org.jboss.as.server.deployment.reflect.ClassReflectionIndex)2 DeploymentReflectionIndex (org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex)2 HashSet (java.util.HashSet)1 TimeUnit (java.util.concurrent.TimeUnit)1 ConcurrencyManagementType (javax.ejb.ConcurrencyManagementType)1 LocalHome (javax.ejb.LocalHome)1 RemoteHome (javax.ejb.RemoteHome)1 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)1 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 DependencyConfigurator (org.jboss.as.ee.component.DependencyConfigurator)1 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1 ViewConfiguration (org.jboss.as.ee.component.ViewConfiguration)1 ViewConfigurator (org.jboss.as.ee.component.ViewConfigurator)1