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
}
Aggregations