Skip to content

Commit 9d4d47f

Browse files
committed
DATAMONGO-1721 - Move ReactiveIndexOperations to core.index package.
Align with synchronous IndexOperations. Related pull request: spring-projects#470.
1 parent f220368 commit 9d4d47f

File tree

8 files changed

+34
-32
lines changed

8 files changed

+34
-32
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.data.mongodb.core;
1717

18+
import org.springframework.data.mongodb.core.index.ReactiveIndexOperations;
1819
import reactor.core.publisher.Flux;
1920
import reactor.core.publisher.Mono;
2021

@@ -85,7 +86,7 @@ private DefaultReactiveIndexOperations(ReactiveMongoOperations mongoOperations,
8586
}
8687

8788
/* (non-Javadoc)
88-
* @see org.springframework.data.mongodb.core.ReactiveIndexOperations#ensureIndex(org.springframework.data.mongodb.core.index.IndexDefinition)
89+
* @see org.springframework.data.mongodb.core.index.ReactiveIndexOperations#ensureIndex(org.springframework.data.mongodb.core.index.IndexDefinition)
8990
*/
9091
public Mono<String> ensureIndex(final IndexDefinition indexDefinition) {
9192

@@ -127,21 +128,21 @@ private MongoPersistentEntity<?> lookupPersistentEntity(String collection) {
127128
}
128129

129130
/* (non-Javadoc)
130-
* @see org.springframework.data.mongodb.core.ReactiveIndexOperations#dropIndex(java.lang.String)
131+
* @see org.springframework.data.mongodb.core.index.ReactiveIndexOperations#dropIndex(java.lang.String)
131132
*/
132133
public Mono<Void> dropIndex(final String name) {
133134
return mongoOperations.execute(collectionName, collection -> collection.dropIndex(name)).then();
134135
}
135136

136137
/* (non-Javadoc)
137-
* @see org.springframework.data.mongodb.core.ReactiveIndexOperations#dropAllIndexes()
138+
* @see org.springframework.data.mongodb.core.index.ReactiveIndexOperations#dropAllIndexes()
138139
*/
139140
public Mono<Void> dropAllIndexes() {
140141
return dropIndex("*");
141142
}
142143

143144
/* (non-Javadoc)
144-
* @see org.springframework.data.mongodb.core.ReactiveIndexOperations#getIndexInfo()
145+
* @see org.springframework.data.mongodb.core.index.ReactiveIndexOperations#getIndexInfo()
145146
*/
146147
public Flux<IndexInfo> getIndexInfo() {
147148

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2016-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.
@@ -26,6 +26,7 @@
2626
import org.springframework.data.geo.GeoResult;
2727
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
2828
import org.springframework.data.mongodb.core.convert.MongoConverter;
29+
import org.springframework.data.mongodb.core.index.ReactiveIndexOperations;
2930
import org.springframework.data.mongodb.core.query.BasicQuery;
3031
import org.springframework.data.mongodb.core.query.Criteria;
3132
import org.springframework.data.mongodb.core.query.NearQuery;
@@ -228,8 +229,8 @@ public interface ReactiveMongoOperations {
228229
* <p/>
229230
* If your collection does not contain a homogeneous collection of types, this operation will not be an efficient way
230231
* to map objects since the test for class type is done in the client and not on the server.
231-
* @param entityClass the parametrized type of the returned {@link Flux}.
232232
*
233+
* @param entityClass the parametrized type of the returned {@link Flux}.
233234
* @return the converted collection
234235
*/
235236
<T> Flux<T> findAll(Class<T> entityClass);
@@ -370,10 +371,10 @@ public interface ReactiveMongoOperations {
370371
<T> Mono<T> findById(Object id, Class<T> entityClass, String collectionName);
371372

372373
/**
373-
* Returns {@link Flux} of {@link GeoResult} for all entities matching the given {@link NearQuery}. Will consider entity mapping
374-
* information to determine the collection the query is ran against. Note, that MongoDB limits the number of results
375-
* by default. Make sure to add an explicit limit to the {@link NearQuery} if you expect a particular number of
376-
* results.
374+
* Returns {@link Flux} of {@link GeoResult} for all entities matching the given {@link NearQuery}. Will consider
375+
* entity mapping information to determine the collection the query is ran against. Note, that MongoDB limits the
376+
* number of results by default. Make sure to add an explicit limit to the {@link NearQuery} if you expect a
377+
* particular number of results.
377378
*
378379
* @param near must not be {@literal null}.
379380
* @param entityClass must not be {@literal null}.
@@ -382,9 +383,9 @@ public interface ReactiveMongoOperations {
382383
<T> Flux<GeoResult<T>> geoNear(NearQuery near, Class<T> entityClass);
383384

384385
/**
385-
* Returns {@link Flux} of {@link GeoResult} for all entities matching the given {@link NearQuery}. Note, that MongoDB limits the
386-
* number of results by default. Make sure to add an explicit limit to the {@link NearQuery} if you expect a
387-
* particular number of results.
386+
* Returns {@link Flux} of {@link GeoResult} for all entities matching the given {@link NearQuery}. Note, that MongoDB
387+
* limits the number of results by default. Make sure to add an explicit limit to the {@link NearQuery} if you expect
388+
* a particular number of results.
388389
*
389390
* @param near must not be {@literal null}.
390391
* @param entityClass must not be {@literal null}.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import java.util.*;
2626
import java.util.Map.Entry;
27+
import java.util.Optional;
28+
import java.util.Set;
2729
import java.util.function.Function;
2830
import java.util.stream.Collectors;
2931

@@ -56,7 +58,6 @@
5658
import org.springframework.data.mapping.model.ConvertingPropertyAccessor;
5759
import org.springframework.data.mongodb.MongoDbFactory;
5860
import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory;
59-
import org.springframework.data.mongodb.core.query.Collation;
6061
import org.springframework.data.mongodb.core.convert.DbRefProxyHandler;
6162
import org.springframework.data.mongodb.core.convert.DbRefResolver;
6263
import org.springframework.data.mongodb.core.convert.DbRefResolverCallback;
@@ -65,8 +66,10 @@
6566
import org.springframework.data.mongodb.core.convert.MongoWriter;
6667
import org.springframework.data.mongodb.core.convert.QueryMapper;
6768
import org.springframework.data.mongodb.core.convert.UpdateMapper;
69+
import org.springframework.data.mongodb.core.index.IndexOperationsAdapter;
6870
import org.springframework.data.mongodb.core.index.MongoMappingEventPublisher;
6971
import org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator;
72+
import org.springframework.data.mongodb.core.index.ReactiveIndexOperations;
7073
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
7174
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
7275
import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
@@ -79,6 +82,7 @@
7982
import org.springframework.data.mongodb.core.mapping.event.BeforeDeleteEvent;
8083
import org.springframework.data.mongodb.core.mapping.event.BeforeSaveEvent;
8184
import org.springframework.data.mongodb.core.mapping.event.MongoMappingEvent;
85+
import org.springframework.data.mongodb.core.query.Collation;
8286
import org.springframework.data.mongodb.core.query.Criteria;
8387
import org.springframework.data.mongodb.core.query.NearQuery;
8488
import org.springframework.data.mongodb.core.query.Query;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/IndexOperationsAdapter.java renamed to spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexOperationsAdapter.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016. the original author or authors.
2+
* Copyright 2016-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.
@@ -14,13 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.data.mongodb.core;
17+
package org.springframework.data.mongodb.core.index;
1818

1919
import java.util.List;
2020

21-
import org.springframework.data.mongodb.core.index.IndexDefinition;
22-
import org.springframework.data.mongodb.core.index.IndexInfo;
23-
import org.springframework.data.mongodb.core.index.IndexOperations;
2421
import org.springframework.util.Assert;
2522

2623
/**

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveIndexOperations.java renamed to spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/ReactiveIndexOperations.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.mongodb.core;
17-
18-
import org.springframework.data.mongodb.core.index.IndexDefinition;
19-
import org.springframework.data.mongodb.core.index.IndexInfo;
16+
package org.springframework.data.mongodb.core.index;
2017

2118
import reactor.core.publisher.Flux;
2219
import reactor.core.publisher.Mono;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/ReactiveMongoRepositoryFactoryBean.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2016-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.
@@ -19,8 +19,8 @@
1919
import java.io.Serializable;
2020

2121
import org.springframework.data.mapping.context.MappingContext;
22-
import org.springframework.data.mongodb.core.IndexOperationsAdapter;
2322
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
23+
import org.springframework.data.mongodb.core.index.IndexOperationsAdapter;
2424
import org.springframework.data.repository.Repository;
2525
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
2626
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
@@ -29,7 +29,7 @@
2929
/**
3030
* {@link org.springframework.beans.factory.FactoryBean} to create
3131
* {@link org.springframework.data.mongodb.repository.ReactiveMongoRepository} instances.
32-
*
32+
*
3333
* @author Mark Paluch
3434
* @author Christoph Strobl
3535
* @since 2.0
@@ -54,7 +54,7 @@ public ReactiveMongoRepositoryFactoryBean(Class<? extends T> repositoryInterface
5454

5555
/**
5656
* Configures the {@link ReactiveMongoOperations} to be used.
57-
*
57+
*
5858
* @param operations the operations to set
5959
*/
6060
public void setReactiveMongoOperations(ReactiveMongoOperations operations) {
@@ -63,14 +63,14 @@ public void setReactiveMongoOperations(ReactiveMongoOperations operations) {
6363

6464
/**
6565
* Configures whether to automatically create indexes for the properties referenced in a query method.
66-
*
66+
*
6767
* @param createIndexesForQueryMethods the createIndexesForQueryMethods to set
6868
*/
6969
public void setCreateIndexesForQueryMethods(boolean createIndexesForQueryMethods) {
7070
this.createIndexesForQueryMethods = createIndexesForQueryMethods;
7171
}
7272

73-
/*
73+
/*
7474
* (non-Javadoc)
7575
* @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport#setMappingContext(org.springframework.data.mapping.context.MappingContext)
7676
*/
@@ -83,7 +83,7 @@ protected void setMappingContext(MappingContext<?, ?> mappingContext) {
8383

8484
/*
8585
* (non-Javadoc)
86-
*
86+
*
8787
* @see
8888
* org.springframework.data.repository.support.RepositoryFactoryBeanSupport
8989
* #createRepositoryFactory()
@@ -103,7 +103,7 @@ protected final RepositoryFactorySupport createRepositoryFactory() {
103103

104104
/**
105105
* Creates and initializes a {@link RepositoryFactorySupport} instance.
106-
*
106+
*
107107
* @param operations
108108
* @return
109109
*/
@@ -113,7 +113,7 @@ protected RepositoryFactorySupport getFactoryInstance(ReactiveMongoOperations op
113113

114114
/*
115115
* (non-Javadoc)
116-
*
116+
*
117117
* @see
118118
* org.springframework.data.repository.support.RepositoryFactoryBeanSupport
119119
* #afterPropertiesSet()

spring-data-mongodb/src/main/kotlin/org/springframework/data/mongodb/core/ReactiveMongoOperationsExtensions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.mongodb.client.result.UpdateResult
2020
import com.mongodb.reactivestreams.client.MongoCollection
2121
import org.bson.Document
2222
import org.springframework.data.geo.GeoResult
23+
import org.springframework.data.mongodb.core.index.ReactiveIndexOperations
2324
import org.springframework.data.mongodb.core.query.NearQuery
2425
import org.springframework.data.mongodb.core.query.Query
2526
import org.springframework.data.mongodb.core.query.Update

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/ReactiveMongoTemplateTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.springframework.data.mongodb.core.index.GeoSpatialIndexType;
5858
import org.springframework.data.mongodb.core.index.GeospatialIndex;
5959
import org.springframework.data.mongodb.core.index.Index;
60+
import org.springframework.data.mongodb.core.index.IndexOperationsAdapter;
6061
import org.springframework.data.mongodb.core.query.Criteria;
6162
import org.springframework.data.mongodb.core.query.NearQuery;
6263
import org.springframework.data.mongodb.core.query.Query;

0 commit comments

Comments
 (0)