Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c7281ba
Remove interconnected IMA, Thrift, and ClientImpl non-public methods
SethSmucker Jan 5, 2026
0a9b879
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Jan 7, 2026
bb272c5
Fix code formatting issues
SethSmucker Jan 20, 2026
0ebe50b
Remove unused getClientContext utility from AccumuloConnectionFactory
SethSmucker Jan 20, 2026
03036a7
Clarify intentionally unsupported methods in InMemoryAccumulo
SethSmucker Jan 22, 2026
d8cad0b
Merge with integration
SethSmucker Feb 2, 2026
6737af1
Add imports back in
ivakegg Feb 2, 2026
d66e1f0
Added in too many
ivakegg Feb 2, 2026
3d45749
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Feb 19, 2026
446f8d2
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Feb 19, 2026
4242425
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Feb 19, 2026
335b8b5
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Feb 20, 2026
8fd9787
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Feb 24, 2026
40ac34c
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker Mar 24, 2026
0d73343
Merge branch 'integration' into task/ima-remove-the-rest
SethSmucker Apr 14, 2026
ff23270
Merge branch 'integration' into task/ima-remove-the-rest
lbschanno Apr 24, 2026
d7d4e81
Address lbschanno and ddanielr review feedback
SethSmucker Apr 28, 2026
e7f210d
Remove unused AccumuloSecurityException import from InMemoryConnector
SethSmucker May 5, 2026
834df62
Restore createConditionalWriter(String) required by AccumuloClient in…
SethSmucker May 6, 2026
76a6d48
Merge remote-tracking branch 'origin/integration' into task/ima-remov…
SethSmucker May 6, 2026
b4ed005
Merge branch 'integration' into task/ima-remove-the-rest
lbschanno May 6, 2026
cf5efdc
Merge branch 'integration' into task/ima-remove-the-rest
foster33 May 7, 2026
1df942a
Merge remote-tracking branch 'origin/task/ima-remove-the-rest' into t…
SethSmucker May 12, 2026
d5f90a0
Make username field final, remove unnecessary throws declarations
SethSmucker May 12, 2026
2295bd7
Bump in-memory-accumulo to 4.0.6-SNAPSHOT and fix MockMetadataHelper
SethSmucker May 12, 2026
3cdd7f5
Merge branch 'integration' into task/ima-remove-the-rest
SethSmucker May 12, 2026
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,10 +5,8 @@
import java.util.Map;

import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.clientImpl.ClientContext;

import datawave.core.common.result.ConnectionPool;
import datawave.webservice.common.connection.WrappedAccumuloClient;

