org.springframework.data.config.ParsingUtils Java Examples

The following examples show how to use org.springframework.data.config.ParsingUtils. 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 File: Neo4jAuditingRegistrar.java    From sdn-rx with 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 File: ArangoAuditingRegistrar.java    From spring-data with 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
Source File: MybatisAuditingRegistrar.java    From spring-data-mybatis with Apache License 2.0 6 votes vote down vote up
@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
Source File: AuditingBeanDefinitionParser.java    From spring-data-mybatis with Apache License 2.0 6 votes vote down vote up
@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 File: Neo4jAuditingRegistrar.java    From sdn-rx with 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
Source File: DatastoreRepositoryConfigurationExtension.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@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
Source File: SpannerRepositoryConfigurationExtension.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@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
Source File: FirestoreRepositoryConfigurationExtension.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@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
Source File: MapRepositoryConfigurationExtension.java    From spring-data-keyvalue with Apache License 2.0 5 votes vote down vote up
@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
Source File: AbstractStoreBeanDefinitionRegistrar.java    From spring-content with Apache License 2.0 4 votes vote down vote up
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
Source File: SimpleDbRepositoryConfigExtension.java    From spring-data-simpledb with MIT License 4 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {
	Element element = config.getElement();
	ParsingUtils.setPropertyReference(builder, element, SIMPLEDB_TEMPLATE_REF, "simpleDbOperations");
}
 
Example #12
Source File: DynamoDBRepositoryConfigExtension.java    From spring-data-dynamodb with Apache License 2.0 3 votes vote down vote up
@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");


}