use of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor in project Payara by payara.
the class AfterCompletionHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext ejbContext : ejbContexts) {
EjbSessionDescriptor ejbDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();
Method annMethod = (Method) ainfo.getAnnotatedElement();
checkValid(annMethod);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Setting AfterCompletion method " + annMethod);
}
ejbDesc.setAfterCompletionMethodIfNotSet(new MethodDescriptor(annMethod));
}
return getDefaultProcessedResult();
}
use of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor in project Payara by payara.
the class BeforeCompletionHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext ejbContext : ejbContexts) {
EjbSessionDescriptor ejbDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();
Method annMethod = (Method) ainfo.getAnnotatedElement();
checkValid(annMethod);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Setting BeforeCompletion method " + annMethod);
}
ejbDesc.setBeforeCompletionMethodIfNotSet(new MethodDescriptor(annMethod));
}
return getDefaultProcessedResult();
}
use of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor in project Payara by payara.
the class InitHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
Init init = (Init) ainfo.getAnnotation();
for (EjbContext next : ejbContexts) {
EjbSessionDescriptor sessionDescriptor = (EjbSessionDescriptor) next.getDescriptor();
Method m = (Method) ainfo.getAnnotatedElement();
// Check for matching method on home and/or local home interface.
int numMatches = 0;
String adaptedCreateMethodName = init.value();
try {
if (sessionDescriptor.isRemoteInterfacesSupported()) {
addInitMethod(sessionDescriptor, m, adaptedCreateMethodName, false);
numMatches++;
}
} catch (Exception e) {
}
try {
if (sessionDescriptor.isLocalInterfacesSupported()) {
addInitMethod(sessionDescriptor, m, adaptedCreateMethodName, true);
numMatches++;
}
} catch (Exception e) {
}
if (numMatches == 0) {
log(Level.SEVERE, ainfo, localStrings.getLocalString("enterprise.deployment.annotation.handlers.notmatchcreate", "Unable to find matching Home create method for Init method {0} on bean {1}.", new Object[] { m, sessionDescriptor.getName() }));
return getDefaultFailedResult();
}
}
return getDefaultProcessedResult();
}
use of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor in project Payara by payara.
the class LockHandler method postProcessAnnotation.
/**
* Set the default value (from class type annotation) on all
* methods that don't have a value.
*/
public void postProcessAnnotation(AnnotationInfo ainfo, EjbContext ejbContext) throws AnnotationProcessorException {
EjbSessionDescriptor ejbDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();
Class classAn = (Class) ainfo.getAnnotatedElement();
Lock lockAnn = (Lock) ainfo.getAnnotation();
// At this point, all method-level specific annotations have been processed.
// For non-private methods, find the ones from the EjbContext's
// component definition view that are declared on this class. This will correctly
// eliminate any overridden methods and provide the most-derived version of each.
// Use the Class's declared methods list to get the private methods.
List<Method> toProcess = new ArrayList<Method>();
for (Method m : ejbContext.getComponentDefinitionMethods()) {
if (classAn.equals(m.getDeclaringClass())) {
toProcess.add(m);
}
}
for (Method m : classAn.getDeclaredMethods()) {
if (Modifier.isPrivate(m.getModifiers())) {
toProcess.add(m);
}
}
for (Method m : toProcess) {
// descriptor, set it.
if (!matchesExistingReadOrWriteLockMethod(m, ejbDesc)) {
MethodDescriptor newMethodDesc = new MethodDescriptor(m);
if (lockAnn.value() == LockType.WRITE) {
ejbDesc.addWriteLockMethod(newMethodDesc);
} else {
ejbDesc.addReadLockMethod(newMethodDesc);
}
}
}
}
use of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor in project Payara by payara.
the class PrePassivateHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext next : ejbContexts) {
EjbSessionDescriptor ejbSessionDescriptor = (EjbSessionDescriptor) next.getDescriptor();
ejbSessionDescriptor.addPrePassivateDescriptor(getPrePassivateDescriptor(ainfo));
}
return getDefaultProcessedResult();
}
Aggregations