Skip to content

Commit b6366c0

Browse files
committed
DATAMONGO-1664 - Updated changelog.
1 parent b22fd05 commit b6366c0

40 files changed

+3324
-3307
lines changed

spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java

Lines changed: 212 additions & 212 deletions
Large diffs are not rendered by default.
Lines changed: 112 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,112 @@
1-
/*
2-
* Copyright 2011-2017 the original author or authors.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.springframework.data.mongodb.config;
17-
18-
import org.springframework.context.annotation.Bean;
19-
import org.springframework.context.annotation.Configuration;
20-
import org.springframework.data.mongodb.MongoDbFactory;
21-
import org.springframework.data.mongodb.core.MongoTemplate;
22-
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
23-
import org.springframework.data.mongodb.core.convert.DbRefResolver;
24-
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
25-
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
26-
import org.springframework.data.mongodb.core.mapping.Document;
27-
28-
import com.mongodb.MongoClient;
29-
30-
/**
31-
* Base class for Spring Data MongoDB configuration using JavaConfig.
32-
*
33-
* @author Mark Pollack
34-
* @author Oliver Gierke
35-
* @author Thomas Darimont
36-
* @author Ryan Tenney
37-
* @author Christoph Strobl
38-
* @author Mark Paluch
39-
* @see MongoConfigurationSupport
40-
*/
41-
@Configuration
42-
public abstract class
43-
AbstractMongoConfiguration extends MongoConfigurationSupport {
44-
45-
/**
46-
* Return the {@link MongoClient} instance to connect to. Annotate with {@link Bean} in case you want to expose a
47-
* {@link MongoClient} instance to the {@link org.springframework.context.ApplicationContext}.
48-
*
49-
* @return
50-
*/
51-
public abstract MongoClient mongoClient();
52-
53-
/**
54-
* Creates a {@link MongoTemplate}.
55-
*
56-
* @return
57-
*/
58-
@Bean
59-
public MongoTemplate mongoTemplate() throws Exception {
60-
return new MongoTemplate(mongoDbFactory(), mappingMongoConverter());
61-
}
62-
63-
/**
64-
* Creates a {@link SimpleMongoDbFactory} to be used by the {@link MongoTemplate}. Will use the {@link MongoClient}
65-
* instance configured in {@link #mongo()}.
66-
*
67-
* @see #mongoClient()
68-
* @see #mongoTemplate()
69-
* @return
70-
*/
71-
@Bean
72-
public MongoDbFactory mongoDbFactory() {
73-
return new SimpleMongoDbFactory(mongoClient(), getDatabaseName());
74-
}
75-
76-
/**
77-
* Return the base package to scan for mapped {@link Document}s. Will return the package name of the configuration
78-
* class' (the concrete class, not this one here) by default. So if you have a {@code com.acme.AppConfig} extending
79-
* {@link AbstractMongoConfiguration} the base package will be considered {@code com.acme} unless the method is
80-
* overridden to implement alternate behavior.
81-
*
82-
* @return the base package to scan for mapped {@link Document} classes or {@literal null} to not enable scanning for
83-
* entities.
84-
* @deprecated use {@link #getMappingBasePackages()} instead.
85-
*/
86-
@Deprecated
87-
protected String getMappingBasePackage() {
88-
89-
Package mappingBasePackage = getClass().getPackage();
90-
return mappingBasePackage == null ? null : mappingBasePackage.getName();
91-
}
92-
93-
/**
94-
* Creates a {@link MappingMongoConverter} using the configured {@link #mongoDbFactory()} and
95-
* {@link #mongoMappingContext()}. Will get {@link #customConversions()} applied.
96-
*
97-
* @see #customConversions()
98-
* @see #mongoMappingContext()
99-
* @see #mongoDbFactory()
100-
* @return
101-
* @throws Exception
102-
*/
103-
@Bean
104-
public MappingMongoConverter mappingMongoConverter() throws Exception {
105-
106-
DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory());
107-
MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mongoMappingContext());
108-
converter.setCustomConversions(customConversions());
109-
110-
return converter;
111-
}
112-
}
1+
/*
2+
* Copyright 2011-2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.mongodb.config;
17+
18+
import org.springframework.context.annotation.Bean;
19+
import org.springframework.context.annotation.Configuration;
20+
import org.springframework.data.mongodb.MongoDbFactory;
21+
import org.springframework.data.mongodb.core.MongoTemplate;
22+
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
23+
import org.springframework.data.mongodb.core.convert.DbRefResolver;
24+
import org.springframework.data.mongodb.core.convert.DefaultDbRefResolver;
25+
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
26+
import org.springframework.data.mongodb.core.mapping.Document;
27+
28+
import com.mongodb.MongoClient;
29+
30+
/**
31+
* Base class for Spring Data MongoDB configuration using JavaConfig.
32+
*
33+
* @author Mark Pollack
34+
* @author Oliver Gierke
35+
* @author Thomas Darimont
36+
* @author Ryan Tenney
37+
* @author Christoph Strobl
38+
* @author Mark Paluch
39+
* @see MongoConfigurationSupport
40+
*/
41+
@Configuration
42+
public abstract class
43+
AbstractMongoConfiguration extends MongoConfigurationSupport {
44+
45+
/**
46+
* Return the {@link MongoClient} instance to connect to. Annotate with {@link Bean} in case you want to expose a
47+
* {@link MongoClient} instance to the {@link org.springframework.context.ApplicationContext}.
48+
*
49+
* @return
50+
*/
51+
public abstract MongoClient mongoClient();
52+
53+
/**
54+
* Creates a {@link MongoTemplate}.
55+
*
56+
* @return
57+
*/
58+
@Bean
59+
public MongoTemplate mongoTemplate() throws Exception {
60+
return new MongoTemplate(mongoDbFactory(), mappingMongoConverter());
61+
}
62+
63+
/**
64+
* Creates a {@link SimpleMongoDbFactory} to be used by the {@link MongoTemplate}. Will use the {@link MongoClient}
65+
* instance configured in {@link #mongo()}.
66+
*
67+
* @see #mongoClient()
68+
* @see #mongoTemplate()
69+
* @return
70+
*/
71+
@Bean
72+
public MongoDbFactory mongoDbFactory() {
73+
return new SimpleMongoDbFactory(mongoClient(), getDatabaseName());
74+
}
75+
76+
/**
77+
* Return the base package to scan for mapped {@link Document}s. Will return the package name of the configuration
78+
* class' (the concrete class, not this one here) by default. So if you have a {@code com.acme.AppConfig} extending
79+
* {@link AbstractMongoConfiguration} the base package will be considered {@code com.acme} unless the method is
80+
* overridden to implement alternate behavior.
81+
*
82+
* @return the base package to scan for mapped {@link Document} classes or {@literal null} to not enable scanning for
83+
* entities.
84+
* @deprecated use {@link #getMappingBasePackages()} instead.
85+
*/
86+
@Deprecated
87+
protected String getMappingBasePackage() {
88+
89+
Package mappingBasePackage = getClass().getPackage();
90+
return mappingBasePackage == null ? null : mappingBasePackage.getName();
91+
}
92+
93+
/**
94+
* Creates a {@link MappingMongoConverter} using the configured {@link #mongoDbFactory()} and
95+
* {@link #mongoMappingContext()}. Will get {@link #customConversions()} applied.
96+
*
97+
* @see #customConversions()
98+
* @see #mongoMappingContext()
99+
* @see #mongoDbFactory()
100+
* @return
101+
* @throws Exception
102+
*/
103+
@Bean
104+
public MappingMongoConverter mappingMongoConverter() throws Exception {
105+
106+
DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory());
107+
MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mongoMappingContext());
108+
converter.setCustomConversions(customConversions());
109+
110+
return converter;
111+
}
112+
}
Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
1-
/*
2-
* Copyright 2011-2017 the original author or authors.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package org.springframework.data.mongodb.config;
17-
18-
import org.springframework.beans.factory.config.BeanDefinition;
19-
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
20-
import org.springframework.beans.factory.parsing.CompositeComponentDefinition;
21-
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
22-
import org.springframework.beans.factory.xml.BeanDefinitionParser;
23-
import org.springframework.beans.factory.xml.ParserContext;
24-
import org.springframework.data.mongodb.core.MongoAdmin;
25-
import org.springframework.data.mongodb.monitor.*;
26-
import org.springframework.util.StringUtils;
27-
import org.w3c.dom.Element;
28-
29-
/**
30-
* @author Mark Pollack
31-
* @author Thomas Risberg
32-
* @author John Brisbin
33-
* @author Oliver Gierke
34-
* @author Christoph Strobl
35-
*/
36-
public class MongoJmxParser implements BeanDefinitionParser {
37-
38-
public BeanDefinition parse(Element element, ParserContext parserContext) {
39-
String name = element.getAttribute("mongo-ref");
40-
if (!StringUtils.hasText(name)) {
41-
name = BeanNames.MONGO_BEAN_NAME;
42-
}
43-
registerJmxComponents(name, element, parserContext);
44-
return null;
45-
}
46-
47-
protected void registerJmxComponents(String mongoRefName, Element element, ParserContext parserContext) {
48-
Object eleSource = parserContext.extractSource(element);
49-
50-
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
51-
52-
createBeanDefEntry(AssertMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
53-
createBeanDefEntry(BackgroundFlushingMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
54-
createBeanDefEntry(BtreeIndexCounters.class, compositeDef, mongoRefName, eleSource, parserContext);
55-
createBeanDefEntry(ConnectionMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
56-
createBeanDefEntry(GlobalLockMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
57-
createBeanDefEntry(MemoryMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
58-
createBeanDefEntry(OperationCounters.class, compositeDef, mongoRefName, eleSource, parserContext);
59-
createBeanDefEntry(ServerInfo.class, compositeDef, mongoRefName, eleSource, parserContext);
60-
createBeanDefEntry(MongoAdmin.class, compositeDef, mongoRefName, eleSource, parserContext);
61-
62-
parserContext.registerComponent(compositeDef);
63-
64-
}
65-
66-
protected void createBeanDefEntry(Class<?> clazz, CompositeComponentDefinition compositeDef, String mongoRefName,
67-
Object eleSource, ParserContext parserContext) {
68-
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(clazz);
69-
builder.getRawBeanDefinition().setSource(eleSource);
70-
builder.addConstructorArgReference(mongoRefName);
71-
BeanDefinition assertDef = builder.getBeanDefinition();
72-
String assertName = parserContext.getReaderContext().registerWithGeneratedName(assertDef);
73-
compositeDef.addNestedComponent(new BeanComponentDefinition(assertDef, assertName));
74-
}
75-
76-
}
1+
/*
2+
* Copyright 2011-2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.mongodb.config;
17+
18+
import org.springframework.beans.factory.config.BeanDefinition;
19+
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
20+
import org.springframework.beans.factory.parsing.CompositeComponentDefinition;
21+
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
22+
import org.springframework.beans.factory.xml.BeanDefinitionParser;
23+
import org.springframework.beans.factory.xml.ParserContext;
24+
import org.springframework.data.mongodb.core.MongoAdmin;
25+
import org.springframework.data.mongodb.monitor.*;
26+
import org.springframework.util.StringUtils;
27+
import org.w3c.dom.Element;
28+
29+
/**
30+
* @author Mark Pollack
31+
* @author Thomas Risberg
32+
* @author John Brisbin
33+
* @author Oliver Gierke
34+
* @author Christoph Strobl
35+
*/
36+
public class MongoJmxParser implements BeanDefinitionParser {
37+
38+
public BeanDefinition parse(Element element, ParserContext parserContext) {
39+
String name = element.getAttribute("mongo-ref");
40+
if (!StringUtils.hasText(name)) {
41+
name = BeanNames.MONGO_BEAN_NAME;
42+
}
43+
registerJmxComponents(name, element, parserContext);
44+
return null;
45+
}
46+
47+
protected void registerJmxComponents(String mongoRefName, Element element, ParserContext parserContext) {
48+
Object eleSource = parserContext.extractSource(element);
49+
50+
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), eleSource);
51+
52+
createBeanDefEntry(AssertMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
53+
createBeanDefEntry(BackgroundFlushingMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
54+
createBeanDefEntry(BtreeIndexCounters.class, compositeDef, mongoRefName, eleSource, parserContext);
55+
createBeanDefEntry(ConnectionMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
56+
createBeanDefEntry(GlobalLockMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
57+
createBeanDefEntry(MemoryMetrics.class, compositeDef, mongoRefName, eleSource, parserContext);
58+
createBeanDefEntry(OperationCounters.class, compositeDef, mongoRefName, eleSource, parserContext);
59+
createBeanDefEntry(ServerInfo.class, compositeDef, mongoRefName, eleSource, parserContext);
60+
createBeanDefEntry(MongoAdmin.class, compositeDef, mongoRefName, eleSource, parserContext);
61+
62+
parserContext.registerComponent(compositeDef);
63+
64+
}
65+
66+
protected void createBeanDefEntry(Class<?> clazz, CompositeComponentDefinition compositeDef, String mongoRefName,
67+
Object eleSource, ParserContext parserContext) {
68+
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(clazz);
69+
builder.getRawBeanDefinition().setSource(eleSource);
70+
builder.addConstructorArgReference(mongoRefName);
71+
BeanDefinition assertDef = builder.getBeanDefinition();
72+
String assertName = parserContext.getReaderContext().registerWithGeneratedName(assertDef);
73+
compositeDef.addNestedComponent(new BeanComponentDefinition(assertDef, assertName));
74+
}
75+
76+
}

0 commit comments

Comments
 (0)