Skip to content

Commit 15dfdbf

Browse files
committed
Bundle Javadoc with Antora documentation site.
Closes #4754
1 parent 6207db0 commit 15dfdbf

14 files changed

+41
-26
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ atlassian-ide-plugin.xml
1919
build/
2020
node_modules
2121
node
22-
package.json
2322
package-lock.json
2423
.mvn/.gradle-enterprise
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"dependencies": {
3+
"antora": "3.2.0-alpha.6",
4+
"@antora/atlas-extension": "1.0.0-alpha.2",
5+
"@antora/collector-extension": "1.0.0-alpha.7",
6+
"@asciidoctor/tabs": "1.0.0-beta.6",
7+
"@springio/antora-extensions": "1.13.0",
8+
"@springio/asciidoctor-extensions": "1.0.0-alpha.11"
9+
}
10+
}

spring-data-mongodb-distribution/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<artifactId>maven-assembly-plugin</artifactId>
6767
</plugin>
6868
<plugin>
69-
<groupId>io.spring.maven.antora</groupId>
69+
<groupId>org.antora</groupId>
7070
<artifactId>antora-maven-plugin</artifactId>
7171
</plugin>
7272
</plugins>

src/main/antora/antora-playbook.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# The purpose of this Antora playbook is to build the docs in the current branch.
44
antora:
55
extensions:
6-
- '@antora/collector-extension'
7-
- require: '@springio/antora-extensions/root-component-extension'
6+
- require: '@springio/antora-extensions'
87
root_component_name: 'data-mongodb'
98
site:
109
title: Spring Data MongoDB
@@ -22,13 +21,12 @@ content:
2221
start_path: src/main/antora
2322
asciidoc:
2423
attributes:
25-
page-pagination: ''
2624
hide-uri-scheme: '@'
2725
tabs-sync-option: '@'
28-
chomp: 'all'
2926
extensions:
3027
- '@asciidoctor/tabs'
3128
- '@springio/asciidoctor-extensions'
29+
- '@springio/asciidoctor-extensions/javadoc-extension'
3230
sourcemap: true
3331
urls:
3432
latest_version_segment: ''
@@ -38,5 +36,5 @@ runtime:
3836
format: pretty
3937
ui:
4038
bundle:
41-
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
39+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.16/ui-bundle.zip
4240
snapshot: true

src/main/antora/antora.yml

+5
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ ext:
1010
local: true
1111
scan:
1212
dir: spring-data-mongodb-distribution/target/classes/
13+
- run:
14+
command: ./mvnw package -Pdistribute
15+
local: true
16+
scan:
17+
dir: target/antora

src/main/antora/modules/ROOT/nav.adoc

+3
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,6 @@
6363
** xref:kotlin/extensions.adoc[]
6464
** xref:kotlin/coroutines.adoc[]
6565
66+
* xref:attachment$api/java/index.html[Javadoc,role=link-external,window=_blank]
67+
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki,role=link-external,window=_blank]
68+

src/main/antora/modules/ROOT/pages/mongodb/aggregation-framework.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ For further information, see the full https://docs.mongodb.org/manual/aggregatio
88
[[mongo.aggregation.basic-concepts]]
99
== Basic Concepts
1010

11-
The Aggregation Framework support in Spring Data MongoDB is based on the following key abstractions: `Aggregation`, `AggregationDefinition`, and `AggregationResults`.
11+
The Aggregation Framework support in Spring Data MongoDB is based on the following key abstractions: javadoc:org.springframework.data.mongodb.core.aggregation.Aggregation[] and javadoc:org.springframework.data.mongodb.core.aggregation.AggregationResults[].
1212

1313
* `Aggregation`
1414
+

src/main/antora/modules/ROOT/pages/mongodb/change-streams.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ In doubt, use `Document`.
1616
== Change Streams with `MessageListener`
1717

1818
Listening to a https://docs.mongodb.com/manual/tutorial/change-streams-example/[Change Stream by using a Sync Driver] creates a long running, blocking task that needs to be delegated to a separate component.
19-
In this case, we need to first create a `MessageListenerContainer`, which will be the main entry point for running the specific `SubscriptionRequest` tasks.
20-
Spring Data MongoDB already ships with a default implementation that operates on `MongoTemplate` and is capable of creating and running `Task` instances for a `ChangeStreamRequest`.
19+
In this case, we need to first create a javadoc:org.springframework.data.mongodb.core.messaging.MessageListenerContainer[] which will be the main entry point for running the specific `SubscriptionRequest` tasks.
20+
Spring Data MongoDB already ships with a default implementation that operates on `MongoTemplate` and is capable of creating and running `Task` instances for a javadoc:org.springframework.data.mongodb.core.messaging.ChangeStreamRequest[].
2121

