Java Code Examples for org.springframework.data.config.ParsingUtils

The following examples show how to use org.springframework.data.config.ParsingUtils. 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
Source Project: sdn-rx   Source File: Neo4jAuditingRegistrar.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void registerAuditListenerBeanDefinition(BeanDefinition auditingHandlerDefinition,
	BeanDefinitionRegistry registry) {

	Assert.notNull(auditingHandlerDefinition, "BeanDefinition must not be null!");
	Assert.notNull(registry, "BeanDefinitionRegistry must not be null!");

	BeanDefinitionBuilder listenerBeanDefinitionBuilder = BeanDefinitionBuilder
		.rootBeanDefinition(AuditingBeforeBindCallback.class);
	listenerBeanDefinitionBuilder
		.addConstructorArgValue(
			ParsingUtils.getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), registry));

	registerInfrastructureBeanWithId(listenerBeanDefinitionBuilder.getBeanDefinition(),
		AuditingBeforeBindCallback.class.getName(), registry);

	if (PROJECT_REACTOR_AVAILABLE) {
		registerReactiveAuditingEntityCallback(registry, auditingHandlerDefinition.getSource());
	}
}
 
Example 2
Source Project: spring-data   Source File: ArangoAuditingRegistrar.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void registerAuditListenerBeanDefinition(
	final BeanDefinition auditingHandlerDefinition,
	final BeanDefinitionRegistry registry) {

	Assert.notNull(auditingHandlerDefinition, "BeanDefinition must not be null!");
	Assert.notNull(registry, "BeanDefinitionRegistry must not be null!");

	final BeanDefinitionBuilder listenerBeanDefinitionBuilder = BeanDefinitionBuilder
			.rootBeanDefinition(AuditingEventListener.class);
	listenerBeanDefinitionBuilder.addConstructorArgValue(
		ParsingUtils.getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), registry));

	registerInfrastructureBeanWithId(listenerBeanDefinitionBuilder.getBeanDefinition(),
		AuditingEventListener.class.getName(), registry);
}
 
Example 3
@Override
protected void registerAuditListenerBeanDefinition(
		BeanDefinition auditingHandlerDefinition, BeanDefinitionRegistry registry) {
	if (!registry.containsBeanDefinition(MYBATIS_MAPPING_CONTEXT_BEAN_NAME)) {
		registry.registerBeanDefinition(MYBATIS_MAPPING_CONTEXT_BEAN_NAME, //
				new RootBeanDefinition(MybatisMappingContextFactoryBean.class));
	}
	BeanDefinitionBuilder builder = BeanDefinitionBuilder
			.rootBeanDefinition(AuditingEntityListener.class);
	builder.addPropertyValue("auditingHandler", ParsingUtils
			.getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), null));
	builder.addPropertyReference("sqlSessionTemplate",
			DEFAULT_SQL_SESSION_TEMPLATE_BEAN_NAME);
	registerInfrastructureBeanWithId(builder.getRawBeanDefinition(),
			AuditingEntityListener.class.getName(), registry);
}
 
Example 4
@Override
public BeanDefinition parse(Element element, ParserContext parser) {
	auditingHandlerParser.parse(element, parser);

	Object source = parser.getReaderContext().extractSource(element);

	BeanDefinitionBuilder builder = rootBeanDefinition(
			AUDITING_ENTITY_LISTENER_CLASS_NAME);
	builder.addPropertyValue("auditingHandler",
			ParsingUtils.getObjectFactoryBeanDefinition(
					auditingHandlerParser.getResolvedBeanName(), source));
	builder.addPropertyReference("sqlSessionTemplate",
			DEFAULT_SQL_SESSION_TEMPLATE_BEAN_NAME);
	// builder.setScope("prototype");

	registerInfrastructureBeanWithId(builder.getRawBeanDefinition(),
			AUDITING_ENTITY_LISTENER_CLASS_NAME, parser, element);

	return null;
}
 
