Skip to content

Commit 80ff376

Browse files
schauderodrotbohm
authored andcommitted
DATAMONGO-1721 - Fixed package dependencies.
Added a Degraph based tests to identify package cycles and violations in layering. Moved Collation to the core.query package, fixing dependency cycles. Moved IndexOperations and IndexOperationsProvider to the core.index package. fixing dependency cycles. Moved GeoJsonConfiguration to config package. Replaced the original version of these interfaces/classes with a deprecated version extending the new one, in order to not break the existing API. Removed all references to Part.Type, except for those to maintain the existing API. API using Part.Type is marked as deprecated. It violates the layering, because nothing but "config" should access "repository". Tests added to MongoRegexCreator in order to facilitate the removal of Part.Type dependencies. Using the moved/new ExampleMatcherAccessor. Related Tickets: DATACMNS-1097. Original pull request: #470.
1 parent d19ea88 commit 80ff376

File tree

49 files changed

+501
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+501
-123
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ src/ant/.ant-targets-upload-dist.xml
1515
atlassian-ide-plugin.xml
1616
/.gradle/
1717
/.idea/
18+
*.graphml

spring-data-mongodb/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,13 @@
232232
<scope>test</scope>
233233
</dependency>
234234

235+
<dependency>
236+
<groupId>de.schauderhaft.degraph</groupId>
237+
<artifactId>degraph-check</artifactId>
238+
<version>0.1.4</version>
239+
<scope>test</scope>
240+
</dependency>
241+
235242
<!-- Kotlin extension -->
236243
<dependency>
237244
<groupId>org.jetbrains.kotlin</groupId>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2015-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.data.mongodb.core.geo.GeoJsonModule;
20+
import org.springframework.data.web.config.SpringDataJacksonModules;
21+
22+
/**
23+
* Configuration class to expose {@link GeoJsonModule} as a Spring bean.
24+
*
25+
* @author Oliver Gierke
26+
* @author Jens Schauder
27+
*/
28+
public class GeoJsonConfiguration implements SpringDataJacksonModules {
29+
30+
@Bean
31+
public GeoJsonModule geoJsonModule() {
32+
return new GeoJsonModule();
33+
}
34+
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.util.Optional;
1919

20+
import org.springframework.data.mongodb.core.query.Collation;
2021
import org.springframework.util.Assert;
2122

2223
/**

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultBulkOperations.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.data.mongodb.core.convert.QueryMapper;
3232
import org.springframework.data.mongodb.core.convert.UpdateMapper;
3333
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
34+
import org.springframework.data.mongodb.core.query.Collation;
3435
import org.springframework.data.mongodb.core.query.Query;
3536
import org.springframework.data.mongodb.core.query.Update;
3637
import org.springframework.data.util.Pair;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultIndexOperations.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.data.mongodb.MongoDbFactory;
2828
import org.springframework.data.mongodb.core.index.IndexDefinition;
2929
import org.springframework.data.mongodb.core.index.IndexInfo;
30+
import org.springframework.data.mongodb.core.index.IndexOperations;
3031
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
3132
import org.springframework.util.Assert;
3233

@@ -89,7 +90,7 @@ public DefaultIndexOperations(MongoDbFactory mongoDbFactory, String collectionNa
8990

9091
/*
9192
* (non-Javadoc)
92-
* @see org.springframework.data.mongodb.core.IndexOperations#ensureIndex(org.springframework.data.mongodb.core.index.IndexDefinition)
93+
* @see org.springframework.data.mongodb.core.index.IndexOperations#ensureIndex(org.springframework.data.mongodb.core.index.IndexDefinition)
9394
*/
9495
public String ensureIndex(final IndexDefinition indexDefinition) {
9596

@@ -136,7 +137,7 @@ private MongoPersistentEntity<?> lookupPersistentEntity(Class<?> entityType, Str
136137

137138
/*
138139
* (non-Javadoc)
139-
* @see org.springframework.data.mongodb.core.IndexOperations#dropIndex(java.lang.String)
140+
* @see org.springframework.data.mongodb.core.index.IndexOperations#dropIndex(java.lang.String)
140141
*/
141142
public void dropIndex(final String name) {
142143

@@ -149,15 +150,15 @@ public void dropIndex(final String name) {
149150

150151
/*
151152
* (non-Javadoc)
152-
* @see org.springframework.data.mongodb.core.IndexOperations#dropAllIndexes()
153+
* @see org.springframework.data.mongodb.core.index.IndexOperations#dropAllIndexes()
153154
*/
154155
public void dropAllIndexes() {
155156
dropIndex("*");
156157
}
157158

158159
/*
159160
* (non-Javadoc)
160-
* @see org.springframework.data.mongodb.core.IndexOperations#getIndexInfo()
161+
* @see org.springframework.data.mongodb.core.index.IndexOperations#getIndexInfo()
161162
*/
162163
public List<IndexInfo> getIndexInfo() {
163164

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultIndexOperationsProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import org.springframework.data.mongodb.MongoDbFactory;
1919
import org.springframework.data.mongodb.core.convert.QueryMapper;
20+
import org.springframework.data.mongodb.core.index.IndexOperations;
21+
import org.springframework.data.mongodb.core.index.IndexOperationsProvider;
2022

2123
/**
2224
* {@link IndexOperationsProvider} to obtain {@link IndexOperations} from a given {@link MongoDbFactory}. TODO: Review
@@ -38,7 +40,7 @@ class DefaultIndexOperationsProvider implements IndexOperationsProvider {
3840
}
3941

4042
/* (non-Javadoc)
41-
* @see org.springframework.data.mongodb.core.IndexOperationsProvider#reactiveIndexOps(java.lang.String)
43+
* @see org.springframework.data.mongodb.core.index.IndexOperationsProvider#reactiveIndexOps(java.lang.String)
4244
*/
4345
@Override
4446
public IndexOperations indexOps(String collectionName) {

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultReactiveIndexOperations.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.bson.Document;
1919
import org.springframework.data.mongodb.core.index.IndexDefinition;
2020
import org.springframework.data.mongodb.core.index.IndexInfo;
21+
import org.springframework.data.mongodb.core.index.IndexOperations;
2122
import org.springframework.util.Assert;
2223

2324
import com.mongodb.reactivestreams.client.ListIndexesPublisher;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndModifyOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import java.util.Optional;
1919

20+
import org.springframework.data.mongodb.core.query.Collation;
21+
2022
/**
2123
* @author Mark Pollak
2224
* @author Oliver Gierke
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2016 the original author or authors.
2+
* Copyright 2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,19 +15,17 @@
1515
*/
1616
package org.springframework.data.mongodb.core;
1717

18-
import org.springframework.context.annotation.Bean;
1918
import org.springframework.data.mongodb.core.geo.GeoJsonModule;
20-
import org.springframework.data.web.config.SpringDataJacksonModules;
2119

2220
/**
2321
* Configuration class to expose {@link GeoJsonModule} as a Spring bean.
24-
*
22+
*
2523
* @author Oliver Gierke
24+
* @author Jens Schauder
25+
*
26+
* @deprecated Use {@link org.springframework.data.mongodb.config.GeoJsonConfiguration} instead.
2627
*/
27-
public class GeoJsonConfiguration implements SpringDataJacksonModules {
28+
@Deprecated
29+
public class GeoJsonConfiguration extends org.springframework.data.mongodb.config.GeoJsonConfiguration {
2830

29-
@Bean
30-
public GeoJsonModule geoJsonModule() {
31-
return new GeoJsonModule();
32-
}
3331
}

0 commit comments

Comments
 (0)