2222
The following example shows how to use Change Streams with `MessageListener` instances:
2323

@@ -73,7 +73,7 @@ Flux<ChangeStreamEvent<User>> flux = reactiveTemplate.changeStream(User.class) <
7373
== Resuming Change Streams
7474

7575
Change Streams can be resumed and resume emitting events where you left. To resume the stream, you need to supply either a resume
76-
token or the last known server time (in UTC). Use `ChangeStreamOptions` to set the value accordingly.
76+
token or the last known server time (in UTC). Use javadoc:org.springframework.data.mongodb.core.ChangeStreamOptions[] to set the value accordingly.
7777

7878
The following example shows how to set the resume offset using server time:
7979

src/main/antora/modules/ROOT/pages/mongodb/getting-started.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Person [id=4ddbba3c0be56b7e1b210166, name=Joe, age=34]
5555
Even in this simple example, there are few things to notice:
5656

5757
* You can instantiate the central helper class of Spring Mongo, xref:mongodb/template-api.adoc[`MongoTemplate`], by using the standard or reactive `MongoClient` object and the name of the database to use.
58-
* The mapper works against standard POJO objects without the need for any additional metadata (though you can optionally provide that information. See xref:mongodb/mapping/mapping.adoc[here].).
58+
* The mapper works against standard POJO objects without the need for any additional metadata (though you can optionally provide that information. See xref:mongodb/mapping/mapping.adoc[here]).
5959
* Conventions are used for handling the `id` field, converting it to be an `ObjectId` when stored in the database.
6060
* Mapping conventions can use field access. Notice that the `Person` class has only getters.
6161
* If the constructor argument names match the field names of the stored document, they are used to instantiate the object

