Skip to content

Commit

Permalink
Merge branch 'integration' into task/supportForConfigChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
mineralntl committed May 21, 2024
2 parents 5e240ca + e54f368 commit 71c1538
Show file tree
Hide file tree
Showing 691 changed files with 15,542 additions and 8,248 deletions.
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# In order to ensure the query microservices are consistent with the wildfly webservice, we need
# to ensure that changes made to QueryExecutorBean match QueryManagementService, and changes made
# to LookupUUIDUtil match LookupService in the Query Service.
QueryExecutorBean.java @jwomeara
LookupUUIDUtil.java @jwomeara
RunningQuery.java @jwomeara
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,3 @@ jobs:
# docker tag ${IMAGE_NAME}:${TAG} ${REMOTE_IMAGE_NAME}:${TAG}
# docker images
# docker push ${REMOTE_IMAGE_NAME}:${TAG}

21 changes: 21 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,24 @@
[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
16 changes: 16 additions & 0 deletions .mvn/maven-build-cache-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@
<goal>install</goal>
</goals>
</goalsList>
<goalsList artifactId="docker-maven-plugin">
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</goalsList>
<goalsList artifactId="maven-resources-plugin">
<goals>
<goal>copy-resources</goal>
</goals>
</goalsList>
<goalsList artifactId="spring-boot-maven-plugin">
<goals>
<goal>repackage</goal>
</goals>
</goalsList>
</goalsLists>
</runAlways>
<reconcile logAllProperties="true">
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion common-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-parent</artifactId>
<version>6.14.0-SNAPSHOT</version>
<version>7.0.1-SNAPSHOT</version>
</parent>
<artifactId>datawave-common-test</artifactId>
<name>${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion contrib/datawave-quickstart/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
!docker
!docker/**

docker/target/**
docker/target/**
1 change: 1 addition & 0 deletions contrib/datawave-quickstart/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "${BIN_DIR}/logging.sh"
source "${BIN_DIR}/query.sh"
source "${BIN_DIR}/modification.sh"

# Upon uninstall, tarballs will be preserved in place by default.
# To remove them, use DW_UNINSTALL_RM_BINARIES_FLAG_*
Expand Down
295 changes: 295 additions & 0 deletions contrib/datawave-quickstart/bin/modification.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
#
# if using feature/queryMicroservices quickstart webserver:
# DW_MODIFICATION_URI=https://localhost:9443/DataWave/Modification
#
# if using feature/queryMicroservices deployed modification service
# DW_BASE_URI=-https://localhost:9443/DataWave
# DW_MODIFICATION_URI=https://localhost:9343/modification/v1
#

DW_BASE_URI=${DW_BASE_URI:-https://localhost:8443/DataWave}
DW_MODIFICATION_URI=${DW_MODIFICATION_URI:-${DW_BASE_URI}/Modification}

function xmlencode() {
local s
s=${1//&/&amp;}
s=${s//</&lt;}
s=${s//>/&gt;}
s=${s//'"'/&quot;}
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="<DefaultUUIDModificationRequest xmlns=\"http://webservice.datawave/v1\" _class=\"datawave.webservice.modification.DefaultUUIDModificationRequest\"><Events><Event><id>${DW_MODIFICATION_UUID}</id><idType>${DW_MODIFICATION_UUID_TYPE}</idType><operations><operation><operationMode>${DW_MODIFICATION_COMMAND}</operationMode><fieldName>${DW_MODIFICATION_FIELD}</fieldName><fieldValue>${DW_MODIFICATION_NEW_VALUE}</fieldValue><columnVisibility>$( xmlencode ${DW_MODIFICATION_VIZ} )</columnVisibility></operation></operations><user>testUser</user></Event></Events><mode>INSERT</mode><fieldName>TEST</fieldName><fieldValue>ABC</fieldValue><columnVisibility>PUBLIC</columnVisibility></DefaultUUIDModificationRequest>"
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="<DefaultUUIDModificationRequest xmlns=\"http://webservice.datawave/v1\" _class=\"datawave.webservice.modification.DefaultUUIDModificationRequest\"><Events><Event><id>${DW_MODIFICATION_UUID}</id><idType>${DW_MODIFICATION_UUID_TYPE}</idType><operations><operation><operationMode>${DW_MODIFICATION_COMMAND}</operationMode><fieldName>${DW_MODIFICATION_FIELD}</fieldName><fieldValue>${DW_MODIFICATION_NEW_VALUE}</fieldValue><oldFieldValue>${DW_MODIFICATION_OLD_VALUE}</oldFieldValue><columnVisibility>$( xmlencode ${DW_MODIFICATION_VIZ} )</columnVisibility></operation></operations><user>testUser</user></Event></Events><mode>INSERT</mode><fieldName>TEST</fieldName><fieldValue>ABC</fieldValue><columnVisibility>PUBLIC</columnVisibility></DefaultUUIDModificationRequest>"
elif [ "${DW_MODIFICATION_COMMAND}" == "DELETE" ] ; then
[ -z "${DW_MODIFICATION_OLD_VALUE}" ] && error "Old field value is required" && return 1
BODY="<DefaultUUIDModificationRequest xmlns=\"http://webservice.datawave/v1\" _class=\"datawave.webservice.modification.DefaultUUIDModificationRequest\"><Events><Event><id>${DW_MODIFICATION_UUID}</id><idType>${DW_MODIFICATION_UUID_TYPE}</idType><operations><operation><operationMode>${DW_MODIFICATION_COMMAND}</operationMode><fieldName>${DW_MODIFICATION_FIELD}</fieldName><oldFieldValue>${DW_MODIFICATION_OLD_VALUE}</oldFieldValue><columnVisibility>$( xmlencode ${DW_MODIFICATION_VIZ} )</columnVisibility></operation></operations><user>testUser</user></Event></Events><mode>INSERT</mode><fieldName>TEST</fieldName><fieldValue>ABC</fieldValue><columnVisibility>PUBLIC</columnVisibility></DefaultUUIDModificationRequest>"
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" ) \"<uuid>\""
echo " The event uuid"
echo
echo " $( printGreen "-t" ) | $( printGreen "--type" ) \"<uuid type>\""
echo " The event uuid type (field)"
echo
echo " $( printGreen "-f" ) | $( printGreen "--field" ) \"<field>\""
echo " The field to modify"
echo
echo " Optional:"
echo
echo " $( printGreen "-c" ) | $( printGreen "--command" ) <syntax>"
echo " The command must be one of INSERT, UPDATE, DELETE, or REPLACE. Defaults to ${DW_MODIFICATION_COMMAND}"
echo
echo " $( printGreen "-n" ) | $( printGreen "--newvalue" ) <value>"
echo " The old value (required for INSERT, UPDATE or REPLACE service)"
echo
echo " $( printGreen "-o" ) | $( printGreen "--oldvalue" ) <value>"
echo " The old value (required for UPDATE or DELETE service)"
echo
echo " $( printGreen "--vis" ) | $( printGreen "--visibility" ) <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
}

2 changes: 1 addition & 1 deletion contrib/datawave-quickstart/bin/query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,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\:.*//' )
}

Expand Down

0 comments on commit 71c1538

Please sign in to comment.