Java Code Examples for org.springframework.beans.BeanMetadataElement

The following examples show how to use org.springframework.beans.BeanMetadataElement. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Convert from an internal Spring bean definition to a DTO.
 * 
 * @param beanDefinition The internal Spring bean definition.
 * @return Returns a DTO representation.
 */
public BeanDefinitionInfo toDto(BeanDefinition beanDefinition) {
	if (beanDefinition instanceof GenericBeanDefinition) {
		GenericBeanDefinitionInfo info = new GenericBeanDefinitionInfo();
		info.setClassName(beanDefinition.getBeanClassName());

		if (beanDefinition.getPropertyValues() != null) {
			Map<String, BeanMetadataElementInfo> propertyValues = new HashMap<String, BeanMetadataElementInfo>();
			for (PropertyValue value : beanDefinition.getPropertyValues().getPropertyValueList()) {
				Object obj = value.getValue();
				if (obj instanceof BeanMetadataElement) {
					propertyValues.put(value.getName(), toDto((BeanMetadataElement) obj));
				} else {
					throw new IllegalArgumentException("Type " + obj.getClass().getName()
							+ " is not a BeanMetadataElement for property: " + value.getName());
				}
			}
			info.setPropertyValues(propertyValues);
		}
		return info;
	} else {
		throw new IllegalArgumentException("Conversion to DTO of " + beanDefinition.getClass().getName()
				+ " not implemented");
	}
}
 
Example 2
private static BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);

	boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
	boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");

	ManagedList<BeanMetadataElement> delegates = new ManagedList<>();
	for (Element scriptElement : scripts) {
		String executionAttr = scriptElement.getAttribute("execution");
		if (!StringUtils.hasText(executionAttr)) {
			executionAttr = "INIT";
		}
		if (!execution.equals(executionAttr)) {
			continue;
		}
		BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
		delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
		delegate.addPropertyValue("continueOnError", continueOnError);

		// Use a factory bean for the resources so they can be given an order if a pattern is used
		BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
		resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
		delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
		if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
			delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
		}
		String separator = getSeparator(element, scriptElement);
		if (separator != null) {
			delegate.addPropertyValue("separator", new TypedStringValue(separator));
		}
		delegates.add(delegate.getBeanDefinition());
	}
	builder.addPropertyValue("populators", delegates);

	return builder.getBeanDefinition();
}
 
Example 3
Source Project: spring-analysis-note   Source File: ConstructorResolver.java    License: MIT License 5 votes vote down vote up
/**
 * Resolve the prepared arguments stored in the given bean definition.
 */
private Object[] resolvePreparedArguments(String beanName, RootBeanDefinition mbd, BeanWrapper bw,
		Executable executable, Object[] argsToResolve, boolean fallback) {

	TypeConverter customConverter = this.beanFactory.getCustomTypeConverter();
	TypeConverter converter = (customConverter != null ? customConverter : bw);
	BeanDefinitionValueResolver valueResolver =
			new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
	Class<?>[] paramTypes = executable.getParameterTypes();

	Object[] resolvedArgs = new Object[argsToResolve.length];
	for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
		Object argValue = argsToResolve[argIndex];
		MethodParameter methodParam = MethodParameter.forExecutable(executable, argIndex);
		GenericTypeResolver.resolveParameterType(methodParam, executable.getDeclaringClass());
		if (argValue instanceof AutowiredArgumentMarker) {
			argValue = resolveAutowiredArgument(methodParam, beanName, null, converter, fallback);
		}
		else if (argValue instanceof BeanMetadataElement) {
			argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
		}
		else if (argValue instanceof String) {
			argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
		}
		Class<?> paramType = paramTypes[argIndex];
		try {
			resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
		}
		catch (TypeMismatchException ex) {
			throw new UnsatisfiedDependencyException(
					mbd.getResourceDescription(), beanName, new InjectionPoint(methodParam),
					"Could not convert argument value of type [" + ObjectUtils.nullSafeClassName(argValue) +
					"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
		}
	}
	return resolvedArgs;
}
 
