All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xlrit.gears.plugin.mongo.MongoExportTargetFactory Maven / Gradle / Ivy

There is a newer version: 1.17.6
Show newest version
package com.xlrit.gears.plugin.mongo;

import java.util.Objects;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.xlrit.gears.engine.export.ExportTarget;
import com.xlrit.gears.engine.export.ExportTargetFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class MongoExportTargetFactory implements ExportTargetFactory {
	private final ObjectMapper objectMapper;
	private final MongoExportProperties properties;

	@Override
	public String getType() {
		return "mongo";
	}

	@Override
	public ExportTarget create() {
		String connectionString = Objects.requireNonNull(properties.getConnectionString(), "connectionString must be configured");
		String database = Objects.requireNonNull(properties.getDatabase(), "database must be configured");
		MongoConfig config = new MongoConfig(connectionString, database);
		return new MongoExportTarget(config, objectMapper);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy