use of javax.ejb.Init 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();
}
Aggregations