Example 4
private static BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);

	boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
	boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");

	ManagedList<BeanMetadataElement> delegates = new ManagedList<>();
	for (Element scriptElement : scripts) {
		String executionAttr = scriptElement.getAttribute("execution");
		if (!StringUtils.hasText(executionAttr)) {
			executionAttr = "INIT";
		}
		if (!execution.equals(executionAttr)) {
			continue;
		}
		BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
		delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
		delegate.addPropertyValue("continueOnError", continueOnError);

		// Use a factory bean for the resources so they can be given an order if a pattern is used
		BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
		resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
		delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
		if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
			delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
		}
		String separator = getSeparator(element, scriptElement);
		if (separator != null) {
			delegate.addPropertyValue("separator", new TypedStringValue(separator));
		}
		delegates.add(delegate.getBeanDefinition());
	}
	builder.addPropertyValue("populators", delegates);

	return builder.getBeanDefinition();
}
 
Example 5
Source Project: java-technology-stack   Source File: ConstructorResolver.java    License: MIT License 5 votes vote down vote up
/**
 * Resolve the prepared arguments stored in the given bean definition.
 */
private Object[] resolvePreparedArguments(String beanName, RootBeanDefinition mbd, BeanWrapper bw,
		Executable executable, Object[] argsToResolve, boolean fallback) {

	TypeConverter customConverter = this.beanFactory.getCustomTypeConverter();
	TypeConverter converter = (customConverter != null ? customConverter : bw);
	BeanDefinitionValueResolver valueResolver =
			new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
	Class<?>[] paramTypes = executable.getParameterTypes();

	Object[] resolvedArgs = new Object[argsToResolve.length];
	for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
		Object argValue = argsToResolve[argIndex];
		MethodParameter methodParam = MethodParameter.forExecutable(executable, argIndex);
		GenericTypeResolver.resolveParameterType(methodParam, executable.getDeclaringClass());
		if (argValue instanceof AutowiredArgumentMarker) {
			argValue = resolveAutowiredArgument(methodParam, beanName, null, converter, fallback);
		}
		else if (argValue instanceof BeanMetadataElement) {
			argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
		}
		else if (argValue instanceof String) {
			argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
		}
		Class<?> paramType = paramTypes[argIndex];
		try {
			resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
		}
		catch (TypeMismatchException ex) {
			throw new UnsatisfiedDependencyException(
					mbd.getResourceDescription(), beanName, new InjectionPoint(methodParam),
					"Could not convert argument value of type [" + ObjectUtils.nullSafeClassName(argValue) +
					"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
		}
	}
	return resolvedArgs;
}
 
Example 6
static private BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);

	boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
	boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");

	ManagedList<BeanMetadataElement> delegates = new ManagedList<BeanMetadataElement>();
	for (Element scriptElement : scripts) {
		String executionAttr = scriptElement.getAttribute("execution");
		if (!StringUtils.hasText(executionAttr)) {
			executionAttr = "INIT";
		}
		if (!execution.equals(executionAttr)) {
			continue;
		}
		BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
		delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
		delegate.addPropertyValue("continueOnError", continueOnError);

		// Use a factory bean for the resources so they can be given an order if a pattern is used
		BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
		resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
		delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
		if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
			delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
		}
		String separator = getSeparator(element, scriptElement);
		if (separator != null) {
			delegate.addPropertyValue("separator", new TypedStringValue(separator));
		}
		delegates.add(delegate.getBeanDefinition());
	}
	builder.addPropertyValue("populators", delegates);

	return builder.getBeanDefinition();
}
 
Example 7
Source Project: lams   Source File: ConstructorResolver.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Resolve the prepared arguments stored in the given bean definition.
 */
