Skip to content

Commit

Permalink
feat: create initial structure to OracleDocumentManager
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Jan 17, 2024
1 parent 1d55449 commit 9e06043
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public BucketManager apply(String bucketName) {
}

private void createTable(String bucketName) {
TableCreationConfiguration creationConfiguration = configuration.tableCreationConfiguration();
creationConfiguration.createTable(bucketName, configuration.serviceHandle());
var tableCreation = configuration.tableCreationConfiguration();
tableCreation.createTable(bucketName, configuration.serviceHandle());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2024 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:
*
* Otavio Santana
*/
package org.eclipse.jnosql.databases.oracle.communication;

import oracle.nosql.driver.NoSQLHandle;
import org.eclipse.jnosql.communication.document.DocumentDeleteQuery;
import org.eclipse.jnosql.communication.document.DocumentEntity;
import org.eclipse.jnosql.communication.document.DocumentManager;
import org.eclipse.jnosql.communication.document.DocumentQuery;

import java.time.Duration;
import java.util.Objects;
import java.util.stream.Stream;

final class OracleDocumentManager implements DocumentManager {
private final String table;
private final NoSQLHandle serviceHandle;

public OracleDocumentManager(String table, NoSQLHandle serviceHandle) {
this.table = table;
this.serviceHandle = serviceHandle;
}

@Override
public String name() {
return table;
}

@Override
public DocumentEntity insert(DocumentEntity entity) {
Objects.requireNonNull(entity, "entity is required");

return null;
}

@Override
public DocumentEntity insert(DocumentEntity entity, Duration ttl) {
return null;
}

@Override
public Iterable<DocumentEntity> insert(Iterable<DocumentEntity> entities) {
return null;
}

@Override
public Iterable<DocumentEntity> insert(Iterable<DocumentEntity> entities, Duration ttl) {
return null;
}

@Override
public DocumentEntity update(DocumentEntity entity) {
return null;
}

@Override
public Iterable<DocumentEntity> update(Iterable<DocumentEntity> entities) {
return null;
}

@Override
public void delete(DocumentDeleteQuery query) {

}

@Override
public Stream<DocumentEntity> select(DocumentQuery query) {
return null;
}

@Override
public long count(String documentCollection) {
return 0;
}

@Override
public void close() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
package org.eclipse.jnosql.databases.oracle.communication;

import oracle.nosql.driver.NoSQLHandle;
import org.eclipse.jnosql.communication.document.DocumentManager;
import org.eclipse.jnosql.communication.document.DocumentManagerFactory;

Expand All @@ -25,20 +24,22 @@
* The Oracle implementation to {@link DocumentManagerFactory}
*/
class OracleDocumentManagerFactory implements DocumentManagerFactory {
private final NoSQLHandle serviceHandle;
private final NoSQLHandleConfiguration configuration;

public OracleDocumentManagerFactory(NoSQLHandle serviceHandle) {
this.serviceHandle = serviceHandle;
public OracleDocumentManagerFactory(NoSQLHandleConfiguration configuration) {
this.configuration = configuration;
}

@Override
public void close() {
this.serviceHandle.close();
this.configuration.serviceHandle().close();
}

@Override
public DocumentManager apply(String table) {
Objects.requireNonNull(table, "table is required");
return null;
var tableCreation = this.configuration.tableCreationConfiguration();
tableCreation.createTable(table, configuration.serviceHandle());
return new OracleDocumentManager(table, configuration.serviceHandle());
}
}

0 comments on commit 9e06043

Please sign in to comment.