}
public HandlerProcessingResult processHandlerChainAnnotation(AnnotationInfo annInfo,
AnnotatedElementHandler annCtx, AnnotatedElement annElem, Class declaringClass, boolean serviceSideChain)
throws AnnotationProcessorException {
HandlerChain hChain = null;
boolean clientSideHandlerChain = false;
if(serviceSideChain) {
// This is a service handler chain
// Ignore @WebService annotation on an interface; process only those in an actual service impl class
if (declaringClass.isInterface()) {
return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
}
// The @HandlerChain can be in the impl class (typically in the java-wsdl case) or
// can be in the SEI also. Check if there is handler chain in the impl class.
// If so, the @HandlerChain in impl class gets precedence
hChain = annElem.getAnnotation(HandlerChain.class);
if(hChain == null) {
WebService webService = (WebService) declaringClass.getAnnotation(WebService.class);
if (webService!=null) {
if (webService.endpointInterface()!=null && webService.endpointInterface().length()>0) {
Class endpointIntf;
try {
endpointIntf = declaringClass.getClassLoader().loadClass(webService.endpointInterface());
} catch(java.lang.ClassNotFoundException cfne) {
throw new AnnotationProcessorException(
localStrings.getLocalString("enterprise.deployment.annotation.handlers.classnotfound",
"class {0} referenced from annotation symbol cannot be loaded",
new Object[] { webService.endpointInterface() }), annInfo);
}
if (endpointIntf.getAnnotation(HandlerChain.class)!=null) {
hChain = (HandlerChain) endpointIntf.getAnnotation(HandlerChain.class);
}
}
}
}
} else {
// this is a client side handler chain
hChain = annElem.getAnnotation(HandlerChain.class);
clientSideHandlerChain = true;
}
// At this point the hChain should be the annotation to use.
if(hChain == null) {
return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
}
// At this point the hChain should be the annotation to use.
String handlerFile = hChain.file();
HandlerChainContainer[] containers=null;
if (annCtx instanceof HandlerContext) {
containers = ((HandlerContext) annCtx).getHandlerChainContainers(serviceSideChain, declaringClass);
}