private Object[] resolvePreparedArguments(
		String beanName, RootBeanDefinition mbd, BeanWrapper bw, Member methodOrCtor, Object[] argsToResolve) {

	TypeConverter customConverter = this.beanFactory.getCustomTypeConverter();
	TypeConverter converter = (customConverter != null ? customConverter : bw);
	BeanDefinitionValueResolver valueResolver =
			new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
	Class<?>[] paramTypes = (methodOrCtor instanceof Method ?
			((Method) methodOrCtor).getParameterTypes() : ((Constructor<?>) methodOrCtor).getParameterTypes());

	Object[] resolvedArgs = new Object[argsToResolve.length];
	for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
		Object argValue = argsToResolve[argIndex];
		MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, argIndex);
		GenericTypeResolver.resolveParameterType(methodParam, methodOrCtor.getDeclaringClass());
		if (argValue instanceof AutowiredArgumentMarker) {
			argValue = resolveAutowiredArgument(methodParam, beanName, null, converter);
		}
		else if (argValue instanceof BeanMetadataElement) {
			argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
		}
		else if (argValue instanceof String) {
			argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
		}
		Class<?> paramType = paramTypes[argIndex];
		try {
			resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
		}
		catch (TypeMismatchException ex) {
			throw new UnsatisfiedDependencyException(
					mbd.getResourceDescription(), beanName, new InjectionPoint(methodParam),
					"Could not convert argument value of type [" + ObjectUtils.nullSafeClassName(argValue) +
					"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
		}
	}
	return resolvedArgs;
}
 
Example 8
Source Project: blog_demos   Source File: ConstructorResolver.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Resolve the prepared arguments stored in the given bean definition.
 */
private Object[] resolvePreparedArguments(
		String beanName, RootBeanDefinition mbd, BeanWrapper bw, Member methodOrCtor, Object[] argsToResolve) {

	Class<?>[] paramTypes = (methodOrCtor instanceof Method ?
			((Method) methodOrCtor).getParameterTypes() : ((Constructor<?>) methodOrCtor).getParameterTypes());
	TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ?
			this.beanFactory.getCustomTypeConverter() : bw);
	BeanDefinitionValueResolver valueResolver =
			new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
	Object[] resolvedArgs = new Object[argsToResolve.length];
	for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
		Object argValue = argsToResolve[argIndex];
		MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, argIndex);
		GenericTypeResolver.resolveParameterType(methodParam, methodOrCtor.getDeclaringClass());
		if (argValue instanceof AutowiredArgumentMarker) {
			argValue = resolveAutowiredArgument(methodParam, beanName, null, converter);
		}
		else if (argValue instanceof BeanMetadataElement) {
			argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
		}
		else if (argValue instanceof String) {
			argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
		}
		Class<?> paramType = paramTypes[argIndex];
		try {
			resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
		}
		catch (TypeMismatchException ex) {
			String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method");
			throw new UnsatisfiedDependencyException(
					mbd.getResourceDescription(), beanName, argIndex, paramType,
					"Could not convert " + methodType + " argument value of type [" +
					ObjectUtils.nullSafeClassName(argValue) +
					"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
		}
	}
	return resolvedArgs;
}
 
Example 9
static private BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);

	boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
	boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");

	ManagedList<BeanMetadataElement> delegates = new ManagedList<BeanMetadataElement>();
	for (Element scriptElement : scripts) {
		String executionAttr = scriptElement.getAttribute("execution");
		if (!StringUtils.hasText(executionAttr)) {
			executionAttr = "INIT";
		}
		if (!execution.equals(executionAttr)) {
			continue;
		}
		BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
		delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
		delegate.addPropertyValue("continueOnError", continueOnError);

		// Use a factory bean for the resources so they can be given an order if a pattern is used
		BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
		resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
		delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
		if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
			delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
		}
		if (StringUtils.hasLength(scriptElement.getAttribute("separator"))) {
			delegate.addPropertyValue("separator", new TypedStringValue(scriptElement.getAttribute("separator")));
		}
		delegates.add(delegate.getBeanDefinition());
	}
	builder.addPropertyValue("populators", delegates);

	return builder.getBeanDefinition();
}
 
