Permalink
Browse files

new changes for 8041

  • Loading branch information...
1 parent 190a310 commit dadb191a294695511f6fed3d7174b453d7ba7eec geremy committed Feb 14, 2013
View
@@ -1,5 +1,9 @@
CHANGELOG
+02-14-2013 - 190a310c2b86e740fd7cb296b22dfa96174591e9
+. better type support
+. misc refactoring
+
02-13-2013 - 9ca6edf7a1c8a0089fc5db8121fc4be75f5a3b2e
. fixing encoding bug on publish
Binary file not shown.
View
@@ -6,13 +6,9 @@
<property name="source" value="1.5"/>
<path id="PubnubApi.classpath">
<pathelement location="bin"/>
- <pathelement location="libs/httpcore-4.2.2.jar"/>
- <pathelement location="libs/httpclient-4.2.2.jar"/>
- <pathelement location="libs/bouncycastle.jar"/>
- <pathelement location="libs/json.jar"/>
- <pathelement location="libs/commons-codec-1.5.jar"/>
- <pathelement location="libs/commons-logging-1.1.1.jar"/>
- <pathelement location="libs/log4j-1.2.17.jar"/>
+ <pathelement location="libs/bcprov-jdk15on-1.47.jar"/>
+ <pathelement location="libs/json-20090211.jar"/>
+ <pathelement location="libs/commons-logging-1.1.1.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
@@ -76,7 +72,7 @@
<attribute name="Company" value="Pubnub" />
<attribute name="Project" value="pubnub-api" />
<attribute name="Java-Version" value="${java.version}" />
- <attribute name="Rsrc-Class-Path" value="./ log4j-1.2.17.jar httpcore-4.2.2.jar httpclient-4.2.2.jar bouncycastle.jar json.jar commons-logging-1.1.1.jar commons-codec-1.5.jar " />
+ <attribute name="Rsrc-Class-Path" value="./ bcprov-jdk15on-1.47.jar json-20090211.jar commons-logging-1.1.1.jar " />
<attribute name="Class-Path" value="." />
<attribute name="Rsrc-Main-Class" value="@{jar.classname}" />
<attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader" />
@@ -3,6 +3,9 @@
import java.util.Hashtable;
import java.util.Scanner;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
import com.pubnub.api.Callback;
import com.pubnub.api.Pubnub;
import com.pubnub.api.PubnubException;
@@ -21,11 +24,53 @@ private void notifyUser(Object message) {
}
private void publish(String channel) {
System.out.println("Enter the message for publish. To exit loop enter QUIT");
- String message ;
- while (!(message = reader.nextLine()).equalsIgnoreCase("QUIT")) {
+ String message = "";
+
+ while (true) {
Hashtable args = new Hashtable(2);
+ message = reader.nextLine();
+ if (message.equalsIgnoreCase("QUIT")) {
+ break;
+ }
+ if (args.get("message") == null ) {
+ try {
+ Integer i = Integer.parseInt(message);
+ args.put("message", i);
+ } catch (Exception e) {
+
+ }
+ }
+ if (args.get("message") == null ) {
+ try {
+ Double d = Double.parseDouble(message);
+ args.put("message", d);
+ } catch (Exception e) {
+
+ }
+ }
+ if (args.get("message") == null ) {
+ try {
+ JSONArray js = new JSONArray(message);
+ args.put("message", js);
+ } catch (Exception e) {
+
+ }
+ }
+ if (args.get("message") == null ) {
+ try {
+ JSONObject js = new JSONObject(message);
+ args.put("message", js);
+ } catch (Exception e) {
+
+ }
+ }
+ if (args.get("message") == null ) {
+ args.put("message", message);
+ }
+
+
+
args.put("channel", channel); // Channel Name
- args.put("message", message); // JSON Message
pubnub.publish(args, new Callback() {
public void successCallback(String channel, Object message) {
notifyUser("PUBLISH : " + message);
@@ -2,7 +2,6 @@
import java.util.Hashtable;
-import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -26,10 +25,10 @@ public PubnubExample() {
* @param params
*/
public static void main(String[] params) {
-
- int counter = 0;
+
+ int counter = 0;
PubnubExample pex = new PubnubExample();
-
+
pex._pubnub.setSubscribeTimeout(310000);
pex._pubnub.setNonSubscribeTimeout(15000);
/*
@@ -58,7 +57,7 @@ public static void main(String[] params) {
System.out.println("\nRunning subscribe()");
pex.subscribe(new String[]{"hello_world" + "-" + String.valueOf(counter)});
-
+
while (true) {
counter = (counter + 1) % 9;
try {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
@@ -0,0 +1,33 @@
+package com.pubnub.api;
+
+import java.util.UUID;
+
+public class Pubnub extends PubnubCore {
+ public Pubnub(String publish_key, String subscribe_key, String secret_key,
+ String cipher_key, boolean ssl_on) {
+ super(publish_key, subscribe_key, secret_key, cipher_key, ssl_on);
+ }
+
+ public Pubnub(String publish_key, String subscribe_key, String secret_key,
+ boolean ssl_on) {
+ super(publish_key, subscribe_key, secret_key, "", ssl_on);
+ }
+
+
+ public Pubnub(String publish_key, String subscribe_key) {
+ super(publish_key, subscribe_key, "", "", false);
+ }
+
+ public Pubnub(String publish_key, String subscribe_key, boolean ssl) {
+ super(publish_key, subscribe_key, "", "", ssl);
+ }
+
+ public Pubnub(String publish_key, String subscribe_key, String secret_key) {
+ super(publish_key, subscribe_key, secret_key, "", false);
+ }
+
+ @Override
+ public String uuid() {
+ return UUID.randomUUID().toString();
+ }
+}
@@ -0,0 +1,9 @@
+package com.pubnub.crypto;
+
+public class PubnubCrypto extends PubnubCryptoCore {
+
+ public PubnubCrypto(String CIPHER_KEY) {
+ super(CIPHER_KEY);
+ }
+
+}
@@ -4,7 +4,7 @@
* Interface to be implemented by objects to be passed to subscribe/presence as
* callback
*
- * @author Pubnub
+ * @author PubnubCore
*
*/
public abstract class Callback {
@@ -1,7 +1,7 @@
package com.pubnub.api;
/**
- * @author Pubnub
+ * @author PubnubCore
*
*/
class Channel {
Oops, something went wrong. Retry.

0 comments on commit dadb191

Please sign in to comment.