Skip to content

Commit

Permalink
chore: create DocumentManagerFactory
Browse files Browse the repository at this point in the history
Signed-off-by: Maximillian Arruda <dearrudam@gmail.com>
  • Loading branch information
dearrudam committed Mar 12, 2024
1 parent 19fe365 commit cb47741
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class DynamoDBDocumentConfiguration extends DynamoDBConfiguration
implements DocumentConfiguration {
@Override
public DocumentManagerFactory apply(Settings settings) {
return null;
var dynamoDB = getDynamoDB(settings);
return new DynamoDBDocumentManagerFactory(dynamoDB);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Maximillian Arruda
*/

package org.eclipse.jnosql.databases.dynamodb.communication;

import org.eclipse.jnosql.communication.document.DocumentManager;
import org.eclipse.jnosql.communication.document.DocumentManagerFactory;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;

import java.util.Optional;

public class DynamoDBDocumentManagerFactory implements DocumentManagerFactory {

private final DynamoDbClient dynamoDB;

public DynamoDBDocumentManagerFactory(DynamoDbClient dynamoDB) {
this.dynamoDB = dynamoDB;
}

@Override
public DocumentManager apply(String s) {
return null;
}

@Override
public void close() {
Optional.ofNullable(this.dynamoDB).ifPresent(DynamoDbClient::close);
}
}

0 comments on commit cb47741

Please sign in to comment.