/** * Has a NotNull annotation attached * @param annotationRepository The annotation repository * @param annotation The annotation being checked * @return True of the method/field contains the NotNull annotation; otherwise false */ private boolean hasNotNull(AnnotationRepository annotationRepository, Annotation annotation) { Collection<Annotation> values = annotationRepository.getAnnotation(javax.validation.constraints.NotNull.class); if (values == null || values.size() == 0) return false; for (Annotation notNullAnnotation : values) { if (notNullAnnotation.getClassName().equals(annotation.getClassName()) && notNullAnnotation.getMemberName().equals(annotation.getMemberName())) return true; } return false; } }
/** * hasAnnotation, if class c contains annotation targetClass * * @param c * @param targetClass * @param annotationRepository * @return */ private boolean hasAnnotation(Class c, Class targetClass, AnnotationRepository annotationRepository) { Collection<Annotation> values = annotationRepository.getAnnotation(targetClass); if (values == null) return false; for (Annotation annotation : values) { if (annotation.getClassName() != null && annotation.getClassName().equals(c.getName())) return true; } return false; }
/** * Attach @ConnectionDefinition * @param annotation The annotation * @param classLoader The class loader * @param configProperty The config properties * @param plainConfigProperty The plain config properties * @return The updated metadata * @exception Exception Thrown if an error occurs */ private ConnectionDefinition attachConnectionDefinition(Annotation annotation, ClassLoader classLoader, ArrayList<? extends ConfigProperty> configProperty, ArrayList<? extends ConfigProperty> plainConfigProperty) throws Exception { javax.resource.spi.ConnectionDefinition cd = (javax.resource.spi.ConnectionDefinition) annotation.getAnnotation(); if (trace) log.trace("Processing: " + annotation); return attachConnectionDefinition(annotation.getClassName(), cd, classLoader, configProperty, plainConfigProperty); }
AnnotationScanner scanner = AnnotationScannerFactory.getAnnotationScanner(); AnnotationRepository repository = scanner.scan(cl.getURLs(), cl); cmd = annotator.merge(cmd, repository, cl);
throws Exception Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinitions.class); if (values != null) .getAnnotation(); return attachConnectionDefinitions(connectionDefinitionsAnnotation, annotation.getClassName(), classLoader, configProperties, plainConfigProperties);
throws ClassNotFoundException, ValidateException if (annotation.isOnField()) Class clz = Class.forName(annotation.getClassName(), true, classLoader); Field field = SecurityActions.getDeclaredField(clz, annotation.getMemberName()); else if (annotation.isOnMethod()) Class clz = Class.forName(annotation.getClassName(), true, classLoader); if (annotation.getParameterTypes() != null) parameters = new Class[annotation.getParameterTypes().size()]; for (int i = 0; i < annotation.getParameterTypes().size(); i++) String parameter = annotation.getParameterTypes().get(i); parameters[i] = Class.forName(parameter, true, classLoader); Method method = SecurityActions.getDeclaredMethod(clz, annotation.getMemberName(), parameters);
throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException if (annotation.isOnField()) return annotation.getMemberName(); else if (annotation.isOnMethod()) String name = annotation.getMemberName();
.getAnnotation(javax.resource.spi.ConnectionDefinition.class); if (values != null)
AnnotationScanner scanner = AnnotationScannerFactory.getAnnotationScanner(); AnnotationRepository repository = scanner.scan(cl.getURLs(), cl); cmd = annotator.merge(cmd, repository, cl);
Collection<Annotation> values = annotationRepository.getAnnotation(javax.resource.spi.Connector.class); if (values != null) String raClass = annotation.getClassName(); javax.resource.spi.Connector connectorAnnotation = (javax.resource.spi.Connector)annotation.getAnnotation();
if (annotation.getClassName().equals(((ConfigPropertyImpl) configProperty).getAttachedClassName())) Set<String> asClasses = getClasses(annotation.getClassName(), classLoader); for (ConfigProperty configProperty : plainConfigProperties) Activation activation = (Activation) annotation.getAnnotation(); ArrayList<MessageListener> messageListeners = null; if (trace) for (Class asClass : activation.messageListeners()) Activationspec asMeta = new ActivationSpecImpl(new XsdString(annotation.getClassName(), null), requiredConfigProperties, validProperties,
/** * Process: @Activation * @param annotationRepository The annotation repository * @param classLoader The class loader * @param configProperties The config properties * @param plainConfigProperties The plain config properties * @return The updated metadata * @exception Exception Thrown if an error occurs */ private InboundResourceAdapter processActivation(AnnotationRepository annotationRepository, ClassLoader classLoader, ArrayList<ConfigProperty> configProperties, ArrayList<ConfigProperty> plainConfigProperties) throws Exception { ArrayList<MessageListener> listeners = new ArrayList<MessageListener>(); Collection<Annotation> values = annotationRepository.getAnnotation(Activation.class); if (values != null) { for (Annotation annotation : values) { listeners.addAll(attachActivation(annotation, classLoader, configProperties, plainConfigProperties)); } listeners.trimToSize(); } return new InboundResourceAdapterImpl(new MessageAdapterImpl(listeners, null), null); }
AnnotationScanner scanner = AnnotationScannerFactory.getAnnotationScanner(); AnnotationRepository repository = scanner.scan(cl.getURLs(), cl); cmd = annotator.merge(cmd, repository, cl);
Collection<Annotation> values = annotationRepository.getAnnotation(javax.resource.spi.ConfigProperty.class); if (values != null) .getAnnotation(); String attachedClassName = annotation.getClassName(); Class attachedClass = Class.forName(attachedClassName, true, classLoader);
Collection<Annotation> values = annotationRepository.getAnnotation(AdministeredObject.class); if (values != null) for (Annotation annotation : values) AdministeredObject a = (AdministeredObject) annotation.getAnnotation(); String aoClassName = annotation.getClassName(); Class<?> aClass = Class.forName(aoClassName, true, classLoader); List<Class<?>> declaredInterfaces = null;