diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f9bbc2e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 + +updates: + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 5 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0be5339 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: Gradle CI + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + build: + name: Build and test + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 21 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v6 + + - name: Make Gradle wrapper executable + run: chmod +x ./gradlew + + - name: Build and test + run: ./gradlew clean build + + dependency-submission: + name: Submit Gradle dependencies + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 21 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v6 + + - name: Submit Gradle dependencies + uses: gradle/actions/dependency-submission@v6 + \ No newline at end of file diff --git a/README.md b/README.md index 743cd8d..7d6b916 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,66 @@ # REGI-Headless -This is a temporary readme file and will be updated in the future. \ No newline at end of file +> [!IMPORTANT] +> **Notice: Project Refactor in Progress** +> This project is undergoing a large refactor for CWMS Data API support. +> It will transition from a Java project consuming Jython scripts to a **Python project** that +> utilizes **JPype** to call underlying REGI Java libraries. + +`REGI-Headless` is a Java-based command-line tool and library designed to run +**REGI** calculations in a headless environment. +It allows users to execute complex hydrological calculations and manage gate settings via Jython +scripts without the need for a graphical interface. + +## Features + +- **Headless Execution**: Run REGI calculations as part of automated workflows or on servers. +- **Database Integration**: Connects to CWMS data retrieval and storage. +- **Modular Calculations**: Includes support for: + - Inflow calculations (Clone, Compute, Auto-Adjust, Balance All, etc.) + - Flow Group and gate settings calculations. + +## Project Structure + +- `regi-headless/`: Core Java implementation, including `RegiCLI`. +- `district-scripts/`: Example scripts and district-specific configurations. +- `docs/`: Additional documentation. + +## Getting Started + +### Prerequisites + +- Java JDK 21 or higher. +- Access to a CWMS + +### Building + + +```powershell +./gradlew build +``` + +Details TBD. + +## Usage + +TBD + +### Command Line Options + +TBD + +### Example + +TBD + +## Testing + +TBD + +## Maintainers + +See [MAINTAINERS.md](MAINTAINERS.md) for a list of project maintainers. + +## License + +See [LICENSE](LICENSE) for licensing information. \ No newline at end of file diff --git a/build.gradle b/build.gradle index 33d99e9..84613dc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { - id "com.palantir.git-version" version "3.0.0" - id "org.sonarqube" version "4.0.0.2929" + id "com.palantir.git-version" version "5.0.0" + id "org.sonarqube" version "7.3.1.8318" } def versionLabel(gitInfo) { diff --git a/buildSrc/src/main/groovy/regi-headless.deps-conventions.gradle b/buildSrc/src/main/groovy/regi-headless.deps-conventions.gradle index 9e8db3d..9f129f3 100644 --- a/buildSrc/src/main/groovy/regi-headless.deps-conventions.gradle +++ b/buildSrc/src/main/groovy/regi-headless.deps-conventions.gradle @@ -1,24 +1,6 @@ - -def checkForNexusCredentials() { - if(!project.hasProperty('nexusUser')) { - println ('Please set the nexusUser property in the GRADLE_USER_HOME ($userHome/.gradle/gradle.properties) file or via -PnexusUser= .') - } - if(!project.hasProperty('nexusPassword')) { - println ('Please set the nexusPassword property in the GRADLE_USER_HOME ($userHome/.gradle/gradle.properties) file or via -PnexusPassword= .') - } -} - repositories { maven { url 'https://www.hec.usace.army.mil/nexus/repository/maven-public' } - maven { - url 'https://www.hec.usace.army.mil/nexus/repository/hec-internal' - credentials { - checkForNexusCredentials() - username "$nexusUser" - password "$nexusPassword" - } - } mavenCentral() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7c8dacb..530fd77 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,87 +1,57 @@ [versions] # HEC Dependencies -service-annotations = "1.2.2" -win-java-heclib = "7-IE-win-x64" -solaris-java-heclib = "7-IE-Solaris64" -hec-core = "6.1-SNAPSHOT" # required for PasswordFileEditor +service-annotations = "2.1.0" +hec-server-suite = "8.4.5" # REGI Dependencies -regi-tools = "3.4.3" -regi = "3.4.4" +regi-tools = "9.1.1" +regi = "3.5.0-alpha001" # Third Party jython-standalone = "2.7.2" args4j = "2.32" -# Natives -windows-jre = "1.8.0_201" -solaris-jre = "1.8.0_202-Solaris-SPARC" -jython-starter = "2.2.4.0" - # Test -junit4 = "4.13.2" -junit = "5.9.3" +junit = "6.1.0" [libraries] # HEC Dependencies service-annotations = { module = "mil.army.usace.hec:service-annotations", version.ref = "service-annotations" } -hec-core = { module="mil.army.usace.hec:hec-core", version.ref = "hec-core" } -win-java-heclib = {module="mil.army.usace.hec:javaHeclib", version.ref = "win-java-heclib"} -solaris-java-heclib = {module="mil.army.usace.hec:javaHeclib", version.ref = "solaris-java-heclib"} +serversuite = { module = "mil.army.usace.hec:hec-server-suite", version.ref = "hec-server-suite" } +serversuite-cda = { module = "mil.army.usace.hec:cda-server-suite", version.ref = "hec-server-suite" } +serversuite-jdbc = { module = "mil.army.usace.hec:jdbc-server-suite", version.ref = "hec-server-suite" } +hec-db-cda = { module = "mil.army.usace.hec:hec-db-cda", version = "14.1.0" } +hec-cwms-ratings-cda = { module = "mil.army.usace.hec:hec-cwms-ratings-io-cda", version = "4.2.2"} # REGI Dependencies -regi-basinpie-ui = {module = "mil.army.wmist.regi:basin-pie-ui", version.ref = "regi"} regi-computation = {module = "mil.army.wmist.regi:computation", version.ref = "regi"} -regi-decisionsupport-ui = {module = "mil.army.wmist.regi:decision-support-ui", version.ref = "regi"} -regi-mappanel-ui = {module = "mil.army.wmist.regi:map-panel-ui", version.ref = "regi"} -regi-ui = {module = "mil.army.wmist.regi:regi-ui", version.ref = "regi"} # Regi-tools Dependencies regi-tools-regi-core = {module = "mil.army.wmist.regi-tools:regi-core", version.ref = "regi-tools"} regi-tools-regi-data = {module = "mil.army.wmist.regi-tools:regi-data", version.ref = "regi-tools"} regi-tools-regi-dao = {module = "mil.army.wmist.regi-tools:regi-dao", version.ref = "regi-tools"} regi-tools-regi-cwms = {module = "mil.army.wmist.regi-tools:regi-cwms", version.ref = "regi-tools"} -# Required for reservoir status graphics -regi-tools-regi-cache-ui = {module = "mil.army.wmist.regi-tools:regi-cache-ui", version.ref = "regi-tools"} # Third Party jython-standalone = {module = "org.python:jython-standalone", version.ref = "jython-standalone"} args4j = {module = "args4j:args4j", version.ref = "args4j"} -# Natives -windows_jre = { module = "com.oracle:oracle-jre", version.ref = "windows-jre" } -solaris_jre = { module = "com.oracle:jre", version.ref = "solaris-jre" } -jython-starter = { module = 'mil.army.usace.hec.javastarter:javastarter-Jython', version.ref = "jython-starter"} - # Test -junit4 = { module = "junit:junit", version.ref = "junit4" } junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "junit" } +junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" } [bundles] -regi = [ - "regi-basinpie-ui", - "regi-computation", - "regi-decisionsupport-ui", - "regi-mappanel-ui", - "regi-ui"] +regi = ["regi-computation"] regi-tools = [ "regi-tools-regi-core", - "regi-tools-regi-cache-ui", "regi-tools-regi-cwms", "regi-tools-regi-dao", "regi-tools-regi-data" ] -hec = [ - "hec-core" -] -sys = [ - "args4j", - "jython-standalone" -] +serversuite = ["serversuite", "serversuite-cda", "serversuite-jdbc", "hec-db-cda"] -junit-api = ["junit-jupiter-api", "junit-jupiter-params", "junit4"] -junit-engine = ["junit-jupiter-engine", "junit-vintage-engine"] \ No newline at end of file +junit-api = ["junit-jupiter-api", "junit-jupiter-params"] +junit-engine = ["junit-jupiter-engine", "junit-platform-launcher"] \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd49..b1b8ef5 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5dd3c01..a9db115 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1aa94a4..249efbb 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -27,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -170,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -203,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..a51ec4f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,16 +13,18 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -43,13 +45,13 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -57,36 +59,24 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% -:mainEnd -if "%OS%"=="Windows_NT" endlocal +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/regi-headless/build.gradle b/regi-headless/build.gradle index e528b8c..c4a6bf1 100644 --- a/regi-headless/build.gradle +++ b/regi-headless/build.gradle @@ -4,21 +4,47 @@ plugins { } dependencies { - implementation(libs.bundles.hec) + implementation(libs.bundles.serversuite) implementation(libs.jython.standalone) implementation(libs.args4j) implementation(libs.bundles.regi) implementation(libs.bundles.regi) {artifact {extension = "jar"}} implementation(libs.bundles.regi.tools) implementation(libs.bundles.regi.tools) {artifact {extension = "jar"} } - + runtimeOnly(libs.hec.cwms.ratings.cda) testImplementation(libs.bundles.junit.api) testRuntimeOnly(libs.bundles.junit.engine) } +configurations.configureEach { + exclude group: 'mil.army.usace.hec', module: 'hec-cwmsvue' + exclude group: 'mil.army.usace.hec', module: 'hec-gt-crs' + exclude group: 'org.openjfx', module: '*' + exclude group: 'mil.army.usace.hec.swingx', module: '*' + exclude group: 'org.swinglabs', module: '*' + exclude group: 'org.jfree', module: '*' + exclude group: 'org.netbeans.modules', module: '*' + exclude group: 'org.netbeans.api', module: '*' + exclude group: 'mil.army.usace.hec.map', module: 'hec-osmmap' + exclude group: 'mil.army.usace.hec', module: 'hec-geojson' + exclude group: 'mil.army.usace.hec', module: 'dssplugin-excel' + exclude group: 'mil.army.usace.hec', module: 'dssgui' + exclude group: 'com.fifesoft', module: 'rstaui' + exclude group: 'mil.army.usace.hec', module: 'rma-javafx-core' + exclude group: 'mil.army.usace.hec', module: 'hec-vrt-io' + exclude group: 'org.apache.xmlgraphics', module: '*' + exclude group: 'org.apache.poi', module: '*' + exclude group: 'javax.media', module: '*' + exclude group: 'com.vividsolutions', module: 'jts' +} + jar { manifest { attributes('Implementation-Version': project.version) } -} \ No newline at end of file +} + +test { + useJUnitPlatform() +} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/HeadlessMessageTaker.java b/regi-headless/src/main/java/usace/rowcps/headless/HeadlessMessageTaker.java index 4369a50..8ec109e 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/HeadlessMessageTaker.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/HeadlessMessageTaker.java @@ -37,13 +37,13 @@ public void addMessage(String string, Message msg) logger.log(Level.INFO, "{0} {1}", new String[]{string, msg.toString()}); } -// @Override + @Override public void addMessage(String string, String string1, boolean showProgress) { logger.log(Level.INFO, "{0} {1}", new String[]{string, string1}); } -// @Override + @Override public void addMessage(String string, Message msg, boolean showProgress) { logger.log(Level.INFO, "{0} {1}", new String[]{string, msg.toString()}); diff --git a/regi-headless/src/main/java/usace/rowcps/headless/HeadlessRegiDomainFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/HeadlessRegiDomainFactory.java index f631bf0..494dd94 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/HeadlessRegiDomainFactory.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/HeadlessRegiDomainFactory.java @@ -1,29 +1,30 @@ package usace.rowcps.headless; -import com.rma.io.FileManager; -import com.rma.io.FileManagerImpl; import com.rma.io.RmaFile; -import com.rma.model.Manager; import com.rma.model.Project; +import hec.db.DataAccessFactory; import hec.db.DbConnectionException; +import hec.db.DbIoException; import hec.db.DbPluginNotFoundException; -import hec.db.InvalidDbConnectionException; -import hec.io.Identifier; +import hec.db.cwms.CwmsSecurityDao; import hec.lang.LoginException; +import hec.serversuite.ServerSuite; import hec.serversuite.ServerSuiteUtil; -import hec.serversuite.data.DirectOracleAuthenticationSource; -import java.io.File; -import java.util.List; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; +import mil.army.usace.hec.serversuite.cda.CdaAuthenticationSource; +import mil.army.usace.hec.serversuite.cda.CwmsApiKeyAuthExtension; import rma.services.ServiceLookup; import rma.services.tz.TimeZoneDisplayService; +import usace.rowcps.regi.executor.ManagerIdType; import usace.rowcps.regi.factories.RegiDomainFactory; import usace.rowcps.regi.interfaces.model.ManagerIdProvider; import usace.rowcps.regi.model.DatabaseConnectionManager; import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.executor.ManagerIdType; - import usace.rowcps.regi.model.RegiDomain; /** @@ -34,121 +35,72 @@ public class HeadlessRegiDomainFactory { private static final Logger logger = Logger.getLogger(HeadlessRegiDomainFactory.class.getName()); + private final ManagerIdProvider idProvider = buildNewProvider(); - public void setPluginsDirFromClasspath() - { - String cp = System.getProperties().getProperty("java.class.path"); - String[] split = cp.split(File.pathSeparator); - final String dbiClientjar = "dbiClient-v3.1.1.jar"; - for (String cpentry : split) { - if (cpentry.endsWith(dbiClientjar)) { - String pluginDir = cpentry.split(dbiClientjar)[0]; - logger.log(Level.INFO, "Setting plugin dir to: {0}", pluginDir); - System.setProperty("PLUGINS", pluginDir); - } - } - } + public RegiDomain createDomain() throws DbConnectionException, + DbPluginNotFoundException, IOException { - public RegiDomain createDomain(CLIOptions options, ManagerId managerId) throws DbConnectionException, - DbPluginNotFoundException, InvalidDbConnectionException - { - RegiDomain regiDomain = null; - - setPluginsDirFromClasspath(); - File rowcpsPojectDir = options.getRowcpsProjectDir(); - - String rowcpsProjectName = options.getRowcpsProjectName(); - logger.log(Level.INFO, "Creating project dir: "+ (rowcpsPojectDir == null ? "null" : rowcpsPojectDir), rowcpsProjectName == null ? "null" : rowcpsProjectName); - File projectDir = new File(rowcpsPojectDir, rowcpsProjectName); - - if (projectDir == null) { - String missingProjDirMessage - = "A Rowcps Project Dir is required and must be specified on the command line or in a properties file."; - throw new IllegalArgumentException(missingProjDirMessage); - } else { - if (!projectDir.exists()) { - // If we are being run headlessly I'm not sure how much hand-holding and sanity checking we have to do. - projectDir.mkdirs(); - if (!projectDir.exists()) { - throw new IllegalArgumentException("The directory " + projectDir.getAbsolutePath() + - " did not exist and could not be created."); - } - } - - String testProjDir = projectDir.getAbsolutePath(); - FileManager fileManager = FileManagerImpl.getFileManager(); - final String projectFilePath = testProjDir + "/" + options.getRowcpsProjectName() + ".prj"; - - RmaFile prjFile; - if (!fileManager.fileExists(projectFilePath)) { - final Identifier identifier = new Identifier(projectFilePath); - Identifier prjId = fileManager.createFile(identifier); - prjFile = fileManager.getFile(prjId.getPath()); - } else { - prjFile = fileManager.getFile(projectFilePath); - } + Path projectDir = Paths.get("regi-projects", "regi-cli"); + logger.log(Level.INFO, "Creating project dir: "+ projectDir); + Files.createDirectories(projectDir); - logger.log(Level.INFO, "Temp project file: " + prjFile.getAbsolutePath()); + Path projectFile = projectDir.resolve("regi-cli.prj"); + if(!Files.exists(projectFile)) { + Files.createFile(projectFile); + } - File projReportsDir = new File(projectDir, "reports"); - File projXmlDir = new File(projectDir, "xml"); - projReportsDir.mkdir(); - projXmlDir.mkdir(); + Files.createDirectories(projectDir.resolve("reports")); + Files.createDirectories(projectDir.resolve("xml")); - String name = "Headless"; - String description = "Created for Headless execution."; - regiDomain = new RegiDomainFactory().createProject(name, description, prjFile); + String name = "Headless"; + String description = "Created for Headless execution."; + RegiDomain regiDomain = new RegiDomainFactory().createProject(name, description, new RmaFile(projectFile.toAbsolutePath().toString())); - regiDomain.loadProjectFile(); + regiDomain.loadProjectFile(); - DatabaseConnectionManager connectionManager = (DatabaseConnectionManager) regiDomain.getManager( - RegiDomain.DOMAIN_CONNECTION_MANAGER, DatabaseConnectionManager.class); + DatabaseConnectionManager connectionManager = (DatabaseConnectionManager) regiDomain.getManager( + RegiDomain.DOMAIN_CONNECTION_MANAGER, DatabaseConnectionManager.class); - if (connectionManager == null) { - connectionManager = regiDomain.buildDatabaseConnectionManager(); - } + if (connectionManager == null) { + connectionManager = regiDomain.buildDatabaseConnectionManager(); + } - //conigure the database connection. - String dbUrl = options.getOracleUrl(); - String username = options.getOracleUser(); - char[] password = options.getOraclePassword(); - String tzId = options.getRowcpsTimezone(); - String officeId = options.getOracleOfficeId(); + String cdaUrl = System.getenv("CDA_URL"); + String apiKey = System.getenv("API_KEY"); + String officeId = System.getenv("OFFICE_ID"); - DirectOracleAuthenticationSource directOracleAuthenticationSource = new DirectOracleAuthenticationSource("", dbUrl, officeId); - connectionManager.setTimeZoneId(tzId); - connectionManager.setUsername(username); + CdaAuthenticationSource cdaAuthenticationSource = new CdaAuthenticationSource("", cdaUrl, officeId, new CwmsApiKeyAuthExtension(apiKey)); + try + { + ServerSuite serverSuite = ServerSuiteUtil.login("REGI CLI", cdaAuthenticationSource, false, false, false); + DataAccessFactory dataAccessFactory = serverSuite.getDataAccessFactory(); + try(var key = dataAccessFactory.getDataAccessKey("REGI CLI")) { + String username = dataAccessFactory.getDao(CwmsSecurityDao.class).getCurrentUserId(key); + connectionManager.setUsername(username); + } + connectionManager.setTimeZoneId("UTC"); connectionManager.setUserOfficeId(officeId); connectionManager.saveData(); - TimeZoneDisplayService tsDS = ServiceLookup.getTimeZoneDisplayService(); tsDS.setTimeZone(connectionManager.getTimeZone()); - try - { - ServerSuiteUtil.login("REGI Headless", directOracleAuthenticationSource, username, password); - } - catch(LoginException ex) - { - throw new DbConnectionException(ex); - } - regiDomain.connect(ServerSuiteUtil.getServerSuite()); - List managerList = regiDomain.getManagerList(); - + regiDomain.getManagerList(); regiDomain.saveProject(); + RegiDomain.setCurrentProject(regiDomain); Project.setCurrentProject(regiDomain); + return regiDomain; + } + catch(LoginException | DbIoException ex) + { + throw new DbConnectionException(ex); } - return regiDomain; } - public ManagerId getManagerId(CLIOptions opt) + public ManagerId getManagerId() { - ManagerId retval = idProvider.getManagerId(); - - return retval; + return idProvider.getManagerId(); } - private ManagerIdProvider idProvider = buildNewProvider(); private static ManagerIdProvider buildNewProvider() { diff --git a/regi-headless/src/main/java/usace/rowcps/headless/LoggingOptions.java b/regi-headless/src/main/java/usace/rowcps/headless/LoggingOptions.java index c955c60..70c3559 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/LoggingOptions.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/LoggingOptions.java @@ -9,7 +9,7 @@ import java.util.logging.Logger; import usace.rowcps.headless.metrics.RegiHeadlessMetricsServiceProvider; import usace.rowcps.metrics.RegiMetricsService; -import wcds.dbi.DbiProperties; +import hec.db.cwms.DbiProperties; /** * diff --git a/regi-headless/src/main/java/usace/rowcps/headless/PythonEvaluator.java b/regi-headless/src/main/java/usace/rowcps/headless/PythonEvaluator.java index 32b1b74..a40a329 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/PythonEvaluator.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/PythonEvaluator.java @@ -27,22 +27,9 @@ public Object evaluateExpression(Reader reader, Map variables) // I think this would let us restrict the classes loadable by python. ClassLoader ctxtLoader = Thread.currentThread().getContextClassLoader(); -// try { -// Class aClass = ctxtLoader.loadClass("usace.rowcps.regi.model.AtLocationMananger"); -// } catch (ClassNotFoundException ex) { -// Logger.getLogger(PythonEvaluator.class.getName()).log(Level.SEVERE, null, ex); -// } ScriptEngineManager scriptManager = new ScriptEngineManager(ctxtLoader); ScriptEngine pythonEngine = scriptManager.getEngineByName(ENGINE_NAME); -// if (pythonEngine instanceof (PyScriptEngine)) { -// (PyScriptEngine) object = ((PyScriptEngine)) pythonEngine; -// -// } - - //new PythonScriptContainer() - //ScriptEngineFactory factory = pythonEngine.getFactory(); - SimpleScriptContext context = (SimpleScriptContext) pythonEngine.getContext(); Object javaValue = null; diff --git a/regi-headless/src/main/java/usace/rowcps/headless/RegiCLI.java b/regi-headless/src/main/java/usace/rowcps/headless/RegiCLI.java index b4dc93f..17dc332 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/RegiCLI.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/RegiCLI.java @@ -1,5 +1,6 @@ package usace.rowcps.headless; +import java.io.IOException; import usace.rowcps.headless.interfaces.ScriptEvaluator; import hec.db.DbConnectionException; import hec.db.DbIoException; @@ -45,7 +46,7 @@ public static void main(String[] args) { runHeadless(parser, args, opt); } - catch (DbConnectionException | DbPluginNotFoundException | InvalidDbConnectionException ex) + catch (DbConnectionException | DbPluginNotFoundException | InvalidDbConnectionException | IOException ex) { LOGGER.log(Level.SEVERE, "Headless error connecting to database.", ex); System.exit(-1); @@ -73,21 +74,23 @@ public static void main(String[] args) * @throws CmdLineException * @throws DbPluginNotFoundException */ - static void runHeadlessTest(String[] args) throws DbConnectionException, InvalidDbConnectionException, CmdLineException, DbPluginNotFoundException - { + static void runHeadlessTest(String[] args) + throws DbConnectionException, InvalidDbConnectionException, CmdLineException, DbPluginNotFoundException, + IOException { CLIOptions opt = new CLIOptions(System.getProperties()); CmdLineParser parser = new CmdLineParser(opt); runHeadless(parser, args, opt); } - private static void runHeadless(CmdLineParser parser, String[] args, CLIOptions opt) throws DbConnectionException, InvalidDbConnectionException, CmdLineException, DbPluginNotFoundException - { + private static void runHeadless(CmdLineParser parser, String[] args, CLIOptions opt) + throws DbConnectionException, InvalidDbConnectionException, CmdLineException, DbPluginNotFoundException, + IOException { parser.parseArgument(args); System.setProperties(opt.getProperties()); HeadlessRegiDomainFactory factory = new HeadlessRegiDomainFactory(); - ManagerId managerId = factory.getManagerId(opt); - RegiDomain regiDomain = factory.createDomain(opt, managerId); + ManagerId managerId = factory.getManagerId(); + RegiDomain regiDomain = factory.createDomain(); if (regiDomain != null) { diff --git a/regi-headless/src/main/java/usace/rowcps/headless/SimpleFactoryRegistry.java b/regi-headless/src/main/java/usace/rowcps/headless/SimpleFactoryRegistry.java index 2bb5d1c..c4d0368 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/SimpleFactoryRegistry.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/SimpleFactoryRegistry.java @@ -30,16 +30,6 @@ public Collection getFactories() return factories; } -// public void printNames() -// { -// CalcFactoryRegistry aDefault = getRegistry(DEFAULT_VERSION); -// Collection factories = aDefault.getFactories(); -// for (ScriptableCalcFactory factory : factories) { -// //System.out.println("Found factory:" + factory.getName()); -// logger.log(Level.FINE, "Found factory:" + factory.getName()); -// } -// } - @Override public ScriptableCalcFactory getFactory(String name) { diff --git a/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportAssociations.java b/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportAssociations.java deleted file mode 100644 index af029f9..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportAssociations.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.assocexport; - -/** - * - * @author stephen - */ -public interface ScriptableExportAssociations -{ - /** - * Export all Time Series Associations in the database - * - * @param fileLoc The file to write the CSV to - * @param lineDelimiter the delimiter to use between lines (\n recommended) - * @param valueDelimiter The delimiter to use between values (\t - * recommended) - */ - public void exportAllTSAssociations(String fileLoc, String lineDelimiter, String valueDelimiter); - - /** - * Export the Time Series Associations for a given project - * - * @param project The project to export for - * @param fileLoc The file to write the CSV to - * @param lineDelimiter the delimiter to use between lines (\n recommended) - * @param valueDelimiter The delimiter to use between values (\t - * recommended) - */ - public void exportTSAssociations(String project, String fileLoc, String lineDelimiter, String valueDelimiter); -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportAssociationsFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportAssociationsFactory.java deleted file mode 100644 index 340e714..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportAssociationsFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.assocexport; - -import rma.services.annotations.ServiceProvider; -import usace.rowcps.headless.ScriptableCalcFactory; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.headless.sigstages.exportdb.ScriptableExportSigStagesImpl; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author stephen - */ -@ServiceProvider(service = ScriptableCalcFactory.class) -public class ScriptableExportAssociationsFactory implements ScriptableCalcFactory -{ - public ScriptableExportAssociationsFactory() - { - } - - @Override - public String getName() - { - return "Export Associations"; - } - - @Override - public String getDescription() - { - return "Exports some or all of the Associations in the database."; - } - - @Override - public String getUsage() - { - return ""; - } - - @Override - public ScriptableCalc build(RegiDomain regiDomain, ManagerId managerid) - { - return new ScriptableExportTSAssociationsImpl(regiDomain, managerid); - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportTSAssociationsImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportTSAssociationsImpl.java deleted file mode 100644 index 137f348..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/assocexport/ScriptableExportTSAssociationsImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.assocexport; - -import hec.data.location.LocationTemplate; -import hec.data.project.AtProjectDescriptor; -import hec.data.project.IProject; -import hec.data.project.IProjectCatalog; -import hec.db.DbConnectionException; -import hec.db.DbIoException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.NavigableMap; -import java.util.Objects; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import usace.rowcps.data.association.IAssociationProvider; -import usace.rowcps.data.association.ITimeSeriesAssociation; -import usace.rowcps.data.outputformatter.CSVOutputFormatter; -import usace.rowcps.data.outputformatter.OutputFormatter; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.AtAssociationCache; -import usace.rowcps.regi.model.CacheUsage; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; -import usace.rowcps.regi.status.AtProjectManager; - -/** - * - * @author stephen - */ -public class ScriptableExportTSAssociationsImpl implements ScriptableExportAssociations, ScriptableCalc -{ - private final ManagerId _managerId; - private final RegiDomain _regiDomain; - private static final Logger LOGGER = Logger.getLogger(ScriptableExportTSAssociationsImpl.class.getSimpleName()); - private static final String GLOBAL = "?GLOBAL?"; - - public ScriptableExportTSAssociationsImpl(RegiDomain regiDomain, ManagerId managerId) - { - _managerId = managerId; - _regiDomain = regiDomain; - } - - private List getAllProjects() - { - try - { - AtProjectManager manager = _regiDomain.getAtProjectManager(_managerId); - IProjectCatalog projectCatalog = manager.getProjectCatalog(CacheUsage.NORMAL); - List projectDescriptorList = projectCatalog.getProjectDescriptorList(); - - Set templatesForDescriptors = projectDescriptorList.stream() - .map(projDesc -> projDesc.getProjectLocationRef()) - .filter(Objects::nonNull) - .collect(Collectors.toSet()); - - NavigableMap iProjects = manager.getIProjects(templatesForDescriptors, CacheUsage.NORMAL); - - return new ArrayList<>(iProjects.values()); - } - catch(DbConnectionException | DbIoException ex) - { - LOGGER.log(Level.SEVERE, "Error Retrieving Associations!", ex); - return Collections.emptyList(); - } - } - - @Override - public void exportAllTSAssociations(String fileLoc, String lineDelimiter, String valueDelimiter) - { - OutputFormatter formatter = new CSVOutputFormatter(lineDelimiter, valueDelimiter); - List allProjects = getAllProjects(); - for(IProject project : allProjects) - { - configureFormatter(formatter, project.getProjectId()); - AtAssociationCache atAssociationCache = _regiDomain.getAtAssociationCache(_managerId); - IAssociationProvider timeSeriesAssociationProvider = atAssociationCache.getTimeSeriesAssociationsProvider(project.getLocation().getLocationTemplate()); - if(timeSeriesAssociationProvider != null) - { - timeSeriesAssociationProvider.serializeToFormat(formatter); - } - } - formatter.write(fileLoc); - } - - private IProject getProject(String projName) - { - try - { - AtProjectManager manager = _regiDomain.getAtProjectManager(_managerId); - IProjectCatalog projectCatalog = manager.getProjectCatalog(CacheUsage.NORMAL); - List projectDescriptorList = projectCatalog.getProjectDescriptorList(); - - Set templatesForDescriptors = projectDescriptorList.stream() - .map(projDesc -> projDesc.getProjectLocationRef()) - .filter(Objects::nonNull) - .filter(projDesc -> projDesc.getLocationId().equals(projName)) - .collect(Collectors.toSet()); - - NavigableMap iProjects = manager.getIProjects(templatesForDescriptors, CacheUsage.NORMAL); - - return iProjects.values().stream() - .filter(project -> project.getProjectId().equals(projName)) - .findFirst() - .orElse(null); - } - catch(DbConnectionException | DbIoException ex) - { - LOGGER.log(Level.SEVERE, "Error Retrieving Associations!", ex); - return null; - } - } - - @Override - public void exportTSAssociations(String projectId, String fileLoc, String lineDelimiter, String valueDelimiter) - { - OutputFormatter formatter = new CSVOutputFormatter(lineDelimiter, valueDelimiter); - IProject project = getProject(projectId); - if(project == null) - { - LOGGER.log(Level.SEVERE, "Error: Project with name {0} unable to be retrieved.", project); - } - else - { - configureFormatter(formatter, project.getProjectId()); - AtAssociationCache atAssociationCache = _regiDomain.getAtAssociationCache(_managerId); - IAssociationProvider timeSeriesAssociationProvider = atAssociationCache.getTimeSeriesAssociationsProvider(project.getLocation().getLocationTemplate()); - if(timeSeriesAssociationProvider != null) - { - timeSeriesAssociationProvider.serializeToFormat(formatter); - } - else - { - LOGGER.log(Level.SEVERE, "Error: Project with name {0} has no TS associations provider.", project); - } - formatter.write(fileLoc); - } - } - - private void configureFormatter(OutputFormatter formatter, String projectId) - { - formatter.addReplacementString(GLOBAL, projectId); - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/gatesettings/ScriptableGateSettingsImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/gatesettings/ScriptableGateSettingsImpl.java index 0e9329e..544f0d9 100644 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/gatesettings/ScriptableGateSettingsImpl.java +++ b/regi-headless/src/main/java/usace/rowcps/headless/calculator/gatesettings/ScriptableGateSettingsImpl.java @@ -81,7 +81,6 @@ import usace.rowcps.data.project.TsUsageId; import usace.rowcps.headless.calculator.AbstractScriptableCalc; import usace.rowcps.headless.calculator.inflow.AbstractThreadedBlockRetriever; -import static usace.rowcps.headless.calculator.status.ScriptableStatusGraphicImpl.LATCH_SECONDS; import usace.rowcps.headless.interfaces.ScriptableCalc; import usace.rowcps.metrics.RegiMetricsService; import usace.rowcps.regi.event.IThreadedBlockRetriever; @@ -103,6 +102,7 @@ public class ScriptableGateSettingsImpl extends AbstractScriptableCalc implements ScriptableCalc, ScriptableGateSettings { + public final static String LATCH_SECONDS = "rowcps.latchseconds"; private static final Logger LOGGER = Logger.getLogger(ScriptableGateSettings.class.getName()); public ScriptableGateSettingsImpl(RegiDomain regiDomain, ManagerId managerId) { diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/poolpercent/PoolPercentCalcFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/poolpercent/PoolPercentCalcFactory.java deleted file mode 100644 index 724ec2b..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/poolpercent/PoolPercentCalcFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -package usace.rowcps.headless.calculator.poolpercent; - -import rma.services.annotations.ServiceProvider; -import usace.rowcps.headless.ScriptableCalcFactory; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author ryan - */ -@ServiceProvider(service = ScriptableCalcFactory.class) -public class PoolPercentCalcFactory implements ScriptableCalcFactory -{ - - @Override - public String getName() - { - return "Pool Percent"; - } - - @Override - public String getDescription() - { - return "Recalculates Pool Percentages at a Location"; - } - - @Override - public String getUsage() - { - return ""; - } - - @Override - public ScriptableCalc build(RegiDomain regiDomain, ManagerId managerid) - { - return new ScriptablePoolPercentImpl(regiDomain, managerid); - } - -} \ No newline at end of file diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/poolpercent/ScriptablePoolPercentImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/poolpercent/ScriptablePoolPercentImpl.java deleted file mode 100644 index c4c278c..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/poolpercent/ScriptablePoolPercentImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -package usace.rowcps.headless.calculator.poolpercent; - -import hec.data.TimeWindow; -import hec.data.location.LocationTemplate; -import hec.data.project.IProject; -import hec.db.DbConnectionException; -import hec.db.DbIoException; -import usace.metrics.services.Metrics; -import usace.rowcps.computation.pool.DbCommitPoolCalc; -import usace.rowcps.data.pool.DbPool; -import usace.rowcps.data.pool.PoolTimeSeries; -import usace.rowcps.data.pool.RegiPool; -import usace.rowcps.headless.calculator.AbstractScriptableCalc; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.metrics.RegiMetricsService; -import usace.rowcps.regi.model.CacheUsage; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.OptionalParams; -import usace.rowcps.regi.model.RegiDomain; -import usace.rowcps.regi.pool.AtPoolManager; -import usace.rowcps.regi.status.AtProjectManager; - -import java.util.Date; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * - * @author ryan - */ -public class ScriptablePoolPercentImpl extends AbstractScriptableCalc implements ScriptableCalc -{ - - private static final Logger LOGGER = Logger.getLogger(ScriptablePoolPercentImpl.class.getName()); - - public ScriptablePoolPercentImpl(RegiDomain regiDomain, ManagerId managerId) - { - super(regiDomain, managerId); - } - - public void calculatePoolPercents(String officeId, String locationStr, Date startDate, Date endDate) - { - LocationTemplate locRef = new LocationTemplate(officeId, locationStr); - - Metrics metrics = RegiMetricsService.createMetrics(this.getClass().getSimpleName(), "calculatePoolPercents"); - OptionalParams funcParams = new OptionalParams(metrics); - - LOGGER.log(Level.INFO, "Calculating Pool Percents for {0} from: {1} to: {2}", new Object[]{locRef, startDate, endDate}); - DbCommitPoolCalc poolCalc = new DbCommitPoolCalc(); - AtPoolManager poolMan = regiDomain.getAtPoolManager(managerId); - AtProjectManager projectMan = regiDomain.getAtProjectManager(managerId); - - try - { - //Retrieval of the project also fills in the associations, this is required for the pool calculations. - IProject project = projectMan.getIProject(locRef, CacheUsage.NORMAL); - if (project == null) - { - LOGGER.log(Level.SEVERE, () -> "Unable to calculate pool time series. Project " + locRef + " does not exist."); - return; - } - - Set pools = poolMan.retrievePools(locRef, CacheUsage.NORMAL, funcParams); - pools.stream() - .filter(pool -> pool.getTsId() == null) - .filter(DbPool.class::isInstance) - .map(DbPool.class::cast) - .forEach(pool -> pool.getMetaData().setTsId(retrieveDefaultTsId(pool))); - - TimeWindow tw = new TimeWindow(startDate, true, endDate, true); - - poolCalc.calcTimeSeries(getRegiDomain(), getManagerId(), pools, tw, funcParams); - - LOGGER.log(Level.INFO, "Calculated Pool Percents for {0} from: {1} to: {2}", new Object[]{locRef, startDate, endDate}); - } - catch (DbConnectionException | DbIoException ex) - { - LOGGER.log(Level.SEVERE, "Unable to calculate pool time series data.", ex); - } - } - - // Based on method from PoolsPanel - public String retrieveDefaultTsId(RegiPool pool) - { - LocationTemplate template = pool.getLocationRef(); - String output = AtProjectManager.getDefaultPoolTimeSeriesIdMask(template); - AtProjectManager projMan = regiDomain.getAtProjectManager(managerId); - try - { - output = projMan.retrievePoolTimeSeriesIdMask(template); - } - catch (DbConnectionException | DbIoException ex) - { - LOGGER.log(Level.SEVERE, "Unable to retrieve elevation time series association for " + template.getLocationId() + ". Defaulting to " + output, ex); - } - - String poolName = pool.getPoolName(); - if (poolName.length() > PoolTimeSeries.MAX_POOL_NAME_LENGTH) - { - poolName = poolName.substring(0, PoolTimeSeries.MAX_POOL_NAME_LENGTH); - } - - return output.replace(AtProjectManager.POOL_NAME_MASK, poolName); - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/HeadlessBasinPieAnnotationLayer.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/HeadlessBasinPieAnnotationLayer.java deleted file mode 100644 index 63665cc..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/HeadlessBasinPieAnnotationLayer.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018 - * United States Army Corps of Engineers - Hydrologic Engineering Center (USACE/HEC) - * All Rights Reserved. USACE PROPRIETARY/CONFIDENTIAL. - * Source may not be released without written approval from HEC - */ -package usace.rowcps.headless.calculator.status; - -import com.rma.ui.pinnable.IPinnableComponentContainer; -import com.rma.ui.pinnable.PinnableComponentManager; -import hec.data.location.LocationGroup; -import hec.data.location.LocationTemplate; -import java.util.List; -import usace.rowcps.basinpie.ui.annotations.BasinPieAnnotationLayer; -import usace.rowcps.data.maptemplate.annotations.AnnotationData; -import usace.rowcps.data.maptemplate.annotations.BarChartAnnotationPayload; -import usace.rowcps.data.maptemplate.annotations.PieChartAnnotationPayload; -import usace.rowcps.decisionsupport.ui.annotations.chartpanel.BarChartAnnotationPanel; -import usace.rowcps.regi.interfaces.model.ManagerIdProvider; - -/** - * - * @author josh - */ -public class HeadlessBasinPieAnnotationLayer extends BasinPieAnnotationLayer -{ - - private final List _activeLocations; - - public HeadlessBasinPieAnnotationLayer(ManagerIdProvider managerIdProvider, - LocationGroup locationGroup, List activeLocations) - { - super(managerIdProvider, locationGroup); - _activeLocations = activeLocations; - } - - @Override - protected List getActiveLocations() - { - return _activeLocations; - } - - @Override - public void addAnnotation(AnnotationData annotationData) - { - IPinnableComponentContainer iPinnableComponentContainer = createAnnotation(annotationData); - if (iPinnableComponentContainer != null) - { - PinnableComponentManager pcm = PinnableComponentManager.getManager(this); - pcm.addPinnableComponent(iPinnableComponentContainer); - - applyAnnotationData(iPinnableComponentContainer, annotationData, true); - annotationData.addPropertyChangeListener(this); - } - } - - public void updateBarChartGraphics() - { - getContainers().keySet().stream() - .filter(BarChartAnnotationPanel.class::isInstance) - .map(BarChartAnnotationPanel.class::cast) - .forEach(BarChartAnnotationPanel::updateBarChart); - } - - @Override - protected void updateAnnotationActiveProjects(AnnotationData data) - { - if (data.getPayload() instanceof PieChartAnnotationPayload) - { - PieChartAnnotationPayload payload = (PieChartAnnotationPayload) data.getPayload(); - payload.setActiveLocations(_activeLocations); - } - else if (data.getPayload() instanceof BarChartAnnotationPayload) - { - BarChartAnnotationPayload payload = (BarChartAnnotationPayload) data.getPayload(); - payload.setActiveLocations(_activeLocations); - } - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/LocationGroupFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/LocationGroupFactory.java deleted file mode 100644 index 9466111..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/LocationGroupFactory.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.calculator.status; - -import hec.data.basin.IBasin; -import hec.data.location.AssignedLocation; -import hec.data.location.LocationCategoryRef; -import hec.data.location.LocationGroup; -import hec.data.location.LocationGroupRef; -import hec.data.location.LocationTemplate; -import hec.data.project.IProject; -import hec.db.DbConnectionException; -import hec.db.DbException; -import hec.db.DbIoException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.NavigableMap; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import usace.metrics.services.Metrics; -import usace.metrics.services.Timer; -import usace.rowcps.computation.basinconnectivity.BasinConnectivityModel; -import usace.rowcps.metrics.RegiMetricsService; -import usace.rowcps.regi.basin.IBasinConnectivityLocation; -import usace.rowcps.regi.basin.IBasinConnectivityModel; -import usace.rowcps.regi.interfaces.model.ManagerIdProvider; -import usace.rowcps.regi.model.AtBasinManager; -import usace.rowcps.regi.model.CacheUsage; -import usace.rowcps.regi.model.OptionalParams; -import usace.rowcps.regi.model.RegiDomain; -import usace.rowcps.regi.status.AtProjectManager; - -/** - * - * @author josh - */ -public class LocationGroupFactory -{ - ManagerIdProvider _managerIdProvider; - NavigableMap _projectsMap; - Set _projectGroups; - final private BasinConnectivityModel _basinConnectivityModel; - RegiDomain _regiDomain; - - public LocationGroupFactory(ManagerIdProvider managerIdProvider) - { - _managerIdProvider = managerIdProvider; - _basinConnectivityModel = new BasinConnectivityModel(_managerIdProvider.getManagerId()); - _regiDomain = (RegiDomain) RegiDomain.getCurrentProject(); - loadProjectsMap(); - } - - /** - * This method returns the populated LocationGroup for "Project Group" - * with the given projectGroupId - * @param projectGroupId - * @return - */ - public LocationGroup retrieveProjectGroup(String projectGroupId) - { - OptionalParams params = OptionalParams.createForMetrics(getClass().getSimpleName(), "retrieveProjectGroup"); - LocationGroup retval = null; - Set projectGroups = getProjectGroups(params); - for(LocationGroup locGroup : projectGroups) - { - if(locGroup.getName().equalsIgnoreCase(projectGroupId)) - { - retval = locGroup; - break; - } - } - - return retval; - } - - private Set retrieveProjectGroups(OptionalParams params) - { - OptionalParams funcParams = OptionalParams.forMetrics(params, "retrieveProjectGroups"); - AtBasinManager atBasinManager = _regiDomain.getAtBasinManager(_managerIdProvider.getManagerId()); - Set projectGroups = new HashSet<>(); - - try - { - projectGroups.addAll(atBasinManager.getBasinCatalog(funcParams)); - } - catch(DbConnectionException | DbIoException ex) - { - Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Unable to retrieve ProjectGroup catalog from the database.", ex); - } - - return projectGroups; - } - - private Set getProjectGroups(OptionalParams params) - { - OptionalParams funcParams = OptionalParams.forMetrics(params, "getProjectGroups"); - if(_projectGroups != null && _projectGroups.size() > 0) - { - return _projectGroups; - } - else - { - _projectGroups = retrieveProjectGroups(funcParams); - } - - return _projectGroups; - } - - public LocationGroup retrieveLocationGroupForBasin(String basinId) - { - //try getting the IBasin from the AtBasinManager - IBasin basin = retrieveIBasin(basinId); - if(basin == null) - { - Logger.getLogger(LocationGroupFactory.class.getName()).log(Level.SEVERE, "Unable to retrieve Basin from CWMS database for BasinId: {0}", basinId); - return null; - } - - Metrics metrics = RegiMetricsService.createMetrics(getClass().getSimpleName(), "getLocationGroup"); - OptionalParams funcParams = new OptionalParams(metrics); - try(Timer.Context ctx = metrics.createTimer().start()) - { - LocationGroup lg = new LocationGroup(); - lg.setName(basin.getBasinId()); - lg.setDbOfficeId(basin.getOfficeId()); - lg.setLocationGroupRef(new LocationGroupRef(new LocationCategoryRef(AtBasinManager.BASIN_CATEGORY_REF_ID, basin.getOfficeId()), basin.getOfficeId(), basin.getBasinId())); - - //all stream locations are associated with the - LocationTemplate basinLocation = basin.getLocationTemplate(); - - if(!_basinConnectivityModel.isDataAvailableForLocation(basinLocation)) - { - _basinConnectivityModel.fillModel(basin, _projectsMap, funcParams); - } - - IBasinConnectivityLocation primaryStream = _basinConnectivityModel.getStreamBase(new LocationTemplate(basin.getOfficeId(), basin.getPrimaryStream())); - - List assignedLocations = buildAssignedLocations(primaryStream, basinLocation); - - for(int i = 0; i < assignedLocations.size(); i++) - { - assignedLocations.get(i).setAttribute(Double.valueOf(i)); - } - - lg.setAssignedLocations(new HashSet<>(assignedLocations)); - - return lg; - } - } - - /** - * This method returns the basin connectivity model that was populated - * by the retrieveLocationGroupForBasin() method. - * - * @return IBasinConnectivityModel - */ - public IBasinConnectivityModel getBasinConnectivityModel() - { - return _basinConnectivityModel; - } - - private List buildAssignedLocations(IBasinConnectivityLocation streamBase, LocationTemplate basinLocation) - { - List assignedLocations = new ArrayList<>(); - - LocationTemplate streamBaseLocation = streamBase.getLocationTemplate(); - - AssignedLocation aLoc = new AssignedLocation(streamBaseLocation, streamBase.getLocationId(), 0.0, basinLocation); - - aLoc.setDescription(" (" + streamBase.getLocationKind() + ")"); - - assignedLocations.add(aLoc); - - streamBase.getStreamBases().forEach(sbase -> assignedLocations.addAll(buildAssignedLocations(sbase, basinLocation))); - - return assignedLocations; - } - - private IBasin retrieveIBasin(String basinId) - { - IBasin retval = null; - AtBasinManager atBasinManager = _regiDomain.getAtBasinManager(_managerIdProvider.getManagerId()); - try - { - List allBasins = atBasinManager.retrieveAllBasins(CacheUsage.NORMAL, OptionalParams.createForMetrics(getClass().getSimpleName(), "retrieveIBasin", basinId)); - for(IBasin iBasin : allBasins) - { - if(iBasin.getBasinId().equalsIgnoreCase(basinId)) - { - retval = iBasin; - break; - } - } - } - catch (DbException ex) - { - Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error retrieving Basin:", ex); - } - return retval; - } - - private NavigableMap getProjectsMap() - { - if(_projectsMap != null) - { - return _projectsMap; - } - else - { - loadProjectsMap(); - } - return _projectsMap; - } - - private void loadProjectsMap() - { - AtBasinManager atBasinManager = _regiDomain.getAtBasinManager(_managerIdProvider.getManagerId()); - AtProjectManager atProjectManager = _regiDomain.getAtProjectManager(_managerIdProvider.getManagerId()); - Metrics metrics = RegiMetricsService.createMetrics(getClass().getSimpleName(), "getProejcts"); - OptionalParams funcParams = new OptionalParams(metrics); - try - { - _projectsMap = IBasinConnectivityModel.retrieveAllProjects(atBasinManager, atProjectManager, funcParams); - } - catch (DbIoException | DbConnectionException ex) - { - Logger.getLogger(LocationGroupFactory.class.getName()).log(Level.SEVERE, "Error loading projects map:", ex); - } - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/ScriptableStatusGraphicImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/ScriptableStatusGraphicImpl.java deleted file mode 100644 index 72b8568..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/ScriptableStatusGraphicImpl.java +++ /dev/null @@ -1,1151 +0,0 @@ -package usace.rowcps.headless.calculator.status; - -import com.rma.ui.pinnable.PinnableComponentGlassPane; -import com.rma.ui.pinnable.PinnableComponentGlassPaneFactory; -import com.rma.ui.pinnable.PinnableContainer; -import hec.data.location.AssignedLocation; -import hec.data.location.Location; -import hec.data.location.LocationGroup; -import hec.data.location.LocationTemplate; -import hec.data.project.IProject; -import hec.db.DbConnectionException; -import hec.db.DbIoException; -import hec.heclib.util.HecTime; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; -import usace.rowcps.data.maptemplate.IMapTemplate; -import usace.rowcps.data.maptemplate.streamplot.StreamGageGraphicOptionData; -import usace.rowcps.decisionsupport.ui.basintree.BasinTreeSelectionData; -import usace.rowcps.decisionsupport.ui.basintree.BasinTreeSelectionService; -import usace.rowcps.decisionsupport.ui.basintree.SimpleBasinTreeSelectionData; -import usace.rowcps.decisionsupport.ui.mappanel.template.impl.TimeInfoSource; -import usace.rowcps.decisionsupport.ui.streamplot.StreamData; -import usace.rowcps.decisionsupport.ui.streamplot.StreamPlotPanel; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.AtLocationManager; -import usace.rowcps.regi.model.AtMapTemplateManager; -import usace.rowcps.regi.model.CacheUsage; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; -import hec.map.geoui.interp.TimeInfo; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.LayoutManager; -import java.awt.image.BufferedImage; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.lang.reflect.InvocationTargetException; -import java.time.Instant; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.ServiceLoader; -import java.util.Set; -import java.util.SortedSet; -import java.util.TimeZone; -import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.FutureTask; -import java.util.concurrent.RunnableFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.logging.Level; -import javax.imageio.IIOImage; -import javax.imageio.ImageWriteParam; -import javax.imageio.ImageWriter; -import javax.swing.JComponent; -import javax.swing.JLayer; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; -import rma.services.GlobalServiceLoader; -import rma.services.GlobalServiceLoaderDelegate; -import usace.metrics.services.Metrics; -import usace.rowcps.metrics.RegiMetricsService; -import usace.rowcps.basinpie.ui.BasinPieModel; -import usace.rowcps.computation.services.CalcFlowGroupTimeSeriesService; -import usace.rowcps.data.charttemplate.IChartTemplate; -import usace.rowcps.data.maptemplate.graphicoptions.ReleasesGraphicOptionData; -import usace.rowcps.data.maptemplate.reservoir.ReservoirGraphicOptionData; -import usace.rowcps.decisionsupport.ui.graphics.releases.ReleasesGraphicData; -import usace.rowcps.decisionsupport.ui.graphics.utilities.GraphicConstants; -import usace.rowcps.headless.calculator.AbstractScriptableCalc; -import usace.rowcps.regi.interfaces.model.ProjectChildLocationCacheService; -import usace.rowcps.regi.model.AtChartTemplateManager; -import usace.rowcps.regi.model.OptionalParams; -import usace.rowcps.regi.ui.gfx2d.PiePanel; -import usace.rowcps.decisionsupport.ui.basintree.OperationSupportBasinTreeModel; -import usace.rowcps.mappanel.ui.template.MapTemplateLayer; -import usace.rowcps.decisionsupport.ui.basintree.BasinTreeModel; -import usace.rowcps.decisionsupport.ui.graphics.releases.ReleasesGraphicPanel; -import usace.rowcps.decisionsupport.ui.reservoirplot.ReservoirPlotPanel; -import usace.rowcps.decisionsupport.ui.reservoirplot.ReservoirPlotPanelData; -import usace.rowcps.mappanel.ui.MapPanelDateRangeService; -import usace.rowcps.mappanel.ui.SimpleMapPanelDateRange; -import usace.rowcps.regi.basin.IBasinConnectivityModel; -import usace.rowcps.regi.executor.FutureDescriptor; -import usace.rowcps.regi.status.AtProjectManager; - -/** - * - * @author ryan - */ -public class ScriptableStatusGraphicImpl extends AbstractScriptableCalc - implements ScriptableCalc -{ - private static final Logger LOGGER = Logger.getLogger(ScriptableStatusGraphicImpl.class.getName()); - public final static String LATCH_SECONDS = "rowcps.latchseconds"; - private final BasinTreeSelectionData _selectionData = new SimpleBasinTreeSelectionData(new ArrayList<>(), new LocationGroup()); - - public ScriptableStatusGraphicImpl(RegiDomain regiDomain, ManagerId manId) - { - super(regiDomain, manId); - System.setProperty("java.awt.headless", "true"); - } - - public void generateReservoirStatusImage(String officeId, String locationId, - String templateName, Date current, - final int width, final int height, - String filename) throws DbConnectionException, DbIoException, IOException, InterruptedException, ExecutionException, TimeoutException - { - SimpleMapPanelDateRange simpleDateRange = new SimpleMapPanelDateRange(current); - MapPanelDateRangeService.registerRange(getManagerId(), simpleDateRange); - - LocationTemplate locTemp = new LocationTemplate(officeId, locationId); - - TimeInfo utcTimeInfo = getUtcTimeInfo(current, regiDomain.getTimeZone()); - - TimeInfoSource utcTimeInfoSource = () -> utcTimeInfo; - - checkForKnownNeededServices(); - - MapTemplateLayer mtl = getMapTemplateLayer(templateName); - - ReservoirGraphicOptionData optionData = mtl.getGraphicsOptions(); - - CountDownLatch cdl = new CountDownLatch(1); - PropertyChangeListener pcl = (PropertyChangeEvent evt) -> - { - if (GraphicConstants.DATA_FILLED_EVENT.equals(evt.getPropertyName())) - { - cdl.countDown(); - } - }; - - optionData.addPropertyChangeListener(pcl); - - AtProjectManager atProjectManager = this.regiDomain.getAtProjectManager(managerId); - IProject iProject = atProjectManager.getIProject(locTemp, CacheUsage.NORMAL); - - ReservoirPlotPanelData plotPanelData = new ReservoirPlotPanelData(iProject, utcTimeInfoSource, managerId, optionData); - plotPanelData.addPropertyChangeListener(pcl); - - ReservoirPlotPanel reservoirPlotPanel; - - RunnableFuture panelFuture = new FutureTask<>(() -> new ReservoirPlotPanel(iProject, managerId, utcTimeInfoSource, plotPanelData)); - SwingUtilities.invokeLater(panelFuture); - reservoirPlotPanel = panelFuture.get(1, TimeUnit.MINUTES); - - Integer seconds = Integer.getInteger(LATCH_SECONDS, 11 * 60); // This one goes to 11... - boolean normalExit = cdl.await(seconds, TimeUnit.SECONDS); - if (!normalExit) - { - LOGGER.log(Level.WARNING, "Timeout exceeded loading reservoir status graphic data."); - } - - optionData.removePropertyChangeListener(pcl); - - // This next sleep is important b/c the latch gets set after the SwingWorker doInBackground complete but before done() - // are called. We need the done() methods to execute before we proceed. - Thread.sleep(2000); - - String imageFormat = getFormatFromFile(filename); - - Dimension d = computePreferredSize(reservoirPlotPanel, width, height); - - layoutAndSave(reservoirPlotPanel, d, filename, imageFormat); - } - - private Dimension computePreferredSize(Component comp, int requestedWidth, int requestedHeight) - { - comp.setPreferredSize(null); //Causes the component to recompute its pref size - Dimension prefSize = comp.getPreferredSize(); - Dimension reqSize = new Dimension(requestedWidth, requestedHeight); - - //This should prevent most clipping issues where the size provided is too small for the data. - return computeLargestDimension(prefSize, reqSize); - } - - private Dimension computeLargestDimension(Dimension dim1, Dimension dim2) - { - return new Dimension(Math.max(dim1.width, dim2.width), Math.max(dim1.height, dim2.height)); - } - - private boolean checkForKnownNeededServices() - { - boolean hasCalcFlow = hasGlobalService(CalcFlowGroupTimeSeriesService.class); - if (!hasCalcFlow) - { - ServiceLoader serviceLoader = ServiceLoader.load(CalcFlowGroupTimeSeriesService.class); - hasCalcFlow = hasService(CalcFlowGroupTimeSeriesService.class, serviceLoader); - } - - if (!hasCalcFlow) - { - String mesg = "The CalcFlowGroupTimeSeriesService was not found and is known to be needed by Regi Headless. " - + "Without this service the headless Status Graphic generation may not generate the correct values. " - + "Even if the necessary classes are in the classpath, the services may still not be found " - + "if the jars do not include the necessary META-INF services folder. " - + "For example, public-package-jars\\usace-rowcps-computation.jar contains implementation classes " - + "but not the service definitions."; - LOGGER.warning(mesg); - } - - boolean hasProjectChild = hasGlobalService(ProjectChildLocationCacheService.class); - if (!hasProjectChild) - { - String mesg = "A ProjectChildLocationCacheService was not found and is known to be needed by Regi Headless. " - + "Without this service the headless Status Graphic generation may not generate the correct values. " - + "Even if the necessary classes are in the classpath, the services may still not be found " - + "if the jars do not include the necessary META-INF services folder. " - + "For example, public-package-jars\\usace-rowcps-regi.jar contains implementation classes " - + "but not the service definitions."; - LOGGER.warning(mesg); - } - - return hasCalcFlow && hasProjectChild; - } - - private boolean hasGlobalService(Class klass) - { - GlobalServiceLoaderDelegate instance = GlobalServiceLoader.getInstance(); - ServiceLoader serviceLoader = instance.getServiceLoader(klass); - - return hasService(klass, serviceLoader); - } - - private boolean hasService(Class klass, ServiceLoader sl) - { - boolean hasCalcFlow = false; - ServiceLoader serviceLoader; - - GlobalServiceLoaderDelegate instance = GlobalServiceLoader.getInstance(); - serviceLoader = instance.getServiceLoader(klass); - - for (Object service : serviceLoader) - { - hasCalcFlow = true; - break; - } - return hasCalcFlow; - } - - public void generateStreamStatusImage(String officeId, String locationId, - String templateName, Date current, - final int width, final int height, - String filename) throws DbConnectionException, DbIoException, IOException, InterruptedException, ExecutionException, TimeoutException - { - - LocationTemplate locTemp = new LocationTemplate(officeId, locationId); - - AtLocationManager locMan = this.regiDomain.getAtLocationManager(getManagerId()); - Location loc = locMan.retrieveLocation(locTemp, CacheUsage.NORMAL); - - final TimeInfo ti = getUtcTimeInfo(current, this.regiDomain.getTimeZone()); - - TimeInfoSource timeInfoSource = () -> ti; - - SimpleMapPanelDateRange simpleDateRange = new SimpleMapPanelDateRange(current); - MapPanelDateRangeService.registerRange(getManagerId(), simpleDateRange); - - MapTemplateLayer mapTemplateLayer = getMapTemplateLayer(templateName); - - if(mapTemplateLayer == null) - { - LOGGER.log(Level.SEVERE, "Unable to locate MapTemplateLayer with the name:{0}", templateName); - return; - } - - StreamGageGraphicOptionData sggod = mapTemplateLayer.getStreamGageGraphicOptions(); - TimeZone timeZone = this.regiDomain.getTimeZone(); - final StreamData streamData = new StreamData(loc, sggod, timeInfoSource, timeZone, getManagerId()); - - final CountDownLatch cdl = new CountDownLatch(1); - PropertyChangeListener pcl = (PropertyChangeEvent evt) -> - { - if (GraphicConstants.DATA_FILLED_EVENT.equals(evt.getPropertyName())) - { - cdl.countDown(); - } - }; - - streamData.addPropertyChangeListener(pcl); - Future future = streamData.retrieveData(); - future.get(11, TimeUnit.MINUTES); //No return from this, but we need to wait until it's done. - - String imageFormat = getFormatFromFile(filename); - - StreamPlotPanel panel = new StreamPlotPanel(streamData); // Why is this building a panel on background thread? - - Dimension d = computePreferredSize(panel, width, height); - - layoutAndSave(panel, d, filename, imageFormat); - } - - public void generateReleasesStatusImage(String officeId, String locationId, - String templateName, Date current, - final int width, final int height, - String filename) throws DbConnectionException, DbIoException, IOException, InterruptedException, TimeoutException, ExecutionException - { - Metrics metrics = RegiMetricsService.createMetrics(getClass().getSimpleName()); - - MyReleasesGraphicData data = buildReleasesGraphicData(officeId, locationId, current, metrics); - - CompletableFuture future = data.retrieveOutletGroups(new OptionalParams(metrics)); - data.updateDataScopeSynchronous(new OptionalParams(metrics)); - LOGGER.log(Level.FINE, "(Headless)Data scope retrieval complete."); - future.get(); - LOGGER.log(Level.FINE, "(Headless)Retrieval of outlet groups complete."); - - //This needs to occur *after* all of the futures have been completed. - data.fireDataUpdateEvent(); - - saveReleasesToFile(data, width, height, filename); - } - - private MyReleasesGraphicData buildReleasesGraphicData(String officeId, String locationId, Date current, Metrics metrics) throws DbConnectionException, DbIoException - { - LocationTemplate locTemp = new LocationTemplate(officeId, locationId); - AtLocationManager locMan = this.regiDomain.getAtLocationManager(getManagerId()); - Location loc = locMan.retrieveLocation(locTemp, CacheUsage.NORMAL); - TimeInfo utcTimeInfo = getUtcTimeInfo(current, this.regiDomain.getTimeZone()); - TimeInfoSource utcTimeInfoSource = () -> utcTimeInfo; - SimpleMapPanelDateRange simpleDateRange = new SimpleMapPanelDateRange(current); - MapPanelDateRangeService.registerRange(getManagerId(), simpleDateRange); - ReleasesGraphicOptionData graphicOptionData = new ReleasesGraphicOptionData(); - - return new MyReleasesGraphicData(loc, managerId, utcTimeInfoSource, graphicOptionData, new OptionalParams(metrics)); - } - - private void saveReleasesToFile(ReleasesGraphicData data, int width, int height, String filename) - { - try - { - SwingUtilities.invokeAndWait(() -> - { - ReleasesGraphicPanel releasesGraphicPanel = new ReleasesGraphicPanel(false, true); - releasesGraphicPanel.setData(data); - - //This is a bit assinine, but it's used to massage the preferred sizes - //The detail component's pref size is constantly recomputed on paint....why? because science! and my youthful ignorance. - renderGraphic(releasesGraphicPanel); - renderGraphic(releasesGraphicPanel); - renderGraphic(releasesGraphicPanel); - renderGraphic(releasesGraphicPanel); - - Dimension imageDimension = computePreferredSize(releasesGraphicPanel, width, height); - String imageFormat = getFormatFromFile(filename); - - try - { - layoutAndSave(releasesGraphicPanel, imageDimension, filename, imageFormat); - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, "Unable to save to file " + filename, ex); - } - }); - } - catch (InterruptedException ex) - { - LOGGER.log(Level.SEVERE, "Event thread was interrupted", ex); - } - catch (InvocationTargetException ex) - { - LOGGER.log(Level.SEVERE, "An uncaught exception occurred on the Event Thread for generateReleasesStatusImage.", ex); - } - } - - private void renderGraphic(JComponent comp) - { - layoutComponent(comp, comp.getSize()); - BufferedImage img = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_ARGB); - Graphics2D g = img.createGraphics(); - comp.print(g); - computePreferredSize(comp, comp.getWidth(), comp.getHeight()); - } - - private void layoutComponent(JComponent component, Dimension d) - { - LayoutManager layout = component.getLayout(); - if (layout != null) - { - layout.layoutContainer(component); - } - component.setSize(d); - component.addNotify(); - component.invalidate(); - component.validate(); - component.addNotify(); - if (layout != null) - { - layout.layoutContainer(component); - } - } - - public static class MyReleasesGraphicData extends ReleasesGraphicData - { - private boolean _hasRetrieved = false; - - public MyReleasesGraphicData(Location loc, ManagerId manId, - TimeInfoSource tis, - ReleasesGraphicOptionData options, - OptionalParams optionalParams) - { - super(loc, manId, tis, options, optionalParams); - } - - @Override - public CompletableFuture updateDataScope(OptionalParams params) - { - if (!_hasRetrieved) - { - LOGGER.log(Level.FINE, "(Headless)Updating data scope"); - _hasRetrieved = true; - return super.updateDataScope(params); - } - return CompletableFuture.completedFuture(null); - } - - public void updateDataScopeSynchronous(OptionalParams params) throws InterruptedException, ExecutionException - { - updateDataScope(params).get(); - } - - @Override - public void fireDataUpdateEvent() - { - //Exposing this publicly - super.fireDataUpdateEvent(); //To change body of generated methods, choose Tools | Templates. - } - } - - public TimeInfo getUtcTimeInfo(Date current, TimeZone displayTimeZone) - { - // The time controls internally use HecTimes with utc values and Regi formats them to the display timezone in the ui - // components. - // In headless the user is giving us a Date object and a timezone that date object is in. - // So imagine the user wants a graphic displayed at midnight on 4/18 in CDT. Say that UTC is ahead of CDT by 5 hours - // so we need hectime to actually store the time at 5AM - HecTime utcStart = new HecTime(); - utcStart.setTimeInMillis(current.getTime()); - - Calendar endCal = Calendar.getInstance(displayTimeZone); - endCal.setTime(current); - endCal.add(Calendar.DAY_OF_MONTH, 1); - //truncate down to start of day // - HecTime utcEnd = new HecTime(); - utcEnd.setTimeInMillis(endCal.getTimeInMillis()); - - HecTime utcCurrent = new HecTime(); - utcCurrent.setTimeInMillis(current.getTime()); - - utcCurrent.showTimeAsBeginningOfDay(true); - - int stepSize = 1000 * 60 * 60; // millisPerHour - TimeInfo ti = new TimeInfo(utcStart, utcEnd, utcCurrent, stepSize); - return ti; - } - - private List getMapTemplates() throws DbIoException, DbConnectionException - { - RegiDomain currentProject = (RegiDomain) RegiDomain.getCurrentProject(); - final AtMapTemplateManager tm = currentProject.getAtMapTemplateManager(getManagerId()); - final List mapTemplates = tm.retrieveMapTemplates(currentProject.getUserOfficeId(), - CacheUsage.NORMAL); - return mapTemplates; - } - - private MapTemplateLayer getMapTemplateLayer(String templateName) throws DbIoException, DbConnectionException - { - //Map template layer will require this if we have an annotation layer. - BasinTreeSelectionData selectionData = BasinTreeSelectionService.getBasinTreeSelectionData(getManagerIdProvider().getManagerId()); - if (selectionData != _selectionData) - { - //_selectionData needs to be a class member, because both key and value are weak references. - BasinTreeSelectionService.registerBasinTreeSelectionData(getManagerIdProvider().getManagerId(), _selectionData); - } - - MapTemplateLayer retval = null; - List mapTemplates = getMapTemplates(); - IMapTemplate matching = find(templateName, mapTemplates); - - if (matching != null) - { - retval = new MapTemplateLayer(matching, getManagerIdProvider()); - } - - return retval; - } - - private IMapTemplate find(String templateName, - List mapTemplates) - { - IMapTemplate retval = null; - - if (mapTemplates != null && !mapTemplates.isEmpty() && templateName != null) - { - for (IMapTemplate mapTemplate : mapTemplates) - { - if (templateName.equalsIgnoreCase(mapTemplate.getName())) - { - retval = mapTemplate; - break; - } - } - } - - return retval; - } - - public void generateBasinPieImageForGroup(final String officeId, - final String locationStr, - final String groupId, - final Date date, final int width, - final int height, final String template, - final String file) throws Exception - { - String[] locations = new String[] {locationStr}; - Date[] dates = new Date[] {date}; - String[] templates = new String[]{template}; - generateBasinPieImagesForGroup(officeId, locations, groupId, dates, width, - height, templates, file); - } - - public void generateBasinPieImageForBasin(final String officeId, - final String locationStr, - final String basinId, - final Date date, final int width, - final int height, final String template, - final String file) throws Exception - { - String[] locations = new String[] {locationStr}; - Date[] dates = new Date[] {date}; - String[] templates = new String[]{template}; - generateBasinPieImagesForBasin(officeId, locations, basinId, dates, width, - height, templates, file); - } - -/** - * This method generates a suite a basin pie images for a given basin - * 1 basin pie image for each possible assigned location as a reference. - * - * @param officeId - * @param basinId - * @param dates - * @param width - * @param height - * @param templateIds - * @param file - * @throws Exception - */ - public void generateAllBasinPieImagesForBasin(final String officeId, - final String basinId, - final Date[] dates, - final int width, final int height, - final String[] templateIds, - final String file) throws Exception - { - LocationGroupFactory locationGroupFactory = new LocationGroupFactory(getManagerIdProvider()); - LocationGroup locationGroup = locationGroupFactory.retrieveLocationGroupForBasin(basinId); - - OperationSupportBasinTreeModel basinTreeModel = new OperationSupportBasinTreeModel(); - IBasinConnectivityModel basinConnModel = locationGroupFactory.getBasinConnectivityModel(); - basinTreeModel.fillBasinTree(locationGroup, basinConnModel); - - generateAllBasinPieImages(officeId, locationGroup, basinTreeModel, dates, width, height, templateIds, file); - } - - /** - * This method generates a suite a basin pie images for a given basin - * 1 basin pie image for each possible assigned location as a reference. - * - * @param officeId - * @param groupId - * @param dates - * @param width - * @param height - * @param templateIds - * @param file - * @throws Exception - */ - public void generateAllBasinPieImagesForGroup(final String officeId, - final String groupId, - final Date[] dates, - final int width, final int height, - final String[] templateIds, - final String file) throws Exception - { - LocationGroupFactory locationGroupFactory = new LocationGroupFactory(getManagerIdProvider()); - LocationGroup locationGroup = locationGroupFactory.retrieveProjectGroup(groupId); - - BasinTreeModel basinTreeModel = new BasinTreeModel(null); - basinTreeModel.fillBasinTree(locationGroup); - - generateAllBasinPieImages(officeId, locationGroup, basinTreeModel, dates, width, height, templateIds, file); - } - - private void generateAllBasinPieImages(final String officeId, - final LocationGroup locationGroup, - final BasinTreeModel basinTreeModel, - final Date[] dates, - final int width, final int height, - final String[] templateIds, - final String file) throws Exception - { - List referenceLocations = new ArrayList<>(); - - Set assignedLocations = locationGroup.getAssignedLocations(); - for (AssignedLocation assignedLocation : assignedLocations) - { - referenceLocations.add(assignedLocation.getLocRef()); - } - - List templates = getTemplates(templateIds, officeId); - final Dimension d = new Dimension(width, height); - String imageFormat = getFormatFromFile(file); - - generateImages(officeId, referenceLocations, locationGroup, basinTreeModel, dates, d, templates, file, imageFormat); - } - - public void generateBasinPieImagesForBasin(final String officeId, - final String locationStrs[], - final String basinId, - final Date[] dates, final int width, - final int height, - final String[] templateIds, - final String filename) throws Exception - { - System.setProperty("java.awt.headless", "true"); - if (width <= 0 || height <= 0) - { // is there a max? - LOGGER.warning("Width and Height parameters must be > 0"); - return; - } - - LocationGroupFactory locationGroupFactory = new LocationGroupFactory(getManagerIdProvider()); - LocationGroup locationGroup = locationGroupFactory.retrieveLocationGroupForBasin(basinId); - - OperationSupportBasinTreeModel basinTreeModel = new OperationSupportBasinTreeModel(); - IBasinConnectivityModel basinConnModel = locationGroupFactory.getBasinConnectivityModel(); - basinTreeModel.fillBasinTree(locationGroup, basinConnModel); - - List templates = getTemplates(templateIds, officeId); - - List locs = new ArrayList<>(); - for (String locationStr : locationStrs) - { - final LocationTemplate locRef = new LocationTemplate(officeId, locationStr); - locs.add(locRef); - } - - String imageFormat = getFormatFromFile(filename); - final Dimension dimension = new Dimension(width, height); - - generateImages(officeId, locs, locationGroup, basinTreeModel, dates, dimension, templates, filename, imageFormat); - } - - public void generateBasinPieImagesForGroup(final String officeId, - final String locationStrs[], - final String groupId, - final Date[] dates, final int width, - final int height, - final String[] templateIds, - final String filename) throws Exception - { - System.setProperty("java.awt.headless", "true"); - if (width <= 0 || height <= 0) - { // is there a max? - LOGGER.warning("Width and Height parameters must be > 0"); - return; - } - - LocationGroupFactory locationGroupFactory = new LocationGroupFactory(getManagerIdProvider()); - LocationGroup locationGroup = locationGroupFactory.retrieveProjectGroup(groupId); - BasinTreeModel treeModel = new BasinTreeModel(); - treeModel.fillBasinTree(locationGroup); - - List templates = getTemplates(templateIds, officeId); - - List locs = new ArrayList<>(); - for (String locationStr : locationStrs) - { - final LocationTemplate locRef = new LocationTemplate(officeId, locationStr); - locs.add(locRef); - } - - String imageFormat = getFormatFromFile(filename); - final Dimension dimension = new Dimension(width, height); - - generateImages(officeId, locs, locationGroup, treeModel, dates, dimension, templates, filename, imageFormat); - } - - public void generateImages(String officeId, - List referenceLocations, - LocationGroup locationGroup, - BasinTreeModel treeModel, - Date[] dates, - Dimension d, - List templates, - String filePattern, String imageFormat) - throws ExecutionException, DbConnectionException, InterruptedException - { - SortedSet dateSet = new TreeSet<>(); - dateSet.addAll(Arrays.asList(dates)); - - Date startDate = dateSet.first(); - Date endDate = dateSet.last(); - - for (IChartTemplate chartTemplate : templates) - { - LOGGER.log(Level.INFO, "Generating images for template:{0}", chartTemplate.getId()); - BasinPieModel pieModel = buildAndInitializeBasinPieModel(locationGroup, chartTemplate, startDate, endDate, treeModel); - - for (Date date : dateSet) - { - for (LocationTemplate locRef : referenceLocations) - { - String file = getFileName(date, filePattern, locRef.getLocationId(), imageFormat, chartTemplate.getIdSuffix(), officeId, locationGroup.getName(), d.width, d.height); - drawImage(treeModel, locRef, pieModel, d, date, file, imageFormat); - } - } - } - } - - public List getTemplates(final String[] templateIds, - final String officeId) throws DbConnectionException, DbIoException - { - List templates = new ArrayList<>(); - AtChartTemplateManager chartTemplateManager = regiDomain.getAtChartTemplateManager(managerId); - for (String template : templateIds) - { - String templateId = IChartTemplate.CHART_TEMPLATE_CATEGORY_ID + "." + officeId + "." + template; - - IChartTemplate chartTemplate = chartTemplateManager.retrieveChartTemplate(officeId, templateId, CacheUsage.NORMAL); - if (chartTemplate == null) - { - // try again using the user-provided string. - chartTemplate = chartTemplateManager.retrieveChartTemplate(officeId, template, CacheUsage.NORMAL); - } - - if (chartTemplate == null) - { - LOGGER.log(Level.WARNING, "Could not locate chart:{0}", templateId); - } - else - { - templates.add(chartTemplate); - } - - } - return templates; - } - - public static String getFileName(Date date, final String filePattern, - final String locationStr, - String imageFormat, String chartTemplate, - String officeId, String basinId, int width, - int height) - { - - String dateStr = getDateString(date); - - SimpleTemplateEngine engine = new SimpleTemplateEngine(); - engine.addPattern("date", dateStr); - engine.addPattern("office_id", officeId); - engine.addPattern("location_id", locationStr); - engine.addPattern("chart_template_id", chartTemplate); - engine.addPattern("basin_id", basinId); - engine.addPattern("image_format", imageFormat); - engine.addPattern("width", Integer.toString(width)); - engine.addPattern("height", Integer.toString(height)); - - String filename = engine.makeReplacements(filePattern); -// Replace anything that isn't a-z or A-z or 0-9 or [:\/)(.-] with an underscore. - return filename.replaceAll("[^a-zA-Z0-9:\\\\\\/\\)\\(\\.\\- ]", "_"); - } - - public static String getDateString(Date date) - { - Instant asInstant = date.toInstant(); - String dateStr = asInstant.toString(); // like: 2017-02-24T22:23:21.149Z - dateStr = dateStr.replaceAll(":", "_"); - return dateStr; - } - - public void drawImage(BasinTreeModel treeModel, - LocationTemplate locRef, - BasinPieModel pieModel, Dimension d, - Date date, String file, - String imageFormat) throws InterruptedException, ExecutionException - { - - final CountDownLatch latch = new CountDownLatch(1); - final SwingWorker worker = new SwingWorker() - { - @Override - protected Void doInBackground() throws Exception - { - List relavantLocations = treeModel.getRelevantLocations(locRef); - LOGGER.log(Level.INFO, "Found {0} locations relevant to {1}", new Object[] - { - relavantLocations.size(), locRef - }); - pieModel.setActiveLocations(relavantLocations, true); - - return null; - } - - @Override - protected void done() - { - try - { - LOGGER.log(Level.INFO, "Creating Basin Pie Panel."); - writeBasinImage(d, pieModel, date, file, imageFormat); - latch.countDown(); - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, null, ex); - } - } - }; - - worker.execute(); - - Void got = worker.get(); // This returns as soon as doInBackground finishes. - boolean normalExit = latch.await(Integer.getInteger(LATCH_SECONDS, 11 * 60), TimeUnit.SECONDS); - if (!normalExit) - { - LOGGER.log(Level.WARNING, "Exceeded timeout waiting for basin image to draw."); - } - - } - - public BasinPieModel buildAndInitializeBasinPieModel( - LocationGroup locationGroup, IChartTemplate chartTemplate, - Date startDate, Date endDate, - BasinTreeModel treeModel) throws InterruptedException - { - BasinPieModel pieModel = new BasinPieModel(managerId, locationGroup, chartTemplate, startDate, endDate); - CountDownLatch initlatch = new CountDownLatch(1); - pieModel.addPropertyChangeListener((PropertyChangeEvent evt) -> - { - if ("PieDataChangedProperty".equals(evt.getPropertyName())) - { - LOGGER.log(Level.FINER, "PieDataChanged edt:{0} latch:{1}", - new Object[] - { - SwingUtilities.isEventDispatchThread(), initlatch.getCount() - }); - initlatch.countDown(); - } - }); - List forInitCache = treeModel.getRelevantLocations(null); - LOGGER.log(Level.INFO, "Initializing BasinPieModel with {0} locations.", forInitCache.size()); - pieModel.initCache(forInitCache); // this can take a while but it fires a property change event when its done. - - boolean normalExit = initlatch.await(Integer.getInteger(LATCH_SECONDS, 11 * 60), TimeUnit.SECONDS); - if (!normalExit) - { - LOGGER.log(Level.WARNING, "Exceeded timeout waiting for basin pie model to load."); - } - - return pieModel; - } - - private void writeBasinImage(Dimension d, BasinPieModel pieModel, - Date date, String file, String imageFormat) throws FileNotFoundException, IOException - { - LocationGroup locationGroup = pieModel.getLocationGroup(); - PiePanel piePanel = new PiePanel(); - IChartTemplate chartTemplate = pieModel.getChartTemplate(); - List dataIdentifiers = chartTemplate.getDataIdentifiers(); - Set poolIds = new HashSet<>(); - poolIds.addAll(dataIdentifiers); - - TimeZone timezone = regiDomain.getTimeZone(); - piePanel.setTimeZone(timezone); - - JLayer piePanelJLayerWrapper = new JLayer(piePanel); - HeadlessBasinPieAnnotationLayer basinPieAnnotationLayer = new HeadlessBasinPieAnnotationLayer(getManagerIdProvider(), locationGroup, pieModel.getActiveLocations()); - basinPieAnnotationLayer.fillPanel(poolIds, date, chartTemplate); - - PinnableComponentGlassPane glassPane = PinnableComponentGlassPaneFactory.createNewGlassPane(basinPieAnnotationLayer, piePanel); - - piePanelJLayerWrapper.setGlassPane(glassPane); - glassPane.addPinnableContainer(basinPieAnnotationLayer); - PinnableContainer container = glassPane.getPinnableContainer(basinPieAnnotationLayer); - basinPieAnnotationLayer.setPinnableContainer(container); - container.setSize(d); - - List> futures = basinPieAnnotationLayer.resetFromChartTemplate(); - futures.stream().map((future) -> - { - if (future instanceof FutureDescriptor) - { - return ((FutureDescriptor) future).getFuture(); - } - return future; - }).forEach((future)-> - { - try - { - future.get(); - } - catch (InterruptedException | ExecutionException ex) - { - LOGGER.log(Level.INFO, "Well that didn't work...", ex); - } - }); - - PinnableComponentGlassPaneFactory.getGlassPane(basinPieAnnotationLayer).setVisible(true); - - LOGGER.fine("Filling panel with model."); - piePanel.fillPanel(pieModel); - LOGGER.log(Level.INFO, "Setting active date:{0}", date); - piePanel.setActiveDate(date); - - //This updates the data of bar charts. This has to happen after we've loaded the data. Otherwise it doesn't - //Load the bar chart correctly. - basinPieAnnotationLayer.updateBarChartGraphics(); - - layoutAndSave(piePanelJLayerWrapper, d, file, imageFormat); - } - - /** - * Saves a copy of the plot as a image type - * - * @param os the output stream to write to. - * @param panel - * @param imageType i.e. "png" or "jpg". - * @param compression sets the compression for the image if the image writer - * supports it - * @return - * @throws java.io.IOException - */ - protected boolean saveToStream(OutputStream os, final JComponent panel, - String imageType, float compression) throws IOException - { - // This next comment came from the source this was loosely based on. - /** - * Add a revalidate here in order for headless scripting to work. Due to - * a joining of the building and displaying of the plot in showPlot(), - * any component changes to recompute preferred sizes and exports look - * bad and components overlap. If we do this here, then we can build and - * show the plot, tweak some properties and export correctly. - */ - - BufferedImage bImage; - - if (SwingUtilities.isEventDispatchThread()) - { - bImage = saveToImage(panel.getSize(), panel); - } - else - { - Callable imageCallable = () -> saveToImage(panel.getSize(), panel); - FutureTask futureTask = new FutureTask<>(imageCallable); - - SwingUtilities.invokeLater(futureTask); - try - { - // Not sure how long to wait here. Infinite is wrong. - bImage = futureTask.get(5, TimeUnit.MINUTES); - } - catch (InterruptedException ex) - { - Thread.currentThread().interrupt(); - throw new IOException("Background paint was interrupted.", ex); - } - catch (ExecutionException ex) - { - throw new IOException("Background paint encountered ExecutionException.", ex); - } - catch (TimeoutException ex) - { - throw new IOException("Timeout waiting for paint to complete.", ex); - } - } - return writeImage(imageType, compression, os, bImage); - } - - public boolean writeImage(String imageType, float compression, - OutputStream os, BufferedImage bImage) - { - Iterator iter = javax.imageio.ImageIO.getImageWritersByFormatName(imageType); - if (!iter.hasNext()) - { - LOGGER.log(Level.WARNING, "No Image writers exist for Image Type = {0}", imageType); - return true; - } - ImageWriter next = iter.next(); - ImageWriteParam defaultWriteParam = next.getDefaultWriteParam(); - if (defaultWriteParam.canWriteCompressed() && compression != hec.lang.Const.UNDEFINED_INT) - { - defaultWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); - defaultWriteParam.setCompressionQuality(compression / 100); - } - writeToStream(next, os, bImage, defaultWriteParam); - return false; - } - - public static BufferedImage saveToImage(Dimension d, JComponent panel) - { - - BufferedImage bImage = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB); - paintIntoImage(bImage, d, panel); - - return bImage; - } - - private static void paintIntoImage(BufferedImage bImage, Dimension d, - JComponent panel) - { - Graphics2D g = bImage.createGraphics(); - - boolean useTrans = false; - - if (!useTrans) - { - Color color = new Color(226, 226, 226); // make backgroup grey - g.setColor(color); - g.fillRect(0, 0, d.width, d.height); - } - else - { - // This doesn't work. - Color color = new Color(0, 0, 0, 0); - g.setColor(color); - g.setComposite(AlphaComposite.Clear); - g.fillRect(0, 0, d.width, d.height); - g.setComposite(AlphaComposite.SrcOver); - } - - panel.paint(g); - g.dispose(); - } - - public static void writeToStream(ImageWriter writer, OutputStream fs, - BufferedImage bImage, - ImageWriteParam defaultWriteParam) - { - try - { - writer.setOutput(javax.imageio.ImageIO.createImageOutputStream(fs)); - writer.write(null, new IIOImage(bImage, null, null), defaultWriteParam); - } - catch (IOException e) - { - LOGGER.log(Level.SEVERE, "Exception encountered writing image.", e); - } - finally - { - writer.dispose(); - try - { - if (fs != null) - { - fs.flush(); - fs.close(); - } - } - catch (IOException ioe) - { - LOGGER.log(Level.SEVERE, "IOException encountered while closing OutputStream.", ioe); - } - } - } - - protected String getFormatFromFile(String file) - { - String format = "png"; - - if (file != null && !file.isEmpty()) - { - String asLower = file.toLowerCase(); - - if (asLower.endsWith(".jpg") || asLower.endsWith(".jpeg")) - { - return "jpg"; - } - - } - - return format; - } - - public void layoutAndSave(final JComponent component, final Dimension d, - String file, String imageFormat) throws IOException - { - if (SwingUtilities.isEventDispatchThread()) - { - layoutComponent(component, d); - } - else - { - Callable imageCallable = () -> - { - layoutComponent(component, d); - return Boolean.TRUE; - }; - FutureTask futureTask = new FutureTask<>(imageCallable); - - SwingUtilities.invokeLater(futureTask); - try - { - // Not sure how long to wait here. Infinite is wrong. - Boolean dontcare = futureTask.get(1, TimeUnit.MINUTES); - } - catch (InterruptedException ex) - { - Thread.currentThread().interrupt(); - throw new IOException("Background layout was interrupted.", ex); - } - catch (ExecutionException ex) - { - throw new IOException("Background layout encountered ExecutionException.", ex); - } - catch (TimeoutException ex) - { - throw new IOException("Timeout waiting for layout to complete.", ex); - } - } - - File f = new File(file); - f.getParentFile().mkdirs(); - - try (FileOutputStream fos = new FileOutputStream(f); - BufferedOutputStream bos = new BufferedOutputStream(fos);) - { - LOGGER.info("Writing to output stream"); - saveToStream(bos, component, imageFormat, 100.0f); - } - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/SimpleTemplateEngine.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/SimpleTemplateEngine.java deleted file mode 100644 index 116c062..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/SimpleTemplateEngine.java +++ /dev/null @@ -1,54 +0,0 @@ -package usace.rowcps.headless.calculator.status; - -import java.util.HashMap; -import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Very simple templating system which replaces %keyword% with supplied values. - * Supported patterns look like: "J:\\temp\\headless\\%office_id%_%basin_id%_%location_id%_%chart_template_id%_%date%.png" - * @author ryan - */ -public class SimpleTemplateEngine { - private static final Logger logger = Logger.getLogger(SimpleTemplateEngine.class.getName()); - - protected HashMap replacements = new HashMap<>(); - public SimpleTemplateEngine() { - } - - static Pattern pattern = Pattern.compile("%\\w+%"); // This defines the %word% pattern we will look for. - - public void addPattern( String pattern, String value){ - if(pattern.contains("%")){ - logger.warning("Supplied pattern contained '%' character, this is unlikely to work correctly."); - } - replacements.put("%" + pattern + "%", value); - } - - public String makeReplacements(String text ){ - return makeReplacements(text, replacements); - } - - public static String makeReplacements(String text, HashMap replacements) { - Matcher matcher = pattern.matcher(text); - - StringBuffer buffer = new StringBuffer(); - - while (matcher.find()) { - String found = matcher.group(); - String replacement = replacements.get(found); - if (replacement != null) { - matcher.appendReplacement(buffer, ""); - buffer.append(replacement); - } else { - logger.info("Unrecognized replacement pattern:" + found + ". " - + " Recognized replacement patterns are:" + replacements.keySet()); - } - } - matcher.appendTail(buffer); - - return buffer.toString(); - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/StatusCalcFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/StatusCalcFactory.java deleted file mode 100644 index 3865b69..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/calculator/status/StatusCalcFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -package usace.rowcps.headless.calculator.status; - -import rma.services.annotations.ServiceProvider; -import usace.rowcps.headless.ScriptableCalcFactory; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author ryan - */ -@ServiceProvider(service = ScriptableCalcFactory.class) -public class StatusCalcFactory implements ScriptableCalcFactory -{ - - @Override - public String getName() - { - return "Status"; - } - - @Override - public String getDescription() - { - return "Generates Status Graphic images"; - } - - @Override - public String getUsage() - { - return ""; - } - - @Override - public ScriptableCalc build(RegiDomain regiDomain, ManagerId managerid) - { - return new ScriptableStatusGraphicImpl(regiDomain, managerid); - } - -} \ No newline at end of file diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ExportSigStagesCalcFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ExportSigStagesCalcFactory.java deleted file mode 100644 index a7b8444..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ExportSigStagesCalcFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.exportdb; - -import usace.rowcps.headless.sigstages.importdb.*; -import usace.rowcps.headless.sigstages.retrieve.*; -import rma.services.annotations.ServiceProvider; -import usace.rowcps.headless.ScriptableCalcFactory; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author stephen - */ -@ServiceProvider(service = ScriptableCalcFactory.class) -public class ExportSigStagesCalcFactory implements ScriptableCalcFactory -{ - public ExportSigStagesCalcFactory() - { - } - - @Override - public String getName() - { - return "Export Sig States"; - } - - @Override - public String getDescription() - { - return "Reads the database and writes a text file that is used to retrieve NWS Gage info"; - } - - @Override - public String getUsage() - { - return ""; - } - - @Override - public ScriptableCalc build(RegiDomain regiDomain, ManagerId managerid) - { - return new ScriptableExportSigStagesImpl(regiDomain, managerid); - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ScriptableExportSigStagesImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ScriptableExportSigStagesImpl.java deleted file mode 100644 index 1596d41..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ScriptableExportSigStagesImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/* -* To change this license header, choose License Headers in Project Properties. -* To change this template file, choose Tools | Templates -* and open the template in the editor. -*/ -package usace.rowcps.headless.sigstages.exportdb; - -import hec.data.location.AssignedLocation; -import hec.data.location.LocationGroup; -import hec.data.location.LocationGroupRef; -import hec.data.location.LocationTemplate; -import hec.data.meta.Catalog; -import hec.data.meta.LocationCatalogQuery; -import hec.db.DbConnectionException; -import hec.db.DbIoException; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.logging.Level; -import java.util.logging.Logger; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.AgencyAlias; -import usace.rowcps.regi.model.AtLocationGroupManager; -import usace.rowcps.regi.model.AtLocationManager; -import usace.rowcps.regi.model.CacheUsage; -import usace.rowcps.regi.model.RegiDomain; -import usace.rowcps.regi.model.ManagerId; - -/** - * - * @author stephen - */ -public class ScriptableExportSigStagesImpl implements ScriptableExportSigstages, ScriptableCalc -{ - private RegiDomain _regiDomain; - private ManagerId _managerId; - private String _office; - - public static final String DELIMETER = System.getProperty("sigstages.delim", ";"); - public static final String CSVDELIMETER = System.getProperty("sigstages.csv.delim", "\n"); - public static final String CSVSEPARATOR = System.getProperty("sigstages.csv.separator", ","); - - public ScriptableExportSigStagesImpl(RegiDomain regiDomain, ManagerId managerId) - { - _regiDomain = regiDomain; - _managerId = managerId; - _office = "SWF"; - } - - @Override - public boolean exportSigStages(String file) - { - Path toPath = Paths.get(file); - - AtLocationManager atLocManager = _regiDomain.getAtLocationManager(_managerId); - - try (BufferedWriter writer = new BufferedWriter(new FileWriter(toPath.toFile()))) - { - Map usedIds = new HashMap<>(); - AtLocationGroupManager lgm = _regiDomain.getAtLocationGroupManager(_managerId); - LocationGroupRef lgr = AgencyAlias.Agency.NWS_HANDBOOK_5_ID.getLocationGroupRef(_regiDomain); - LocationGroup usgsAliases = lgm.retrieveLocationGroup(lgr, CacheUsage.NORMAL); - for(AssignedLocation al : usgsAliases.getAssignedLocationsSorted()) - { - String aliasId = al.getAliasId(); - LocationTemplate location = al.getLocRef(); - usedIds.put(location, aliasId); - } - - Catalog catalog = atLocManager.retrieveLocationCatalog(CacheUsage.NORMAL); - for(int i=0; i < catalog.size(); i++) - { - List rowList = catalog.getRow(i); - LocationTemplate locationTemplate = LocationCatalogQuery.convertToLocationTemplate(rowList); - if(locationTemplate != null) - { - String locationId = locationTemplate.getLocationId(); - String aliasId = usedIds.get(locationTemplate); - if(Objects.equals(aliasId, locationId) || aliasId == null || "".equals(aliasId)) - { - writer.write(locationId); - } - else - { - writer.write(locationId + DELIMETER + aliasId); - } - writer.write("\n"); - } - } - } - catch (DbConnectionException|DbIoException|IOException ex) - { - Logger.getLogger(ScriptableExportSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - return false; - } - return true; - } - - @Override - public void setOffice(String office) - { - _office = office; - } - - @Override - public String getOffice() - { - return _office; - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ScriptableExportSigstages.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ScriptableExportSigstages.java deleted file mode 100644 index dec7ac5..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/exportdb/ScriptableExportSigstages.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.exportdb; - -import usace.rowcps.headless.sigstages.importdb.*; -import usace.rowcps.headless.sigstages.retrieve.*; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Sigstage; - -/** - * - * @author stephen - */ -public interface ScriptableExportSigstages -{ - public boolean exportSigStages(String toFile); - public void setOffice(String office); - public String getOffice(); -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ImportSigStagesCalcFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ImportSigStagesCalcFactory.java deleted file mode 100644 index 72037de..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ImportSigStagesCalcFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.importdb; - -import usace.rowcps.headless.sigstages.retrieve.*; -import rma.services.annotations.ServiceProvider; -import usace.rowcps.headless.ScriptableCalcFactory; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author stephen - */ -@ServiceProvider(service = ScriptableCalcFactory.class) -public class ImportSigStagesCalcFactory implements ScriptableCalcFactory -{ - public ImportSigStagesCalcFactory() - { - } - - @Override - public String getName() - { - return "Import Sig States"; - } - - @Override - public String getDescription() - { - return "Reads a CSV File and then import that data into the database."; - } - - @Override - public String getUsage() - { - return ""; - } - - @Override - public ScriptableCalc build(RegiDomain regiDomain, ManagerId managerid) - { - return new ScriptableImportSigStagesImpl(regiDomain, managerid); - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ScriptableImportSigStagesImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ScriptableImportSigStagesImpl.java deleted file mode 100644 index 14ae0d6..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ScriptableImportSigStagesImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/* -* To change this license header, choose License Headers in Project Properties. -* To change this template file, choose Tools | Templates -* and open the template in the editor. -*/ -package usace.rowcps.headless.sigstages.importdb; - -import hec.data.level.ILocationLevel; -import hec.db.DbConnectionException; -import hec.db.DbIoException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Date; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.level.importer.CSVLocationLevelImportUtil; -import usace.rowcps.regi.model.AtLocationLevelManager; -import usace.rowcps.regi.model.RegiDomain; -import usace.rowcps.regi.model.ManagerId; - -/** - * - * @author stephen - */ -public class ScriptableImportSigStagesImpl implements ScriptableImportSigstages, ScriptableCalc -{ - private RegiDomain _regiDomain; - private ManagerId _managerId; - - public static final String DELIMETER = System.getProperty("sigstages.delim", ";"); - public static final String CSVDELIMETER = System.getProperty("sigstages.csv.delim", "\n"); - public static final String CSVSEPARATOR = System.getProperty("sigstages.csv.separator", ","); - - public ScriptableImportSigStagesImpl(RegiDomain regiDomain, ManagerId managerId) - { - _regiDomain = regiDomain; - _managerId = managerId; - } - - @Override - public boolean importSigStages(String file, Date effectiveDate) - { - boolean retval = true; - AtLocationLevelManager atLocLevelMgr = _regiDomain.getAtLocationLevelManager(_managerId); - Connection c = null; - try { - Path p = Paths.get(file); - c = atLocLevelMgr.getPooledConnection(); - CSVLocationLevelImportUtil importUtil = new CSVLocationLevelImportUtil(); - importUtil.setPath(p); - importUtil.readFile(true); - List locationLevels = importUtil.getLocationLevelList(); - for(int locationLevelIndex = 0; locationLevelIndex < locationLevels.size(); locationLevelIndex++) - { - ILocationLevel level = locationLevels.get(locationLevelIndex); - try { - level.setDate(effectiveDate); - atLocLevelMgr.addLocationLevel(level); - } catch (DbConnectionException | DbIoException ex) { - Logger.getLogger(ScriptableImportSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - retval = false; - break; - } - } - - if(retval) - { - try { - atLocLevelMgr.commitData(); - } catch (DbConnectionException | DbIoException ex) { - Logger.getLogger(ScriptableImportSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - retval = false; - } - } - } catch (DbConnectionException ex) { - Logger.getLogger(ScriptableImportSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - } - finally - { - try - { - if(c != null && !c.isClosed()) c.close(); - } - catch (SQLException ex) - { - Logger.getLogger(ScriptableImportSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - } - } - return retval; - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ScriptableImportSigstages.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ScriptableImportSigstages.java deleted file mode 100644 index 0883a58..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/importdb/ScriptableImportSigstages.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.importdb; - -import java.util.Date; - -/** - * - * @author stephen - */ -public interface ScriptableImportSigstages -{ - public boolean importSigStages(String file, Date effectiveDate); -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigStagesCalcFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigStagesCalcFactory.java deleted file mode 100644 index 063dd7e..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigStagesCalcFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.retrieve; - -import rma.services.annotations.ServiceProvider; -import usace.rowcps.headless.ScriptableCalcFactory; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author stephen - */ -@ServiceProvider(service = ScriptableCalcFactory.class) -public class RetrieveSigStagesCalcFactory implements ScriptableCalcFactory -{ - public RetrieveSigStagesCalcFactory() - { - } - - @Override - public String getName() - { - return "Retrieve Sig States"; - } - - @Override - public String getDescription() - { - return "Reads a newline delimited file containing NWS Names, then writes the sigstages to a CSV"; - } - - @Override - public String getUsage() - { - return ""; - } - - @Override - public ScriptableCalc build(RegiDomain regiDomain, ManagerId managerid) - { - return new RetrieveSigStagesImpl(regiDomain, managerid); - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigStagesImpl.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigStagesImpl.java deleted file mode 100644 index 6a609e5..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigStagesImpl.java +++ /dev/null @@ -1,488 +0,0 @@ -/* -* To change this license header, choose License Headers in Project Properties. -* To change this template file, choose Tools | Templates -* and open the template in the editor. -*/ -package usace.rowcps.headless.sigstages.retrieve; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.regex.Pattern; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Unmarshaller; -import usace.metrics.services.Metrics; -import usace.metrics.services.Timer; -import usace.rowcps.headless.interfaces.ScriptableCalc; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Action; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Bankfull; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Flood; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Low; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Major; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Moderate; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Sigstage; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Sigstages; -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Site; -import usace.rowcps.metrics.RegiMetricsService; -import usace.rowcps.regi.model.ManagerId; -import usace.rowcps.regi.model.RegiDomain; - -/** - * - * @author stephen - */ -public class RetrieveSigStagesImpl implements RetrieveSigstages, ScriptableCalc -{ - private RegiDomain _regiDomain; - private ManagerId _managerId; - - private JAXBContext _jaxbContext = null; - - public final static String DOWNLOADURL = System.getProperty("sigstages.downloadurl", "http://water.weather.gov/ahps2/hydrograph_to_xml.php?gage=GAGENAME&output=xml"); - public static final String DELIMETER = System.getProperty("sigstages.delim", ";"); - public static final String CSVDELIMETER = System.getProperty("sigstages.csv.delim", "\n"); - public static final String CSVSEPARATOR = System.getProperty("sigstages.csv.separator", ","); - public static int THREADCOUNT = 2; - - private static final DateFormat DATE_FORMAT = new SimpleDateFormat("ddMMMyyyy HHmm"); - private static final DateFormat ISO_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); - - private static final int SHEF_MISSING_VALUE = -9999; - - private String _parameter; - private String _parameterType; - private String _duration; - private Map _specifiedLevelOverride; - private String _office; - private String _csvHeader; - - protected RetrieveSigStagesImpl() - { - super(); - _parameter = "Stage"; - _parameterType = "Inst"; - _duration = "0"; - _specifiedLevelOverride = new HashMap<>(); - _office = "SWF"; - _csvHeader = "Office,Location Level,Effective Date,Constant Level,Unit,Seasonal Value,Interpolate,Calendar Interval,Time Interval,Origin Date,Calendar Offset,TSID\n"; - String threadCount = System.getProperty("sigstages.threadcount", Runtime.getRuntime().availableProcessors()+"").trim(); - if(threadCount.matches("^[\\d]+$")) - { - THREADCOUNT = Integer.parseInt(threadCount); - } - } - - public void setCSVHeader(String csvHeader) - { - //TODO: Be sure this actually is a valid header - _csvHeader = csvHeader; - } - - public String getCSVHeader() - { - return _csvHeader; - } - - public RetrieveSigStagesImpl(RegiDomain regiDomain, ManagerId managerId) - { - this(); - _regiDomain = regiDomain; - _managerId = managerId; - } - - @Override - public void retrieveSigstages(String sourceFile, String outputFile, int milliDelay) - { - Path inputPath = Paths.get(sourceFile); - Path outputPath = Paths.get(outputFile); - retrieveSigstages(inputPath, outputPath, milliDelay); - } - - public void retrieveSigstages(Path source, Path outputPath, int milliDelay) - { - SigstageLocation[] locations; - try - { - locations = readLocationFile(source); - fetchSitesThreaded(milliDelay, locations); - locationsToCSV(outputPath, locations); - } - catch (IOException ex) - { - Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - } - } - - public void locationsToCSV(Path file, SigstageLocation... locations) - { - Metrics metrics = RegiMetricsService.createMetrics("locationsToCSV"); - try(Timer.Context context = metrics.createTimer().start()) - { - - StringBuilder csvBuilder = new StringBuilder(getCSVHeader()); - for(int locationIndex = 0; locationIndex < locations.length; locationIndex++) - { - if(locations[locationIndex] == null) - { - continue; - } - if(locations[locationIndex].getSite() == null) - { - continue; - } - Site site = locations[locationIndex].getSite(); - - if(site.getSigstages() == null) - { - continue; - } - Sigstages sigstages = site.getSigstages(); - - List allStages = new ArrayList<>(); - - if(sigstages.getAction() == null) - { - continue; - } - Action action = sigstages.getAction(); - allStages.add(action); - - Bankfull bankfull = sigstages.getBankfull(); - allStages.add(bankfull); - - Flood flood = sigstages.getFlood(); - allStages.add(flood); - - Low low = sigstages.getLow(); - allStages.add(low); - - Major major = sigstages.getMajor(); - allStages.add(major); - - //Record record = sigstages.getRecord(); - //allStages.add(record); - - Moderate moderate = sigstages.getModerate(); - allStages.add(moderate); - - for(int stageIndex = 0; stageIndex < allStages.size(); stageIndex++) - { - Sigstage stage = allStages.get(stageIndex); - if(stage.getValue() == 0 || stage.getValue() == SHEF_MISSING_VALUE) - { - continue; - } - String dateTime = ""; - if(site.getGenerationtime() != null && !site.getGenerationtime().isEmpty()) - { - Date generationDateTime = null; - - try { - generationDateTime = ISO_FORMAT.parse(site.getGenerationtime()); - } - catch (ParseException ex) { - Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - } - - dateTime = DATE_FORMAT.format(generationDateTime); - } - csvBuilder.append(_office); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(stage.getType().generateID(locations[locationIndex].getOriginal(), _parameter, _parameterType, _duration, getSpecifiedLevelOverride(stage.getType()))); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(dateTime); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(stage.getValue()); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(stage.getUnits()); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVSEPARATOR); - csvBuilder.append(CSVDELIMETER); - } - } - - try (BufferedWriter writer = new BufferedWriter(new FileWriter(file.toFile()))) - { - writer.write(csvBuilder.toString()); - } - catch (IOException ex) - { - Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - -// public void fetchSites(Location... locationNames) -// { -// for(int locationNamesIndex = 0; locationNamesIndex < locationNames.length; locationNamesIndex++) -// { -// String fullURL = DOWNLOADURL.replace("GAGENAME", locationNames[locationNamesIndex].getNWS()); -// try -// { -// Location loc = locationNames[locationNamesIndex]; -// Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.FINE, null, "Retrieving " + loc); -// loc.setSite(fetchSite(fullURL)); -// Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.FINE, null, "Retrieved " + loc); -// } catch (Exception ex) -// { -// Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); -// } -// } -// } - - public void fetchSitesThreaded(int milliDelay, SigstageLocation... locationNames) - { - Metrics metrics = RegiMetricsService.createMetrics("fetchSitesThreaded"); - try(Timer.Context context = metrics.createTimer().start()) - { - final CountDownLatch cdl = new CountDownLatch(1); - BlockingQueue threadPoolQueue = new LinkedBlockingQueue<>(); - ThreadPoolExecutor threadPool = new ThreadPoolExecutor(THREADCOUNT / 2, THREADCOUNT, 1, TimeUnit.SECONDS, threadPoolQueue){ - @Override - protected void terminated() - { - cdl.countDown(); - } - }; - - for (final SigstageLocation l : locationNames) { - - threadPool.execute(new Runnable(){ - - @Override - public void run() - { - Metrics metrics = RegiMetricsService.createMetrics("fetchSitesThreadedRunnable"); - try(Timer.Context timerContext = metrics.createTimer().start()) - { - String fullURL = DOWNLOADURL.replace("GAGENAME", l.getNWS()); - try { - Site locationSite = fetchSite(fullURL); - l.setSite(locationSite); - - // report the number of locations at this site - int sameSiteLocations = countNumStages(locationSite); - String logString = "retrieved " + sameSiteLocations + " level" - + (sameSiteLocations==1? " ":"s ") + "for " - + l.getNWS(); - Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.INFO, logString); - } - catch (Exception ex) - { - Logger logger = Logger.getLogger(RetrieveSigStagesImpl.class.getName()); - logger.isLoggable(Level.SEVERE); - if(logger.isLoggable(Level.FINE)) - { - logger.log(Level.SEVERE, "error retrieving at site " + l.getNWS(), ex); - } - else - { - String logMessage = "error retrieving at site " + l.getNWS() + " " + ex.getMessage(); - logger.log(Level.SEVERE, logMessage); - } - } - } - } - }); - - try - { - cdl.await(milliDelay, TimeUnit.MILLISECONDS); - } - catch (InterruptedException ex) - { - Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.SEVERE, "timeout while retrieving site " + l.getNWS(), ex); - } - } - threadPool.shutdown(); - try - { - cdl.await(); - } - catch (InterruptedException ex) - { - Logger.getLogger(RetrieveSigStagesImpl.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - public Site fetchSite(String fullURL) throws Exception - { - Metrics metrics = RegiMetricsService.createMetrics("fetchSite"); - try(Timer.Context context = metrics.createTimer().start()) - { - if(_jaxbContext == null) - { - _jaxbContext = JAXBContext.newInstance("usace.rowcps.headless.sigstages.retrieve.xmlmodel"); - } - Unmarshaller unmarshaller = _jaxbContext.createUnmarshaller(); - URL url = new URL(fullURL); - InputStream input = url.openStream(); - Site site = ((Site)unmarshaller.unmarshal(input)); - return site; - } - } - - private static final Pattern VALIDNWS = Pattern.compile("^[A-Za-z]{4}[\\d]$"); - - public SigstageLocation[] readLocationFile(Path source) throws FileNotFoundException, IOException - { - Metrics metrics = RegiMetricsService.createMetrics("readLocationFile"); - try(Timer.Context context = metrics.createTimer().start()) - { - List locations = new ArrayList<>(); - - try (BufferedReader reader = new BufferedReader(new FileReader(source.toFile()))) { - String line; - while((line = reader.readLine()) != null) - { - line = line.trim(); - String[] lineArray = line.split(DELIMETER); - if(lineArray.length == 0) - { - continue; - } - String nws = (lineArray.length > 1) ? lineArray[1] : lineArray[0]; - if(VALIDNWS.matcher(nws).matches()) - { - String original = lineArray[0]; - SigstageLocation location = new SigstageLocation(original, nws); - locations.add(location); - } - } - } - - SigstageLocation[] locationsArray = new SigstageLocation[locations.size()]; - locationsArray = locations.toArray(locationsArray); - return locationsArray; - } - } - - // count all valid locations at a site - private int countNumStages(Site site) - { - int numStages = 0; - - if(site == null) - return numStages; - - Sigstages stages = site.getSigstages(); - - if(stages == null) - return numStages; - - if(stages.getAction() != null && stages.getAction().getValue() != 0 && stages.getAction().getValue() != SHEF_MISSING_VALUE) - numStages++; - else - return numStages; - - if(stages.getBankfull() != null && stages.getBankfull().getValue() != 0 && stages.getBankfull().getValue() != SHEF_MISSING_VALUE) - numStages++; - - if(stages.getFlood() != null && stages.getFlood().getValue() != 0 && stages.getFlood().getValue() != SHEF_MISSING_VALUE) - numStages++; - - if(stages.getLow() != null && stages.getLow().getValue() != 0 && stages.getLow().getValue() != SHEF_MISSING_VALUE) - numStages++; - - if(stages.getMajor() != null && stages.getMajor().getValue() != 0 && stages.getMajor().getValue() != SHEF_MISSING_VALUE) - numStages++; - - if(stages.getModerate() != null && stages.getModerate().getValue() != 0 && stages.getModerate().getValue() != SHEF_MISSING_VALUE) - numStages++; - - return numStages; - } - - @Override - public void setParameter(String parameter) - { - _parameter = parameter; - } - - @Override - public String getParameter() - { - return _parameter; - } - - @Override - public void setParameterType(String parameterType) - { - _parameterType = parameterType; - } - - @Override - public String getParameterType() - { - return _parameterType; - } - - @Override - public void setDuration(String duration) - { - _duration = duration; - } - - @Override - public String getDuration() - { - return _duration; - } - - @Override - public void setSpecifiedLevelOverride(Sigstage.Type type, String overrideText) - { - _specifiedLevelOverride.put(type, overrideText); - } - - @Override - public String getSpecifiedLevelOverride(Sigstage.Type type) - { - String specifiedLevel = _specifiedLevelOverride.get(type); - if(specifiedLevel == null) - { - specifiedLevel = type.toString(); - } - return specifiedLevel; - } - - @Override - public void setOffice(String office) - { - _office = office; - } - - @Override - public String getOffice() - { - return _office; - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigstages.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigstages.java deleted file mode 100644 index 1a518a6..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/RetrieveSigstages.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.retrieve; - -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Sigstage; - -/** - * - * @author stephen - */ -public interface RetrieveSigstages -{ - public void retrieveSigstages(String sourceFile, String outputFile, int milliDelay); - public void setParameter(String parameter); - public String getParameter(); - public void setParameterType(String parameterType); - public String getParameterType(); - public void setDuration(String duration); - public String getDuration(); - public void setSpecifiedLevelOverride(Sigstage.Type type, String overrideText); - public String getSpecifiedLevelOverride(Sigstage.Type type); - public void setOffice(String office); - public String getOffice(); -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/SigstageLocation.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/SigstageLocation.java deleted file mode 100644 index 98fbeb7..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/SigstageLocation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.retrieve; - -import usace.rowcps.headless.sigstages.retrieve.xmlmodel.Site; - -/** - * - * @author stephen - */ -public class SigstageLocation -{ - private String _originalLocation; - private String _nwsLocation; - private Site _site; - - public SigstageLocation() - { - super(); - _site = null; - _originalLocation = ""; - _nwsLocation = ""; - } - - public SigstageLocation(String orig, String nws) - { - this(); - _originalLocation = orig; - _nwsLocation = nws; - } - - public String getOriginal() - { - return _originalLocation; - } - - public String getNWS() - { - return _nwsLocation; - } - - public void setOriginal(String original) - { - _originalLocation = original; - } - - public void setNWS(String nws) - { - _nwsLocation = nws; - } - - public Site getSite() - { - return _site; - } - - public void setSite(Site site) - { - _site = site; - } - - @Override - public String toString() - { - return getOriginal() + ";" + getNWS() + " " + getSite().getName(); - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Action.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Action.java deleted file mode 100644 index 06c23fc..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Action.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "action") -public class Action implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType(){ - return Type.ACTION; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/AltRating.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/AltRating.java deleted file mode 100644 index 5e4b4c2..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/AltRating.java +++ /dev/null @@ -1,111 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}datum" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="dignity" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "datum" -}) -@XmlRootElement(name = "alt_rating") -public class AltRating { - - @XmlElement(required = true) - protected List datum; - @XmlAttribute(name = "dignity", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String dignity; - - /** - * Gets the value of the datum property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the datum property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDatum().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Datum } - * - * - */ - public List getDatum() { - if (datum == null) { - datum = new ArrayList(); - } - return this.datum; - } - - /** - * Gets the value of the dignity property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDignity() { - return dignity; - } - - /** - * Sets the value of the dignity property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDignity(String value) { - this.dignity = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Bankfull.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Bankfull.java deleted file mode 100644 index 34142cf..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Bankfull.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "bankfull") -public class Bankfull implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType() { - return Type.BANKFULL; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Datum.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Datum.java deleted file mode 100644 index ad24775..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Datum.java +++ /dev/null @@ -1,268 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence minOccurs="0">
- *         <element ref="{}valid"/>
- *         <element ref="{}primary"/>
- *         <element ref="{}secondary"/>
- *         <element ref="{}pedts"/>
- *       </sequence>
- *       <attribute name="flow" type="{http://www.w3.org/2001/XMLSchema}float" />
- *       <attribute name="flowUnits" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="stage" type="{http://www.w3.org/2001/XMLSchema}float" />
- *       <attribute name="stageUnits" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "valid", - "primary", - "secondary", - "pedts" -}) -@XmlRootElement(name = "datum") -public class Datum { - - protected Valid valid; - protected Primary primary; - protected Secondary secondary; - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String pedts; - @XmlAttribute(name = "flow") - protected Float flow; - @XmlAttribute(name = "flowUnits") - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String flowUnits; - @XmlAttribute(name = "stage") - protected Float stage; - @XmlAttribute(name = "stageUnits") - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String stageUnits; - - /** - * Gets the value of the valid property. - * - * @return - * possible object is - * {@link Valid } - * - */ - public Valid getValid() { - return valid; - } - - /** - * Sets the value of the valid property. - * - * @param value - * allowed object is - * {@link Valid } - * - */ - public void setValid(Valid value) { - this.valid = value; - } - - /** - * Gets the value of the primary property. - * - * @return - * possible object is - * {@link Primary } - * - */ - public Primary getPrimary() { - return primary; - } - - /** - * Sets the value of the primary property. - * - * @param value - * allowed object is - * {@link Primary } - * - */ - public void setPrimary(Primary value) { - this.primary = value; - } - - /** - * Gets the value of the secondary property. - * - * @return - * possible object is - * {@link Secondary } - * - */ - public Secondary getSecondary() { - return secondary; - } - - /** - * Sets the value of the secondary property. - * - * @param value - * allowed object is - * {@link Secondary } - * - */ - public void setSecondary(Secondary value) { - this.secondary = value; - } - - /** - * Gets the value of the pedts property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPedts() { - return pedts; - } - - /** - * Sets the value of the pedts property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPedts(String value) { - this.pedts = value; - } - - /** - * Gets the value of the flow property. - * - * @return - * possible object is - * {@link Float } - * - */ - public Float getFlow() { - return flow; - } - - /** - * Sets the value of the flow property. - * - * @param value - * allowed object is - * {@link Float } - * - */ - public void setFlow(Float value) { - this.flow = value; - } - - /** - * Gets the value of the flowUnits property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFlowUnits() { - return flowUnits; - } - - /** - * Sets the value of the flowUnits property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFlowUnits(String value) { - this.flowUnits = value; - } - - /** - * Gets the value of the stage property. - * - * @return - * possible object is - * {@link Float } - * - */ - public Float getStage() { - return stage; - } - - /** - * Sets the value of the stage property. - * - * @param value - * allowed object is - * {@link Float } - * - */ - public void setStage(Float value) { - this.stage = value; - } - - /** - * Gets the value of the stageUnits property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStageUnits() { - return stageUnits; - } - - /** - * Sets the value of the stageUnits property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStageUnits(String value) { - this.stageUnits = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Disclaimers.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Disclaimers.java deleted file mode 100644 index d795985..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Disclaimers.java +++ /dev/null @@ -1,152 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}AHPSXMLversion"/>
- *         <element ref="{}status"/>
- *         <element ref="{}quality"/>
- *         <element ref="{}standing"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "ahpsxmLversion", - "status", - "quality", - "standing" -}) -@XmlRootElement(name = "disclaimers") -public class Disclaimers { - - @XmlElement(name = "AHPSXMLversion") - protected float ahpsxmLversion; - @XmlElement(required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String status; - @XmlElement(required = true) - protected Quality quality; - @XmlElement(required = true) - protected Standing standing; - - /** - * Gets the value of the ahpsxmLversion property. - * - */ - public float getAHPSXMLversion() { - return ahpsxmLversion; - } - - /** - * Sets the value of the ahpsxmLversion property. - * - */ - public void setAHPSXMLversion(float value) { - this.ahpsxmLversion = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the quality property. - * - * @return - * possible object is - * {@link Quality } - * - */ - public Quality getQuality() { - return quality; - } - - /** - * Sets the value of the quality property. - * - * @param value - * allowed object is - * {@link Quality } - * - */ - public void setQuality(Quality value) { - this.quality = value; - } - - /** - * Gets the value of the standing property. - * - * @return - * possible object is - * {@link Standing } - * - */ - public Standing getStanding() { - return standing; - } - - /** - * Sets the value of the standing property. - * - * @param value - * allowed object is - * {@link Standing } - * - */ - public void setStanding(Standing value) { - this.standing = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Flood.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Flood.java deleted file mode 100644 index da6f6fa..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Flood.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "flood") -public class Flood implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType() { - return Type.FLOOD; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Forecast.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Forecast.java deleted file mode 100644 index 1690728..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Forecast.java +++ /dev/null @@ -1,140 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.datatype.XMLGregorianCalendar; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}datum" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="issued" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
- *       <attribute name="timezone" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "datum" -}) -@XmlRootElement(name = "forecast") -public class Forecast { - - @XmlElement(required = true) - protected List datum; - @XmlAttribute(name = "issued", required = true) - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar issued; - @XmlAttribute(name = "timezone", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String timezone; - - /** - * Gets the value of the datum property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the datum property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDatum().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Datum } - * - * - */ - public List getDatum() { - if (datum == null) { - datum = new ArrayList(); - } - return this.datum; - } - - /** - * Gets the value of the issued property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getIssued() { - return issued; - } - - /** - * Sets the value of the issued property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setIssued(XMLGregorianCalendar value) { - this.issued = value; - } - - /** - * Gets the value of the timezone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTimezone() { - return timezone; - } - - /** - * Sets the value of the timezone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTimezone(String value) { - this.timezone = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Low.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Low.java deleted file mode 100644 index 09ca9ff..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Low.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "low") -public class Low implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType() { - return Type.LOW; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Major.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Major.java deleted file mode 100644 index d5deb79..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Major.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "major") -public class Major implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType() { - return Type.MAJOR; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Moderate.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Moderate.java deleted file mode 100644 index 4c59bfe..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Moderate.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "moderate") -public class Moderate implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType() { - return Type.MODERATE; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/ObjectFactory.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/ObjectFactory.java deleted file mode 100644 index 0974e70..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/ObjectFactory.java +++ /dev/null @@ -1,252 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the usace.rowcps.headless.sigstages.xmlmodel package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _Pedts_QNAME = new QName("", "pedts"); - private final static QName _AHPSXMLversion_QNAME = new QName("", "AHPSXMLversion"); - private final static QName _Status_QNAME = new QName("", "status"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: usace.rowcps.headless.sigstages.xmlmodel - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link Datum } - * - */ - public Datum createDatum() { - return new Datum(); - } - - /** - * Create an instance of {@link Valid } - * - */ - public Valid createValid() { - return new Valid(); - } - - /** - * Create an instance of {@link Primary } - * - */ - public Primary createPrimary() { - return new Primary(); - } - - /** - * Create an instance of {@link Secondary } - * - */ - public Secondary createSecondary() { - return new Secondary(); - } - - /** - * Create an instance of {@link Rating } - * - */ - public Rating createRating() { - return new Rating(); - } - - /** - * Create an instance of {@link Sigstages } - * - */ - public Sigstages createSigstages() { - return new Sigstages(); - } - - /** - * Create an instance of {@link Low } - * - */ - public Low createLow() { - return new Low(); - } - - /** - * Create an instance of {@link Action } - * - */ - public Action createAction() { - return new Action(); - } - - /** - * Create an instance of {@link Bankfull } - * - */ - public Bankfull createBankfull() { - return new Bankfull(); - } - - /** - * Create an instance of {@link Flood } - * - */ - public Flood createFlood() { - return new Flood(); - } - - /** - * Create an instance of {@link Moderate } - * - */ - public Moderate createModerate() { - return new Moderate(); - } - - /** - * Create an instance of {@link Major } - * - */ - public Major createMajor() { - return new Major(); - } - - /** - * Create an instance of {@link Record } - * - */ - public Record createRecord() { - return new Record(); - } - - /** - * Create an instance of {@link Observed } - * - */ - public Observed createObserved() { - return new Observed(); - } - - /** - * Create an instance of {@link Disclaimers } - * - */ - public Disclaimers createDisclaimers() { - return new Disclaimers(); - } - - /** - * Create an instance of {@link Quality } - * - */ - public Quality createQuality() { - return new Quality(); - } - - /** - * Create an instance of {@link Standing } - * - */ - public Standing createStanding() { - return new Standing(); - } - - /** - * Create an instance of {@link Zerodatum } - * - */ - public Zerodatum createZerodatum() { - return new Zerodatum(); - } - - /** - * Create an instance of {@link Forecast } - * - */ - public Forecast createForecast() { - return new Forecast(); - } - - /** - * Create an instance of {@link Site } - * - */ - public Site createSite() { - return new Site(); - } - - /** - * Create an instance of {@link Sigflows } - * - */ - public Sigflows createSigflows() { - return new Sigflows(); - } - - /** - * Create an instance of {@link AltRating } - * - */ - public AltRating createAltRating() { - return new AltRating(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "", name = "pedts") - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - public JAXBElement createPedts(String value) { - return new JAXBElement(_Pedts_QNAME, String.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}} - * - */ - @XmlElementDecl(namespace = "", name = "AHPSXMLversion") - public JAXBElement createAHPSXMLversion(Float value) { - return new JAXBElement(_AHPSXMLversion_QNAME, Float.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "", name = "status") - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - public JAXBElement createStatus(String value) { - return new JAXBElement(_Status_QNAME, String.class, null, value); - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Observed.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Observed.java deleted file mode 100644 index 3ce6f18..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Observed.java +++ /dev/null @@ -1,78 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}datum" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "datum" -}) -@XmlRootElement(name = "observed") -public class Observed { - - @XmlElement(required = true) - protected List datum; - - /** - * Gets the value of the datum property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the datum property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDatum().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Datum } - * - * - */ - public List getDatum() { - if (datum == null) { - datum = new ArrayList(); - } - return this.datum; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Primary.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Primary.java deleted file mode 100644 index 4e6239c..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Primary.java +++ /dev/null @@ -1,122 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "primary") -public class Primary { - - @XmlValue - protected float value; - @XmlAttribute(name = "name", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String name; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Quality.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Quality.java deleted file mode 100644 index 90e3341..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Quality.java +++ /dev/null @@ -1,101 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="trace" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "content" -}) -@XmlRootElement(name = "quality") -public class Quality { - - @XmlValue - protected String content; - @XmlAttribute(name = "trace", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String trace; - - /** - * Gets the value of the content property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getContent() { - return content; - } - - /** - * Sets the value of the content property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setContent(String value) { - this.content = value; - } - - /** - * Gets the value of the trace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTrace() { - return trace; - } - - /** - * Sets the value of the trace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTrace(String value) { - this.trace = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Rating.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Rating.java deleted file mode 100644 index 0c5c09e..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Rating.java +++ /dev/null @@ -1,111 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}datum" maxOccurs="unbounded"/>
- *       </sequence>
- *       <attribute name="dignity" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "datum" -}) -@XmlRootElement(name = "rating") -public class Rating { - - @XmlElement(required = true) - protected List datum; - @XmlAttribute(name = "dignity", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String dignity; - - /** - * Gets the value of the datum property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the datum property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getDatum().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Datum } - * - * - */ - public List getDatum() { - if (datum == null) { - datum = new ArrayList(); - } - return this.datum; - } - - /** - * Gets the value of the dignity property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDignity() { - return dignity; - } - - /** - * Sets the value of the dignity property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDignity(String value) { - this.dignity = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Record.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Record.java deleted file mode 100644 index 2c0e70b..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Record.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "record") -public class Record implements Sigstage{ - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - - @Override - public Type getType() { - return Type.RECORD; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Secondary.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Secondary.java deleted file mode 100644 index b49c329..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Secondary.java +++ /dev/null @@ -1,122 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "secondary") -public class Secondary { - - @XmlValue - protected float value; - @XmlAttribute(name = "name", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String name; - @XmlAttribute(name = "units", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigflows.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigflows.java deleted file mode 100644 index ef64c41..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigflows.java +++ /dev/null @@ -1,239 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}low"/>
- *         <element ref="{}action"/>
- *         <element ref="{}flood"/>
- *         <element ref="{}bankfull"/>
- *         <element ref="{}moderate"/>
- *         <element ref="{}major"/>
- *         <element ref="{}record"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "low", - "action", - "flood", - "bankfull", - "moderate", - "major", - "record" -}) -@XmlRootElement(name = "sigflows") -public class Sigflows { - - @XmlElement(required = true) - protected Low low; - @XmlElement(required = true) - protected Action action; - @XmlElement(required = true) - protected Flood flood; - @XmlElement(required = true) - protected Bankfull bankfull; - @XmlElement(required = true) - protected Moderate moderate; - @XmlElement(required = true) - protected Major major; - @XmlElement(required = true) - protected Record record; - - /** - * Gets the value of the low property. - * - * @return - * possible object is - * {@link Low } - * - */ - public Low getLow() { - return low; - } - - /** - * Sets the value of the low property. - * - * @param value - * allowed object is - * {@link Low } - * - */ - public void setLow(Low value) { - this.low = value; - } - - /** - * Gets the value of the action property. - * - * @return - * possible object is - * {@link Action } - * - */ - public Action getAction() { - return action; - } - - /** - * Sets the value of the action property. - * - * @param value - * allowed object is - * {@link Action } - * - */ - public void setAction(Action value) { - this.action = value; - } - - /** - * Gets the value of the flood property. - * - * @return - * possible object is - * {@link Flood } - * - */ - public Flood getFlood() { - return flood; - } - - /** - * Sets the value of the flood property. - * - * @param value - * allowed object is - * {@link Flood } - * - */ - public void setFlood(Flood value) { - this.flood = value; - } - - /** - * Gets the value of the bankfull property. - * - * @return - * possible object is - * {@link Bankfull } - * - */ - public Bankfull getBankfull() { - return bankfull; - } - - /** - * Sets the value of the bankfull property. - * - * @param value - * allowed object is - * {@link Bankfull } - * - */ - public void setBankfull(Bankfull value) { - this.bankfull = value; - } - - /** - * Gets the value of the moderate property. - * - * @return - * possible object is - * {@link Moderate } - * - */ - public Moderate getModerate() { - return moderate; - } - - /** - * Sets the value of the moderate property. - * - * @param value - * allowed object is - * {@link Moderate } - * - */ - public void setModerate(Moderate value) { - this.moderate = value; - } - - /** - * Gets the value of the major property. - * - * @return - * possible object is - * {@link Major } - * - */ - public Major getMajor() { - return major; - } - - /** - * Sets the value of the major property. - * - * @param value - * allowed object is - * {@link Major } - * - */ - public void setMajor(Major value) { - this.major = value; - } - - /** - * Gets the value of the record property. - * - * @return - * possible object is - * {@link Record } - * - */ - public Record getRecord() { - return record; - } - - /** - * Sets the value of the record property. - * - * @param value - * allowed object is - * {@link Record } - * - */ - public void setRecord(Record value) { - this.record = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigstage.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigstage.java deleted file mode 100644 index 74f51c2..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigstage.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -/** - * - * @author stephen - */ -public interface Sigstage -{ - public float getValue(); - public String getUnits(); - - public Type getType(); - - public enum Type - { - ACTION ("Action"), - BANKFULL ("Bankfull"), - FLOOD ("Flood"), - LOW ("Low"), - MAJOR ("Major"), - MODERATE ("Moderate"), - RECORD ("Record"); - - private String _typeName; - - private Type(String s) - { - _typeName = s; - } - - @Override - public String toString() - { - return _typeName; - } - - public String generateID(String location, String parameter, String parameterType, String duration, String specifiedLevel) - { - StringBuilder build = new StringBuilder(); - if(specifiedLevel == null || specifiedLevel.equals("")) - { - specifiedLevel = _typeName; - } - build.append(location); - build.append("."); - build.append(parameter); - build.append("."); - build.append(parameterType); - build.append("."); - build.append(duration); - build.append("."); - build.append(specifiedLevel); - return build.toString(); - } - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigstages.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigstages.java deleted file mode 100644 index 540d49e..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Sigstages.java +++ /dev/null @@ -1,239 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}low"/>
- *         <element ref="{}action"/>
- *         <element ref="{}bankfull"/>
- *         <element ref="{}flood"/>
- *         <element ref="{}moderate"/>
- *         <element ref="{}major"/>
- *         <element ref="{}record"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "low", - "action", - "bankfull", - "flood", - "moderate", - "major", - "record" -}) -@XmlRootElement(name = "sigstages") -public class Sigstages { - - @XmlElement(required = true) - protected Low low = null; - @XmlElement(required = true) - protected Action action = null; - @XmlElement(required = true) - protected Bankfull bankfull = null; - @XmlElement(required = true) - protected Flood flood = null; - @XmlElement(required = true) - protected Moderate moderate = null; - @XmlElement(required = true) - protected Major major = null; - @XmlElement(required = true) - protected Record record = null; - - /** - * Gets the value of the low property. - * - * @return - * possible object is - * {@link Low } - * - */ - public Low getLow() { - return low; - } - - /** - * Sets the value of the low property. - * - * @param value - * allowed object is - * {@link Low } - * - */ - public void setLow(Low value) { - this.low = value; - } - - /** - * Gets the value of the action property. - * - * @return - * possible object is - * {@link Action } - * - */ - public Action getAction() { - return action; - } - - /** - * Sets the value of the action property. - * - * @param value - * allowed object is - * {@link Action } - * - */ - public void setAction(Action value) { - this.action = value; - } - - /** - * Gets the value of the bankfull property. - * - * @return - * possible object is - * {@link Bankfull } - * - */ - public Bankfull getBankfull() { - return bankfull; - } - - /** - * Sets the value of the bankfull property. - * - * @param value - * allowed object is - * {@link Bankfull } - * - */ - public void setBankfull(Bankfull value) { - this.bankfull = value; - } - - /** - * Gets the value of the flood property. - * - * @return - * possible object is - * {@link Flood } - * - */ - public Flood getFlood() { - return flood; - } - - /** - * Sets the value of the flood property. - * - * @param value - * allowed object is - * {@link Flood } - * - */ - public void setFlood(Flood value) { - this.flood = value; - } - - /** - * Gets the value of the moderate property. - * - * @return - * possible object is - * {@link Moderate } - * - */ - public Moderate getModerate() { - return moderate; - } - - /** - * Sets the value of the moderate property. - * - * @param value - * allowed object is - * {@link Moderate } - * - */ - public void setModerate(Moderate value) { - this.moderate = value; - } - - /** - * Gets the value of the major property. - * - * @return - * possible object is - * {@link Major } - * - */ - public Major getMajor() { - return major; - } - - /** - * Sets the value of the major property. - * - * @param value - * allowed object is - * {@link Major } - * - */ - public void setMajor(Major value) { - this.major = value; - } - - /** - * Gets the value of the record property. - * - * @return - * possible object is - * {@link Record } - * - */ - public Record getRecord() { - return record; - } - - /** - * Sets the value of the record property. - * - * @param value - * allowed object is - * {@link Record } - * - */ - public void setRecord(Record value) { - this.record = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Site.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Site.java deleted file mode 100644 index 3289619..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Site.java +++ /dev/null @@ -1,385 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{}disclaimers"/>
- *         <element ref="{}sigstages"/>
- *         <element ref="{}sigflows"/>
- *         <element ref="{}zerodatum"/>
- *         <element ref="{}rating"/>
- *         <element ref="{}alt_rating"/>
- *         <element ref="{}observed"/>
- *         <element ref="{}forecast"/>
- *       </sequence>
- *       <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
- *       <attribute name="timezone" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="generationtime" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "disclaimers", - "sigstages", - "sigflows", - "zerodatum", - "rating", - "altRating", - "observed", - "forecast" -}) -@XmlRootElement(name = "site") -public class Site { - - @XmlElement(required = true) - protected Disclaimers disclaimers; - @XmlElement(required = true) - protected Sigstages sigstages = null; - @XmlElement(required = true) - protected Sigflows sigflows; - @XmlElement(required = true) - protected Zerodatum zerodatum; - @XmlElement(required = true) - protected Rating rating; - @XmlElement(name = "alt_rating", required = true) - protected AltRating altRating; - @XmlElement(required = true) - protected Observed observed; - @XmlElement(required = true) - protected Forecast forecast; - @XmlAttribute(name = "id", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String id; - @XmlAttribute(name = "name", required = true) - @XmlSchemaType(name = "anySimpleType") - protected String name; - @XmlAttribute(name = "timezone", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String timezone; - @XmlAttribute(name = "generationtime", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String generationtime = ""; - - /** - * Gets the value of the disclaimers property. - * - * @return - * possible object is - * {@link Disclaimers } - * - */ - public Disclaimers getDisclaimers() { - return disclaimers; - } - - /** - * Sets the value of the disclaimers property. - * - * @param value - * allowed object is - * {@link Disclaimers } - * - */ - public void setDisclaimers(Disclaimers value) { - this.disclaimers = value; - } - - /** - * Gets the value of the sigstages property. - * - * @return - * possible object is - * {@link Sigstages } - * - */ - public Sigstages getSigstages() { - return sigstages; - } - - /** - * Sets the value of the sigstages property. - * - * @param value - * allowed object is - * {@link Sigstages } - * - */ - public void setSigstages(Sigstages value) { - this.sigstages = value; - } - - /** - * Gets the value of the sigflows property. - * - * @return - * possible object is - * {@link Sigflows } - * - */ - public Sigflows getSigflows() { - return sigflows; - } - - /** - * Sets the value of the sigflows property. - * - * @param value - * allowed object is - * {@link Sigflows } - * - */ - public void setSigflows(Sigflows value) { - this.sigflows = value; - } - - /** - * Gets the value of the zerodatum property. - * - * @return - * possible object is - * {@link Zerodatum } - * - */ - public Zerodatum getZerodatum() { - return zerodatum; - } - - /** - * Sets the value of the zerodatum property. - * - * @param value - * allowed object is - * {@link Zerodatum } - * - */ - public void setZerodatum(Zerodatum value) { - this.zerodatum = value; - } - - /** - * Gets the value of the rating property. - * - * @return - * possible object is - * {@link Rating } - * - */ - public Rating getRating() { - return rating; - } - - /** - * Sets the value of the rating property. - * - * @param value - * allowed object is - * {@link Rating } - * - */ - public void setRating(Rating value) { - this.rating = value; - } - - /** - * Gets the value of the altRating property. - * - * @return - * possible object is - * {@link AltRating } - * - */ - public AltRating getAltRating() { - return altRating; - } - - /** - * Sets the value of the altRating property. - * - * @param value - * allowed object is - * {@link AltRating } - * - */ - public void setAltRating(AltRating value) { - this.altRating = value; - } - - /** - * Gets the value of the observed property. - * - * @return - * possible object is - * {@link Observed } - * - */ - public Observed getObserved() { - return observed; - } - - /** - * Sets the value of the observed property. - * - * @param value - * allowed object is - * {@link Observed } - * - */ - public void setObserved(Observed value) { - this.observed = value; - } - - /** - * Gets the value of the forecast property. - * - * @return - * possible object is - * {@link Forecast } - * - */ - public Forecast getForecast() { - return forecast; - } - - /** - * Sets the value of the forecast property. - * - * @param value - * allowed object is - * {@link Forecast } - * - */ - public void setForecast(Forecast value) { - this.forecast = value; - } - - /** - * Gets the value of the id property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getId() { - return id; - } - - /** - * Sets the value of the id property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setId(String value) { - this.id = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the timezone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTimezone() { - return timezone; - } - - /** - * Sets the value of the timezone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTimezone(String value) { - this.timezone = value; - } - - /** - * Gets the value of the generationtime property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGenerationtime(){ - return generationtime; - } - - /** - * Sets the value of the generationtime property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGenerationtime(String value){ - this.generationtime = value; - } -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Standing.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Standing.java deleted file mode 100644 index e326da1..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Standing.java +++ /dev/null @@ -1,159 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="audience" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="dignity" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *       <attribute name="trace" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "content" -}) -@XmlRootElement(name = "standing") -public class Standing { - - @XmlValue - protected String content; - @XmlAttribute(name = "audience", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String audience; - @XmlAttribute(name = "dignity", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String dignity; - @XmlAttribute(name = "trace", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String trace; - - /** - * Gets the value of the content property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getContent() { - return content; - } - - /** - * Sets the value of the content property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setContent(String value) { - this.content = value; - } - - /** - * Gets the value of the audience property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAudience() { - return audience; - } - - /** - * Sets the value of the audience property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAudience(String value) { - this.audience = value; - } - - /** - * Gets the value of the dignity property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDignity() { - return dignity; - } - - /** - * Sets the value of the dignity property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDignity(String value) { - this.dignity = value; - } - - /** - * Gets the value of the trace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTrace() { - return trace; - } - - /** - * Sets the value of the trace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTrace(String value) { - this.trace = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Valid.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Valid.java deleted file mode 100644 index 0da5c47..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Valid.java +++ /dev/null @@ -1,103 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.datatype.XMLGregorianCalendar; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>dateTime">
- *       <attribute name="timezone" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "valid") -public class Valid { - - @XmlValue - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar value; - @XmlAttribute(name = "timezone", required = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "NCName") - protected String timezone; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link XMLGregorianCalendar } - * - */ - public XMLGregorianCalendar getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link XMLGregorianCalendar } - * - */ - public void setValue(XMLGregorianCalendar value) { - this.value = value; - } - - /** - * Gets the value of the timezone property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTimezone() { - return timezone; - } - - /** - * Sets the value of the timezone property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTimezone(String value) { - this.timezone = value; - } - -} diff --git a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Zerodatum.java b/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Zerodatum.java deleted file mode 100644 index 2961f2d..0000000 --- a/regi-headless/src/main/java/usace/rowcps/headless/sigstages/retrieve/xmlmodel/Zerodatum.java +++ /dev/null @@ -1,90 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.07.28 at 11:19:12 AM PDT -// - - -package usace.rowcps.headless.sigstages.retrieve.xmlmodel; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>float">
- *       <attribute name="units" use="required" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "value" -}) -@XmlRootElement(name = "zerodatum") -public class Zerodatum { - - @XmlValue - protected float value; - @XmlAttribute(name = "units", required = true) - @XmlSchemaType(name = "anySimpleType") - protected String units; - - /** - * Gets the value of the value property. - * - */ - public float getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - */ - public void setValue(float value) { - this.value = value; - } - - /** - * Gets the value of the units property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUnits() { - return units; - } - - /** - * Sets the value of the units property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUnits(String value) { - this.units = value; - } - -} diff --git a/regi-headless/src/test/java/usace/rowcps/headless/TestFrame.java b/regi-headless/src/test/java/usace/rowcps/headless/TestFrame.java index 8d2f38e..2b46ad7 100644 --- a/regi-headless/src/test/java/usace/rowcps/headless/TestFrame.java +++ b/regi-headless/src/test/java/usace/rowcps/headless/TestFrame.java @@ -43,7 +43,6 @@ public TestFrame() throws HeadlessException public static void main(String[] args) { - TestHeadless.beforeClass(); TestFrame frame = new TestFrame(); frame.pack(); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); diff --git a/regi-headless/src/test/java/usace/rowcps/headless/TestHeadless.java b/regi-headless/src/test/java/usace/rowcps/headless/TestHeadless.java index 4c97c79..4cf8ac7 100644 --- a/regi-headless/src/test/java/usace/rowcps/headless/TestHeadless.java +++ b/regi-headless/src/test/java/usace/rowcps/headless/TestHeadless.java @@ -7,9 +7,6 @@ package usace.rowcps.headless; import java.util.TimeZone; -import org.junit.BeforeClass; -import org.junit.Test; -import usace.rowcps.cwms.Installer; import usace.rowcps.headless.tests.TestVariables; /** @@ -148,12 +145,4 @@ private static String[] getArgsForFileAndTimeZone(String file, TimeZone tz) return args; } - - @BeforeClass - public static void beforeClass() - { - //Sets up DB info - Installer installer = new Installer(); - installer.restored(); - } } diff --git a/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/DailyHeadlessInflowCurrentDayControlTest.java b/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/DailyHeadlessInflowCurrentDayControlTest.java index e6802b9..fa8c949 100644 --- a/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/DailyHeadlessInflowCurrentDayControlTest.java +++ b/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/DailyHeadlessInflowCurrentDayControlTest.java @@ -6,25 +6,24 @@ */ package usace.rowcps.headless.calculator.inflow; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.Calendar; import java.util.Date; import java.util.NavigableSet; import java.util.TimeZone; import java.util.logging.Logger; -import org.junit.Test; - import hec.data.DataSetException; import hec.data.location.LocationTemplate; import hec.data.tx.DataSetTxIllegalArgumentException; import hec.db.DbConnectionException; import hec.db.DbException; import hec.db.DbIoException; +import org.junit.jupiter.api.Test; import usace.rowcps.regi.executor.ManagerIdType; import usace.rowcps.regi.model.ManagerId; -import static org.junit.Assert.assertEquals; - /** * * @author Ryan A. Miles (ryanm@rmanet.com) diff --git a/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/HeadlessInflowOptionsTest.java b/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/HeadlessInflowOptionsTest.java index a959776..e3f2d00 100644 --- a/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/HeadlessInflowOptionsTest.java +++ b/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/HeadlessInflowOptionsTest.java @@ -6,9 +6,11 @@ */ package usace.rowcps.headless.calculator.inflow; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Arrays; -import static org.junit.Assert.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import usace.rowcps.data.inflow.InflowDataType; /** diff --git a/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/InflowComputationStorageOptionTest.java b/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/InflowComputationStorageOptionTest.java index 054c918..e04155d 100644 --- a/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/InflowComputationStorageOptionTest.java +++ b/regi-headless/src/test/java/usace/rowcps/headless/calculator/inflow/InflowComputationStorageOptionTest.java @@ -6,10 +6,11 @@ */ package usace.rowcps.headless.calculator.inflow; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; import usace.rowcps.data.inflow.InflowDataType; /** @@ -38,7 +39,7 @@ public void validateUniqueInflowDataTypes() if (!nonUniqueDataTypes.isEmpty()) { - assertTrue("Non unique data types found: " + nonUniqueDataTypes.toString(), false); + assertTrue(false, "Non unique data types found: " + nonUniqueDataTypes); } } }