use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class Generator method getTxAttribute.
protected String getTxAttribute(EjbDescriptor dd, Method method) {
// com.sun.ejb.Container.
if (dd instanceof EjbSessionDescriptor && ((EjbSessionDescriptor) dd).getTransactionType().equals("Bean"))
return "TX_BEAN_MANAGED";
String txAttr = null;
MethodDescriptor mdesc = new MethodDescriptor(method, ejbClassSymbol);
ContainerTransaction ct = dd.getContainerTransactionFor(mdesc);
if (ct != null) {
String attr = ct.getTransactionAttribute();
if (attr.equals(ContainerTransaction.NOT_SUPPORTED))
txAttr = "TX_NOT_SUPPORTED";
else if (attr.equals(ContainerTransaction.SUPPORTS))
txAttr = "TX_SUPPORTS";
else if (attr.equals(ContainerTransaction.REQUIRED))
txAttr = "TX_REQUIRED";
else if (attr.equals(ContainerTransaction.REQUIRES_NEW))
txAttr = "TX_REQUIRES_NEW";
else if (attr.equals(ContainerTransaction.MANDATORY))
txAttr = "TX_MANDATORY";
else if (attr.equals(ContainerTransaction.NEVER))
txAttr = "TX_NEVER";
}
if (txAttr == null) {
throw new RuntimeException("Transaction Attribute not found for method " + method);
}
return txAttr;
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class AbstractAuthAnnotationHandler method postProcessAnnotation.
/**
* This method is for processing security annotation associated to ejb.
* Dervied class call this method may like to override
*
* protected void processEjbMethodSecurity(Annotation authAnnotation,
* MethodDescriptor md, EjbDescriptor ejbDesc)
*/
@Override
public void postProcessAnnotation(AnnotationInfo ainfo, EjbContext ejbContext) throws AnnotationProcessorException {
EjbDescriptor ejbDesc = ejbContext.getDescriptor();
Annotation authAnnotation = ainfo.getAnnotation();
if (!ejbContext.isInherited() && (ejbDesc.getMethodPermissionsFromDD() == null || ejbDesc.getMethodPermissionsFromDD().size() == 0)) {
for (MethodDescriptor md : getMethodAllDescriptors(ejbDesc)) {
processEjbMethodSecurity(authAnnotation, md, ejbDesc);
}
} else {
Class classAn = (Class) ainfo.getAnnotatedElement();
for (Object next : ejbDesc.getSecurityBusinessMethodDescriptors()) {
MethodDescriptor md = (MethodDescriptor) next;
// override by existing info
if (classAn.equals(ejbContext.getDeclaringClass(md)) && !hasMethodPermissionsFromDD(md, ejbDesc)) {
processEjbMethodSecurity(authAnnotation, md, ejbDesc);
}
}
}
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class AsynchronousTask method initSessionSyncMethods.
private void initSessionSyncMethods() throws Exception {
if (SessionSynchronization.class.isAssignableFrom(ejbClass)) {
try {
afterBeginMethod = ejbClass.getMethod("afterBegin");
beforeCompletionMethod = ejbClass.getMethod("beforeCompletion");
afterCompletionMethod = ejbClass.getMethod("afterCompletion", Boolean.TYPE);
} catch (Exception e) {
_logger.log(Level.WARNING, EXCEPTION_WHILE_INITIALIZING_SESSION_SYNCHRONIZATION, e);
}
} else {
EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDescriptor;
MethodDescriptor afterBeginMethodDesc = sessionDesc.getAfterBeginMethod();
if (afterBeginMethodDesc != null) {
afterBeginMethod = afterBeginMethodDesc.getDeclaredMethod(sessionDesc);
processSessionSynchMethod(afterBeginMethod);
}
MethodDescriptor beforeCompletionMethodDesc = sessionDesc.getBeforeCompletionMethod();
if (beforeCompletionMethodDesc != null) {
beforeCompletionMethod = beforeCompletionMethodDesc.getDeclaredMethod(sessionDesc);
processSessionSynchMethod(beforeCompletionMethod);
}
MethodDescriptor afterCompletionMethodDesc = sessionDesc.getAfterCompletionMethod();
if (afterCompletionMethodDesc != null) {
afterCompletionMethod = afterCompletionMethodDesc.getDeclaredMethod(sessionDesc);
if (afterCompletionMethod == null) {
afterCompletionMethod = //
afterCompletionMethodDesc.getDeclaredMethod(sessionDesc, new Class[] { Boolean.TYPE });
}
processSessionSynchMethod(afterCompletionMethod);
}
}
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class AsynchronousTask method loadCheckpointInfo.
protected void loadCheckpointInfo() {
try {
if (!isHAEnabled) {
return;
}
for (InvocationInfo info : invocationInfoMap.values()) {
info.checkpointEnabled = false;
MethodDescriptor md = new MethodDescriptor(info.method, info.methodIntf);
IASEjbExtraDescriptors extraDesc = ejbDescriptor.getIASEjbExtraDescriptors();
if (extraDesc != null) {
CheckpointAtEndOfMethodDescriptor cpDesc = extraDesc.getCheckpointAtEndOfMethodDescriptor();
if (cpDesc != null) {
info.checkpointEnabled = cpDesc.isCheckpointEnabledFor(md);
}
}
if (info.checkpointEnabled) {
_logger.log(Level.FINE, () -> "[SFSBContainer] " + info.method + " MARKED for end-of-method-checkpoint");
}
}
} catch (Exception ex) {
_logger.log(Level.WARNING, EXCEPTION_WHILE_LOADING_CHECKPOINT, ex);
}
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class AbstractMethodHelper method categorizeMethods.
/**
* Reads all known methods and sorts them by name into specific
* Collections for further processing.
*/
protected void categorizeMethods() {
EjbCMPEntityDescriptor descriptor = getDescriptor();
Iterator iterator = descriptor.getMethodDescriptors().iterator();
while (iterator.hasNext()) {
MethodDescriptor methodDescriptor = (MethodDescriptor) iterator.next();
Method method = methodDescriptor.getMethod(descriptor);
String methodName = methodDescriptor.getName();
if (methodName.startsWith(CMPTemplateFormatter.find_))
finders.add(method);
else if (methodName.startsWith(CMPTemplateFormatter.ejbSelect_))
selectors.add(method);
else if (methodName.startsWith(CMPTemplateFormatter.create_))
createMethods.add(method);
else if (methodName.startsWith(CMPTemplateFormatter.get_) || methodName.startsWith(CMPTemplateFormatter.set_)) {
// skip
;
}
// else
// otherMethods.add(method);
// It is OK to use HashMap here as we won't use it for possible
// overloaded methods.
methodNames.put(methodName, method);
}
}
Aggregations