Skip to content

Commit 7465414

Browse files
committed
Migrate docs to Antora.
Closes #1427
1 parent 66de8a8 commit 7465414

File tree

94 files changed

+2456
-2412
lines changed

Some content is hidden

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

94 files changed

+2456
-2412
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ build
1515
.idea
1616
download
1717
work
18+
build/
19+
node_modules
20+
node
21+
package.json
22+
package-lock.json
1823

spring-data-cassandra-distribution/pom.xml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,40 @@
1515
<artifactId>spring-data-cassandra-distribution</artifactId>
1616
<packaging>pom</packaging>
1717

18-
<name>Spring Data for Apache Cassandra - Distribution</name>
19-
<description>Distribution build for Spring Data for Apache Cassandra</description>
20-
<url>https://github.com/spring-projects/spring-data-cassandra/tree/master/spring-data-cassandra-distribution</url>
21-
2218
<properties>
2319
<project.root>${basedir}/..</project.root>
24-
<dist.key>SDCASS</dist.key>
20+
<antora.playbook>${project.basedir}/../src/main/antora/antora-playbook.yml</antora.playbook>
2521
</properties>
2622

2723
<build>
24+
<resources>
25+
<resource>
26+
<directory>${project.basedir}/../src/main/antora/resources/antora-resources</directory>
27+
<filtering>true</filtering>
28+
</resource>
29+
</resources>
2830
<plugins>
31+
<plugin>
32+
<groupId>org.apache.maven.plugins</groupId>
33+
<artifactId>maven-resources-plugin</artifactId>
34+
<executions>
35+
<execution>
36+
<goals>
37+
<goal>resources</goal>
38+
</goals>
39+
</execution>
40+
</executions>
41+
42+
</plugin>
43+
2944
<plugin>
3045
<groupId>org.apache.maven.plugins</groupId>
3146
<artifactId>maven-assembly-plugin</artifactId>
3247
</plugin>
48+
3349
<plugin>
34-
<groupId>org.asciidoctor</groupId>
35-
<artifactId>asciidoctor-maven-plugin</artifactId>
50+
<groupId>io.spring.maven.antora</groupId>
51+
<artifactId>antora-maven-plugin</artifactId>
3652
</plugin>
3753
</plugins>
3854
</build>

src/main/antora/antora-playbook.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# PACKAGES [email protected] @antora/atlas-extension:1.0.0-alpha.1 @antora/[email protected] @springio/[email protected] @asciidoctor/[email protected] @opendevise/[email protected]
2+
#
3+
# The purpose of this Antora playbook is to build the docs in the current branch.
4+
antora:
5+
extensions:
6+
- '@antora/collector-extension'
7+
- require: '@springio/antora-extensions/root-component-extension'
8+
root_component_name: 'data-cassandra'
9+
site:
10+
title: Spring Data Cassandra
11+
url: https://docs.spring.io/spring-data-cassandra/reference/
12+
content:
13+
sources:
14+
- url: ./../../..
15+
branches: HEAD
16+
start_path: src/main/antora
17+
worktrees: true
18+
- url: https://github.com/spring-projects/spring-data-commons
19+
# Refname matching:
20+
# https://docs.antora.org/antora/latest/playbook/content-refname-matching/
21+
branches: [ main, 3.2.x ]
22+
start_path: src/main/antora
23+
asciidoc:
24+
attributes:
25+
page-pagination: ''
26+
hide-uri-scheme: '@'
27+
tabs-sync-option: '@'
28+
chomp: 'all'
29+
extensions:
30+
- '@asciidoctor/tabs'
31+
- '@springio/asciidoctor-extensions'
32+
sourcemap: true
33+
urls:
34+
latest_version_segment: ''
35+
runtime:
36+
log:
37+
failure_level: warn
38+
format: pretty
39+
ui:
40+
bundle:
41+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.5/ui-bundle.zip
42+
snapshot: true

