Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ cache:
directories:
- "$HOME/.m2/repository"

before_install:
- gpg --fast-import gpg.asc

install:
- echo "<settings><servers><server><id>bintray</id><username>\${env.BINTRAY_USER}</username><password>\${env.BINTRAY_KEY}</password></server></servers></settings>" > ~/.m2/settings.xml
- echo "<settings><servers><server><id>ossrh</id><username>\${env.SONATYPE_USER}</username><password>\${env.SONATYPE_PASSWORD}</password></server></servers></settings>" > ~/.m2/settings.xml
- if [[ $TRAVIS_PULL_REQUEST = false ]] && [[ $TRAVIS_BRANCH = master || $TRAVIS_BRANCH = dev-* ]] || [[ $TRAVIS_TAG = v* ]]; then GOAL=deploy; else GOAL=install; fi
- if [[ $TRAVIS_TAG = v* ]]; then ADDITIONAL_PROFILES=release; mvn -q -U org.seedstack:seedstack-maven-plugin:release; else ADDITIONAL_PROFILES=snapshots; fi
- if [[ $TRAVIS_TAG = v* ]]; then ADDITIONAL_PROFILES=release; mvn -q -U org.seedstack:seedstack-maven-plugin:release; fi

script: mvn -U -Pbuild-number,compatibility,bintray,quality,javadoc,$ADDITIONAL_PROFILES $GOAL jacoco:report
script: mvn -U -Pbuild-number,compatibility,javadoc,quality,$ADDITIONAL_PROFILES $GOAL

after_success: mvn -q coveralls:report -DrepoToken=$COVERALLS_TOKEN
22 changes: 16 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 3.1.3 (2021-07-31)

* [fix] Avoid calling `ensureIndexes()` and `ensureCaps()` for each datastore instantiation which adds a considerable
overhead in some circumstances. It is now done at application startup and can be controlled with
`mongoDb.morphia.ensureCapsAtStartup` and `mongoDb.morphia.ensureIndexesAtStartup` config options.

# Version 3.1.2 (2020-08-05)

* [chg] Updated for seed 3.10+
Expand All @@ -8,21 +14,24 @@

# Version 3.1.0 (2020-01-31)

* [new] Morphia repository now has the ability to stream results from the database as consumed (using a cursor instead of a list behind the scenes).
* [new] Morphia repository now has the ability to stream results from the database as consumed (using a cursor instead
of a list behind the scenes).
* [chg] Update the Morphia module to work with business framework 4.3.0+.
* [chg] Updated Morphia to 1.5.8 (its package has changed to `dev.morphia`, update project code accordingly if necessary).
* [chg] Updated Morphia to 1.5.8 (its package has changed to `dev.morphia`, update project code accordingly if
necessary).

# Version 3.0.2 (2019-01-10)

* [fix] Fix issue #11: an exception occurred at startup because the way of accessing the ValidationFactory changed.
* [fix] Fix issue #11: an exception occurred at startup because the way of accessing the ValidationFactory changed.

# Version 3.0.1 (2019-01-10)

* [fix] During translation of composite specifications (or, and), set the field for each member (avoid "No field has been set" exception).
* [fix] During translation of composite specifications (or, and), set the field for each member (avoid "No field has
been set" exception).

# Version 3.0.0 (2017-11-30)

* [new] Implements automatic translation of business specifications to Morphia queries.
* [new] Implements automatic translation of business specifications to Morphia queries.

# Version 2.0.0 (2017-01-13)

Expand All @@ -31,7 +40,8 @@
# Version 1.1.0 (2016-04-26)

* [new] Automatically build indexes
* [new] Add Bean Validation support to Morphia (at pre-persist) when SeedStack validation add-on is present in the classpath.
* [new] Add Bean Validation support to Morphia (at pre-persist) when SeedStack validation add-on is present in the
classpath.
* [new] Add `exists()` and `count()` in `BaseMorphiaRepository` according to change in business framework.
* [chg] Update for SeedStack 16.4.
* [brk] Remove `do*()` methods in `BaseMorphiaRepository` according to change in business framework.
Expand Down
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--

Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--

Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
# Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
# Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/org/seedstack/mongodb/MongoDbIT.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
# Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
91 changes: 91 additions & 0 deletions gpg.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----

lQIVBFURkDoBEAD77xeWlHPAay/mareRGHhlc/x7IY1T6GRge71bh8M29ha6WoXt
ES+ypXXIibKlcFA/IBb9Sihw2kkCZ/KPJoG94HsjrbdHGZcCdJKNXI4UcXekLTeb
yldVorR0VKe1bkv7TAfz8Qi3NZ+kBs3WQb9uNrsasm4eO2L7/A8FO08kvXnzm41l
wI3OCeioiKyk3CgWptTgFvKxTueJNXmbYyDO3TPcRxEgJfoa/r5dRrqZsaPELuzI
FEaSf4dfL9j2DtX/iBJ0u1ZJBax9Fa9LQxGg9GflJA2HVVDnMU9nI554aNUvRAYw
zBg9awgUGX2p0Il/2oVWGdHSg/EskQDka5liJFkTD9XXSEEzNl8Wp3c+mPS46xuW
xEYaQoZ5udtwjoUN5CZwm9qhwvf3RXEAzD/jMoPs3RyMekUEHJOEx+0GP1VoqV7J
yrnBmvcq18mKLQHblKCAe2+whdEwJ/aZ5F5sV6RLSe/tXpDiGy8jdp2eIpkSOnEZ
gyRyTDv7sw/S3EhXDsZeqxNJTakT8BHcCUX91w0bwbxOULCkS8utPh/SfenXN7JN
6ER42HtNr75UQT2yA8NIYjhSdwgSPym8+YXnv+h4MSz0fuF2GTb3YF1FLEuauqhn
f+bU2sBNRB2QnlSMo39DvFPNZyiZUWPIw4V7TvIct7mxNb4QWsUIn0SB5wARAQAB
/w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lW1CTnMRg9YpNliiBHVNo2xuqk17Ozy0xF6/b/I9ilQwRspVgXpB9
0hozsKne4TKAR2/ymnqbyKG3znRH1UvQZzuzxIh/CM8WzXkgppGE95xqOhKUKvfG
2pIJj0CXmi71ZKJSKi7ADH+djn1ZApM25dxfMOHDIAk06AByaIfum4gJL7k4jsfA
pZyjFDQTryNlHk6HkXCgP6jy1xtkcpJiPq7nFozt7kdMfoImIjLQUJ7wiSdgZBqb
XwquCSxipiTcJfcrVIRQ34ZyuM5Z1IB+RF3cr49Rn65bWUpfH6IldxQYb69Cmhyl
Uq4vi2E9jBjDAsN3/U3sdJxIHG2Qs7cVDDJpIKiBTQ58vuupK48PcWio0MQWKFda
NDK7X7mEtWvm0XqJWWCpLc/lodMt+/qlgEYxDoh1f+Hg+AxdW+UtIrj12LVDfJw+
ETb3Y/mF0OlCQR56l7Zevp+0ocOvpd8KGWAqfATqaMf/+WDX7TwEJ2X0olqTAgA4
qS7F7RHN99ohApUrCRL6BqGtbAtFFrzf8OOuI7/AH7Hg0+yxaTNBZdTtWfcTee0e
qpkiNhkcsyZy438ObChQNBosqf7znI+BOf4GTEBDCtKyM0ZYpsV1nkTTz6xMhK8=
=LXKR
-----END PGP PRIVATE KEY BLOCK-----
2 changes: 1 addition & 1 deletion morphia/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--

Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.mongodb.morphia;

import org.seedstack.coffig.Config;

@Config("mongoDb.morphia")
public class MorphiaConfig {
private boolean ensureCapsAtStartup = true;
private boolean ensureIndexesAtStartup = true;

public boolean isEnsureCapsAtStartup() {
return ensureCapsAtStartup;
}

public MorphiaConfig setEnsureCapsAtStartup(boolean ensureCapsAtStartup) {
this.ensureCapsAtStartup = ensureCapsAtStartup;
return this;
}

public boolean isEnsureIndexesAtStartup() {
return ensureIndexesAtStartup;
}

public MorphiaConfig setEnsureIndexesAtStartup(boolean ensureIndexesAtStartup) {
this.ensureIndexesAtStartup = ensureIndexesAtStartup;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.mongodb.morphia.internal;

import static org.seedstack.mongodb.morphia.internal.MorphiaUtils.createDatastoreAnnotation;
import static org.seedstack.mongodb.morphia.internal.MorphiaUtils.getMongoClientConfig;

import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.name.Names;
import com.mongodb.MongoClient;
import dev.morphia.Datastore;
import dev.morphia.Morphia;
import javax.inject.Inject;
import org.seedstack.mongodb.morphia.MorphiaDatastore;
import org.seedstack.seed.Application;

import javax.inject.Inject;

import static org.seedstack.mongodb.morphia.internal.MorphiaUtils.createDatastoreAnnotation;
import static org.seedstack.mongodb.morphia.internal.MorphiaUtils.getMongoClientConfig;

public class DatastoreFactory {
private final Application application;
private final Injector injector;
Expand All @@ -33,20 +34,20 @@ public class DatastoreFactory {
}

public Datastore createDatastore(Class<?> morphiaClass) {
MorphiaDatastore datastoreAnnotation = createDatastoreAnnotation(application, morphiaClass);
return createDatastore(createDatastoreAnnotation(application, morphiaClass));
}

public Datastore createDatastore(MorphiaDatastore datastoreAnnotation) {
return createDatastore(datastoreAnnotation.clientName(), datastoreAnnotation.dbName());
}

public Datastore createDatastore(String clientName, String dbName) {
Datastore datastore = morphia.createDatastore(
return morphia.createDatastore(
injector.getInstance(Key.get(MongoClient.class, Names.named(clientName))),
MorphiaUtils.resolveDatabaseAlias(
getMongoClientConfig(application, clientName),
dbName
)
);
datastore.ensureIndexes();
datastore.ensureCaps();
return datastore;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Loading