Search in sources :

Example 11 with StatefulSessionComponent

use of org.jboss.as.ejb3.component.stateful.StatefulSessionComponent in project wildfly by wildfly.

the class StatefulSessionBeanRuntimeHandler method executeReadAttribute.

@Override
protected void executeReadAttribute(String attributeName, OperationContext context, StatefulSessionComponent component, PathAddress address) {
    final StatefulComponentDescription componentDescription = (StatefulComponentDescription) component.getComponentDescription();
    final ModelNode result = context.getResult();
    if (STATEFUL_TIMEOUT.getName().equals(attributeName)) {
        final StatefulTimeoutInfo statefulTimeout = componentDescription.getStatefulTimeout();
        if (statefulTimeout != null) {
            result.set(statefulTimeout.getValue() + ' ' + statefulTimeout.getTimeUnit().toString());
        }
    } else if (AFTER_BEGIN_METHOD.getName().equals(attributeName)) {
        final Method afterBeginMethod = component.getAfterBeginMethod();
        if (afterBeginMethod != null) {
            result.set(afterBeginMethod.toString());
        }
    } else if (BEFORE_COMPLETION_METHOD.getName().equals(attributeName)) {
        final Method beforeCompletionMethod = component.getBeforeCompletionMethod();
        if (beforeCompletionMethod != null) {
            result.set(beforeCompletionMethod.toString());
        }
    } else if (AFTER_COMPLETION_METHOD.getName().equals(attributeName)) {
        final Method afterCompletionMethod = component.getAfterCompletionMethod();
        if (afterCompletionMethod != null) {
            result.set(afterCompletionMethod.toString());
        }
    } else if (PASSIVATION_CAPABLE.getName().equals(attributeName)) {
        result.set(componentDescription.isPassivationApplicable());
    } else if (REMOVE_METHODS.getName().equals(attributeName)) {
        final Collection<StatefulComponentDescription.StatefulRemoveMethod> removeMethods = componentDescription.getRemoveMethods();
        for (StatefulComponentDescription.StatefulRemoveMethod removeMethod : removeMethods) {
            ModelNode removeMethodNode = result.add();
            final ModelNode beanMethodNode = removeMethodNode.get(BEAN_METHOD.getName());
            final MethodIdentifier methodIdentifier = removeMethod.getMethodIdentifier();
            beanMethodNode.set(methodIdentifier.getReturnType() + ' ' + methodIdentifier.getName() + '(' + String.join(", ", methodIdentifier.getParameterTypes()) + ')');
            final ModelNode retainIfExceptionNode = removeMethodNode.get(RETAIN_IF_EXCEPTION.getName());
            retainIfExceptionNode.set(removeMethod.getRetainIfException());
        }
    } else {
        super.executeReadAttribute(attributeName, context, component, address);
    }
// TODO expose the cache
}
Also used : StatefulComponentDescription(org.jboss.as.ejb3.component.stateful.StatefulComponentDescription) StatefulTimeoutInfo(org.jboss.as.ejb3.component.stateful.StatefulTimeoutInfo) Collection(java.util.Collection) Method(java.lang.reflect.Method) MethodIdentifier(org.jboss.invocation.proxy.MethodIdentifier) ModelNode(org.jboss.dmr.ModelNode)

Aggregations

StatefulSessionComponent (org.jboss.as.ejb3.component.stateful.StatefulSessionComponent)6 SessionID (org.jboss.ejb.client.SessionID)6 Component (org.jboss.as.ee.component.Component)4 EJBComponent (org.jboss.as.ejb3.component.EJBComponent)4 EjbDeploymentInformation (org.jboss.as.ejb3.deployment.EjbDeploymentInformation)4 Method (java.lang.reflect.Method)3 EJBException (javax.ejb.EJBException)3 ComponentView (org.jboss.as.ee.component.ComponentView)3 StatelessSessionComponent (org.jboss.as.ejb3.component.stateless.StatelessSessionComponent)3 IOException (java.io.IOException)2 UnknownHostException (java.net.UnknownHostException)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CancellationException (java.util.concurrent.CancellationException)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ComponentIsStoppedException (org.jboss.as.ee.component.ComponentIsStoppedException)2 EJBComponentUnavailableException (org.jboss.as.ejb3.component.EJBComponentUnavailableException)2 CancellationFlag (org.jboss.as.ejb3.component.interceptors.CancellationFlag)2 SessionBeanComponent (org.jboss.as.ejb3.component.session.SessionBeanComponent)2 EJBIdentifier (org.jboss.ejb.client.EJBIdentifier)2