public interface AccumuloConnectionFactory extends AutoCloseable {

Expand Down Expand Up @@ -110,21 +108,4 @@ AccumuloClient getClient(String userDN, Collection<String> proxyServers, String
* @return A map representation
*/
Map<String,String> getTrackingMap(StackTraceElement[] stackTrace);

/**
* Utility method to unwrap the ClientContext instance within {@link WrappedAccumuloClient} as needed
*
* @param accumuloClient
* {@link AccumuloClient} instance
* @return {@link WrappedAccumuloClient#getReal()}, if applicable; accumuloClient itself, if it implements {@link ClientContext}; otherwise returns null
*/
static ClientContext getClientContext(AccumuloClient accumuloClient) {
ClientContext cc = null;
if (accumuloClient instanceof WrappedAccumuloClient) {
cc = (ClientContext) ((WrappedAccumuloClient) accumuloClient).getReal();
} else if (accumuloClient instanceof ClientContext) {
cc = (ClientContext) accumuloClient;
}
return cc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,43 @@
import org.apache.accumulo.core.client.admin.SecurityOperations;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.clientImpl.ClientContext;
import org.apache.accumulo.core.clientImpl.Credentials;
import org.apache.accumulo.core.clientImpl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.singletons.SingletonReservation;

public class InMemoryAccumuloClient extends ClientContext implements AccumuloClient {
/**
* In-memory implementation of {@link AccumuloClient} for testing. Does not connect to a real Accumulo instance.
*/
public class InMemoryAccumuloClient implements AccumuloClient {

String username;
private final InMemoryAccumulo acu;

public InMemoryAccumuloClient(String username, InMemoryInstance instance) throws AccumuloSecurityException {
this(new Credentials(username, new PasswordToken(new byte[0])), instance.acu);
}

public InMemoryAccumuloClient(Credentials credentials, InMemoryAccumulo acu) throws AccumuloSecurityException {
super(SingletonReservation.noop(), new InMemoryClientInfo(credentials), DefaultConfiguration.getInstance(), null);
if (credentials.getToken().isDestroyed())
throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.TOKEN_EXPIRED);
this.username = credentials.getPrincipal();
this.acu = acu;
public InMemoryAccumuloClient(String username, InMemoryInstance instance) {
this.username = username;
this.acu = instance.acu;
if (!acu.users.containsKey(username)) {
InMemoryUser user = new InMemoryUser(username, new PasswordToken(new byte[0]), Authorizations.EMPTY);
user.permissions.add(SystemPermission.SYSTEM);
acu.users.put(user.name, user);
}
}

/**
* Not supported by the in-memory implementation.
*/
@Override
public ConditionalWriter createConditionalWriter(String tableName) throws TableNotFoundException {
throw new UnsupportedOperationException();
}

/**
* Not supported by the in-memory implementation.
*/
@Override
public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) throws TableNotFoundException {
throw new UnsupportedOperationException();
}

@Override
public BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
if (acu.tables.get(tableName) == null)
Expand Down Expand Up @@ -156,15 +163,11 @@ public NamespaceOperations namespaceOperations() {
return new InMemoryNamespaceOperations(acu, username);
}

@Override
public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) {
// TODO add implementation
throw new UnsupportedOperationException();
}

/**
* Not supported by the in-memory implementation.
*/
@Override
public ReplicationOperations replicationOperations() {
// TODO add implementation
throw new UnsupportedOperationException();
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,137 +18,106 @@

import java.util.concurrent.TimeUnit;

import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchDeleter;
import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.ConditionalWriter;
import org.apache.accumulo.core.client.ConditionalWriterConfig;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.MultiTableBatchWriter;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.InstanceOperations;
import org.apache.accumulo.core.client.admin.NamespaceOperations;
import org.apache.accumulo.core.client.admin.ReplicationOperations;
import org.apache.accumulo.core.client.admin.SecurityOperations;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.clientImpl.Credentials;
import org.apache.accumulo.core.clientImpl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;

public class InMemoryConnector extends Connector {
public class InMemoryConnector {

String username;
private final InMemoryAccumulo acu;
private final Instance instance;

InMemoryConnector(String username, InMemoryInstance instance) throws AccumuloSecurityException {
this(new Credentials(username, new PasswordToken(new byte[0])), new InMemoryAccumulo(InMemoryInstance.getDefaultFileSystem()), instance);
InMemoryConnector(String username, InMemoryInstance instance) {
this.username = username;
this.acu = instance.acu;
if (!acu.users.containsKey(username)) {
InMemoryUser user = new InMemoryUser(username, new PasswordToken(new byte[0]), Authorizations.EMPTY);
user.permissions.add(SystemPermission.SYSTEM);
acu.users.put(user.name, user);
}
}

InMemoryConnector(Credentials credentials, InMemoryAccumulo acu, InMemoryInstance instance) throws AccumuloSecurityException {
if (credentials.getToken().isDestroyed())
throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.TOKEN_EXPIRED);
this.username = credentials.getPrincipal();
this.acu = acu;
this.instance = instance;
}

@Override
public BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
if (acu.tables.get(tableName) == null)
throw new TableNotFoundException(tableName, tableName, "no such table");
return acu.createBatchScanner(tableName, authorizations);
}

@Override
public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
int maxWriteThreads) throws TableNotFoundException {
if (acu.tables.get(tableName) == null)
throw new TableNotFoundException(tableName, tableName, "no such table");
return new InMemoryBatchDeleter(acu, tableName, authorizations);
}

@Override
public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
throws TableNotFoundException {
return createBatchDeleter(tableName, authorizations, numQueryThreads, config.getMaxMemory(), config.getMaxLatency(TimeUnit.MILLISECONDS),
config.getMaxWriteThreads());
}

@Override
public BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException {
if (acu.tables.get(tableName) == null)
throw new TableNotFoundException(tableName, tableName, "no such table");
return new InMemoryBatchWriter(acu, tableName);
}

@Override
public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException {
return createBatchWriter(tableName, config.getMaxMemory(), config.getMaxLatency(TimeUnit.MILLISECONDS), config.getMaxWriteThreads());
}

@Override
public MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads) {
return new InMemoryMultiTableBatchWriter(acu);
}

@Override
public MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config) {
return createMultiTableBatchWriter(config.getMaxMemory(), config.getMaxLatency(TimeUnit.MILLISECONDS), config.getMaxWriteThreads());
}

@Override
public Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException {
InMemoryTable table = acu.tables.get(tableName);
if (table == null)
throw new TableNotFoundException(tableName, tableName, "no such table");
return new InMemoryScanner(table, authorizations);
}

@Override
public Instance getInstance() {
return instance;
}

@Override
public String whoami() {
return username;
}

@Override
public TableOperations tableOperations() {
return new InMemoryTableOperations(acu, username);
}

@Override
public SecurityOperations securityOperations() {
return new InMemorySecurityOperations(acu);
}

@Override
public InstanceOperations instanceOperations() {
return new InMemoryInstanceOperations(acu);
}

@Override
public NamespaceOperations namespaceOperations() {
return new InMemoryNamespaceOperations(acu, username);
}

@Override
/**
* Not supported by the in-memory implementation.
*/
public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config) throws TableNotFoundException {
Comment thread
SethSmucker marked this conversation as resolved.
// TODO add implementation
throw new UnsupportedOperationException();
}

@Override
public ReplicationOperations replicationOperations() {
// TODO add implementation
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,13 @@
package datawave.accumulo.inmemory;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.clientImpl.Credentials;
import org.apache.accumulo.core.clientImpl.thrift.SecurityErrorCode;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;

/**
* InMemory Accumulo provides an in memory implementation of the Accumulo client API. It is possible that the behavior of this implementation may differ subtly
Expand All @@ -48,7 +36,7 @@
* Accumulo.
*
*/
public class InMemoryInstance implements Instance {
public class InMemoryInstance {

static final String genericAddress = "localhost:1234";
static final Map<String,InMemoryAccumulo> instances = new HashMap<>();
Expand Down Expand Up @@ -85,61 +73,30 @@ public InMemoryInstance(String instanceName, FileSystem fs) {
this.instanceName = instanceName;
}

@Override
public String getRootTabletLocation() {
return genericAddress;
}

@Override
public List<String> getMasterLocations() {
return Collections.singletonList(genericAddress);
}

@Override
public String getInstanceID() {
return "mock-instance-id";
}

@Override
public String getInstanceName() {
return instanceName;
}

@Override
public String getZooKeepers() {
return "localhost";
}

@Override
public int getZooKeepersSessionTimeOut() {
return 30 * 1000;
}

@Override
public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
return getConnector(user, new PasswordToken(pass));
}

@Override
public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
return getConnector(user, ByteBufferUtil.toBytes(pass));
}

@Override
public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));
}

@Override
public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
Connector conn = new InMemoryConnector(new Credentials(principal, token), acu, this);
if (!acu.users.containsKey(principal))
conn.securityOperations().createLocalUser(principal, (PasswordToken) token);
else if (!acu.users.get(principal).token.equals(token))
throw new AccumuloSecurityException(principal, SecurityErrorCode.BAD_CREDENTIALS);
return conn;
}

public static class CachedConfiguration {
private static Configuration configuration = null;

Expand Down
Loading
Loading