http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/layout/activity_settings.xml ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/layout/activity_settings.xml b/sdks/android/Samples/Push/push/src/main/res/layout/activity_settings.xml deleted file mode 100644 index 0f6626b..0000000 --- a/sdks/android/Samples/Push/push/src/main/res/layout/activity_settings.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin" - tools:context="org.apache.usergrid.push.SettingsActivity" - android:background="@color/colorPrimary" - android:minHeight="30dp"> - - <EditText - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/orgId" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" - android:minWidth="300dp" - android:background="@android:color/white" - android:layout_marginTop="30dp" - android:hint="Org Id" - android:paddingStart="10dp" - android:minHeight="30dp" - android:maxLines="1" - android:singleLine="true" - android:maxWidth="300dp" /> - - <EditText - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/appId" - android:minWidth="300dp" - android:background="@android:color/white" - android:layout_marginTop="30dp" - android:layout_below="@+id/orgId" - android:layout_centerHorizontal="true" - android:hint="App Id" - android:paddingStart="10dp" - android:minHeight="30dp" - android:maxLines="1" - android:singleLine="true" - android:maxWidth="300dp" /> - - <EditText - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/url" - android:minWidth="300dp" - android:background="@android:color/white" - android:layout_marginTop="30dp" - android:layout_below="@+id/appId" - android:layout_centerHorizontal="true" - android:hint="URL" - android:paddingStart="10dp" - android:minHeight="30dp" - android:maxLines="1" - android:singleLine="true" - android:maxWidth="300dp" /> - - <EditText - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/notifierId" - android:minWidth="300dp" - android:background="@android:color/white" - android:layout_marginTop="30dp" - android:layout_below="@+id/url" - android:layout_centerHorizontal="true" - android:hint="Notifier Id" - android:paddingStart="10dp" - android:minHeight="30dp" - android:maxLines="1" - android:singleLine="true" - android:maxWidth="300dp" /> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Save" - android:id="@+id/saveButton" - android:layout_marginTop="23dp" - android:layout_below="@+id/notifierId" - android:layout_alignEnd="@+id/notifierId" /> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Cancel" - android:id="@+id/cancelButton" - android:layout_alignTop="@+id/saveButton" - android:layout_alignStart="@+id/notifierId" /> -</RelativeLayout>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/mipmap-hdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/mipmap-hdpi/ic_launcher.png b/sdks/android/Samples/Push/push/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bc..0000000 Binary files a/sdks/android/Samples/Push/push/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/mipmap-mdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/mipmap-mdpi/ic_launcher.png b/sdks/android/Samples/Push/push/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0c..0000000 Binary files a/sdks/android/Samples/Push/push/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/mipmap-xhdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/mipmap-xhdpi/ic_launcher.png b/sdks/android/Samples/Push/push/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0..0000000 Binary files a/sdks/android/Samples/Push/push/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/mipmap-xxhdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sdks/android/Samples/Push/push/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72c..0000000 Binary files a/sdks/android/Samples/Push/push/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/mipmap-xxxhdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sdks/android/Samples/Push/push/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index aee44e1..0000000 Binary files a/sdks/android/Samples/Push/push/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/values-w820dp/dimens.xml ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/values-w820dp/dimens.xml b/sdks/android/Samples/Push/push/src/main/res/values-w820dp/dimens.xml deleted file mode 100644 index 63fc816..0000000 --- a/sdks/android/Samples/Push/push/src/main/res/values-w820dp/dimens.xml +++ /dev/null @@ -1,6 +0,0 @@ -<resources> - <!-- Example customization of dimensions originally defined in res/values/dimens.xml - (such as screen margins) for screens with more than 820dp of available width. This - would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> - <dimen name="activity_horizontal_margin">64dp</dimen> -</resources> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/values/colors.xml ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/values/colors.xml b/sdks/android/Samples/Push/push/src/main/res/values/colors.xml deleted file mode 100644 index 75703af..0000000 --- a/sdks/android/Samples/Push/push/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="colorPrimary">#1b5d89</color> - <color name="colorPrimaryDark">#303F9F</color> - <color name="colorAccent">#FF4081</color> -</resources> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/values/dimens.xml ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/values/dimens.xml b/sdks/android/Samples/Push/push/src/main/res/values/dimens.xml deleted file mode 100644 index 47c8224..0000000 --- a/sdks/android/Samples/Push/push/src/main/res/values/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/values/strings.xml ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/values/strings.xml b/sdks/android/Samples/Push/push/src/main/res/values/strings.xml deleted file mode 100644 index f0817ce..0000000 --- a/sdks/android/Samples/Push/push/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<resources> - <string name="app_name">Apigee Push</string> -</resources> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/main/res/values/styles.xml ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/main/res/values/styles.xml b/sdks/android/Samples/Push/push/src/main/res/values/styles.xml deleted file mode 100644 index 0eb88fe..0000000 --- a/sdks/android/Samples/Push/push/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ -<resources> - - <!-- Base application theme. --> - <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> - <!-- Customize your theme here. --> - <item name="colorPrimary">@color/colorPrimary</item> - <item name="colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="colorAccent">@color/colorAccent</item> - </style> - -</resources> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/push/src/test/java/org/apache/usergrid/push/ExampleUnitTest.java ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/push/src/test/java/org/apache/usergrid/push/ExampleUnitTest.java b/sdks/android/Samples/Push/push/src/test/java/org/apache/usergrid/push/ExampleUnitTest.java deleted file mode 100644 index fcc42bf..0000000 --- a/sdks/android/Samples/Push/push/src/test/java/org/apache/usergrid/push/ExampleUnitTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.apache.usergrid.push; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * To work on unit tests, switch the Test Artifact in the Build Variants view. - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/Samples/Push/settings.gradle ---------------------------------------------------------------------- diff --git a/sdks/android/Samples/Push/settings.gradle b/sdks/android/Samples/Push/settings.gradle deleted file mode 100644 index f1ac978..0000000 --- a/sdks/android/Samples/Push/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -include ':push', ':UsergridAndroidSDK' -project (":UsergridAndroidSDK").projectDir = new File("../../UsergridAndroidSDK") http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/.gitignore ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/.gitignore b/sdks/android/UsergridAndroidSDK/.gitignore deleted file mode 100644 index c6cbe56..0000000 --- a/sdks/android/UsergridAndroidSDK/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/build.gradle ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/build.gradle b/sdks/android/UsergridAndroidSDK/build.gradle deleted file mode 100644 index ef2db46..0000000 --- a/sdks/android/UsergridAndroidSDK/build.gradle +++ /dev/null @@ -1,70 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'com.jfrog.bintray' -apply plugin: 'com.github.dcendents.android-maven' - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.1.0' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' - classpath "com.github.dcendents:android-maven-gradle-plugin:1.3" - } -} - -android { - compileSdkVersion 17 - buildToolsVersion "22.0.1" - - group = 'org.apache.usergrid.android' - version = '2.1.0' - - defaultConfig { - minSdkVersion 17 - targetSdkVersion 23 - versionCode 1 - versionName "2.1.0" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } -} - -dependencies { - repositories { - mavenCentral() - } - compile fileTree(dir: 'libs', include: ['*.jar']) - testCompile 'junit:junit:4.12' -} - -task generateSourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier 'sources' -} -artifacts { - archives generateSourcesJar -} - -bintray { - user = 'rwalsh' - key = '3ae2887b2af626dab61faffd57b99303e146feb6' - pkg { - repo = 'maven' - name = 'org.apache.usergrid.android' - version { - name = '2.1.0' - desc = 'Usergrid Android Client' - released = new Date() - } - - licenses = ['Apache-2.0'] - vcsUrl = 'https://github.com/apache/usergrid.git' - websiteUrl = 'https://github.com/apache/usergrid' - } - configurations = ['archives'] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.jar ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.jar b/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372ae..0000000 Binary files a/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.jar and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.properties ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.properties b/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 122a0dc..0000000 --- a/sdks/android/UsergridAndroidSDK/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Dec 28 10:00:20 PST 2015 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/gradlew ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/gradlew b/sdks/android/UsergridAndroidSDK/gradlew deleted file mode 100644 index 9d82f78..0000000 --- a/sdks/android/UsergridAndroidSDK/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# 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 -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# 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 - -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" ] ; 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 - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/gradlew.bat ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/gradlew.bat b/sdks/android/UsergridAndroidSDK/gradlew.bat deleted file mode 100644 index aec9973..0000000 --- a/sdks/android/UsergridAndroidSDK/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -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. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -: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 %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/libs/usergrid-java-client-2.1.0.jar ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/libs/usergrid-java-client-2.1.0.jar b/sdks/android/UsergridAndroidSDK/libs/usergrid-java-client-2.1.0.jar deleted file mode 100644 index d77cd88..0000000 Binary files a/sdks/android/UsergridAndroidSDK/libs/usergrid-java-client-2.1.0.jar and /dev/null differ http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/proguard-rules.pro ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/proguard-rules.pro b/sdks/android/UsergridAndroidSDK/proguard-rules.pro deleted file mode 100644 index 73ed137..0000000 --- a/sdks/android/UsergridAndroidSDK/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/ApigeeCorporation/Developer/android_sdk_files/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/ApplicationTest.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/ApplicationTest.java b/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/ApplicationTest.java deleted file mode 100644 index 484d85e..0000000 --- a/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/ApplicationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.apache.usergrid.android; - -import android.app.Application; -import android.test.ApplicationTestCase; - -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; - -import org.apache.usergrid.java.client.Usergrid; -import org.apache.usergrid.java.client.model.UsergridEntity; -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.CountDownLatch; - -/** - * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> - */ -public class ApplicationTest extends ApplicationTestCase<Application> { - - Book finishedBook; - String newBookTitle = "A new title again at time: " + System.currentTimeMillis(); - - public ApplicationTest() { - super(Application.class); - } - - @Override - protected void setUp() throws Exception { - Usergrid.initSharedInstance("rwalsh","sandbox"); - UsergridEntity.mapCustomSubclassToType("book",Book.class); - } - - @Override - protected void tearDown() throws Exception { - Usergrid.reset(); - } - - public void testGET() throws InterruptedException { - final CountDownLatch signal = new CountDownLatch(1); - - Usergrid.initSharedInstance("rwalsh","sandbox"); - UsergridAsync.GET("books", new UsergridResponseCallback() { - @Override - public void onResponse(@NotNull UsergridResponse response) { - if (response.ok()) { - final Book book = (Book) response.first(); - assertNotNull(book); - assertNotNull(book.getUuid()); - book.setTitle(newBookTitle); - UsergridEntityAsync.save(book, new UsergridResponseCallback() { - @Override - public void onResponse(@NotNull UsergridResponse response) { - final Book book = (Book) response.first(); - assertNotNull(book); - assertNotNull(book.getUuid()); - assertEquals(book.getTitle(),newBookTitle); - UsergridAsync.GET("book", book.getUuid(), new UsergridResponseCallback() { - @Override - public void onResponse(@NotNull UsergridResponse response) { - assertNotNull(response.getEntities()); - assertNotNull(response.first()); - finishedBook = (Book) response.first(); - signal.countDown(); - } - }); - } - }); - } - } - }); - signal.await(); - assertNotNull(finishedBook); - assertEquals(finishedBook.getTitle(),newBookTitle); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/Book.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/Book.java b/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/Book.java deleted file mode 100644 index a27f237..0000000 --- a/sdks/android/UsergridAndroidSDK/src/androidTest/java/org/apache/usergrid/android/Book.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.usergrid.android; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.apache.usergrid.java.client.model.UsergridEntity; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Created by Robert Walsh on 4/12/16. - */ -public class Book extends UsergridEntity { - @Nullable private String title; - - public Book(@JsonProperty("type") @NotNull String type) { - super(type); - } - - public void setTitle(@NotNull final String title) { - this.title = title; - } - public String getTitle() { - return this.title; - } - -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/AndroidManifest.xml ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/AndroidManifest.xml b/sdks/android/UsergridAndroidSDK/src/main/AndroidManifest.xml deleted file mode 100644 index 8d9dfe0..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/AndroidManifest.xml +++ /dev/null @@ -1,17 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.apache.usergrid.android"> - <uses-permission android:name="android.permission.INTERNET" /> - <uses-permission android:name="android.permission.READ_PHONE_STATE" /> - <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> - <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> - <application - android:allowBackup="true" - android:label="@string/app_name" - android:supportsRtl="true"> - - </application> - -</manifest> http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridAsync.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridAsync.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridAsync.java deleted file mode 100644 index e701893..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridAsync.java +++ /dev/null @@ -1,474 +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 org.apache.usergrid.android; - -import android.content.Context; - -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; -import org.apache.usergrid.android.tasks.UsergridAsyncTask; -import org.apache.usergrid.java.client.Usergrid; -import org.apache.usergrid.java.client.UsergridClient; -import org.apache.usergrid.java.client.UsergridEnums.UsergridDirection; -import org.apache.usergrid.java.client.UsergridRequest; -import org.apache.usergrid.java.client.auth.UsergridAppAuth; -import org.apache.usergrid.java.client.auth.UsergridUserAuth; -import org.apache.usergrid.java.client.model.UsergridEntity; -import org.apache.usergrid.java.client.model.UsergridUser; -import org.apache.usergrid.java.client.query.UsergridQuery; -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Map; - -@SuppressWarnings("unused") -public final class UsergridAsync { - - private UsergridAsync() { } - - public static void applyPushToken(@NotNull final Context context, @NotNull final String pushToken, @NotNull final String notifier, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.applyPushToken(Usergrid.getInstance(),context,pushToken,notifier,responseCallback); - } - - public static void applyPushToken(@NotNull final UsergridClient client, @NotNull final Context context, @NotNull final String pushToken, @NotNull final String notifier, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.applyPushToken(client,context,notifier,pushToken,responseCallback); - } - - public static void authenticateApp(@NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.authenticateApp(Usergrid.getInstance(),responseCallback); - } - - public static void authenticateApp(@NotNull final UsergridClient client, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.authenticateApp(); - } - }).execute(); - } - - public static void authenticateApp(@NotNull final UsergridAppAuth auth, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.authenticateApp(Usergrid.getInstance(),auth,responseCallback); - } - - public static void authenticateApp(@NotNull final UsergridClient client, @NotNull final UsergridAppAuth auth, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.authenticateApp(auth); - } - }).execute(); - } - - public static void authenticateUser(@NotNull final UsergridUserAuth userAuth, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.authenticateUser(Usergrid.getInstance(),userAuth,true,responseCallback); - } - - public static void authenticateUser(@NotNull final UsergridClient client, @NotNull final UsergridUserAuth userAuth, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.authenticateUser(client,userAuth,true,responseCallback); - } - - public static void authenticateUser(@NotNull final UsergridUserAuth userAuth, final boolean setAsCurrentUser, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.authenticateUser(Usergrid.getInstance(),userAuth,setAsCurrentUser,responseCallback); - } - - public static void authenticateUser(@NotNull final UsergridClient client, @NotNull final UsergridUserAuth userAuth, final boolean setAsCurrentUser, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.authenticateUser(userAuth,setAsCurrentUser); - } - }).execute(); - } - - public static void resetPassword(@NotNull final UsergridUser user, @NotNull final String oldPassword, @NotNull final String newPassword, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.resetPassword(Usergrid.getInstance(),user,oldPassword,newPassword,responseCallback); - } - - public static void resetPassword(@NotNull final UsergridClient client, @NotNull final UsergridUser user, @NotNull final String oldPassword, @NotNull final String newPassword, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.resetPassword(user,oldPassword,newPassword); - } - }).execute(); - } - - public static void logoutCurrentUser(@NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.logoutCurrentUser(Usergrid.getInstance(),responseCallback); - } - - public static void logoutCurrentUser(@NotNull final UsergridClient client, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.logoutCurrentUser(); - } - }).execute(); - } - - public static void logoutUserAllTokens(@NotNull final String uuidOrUsername, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.logoutUser(Usergrid.getInstance(),uuidOrUsername, null, responseCallback); - } - - public static void logoutUserAllTokens(@NotNull final UsergridClient client, @NotNull final String uuidOrUsername, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.logoutUser(client,uuidOrUsername, null, responseCallback); - } - - public static void logoutUser(@NotNull final UsergridClient client, @NotNull final String uuidOrUsername, @Nullable final String token, @NotNull final UsergridResponseCallback responseCallback){ - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.logoutUser(uuidOrUsername,token); - } - }).execute(); - } - - public static void sendRequest(@NotNull final UsergridRequest request, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.sendRequest(Usergrid.getInstance(),request,responseCallback); - } - - public static void sendRequest(@NotNull final UsergridClient client, @NotNull final UsergridRequest request, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.sendRequest(request); - } - }).execute(); - } - - public static void GET(@NotNull final String collection, @NotNull final String uuidOrName, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.GET(Usergrid.getInstance(),collection,uuidOrName,responseCallback); - } - - public static void GET(@NotNull final UsergridClient client, @NotNull final String collection, @NotNull final String uuidOrName, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.GET(collection,uuidOrName); - } - }).execute(); - } - - public static void GET(@NotNull final String type, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.GET(Usergrid.getInstance(),type,responseCallback); - } - - public static void GET(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.GET(type); - } - }).execute(); - } - - public static void GET(@NotNull final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.GET(Usergrid.getInstance(),query,responseCallback); - } - - public static void GET(@NotNull final UsergridClient client, @NotNull final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.GET(query); - } - }).execute(); - } - - public static void PUT(@NotNull final String type, @NotNull final String uuidOrName, @NotNull final Map<String, Object> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.PUT(Usergrid.getInstance(),type,uuidOrName,jsonBody,responseCallback); - } - - public static void PUT(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final String uuidOrName, @NotNull final Map<String, Object> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.PUT(type, uuidOrName, jsonBody); - } - }).execute(); - } - - public static void PUT(@NotNull final String type, @NotNull final Map<String, Object> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.PUT(Usergrid.getInstance(),type,jsonBody,responseCallback); - } - - public static void PUT(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final Map<String, Object> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.PUT(type, jsonBody); - } - }).execute(); - } - - public static void PUT(@NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.PUT(Usergrid.getInstance(),entity,responseCallback); - } - - public static void PUT(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.PUT(entity); - } - }).execute(); - } - - public static void PUT(@NotNull final UsergridQuery query, @NotNull final Map<String, Object> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.PUT(Usergrid.getInstance(),query,jsonBody,responseCallback); - } - - public static void PUT(@NotNull final UsergridClient client, @NotNull final UsergridQuery query, @NotNull final Map<String, Object> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.PUT(query, jsonBody); - } - }).execute(); - } - - public static void POST(@NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.POST(Usergrid.getInstance(),entity,responseCallback); - } - - public static void POST(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.PUT(entity); - } - }).execute(); - } - - public static void POST(@NotNull final List<UsergridEntity> entities, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.POST(Usergrid.getInstance(),entities,responseCallback); - } - - public static void POST(@NotNull final UsergridClient client, @NotNull final List<UsergridEntity> entities, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.POST(entities); - } - }).execute(); - } - - public static void POST(@NotNull final String type, @NotNull final String uuidOrName, @NotNull final Map<String, ?> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.POST(Usergrid.getInstance(),type,uuidOrName,jsonBody,responseCallback); - } - - public static void POST(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final String uuidOrName, @NotNull final Map<String, ?> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.POST(type, uuidOrName, jsonBody); - } - }).execute(); - } - - public static void POST(@NotNull final String type, @NotNull final Map<String, ?> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.POST(Usergrid.getInstance(),type,jsonBody,responseCallback); - } - - public static void POST(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final Map<String, ?> jsonBody, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.POST(type, jsonBody); - } - }).execute(); - } - - public static void POST(@NotNull final String type, @NotNull final List<Map<String, ?>> jsonBodies, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.POST(Usergrid.getInstance(),type,jsonBodies,responseCallback); - } - - public static void POST(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final List<Map<String, ?>> jsonBodies, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.POST(type, jsonBodies); - } - }).execute(); - } - - public static void DELETE(@NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.DELETE(Usergrid.getInstance(),entity,responseCallback); - } - - public static void DELETE(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.DELETE(entity); - } - }).execute(); - } - - public static void DELETE(@NotNull final String type, @NotNull final String uuidOrName, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.DELETE(Usergrid.getInstance(),type,uuidOrName,responseCallback); - } - - public static void DELETE(@NotNull final UsergridClient client, @NotNull final String type, @NotNull final String uuidOrName, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.DELETE(type, uuidOrName); - } - }).execute(); - } - - public static void DELETE(@NotNull final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.DELETE(Usergrid.getInstance(),query,responseCallback); - } - - public static void DELETE(@NotNull final UsergridClient client, @NotNull final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.DELETE(query); - } - }).execute(); - } - - public static void connect(@NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity to, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.connect(Usergrid.getInstance(),entity,relationship,to,responseCallback); - } - - public static void connect(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity to, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.connect(entity, relationship, to); - } - }).execute(); - } - - public static void connect(@NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String toType, @NotNull final String toName, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.connect(Usergrid.getInstance(),entityType,entityId,relationship,toType,toName,responseCallback); - } - - public static void connect(@NotNull final UsergridClient client, @NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String toType, @NotNull final String toName, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.connect(entityType, entityId, relationship, toType, toName); - } - }).execute(); - } - - public static void connect(@NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String toId, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.connect(Usergrid.getInstance(),entityType,entityId,relationship,toId,responseCallback); - } - - public static void connect(@NotNull final UsergridClient client, @NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String toId, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.connect(entityType, entityId, relationship, toId); - } - }).execute(); - } - - public static void disconnect(@NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String fromUuid, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.disconnect(Usergrid.getInstance(),entityType,entityId,relationship,fromUuid,responseCallback); - } - - public static void disconnect(@NotNull final UsergridClient client, @NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String fromUuid, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.disconnect(entityType, entityId, relationship, fromUuid); - } - }).execute(); - } - - public static void disconnect(@NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String fromType, @NotNull final String fromName, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.disconnect(Usergrid.getInstance(),entityType,entityId,relationship,fromType,fromName,responseCallback); - } - - public static void disconnect(@NotNull final UsergridClient client, @NotNull final String entityType, @NotNull final String entityId, @NotNull final String relationship, @NotNull final String fromType, @NotNull final String fromName, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.disconnect(entityType, entityId, relationship, fromType, fromName); - } - }).execute(); - } - - public static void disconnect(@NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity from, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.disconnect(Usergrid.getInstance(),entity,relationship,from,responseCallback); - } - - public static void disconnect(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity from, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.disconnect(entity, relationship, from); - } - }).execute(); - } - - public static void getConnections(@NotNull final UsergridDirection direction, @NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.getConnections(Usergrid.getInstance(),direction,entity,relationship,null,responseCallback); - } - - public static void getConnections(@NotNull final UsergridClient client, @NotNull final UsergridDirection direction, @NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.getConnections(client,direction,entity,relationship,null,responseCallback); - } - - public static void getConnections(@NotNull final UsergridDirection direction, @NotNull final UsergridEntity entity, @NotNull final String relationship, @Nullable final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.getConnections(Usergrid.getInstance(),direction,entity,relationship,query,responseCallback); - } - - public static void getConnections(@NotNull final UsergridClient client, @NotNull final UsergridDirection direction, @NotNull final UsergridEntity entity, @NotNull final String relationship, @Nullable final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.getConnections(direction, entity, relationship, query); - } - }).execute(); - } - - public static void getConnections(@NotNull final UsergridDirection direction, @NotNull final String type, @NotNull final String uuidOrName, @NotNull final String relationship, @Nullable final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.getConnections(Usergrid.getInstance(),direction,type,uuidOrName,relationship,query,responseCallback); - } - - public static void getConnections(@NotNull final UsergridClient client, @NotNull final UsergridDirection direction, @NotNull final String type, @NotNull final String uuidOrName, @NotNull final String relationship, @Nullable final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.getConnections(direction, type, uuidOrName, relationship, query); - } - }).execute(); - } - - public static void getConnections(@NotNull final UsergridDirection direction, @NotNull final String uuid, @NotNull final String relationship, @Nullable final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - UsergridAsync.getConnections(Usergrid.getInstance(),direction,uuid,relationship,query,responseCallback); - } - - public static void getConnections(@NotNull final UsergridClient client, @NotNull final UsergridDirection direction, @NotNull final String uuid, @NotNull final String relationship, @Nullable final UsergridQuery query, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return client.getConnections(direction, uuid, relationship, query); - } - }).execute(); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridEntityAsync.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridEntityAsync.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridEntityAsync.java deleted file mode 100644 index 690cc0f..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridEntityAsync.java +++ /dev/null @@ -1,110 +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 org.apache.usergrid.android; - -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; -import org.apache.usergrid.android.tasks.UsergridAsyncTask; -import org.apache.usergrid.java.client.Usergrid; -import org.apache.usergrid.java.client.UsergridClient; -import org.apache.usergrid.java.client.UsergridEnums.UsergridDirection; -import org.apache.usergrid.java.client.model.UsergridEntity; -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; - -@SuppressWarnings("unused") -public final class UsergridEntityAsync { - - private UsergridEntityAsync() {} - - public static void reload(@NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridEntityAsync.reload(Usergrid.getInstance(),entity,responseCallback); - } - - public static void reload(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return entity.reload(client); - } - }).execute(); - } - - public static void save(@NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridEntityAsync.save(Usergrid.getInstance(),entity,responseCallback); - } - - public static void save(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return entity.save(client); - } - }).execute(); - } - - public static void remove(@NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridEntityAsync.remove(Usergrid.getInstance(),entity, responseCallback); - } - - public static void remove(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return entity.remove(client); - } - }).execute(); - } - - public static void connect(@NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity toEntity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridEntityAsync.connect(Usergrid.getInstance(), entity, relationship, toEntity, responseCallback); - } - - public static void connect(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity toEntity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return entity.connect(client,relationship,toEntity); - } - }).execute(); - } - - public static void disconnect(@NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity fromEntity, @NotNull final UsergridResponseCallback responseCallback) { - UsergridEntityAsync.disconnect(Usergrid.getInstance(), entity, relationship, fromEntity, responseCallback); - } - - public static void disconnect(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final String relationship, @NotNull final UsergridEntity fromEntity, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return entity.disconnect(client,relationship,fromEntity); - } - }).execute(); - } - - public static void getConnections(@NotNull final UsergridEntity entity, @NotNull final UsergridDirection direction, @NotNull final String relationship, @NotNull final UsergridResponseCallback responseCallback) { - UsergridEntityAsync.getConnections(Usergrid.getInstance(),entity,direction,relationship,responseCallback); - } - - public static void getConnections(@NotNull final UsergridClient client, @NotNull final UsergridEntity entity, @NotNull final UsergridDirection direction, @NotNull final String relationship, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return entity.getConnections(client,direction,relationship); - } - }).execute(); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridResponseAsync.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridResponseAsync.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridResponseAsync.java deleted file mode 100644 index 51c14c4..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridResponseAsync.java +++ /dev/null @@ -1,38 +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 org.apache.usergrid.android; - -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; -import org.apache.usergrid.android.tasks.UsergridAsyncTask; - -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; - -@SuppressWarnings("unused") -public final class UsergridResponseAsync { - - private UsergridResponseAsync() {} - - public static void loadNextPage(@NotNull final UsergridResponse response, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return response.loadNextPage(); - } - }).execute(); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridSharedDevice.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridSharedDevice.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridSharedDevice.java deleted file mode 100644 index ee23d2a..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridSharedDevice.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.apache.usergrid.android; - -import android.content.Context; -import android.content.SharedPreferences; -import android.net.wifi.WifiManager; -import android.os.Build; -import android.provider.Settings; -import android.telephony.TelephonyManager; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.TextNode; - -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; -import org.apache.usergrid.java.client.Usergrid; -import org.apache.usergrid.java.client.UsergridClient; -import org.apache.usergrid.java.client.UsergridEnums.UsergridHttpMethod; -import org.apache.usergrid.java.client.UsergridRequest; -import org.apache.usergrid.java.client.model.UsergridDevice; -import org.apache.usergrid.java.client.model.UsergridEntity; -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.apache.usergrid.java.client.utils.JsonUtils; -import org.apache.usergrid.java.client.utils.ObjectUtils; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.IOException; -import java.util.HashMap; -import java.util.UUID; - -@SuppressWarnings("unused") -public final class UsergridSharedDevice { - @Nullable - private static UsergridDevice sharedDevice; - - @NotNull - private static final String USERGRID_PREFS_FILE_NAME = "usergrid_prefs.xml"; - @NotNull - private static final String USERGRID_SHARED_DEVICE_KEY = "usergridSharedDevice"; - - @NotNull - public static UsergridDevice getSharedDevice(@NotNull final Context context) { - if (sharedDevice == null) { - sharedDevice = UsergridSharedDevice.getStoredSharedDevice(context); - if (sharedDevice == null) { - String sharedDeviceId = UsergridSharedDevice.getSharedDeviceUUID(context); - HashMap<String, JsonNode> map = new HashMap<String, JsonNode>(); - map.put("uuid", new TextNode(sharedDeviceId)); - sharedDevice = new UsergridDevice(map); - sharedDevice.setModel(Build.MODEL); - sharedDevice.setPlatform("android"); - sharedDevice.setOsVersion(Build.VERSION.RELEASE); - } - } - return sharedDevice; - } - - public static void applyPushToken(@NotNull final Context context, @NotNull final String notifier, @NotNull final String token, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.applyPushToken(Usergrid.getInstance(), context, notifier, token, responseCallback); - } - - public static void applyPushToken(@NotNull final UsergridClient client, @NotNull final Context context, @NotNull final String notifier, @NotNull final String token, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.getSharedDevice(context).putProperty(notifier + ".notifier.id", token); - UsergridSharedDevice.saveSharedDeviceRemotelyAndToDisk(client, context, responseCallback); - } - - public static void save(@NotNull final Context context, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.saveSharedDevice(Usergrid.getInstance(), context, responseCallback); - } - - public static void save(@NotNull final UsergridClient client, @NotNull final Context context, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.saveSharedDevice(client, context, responseCallback); - } - - public static void saveSharedDevice(@NotNull final Context context, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.saveSharedDeviceRemotelyAndToDisk(Usergrid.getInstance(), context, responseCallback); - } - - public static void saveSharedDevice(@NotNull final UsergridClient client, @NotNull final Context context, @NotNull final UsergridResponseCallback responseCallback) { - UsergridSharedDevice.saveSharedDeviceRemotelyAndToDisk(client, context, responseCallback); - } - - @Nullable - private static UsergridDevice getStoredSharedDevice(@NotNull final Context context) { - SharedPreferences prefs = context.getSharedPreferences(USERGRID_PREFS_FILE_NAME, Context.MODE_PRIVATE); - String deviceString = prefs.getString(USERGRID_SHARED_DEVICE_KEY, null); - UsergridDevice storedSharedDevice = null; - if (deviceString != null) { - try { - storedSharedDevice = JsonUtils.mapper.readValue(deviceString, UsergridDevice.class); - } catch (IOException ignored) { - prefs.edit().remove(USERGRID_SHARED_DEVICE_KEY).commit(); - } - } - return storedSharedDevice; - } - - private static void saveSharedDeviceToDisk(@NotNull final Context context) { - String deviceAsString = UsergridSharedDevice.getSharedDevice(context).toString(); - SharedPreferences prefs = context.getSharedPreferences(USERGRID_PREFS_FILE_NAME, Context.MODE_PRIVATE); - prefs.edit().putString(USERGRID_SHARED_DEVICE_KEY, deviceAsString).commit(); - } - - private static void saveSharedDeviceRemotelyAndToDisk(@NotNull final UsergridClient client, @NotNull final Context context, @NotNull final UsergridResponseCallback responseCallback) { - UsergridDevice sharedDevice = UsergridSharedDevice.getSharedDevice(context); - String sharedDeviceUUID = sharedDevice.getUuid() != null ? sharedDevice.getUuid() : sharedDevice.getStringProperty("uuid"); - UsergridRequest request = new UsergridRequest(UsergridHttpMethod.PUT, UsergridRequest.APPLICATION_JSON_MEDIA_TYPE, client.clientAppUrl(), null, sharedDevice, client.authForRequests(), "devices", sharedDeviceUUID); - UsergridAsync.sendRequest(client, request, new UsergridResponseCallback() { - @Override - public void onResponse(@NotNull UsergridResponse response) { - UsergridEntity responseEntity = response.entity(); - if (response.ok() && responseEntity != null && responseEntity instanceof UsergridDevice) { - UsergridSharedDevice.sharedDevice = (UsergridDevice) responseEntity; - UsergridSharedDevice.saveSharedDeviceToDisk(context); - } - responseCallback.onResponse(response); - } - }); - } - - @NotNull - public static String getSharedDeviceUUID(@NotNull final Context context) { - if( sharedDevice != null && sharedDevice.getUuid() != null ) { - return sharedDevice.getUuid(); - } - - String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); - UUID uuid; - try { - if (!"9774d56d682e549c".equals(androidId)) { - uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8")); - } else { - final String deviceId = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); - uuid = deviceId != null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : generateDeviceUuid(context); - } - } catch (Exception ignored) { - uuid = UUID.randomUUID(); - } - return uuid.toString(); - } - - private static UUID generateDeviceUuid(Context context) { - // Get some of the hardware information - String buildParams = Build.BOARD + Build.BRAND + Build.CPU_ABI - + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST - + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT - + Build.TAGS + Build.TYPE + Build.USER; - - // Requires READ_PHONE_STATE - TelephonyManager tm = (TelephonyManager) context - .getSystemService(Context.TELEPHONY_SERVICE); - - // gets the imei (GSM) or MEID/ESN (CDMA) - String imei = tm.getDeviceId(); - - // gets the android-assigned id - String androidId = Settings.Secure.getString(context.getContentResolver(), - Settings.Secure.ANDROID_ID); - - // requires ACCESS_WIFI_STATE - WifiManager wm = (WifiManager) context - .getSystemService(Context.WIFI_SERVICE); - - // gets the MAC address - String mac = wm.getConnectionInfo().getMacAddress(); - - // if we've got nothing, return a random UUID - if (ObjectUtils.isEmpty(imei) && ObjectUtils.isEmpty(androidId) && ObjectUtils.isEmpty(mac)) { - return UUID.randomUUID(); - } - - // concatenate the string - String fullHash = buildParams + imei + androidId + mac; - return UUID.nameUUIDFromBytes(fullHash.getBytes()); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridUserAsync.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridUserAsync.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridUserAsync.java deleted file mode 100644 index af0b791..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/UsergridUserAsync.java +++ /dev/null @@ -1,125 +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 org.apache.usergrid.android; - -import org.apache.usergrid.android.callbacks.UsergridCheckAvailabilityCallback; -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; -import org.apache.usergrid.android.tasks.UsergridAsyncTask; - -import org.apache.usergrid.java.client.Usergrid; -import org.apache.usergrid.java.client.UsergridClient; -import org.apache.usergrid.java.client.UsergridEnums.*; -import org.apache.usergrid.java.client.model.UsergridUser; -import org.apache.usergrid.java.client.query.UsergridQuery; -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -@SuppressWarnings("unused") -public final class UsergridUserAsync { - - private UsergridUserAsync() {} - - public static void checkAvailable(@Nullable final String email, @Nullable final String username, @NotNull final UsergridCheckAvailabilityCallback checkAvailabilityCallback) { - UsergridUserAsync.checkAvailable(Usergrid.getInstance(), email, username, checkAvailabilityCallback); - } - - public static void checkAvailable(@NotNull final UsergridClient client, @Nullable final String email, @Nullable final String username, @NotNull final UsergridCheckAvailabilityCallback checkAvailabilityCallback) { - if (email == null && username == null) { - checkAvailabilityCallback.onResponse(false); - return; - } - UsergridQuery query = new UsergridQuery(UsergridUser.USER_ENTITY_TYPE); - if (username != null) { - query.eq(UsergridUserProperties.USERNAME.toString(), username); - } - if (email != null) { - query.or().eq(UsergridUserProperties.EMAIL.toString(), email); - } - UsergridAsync.GET(client, query, new UsergridResponseCallback() { - @Override - public void onResponse(@NotNull UsergridResponse response) { - checkAvailabilityCallback.onResponse((response.ok() && response.first() != null)); - } - }); - } - - public static void create(@NotNull final UsergridUser user, @NotNull final UsergridResponseCallback responseCallback) { - UsergridUserAsync.create(Usergrid.getInstance(),user,responseCallback); - } - - public static void create(@NotNull final UsergridClient client, @NotNull final UsergridUser user, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return user.create(client); - } - }).execute(); - } - - public static void login(@NotNull final UsergridUser user, @NotNull final String username, @NotNull final String password, @NotNull final UsergridResponseCallback responseCallback) { - UsergridUserAsync.login(Usergrid.getInstance(),user,username,password,responseCallback); - } - - public static void login(@NotNull final UsergridClient client, @NotNull final UsergridUser user, @NotNull final String username, @NotNull final String password, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return user.login(client,username,password); - } - }).execute(); - } - - public static void resetPassword(@NotNull final UsergridUser user, @NotNull final String oldPassword, @NotNull final String newPassword, @NotNull final UsergridResponseCallback responseCallback) { - UsergridUserAsync.resetPassword(Usergrid.getInstance(),user,oldPassword,newPassword,responseCallback); - } - - public static void resetPassword(@NotNull final UsergridClient client, @NotNull final UsergridUser user, @NotNull final String oldPassword, @NotNull final String newPassword, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return user.resetPassword(client,oldPassword,newPassword); - } - }).execute(); - } - - public static void reauthenticate(@NotNull final UsergridUser user, @NotNull final UsergridResponseCallback responseCallback) { - UsergridUserAsync.reauthenticate(Usergrid.getInstance(),user,responseCallback); - } - - public static void reauthenticate(@NotNull final UsergridClient client, @NotNull final UsergridUser user, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return user.reauthenticate(client); - } - }).execute(); - } - - public static void logout(@NotNull final UsergridUser user, @NotNull final UsergridResponseCallback responseCallback) { - UsergridUserAsync.logout(Usergrid.getInstance(),user,responseCallback); - } - - public static void logout(@NotNull final UsergridClient client, @NotNull final UsergridUser user, @NotNull final UsergridResponseCallback responseCallback) { - (new UsergridAsyncTask(responseCallback) { - @Override - public UsergridResponse doTask() { - return user.logout(client); - } - }).execute(); - } -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridCheckAvailabilityCallback.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridCheckAvailabilityCallback.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridCheckAvailabilityCallback.java deleted file mode 100644 index 3c3916e..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridCheckAvailabilityCallback.java +++ /dev/null @@ -1,21 +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 org.apache.usergrid.android.callbacks; - -public interface UsergridCheckAvailabilityCallback { - void onResponse(final boolean available); -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridResponseCallback.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridResponseCallback.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridResponseCallback.java deleted file mode 100644 index fce1e67..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/callbacks/UsergridResponseCallback.java +++ /dev/null @@ -1,24 +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 org.apache.usergrid.android.callbacks; - -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; - -public interface UsergridResponseCallback { - void onResponse(@NotNull final UsergridResponse response); -} http://git-wip-us.apache.org/repos/asf/usergrid/blob/fdc10b78/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/tasks/UsergridAsyncTask.java ---------------------------------------------------------------------- diff --git a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/tasks/UsergridAsyncTask.java b/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/tasks/UsergridAsyncTask.java deleted file mode 100644 index b9dd2c6..0000000 --- a/sdks/android/UsergridAndroidSDK/src/main/java/org/apache/usergrid/android/tasks/UsergridAsyncTask.java +++ /dev/null @@ -1,45 +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 org.apache.usergrid.android.tasks; - -import android.os.AsyncTask; - -import org.apache.usergrid.android.callbacks.UsergridResponseCallback; - -import org.apache.usergrid.java.client.response.UsergridResponse; -import org.jetbrains.annotations.NotNull; - -public abstract class UsergridAsyncTask extends AsyncTask<Void, Void, UsergridResponse> { - - @NotNull private final UsergridResponseCallback responseCallback; - - public UsergridAsyncTask(@NotNull final UsergridResponseCallback responseCallback) { - this.responseCallback = responseCallback; - } - - @Override @NotNull - protected UsergridResponse doInBackground(final Void... v) { - return doTask(); - } - - public abstract UsergridResponse doTask(); - - @Override - protected void onPostExecute(@NotNull final UsergridResponse response) { - this.responseCallback.onResponse(response); - } -}
