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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb;
package org.seedstack.mongodb;

import com.mongodb.async.SingleResultCallback;
import com.mongodb.async.client.MongoClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb;
package org.seedstack.mongodb;

import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

[org.seedstack.seed.persistence.mongodb]
[org.seedstack.mongodb]
clients = client1, client2, client3

[org.seedstack.seed.persistence.mongodb.client.client1]
[org.seedstack.mongodb.client.client1]
hosts = localhost
option.connectionsPerHost = 50
databases = db1

[org.seedstack.seed.persistence.mongodb.client.client2]
[org.seedstack.mongodb.client.client2]
async = true
hosts = localhost
setting.connectionPool.maxSize = 50
databases = db2

[org.seedstack.seed.persistence.mongodb.client.client3]
[org.seedstack.mongodb.client.client3]
async = true
hosts = localhost
databases = db2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
* 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.seed.persistence.mongodb.internal;
package org.seedstack.mongodb.morphia.internal;

import com.google.inject.Module;
import com.mongodb.AuthenticationMechanism;
import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress;
import org.apache.commons.configuration.Configuration;
import org.seedstack.seed.core.api.SeedException;
import org.seedstack.seed.persistence.mongodb.api.MongoDbErrorCodes;
import org.seedstack.seed.SeedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb.internal;
package org.seedstack.mongodb.morphia.internal;

import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
Expand All @@ -23,8 +23,7 @@
import com.mongodb.selector.ServerSelector;
import org.apache.commons.configuration.Configuration;
import org.bson.codecs.configuration.CodecRegistry;
import org.seedstack.seed.core.api.SeedException;
import org.seedstack.seed.persistence.mongodb.api.MongoDbErrorCodes;
import org.seedstack.seed.SeedException;

import java.util.Iterator;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 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.seed.persistence.mongodb.api;
package org.seedstack.mongodb.morphia.internal;

import org.seedstack.seed.core.api.ErrorCode;
import org.seedstack.seed.ErrorCode;

public enum MongoDbErrorCodes implements ErrorCode {
MISSING_URI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb.internal;
package org.seedstack.mongodb.morphia.internal;

import com.google.inject.Module;
import org.apache.commons.configuration.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb.internal;
package org.seedstack.mongodb.morphia.internal;

import com.google.inject.AbstractModule;
import com.google.inject.Key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb.internal;
package org.seedstack.mongodb.morphia.internal;

import com.google.inject.AbstractModule;
import io.nuun.kernel.api.Plugin;
Expand All @@ -14,10 +14,9 @@
import io.nuun.kernel.api.plugin.context.InitContext;
import io.nuun.kernel.core.AbstractPlugin;
import org.apache.commons.configuration.Configuration;
import org.seedstack.seed.core.api.Application;
import org.seedstack.seed.core.api.SeedException;
import org.seedstack.seed.Application;
import org.seedstack.seed.SeedException;
import org.seedstack.seed.core.internal.application.ApplicationPlugin;
import org.seedstack.seed.persistence.mongodb.api.MongoDbErrorCodes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -27,9 +26,9 @@
import java.util.Set;

public class MongoDbPlugin extends AbstractPlugin {
public static final String MONGO_PLUGIN_CONFIGURATION_PREFIX = "org.seedstack.seed.persistence.mongodb";

private static final Logger LOGGER = LoggerFactory.getLogger(MongoDbPlugin.class);
public static final String CONFIGURATION_PREFIX = "org.seedstack.mongodb";

private static class SyncHolder {
private static final MongoDbManager INSTANCE = new SyncMongoDbManager();
Expand All @@ -44,7 +43,7 @@ private static class AsyncHolder {

@Override
public String name() {
return "seed-persistence-mongodb-plugin";
return "mongodb";
}

@Override
Expand All @@ -56,7 +55,7 @@ public InitState init(InitContext initContext) {
for (Plugin plugin : initContext.pluginsRequired()) {
if (plugin instanceof ApplicationPlugin) {
application = ((ApplicationPlugin) plugin).getApplication();
mongoConfiguration = application.getConfiguration().subset(MongoDbPlugin.MONGO_PLUGIN_CONFIGURATION_PREFIX);
mongoConfiguration = application.getConfiguration().subset(MongoDbPlugin.CONFIGURATION_PREFIX);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb.internal;
package org.seedstack.mongodb.morphia.internal;

import com.mongodb.DBDecoderFactory;
import com.mongodb.DBEncoderFactory;
Expand All @@ -19,8 +19,7 @@
import com.mongodb.client.MongoDatabase;
import org.apache.commons.configuration.Configuration;
import org.bson.codecs.configuration.CodecRegistry;
import org.seedstack.seed.core.api.SeedException;
import org.seedstack.seed.persistence.mongodb.api.MongoDbErrorCodes;
import org.seedstack.seed.SeedException;

import javax.net.SocketFactory;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
org.seedstack.seed.persistence.mongodb.internal.MongoDbPlugin
org.seedstack.mongodb.morphia.internal.MongoDbPlugin
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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.seed.persistence.mongodb;
package org.seedstack.mongodb.morphia;

import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
Expand Down
Loading