diff --git a/.github/workflows/csharp-darwin-snippets.yaml b/.github/workflows/csharp-darwin-snippets.yaml
index 6696aab..5b0d0d3 100644
--- a/.github/workflows/csharp-darwin-snippets.yaml
+++ b/.github/workflows/csharp-darwin-snippets.yaml
@@ -25,22 +25,26 @@ jobs:
dotnet-version: ${{ matrix.dotnet-version }}
- name: install Senzing SDK
- uses: senzing-factory/github-action-install-senzing-sdk@v2
+ uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
senzingsdk-repository-path: ${{ secrets.SENZING_OSX_BETA_REPOSITORY }}
+ - name: configure environment
+ run: |
+ SENZING_DIR="${HOME}/senzing/er"
+ {
+ echo "SENZING_DIR=${SENZING_DIR}"
+ echo "DYLD_LIBRARY_PATH=${SENZING_DIR}/lib"
+ } >> "$GITHUB_ENV"
+
- name: configure local nuget repo
run: |
- find /opt/senzing/er/sdk/dotnet/ -name "Senzing.Sdk*" | xargs -0 -L 1 basename
- sdk_package=$(find /opt/senzing/er/sdk/dotnet/ -name "Senzing.Sdk*" | xargs -0 -L 1 basename)
+ sdk_package=$(find "${HOME}"/senzing/er/sdk/dotnet/ -name "Senzing.Sdk*" | xargs -0 -L 1 basename)
mkdir -p ~/dev/nuget/packages
dotnet nuget add source ~/dev/nuget/packages -n dev
- dotnet nuget push /opt/senzing/er/sdk/dotnet/"${sdk_package}" --source dev
+ dotnet nuget push "${HOME}"/senzing/er/sdk/dotnet/"${sdk_package}" --source dev
- name: run csharp snippets
- env:
- DYLD_LIBRARY_PATH: "/opt/senzing/er/lib"
- SENZING_DATA_DIR: "/opt/senzing/er/data"
run: |
cd "${GITHUB_WORKSPACE}"/csharp/runner
dotnet add SnippetRunner package Senzing.Sdk --version 4.0.0-beta
diff --git a/.github/workflows/csharp-linux-snippets.yaml b/.github/workflows/csharp-linux-snippets.yaml
index 0c5dfd1..2cd6209 100644
--- a/.github/workflows/csharp-linux-snippets.yaml
+++ b/.github/workflows/csharp-linux-snippets.yaml
@@ -29,7 +29,7 @@ jobs:
dotnet-version: ${{ matrix.dotnet-version }}
- name: install Senzing runtime
- uses: senzing-factory/github-action-install-senzing-sdk@v2
+ uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
packages-to-install: "senzingsdk-runtime senzingsdk-setup"
senzingsdk-repository-package: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_PACKAGE }}
diff --git a/.github/workflows/csharp-windows-snippets.yaml b/.github/workflows/csharp-windows-snippets.yaml
index 0a04f17..496e6fe 100644
--- a/.github/workflows/csharp-windows-snippets.yaml
+++ b/.github/workflows/csharp-windows-snippets.yaml
@@ -25,26 +25,26 @@ jobs:
dotnet-version: ${{ matrix.dotnet-version }}
- name: install Senzing SDK
- uses: senzing-factory/github-action-install-senzing-sdk@v2
+ uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
senzingsdk-repository-path: ${{ secrets.SENZING_WIN_BETA_REPOSITORY }}
- name: configure local nuget repo
run: |
- $Env:sdk_package = Get-ChildItem -Path "C:\Program Files\Senzing\er\sdk\dotnet\" -Recurse | Where-Object {$_.Name -match "^Senzing.SDK*"} | Select-Object -ExpandProperty Name
+ $Env:sdk_package = Get-ChildItem -Path "$Env:USERPROFILE\Senzing\er\sdk\dotnet\" -Recurse | Where-Object {$_.Name -match "^Senzing.SDK*"} | Select-Object -ExpandProperty Name
mkdir $Env:USERPROFILE\dev\nuget\packages
cd $Env:USERPROFILE\dev\nuget\packages
dir
dotnet nuget add source $Env:USERPROFILE\dev\nuget\packages -n senzing
- dotnet nuget push "C:\Program Files\Senzing\er\sdk\dotnet\${Env:sdk_package}" --source senzing
+ dotnet nuget push "$Env:USERPROFILE\Senzing\er\sdk\dotnet\${Env:sdk_package}" --source senzing
dotnet nuget list source
- name: Add to "Path" environment variable
run: |
- Add-Content $env:GITHUB_PATH "C:\Program Files\Senzing\er\lib"
+ Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\Senzing\er\lib"
- name: run csharp snippets
run: |
- echo $Env:Path
+ $Env:SENZING_DIR = "$Env:USERPROFILE\Senzing\er"
cd ${Env:GITHUB_WORKSPACE}/csharp/runner
dotnet run --project SnippetRunner all
diff --git a/.github/workflows/java-darwin-snippets.yaml b/.github/workflows/java-darwin-snippets.yaml
index d946e8e..ea05fd5 100644
--- a/.github/workflows/java-darwin-snippets.yaml
+++ b/.github/workflows/java-darwin-snippets.yaml
@@ -27,20 +27,24 @@ jobs:
java-version: ${{ matrix.java-version }}
- name: install Senzing SDK
- uses: senzing-factory/github-action-install-senzing-sdk@v2
+ uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
senzingsdk-repository-path: ${{ secrets.SENZING_OSX_BETA_REPOSITORY }}
+ - name: configure environment
+ run: |
+ SENZING_DIR="${HOME}/senzing/er"
+ {
+ echo "SENZING_DIR=${SENZING_DIR}"
+ echo "DYLD_LIBRARY_PATH=${SENZING_DIR}/lib:${SENZING_DIR}/lib/macos"
+ } >> "$GITHUB_ENV"
+
- name: build with Maven
- env:
- SENZING_DIR: "/opt/senzing/er"
run: |
cd "${GITHUB_WORKSPACE}"/java
mvn clean install
- name: run java snippets
- env:
- DYLD_LIBRARY_PATH: "/opt/senzing/er/lib"
run: |
cd "${GITHUB_WORKSPACE}"/java
java -jar target/sz-sdk-snippets.jar all
diff --git a/.github/workflows/java-linux-snippets.yaml b/.github/workflows/java-linux-snippets.yaml
index 07136da..a25cd50 100644
--- a/.github/workflows/java-linux-snippets.yaml
+++ b/.github/workflows/java-linux-snippets.yaml
@@ -31,7 +31,7 @@ jobs:
distribution: ${{ matrix.java-distribution }}
- name: install Senzing runtime
- uses: senzing-factory/github-action-install-senzing-sdk@v2
+ uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
packages-to-install: "senzingsdk-runtime senzingsdk-setup"
senzingsdk-repository-package: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_PACKAGE }}
diff --git a/.github/workflows/java-windows-snippets.yaml b/.github/workflows/java-windows-snippets.yaml
index cef76ab..20086d5 100644
--- a/.github/workflows/java-windows-snippets.yaml
+++ b/.github/workflows/java-windows-snippets.yaml
@@ -27,22 +27,21 @@ jobs:
distribution: ${{ matrix.java-distribution }}
- name: install Senzing SDK
- uses: senzing-factory/github-action-install-senzing-sdk@v2
+ uses: senzing-factory/github-action-install-senzing-sdk@v3
with:
senzingsdk-repository-path: ${{ secrets.SENZING_WIN_BETA_REPOSITORY }}
- name: build with Maven
- env:
- SENZING_DIR: 'C:\Program Files\Senzing\er'
run: |
+ $Env:SENZING_DIR = "$Env:USERPROFILE\Senzing\er"
cd "${Env:GITHUB_WORKSPACE}/java"
mvn clean install
- name: Add to "Path" environment variable
run: |
- Add-Content $env:GITHUB_PATH "C:\Program Files\Senzing\er\lib"
+ Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\Senzing\er\lib"
- name: run java snippets
run: |
cd "${Env:GITHUB_WORKSPACE}/java"
- java -jar target/sz-sdk-snippets.jar all
+ java "-Dsenzing.install.dir=$Env:USERPROFILE\Senzing\er" -jar target/sz-sdk-snippets.jar all
diff --git a/csharp/runner/SnippetRunner/InstallLocations.cs b/csharp/runner/SnippetRunner/InstallLocations.cs
index 9d57348..d02c802 100644
--- a/csharp/runner/SnippetRunner/InstallLocations.cs
+++ b/csharp/runner/SnippetRunner/InstallLocations.cs
@@ -180,6 +180,15 @@ private static bool IsDirectory(string path)
///
public static InstallLocations? FindLocations()
{
+ DirectoryInfo homeDir = new DirectoryInfo(Environment.GetFolderPath(
+ Environment.SpecialFolder.UserProfile));
+ DirectoryInfo homeSenzing = new DirectoryInfo(
+ Path.Combine(homeDir.FullName, "senzing"));
+ DirectoryInfo homeInstall = new DirectoryInfo(
+ Path.Combine(homeSenzing.FullName, "er"));
+ DirectoryInfo homeSupport = new DirectoryInfo(
+ Path.Combine(homeInstall.FullName, "data"));
+
DirectoryInfo? installDir = null;
DirectoryInfo? configDir = null;
DirectoryInfo? resourceDir = null;
@@ -190,25 +199,27 @@ private static bool IsDirectory(string path)
string? defaultConfigPath = null;
string defaultSupportPath;
- switch (Environment.OSVersion.Platform)
+ if (OperatingSystem.IsWindows())
+ {
+ defaultInstallPath = homeInstall.FullName;
+ defaultSupportPath = homeSupport.FullName;
+ }
+ else if (OperatingSystem.IsMacOS())
{
- case PlatformID.Win32NT:
- defaultInstallPath = "C:\\Program Files\\Senzing\\er";
- defaultSupportPath = "C:\\Program Files\\Senzing\\er\\data";
- break;
- case PlatformID.MacOSX:
- defaultInstallPath = "/opt/senzing/er";
- defaultSupportPath = "/opt/senzing/er/data";
- break;
- case PlatformID.Unix:
- defaultInstallPath = "/opt/senzing/er";
- defaultConfigPath = "/etc/opt/senzing";
- defaultSupportPath = "/opt/senzing/data";
- break;
- default:
- throw new NotSupportedException(
- "Unsupported Operating System: "
- + Environment.OSVersion.Platform);
+ defaultInstallPath = homeInstall.FullName;
+ defaultSupportPath = homeSupport.FullName;
+ }
+ else if (OperatingSystem.IsLinux())
+ {
+ defaultInstallPath = "/opt/senzing/er";
+ defaultConfigPath = "/etc/opt/senzing";
+ defaultSupportPath = "/opt/senzing/data";
+ }
+ else
+ {
+ throw new NotSupportedException(
+ "Unsupported Operating System: "
+ + Environment.OSVersion.Platform);
}
// check for senzing system properties
@@ -302,22 +313,6 @@ private static bool IsDirectory(string path)
}
else
{
- switch (Environment.OSVersion.Platform)
- {
- case PlatformID.Win32NT:
- defaultSupportPath = Path.Combine(installDir.FullName, "data");
- break;
- case PlatformID.MacOSX:
- defaultSupportPath = Path.Combine(installDir.FullName, "data");
- break;
- case PlatformID.Unix:
- break;
- default:
- throw new NotSupportedException(
- "Unsupported Operating System: "
- + Environment.OSVersion.Platform);
- }
-
// no explicit path, try the default support path
supportDir = new DirectoryInfo(defaultSupportPath);
}
diff --git a/java/pom.xml b/java/pom.xml
index ada36f7..9c7c5a3 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -39,6 +39,7 @@
17
UTF-8
UTF-8
+ ${SENZING_DIR}
snippets
diff --git a/java/runner/java/com/senzing/runner/InstallLocations.java b/java/runner/java/com/senzing/runner/InstallLocations.java
index efd0cc4..1fa14a5 100644
--- a/java/runner/java/com/senzing/runner/InstallLocations.java
+++ b/java/runner/java/com/senzing/runner/InstallLocations.java
@@ -133,8 +133,8 @@ public String toString() {
* Finds the install directories and returns the {@link InstallLocations}
* instance describing those locations.
*
- * @param senzingDir The optional Senzing installation directory if one has
- * been provided, null
otherwise.
+ * @param senzingDir The optional Senzing installation directory if one has been
+ * provided, null
otherwise.
*
* @return The {@link InstallLocations} instance describing the install
* locations.
@@ -148,12 +148,14 @@ public static InstallLocations findLocations() {
String lowerOSName = osName.toLowerCase().trim();
if (lowerOSName.startsWith("windows")) {
windows = true;
- } else if (lowerOSName.startsWith("mac")
- || lowerOSName.indexOf("darwin") >= 0)
- {
+ } else if (lowerOSName.startsWith("mac") || lowerOSName.indexOf("darwin") >= 0) {
macOS = true;
}
+ File homeDir = new File(System.getProperty("user.home"));
+ File homeSenzing = new File(homeDir, "senzing");
+ File homeInstall = new File(homeSenzing, "er");
+ File homeSupport = new File(homeInstall, "data");
File installDir = null;
File configDir = null;
File resourceDir = null;
@@ -165,14 +167,14 @@ public static InstallLocations findLocations() {
String defaultSupportPath = null;
if (windows) {
- defaultInstallPath = "C:\\Program Files\\Senzing\\er";
- defaultSupportPath = "C:\\Program Files\\Senzing\\er\\data";
+ defaultInstallPath = homeInstall.getCanonicalPath();
+ defaultSupportPath = homeSupport.getCanonicalPath();
} else if (macOS) {
- defaultInstallPath = "/opt/senzing/er";
- defaultSupportPath = "/opt/senzing/er/data";
+ defaultInstallPath = homeInstall.getCanonicalPath();
+ defaultSupportPath = homeSupport.getCanonicalPath();
} else {
defaultInstallPath = "/opt/senzing/er";
- defaultConfigPath = "/etc/opt/senzing";
+ defaultConfigPath = "/etc/opt/senzing";
defaultSupportPath = "/opt/senzing/data";
}
@@ -214,12 +216,10 @@ public static InstallLocations findLocations() {
System.err.println(" " + installDir);
System.err.println();
if (installPath != null) {
- System.err.println(
- "Check the -Dsenzing.install.dir=[path] command line option.");
+ System.err.println("Check the -Dsenzing.install.dir=[path] command line option.");
} else {
- System.err.println(
- "Use the -Dsenzing.install.dir=[path] command line option to "
- + "specify a path");
+ System.err
+ .println("Use the -Dsenzing.install.dir=[path] command line option to " + "specify a path");
}
return null;
@@ -227,9 +227,7 @@ public static InstallLocations findLocations() {
// normalize the senzing directory
String dirName = installDir.getName();
- if (installDir.isDirectory() && !dirName.equalsIgnoreCase("er")
- && dirName.equalsIgnoreCase("senzing"))
- {
+ if (installDir.isDirectory() && !dirName.equalsIgnoreCase("er") && dirName.equalsIgnoreCase("senzing")) {
// for windows or linux allow the "Senzing" dir as well
installDir = new File(installDir, "er");
}
@@ -239,12 +237,10 @@ public static InstallLocations findLocations() {
System.err.println(" " + installDir);
System.err.println();
if (installPath != null) {
- System.err.println(
- "Check the -Dsenzing.install.dir=[path] command line option.");
+ System.err.println("Check the -Dsenzing.install.dir=[path] command line option.");
} else {
- System.err.println(
- "Use the -Dsenzing.install.dir=[path] command line option to "
- + "specify a path");
+ System.err
+ .println("Use the -Dsenzing.install.dir=[path] command line option to " + "specify a path");
}
return null;
@@ -260,7 +256,7 @@ public static InstallLocations findLocations() {
supportDir = new File(installDir, "data");
} else {
// no explicit path, try the default support path
- supportDir = new File(defaultSupportPath);
+ supportDir = new File(defaultSupportPath);
}
} else {
@@ -274,8 +270,8 @@ public static InstallLocations findLocations() {
if (supportPath != null) {
System.err.println("Check the -Dsenzing.support.dir=[path] command line option.");
} else {
- System.err.println("Use the -Dsenzing.support.dir=[path] command line option to "
- + "specify a path");
+ System.err
+ .println("Use the -Dsenzing.support.dir=[path] command line option to " + "specify a path");
}
throw new IllegalStateException("The support directory does not exist: " + supportDir);
@@ -287,8 +283,8 @@ public static InstallLocations findLocations() {
if (supportPath != null) {
System.err.println("Check the -Dsenzing.support.dir=[path] command line option.");
} else {
- System.err.println("Use the -Dsenzing.support.dir=[path] command line option to "
- + "specify a path");
+ System.err
+ .println("Use the -Dsenzing.support.dir=[path] command line option to " + "specify a path");
}
throw new IllegalStateException("The support directory is invalid: " + supportDir);
@@ -317,24 +313,21 @@ public static InstallLocations findLocations() {
configDir = new File(installDir, "etc");
if (!configDir.exists()) {
configDir = null;
- }
+ }
}
if (configPath != null && !configDir.exists()) {
- System.err.println(
- "The -Dsenzing.config.dir=[path] option specifies a path that does not exist:");
+ System.err.println("The -Dsenzing.config.dir=[path] option specifies a path that does not exist:");
System.err.println(" " + configPath);
throw new IllegalStateException("Explicit config path does not exist: " + configPath);
}
if (configDir != null && configDir.exists()) {
if (!configDir.isDirectory()) {
- System.err.println(
- "The -Dsenzing.config.dir=[path] option specifies a file, not a directory:");
+ System.err.println("The -Dsenzing.config.dir=[path] option specifies a file, not a directory:");
System.err.println(" " + configPath);
- throw new IllegalStateException(
- "Explicit config path is not directory: " + configPath);
+ throw new IllegalStateException("Explicit config path is not directory: " + configPath);
}
String[] requiredFiles = { "cfgVariant.json" };
@@ -348,13 +341,11 @@ public static InstallLocations findLocations() {
}
}
if (missingFiles.size() > 0 && configPath != null) {
- System.err.println(
- "The -Dsenzing.config.dir=[path] option specifies an invalid config directory:");
+ System.err.println("The -Dsenzing.config.dir=[path] option specifies an invalid config directory:");
for (String missing : missingFiles) {
System.err.println(" " + missing + " was not found");
}
- throw new IllegalStateException(
- "Explicit config path missing required files: " + missingFiles);
+ throw new IllegalStateException("Explicit config path missing required files: " + missingFiles);
}
}
@@ -372,22 +363,19 @@ public static InstallLocations findLocations() {
if (resourcePath != null) {
if (!resourceDir.exists()) {
- System.err.println(
- "The -Dsenzing.resource.dir=[path] option specifies a path that does not exist:");
+ System.err
+ .println("The -Dsenzing.resource.dir=[path] option specifies a path that does not exist:");
System.err.println(" " + resourcePath);
- throw new IllegalStateException(
- "Explicit resource path does not exist: " + resourcePath);
+ throw new IllegalStateException("Explicit resource path does not exist: " + resourcePath);
}
if (!resourceDir.isDirectory() || !templatesDir.exists() || !templatesDir.isDirectory()) {
System.err.println(
- "The -Dsenzing.resource.dir=[path] option specifies an invalid "
- + "resource directory:");
+ "The -Dsenzing.resource.dir=[path] option specifies an invalid " + "resource directory:");
System.err.println(" " + resourcePath);
- throw new IllegalStateException(
- "Explicit resource path is not valid: " + resourcePath);
+ throw new IllegalStateException("Explicit resource path is not valid: " + resourcePath);
}
} else if (!resourceDir.exists() || !resourceDir.isDirectory() || !templatesDir.exists()