diff --git a/.github/workflows/build-accumulo.yml b/.github/workflows/build-accumulo.yml
new file mode 100644
index 00000000000..c1e15ef3d43
--- /dev/null
+++ b/.github/workflows/build-accumulo.yml
@@ -0,0 +1,99 @@
+name: Build Accumulo snapshot and update DataWave to use
+
+on:
+ workflow_dispatch:
+ inputs:
+ accumuloBranch:
+ required: true
+ default: "2.1"
+ description: "Branch name to build. Will be used as image tag."
+ accumuloRepo:
+ required: true
+ default: "apache/accumulo"
+ description: "Accumulo Repo to use. Expected to be at Github. Example: apache/accumulo"
+ deployAccumulo:
+ required: true
+ default: "false"
+ description: "Set to false if this accumulo version has already been pushed to Github Packages"
+
+# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: ${{ github.repository.lowercase }}
+ ACCUMULO_JAVA_VERSION: '17'
+ DATAWAVE_JAVA_VERSION: '11'
+ JAVA_DISTRIBUTION: 'zulu' #This is the default on v1 of the action for 1.8
+ USER_NAME: ${{ secrets.GHCR_WRITE_USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
+
+jobs:
+ build-and-deploy-accumulo:
+ runs-on: ubuntu-latest
+ # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
+ permissions:
+ contents: read
+ packages: write
+ #
+ steps:
+ - name: Checkout DataWave
+ uses: actions/checkout@v4
+ with:
+ path: datawave
+
+ - name: Checkout Accumulo
+ uses: actions/checkout@v4
+ id: accumuloCheckout
+ with:
+ repository: ${{ github.event.inputs.accumuloRepo }}
+ path: accumulo
+ ref: ${{ github.event.inputs.accumuloBranch }}
+
+ - name: Set up JDK ${{env.ACCUMULO_JAVA_VERSION}}
+ uses: actions/setup-java@v4
+ with:
+ distribution: ${{env.JAVA_DISTRIBUTION}}
+ java-version: ${{env.ACCUMULO_JAVA_VERSION}}
+ cache: 'maven'
+ - run: echo "ACCUMULO_JAVA=$JAVA_HOME" >> $GITHUB_ENV
+ - name: Set up JDK ${{env.DATAWAVE_JAVA_VERSION}}
+ uses: actions/setup-java@v4
+ with:
+ distribution: ${{env.JAVA_DISTRIBUTION}}
+ java-version: ${{env.DATAWAVE_JAVA_VERSION}}
+ cache: 'maven'
+ - run: echo "DATAWAVE_JAVA=$JAVA_HOME" >> $GITHUB_ENV
+
+ - name: Get Accumulo Version
+ id: get-accumulo-version
+ run: |
+ export JAVA_HOME="$ACCUMULO_JAVA"
+ cd "$GITHUB_WORKSPACE/accumulo"
+ mvn build-helper:parse-version versions:set -DgenerateBackupPoms=false -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}-dwv-$(git rev-parse --short HEAD)
+ export newVersion=$(mvn -q help:evaluate -DforceStdout -Dexpression=project.version)
+ echo accumuloVersion=$newVersion >> $GITHUB_OUTPUT
+ - name: Deploy Accumulo
+ if: ${{ github.event.inputs.deployAccumulo == 'true'}}
+ run: |
+ export JAVA_HOME="$ACCUMULO_JAVA"
+ cd "$GITHUB_WORKSPACE/accumulo"
+ mvn -DaltDeploymentRepository=github-datawave::https://maven.pkg.github.com/NationalSecurityAgency/datawave -V -B -e -ntp "-Dstyle.color=always" -DskipTests -T1C clean source:jar deploy -s "$GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml"
+ - name: Log in to the Container registry
+ uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ env.USER_NAME }}
+ password: ${{ env.ACCESS_TOKEN }}
+
+ - name: Update DataWave Dependency Version
+ run: |
+
+ export JAVA_HOME="$DATAWAVE_JAVA"
+ cd "$GITHUB_WORKSPACE/datawave"
+ mvn -s "$GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml" versions:set-property -Dproperty=version.accumulo -DnewVersion=${{ steps.get-accumulo-version.outputs.accumuloVersion }} -DgenerateBackupPoms=false
+ - name: Build Web and Ingest Docker Images (Maven)
+ run: |
+ export JAVA_HOME="$DATAWAVE_JAVA"
+ cd "$GITHUB_WORKSPACE/datawave"
+ mvn -s "$GITHUB_WORKSPACE/datawave/.github/workflows/settings.xml" clean install -Prpm,kubernetes,assemble,deploy-ws -Ddist -Pdocker -DpushImage -Ddocker-release -DskipTests -Ddocker.image.accumulo.tag=${{ steps.get-accumulo-version.outputs.accumuloVersion }}
+
+
diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml
new file mode 100644
index 00000000000..33ff967db6d
--- /dev/null
+++ b/.github/workflows/build-images.yml
@@ -0,0 +1,46 @@
+#
+name: Create and publish a Docker image
+
+on:
+ push:
+ paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE']
+ tags:
+ - "**"
+ branches:
+ - 'integration'
+ - 'release/version*'
+ - 'docker-images'
+ workflow_dispatch:
+
+# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
+env:
+ REGISTRY: ghcr.io
+ IMAGE_NAME: ${{ github.repository.lowercase }}
+ JAVA_VERSION: '11'
+ JAVA_DISTRIBUTION: 'zulu' #This is the default on v1 of the action for 1.8
+ USER_NAME: ${{ secrets.GHCR_WRITE_USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.GHCR_WRITE_ACCESS_TOKEN }}
+
+jobs:
+ build-and-push-datawave-images:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Log in to the Container registry
+ uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ env.USER_NAME }}
+ password: ${{ env.ACCESS_TOKEN }}
+ - name: Checkout Code
+ uses: actions/checkout@v4
+ - name: Set up JDK ${{env.JAVA_VERSION}}
+ uses: actions/setup-java@v4
+ with:
+ distribution: ${{env.JAVA_DISTRIBUTION}}
+ java-version: ${{env.JAVA_VERSION}}
+ cache: 'maven'
+ - name: Build Web and Ingest Docker Images (Maven)
+ run: |
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml clean install -Prpm,kubernetes,assemble,deploy-ws -Ddist -Pdocker -DpushImage -Ddocker-release -DskipTests
+
+
diff --git a/.github/workflows/microservice-build-image.yaml b/.github/workflows/microservice-build-image.yaml
new file mode 100644
index 00000000000..fe9e199ce50
--- /dev/null
+++ b/.github/workflows/microservice-build-image.yaml
@@ -0,0 +1,41 @@
+#
+name: Create and publish a Docker image
+
+on:
+ workflow_call:
+ secrets:
+ USER_NAME:
+ description: "User Name for maven pulls"
+ required: true
+ ACCESS_TOKEN:
+ description: "Access token for maven pulls"
+ required: true
+
+
+jobs:
+ build-and-push-datawave-images:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Log in to the Container registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ secrets.USER_NAME }}
+ password: ${{ secrets.ACCESS_TOKEN }}
+ - name: Checkout Code
+ uses: actions/checkout@v4
+ - name: Set up JDK 11
+ uses: actions/setup-java@v4
+ with:
+ distribution: "zulu"
+ java-version: 11
+ cache: 'maven'
+ - name: Build And Push Docker Image (Maven)
+ env:
+ MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true"
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
+ run: |
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e clean install -Pdocker,exec -Ddocker.image.prefix=ghcr.io/nationalsecurityagency/ -DpushImage
+
+
diff --git a/.github/workflows/microservice-maven-tests.yaml b/.github/workflows/microservice-maven-tests.yaml
new file mode 100644
index 00000000000..4f20d49c3b8
--- /dev/null
+++ b/.github/workflows/microservice-maven-tests.yaml
@@ -0,0 +1,72 @@
+name: Tests
+
+on:
+ workflow_call:
+ secrets:
+ USER_NAME:
+ description: "User Name for maven pulls"
+ required: true
+ ACCESS_TOKEN:
+ description: "Access token for maven pulls"
+ required: true
+
+env:
+ MAVEN_OPTS: "-Djansi.force=true -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true -XX:ThreadStackSize=1m"
+
+jobs:
+ # Runs the pom sorter and code formatter to ensure that the code
+ # is formatted and poms are sorted according to project rules. This
+ # will fail if the formatter makes any changes.
+ check-code-formatting:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Code
+ uses: actions/checkout@v4
+ - name: Set up JDK 11
+ uses: actions/setup-java@v4
+ with:
+ java-version: 11
+ distribution: 'zulu'
+ - uses: actions/cache@v4
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-format-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-format-
+ ${{ runner.os }}-maven-
+ - name: Format code
+ run: |
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e clean formatter:format sortpom:sort -Pautoformat
+ git status
+ git diff-index --quiet HEAD || (echo "Error! There are modified files after formatting." && false)
+ env:
+ MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true"
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
+
+ # Build the code and run the unit/integration tests.
+ build-and-test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Code
+ uses: actions/checkout@v4
+ - name: Set up JDK 11
+ uses: actions/setup-java@v4
+ with:
+ java-version: 11
+ distribution: 'zulu'
+ - uses: actions/cache@v4
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-build-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-build-
+ ${{ runner.os }}-maven-format-
+ ${{ runner.os }}-maven-
+ - name: Build and Run Unit Tests
+ run: mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Ddist clean verify
+ env:
+ MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true"
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
+
diff --git a/.github/workflows/settings.xml b/.github/workflows/settings.xml
new file mode 100644
index 00000000000..d8be2eb498d
--- /dev/null
+++ b/.github/workflows/settings.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ github-datawave
+ ${env.USER_NAME}
+ ${env.ACCESS_TOKEN}
+
+
+
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 2f4302f86bf..0e38efb41c1 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -6,9 +6,8 @@ on:
branches:
- 'integration'
- 'release/version*'
- - 'feature/accumulo-2.0'
pull_request:
- paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE']
+ paths-ignore: ['*.md', 'CODEOWNERS', 'LICENSE', '.github/workflows/microservice*.yaml']
workflow_dispatch:
env:
@@ -24,19 +23,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
- uses: actions/checkout@v3
- with:
- submodules: 'recursive'
+ uses: actions/checkout@v4
- name: Set up JDK ${{env.JAVA_VERSION}}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}
maven-version: 3.9.5
cache: 'maven'
+ - name: Extract branch name
+ shell: bash
+ run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
+ id: extract_branch
- name: Format code
+ env:
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
- mvn -V -B -e -ntp "-Dstyle.color=always" clean formatter:format sortpom:sort impsort:sort -Dmaven.build.cache.enabled=false -Pautoformat
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -ntp "-Dstyle.color=always" clean formatter:format sortpom:sort impsort:sort -Dmaven.build.cache.enabled=false -Pautoformat
git status
git diff-index --quiet HEAD || (echo "Modified files found. Creating new commit with formatting fixes" && echo "diffs_found=true" >> "$GITHUB_ENV")
- name: Commit Changes
@@ -44,8 +48,10 @@ jobs:
if [ "$diffs_found" = true ]; then
git config --global user.name "GitHub Actions"
git config --global user.email "datawave@github.com"
- git commit -am "Formatting job fix"
- git push
+ git pull origin ${{ steps.extract_branch.outputs.branch }} --rebase --autostash
+ git checkout -b ${{ steps.extract_branch.outputs.branch }}
+ git commit -am "GitHub Actions: Fix Formatting"
+ git push origin ${{ steps.extract_branch.outputs.branch }}
else
echo "Nothing to do"
fi
@@ -55,17 +61,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Set up JDK ${{env.JAVA_VERSION}}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}
maven-version: 3.9.5
cache: 'maven'
- name: Build and Run Unit Tests
+ env:
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
- RUN_TESTS="mvn -V -B -e -ntp "-Dstyle.color=always" -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -Ddeploy -Ddist -T1C clean verify"
+ RUN_TESTS="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -ntp "-Dstyle.color=always" -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -Ddeploy -Ddist -T1C clean verify"
$RUN_TESTS \
|| { echo "***** TESTS FAILED. Attempting retry."; $RUN_TESTS; } \
|| { echo "***** TESTS FAILED. Attempting final retry."; $RUN_TESTS; }
@@ -80,15 +89,15 @@ jobs:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Code
- # uses: actions/checkout@v3
+ # uses: actions/checkout@v4
# with:
# submodules: 'recursive'
# - name: Set up JDK ${{env.JAVA_VERSION}}
- # uses: actions/setup-java@v3
+ # uses: actions/setup-java@v4
# with:
# distribution: ${{env.JAVA_DISTRIBUTION}}
# java-version: ${{env.JAVA_VERSION}}
- # - uses: actions/cache@v3
+ # - uses: actions/cache@v4
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-maven-build-${{ hashFiles('**/pom.xml') }}
@@ -97,12 +106,18 @@ jobs:
# ${{ runner.os }}-maven-format-
# ${{ runner.os }}-maven-
# - name: Build Project
+ # env:
+ # USER_NAME: ${{ secrets.USER_NAME }}
+ # ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# run: |
- # BUILD="mvn -V -B -e -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -DskipServices -Ddeploy -Ddist -T1C -pl "-:config-service" clean install -DskipTests"
+ # BUILD="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Pdev,examples,assemble,spotbugs -Dmaven.build.cache.enabled=false -DskipServices -Ddeploy -Ddist -T1C -pl "-:config-service" clean install -DskipTests"
# $BUILD
# - name: Run Microservice Unit Tests
+ # env:
+ # USER_NAME: ${{ secrets.USER_NAME }}
+ # ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# run: |
- # RUN_TESTS="mvn -V -B -e -Dmaven.build.cache.enabled=false verify"
+ # RUN_TESTS="mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -V -B -e -Dmaven.build.cache.enabled=false verify"
# cd microservices
# $RUN_TESTS \
# || { echo "***** TESTS FAILED. Attempting retry."; $RUN_TESTS; } \
@@ -112,9 +127,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Set up JDK ${{env.JAVA_VERSION}}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}
@@ -133,12 +148,154 @@ jobs:
# Builds the quickstart docker image and run the query tests
- name: Quickstart Query Tests
env:
- DW_DATAWAVE_BUILD_COMMAND: "mvn -B -V -e -ntp -Dstyle.color=always -Dmaven.build.cache.enabled=false -Pdev -Ddeploy -Dtar -DskipTests clean package"
+ DW_DATAWAVE_BUILD_COMMAND: "mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -ntp -Dstyle.color=always -Dmaven.build.cache.enabled=false -Pdev -Ddeploy -Dtar -DskipTests clean package"
DOCKER_BUILD_OPTS: "--squash --force-rm"
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
- TAG=$(mvn -q -N -Dmaven.build.cache.enabled=false -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec)
+ TAG=$(mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -q -N -Dmaven.build.cache.enabled=false -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec)
contrib/datawave-quickstart/docker/docker-build.sh ${TAG} --docker-opts "${DOCKER_BUILD_OPTS}"
+ compose-build-and-test-latest-snapshots:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Free up some space
+ run: |
+ sudo rm -rf /usr/share/dotnet
+ sudo rm -rf /opt/ghc
+ sudo rm -rf /usr/local/share/boost
+ sudo rm -rf $AGENT_TOOLSDIRECTORY
+ - name: Checkout Code
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Set up JDK ${{env.JAVA_VERSION}}
+ uses: actions/setup-java@v4
+ with:
+ distribution: ${{env.JAVA_DISTRIBUTION}}
+ java-version: ${{env.JAVA_VERSION}}
+ maven-version: 3.9.5
+ cache: 'maven'
+ # Builds the quickstart and microservice docker images and runs a query test
+ - name: Docker Compose Query Tests
+ env:
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
+ run: |
+ # update datawave dependencies to use the latest snapshots
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e versions:update-properties versions:update-parent -DallowSnapshots=true -Dincludes=gov.nsa.*
+
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Ddeploy -Dtar -DskipTests clean install
+
+ # free up some space so that we don't run out
+ docker system prune -f
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Ddeploy -Dtar -DskipTests clean
+
+ cd docker
+ ./bootstrap.sh
+
+ attempt=0
+ max_attempts=20
+ while [ $attempt -lt $max_attempts ]; do
+ attempt=$((attempt+1))
+
+ echo "Starting docker compose (Attempt ${attempt}/${max_attempts})"
+ nohup docker compose up -d --no-recreate < /dev/null > compose.out 2>&1 &
+ sleep 60s
+ cat compose.out
+
+ # check to see if the query service is running
+ QUERY="$(docker compose ps --status running --services | grep query || true)"
+
+ if [ "$QUERY" == "query" ] ; then
+ echo "Docker compose started successfully"
+ break
+ elif [ $attempt -eq $max_attempts ] ; then
+ echo "Failed to start docker compose"
+ exit 1
+ fi
+ done
+
+ cd scripts
+ ./testAll.sh
+
+ - name: Dump Logs
+ if: failure()
+ run: |
+ cd docker
+ docker compose logs
+
+ compose-build-and-test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Free up some space
+ run: |
+ sudo rm -rf /usr/share/dotnet
+ sudo rm -rf /opt/ghc
+ sudo rm -rf /usr/local/share/boost
+ sudo rm -rf $AGENT_TOOLSDIRECTORY
+ - name: Checkout Code
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Set up JDK ${{env.JAVA_VERSION}}
+ uses: actions/setup-java@v4
+ with:
+ distribution: ${{env.JAVA_DISTRIBUTION}}
+ java-version: ${{env.JAVA_VERSION}}
+ - uses: actions/cache@v4
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-build-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-build-
+ ${{ runner.os }}-maven-format-
+ ${{ runner.os }}-maven-
+ # Builds the quickstart and microservice docker images and runs a query test
+ - name: Docker Compose Query Tests
+ env:
+ USER_NAME: ${{ secrets.USER_NAME }}
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
+ run: |
+ # set some bogus URLs to trigger dependency download via maven
+ DIST_URLS="-Durl.zookeeper=https://bogus.apache.org/zookeeper/zookeeper-3.7.2/apache-zookeeper-3.7.2-bin.tar.gz.tar.gz \
+ -Durl.accumulo=https://bogus.apache.org/accumulo/2.1.3/accumulo-2.1.3-bin.tar.gz \
+ -Durl.wildfly=https://bogus.jboss.org/wildfly/17.0.1.Final/wildfly-17.0.1.Final.tar.gz \
+ -Durl.hadoop=https://bogus.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz \
+ -Durl.maven=https://bogus.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz"
+
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Dquickstart-maven ${DIST_URLS} -Ddeploy -Dtar -DskipTests -Dmaven.build.cache.enabled=false clean install
+ # free up some space so that we don't run out
+ docker system prune -f
+ mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -B -V -e -Pcompose -Dmicroservice-docker -Dquickstart-docker -Dquickstart-maven ${DIST_URLS} -Ddeploy -Dtar -DskipTests -Dmaven.build.cache.enabled=false clean
+ cd docker
+ ./bootstrap.sh
+ attempt=0
+ max_attempts=20
+ while [ $attempt -lt $max_attempts ]; do
+ attempt=$((attempt+1))
+ echo "Starting docker compose (Attempt ${attempt}/${max_attempts})"
+ nohup docker compose up -d --no-recreate < /dev/null > compose.out 2>&1 &
+ sleep 60s
+ cat compose.out
+ # check to see if the query service is running
+ QUERY="$(docker compose ps --status running --services | grep query || true)"
+ if [ "$QUERY" == "query" ] ; then
+ echo "Docker compose started successfully"
+ break
+ elif [ $attempt -eq $max_attempts ] ; then
+ echo "Failed to start docker compose"
+ exit 1
+ fi
+ done
+ cd scripts
+ ./testAll.sh
+ - name: Dump Logs
+ if: failure()
+ run: |
+ cd docker
+ docker compose logs
+
# Here's an example of how you'd deploy the image to the github package registry.
# We don't want to do this by default since packages on github cannot be deleted
# or overwritten. So this could only be done for tags, however it seems the quickstart
@@ -148,9 +305,11 @@ jobs:
# IMAGE_REGISTRY: "docker.pkg.github.com"
# IMAGE_USERNAME: "brianloss"
# IMAGE_NAME: "datawave/quickstart"
+ # USER_NAME: ${{ secrets.USER_NAME }}
+ # ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# run: |
# # Set up env vars
- # TAG=$(mvn -q -N -Dmaven.build.cache.enabled=false -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec)
+ # TAG=$(mvn -s $GITHUB_WORKSPACE/.github/workflows/settings.xml -q -N -Dmaven.build.cache.enabled=false -Dexec.executable='echo' -Dexec.args='${project.version}' exec:exec)
# REMOTE_IMAGE_NAME="${IMAGE_REGISTRY}/${IMAGE_USERNAME}/${IMAGE_NAME}"
# # Log in to the package registry
# echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com --username ${GITHUB_ACTOR} --password-stdin
@@ -158,4 +317,3 @@ jobs:
# docker tag ${IMAGE_NAME}:${TAG} ${REMOTE_IMAGE_NAME}:${TAG}
# docker images
# docker push ${REMOTE_IMAGE_NAME}:${TAG}
-
diff --git a/.gitignore b/.gitignore
index 9cff6e33f22..adb29ab2c20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
!**/application/src/main/wildfly/overlay/bin
!**/web-services/deploy/application/src/main/wildfly/overlay/bin
!**/web-services/examples/http-client/bin
+**/*.env
**/*.iml
**/*.orig
**/*.prefs
@@ -49,3 +50,5 @@ web-services/geoserver/geoserver-application/overlays/
services/sample_configuration/*-dev.yml
/.metadata/
+/.dockerignore
+/.maven-dockerignore
diff --git a/.gitmodules b/.gitmodules
index c5ed6ab8d72..26ad0ff918c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -61,3 +61,30 @@
[submodule "microservices/microservice-service-parent"]
path = microservices/microservice-service-parent
url = git@github.com:NationalSecurityAgency/datawave-service-parent.git
+[submodule "contrib/datawave-utils"]
+ path = contrib/datawave-utils
+ url = git@github.com:NationalSecurityAgency/datawave-utils.git
+[submodule "microservices/starters/query"]
+ path = microservices/starters/query
+ url = git@github.com:NationalSecurityAgency/datawave-spring-boot-starter-query.git
+[submodule "microservices/services/query"]
+ path = microservices/services/query
+ url = git@github.com:NationalSecurityAgency/datawave-query-service.git
+[submodule "microservices/services/query-executor"]
+ path = microservices/services/query-executor
+ url = git@github.com:NationalSecurityAgency/datawave-query-executor-service.git
+[submodule "microservices/services/modification"]
+ path = microservices/services/modification
+ url = git@github.com:NationalSecurityAgency/datawave-modification-service.git
+[submodule "microservices/services/mapreduce-query"]
+ path = microservices/services/mapreduce-query
+ url = git@github.com:NationalSecurityAgency/datawave-mapreduce-query-service.git
+[submodule "microservices/starters/cached-results"]
+ path = microservices/starters/cached-results
+ url = git@github.com:NationalSecurityAgency/datawave-spring-boot-starter-cached-results.git
+[submodule "microservices/services/map"]
+ path = microservices/services/map
+ url = git@github.com:NationalSecurityAgency/datawave-map-service.git
+[submodule "microservices/services/file-provider"]
+ path = microservices/services/file-provider
+ url = git@github.com:NationalSecurityAgency/datawave-file-provider-service.git
diff --git a/.mvn/maven-build-cache-config.xml b/.mvn/maven-build-cache-config.xml
index 8def3e68c94..549ab1212ed 100644
--- a/.mvn/maven-build-cache-config.xml
+++ b/.mvn/maven-build-cache-config.xml
@@ -23,7 +23,7 @@
-->
- true
+ false
SHA-256
true
@@ -71,6 +71,22 @@
install
+
+
+ build
+ push
+
+
+
+
+ copy-resources
+
+
+
+
+ repackage
+
+
diff --git a/BUILDME.md b/BUILDME.md
index bd01e71a5be..fbd6744675f 100644
--- a/BUILDME.md
+++ b/BUILDME.md
@@ -1,5 +1,28 @@
# Building Datawave
+## Generating a Github Repository access token
+
+In order to download datawave artifacts from the github package repository, you will need to set credentials in
+your maven `settings.xml` file.
+
+You should first create a classic personal access token on github [here](https://github.com/settings/tokens). Be
+sure to give the token at least the following permissions:
+ * `read:packages`
+
+Save the token value, and create a server entry for the github package repo in your maven `settings.xml` file, like so:
+```xml
+
+
+ github-datawave
+ PUT_YOUR_GITHUB_USERNAME_HERE
+ PUT_YOUR_PERSONAL_ACCESS_TOKEN_HERE
+
+
+```
+The id of the server matters, and should match what is used in the datawave parent pom.
+
+## Building Datawave
+
To perform a full (non-release) 'dev' build without unit tests:
```bash
@@ -41,47 +64,38 @@ mvn -Pdev,assemble,rpm -Ddeploy -Dtar -Ddist -DskipTests clean install
Datawave web services utilize several microservices at runtime (currently authorization and auditing, although that
list will expand soon). Datawave depends on api modules for some of these services, and the dependencies are set in
-the parent pom (see `version.microservice.*` properties) to released versions. If you wish to build the microservices
+the parent pom (see `version.datawave.*` properties) to released versions. If you wish to build the microservices
for some reason, you can simply add `-Dservices` to your maven build command.
### Releasing Microservices
Each subdirectory under the `services` folder is treated as a separate project. Therefore if you wish to build a
release for any of the services (or their APIs), change directory to the appropriate service and build and deploy
-the release with `mvn -Ddist clean deploy`. Note that due to licensing restrictions, we are currently unable to deploy
-to maven's central repository (though we hope to have that changed soon), so we are temporarily deploying to a branch
-in github. Therefore, to execute the deployment, you will need to set credentials in your maven `settings.xml` file.
-You should first create a personal access token on github [here](https://github.com/settings/tokens). Be sure to give
-the token at least the following permissions:
- * `repo:status`
- * `repo_deployment`
- * `public_repo`
- * `notifications`
- * `user:email`
-Save the token value, and add it to a `github` profile in your maven `settings.xml` file, like so:
+the release with `mvn -Ddist clean deploy`. We are currently deploying our artifacts to the github package repo.
+Therefore, to execute the deployment, you will need to set credentials in your maven `settings.xml` file.
+You should first create a classic personal access token on github [here](https://github.com/settings/tokens). Be
+sure to give the token at least the following permissions:
+ * `write:packages`
+ * `delete:packages`
+
+Save the token value, and create a server entry for the github package repo in your maven `settings.xml` file, like so:
```xml
-
- github
-
-
-
- github
-
- PUT_YOUR_GITHUB_USERNAME_HERE
- PUT_YOUR_PERSONAL_ACCESS_TOKEN_HERE
-
-
-
+
+
+ github-datawave
+ PUT_YOUR_GITHUB_USERNAME_HERE
+ PUT_YOUR_PERSONAL_ACCESS_TOKEN_HERE
+
+
```
-The name of the profile doesn't actually matter. The important fact is that the specific maven properties
-are defined.
+The id of the server matters, and should match what is used in the datawave parent pom.
Releases for individual services are generally tagged using the pattern `svc__`. For example,
the authorization service API version 1.0 is tagged with `svc_authorization-api_1.0`.
Note that simply building a new API or service release won't ensure that it is used anywhere. You will need to update
build properties in either the datawave parent pom or within other service poms (for cross-service dependencies) to
-ensure that the new version is used. Look for properties starting with `version.microservice.` to see what to update.
+ensure that the new version is used. Look for properties starting with `version.datawave.` to see what to update.
If you are updating an API module, you should be careful. In general, the associated service will need to be updated as
well to support the API changes. The service should _add_ a new version of the API and continue to support the old
version until it can be ensured that there are no more consumers of the old API.
diff --git a/README.md b/README.md
index 9fa8de8d554..2b154209b7b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[![Apache License][li]][ll] ![Build Status](https://github.com/NationalSecurityAgency/datawave/workflows/Tests/badge.svg)
+[![Apache License][li]][ll] ![Build Status](https://github.com/NationalSecurityAgency/datawave/actions/workflows/tests.yml/badge.svg)
DataWave is a Java-based ingest and query framework that leverages [Apache Accumulo](http://accumulo.apache.org/) to provide fast, secure access to your data. DataWave supports a wide variety of use cases, including but not limited to...
@@ -56,5 +56,9 @@ mvn -Pdocker,dist -DskipMicroservices clean install -T 1C
git submodule deinit --all
```
+### DataWave Microservices
+
+For more information about deploying the datawave quickstart and microservices, check out the [Docker Readme](docker/README.md#usage)
+
[li]: http://img.shields.io/badge/license-ASL-blue.svg
[ll]: https://www.apache.org/licenses/LICENSE-2.0
diff --git a/checkstyle.xml b/checkstyle.xml
index 8744f2ba1a0..6ac2c34afa1 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -2,12 +2,14 @@
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/common-test/pom.xml b/common-test/pom.xml
index aef4f88263a..c340d1e48aa 100644
--- a/common-test/pom.xml
+++ b/common-test/pom.xml
@@ -4,7 +4,7 @@
gov.nsa.datawave
datawave-parent
- 6.5.0-SNAPSHOT
+ 7.13.0-SNAPSHOT
datawave-common-test
${project.artifactId}
@@ -63,5 +63,10 @@
provided
true
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
diff --git a/common-test/src/main/java/datawave/common/test/logging/TestLogCollector.java b/common-test/src/main/java/datawave/common/test/logging/TestLogCollector.java
index 55b20c8c162..679753de40e 100644
--- a/common-test/src/main/java/datawave/common/test/logging/TestLogCollector.java
+++ b/common-test/src/main/java/datawave/common/test/logging/TestLogCollector.java
@@ -4,6 +4,7 @@
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.apache.log4j.bridge.FilterAdapter;
@@ -27,7 +28,7 @@
*/
public class TestLogCollector extends ExternalResource {
- private List messages = new ArrayList<>();
+ private List messages = Collections.synchronizedList(new ArrayList<>());
private List loggers;
private Writer writer = new CharArrayWriter();
diff --git a/common-test/src/main/java/datawave/common/test/utils/ProcessUtils.java b/common-test/src/main/java/datawave/common/test/utils/ProcessUtils.java
index c3b57af8df6..c8e3ea704f5 100644
--- a/common-test/src/main/java/datawave/common/test/utils/ProcessUtils.java
+++ b/common-test/src/main/java/datawave/common/test/utils/ProcessUtils.java
@@ -46,6 +46,8 @@ public static List buildApplicationCommandLine(String clzName, List/>}
+ s=${s//'"'/"}
+ printf -- %s "$s"
+}
+
+function datawaveModification() {
+
+ ! datawaveIsInstalled && info "DataWave Web is not installed. Try 'datawaveInstall'" && return 1
+ ! datawaveWebIsRunning && info "DataWave Web is not running. Try 'datawaveWebStart'" && return 1
+
+ # Reset
+
+ DW_QUERY_RESPONSE_BODY=""
+ DW_QUERY_RESPONSE_CODE=""
+ DW_QUERY_RESPONSE_TYPE=""
+ DW_QUERY_TOTAL_TIME=""
+
+ # Both 'Content-Type: application/x-www-form-urlencoded' and 'Accept: application/json'
+ # added by default, but may be overridden, if needed, via --header,-H option
+
+ DW_REQUEST_HEADERS=""
+
+ # Defaults
+
+ DW_MODIFICATION_COMMAND="INSERT"
+ DW_MODIFICATION_SERVICE="MutableMetadataUUIDService"
+ DW_MODIFICATION_VIZ="BAR&FOO"
+ DW_MODIFICATION_VERBOSE=false
+
+ configureUserIdentity || return 1
+ configureModification "$@" || return $?
+
+ local curlcmd="/usr/bin/curl \
+ --silent --write-out 'HTTP_STATUS_CODE:%{http_code};TOTAL_TIME:%{time_total};CONTENT_TYPE:%{content_type}' \
+ --insecure --cert "${DW_CURL_CERT}" --key "${DW_CURL_KEY_RSA}" --cacert "${DW_CURL_CA}" \
+ --header 'Content-Type: application/xml;charset=UTF-8' --header 'Accept: application/xml' \
+ ${DW_REQUEST_HEADERS} ${DW_CURL_DATA} -X PUT ${DW_MODIFICATION_URI}/${DW_MODIFICATION_SERVICE}/submit"
+ echo $curlcmd
+
+ local response="$( eval "${curlcmd}" )"
+ local exitStatus=$?
+
+ if [ "${exitStatus}" != "0" ] ; then
+ echo
+ error "Curl command exited with non-zero status: ${exitStatus}"
+ echo
+ return 1
+ fi
+
+ parseQueryResponse
+ prettyPrintResponse
+ printCurlSummary
+
+ return 0
+}
+
+function configureModification() {
+
+ while [ "${1}" != "" ]; do
+ case "${1}" in
+ --uuid | -u)
+ DW_MODIFICATION_UUID="${2}"
+ shift
+ ;;
+ --type | -t)
+ DW_MODIFICATION_UUID_TYPE="${2}"
+ shift
+ ;;
+ --field | -f)
+ DW_MODIFICATION_FIELD="${2}"
+ shift
+ ;;
+ --oldvalue | -o)
+ DW_MODIFICATION_OLD_VALUE="${2}"
+ shift
+ ;;
+ --newvalue | -n)
+ DW_MODIFICATION_NEW_VALUE="${2}"
+ shift
+ ;;
+ --visibility | --vis)
+ DW_MODIFICATION_VIZ="${2}"
+ shift
+ ;;
+ --command | -c)
+ DW_MODIFICATION_COMMAND="${2}"
+ shift
+ ;;
+ --header | -H)
+ DW_REQUEST_HEADERS="${DW_REQUEST_HEADERS} ${1} '${2}'"
+ shift
+ ;;
+ --help | -h)
+ modificationHelp && return 1
+ ;;
+ --verbose | -v)
+ DW_MODIFICATION_VERBOSE=true
+ ;;
+ *)
+ error "Invalid argument passed to $( basename "$0" ): ${1}" && return 1
+ esac
+ shift
+ done
+
+ [ -z "${DW_MODIFICATION_UUID}" ] && error "Uuid is required" && return 1
+ [ -z "${DW_MODIFICATION_UUID_TYPE}" ] && error "Uuid type (field) is required" && return 1
+ [ -z "${DW_MODIFICATION_FIELD}" ] && error "Field is required" && return 1
+ [ -z "${DW_MODIFICATION_VIZ}" ] && error "Visibility is required" && return 1
+ BODY="${DW_MODIFICATION_UUID}${DW_MODIFICATION_UUID_TYPE}${DW_MODIFICATION_COMMAND}${DW_MODIFICATION_FIELD}${DW_MODIFICATION_NEW_VALUE}$( xmlencode ${DW_MODIFICATION_VIZ} )testUserINSERTTESTABCPUBLIC"
+ if [ "${DW_MODIFICATION_COMMAND}" == "INSERT" ] ; then
+ [ -z "${DW_MODIFICATION_NEW_VALUE}" ] && error "New field value is required" && return 1
+ elif [ "${DW_MODIFICATION_COMMAND}" == "REPLACE" ] ; then
+ [ -z "${DW_MODIFICATION_NEW_VALUE}" ] && error "New field value is required" && return 1
+ elif [ "${DW_MODIFICATION_COMMAND}" == "UPDATE" ] ; then
+ [ -z "${DW_MODIFICATION_NEW_VALUE}" ] && error "New field value is required" && return 1
+ [ -z "${DW_MODIFICATION_OLD_VALUE}" ] && error "Old field value is required" && return 1
+ BODY="${DW_MODIFICATION_UUID}${DW_MODIFICATION_UUID_TYPE}${DW_MODIFICATION_COMMAND}${DW_MODIFICATION_FIELD}${DW_MODIFICATION_NEW_VALUE}${DW_MODIFICATION_OLD_VALUE}$( xmlencode ${DW_MODIFICATION_VIZ} )testUserINSERTTESTABCPUBLIC"
+ elif [ "${DW_MODIFICATION_COMMAND}" == "DELETE" ] ; then
+ [ -z "${DW_MODIFICATION_OLD_VALUE}" ] && error "Old field value is required" && return 1
+ BODY="${DW_MODIFICATION_UUID}${DW_MODIFICATION_UUID_TYPE}${DW_MODIFICATION_COMMAND}${DW_MODIFICATION_FIELD}${DW_MODIFICATION_OLD_VALUE}$( xmlencode ${DW_MODIFICATION_VIZ} )testUserINSERTTESTABCPUBLIC"
+ else
+ error "Command set to ${DW_MODIFICATION_COMMAND}. Command must be one of INSERT, UPDATE, DELETE, or REPLACE." && return 1
+ fi
+
+ DW_CURL_DATA="-d '$BODY'"
+}
+
+function modificationHelp() {
+ echo
+ echo " The $( printGreen "datawaveModification" ) shell function allows you submit modification requests on demand to DataWave's"
+ echo " Rest API and to inspect the results. It automatically configures curl and sets"
+ echo " reasonable defaults for most required query parameters"
+ echo
+ echo " Assuming the following modification entries are in the datawave.metadata:"
+ echo " REVIEW m:csv []"
+ echo " REVIEW m:enwiki []"
+ echo " REVIEW m:tvmaze []"
+ echo
+ echo " $( printGreen datawaveModification ) --uuid 09aa3d46-8aa0-49fb-8859-f3add48859b0 --type UUID --field REVIEW -c INSERT --newvalue 'I liked this one'"
+ echo " $( printGreen datawaveModification ) --uuid 09aa3d46-8aa0-49fb-8859-f3add48859b0 --type UUID --field REVIEW -c DELETE --oldvalue 'I liked this one'"
+ echo " $( printGreen datawaveModification ) --uuid 09aa3d46-8aa0-49fb-8859-f3add48859b0 --type UUID --field REVIEW -c REPLACE --newvalue 'I really liked this one'"
+ echo " $( printGreen datawaveModification ) --uuid 09aa3d46-8aa0-49fb-8859-f3add48859b0 --type UUID --field REVIEW -c UPDATE --oldvalue 'I liked this one' --newvalue 'I really liked this one'"
+ echo
+ echo " Required:"
+ echo
+ echo " $( printGreen "-u" ) | $( printGreen "--uuid" ) \"\""
+ echo " The event uuid"
+ echo
+ echo " $( printGreen "-t" ) | $( printGreen "--type" ) \"\""
+ echo " The event uuid type (field)"
+ echo
+ echo " $( printGreen "-f" ) | $( printGreen "--field" ) \"\""
+ echo " The field to modify"
+ echo
+ echo " Optional:"
+ echo
+ echo " $( printGreen "-c" ) | $( printGreen "--command" ) "
+ echo " The command must be one of INSERT, UPDATE, DELETE, or REPLACE. Defaults to ${DW_MODIFICATION_COMMAND}"
+ echo
+ echo " $( printGreen "-n" ) | $( printGreen "--newvalue" ) "
+ echo " The old value (required for INSERT, UPDATE or REPLACE service)"
+ echo
+ echo " $( printGreen "-o" ) | $( printGreen "--oldvalue" ) "
+ echo " The old value (required for UPDATE or DELETE service)"
+ echo
+ echo " $( printGreen "--vis" ) | $( printGreen "--visibility" ) "
+ echo " Visibility expression to use when logging this query to Accumulo. Defaults to '${DW_MODIFICATION_LOG_VIZ}'"
+ echo
+ echo " $( printGreen "-H" ) | $( printGreen "--header" ) \"HeaderName: HeaderValue\""
+ echo " Adds specified name/value pair to the curl command as an HTTP request header"
+ echo " Defaults: '$(printGreen "Content-Type"): application/x-www-form-urlencoded' and '$(printGreen "Accept"): application/json'"
+ echo
+ echo " $( printGreen "-x" ) | $( printGreen "--xml" )"
+ echo " Adds '$(printGreen "Accept"): application/xml' as an HTTP request header to override the default JSON"
+ echo
+ echo " $( printGreen "-v" ) | $( printGreen "--verbose" )"
+ echo " Display curl command. Otherwise, only query results and response metadata are displayed"
+ echo
+ echo " $( printGreen "-h" ) | $( printGreen "--help" )"
+ echo " Print this usage information and exit the script"
+ echo
+}
+
+function listMutableFields() {
+
+ # Reset
+
+ DW_QUERY_RESPONSE_BODY=""
+ DW_QUERY_RESPONSE_CODE=""
+ DW_QUERY_RESPONSE_TYPE=""
+ DW_QUERY_TOTAL_TIME=""
+ DW_QUERY_EXTRA_PARAMS=""
+
+ configureUserIdentity || return 1
+
+ local curlcmd="/usr/bin/curl \
+ --silent --write-out 'HTTP_STATUS_CODE:%{http_code};TOTAL_TIME:%{time_total};CONTENT_TYPE:%{content_type}' \
+ --insecure --cert "${DW_CURL_CERT}" --key "${DW_CURL_KEY_RSA}" --cacert "${DW_CURL_CA}" \
+ -X GET ${DW_MODIFICATION_URI}/getMutableFieldList"
+
+ local response="$( eval "${curlcmd}" )"
+ local exitStatus=$?
+ if [ "${exitStatus}" != "0" ] ; then
+ error "Curl command exited with non-zero status: ${exitStatus}"
+ echo
+ return 1
+ fi
+
+ parseQueryResponse
+ prettyPrintResponse
+ printCurlSummary
+}
+
+function reloadMutableFieldCache() {
+
+ local curlcmd="/usr/bin/curl \
+ --silent --write-out 'HTTP_STATUS_CODE:%{http_code};TOTAL_TIME:%{time_total};CONTENT_TYPE:%{content_type}' \
+ --insecure --cert "${DW_CURL_CERT}" --key "${DW_CURL_KEY_RSA}" --cacert "${DW_CURL_CA}" \
+ -X GET ${DW_MODIFICATION_URI}/AccumuloTableCache/reload/datawave.metadata"
+ local response="$( eval "${curlcmd}" )"
+ local exitStatus=$?
+
+ if [ "${exitStatus}" != "0" ] ; then
+ error "Curl command exited with non-zero status: ${exitStatus}. Failed to update table cache: ${dwtable}"
+ return 1
+ fi
+
+ parseQueryResponse
+ prettyPrintResponse
+ printCurlSummary
+
+ local curlcmd="/usr/bin/curl \
+ --silent --write-out 'HTTP_STATUS_CODE:%{http_code};TOTAL_TIME:%{time_total};CONTENT_TYPE:%{content_type}' \
+ --insecure --cert "${DW_CURL_CERT}" --key "${DW_CURL_KEY_RSA}" --cacert "${DW_CURL_CA}" \
+ -X GET ${DW_MODIFICATION_URI}/reloadCache"
+
+ local response="$( eval "${curlcmd}" )"
+ local exitStatus=$?
+
+ if [ "${exitStatus}" != "0" ] ; then
+ error "Curl command exited with non-zero status: ${exitStatus}. Failed to update mutable fields cache: ${dwtable}"
+ return 1
+ fi
+
+ parseQueryResponse
+ prettyPrintResponse
+ printCurlSummary
+}
+
+function listModificationConfiguration() {
+
+ # Reset
+
+ DW_QUERY_RESPONSE_BODY=""
+ DW_QUERY_RESPONSE_CODE=""
+ DW_QUERY_RESPONSE_TYPE=""
+ DW_QUERY_TOTAL_TIME=""
+ DW_QUERY_EXTRA_PARAMS=""
+
+ configureUserIdentity || return 1
+
+ local curlcmd="/usr/bin/curl \
+ --silent --write-out 'HTTP_STATUS_CODE:%{http_code};TOTAL_TIME:%{time_total};CONTENT_TYPE:%{content_type}' \
+ --insecure --cert "${DW_CURL_CERT}" --key "${DW_CURL_KEY_RSA}" --cacert "${DW_CURL_CA}" \
+ -X GET ${DW_MODIFICATION_URI}/listConfigurations"
+
+ local response="$( eval "${curlcmd}" )"
+ local exitStatus=$?
+ if [ "${exitStatus}" != "0" ] ; then
+ error "Curl command exited with non-zero status: ${exitStatus}"
+ echo
+ return 1
+ fi
+
+ parseQueryResponse
+ prettyPrintResponse
+ printCurlSummary
+}
+
diff --git a/contrib/datawave-quickstart/bin/query.sh b/contrib/datawave-quickstart/bin/query.sh
index 7e44656010c..d49aa64b4f1 100644
--- a/contrib/datawave-quickstart/bin/query.sh
+++ b/contrib/datawave-quickstart/bin/query.sh
@@ -131,21 +131,8 @@ function setQueryIdFromResponse() {
}
function prettyPrintJson() {
- local PY=$( which python )
- if [ -n "${PY}" ] ; then
- echo "${1}" | ${PY} -c 'from __future__ import print_function;import sys,json;data=json.loads(sys.stdin.read()); print(json.dumps(data, indent=2, sort_keys=True))'
- local exitStatus=$?
- echo
- if [ "${exitStatus}" != "0" ] ; then
- printRawResponse "${1}"
- warn "Python encountered error. Printed response without formatting"
- echo
- fi
- else
- printRawResponse "${1}"
- warn "Couldn't find python in your environment. Json response was printed without formatting"
- echo
- fi
+ PY_CMD='from __future__ import print_function; import sys,json; data=json.loads(sys.stdin.read()); print(json.dumps(data, indent=2, sort_keys=True))'
+ echo "${1}" | ( python3 -c "${PY_CMD}" 2>/dev/null || python2 -c "${PY_CMD}" 2>/dev/null ) || ( warn "Python encountered error. Printed response without formatting" && printRawResponse "${1}" )
}
function printRawResponse() {
@@ -400,7 +387,7 @@ function getNextPage() {
function parseQueryResponse() {
DW_QUERY_RESPONSE_BODY=$( echo ${response} | sed -e 's/HTTP_STATUS_CODE\:.*//g' )
DW_QUERY_RESPONSE_CODE=$( echo ${response} | tr -d '\n' | sed -e 's/.*HTTP_STATUS_CODE://' | sed -e 's/;TOTAL_TIME\:.*//' )
- DW_QUERY_RESPONSE_TYPE=$( echo ${response} | tr -d '\n' | sed -e 's/.*CONTENT_TYPE://' )
+ DW_QUERY_RESPONSE_TYPE=$( echo ${response} | tr -d '\n' | sed -e 's/.*CONTENT_TYPE://' | sed -e 's/;.*//' )
DW_QUERY_TOTAL_TIME=$( echo ${response} | tr -d '\n' | sed -e 's/.*TOTAL_TIME://' | sed -e 's/;CONTENT_TYPE\:.*//' )
}
diff --git a/contrib/datawave-quickstart/bin/services/accumulo/bootstrap.sh b/contrib/datawave-quickstart/bin/services/accumulo/bootstrap.sh
index 7e785e9b46e..15d01f2ece7 100644
--- a/contrib/datawave-quickstart/bin/services/accumulo/bootstrap.sh
+++ b/contrib/datawave-quickstart/bin/services/accumulo/bootstrap.sh
@@ -15,13 +15,26 @@ DW_ACCUMULO_SERVICE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Zookeeper config
# You may override DW_ZOOKEEPER_DIST_URI in your env ahead of time, and set as file:///path/to/file.tar.gz for local tarball, if needed
-DW_ZOOKEEPER_DIST_URI="${DW_ZOOKEEPER_DIST_URI:-https://archive.apache.org/dist/zookeeper/zookeeper-3.7.1/apache-zookeeper-3.7.1-bin.tar.gz}"
+# DW_ZOOKEEPER_DIST_URI should, if possible, be using https. There are potential security risks by using http.
+DW_ZOOKEEPER_VERSION="3.7.2"
+DW_ZOOKEEPER_DIST_URI="${DW_ZOOKEEPER_DIST_URI:-https://dlcdn.apache.org/zookeeper/zookeeper-${DW_ZOOKEEPER_VERSION}/apache-zookeeper-${DW_ZOOKEEPER_VERSION}-bin.tar.gz}"
+# The sha512 checksum for the tarball. Value should be the hash value only and does not include the file name. Cannot be left blank.
+DW_ZOOKEEPER_DIST_SHA512_CHECKSUM="${DW_ZOOKEEPER_DIST_SHA512_CHECKSUM:-6afbfc1afc8b9370281bd9862f37dbb1cb95ec54bb2ed4371831aa5c0f08cfee775050bd57ce5fc0836e61af27eed9f0076f54b98997dd0e15159196056e52ea}"
# shellcheck disable=SC2154
# shellcheck disable=SC2034
-DW_ZOOKEEPER_DIST="$( downloadTarball "${DW_ZOOKEEPER_DIST_URI}" "${DW_ACCUMULO_SERVICE_DIR}" && echo "${tarball}" )"
+DW_ZOOKEEPER_DIST="$( { downloadTarball "${DW_ZOOKEEPER_DIST_URI}" "${DW_ACCUMULO_SERVICE_DIR}" || downloadMavenTarball "datawave-parent" "gov.nsa.datawave.quickstart" "zookeeper" "${DW_ZOOKEEPER_VERSION}" "${DW_ACCUMULO_SERVICE_DIR}"; } && echo "${tarball}" )"
DW_ZOOKEEPER_BASEDIR="zookeeper-install"
DW_ZOOKEEPER_SYMLINK="zookeeper"
+# You may override DW_BIND_HOST in your env ahead of time, if needed
+DW_BIND_HOST="${DW_BIND_HOST:-localhost}"
+
+# If we are configured to bind to all interfaces, instead bind to the hostname
+DW_ACCUMULO_BIND_HOST="${DW_ACCUMULO_BIND_HOST:-${DW_BIND_HOST}}"
+if [ "$DW_ACCUMULO_BIND_HOST" == "0.0.0.0" ] ; then
+ DW_ACCUMULO_BIND_HOST="$(hostname)"
+fi
+
# zoo.cfg...
# shellcheck disable=SC2034
DW_ZOOKEEPER_CONF="
@@ -30,15 +43,20 @@ syncLimit=5
clientPort=2181
dataDir=${DW_CLOUD_DATA}/zookeeper
maxClientCnxns=100
+4lw.commands.whitelist=ruok,wchs
admin.serverPort=8089
admin.enableServer=false"
# Accumulo config
# You may override DW_ACCUMULO_DIST_URI in your env ahead of time, and set as file:///path/to/file.tar.gz for local tarball, if needed
-DW_ACCUMULO_DIST_URI="${DW_ACCUMULO_DIST_URI:-http://archive.apache.org/dist/accumulo/2.1.1/accumulo-2.1.1-bin.tar.gz}"
+# DW_ACCUMULO_DIST_URI should, if possible, be using https. There are potential security risks by using http.
+DW_ACCUMULO_VERSION="2.1.3"
+DW_ACCUMULO_DIST_URI="${DW_ACCUMULO_DIST_URI:-https://dlcdn.apache.org/accumulo/${DW_ACCUMULO_VERSION}/accumulo-${DW_ACCUMULO_VERSION}-bin.tar.gz}"
+# The sha512 checksum for the tarball. Value should be the hash value only and does not include the file name. Cannot be left blank.
+DW_ACCUMULO_DIST_SHA512_CHECKSUM="${DW_ACCUMULO_DIST_SHA512_CHECKSUM:-1a27a144dc31f55ccc8e081b6c1bc6cc0362a8391838c53c166cb45291ff8f35867fd8e4729aa7b2c540f8b721f8c6953281bf589fc7fe320e4dc4d20b87abc4}"
# shellcheck disable=SC2034
-DW_ACCUMULO_DIST="$( downloadTarball "${DW_ACCUMULO_DIST_URI}" "${DW_ACCUMULO_SERVICE_DIR}" && echo "${tarball}" )"
+DW_ACCUMULO_DIST="$( { downloadTarball "${DW_ACCUMULO_DIST_URI}" "${DW_ACCUMULO_SERVICE_DIR}" || downloadMavenTarball "datawave-parent" "gov.nsa.datawave.quickstart" "accumulo" "${DW_ACCUMULO_VERSION}" "${DW_ACCUMULO_SERVICE_DIR}"; } && echo "${tarball}" )"
DW_ACCUMULO_BASEDIR="accumulo-install"
DW_ACCUMULO_SYMLINK="accumulo"
DW_ACCUMULO_INSTANCE_NAME="my-instance-01"
@@ -57,7 +75,7 @@ DW_ACCUMULO_VFS_DATAWAVE_DIR="/datawave/accumulo-vfs-classpath"
# accumulo.properties (Format: ={})
DW_ACCUMULO_PROPERTIES="## Sets location in HDFS where Accumulo will store data
-instance.volumes=${DW_HADOOP_DFS_URI}/accumulo
+instance.volumes=${DW_HADOOP_DFS_URI_CLIENT}/accumulo
## Sets location of Zookeepers
instance.zookeeper.host=localhost:2181
@@ -66,7 +84,7 @@ instance.zookeeper.host=localhost:2181
instance.secret=${DW_ACCUMULO_PASSWORD}
## Set to false if 'accumulo-util build-native' fails
-tserver.memory.maps.native.enabled=true
+tserver.memory.maps.native.enabled=false
tserver.memory.maps.max=385M
tserver.cache.data.size=64M
tserver.cache.index.size=64M
@@ -79,7 +97,7 @@ trace.password=${DW_ACCUMULO_PASSWORD}"
if [ "${DW_ACCUMULO_VFS_DATAWAVE_ENABLED}" != false ] ; then
DW_ACCUMULO_PROPERTIES="${DW_ACCUMULO_PROPERTIES}
-general.vfs.context.classpath.datawave=${DW_HADOOP_DFS_URI}${DW_ACCUMULO_VFS_DATAWAVE_DIR}/.*.jar"
+general.vfs.context.classpath.datawave=${DW_HADOOP_DFS_URI_CLIENT}${DW_ACCUMULO_VFS_DATAWAVE_DIR}/.*.jar"
else
DW_ACCUMULO_PROPERTIES="${DW_ACCUMULO_PROPERTIES}
general.vfs.context.classpath.extlib=file://${ACCUMULO_HOME}/lib/ext/.*.jar"
@@ -108,7 +126,7 @@ DW_ZOOKEEPER_CMD_FIND_ALL_PIDS="ps -ef | grep 'zookeeper.server.quorum.QuorumPee
DW_ACCUMULO_CMD_START="( cd ${ACCUMULO_HOME}/bin && ./accumulo-cluster start )"
DW_ACCUMULO_CMD_STOP="( cd ${ACCUMULO_HOME}/bin && ./accumulo-cluster stop )"
-DW_ACCUMULO_CMD_FIND_ALL_PIDS="pgrep -d ' ' -f 'o.start.Main manager|o.start.Main tserver|o.start.Main monitor|o.start.Main gc|o.start.Main tracer'"
+DW_ACCUMULO_CMD_FIND_ALL_PIDS="pgrep -u ${USER} -d ' ' -f 'o.start.Main manager|o.start.Main tserver|o.start.Main monitor|o.start.Main gc|o.start.Main tracer'"
function accumuloIsRunning() {
DW_ACCUMULO_PID_LIST="$(eval "${DW_ACCUMULO_CMD_FIND_ALL_PIDS}")"
@@ -131,7 +149,7 @@ function accumuloStart() {
fi
eval "${DW_ACCUMULO_CMD_START}"
echo
- info "For detailed status visit 'http://localhost:9995' in your browser"
+ info "For detailed status visit 'http://${DW_ACCUMULO_BIND_HOST}:9995' in your browser"
}
function accumuloStop() {
@@ -233,7 +251,7 @@ function accumuloUninstall() {
}
function accumuloInstall() {
- "${DW_ACCUMULO_SERVICE_DIR}/install.sh"
+ "${DW_ACCUMULO_SERVICE_DIR}/install.sh"
}
function zookeeperIsInstalled() {
@@ -284,15 +302,15 @@ function accumuloPidList() {
}
function accumuloDisplayBinaryInfo() {
- echo "Source: ${DW_ACCUMULO_DIST_URI}"
- local tarballName="$(basename "$DW_ACCUMULO_DIST_URI")"
+ echo "Source: ${DW_ACCUMULO_DIST}"
+ local tarballName="$(basename "$DW_ACCUMULO_DIST")"
if [[ -f "${DW_ACCUMULO_SERVICE_DIR}/${tarballName}" ]]; then
echo " Local: ${DW_ACCUMULO_SERVICE_DIR}/${tarballName}"
else
echo " Local: Not loaded"
fi
- echo "Source: ${DW_ZOOKEEPER_DIST_URI}"
- tarballName="$(basename "$DW_ZOOKEEPER_DIST_URI")"
+ echo "Source: ${DW_ZOOKEEPER_DIST}"
+ tarballName="$(basename "$DW_ZOOKEEPER_DIST")"
if [[ -f "${DW_ACCUMULO_SERVICE_DIR}/${tarballName}" ]]; then
echo " Local: ${DW_ACCUMULO_SERVICE_DIR}/${tarballName}"
else
diff --git a/contrib/datawave-quickstart/bin/services/accumulo/install.sh b/contrib/datawave-quickstart/bin/services/accumulo/install.sh
index 3fa5dc9d2ae..b73e5494045 100755
--- a/contrib/datawave-quickstart/bin/services/accumulo/install.sh
+++ b/contrib/datawave-quickstart/bin/services/accumulo/install.sh
@@ -14,6 +14,11 @@ source "${SERVICES_DIR}/hadoop/bootstrap.sh"
hadoopIsInstalled || fatal "Accumulo requires that Hadoop be installed"
+# If Accumulo is not installed, verify that the two checksums match before installing.
+accumuloIsInstalled || verifyChecksum "${DW_ACCUMULO_DIST_URI}" "${DW_ACCUMULO_SERVICE_DIR}" "${DW_ACCUMULO_DIST_SHA512_CHECKSUM}"
+# If Zookeeper is not installed, verify that the two checksums match before installing.
+zookeeperIsInstalled || verifyChecksum "${DW_ZOOKEEPER_DIST_URI}" "${DW_ACCUMULO_SERVICE_DIR}" "${DW_ZOOKEEPER_DIST_SHA512_CHECKSUM}"
+
if zookeeperIsInstalled ; then
info "ZooKeeper is already installed"
else
@@ -21,6 +26,8 @@ else
mkdir "${DW_ACCUMULO_SERVICE_DIR}/${DW_ZOOKEEPER_BASEDIR}" || fatal "Failed to create ZooKeeper base directory"
# Extract ZooKeeper, set symlink, and verify...
tar xf "${DW_ACCUMULO_SERVICE_DIR}/${DW_ZOOKEEPER_DIST}" -C "${DW_ACCUMULO_SERVICE_DIR}/${DW_ZOOKEEPER_BASEDIR}" --strip-components=1 || fatal "Failed to extract ZooKeeper tarball"
+ #symlink the zookeeper jars if needed
+ ln -s ${DW_ACCUMULO_SERVICE_DIR}/${DW_ZOOKEEPER_BASEDIR}/lib/* ${DW_ACCUMULO_SERVICE_DIR}/${DW_ZOOKEEPER_BASEDIR}
( cd "${DW_CLOUD_HOME}" && ln -s "bin/services/accumulo/${DW_ZOOKEEPER_BASEDIR}" "${DW_ZOOKEEPER_SYMLINK}" ) || fatal "Failed to set ZooKeeper symlink"
zookeeperIsInstalled || fatal "ZooKeeper was not installed"
@@ -66,6 +73,11 @@ sed -i'' -e "s~\(ACCUMULO_TSERVER_OPTS=\).*$~\1\"${DW_ACCUMULO_TSERVER_OPTS}\"~g
sed -i'' -e "s~\(export JAVA_HOME=\).*$~\1\"${JAVA_HOME}\"~g" "${DW_ACCUMULO_CONF_DIR}/accumulo-env.sh"
sed -i'' -e "s~\(export ACCUMULO_MONITOR_OPTS=\).*$~\1\"\${POLICY} -Xmx2g -Xms512m\"~g" "${DW_ACCUMULO_CONF_DIR}/accumulo-env.sh"
+# Update Accumulo bind host if it's not set to localhost
+if [ "${DW_ACCUMULO_BIND_HOST}" != "localhost" ] ; then
+ sed -i'' -e "s/localhost/${DW_ACCUMULO_BIND_HOST}/g" ${DW_ACCUMULO_CONF_DIR}/cluster.yaml
+fi
+
# Write zoo.cfg file using our settings in DW_ZOOKEEPER_CONF
if [ -n "${DW_ZOOKEEPER_CONF}" ] ; then
echo "${DW_ZOOKEEPER_CONF}" > "${DW_ZOOKEEPER_CONF_DIR}/zoo.cfg" || fatal "Failed to write zoo.cfg"
diff --git a/contrib/datawave-quickstart/bin/services/datawave/bootstrap-ingest.sh b/contrib/datawave-quickstart/bin/services/datawave/bootstrap-ingest.sh
index bd689ec71d1..8629602bc00 100644
--- a/contrib/datawave-quickstart/bin/services/datawave/bootstrap-ingest.sh
+++ b/contrib/datawave-quickstart/bin/services/datawave/bootstrap-ingest.sh
@@ -184,7 +184,7 @@ function datawaveIngestWikipedia() {
[ ! -f "${wikipediaRawFile}" ] && error "File not found: ${wikipediaRawFile}" && return 1
local wikipediaHdfsFile="${DW_DATAWAVE_INGEST_HDFS_BASEDIR}/$( basename ${wikipediaRawFile} )"
- local putFileCommand="hdfs dfs -copyFromLocal ${wikipediaRawFile} ${wikipediaHdfsFile}"
+ local putFileCommand="hdfs dfs -copyFromLocal -f ${wikipediaRawFile} ${wikipediaHdfsFile}"
local inputFormat="datawave.ingest.wikipedia.WikipediaEventInputFormat"
local jobCommand="${DW_DATAWAVE_INGEST_HOME}/bin/ingest/live-ingest.sh ${wikipediaHdfsFile} ${DW_DATAWAVE_INGEST_NUM_SHARDS} -inputFormat ${inputFormat} -data.name.override=wikipedia ${extraOpts}"
@@ -211,7 +211,7 @@ function datawaveIngestCsv() {
[ ! -f "${csvRawFile}" ] && error "File not found: ${csvRawFile}" && return 1
local csvHdfsFile="${DW_DATAWAVE_INGEST_HDFS_BASEDIR}/$( basename ${csvRawFile} )"
- local putFileCommand="hdfs dfs -copyFromLocal ${csvRawFile} ${csvHdfsFile}"
+ local putFileCommand="hdfs dfs -copyFromLocal -f ${csvRawFile} ${csvHdfsFile}"
local inputFormat="datawave.ingest.csv.mr.input.CSVFileInputFormat"
local jobCommand="${DW_DATAWAVE_INGEST_HOME}/bin/ingest/live-ingest.sh ${csvHdfsFile} ${DW_DATAWAVE_INGEST_NUM_SHARDS} -inputFormat ${inputFormat} -data.name.override=mycsv ${extraOpts}"
@@ -232,7 +232,7 @@ function datawaveIngestJson() {
[ ! -f "${jsonRawFile}" ] && error "File not found: ${jsonRawFile}" && return 1
local jsonHdfsFile="${DW_DATAWAVE_INGEST_HDFS_BASEDIR}/$( basename ${jsonRawFile} )"
- local putFileCommand="hdfs dfs -copyFromLocal ${jsonRawFile} ${jsonHdfsFile}"
+ local putFileCommand="hdfs dfs -copyFromLocal -f ${jsonRawFile} ${jsonHdfsFile}"
local inputFormat="datawave.ingest.json.mr.input.JsonInputFormat"
local jobCommand="${DW_DATAWAVE_INGEST_HOME}/bin/ingest/live-ingest.sh ${jsonHdfsFile} ${DW_DATAWAVE_INGEST_NUM_SHARDS} -inputFormat ${inputFormat} -data.name.override=myjson ${extraOpts}"
@@ -347,3 +347,10 @@ function datawaveIngestTarballName() {
local dwVersion="$(getDataWaveVersion)"
echo "$( basename "${DW_DATAWAVE_INGEST_TARBALL/-\*-/-$dwVersion-}" )"
}
+
+function datawaveIngestExamples() {
+ datawaveIngestWikipedia ${DW_DATAWAVE_INGEST_TEST_FILE_WIKI}
+ datawaveIngestJson ${DW_DATAWAVE_INGEST_TEST_FILE_JSON}
+ datawaveIngestCsv ${DW_DATAWAVE_INGEST_TEST_FILE_CSV}
+}
+
diff --git a/contrib/datawave-quickstart/bin/services/datawave/bootstrap-web.sh b/contrib/datawave-quickstart/bin/services/datawave/bootstrap-web.sh
index 65e243576de..a6606321d7f 100644
--- a/contrib/datawave-quickstart/bin/services/datawave/bootstrap-web.sh
+++ b/contrib/datawave-quickstart/bin/services/datawave/bootstrap-web.sh
@@ -1,7 +1,11 @@
# You may override DW_WILDFLY_DIST_URI in your env ahead of time, and set as file:///path/to/file.tar.gz for local tarball, if needed
-DW_WILDFLY_DIST_URI="${DW_WILDFLY_DIST_URI:-https://download.jboss.org/wildfly/17.0.1.Final/wildfly-17.0.1.Final.tar.gz}"
-DW_WILDFLY_DIST="$( downloadTarball "${DW_WILDFLY_DIST_URI}" "${DW_DATAWAVE_SERVICE_DIR}" && echo "${tarball}" )"
+DW_WILDFLY_VERSION="17.0.1"
+# DW_WILDFLY_DIST_URI should, if possible, be using https. There are potential security risks by using http.
+DW_WILDFLY_DIST_URI="${DW_WILDFLY_DIST_URI:-https://download.jboss.org/wildfly/${DW_WILDFLY_VERSION}.Final/wildfly-${DW_WILDFLY_VERSION}.Final.tar.gz}"
+# The sha512 checksum for the tarball. Value should be the hash value only and does not include the file name. Cannot be left blank.
+DW_WILDFLY_DIST_SHA512_CHECKSUM="${DW_WILDFLY_DIST_SHA512_CHECKSUM:-fcbdff4bc275f478c3bf5f665a83e62468a920e58fcddeaa2710272dd0f1ce3154cdc371d5011763a6be24ae1a5e0bca0218cceea63543edb4b5cf22de60b485}"
+DW_WILDFLY_DIST="$( { downloadTarball "${DW_WILDFLY_DIST_URI}" "${DW_DATAWAVE_SERVICE_DIR}" || downloadMavenTarball "datawave-parent" "gov.nsa.datawave.quickstart" "wildfly" "${DW_WILDFLY_VERSION}" "${DW_DATAWAVE_SERVICE_DIR}"; } && echo "${tarball}" )"
DW_WILDFLY_BASEDIR="wildfly-install"
DW_WILDFLY_SYMLINK="wildfly"
@@ -173,8 +177,8 @@ function datawaveWebDisplayBinaryInfo() {
else
echo " Local: Not loaded"
fi
- echo "Source: ${DW_WILDFLY_DIST_URI}"
- local tarballName="$(basename "$DW_WILDFLY_DIST_URI")"
+ echo "Source: ${DW_WILDFLY_DIST}"
+ local tarballName="$(basename "$DW_WILDFLY_DIST")"
if [[ -f "${DW_DATAWAVE_SERVICE_DIR}/${tarballName}" ]]; then
echo " Local: ${DW_DATAWAVE_SERVICE_DIR}/${tarballName}"
else
diff --git a/contrib/datawave-quickstart/bin/services/datawave/bootstrap.sh b/contrib/datawave-quickstart/bin/services/datawave/bootstrap.sh
index 10bdde77661..898828f357f 100644
--- a/contrib/datawave-quickstart/bin/services/datawave/bootstrap.sh
+++ b/contrib/datawave-quickstart/bin/services/datawave/bootstrap.sh
@@ -30,7 +30,7 @@ source "${DW_DATAWAVE_SERVICE_DIR}/bootstrap-user.sh"
DW_DATAWAVE_BUILD_PROFILE=${DW_DATAWAVE_BUILD_PROFILE:-dev}
# Maven command
-DW_DATAWAVE_BUILD_COMMAND="${DW_DATAWAVE_BUILD_COMMAND:-mvn -P${DW_DATAWAVE_BUILD_PROFILE} -Ddeploy -Dtar -Ddist -DskipTests -Dmaven.build.cache.enabled=false clean package --builder smart -T1.0C}"
+DW_DATAWAVE_BUILD_COMMAND="${DW_DATAWAVE_BUILD_COMMAND:-mvn -P${DW_DATAWAVE_BUILD_PROFILE} -Ddeploy -Dtar -Ddist -DskipServices -DskipTests -Dmaven.build.cache.enabled=false clean package --builder smart -T1.0C}"
# Home of any temp data and *.properties file overrides for this instance of DataWave
@@ -137,10 +137,10 @@ function setBuildPropertyOverrides() {
echo "WAREHOUSE_ACCUMULO_HOME=${ACCUMULO_HOME}" >> ${BUILD_PROPERTIES_FILE}
echo "WAREHOUSE_INSTANCE_NAME=${DW_ACCUMULO_INSTANCE_NAME}" >> ${BUILD_PROPERTIES_FILE}
- echo "WAREHOUSE_JOBTRACKER_NODE=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS}" >> ${BUILD_PROPERTIES_FILE}
+ echo "WAREHOUSE_JOBTRACKER_NODE=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
echo "INGEST_ACCUMULO_HOME=${ACCUMULO_HOME}" >> ${BUILD_PROPERTIES_FILE}
echo "INGEST_INSTANCE_NAME=${DW_ACCUMULO_INSTANCE_NAME}" >> ${BUILD_PROPERTIES_FILE}
- echo "INGEST_JOBTRACKER_NODE=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS}" >> ${BUILD_PROPERTIES_FILE}
+ echo "INGEST_JOBTRACKER_NODE=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
echo "BULK_INGEST_DATA_TYPES=${DW_DATAWAVE_INGEST_BULK_DATA_TYPES}" >> ${BUILD_PROPERTIES_FILE}
echo "LIVE_INGEST_DATA_TYPES=${DW_DATAWAVE_INGEST_LIVE_DATA_TYPES}" >> ${BUILD_PROPERTIES_FILE}
echo "PASSWORD=${DW_ACCUMULO_PASSWORD}" >> ${BUILD_PROPERTIES_FILE}
@@ -168,11 +168,11 @@ function setBuildPropertyOverrides() {
# # uncomment to enable environment passwords in the quickstart, and comment out above line
# echo "accumulo.user.password=env:DW_ACCUMULO_PASSWORD" >> ${BUILD_PROPERTIES_FILE}
- echo "cached.results.hdfs.uri=${DW_HADOOP_DFS_URI}" >> ${BUILD_PROPERTIES_FILE}
- echo "type.metadata.hdfs.uri=${DW_HADOOP_DFS_URI}" >> ${BUILD_PROPERTIES_FILE}
- echo "mapReduce.hdfs.uri=${DW_HADOOP_DFS_URI}" >> ${BUILD_PROPERTIES_FILE}
- echo "bulkResults.hdfs.uri=${DW_HADOOP_DFS_URI}" >> ${BUILD_PROPERTIES_FILE}
- echo "jboss.log.hdfs.uri=${DW_HADOOP_DFS_URI}" >> ${BUILD_PROPERTIES_FILE}
+ echo "cached.results.hdfs.uri=${DW_HADOOP_DFS_URI_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
+ echo "type.metadata.hdfs.uri=${DW_HADOOP_DFS_URI_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
+ echo "mapReduce.hdfs.uri=${DW_HADOOP_DFS_URI_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
+ echo "bulkResults.hdfs.uri=${DW_HADOOP_DFS_URI_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
+ echo "jboss.log.hdfs.uri=${DW_HADOOP_DFS_URI_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
echo "lock.file.dir=${DW_DATAWAVE_INGEST_LOCKFILE_DIR}" >> ${BUILD_PROPERTIES_FILE}
echo "server.keystore.password=${DW_ACCUMULO_PASSWORD}" >> ${BUILD_PROPERTIES_FILE}
@@ -181,9 +181,10 @@ function setBuildPropertyOverrides() {
echo "jboss.managed.executor.service.default.max.threads=${DW_WILDFLY_EE_DEFAULT_MAX_THREADS:-48}" >> ${BUILD_PROPERTIES_FILE}
echo "hornetq.cluster.password=${DW_ACCUMULO_PASSWORD}" >> ${BUILD_PROPERTIES_FILE}
echo "hornetq.system.password=${DW_ACCUMULO_PASSWORD}" >> ${BUILD_PROPERTIES_FILE}
- echo "mapReduce.job.tracker=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS}" >> ${BUILD_PROPERTIES_FILE}
- echo "bulkResults.job.tracker=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS}" >> ${BUILD_PROPERTIES_FILE}
+ echo "mapReduce.job.tracker=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
+ echo "bulkResults.job.tracker=${DW_HADOOP_RESOURCE_MANAGER_ADDRESS_CLIENT}" >> ${BUILD_PROPERTIES_FILE}
echo "EVENT_DISCARD_INTERVAL=0" >> ${BUILD_PROPERTIES_FILE}
+ echo "EVENT_DISCARD_FUTURE_INTERVAL=0" >> ${BUILD_PROPERTIES_FILE}
echo "ingest.data.types=${DW_DATAWAVE_INGEST_LIVE_DATA_TYPES},${DW_DATAWAVE_INGEST_BULK_DATA_TYPES}" >> ${BUILD_PROPERTIES_FILE}
echo "JOB_CACHE_REPLICATION=1" >> ${BUILD_PROPERTIES_FILE}
echo "EDGE_DEFINITION_FILE=${DW_DATAWAVE_INGEST_EDGE_DEFINITIONS}" >> ${BUILD_PROPERTIES_FILE}
diff --git a/contrib/datawave-quickstart/bin/services/datawave/ingest-examples/tvmaze-api-query.sh b/contrib/datawave-quickstart/bin/services/datawave/ingest-examples/tvmaze-api-query.sh
index af1da19187e..69cf2d47fa5 100755
--- a/contrib/datawave-quickstart/bin/services/datawave/ingest-examples/tvmaze-api-query.sh
+++ b/contrib/datawave-quickstart/bin/services/datawave/ingest-examples/tvmaze-api-query.sh
@@ -38,10 +38,11 @@ TVMAZE_RESPONSE_STATUS=$( echo ${CURL_RESPONSE} | tr -d '\n' | sed -e 's/.*HTTP_
[ "${TVMAZE_RESPONSE_STATUS}" != "200" ] && error "api.tvmaze.com returned invalid response status: ${TVMAZE_RESPONSE_STATUS}" && exit 1
[ -z "${TVMAZE_RESPONSE_BODY}" ] && error "Response body is empty!" && exit 1
+PY_CMD='from __future__ import print_function; import sys,json; data=json.loads(sys.stdin.read()); print(json.dumps(data, indent=2, sort_keys=True))'
if [ "${PRETTY}" == true ] ; then
- echo "${TVMAZE_RESPONSE_BODY}" | python -c 'from __future__ import print_function;import sys,json;data=json.loads(sys.stdin.read()); print(json.dumps(data, indent=2, sort_keys=True))'
+ echo "${TVMAZE_RESPONSE_BODY}" | ( python3 -c "${PY_CMD}" 2>/dev/null || python2 -c "${PY_CMD}" 2>/dev/null ) || ( warn "Unable to pretty print, Python not detected" && echo "${TVMAZE_RESPONSE_BODY}" )
else
- echo "${TVMAZE_RESPONSE_BODY}"
+ echo "${TVMAZE_RESPONSE_BODY}"
fi
exit 0
\ No newline at end of file
diff --git a/contrib/datawave-quickstart/bin/services/datawave/install-ingest.sh b/contrib/datawave-quickstart/bin/services/datawave/install-ingest.sh
index ca3ab94af47..2ab3f06fa7b 100755
--- a/contrib/datawave-quickstart/bin/services/datawave/install-ingest.sh
+++ b/contrib/datawave-quickstart/bin/services/datawave/install-ingest.sh
@@ -75,9 +75,9 @@ else
[ ! -d ${ACCUMULO_HOME}/lib/ext ] && fatal "Unable to update Accumulo classpath. ${ACCUMULO_HOME}/lib/ext does not exist!"
info "Removing any existing jars from ${ACCUMULO_HOME}/lib/ext"
rm -f ${ACCUMULO_HOME}/lib/ext/*.jar
- info "Copying DataWave jars into ${ACCUMULO_HOME}/lib/ext"
+ info "Copying DataWave jars into ${ACCUMULO_HOME}/lib and ${ACCUMULO_HOME}/lib/ext"
if [ -d ${DW_DATAWAVE_INGEST_HOME}/accumulo-warehouse/lib ]; then
- cp ${DW_DATAWAVE_INGEST_HOME}/accumulo-warehouse/lib/*.jar ${ACCUMULO_HOME}/lib/ext > /dev/null 2>&1
+ cp ${DW_DATAWAVE_INGEST_HOME}/accumulo-warehouse/lib/*.jar ${ACCUMULO_HOME}/lib > /dev/null 2>&1
fi
if [ -d ${DW_DATAWAVE_INGEST_HOME}/accumulo-warehouse/lib/ext ]; then
cp ${DW_DATAWAVE_INGEST_HOME}/accumulo-warehouse/lib/ext/*.jar ${ACCUMULO_HOME}/lib/ext > /dev/null 2>&1
@@ -159,13 +159,6 @@ function initializeDatawaveTables() {
fi
}
-function ingestExampleData() {
- # Ingest some canned, example data files
- datawaveIngestWikipedia "${DW_DATAWAVE_INGEST_TEST_FILE_WIKI}"
- datawaveIngestJson "${DW_DATAWAVE_INGEST_TEST_FILE_JSON}"
- datawaveIngestCsv "${DW_DATAWAVE_INGEST_TEST_FILE_CSV}"
-}
-
initializeDatawaveTables
@@ -186,4 +179,4 @@ info "See \$DW_CLOUD_HOME/bin/services/datawave/bootstrap-ingest.sh to view/edit
# Ingest raw data examples, if appropriate...
-[ "${DW_REDEPLOY_IN_PROGRESS}" != true ] && [ "${DW_DATAWAVE_INGEST_TEST_SKIP}" == false ] && ingestExampleData
+[ "${DW_REDEPLOY_IN_PROGRESS}" != true ] && [ "${DW_DATAWAVE_INGEST_TEST_SKIP}" == false ] && datawaveIngestExamples
diff --git a/contrib/datawave-quickstart/bin/services/datawave/install-web.sh b/contrib/datawave-quickstart/bin/services/datawave/install-web.sh
index 5435e9598e9..40c18b4aa31 100755
--- a/contrib/datawave-quickstart/bin/services/datawave/install-web.sh
+++ b/contrib/datawave-quickstart/bin/services/datawave/install-web.sh
@@ -10,6 +10,9 @@ source "${THIS_DIR}/bootstrap.sh"
source "${SERVICES_DIR}/hadoop/bootstrap.sh"
source "${SERVICES_DIR}/accumulo/bootstrap.sh"
+# If Wildfly is not installed, verify that the two checksums match before installing.
+datawaveWebIsInstalled || verifyChecksum "${DW_WILDFLY_DIST_URI}" "${DW_DATAWAVE_SERVICE_DIR}" "${DW_WILDFLY_DIST_SHA512_CHECKSUM}"
+
accumuloIsInstalled || fatal "DataWave Web requires that Accumulo be installed"
datawaveWebIsInstalled && info "DataWave Web is already installed" && exit 1
diff --git a/contrib/datawave-quickstart/bin/services/datawave/test-web/responses/EventQueryJexlSyntax.test/JexlWildFieldedPage1.expected b/contrib/datawave-quickstart/bin/services/datawave/test-web/responses/EventQueryJexlSyntax.test/JexlWildFieldedPage1.expected
new file mode 100644
index 00000000000..c9e1cf9dab6
--- /dev/null
+++ b/contrib/datawave-quickstart/bin/services/datawave/test-web/responses/EventQueryJexlSyntax.test/JexlWildFieldedPage1.expected
@@ -0,0 +1 @@
+{"Events":[{"Fields":[{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"1709323633673"},"columnVisibility":"PUBLIC","name":"LOAD_DATE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"30"},"columnVisibility":"PUBLIC","name":"TERM_COUNT","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"2016-04-26T00:32:53Z"},"columnVisibility":"PUBLIC","name":"EVENT_DATE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"f7fbd49088f28aeb92bf76157ed5f1056fe2f9c3"},"columnVisibility":"PUBLIC","name":"SHA1","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"PUBLIC"},"columnVisibility":"PUBLIC","name":"SECURITY_MARKING","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"VERTEX1"},"columnVisibility":"PUBLIC","name":"EDGE_VERTEX_TO","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"THIS SHALL NOT BE TOKENIZED"},"columnVisibility":"PUBLIC","name":"FIELDNAME1_NOT_TO_TOKENIZE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"2016-04-26 03:00:00"},"columnVisibility":"PUBLIC","name":"PROCESSING_DATE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"my.csv|5|0"},"columnVisibility":"PUBLIC","name":"ORIG_FILE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"TXT2M20161170217518731.gz#152498541"},"columnVisibility":"PUBLIC","name":"CONTENT_URI","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"\nMore summary text \n"},"columnVisibility":"PUBLIC","name":"SUMMARY","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"2190"},"columnVisibility":"PUBLIC","name":"PROCESSED_SIZE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"20160426_0/csv/1855zl.64utu.-nzzng8.1"},"columnVisibility":"PUBLIC","name":"RECORD_ID","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"MYFOO"},"columnVisibility":"PUBLIC","name":"FOO_FIELD","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"0016dd72-0000-827d-dd4d-001b2163ba09"},"columnVisibility":"PUBLIC","name":"UUID","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"ENGLISH"},"columnVisibility":"PUBLIC","name":"LANGUAGE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"66f00045d715f5afa19ffc1c28c140cd01eac190"},"columnVisibility":"PUBLIC","name":"PARAGRAPH_CHECKSUM_SHA_1","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"718ef8731de49eceaf24ce149710d6f3f854d5f3"},"columnVisibility":"PUBLIC","name":"PARAGRAPH_CHECKSUM_SHA_1","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"d6bdac5ec34acde7d55611246280648de11d7a6b"},"columnVisibility":"PUBLIC","name":"PARAGRAPH_CHECKSUM_SHA_1","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"MYBAR"},"columnVisibility":"PUBLIC","name":"BAR_FIELD","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"MIME"},"columnVisibility":"PUBLIC","name":"PARENT_FILETYPE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"7e604bd4cd397bec7a861405f8860cb45892d054a96be66e94ea9b62c118f8a6"},"columnVisibility":"PUBLIC","name":"SHA256","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"VERTEX9"},"columnVisibility":"PUBLIC","name":"EDGE_VERTEX_FROM","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"gggb.n2016117myaa.0000000179-att-1"},"columnVisibility":"PUBLIC","name":"EVENT_ID","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"MIME-BODY"},"columnVisibility":"PUBLIC","name":"FILE_TYPE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"2188"},"columnVisibility":"PUBLIC","name":"ORIGINAL_SIZE","timestamp":1461628800000},{"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Value":{"type":"xs:string","value":"6c257114aaca09de9e9c3754baf1015h"},"columnVisibility":"PUBLIC","name":"MD5","timestamp":1461628800000}],"Markings":{"entry":[{"key":"columnVisibility","value":"PUBLIC"}]},"Metadata":{"DataType":"csv","InternalId":"1855zl.64utu.-nzzng8.1","Row":"20160426_0","Table":"datawave.shard"}}],"Fields":["BAR_FIELD","CONTENT_URI","EDGE_VERTEX_FROM","EDGE_VERTEX_TO","EVENT_DATE","EVENT_ID","FIELDNAME1_NOT_TO_TOKENIZE","FILE_TYPE","FOO_FIELD","LANGUAGE","LOAD_DATE","MD5","ORIGINAL_SIZE","ORIG_FILE","PARAGRAPH_CHECKSUM_SHA_1","PARENT_FILETYPE","PROCESSED_SIZE","PROCESSING_DATE","RECORD_ID","SECURITY_MARKING","SHA1","SHA256","SUMMARY","TERM_COUNT","UUID"],"HasResults":true,"LogicName":"EventQuery","OperationTimeMS":2,"PageNumber":2,"PartialResults":false,"QueryId":"f5b1e1a5-19a9-497d-aac5-0fd5d00a2a7f","ReturnedEvents":1}
\ No newline at end of file
diff --git a/contrib/datawave-quickstart/bin/services/datawave/test-web/tests/EventQueryJexlSyntax.test b/contrib/datawave-quickstart/bin/services/datawave/test-web/tests/EventQueryJexlSyntax.test
index 274c6896ae0..8d6da3e235d 100644
--- a/contrib/datawave-quickstart/bin/services/datawave/test-web/tests/EventQueryJexlSyntax.test
+++ b/contrib/datawave-quickstart/bin/services/datawave/test-web/tests/EventQueryJexlSyntax.test
@@ -106,4 +106,35 @@ configureTest \
"" \
204
+
+setCurlData query=$( urlencode "SUMMARY =~ '.*more.*' AND UUID == '0016dd72-0000-827d-dd4d-001b2163ba09'" ) \
+ queryName=EventQueryTestJexlWild \
+ begin=20160301 \
+ end=20160501 \
+ pagesize=1 \
+ auths=PUBLIC \
+ columnVisibility=PRIVATE \
+ query.syntax=JEXL
+
+configureTest \
+ CreateJexlWildFielded \
+ "Creates a valid, fielded EventQuery w/ JEXL query syntax" \
+ "--header 'Content-Type: application/x-www-form-urlencoded' ${DW_CURL_DATA} -X POST ${URI_ROOT}/Query/EventQuery/create" \
+ "application/xml;charset=UTF-8" \
+ 200
+
+runTest --set-query-id
+
+################################################################
+# Get 1st page from /Query/${DW_QUERY_ID}/next, in JSON format this time
+
+configureTest \
+ JexlWildFieldedPage1 \
+ "Gets the 1st page of results for the CreateJexlWild test in JSON format" \
+ "--header 'Accept: application/json' -X GET ${URI_ROOT}/Query/${DW_QUERY_ID}/next" \
+ application/json \
+ 200
+
+runTest
+
# This last test is executed by run.sh, as usual
diff --git a/contrib/datawave-quickstart/bin/services/hadoop/bootstrap.sh b/contrib/datawave-quickstart/bin/services/hadoop/bootstrap.sh
index f8f60d8f9c1..8cec3a75726 100644
--- a/contrib/datawave-quickstart/bin/services/hadoop/bootstrap.sh
+++ b/contrib/datawave-quickstart/bin/services/hadoop/bootstrap.sh
@@ -2,27 +2,41 @@
DW_HADOOP_SERVICE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+DW_HADOOP_VERSION="3.3.6"
# You may override DW_HADOOP_DIST_URI in your env ahead of time, and set as file:///path/to/file.tar.gz for local tarball, if needed
-DW_HADOOP_DIST_URI="${DW_HADOOP_DIST_URI:-http://archive.apache.org/dist/hadoop/common/hadoop-3.3.4/hadoop-3.3.4.tar.gz}"
-DW_HADOOP_DIST="$( downloadTarball "${DW_HADOOP_DIST_URI}" "${DW_HADOOP_SERVICE_DIR}" && echo "${tarball}" )"
+# DW_HADOOP_DIST_URI should, if possible, be using https. There are potential security risks by using http.
+DW_HADOOP_DIST_URI="${DW_HADOOP_DIST_URI:-https://dlcdn.apache.org/hadoop/common/hadoop-${DW_HADOOP_VERSION}/hadoop-${DW_HADOOP_VERSION}.tar.gz}"
+# The sha512 checksum for the tarball. Value should be the hash value only and does not include the file name. Cannot be left blank.
+DW_HADOOP_DIST_SHA512_CHECKSUM="${DW_HADOOP_DIST_SHA512_CHECKSUM:-de3eaca2e0517e4b569a88b63c89fae19cb8ac6c01ff990f1ff8f0cc0f3128c8e8a23db01577ca562a0e0bb1b4a3889f8c74384e609cd55e537aada3dcaa9f8a}"
+DW_HADOOP_DIST="$( { downloadTarball "${DW_HADOOP_DIST_URI}" "${DW_HADOOP_SERVICE_DIR}" || downloadMavenTarball "datawave-parent" "gov.nsa.datawave.quickstart" "hadoop" "${DW_HADOOP_VERSION}" "${DW_HADOOP_SERVICE_DIR}"; } && echo "${tarball}" )"
DW_HADOOP_BASEDIR="hadoop-install"
DW_HADOOP_SYMLINK="hadoop"
-DW_HADOOP_DFS_URI="hdfs://localhost:9000"
+# You may override DW_BIND_HOST in your env ahead of time, if needed
+DW_BIND_HOST="${DW_BIND_HOST:-localhost}"
+
+DW_HADOOP_DFS_URI_SERVER="hdfs://${DW_BIND_HOST}:9000"
+DW_HADOOP_DFS_URI_CLIENT="hdfs://${DW_BIND_HOST}:9000"
DW_HADOOP_MR_INTER_DIR="/jobhist/inter"
DW_HADOOP_MR_DONE_DIR="/jobhist/done"
-DW_HADOOP_RESOURCE_MANAGER_ADDRESS="localhost:8050"
+DW_HADOOP_RESOURCE_MANAGER_ADDRESS_SERVER="${DW_BIND_HOST}:8050"
+DW_HADOOP_RESOURCE_MANAGER_ADDRESS_CLIENT="${DW_BIND_HOST}:8050"
+
+if [ "${DW_BIND_HOST}" == "0.0.0.0" ] ; then
+ DW_HADOOP_DFS_URI_CLIENT="hdfs://localhost:9000"
+ DW_HADOOP_RESOURCE_MANAGER_ADDRESS_CLIENT="localhost:8050"
+fi
HADOOP_HOME="${DW_CLOUD_HOME}/${DW_HADOOP_SYMLINK}"
# core-site.xml (Format: {})
-DW_HADOOP_CORE_SITE_CONF="fs.defaultFS ${DW_HADOOP_DFS_URI}
-hadoop.tmp.dir file:/${DW_CLOUD_DATA}/hadoop/tmp
+DW_HADOOP_CORE_SITE_CONF="fs.defaultFS ${DW_HADOOP_DFS_URI_SERVER}
+hadoop.tmp.dir file://${DW_CLOUD_DATA}/hadoop/tmp
io.compression.codecs org.apache.hadoop.io.compress.GzipCodec"
# hdfs-site.xml (Format: {})
DW_HADOOP_HDFS_SITE_CONF="dfs.namenode.name.dir file://${DW_CLOUD_DATA}/hadoop/nn
-dfs.namenode.secondary.http-address localhost
+dfs.namenode.secondary.http-address ${DW_BIND_HOST}
dfs.namenode.checkpoint.dir file://${DW_CLOUD_DATA}/hadoop/nnchk
dfs.datanode.data.dir file://${DW_CLOUD_DATA}/hadoop/dn
dfs.datanode.handler.count 10
@@ -31,8 +45,8 @@ dfs.replication 1"
DW_HADOOP_MR_HEAPDUMP_DIR="${DW_CLOUD_DATA}/heapdumps"
# mapred-site.xml (Format: {})
-DW_HADOOP_MAPRED_SITE_CONF="mapreduce.jobhistory.address http://localhost:8020
-mapreduce.jobhistory.webapp.address http://localhost:8021
+DW_HADOOP_MAPRED_SITE_CONF="mapreduce.jobhistory.address ${DW_BIND_HOST}:8020
+mapreduce.jobhistory.webapp.address ${DW_BIND_HOST}:8021
mapreduce.jobhistory.intermediate-done-dir ${DW_HADOOP_MR_INTER_DIR}
mapreduce.jobhistory.done-dir ${DW_HADOOP_MR_DONE_DIR}
mapreduce.map.memory.mb 2048
@@ -45,12 +59,12 @@ mapreduce.map.env HADOOP_MAPRED_HOME=${HADOOP_HOME}
mapreduce.reduce.env HADOOP_MAPRED_HOME=${HADOOP_HOME}"
# yarn-site.xml (Format: {})
-DW_HADOOP_YARN_SITE_CONF="yarn.resourcemanager.scheduler.address localhost:8030
+DW_HADOOP_YARN_SITE_CONF="yarn.resourcemanager.scheduler.address ${DW_BIND_HOST}:8030
yarn.resourcemanager.scheduler.class org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler
-yarn.resourcemanager.resource-tracker.address localhost:8025
-yarn.resourcemanager.address ${DW_HADOOP_RESOURCE_MANAGER_ADDRESS}
-yarn.resourcemanager.admin.address localhost:8033
-yarn.resourcemanager.webapp.address localhost:8088
+yarn.resourcemanager.resource-tracker.address ${DW_BIND_HOST}:8025
+yarn.resourcemanager.address ${DW_HADOOP_RESOURCE_MANAGER_ADDRESS_SERVER}
+yarn.resourcemanager.admin.address ${DW_BIND_HOST}:8033
+yarn.resourcemanager.webapp.address ${DW_BIND_HOST}:8088
yarn.nodemanager.local-dirs ${DW_CLOUD_DATA}/hadoop/yarn/local
yarn.nodemanager.log-dirs ${DW_CLOUD_DATA}/hadoop/yarn/log
yarn.nodemanager.aux-services mapreduce_shuffle
@@ -58,7 +72,7 @@ yarn.nodemanager.pmem-check-enabled false
yarn.nodemanager.vmem-check-enabled false
yarn.nodemanager.resource.memory-mb 6144
yarn.app.mapreduce.am.resource.mb 1024
-yarn.log.server.url http://localhost:8070/jobhistory/logs"
+yarn.log.server.url http://localhost:8021/jobhistory/logs"
# capacity-scheduler.xml (Format: {})
DW_HADOOP_CAPACITY_SCHEDULER_CONF="yarn.scheduler.capacity.maximum-applications 10000
@@ -85,6 +99,7 @@ yarn.scheduler.capacity.node-locality-delay 40"
export HADOOP_HOME
export HADOOP_CONF_DIR="${HADOOP_HOME}/etc/hadoop"
export HADOOP_LOG_DIR="${HADOOP_HOME}/logs"
+export YARN_LOG_DIR="${DW_CLOUD_DATA}/hadoop/yarn/log"
export HADOOP_YARN_HOME="${HADOOP_HOME}"
export HADOOP_MAPRED_HOME="${HADOOP_HOME}"
export HADOOP_PID_DIR="${DW_CLOUD_DATA}/hadoop/pids"
@@ -95,7 +110,7 @@ export PATH=${HADOOP_HOME}/bin:$PATH
DW_HADOOP_CMD_START="( cd ${HADOOP_HOME}/sbin && ./start-dfs.sh && ./start-yarn.sh && mapred --daemon start historyserver )"
DW_HADOOP_CMD_STOP="( cd ${HADOOP_HOME}/sbin && mapred --daemon stop historyserver && ./stop-yarn.sh && ./stop-dfs.sh )"
-DW_HADOOP_CMD_FIND_ALL_PIDS="pgrep -d ' ' -f 'proc_datanode|proc_namenode|proc_secondarynamenode|proc_nodemanager|proc_resourcemanager|mapreduce.v2.hs.JobHistoryServer'"
+DW_HADOOP_CMD_FIND_ALL_PIDS="pgrep -u ${USER} -d ' ' -f 'proc_datanode|proc_namenode|proc_secondarynamenode|proc_nodemanager|proc_resourcemanager|mapreduce.v2.hs.JobHistoryServer'"
function hadoopIsRunning() {
DW_HADOOP_PID_LIST="$(eval "${DW_HADOOP_CMD_FIND_ALL_PIDS}")"
@@ -105,7 +120,7 @@ function hadoopIsRunning() {
function hadoopStart() {
hadoopIsRunning && echo "Hadoop is already running" || eval "${DW_HADOOP_CMD_START}"
echo
- info "For detailed status visit 'http://localhost:50070/dfshealth.html#tab-overview' in your browser"
+ info "For detailed status visit 'http://localhost:9870/dfshealth.html#tab-overview' in your browser"
# Wait for Hadoop to come out of safemode
${HADOOP_HOME}/bin/hdfs dfsadmin -safemode wait
}
@@ -191,7 +206,7 @@ function hadoopUninstall() {
}
function hadoopInstall() {
- "${DW_HADOOP_SERVICE_DIR}"/install.sh
+ "${DW_HADOOP_SERVICE_DIR}"/install.sh
}
function hadoopPrintenv() {
@@ -209,8 +224,8 @@ function hadoopPidList() {
}
function hadoopDisplayBinaryInfo() {
- echo "Source: ${DW_HADOOP_DIST_URI}"
- local tarballName="$(basename "$DW_HADOOP_DIST_URI")"
+ echo "Source: ${DW_HADOOP_DIST}"
+ local tarballName="$(basename "$DW_HADOOP_DIST")"
if [[ -f "${DW_HADOOP_SERVICE_DIR}/${tarballName}" ]]; then
echo " Local: ${DW_HADOOP_SERVICE_DIR}/${tarballName}"
else
diff --git a/contrib/datawave-quickstart/bin/services/hadoop/install.sh b/contrib/datawave-quickstart/bin/services/hadoop/install.sh
index 8757ec4bdb9..b31338c09ab 100755
--- a/contrib/datawave-quickstart/bin/services/hadoop/install.sh
+++ b/contrib/datawave-quickstart/bin/services/hadoop/install.sh
@@ -36,6 +36,9 @@ Generate the password-less ssh key now?"
source "${BIN_DIR}/env.sh"
source "${THIS_DIR}/bootstrap.sh"
+# If Hadoop is not installed, verify that the two checksums match before installing.
+hadoopIsInstalled || verifyChecksum "${DW_HADOOP_DIST_URI}" "${DW_HADOOP_SERVICE_DIR}" "${DW_HADOOP_DIST_SHA512_CHECKSUM}"
+
hadoopIsInstalled && info "Hadoop is already installed" && exit 1
[ -f "${DW_HADOOP_SERVICE_DIR}/${DW_HADOOP_DIST}" ] || fatal "Hadoop tarball not found"
diff --git a/contrib/datawave-quickstart/bin/services/maven/bootstrap.sh b/contrib/datawave-quickstart/bin/services/maven/bootstrap.sh
index e638fd044f1..61fc360a58c 100644
--- a/contrib/datawave-quickstart/bin/services/maven/bootstrap.sh
+++ b/contrib/datawave-quickstart/bin/services/maven/bootstrap.sh
@@ -1,16 +1,18 @@
# Sourced by env.sh
DW_MAVEN_SERVICE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+DW_MAVEN_VERSION="3.8.8"
# You may override DW_MAVEN_DIST_URI in your env ahead of time, and set as file:///path/to/file.tar.gz for local tarball, if needed
-DW_MAVEN_DIST_URI="${DW_MAVEN_DIST_URI:-https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz}"
+DW_MAVEN_DIST_URI="${DW_MAVEN_DIST_URI:-https://dlcdn.apache.org/maven/maven-3/${DW_MAVEN_VERSION}/binaries/apache-maven-${DW_MAVEN_VERSION}-bin.tar.gz}"
DW_MAVEN_DIST="$( basename "${DW_MAVEN_DIST_URI}" )"
DW_MAVEN_BASEDIR="maven-install"
DW_MAVEN_SYMLINK="maven"
function bootstrapEmbeddedMaven() {
- [ ! -f "${DW_MAVEN_SERVICE_DIR}/${DW_MAVEN_DIST}" ] \
- && info "Maven 3.x not detected. Attempting to bootstrap a dedicated install..." \
- && downloadTarball "${DW_MAVEN_DIST_URI}" "${DW_MAVEN_SERVICE_DIR}"
+ if [ ! -f "${DW_MAVEN_SERVICE_DIR}/${DW_MAVEN_DIST}" ]; then
+ info "Maven 3.x not detected. Attempting to bootstrap a dedicated install..."
+ DW_MAVEN_DIST="$( { downloadTarball "${DW_MAVEN_DIST_URI}" "${DW_MAVEN_SERVICE_DIR}" || downloadMavenTarball "datawave-parent" "gov.nsa.datawave.quickstart" "maven" "${DW_MAVEN_VERSION}" "${DW_MAVEN_SERVICE_DIR}"; } && echo "${tarball}" )"
+ fi
export MAVEN_HOME="${DW_CLOUD_HOME}/${DW_MAVEN_SYMLINK}"
export M2_HOME="${MAVEN_HOME}"
@@ -105,8 +107,8 @@ function mavenPrintenv() {
}
function mavenDisplayBinaryInfo() {
- echo "Source: ${DW_MAVEN_DIST_URI}"
- local tarballName="$(basename "$DW_MAVEN_DIST_URI")"
+ echo "Source: ${DW_MAVEN_DIST}"
+ local tarballName="$(basename "$DW_MAVEN_DIST")"
if [[ -f "${DW_MAVEN_SERVICE_DIR}/${tarballName}" ]]; then
echo " Local: ${DW_MAVEN_SERVICE_DIR}/${tarballName}"
else
diff --git a/contrib/datawave-quickstart/bin/services/nifi/bootstrap.sh b/contrib/datawave-quickstart/bin/services/nifi/bootstrap.sh
index cb7145f9707..dc369b1ddd8 100644
--- a/contrib/datawave-quickstart/bin/services/nifi/bootstrap.sh
+++ b/contrib/datawave-quickstart/bin/services/nifi/bootstrap.sh
@@ -3,7 +3,10 @@
DW_NIFI_SERVICE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# You may override DW_NIFI_DIST_URI in your env ahead of time, and set as file:///path/to/file.tar.gz for local tarball, if needed
-DW_NIFI_DIST_URI="${DW_NIFI_DIST_URI:-http://apache.claz.org/nifi/1.1.1/nifi-1.1.1-bin.tar.gz}"
+# DW_NIFI_DIST_URI should, if possible, be using https. There are potential security risks by using http.
+DW_NIFI_DIST_URI="${DW_NIFI_DIST_URI:-https://dlcdn.apache.org/nifi/1.25.0/nifi-1.25.0-bin.zip}"
+# The sha512 checksum for the tarball. Value should be the hash value only and does not include the file name. Cannot be left blank.
+DW_NIFI_DIST_SHA512_CHECKSUM="${DW_NIFI_DIST_SHA512_CHECKSUM:-3798e8923cfc9099b785ee2019e9a0fe8bcd36301946f19d21d414800ca6b7fedd1bbe28764fa446262a2f47b1c608651208c8d8790c73bea9ebd839f42dbab1}"
DW_NIFI_DIST="$( downloadTarball "${DW_NIFI_DIST_URI}" "${DW_NIFI_SERVICE_DIR}" && echo "${tarball}" )"
DW_NIFI_BASEDIR="nifi-install"
DW_NIFI_SYMLINK="nifi"
@@ -16,7 +19,7 @@ export PATH=${NIFI_HOME}/bin:$PATH
DW_NIFI_CMD_START="( cd ${NIFI_HOME}/bin && ./nifi.sh start )"
DW_NIFI_CMD_STOP="( cd ${NIFI_HOME}/bin && ./nifi.sh stop )"
-DW_NIFI_CMD_FIND_ALL_PIDS="pgrep -d ' ' -f 'org.apache.nifi'"
+DW_NIFI_CMD_FIND_ALL_PIDS="pgrep -u ${USER} -d ' ' -f 'org.apache.nifi'"
function nifiIsRunning() {
DW_NIFI_PID_LIST="$(eval "${DW_NIFI_CMD_FIND_ALL_PIDS}")"
diff --git a/contrib/datawave-quickstart/bin/services/nifi/install.sh b/contrib/datawave-quickstart/bin/services/nifi/install.sh
index 5e8edd4e6cf..92ccb6b0ea7 100755
--- a/contrib/datawave-quickstart/bin/services/nifi/install.sh
+++ b/contrib/datawave-quickstart/bin/services/nifi/install.sh
@@ -8,13 +8,16 @@ BIN_DIR="$( dirname "${SERVICES_DIR}" )"
source "${BIN_DIR}/env.sh"
source "${THIS_DIR}/bootstrap.sh"
+# If NiFi is not installed, verify that the two checksums match before installing.
+nifiIsInstalled || verifyChecksum "${DW_NIFI_DIST_URI}" "${DW_NIFI_SERVICE_DIR}" "${DW_NIFI_DIST_SHA512_CHECKSUM}"
+
nifiIsInstalled && info "NiFi is already installed" && exit 1
-[ ! -f "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_DIST}" ] && fatal "NiFi tarball not found"
+[ ! -f "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_DIST}" ] && fatal "NiFi zip file not found"
mkdir "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_BASEDIR}" || fatal "Failed to create NiFi base directory"
-tar xf "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_DIST}" -C "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_BASEDIR}" --strip-components=1 || fatal "Failed to extract NiFi tarball"
+unzip "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_DIST}" -d "${DW_NIFI_SERVICE_DIR}/${DW_NIFI_BASEDIR}" || fatal "Failed to extract NiFi tarball"
$( cd "${DW_CLOUD_HOME}" && ln -s "bin/services/nifi/${DW_NIFI_BASEDIR}" "${DW_NIFI_SYMLINK}" ) || fatal "Failed to create NiFi symlink"
nifiIsInstalled || fatal "NiFi was not installed"
diff --git a/contrib/datawave-quickstart/docker/.dockerignore b/contrib/datawave-quickstart/docker/.dockerignore
index 502d36b8395..c6bdfad356b 100644
--- a/contrib/datawave-quickstart/docker/.dockerignore
+++ b/contrib/datawave-quickstart/docker/.dockerignore
@@ -39,7 +39,7 @@
**/datawave-quickstart/bin/services/accumulo/accumulo-install
**/datawave-quickstart/bin/services/datawave/datawave-ingest-*
-**/datawave-quickstart/bin/services/datawave/datawave-web-*
+**/datawave-quickstart/bin/services/datawave/datawave-webservice-*
**/datawave-quickstart/bin/services/hadoop/hadoop-install
**/datawave-quickstart/bin/services/nifi/nifi-install
**/datawave-quickstart/bin/services/maven/maven-install
diff --git a/contrib/datawave-quickstart/docker/.maven-dockerignore b/contrib/datawave-quickstart/docker/.maven-dockerignore
new file mode 100644
index 00000000000..fb8d37ce358
--- /dev/null
+++ b/contrib/datawave-quickstart/docker/.maven-dockerignore
@@ -0,0 +1,59 @@
+# This .dockerignore gets symlinked temporarily from the datawave repo's
+# root directory by docker-build.sh, since that directory is used as
+# the build context for the image.
+
+# Therefore, any exclusions/exceptions added here should take that into account
+
+# Ignore any ide and repo dirs/files
+
+**/.m2/**
+**/.git/**
+**/.idea/**
+**/target/**
+**/*.iml/**
+**/.classpath/**
+**/.project/**
+**/.settings/**
+**/logs/**
+
+# Ignore temporary .dockerignore symlink in the root directory...
+.dockerignore
+# ...but don't ignore the actual .dockerignore file
+!**/datawave-quickstart/docker/.dockerignore
+
+# Below, we mostly just ignore enviromnent-specific stuff that may have
+# already been initialized under **/datawave-quickstart
+
+# Ignore any service install symlinks
+
+**/datawave-quickstart/accumulo/**
+**/datawave-quickstart/datawave-ingest/**
+**/datawave-quickstart/datawave-webservice/**
+**/datawave-quickstart/hadoop/**
+**/datawave-quickstart/nifi/**
+**/datawave-quickstart/zookeeper/**
+**/datawave-quickstart/java/**
+**/datawave-quickstart/maven/**
+**/datawave-quickstart/wildfly/**
+
+# Ignore any service install directories
+
+**/datawave-quickstart/bin/services/accumulo/accumulo-install/**
+**/datawave-quickstart/bin/services/datawave/datawave-ingest-*/**
+**/datawave-quickstart/bin/services/datawave/datawave-webservice-*/**
+**/datawave-quickstart/bin/services/hadoop/hadoop-install/**
+**/datawave-quickstart/bin/services/nifi/nifi-install/**
+**/datawave-quickstart/bin/services/maven/maven-install/**
+**/datawave-quickstart/bin/services/maven/apache-maven-install/**
+**/datawave-quickstart/bin/services/java/jdk-8-linux-x64/**
+**/datawave-quickstart/bin/services/datawave/wildfly-install/**
+**/datawave-quickstart/bin/services/accumulo/zookeeper-install/**
+**/datawave-quickstart/data/**
+**/datawave-quickstart/build-properties/**
+
+# Make sure that we don't exclude the datawave tarballs, if they exist.
+# The docker-build.sh script *should* ensure that these are built prior
+# to the 'docker build ...' and that they are configured for the
+# docker container's standard root directory, ie, /opt/datawave
+
+!**/datawave-quickstart/bin/services/datawave/datawave-*.tar.gz
diff --git a/contrib/datawave-quickstart/docker/Dockerfile b/contrib/datawave-quickstart/docker/Dockerfile
index d936761d930..7396b0c7527 100644
--- a/contrib/datawave-quickstart/docker/Dockerfile
+++ b/contrib/datawave-quickstart/docker/Dockerfile
@@ -1,24 +1,42 @@
-FROM centos:centos7
+FROM rockylinux/rockylinux:8
ARG DATAWAVE_COMMIT_ID
ARG DATAWAVE_BRANCH_NAME
ARG DATAWAVE_JAVA_HOME
+ARG DATAWAVE_BUILD_PROFILE
+ARG DATAWAVE_SKIP_INGEST=false
+ARG DATAWAVE_SKIP_TESTS=false
+ARG DATAWAVE_MAVEN_REPO="https://maven.pkg.github.com/NationalSecurityAgency/datawave"
+
+ARG ACCUMULO_URL
+ARG HADOOP_URL
+ARG MAVEN_URL
+ARG WILDFLY_URL
+ARG ZOOKEEPER_URL
USER root
+ENV USER=root
ENV HADOOP_IDENT_STRING=root
ENV HDFS_NAMENODE_USER=root HDFS_DATANODE_USER=root
ENV HDFS_SECONDARYNAMENODE_USER=root YARN_RESOURCEMANAGER_USER=root
ENV YARN_NODEMANAGER_USER=root
+# Bind services to all interfaces
+ENV DW_BIND_HOST=0.0.0.0
+
+# Bind accumulo specifically to localhost
+# This can be overridden at runtime to match the service name using DW_CONTAINER_HOST
+ENV DW_ACCUMULO_BIND_HOST=localhost
+
# Build context should be the DataWave source root, minus .git and other dirs. See .dockerignore
COPY . /opt/datawave
# Install dependencies, configure password-less/zero-prompt SSH...
-RUN yum -y install gcc-c++ openssl openssh openssh-server openssh-clients openssl-libs which bc wget git java-11-openjdk-devel iproute && \
- yum clean all && \
+RUN dnf -y install gcc-c++ openssl python3 openssh openssh-server openssh-clients openssl-libs which bc wget git java-11-openjdk-devel iproute && \
+ dnf clean all && \
ssh-keygen -q -N "" -t rsa -f ~/.ssh/id_rsa && \
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && \
chmod 0600 ~/.ssh/authorized_keys && \
@@ -34,17 +52,21 @@ WORKDIR /opt/datawave
# Create new Git repo and configure environment...
-RUN rm -f .dockerignore && \
+RUN rm -f .dockerignore .maven-dockerignore && \
git init && \
git add . && \
git config user.email "root@localhost.local" && \
git config user.name "Root User" && \
git commit -m "Source Branch :: $DATAWAVE_BRANCH_NAME :: Source Commit :: $DATAWAVE_COMMIT_ID" && \
- echo "export DW_ACCUMULO_DIST_URI=file://$(find /opt/datawave/contrib/datawave-quickstart/bin/services/accumulo -name 'accumulo*.tar.gz')" >> ~/.bashrc && \
- echo "export DW_ZOOKEEPER_DIST_URI=file://$(find /opt/datawave/contrib/datawave-quickstart/bin/services/accumulo -name 'apache-zookeeper*.tar.gz')" >> ~/.bashrc && \
- echo "export DW_MAVEN_DIST_URI=file://$(find /opt/datawave/contrib/datawave-quickstart/bin/services/maven -name 'apache-maven*.tar.gz')" >> ~/.bashrc && \
- echo "export DW_HADOOP_DIST_URI=file://$(find /opt/datawave/contrib/datawave-quickstart/bin/services/hadoop -name 'hadoop*.tar.gz')" >> ~/.bashrc && \
- echo "export DW_WILDFLY_DIST_URI=file://$(find /opt/datawave/contrib/datawave-quickstart/bin/services/datawave -name 'wildfly*.tar.gz')" >> ~/.bashrc && \
+ echo "export DW_ACCUMULO_DIST_URI=\"$ACCUMULO_URL\"" >> ~/.bashrc && \
+ echo "export DW_HADOOP_DIST_URI=\"$HADOOP_URL\"" >> ~/.bashrc && \
+ echo "export DW_MAVEN_DIST_URI=\"$MAVEN_URL\"" >> ~/.bashrc && \
+ echo "export DW_WILDFLY_DIST_URI=\"$WILDFLY_URL\"" >> ~/.bashrc && \
+ echo "export DW_ZOOKEEPER_DIST_URI=\"$ZOOKEEPER_URL\"" >> ~/.bashrc && \
+ echo "export DW_DATAWAVE_BUILD_PROFILE=\"$DATAWAVE_BUILD_PROFILE\"" >> ~/.bashrc && \
+ echo "export DW_DATAWAVE_INGEST_TEST_SKIP=\"$DATAWAVE_SKIP_INGEST\"" >> ~/.bashrc && \
+ echo "export DW_MAVEN_REPOSITORY=\"$DATAWAVE_MAVEN_REPO\"" >> ~/.bashrc && \
+ echo "export DW_WGET_OPTS=\"-q --no-check-certificate\"" >> ~/.bashrc && \
echo "export JAVA_HOME=\"$DATAWAVE_JAVA_HOME\"" >> ~/.bashrc && \
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> ~/.bashrc && \
echo "source /opt/datawave/contrib/datawave-quickstart/bin/env.sh" >> ~/.bashrc
@@ -56,8 +78,7 @@ RUN rm -f .dockerignore && \
# stopped gracefully, and any cruft is purged.
RUN /bin/bash -c "/usr/bin/nohup /usr/sbin/sshd -D &" && \
- /bin/bash -c "source ~/.bashrc && allInstall && datawaveStart && datawaveWebTest --blacklist-files QueryMetrics && allStop" && \
- echo "0.0.0.0" > contrib/datawave-quickstart/accumulo/conf/monitor && \
+ /bin/bash -c "source ~/.bashrc && allInstall && [ $DATAWAVE_SKIP_TESTS == true ] || (datawaveStart && datawaveWebTest --blacklist-files QueryMetrics && allStop)" && \
rm -rf contrib/datawave-quickstart/datawave-ingest/logs/* && \
rm -rf contrib/datawave-quickstart/hadoop/logs/* && \
rm -rf contrib/datawave-quickstart/accumulo/logs/* && \
@@ -77,7 +98,7 @@ VOLUME ["/opt/datawave/contrib/datawave-quickstart/accumulo/logs"]
VOLUME ["/opt/datawave/contrib/datawave-quickstart/wildfly/standalone/log"]
VOLUME ["/opt/datawave/contrib/datawave-quickstart/datawave-ingest/logs"]
-EXPOSE 8443 9995 50070 8088 9000 2181
+EXPOSE 8443 9995 9870 8088 9000 2181
WORKDIR /opt/datawave/contrib/datawave-quickstart
diff --git a/contrib/datawave-quickstart/docker/datawave-bootstrap.sh b/contrib/datawave-quickstart/docker/datawave-bootstrap.sh
index 73a9f7710b5..5cb868b5aff 100755
--- a/contrib/datawave-quickstart/docker/datawave-bootstrap.sh
+++ b/contrib/datawave-quickstart/docker/datawave-bootstrap.sh
@@ -2,9 +2,22 @@
source ~/.bashrc
+# If DW_CONTAINER_HOST is defined update Accumulo and Hadoop bind hosts
+if [ ! -z "${DW_CONTAINER_HOST}" ] && [ "${DW_CONTAINER_HOST}" != "localhost" ] ; then
+ # Update Accumulo bind hosts
+ sed -i'' -e "s/localhost/${DW_CONTAINER_HOST}/g" ${ACCUMULO_HOME}/conf/cluster.yaml
+
+ # Create hadoop client configs
+ mkdir -p ${HADOOP_HOME}/client/conf
+ cp -r ${HADOOP_CONF_DIR}/*-site.xml ${HADOOP_HOME}/client/conf
+ sed -i'' -e "s/${DW_BIND_HOST}/${DW_CONTAINER_HOST}/g" ${HADOOP_HOME}/client/conf/*-site.xml
+fi
+
START_AS_DAEMON=true
+START_ACCUMULO=false
START_WEB=false
+START_TEST=false
START_INGEST=false
for arg in "$@"
@@ -13,6 +26,9 @@ do
--bash)
START_AS_DAEMON=false
;;
+ --accumulo)
+ START_ACCUMULO=true
+ ;;
--web)
START_WEB=true
;;
@@ -34,6 +50,8 @@ done
[ "${START_INGEST}" == true ] && datawaveIngestStart
+[ "${START_ACCUMULO}" == true ] && accumuloStart
+
[ "${START_WEB}" == true ] && datawaveWebStart
[ "${START_WEB_DEBUG}" == true ] && datawaveWebStart --debug
diff --git a/contrib/datawave-quickstart/docker/docker-build.sh b/contrib/datawave-quickstart/docker/docker-build.sh
index 87ed6357db1..21066907340 100755
--- a/contrib/datawave-quickstart/docker/docker-build.sh
+++ b/contrib/datawave-quickstart/docker/docker-build.sh
@@ -187,10 +187,11 @@ function buildDockerImage() {
info "Building Docker image: ${IMAGE_NAME}"
- docker build ${docker_opts} -f ${THIS_DIR}/Dockerfile -t ${IMAGE_NAME} \
+ docker build -m 8g ${docker_opts} -f ${THIS_DIR}/Dockerfile -t ${IMAGE_NAME} \
--build-arg DATAWAVE_COMMIT_ID=$( git rev-parse --verify HEAD ) \
--build-arg DATAWAVE_BRANCH_NAME=$( git rev-parse --abbrev-ref HEAD ) \
--build-arg DATAWAVE_JAVA_HOME="${DW_JAVA_HOME_OVERRIDE}" \
+ --build-arg DATAWAVE_BUILD_PROFILE="${DW_DATAWAVE_BUILD_PROFILE}" \
${DATAWAVE_SOURCE_DIR} || fatal "Docker image creation for DataWave Quickstart failed"
}
diff --git a/contrib/datawave-quickstart/docker/docker-run.sh b/contrib/datawave-quickstart/docker/docker-run.sh
index 7bfbf3c2a9e..2fef63f0f9b 100755
--- a/contrib/datawave-quickstart/docker/docker-run.sh
+++ b/contrib/datawave-quickstart/docker/docker-run.sh
@@ -58,7 +58,7 @@ VOLUMES="-v ${DATA}:${V_DATA} -v ${M2REPO}:${V_M2REPO} -v ${HLOGS}:${V_HLOGS} -v
# Set port mapping
-PORTS="-p 8443:8443 -p 50070:50070 -p 9995:9995"
+PORTS="-p 8443:8443 -p 9870:9870 -p 9995:9995"
# Interpret any remaining args as the CMD to pass in
diff --git a/contrib/datawave-quickstart/docker/pom.xml b/contrib/datawave-quickstart/docker/pom.xml
new file mode 100644
index 00000000000..de19a23c2d4
--- /dev/null
+++ b/contrib/datawave-quickstart/docker/pom.xml
@@ -0,0 +1,503 @@
+
+
+ 4.0.0
+
+ gov.nsa.datawave
+ datawave-parent
+ 7.13.0-SNAPSHOT
+ ../../../pom.xml
+
+ quickstart
+ pom
+ ${project.artifactId}
+
+ accumulo-${version.accumulo.tar.gz}-bin.tar.gz
+ hadoop-${version.hadoop.tar.gz}.tar.gz
+ apache-maven-${version.maven.tar.gz}-bin.tar.gz
+ wildfly-${version.wildfly.tar.gz}.Final.tar.gz
+ apache-zookeeper-${version.zookeeper.tar.gz}-bin.tar.gz
+ false
+ https://dlcdn.apache.org/accumulo/${version.accumulo.tar.gz}/${dist.accumulo}
+ https://dlcdn.apache.org/hadoop/common/hadoop-${version.hadoop.tar.gz}/${dist.hadoop}
+ https://dlcdn.apache.org/maven/maven-3/${version.maven.tar.gz}/binaries/${dist.maven}
+ https://download.jboss.org/wildfly/${version.wildfly.tar.gz}.Final/${dist.wildfly}
+ https://dlcdn.apache.org/zookeeper/zookeeper-${version.zookeeper.tar.gz}/${dist.zookeeper}
+
+ 2.1.3
+ 3.3.6
+ 3.8.8
+ 17.0.1
+ 3.7.2
+
+
+
+ gov.nsa.datawave
+ assemble-datawave
+ ${project.version}
+ pom
+
+
+ gov.nsa.datawave
+ assemble-datawave
+ ${project.version}
+ dist
+ tar.gz
+
+
+ gov.nsa.datawave.webservices
+ datawave-ws-deploy-application
+ ${project.version}
+ pom
+
+
+ gov.nsa.datawave.webservices
+ datawave-ws-deploy-application
+ ${project.version}
+ ${build.env}
+ tar.gz
+
+
+
+
+
+ maven-clean-plugin
+ 3.2.0
+
+
+
+ ${project.basedir}/../../../
+
+ .maven-dockerignore
+
+
+
+ ../bin/services/accumulo
+
+ **/apache-zookeeper-*-bin.tar.gz
+ **/accumulo-*-bin.tar.gz
+ **/zookeeper-*.tar.gz
+ **/accumulo-*.tar.gz
+
+
+
+ ../bin/services/datawave
+
+ **/datawave-*-dist.tar.gz
+ **/datawave-ws-deploy-application-*.tar.gz
+ **/wildfly-*.tar.gz
+
+
+
+ ../bin/services/hadoop
+
+ **/hadoop-*.tar.gz
+
+
+
+ ../bin/services/maven
+
+ **/apache-maven-*-bin.tar.gz
+ **/maven-*.tar.gz
+
+
+
+
+
+
+ maven-dependency-plugin
+
+
+ copy-datawave-warehouse
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave:assemble-datawave:${project.version}:tar.gz:dist
+ ${project.basedir}/../bin/services/datawave
+
+
+
+ copy-datawave-webservice
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave.webservices:datawave-ws-deploy-application:${project.version}:tar.gz:${build.env}
+ ${project.basedir}/../bin/services/datawave
+
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ rename-datawave-warehouse
+
+ run
+
+ process-resources
+
+
+
+
+
+
+
+
+
+
+
+
+
+ docker
+
+
+ quickstart-docker
+
+
+
+
+
+ io.fabric8
+ docker-maven-plugin
+ 0.40.1
+
+ true
+
+
+ ${docker.image.prefix}datawave/quickstart-${build.env}
+
+
+ 8589934592
+
+ none
+ ${project.basedir}/../../../
+ ${project.basedir}/Dockerfile
+
+ latest
+ ${project.version}
+
+
+ ${git.commit.id}
+ ${git.branch}
+ ${build.env}
+ ${skipIngest}
+ true
+ ${url.accumulo}
+ ${url.hadoop}
+ ${url.maven}
+ ${url.wildfly}
+ ${url.zookeeper}
+
+
+
+
+
+
+
+ build
+
+ build
+
+ install
+
+
+ push
+
+ push
+
+ deploy
+
+
+
+
+ maven-resources-plugin
+
+
+ copy-docker-ignore
+
+ copy-resources
+
+ process-resources
+
+ ${project.basedir}/../../../
+
+
+ ${project.basedir}
+
+ .maven-dockerignore
+
+
+
+
+
+
+
+
+ pl.project13.maven
+ git-commit-id-plugin
+
+ false
+
+
+
+
+
+
+ quickstart-default
+
+
+ !quickstart-maven
+
+
+
+
+
+
+ com.googlecode.maven-download-plugin
+ download-maven-plugin
+ 1.6.8
+
+
+ download-zookeeper
+
+ wget
+
+
+ ${url.zookeeper}
+ ${project.build.outputDirectory}
+
+
+
+ download-accumulo
+
+ wget
+
+
+ ${url.accumulo}
+ ${project.build.outputDirectory}
+
+
+
+ download-hadoop
+
+ wget
+
+
+ ${url.hadoop}
+ ${project.build.outputDirectory}
+
+
+
+ download-maven
+
+ wget
+
+
+ ${url.maven}
+ ${project.build.outputDirectory}
+
+
+
+ download-wildfly
+
+ wget
+
+
+ ${url.wildfly}
+ ${project.build.outputDirectory}
+
+
+
+
+
+ maven-resources-plugin
+
+
+ copy-accumulo-tarballs
+
+ copy-resources
+
+ process-resources
+
+ ${project.basedir}/../bin/services/accumulo
+
+
+ ${project.build.outputDirectory}
+
+ ${dist.zookeeper}
+ ${dist.accumulo}
+
+
+
+
+
+
+ copy-hadoop-tarballs
+
+ copy-resources
+
+ process-resources
+
+ ${project.basedir}/../bin/services/hadoop
+
+
+ ${project.build.outputDirectory}
+
+ ${dist.hadoop}
+
+
+
+
+
+
+ copy-maven-tarballs
+
+ copy-resources
+
+ process-resources
+
+ ${project.basedir}/../bin/services/maven
+
+
+ ${project.build.outputDirectory}
+
+ ${dist.maven}
+
+
+
+
+
+
+ copy-wildfly-tarball
+
+ copy-resources
+
+ process-resources
+
+ ${project.basedir}/../bin/services/datawave
+
+
+ ${project.build.outputDirectory}
+
+ ${dist.wildfly}
+
+
+
+
+
+
+
+
+
+
+
+ quickstart-maven
+
+
+ quickstart-maven
+
+
+
+
+ gov.nsa.datawave.quickstart
+ accumulo
+ ${version.accumulo.tar.gz}
+ tar.gz
+
+
+ gov.nsa.datawave.quickstart
+ hadoop
+ ${version.hadoop.tar.gz}
+ tar.gz
+
+
+ gov.nsa.datawave.quickstart
+ maven
+ ${version.maven.tar.gz}
+ tar.gz
+
+
+ gov.nsa.datawave.quickstart
+ wildfly
+ ${version.wildfly.tar.gz}
+ tar.gz
+
+
+ gov.nsa.datawave.quickstart
+ zookeeper
+ ${version.zookeeper.tar.gz}
+ tar.gz
+
+
+
+
+
+ maven-dependency-plugin
+
+
+ copy-accumulo-tarball
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave.quickstart:accumulo:${version.accumulo.tar.gz}:tar.gz
+ ${project.basedir}/../bin/services/accumulo
+
+
+
+ copy-hadoop-tarball
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave.quickstart:hadoop:${version.hadoop.tar.gz}:tar.gz
+ ${project.basedir}/../bin/services/hadoop
+
+
+
+ copy-maven-tarball
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave.quickstart:maven:${version.maven.tar.gz}:tar.gz
+ ${project.basedir}/../bin/services/maven
+
+
+
+ copy-wildfly-tarball
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave.quickstart:wildfly:${version.wildfly.tar.gz}:tar.gz
+ ${project.basedir}/../bin/services/datawave
+
+
+
+ copy-zookeeper-tarball
+
+ copy
+
+ process-resources
+
+ gov.nsa.datawave.quickstart:zookeeper:${version.zookeeper.tar.gz}:tar.gz
+ ${project.basedir}/../bin/services/accumulo
+
+
+
+
+
+
+
+
+
diff --git a/contrib/datawave-utils b/contrib/datawave-utils
new file mode 160000
index 00000000000..4348fc36a35
--- /dev/null
+++ b/contrib/datawave-utils
@@ -0,0 +1 @@
+Subproject commit 4348fc36a3519ca9e5d1b96ac47c3f0b64abe34b
diff --git a/core/base-rest-responses b/core/base-rest-responses
index f09536681ee..cb0f550615e 160000
--- a/core/base-rest-responses
+++ b/core/base-rest-responses
@@ -1 +1 @@
-Subproject commit f09536681eeefe27b0f3e5840966656b04a4e476
+Subproject commit cb0f550615ecd1d9fe1db7b17bb671db861301ff
diff --git a/core/cached-results/pom.xml b/core/cached-results/pom.xml
new file mode 100644
index 00000000000..9c5dbd86f17
--- /dev/null
+++ b/core/cached-results/pom.xml
@@ -0,0 +1,48 @@
+
+
+ 4.0.0
+
+ gov.nsa.datawave.core
+ datawave-core-parent
+ 7.13.0-SNAPSHOT
+
+ datawave-core-cached-results
+ ${project.artifactId}
+
+
+
+
+ gov.nsa.datawave.microservice
+ base-rest-responses
+
+
+ gov.nsa.datawave.microservice
+ query-api
+
+
+ jakarta.validation
+ jakarta.validation-api
+
+
+
+
+ gov.nsa.datawave.microservice
+ type-utils
+
+
+ gov.nsa.datawave.webservices
+ datawave-ws-client
+ ${project.version}
+
+
+ org.slf4j
+ *
+
+
+ log4j
+ log4j
+
+
+
+
+
diff --git a/web-services/query/src/main/java/datawave/webservice/query/cachedresults/CacheableQueryRowImpl.java b/core/cached-results/src/main/java/datawave/core/query/cachedresults/CacheableQueryRowImpl.java
similarity index 99%
rename from web-services/query/src/main/java/datawave/webservice/query/cachedresults/CacheableQueryRowImpl.java
rename to core/cached-results/src/main/java/datawave/core/query/cachedresults/CacheableQueryRowImpl.java
index 7fa25b368f3..ab4673fb274 100644
--- a/web-services/query/src/main/java/datawave/webservice/query/cachedresults/CacheableQueryRowImpl.java
+++ b/core/cached-results/src/main/java/datawave/core/query/cachedresults/CacheableQueryRowImpl.java
@@ -1,4 +1,4 @@
-package datawave.webservice.query.cachedresults;
+package datawave.core.query.cachedresults;
import java.util.ArrayList;
import java.util.Collection;
@@ -20,6 +20,7 @@
import datawave.data.type.Type;
import datawave.marking.MarkingFunctions;
import datawave.marking.MarkingFunctionsFactory;
+import datawave.webservice.query.cachedresults.CacheableQueryRow;
import datawave.webservice.query.data.ObjectSizeOf;
import datawave.webservice.query.util.TypedValue;
@@ -44,8 +45,6 @@ public class CacheableQueryRowImpl extends CacheableQueryRow implements ObjectSi
private String queryOrigin = null;
private String resultOrigin = null;
- private static final MarkingFunctions markingFunctions = MarkingFunctionsFactory.createMarkingFunctions();
-
public void addColumn(String columnName, String columnValueString, Map markings, String columnVisibility, Long timestamp) {
addColumn(columnName, new TypedValue(columnValueString), markings, columnVisibility, timestamp);
}
diff --git a/web-services/query/src/main/java/datawave/webservice/query/cachedresults/CacheableQueryRowReader.java b/core/cached-results/src/main/java/datawave/core/query/cachedresults/CacheableQueryRowReader.java
similarity index 95%
rename from web-services/query/src/main/java/datawave/webservice/query/cachedresults/CacheableQueryRowReader.java
rename to core/cached-results/src/main/java/datawave/core/query/cachedresults/CacheableQueryRowReader.java
index 7b13334b102..ddcbf921264 100644
--- a/web-services/query/src/main/java/datawave/webservice/query/cachedresults/CacheableQueryRowReader.java
+++ b/core/cached-results/src/main/java/datawave/core/query/cachedresults/CacheableQueryRowReader.java
@@ -1,5 +1,6 @@
-package datawave.webservice.query.cachedresults;
+package datawave.core.query.cachedresults;
+import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
@@ -8,20 +9,21 @@
import java.util.Set;
import java.util.TreeSet;
-import javax.sql.rowset.CachedRowSet;
-
import org.apache.log4j.Logger;
import datawave.marking.MarkingFunctions;
+import datawave.webservice.query.cachedresults.CacheableQueryRow;
import datawave.webservice.query.result.event.ResponseObjectFactory;
public class CacheableQueryRowReader {
private static Logger log = Logger.getLogger(CacheableQueryRowReader.class);
- public static CacheableQueryRow createRow(CachedRowSet cachedRowSet, Set fixedFieldsInEvent, ResponseObjectFactory responseObjectFactory) {
+ public static CacheableQueryRow createRow(ResultSet cachedRowSet, Set fixedFieldsInEvent, ResponseObjectFactory responseObjectFactory,
+ MarkingFunctions markingFunctions) {
CacheableQueryRow cqfc = responseObjectFactory.getCacheableQueryRow();
+ cqfc.setMarkingFunctions(markingFunctions);
ResultSetMetaData metadata;
try {
diff --git a/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsParameters.java b/core/cached-results/src/main/java/datawave/core/query/cachedresults/CachedResultsQueryParameters.java
similarity index 96%
rename from web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsParameters.java
rename to core/cached-results/src/main/java/datawave/core/query/cachedresults/CachedResultsQueryParameters.java
index 3c5cc6cef89..59d12f3f225 100644
--- a/web-services/cached-results/src/main/java/datawave/webservice/results/cached/CachedResultsParameters.java
+++ b/core/cached-results/src/main/java/datawave/core/query/cachedresults/CachedResultsQueryParameters.java
@@ -1,4 +1,4 @@
-package datawave.webservice.results.cached;
+package datawave.core.query.cachedresults;
import java.util.Arrays;
import java.util.List;
@@ -7,11 +7,10 @@
import com.google.common.base.Preconditions;
+import datawave.microservice.query.QueryParameters;
import datawave.validation.ParameterValidator;
-import datawave.webservice.query.QueryParameters;
-
-public class CachedResultsParameters implements ParameterValidator {
+public class CachedResultsQueryParameters implements ParameterValidator {
public static final String QUERY_ID = "queryId";
public static final String ALIAS = "alias";
public static final String VIEW = "view";
diff --git a/core/common-util/pom.xml b/core/common-util/pom.xml
new file mode 100644
index 00000000000..f7ee5e356f3
--- /dev/null
+++ b/core/common-util/pom.xml
@@ -0,0 +1,121 @@
+
+
+ 4.0.0
+
+ gov.nsa.datawave.core
+ datawave-core-parent
+ 7.13.0-SNAPSHOT
+
+ datawave-core-common-util
+ ${project.artifactId}
+
+
+
+
+
+
+ gov.nsa.datawave.core
+ datawave-core-connection-pool
+ ${project.version}
+
+
+ gov.nsa.datawave.microservice
+ accumulo-utils
+
+
+ gov.nsa.datawave.microservice
+ authorization-api
+
+
+ org.apache.accumulo
+ accumulo-core
+ provided
+
+
+ javax.servlet
+ servlet-api
+
+
+
+
+
+
+
+ true
+ src/main/resources
+
+ source-templates/**
+
+
+
+ test-classes
+ true
+ src/test/resources
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ META-INF/beans.xml
+ META-INF/jboss-ejb3.xml
+
+
+
+
+ jboss
+
+ jar
+
+
+ jboss
+
+
+
+
+
+
+ maven-resources-plugin
+
+
+ copy-templated-sources
+
+ copy-resources
+
+ validate
+
+ ${project.build.directory}/generated-sources/templated-sources
+
+
+ src/main/resources/source-templates
+ true
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 3.3.0
+
+
+ add-source
+
+ add-source
+
+ generate-sources
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web-services/common-util/src/main/java/datawave/webservice/common/logging/ThreadConfigurableLogger.java b/core/common-util/src/main/java/datawave/core/common/logging/ThreadConfigurableLogger.java
similarity index 99%
rename from web-services/common-util/src/main/java/datawave/webservice/common/logging/ThreadConfigurableLogger.java
rename to core/common-util/src/main/java/datawave/core/common/logging/ThreadConfigurableLogger.java
index 0e65d99c07f..64a3fbe64e1 100644
--- a/web-services/common-util/src/main/java/datawave/webservice/common/logging/ThreadConfigurableLogger.java
+++ b/core/common-util/src/main/java/datawave/core/common/logging/ThreadConfigurableLogger.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.logging;
+package datawave.core.common.logging;
import java.util.HashMap;
import java.util.Map;
diff --git a/web-services/common-util/src/main/java/datawave/webservice/util/EnvProvider.java b/core/common-util/src/main/java/datawave/core/common/util/EnvProvider.java
similarity index 91%
rename from web-services/common-util/src/main/java/datawave/webservice/util/EnvProvider.java
rename to core/common-util/src/main/java/datawave/core/common/util/EnvProvider.java
index 99d2e40b6b8..2b08e99c545 100644
--- a/web-services/common-util/src/main/java/datawave/webservice/util/EnvProvider.java
+++ b/core/common-util/src/main/java/datawave/core/common/util/EnvProvider.java
@@ -1,9 +1,9 @@
-package datawave.webservice.util;
+package datawave.core.common.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
-import datawave.webservice.common.logging.ThreadConfigurableLogger;
+import datawave.core.common.logging.ThreadConfigurableLogger;
public class EnvProvider {
diff --git a/core/common-util/src/main/java/datawave/core/query/cache/ResultsPage.java b/core/common-util/src/main/java/datawave/core/query/cache/ResultsPage.java
new file mode 100644
index 00000000000..3107497359f
--- /dev/null
+++ b/core/common-util/src/main/java/datawave/core/query/cache/ResultsPage.java
@@ -0,0 +1,45 @@
+package datawave.core.query.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public class ResultsPage {
+ public enum Status {
+ NONE, PARTIAL, COMPLETE
+ }
+
+ private List results;
+ private Status status;
+
+ public ResultsPage() {
+ this(new ArrayList<>());
+ }
+
+ public ResultsPage(List results) {
+ this(results, Status.COMPLETE);
+ }
+
+ public ResultsPage(List results, Status status) {
+ this.results = results;
+ this.status = status;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public List getResults() {
+ return results;
+ }
+
+ public void setResults(List results) {
+ this.results = results;
+ }
+}
diff --git a/web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java b/core/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java
similarity index 97%
rename from web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java
rename to core/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java
index 8e798e79be6..1c43eb931da 100644
--- a/web-services/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java
+++ b/core/common-util/src/main/java/datawave/security/authorization/DatawavePrincipal.java
@@ -17,7 +17,7 @@
import javax.xml.bind.annotation.XmlType;
import datawave.security.authorization.DatawaveUser.UserType;
-import datawave.security.util.DnUtils;
+import datawave.security.util.ProxiedEntityUtils;
/**
* A {@link Principal} that represents a set of proxied {@link DatawaveUser}s. For example, this proxied user could represent a GUI server acting on behalf of a
@@ -108,14 +108,17 @@ static protected List orderProxiedUsers(List datawav
return users;
}
+ @Override
public Collection getProxiedUsers() {
return Collections.unmodifiableCollection(this.proxiedUsers);
}
+ @Override
public DatawaveUser getPrimaryUser() {
return primaryUser;
}
+ @Override
public Collection extends Collection> getAuthorizations() {
// @formatter:off
return Collections.unmodifiableCollection(
@@ -125,6 +128,7 @@ public Collection extends Collection> getAuthorizations() {
// @formatter:on
}
+ @Override
public String[] getDNs() {
// @formatter:off
return DatawavePrincipal.orderProxiedUsers(this.proxiedUsers).stream()
@@ -144,14 +148,16 @@ public String getName() {
return this.username;
}
+ @Override
public String getShortName() {
- return DnUtils.getShortName(getPrimaryUser().getName());
+ return ProxiedEntityUtils.getShortName(getPrimaryUser().getName());
}
public SubjectIssuerDNPair getUserDN() {
return getPrimaryUser().getDn();
}
+ @Override
public List getProxyServers() {
// @formatter:off
diff --git a/core/common-util/src/main/resources/META-INF/beans.xml b/core/common-util/src/main/resources/META-INF/beans.xml
new file mode 100644
index 00000000000..4ca201f8ff2
--- /dev/null
+++ b/core/common-util/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/core/common-util/src/main/resources/META-INF/jboss-ejb3.xml b/core/common-util/src/main/resources/META-INF/jboss-ejb3.xml
new file mode 100644
index 00000000000..8cf49db8c87
--- /dev/null
+++ b/core/common-util/src/main/resources/META-INF/jboss-ejb3.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ *
+ datawave
+
+
+
+
\ No newline at end of file
diff --git a/web-services/common-util/src/main/resources/source-templates/datawave/security/authorization/package-info.java b/core/common-util/src/main/resources/source-templates/datawave/security/authorization/package-info.java
similarity index 99%
rename from web-services/common-util/src/main/resources/source-templates/datawave/security/authorization/package-info.java
rename to core/common-util/src/main/resources/source-templates/datawave/security/authorization/package-info.java
index 7eb19db2923..6cc9445d7c2 100644
--- a/web-services/common-util/src/main/resources/source-templates/datawave/security/authorization/package-info.java
+++ b/core/common-util/src/main/resources/source-templates/datawave/security/authorization/package-info.java
@@ -4,4 +4,3 @@
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
-
diff --git a/web-services/common-util/src/test/java/datawave/webservice/util/EnvProviderTest.java b/core/common-util/src/test/java/datawave/core/common/util/EnvProviderTest.java
similarity index 95%
rename from web-services/common-util/src/test/java/datawave/webservice/util/EnvProviderTest.java
rename to core/common-util/src/test/java/datawave/core/common/util/EnvProviderTest.java
index bab9edeeda9..b792f0721e2 100644
--- a/web-services/common-util/src/test/java/datawave/webservice/util/EnvProviderTest.java
+++ b/core/common-util/src/test/java/datawave/core/common/util/EnvProviderTest.java
@@ -1,4 +1,4 @@
-package datawave.webservice.util;
+package datawave.core.common.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
diff --git a/core/common/pom.xml b/core/common/pom.xml
new file mode 100644
index 00000000000..77522fd9a10
--- /dev/null
+++ b/core/common/pom.xml
@@ -0,0 +1,79 @@
+
+
+ 4.0.0
+
+ gov.nsa.datawave.core
+ datawave-core-parent
+ 7.13.0-SNAPSHOT
+
+ datawave-core-common
+ ${project.artifactId}
+
+
+
+
+ org.apache.accumulo
+ accumulo-core
+ ${version.accumulo}
+
+
+ org.slf4j
+ *
+
+
+ commons-logging
+ commons-logging
+
+
+ junit
+ junit
+
+
+ log4j
+ log4j
+
+
+ javax.servlet
+ servlet-api
+
+
+
+
+ org.springframework
+ spring-core
+ ${version.spring}
+
+
+
+
+
+ gov.nsa.datawave.webservices
+ datawave-ws-client
+ ${project.version}
+
+
+ org.apache.accumulo
+ accumulo-core
+
+
+ org.springframework
+ spring-core
+ provided
+
+
+ junit
+ junit
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ test
+
+
+
diff --git a/web-services/common/src/main/java/datawave/webservice/common/audit/PrivateAuditConstants.java b/core/common/src/main/java/datawave/core/common/audit/PrivateAuditConstants.java
similarity index 80%
rename from web-services/common/src/main/java/datawave/webservice/common/audit/PrivateAuditConstants.java
rename to core/common/src/main/java/datawave/core/common/audit/PrivateAuditConstants.java
index c11f969b166..1cffc3e0177 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/audit/PrivateAuditConstants.java
+++ b/core/common/src/main/java/datawave/core/common/audit/PrivateAuditConstants.java
@@ -1,6 +1,7 @@
-package datawave.webservice.common.audit;
+package datawave.core.common.audit;
-import javax.ws.rs.core.MultivaluedMap;
+import java.util.List;
+import java.util.Map;
/**
* Constants marking private parameters that are computed internally and then added at runtime to the incoming query parameters for the purposes of passing them
@@ -15,7 +16,7 @@ public class PrivateAuditConstants {
public static final String USER_DN = PREFIX + "userDn";
public static final String SELECTORS = PREFIX + "selectors";
- public static void stripPrivateParameters(MultivaluedMap queryParameters) {
+ public static void stripPrivateParameters(Map> queryParameters) {
queryParameters.entrySet().removeIf(entry -> entry.getKey().startsWith(PREFIX));
}
}
diff --git a/core/common/src/main/java/datawave/core/common/edgedictionary/EdgeDictionaryProvider.java b/core/common/src/main/java/datawave/core/common/edgedictionary/EdgeDictionaryProvider.java
new file mode 100644
index 00000000000..b473fbb8051
--- /dev/null
+++ b/core/common/src/main/java/datawave/core/common/edgedictionary/EdgeDictionaryProvider.java
@@ -0,0 +1,9 @@
+package datawave.core.common.edgedictionary;
+
+import datawave.microservice.query.Query;
+import datawave.webservice.dictionary.edge.EdgeDictionaryBase;
+import datawave.webservice.dictionary.edge.MetadataBase;
+
+public interface EdgeDictionaryProvider {
+ EdgeDictionaryBase,? extends MetadataBase>> getEdgeDictionary(Query settings, String metadataTableName);
+}
diff --git a/web-services/common/src/main/java/datawave/webservice/common/extjs/ExtJsResponse.java b/core/common/src/main/java/datawave/core/common/extjs/ExtJsResponse.java
similarity index 95%
rename from web-services/common/src/main/java/datawave/webservice/common/extjs/ExtJsResponse.java
rename to core/common/src/main/java/datawave/core/common/extjs/ExtJsResponse.java
index e9760dcc039..d92feee8cbb 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/extjs/ExtJsResponse.java
+++ b/core/common/src/main/java/datawave/core/common/extjs/ExtJsResponse.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.extjs;
+package datawave.core.common.extjs;
import java.util.List;
diff --git a/core/connection-pool/pom.xml b/core/connection-pool/pom.xml
new file mode 100644
index 00000000000..9c3ed01fa4b
--- /dev/null
+++ b/core/connection-pool/pom.xml
@@ -0,0 +1,161 @@
+
+
+ 4.0.0
+
+ gov.nsa.datawave.core
+ datawave-core-parent
+ 7.13.0-SNAPSHOT
+
+ datawave-core-connection-pool
+ ${project.artifactId}
+
+ 2.1.8
+
+
+
+
+ dnsjava
+ dnsjava
+ ${version.dnsjava}
+
+
+
+
+
+ com.fasterxml.jackson.module
+ jackson-module-jaxb-annotations
+
+
+ commons-configuration
+ commons-configuration
+
+
+ commons-lang
+ commons-lang
+
+
+ dnsjava
+ dnsjava
+
+
+ gov.nsa.datawave
+ datawave-in-memory-accumulo
+
+
+ gov.nsa.datawave.microservice
+ accumulo-api
+
+
+ junit
+ junit
+
+
+ org.apache.curator
+ curator-recipes
+
+
+ org.apache.curator
+ curator-test
+
+
+ org.easymock
+ easymock
+
+
+ com.fasterxml.woodstox
+ woodstox-core
+ provided
+
+
+ org.apache.commons
+ commons-configuration2
+ provided
+
+
+ org.apache.hadoop.thirdparty
+ hadoop-shaded-guava
+ provided
+
+
+ org.powermock
+ powermock-reflect
+ test
+
+
+
+ ${project.artifactId}
+
+
+ true
+ src/main/resources
+
+ source-templates/**
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+ META-INF/beans.xml
+ META-INF/jboss-ejb3.xml
+
+
+
+
+ jboss
+
+ jar
+
+
+ jboss
+
+
+
+
+
+
+ maven-resources-plugin
+
+
+ copy-templated-sources
+
+ copy-resources
+
+ validate
+
+ ${project.build.directory}/generated-sources/templated-sources
+
+
+ src/main/resources/source-templates
+ true
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 3.3.0
+
+
+ add-source
+
+ add-source
+
+ generate-sources
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCache.java b/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCache.java
new file mode 100644
index 00000000000..674dfe3183c
--- /dev/null
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCache.java
@@ -0,0 +1,28 @@
+package datawave.core.common.cache;
+
+import java.util.List;
+
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+
+import datawave.accumulo.inmemory.InMemoryInstance;
+import datawave.core.common.connection.AccumuloConnectionFactory;
+import datawave.core.common.result.TableCacheDescription;
+
+/**
+ * Object that caches data from Accumulo tables.
+ */
+public interface AccumuloTableCache extends AutoCloseable {
+
+ String MOCK_USERNAME = "";
+ PasswordToken MOCK_PASSWORD = new PasswordToken(new byte[0]);
+
+ void setConnectionFactory(AccumuloConnectionFactory connectionFactory);
+
+ InMemoryInstance getInstance();
+
+ void submitReloadTasks();
+
+ public void reloadTableCache(String tableName);
+
+ public List getTableCaches();
+}
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/AccumuloTableCache.java b/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCacheImpl.java
similarity index 50%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/AccumuloTableCache.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCacheImpl.java
index 9ffe3cf48b8..582e72c4e17 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/AccumuloTableCache.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCacheImpl.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import java.util.ArrayList;
import java.util.Date;
@@ -6,125 +6,78 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.annotation.Resource;
-import javax.annotation.security.DeclareRoles;
-import javax.annotation.security.RolesAllowed;
-import javax.annotation.security.RunAs;
-import javax.ejb.EJBException;
-import javax.ejb.LocalBean;
-import javax.ejb.Lock;
-import javax.ejb.LockType;
-import javax.ejb.Schedule;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.enterprise.concurrent.ManagedExecutorService;
-import javax.inject.Inject;
-import javax.interceptor.Interceptors;
-import javax.jms.Destination;
-import javax.jms.JMSContext;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.shared.SharedCountListener;
import org.apache.curator.framework.recipes.shared.SharedCountReader;
import org.apache.curator.framework.state.ConnectionState;
-import org.apache.deltaspike.core.api.config.ConfigProperty;
-import org.apache.deltaspike.core.api.exclude.Exclude;
import org.apache.log4j.Logger;
-import org.jboss.resteasy.annotations.GZIP;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
import datawave.accumulo.inmemory.InMemoryInstance;
-import datawave.annotation.Required;
-import datawave.configuration.DatawaveEmbeddedProjectStageHolder;
-import datawave.interceptor.RequiredInterceptor;
-import datawave.webservice.common.connection.AccumuloConnectionFactory;
-import datawave.webservice.common.exception.DatawaveWebApplicationException;
-import datawave.webservice.common.result.AccumuloTableCacheStatus;
-import datawave.webservice.query.exception.QueryException;
-import datawave.webservice.result.VoidResponse;
+import datawave.core.common.connection.AccumuloConnectionFactory;
+import datawave.core.common.result.TableCacheDescription;
/**
* Object that caches data from Accumulo tables.
*/
-@Path("/Common/AccumuloTableCache")
-@RunAs("InternalUser")
-@RolesAllowed({"AuthorizedUser", "AuthorizedQueryServer", "AuthorizedServer", "InternalUser", "Administrator", "JBossAdministrator"})
-@DeclareRoles({"AuthorizedUser", "AuthorizedQueryServer", "AuthorizedServer", "InternalUser", "Administrator", "JBossAdministrator"})
-@LocalBean
-@Startup
-// tells the container to initialize on startup
-@Singleton
-// this is a singleton bean in the container
-@Lock(LockType.READ)
-@Exclude(ifProjectStage = DatawaveEmbeddedProjectStageHolder.DatawaveEmbedded.class)
-public class AccumuloTableCache {
-
+public class AccumuloTableCacheImpl implements AccumuloTableCache {
private final Logger log = Logger.getLogger(this.getClass());
- @Inject
- private JMSContext jmsContext;
-
- @Resource(mappedName = "java:/topic/AccumuloTableCache")
- private Destination cacheTopic;
-
- @Resource
- private ManagedExecutorService executorService;
-
- @Inject
- private AccumuloTableCacheConfiguration accumuloTableCacheConfiguration;
-
- @Inject
- @ConfigProperty(name = "dw.cacheCoordinator.evictionReaperIntervalSeconds", defaultValue = "30")
- private int evictionReaperIntervalInSeconds;
- @Inject
- @ConfigProperty(name = "dw.cacheCoordinator.numLocks", defaultValue = "300")
- private int numLocks;
- @Inject
- @ConfigProperty(name = "dw.cacheCoordinator.maxRetries", defaultValue = "10")
- private int maxRetries;
-
- public static final String MOCK_USERNAME = "";
- public static final PasswordToken MOCK_PASSWORD = new PasswordToken(new byte[0]);
-
+ private final ExecutorService executorService;
+ private final AccumuloTableCacheProperties accumuloTableCacheProperties;
private InMemoryInstance instance;
private Map details;
private List cacheCoordinators;
private boolean connectionFactoryProvided = false;
- public AccumuloTableCache() {
- log.debug("Called AccumuloTableCacheBean and accumuloTableCacheConfiguration = " + accumuloTableCacheConfiguration);
+ public AccumuloTableCacheImpl(ExecutorService executorService, AccumuloTableCacheProperties accumuloTableCacheProperties) {
+ log.debug("Called AccumuloTableCacheImpl with accumuloTableCacheConfiguration = " + accumuloTableCacheProperties);
+ this.executorService = executorService;
+ this.accumuloTableCacheProperties = accumuloTableCacheProperties;
+ setup();
+ }
+
+ public AccumuloTableCacheImpl(AccumuloTableCacheProperties accumuloTableCacheProperties) {
+ this(getThreadPoolExecutor(accumuloTableCacheProperties), accumuloTableCacheProperties);
}
- @PostConstruct
- private void setup() {
- log.debug("accumuloTableCacheConfiguration was setup as: " + accumuloTableCacheConfiguration);
+ private static ExecutorService getThreadPoolExecutor(AccumuloTableCacheProperties accumuloTableCacheProperties) {
+ return new ThreadPoolExecutor(Math.max(accumuloTableCacheProperties.getTableNames().size() / 2, 1),
+ Math.max(accumuloTableCacheProperties.getTableNames().size(), 1), 5, TimeUnit.MINUTES, new LinkedBlockingDeque<>(),
+ new ThreadFactoryBuilder().setNameFormat("TableCacheReloader %d").build());
+ }
+ public void setup() {
+ log.debug("accumuloTableCacheConfiguration was setup as: " + accumuloTableCacheProperties);
instance = new InMemoryInstance();
details = new HashMap<>();
cacheCoordinators = new ArrayList<>();
- String zookeepers = accumuloTableCacheConfiguration.getZookeepers();
+ String zookeepers = accumuloTableCacheProperties.getZookeepers();
+
+ for (String tableName : accumuloTableCacheProperties.getTableNames()) {
+ BaseTableCache detail = new BaseTableCache();
+ detail.setTableName(tableName);
+ detail.setConnectionPoolName(accumuloTableCacheProperties.getPoolName());
+ detail.setReloadInterval(accumuloTableCacheProperties.getReloadInterval());
- for (Entry entry : accumuloTableCacheConfiguration.getCaches().entrySet()) {
- final String tableName = entry.getKey();
- TableCache detail = entry.getValue();
detail.setInstance(instance);
- final SharedCacheCoordinator cacheCoordinator = new SharedCacheCoordinator(tableName, zookeepers, evictionReaperIntervalInSeconds, numLocks,
- maxRetries);
+ final SharedCacheCoordinator cacheCoordinator = new SharedCacheCoordinator(tableName, zookeepers,
+ accumuloTableCacheProperties.getEvictionReaperIntervalInSeconds(), accumuloTableCacheProperties.getNumLocks(),
+ accumuloTableCacheProperties.getMaxRetries());
cacheCoordinators.add(cacheCoordinator);
try {
cacheCoordinator.start();
} catch (Exception e) {
- throw new EJBException("Error starting AccumuloTableCache", e);
+ throw new RuntimeException("Error starting AccumuloTableCache", e);
}
try {
@@ -165,24 +118,24 @@ public void countHasChanged(SharedCountReader sharedCount, int newCount) throws
throw new RuntimeException("table:" + tableName + " Unable to create shared counters: " + e.getMessage(), e);
}
detail.setWatcher(cacheCoordinator);
- details.put(entry.getKey(), entry.getValue());
-
+ details.put(tableName, detail);
}
}
public void setConnectionFactory(AccumuloConnectionFactory connectionFactory) {
- for (Entry entry : accumuloTableCacheConfiguration.getCaches().entrySet()) {
+ for (Entry entry : details.entrySet()) {
TableCache detail = entry.getValue();
detail.setConnectionFactory(connectionFactory);
}
connectionFactoryProvided = true;
}
+ @Override
public InMemoryInstance getInstance() {
return this.instance;
}
- @Schedule(hour = "*", minute = "*", second = "1", persistent = false)
+ @Override
public void submitReloadTasks() {
if (!connectionFactoryProvided) {
log.trace("NOT submitting reload tasks since our connection factory hasn't been provided yet.");
@@ -217,8 +170,8 @@ public void submitReloadTasks() {
}
}
- @PreDestroy
- public void stop() {
+ @Override
+ public void close() {
for (Entry entry : details.entrySet()) {
Future ref = entry.getValue().getReference();
if (null != ref)
@@ -230,47 +183,25 @@ public void stop() {
}
/**
- * JBossAdministrator or Administrator credentials required.
+ * Reload a table cache
*
* @param tableName
* the name of the table for which the cached version is to be reloaded
- * @return datawave.webservice.result.VoidResponse
- * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
- * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
- * @RequestHeader query-session-id session id value used for load balancing purposes. query-session-id can be placed in the request in a Cookie header or as
- * a query parameter
- * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
- *
- * @HTTP 200 success
- * @HTTP 404 queries not found using {@code id}
- * @HTTP 500 internal server error
*/
- @GET
- @Path("/reload/{tableName}")
- @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
- "application/x-protostuff"})
- @GZIP
- @Interceptors(RequiredInterceptor.class)
- public VoidResponse reloadCache(@Required("tableName") @PathParam("tableName") String tableName) {
- VoidResponse response = new VoidResponse();
+ @Override
+ public void reloadTableCache(String tableName) {
if (null == details.get(tableName)) {
- return response;
+ return;
}
+ log.debug("Reloading table cache for " + tableName);
// send an eviction notice to the cluster
try {
details.get(tableName).getWatcher().incrementCounter(tableName);
} catch (Exception e) {
- response.addException(new QueryException(e).getBottomQueryException());
- throw new DatawaveWebApplicationException(e, response);
- }
- try {
- this.sendCacheReloadMessage(tableName);
- } catch (Exception e) {
- log.error("Unable to send message about cache reload");
+ throw new RuntimeException(e);
}
handleReload(tableName);
handleReloadTypeMetadata(tableName);
- return response;
}
private void handleReloadTypeMetadata(String tableName) {
@@ -291,26 +222,13 @@ private void handleReload(String tableName) {
}
/**
- * JBossAdministrator or Administrator credentials required.
- *
- * @return datawave.webservice.common.result.AccumuloTableCacheStatus
- * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
- * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
- * @RequestHeader query-session-id session id value used for load balancing purposes. query-session-id can be placed in the request in a Cookie header or as
- * a query parameter
- * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
- *
- * @HTTP 200 success
+ * Get the table caches
*/
- @GET
- @Path("/")
- @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
- "application/x-protostuff", "text/html"})
- @GZIP
- public AccumuloTableCacheStatus getStatus() {
- AccumuloTableCacheStatus response = new AccumuloTableCacheStatus();
+ @Override
+ public List getTableCaches() {
+ List tableCaches = new ArrayList<>();
for (Entry entry : details.entrySet()) {
- datawave.webservice.common.result.TableCache t = new datawave.webservice.common.result.TableCache();
+ TableCacheDescription t = new TableCacheDescription();
t.setTableName(entry.getValue().getTableName());
t.setConnectionPoolName(entry.getValue().getConnectionPoolName());
t.setAuthorizations(entry.getValue().getAuths());
@@ -318,14 +236,8 @@ public AccumuloTableCacheStatus getStatus() {
t.setMaxRows(entry.getValue().getMaxRows());
t.setLastRefresh(entry.getValue().getLastRefresh());
t.setCurrentlyRefreshing((entry.getValue().getReference() != null));
- response.getCaches().add(t);
+ tableCaches.add(t);
}
- return response;
- }
-
- private void sendCacheReloadMessage(String tableName) {
- log.warn("table:" + tableName + " sending cache reload message about table " + tableName);
-
- jmsContext.createProducer().send(cacheTopic, tableName);
+ return tableCaches;
}
}
diff --git a/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCacheProperties.java b/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCacheProperties.java
new file mode 100644
index 00000000000..3be5b90b666
--- /dev/null
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/AccumuloTableCacheProperties.java
@@ -0,0 +1,129 @@
+package datawave.core.common.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+public class AccumuloTableCacheProperties {
+ private String zookeepers = null;
+ private List tableNames = new ArrayList<>();
+ private String poolName;
+ private long reloadInterval;
+ private int evictionReaperIntervalInSeconds;
+ private int numLocks;
+ private int maxRetries;
+ private long tableCacheReloadTaskLease = TimeUnit.MINUTES.toMillis(10);
+ private TimeUnit tableCacheReloadTaskLeaseTimeUnit = TimeUnit.MILLISECONDS;
+
+ public String getZookeepers() {
+ return zookeepers;
+ }
+
+ public AccumuloTableCacheProperties withZookeepers(String zookeepers) {
+ this.zookeepers = zookeepers;
+ return this;
+ }
+
+ public List getTableNames() {
+ return tableNames;
+ }
+
+ public AccumuloTableCacheProperties withTableNames(List tableNames) {
+ this.tableNames = tableNames;
+ return this;
+ }
+
+ public String getPoolName() {
+ return poolName;
+ }
+
+ public AccumuloTableCacheProperties withPoolName(String poolName) {
+ this.poolName = poolName;
+ return this;
+ }
+
+ public long getReloadInterval() {
+ return reloadInterval;
+ }
+
+ public AccumuloTableCacheProperties withReloadInterval(long reloadInterval) {
+ this.reloadInterval = reloadInterval;
+ return this;
+ }
+
+ public int getEvictionReaperIntervalInSeconds() {
+ return evictionReaperIntervalInSeconds;
+ }
+
+ public AccumuloTableCacheProperties withEvictionReaperIntervalInSeconds(int evictionReaperIntervalInSeconds) {
+ this.evictionReaperIntervalInSeconds = evictionReaperIntervalInSeconds;
+ return this;
+ }
+
+ public int getNumLocks() {
+ return numLocks;
+ }
+
+ public AccumuloTableCacheProperties withNumLocks(int numLocks) {
+ this.numLocks = numLocks;
+ return this;
+ }
+
+ public int getMaxRetries() {
+ return maxRetries;
+ }
+
+ public AccumuloTableCacheProperties withMaxRetries(int maxRetries) {
+ this.maxRetries = maxRetries;
+ return this;
+ }
+
+ public void setZookeepers(String zookeepers) {
+ this.zookeepers = zookeepers;
+ }
+
+ public void setTableNames(List tableNames) {
+ this.tableNames = tableNames;
+ }
+
+ public void setPoolName(String poolName) {
+ this.poolName = poolName;
+ }
+
+ public void setReloadInterval(long reloadInterval) {
+ this.reloadInterval = reloadInterval;
+ }
+
+ public void setEvictionReaperIntervalInSeconds(int evictionReaperIntervalInSeconds) {
+ this.evictionReaperIntervalInSeconds = evictionReaperIntervalInSeconds;
+ }
+
+ public void setNumLocks(int numLocks) {
+ this.numLocks = numLocks;
+ }
+
+ public void setMaxRetries(int maxRetries) {
+ this.maxRetries = maxRetries;
+ }
+
+ public long getTableCacheReloadTaskLease() {
+ return tableCacheReloadTaskLease;
+ }
+
+ public void setTableCacheReloadTaskLease(long tableCacheReloadTaskLease) {
+ this.tableCacheReloadTaskLease = tableCacheReloadTaskLease;
+ }
+
+ public long getTableCacheReloadTaskLeaseMillis() {
+ return tableCacheReloadTaskLeaseTimeUnit.toMillis(tableCacheReloadTaskLease);
+ }
+
+ public TimeUnit getTableCacheReloadTaskLeaseTimeUnit() {
+ return tableCacheReloadTaskLeaseTimeUnit;
+ }
+
+ public void setTableCacheReloadTaskLeaseTimeUnit(TimeUnit tableCacheReloadTaskLeaseTimeUnit) {
+ this.tableCacheReloadTaskLeaseTimeUnit = tableCacheReloadTaskLeaseTimeUnit;
+ }
+
+}
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/BaseTableCache.java b/core/connection-pool/src/main/java/datawave/core/common/cache/BaseTableCache.java
similarity index 96%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/BaseTableCache.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/BaseTableCache.java
index 2f90cfa77ce..e662b70f4fb 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/BaseTableCache.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/BaseTableCache.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import java.io.Serializable;
import java.util.Date;
@@ -33,8 +33,7 @@
import datawave.accumulo.inmemory.InMemoryAccumuloClient;
import datawave.accumulo.inmemory.InMemoryInstance;
-import datawave.webservice.common.connection.AccumuloConnectionFactory;
-import datawave.webservice.common.connection.AccumuloConnectionFactory.Priority;
+import datawave.core.common.connection.AccumuloConnectionFactory;
import datawave.webservice.common.connection.WrappedAccumuloClient;
public class BaseTableCache implements Serializable, TableCache {
@@ -171,7 +170,7 @@ public Boolean call() throws Exception {
String tempTableName = tableName + "Temp";
try {
Map map = connectionFactory.getTrackingMap(Thread.currentThread().getStackTrace());
- accumuloClient = connectionFactory.getClient(connectionPoolName, Priority.ADMIN, map);
+ accumuloClient = connectionFactory.getClient(null, null, connectionPoolName, AccumuloConnectionFactory.Priority.ADMIN, map);
if (accumuloClient instanceof WrappedAccumuloClient) {
accumuloClient = ((WrappedAccumuloClient) accumuloClient).getReal();
}
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedBoolean.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedBoolean.java
similarity index 98%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedBoolean.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedBoolean.java
index 1e6bd7b9644..ec2965f76a4 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedBoolean.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedBoolean.java
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import java.io.Closeable;
import java.io.IOException;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedBooleanListener.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedBooleanListener.java
similarity index 90%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedBooleanListener.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedBooleanListener.java
index fa20bd7228b..e9300b7072b 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedBooleanListener.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedBooleanListener.java
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import org.apache.curator.framework.state.ConnectionStateListener;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedBooleanReader.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedBooleanReader.java
similarity index 89%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedBooleanReader.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedBooleanReader.java
index 6703b03e73b..31721333f42 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedBooleanReader.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedBooleanReader.java
@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import org.apache.curator.framework.listen.Listenable;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedCacheCoordinator.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedCacheCoordinator.java
similarity index 97%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedCacheCoordinator.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedCacheCoordinator.java
index 363da12ef16..ac322004e26 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedCacheCoordinator.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedCacheCoordinator.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import java.io.IOException;
import java.io.Serializable;
@@ -11,10 +11,6 @@
import java.util.Timer;
import java.util.TimerTask;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.recipes.cache.ChildData;
@@ -31,17 +27,14 @@
import org.apache.curator.framework.state.ConnectionStateListener;
import org.apache.curator.retry.BoundedExponentialBackoffRetry;
import org.apache.curator.utils.ZKPaths;
-import org.apache.deltaspike.core.api.config.ConfigProperty;
+import org.apache.log4j.Logger;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZKUtil;
import org.apache.zookeeper.data.Stat;
-import org.jboss.logging.Logger;
import com.google.common.base.Preconditions;
-import datawave.common.util.ArgumentChecker;
-
/**
* Coordinates operations on a shared cache. That is, this coordinates operations where an in-memory cache may be running on multiple servers and each in-memory
* cache is using a shared backing store (e.g., shared filesystem, Accumulo, etc). There are helper methods to handle distributed locking, notification of
@@ -58,7 +51,7 @@ public interface EvictionCallback {
private static final String LIVE_SERVERS = "/liveServers";
private static final long EVICT_MESSAGE_TIMEOUT = 60 * 1000L;
- private Logger log = Logger.getLogger(getClass());
+ private static final Logger log = Logger.getLogger(SharedCacheCoordinator.class);
private transient CuratorFramework curatorClient;
private String localName;
private String serverIdentifierPath;
@@ -98,12 +91,7 @@ public interface EvictionCallback {
* @param numLocks
* number of locks
*/
- @Inject
- public SharedCacheCoordinator(@ConfigProperty(name = "dw.cache.coordinator.namespace") String namespace,
- @ConfigProperty(name = "dw.warehouse.zookeepers") String zookeeperConnectionString,
- @ConfigProperty(name = "dw.cacheCoordinator.evictionReaperIntervalSeconds", defaultValue = "30") int evictionReaperIntervalInSeconds,
- @ConfigProperty(name = "dw.cacheCoordinator.numLocks", defaultValue = "300") int numLocks,
- @ConfigProperty(name = "dw.cacheCoordinator.maxRetries", defaultValue = "10") int maxRetries) {
+ public SharedCacheCoordinator(String namespace, String zookeeperConnectionString, int evictionReaperIntervalInSeconds, int numLocks, int maxRetries) {
ArgumentChecker.notNull(namespace, zookeeperConnectionString);
locks = new HashMap<>();
@@ -130,7 +118,6 @@ public SharedCacheCoordinator(@ConfigProperty(name = "dw.cache.coordinator.names
evictionReaper = new Timer("cache-eviction-reaper-" + namespace, true);
}
- @PostConstruct
public void start() {
curatorClient.start();
@@ -284,7 +271,6 @@ private void restartTriStates() {
}
}
- @PreDestroy
public void stop() {
evictionReaper.cancel();
@@ -748,4 +734,18 @@ protected void reapEvictions() {
log.warn("Error cleaning up eviction notices: " + e.getMessage(), e);
}
}
+
+ public static class ArgumentChecker {
+ private static final String NULL_ARG_MSG = "argument was null";
+
+ public static final void notNull(final Object arg1) {
+ if (arg1 == null)
+ throw new IllegalArgumentException(NULL_ARG_MSG + ":Is null- arg1? true");
+ }
+
+ public static final void notNull(final Object arg1, final Object arg2) {
+ if (arg1 == null || arg2 == null)
+ throw new IllegalArgumentException(NULL_ARG_MSG + ":Is null- arg1? " + (arg1 == null) + " arg2? " + (arg2 == null));
+ }
+ }
}
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriState.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriState.java
similarity index 99%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriState.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriState.java
index f1aa73e7f36..e98be8527ef 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriState.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriState.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import java.io.Closeable;
import java.io.IOException;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriStateListener.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriStateListener.java
similarity index 85%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriStateListener.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriStateListener.java
index 78ec9012cc7..363277c4db4 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriStateListener.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriStateListener.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import org.apache.curator.framework.state.ConnectionStateListener;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriStateReader.java b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriStateReader.java
similarity index 82%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriStateReader.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriStateReader.java
index 02101aeb2f0..019e28af88d 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/SharedTriStateReader.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/SharedTriStateReader.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import org.apache.curator.framework.listen.Listenable;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/cache/TableCache.java b/core/connection-pool/src/main/java/datawave/core/common/cache/TableCache.java
similarity index 90%
rename from web-services/common/src/main/java/datawave/webservice/common/cache/TableCache.java
rename to core/connection-pool/src/main/java/datawave/core/common/cache/TableCache.java
index 808f50726ef..5296146c1d5 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/cache/TableCache.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/cache/TableCache.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.cache;
+package datawave.core.common.cache;
import java.io.Serializable;
import java.util.Date;
@@ -6,7 +6,7 @@
import java.util.concurrent.Future;
import datawave.accumulo.inmemory.InMemoryInstance;
-import datawave.webservice.common.connection.AccumuloConnectionFactory;
+import datawave.core.common.connection.AccumuloConnectionFactory;
public interface TableCache extends Callable, Serializable {
diff --git a/web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloClientPool.java b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloClientPool.java
similarity index 88%
rename from web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloClientPool.java
rename to core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloClientPool.java
index 978880fd932..2032b783f19 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloClientPool.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloClientPool.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.connection;
+package datawave.core.common.connection;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,9 +34,9 @@ public AccumuloClient borrowObject(Map trackingMap) throws Except
Long threadId = Thread.currentThread().getId();
AccumuloClient o;
try {
- trackingMap.put("connection.state.start", Long.valueOf(System.currentTimeMillis()).toString());
- trackingMap.put("state", AccumuloConnectionFactory.State.WAITING.toString());
- trackingMap.put("thread.name", Thread.currentThread().getName());
+ trackingMap.put(AccumuloConnectionFactory.START_TIME, Long.valueOf(System.currentTimeMillis()).toString());
+ trackingMap.put(AccumuloConnectionFactory.STATE, AccumuloConnectionFactory.State.WAITING.toString());
+ trackingMap.put(AccumuloConnectionFactory.THREAD_NAME, Thread.currentThread().getName());
threadToTrackingMapMap.put(threadId, trackingMap);
o = super.borrowObject();
log.debug(System.currentTimeMillis() + " thread: " + threadId + " borrowed connector: " + o);
@@ -47,8 +47,8 @@ public AccumuloClient borrowObject(Map trackingMap) throws Except
// connection being moved from the threadToTrackingMapMap to the connectorToTrackingMapMap
if (o != null) {
- trackingMap.put("connection.state.start", Long.valueOf(System.currentTimeMillis()).toString());
- trackingMap.put("state", AccumuloConnectionFactory.State.CONNECTED.toString());
+ trackingMap.put(AccumuloConnectionFactory.START_TIME, Long.valueOf(System.currentTimeMillis()).toString());
+ trackingMap.put(AccumuloConnectionFactory.STATE, AccumuloConnectionFactory.State.CONNECTED.toString());
connectorToTrackingMapMap.put(o, trackingMap);
}
diff --git a/web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloClientPoolFactory.java b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloClientPoolFactory.java
similarity index 97%
rename from web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloClientPoolFactory.java
rename to core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloClientPoolFactory.java
index 0b7b246b3b2..bbc192ee193 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloClientPoolFactory.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloClientPoolFactory.java
@@ -1,4 +1,4 @@
-package datawave.webservice.common.connection;
+package datawave.core.common.connection;
import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
diff --git a/web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloConnectionFactory.java b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloConnectionFactory.java
similarity index 52%
rename from web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloConnectionFactory.java
rename to core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloConnectionFactory.java
index 66a652baba9..80d67e6184d 100644
--- a/web-services/common/src/main/java/datawave/webservice/common/connection/AccumuloConnectionFactory.java
+++ b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloConnectionFactory.java
@@ -1,11 +1,26 @@
-package datawave.webservice.common.connection;
+package datawave.core.common.connection;
+import java.util.Collection;
+import java.util.List;
import java.util.Map;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.clientImpl.ClientContext;
-public interface AccumuloConnectionFactory {
+import datawave.core.common.result.ConnectionPool;
+import datawave.webservice.common.connection.WrappedAccumuloClient;
+
+public interface AccumuloConnectionFactory extends AutoCloseable {
+
+ String USER_DN = "user.dn";
+ String PROXY_SERVERS = "proxyServers";
+ String REQUEST_LOCATION = "request.location";
+ String START_TIME = "connection.state.start";
+ String STATE = "state";
+ String THREAD_NAME = "thread.name";
+ String QUERY_USER = "query.user";
+ String QUERY_ID = "query.id";
+ String QUERY = "query.query";
enum Priority {
@@ -17,17 +32,10 @@ enum State {
WAITING, CONNECTED
}
- /**
- * @param poolName
- * the name of the pool to query
- * @return name of the user used in the connection pools
- */
- String getConnectionUserName(String poolName);
-
/**
* Gets a connection from the pool with the assigned priority
*
- * Deprecated in 2.2.3, use {@link #getClient(Priority, Map)}
+ * Deprecated in 2.2.3, use {@link #getClient(String, Collection, String, Priority, Map)}
*
* @param priority
* the connection's Priority
@@ -35,9 +43,9 @@ enum State {
* the tracking map
* @return accumulo connection
* @throws Exception
- * if there are issues
+ * on failure
*/
- AccumuloClient getClient(Priority priority, Map trackingMap) throws Exception;
+ AccumuloClient getClient(String userDN, Collection proxyServers, Priority priority, Map trackingMap) throws Exception;
/**
* Gets a connection from the named pool with the assigned priority
@@ -50,20 +58,47 @@ enum State {
* the tracking map
* @return Accumulo connection
* @throws Exception
- * if there are issues
+ * on failure
*/
- AccumuloClient getClient(String poolName, Priority priority, Map trackingMap) throws Exception;
+ AccumuloClient getClient(String userDN, Collection proxyServers, String poolName, Priority priority, Map trackingMap)
+ throws Exception;
/**
* Returns the connection to the pool with the associated priority.
*
* @param client
- * The client to return
+ * The connection to return
* @throws Exception
- * if there are issues
+ * on failure
*/
void returnClient(AccumuloClient client) throws Exception;
+ /**
+ * Return a report of the current connection factory usage
+ */
+ String report();
+
+ /**
+ * Get a description of the current pools
+ *
+ * @return A list of connection pools
+ */
+ List getConnectionPools();
+
+ /**
+ * Get the current connection usage percentage. This can be used for balancing purposes.
+ *
+ * @return The usage percentage (0 - 100)
+ */
+ int getConnectionUsagePercent();
+
+ /**
+ * Get a tracking map to be used in the getConnection calls
+ *
+ * @param stackTrace
+ * The callers stack trace
+ * @return A map representation
+ */
Map getTrackingMap(StackTraceElement[] stackTrace);
/**
diff --git a/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloConnectionFactoryImpl.java b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloConnectionFactoryImpl.java
new file mode 100644
index 00000000000..8c77dd34688
--- /dev/null
+++ b/core/connection-pool/src/main/java/datawave/core/common/connection/AccumuloConnectionFactoryImpl.java
@@ -0,0 +1,381 @@
+package datawave.core.common.connection;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.admin.SecurityOperations;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.util.Pair;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.mutable.MutableInt;
+import org.apache.log4j.Logger;
+
+import datawave.accumulo.inmemory.InMemoryAccumuloClient;
+import datawave.core.common.cache.AccumuloTableCache;
+import datawave.core.common.result.Connection;
+import datawave.core.common.result.ConnectionPool;
+import datawave.core.common.result.ConnectionPoolProperties;
+import datawave.core.common.result.ConnectionPoolsProperties;
+import datawave.webservice.common.connection.WrappedAccumuloClient;
+
+/**
+ * An accumulo connection factory
+ */
+public class AccumuloConnectionFactoryImpl implements AccumuloConnectionFactory {
+
+ private Logger log = Logger.getLogger(this.getClass());
+
+ private final AccumuloTableCache cache;
+ private final ConnectionPoolsProperties connectionPoolsConfiguration;
+
+ private Map> pools;
+
+ private String defaultPoolName = null;
+
+ private static AccumuloConnectionFactoryImpl factory = null;
+
+ public static AccumuloConnectionFactory getInstance(AccumuloTableCache cache, ConnectionPoolsProperties config) {
+ if (factory == null) {
+ synchronized (AccumuloConnectionFactoryImpl.class) {
+ if (factory == null) {
+ setFactory(new AccumuloConnectionFactoryImpl(cache, config));
+ }
+ }
+ }
+ return factory;
+ }
+
+ private AccumuloConnectionFactoryImpl(AccumuloTableCache cache, ConnectionPoolsProperties config) {
+ this.cache = cache;
+ this.connectionPoolsConfiguration = config;
+ log.info("Initializing AccumuloConnectionFactoryImpl with " + config.getDefaultPool() + " and " + config.getPoolNames());
+ init();
+ }
+
+ public void init() {
+ this.pools = new HashMap<>();
+
+ if (this.connectionPoolsConfiguration == null) {
+ log.error("connectionPoolsConfiguration was null - aborting init()");
+ return;
+ }
+ HashMap> instances = new HashMap<>();
+ this.defaultPoolName = connectionPoolsConfiguration.getDefaultPool();
+ for (Entry entry : connectionPoolsConfiguration.getPools().entrySet()) {
+ Map p = new HashMap<>();
+ ConnectionPoolProperties conf = entry.getValue();
+ p.put(Priority.ADMIN, createConnectionPool(conf, conf.getAdminPriorityPoolSize()));
+ p.put(Priority.HIGH, createConnectionPool(conf, conf.getHighPriorityPoolSize()));
+ p.put(Priority.NORMAL, createConnectionPool(conf, conf.getNormalPriorityPoolSize()));
+ p.put(Priority.LOW, createConnectionPool(conf, conf.getLowPriorityPoolSize()));
+ this.pools.put(entry.getKey(), Collections.unmodifiableMap(p));
+ try {
+ setupMockAccumuloUser(conf, p.get(AccumuloConnectionFactory.Priority.NORMAL), instances);
+ } catch (Exception e) {
+ log.error("Error configuring mock accumulo user for AccumuloConnectionFactoryBean.", e);
+ }
+
+ // Initialize the distributed tracing system. This needs to be done once at application startup. Since
+ // it is tied to Accumulo connections, we do it here in this singleton bean.
+ String appName = "datawave_ws";
+ try {
+ appName = System.getProperty("app", "datawave_ws");
+ } catch (SecurityException e) {
+ log.warn("Unable to retrieve system property \"app\": " + e.getMessage());
+ }
+ }
+
+ cache.setConnectionFactory(this);
+ }
+
+ private AccumuloClientPool createConnectionPool(ConnectionPoolProperties conf, int limit) {
+ AccumuloClientPoolFactory factory = new AccumuloClientPoolFactory(conf.getUsername(), conf.getPassword(), conf.getZookeepers(), conf.getInstance());
+ AccumuloClientPool pool = new AccumuloClientPool(factory);
+ pool.setTestOnBorrow(true);
+ pool.setTestOnReturn(true);
+ pool.setMaxTotal(limit);
+ pool.setMaxIdle(-1);
+
+ try {
+ pool.addObject();
+ } catch (Exception e) {
+ log.error("Error pre-populating connection pool", e);
+ }
+
+ return pool;
+ }
+
+ private void setupMockAccumuloUser(ConnectionPoolProperties conf, AccumuloClientPool pool, HashMap> instances)
+ throws Exception {
+ AccumuloClient c = null;
+ try {
+ c = pool.borrowObject(new HashMap<>());
+
+ Pair pair = instances.get(cache.getInstance().getInstanceID());
+ String user = "root";
+ PasswordToken password = new PasswordToken(new byte[0]);
+ if (pair != null && user.equals(pair.getFirst()))
+ password = pair.getSecond();
+ SecurityOperations security = new InMemoryAccumuloClient(user, cache.getInstance()).securityOperations();
+ Set users = security.listLocalUsers();
+ if (!users.contains(conf.getUsername())) {
+ security.createLocalUser(conf.getUsername(), new PasswordToken(conf.getPassword()));
+ security.changeUserAuthorizations(conf.getUsername(), c.securityOperations().getUserAuthorizations(conf.getUsername()));
+ } else {
+ PasswordToken newPassword = new PasswordToken(conf.getPassword());
+ // If we're changing root's password, and trying to change then keep track of that. If we have multiple instances
+ // that specify mismatching passwords, then throw an error.
+ if (user.equals(conf.getUsername())) {
+ if (pair != null && !newPassword.equals(pair.getSecond()))
+ throw new IllegalStateException(
+ "Invalid AccumuloConnectionFactoryBean configuration--multiple pools are configured with different root passwords!");
+ instances.put(cache.getInstance().getInstanceID(), new Pair<>(conf.getUsername(), newPassword));
+ }
+ // match root's password on mock to the password on the actual Accumulo instance
+ security.changeLocalUserPassword(conf.getUsername(), newPassword);
+ }
+ } finally {
+ pool.returnObject(c);
+ }
+ }
+
+ private static void setFactory(AccumuloConnectionFactoryImpl factory) {
+ AccumuloConnectionFactoryImpl.factory = factory;
+ }
+
+ @Override
+ public void close() {
+ synchronized (AccumuloConnectionFactoryImpl.class) {
+ setFactory(null);
+ for (Entry> entry : this.pools.entrySet()) {
+ for (Entry poolEntry : entry.getValue().entrySet()) {
+ try {
+ poolEntry.getValue().close();
+ } catch (Exception e) {
+ log.error("Error closing Accumulo Connection Pool: " + e);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Gets a connection from the pool with the assigned priority
+ *
+ * Deprecated in 2.2.3, use getConnection(UserContext context, String poolName, Priority priority, {@code Map trackingMap)}
+ *
+ * @param priority
+ * the connection's Priority
+ * @return accumulo connection
+ * @throws Exception
+ */
+ @Override
+ public AccumuloClient getClient(final String userDN, final Collection proxyServers, Priority priority, Map trackingMap)
+ throws Exception {
+ return getClient(userDN, proxyServers, defaultPoolName, priority, trackingMap);
+ }
+
+ /**
+ * Gets a connection from the named pool with the assigned priority
+ *
+ * @param cpn
+ * the name of the pool to retrieve the connection from
+ * @param priority
+ * the priority of the connection
+ * @param tm
+ * the tracking map
+ * @return Accumulo connection
+ * @throws Exception
+ */
+ @Override
+ public AccumuloClient getClient(final String userDN, final Collection proxyServers, final String cpn, final Priority priority,
+ final Map tm) throws Exception {
+ final Map trackingMap = (tm != null) ? tm : new HashMap<>();
+ final String poolName = (cpn != null) ? cpn : defaultPoolName;
+
+ if (!priority.equals(Priority.ADMIN)) {
+ if (userDN != null)
+ trackingMap.put(USER_DN, userDN);
+ if (proxyServers != null)
+ trackingMap.put(PROXY_SERVERS, StringUtils.join(proxyServers, " -> "));
+ }
+ log.info("Getting pool from " + poolName + " for priority " + priority);
+ log.info("Pools = " + pools);
+ log.info("Pools.get(poolName) = " + pools.get(poolName));
+ AccumuloClientPool pool = pools.get(poolName).get(priority);
+ AccumuloClient c = pool.borrowObject(trackingMap);
+ AccumuloClient mock = new InMemoryAccumuloClient(pool.getFactory().getUsername(), cache.getInstance());
+ WrappedAccumuloClient wrappedAccumuloClient = new WrappedAccumuloClient(c, mock);
+ if (connectionPoolsConfiguration.getClientConfiguration(poolName) != null) {
+ wrappedAccumuloClient.setClientConfig(connectionPoolsConfiguration.getClientConfiguration(poolName).getConfiguration());
+ }
+ String classLoaderContext = System.getProperty("dw.accumulo.classLoader.context");
+ if (classLoaderContext != null) {
+ wrappedAccumuloClient.setScannerClassLoaderContext(classLoaderContext);
+ }
+ String timeout = System.getProperty("dw.accumulo.scan.batch.timeout.seconds");
+ if (timeout != null) {
+ wrappedAccumuloClient.setScanBatchTimeoutSeconds(Long.parseLong(timeout));
+ }
+ return wrappedAccumuloClient;
+ }
+
+ /**
+ * Returns the connection to the pool with the associated priority.
+ *
+ * @param client
+ * The connection to return
+ * @throws Exception
+ */
+ @Override
+ public void returnClient(AccumuloClient client) throws Exception {
+ if (client instanceof WrappedAccumuloClient) {
+ WrappedAccumuloClient wrappedAccumuloClient = (WrappedAccumuloClient) client;
+ wrappedAccumuloClient.clearScannerClassLoaderContext();
+ client = wrappedAccumuloClient.getReal();
+ }
+ for (Entry> entry : this.pools.entrySet()) {
+ for (Entry poolEntry : entry.getValue().entrySet()) {
+ if (poolEntry.getValue().connectorCameFromHere(client)) {
+ poolEntry.getValue().returnObject(client);
+ log.info("Returning connection to pool " + entry.getKey() + " for priority " + poolEntry.getKey());
+ return;
+ }
+ }
+ }
+ log.info("returnConnection called with connection that did not come from any AccumuloConnectionPool");
+ }
+
+ @Override
+ public String report() {
+ StringBuilder buf = new StringBuilder();
+ for (Entry> entry : this.pools.entrySet()) {
+ buf.append("**** ").append(entry.getKey()).append(" ****\n");
+ buf.append("ADMIN: ").append(entry.getValue().get(Priority.ADMIN)).append("\n");
+ buf.append("HIGH: ").append(entry.getValue().get(Priority.HIGH)).append("\n");
+ buf.append("NORMAL: ").append(entry.getValue().get(Priority.NORMAL)).append("\n");
+ buf.append("LOW: ").append(entry.getValue().get(Priority.LOW)).append("\n");
+ }
+
+ return buf.toString();
+ }
+
+ /**
+ * Returns metrics for the AccumuloConnectionFactory
+ *
+ * @return list of ConnectionPool (connection pool metrics)
+ */
+ @Override
+ public List getConnectionPools() {
+ ArrayList connectionPools = new ArrayList<>();
+
+ Set exclude = new HashSet<>();
+ exclude.add("connection.state.start");
+ exclude.add("state");
+ exclude.add("request.location");
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
+
+ for (Entry> entry : this.pools.entrySet()) {
+ for (Entry entry2 : entry.getValue().entrySet()) {
+ String poolName = entry.getKey();
+ Priority priority = entry2.getKey();
+ AccumuloClientPool p = entry2.getValue();
+
+ Long now = System.currentTimeMillis();
+ MutableInt maxActive = new MutableInt();
+ MutableInt numActive = new MutableInt();
+ MutableInt maxIdle = new MutableInt();
+ MutableInt numIdle = new MutableInt();
+ MutableInt numWaiting = new MutableInt();
+ // getConnectionPoolStats will collect the tracking maps and maxActive, numActive, maxIdle, numIdle while synchronized
+ // to ensure consistency between the GenericObjectPool and the tracking maps
+ List