-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated connection factory to be able to configure scan hints * Updated to allow query logics to selectively override base client configuration
- Loading branch information
Showing
8 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../java/datawave/webservice/common/connection/config/ConnectionPoolClientConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package datawave.webservice.common.connection.config; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.accumulo.core.client.ScannerBase; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.deltaspike.core.api.config.ConfigResolver; | ||
import org.apache.log4j.Logger; | ||
|
||
import datawave.webservice.common.connection.AccumuloClientConfiguration; | ||
|
||
/** | ||
* The configuration for the connection pool clients of the form derived from properties as follows: | ||
* | ||
* dw.{pool}.client.{tableName}.consistency = IMMEDIATE|EVENTUAL dw.{pool}.client.{tableName}.{hintName} = {hintValue} | ||
* | ||
*/ | ||
public class ConnectionPoolClientConfiguration { | ||
|
||
private static final Logger log = Logger.getLogger(ConnectionPoolConfiguration.class); | ||
private AccumuloClientConfiguration config = new AccumuloClientConfiguration(); | ||
|
||
public ConnectionPoolClientConfiguration(String poolName) { | ||
String prefix = "dw." + poolName + ".client"; | ||
for (Map.Entry<String,String> property : ConfigResolver.getAllProperties().entrySet()) { | ||
if (property.getKey().startsWith(prefix)) { | ||
String[] tableAndHint = StringUtils.split(property.getKey().substring(prefix.length()), '.'); | ||
if (tableAndHint.length == 2) { | ||
if (tableAndHint[1].equals("consistency")) { | ||
config.setConsistency(tableAndHint[0], ScannerBase.ConsistencyLevel.valueOf(property.getValue())); | ||
} else { | ||
config.addHint(tableAndHint[0], tableAndHint[1], property.getValue()); | ||
} | ||
} else { | ||
log.error("Invalid client hint configuration property " + property.getKey()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public AccumuloClientConfiguration getConfiguration() { | ||
return config; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters