From 741aa661a04c6ea6c30715daffafc9154dffd133 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Sun, 27 Oct 2013 15:59:21 -0400 Subject: [PATCH 01/21] Updated pom.xml file for submission to Sonatype OSSRH --- LICENSE.txt | 26 ++++++++++++++++++++++++++ pom.xml | 26 +++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..1802950 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,26 @@ +Copyright (c) 2013, MeetMoi LLC +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. \ No newline at end of file diff --git a/pom.xml b/pom.xml index e51493a..062221b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,12 +4,22 @@ com.indicative.client.java Indicative-Java - 1.0.1 + 1.0.2 jar Indicative-Java + Java Client for Indicative's REST API https://github.com/Indicative/Indicative-Java + + + Simplified BSD License + repo + https://github.com/Indicative/Indicative-Java/blob/master/LICENSE.txt + 2-clause BSD License, aka the FreeBSD License. See LICENSE.txt + + + https://github.com/Indicative/Indicative-Java scm:git:git@github.com:Indicative/Indicative-Java.git @@ -17,6 +27,20 @@ HEAD + + + andrewbeale + Andrew Beale + andrew.beale@indicative.com + + + + + org.sonatype.oss + oss-parent + 7 + + From 906641a08b7139783a31cf998c94f87642e9c9a8 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 17:49:19 -0400 Subject: [PATCH 02/21] Added -SNAPSHOT back to pom.xml for deployment to Maven Central --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 062221b..093d7fb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.indicative.client.java Indicative-Java - 1.0.2 + 1.0.2-SNAPSHOT jar Indicative-Java From b3eb2695fc09218bd744b6d5d561caf6a41af088 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 17:50:49 -0400 Subject: [PATCH 03/21] [maven-release-plugin] prepare release Indicative-Java-1.0.2 --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 093d7fb..675a4d3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,10 +1,9 @@ - + 4.0.0 com.indicative.client.java Indicative-Java - 1.0.2-SNAPSHOT + 1.0.2 jar Indicative-Java From 518c92b913763b86e5e40000a713d391f7b1381d Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 18:15:02 -0400 Subject: [PATCH 04/21] Added back -SNAPSHOT to pom.xml for subsequent attempt to deploy to Maven Central... --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 675a4d3..30789fe 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.2 + 1.0.2-SNAPSHOT jar Indicative-Java From 82287cd8eeb2ca8fa765d974a27269a4f4f83e96 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 18:15:58 -0400 Subject: [PATCH 05/21] [maven-release-plugin] prepare release Indicative-Java-1.0.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 30789fe..675a4d3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.2-SNAPSHOT + 1.0.2 jar Indicative-Java From 9c4219120dcd88602cdb413035816ae43f0f70bf Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 18:49:45 -0400 Subject: [PATCH 06/21] Changed pom.xml SCM config for deployment to Maven Central... --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 675a4d3..09b2b1d 100644 --- a/pom.xml +++ b/pom.xml @@ -20,10 +20,8 @@ - https://github.com/Indicative/Indicative-Java - scm:git:git@github.com:Indicative/Indicative-Java.git - scm:git:git@github.com:Indicative/Indicative-Java.git - HEAD + scm:git:git://Indicative/Indicative-Java.git + scm:git:git://Indicative/Indicative-Java.git From b0f606e806b00954deeb10a7f555b38ee1baa1c4 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 18:50:25 -0400 Subject: [PATCH 07/21] Yet again added back in -SNAPSHOT for Maven... --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 09b2b1d..949005a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.2 + 1.0.2-SNAPSHOT jar Indicative-Java From a17e93b954c2ace041b81f8ee4d8c9b90a626f68 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 19:01:13 -0400 Subject: [PATCH 08/21] More pom.xml changes for Maven Central deployment... --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 949005a..ef62eaa 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,9 @@ - scm:git:git://Indicative/Indicative-Java.git - scm:git:git://Indicative/Indicative-Java.git + scm:git:git://github.com/Indicative/Indicative-Java.git + scm:git:https://bealeindicative@github.com/Indicative/Indicative-Java.git + https://github.com/Indicative/Indicative-Java From d9433a37a23635d9497dae9bb5b6310b3cece8f8 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 19:02:03 -0400 Subject: [PATCH 09/21] [maven-release-plugin] prepare release Indicative-Java-1.0.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ef62eaa..dd222c0 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.2-SNAPSHOT + 1.0.2 jar Indicative-Java From 893ce0a02413ee3eeb069b8063fc47a9e272ee59 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Mon, 28 Oct 2013 19:02:07 -0400 Subject: [PATCH 10/21] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dd222c0..c4127ac 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.2 + 1.0.3-SNAPSHOT jar Indicative-Java From eeb281c036d448a59b612b7643f21ff8eba80ae2 Mon Sep 17 00:00:00 2001 From: bealeindicative Date: Tue, 29 Oct 2013 13:57:59 -0400 Subject: [PATCH 11/21] Update README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5aea83f..b0ec3ed 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,14 @@ Features: Sample usage: - // First, call the Indicative class's apiKey() method and pass in your API key, + // If you're integrating with a Maven project, just add the following dependency to your pom.xml file: + + com.indicative.client.java + indicative-java + 1.0.2 + + + // Call the Indicative class's apiKey() method and pass in your API key, // which you can find on the Project Settings page. You'll only have to do this once. Indicative.apiKey("Your-API-Key-Goes-Here"); From d0ba9307bc135ed18bc60497d5f24f7ce7bb3af9 Mon Sep 17 00:00:00 2001 From: bealeindicative Date: Wed, 6 Nov 2013 15:58:54 -0500 Subject: [PATCH 12/21] Update LICENSE.txt --- LICENSE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 1802950..8355543 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013, MeetMoi LLC +Copyright (c) 2013, Indicative All rights reserved. Redistribution and use in source and binary forms, with or without @@ -23,4 +23,4 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. \ No newline at end of file +either expressed or implied, of the FreeBSD Project. From 61119a8d725dd2085023d373bcffb59761975948 Mon Sep 17 00:00:00 2001 From: Chris Fei Date: Wed, 8 Jan 2014 15:34:14 -0500 Subject: [PATCH 13/21] Allow for failed POSTs to be automatically retried 2 more times --- .gitignore | 4 +++ .../indicative/client/java/Indicative.java | 29 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 4874fbf..2b30b21 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ .classpath .project .settings + +# IntelliJ files +.idea/ +*.iml diff --git a/src/main/java/com/indicative/client/java/Indicative.java b/src/main/java/com/indicative/client/java/Indicative.java index 93ae73c..ba98c20 100644 --- a/src/main/java/com/indicative/client/java/Indicative.java +++ b/src/main/java/com/indicative/client/java/Indicative.java @@ -36,6 +36,11 @@ public class Indicative { * Enable this to see some basic details printed to the default logger */ private static final boolean DEBUG = false; + + /** + * The number of times to retry a failed POST to Indicative before giving up. + */ + private static final int NUM_RETRY_ATTEMPTS = 2; /** * A class used to asynchronously post Events to the Indicative API @@ -60,17 +65,29 @@ private PostThread(Event event) { */ @Override public void run() { - sendPost(event.toJson()); + int retryAttempt = 0; + boolean callSuccessful = false; + while (!callSuccessful && retryAttempt <= NUM_RETRY_ATTEMPTS) { + callSuccessful = sendPost(event.toJson()); + retryAttempt++; + } + + if (!callSuccessful) { + LOG.log(Level.SEVERE, "Unable to POST event to Indicative after {0} failed attempts : {1}", new Object[] { retryAttempt, this.event.toJson() }); + } } /** * Sends the Event's JSON representation to the Indicative API endpoint via an HTTP POST. * * @param body + * @return a boolean that's true if the POST was successful */ - private void sendPost(String body) { + private boolean sendPost(String body) { HttpURLConnection con = null; DataOutputStream wr = null; + boolean successful = false; + try { URL url = new URL(REST_ENDPOINT_URL); con = (HttpURLConnection) url.openConnection(); @@ -110,9 +127,12 @@ private void sendPost(String body) { } in.close(); - LOG.log(Level.SEVERE, response.toString()); + LOG.log(Level.SEVERE, response.toString()); + } else { + successful = true; } + } catch (MalformedURLException ex) { LOG.log(Level.SEVERE, null, ex); } catch (IOException ex) { @@ -131,6 +151,8 @@ private void sendPost(String body) { } } } + + return successful; } } @@ -139,7 +161,6 @@ private void sendPost(String body) { * * @param apiKey The API key for your project. You can find this on your Project Settings page. */ - public static void apiKey(String apiKey) { Indicative.API_KEY = apiKey; } From 1648cb40c8513a6fcae15b7b17a7aaaea90bcc46 Mon Sep 17 00:00:00 2001 From: Chris Fei Date: Wed, 8 Jan 2014 15:40:31 -0500 Subject: [PATCH 14/21] Be a bit smarter with json conversion --- src/main/java/com/indicative/client/java/Indicative.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/indicative/client/java/Indicative.java b/src/main/java/com/indicative/client/java/Indicative.java index ba98c20..5ac31e7 100644 --- a/src/main/java/com/indicative/client/java/Indicative.java +++ b/src/main/java/com/indicative/client/java/Indicative.java @@ -67,8 +67,10 @@ private PostThread(Event event) { public void run() { int retryAttempt = 0; boolean callSuccessful = false; + String eventJson = event.toJson(); + while (!callSuccessful && retryAttempt <= NUM_RETRY_ATTEMPTS) { - callSuccessful = sendPost(event.toJson()); + callSuccessful = sendPost(eventJson); retryAttempt++; } From 957a04229dcd0ed9a33b22e81688b7c9c8d0985a Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Wed, 8 Jan 2014 17:11:33 -0500 Subject: [PATCH 15/21] [maven-release-plugin] prepare release Indicative-Java-1.0.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c4127ac..79d6a52 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.3-SNAPSHOT + 1.0.3 jar Indicative-Java From 941958015a025655879df02c60d200a942925c17 Mon Sep 17 00:00:00 2001 From: Andrew Beale Date: Wed, 8 Jan 2014 17:11:36 -0500 Subject: [PATCH 16/21] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 79d6a52..8b69117 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.indicative.client.java Indicative-Java - 1.0.3 + 1.0.4-SNAPSHOT jar Indicative-Java From 44fa4e75f5e36716a0074011964aa0e805ab00d9 Mon Sep 17 00:00:00 2001 From: bealeindicative Date: Mon, 21 Jul 2014 15:44:37 -0400 Subject: [PATCH 17/21] Update README.md Updated version number in sample maven integration --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0ec3ed..758f7f3 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Sample usage: com.indicative.client.java indicative-java - 1.0.2 + 1.0.3 // Call the Indicative class's apiKey() method and pass in your API key, From 2d1b6ecdcb284ebdb58b896008ca1e586c8f26a4 Mon Sep 17 00:00:00 2001 From: Jackie Date: Mon, 13 Oct 2014 15:12:20 -0400 Subject: [PATCH 18/21] + let indicative servers know what client requests are coming from --- src/main/java/com/indicative/client/java/Indicative.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/indicative/client/java/Indicative.java b/src/main/java/com/indicative/client/java/Indicative.java index 5ac31e7..7abc681 100644 --- a/src/main/java/com/indicative/client/java/Indicative.java +++ b/src/main/java/com/indicative/client/java/Indicative.java @@ -101,6 +101,7 @@ private boolean sendPost(String body) { con.setRequestProperty("Accept-Charset", "UTF-8"); con.addRequestProperty("Content-Type", "application/json; charset=UTF-8"); con.setRequestProperty("Content-Length", "" + Integer.toString(bodyBytes.length)); + con.addRequestProperty("Indicative-Client", "Java"); // Send post request con.setDoOutput(true); From 96564af169a9db24c9d5a15c1f6ea46c58370b21 Mon Sep 17 00:00:00 2001 From: bealeindicative Date: Wed, 11 Mar 2015 14:16:32 -0400 Subject: [PATCH 19/21] Update LICENSE.txt --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 8355543..538dd93 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013, Indicative +Copyright (c) 2015, Indicative All rights reserved. Redistribution and use in source and binary forms, with or without From 031402648932d72ffcdf1ae241497996db64cf25 Mon Sep 17 00:00:00 2001 From: Prajjwol Gautam Date: Fri, 25 Sep 2015 14:13:18 -0400 Subject: [PATCH 20/21] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 758f7f3..4f72a74 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,4 @@ You should modify and extend this class to your heart's content. If you make an As a best practice, consider adding a method that takes as a parameter the object representing your user, and adds certain default properties based on that user's characteristics (e.g., gender, age, etc.). -For more details, see our documentation at: http://www.indicative.com/docs/integration.html +For more details, see our documentation at: http://app.indicative.com/docs/integration.html From 84eb29a2d6c2090b27bfe9cf9fbfb93def13d1bc Mon Sep 17 00:00:00 2001 From: Jeremy Levy Date: Fri, 2 Aug 2019 13:07:43 -0400 Subject: [PATCH 21/21] bumped mvn java versions --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8b69117..b1efadc 100644 --- a/pom.xml +++ b/pom.xml @@ -46,8 +46,8 @@ maven-compiler-plugin 3.0 - 1.6 - 1.6 + 1.7 + 1.7