src/main/antora/modules/ROOT/pages/mongodb/lifecycle-events.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The MongoDB mapping framework includes several `org.springframework.context.Appl
55
Being based on Spring's `ApplicationContext` event infrastructure enables other products, such as Spring Integration, to easily receive these events, as they are a well known eventing mechanism in Spring-based applications.
66

77
Entity lifecycle events can be costly and you may notice a change in the performance profile when loading large result sets.
8-
You can disable lifecycle events on the link:https://docs.spring.io/spring-data/mongodb/docs/{version}/api/org/springframework/data/mongodb/core/MongoTemplate.html#setEntityLifecycleEventsEnabled(boolean)[Template API].
8+
You can disable lifecycle events on the javadoc:org.springframework.data.mongodb.core.MongoTemplate#setEntityLifecycleEventsEnabled(boolean)[Template API].
99

1010
To intercept an object before it goes through the conversion process (which turns your domain object into a `org.bson.Document`), you can register a subclass of `AbstractMongoEventListener` that overrides the `onBeforeConvert` method.
1111
When the event is dispatched, your listener is called and passed the domain object before it goes into the converter.
@@ -23,7 +23,7 @@ public class BeforeConvertListener extends AbstractMongoEventListener<Person> {
2323
----
2424
====
2525

26-
To intercept an object before it goes into the database, you can register a subclass of `org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener` that overrides the `onBeforeSave` method. When the event is dispatched, your listener is called and passed the domain object and the converted `com.mongodb.Document`. The following example shows how to do so:
26+
To intercept an object before it goes into the database, you can register a subclass of javadoc:org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener[] that overrides the `onBeforeSave` method. When the event is dispatched, your listener is called and passed the domain object and the converted `com.mongodb.Document`. The following example shows how to do so:
2727

2828
====
2929
[source,java]

src/main/antora/modules/ROOT/pages/mongodb/template-api.adoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
[[mongo-template]]
22
= Template API
33

4-
The `MongoTemplate` and its reactive counterpart class, located in the `org.springframework.data.mongodb.core` package, is the central class of Spring's MongoDB support and provides a rich feature set for interacting with the database.
4+
The javadoc:org.springframework.data.mongodb.core.MongoTemplate[] and its javadoc:org.springframework.data.mongodb.core.ReactiveMongoTemplate[reactive] counterpart class, located in the `org.springframework.data.mongodb.core` package, is the central class of Spring's MongoDB support and provides a rich feature set for interacting with the database.
55
The template offers convenience operations to create, update, delete, and query MongoDB documents and provides a mapping between your domain objects and MongoDB documents.
66

77
NOTE: Once configured, `MongoTemplate` is thread-safe and can be reused across multiple instances.
88

99
[[mongo-template.convenience-methods]]
1010
== Convenience Methods
1111

12-
The `MongoTemplate` class implements the interface `MongoOperations`.
12+
The javadoc:org.springframework.data.mongodb.core.MongoTemplate[] class implements the interface javadoc:org.springframework.data.mongodb.core.MongoOperations[].
1313
In as much as possible, the methods on `MongoOperations` are named after methods available on the MongoDB driver `Collection` object, to make the API familiar to existing MongoDB developers who are used to the driver API.
1414
For example, you can find methods such as `find`, `findAndModify`, `findAndReplace`, `findOne`, `insert`, `remove`, `save`, `update`, and `updateMulti`.
1515
The design goal was to make it as easy as possible to transition between the use of the base MongoDB driver and `MongoOperations`.
1616
A major difference between the two APIs is that `MongoOperations` can be passed domain objects instead of `Document`.
1717
Also, `MongoOperations` has fluent APIs for `Query`, `Criteria`, and `Update` operations instead of populating a `Document` to specify the parameters for those operations.
1818

19-
For more information please refer to the the xref:mongodb/template-crud-operations.adoc[CRUD] and xref:mongodb/template-query-operations.adoc[Query] sections of the documentation.
19+
For more information please refer to the xref:mongodb/template-crud-operations.adoc[CRUD] and xref:mongodb/template-query-operations.adoc[Query] sections of the documentation.
2020

2121
NOTE: The preferred way to reference the operations on `MongoTemplate` instance is through its interface, `MongoOperations`.
2222

@@ -37,7 +37,7 @@ The `execute` callbacks gives you a reference to either a `MongoCollection` or a
3737

3838
* `<T> T` *executeInSession* `(DbCallback<T> action)`: Runs the given `DbCallback` within the same connection to the database so as to ensure consistency in a write-heavy environment where you may read the data that you wrote.
3939

40-
The following example uses the `CollectionCallback` to return information about an index:
40+
The following example uses the javadoc:org.springframework.data.mongodb.core.CollectionCallback[] to return information about an index:
4141

4242
[tabs]
4343
======
@@ -108,7 +108,7 @@ Flux<Jedi> all = template.query(SWCharacter.class)
108108
======
109109

110110
NOTE: Using projections allows `MongoTemplate` to optimize result mapping by limiting the actual response to fields required
111-
by the projection target type. This applies as long as the `Query` itself does not contain any field restriction and the
111+
by the projection target type. This applies as long as the javadoc:org.springframework.data.mongodb.core.query.Query[] itself does not contain any field restriction and the
112112
target type is a closed interface or DTO projection.
113113

114114
WARNING: Projections must not be applied to xref:mongodb/mapping/document-references.adoc[DBRefs].
@@ -158,7 +158,7 @@ Look into the implementation for more details on the mapping.
158158
[[mongo-template.type-mapping]]
159159
== Domain Type Mapping
160160

161-
The mapping between MongoDB documents and domain classes is done by delegating to an implementation of the `MongoConverter` interface.
162-
Spring provides `MappingMongoConverter`, but you can also write your own converter.
161+
The mapping between MongoDB documents and domain classes is done by delegating to an implementation of the javadoc:org.springframework.data.mongodb.core.convert.MongoConverter[] interface.
162+
Spring provides javadoc:org.springframework.data.mongodb.core.convert.MappingMongoConverter[], but you can also write your own converter.
163163
While the `MappingMongoConverter` can use additional metadata to specify the mapping of objects to documents, it can also convert objects that contain no additional metadata by using some conventions for the mapping of IDs and collection names.
164164
These conventions, as well as the use of mapping annotations, are explained in the xref:mongodb/mapping/mapping.adoc[Mapping] chapter.

src/main/antora/modules/ROOT/pages/mongodb/template-config.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ XML::
5757
----
5858
======
5959

60-
There are several overloaded constructors of `MongoTemplate` and `ReactiveMongoTemplate`:
60+
There are several overloaded constructors of javadoc:org.springframework.data.mongodb.core.MongoTemplate[] and javadoc:org.springframework.data.mongodb.core.ReactiveMongoTemplate[]:
6161

6262
* `MongoTemplate(MongoClient mongo, String databaseName)`: Takes the `MongoClient` object and the default database name to operate against.
6363
* `MongoTemplate(MongoDatabaseFactory mongoDbFactory)`: Takes a MongoDbFactory object that encapsulated the `MongoClient` object, database name, and username and password.
@@ -164,4 +164,4 @@ ReactiveMongoOperations mongoTemplate(MongoClient mongoClient) {
164164
== Document count configuration
165165

166166
By setting `MongoTemplate#useEstimatedCount(...)` to `true` _MongoTemplate#count(...)_ operations, that use an empty filter query, will be delegated to `estimatedCount`, as long as there is no transaction active and the template is not bound to a xref:mongodb/client-session-transactions.adoc[session].
167-
Please refer to to the xref:mongodb/template-document-count.adoc#mongo.query.count[Counting Documents] section for more information.
167+
Please refer to the xref:mongodb/template-document-count.adoc#mongo.query.count[Counting Documents] section for more information.

