http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/LICENSE ---------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d645695..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License.
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/NOTICE ---------------------------------------------------------------------- diff --git a/NOTICE b/NOTICE deleted file mode 100644 index c0c89f8..0000000 --- a/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -Apache Climate Model Diagnostic Analyzer -Copyright 2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md deleted file mode 100644 index f1ba5d7..0000000 --- a/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Apache Climate Model Diagnostic Analyzer -================ - -The Climate Model Diagnostic Analyzer (CMDA) provides web services for multi-aspect physics-based and phenomenon-oriented climate model performance evaluation and diagnosis through the comprehensive and synergistic use of multiple observational data, reanalysis data, and model outputs. - -Requirements -============ -Java 1.6+ (http://www.oracle.com/technetwork/java/javase/downloads) - -Play 2.2.x (http://www.playframework.com/download) - http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/activator ---------------------------------------------------------------------- diff --git a/activator b/activator deleted file mode 100755 index 59c131b..0000000 --- a/activator +++ /dev/null @@ -1,334 +0,0 @@ -#!/bin/bash - -### ------------------------------- ### -### Helper methods for BASH scripts ### -### ------------------------------- ### - -realpath () { -( - TARGET_FILE="$1" - - cd $(dirname "$TARGET_FILE") - TARGET_FILE=$(basename "$TARGET_FILE") - - COUNT=0 - while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ] - do - TARGET_FILE=$(readlink "$TARGET_FILE") - cd $(dirname "$TARGET_FILE") - TARGET_FILE=$(basename "$TARGET_FILE") - COUNT=$(($COUNT + 1)) - done - - if [ "$TARGET_FILE" == "." -o "$TARGET_FILE" == ".." ]; then - cd "$TARGET_FILE" - TARGET_FILEPATH= - else - TARGET_FILEPATH=/$TARGET_FILE - fi - - # make sure we grab the actual windows path, instead of cygwin's path. - if ! is_cygwin; then - echo "$(pwd -P)/$TARGET_FILE" - else - echo $(cygwinpath "$(pwd -P)/$TARGET_FILE") - fi -) -} - -# TODO - Do we need to detect msys? - -# Uses uname to detect if we're in the odd cygwin environment. -is_cygwin() { - local os=$(uname -s) - case "$os" in - CYGWIN*) return 0 ;; - *) return 1 ;; - esac -} - -# This can fix cygwin style /cygdrive paths so we get the -# windows style paths. -cygwinpath() { - local file="$1" - if is_cygwin; then - echo $(cygpath -w $file) - else - echo $file - fi -} - -# Make something URI friendly -make_url() { - url="$1" - local nospaces=${url// /%20} - if is_cygwin; then - echo "/${nospaces//\\//}" - else - echo "$nospaces" - fi -} - -# Detect if we should use JAVA_HOME or just try PATH. -get_java_cmd() { - if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then - echo "$JAVA_HOME/bin/java" - else - echo "java" - fi -} - -echoerr () { - echo 1>&2 "$@" -} -vlog () { - [[ $verbose || $debug ]] && echoerr "$@" -} -dlog () { - [[ $debug ]] && echoerr "$@" -} -execRunner () { - # print the arguments one to a line, quoting any containing spaces - [[ $verbose || $debug ]] && echo "# Executing command line:" && { - for arg; do - if printf "%s\n" "$arg" | grep -q ' '; then - printf "\"%s\"\n" "$arg" - else - printf "%s\n" "$arg" - fi - done - echo "" - } - - exec "$@" -} -addJava () { - dlog "[addJava] arg = '$1'" - java_args=( "${java_args[@]}" "$1" ) -} -addApp () { - dlog "[addApp] arg = '$1'" - sbt_commands=( "${app_commands[@]}" "$1" ) -} -addResidual () { - dlog "[residual] arg = '$1'" - residual_args=( "${residual_args[@]}" "$1" ) -} -addDebugger () { - addJava "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1" -} -addConfigOpts () { - dlog "[addConfigOpts] arg = '$*'" - for item in $* - do - addJava "$item" - done -} -# a ham-fisted attempt to move some memory settings in concert -# so they need not be messed around with individually. -get_mem_opts () { - local mem=${1:-1024} - local meta=$(( $mem / 4 )) - (( $meta > 256 )) || meta=256 - (( $meta < 1024 )) || meta=1024 - - # default is to set memory options but this can be overridden by code section below - memopts="-Xms${mem}m -Xmx${mem}m" - if [[ "${java_version}" > "1.8" ]]; then - extmemopts="-XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=${meta}m" - else - extmemopts="-XX:PermSize=64m -XX:MaxPermSize=${meta}m" - fi - - if [[ "${java_opts}" == *-Xmx* ]] || [[ "${java_opts}" == *-Xms* ]] || [[ "${java_opts}" == *-XX:MaxPermSize* ]] || [[ "${java_opts}" == *-XX:ReservedCodeCacheSize* ]] || [[ "${java_opts}" == *-XX:MaxMetaspaceSize* ]]; then - # if we detect any of these settings in ${java_opts} we need to NOT output our settings. - # The reason is the Xms/Xmx, if they don't line up, cause errors. - memopts="" - extmemopts="" - fi - - echo "${memopts} ${extmemopts}" -} -require_arg () { - local type="$1" - local opt="$2" - local arg="$3" - if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then - die "$opt requires <$type> argument" - fi -} -is_function_defined() { - declare -f "$1" > /dev/null -} - -# If we're *not* running in a terminal, and we don't have any arguments, then we need to add the 'ui' parameter -detect_terminal_for_ui() { - [[ ! -t 0 ]] && [[ "${#residual_args}" == "0" ]] && { - addResidual "ui" - } - # SPECIAL TEST FOR MAC - [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]] && [[ "${#residual_args}" == "0" ]] && { - echo "Detected MAC OSX launched script...." - echo "Swapping to UI" - addResidual "ui" - } -} - -# Processes incoming arguments and places them in appropriate global variables. called by the run method. -process_args () { - while [[ $# -gt 0 ]]; do - case "$1" in - -h|-help) usage; exit 1 ;; - -v|-verbose) verbose=1 && shift ;; - -d|-debug) debug=1 && shift ;; - -mem) require_arg integer "$1" "$2" && app_mem="$2" && shift 2 ;; - -jvm-debug) - if echo "$2" | grep -E ^[0-9]+$ > /dev/null; then - addDebugger "$2" && shift - else - addDebugger 9999 - fi - shift ;; - -java-home) require_arg path "$1" "$2" && java_cmd="$2/bin/java" && shift 2 ;; - -D*) addJava "$1" && shift ;; - -J*) addJava "${1:2}" && shift ;; - *) addResidual "$1" && shift ;; - esac - done - - is_function_defined process_my_args && { - myargs=("${residual_args[@]}") - residual_args=() - process_my_args "${myargs[@]}" - } -} - -# Actually runs the script. -run() { - # TODO - check for sane environment - - # process the combined args, then reset "$@" to the residuals - process_args "$@" - detect_terminal_for_ui - set -- "${residual_args[@]}" - argumentCount=$# - - #check for jline terminal fixes on cygwin - if is_cygwin; then - stty -icanon min 1 -echo > /dev/null 2>&1 - addJava "-Djline.terminal=jline.UnixTerminal" - addJava "-Dsbt.cygwin=true" - fi - - # run sbt - execRunner "$java_cmd" \ - "-Dactivator.home=$(make_url "$activator_home")" \ - $(get_mem_opts $app_mem) \ - ${java_opts[@]} \ - ${java_args[@]} \ - -jar "$app_launcher" \ - "${app_commands[@]}" \ - "${residual_args[@]}" - - local exit_code=$? - if is_cygwin; then - stty icanon echo > /dev/null 2>&1 - fi - exit $exit_code -} - -# Loads a configuration file full of default command line options for this script. -loadConfigFile() { - cat "$1" | sed '/^\#/d' -} - -### ------------------------------- ### -### Start of customized settings ### -### ------------------------------- ### -usage() { - cat <<EOM -Usage: $script_name <command> [options] - - Command: - ui Start the Activator UI - new [name] [template-id] Create a new project with [name] using template [template-id] - list-templates Print all available template names - -h | -help Print this message - - Options: - -v | -verbose Make this runner chattier - -d | -debug Set sbt log level to debug - -mem <integer> Set memory options (default: $sbt_mem, which is $(get_mem_opts $sbt_mem)) - -jvm-debug <port> Turn on JVM debugging, open at the given port. - - # java version (default: java from PATH, currently $(java -version 2>&1 | grep version)) - -java-home <path> Alternate JAVA_HOME - - # jvm options and output control - -Dkey=val Pass -Dkey=val directly to the java runtime - -J-X Pass option -X directly to the java runtime - (-J is stripped) - - # environment variables (read from context) - JAVA_OPTS Environment variable, if unset uses "" - SBT_OPTS Environment variable, if unset uses "" - ACTIVATOR_OPTS Environment variable, if unset uses "" - -In the case of duplicated or conflicting options, the order above -shows precedence: environment variables lowest, command line options highest. -EOM -} - -### ------------------------------- ### -### Main script ### -### ------------------------------- ### - -declare -a residual_args -declare -a java_args -declare -a app_commands -declare -r real_script_path="$(realpath "$0")" -declare -r activator_home="$(realpath "$(dirname "$real_script_path")")" -declare -r app_version="1.2.12" - -declare -r app_launcher="${activator_home}/activator-launch-${app_version}.jar" -declare -r script_name=activator -declare -r java_cmd=$(get_java_cmd) -declare -r java_opts=( "${ACTIVATOR_OPTS[@]}" "${SBT_OPTS[@]}" "${JAVA_OPTS[@]}" "${java_opts[@]}" ) -userhome="$HOME" -if is_cygwin; then - # cygwin sets home to something f-d up, set to real windows homedir - userhome="$USERPROFILE" -fi -declare -r activator_user_home_dir="${userhome}/.activator" -declare -r java_opts_config_home="${activator_user_home_dir}/activatorconfig.txt" -declare -r java_opts_config_version="${activator_user_home_dir}/${app_version}/activatorconfig.txt" - -# Now check to see if it's a good enough version -declare -r java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}') -if [[ "$java_version" == "" ]]; then - echo - echo No java installations was detected. - echo Please go to http://www.java.com/getjava/ and download - echo - exit 1 -elif [[ ! "$java_version" > "1.6" ]]; then - echo - echo The java installation you have is not up to date - echo Activator requires at least version 1.6+, you have - echo version $java_version - echo - echo Please go to http://www.java.com/getjava/ and download - echo a valid Java Runtime and install before running Activator. - echo - exit 1 -fi - -# if configuration files exist, prepend their contents to the java args so it can be processed by this runner -# a "versioned" config trumps one on the top level -if [[ -f "$java_opts_config_version" ]]; then - addConfigOpts $(loadConfigFile "$java_opts_config_version") -elif [[ -f "$java_opts_config_home" ]]; then - addConfigOpts $(loadConfigFile "$java_opts_config_home") -fi - -run "$@" http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/activator-launch-1.2.12.jar ---------------------------------------------------------------------- diff --git a/activator-launch-1.2.12.jar b/activator-launch-1.2.12.jar deleted file mode 100644 index 4a8963c..0000000 Binary files a/activator-launch-1.2.12.jar and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/activator-sbt-echo-play-shim.sbt ---------------------------------------------------------------------- diff --git a/activator-sbt-echo-play-shim.sbt b/activator-sbt-echo-play-shim.sbt deleted file mode 100644 index 1ffdc88..0000000 --- a/activator-sbt-echo-play-shim.sbt +++ /dev/null @@ -1 +0,0 @@ -echoPlaySettings \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/activator.bat ---------------------------------------------------------------------- diff --git a/activator.bat b/activator.bat deleted file mode 100644 index d078287..0000000 --- a/activator.bat +++ /dev/null @@ -1,227 +0,0 @@ -@REM activator launcher script -@REM -@REM Envioronment: -@REM JAVA_HOME - location of a JDK home dir (optional if java on path) -@REM CFG_OPTS - JVM options (optional) -@REM Configuration: -@REM activatorconfig.txt found in the ACTIVATOR_HOME or ACTIVATOR_HOME/ACTIVATOR_VERSION -@setlocal enabledelayedexpansion - -@echo off - -set "var1=%~1" -if defined var1 ( - if "%var1%"=="help" ( - echo. - echo Usage activator [options] [command] - echo. - echo Commands: - echo ui Start the Activator UI - echo new [name] [template-id] Create a new project with [name] using template [template-id] - echo list-templates Print all available template names - echo help Print this message - echo. - echo Options: - echo -jvm-debug [port] Turn on JVM debugging, open at the given port. Defaults to 9999 if no port given. - echo. - echo Environment variables ^(read from context^): - echo JAVA_OPTS Environment variable, if unset uses "" - echo SBT_OPTS Environment variable, if unset uses "" - echo ACTIVATOR_OPTS Environment variable, if unset uses "" - echo. - goto :end - ) -) - -if "%ACTIVATOR_HOME%"=="" ( - set "ACTIVATOR_HOME=%~dp0" - @REM remove trailing "\" from path - set ACTIVATOR_HOME=!ACTIVATOR_HOME:~0,-1! -) - -set ERROR_CODE=0 -set APP_VERSION=1.2.12 -set ACTIVATOR_LAUNCH_JAR=activator-launch-%APP_VERSION%.jar - -rem Detect if we were double clicked, although theoretically A user could -rem manually run cmd /c -for %%x in (%cmdcmdline%) do if %%~x==/c set DOUBLECLICKED=1 - -rem FIRST we load a config file of extra options (if there is one) -set "CFG_FILE_HOME=%UserProfile%\.activator\activatorconfig.txt" -set "CFG_FILE_VERSION=%UserProfile%\.activator\%APP_VERSION%\activatorconfig.txt" -set CFG_OPTS= -if exist %CFG_FILE_VERSION% ( - FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE_VERSION%") DO ( - set DO_NOT_REUSE_ME=%%i - rem ZOMG (Part #2) WE use !! here to delay the expansion of - rem CFG_OPTS, otherwise it remains "" for this loop. - set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME! - ) -) -if "%CFG_OPTS%"=="" ( - if exist %CFG_FILE_HOME% ( - FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE_HOME%") DO ( - set DO_NOT_REUSE_ME=%%i - rem ZOMG (Part #2) WE use !! here to delay the expansion of - rem CFG_OPTS, otherwise it remains "" for this loop. - set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME! - ) - ) -) - -rem We use the value of the JAVACMD environment variable if defined -set _JAVACMD=%JAVACMD% - -if "%_JAVACMD%"=="" ( - if not "%JAVA_HOME%"=="" ( - if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe" - - rem if there is a java home set we make sure it is the first picked up when invoking 'java' - SET "PATH=%JAVA_HOME%\bin;%PATH%" - ) -) - -if "%_JAVACMD%"=="" set _JAVACMD=java - -rem Detect if this java is ok to use. -for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do ( - if %%~j==Java set JAVAINSTALLED=1 -) - -rem Detect the same thing about javac -if "%_JAVACCMD%"=="" ( - if not "%JAVA_HOME%"=="" ( - if exist "%JAVA_HOME%\bin\javac.exe" set "_JAVACCMD=%JAVA_HOME%\bin\javac.exe" - ) -) -if "%_JAVACCMD%"=="" set _JAVACCMD=javac -for /F %%j in ('"%_JAVACCMD%" -version 2^>^&1') do ( - if %%~j==javac set JAVACINSTALLED=1 -) - -rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style -set JAVAOK=true -if not defined JAVAINSTALLED set JAVAOK=false -if not defined JAVACINSTALLED set JAVAOK=false - -if "%JAVAOK%"=="false" ( - echo. - echo A Java JDK is not installed or can't be found. - if not "%JAVA_HOME%"=="" ( - echo JAVA_HOME = "%JAVA_HOME%" - ) - echo. - echo Please go to - echo http://www.oracle.com/technetwork/java/javase/downloads/index.html - echo and download a valid Java JDK and install before running Activator. - echo. - echo If you think this message is in error, please check - echo your environment variables to see if "java.exe" and "javac.exe" are - echo available via JAVA_HOME or PATH. - echo. - if defined DOUBLECLICKED pause - exit /B 1 -) - -rem Check what Java version is being used to determine what memory options to use -for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do ( - set JAVA_VERSION=%%g -) - -rem Strips away the " characters -set JAVA_VERSION=%JAVA_VERSION:"=% - -rem TODO Check if there are existing mem settings in JAVA_OPTS/CFG_OPTS and use those instead of the below -for /f "delims=. tokens=1-3" %%v in ("%JAVA_VERSION%") do ( - set MAJOR=%%v - set MINOR=%%w - set BUILD=%%x - - set META_SIZE=-XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=256M - if "!MINOR!" LSS "8" ( - set META_SIZE=-XX:PermSize=64M -XX:MaxPermSize=256M - ) - - set MEM_OPTS=!META_SIZE! - ) - -rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config. -set _JAVA_OPTS=%JAVA_OPTS% -if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=%CFG_OPTS% - -set DEBUG_OPTS= - -rem Loop through the arguments, building remaining args in args variable -set args= -:argsloop -if not "%~1"=="" ( - rem Checks if the argument contains "-D" and if true, adds argument 1 with 2 and puts an equal sign between them. - rem This is done since batch considers "=" to be a delimiter so we need to circumvent this behavior with a small hack. - set arg1=%~1 - if "!arg1:~0,2!"=="-D" ( - set "args=%args% "%~1"="%~2"" - shift - shift - goto argsloop - ) - - if "%~1"=="-jvm-debug" ( - if not "%~2"=="" ( - rem This piece of magic somehow checks that an argument is a number - for /F "delims=0123456789" %%i in ("%~2") do ( - set var="%%i" - ) - if defined var ( - rem Not a number, assume no argument given and default to 9999 - set JPDA_PORT=9999 - ) else ( - rem Port was given, shift arguments - set JPDA_PORT=%~2 - shift - ) - ) else ( - set JPDA_PORT=9999 - ) - shift - - set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=!JPDA_PORT! - goto argsloop - ) - rem else - set "args=%args% "%~1"" - shift - goto argsloop -) - -:run - -if "!args!"=="" ( - if defined DOUBLECLICKED ( - set CMDS="ui" - ) else set CMDS=!args! -) else set CMDS=!args! - -rem We add a / in front, so we get file:///C: instead of file://C: -rem Java considers the later a UNC path. -rem We also attempt a solid effort at making it URI friendly. -rem We don't even bother with UNC paths. -set JAVA_FRIENDLY_HOME_1=/!ACTIVATOR_HOME:\=/! -set JAVA_FRIENDLY_HOME=/!JAVA_FRIENDLY_HOME_1: =%%20! - -rem Checks if the command contains spaces to know if it should be wrapped in quotes or not -set NON_SPACED_CMD=%_JAVACMD: =% -if "%_JAVACMD%"=="%NON_SPACED_CMD%" %_JAVACMD% %DEBUG_OPTS% %MEM_OPTS% %ACTIVATOR_OPTS% %SBT_OPTS% %_JAVA_OPTS% "-Dactivator.home=%JAVA_FRIENDLY_HOME%" -jar "%ACTIVATOR_HOME%\%ACTIVATOR_LAUNCH_JAR%" %CMDS% -if NOT "%_JAVACMD%"=="%NON_SPACED_CMD%" "%_JAVACMD%" %DEBUG_OPTS% %MEM_OPTS% %ACTIVATOR_OPTS% %SBT_OPTS% %_JAVA_OPTS% "-Dactivator.home=%JAVA_FRIENDLY_HOME%" -jar "%ACTIVATOR_HOME%\%ACTIVATOR_LAUNCH_JAR%" %CMDS% - -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end - -@endlocal - -exit /B %ERROR_CODE% http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/AboutusController.java ---------------------------------------------------------------------- diff --git a/app/controllers/AboutusController.java b/app/controllers/AboutusController.java deleted file mode 100644 index 6954462..0000000 --- a/app/controllers/AboutusController.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package controllers; - -import play.mvc.*; -import views.html.climate.*; - -public class AboutusController extends Controller { - - public static Result aboutUs() { - return ok(aboutus.render("test")); - } - - public static Result aboutProject(){ - return ok(aboutProject.render("test")); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/AccountController.java ---------------------------------------------------------------------- diff --git a/app/controllers/AccountController.java b/app/controllers/AccountController.java deleted file mode 100644 index 804125f..0000000 --- a/app/controllers/AccountController.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package controllers; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import models.metadata.ServiceLog; -import play.Logger; -import play.data.Form; -import play.libs.Json; -import play.mvc.*; -import util.APICall; -import util.APICall.ResponseType; -import views.html.climate.*; - -public class AccountController extends Controller { - - final static Form<ServiceLog> serviceLogForm = Form - .form(ServiceLog.class); - - public static Result getServiceLog() { - return ok(serviceLog.render(ServiceLog.all(), - serviceLogForm)); - } - - public static Result syncData(){ - return ok(serviceLog.render(ServiceLog.syncDataByPurpose(), - serviceLogForm)); - } - - public static Result searchServiceLog() { - return ok(searchServiceLog.render(serviceLogForm)); - } - - public static Result getSearchServiceLogOneDimension() { - Form<ServiceLog> dc = serviceLogForm.bindFromRequest(); - ObjectNode jsonData = Json.newObject(); - String dataSource = ""; - String variableName = ""; - String executionPurpose = ""; - String userId = ""; - String startTime = ""; - String endTime = ""; - String dataSetStartTime = ""; - String dataSetEndTime = ""; - Date executionStartTime = null, executionEndTime= null; - - try { - dataSource = dc.field("Data Source").value().replace("/", "_"); - variableName = dc.field("Variable Name").value(); - executionPurpose = dc.field("Execution Purpose").value(); - startTime = dc.field("Execution Start Time").value(); - endTime = dc.field("Execution End Time").value(); - dataSetStartTime = dc.field("Dataset Start Time").value(); - dataSetEndTime = dc.field("Dataset End Time").value(); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); - - if (!startTime.isEmpty()) { - try { - executionStartTime = simpleDateFormat.parse(startTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + startTime); - return badRequest("Wrong Date Format :" + startTime); - } - } - - if (!endTime.isEmpty()) { - try { - executionEndTime = simpleDateFormat.parse(endTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + endTime); - return badRequest("Wrong Date Format :" + endTime); - } - } - - if (variableName.equals("Air Temperature")) { - variableName = "ta"; - } else if (variableName.equals("Cloud Ice Water Content")) { - variableName = "cli"; - } else if (variableName.equals("Cloud Liquid Water Content")) { - variableName = "clw"; - } else if (variableName.equals("Eastward Near-Surface Wind")) { - variableName = "uas"; - } else if (variableName.equals("Equivalent Water Height Over Land")) { - variableName = "zl"; - } else if (variableName - .equals("Equivalent Water Height Over Ocean")) { - variableName = "zo"; - } else if (variableName.equals("Leaf Area Index")) { - variableName = "lai"; - } else if (variableName.equals("Near-Surface Air Temperature")) { - variableName = "tas"; - } else if (variableName.equals("Near-Surface Relative Humidity")) { - variableName = "hurs"; - } else if (variableName.equals("Near-Surface Wind Speed")) { - variableName = "sfcWind"; - } else if (variableName.equals("Northward Near-Surface Wind")) { - variableName = "vas"; - } else if (variableName - .equals("Ocean Heat Content Anomaly within 2000 m Depth")) { - variableName = "ohc2000"; - } else if (variableName - .equals("Ocean Heat Content Anomaly within 700 m Depth")) { - variableName = "ohc700"; - } else if (variableName.equals("Ocean Salinity")) { - variableName = "os"; - } else if (variableName.equals("Ocean Temperature")) { - variableName = "ot"; - } else if (variableName.equals("Precipitation Flux")) { - variableName = "pr"; - } else if (variableName.equals("Relative Humidity")) { - variableName = "hur"; - } else if (variableName.equals("Sea Surface Height")) { - variableName = "zos"; - } else if (variableName.equals("Sea Surface Temperature")) { - variableName = "tos"; - } else if (variableName.equals("Specific Humidity")) { - variableName = "hus"; - } else if (variableName - .equals("Surface Downwelling Clear-Sky Longwave Radiation")) { - variableName = "rldscs"; - } else if (variableName - .equals("Surface Downwelling Clear-Sky Shortwave Radiation")) { - variableName = "rsdscs"; - } else if (variableName - .equals("Surface Downwelling Longwave Radiation")) { - variableName = "rlds"; - } else if (variableName - .equals("Surface Downwelling Shortwave Radiation")) { - variableName = "rsds"; - } else if (variableName.equals("Surface Temperature")) { - variableName = "ts"; - } else if (variableName - .equals("Surface Upwelling Clear-Sky Shortwave Radiation")) { - variableName = "rsuscs"; - } else if (variableName - .equals("Surface Upwelling Longwave Radiation")) { - variableName = "rlus"; - } else if (variableName - .equals("Surface Upwelling Shortwave Radiation")) { - variableName = "rsus"; - } else if (variableName.equals("TOA Incident Shortwave Radiation")) { - variableName = "rsdt"; - } else if (variableName - .equals("TOA Outgoing Clear-Sky Longwave Radiation")) { - variableName = "rlutcs"; - } else if (variableName - .equals("TOA Outgoing Clear-Sky Shortwave Radiation")) { - variableName = "rsutcs"; - } else if (variableName.equals("TOA Outgoing Longwave Radiation")) { - variableName = "rlut"; - } else if (variableName.equals("TOA Outgoing Shortwave Radiation")) { - variableName = "rsut"; - } else if (variableName.equals("Total Cloud Fraction")) { - variableName = "clt"; - } else if (variableName.equals("Vertical Wind Velocity")) { - variableName = "wap"; - } - - } catch (IllegalStateException e) { - e.printStackTrace(); - Application.flashMsg(APICall - .createResponse(ResponseType.CONVERSIONERROR)); - } catch (Exception e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - - Map<String, String> parameters = new HashMap<String, String>(); - parameters.put("model", dataSource); - parameters.put("var", variableName); - parameters.put("startT", dataSetStartTime); - parameters.put("endT", dataSetEndTime); - List<ServiceLog> response = ServiceLog.queryExecutionLogs(userId, executionStartTime, executionEndTime, executionPurpose, dataSetStartTime, dataSetEndTime, parameters); - return ok(searchLogResult.render(response)); - - } - - public static Result getSearchServiceLog() { - Form<ServiceLog> dc = serviceLogForm.bindFromRequest(); - String userId = "", startTime = "", endTime = ""; - Date start=null, end=null; - - try { - startTime = dc.field("Start Time").value(); - endTime = dc.field("End Time").value(); - Logger.info(""+startTime); - Logger.info(""+endTime); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm"); - - if (!startTime.isEmpty()) { - try { - start = simpleDateFormat.parse(startTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + startTime); - return badRequest("Wrong Date Format :" + startTime); - } - } - - if (!endTime.isEmpty()) { - try { - end = simpleDateFormat.parse(endTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + endTime); - return badRequest("Wrong Date Format :" + endTime); - } - } - } catch (IllegalStateException e) { - e.printStackTrace(); - Application.flashMsg(APICall - .createResponse(ResponseType.CONVERSIONERROR)); - } catch (Exception e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - - List<ServiceLog> response = ServiceLog.queryExecutionLogs(userId, start, end, null, null, null, null); - return ok(searchLogResult.render(response)); - } - - public static Result getSearchServiceLogForWorkflow() { - Form<ServiceLog> dc = serviceLogForm.bindFromRequest(); - ObjectNode jsonData = Json.newObject(); - String userId = "123", startTime = "", endTime = ""; - Date start=null, end=null; - try { - - userId = dc.field("User Id").value().replace(" ", "%20"); - startTime = dc.field("Start Time").value(); - endTime = dc.field("End Time").value(); - Logger.info(""+startTime); - Logger.info(""+endTime); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); - - if (!startTime.isEmpty()) { - try { - start = simpleDateFormat.parse(startTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + startTime); - return badRequest("Wrong Date Format :" + startTime); - } - } - - if (!endTime.isEmpty()) { - try { - end = simpleDateFormat.parse(endTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + endTime); - return badRequest("Wrong Date Format :" + endTime); - } - } - - } catch (IllegalStateException e) { - e.printStackTrace(); - Application.flashMsg(APICall - .createResponse(ResponseType.CONVERSIONERROR)); - } catch (Exception e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - - List<ServiceLog> response = ServiceLog.queryExecutionLogs(userId, start, end, null, null, null, null); - return ok(searchLogResultWorkflow.render(response, userId, startTime, endTime, null)); - } - - public static Result getSearchAndGenerateWorkflow() { - return ok(searchGenerateWorkflow.render(serviceLogForm)); - } - - public static Result getJsonData() { - Form<ServiceLog> dc = serviceLogForm.bindFromRequest(); - ObjectNode jsonData = Json.newObject(); - String userId = "CCS student 1", startTime = "03/05/2015 12:30", endTime = "03/05/2015 12:41"; - Date start=null, end=null; - try { - - userId = dc.field("User Id").value().replace(" ", "%20"); - startTime = dc.field("Start Time").value(); - endTime = dc.field("End Time").value(); - Logger.info(""+startTime); - Logger.info(""+endTime); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm"); - - if (!startTime.isEmpty()) { - try { - start = simpleDateFormat.parse(startTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + startTime); - return badRequest("Wrong Date Format :" + startTime); - } - } - - if (!endTime.isEmpty()) { - try { - end = simpleDateFormat.parse(endTime); - } catch (ParseException e) { - System.out.println("Wrong Date Format :" + endTime); - return badRequest("Wrong Date Format :" + endTime); - } - } - - } catch (IllegalStateException e) { - e.printStackTrace(); - Application.flashMsg(APICall - .createResponse(ResponseType.CONVERSIONERROR)); - } catch (Exception e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - - ObjectMapper mapper = new ObjectMapper(); - ObjectNode queryJson = mapper.createObjectNode(); - if (userId != null && !userId.isEmpty()) { - queryJson.put("userId", userId); - } - if (start != null ) { - queryJson.put("executionStartTime", start.getTime()); - } - if (end != null) { - queryJson.put("executionEndTime", end.getTime()); - } - JsonNode response = APICall.postAPI("http://localhost:9034/workflow/generateWorkflowJson", queryJson); - String resStr = response.toString(); - List<ServiceLog> responseList = ServiceLog.queryExecutionLogs(userId, start, end, null, null, null, null); - return ok(searchLogResultWorkflow.render(responseList,userId, startTime, endTime, resStr)); - } - - public static Result getRecommend() { - JsonNode response = APICall.callAPI("http://einstein.sv.cmu.edu:9026/api/sgraph"); - String resStr = response.toString(); - return ok(views.html.climate.recommend.render(resStr)); - } - - public static Result getLogGraph() { - JsonNode response = APICall.callAPI("http://einstein.sv.cmu.edu:9026/api/ugraph"); - String resStr = response.toString(); - return ok(views.html.climate.recommend.render(resStr)); - } - - public static Result getDatasetRecommend() { - JsonNode response = APICall.callAPI("http://einstein.sv.cmu.edu:9026/api/dgraph"); - String resStr = response.toString(); - return ok(views.html.climate.dataRecommend.render(resStr)); - } - - public static Result getScientistRecommend() { - JsonNode response = APICall.callAPI("http://einstein.sv.cmu.edu:9026/api/scgraph"); - String resStr = response.toString(); - return ok(views.html.climate.dataRecommend.render(resStr)); - } -} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/Application.java ---------------------------------------------------------------------- diff --git a/app/controllers/Application.java b/app/controllers/Application.java deleted file mode 100644 index 943d923..0000000 --- a/app/controllers/Application.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package controllers; - -import java.util.Iterator; -import java.util.Map.Entry; -import com.fasterxml.jackson.databind.JsonNode; -import play.mvc.*; -import views.html.*; - -public class Application extends Controller { - - public static Result index() { - return ok(index.render("")); - } - - public static class Login { - - public String email; - public String password; - - public String validate() { - return null; - } - } - - public static void flashMsg(JsonNode jsonNode){ - Iterator<Entry<String, JsonNode>> it = jsonNode.fields(); - while (it.hasNext()) { - Entry<String, JsonNode> field = it.next(); - flash(field.getKey(),field.getValue().asText()); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/a8965336/app/controllers/BugReportController.java ---------------------------------------------------------------------- diff --git a/app/controllers/BugReportController.java b/app/controllers/BugReportController.java deleted file mode 100644 index f231d32..0000000 --- a/app/controllers/BugReportController.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package controllers; - -import models.BugReport; -import play.data.DynamicForm; -import play.data.Form; -import play.mvc.*; -import util.APICall; -import util.APICall.ResponseType; -import views.html.climate.*; -import java.util.*; - -public class BugReportController extends Controller { - final static Form<BugReport> bugReportForm = Form.form(BugReport.class); - - @play.db.jpa.Transactional - public static Result reports() { - return ok(bugReporting.render(bugReportForm)); - } - - @play.db.jpa.Transactional - public static Result newReport() { - Form<BugReport> filledForm = bugReportForm.bindFromRequest(); - BugReport report = new BugReport(); - - try { - report.setTitle(filledForm.get().getTitle()); - report.setName(filledForm.get().getName()); - report.setEmail(filledForm.get().getEmail()); - report.setOrganization(filledForm.get().getOrganization()); - report.setDescription(filledForm.get().getDescription()); - report.setSolved(0); - report.save(); - return redirect(routes.BugReportController.list()); - } catch (IllegalStateException e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - return ok(bugReporting.render(filledForm)); - } - - @play.db.jpa.Transactional - public static Result list() { - BugReport bugReport = new BugReport(); - List<Object[]> list = BugReport.getAll(); - LinkedList<BugReport> bugList = new LinkedList<BugReport>(); - - for (Object[] e : list) { - BugReport bug = new BugReport(); - bug.setId((Integer)e[0]); - bug.setTitle(e[1].toString()); - bug.setName(e[2].toString()); - bug.setEmail(e[3].toString()); - bug.setOrganization(e[4].toString()); - bug.setDescription(e[5].toString()); - bug.setSolved((Byte)e[6]); - bugList.add(bug); - } - return ok(bugs.render(bugList)); - } - - @play.db.jpa.Transactional - public static Result deleteReport() { - DynamicForm df = DynamicForm.form().bindFromRequest(); - - try { - int id = Integer.valueOf(df.field("idHolder").value()); - - if(BugReport.delete(id)){ - Application.flashMsg(APICall.createResponse(ResponseType.SUCCESS)); - }else { - Application.flashMsg(APICall.createResponse(ResponseType.DELETEERROR)); - } - } catch (Exception e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - return redirect(routes.BugReportController.list()); - } - - @play.db.jpa.Transactional - public static Result solveReport() { - DynamicForm df = DynamicForm.form().bindFromRequest(); - - try { - int id = Integer.valueOf(df.field("idHolder").value()); - - if(BugReport.solve(id)){ - Application.flashMsg(APICall.createResponse(ResponseType.SUCCESS)); - }else { - Application.flashMsg(APICall.createResponse(ResponseType.RESOLVEERROR)); - } - } catch (Exception e) { - e.printStackTrace(); - Application.flashMsg(APICall.createResponse(ResponseType.UNKNOWN)); - } - return redirect(routes.BugReportController.list()); - } -} \ No newline at end of file