Example 10
Source Project: spring4-understanding   Source File: ConstructorResolver.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Resolve the prepared arguments stored in the given bean definition.
 */
private Object[] resolvePreparedArguments(
		String beanName, RootBeanDefinition mbd, BeanWrapper bw, Member methodOrCtor, Object[] argsToResolve) {

	Class<?>[] paramTypes = (methodOrCtor instanceof Method ?
			((Method) methodOrCtor).getParameterTypes() : ((Constructor<?>) methodOrCtor).getParameterTypes());
	TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ?
			this.beanFactory.getCustomTypeConverter() : bw);
	BeanDefinitionValueResolver valueResolver =
			new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
	Object[] resolvedArgs = new Object[argsToResolve.length];
	for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
		Object argValue = argsToResolve[argIndex];
		MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, argIndex);
		GenericTypeResolver.resolveParameterType(methodParam, methodOrCtor.getDeclaringClass());
		if (argValue instanceof AutowiredArgumentMarker) {
			argValue = resolveAutowiredArgument(methodParam, beanName, null, converter);
		}
		else if (argValue instanceof BeanMetadataElement) {
			argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
		}
		else if (argValue instanceof String) {
			argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
		}
		Class<?> paramType = paramTypes[argIndex];
		try {
			resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
		}
		catch (TypeMismatchException ex) {
			String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method");
			throw new UnsatisfiedDependencyException(
					mbd.getResourceDescription(), beanName, argIndex, paramType,
					"Could not convert " + methodType + " argument value of type [" +
					ObjectUtils.nullSafeClassName(argValue) +
					"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
		}
	}
	return resolvedArgs;
}
 
Example 11
Source Project: riptide   Source File: DefaultRiptideRegistrar.java    License: MIT License 5 votes vote down vote up
private List<BeanMetadataElement> registerRetryTagGenerator(final Client client) {
    if (client.getRetry().getEnabled()) {
        return list(genericBeanDefinition(RetryTagGenerator.class)
                .getBeanDefinition());
    } else {
        return list();
    }
}
 
Example 12
Source Project: riptide   Source File: DefaultRiptideRegistrar.java    License: MIT License 5 votes vote down vote up
private BeanMetadataElement registerCircuitBreaker(final String id, final Client client) {
    return ref(registry.registerIfAbsent(id, CircuitBreaker.class, () ->
            genericBeanDefinition(FailsafePluginFactory.class)
                    .setFactoryMethod("createCircuitBreaker")
                    .addConstructorArgValue(client)
                    .addConstructorArgReference(registerCircuitBreakerListener(id, client))));
}
 
Example 13
Source Project: riptide   Source File: DefaultRiptideRegistrar.java    License: MIT License 5 votes vote down vote up
private List<BeanMetadataElement> configureFirstRequestInterceptors(final String id, final Client client) {
    final List<BeanMetadataElement> interceptors = list();

    if (client.getTracing().getEnabled() && client.getTracing().getPropagateFlowId()) {
        log.debug("Client [{}]: Registering FlowHttpRequestInterceptor", id);
        interceptors.add(ref("flowHttpRequestInterceptor"));
    }

    return interceptors;
}
 
Example 14
Source Project: riptide   Source File: DefaultRiptideConfigurer.java    License: MIT License 5 votes vote down vote up
void register() {
    final Map<String, BeanMetadataElement> replacements = replacements();

    Arrays.stream(beanFactory.getBeanDefinitionNames())
            .map(beanFactory::getBeanDefinition)
            .map(BeanDefinition::getConstructorArgumentValues)
            .map(ConstructorArgumentValues::getIndexedArgumentValues)
            .map(Map::values)
            .flatMap(Collection::stream)
            .forEach(holder -> replaceRefs(holder, replacements));
}
 
