Skip to content

Commit 5ef33e3

Browse files
Merge pull request #34 from xdev-software/docs
Docs
2 parents 8514615 + ce893a5 commit 5ef33e3

19 files changed

+747
-0
lines changed

.github/workflows/antora-build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Antora Documentation Build # Name of the GitHub Actions workflow
2+
3+
on: workflow_dispatch # This workflow is triggered manually
4+
5+
env:
6+
ACTIONS_STEP_DEBUG : true
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read # Read permission for repository contents
11+
pages: write # Write permission for GitHub Pages
12+
id-token: write # Write permission for ID token
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest # Run the job on a machine with the latest version of Ubuntu
17+
18+
environment:
19+
name: github-pages # Environment name
20+
url: https://github.com/xdev-software/spring-data-eclipse-store
21+
22+
steps:
23+
- name: Checkout repository # Step to check out the repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Node.js # Step to install Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 18 # Specify Node.js version
30+
31+
- name: Install Antora and the Antora Lunr Extension # Step to install Antora and the Lunr extension
32+
run: npm i antora @antora/lunr-extension
33+
34+
- name: Generate Site # Step to generate the documentation site
35+
run: GIT_CREDENTIALS=https://${{ secrets.GITHUB_TOKEN }}:@github.com npx antora docs/antora-playbook.yml --fetch --stacktrace #GIT_CREDENTIALS are needed if the source repo with the documentation is private!
36+
37+
- name: Setup Pages # Step to set up GitHub Pages
38+
uses: actions/configure-pages@v3
39+
40+
- name: Upload artifact # Step to upload an artifact
41+
uses: actions/upload-pages-artifact@v2
42+
with:
43+
name: site # Specify the name of the artifact
44+
path: docs/site # Specify the path to the artifact
45+
46+
- name: Deploy to GitHub Pages # Step to deploy the site to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v2
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }} # Specify the GitHub token for deployment
51+
artifact_name: site # Specify the name of the artifact to deploy

docs/antora-playbook.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
site:
2+
title: Spring-Data-Eclipse-Store
3+
url: https://xdev-software.github.io/spring-data-eclipse-store/
4+
robots: allow
5+
6+
# see https://docs.antora.org/antora/2.3/playbook/configure-runtime/
7+
runtime:
8+
cache_dir: ./.cache/antora
9+
log:
10+
# use pretty even on CI
11+
format: pretty
12+
# set to info to get details from the Antora extensions
13+
level: info
14+
# Antora exits with a non-zero exit code if an error is logged -> https://docs.antora.org/antora/latest/playbook/runtime-log-failure-level
15+
failure_level: error
16+
17+
content:
18+
sources:
19+
# url of the repo
20+
- url: https://github.com/xdev-software/spring-data-eclipse-store
21+
start_path: docs
22+
branches:
23+
- "master"
24+
25+
ui:
26+
bundle:
27+
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/master/raw/build/ui-bundle.zip?job=bundle-stable
28+
snapshot: true
29+
supplemental_files: ./supplemental-ui
30+
31+
output:
32+
dir: ./site
33+
34+
antora:
35+
extensions:
36+
- require: '@antora/lunr-extension'

docs/antora.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: manual
2+
title: Spring-Data-Eclipse-Store
3+
version: master
4+
display_version: '1.0'
5+
start_page: index.adoc
6+
nav:
7+
- modules/ROOT/nav.adoc
8+
asciidoc:
9+
attributes:
10+
product-name: 'Spring-Data-Eclipse-Store'
11+
display-version: '1.0.3'
12+
maven-version: '1.0.3'
13+
page-editable: false
14+
page-out-of-support: false

docs/modules/ROOT/assets/images/WorkingCopy_1.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/modules/ROOT/assets/images/WorkingCopy_2.svg

Lines changed: 4 additions & 0 deletions
Loading

docs/modules/ROOT/nav.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* xref:index.adoc[Home]
2+
* xref:installation.adoc[Installation]
3+
* xref:working-copies.adoc[Working Copies]
4+
* xref:migration.adoc[Migration]
5+
* xref:known-issues.adoc[Known issues]

docs/modules/ROOT/pages/index.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
= Overview
2+
3+
== About Spring-Data-Eclipse-Store
4+
5+
A library to simplify using https://eclipsestore.io/[EclipseStore] in the https://spring.io/projects/spring-data/[Spring environment].
6+
7+
What makes this library special is, that it creates a xref:working-copies.adoc[working copy] of the data.
8+
This way EclipseStore behaves almost exactly like relational database from a coding perspective.
9+
10+
== Features
11+
12+
The library provides following features:
13+
14+
* Enforces the
15+
https://docs.spring.io/spring-data/jpa/reference/repositories/core-concepts.html[Spring data repository concept]
16+
for EclipseStore by using xref:working-copies.adoc[working copies].
17+
* xref:installation.adoc#drop-in-compatible[Drop in compatible] for your existing Spring application
18+
* Utilizes *ultra-fast EclipseStore serializing and storing*
19+
* Enables your application to select any https://docs.eclipsestore.io/manual/storage/storage-targets/index.html[EclipseStore target] (e.g.
20+
https://docs.eclipsestore.io/manual/storage/storage-targets/sql-databases/postgresql.html[PostgreSQL],
21+
https://docs.eclipsestore.io/manual/storage/storage-targets/blob-stores/aws-s3.html[AWS S3] or
22+
https://github.com/xdev-software/eclipse-store-afs-ibm-cos[IBM COS])
23+
* Can save up to *99%footnote:[If the COS Connector is used in the IBM Cloud instead of a PostgreSQL and approx. 10,000 entries with a total size of 1 GB of data are stored. (https://cloud.ibm.com/estimator/estimates[IBM Cloud Pricing], as of 08.01.2024)] of monthly costs* in the IBM Cloud and up to 82%footnote:[If the S3 connector is used instead of DynamoDB under the same conditions at AWS.
24+
(https://calculator.aws/#/estimate?id=ab85cddf77f0d1aa0457111ed82785dfb836b1d8[AWS Pricing Calculator], as of 08.01.2024)] in the AWS Cloud
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
= Installation
2+
3+
== Build Configuration
4+
5+
You can find the {product-name} libraries in the Maven Central repository.
6+
7+
Simply add the following dependency to your maven project
8+
9+
[source,xml,subs=attributes+,title="Maven [pom.xml]"]
10+
----
11+
<dependencies>
12+
<dependency>
13+
<groupId>software.xdev</groupId>
14+
<artifactId>spring-data-eclipse-store</artifactId>
15+
<version>{maven-version}</version>
16+
</dependency>
17+
</dependencies>
18+
----
19+
20+
Also see the https://github.com/xdev-software/spring-data-eclipse-store/releases/latest#Installation[installation guide for the latest release].
21+
22+
== Configuration
23+
24+
After adding the library in your dependencies, using it is as easy as adding the ``@EnableEclipseStoreRepositories`` annotation to your ``@SpringBootApplication`` annotation.
25+
26+
[NOTE]
27+
====
28+
Since the library is using reflection to copy data, the following JVM-Arguments may have to be set.
29+
30+
[source,title="JVM Arguments"]
31+
----
32+
--add-opens=java.base/java.util=ALL-UNNAMED
33+
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
34+
--add-opens=java.base/java.lang=ALL-UNNAMED
35+
--add-opens=java.base/java.time=ALL-UNNAMED
36+
----
37+
====
38+
39+
== Demo
40+
41+
To see how easy it is to implement EclipseStore in your Spring project, take a look at the three https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo[demos]:
42+
A https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/simple[simple], a more https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex[complex demo] and a https://github.com/xdev-software/spring-data-eclipse-store/tree/develop/spring-data-eclipse-store-jpa/src/main/java/software/xdev/spring/data/eclipse/store/jpa[demo with coexisting JPA].
43+
44+
== Drop in compatible [[drop-in-compatible]]
45+
//TODO
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
= Known issues
2+
3+
== Lazy references
4+
5+
One of the core features of EclipseStore is its https://docs.eclipsestore.io/manual/storage/loading-data/lazy-loading/index.html[Lazy references].
6+
Unfortunately this requires our library to implement some kind of proxy.
7+
That's something that takes a lot of effort to implement in our {product-name}.
8+
9+
We created https://github.com/xdev-software/spring-data-eclipse-store/issues/31[an issue] for that but right now we *do not support Lazy references*.
10+
11+
== Query annotations
12+
13+
In Spring-Data-JPA you can write a Query over methods of repositories like this:
14+
15+
[source,java,title="From https://github.com/spring-projects/spring-petclinic/blob/main/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java[spring-petclinic]"]
16+
----
17+
@Query("SELECT ptype FROM PetType ptype ORDER BY ptype.name")
18+
List<PetType> findPetTypes();
19+
----
20+
21+
We created https://github.com/xdev-software/spring-data-eclipse-store/issues/32[an issue] for that but right now we *do not support Query annotations*.
22+
23+
== Data changes
24+
25+
There are two basic ways to keep your data up to date.
26+
27+
=== Structural
28+
29+
As with most projects, data that needs persisting changes over time.
30+
In EclipseStore that's handled through https://docs.eclipsestore.io/manual/storage/legacy-type-mapping/index.html[Legacy Type Mapping].
31+
32+
That consists of https://docs.eclipsestore.io/manual/storage/legacy-type-mapping/index.html#_automatic_mapping[Automatic Mapping] through EclipseStores internal heuristic and https://docs.eclipsestore.io/manual/storage/legacy-type-mapping/index.html#explicit-mapping[Explicit Mapping] by the user.
33+
34+
=== Values
35+
36+
There is a library to version your data in the store called https://github.com/xdev-software/micro-migration[XDEV MicroMigration].
37+
This helps you keep your data up to date regardless of the current version.
38+
39+
We created https://github.com/xdev-software/spring-data-eclipse-store/issues/33[an issue] for that but right now we *do not support XDEVs MicroMigration*.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
= Migration
2+
3+
Migrating from Spring Data JPA is very easy.
4+
We implemented a https://github.com/xdev-software/spring-data-eclipse-store-migration[OpenRewrite recipe] for that.
5+
It can be executed with a simple Maven command:
6+
7+
[source,title="Maven"]
8+
----
9+
mvn org.openrewrite.maven:rewrite-maven-plugin:run \
10+
-Drewrite.recipeArtifactCoordinates=software.xdev:spring-data-eclipse-store-migration \
11+
-Drewrite.activeRecipes=software.xdev.spring.data.eclipse.store.JpaMigration
12+
----
13+
14+
[CAUTION]
15+
====
16+
Since {product-name} can't handle ``@Query``-Annotations, these annotations are getting removed by the Rewrite-Recipe.
17+
====
18+
19+
== Data
20+
21+
To import data from different data sources like JPA, you can simply let the ``EclipseStoreDataImporterComponent`` get injected and then call ``importData()``.
22+
This reads all instances of ``EntityManagerFactory``, creates EclipseStoreRepositories for it and then imports that data.
23+
This can take quite some time if you have a lot of data.
24+
25+
[source,java]
26+
----
27+
@Autowired
28+
private EclipseStoreDataImporterComponent eclipseStoreDataImporter;
29+
30+
void importDataFromJpaToEclipseStore()
31+
{
32+
final List<SimpleEclipseStoreRepository<?, ?>> repositories = this.eclipseStoreDataImporter.importData();
33+
}
34+
----
35+
36+
After that you can change your JpaRepositories to EclipseStoreRepositories and you're done.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
= Working copies
2+
3+
If you use EclipseStore without our library, EclipseStore loads the data from the datastore directly into memory. You make your changes on these loaded Java objects and by calling ``store`` EclipseStore writes it directly from memory to the datastore.
4+
5+
image::../images/WorkingCopy_1.svg[Native behavior of EclipseStore]
6+
7+
If you e.g. change the address of a person, the changed address is already in your data model, *even before storing* this person.
8+
This is very different from the behavior a Spring user expects.
9+
10+
image::../images/WorkingCopy_2.svg[Behavior of EclipseStore with Spring-Data-Eclipse-Store]
11+
12+
With {product-name} every time an object is loaded from the datastore, a working copy of that object (or rather the object tree) is created and returned to the user.
13+
Therefore, the user can make the changes on the working copy without any changes to the actual data model.
14+
The changes are only persisted after calling ``save`` on a repository.
15+

docs/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"dependencies": {
3+
"@antora/lunr-extension": "^1.0.0-alpha.8"
4+
},
5+
"devDependencies": {
6+
"@antora/cli": "3.1.4",
7+
"@antora/site-generator": "3.1.4"
8+
}
9+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
body {
2+
font-family: sans-serif;
3+
}
4+
5+
.navbar {
6+
background-color: #fff;
7+
}
8+
9+
footer.footer {
10+
color: #fff;
11+
background-color: #333333;
12+
}
13+
14+
footer.footer a,
15+
footer.footer .link-separator
16+
{
17+
color: #c02222;
18+
}
19+
20+
.navbar-item {
21+
padding: 0px 8px;
22+
}
23+
24+
.navbar-brand .navbar-item.logo {
25+
align-self: center;
26+
padding: 0;
27+
}
28+
29+
.navbar-brand .navbar-item.logo img {
30+
width: inherit;
31+
}
32+
33+
.navbar-brand .navbar-item.title {
34+
align-self: center;
35+
color: var(--navbar-font-color);
36+
font-size: 1rem;
37+
line-height: 1;
38+
position: relative;
39+
top: 0.06em; /* compensate for built-in line height in font */
40+
letter-spacing: -0.02em;
41+
padding: 0;
42+
margin: 0 1rem;
43+
}
44+
45+
.doc h1 {
46+
color: #333333;
47+
}
365 Bytes
Loading
632 Bytes
Loading

0 commit comments

Comments
 (0)