Skip to content

Commit 3012bcd

Browse files
committed
DATAMONGO-1762 - Fix line endings.
Convert line endings from CRLF to LF.
1 parent 0be4d13 commit 3012bcd

21 files changed

+1644
-1644
lines changed
Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,114 @@
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-
import org.springframework.lang.Nullable;
28-
29-
import com.mongodb.MongoClient;
30-
31-
/**
32-
* Base class for Spring Data MongoDB configuration using JavaConfig.
33-
*
34-
* @author Mark Pollack
35-
* @author Oliver Gierke
36-
* @author Thomas Darimont
37-
* @author Ryan Tenney
38-
* @author Christoph Strobl
39-
* @author Mark Paluch
40-
* @see MongoConfigurationSupport
41-
*/
42-
@Configuration
43-
public abstract class
44-
AbstractMongoConfiguration extends MongoConfigurationSupport {
45-
46-
/**
47-
* Return the {@link MongoClient} instance to connect to. Annotate with {@link Bean} in case you want to expose a
48-
* {@link MongoClient} instance to the {@link org.springframework.context.ApplicationContext}.
49-
*
50-
* @return
51-
*/
52-
public abstract MongoClient mongoClient();
53-
54-
/**
55-
* Creates a {@link MongoTemplate}.
56-
*
57-
* @return
58-
*/
59-
@Bean
60-
public MongoTemplate mongoTemplate() throws Exception {
61-
return new MongoTemplate(mongoDbFactory(), mappingMongoConverter());
62-
}
63-
64-
/**
65-
* Creates a {@link SimpleMongoDbFactory} to be used by the {@link MongoTemplate}. Will use the {@link MongoClient}
66-
* instance configured in {@link #mongo()}.
67-
*
68-
* @see #mongoClient()
69-
* @see #mongoTemplate()
70-
* @return
71-
*/
72-
@Bean
73-
public MongoDbFactory mongoDbFactory() {
74-
return new SimpleMongoDbFactory(mongoClient(), getDatabaseName());
75-
}
76-
77-
/**
78-
* Return the base package to scan for mapped {@link Document}s. Will return the package name of the configuration
79-
* class' (the concrete class, not this one here) by default. So if you have a {@code com.acme.AppConfig} extending
80-
* {@link AbstractMongoConfiguration} the base package will be considered {@code com.acme} unless the method is
81-
* overridden to implement alternate behavior.
82-
*
83-
* @return the base package to scan for mapped {@link Document} classes or {@literal null} to not enable scanning for
84-
* entities.
85-
* @deprecated use {@link #getMappingBasePackages()} instead.
86-
*/
87-
@Deprecated
88-
@Nullable
89-
protected String getMappingBasePackage() {
90-
91-
Package mappingBasePackage = getClass().getPackage();
92-
return mappingBasePackage == null ? null : mappingBasePackage.getName();
93-
}
94-
95-
/**
96-
* Creates a {@link MappingMongoConverter} using the configured {@link #mongoDbFactory()} and
97-
* {@link #mongoMappingContext()}. Will get {@link #customConversions()} applied.
98-
*
99-
* @see #customConversions()
100-
* @see #mongoMappingContext()
101-
* @see #mongoDbFactory()
102-
* @return
103-
* @throws Exception
104-
*/
105-
@Bean
106-
public MappingMongoConverter mappingMongoConverter() throws Exception {
107-
108-
DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory());
109-
MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mongoMappingContext());
110-
converter.setCustomConversions(customConversions());
111-
112-
return converter;
113-
}
114-
}
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+
import org.springframework.lang.Nullable;
28+
29+
import com.mongodb.MongoClient;
30+
31+
/**
32+
* Base class for Spring Data MongoDB configuration using JavaConfig.
33+
*
34+
* @author Mark Pollack
35+
* @author Oliver Gierke
36+
* @author Thomas Darimont
37+
* @author Ryan Tenney
38+
* @author Christoph Strobl
39+
* @author Mark Paluch
40+
* @see MongoConfigurationSupport
41+
*/
42+
@Configuration
43+
public abstract class
44+
AbstractMongoConfiguration extends MongoConfigurationSupport {
45+
46+
/**
47+
* Return the {@link MongoClient} instance to connect to. Annotate with {@link Bean} in case you want to expose a
48+
* {@link MongoClient} instance to the {@link org.springframework.context.ApplicationContext}.
49+
*
50+
* @return
51+
*/
52+
public abstract MongoClient mongoClient();
53+
54+
/**
55+
* Creates a {@link MongoTemplate}.
56+
*
57+
* @return
58+
*/
59+
@Bean
60+
public MongoTemplate mongoTemplate() throws Exception {
61+
return new MongoTemplate(mongoDbFactory(), mappingMongoConverter());
62+
}
63+
64+
/**
65+
* Creates a {@link SimpleMongoDbFactory} to be used by the {@link MongoTemplate}. Will use the {@link MongoClient}
66+
* instance configured in {@link #mongo()}.
67+
*
68+
* @see #mongoClient()
69+
* @see #mongoTemplate()
70+
* @return
71+
*/
72+
@Bean
73+
public MongoDbFactory mongoDbFactory() {
74+
return new SimpleMongoDbFactory(mongoClient(), getDatabaseName());
75+
}
76+
77+
/**
78+
* Return the base package to scan for mapped {@link Document}s. Will return the package name of the configuration
79+
* class' (the concrete class, not this one here) by default. So if you have a {@code com.acme.AppConfig} extending
80+
* {@link AbstractMongoConfiguration} the base package will be considered {@code com.acme} unless the method is
81+
* overridden to implement alternate behavior.
82+
*
83+
* @return the base package to scan for mapped {@link Document} classes or {@literal null} to not enable scanning for
84+
* entities.
85+
* @deprecated use {@link #getMappingBasePackages()} instead.
86+
*/
87+
@Deprecated
88+
@Nullable
89+
protected String getMappingBasePackage() {
90+
91+
Package mappingBasePackage = getClass().getPackage();
92+
return mappingBasePackage == null ? null : mappingBasePackage.getName();
93+
}
94+
95+
/**
96+
* Creates a {@link MappingMongoConverter} using the configured {@link #mongoDbFactory()} and
97+
* {@link #mongoMappingContext()}. Will get {@link #customConversions()} applied.
98+
*
99+
* @see #customConversions()
100+
* @see #mongoMappingContext()
101+
* @see #mongoDbFactory()
102+
* @return
103+
* @throws Exception
104+
*/
105+
@Bean
106+
public MappingMongoConverter mappingMongoConverter() throws Exception {
107+
108+
DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory());
109+
MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mongoMappingContext());
110+
converter.setCustomConversions(customConversions());
111+
112+
return converter;
113+
}
114+
}
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)