Search in sources :

Example 1 with ITimeoutTarget

use of org.jboss.metadata.ejb.common.ITimeoutTarget in project wildfly by wildfly.

the class TimerMethodMergingProcessor method handleDeploymentDescriptor.

@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException {
    final EnterpriseBeanMetaData descriptorData = description.getDescriptorData();
    if (descriptorData != null && (description.isSession() || description.isMessageDriven())) {
        assert descriptorData instanceof ITimeoutTarget : descriptorData + " is not an ITimeoutTarget";
        ITimeoutTarget target = (ITimeoutTarget) descriptorData;
        if (target.getTimeoutMethod() != null) {
            parseTimeoutMethod(target, description, componentClass, deploymentReflectionIndex);
        }
        parseScheduleMethods(descriptorData, description, componentClass, deploymentReflectionIndex);
    }
    // or the method specified in the deployment descriptor
    if (TimedObject.class.isAssignableFrom(componentClass)) {
        Class<?> c = componentClass;
        while (c != null && c != Object.class) {
            final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(c);
            // TimedObject takes precedence
            Method method = index.getMethod(Void.TYPE, "ejbTimeout", javax.ejb.Timer.class);
            if (method != null) {
                final Method otherMethod = description.getTimeoutMethod();
                if (otherMethod != null && !otherMethod.equals(method)) {
                    throw EjbLogger.ROOT_LOGGER.invalidEjbEntityTimeout("3.1 18.2.5.3", componentClass);
                }
                description.setTimeoutMethod(method);
                break;
            }
            c = c.getSuperclass();
        }
    }
}
Also used : ITimeoutTarget(org.jboss.metadata.ejb.common.ITimeoutTarget) ClassReflectionIndex(org.jboss.as.server.deployment.reflect.ClassReflectionIndex) TimedObject(javax.ejb.TimedObject) Method(java.lang.reflect.Method) EnterpriseBeanMetaData(org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData)

Aggregations

Method (java.lang.reflect.Method)1 TimedObject (javax.ejb.TimedObject)1 ClassReflectionIndex (org.jboss.as.server.deployment.reflect.ClassReflectionIndex)1 ITimeoutTarget (org.jboss.metadata.ejb.common.ITimeoutTarget)1 EnterpriseBeanMetaData (org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData)1