Example 15
Source Project: riptide   Source File: DefaultRiptideConfigurer.java    License: MIT License 5 votes vote down vote up
private void replaceRefs(final ValueHolder holder, final Map<String, BeanMetadataElement> replacements) {
    Optional.ofNullable(holder.getValue())
            .filter(String.class::isInstance)
            .map(String.class::cast)
            .map(replacements::get)
            .ifPresent(holder::setValue);
}
 
Example 16
static private BeanDefinition createDatabasePopulator(Element element, List<Element> scripts, String execution) {
	BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CompositeDatabasePopulator.class);

	boolean ignoreFailedDrops = element.getAttribute("ignore-failures").equals("DROPS");
	boolean continueOnError = element.getAttribute("ignore-failures").equals("ALL");

	ManagedList<BeanMetadataElement> delegates = new ManagedList<BeanMetadataElement>();
	for (Element scriptElement : scripts) {
		String executionAttr = scriptElement.getAttribute("execution");
		if (!StringUtils.hasText(executionAttr)) {
			executionAttr = "INIT";
		}
		if (!execution.equals(executionAttr)) {
			continue;
		}
		BeanDefinitionBuilder delegate = BeanDefinitionBuilder.genericBeanDefinition(ResourceDatabasePopulator.class);
		delegate.addPropertyValue("ignoreFailedDrops", ignoreFailedDrops);
		delegate.addPropertyValue("continueOnError", continueOnError);

		// Use a factory bean for the resources so they can be given an order if a pattern is used
		BeanDefinitionBuilder resourcesFactory = BeanDefinitionBuilder.genericBeanDefinition(SortedResourcesFactoryBean.class);
		resourcesFactory.addConstructorArgValue(new TypedStringValue(scriptElement.getAttribute("location")));
		delegate.addPropertyValue("scripts", resourcesFactory.getBeanDefinition());
		if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) {
			delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding")));
		}
		if (StringUtils.hasLength(scriptElement.getAttribute("separator"))) {
			delegate.addPropertyValue("separator", new TypedStringValue(scriptElement.getAttribute("separator")));
		}
		delegates.add(delegate.getBeanDefinition());
	}
	builder.addPropertyValue("populators", delegates);

	return builder.getBeanDefinition();
}
 
Example 17
public BeanMetadataElement createBeanMetadataElementByIntrospection(Object object) {
	return createMetadataElementByIntrospection(object, new NamedBeanMap(), conversionService);
}
 
Example 18
public BeanMetadataElement createBeanMetadataElementByIntrospection(Object object,
		ConversionService conversionService) {
	return createBeanDefinitionByIntrospection(object, new NamedBeanMap(), conversionService);
}
 
Example 19
public BeanMetadataElement createBeanMetadataElementByIntrospection(Object object,
		ConversionService conversionService, List<NamedObject> objectList) {
	NamedBeanMap refs = new NamedBeanMap(objectList);
	return createMetadataElementByIntrospection(object, refs, conversionService);
}
 
Example 20
public BeanMetadataElement createBeanMetadataElementByIntrospection(Object object, List<NamedObject> objectList) {
	NamedBeanMap refs = new NamedBeanMap(objectList);
	return createMetadataElementByIntrospection(object, refs, conversionService);
}
 