Example 5
Source Project: sdn-rx   Source File: Neo4jAuditingRegistrar.java    License: Apache License 2.0 5 votes vote down vote up
private void registerReactiveAuditingEntityCallback(BeanDefinitionRegistry registry, Object source) {

		BeanDefinitionBuilder builder = BeanDefinitionBuilder
			.rootBeanDefinition(ReactiveAuditingBeforeBindCallback.class);

		builder.addConstructorArgValue(
			ParsingUtils.getObjectFactoryBeanDefinition(getAuditingHandlerBeanName(), registry));
		builder.getRawBeanDefinition().setSource(source);

		registerInfrastructureBeanWithId(builder.getBeanDefinition(),
			ReactiveAuditingBeforeBindCallback.class.getName(), registry);
	}
 
Example 6
@Override
public void postProcess(BeanDefinitionBuilder builder,
		XmlRepositoryConfigurationSource config) {
	Element element = config.getElement();

	ParsingUtils.setPropertyReference(builder, element, "datastore-template-ref",
			"datastoreTemplate");
	ParsingUtils.setPropertyReference(builder, element,
			"datastore-mapping-context-ref", "datastoreMappingContext");
}
 
Example 7
@Override
public void postProcess(BeanDefinitionBuilder builder,
		XmlRepositoryConfigurationSource config) {
	Element element = config.getElement();

	ParsingUtils.setPropertyReference(builder, element, "spanner-template-ref",
			"spannerTemplate");
	ParsingUtils.setPropertyReference(builder, element, "spanner-mapping-context-ref",
			"spannerMappingContext");
}
 
Example 8
@Override
public void postProcess(BeanDefinitionBuilder builder,
		XmlRepositoryConfigurationSource config) {
	Element element = config.getElement();

	ParsingUtils.setPropertyReference(builder, element, "firestore-template-ref",
			"firestoreTemplate");
	ParsingUtils.setPropertyReference(builder, element, "firestore-mapping-context-ref",
			"firestoreMappingContext");
}
 
Example 9
@Override
protected AbstractBeanDefinition getDefaultKeyValueTemplateBeanDefinition(
		RepositoryConfigurationSource configurationSource) {

	BeanDefinitionBuilder adapterBuilder = BeanDefinitionBuilder.rootBeanDefinition(MapKeyValueAdapter.class);
	adapterBuilder.addConstructorArgValue(getMapTypeToUse(configurationSource));

	BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(KeyValueTemplate.class);
	builder
			.addConstructorArgValue(ParsingUtils.getSourceBeanDefinition(adapterBuilder, configurationSource.getSource()));
	builder.setRole(BeanDefinition.ROLE_SUPPORT);

	return ParsingUtils.getSourceBeanDefinition(builder, configurationSource.getSource());
}
 
Example 10
private void registerStoreFragment(BeanDefinitionRegistry registry, AnnotationMetadata source, StoreFragmentDefinition fragmentDefinition) {

		String implementationBeanName = fragmentDefinition.getImplementationBeanName();
		String fragmentBeanName = fragmentDefinition.getFragmentBeanName();

		if (registry.containsBeanDefinition(fragmentBeanName)) {
			return;
		}

		BeanDefinitionBuilder fragmentBuilder = BeanDefinitionBuilder.genericBeanDefinition(StoreFragment.class);

		fragmentBuilder.addConstructorArgValue(fragmentDefinition.getInterfaceName());
		fragmentBuilder.addConstructorArgReference(implementationBeanName);

		registry.registerBeanDefinition(fragmentBeanName, ParsingUtils.getSourceBeanDefinition(fragmentBuilder, source));
	}
 
Example 11
@Override
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {
	Element element = config.getElement();
	ParsingUtils.setPropertyReference(builder, element, SIMPLEDB_TEMPLATE_REF, "simpleDbOperations");
}
 
Example 12
@Override
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {

	Element element = config.getElement();

	ParsingUtils.setPropertyReference(builder, element, AMAZON_DYNAMODB_REF, "amazonDynamoDB");
	ParsingUtils.setPropertyReference(builder, element, DYNAMO_DB_MAPPER_CONFIG_REF, "dynamoDBMapperConfig");
	ParsingUtils.setPropertyReference(builder, element, DYNAMO_DB_OPERATIONS_REF, "dynamoDBOperations");


}