protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, ResourceContainerContext[] rcContexts) throws AnnotationProcessorException { AnnotatedElementHandler aeHandler = ainfo.getProcessingContext().getHandler(); PreDestroy preDestroyAn = (PreDestroy)ainfo.getAnnotation(); Method annMethod = (Method)ainfo.getAnnotatedElement(); String pdMethodName = annMethod.getName(); String pdClassName = annMethod.getDeclaringClass().getName(); for (ResourceContainerContext rcContext : rcContexts) { LifecycleCallbackDescriptor preDestroyDesc = new LifecycleCallbackDescriptor(); preDestroyDesc.setLifecycleCallbackClass(pdClassName); preDestroyDesc.setLifecycleCallbackMethod(pdMethodName); preDestroyDesc.setMetadataSource(MetadataSource.ANNOTATION); // override by xml is handled in addPreDestroyDescriptor rcContext.addPreDestroyDescriptor(preDestroyDesc); } return getDefaultProcessedResult(); } }
/** * Receive notication of a fine error message * @param ape The warning information * @throws any exception to stop the annotation processing */ public void fine(AnnotationProcessorException ape) throws AnnotationProcessorException { if (logger.isLoggable(Level.FINE)){ AnnotationInfo info = ape.getLocator(); if (info==null){ logger.fine(ape.getMessage()); } else{ logger.fine(AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0}\n location: {1}\n\n", new Object[] { info.getElementType(), info.getAnnotatedElement(), ape.getMessage()})); } } }
/** * Log a message on the default logger */ public void log(Level level, AnnotationInfo locator, String localizedMessage){ if (logger!=null && logger.isLoggable(level)){ if (locator!=null){ logger.log(level, AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0}\n location: {1}", new Object[] { locator.getAnnotation().annotationType().getName(), locator.getAnnotatedElement(), 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; }
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException { AccessTimeout timeout = (AccessTimeout) ainfo.getAnnotation(); for (EjbContext ejbContext : ejbContexts) { if (ejbContext.getDescriptor() instanceof EjbSessionDescriptor) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbContext.getDescriptor(); if( sessionDesc.isStateless() ) { continue; } if (ElementType.TYPE.equals(ainfo.getElementType())) { // Delay processing Class-level default until after methods are processed ejbContext.addPostProcessInfo(ainfo, this); } else { Method annMethod = (Method) ainfo.getAnnotatedElement(); // Only assign access timeout info if the method hasn't already // been processed. This correctly ignores superclass methods that // are overridden and applies the correct .xml overriding semantics. if(!matchesExistingAccessTimeoutMethod(annMethod, sessionDesc)) { MethodDescriptor newMethodDesc = new MethodDescriptor(annMethod); sessionDesc.addAccessTimeoutMethod(newMethodDesc, timeout.value(), timeout.unit()); } } } } return getDefaultProcessedResult(); }
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException { AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler(); ConnectionDefinition connDefn = (ConnectionDefinition) element.getAnnotation(); if (aeHandler instanceof RarBundleContext) { handleAnnotation(aeHandler, connDefn, element); } else { getFailureResult(element, "not a rar bundle context", true); } return getDefaultProcessedResult(); }
@Override public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo) throws AnnotationProcessorException { WebServiceRef annotation = (WebServiceRef) annInfo.getAnnotation(); return(processAWsRef(annInfo, annotation)); }
private boolean hasConnectorAnnotation(AnnotationInfo element) { Class c = (Class) element.getAnnotatedElement(); return c.getAnnotation(Connector.class) != null; }
public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo) throws AnnotationProcessorException { AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler(); AnnotatedElement annElem = annInfo.getAnnotatedElement(); Class declaringClass; declaringClass = (Class)annElem; } else { if (annInfo.getElementType().equals(ElementType.FIELD)) { } else if (annInfo.getElementType().equals(ElementType.METHOD)) { } else if (annInfo.getElementType().equals(ElementType.TYPE)) { declaringClass = (Class) annElem; } else {
Annotation annotation = element.getAnnotation(); if (AnnotationUtils.shouldLog("annotation")) { logger.finer("Annotation : " + annotation.annotationType().getName() + " delegate = " + delegate); AnnotatedElement ae = element.getAnnotatedElement(); for (Class<? extends Annotation> annotationType : dependencies) { Annotation depAnnotation = ae.getAnnotation(annotationType); if (resultType==null || resultType==ResultType.UNPROCESSED){ AnnotationInfo info = new AnnotationInfo(ctx, ae, depAnnotation, getTopElementType()); process(ctx, info, result);
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, WebBundleContext webBundleContext) throws AnnotationProcessorException { return getInvalidAnnotatedElementHandlerResult( ainfo.getProcessingContext().getHandler(), ainfo); }
position = p; return new AnnotationInfo(annotation, position, textViewer) { public ICompletionProposal[] getCompletionProposals() { ICompletionProposal proposal1 = null;
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException { TransactionAttribute taAn = (TransactionAttribute) ainfo.getAnnotation(); for (EjbContext ejbContext : ejbContexts) { EjbDescriptor ejbDesc = ejbContext.getDescriptor(); ContainerTransaction containerTransaction = getContainerTransaction(taAn.value()); if (ElementType.TYPE.equals(ainfo.getElementType())) { ejbContext.addPostProcessInfo(ainfo, this); } else { Method annMethod = (Method) ainfo.getAnnotatedElement(); Set txBusMethods = ejbDesc.getTxBusinessMethodDescriptors(); for (Object next : txBusMethods) { MethodDescriptor nextDesc = (MethodDescriptor) next; Method m = nextDesc.getMethod(ejbDesc); if( TypeUtil.sameMethodSignature(m, annMethod) && ejbDesc.getContainerTransactionFor(nextDesc) == null ) { // override by xml ejbDesc.setContainerTransactionFor (nextDesc, containerTransaction); } } } } return getDefaultProcessedResult(); }
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException { AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler(); ConfigProperty configProperty = (ConfigProperty) element.getAnnotation(); if (aeHandler instanceof RarBundleContext) { RarBundleContext rbc = (RarBundleContext) aeHandler; ConnectorDescriptor desc = rbc.getDescriptor(); handleConfigPropertyAnnotation(configProperty, element, desc); } else { return getFailureResult(element, "not a rar bundle context", true); } return getDefaultProcessedResult(); }
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException { return processSchedule((Schedule)ainfo.getAnnotation(), ainfo, ejbContexts); }
/** * Log a message on the default logger */ public void log(Level level, AnnotationInfo locator, String localizedMessage){ if (logger!=null && logger.isLoggable(level)){ if (locator!=null){ logger.log(level, AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0}\n location: {1}", new Object[] { locator.getAnnotation().annotationType().getName(), locator.getAnnotatedElement(), localizedMessage})); } else{ logger.log(level, localizedMessage); } } }
private boolean hasConnectorAnnotation(AnnotationInfo element) { Class c = (Class) element.getAnnotatedElement(); return c.getAnnotation(Connector.class) != null; }
public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo) throws AnnotationProcessorException { AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler(); AnnotatedElement annElem = annInfo.getAnnotatedElement(); Class declaringClass; declaringClass = (Class)annElem; } else { if (annInfo.getElementType().equals(ElementType.FIELD)) { } else if (annInfo.getElementType().equals(ElementType.METHOD)) { } else if (annInfo.getElementType().equals(ElementType.TYPE)) { declaringClass = (Class) annElem; } else {
/** * 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; }
Annotation annotation = element.getAnnotation(); if (AnnotationUtils.shouldLog("annotation")) { logger.finer("Annotation : " + annotation.annotationType().getName() + " delegate = " + delegate); AnnotatedElement ae = element.getAnnotatedElement(); for (Class<? extends Annotation> annotationType : dependencies) { Annotation depAnnotation = ae.getAnnotation(annotationType); if (resultType==null || resultType==ResultType.UNPROCESSED){ AnnotationInfo info = new AnnotationInfo(ctx, ae, depAnnotation, getTopElementType()); process(ctx, info, result);