Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (6)
Showing
with 909 additions and 0 deletions
File deleted
{
"extends": "standard"
}
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
File moved
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
# Created by https://www.gitignore.io/api/java-web,androidstudio,jetbrains+all
### AndroidStudio ###
# Covers files to be ignored for android development using Android Studio.
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle
.gradle/
build/
# Signing files
.signing/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
captures/
.navigation/
*.ipr
*~
*.swp
# Android Patch
gen-external-apklibs
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# NDK
obj/
# IntelliJ IDEA
*.iml
*.iws
/out/
# User-specific configurations
.idea/libraries/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Legacy Eclipse project files
.classpath
.project
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.war
*.ear
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
hs_err_pid*
## Plugin-specific files:
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Mongo Explorer plugin
.idea/mongoSettings.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### AndroidStudio Patch ###
!/gradle/wrapper/gradle-wrapper.jar
### Java-Web ###
## ignoring target file
target/
### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
## Plugin-specific files:
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
.idea/replstate.xml
# Ruby plugin and RubyMine
/.rakeTasks
# Crashlytics plugin (for Android Studio and IntelliJ)
### JetBrains+all Patch ###
# Ignores the whole idea folder
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
.idea/
# End of https://www.gitignore.io/api/java-web,androidstudio,jetbrains+all
plugins {
id 'java'
id 'war'
id 'org.akhikhl.gretty'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':SharedLibrary')
// https://mvnrepository.com/artifact/junit/junit
testCompile 'junit:junit:4.12'
// https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api
providedCompile 'javax.servlet:javax.servlet-api:4.0.0'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile 'com.google.code.gson:gson:2.8.2'
// https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-ri
gretty 'com.sun.xml.ws:jaxws-ri:2.3.0'
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
gretty 'mysql:mysql-connector-java:8.0.8-dmr'
}
package com.adaapa.identityservice.models;
import com.adaapa.bean.UserBean;
import com.adaapa.models.BaseModel;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
public class UserModel extends BaseModel {
Connection conn;
public UserModel(){
super("users","id");
}
public UserBean parseResultSet(ResultSet rs) throws SQLException {
UserBean res = new UserBean();
res.id = rs.getInt("id");
res.name = rs.getString("name");
res.email = rs.getString("email");
res.username = rs.getString("username");
res.phoneNumber = rs.getString("phone_number");
return res;
}
public UserBean findUser(Integer id) {
UserBean res = null;
try {
ResultSet rs = find(id);
if (rs.next()) {
res = parseResultSet(rs);
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public UserBean findUser(String username) {
UserBean res = null;
try {
ResultSet rs = query(String.format("SELECT * FROM %s WHERE username = '%s'", tableName, username ));;
if (rs.next()) {
res = parseResultSet(rs);
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public UserBean findUserByEmail(String email) {
UserBean res = null;
try {
ResultSet rs = query(String.format("SELECT * FROM %s WHERE email = '%s'", tableName, email));
;
if (rs.next()) {
res = parseResultSet(rs);
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
/**
*
* @param username Username yang diterima oleh servlet
* @param password Password yang diterima oleh servlet
* @return UserBean object jika terautentikasi, null jika tidak
*/
public UserBean authenticate(String username, String password) {
UserBean ubean = null;
try {
ResultSet rs = query(String.format(
"SELECT * FROM %s WHERE username = '%s' and password = '%s'",
tableName, username, password));
if(rs.next()) {
ubean = parseResultSet(rs);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
return ubean;
}
}
/**
* Menyimpan token yang telah digenerate
* @param token token yang sudah digenerate oleh generate token
* @return true jika token berhasil disimpan, false jika tidak berhasil
*/
public Boolean saveToken(Integer userId, String token) {
try {
ResultSet rs = queryUpdate(String.format(
"UPDATE %s SET last_token='%s',token_expire=DATE_ADD(now(), INTERVAL 7 DAY) where id=%d", this.tableName, token, userId
));
} catch (SQLException e) {
e.printStackTrace();
}
return true;
}
public Boolean deleteToken(String token) {
try {
ResultSet rs = queryUpdate(String.format(
"UPDATE %s SET last_token=%s,token_expire=%s WHERE last_token='%s'",this.tableName,null,null,token
));
} catch (SQLException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
*
* @return Userbean dimana token ditemukan, null validasi gagal
*/
public UserBean validateToken() {
return null;
}
/**
* Fungsi untuk menyimpan data user yang akan diregister ke database
* @param user bean dari servlet
* @param password password yang diterima oleh servlet
* @return id yang didapatkan oleh user yang teregister, null jika register gagal
*/
public Integer register(UserBean user, String password) {
UserBean ubean = null;
Integer res = null;
UserBean ubeanuname = findUser(user.getUsername());
UserBean ubeanemail = findUserByEmail(user.getEmail());
if(ubeanuname == null && ubeanemail == null) {
ResultSet resultSet = null;
try {
resultSet = queryUpdate(String.format(
"INSERT INTO %s (name,email,username,password,phone_number)"
+ "VALUES ('%s','%s','%s','%s','%s')",
tableName,user.name,user.email,user.username, password, user.phoneNumber
));
} catch (Exception e) {
e.printStackTrace();
}
try {
ResultSet temp = query(String.format(
"SELECT * FROM %s WHERE username = '%s'", this.tableName, user.getUsername()));
if(temp.next()) {
ubean = parseResultSet(temp);
}
} catch (Exception e) {
e.printStackTrace();
}
res = ubean.getId();
}
return res;
}
public UserBean findUserByToken(String token) {
UserBean res = null;
try {
ResultSet rs = query(String.format("SELECT * FROM %s WHERE last_token = '%s'", tableName, token ));;
if (rs.next()) {
Timestamp timestamp = rs.getTimestamp("token_expire");
Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
if(timestamp.after(currentTimestamp)) {
res = parseResultSet(rs);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
public void updateTokenLifetime(Integer userId) {
try {
ResultSet rs = queryUpdate(String.format(
"UPDATE %s SET token_expire=DATE_ADD(now(), INTERVAL 7 DAY) where id=%d", this.tableName, userId
));
} catch (SQLException e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.adaapa.identityservice.services;
import java.util.Base64;
import java.util.Random;
public class TokenService {
//TODO: generate Token
/**
* Generate token menghasilkan token string random
* @return token yang telah digenerate
*/
//TODO:Generate Token, validate token, regenerate token(bonus)
public String generateToken(){
byte [] r = new byte[96];
Random rand = new Random();
rand.nextBytes(r);
String s = Base64.getEncoder().encodeToString(r);
return s;
}
}
package com.adaapa.identityservice.servlets;
import com.adaapa.bean.LoginResponseBean;
import com.adaapa.bean.UserBean;
import com.adaapa.identityservice.models.UserModel;
import com.adaapa.identityservice.services.TokenService;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by kennethhalim on 10/26/17.
*/
public class LoginServlet extends HttpServlet {
private String message;
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
TokenService tokenService = new TokenService();
String username = req.getParameter("username");
String password = req.getParameter("password");
PrintWriter out = resp.getWriter();
Gson gson = new Gson();
UserModel userModel = new UserModel();
UserBean user= userModel.authenticate(username, password);
UserBean responseUser = new UserBean();
if(user != null) {
//Call Generate token here, then save it to database via usermodel;
responseUser.username = user.username;
String access_token = tokenService.generateToken();
userModel.saveToken(user.id, access_token);
out.println(gson.toJson(new LoginResponseBean("accepted",access_token, LoginResponseBean.TOKEN_AGE_DEFAULT, responseUser)));
} else {
out.println(gson.toJson(new LoginResponseBean("failed","",0,null)));
}
}
public void destroy() {
// do nothing.
}
}
package com.adaapa.identityservice.servlets;
import com.adaapa.bean.LogoutResponseBean;
import com.adaapa.identityservice.models.UserModel;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LogoutServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String token = req.getParameter("access_token");
UserModel userModel = new UserModel();
PrintWriter out = resp.getWriter();
LogoutResponseBean logoutResponse = new LogoutResponseBean();
if(userModel.deleteToken(token)){
logoutResponse.setStatus("accepted");
} else {
logoutResponse.setStatus("failed");
}
Gson gson = new Gson();
out.println(gson.toJson(logoutResponse));
}
}
package com.adaapa.identityservice.servlets;
import com.adaapa.bean.LoginResponseBean;
import com.adaapa.bean.UserBean;
import com.adaapa.identityservice.models.UserModel;
import com.adaapa.identityservice.services.TokenService;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RegisterServlet extends HttpServlet{
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
//Implement Register Here
UserBean user = new UserBean();
UserModel userModel = new UserModel();
UserModel usermodel = new UserModel();
TokenService tokenService = new TokenService();
//Parsing data
PrintWriter out = resp.getWriter();
user.name = req.getParameter("name");
user.username = req.getParameter("username");
user.email = req.getParameter("email");
user.phoneNumber = req.getParameter("phoneNumber");
String password = req.getParameter("password");
Gson gson = new Gson();
user.id = userModel.register(user,password);
UserBean responseUser = new UserBean();
if(user.id != null) {
//Register berhasil
//Generate token here, then save token
String token = tokenService.generateToken();
userModel.saveToken(user.id, token);
responseUser.username = user.username;
out.println(gson.toJson(new LoginResponseBean("accepted",token, LoginResponseBean.TOKEN_AGE_DEFAULT, responseUser)));
} else {
out.println(gson.toJson(new LoginResponseBean("failed","",0,null)));
}
}
}
\ No newline at end of file
package com.adaapa.identityservice.servlets;
import com.adaapa.bean.TokenVerificationResponse;
import com.adaapa.bean.UserBean;
import com.adaapa.identityservice.models.UserModel;
import com.google.gson.Gson;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
@WebService(targetNamespace = "tokenverifier.adaapa.com")
public class TokenVerifier {
@WebMethod(operationName = "verifyToken")
@WebResult(name = "userObjectInJSON")
public String verifyToken(@WebParam(name = "access_token") String access_token) {
UserModel userModel = new UserModel();
UserBean userBean = userModel.findUserByToken(access_token);
TokenVerificationResponse response = new TokenVerificationResponse();
if(userBean != null){
userModel.updateTokenLifetime(userBean.getId());
response.setStatus(TokenVerificationResponse.TOKEN_VALID);
response.setUser(userBean);
} else {
response.setStatus(TokenVerificationResponse.TOKEN_INVALID);
}
return (new Gson().toJson(response));
}
}
DB_HOST = localhost
DB_USER = wbd
DB_PASS = wbd123
DB_NAME = wbd_idservice
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<endpoints
xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0">
<endpoint
name="TokenVerifier"
implementation="com.adaapa.identityservice.servlets.TokenVerifier"
url-pattern="/verify"/>
</endpoints>
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.adaapa.identityservice.servlets.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>LogoutServlet</servlet-name>
<servlet-class>com.adaapa.identityservice.servlets.LogoutServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LogoutServlet</servlet-name>
<url-pattern>/logout</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RegisterServlet</servlet-name>
<servlet-class>com.adaapa.identityservice.servlets.RegisterServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegisterServlet</servlet-name>
<url-pattern>/register</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>web-jaxws</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>web-jaxws</servlet-name>
<url-pattern>/soap</url-pattern>
</servlet-mapping>
</web-app>
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a commented-out sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.3/userguide/tutorial_java_projects.html
*/
/*
// Apply the java plugin to add support for Java
apply plugin: 'java'
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.25'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
}
*/
File added
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"