Example 21
@Override
protected AbstractBeanDefinition doParse(Element element,
		ParserContext parserContext, String channelName) {

	AbstractBeanDefinition beanDefinitition = null;

	final BeanDefinitionBuilder sqsAdapterBuilder = BeanDefinitionBuilder
			.genericBeanDefinition(SqsSubscribableChannelAdapter.class);

	// create and set sqsExecutor
	final BeanDefinitionBuilder sqsExecutorBuilder = SqsParserUtils
			.getSqsExecutorBuilder(element, parserContext);

	final BeanDefinition sqsExecutorBuilderBeanDefinition = sqsExecutorBuilder
			.getBeanDefinition();
	final String channelAdapterId = this.resolveId(element,
			sqsAdapterBuilder.getRawBeanDefinition(), parserContext);
	final String sqsExecutorBeanName = SqsParserUtils
			.getExecutorBeanName(channelAdapterId);

	parserContext.registerBeanComponent(new BeanComponentDefinition(
			sqsExecutorBuilderBeanDefinition, sqsExecutorBeanName));

	sqsAdapterBuilder.addPropertyReference("sqsExecutor",
			sqsExecutorBeanName);

	SqsParserUtils.registerExecutorProxy(element, sqsExecutorBeanName,
			parserContext);
	// ---

	// Core messaging properties
	sqsAdapterBuilder.addPropertyReference("outputChannel", channelName);
	IntegrationNamespaceUtils.setValueIfAttributeDefined(sqsAdapterBuilder,
			element, "send-timeout");
	IntegrationNamespaceUtils.setValueIfAttributeDefined(sqsAdapterBuilder,
			element, "auto-startup");
	IntegrationNamespaceUtils.setValueIfAttributeDefined(sqsAdapterBuilder,
			element, "phase");
	// ---

	IntegrationNamespaceUtils.setValueIfAttributeDefined(sqsAdapterBuilder,
			element, "worker-shutdown-timeout");

	Element pollerElement = DomUtils.getChildElementByTagName(element,
			"poller");

	if (pollerElement == null) {
		IntegrationNamespaceUtils.setValueIfAttributeDefined(
				sqsAdapterBuilder, element, "concurrent-consumers");

		beanDefinitition = sqsAdapterBuilder.getBeanDefinition();

	} else {
		sqsAdapterBuilder.addPropertyValue("pollableMode", Boolean.TRUE);

		BeanMetadataElement source = sqsAdapterBuilder.getBeanDefinition();
		if (source == null) {
			parserContext.getReaderContext().error(
					"failed to parse source", element);
		}
		BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder
				.genericBeanDefinition(SourcePollingChannelAdapterFactoryBean.class);
		adapterBuilder.addPropertyValue("source", source);
		adapterBuilder.addPropertyReference("outputChannel", channelName);
		IntegrationNamespaceUtils.setValueIfAttributeDefined(
				adapterBuilder, element, "send-timeout");
		IntegrationNamespaceUtils.setValueIfAttributeDefined(
				adapterBuilder, element, "auto-startup");
		IntegrationNamespaceUtils.configurePollerMetadata(pollerElement,
				adapterBuilder, parserContext);

		beanDefinitition = adapterBuilder.getBeanDefinition();
	}

	AwsParserUtils.registerPermissions(element, sqsExecutorBuilder,
			parserContext);

	return beanDefinitition;
}
 
Example 22
/**
 * Convert from a DTO to an internal Spring bean definition.
 * 
 * @param beanDefinitionDto The DTO object.
 * @return Returns a Spring bean definition.
 */
BeanMetadataElement toInternal(BeanMetadataElementInfo elementInfo);
 
Example 23
/**
 * Creates a bean metadata element by introspecting a Java beans object.
 * 
 * @param object the object to introspect
 * @param conversionService the conversion service to be used to convert simple object types to string
 * @return the bean definition
 */
BeanMetadataElement createBeanMetadataElementByIntrospection(Object object, ConversionService conversionService);
 
Example 24
/**
 * Creates a bean metadata by introspecting a Java beans object.
 * 
 * @param object the object to introspect
 * @return the bean definition
 */
BeanMetadataElement createBeanMetadataElementByIntrospection(Object object);
 
Example 25
/**
 * Creates a bean metadata element by introspecting a Java beans object.
 * 
 * @param object the object to introspect
 * @param conversionService the conversion service to be used to convert simple object types to string
 * @return the bean definition
 */
BeanMetadataElement createBeanMetadataElementByIntrospection(Object object, ConversionService conversionService,
		List<NamedObject> objectList);
 
Example 26
/**
 * Creates a bean metadata by introspecting a Java beans object.
 * 
 * @param object the object to introspect
 * @return the bean definition
 */
BeanMetadataElement createBeanMetadataElementByIntrospection(Object object, List<NamedObject> objectList);