public static HandlerProcessingResultImpl getDefaultResult(Class<? extends Annotation> annotationType, ResultType result) { HandlerProcessingResultImpl impl = new HandlerProcessingResultImpl(); impl.results.put(annotationType, result); impl.overallResult = result; return impl; }
public static HandlerProcessingResultImpl getDefaultResult(Class<? extends Annotation> annotationType, ResultType result) { HandlerProcessingResultImpl impl = new HandlerProcessingResultImpl(); impl.results.put(annotationType, result); impl.overallResult = result; return impl; }
/** * @return a default processed result */ protected HandlerProcessingResult getSuccessfulProcessedResult(List<Class<? extends Annotation>> annotationTypes) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); for(Class<? extends Annotation> annotation : annotationTypes){ result.addResult(annotation, ResultType.PROCESSED); } return result; }
public void add(AnnotatedElement element, HandlerProcessingResult elementResult) { if (elementResult.getOverallResult().compareTo(overallResult)>0) { overallResult = elementResult.getOverallResult(); } if (results.containsKey(element)) { HandlerProcessingResultImpl previousResult = (HandlerProcessingResultImpl) results.get(element); previousResult.addAll(elementResult); } else { if (elementResult instanceof HandlerProcessingResultImpl) { results.put(element, elementResult); } else { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addAll(elementResult); results.put(element, result); } } }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Object o = element.getAnnotatedElement(); String className = null; if(o instanceof Field){ className = ((Field)o).getDeclaringClass().getName(); }else { //else it can be only METHOD className = ((Method)o).getDeclaringClass().getName(); } Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; } }
public void add(AnnotatedElement element, HandlerProcessingResult elementResult) { if (elementResult.getOverallResult().compareTo(overallResult)>0) { overallResult = elementResult.getOverallResult(); } if (results.containsKey(element)) { HandlerProcessingResultImpl previousResult = (HandlerProcessingResultImpl) results.get(element); previousResult.addAll(elementResult); } else { if (elementResult instanceof HandlerProcessingResultImpl) { results.put(element, elementResult); } else { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addAll(elementResult); results.put(element, result); } } }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.datasourcedefinitionsfailure", "failed to handle annotation [ {0} ] on class [ {1} ] due to the following exception : ", element.getAnnotation(), className); logger.log(Level.WARNING, localString, message); } return result; }
private HandlerProcessingResult processAnnotations(ProcessingContext ctx, AnnotatedElement element) throws AnnotationProcessorException { HandlerProcessingResultImpl result= new HandlerProcessingResultImpl(); try{ for (Annotation annotation : element.getAnnotations()) { // initialize the result... AnnotationInfo subElement = new AnnotationInfo(ctx, element, annotation, getTopElementType()); if (!result.processedAnnotations().containsKey(annotation.annotationType())) { process(ctx, subElement, result); } else { if (AnnotationUtils.shouldLog("annotation")) { logger.finer("Annotation " + annotation.annotationType() + " already processed"); } } } } catch (ArrayStoreException e) { logger.info("Exception " + e.toString() + " encountered while processing annotaton for element " + element + ". Message is: " + e.getMessage() + ". Ignoring annotations and proceeding."); } return result; }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; } }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; } }
private HandlerProcessingResult processAnnotations(ProcessingContext ctx, AnnotatedElement element) throws AnnotationProcessorException { HandlerProcessingResultImpl result= new HandlerProcessingResultImpl(); try{ for (Annotation annotation : element.getAnnotations()) { // initialize the result... AnnotationInfo subElement = new AnnotationInfo(ctx, element, annotation, getTopElementType()); if (!result.processedAnnotations().containsKey(annotation.annotationType())) { process(ctx, subElement, result); } else { if (AnnotationUtils.shouldLog("annotation")) { logger.finer("Annotation " + annotation.annotationType() + " already processed"); } } } } catch (ArrayStoreException e) { logger.info("Exception " + e.toString() + " encountered while processing annotaton for element " + element + ". Message is: " + e.getMessage() + ". Ignoring annotations and proceeding."); } return result; }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; } }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; } }
private HandlerProcessingResultImpl getFailureResult(AnnotationInfo element, String message, boolean doLog) { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); result.addResult(getAnnotationType(), ResultType.FAILED); if (doLog) { Class c = (Class) element.getAnnotatedElement(); String className = c.getName(); Object args[] = new Object[]{ element.getAnnotation(), className, message, }; String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.connectorannotationfailure", "failed to handle annotation [ {0} ] on class [ {1} ], reason : {2}", args); logger.log(Level.WARNING, localString); } return result; } }
private HandlerProcessingResult processParameters(ProcessingContext ctx, Annotation[][] parametersAnnotations) throws AnnotationProcessorException { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); // process the method parameters... for (Annotation[] parameterAnnotations : parametersAnnotations) { logStart(ctx.getHandler(), ElementType.PARAMETER, null); if (parameterAnnotations!=null) { for (Annotation annotation : parameterAnnotations) { AnnotationInfo info = new AnnotationInfo(ctx, null, annotation, ElementType.PARAMETER); process(ctx, info, result); dumpProcessingResult(result); } } logEnd(ctx.getHandler(), ElementType.PARAMETER, null); } return result; }
private HandlerProcessingResult processParameters(ProcessingContext ctx, Annotation[][] parametersAnnotations) throws AnnotationProcessorException { HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); // process the method parameters... for (Annotation[] parameterAnnotations : parametersAnnotations) { logStart(ctx.getHandler(), ElementType.PARAMETER, null); if (parameterAnnotations!=null) { for (Annotation annotation : parameterAnnotations) { AnnotationInfo info = new AnnotationInfo(ctx, null, annotation, ElementType.PARAMETER); process(ctx, info, result); dumpProcessingResult(result); } } logEnd(ctx.getHandler(), ElementType.PARAMETER, null); } return result; }