Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2002-2013 the original author or authors.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package org.springframework.data.gemfire.function.config;
org.springframework.context.annotation.ImportBeanDefinitionRegistrar for {code}

Author(s):
David Turanski
EnableGemfireFunctionExecutions:
{code} Scans for interfaces annotated with one of {code} @OnRegion, @OnServer, @OnServers, @OnMember, @OnMembers {code}
	/* (non-Javadoc)
	 * @see org.springframework.context.annotation.ImportBeanDefinitionRegistrar#registerBeanDefinitions(org.springframework.core.type.AnnotationMetadata, org.springframework.beans.factory.support.BeanDefinitionRegistry)
	 */
	public void registerBeanDefinitions(AnnotationMetadata annotationMetadataBeanDefinitionRegistry registry) {
				annotationMetadata);
		registerBeanDefinitions(configurationSourceregistry);
	}
	/*
	 * This registers bean definitions from any function execution configuration source
	 */
		ResourceLoader resourceLoader = new DefaultResourceLoader();
		Set<StringfunctionExecutionAnnotationTypes = new HashSet<String>(
				AnnotationFunctionExecutionConfigurationSource.getFunctionExecutionAnnotationTypes().size());
		for (Class<?> annotation : AbstractFunctionExecutionConfigurationSource.getFunctionExecutionAnnotationTypes()) {
			functionExecutionAnnotationTypes.add(annotation.getName());
		}
		for (ScannedGenericBeanDefinition beanDefinition : configurationSource.getCandidates(resourceLoader)) {
			String functionExecutionAnnotation = getFunctionExecutionAnnotation(beanDefinition,
					functionExecutionAnnotationTypes);
			Assert.notNull(functionExecutionAnnotation);
			String beanName = (StringbeanDefinition.getMetadata()
					.getAnnotationAttributes(functionExecutionAnnotation).get("id");
			if (!StringUtils.hasLength(beanName)) {
				beanName = BeanDefinitionReaderUtils.generateBeanName(beanDefinitionregistry);
			}
			AbstractFunctionExecutionBeanDefinitionBuilder builder = FunctionExecutionBeanDefinitionBuilderFactory
					.newInstance(new FunctionExecutionConfiguration(beanDefinitionfunctionExecutionAnnotation));
			registry.registerBeanDefinition(beanNamebuilder.build(registry));
		}
	}
			Set<StringfunctionExecutionAnnotationTypes) {
		Set<StringannotationTypes = beanDefinition.getMetadata().getAnnotationTypes();
		String functionExecutionAnnotation = null;
		for (String annotation : annotationTypes) {
			if (functionExecutionAnnotationTypes.contains(annotation)) {
				Assert.isNull(functionExecutionAnnotation, String.format(
						"interface %s contains multiple function execution annotations: %s, %s",
						beanDefinition.getBeanClassName(), functionExecutionAnnotationannotation));
				functionExecutionAnnotation = annotation;
			}
		}
		return functionExecutionAnnotation;
	}
	 
New to GrepCode? Check out our FAQ X