public Class<? extends Annotation>[] getTypeDependencies() { return getEjbAndWebAnnotationTypes(); } }
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; }
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, ResourceContainerContext[] rcContexts) throws AnnotationProcessorException { DataSourceDefinitions defns = (DataSourceDefinitions) ainfo.getAnnotation(); DataSourceDefinition values[] = defns.value(); Set duplicates = new HashSet(); if(values != null && values.length >0){ for(DataSourceDefinition defn : values){ String defnName = DataSourceDefinitionDescriptor.getJavaName(defn.name()); if(duplicates.contains(defnName)){ String localString = localStrings.getLocalString( "enterprise.deployment.annotation.handlers.datasourcedefinitionsduplicates", "@DataSourceDefinitions cannot have multiple definitions with same name : '{0}'", defnName); throw new IllegalStateException(localString); /* //TODO V3 should we throw exception or return failure result ? return getFailureResult(ainfo, "@DataSourceDefinitions cannot have multiple" + " definitions with same name [ "+defnName+" ]", true ); */ }else{ duplicates.add(defnName); } DataSourceDefinitionHandler handler = new DataSourceDefinitionHandler(); handler.processAnnotation(defn, ainfo, rcContexts); } duplicates.clear(); } return getDefaultProcessedResult(); }