src/main/antora/modules/ROOT/pages/mongodb/template-gridfs.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
= GridFS Support
33

44
MongoDB supports storing binary files inside its filesystem, GridFS.
5-
Spring Data MongoDB provides a `GridFsOperations` and `ReactiveGridFsOperations` interface as well as the corresponding implementation, `GridFsTemplate` and `ReactiveGridFsTemplate`, to let you interact with the filesystem.
5+
Spring Data MongoDB provides a javadoc:org.springframework.data.mongodb.gridfs.GridFsOperations[] and javadoc:org.springframework.data.mongodb.gridfs.ReactiveGridFsOperations[] interface as well as the corresponding implementation, `GridFsTemplate` and `ReactiveGridFsTemplate`, to let you interact with the filesystem.
66
You can set up a template instance by handing it a `MongoDatabaseFactory`/`ReactiveMongoDatabaseFactory` as well as a `MongoConverter`, as the following example shows:
77

88
[tabs]

src/main/antora/modules/ROOT/pages/mongodb/template-query-operations.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ The `Metrics` enum used here actually implements an interface so that other metr
472472
A `Metric` is backed by a multiplier to transform the distance value of the given metric into native distances.
473473
The sample shown here would consider the 10 to be miles. Using one of the built-in metrics (miles and kilometers) automatically triggers the spherical flag to be set on the query.
474474
If you want to avoid that, pass plain `double` values into `maxDistance(…)`.
475-
For more information, see the https://docs.spring.io/spring-data/mongodb/docs/{version}/api/index.html[JavaDoc] of `NearQuery` and `Distance`.
475+
For more information, see the Javadoc of javadoc:org.springframework.data.mongodb.core.query.NearQuery[] and `Distance`.
476476

477477
The geo-near operations return a `GeoResults` wrapper object that encapsulates `GeoResult` instances.
478478
Wrapping `GeoResults` allows accessing the average distance of all results.
@@ -486,7 +486,7 @@ MongoDB supports https://geojson.org/[GeoJSON] and simple (legacy) coordinate pa
486486
[[mongo.geo-json.domain.classes]]
487487
== GeoJSON Types in Domain Classes
488488

489-
Usage of https://geojson.org/[GeoJSON] types in domain classes is straightforward. The `org.springframework.data.mongodb.core.geo` package contains types such as `GeoJsonPoint`, `GeoJsonPolygon`, and others. These types are extend the existing `org.springframework.data.geo` types. The following example uses a `GeoJsonPoint`:
489+
Usage of https://geojson.org/[GeoJSON] types in domain classes is straightforward. The `org.springframework.data.mongodb.core.geo` package contains types such as `GeoJsonPoint`, `GeoJsonPolygon`, and others. These types are extend the existing `org.springframework.data.geo` types. The following example uses a javadoc:org.springframework.data.mongodb.core.geo.GeoJsonPoint[]:
490490

491491
====
492492
[source,java]

0 commit comments

Comments
 (0)