Releases: Nuix/Nuix-Java-Engine-Baseline
Releases · Nuix/Nuix-Java-Engine-Baseline
v9.10 - License Shortname Filtering
Updated NuixLicenseResolver to have new method withLicenseShortNameMatching. This method allows you to specify one or more license short name values that a resolved license must match one of:
NuixLicenseResolver cloudEnterpriseWorkstation = NuixLicenseResolver.fromCloud()
.withLicenseCredentialsResolvedFromEnvVars()
.withLicenseShortNameMatching("enterprise-workstation");
v9.10 - App Main Method Example
Added example main method entry point. See:
v9.10 - Ruby Scripting Support
Added support for executing a Ruby script from a String or file. Usage (also see relevant tests):
Script File
puts "I am located at #{__FILE__}"
z = x + y
Java Code
// We will direct output lines to this List
List<String> outputLines = new ArrayList<>();
// Define where our script file is located
File rubyScriptFile = new File(testDataDirectory, "BasicRubyScript.rb").getCanonicalFile();
// Get engine setup
try (NuixEngine nuixEngine = constructNuixEngine()) {
// Define some additional variables we will pass into the script
Map<String, Object> additionalVariables = Map.of(
"x", 40,
"y", 2
);
// Execute our script file, with our additional variables, redirecting output to our List and providing
// a callback that will allow us to inspect state upon script completion.
RubyScriptRunner rubyScriptRunner = nuixEngine.runRubyScriptFileAsync(
rubyScriptFile, additionalVariables, outputLines::add, outputLines::add, (result, vars) -> {
log.info("Script Output:");
log.info(String.join("", outputLines));
assertFalse(outputLines.isEmpty());
log.info("Implicit Final Result: {}", result);
assertEquals(42L, result);
for(Map.Entry<String,Object> entry : vars.entrySet()) {
log.info("{} => {}", entry.getKey(), entry.getValue());
}
Long zValue = (Long) vars.get("z");
assertEquals(42L, zValue);
});
// Script is running asynchronous so we join it to wait for it to complete.
rubyScriptRunner.join();
}
Refactored Nuix 9.10
Reworked much of this project with several goals in mind:
- Simpler interface to get things running
- Better way to resolve licenses
- Detect some configuration issues and propose solutions
- Provide conveniences for some common scenarios
- And so on...
Basic usage now looks like this:
// Define a resolver which will resolve licenses from Cloud License Server (CLS),
// authenticating using upon environment variable "NUIX_USERNAME" and "NUIX_PASSWORD",
// that have at least 4 workers and the feature "CASE_CREATION".
LicenseResolver cloud_4_workers = NuixLicenseResolver.fromCloud()
.withLicenseCredentialsResolvedFromEnvVars()
.withMinWorkerCount(4)
.withRequiredFeatures("CASE_CREATION");
// Define a resolver which will attempt to resolve a license from a local physical dongle
// that has the feature "CASE_CREATION".
LicenseResolver anyDongle = NuixLicenseResolver.fromDongle()
.withRequiredFeatures("CASE_CREATION");
// Create a new NuixEngine instance which will first attempt to resolve a cloud license and then
// attempt to resolve a dongle license if one cannot be resolved from cloud, using resolvers
// defined above. Calling run method to execute code with a licensed Engine instance (if a license can be obtained).
NuixEngine.usingFirstAvailableLicense(cloud_4_workers, anyDongle)
.setEngineDistributionDirectoryFromEnvVars()
.run((utilities -> {
log.info("License was obtained!");
// Do something with Utilities/API here
}));
Nuix 9.10
- EngineWrapper.withClsLicense now calls new Engine method
signOutOnClose
to ensure that license is released such that subsequent sessions always re-authenticate with CLS (see here).
- LicenseFilter now logs each license that it analyzes in the isValid method so that it is clearer in the logs how many and which licenses have been found by the licensor.
- LicenseFilter.isValid method now ignores AvailableLicence instances which have the short name
server
. We cannot make use of them to license our Engine session and callinggetWorkers
method on AvailableLicence instances of this type will throw a null pointer exception.
Nuix 9.6 Support / Project Refactor
The project has been modified with the following changes:
- Modified for Nuix 9.6 support. Some small (but important) changes were made to keep the project working with Nuix 9.6. Note that this is untested against versions of the engine prior to to 9.6 and may no longer work with these older versions!
- Project is now Gradle based which should hopefully simplify some aspects of the project.
- Project supports IntelliJ Idea. Other IDEs may still work as well, but development is now being performed/tested in that IDE.
Nuix Engine 9.2 Support
Updates to get things working against Nuix Engine 9.2. Unfortunately I think there is enough different from prior releases that this likely won't work against version of the engine prior to 9.2.