src/main/antora/antora.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: data-cassandra
2+
version: true
3+
title: Spring Data Cassandra
4+
nav:
5+
- modules/ROOT/nav.adoc
6+
ext:
7+
collector:
8+
- run:
9+
command: ./mvnw validate process-resources -pl :spring-data-cassandra-distribution -am -Pantora-process-resources
10+
local: true
11+
scan:
12+
dir: spring-data-cassandra-distribution/target/classes/
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2020-2023 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+
* https:://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.cassandra.example;
17+
18+
import static org.springframework.data.cassandra.core.query.Criteria.*;
19+
import static org.springframework.data.cassandra.core.query.Query.*;
20+
21+
import org.springframework.data.cassandra.core.CassandraTemplate;
22+
23+
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
24+
25+
/**
26+
* @author Mark Paluch
27+
*/
28+
// @formatter:off
29+
public class ReactiveCassandraTemplateExamples {
30+
31+
private ReactiveCassandraTemplate template = null;
32+
33+
void examples() {
34+
// tag::preparedStatement[]
35+
template.setUsePreparedStatements(true);
36+
37+
Mono<Actor> actorByQuery = template.selectOne(query(where("id").is(42)), Actor.class);
38+
39+
Mono<Actor> actorByStatement = template.selectOne(
40+
SimpleStatement.newInstance("SELECT id, name FROM actor WHERE id = ?", 42),
41+
Actor.class);
42+
// end::preparedStatement[]
43+
}
44+
45+
static class Actor {
46+
47+
}
48+
49+
}
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Copyright 2020-2023 the original author or authors.
2+
* Copyright 2023 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.
66
* You may obtain a copy of the License at
77
*
8-
* https:://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -73,6 +73,13 @@ public Actor mapRow(Row row, int rowNum) {
7373
}
7474
});
7575
// end::listOfRowMapper[]
76+
77+
// tag::preparedStatement[]
78+
Flux<String> lastNames = reactiveCqlTemplate.query(
79+
session -> session.prepare("SELECT last_name FROM t_actor WHERE id = ?"),
80+
ps -> ps.bind(1212L),
81+
(row, rowNum) -> row.getString(0));
82+
// end::preparedStatement[]
7683
}
7784

7885
// tag::findAllActors[]

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
* xref:index.adoc[Overview]
2+
** xref:commons/upgrade.adoc[]
3+
4+
* xref:cassandra.adoc[]
5+
** xref:cassandra/getting-started.adoc[]
6+
** xref:cassandra/configuration.adoc[]
7+
** xref:cassandra/schema-management.adoc[]
8+
** xref:cassandra/cql-template.adoc[]
9+
** xref:cassandra/reactive-cassandra.adoc[]
10+
** xref:cassandra/template.adoc[]
11+
** xref:cassandra/prepared-statements.adoc[]
12+
** xref:object-mapping.adoc[]
13+
** xref:cassandra/converters.adoc[]
14+
** xref:cassandra/events.adoc[]
15+
** xref:cassandra/auditing.adoc[]
16+
17+
* xref:repositories.adoc[]
18+
** xref:repositories/core-concepts.adoc[]
19+
** xref:repositories/definition.adoc[]
20+
** xref:cassandra/repositories/repositories.adoc[]
21+
** xref:repositories/create-instances.adoc[]
22+
** xref:repositories/query-methods-details.adoc[]
23+
** xref:cassandra/repositories/query-methods.adoc[]
24+
** xref:repositories/projections.adoc[]
25+
** xref:repositories/custom-implementations.adoc[]
26+
** xref:repositories/core-domain-events.adoc[]
27+
** xref:repositories/null-handling.adoc[]
28+
** xref:cassandra/repositories/cdi-integration.adoc[]
29+
** xref:repositories/query-keywords-reference.adoc[]
30+
** xref:repositories/query-return-types-reference.adoc[]
31+
32+
* xref:observability.adoc[]
33+
34+
* xref:kotlin.adoc[]
35+
** xref:kotlin/requirements.adoc[]
36+
** xref:kotlin/null-safety.adoc[]
37+
** xref:kotlin/object-mapping.adoc[]
38+
** xref:kotlin/extensions.adoc[]
39+
** xref:kotlin/coroutines.adoc[]
40+
41+
* xref:migration-guides.adoc[]
42+
** xref:migration-guide/migration-guide-1.5-to-2.0.adoc[]
43+
** xref:migration-guide/migration-guide-2.2-to-3.0.adoc[]
44+
** xref:migration-guide/migration-guide-3.0-to-4.0.adoc[]
45+
* https://github.com/spring-projects/spring-data-commons/wiki[Wiki]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[[cassandra.core]]
2+
= Cassandra Support
3+
:page-section-summary-toc: 1
4+
5+
Spring Data support for Apache Cassandra contains a wide range of features:
6+
7+
* Spring configuration support with Java-based `@Configuration` classes or the XML namespace.
8+
* The `CqlTemplate`, `AsyncCqlTemplate`, and `ReactiveCqlTemplate` helper classes that increases productivity by properly handling common Cassandra data access operations.
9+
* The `CassandraTemplate`, `AsyncCassandraTemplate`, and `ReactiveCassandraTemplate` helper classes that provide object mapping between CQL Tables and POJOs.
10+
* Exception translation into Spring's portable {springDocsUrl}data-access.html#dao-exceptions[Data Access Exception Hierarchy].
11+
* Feature rich object mapping integrated with _Spring's_ {springDocsUrl}core.html#core-convert[Conversion Service].
12+
* Annotation-based mapping metadata that is extensible to support other metadata formats.
13+
* Java-based query, criteria, and update DSLs.
14+
* Automatic implementation of imperative and reactive `Repository` interfaces including support for custom finder methods.
15+
16+
For most data-oriented tasks, you can use the `[Reactive|Async]CassandraTemplate` or the `Repository` support, both of which use the rich object-mapping functionality. `[Reactive|Async]CqlTemplate` is commonly used to increment counters or perform ad-hoc CRUD operations. `[Reactive|Async]CqlTemplate` also provides callback methods that make it easy to get low-level API objects, such as `com.datastax.oss.driver.api.core.CqlSession`, which lets you communicate directly with Cassandra.
17+
Spring Data for Apache Cassandra uses consistent naming conventions on objects in various APIs to those found in the DataStax Java Driver so that they are familiar and so that you can map your existing knowledge onto the Spring APIs.

src/main/asciidoc/reference/cassandra-auditing.adoc renamed to src/main/antora/modules/ROOT/pages/cassandra/auditing.adoc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
[[cassandra.auditing]]
2-
== General Auditing Configuration for Cassandra
2+
= Auditing Configuration for Cassandra
33

44
To activate auditing functionality, create a configuration as the following example shows:
55

6-
.Activating auditing by using XML configuration
7-
====
8-
.Java
9-
[source,java,role="primary"]
6+
.Activating auditing through configuration
7+
[tabs]
8+
======
9+
Java::
10+
+
11+
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
1012
----
1113
@Configuration
1214
@EnableCassandraAuditing
@@ -19,8 +21,9 @@ class Config {
1921
}
2022
----
2123
22-
.XML
23-
[source,xml,role="secondary"]
24+
XML::
25+
+
26+
[source,xml,indent=0,subs="verbatim,quotes",role="secondary"]
2427
----
2528
<?xml version="1.0" encoding="UTF-8"?>
2629
<beans xmlns="http://www.springframework.org/schema/beans"
@@ -35,7 +38,7 @@ class Config {
3538
<cassandra:auditing mapping-context-ref="customMappingContext" auditor-aware-ref="yourAuditorAwareImpl"/>
3639
</beans>
3740
----
38-
====
41+
======
3942

4043
If you expose a bean of type `AuditorAware` to the `ApplicationContext`, the auditing infrastructure picks it up automatically and uses it to determine the current user to be set on domain types.
4144
If you have multiple implementations registered in the `ApplicationContext`, you can select the one to be used by explicitly setting the `auditorAwareRef` attribute of `@EnableCassandraAuditing`.

0 commit comments

Comments
 (0)