protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, WebBundleContext webBundleContext) throws AnnotationProcessorException { return getInvalidAnnotatedElementHandlerResult( ainfo.getProcessingContext().getHandler(), ainfo); }
/** * This methods create a context for EjbInterceptor associated to * given className. * Return null if corresponding descriptor is not found. */ public AnnotatedElementHandler createContextForEjbInterceptor() { Class interceptorClass = (Class)this.getProcessingContext().getProcessor( ).getLastAnnotatedElement(ElementType.TYPE); EjbInterceptor ejbInterceptor = this.getDescriptor().getInterceptorByClassName( interceptorClass.getName()); AnnotatedElementHandler aeHandler = null; if (ejbInterceptor != null) { aeHandler = new EjbInterceptorContext(ejbInterceptor); // push a EjbInterceptorContext to stack this.getProcessingContext().pushHandler(aeHandler); } return aeHandler; } }
protected void log(Level level, AnnotationInfo ainfo, String localizedMessage) throws AnnotationProcessorException { if (Level.SEVERE.equals(level)) { ainfo.getProcessingContext().getErrorHandler().error( new AnnotationProcessorException(localizedMessage, ainfo)); } else if (Level.WARNING.equals(level)) { ainfo.getProcessingContext().getErrorHandler().warning( new AnnotationProcessorException(localizedMessage, ainfo)); } else if (Level.FINE.equals(level)) { ainfo.getProcessingContext().getErrorHandler().fine( new AnnotationProcessorException(localizedMessage, ainfo)); } else if (ainfo != null) { ainfo.getProcessingContext().getProcessor().log( level, ainfo, localizedMessage); } else { logger.log(level, localizedMessage); } }
/** * If WEB-INF/sun-jaxws.xml exists and is not processed in EJB context , then it returns true. * @param annInfo * @return */ private boolean isJaxwsRIDeployment(AnnotationInfo annInfo) { boolean riDeployment = false; AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler(); try { ReadableArchive moduleArchive = annInfo.getProcessingContext().getArchive(); if (moduleArchive != null && moduleArchive.exists("WEB-INF/sun-jaxws.xml") && !((Class)annInfo.getAnnotatedElement()).isInterface() && ( (annCtx instanceof WebBundleContext) || (annCtx instanceof WebComponentContext))) { riDeployment = true; } } catch (Exception e) { //continue, processing } return riDeployment; }
public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo) throws AnnotationProcessorException AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler(); AnnotatedElement annElem = annInfo.getAnnotatedElement(); AnnotatedElement origAnnElem = annElem; rb.getString("enterprise.deployment.annotation.handlers.wrongannotationlocation") ,annInfo); annInfo.getProcessingContext().getErrorHandler().error(ape); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED); annInfo.getProcessingContext().getArchive().getName(),"WEB-INF/sun-jaxws.xml")); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED); } else if ( !(annCtx instanceof WebBundleContext)) { return getInvalidAnnotatedElementHandlerResult( annInfo.getProcessingContext().getHandler(), annInfo); rb.getString("mismatch.targetnamespace"), annInfo); annInfo.getProcessingContext().getErrorHandler().error(ape); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED); rb.getString("mismatch.port.targetnamespace"), annInfo); annInfo.getProcessingContext().getErrorHandler().error(ape); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED);
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler(); if( aeHandler instanceof ManagedBeanContext ) { new ManagedBeanContext(managedBeanDesc); ProcessingContext procContext = element.getProcessingContext(); procContext.pushHandler(managedBeanContext); procContext.getProcessor().process( procContext, new Class[] { managedBeanClass });
ClassLoader clo = annInfo.getProcessingContext().getProcessingInput().getClassLoader(); handlerFileStream = clo.getResourceAsStream(handlerFile); if (handlerFileStream==null) { ClassLoader clo = annInfo.getProcessingContext().getProcessingInput().getClassLoader(); for (WebServiceHandlerChain chain : chains) { for (WebServiceHandler handler : chain.getHandlers()) { ProcessingContext ctx = annInfo.getProcessingContext(); ctx.pushHandler(newContext); annInfo.getProcessingContext().getProcessor().process( annInfo.getProcessingContext(), handlerClasses.toArray(new Class[handlerClasses.size()])); ctx.popHandler();
private ProcessingResult process(ProcessingContext ctx, Class c) throws AnnotationProcessorException { Scanner scanner = ctx.getProcessingInput(); ProcessingResultImpl result = new ProcessingResultImpl(); "Class [ {0} ] not found. Error while loading [ {1} ]", new Object[]{err.getMessage(), c})); ctx.getErrorHandler().error(ape); AnnotatedElementHandler handler= ctx.getHandler(); logStart(handler, ElementType.TYPE,c); result.add(c, processAnnotations(ctx, c)); logStart(ctx.getHandler(), ElementType.CONSTRUCTOR, constructor); result.add(constructor, processAnnotations(ctx, constructor)); logEnd(ctx.getHandler(), ElementType.CONSTRUCTOR, constructor); logStart(ctx.getHandler(), ElementType.METHOD, method); result.add(method, processAnnotations(ctx, method)); logEnd(ctx.getHandler(), ElementType.METHOD, method); logEnd(ctx.getHandler(), ElementType.TYPE, c);
ainfo.getProcessingContext().getHandler(); if (aeHandler != null && aeHandler instanceof EjbContext) { EjbContext context = (EjbContext)aeHandler; ainfo.getProcessingContext().getHandler(), ainfo); ctx.getProcessingContext().pushHandler(annContext);
protected HandlerProcessingResult processAWsRef(AnnotationInfo annInfo, WebServiceRef annotation) throws AnnotationProcessorException { AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler(); AnnotatedElement annElem = annInfo.getAnnotatedElement(); annInfo.getProcessingContext().getErrorHandler().fine( new AnnotationProcessorException( localStrings.getLocalString(
ctx.setArchive(archive); if (annotationErrorHandler != null) { ctx.setErrorHandler(annotationErrorHandler); ctx.setProcessingInput(scanner); ctx.pushHandler(aeHandler);
public void endElement(ElementType type, AnnotatedElement element) throws AnnotationProcessorException { getProcessingContext().popHandler(); } }
public void startElement(ElementType type, AnnotatedElement element) throws AnnotationProcessorException { getProcessingContext().pushHandler(this); }
delegate.process(ctx, element, result); } else { ctx.getErrorHandler().fine( new AnnotationProcessorException("No handler defined for " + annotation.annotationType()));
public ProcessingContext createContext() { ProcessingContext ctx = new ProcessingContextImpl(this); ctx.setErrorHandler(new DefaultErrorHandler()); return ctx; }
/** * Starts the annotation processing tool passing the processing context which * encapuslate all information necessary for the configuration of the tool. * @param ctx is the initialized processing context * @return the result of the annoations processing */ public ProcessingResult process(ProcessingContext ctx) throws AnnotationProcessorException { Scanner<Object> scanner = ctx.getProcessingInput(); ProcessingResultImpl result = new ProcessingResultImpl(); errorCount=0; for (Class c : scanner.getElements()) { result.add(process(ctx, c)); } return result; }
public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo) throws AnnotationProcessorException AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler(); AnnotatedElement annElem = annInfo.getAnnotatedElement(); AnnotationProcessorException ape = new AnnotationProcessorException( "@WebServiceProvider can only be specified on TYPE", annInfo); annInfo.getProcessingContext().getErrorHandler().error(ape); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED); annInfo.getProcessingContext().getArchive().getName(),"WEB-INF/sun-jaxws.xml")); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED); AnnotationProcessorException ape = new AnnotationProcessorException( annElem.toString() + "does not implement the javax.xml.ws.Provider interface", annInfo); annInfo.getProcessingContext().getErrorHandler().error(ape); return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED); } else if ( !(annCtx instanceof WebBundleContext)) { return getInvalidAnnotatedElementHandlerResult( annInfo.getProcessingContext().getHandler(), annInfo);
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler(); if( aeHandler instanceof ManagedBeanContext ) { new ManagedBeanContext(managedBeanDesc); ProcessingContext procContext = element.getProcessingContext(); procContext.pushHandler(managedBeanContext); procContext.getProcessor().process( procContext, new Class[] { managedBeanClass });
ClassLoader clo = annInfo.getProcessingContext().getProcessingInput().getClassLoader(); handlerFileStream = clo.getResourceAsStream(handlerFile); if (handlerFileStream==null) { ClassLoader clo = annInfo.getProcessingContext().getProcessingInput().getClassLoader(); for (WebServiceHandlerChain chain : chains) { for (WebServiceHandler handler : chain.getHandlers()) { ProcessingContext ctx = annInfo.getProcessingContext(); ctx.pushHandler(newContext); annInfo.getProcessingContext().getProcessor().process( annInfo.getProcessingContext(), handlerClasses.toArray(new Class[0])); ctx.popHandler();
private ProcessingResult process(ProcessingContext ctx, Class c) throws AnnotationProcessorException { Scanner scanner = ctx.getProcessingInput(); ProcessingResultImpl result = new ProcessingResultImpl(); "Class [ {0} ] not found. Error while loading [ {1} ]", new Object[]{err.getMessage(), c})); ctx.getErrorHandler().error(ape); AnnotatedElementHandler handler= ctx.getHandler(); logStart(handler, ElementType.TYPE,c); result.add(c, processAnnotations(ctx, c)); logStart(ctx.getHandler(), ElementType.CONSTRUCTOR, constructor); result.add(constructor, processAnnotations(ctx, constructor)); logEnd(ctx.getHandler(), ElementType.CONSTRUCTOR, constructor); logStart(ctx.getHandler(), ElementType.METHOD, method); result.add(method, processAnnotations(ctx, method)); logEnd(ctx.getHandler(), ElementType.METHOD, method); logEnd(ctx.getHandler(), ElementType.TYPE, c);