diff --git a/.directory b/.directory new file mode 100644 index 000000000..455d8a3ed --- /dev/null +++ b/.directory @@ -0,0 +1,7 @@ +[Dolphin] +Timestamp=2013,5,31,1,23,30 +Version=3 +ViewMode=2 + +[Settings] +HiddenFilesShown=true diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..641ab5991 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# built application files +*.apk +*.ap_ + +# files for the dex VM +*.dex + +# Java class files +*.class + +# generated files +bin/ +gen/ + +# Local configuration file (sdk path, etc) +local.properties + +# Eclipse project files +.classpath +.project + +# Proguard folder generated by Eclipse +proguard/ + +# Intellij project files +*.iml +*.ipr +*.iws +.idea/ + +*.class + +# gwt caches and compiled units # +war/gwt_bree/ +gwt-unitCache/ + +# boilerplate generated classes # +.apt_generated/ + +# more caches and things from deploy # +war/WEB-INF/deploy/ +war/WEB-INF/classes/ + + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 000000000..27e454cc3 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,51 @@ +11-06-13 3.5.6 +. fixed socket timeout exception handling +. make PNERR_HTTP_RC_ERROR public +. encryption logic is made public for developers to integrate with their own logic +. always honor retry interval +. backwards compatible (3.1) encryption support +. adding windowing feature to java clients + +08-27-13 3.5.5 +. better handling of double quoted strings +. make auth key optional for audit +. update encoding parameters for signature generation +. debug jar and maven deployment + +07-11-13 3.5.4 +. fixed issue with PAM audit when auth key is set +. fixed issue in cn1 where global headers were not getting added +. fixed issue in PAM, where ttl 0 was being considered invalid + +07-09-13 3.5.3 +. added constructor for setting iv +. beta1 of CN1 port +. added constructor for setting PAM grant TTL (minutes) +. migrate ULS* methods to PAM* methods +. first version of scala console +. fix ant debug-build from any source path + +07-01-13 3.5.2 +. Introduced PubnubError class object passing to errorCallback +. ULS APIs +. Consolidated CHANGELOG to root of repo +. set origin feature +. set cache-busting feature + + +06-07-13 +. better handling in multithreaded environments +. better debug log handling + +02-20-2013 - 800478550d9dfa19ae626ee7fd0f774f35254e1b +. added additional versioning support for maven +. jar refactor + +02-01-2013 - 8a686c91cb546787a6be7810b96b806c33cf96e7 +. client is now fully asyncronous +. added enhanced multiplexed subscribe support +. better error handling added to example app +. improved keep-alive handling +. support for chunked responses +. improved logging + diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/README.md b/README.md new file mode 100644 index 000000000..62c67adf4 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +#PubNub Java-based APIs for core Java, Android, J2ME, BlackBerry. +Learn more at http://www.pubnub.com + +## Migrating from 3.5.1 and older... + +3.5.2+ is backward compatible with 3.5.1. Some of the methods have been deprecated. +You will see compiler warnings for the same. Please refer to java docs for alternate +methods to be used. + +Its recommended to remove the usage of Deprecated methods as they will be removed in +3.6.0 . + + +## Subdirectory Description +This repo contains the following platform-specific subdirectories: + +### Android +Client for the Mobile Android OS + +### GWT +Client for the GWT Platform + +### J2ME +Client for the J2ME Mobile Platform + +### Blackberry +Client for the Blackberry Mobile Platform + +### Java +Everything else! Java development for POJOs, J2EE, J2SE, etc. + +### Java for Google App Engine +See the Java subdir, and the GAE_3.3 tag + +### Codename One +Easy amazing, fast, native mobile app development using Java™ for all platforms +See the [codenameone](codenameone) subdir for client and example code. diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..c49282585 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +3.5.6 diff --git a/android/CHANGELOG b/android/CHANGELOG new file mode 100644 index 000000000..f1febed1b --- /dev/null +++ b/android/CHANGELOG @@ -0,0 +1,5 @@ +03-18-13 +Fixing URL encoding bug in Android + +02-19-13 - ff0bf5d8cf5402983072e6f1666b6eb4e1a58926 +Moving 3.4 code into a new repo from the old repository @ cf8baca03090b6052fb11625e15bb0fb75d39fe3 diff --git a/android/LICENSE b/android/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/android/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/android/Pubnub-Android-3.5.6.jar b/android/Pubnub-Android-3.5.6.jar new file mode 100644 index 000000000..910a1efaf Binary files /dev/null and b/android/Pubnub-Android-3.5.6.jar differ diff --git a/android/Pubnub-Android-Debug-3.5.6.jar b/android/Pubnub-Android-Debug-3.5.6.jar new file mode 100644 index 000000000..910a1efaf Binary files /dev/null and b/android/Pubnub-Android-Debug-3.5.6.jar differ diff --git a/android/README.md b/android/README.md new file mode 100644 index 000000000..848179df9 --- /dev/null +++ b/android/README.md @@ -0,0 +1,219 @@ +### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. + +http://www.pubnub.com/account + +## PubNub 3.5 Real-time Cloud Push API - ANDROID + +PubNub is a Massively Scalable Real-time Service for Web and Mobile Games. +This is a cloud-based service for broadcasting Real-time messages +to thousands of web and mobile clients simultaneously. + +The PubNub Android client provides a superior alternative to C2DM for broadcasting messages to entire user base. +C2DM is hard to implement, and it imposes artificial limits for you to reach your users quickly. +C2DM is not recommended as it is a "broadcast" mechanism according to Google. C2DM is Slow, and limited to 1 message at a time. +Use PubNub Instead! + +## Getting started with Pubnub in your app + +Checkout the [walkthrough video](https://vimeo.com/71554109) first! + +To use Pubnub, simply copy the Pubnub-Android-3.4.jar and bcprov-jdk15on-1.47.jar files in to your project's libs directory. +These files can be found at pubnub/java/android/3.4/Pubnub-Android-3.4.jar and pubnub/java/java/3.4/libs/bcprov-jdk15on-1.47.jar. + +### PubNub Android Sample App + +This app demonstrates all PubNub features and functionality. It can be found in 3.4/examples/PubnubExample directory. + +### Pubnub Auto-subscribing, Auto-startup App +This is a sample app which subscribes to channel **"hello_world"** on receiving the **android.intent.action.BOOT_COMPLETED** intent. +The user is alerted about events like connect, message received etc. via notifications. + +Code for this app can be found in the 3.4/examples/SubscribeAtBoot directory. + +## Building the Pubnub library jar + +Pubnub library jar can be built by running following commands. ( Jar is already present in repository ) +``` +$ ant clean +$ ant +``` + +Pubnub library jar with debug messages enabled can be built by running following commands +``` +$ ant clean +$ and debug-build +``` + +##Connection Durability: Reconnecting & Resuming when a connection is lost or changed + +As a mobile device may lose its connection under many different circumstances (IP change, roaming, etc), any current in-process subscribe operations can be forced +to reconnect (and optionally catchup where left off) when any change has occured in the network environment. This is done by calling the +**disconnectAndResubscribe()** method on the PubNub instance. + +The demo application has examples of setting up a broadcast receiver for the **ConnectivityManager.CONNECTIVITY_ACTION**. +The **onReceive()** method is where it checks for certain (or any) network change conditions, and +calls **disconnectAndResubscribe()** as needed. + +```java + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + this.registerReceiver(new BroadcastReceiver() { + @Override + public void onReceive(Context arg0, Intent intent) { + pubnub.disconnectAndResubscribe(); + } + + }, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION )); +``` + +This logic has been purposely left out of the core and documented in the example application, so that if you wish to +add additional tests for monitoring a potential zombied subscribe connection, it is very easy to add your own custom logic within this +given receiver template. + +When **disconnectAndResubscribe()** is called, either via the broadcast receiver or otherwise, it will retry maxRetries times +to reconnect ever retryInterval seconds. You can set these variables with the **setRetryInterval(int milliseconds)** and **setMaxRetries** methods. + +If it **not able** to recover network within the given constraints, it will return an error response of [0, ERROR_MSG_STRING]. + +**setResumeOnReconnect()** allows you to define the behaviour upon successful reconnect. + +If it **is able** to recover network, then the subscribe will "catchup", or resume where it left off before the interruption +if isResumeOnReconnect() is true, otherwise, it will restart and grab only new messages since it reconnected. + + +##Client API Summary + +###Init +```java +Pubnub pubnub = new Pubnub( + "demo", // PUBLISH_KEY (Optional, supply "" to disable) + "demo", // SUBSCRIBE_KEY (Required) + "", // SECRET_KEY (Optional, supply "" to disable) + "", // CIPHER_KEY (Optional, supply "" to disable) + false // SSL_ON? +); +``` + +###Publish +```java + +// Setup the argument Hash object to set the message and channel name + +Hashtable args = new Hashtable(2); + +String message = "Hello PubNub!"; +String message = "hello_world"; + +args.put("message", message); +args.put("channel", channel); + +// Publish It! + +pubnub.publish(args, new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, Object message) { + notifyUser(channel + " : " + message.toString()); + } +}); + +``` + +###Subscribe and Presence +```java + +// Regular Subscribe + +Hashtable args = new Hashtable(1); + +args.put("channel", channel); + +pubnub.subscribe(args, new Callback() { + public void connectCallback(String channel) { + notifyUser("CONNECT on channel:" + channel); + } + + public void disconnectCallback(String channel) { + notifyUser("DISCONNECT on channel:" + channel); + } + + public void reconnectCallback(String channel) { + notifyUser("RECONNECT on channel:" + channel); + } + + public void successCallback(String channel, Object message) { + notifyUser(channel + " " + message.toString()); + } + + public void errorCallback(String channel, Object message) { + notifyUser(channel + " " + message.toString()); + } +}); + +// Presence + +pubnub.presence(channel, new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, Object message) { + notifyUser(channel + " : " + message.toString()); + } +}); + +``` + +###History +```java +pubnub.detailedHistory(channel, 2, new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, Object message) { + notifyUser(channel + " : " + message.toString()); + } +}); +``` + +###Unsubscribe +```java +String channel = "goodbye_world"; +pubnub.unsubscribe(channel); +``` + +###Time +```java + // Get server time + double time = pubnub.time(); + System.out.println("Time : "+time); +``` + +###UUID +```java + // Get UUID + System.out.println("UUID : "+Pubnub.uuid()); +``` + +###Here Now + +```java +pubnub.hereNow(channel, new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, Object message) { + notifyUser(channel + " : " + message.toString()); + } +}); +``` + + diff --git a/android/build.xml b/android/build.xml new file mode 100644 index 000000000..54b09d0b9 --- /dev/null +++ b/android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/examples/PubnubExample/AndroidManifest.xml b/android/examples/PubnubExample/AndroidManifest.xml new file mode 100644 index 000000000..816d1992e --- /dev/null +++ b/android/examples/PubnubExample/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/examples/PubnubExample/ic_launcher-web.png b/android/examples/PubnubExample/ic_launcher-web.png new file mode 100644 index 000000000..424f26042 Binary files /dev/null and b/android/examples/PubnubExample/ic_launcher-web.png differ diff --git a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.6.jar b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.6.jar new file mode 100644 index 000000000..910a1efaf Binary files /dev/null and b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.6.jar differ diff --git a/android/examples/PubnubExample/libs/android-support-v4.jar b/android/examples/PubnubExample/libs/android-support-v4.jar new file mode 100644 index 000000000..6080877d4 Binary files /dev/null and b/android/examples/PubnubExample/libs/android-support-v4.jar differ diff --git a/android/examples/PubnubExample/libs/bcprov-jdk15on-1.47.jar b/android/examples/PubnubExample/libs/bcprov-jdk15on-1.47.jar new file mode 100644 index 000000000..0b80922e6 Binary files /dev/null and b/android/examples/PubnubExample/libs/bcprov-jdk15on-1.47.jar differ diff --git a/android/examples/PubnubExample/proguard-project.txt b/android/examples/PubnubExample/proguard-project.txt new file mode 100644 index 000000000..5b89420db --- /dev/null +++ b/android/examples/PubnubExample/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# 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 *; +#} \ No newline at end of file diff --git a/android/examples/PubnubExample/project.properties b/android/examples/PubnubExample/project.properties new file mode 100644 index 000000000..85aac5401 --- /dev/null +++ b/android/examples/PubnubExample/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 diff --git a/android/examples/PubnubExample/res/drawable-hdpi/ic_launcher.png b/android/examples/PubnubExample/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..0e79b184f Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/examples/PubnubExample/res/drawable-hdpi/ic_launcher_pubnub.png b/android/examples/PubnubExample/res/drawable-hdpi/ic_launcher_pubnub.png new file mode 100644 index 000000000..dae531896 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-hdpi/ic_launcher_pubnub.png differ diff --git a/android/examples/PubnubExample/res/drawable-hdpi/pubnub_large.png b/android/examples/PubnubExample/res/drawable-hdpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-hdpi/pubnub_large.png differ diff --git a/android/examples/PubnubExample/res/drawable-ldpi/ic_launcher.png b/android/examples/PubnubExample/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..ebfac7d78 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-ldpi/ic_launcher.png differ diff --git a/android/examples/PubnubExample/res/drawable-ldpi/pubnub_large.png b/android/examples/PubnubExample/res/drawable-ldpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-ldpi/pubnub_large.png differ diff --git a/android/examples/PubnubExample/res/drawable-mdpi/ic_launcher.png b/android/examples/PubnubExample/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..118344193 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/examples/PubnubExample/res/drawable-mdpi/ic_launcher_pubnub.png b/android/examples/PubnubExample/res/drawable-mdpi/ic_launcher_pubnub.png new file mode 100644 index 000000000..94ca3a50f Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-mdpi/ic_launcher_pubnub.png differ diff --git a/android/examples/PubnubExample/res/drawable-mdpi/pubnub_large.png b/android/examples/PubnubExample/res/drawable-mdpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-mdpi/pubnub_large.png differ diff --git a/android/examples/PubnubExample/res/drawable-xhdpi/ic_launcher.png b/android/examples/PubnubExample/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..c8ab2a114 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/examples/PubnubExample/res/drawable-xhdpi/ic_launcher_pubnub.png b/android/examples/PubnubExample/res/drawable-xhdpi/ic_launcher_pubnub.png new file mode 100644 index 000000000..1ed434174 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-xhdpi/ic_launcher_pubnub.png differ diff --git a/android/examples/PubnubExample/res/drawable-xhdpi/pubnub_large.png b/android/examples/PubnubExample/res/drawable-xhdpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-xhdpi/pubnub_large.png differ diff --git a/android/examples/PubnubExample/res/drawable-xxhdpi/ic_launcher_pubnub.png b/android/examples/PubnubExample/res/drawable-xxhdpi/ic_launcher_pubnub.png new file mode 100644 index 000000000..290fc06b6 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable-xxhdpi/ic_launcher_pubnub.png differ diff --git a/android/examples/PubnubExample/res/drawable/icon.png b/android/examples/PubnubExample/res/drawable/icon.png new file mode 100644 index 000000000..08ee50da9 Binary files /dev/null and b/android/examples/PubnubExample/res/drawable/icon.png differ diff --git a/android/examples/PubnubExample/res/layout/usage.xml b/android/examples/PubnubExample/res/layout/usage.xml new file mode 100644 index 000000000..867516d04 --- /dev/null +++ b/android/examples/PubnubExample/res/layout/usage.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/examples/PubnubExample/res/menu/activity_main.xml b/android/examples/PubnubExample/res/menu/activity_main.xml new file mode 100644 index 000000000..8a1c582d2 --- /dev/null +++ b/android/examples/PubnubExample/res/menu/activity_main.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/examples/PubnubExample/res/values/dimens.xml b/android/examples/PubnubExample/res/values/dimens.xml new file mode 100644 index 000000000..a67ff7099 --- /dev/null +++ b/android/examples/PubnubExample/res/values/dimens.xml @@ -0,0 +1,12 @@ + + + 300dip + 150dip + 100dip + 20dip + 30dip + 15dip + 11dip + 10dip + 20dip + diff --git a/android/examples/PubnubExample/res/values/strings.xml b/android/examples/PubnubExample/res/values/strings.xml new file mode 100644 index 000000000..a870ddeca --- /dev/null +++ b/android/examples/PubnubExample/res/values/strings.xml @@ -0,0 +1,40 @@ + + + + PubnubExample + Pubnub + Hello world! + Settings + History + Presence + Subscribe + Publish + History + Disconnect and Resubscribe + History + Toggle Catchup + Here Now + Message to Publish + Publish/Subscribe Test + Unsubscribe All + Welcome to the Pubnub Demo Console + Click Menu and select an action: + Subscribe + Publish + Presence + Detailed History + Here Now + Unsubscribe + Presence-Unsubscribe + Time + Disconnect-And-Resubscribe + Disconnect-And-Resubscribe with timetoken + Toggle Resume On Reconnect + Set MAX Retries + Set Retry Interval + Set Subscribe Timeout + Set Non Subscribe Timeout + Set Window Interval + + + \ No newline at end of file diff --git a/android/examples/PubnubExample/res/values/styles.xml b/android/examples/PubnubExample/res/values/styles.xml new file mode 100644 index 000000000..4a10ca492 --- /dev/null +++ b/android/examples/PubnubExample/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java b/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java new file mode 100644 index 000000000..6a25f8856 --- /dev/null +++ b/android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample/MainActivity.java @@ -0,0 +1,633 @@ +package com.pubnub.examples.pubnubExample; + +import java.util.Hashtable; + +import org.json.JSONArray; +import org.json.JSONObject; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.os.Bundle; +import android.text.InputType; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.EditText; +import android.widget.Toast; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class MainActivity extends Activity { + /* + * //Noise Test Pubnub pubnub = new + * Pubnub("pub-c-87f96934-8c44-4f8d-a35f-deaa2753f083", + * "sub-c-3a693cf8-7401-11e2-8b02-12313f022c90", "", false); String channel + * = "noise"; String channel = "a"; + */ + + Pubnub pubnub = new Pubnub("demo", "demo", "", false); + + private void notifyUser(Object message) { + try { + if (message instanceof JSONObject) { + final JSONObject obj = (JSONObject) message; + this.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(), obj.toString(), + Toast.LENGTH_LONG).show(); + + Log.i("Received msg : ", String.valueOf(obj)); + } + }); + + } else if (message instanceof String) { + final String obj = (String) message; + this.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(), obj, + Toast.LENGTH_LONG).show(); + Log.i("Received msg : ", obj.toString()); + } + }); + + } else if (message instanceof JSONArray) { + final JSONArray obj = (JSONArray) message; + this.runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(), obj.toString(), + Toast.LENGTH_LONG).show(); + Log.i("Received msg : ", obj.toString()); + } + }); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + + setContentView(R.layout.usage); + this.registerReceiver(new BroadcastReceiver() { + @Override + public void onReceive(Context arg0, Intent intent) { + pubnub.disconnectAndResubscribe(); + + } + + }, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.activity_main, menu); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle item selection + switch (item.getItemId()) { + + case R.id.option1: + subscribe(); + return true; + + case R.id.option2: + publish(); + return true; + + case R.id.option3: + presence(); + return true; + + case R.id.option4: + detailedHistory(); + return true; + + case R.id.option5: + hereNow(); + return true; + + case R.id.option6: + unsubscribe(); + return true; + + case R.id.option7: + presenceUnsubscribe(); + return true; + + case R.id.option8: + time(); + return true; + + case R.id.option9: + disconnectAndResubscribe(); + return true; + + case R.id.option10: + disconnectAndResubscribeWithTimetoken(); + return true; + + case R.id.option11: + toggleResumeOnReconnect(); + return true; + + case R.id.option12: + setMaxRetries(); + return true; + + case R.id.option13: + setRetryInterval(); + return true; + + case R.id.option14: + setSubscribeTimeout(); + return true; + + case R.id.option15: + setNonSubscribeTimeout(); + return true; + + case R.id.option16: + setWindowInterval(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void setNonSubscribeTimeout() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Set Non Subscribe Timeout"); + builder.setMessage("Enter timeout value in milliseconds"); + final EditText edTimeout = new EditText(this); + edTimeout.setInputType(InputType.TYPE_CLASS_NUMBER); + builder.setView(edTimeout); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.setNonSubscribeTimeout(Integer + .parseInt(edTimeout.getText().toString())); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void subscribe() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Subscribe"); + builder.setMessage("Enter channel name"); + final EditText input = new EditText(this); + builder.setView(input); + builder.setPositiveButton("Subscribe", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + + Hashtable args = new Hashtable(1); + + String message = input.getText().toString(); + args.put("channel", message); + + try { + pubnub.subscribe(args, new Callback() { + @Override + public void connectCallback(String channel, + Object message) { + notifyUser("SUBSCRIBE : CONNECT on channel:" + + channel + + " : " + + message.getClass() + + " : " + + message.toString()); + } + @Override + public void disconnectCallback(String channel, + Object message) { + notifyUser("SUBSCRIBE : DISCONNECT on channel:" + + channel + + " : " + + message.getClass() + + " : " + + message.toString()); + } + + @Override + public void reconnectCallback(String channel, + Object message) { + notifyUser("SUBSCRIBE : RECONNECT on channel:" + + channel + + " : " + + message.getClass() + + " : " + + message.toString()); + } + @Override + public void successCallback(String channel, + Object message) { + notifyUser("SUBSCRIBE : " + channel + " : " + + message.getClass() + " : " + + message.toString()); + } + @Override + public void errorCallback(String channel, + PubnubError error) { + notifyUser("SUBSCRIBE : ERROR on channel " + + channel + " : " + + error.toString()); + } + }); + + } catch (Exception e) { + + } + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + + } + + private void _publish(final String channel) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Publish"); + builder.setMessage("Enter message"); + final EditText etMessage = new EditText(this); + builder.setView(etMessage); + builder.setPositiveButton("Publish", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + Hashtable args = new Hashtable(2); + + String message = etMessage.getText().toString(); + + 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); + } + + // Publish Message + + args.put("channel", channel); // Channel Name + + pubnub.publish(args, new Callback() { + @Override + public void successCallback(String channel, + Object message) { + notifyUser("PUBLISH : " + message); + } + @Override + public void errorCallback(String channel, + PubnubError error) { + notifyUser("PUBLISH : " + error); + } + }); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + + } + + private void publish() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Publish "); + builder.setMessage("Enter channel name"); + final EditText etChannel = new EditText(this); + builder.setView(etChannel); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + _publish(etChannel.getText().toString()); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void presence() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Presence"); + builder.setMessage("Enter channel name"); + final EditText input = new EditText(this); + builder.setView(input); + builder.setPositiveButton("Subscribe For Presence", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + String channel = input.getText().toString(); + + try { + pubnub.presence(channel, new Callback() { + @Override + public void successCallback(String channel, + Object message) { + notifyUser("PRESENCE : " + channel + " : " + + message.getClass() + " : " + + message.toString()); + } + @Override + public void errorCallback(String channel, + PubnubError error) { + notifyUser("PRESENCE : ERROR on channel " + + channel + " : " + + error.toString()); + } + }); + + } catch (Exception e) { + + } + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void detailedHistory() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Detailed History"); + builder.setMessage("Enter channel name"); + final EditText input = new EditText(this); + builder.setView(input); + builder.setPositiveButton("Get detailed history", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + String channel = input.getText().toString(); + pubnub.detailedHistory(channel, 2, new Callback() { + @Override + public void successCallback(String channel, + Object message) { + notifyUser("DETAILED HISTORY : " + message); + } + @Override + public void errorCallback(String channel, + PubnubError error) { + notifyUser("DETAILED HISTORY : " + error); + } + }); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void hereNow() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Here Now"); + builder.setMessage("Enter channel name"); + final EditText input = new EditText(this); + builder.setView(input); + builder.setPositiveButton("Get Here Now", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + String channel = input.getText().toString(); + pubnub.hereNow(channel, new Callback() { + @Override + public void successCallback(String channel, + Object message) { + notifyUser("HERE NOW : " + message); + } + @Override + public void errorCallback(String channel, + PubnubError error) { + notifyUser("HERE NOW : " + error); + } + }); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void unsubscribe() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Unsubscribe"); + builder.setMessage("Enter channel name"); + final EditText input = new EditText(this); + builder.setView(input); + builder.setPositiveButton("Unsubscribe", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + String channel = input.getText().toString(); + pubnub.unsubscribe(channel); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void presenceUnsubscribe() { + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Unsubscribe Presence"); + builder.setMessage("Enter channel name"); + final EditText input = new EditText(this); + builder.setView(input); + builder.setPositiveButton("Unsubscribe Presence", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + String channel = input.getText().toString(); + pubnub.unsubscribePresence(channel); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void time() { + pubnub.time(new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("TIME : " + message); + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("TIME : " + error); + } + }); + + } + + private void disconnectAndResubscribe() { + pubnub.disconnectAndResubscribe(); + + } + + private void setSubscribeTimeout() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Set Subscribe Timeout"); + builder.setMessage("Enter timeout value in milliseconds"); + final EditText edTimeout = new EditText(this); + edTimeout.setInputType(InputType.TYPE_CLASS_NUMBER); + builder.setView(edTimeout); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.setSubscribeTimeout(Integer.parseInt(edTimeout + .getText().toString())); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + + } + + private void setRetryInterval() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Set Retry Interval"); + builder.setMessage("Enter retry interval in milliseconds"); + final EditText edInterval = new EditText(this); + edInterval.setInputType(InputType.TYPE_CLASS_NUMBER); + builder.setView(edInterval); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.setRetryInterval(Integer.parseInt(edInterval + .getText().toString())); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } + private void setWindowInterval() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Set Window Interval"); + builder.setMessage("Enter Window interval in milliseconds"); + final EditText edInterval = new EditText(this); + edInterval.setInputType(InputType.TYPE_CLASS_NUMBER); + builder.setView(edInterval); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.setWindowInterval(Integer.parseInt(edInterval + .getText().toString())); + } + + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void toggleResumeOnReconnect() { + pubnub.setResumeOnReconnect(pubnub.isResumeOnReconnect() ? false : true); + notifyUser("RESUME ON RECONNECT : " + pubnub.isResumeOnReconnect()); + } + + private void setMaxRetries() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Set Max Retries"); + builder.setMessage("Enter Max Retries"); + final EditText edRetries = new EditText(this); + edRetries.setInputType(InputType.TYPE_CLASS_NUMBER); + builder.setView(edRetries); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.setMaxRetries(Integer.parseInt(edRetries + .getText().toString())); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } + + private void disconnectAndResubscribeWithTimetoken() { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Disconnect and Resubscribe with timetoken"); + builder.setMessage("Enter Timetoken"); + final EditText edTimetoken = new EditText(this); + builder.setView(edTimetoken); + builder.setPositiveButton("Done", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + pubnub.disconnectAndResubscribeWithTimetoken( + edTimetoken.getText().toString()); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } +} diff --git a/android/examples/SubscribeAtBoot/AndroidManifest.xml b/android/examples/SubscribeAtBoot/AndroidManifest.xml new file mode 100644 index 000000000..feb2252c6 --- /dev/null +++ b/android/examples/SubscribeAtBoot/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/examples/SubscribeAtBoot/ic_launcher-web.png b/android/examples/SubscribeAtBoot/ic_launcher-web.png new file mode 100644 index 000000000..a18cbb48c Binary files /dev/null and b/android/examples/SubscribeAtBoot/ic_launcher-web.png differ diff --git a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.6.jar b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.6.jar new file mode 100644 index 000000000..910a1efaf Binary files /dev/null and b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.6.jar differ diff --git a/android/examples/SubscribeAtBoot/libs/android-support-v4.jar b/android/examples/SubscribeAtBoot/libs/android-support-v4.jar new file mode 100644 index 000000000..6080877d4 Binary files /dev/null and b/android/examples/SubscribeAtBoot/libs/android-support-v4.jar differ diff --git a/android/examples/SubscribeAtBoot/proguard-project.txt b/android/examples/SubscribeAtBoot/proguard-project.txt new file mode 100644 index 000000000..f2fe1559a --- /dev/null +++ b/android/examples/SubscribeAtBoot/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# 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 *; +#} diff --git a/android/examples/SubscribeAtBoot/project.properties b/android/examples/SubscribeAtBoot/project.properties new file mode 100644 index 000000000..0c9830a3b --- /dev/null +++ b/android/examples/SubscribeAtBoot/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=Google Inc.:Google APIs:17 diff --git a/android/examples/SubscribeAtBoot/res/drawable-hdpi/ic_launcher.png b/android/examples/SubscribeAtBoot/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..131c6370a Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-hdpi/ic_launcher.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-hdpi/pubnub_large.png b/android/examples/SubscribeAtBoot/res/drawable-hdpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-hdpi/pubnub_large.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-ldpi/pubnub_large.png b/android/examples/SubscribeAtBoot/res/drawable-ldpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-ldpi/pubnub_large.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-mdpi/ic_launcher.png b/android/examples/SubscribeAtBoot/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..068d9e4cb Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-mdpi/ic_launcher.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-mdpi/pubnub_large.png b/android/examples/SubscribeAtBoot/res/drawable-mdpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-mdpi/pubnub_large.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-xhdpi/ic_launcher.png b/android/examples/SubscribeAtBoot/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..2e9dc7df7 Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-xhdpi/ic_launcher.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-xhdpi/pubnub_large.png b/android/examples/SubscribeAtBoot/res/drawable-xhdpi/pubnub_large.png new file mode 100644 index 000000000..231910435 Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-xhdpi/pubnub_large.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable-xxhdpi/ic_launcher.png b/android/examples/SubscribeAtBoot/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..783cd2c9b Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/android/examples/SubscribeAtBoot/res/drawable/icon.png b/android/examples/SubscribeAtBoot/res/drawable/icon.png new file mode 100644 index 000000000..08ee50da9 Binary files /dev/null and b/android/examples/SubscribeAtBoot/res/drawable/icon.png differ diff --git a/android/examples/SubscribeAtBoot/res/values/strings.xml b/android/examples/SubscribeAtBoot/res/values/strings.xml new file mode 100644 index 000000000..ef18a1bcc --- /dev/null +++ b/android/examples/SubscribeAtBoot/res/values/strings.xml @@ -0,0 +1,4 @@ + + + SubscribeAtBoot + \ No newline at end of file diff --git a/android/examples/SubscribeAtBoot/res/values/styles.xml b/android/examples/SubscribeAtBoot/res/values/styles.xml new file mode 100644 index 000000000..4a10ca492 --- /dev/null +++ b/android/examples/SubscribeAtBoot/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/BootReceiver.java b/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/BootReceiver.java new file mode 100644 index 000000000..e0a44bbe8 --- /dev/null +++ b/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/BootReceiver.java @@ -0,0 +1,18 @@ +package com.pubnub.examples.subscribeAtBoot; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class BootReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent arg1) { + Log.i("PubnubService", "PubNub BootReceiver Starting"); + Intent intent = new Intent(context, PubnubService.class); + context.startService(intent); + Log.i("PubnubService", "PubNub BootReceiver Started"); + } + +} diff --git a/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/HelloWorldActivity.java b/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/HelloWorldActivity.java new file mode 100644 index 000000000..021083b30 --- /dev/null +++ b/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/HelloWorldActivity.java @@ -0,0 +1,23 @@ +package com.pubnub.examples.subscribeAtBoot; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; + + +public class HelloWorldActivity extends Activity { + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // In new versions of Android, the service may not be activated unless an + // associated activity is run at least once. This empty activity serves + // that purpose + + Intent serviceIntent = new Intent(this, PubnubService.class); + startService(serviceIntent); + + Log.i("HelloWorldActivity", "PubNub Activity Started!"); + + } +} \ No newline at end of file diff --git a/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/PubnubService.java b/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/PubnubService.java new file mode 100644 index 000000000..e2ef86b06 --- /dev/null +++ b/android/examples/SubscribeAtBoot/src/com/pubnub/examples/subscribeAtBoot/PubnubService.java @@ -0,0 +1,96 @@ +package com.pubnub.examples.subscribeAtBoot; + +import android.os.Handler; +import android.os.Message; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubException; + + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; +import android.util.Log; +import android.widget.Toast; + +public class PubnubService extends Service { + + String channel = "hello_world"; + Pubnub pubnub = new Pubnub("demo", "demo", false); + + private final Handler handler = new Handler() { + public void handleMessage(Message msg) { + String pnMsg = msg.obj.toString(); + + final Toast toast = Toast.makeText(getApplicationContext(), pnMsg, Toast.LENGTH_SHORT); + toast.show(); + + Handler handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + toast.cancel(); + } + }, 200); + + } + }; + + private void notifyUser(Object message) { + + Message msg = handler.obtainMessage(); + + try { + final String obj = (String) message; + msg.obj = obj; + handler.sendMessage(msg); + Log.i("Received msg : ", obj.toString()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void onCreate() { + super.onCreate(); + Toast.makeText(this, "PubnubService created...", Toast.LENGTH_LONG).show(); + Log.i("PUBNUB", "PubnubService created..."); + try { + pubnub.subscribe(new String[] {channel}, new Callback() { + public void connectCallback(String channel) { + notifyUser("CONNECT on channel:" + channel); + } + public void disconnectCallback(String channel) { + notifyUser("DISCONNECT on channel:" + channel); + } + public void reconnectCallback(String channel) { + notifyUser("RECONNECT on channel:" + channel); + } + @Override + public void successCallback(String channel, Object message) { + notifyUser(channel + " " + message.toString()); + } + @Override + public void errorCallback(String channel, Object message) { + notifyUser(channel + " " + message.toString()); + } + }); + } catch (PubnubException e) { + + } + } + + @Override + public void onDestroy() { + super.onDestroy(); + Toast.makeText(this, "PubnubService destroyed...", Toast.LENGTH_LONG).show(); + } + + @Override + public IBinder onBind(Intent intent) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/android/libs/android-8.jar b/android/libs/android-8.jar new file mode 100644 index 000000000..24ae5637d Binary files /dev/null and b/android/libs/android-8.jar differ diff --git a/android/res/drawable/icon.png b/android/res/drawable/icon.png new file mode 100644 index 000000000..08ee50da9 Binary files /dev/null and b/android/res/drawable/icon.png differ diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml new file mode 100644 index 000000000..6a2f2b38c --- /dev/null +++ b/android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + threefour + \ No newline at end of file diff --git a/android/src/com/pubnub/api/Pubnub.java b/android/src/com/pubnub/api/Pubnub.java new file mode 100644 index 000000000..7a1edb50d --- /dev/null +++ b/android/src/com/pubnub/api/Pubnub.java @@ -0,0 +1,147 @@ +package com.pubnub.api; + +import java.util.UUID; + +/** + * Pubnub object facilitates querying channels for messages and listening on + * channels for presence/message events + * + * @author Pubnub + * + */ + +public class Pubnub extends PubnubCore { + /** + * Pubnub Constructor + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL on ? + */ + 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); + } + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param ssl_on + * 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); + } + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + */ + public Pubnub(String publish_key, String subscribe_key) { + super(publish_key, subscribe_key, "", "", false); + } + + /** + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param ssl + */ + public Pubnub(String publish_key, String subscribe_key, boolean ssl) { + super(publish_key, subscribe_key, "", "", ssl); + } + + /** + * @param publish_key + * @param subscribe_key + * @param secret_key + */ + public Pubnub(String publish_key, String subscribe_key, String secret_key) { + super(publish_key, subscribe_key, secret_key, "", false); + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL enabled ? + * @param initialization_vector + * Initialization vector + */ + + public Pubnub(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on, String initialization_vector) { + super(publish_key, subscribe_key, secret_key, cipher_key, ssl_on, initialization_vector); + } + + /** + * Sets value for UUID + * + * @param uuid + * UUID value for Pubnub client + */ + public void setUUID(UUID uuid) { + this.UUID = uuid.toString(); + } + + protected String uuid() { + return java.util.UUID.randomUUID().toString(); + } + + /** + * This method sets timeout value for subscribe/presence. Default value is + * 310000 milliseconds i.e. 310 seconds + * + * @param timeout + * Timeout value in milliseconds for subscribe/presence + */ + public void setSubscribeTimeout(int timeout) { + super.setSubscribeTimeout(timeout); + } + + /** + * This method set timeout value for non subscribe operations like publish, + * history, hereNow. Default value is 15000 milliseconds i.e. 15 seconds. + * + * @param timeout + * Timeout value in milliseconds for Non subscribe operations + * like publish, history, hereNow + */ + public void setNonSubscribeTimeout(int timeout) { + super.setNonSubscribeTimeout(timeout); + } + + protected String getUserAgent() { + return "(Android " + android.os.Build.VERSION.RELEASE + + "; " + android.os.Build.MODEL + + " Build) PubNub-Java/Android/" + VERSION; + } +} diff --git a/android/srcLogging/com/pubnub/api/Logger.java b/android/srcLogging/com/pubnub/api/Logger.java new file mode 100644 index 000000000..983c3fdb0 --- /dev/null +++ b/android/srcLogging/com/pubnub/api/Logger.java @@ -0,0 +1,24 @@ +package com.pubnub.api; + +import android.util.Log; + +public class Logger extends AbstractLogger { + Class _class; + public Logger(Class _class) { + super(); + this._class = _class; + } + + protected void nativeDebug(String s) { + Log.d(_class.getName(), s); + } + protected void nativeVerbose(String s) { + Log.v(_class.getName(), s); + } + protected void nativeError(String s) { + Log.e(_class.getName(), s); + } + protected void nativeInfo(String s) { + Log.i(_class.getName(), s ); + } +} diff --git a/blackberry/CHANGELOG b/blackberry/CHANGELOG new file mode 100644 index 000000000..1d3845441 --- /dev/null +++ b/blackberry/CHANGELOG @@ -0,0 +1,8 @@ +CHANGELOG + +02-12-2013 - 89e2be5e5f0fa872fcdf617a6c9af9ce30ae7807 +. client is now fully asyncronous +. added enhanced multiplexed subscribe support +. better error handling added to example app +. improved keep-alive handling +. support for chunked responses diff --git a/blackberry/LICENSE b/blackberry/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/blackberry/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/blackberry/Pubnub-BlackBerry-3.5.6.jar b/blackberry/Pubnub-BlackBerry-3.5.6.jar new file mode 100644 index 000000000..b61a12525 Binary files /dev/null and b/blackberry/Pubnub-BlackBerry-3.5.6.jar differ diff --git a/blackberry/Pubnub-BlackBerry-Debug-3.5.6.jar b/blackberry/Pubnub-BlackBerry-Debug-3.5.6.jar new file mode 100644 index 000000000..26d95a7af Binary files /dev/null and b/blackberry/Pubnub-BlackBerry-Debug-3.5.6.jar differ diff --git a/blackberry/README.md b/blackberry/README.md new file mode 100644 index 000000000..52be85788 --- /dev/null +++ b/blackberry/README.md @@ -0,0 +1,107 @@ +##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. +##### http://www.pubnub.com/account + +## PubNub 3.5 Real-time Cloud Push API - BlackBerry + +www.pubnub.com - PubNub Real-time Push Service in the Cloud. + +Please reference the demo app source code for examples of supercharging your Blackberry app with PubNub! + +## Video Walkthrough +Checkout the [video walkthrough](https://vimeo.com/70973189) before proceeding to get an idea of how it works. + +## Hello PubNub Demo App HOWTO + +Follow this HOWTO step-by-step to setup the demo PubNub app for Blackberry from within Eclipse. + +a. Open the Eclipse (Blackberry Java Plugin) + +b. Goto File -> New -> Blackberry Project + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/1.png) + +c. Enter a project name ( for this example, we'll use PubnubExample ) and click Next + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/2.png) + +Your screen should look similar to: + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/3.png) + +d. Click "Link additional Source" + +e. Browse to and select ```java/blackberry/3.4/examples/PubnubExample/src``` and enter Folder name as src1 + +Your screen should look similar to: + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/4.png) + +f. Click "Finish" + +g. Select the Libraries tab + +h. Click "Add External JARs" + +i. Select ```bouncycastle.jar``` and ```Pubnub-Microedition-3.4.jar``` from ```pubnub-api/blackberry/3.4/libs``` + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/5.png) + +Your screen should look similar to: + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/6.png) + +j. Go to the "Order and Export" tab and check the boxes against **bouncycastle.jar** and **Pubnub-Microedition-3.4.jar**. + +k. Click "Finish" + +Your screen should look similar to: + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/7.png) + +and the "Project View" should look like this when "src1" and "Referenced Libraries" are expanded: + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/8.png) + +l. Create a Run Configuration by clicking Run -> Run Configurations from the menu + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/9.png) + +m. Select **Blackberry Simulator**, right-click, and select **New** + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/10.png) + +You will now have access to some new tabs. + +n. Click the "Projects" tab + +o. Check the box against PubnubExample + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/11.png) + +p. Click the "Simulator" tab, and confirm the **Launch Mobile Data System Connection Service (MDS-CS) with simulator** checkbox is selected + +q. Change the configuration name to PubnubExample + +r. Click "Apply" + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/12.png) + +s. Right click PubnubExample in package explorer. + +t. Select **Run As** -> **Blackberry Simulator** + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/14.png) + +This will start MDS on command prompt and Blackberry Simulator + +**NOTE**: MDS may need to be manually started by running run.bat located at ```Eclipse\plugins\net.rim.ejde.componentpack7.1.0_7.1.0.10\components\MDS``` + +u. The MDS console will display debug information as the simulator phone boots. + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/15.png) + +v. Once the simulator has booted, scroll to and select **PubnubExample** (it will have the default “App Window” icon) + +w. Run it, and select the menu button to see it run various PubNub for Blackberry API methods. + +![File New](https://s3.amazonaws.com/pubnub-readme/blackberry/17.png) diff --git a/blackberry/build.xml b/blackberry/build.xml new file mode 100644 index 000000000..571cd4335 --- /dev/null +++ b/blackberry/build.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/blackberry/examples/PubnubExample/PubnubExample.cod b/blackberry/examples/PubnubExample/PubnubExample.cod new file mode 100644 index 000000000..e66be6916 Binary files /dev/null and b/blackberry/examples/PubnubExample/PubnubExample.cod differ diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/AuthKeyConfig.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/AuthKeyConfig.java new file mode 100644 index 000000000..ac35b9b26 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/AuthKeyConfig.java @@ -0,0 +1,40 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Pubnub; + +public class AuthKeyConfig extends PubnubCommand { + + public AuthKeyConfig(Pubnub pubnub) { + super(pubnub, "Auth Key Config"); + } + + protected void initScreen() { + final BasicEditField txtAuthKey = new BasicEditField("Auth Key : ", "", 256, BasicEditField.FILTER_DEFAULT); + screen = new MainScreen(); + screen.add(txtAuthKey); + + ButtonField btn = new ButtonField(); + btn.setLabel("Set Auth Key"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + + try { + _pubnub.setAuthKey(txtAuthKey.getText()); + close(); + } catch (Exception e) { + + } + }}); + } +} + + diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/DetailedHistory.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/DetailedHistory.java new file mode 100644 index 000000000..b4fb7bd57 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/DetailedHistory.java @@ -0,0 +1,47 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class DetailedHistory extends PubnubCommand { + + public DetailedHistory(Pubnub pubnub) { + super(pubnub, "Detailed History"); + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + final BasicEditField txtCount = new BasicEditField("Count : ", "",20, BasicEditField.FILTER_INTEGER); + screen = new MainScreen(); + screen.add(txtChannel); + screen.add(txtCount); + + ButtonField btn = new ButtonField(); + btn.setLabel("Get Detailed History"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + _pubnub.detailedHistory(txtChannel.toString(), Integer.parseInt(txtCount.toString()), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + close(); + } + }); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/DisconnectAndResubscribe.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/DisconnectAndResubscribe.java new file mode 100644 index 000000000..1d057b755 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/DisconnectAndResubscribe.java @@ -0,0 +1,18 @@ +package com.pubnub.examples.blackberry; + +import com.pubnub.api.Pubnub; + +public class DisconnectAndResubscribe extends PubnubCommand { + + public DisconnectAndResubscribe(Pubnub pubnub) { + super(pubnub, "Disconnect & Resubscribe"); + } + + protected void initScreen() { + + } + public void handler() { + _pubnub.disconnectAndResubscribe(); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/HereNow.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/HereNow.java new file mode 100644 index 000000000..204362a48 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/HereNow.java @@ -0,0 +1,45 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class HereNow extends PubnubCommand { + + public HereNow(Pubnub pubnub) { + super(pubnub, "Here Now"); + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + screen = new MainScreen(); + screen.add(txtChannel); + + ButtonField btn = new ButtonField(); + btn.setLabel("Get Here Now Data"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + _pubnub.hereNow(txtChannel.toString(), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + close(); + } + }); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/History.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/History.java new file mode 100644 index 000000000..58edb913a --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/History.java @@ -0,0 +1,46 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class History extends PubnubCommand { + + public History(Pubnub pubnub) { + super(pubnub, "History"); + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + final BasicEditField txtCount = new BasicEditField("Count : ", "",20, BasicEditField.FILTER_INTEGER); + screen = new MainScreen(); + screen.add(txtChannel); + screen.add(txtCount); + + ButtonField btn = new ButtonField(); + btn.setLabel("Get History"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + _pubnub.history(txtChannel.toString(), Integer.parseInt(txtCount.toString()), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + close(); + } + }); + } +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Presence.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Presence.java new file mode 100644 index 000000000..eadc6f740 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Presence.java @@ -0,0 +1,52 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Presence extends PubnubCommand { + + public Presence(Pubnub pubnub) { + super(pubnub, "Presence"); + // TODO Auto-generated constructor stub + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + screen = new MainScreen(); + screen.add(txtChannel); + + ButtonField btn = new ButtonField(); + btn.setLabel("Subscribe"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + + try { + _pubnub.presence(txtChannel.toString(), new Callback() { + + public void successCallback(String channel, Object message) { + notifyUser("Channel " + channel + " : " + message.toString()); + } + public void errorCallback(String channel, PubnubError error) { + notifyUser("Channel " + channel + " : " + error.toString()); + } + }); + close(); + + } catch (Exception e) { + + } + }}); + } + + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Publish.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Publish.java new file mode 100644 index 000000000..b0781b662 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Publish.java @@ -0,0 +1,48 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Publish extends PubnubCommand { + + public Publish(Pubnub pubnub) { + super(pubnub, "Publish"); + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + final BasicEditField txtMessage = new BasicEditField("Message : ", "",256, BasicEditField.FILTER_DEFAULT); + screen = new MainScreen(); + screen.add(txtChannel); + screen.add(txtMessage); + + ButtonField btn = new ButtonField(); + btn.setLabel("Publish"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + + _pubnub.publish(txtChannel.toString(), txtMessage.toString(), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + close(); + } + }); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubCommand.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubCommand.java new file mode 100644 index 000000000..007208e88 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubCommand.java @@ -0,0 +1,89 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.command.Command; +import net.rim.device.api.command.CommandHandler; +import net.rim.device.api.command.ReadOnlyCommandMetadata; +import net.rim.device.api.ui.MenuItem; +import net.rim.device.api.ui.UiApplication; +import net.rim.device.api.ui.component.Dialog; +import net.rim.device.api.ui.container.MainScreen; +import net.rim.device.api.util.StringProvider; + +import org.json.me.JSONArray; +import org.json.me.JSONObject; + +import com.pubnub.api.Pubnub; + +public abstract class PubnubCommand { + + protected Pubnub _pubnub; + + protected MainScreen screen; + + private UiApplication uiapp; + + private MenuItem menuItem; + + + + /** + * Presents a dialog to the user with a given message + * + * @param message + * The text to display + */ + private void alertDialog(final String message) { + uiapp.invokeLater(new Runnable() { + public void run() { + Dialog.alert(message); + } + }); + } + + public PubnubCommand(Pubnub pubnub, String command) { + this._pubnub = pubnub; + this.uiapp = UiApplication.getUiApplication(); + this.menuItem = new MenuItem(new StringProvider(command), 0x230010, 0); + this.menuItem.setCommand(new Command(new CommandHandler() { + public void execute(ReadOnlyCommandMetadata metadata, Object context) { + handler(); + } + })); + } + + protected void notifyUser(Object message) { + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + alertDialog(obj.toString()); + } else if (message instanceof String) { + String obj = (String) message; + alertDialog(obj.toString()); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + alertDialog(obj.toString()); + } + } catch (Exception e) { + + } + + } + + protected abstract void initScreen(); + + public void handler() { + + if (screen == null) + initScreen(); + uiapp.pushScreen(screen); + + } + + public MenuItem getMenuItem() { + return menuItem; + } + + protected void close() { + this.uiapp.popScreen(screen); + } +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubDemoConsole.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubDemoConsole.java new file mode 100644 index 000000000..df810637b --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubDemoConsole.java @@ -0,0 +1,33 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Screen; +import net.rim.device.api.ui.UiApplication; + +/** + * This class extends the UiApplication class, providing a + * graphical user interface. + */ +public class PubnubDemoConsole extends UiApplication { + /** + * Entry point for application + * @param args Command line arguments (not used) + */ + public static void main(String[] args) { + + // Create a new instance of the application and make the currently + // running thread the application's event dispatch thread. + PubnubDemoConsole theApp = new PubnubDemoConsole(); + theApp.enterEventDispatcher(); + } + + + /** + * Creates a new PubnubExample object + */ + public PubnubDemoConsole() { + Screen sc = new PubnubDemoConsoleScreen(); + // Push a screen onto the UI stack for rendering. + pushScreen(sc); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubDemoConsoleScreen.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubDemoConsoleScreen.java new file mode 100644 index 000000000..e26b92e39 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/PubnubDemoConsoleScreen.java @@ -0,0 +1,37 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Pubnub; + +/** + * A class extending the MainScreen class, which provides default standard + * behavior for BlackBerry GUI applications. + */ +public final class PubnubDemoConsoleScreen extends MainScreen { + String channel = "hello_world"; + String[] channels = { "hello_world1", "hello_world2", "hello_world3", + "hello_world4" + }; + Pubnub _pubnub = new Pubnub("demo","demo","demo", false); + /** + * Creates a new PubnubExampleScreen object + */ + public PubnubDemoConsoleScreen() { + // Set the displayed title of the screen + setTitle("Pubnub Demo Console"); + addMenuItem(new Publish(_pubnub).getMenuItem()); + addMenuItem(new Subscribe(_pubnub).getMenuItem()); + addMenuItem(new Presence(_pubnub).getMenuItem()); + addMenuItem(new Unsubscribe(_pubnub).getMenuItem()); + addMenuItem(new History(_pubnub).getMenuItem()); + addMenuItem(new DetailedHistory(_pubnub).getMenuItem()); + addMenuItem(new HereNow(_pubnub).getMenuItem()); + addMenuItem(new AuthKeyConfig(_pubnub).getMenuItem()); + addMenuItem(new DisconnectAndResubscribe(_pubnub).getMenuItem()); + addMenuItem(new ToggleResumeOnReconnect(_pubnub).getMenuItem()); + addMenuItem(new Time(_pubnub).getMenuItem()); + } + + +} \ No newline at end of file diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Subscribe.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Subscribe.java new file mode 100644 index 000000000..51dd48b8c --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Subscribe.java @@ -0,0 +1,65 @@ +package com.pubnub.examples.blackberry; + +import java.util.Hashtable; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Subscribe extends PubnubCommand { + + public Subscribe(Pubnub pubnub) { + super(pubnub, "Subscribe"); + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + screen = new MainScreen(); + screen.add(txtChannel); + + ButtonField btn = new ButtonField(); + btn.setLabel("Subscribe"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + Hashtable args = new Hashtable(); + args.put("channel", txtChannel.toString()); + + try { + _pubnub.subscribe(args, new Callback() { + public void connectCallback(String channel) { + notifyUser("CONNECT on channel:" + channel); + } + + public void disconnectCallback(String channel) { + notifyUser("DISCONNECT on channel:" + channel); + } + + public void reconnectCallback(String channel) { + notifyUser("RECONNECT on channel:" + channel); + } + + public void successCallback(String channel, Object message) { + notifyUser("Channel " + channel + " : " + message.toString()); + } + public void errorCallback(String channel, PubnubError error) { + notifyUser("Channel " + channel + " : " + error.toString()); + } + }); + close(); + + } catch (Exception e) { + + } + }}); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Time.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Time.java new file mode 100644 index 000000000..bbeaaf6f0 --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Time.java @@ -0,0 +1,26 @@ +package com.pubnub.examples.blackberry; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Time extends PubnubCommand { + + public Time(Pubnub pubnub) { + super(pubnub, "Time"); + } + + protected void initScreen() { + } + public void handler() { + _pubnub.time( new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(error.toString()); + } + }); + } +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/ToggleResumeOnReconnect.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/ToggleResumeOnReconnect.java new file mode 100644 index 000000000..3eda0b4dc --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/ToggleResumeOnReconnect.java @@ -0,0 +1,18 @@ +package com.pubnub.examples.blackberry; + +import com.pubnub.api.Pubnub; + +public class ToggleResumeOnReconnect extends PubnubCommand { + + public ToggleResumeOnReconnect(Pubnub pubnub) { + super(pubnub, "Toggle Resume on Reconnect"); + } + + protected void initScreen() { + + } + public void handler() { + _pubnub.setResumeOnReconnect((_pubnub.isResumeOnReconnect())?false:true); + } + +} diff --git a/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Unsubscribe.java b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Unsubscribe.java new file mode 100644 index 000000000..bb0b5706f --- /dev/null +++ b/blackberry/examples/PubnubExample/src/com/pubnub/examples/blackberry/Unsubscribe.java @@ -0,0 +1,35 @@ +package com.pubnub.examples.blackberry; + +import net.rim.device.api.ui.Field; +import net.rim.device.api.ui.FieldChangeListener; +import net.rim.device.api.ui.component.BasicEditField; +import net.rim.device.api.ui.component.ButtonField; +import net.rim.device.api.ui.container.MainScreen; + +import com.pubnub.api.Pubnub; + +public class Unsubscribe extends PubnubCommand { + + public Unsubscribe(Pubnub pubnub) { + super(pubnub, "Unsubscribe"); + } + + protected void initScreen() { + final BasicEditField txtChannel = new BasicEditField("Channel : ", "", 256, BasicEditField.FILTER_DEFAULT); + screen = new MainScreen(); + screen.add(txtChannel); + + ButtonField btn = new ButtonField(); + btn.setLabel("Unsubscribe"); + screen.add(btn); + + btn.setChangeListener(new FieldChangeListener() { + + public void fieldChanged(Field field, int context) { + _pubnub.unsubscribe(txtChannel.toString()); + close(); + } + }); + } + +} diff --git a/blackberry/libs/Pubnub-Microedition-3.4.jar b/blackberry/libs/Pubnub-Microedition-3.4.jar new file mode 100644 index 000000000..0b99b5f6c Binary files /dev/null and b/blackberry/libs/Pubnub-Microedition-3.4.jar differ diff --git a/blackberry/libs/bouncycastle.jar b/blackberry/libs/bouncycastle.jar new file mode 100644 index 000000000..516587c2d Binary files /dev/null and b/blackberry/libs/bouncycastle.jar differ diff --git a/blackberry/libs/net_rim_api.jar b/blackberry/libs/net_rim_api.jar new file mode 100644 index 000000000..0303009db Binary files /dev/null and b/blackberry/libs/net_rim_api.jar differ diff --git a/blackberry/src/com/pubnub/api/Pubnub.java b/blackberry/src/com/pubnub/api/Pubnub.java new file mode 100644 index 000000000..d274bf3bb --- /dev/null +++ b/blackberry/src/com/pubnub/api/Pubnub.java @@ -0,0 +1,91 @@ +package com.pubnub.api; + +import org.bouncycastle.util.SecureRandom; + + +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); + } + + public Pubnub(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on, String initialization_vector) { + super(publish_key, subscribe_key, secret_key, cipher_key, ssl_on, initialization_vector); + } + + /** + * UUID + * + * 32 digit UUID generation at client side. + * + * @return String uuid. + */ + public String uuid() { + + String valueBeforeMD5; + String valueAfterMD5; + SecureRandom mySecureRand = new SecureRandom(); + String s_id = String.valueOf(PubnubCore.class.hashCode()); + StringBuffer sbValueBeforeMD5 = new StringBuffer(); + try { + long time = System.currentTimeMillis(); + long rand = 0; + rand = mySecureRand.nextLong(); + sbValueBeforeMD5.append(s_id); + sbValueBeforeMD5.append(":"); + sbValueBeforeMD5.append(Long.toString(time)); + sbValueBeforeMD5.append(":"); + sbValueBeforeMD5.append(Long.toString(rand)); + valueBeforeMD5 = sbValueBeforeMD5.toString(); + byte[] array = PubnubCrypto.md5(valueBeforeMD5); + StringBuffer sb = new StringBuffer(); + for (int j = 0; j < array.length; ++j) { + int b = array[j] & 0xFF; + if (b < 0x10) { + sb.append('0'); + } + sb.append(Integer.toHexString(b)); + } + valueAfterMD5 = sb.toString(); + String raw = valueAfterMD5.toUpperCase(); + sb = new StringBuffer(); + sb.append(raw.substring(0, 8)); + sb.append("-"); + sb.append(raw.substring(8, 12)); + sb.append("-"); + sb.append(raw.substring(12, 16)); + sb.append("-"); + sb.append(raw.substring(16, 20)); + sb.append("-"); + sb.append(raw.substring(20)); + return sb.toString(); + } catch (Exception e) { + return null; + } + } + + protected String getUserAgent() { + return "Blackberry/" + VERSION; + } + +} diff --git a/blackberry/tools/preverify b/blackberry/tools/preverify new file mode 100755 index 000000000..6e4b51250 Binary files /dev/null and b/blackberry/tools/preverify differ diff --git a/blackberry/tools/preverify.exe b/blackberry/tools/preverify.exe new file mode 100644 index 000000000..8cdea8902 Binary files /dev/null and b/blackberry/tools/preverify.exe differ diff --git a/blackberry/tools/preverify1.0 b/blackberry/tools/preverify1.0 new file mode 100755 index 000000000..fa9116e9c Binary files /dev/null and b/blackberry/tools/preverify1.0 differ diff --git a/blackberry/tools/preverify1.1 b/blackberry/tools/preverify1.1 new file mode 100755 index 000000000..3cc34a45e Binary files /dev/null and b/blackberry/tools/preverify1.1 differ diff --git a/build.xml b/build.xml new file mode 100644 index 000000000..2f435e105 --- /dev/null +++ b/build.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codenameone/LICENSE b/codenameone/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/codenameone/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/codenameone/Pubnub-CodeNameOne-3.5.6.cn1lib b/codenameone/Pubnub-CodeNameOne-3.5.6.cn1lib new file mode 100644 index 000000000..c43587b4f Binary files /dev/null and b/codenameone/Pubnub-CodeNameOne-3.5.6.cn1lib differ diff --git a/codenameone/Pubnub-CodeNameOne-Debug-3.5.6.cn1lib b/codenameone/Pubnub-CodeNameOne-Debug-3.5.6.cn1lib new file mode 100644 index 000000000..88a5efa2d Binary files /dev/null and b/codenameone/Pubnub-CodeNameOne-Debug-3.5.6.cn1lib differ diff --git a/codenameone/PubnubClientSDK/Stubber.jar b/codenameone/PubnubClientSDK/Stubber.jar new file mode 100644 index 000000000..0e082799a Binary files /dev/null and b/codenameone/PubnubClientSDK/Stubber.jar differ diff --git a/codenameone/PubnubClientSDK/build.xml b/codenameone/PubnubClientSDK/build.xml new file mode 100644 index 000000000..ea58875a3 --- /dev/null +++ b/codenameone/PubnubClientSDK/build.xml @@ -0,0 +1,121 @@ + + + + + + Builds, tests, and runs the project PubnubClientSDK. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Currently testing a library project isn't supported + + + + Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller + code size and wider device support + + + + + + + + + + + + + + You can't run a library project + + + + You can't run a library project + + + + + + + + + + + + + + + + + + + + + + diff --git a/codenameone/PubnubClientSDK/codenameone_library.properties b/codenameone/PubnubClientSDK/codenameone_library.properties new file mode 100644 index 000000000..a80328da9 --- /dev/null +++ b/codenameone/PubnubClientSDK/codenameone_library.properties @@ -0,0 +1,4 @@ +# +#Wed Jan 09 17:59:31 IST 2013 +codename1.languageLevel=5 +codename1.version=1.0 diff --git a/codenameone/PubnubClientSDK/lib/BouncyCastleCN1Lib.cn1lib b/codenameone/PubnubClientSDK/lib/BouncyCastleCN1Lib.cn1lib new file mode 100644 index 000000000..9bcfd0ade Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/BouncyCastleCN1Lib.cn1lib differ diff --git a/codenameone/PubnubClientSDK/lib/CLDC11.jar b/codenameone/PubnubClientSDK/lib/CLDC11.jar new file mode 100644 index 000000000..93829d104 Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/CLDC11.jar differ diff --git a/codenameone/PubnubClientSDK/lib/CodenameOne.jar b/codenameone/PubnubClientSDK/lib/CodenameOne.jar new file mode 100644 index 000000000..6721f10b4 Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/CodenameOne.jar differ diff --git a/codenameone/PubnubClientSDK/lib/CodenameOne_SRC.zip b/codenameone/PubnubClientSDK/lib/CodenameOne_SRC.zip new file mode 100644 index 000000000..ac6d126f6 Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/CodenameOne_SRC.zip differ diff --git a/codenameone/PubnubClientSDK/lib/bccn1/bouncycastle.zip b/codenameone/PubnubClientSDK/lib/bccn1/bouncycastle.zip new file mode 100644 index 000000000..be57701fd Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/bccn1/bouncycastle.zip differ diff --git a/codenameone/PubnubClientSDK/lib/bccn1/manifest.properties b/codenameone/PubnubClientSDK/lib/bccn1/manifest.properties new file mode 100644 index 000000000..4da354bc8 --- /dev/null +++ b/codenameone/PubnubClientSDK/lib/bccn1/manifest.properties @@ -0,0 +1,2 @@ +# Codename One libray manifest + diff --git a/codenameone/PubnubClientSDK/lib/bccn1/stubs.zip b/codenameone/PubnubClientSDK/lib/bccn1/stubs.zip new file mode 100644 index 000000000..cabe7df44 Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/bccn1/stubs.zip differ diff --git a/codenameone/PubnubClientSDK/lib/json/json.zip b/codenameone/PubnubClientSDK/lib/json/json.zip new file mode 100644 index 000000000..9293a9ea9 Binary files /dev/null and b/codenameone/PubnubClientSDK/lib/json/json.zip differ diff --git a/codenameone/PubnubClientSDK/manifest.mf b/codenameone/PubnubClientSDK/manifest.mf new file mode 100644 index 000000000..1574df4a2 --- /dev/null +++ b/codenameone/PubnubClientSDK/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/codenameone/PubnubClientSDK/manifest.properties b/codenameone/PubnubClientSDK/manifest.properties new file mode 100644 index 000000000..4da354bc8 --- /dev/null +++ b/codenameone/PubnubClientSDK/manifest.properties @@ -0,0 +1,2 @@ +# Codename One libray manifest + diff --git a/codenameone/PubnubClientSDK/native/.gitignore b/codenameone/PubnubClientSDK/native/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/native/android/.gitignore b/codenameone/PubnubClientSDK/native/android/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/native/ios/.gitignore b/codenameone/PubnubClientSDK/native/ios/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/native/j2me/.gitignore b/codenameone/PubnubClientSDK/native/j2me/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/native/rim/.gitignore b/codenameone/PubnubClientSDK/native/rim/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/native/win/.gitignore b/codenameone/PubnubClientSDK/native/win/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/nbproject/build-impl.xml b/codenameone/PubnubClientSDK/nbproject/build-impl.xml new file mode 100644 index 000000000..ae935503a --- /dev/null +++ b/codenameone/PubnubClientSDK/nbproject/build-impl.xml @@ -0,0 +1,1400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codenameone/PubnubClientSDK/nbproject/genfiles.properties b/codenameone/PubnubClientSDK/nbproject/genfiles.properties new file mode 100644 index 000000000..798d1238b --- /dev/null +++ b/codenameone/PubnubClientSDK/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=65812561 +build.xml.script.CRC32=c17a4175 +build.xml.stylesheet.CRC32=28e38971@1.44.1.45 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=65812561 +nbproject/build-impl.xml.script.CRC32=d56d33ea +nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 diff --git a/codenameone/PubnubClientSDK/nbproject/nativej2me.res b/codenameone/PubnubClientSDK/nbproject/nativej2me.res new file mode 100644 index 000000000..6b33caf2c Binary files /dev/null and b/codenameone/PubnubClientSDK/nbproject/nativej2me.res differ diff --git a/codenameone/PubnubClientSDK/nbproject/private/config.properties b/codenameone/PubnubClientSDK/nbproject/private/config.properties new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/PubnubClientSDK/nbproject/private/private.properties b/codenameone/PubnubClientSDK/nbproject/private/private.properties new file mode 100644 index 000000000..7ed94b3ed --- /dev/null +++ b/codenameone/PubnubClientSDK/nbproject/private/private.properties @@ -0,0 +1,7 @@ +application.args=com.mycompany.myapp.MyApplication +compile.on.save=false +do.depend=false +do.jar=true +javac.debug=true +javadoc.preview=true +user.properties.file=/home/workpn/.netbeans/7.3.1/build.properties diff --git a/codenameone/PubnubClientSDK/nbproject/private/private.xml b/codenameone/PubnubClientSDK/nbproject/private/private.xml new file mode 100644 index 000000000..8505fc191 --- /dev/null +++ b/codenameone/PubnubClientSDK/nbproject/private/private.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/codenameone/PubnubClientSDK/nbproject/project.properties b/codenameone/PubnubClientSDK/nbproject/project.properties new file mode 100644 index 000000000..1eb0d2cf9 --- /dev/null +++ b/codenameone/PubnubClientSDK/nbproject/project.properties @@ -0,0 +1,84 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=PubnubClientSDK +application.vendor=Codename One +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/PubnubClientSDK.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.CLDC11.jar=lib/CLDC11.jar +file.reference.CodenameOne.jar=lib/CodenameOne.jar +file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip +file.reference.bouncycastle.zip=lib/bccn1/bouncycastle.zip +file.reference.json.zip=lib/json/json.zip +file.reference.PubnubClientSDK-override=override +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.CLDC11.jar}:\ + ${file.reference.CodenameOne.jar}:\ + ${file.reference.CodenameOne_SRC.zip}:\ + ${file.reference.PubnubClientSDK-override}:\ + ${file.reference.json.zip}:\ + ${file.reference.bouncycastle.zip} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=windows-1252 +src.dir=src +test.src.dir=test diff --git a/codenameone/PubnubClientSDK/nbproject/project.xml b/codenameone/PubnubClientSDK/nbproject/project.xml new file mode 100644 index 000000000..f9948715c --- /dev/null +++ b/codenameone/PubnubClientSDK/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + PubnubClientSDK + + + + + + + + + diff --git a/codenameone/PubnubClientSDK/override/.gitignore b/codenameone/PubnubClientSDK/override/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/build.xml b/codenameone/build.xml new file mode 100644 index 000000000..f92a0c234 --- /dev/null +++ b/codenameone/build.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codenameone/examples/PubnubDevConsole/CodeNameOneBuildClient.jar b/codenameone/examples/PubnubDevConsole/CodeNameOneBuildClient.jar new file mode 100644 index 000000000..7bb7c3bac Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/CodeNameOneBuildClient.jar differ diff --git a/codenameone/examples/PubnubDevConsole/JavaSE.jar b/codenameone/examples/PubnubDevConsole/JavaSE.jar new file mode 100644 index 000000000..0305fc261 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/JavaSE.jar differ diff --git a/codenameone/examples/PubnubDevConsole/build.xml b/codenameone/examples/PubnubDevConsole/build.xml new file mode 100644 index 000000000..bd64e5dac --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/build.xml @@ -0,0 +1,425 @@ + + + + + + + Builds, tests, and runs the project PubnubDevConsoleWithCn1lib. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller + code size and wider device support + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codenameone/examples/PubnubDevConsole/codenameone_settings.properties b/codenameone/examples/PubnubDevConsole/codenameone_settings.properties new file mode 100644 index 000000000..d1eee9d89 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/codenameone_settings.properties @@ -0,0 +1,33 @@ +# +#Wed Jul 18 15:45:51 IDT 2012 +codename1.vendor=CodenameOne +codename1.displayName=PubnubDevConsoleWithCn1lib +codename1.icon=icon.png +codename1.ios.debug.certificatePassword= +codename1.secondaryTitle=PubnubDevConsoleWithCn1lib +codename1.version=1.0 +package=generated +codename1.mainName=PubnubDevConsole +codename1.ios.certificatePassword= +codename1.ios.release.provision= +codename1.rim.signtoolDb= +codename1.ios.release.certificatePassword= +codename1.ios.certificate= +userClass=src/userclasses/StateMachine.java +codename1.android.keystorePassword= +codename1.ios.appid=Q5GHSKAL2F.com.pubnub.examples +codename1.ios.release.certificate= +codename1.j2me.nativeTheme=nbproject/nativej2me.res +codename1.rim.signtoolCsk= +codename1.ios.debug.certificate= +mainForm=Main +codename1.android.keystore= +baseClass=src/generated/StateMachineBase.java +guiResource=theme.res +codename1.android.keystoreAlias= +codename1.rim.certificatePassword= +codename1.ios.provision= +codename1.ios.debug.provision= +codename1.packageName=com.pubnub.examples +codename1.languageLevel=5 +codename1.arg.vserv.transition=3000 diff --git a/codenameone/examples/PubnubDevConsole/icon.png b/codenameone/examples/PubnubDevConsole/icon.png new file mode 100644 index 000000000..381ad0425 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/icon.png differ diff --git a/codenameone/examples/PubnubDevConsole/lib/BouncyCastleCN1Lib.cn1lib b/codenameone/examples/PubnubDevConsole/lib/BouncyCastleCN1Lib.cn1lib new file mode 100644 index 000000000..9bcfd0ade Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/lib/BouncyCastleCN1Lib.cn1lib differ diff --git a/codenameone/examples/PubnubDevConsole/lib/CLDC11.jar b/codenameone/examples/PubnubDevConsole/lib/CLDC11.jar new file mode 100644 index 000000000..93829d104 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/lib/CLDC11.jar differ diff --git a/codenameone/examples/PubnubDevConsole/lib/CodenameOne.jar b/codenameone/examples/PubnubDevConsole/lib/CodenameOne.jar new file mode 100644 index 000000000..6721f10b4 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/lib/CodenameOne.jar differ diff --git a/codenameone/examples/PubnubDevConsole/lib/CodenameOne_SRC.zip b/codenameone/examples/PubnubDevConsole/lib/CodenameOne_SRC.zip new file mode 100644 index 000000000..ac6d126f6 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/lib/CodenameOne_SRC.zip differ diff --git a/codenameone/examples/PubnubDevConsole/lib/json.cn1lib b/codenameone/examples/PubnubDevConsole/lib/json.cn1lib new file mode 100644 index 000000000..58636ebd5 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/lib/json.cn1lib differ diff --git a/codenameone/examples/PubnubDevConsole/manifest.mf b/codenameone/examples/PubnubDevConsole/manifest.mf new file mode 100644 index 000000000..1574df4a2 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/codenameone/examples/PubnubDevConsole/nbproject/build-impl.xml b/codenameone/examples/PubnubDevConsole/nbproject/build-impl.xml new file mode 100644 index 000000000..e84f1fa91 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/nbproject/build-impl.xml @@ -0,0 +1,1400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codenameone/examples/PubnubDevConsole/nbproject/genfiles.properties b/codenameone/examples/PubnubDevConsole/nbproject/genfiles.properties new file mode 100644 index 000000000..798d1238b --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=65812561 +build.xml.script.CRC32=c17a4175 +build.xml.stylesheet.CRC32=28e38971@1.44.1.45 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=65812561 +nbproject/build-impl.xml.script.CRC32=d56d33ea +nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 diff --git a/codenameone/examples/PubnubDevConsole/nbproject/nativej2me.res b/codenameone/examples/PubnubDevConsole/nbproject/nativej2me.res new file mode 100644 index 000000000..6b33caf2c Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/nbproject/nativej2me.res differ diff --git a/codenameone/examples/PubnubDevConsole/nbproject/private/config.properties b/codenameone/examples/PubnubDevConsole/nbproject/private/config.properties new file mode 100644 index 000000000..e69de29bb diff --git a/codenameone/examples/PubnubDevConsole/nbproject/private/private.properties b/codenameone/examples/PubnubDevConsole/nbproject/private/private.properties new file mode 100644 index 000000000..f51a09537 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/nbproject/private/private.properties @@ -0,0 +1,14 @@ +application.args=com.pubnub.examples.PubnubDevConsole +compile.on.save=false +do.depend=false +do.jar=true +file.reference.CLDC11.jar=/home/workpn/NetBeansProjects/PubnubDevConsole/lib/CLDC11.jar +file.reference.CodenameOne.jar=/home/workpn/NetBeansProjects/PubnubDevConsole/lib/CodenameOne.jar +file.reference.CodenameOne_SRC.zip=/home/workpn/NetBeansProjects/PubnubDevConsole/lib/CodenameOne_SRC.zip +file.reference.impl-cls=/home/workpn/NetBeansProjects/PubnubDevConsole/lib/impl/cls +file.reference.impl-stubs=/home/workpn/NetBeansProjects/PubnubDevConsole/lib/impl/stubs +file.reference.JavaSE.jar=/home/workpn/NetBeansProjects/PubnubDevConsole/JavaSE.jar +file.reference.PubnubDevConsoleWithCn1lib-override=/home/workpn/NetBeansProjects/PubnubDevConsole/override +javac.debug=true +javadoc.preview=true +user.properties.file=/home/workpn/.netbeans/7.3.1/build.properties diff --git a/codenameone/examples/PubnubDevConsole/nbproject/private/private.xml b/codenameone/examples/PubnubDevConsole/nbproject/private/private.xml new file mode 100644 index 000000000..8505fc191 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/nbproject/private/private.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/codenameone/examples/PubnubDevConsole/nbproject/project.properties b/codenameone/examples/PubnubDevConsole/nbproject/project.properties new file mode 100644 index 000000000..0a94e1ef5 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/nbproject/project.properties @@ -0,0 +1,87 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=PubnubDevConsole +application.vendor=Codename One +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/PubnubDevConsole.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.CLDC11.jar=lib/CLDC11.jar +file.reference.CodenameOne.jar=lib/CodenameOne.jar +file.reference.CodenameOne_SRC.zip=lib/CodenameOne_SRC.zip +file.reference.PubnubDevConsoleWithCn1lib-override=override +file.reference.impl-cls=lib/impl/cls +file.reference.impl-stubs=lib/impl/stubs +file.reference.JavaSE.jar=JavaSE.jar +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.CLDC11.jar}:\ + ${file.reference.CodenameOne.jar}:\ + ${file.reference.CodenameOne_SRC.zip}:\ + ${file.reference.PubnubDevConsoleWithCn1lib-override}:\ + ${file.reference.impl-cls}:\ + ${file.reference.impl-stubs} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${file.reference.JavaSE.jar}:\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=com.codename1.impl.javase.Simulator +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${file.reference.JavaSE.jar}:\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=windows-1252 +src.dir=src +test.src.dir=test diff --git a/codenameone/examples/PubnubDevConsole/nbproject/project.xml b/codenameone/examples/PubnubDevConsole/nbproject/project.xml new file mode 100644 index 000000000..da24cf8f3 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + PubnubDevConsole + + + + + + + + + diff --git a/codenameone/examples/PubnubDevConsole/src/com/pubnub/examples/PubnubDevConsole.java b/codenameone/examples/PubnubDevConsole/src/com/pubnub/examples/PubnubDevConsole.java new file mode 100644 index 000000000..92c93efc4 --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/src/com/pubnub/examples/PubnubDevConsole.java @@ -0,0 +1,29 @@ +package com.pubnub.examples; + + +import com.codename1.ui.Display; +import com.codename1.ui.Form; +import userclasses.StateMachine; + +public class PubnubDevConsole { + + private Form current; + + public void init(Object context) { + } + + public void start() { + if (current != null) { + current.show(); + return; + } + new StateMachine("/theme"); + } + + public void stop() { + current = Display.getInstance().getCurrent(); + } + + public void destroy() { + } +} diff --git a/codenameone/examples/PubnubDevConsole/src/generated/StateMachineBase.java b/codenameone/examples/PubnubDevConsole/src/generated/StateMachineBase.java new file mode 100644 index 000000000..bd605592f --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/src/generated/StateMachineBase.java @@ -0,0 +1,1279 @@ +/** + * This class contains generated code from the Codename One Designer, DO NOT MODIFY! + * This class is designed for subclassing that way the code generator can overwrite it + * anytime without erasing your changes which should exist in a subclass! + * For details about this file and how it works please read this blog post: + * http://codenameone.blogspot.com/2010/10/ui-builder-class-how-to-actually-use.html +*/ +package generated; + +import com.codename1.ui.*; +import com.codename1.ui.util.*; +import com.codename1.ui.plaf.*; +import com.codename1.ui.events.*; + +public abstract class StateMachineBase extends UIBuilder { + private Container aboutToShowThisContainer; + /** + * this method should be used to initialize variables instead of + * the constructor/class scope to avoid race conditions + */ + /** + * @deprecated use the version that accepts a resource as an argument instead + + **/ + protected void initVars() {} + + protected void initVars(Resources res) {} + + public StateMachineBase(Resources res, String resPath, boolean loadTheme) { + startApp(res, resPath, loadTheme); + } + + public Container startApp(Resources res, String resPath, boolean loadTheme) { + initVars(); + UIBuilder.registerCustomComponent("Button", com.codename1.ui.Button.class); + UIBuilder.registerCustomComponent("Form", com.codename1.ui.Form.class); + UIBuilder.registerCustomComponent("Label", com.codename1.ui.Label.class); + UIBuilder.registerCustomComponent("TextArea", com.codename1.ui.TextArea.class); + UIBuilder.registerCustomComponent("TextField", com.codename1.ui.TextField.class); + if (loadTheme) { + if (res == null) { + try { + if (resPath.endsWith(".res")) { + res = Resources.open(resPath); + System.out.println("Warning: you should construct the state machine without the .res extension to allow theme overlays"); + } else { + res = Resources.openLayered(resPath); + } + } catch (java.io.IOException err) { + err.printStackTrace(); + } + } + initTheme(res); + } + if (res != null) { + setResourceFilePath(resPath); + setResourceFile(res); + initVars(res); + return showForm(getFirstFormName(), null); + } else { + Form f = (Form)createContainer(resPath, getFirstFormName()); + initVars(fetchResourceFile()); + beforeShow(f); + f.show(); + postShow(f); + return f; + } + } + + protected String getFirstFormName() { + return "GUI 1"; + } + + public Container createWidget(Resources res, String resPath, boolean loadTheme) { + initVars(); + UIBuilder.registerCustomComponent("Button", com.codename1.ui.Button.class); + UIBuilder.registerCustomComponent("Form", com.codename1.ui.Form.class); + UIBuilder.registerCustomComponent("Label", com.codename1.ui.Label.class); + UIBuilder.registerCustomComponent("TextArea", com.codename1.ui.TextArea.class); + UIBuilder.registerCustomComponent("TextField", com.codename1.ui.TextField.class); + if (loadTheme) { + if (res == null) { + try { + res = Resources.openLayered(resPath); + } catch (java.io.IOException err) { + err.printStackTrace(); + } + } + initTheme(res); + } + return createContainer(resPath, "GUI 1"); + } + + protected void initTheme(Resources res) { + String[] themes = res.getThemeResourceNames(); + if (themes != null && themes.length > 0) { + UIManager.getInstance().setThemeProps(res.getTheme(themes[0])); + } + } + + public StateMachineBase() { + } + + public StateMachineBase(String resPath) { + this(null, resPath, true); + } + + public StateMachineBase(Resources res) { + this(res, null, true); + } + + public StateMachineBase(String resPath, boolean loadTheme) { + this(null, resPath, loadTheme); + } + + public StateMachineBase(Resources res, boolean loadTheme) { + this(res, null, loadTheme); + } + + public com.codename1.ui.Button findBtnHereNowOk(Component root) { + return (com.codename1.ui.Button)findByName("btnHereNowOk", root); + } + + public com.codename1.ui.Button findBtnHereNowOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnHereNowOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnHereNowOk", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextArea findTxtPublishMessage(Component root) { + return (com.codename1.ui.TextArea)findByName("txtPublishMessage", root); + } + + public com.codename1.ui.TextArea findTxtPublishMessage() { + com.codename1.ui.TextArea cmp = (com.codename1.ui.TextArea)findByName("txtPublishMessage", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextArea)findByName("txtPublishMessage", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextArea findTxtPublishChannel(Component root) { + return (com.codename1.ui.TextArea)findByName("txtPublishChannel", root); + } + + public com.codename1.ui.TextArea findTxtPublishChannel() { + com.codename1.ui.TextArea cmp = (com.codename1.ui.TextArea)findByName("txtPublishChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextArea)findByName("txtPublishChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findButton6(Component root) { + return (com.codename1.ui.Button)findByName("Button6", root); + } + + public com.codename1.ui.Button findButton6() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("Button6", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("Button6", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Label findChannel(Component root) { + return (com.codename1.ui.Label)findByName("Channel", root); + } + + public com.codename1.ui.Label findChannel() { + com.codename1.ui.Label cmp = (com.codename1.ui.Label)findByName("Channel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Label)findByName("Channel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findButton5(Component root) { + return (com.codename1.ui.Button)findByName("Button5", root); + } + + public com.codename1.ui.Button findButton5() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("Button5", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("Button5", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findButton4(Component root) { + return (com.codename1.ui.Button)findByName("Button4", root); + } + + public com.codename1.ui.Button findButton4() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("Button4", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("Button4", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findButton3(Component root) { + return (com.codename1.ui.Button)findByName("Button3", root); + } + + public com.codename1.ui.Button findButton3() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("Button3", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("Button3", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findButton2(Component root) { + return (com.codename1.ui.Button)findByName("Button2", root); + } + + public com.codename1.ui.Button findButton2() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("Button2", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("Button2", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnUnsubscribeOk(Component root) { + return (com.codename1.ui.Button)findByName("btnUnsubscribeOk", root); + } + + public com.codename1.ui.Button findBtnUnsubscribeOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnUnsubscribeOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnUnsubscribeOk", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnPresenceOk(Component root) { + return (com.codename1.ui.Button)findByName("btnPresenceOk", root); + } + + public com.codename1.ui.Button findBtnPresenceOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnPresenceOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnPresenceOk", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnPublish(Component root) { + return (com.codename1.ui.Button)findByName("btnPublish", root); + } + + public com.codename1.ui.Button findBtnPublish() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnPublish", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnPublish", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findButton(Component root) { + return (com.codename1.ui.Button)findByName("Button", root); + } + + public com.codename1.ui.Button findButton() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("Button", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("Button", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextField findTxtUnsubscribePresenceChannel(Component root) { + return (com.codename1.ui.TextField)findByName("txtUnsubscribePresenceChannel", root); + } + + public com.codename1.ui.TextField findTxtUnsubscribePresenceChannel() { + com.codename1.ui.TextField cmp = (com.codename1.ui.TextField)findByName("txtUnsubscribePresenceChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextField)findByName("txtUnsubscribePresenceChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Label findLabel1(Component root) { + return (com.codename1.ui.Label)findByName("Label1", root); + } + + public com.codename1.ui.Label findLabel1() { + com.codename1.ui.Label cmp = (com.codename1.ui.Label)findByName("Label1", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Label)findByName("Label1", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextField findTxtHistoryChannel(Component root) { + return (com.codename1.ui.TextField)findByName("txtHistoryChannel", root); + } + + public com.codename1.ui.TextField findTxtHistoryChannel() { + com.codename1.ui.TextField cmp = (com.codename1.ui.TextField)findByName("txtHistoryChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextField)findByName("txtHistoryChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnDar(Component root) { + return (com.codename1.ui.Button)findByName("btnDar", root); + } + + public com.codename1.ui.Button findBtnDar() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnDar", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnDar", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextField findTxtPresenceChannel(Component root) { + return (com.codename1.ui.TextField)findByName("txtPresenceChannel", root); + } + + public com.codename1.ui.TextField findTxtPresenceChannel() { + com.codename1.ui.TextField cmp = (com.codename1.ui.TextField)findByName("txtPresenceChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextField)findByName("txtPresenceChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnUnsubscribePresenceOk(Component root) { + return (com.codename1.ui.Button)findByName("btnUnsubscribePresenceOk", root); + } + + public com.codename1.ui.Button findBtnUnsubscribePresenceOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnUnsubscribePresenceOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnUnsubscribePresenceOk", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnPublishOk(Component root) { + return (com.codename1.ui.Button)findByName("btnPublishOk", root); + } + + public com.codename1.ui.Button findBtnPublishOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnPublishOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnPublishOk", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnHistoryOk(Component root) { + return (com.codename1.ui.Button)findByName("btnHistoryOk", root); + } + + public com.codename1.ui.Button findBtnHistoryOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnHistoryOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnHistoryOk", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Label findLabel(Component root) { + return (com.codename1.ui.Label)findByName("label", root); + } + + public com.codename1.ui.Label findLabel() { + com.codename1.ui.Label cmp = (com.codename1.ui.Label)findByName("label", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Label)findByName("label", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextField findTxtUnsubscribeChannel(Component root) { + return (com.codename1.ui.TextField)findByName("txtUnsubscribeChannel", root); + } + + public com.codename1.ui.TextField findTxtUnsubscribeChannel() { + com.codename1.ui.TextField cmp = (com.codename1.ui.TextField)findByName("txtUnsubscribeChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextField)findByName("txtUnsubscribeChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextField findTxtSubscribeChannel(Component root) { + return (com.codename1.ui.TextField)findByName("txtSubscribeChannel", root); + } + + public com.codename1.ui.TextField findTxtSubscribeChannel() { + com.codename1.ui.TextField cmp = (com.codename1.ui.TextField)findByName("txtSubscribeChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextField)findByName("txtSubscribeChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.TextArea findTxtHereNowChannel(Component root) { + return (com.codename1.ui.TextArea)findByName("txtHereNowChannel", root); + } + + public com.codename1.ui.TextArea findTxtHereNowChannel() { + com.codename1.ui.TextArea cmp = (com.codename1.ui.TextArea)findByName("txtHereNowChannel", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.TextArea)findByName("txtHereNowChannel", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findBtnTime(Component root) { + return (com.codename1.ui.Button)findByName("btnTime", root); + } + + public com.codename1.ui.Button findBtnTime() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("btnTime", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("btnTime", aboutToShowThisContainer); + } + return cmp; + } + + public com.codename1.ui.Button findTxtSubscribeOk(Component root) { + return (com.codename1.ui.Button)findByName("txtSubscribeOk", root); + } + + public com.codename1.ui.Button findTxtSubscribeOk() { + com.codename1.ui.Button cmp = (com.codename1.ui.Button)findByName("txtSubscribeOk", Display.getInstance().getCurrent()); + if (cmp == null && aboutToShowThisContainer != null) { + cmp = (com.codename1.ui.Button)findByName("txtSubscribeOk", aboutToShowThisContainer); + } + return cmp; + } + + public static final int COMMAND_GUI1HereNow = 5; + public static final int COMMAND_SubscribeSubscribe = 9; + public static final int COMMAND_GUI1Unsubscribe = 6; + public static final int COMMAND_GUI1History = 4; + public static final int COMMAND_GUI1Subscribe = 2; + public static final int COMMAND_UnsubscribePresenceUnsubscribeFromPresenceEvents = 11; + public static final int COMMAND_GUI1UnsubscribePresence = 7; + public static final int COMMAND_GUI1Time = 8; + public static final int COMMAND_GUI1Presence = 3; + public static final int COMMAND_GUI1Publish = 1; + public static final int COMMAND_HereNowGetHereNowData = 10; + + protected boolean onGUI1HereNow() { + return false; + } + + protected boolean onSubscribeSubscribe() { + return false; + } + + protected boolean onGUI1Unsubscribe() { + return false; + } + + protected boolean onGUI1History() { + return false; + } + + protected boolean onGUI1Subscribe() { + return false; + } + + protected boolean onUnsubscribePresenceUnsubscribeFromPresenceEvents() { + return false; + } + + protected boolean onGUI1UnsubscribePresence() { + return false; + } + + protected boolean onGUI1Time() { + return false; + } + + protected boolean onGUI1Presence() { + return false; + } + + protected boolean onGUI1Publish() { + return false; + } + + protected boolean onHereNowGetHereNowData() { + return false; + } + + protected void processCommand(ActionEvent ev, Command cmd) { + switch (cmd.getId()) { + case COMMAND_GUI1HereNow: + if (onGUI1HereNow()) { + ev.consume(); + return; + } + break; + + case COMMAND_SubscribeSubscribe: + if (onSubscribeSubscribe()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1Unsubscribe: + if (onGUI1Unsubscribe()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1History: + if (onGUI1History()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1Subscribe: + if (onGUI1Subscribe()) { + ev.consume(); + return; + } + break; + + case COMMAND_UnsubscribePresenceUnsubscribeFromPresenceEvents: + if (onUnsubscribePresenceUnsubscribeFromPresenceEvents()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1UnsubscribePresence: + if (onGUI1UnsubscribePresence()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1Time: + if (onGUI1Time()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1Presence: + if (onGUI1Presence()) { + ev.consume(); + return; + } + break; + + case COMMAND_GUI1Publish: + if (onGUI1Publish()) { + ev.consume(); + return; + } + break; + + case COMMAND_HereNowGetHereNowData: + if (onHereNowGetHereNowData()) { + ev.consume(); + return; + } + break; + + } + if (ev.getComponent() != null) { + handleComponentAction(ev.getComponent(), ev); + } + } + + protected void exitForm(Form f) { + if ("Presence".equals(f.getName())) { + exitPresence(f); + aboutToShowThisContainer = null; + return; + } + + if ("GUI 1".equals(f.getName())) { + exitGUI1(f); + aboutToShowThisContainer = null; + return; + } + + if ("Unsubscribe".equals(f.getName())) { + exitUnsubscribe(f); + aboutToShowThisContainer = null; + return; + } + + if ("History".equals(f.getName())) { + exitHistory(f); + aboutToShowThisContainer = null; + return; + } + + if ("Subscribe".equals(f.getName())) { + exitSubscribe(f); + aboutToShowThisContainer = null; + return; + } + + if ("UnsubscribePresence".equals(f.getName())) { + exitUnsubscribePresence(f); + aboutToShowThisContainer = null; + return; + } + + if ("Here Now".equals(f.getName())) { + exitHereNow(f); + aboutToShowThisContainer = null; + return; + } + + if ("Publish".equals(f.getName())) { + exitPublish(f); + aboutToShowThisContainer = null; + return; + } + + } + + + protected void exitPresence(Form f) { + } + + + protected void exitGUI1(Form f) { + } + + + protected void exitUnsubscribe(Form f) { + } + + + protected void exitHistory(Form f) { + } + + + protected void exitSubscribe(Form f) { + } + + + protected void exitUnsubscribePresence(Form f) { + } + + + protected void exitHereNow(Form f) { + } + + + protected void exitPublish(Form f) { + } + + protected void beforeShow(Form f) { + aboutToShowThisContainer = f; + if ("Presence".equals(f.getName())) { + beforePresence(f); + aboutToShowThisContainer = null; + return; + } + + if ("GUI 1".equals(f.getName())) { + beforeGUI1(f); + aboutToShowThisContainer = null; + return; + } + + if ("Unsubscribe".equals(f.getName())) { + beforeUnsubscribe(f); + aboutToShowThisContainer = null; + return; + } + + if ("History".equals(f.getName())) { + beforeHistory(f); + aboutToShowThisContainer = null; + return; + } + + if ("Subscribe".equals(f.getName())) { + beforeSubscribe(f); + aboutToShowThisContainer = null; + return; + } + + if ("UnsubscribePresence".equals(f.getName())) { + beforeUnsubscribePresence(f); + aboutToShowThisContainer = null; + return; + } + + if ("Here Now".equals(f.getName())) { + beforeHereNow(f); + aboutToShowThisContainer = null; + return; + } + + if ("Publish".equals(f.getName())) { + beforePublish(f); + aboutToShowThisContainer = null; + return; + } + + } + + + protected void beforePresence(Form f) { + } + + + protected void beforeGUI1(Form f) { + } + + + protected void beforeUnsubscribe(Form f) { + } + + + protected void beforeHistory(Form f) { + } + + + protected void beforeSubscribe(Form f) { + } + + + protected void beforeUnsubscribePresence(Form f) { + } + + + protected void beforeHereNow(Form f) { + } + + + protected void beforePublish(Form f) { + } + + protected void beforeShowContainer(Container c) { + aboutToShowThisContainer = c; + if ("Presence".equals(c.getName())) { + beforeContainerPresence(c); + aboutToShowThisContainer = null; + return; + } + + if ("GUI 1".equals(c.getName())) { + beforeContainerGUI1(c); + aboutToShowThisContainer = null; + return; + } + + if ("Unsubscribe".equals(c.getName())) { + beforeContainerUnsubscribe(c); + aboutToShowThisContainer = null; + return; + } + + if ("History".equals(c.getName())) { + beforeContainerHistory(c); + aboutToShowThisContainer = null; + return; + } + + if ("Subscribe".equals(c.getName())) { + beforeContainerSubscribe(c); + aboutToShowThisContainer = null; + return; + } + + if ("UnsubscribePresence".equals(c.getName())) { + beforeContainerUnsubscribePresence(c); + aboutToShowThisContainer = null; + return; + } + + if ("Here Now".equals(c.getName())) { + beforeContainerHereNow(c); + aboutToShowThisContainer = null; + return; + } + + if ("Publish".equals(c.getName())) { + beforeContainerPublish(c); + aboutToShowThisContainer = null; + return; + } + + } + + + protected void beforeContainerPresence(Container c) { + } + + + protected void beforeContainerGUI1(Container c) { + } + + + protected void beforeContainerUnsubscribe(Container c) { + } + + + protected void beforeContainerHistory(Container c) { + } + + + protected void beforeContainerSubscribe(Container c) { + } + + + protected void beforeContainerUnsubscribePresence(Container c) { + } + + + protected void beforeContainerHereNow(Container c) { + } + + + protected void beforeContainerPublish(Container c) { + } + + protected void postShow(Form f) { + if ("Presence".equals(f.getName())) { + postPresence(f); + aboutToShowThisContainer = null; + return; + } + + if ("GUI 1".equals(f.getName())) { + postGUI1(f); + aboutToShowThisContainer = null; + return; + } + + if ("Unsubscribe".equals(f.getName())) { + postUnsubscribe(f); + aboutToShowThisContainer = null; + return; + } + + if ("History".equals(f.getName())) { + postHistory(f); + aboutToShowThisContainer = null; + return; + } + + if ("Subscribe".equals(f.getName())) { + postSubscribe(f); + aboutToShowThisContainer = null; + return; + } + + if ("UnsubscribePresence".equals(f.getName())) { + postUnsubscribePresence(f); + aboutToShowThisContainer = null; + return; + } + + if ("Here Now".equals(f.getName())) { + postHereNow(f); + aboutToShowThisContainer = null; + return; + } + + if ("Publish".equals(f.getName())) { + postPublish(f); + aboutToShowThisContainer = null; + return; + } + + } + + + protected void postPresence(Form f) { + } + + + protected void postGUI1(Form f) { + } + + + protected void postUnsubscribe(Form f) { + } + + + protected void postHistory(Form f) { + } + + + protected void postSubscribe(Form f) { + } + + + protected void postUnsubscribePresence(Form f) { + } + + + protected void postHereNow(Form f) { + } + + + protected void postPublish(Form f) { + } + + protected void postShowContainer(Container c) { + if ("Presence".equals(c.getName())) { + postContainerPresence(c); + aboutToShowThisContainer = null; + return; + } + + if ("GUI 1".equals(c.getName())) { + postContainerGUI1(c); + aboutToShowThisContainer = null; + return; + } + + if ("Unsubscribe".equals(c.getName())) { + postContainerUnsubscribe(c); + aboutToShowThisContainer = null; + return; + } + + if ("History".equals(c.getName())) { + postContainerHistory(c); + aboutToShowThisContainer = null; + return; + } + + if ("Subscribe".equals(c.getName())) { + postContainerSubscribe(c); + aboutToShowThisContainer = null; + return; + } + + if ("UnsubscribePresence".equals(c.getName())) { + postContainerUnsubscribePresence(c); + aboutToShowThisContainer = null; + return; + } + + if ("Here Now".equals(c.getName())) { + postContainerHereNow(c); + aboutToShowThisContainer = null; + return; + } + + if ("Publish".equals(c.getName())) { + postContainerPublish(c); + aboutToShowThisContainer = null; + return; + } + + } + + + protected void postContainerPresence(Container c) { + } + + + protected void postContainerGUI1(Container c) { + } + + + protected void postContainerUnsubscribe(Container c) { + } + + + protected void postContainerHistory(Container c) { + } + + + protected void postContainerSubscribe(Container c) { + } + + + protected void postContainerUnsubscribePresence(Container c) { + } + + + protected void postContainerHereNow(Container c) { + } + + + protected void postContainerPublish(Container c) { + } + + protected void onCreateRoot(String rootName) { + if ("Presence".equals(rootName)) { + onCreatePresence(); + aboutToShowThisContainer = null; + return; + } + + if ("GUI 1".equals(rootName)) { + onCreateGUI1(); + aboutToShowThisContainer = null; + return; + } + + if ("Unsubscribe".equals(rootName)) { + onCreateUnsubscribe(); + aboutToShowThisContainer = null; + return; + } + + if ("History".equals(rootName)) { + onCreateHistory(); + aboutToShowThisContainer = null; + return; + } + + if ("Subscribe".equals(rootName)) { + onCreateSubscribe(); + aboutToShowThisContainer = null; + return; + } + + if ("UnsubscribePresence".equals(rootName)) { + onCreateUnsubscribePresence(); + aboutToShowThisContainer = null; + return; + } + + if ("Here Now".equals(rootName)) { + onCreateHereNow(); + aboutToShowThisContainer = null; + return; + } + + if ("Publish".equals(rootName)) { + onCreatePublish(); + aboutToShowThisContainer = null; + return; + } + + } + + + protected void onCreatePresence() { + } + + + protected void onCreateGUI1() { + } + + + protected void onCreateUnsubscribe() { + } + + + protected void onCreateHistory() { + } + + + protected void onCreateSubscribe() { + } + + + protected void onCreateUnsubscribePresence() { + } + + + protected void onCreateHereNow() { + } + + + protected void onCreatePublish() { + } + + protected void handleComponentAction(Component c, ActionEvent event) { + Container rootContainerAncestor = getRootAncestor(c); + if (rootContainerAncestor == null) return; + String rootContainerName = rootContainerAncestor.getName(); + if (c.getParent().getLeadParent() != null) { + c = c.getParent().getLeadParent(); + } + if (rootContainerName == null) return; + if (rootContainerName.equals("Presence")) { + if ("txtPresenceChannel".equals(c.getName())) { + onPresence_TxtPresenceChannelAction(c, event); + return; + } + if ("btnPresenceOk".equals(c.getName())) { + onPresence_BtnPresenceOkAction(c, event); + return; + } + } + if (rootContainerName.equals("GUI 1")) { + if ("Button".equals(c.getName())) { + onGUI1_ButtonAction(c, event); + return; + } + if ("btnPublish".equals(c.getName())) { + onGUI1_BtnPublishAction(c, event); + return; + } + if ("Button2".equals(c.getName())) { + onGUI1_Button2Action(c, event); + return; + } + if ("Button3".equals(c.getName())) { + onGUI1_Button3Action(c, event); + return; + } + if ("Button4".equals(c.getName())) { + onGUI1_Button4Action(c, event); + return; + } + if ("Button5".equals(c.getName())) { + onGUI1_Button5Action(c, event); + return; + } + if ("Button6".equals(c.getName())) { + onGUI1_Button6Action(c, event); + return; + } + if ("btnTime".equals(c.getName())) { + onGUI1_BtnTimeAction(c, event); + return; + } + if ("btnDar".equals(c.getName())) { + onGUI1_BtnDarAction(c, event); + return; + } + } + if (rootContainerName.equals("Unsubscribe")) { + if ("txtUnsubscribeChannel".equals(c.getName())) { + onUnsubscribe_TxtUnsubscribeChannelAction(c, event); + return; + } + if ("btnUnsubscribeOk".equals(c.getName())) { + onUnsubscribe_BtnUnsubscribeOkAction(c, event); + return; + } + } + if (rootContainerName.equals("History")) { + if ("txtHistoryChannel".equals(c.getName())) { + onHistory_TxtHistoryChannelAction(c, event); + return; + } + if ("btnHistoryOk".equals(c.getName())) { + onHistory_BtnHistoryOkAction(c, event); + return; + } + } + if (rootContainerName.equals("Subscribe")) { + if ("txtSubscribeChannel".equals(c.getName())) { + onSubscribe_TxtSubscribeChannelAction(c, event); + return; + } + if ("txtSubscribeOk".equals(c.getName())) { + onSubscribe_TxtSubscribeOkAction(c, event); + return; + } + } + if (rootContainerName.equals("UnsubscribePresence")) { + if ("txtUnsubscribePresenceChannel".equals(c.getName())) { + onUnsubscribePresence_TxtUnsubscribePresenceChannelAction(c, event); + return; + } + if ("btnUnsubscribePresenceOk".equals(c.getName())) { + onUnsubscribePresence_BtnUnsubscribePresenceOkAction(c, event); + return; + } + } + if (rootContainerName.equals("Here Now")) { + if ("txtHereNowChannel".equals(c.getName())) { + onHereNow_TxtHereNowChannelAction(c, event); + return; + } + if ("btnHereNowOk".equals(c.getName())) { + onHereNow_BtnHereNowOkAction(c, event); + return; + } + } + if (rootContainerName.equals("Publish")) { + if ("txtPublishChannel".equals(c.getName())) { + onPublish_TxtPublishChannelAction(c, event); + return; + } + if ("txtPublishMessage".equals(c.getName())) { + onPublish_TxtPublishMessageAction(c, event); + return; + } + if ("btnPublishOk".equals(c.getName())) { + onPublish_BtnPublishOkAction(c, event); + return; + } + } + } + + protected void onPresence_TxtPresenceChannelAction(Component c, ActionEvent event) { + } + + protected void onPresence_BtnPresenceOkAction(Component c, ActionEvent event) { + } + + protected void onGUI1_ButtonAction(Component c, ActionEvent event) { + } + + protected void onGUI1_BtnPublishAction(Component c, ActionEvent event) { + } + + protected void onGUI1_Button2Action(Component c, ActionEvent event) { + } + + protected void onGUI1_Button3Action(Component c, ActionEvent event) { + } + + protected void onGUI1_Button4Action(Component c, ActionEvent event) { + } + + protected void onGUI1_Button5Action(Component c, ActionEvent event) { + } + + protected void onGUI1_Button6Action(Component c, ActionEvent event) { + } + + protected void onGUI1_BtnTimeAction(Component c, ActionEvent event) { + } + + protected void onGUI1_BtnDarAction(Component c, ActionEvent event) { + } + + protected void onUnsubscribe_TxtUnsubscribeChannelAction(Component c, ActionEvent event) { + } + + protected void onUnsubscribe_BtnUnsubscribeOkAction(Component c, ActionEvent event) { + } + + protected void onHistory_TxtHistoryChannelAction(Component c, ActionEvent event) { + } + + protected void onHistory_BtnHistoryOkAction(Component c, ActionEvent event) { + } + + protected void onSubscribe_TxtSubscribeChannelAction(Component c, ActionEvent event) { + } + + protected void onSubscribe_TxtSubscribeOkAction(Component c, ActionEvent event) { + } + + protected void onUnsubscribePresence_TxtUnsubscribePresenceChannelAction(Component c, ActionEvent event) { + } + + protected void onUnsubscribePresence_BtnUnsubscribePresenceOkAction(Component c, ActionEvent event) { + } + + protected void onHereNow_TxtHereNowChannelAction(Component c, ActionEvent event) { + } + + protected void onHereNow_BtnHereNowOkAction(Component c, ActionEvent event) { + } + + protected void onPublish_TxtPublishChannelAction(Component c, ActionEvent event) { + } + + protected void onPublish_TxtPublishMessageAction(Component c, ActionEvent event) { + } + + protected void onPublish_BtnPublishOkAction(Component c, ActionEvent event) { + } + +} diff --git a/codenameone/examples/PubnubDevConsole/src/theme.res b/codenameone/examples/PubnubDevConsole/src/theme.res new file mode 100644 index 000000000..aac9dade0 Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/src/theme.res differ diff --git a/codenameone/examples/PubnubDevConsole/src/userclasses/StateMachine.java b/codenameone/examples/PubnubDevConsole/src/userclasses/StateMachine.java new file mode 100644 index 000000000..04478aefc --- /dev/null +++ b/codenameone/examples/PubnubDevConsole/src/userclasses/StateMachine.java @@ -0,0 +1,166 @@ +/** + * Your application code goes here + */ + +package userclasses; + +import generated.StateMachineBase; +import com.codename1.ui.*; +import com.codename1.ui.events.*; +import com.codename1.ui.util.Resources; + +import com.pubnub.api.*; + + +/** + * + * @author Your name here + */ +public class StateMachine extends StateMachineBase { + Pubnub pubnub; + public StateMachine(String resFile) { + super(resFile); + // do not modify, write code in initVars and initialize class members there, + // the constructor might be invoked too late due to race conditions that might occur + } + + /** + * this method should be used to initialize variables instead of + * the constructor/class scope to avoid race conditions + */ + protected void initVars(Resources res) { + pubnub = new Pubnub("demo", "demo"); + } + + + + + @Override + protected void onPublish_BtnPublishOkAction(Component c, ActionEvent event) { + String channel = findTxtPublishChannel().getText(); + String message = findTxtPublishMessage().getText(); + pubnub.publish(channel, message, new Callback() { + + @Override + public void successCallback(String channel, Object message) { + new Dialog().show("Publish", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + @Override + public void errorCallback(String channel, PubnubError message) { + new Dialog().show("Publish", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + }); + } + + @Override + protected void onUnsubscribePresence_BtnUnsubscribePresenceOkAction(Component c, ActionEvent event) { + String channel = findTxtUnsubscribePresenceChannel().getText(); + pubnub.unsubscribePresence(channel); + } + + @Override + protected void onUnsubscribe_BtnUnsubscribeOkAction(Component c, ActionEvent event) { + String channel = findTxtUnsubscribeChannel().getText(); + pubnub.unsubscribe(channel); + } + + @Override + protected void onSubscribe_TxtSubscribeOkAction(Component c, ActionEvent event) { + try { + String channel = findTxtSubscribeChannel().getText(); + + pubnub.subscribe(channel , new Callback() { + + @Override + public void successCallback(String channel, Object message) { + new Dialog().show("Subscribe", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + @Override + public void errorCallback(String channel, PubnubError message) { + new Dialog().show("Subscribe", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + }); + } catch (PubnubException ex) { + + } + + } + + @Override + protected void onPresence_TxtPresenceChannelAction(Component c, ActionEvent event) { + try { + String channel = findTxtPresenceChannel().getText(); + + pubnub.presence(channel , new Callback() { + + @Override + public void successCallback(String channel, Object message) { + new Dialog().show("Presence", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + @Override + public void errorCallback(String channel, PubnubError message) { + new Dialog().show("Presence", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + }); + } catch (PubnubException ex) { + + } + + } + + @Override + protected void onHistory_BtnHistoryOkAction(Component c, ActionEvent event) { + String channel = findTxtHistoryChannel().getText(); + pubnub.history(channel, 1, new Callback() { + + @Override + public void successCallback(String channel, Object message) { + new Dialog().show("History", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + @Override + public void errorCallback(String channel, PubnubError message) { + new Dialog().show("History", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + }); + + } + + @Override + protected void onHereNow_TxtHereNowChannelAction(Component c, ActionEvent event) { + String channel = findTxtHereNowChannel().getText(); + pubnub.hereNow(channel, new Callback() { + + @Override + public void successCallback(String channel, Object message) { + new Dialog().show("Here Now", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + @Override + public void errorCallback(String channel, PubnubError message) { + new Dialog().show("Here Now", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + }); + + } + + + @Override + protected void onGUI1_BtnTimeAction(Component c, ActionEvent event) { + pubnub.time(new Callback() { + + @Override + public void successCallback(String channel, Object message) { + new Dialog().show("Time", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + @Override + public void errorCallback(String channel, PubnubError message) { + new Dialog().show("Time", message.toString() , Dialog.TYPE_INFO, null, "Ok", null); + } + }); + + } + + @Override + protected void onGUI1_BtnDarAction(Component c, ActionEvent event) { + pubnub.disconnectAndResubscribe();; + } +} diff --git a/codenameone/json.cn1lib b/codenameone/json.cn1lib new file mode 100644 index 000000000..58636ebd5 Binary files /dev/null and b/codenameone/json.cn1lib differ diff --git a/codenameone/src/com/codename1/io/PubnubCn1Connection.java b/codenameone/src/com/codename1/io/PubnubCn1Connection.java new file mode 100644 index 000000000..c18faea7e --- /dev/null +++ b/codenameone/src/com/codename1/io/PubnubCn1Connection.java @@ -0,0 +1,78 @@ +package com.codename1.io; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Hashtable; + +import com.codename1.impl.CodenameOneImplementation; +import com.pubnub.api.HttpUtil; +import java.io.UnsupportedEncodingException; +//import java.util.logging.Level; +//import java.util.logging.Logger; + +public class PubnubCn1Connection { + + private CodenameOneImplementation impl = Util.getImplementation(); + private Object connection = null; + private InputStream input = null; + + private byte[] data = null; + + public PubnubCn1Response fetch(String url, int timeout, Hashtable _headers) throws UnsupportedEncodingException, IOException { + int rc = 0; + String page = null; + int contentLength = 0; + + while (HttpUtil.isRedirect(rc) || rc == 0) { + try { + connection = impl.connect(url, true, false, timeout); + } catch (IOException ex) { + throw ex; + } + impl.setPostRequest(connection, false); + + if (_headers != null) { + Enumeration e = _headers.keys(); + while (e.hasMoreElements()) { + String k = (String) e.nextElement(); + String value = (String) _headers.get(k); + impl.setHeader(connection, k, value); + } + } + try { + rc = impl.getResponseCode(connection); + } catch (IOException ex) { + throw ex; + } + if (HttpUtil.isRedirect(rc)) { + String uri; + try { + uri = impl.getHeaderField("location", connection); + } catch (IOException ex) { + throw ex; + } + if (!(uri.startsWith("https://") || uri.startsWith("https://"))) { + url = Util.relativeToAbsolute(url, uri); + } else { + url = uri; + } + } + } + contentLength = impl.getContentLength(connection); + try { + input = impl.openInputStream(connection); + data = Util.readInputStream(input); + input.close(); + } catch (IOException ex) { + return new PubnubCn1Response(rc, ex.getMessage() ); + } + + input = null; + + return new PubnubCn1Response(rc, new String(data, "UTF-8")); + } + + public void disconnect() { + } +} diff --git a/codenameone/src/com/codename1/io/PubnubCn1Response.java b/codenameone/src/com/codename1/io/PubnubCn1Response.java new file mode 100644 index 000000000..d14d9fb67 --- /dev/null +++ b/codenameone/src/com/codename1/io/PubnubCn1Response.java @@ -0,0 +1,17 @@ +package com.codename1.io; + +public class PubnubCn1Response { + private String response; + private int responseStatusCode; + public String getResponse() { + return response; + } + public int getResponseStatusCode() { + return responseStatusCode; + } + public PubnubCn1Response(int responseStatusCode, String response) { + this.response = response; + this.responseStatusCode = responseStatusCode; + } +} + diff --git a/codenameone/src/com/pubnub/api/HttpClientCore.java b/codenameone/src/com/pubnub/api/HttpClientCore.java new file mode 100644 index 000000000..cce79d152 --- /dev/null +++ b/codenameone/src/com/pubnub/api/HttpClientCore.java @@ -0,0 +1,105 @@ +package com.pubnub.api; + +import static com.pubnub.api.PubnubError.*; +import static com.pubnub.api.PubnubError.getErrorObject; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Hashtable; + +import com.codename1.impl.CodenameOneImplementation; +import com.codename1.io.*; +import org.json.*; + +class HttpClientCore extends HttpClient { + + + PubnubCn1Connection connection; + private int requestTimeout = 310000; + private int connectionTimeout = 5000; + + + protected static Logger log = new Logger(Worker.class); + + private void init() { + connection = new PubnubCn1Connection(); + } + + public HttpClientCore(int connectionTimeout, int requestTimeout, Hashtable headers) { + init(); + this.setRequestTimeout(requestTimeout); + this.setConnectionTimeout(connectionTimeout); + this._headers = headers; + } + + public int getRequestTimeout() { + return requestTimeout; + } + + public void setRequestTimeout(int requestTimeout) { + this.requestTimeout = requestTimeout; + } + + public int getConnectionTimeout() { + return connectionTimeout; + } + + public void setConnectionTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + } + + public HttpResponse fetch(String url) throws PubnubException, IOException { + return fetch(url, null); + } + + public synchronized HttpResponse fetch(String url, Hashtable headers) + throws PubnubException, IOException { + IOException excp = null; + PubnubCn1Response pcr = null; + try { + pcr = connection.fetch(url, requestTimeout, PubnubUtil.hashtableClone(headers,_headers)); + } catch (IOException ex) { + excp = ex; + } + String page = pcr.getResponse(); + switch (pcr.getResponseStatusCode()) { + case HttpUtil.HTTP_FORBIDDEN: + throw new PubnubException(getErrorObject(PNERROBJ_FORBIDDEN, page)); + case HttpUtil.HTTP_UNAUTHORIZED: + throw new PubnubException(getErrorObject(PNERROBJ_UNAUTHORIZED, page)); + case HttpUtil.HTTP_BAD_REQUEST: + try { + JSONArray jsarr = new JSONArray(page); + String error = jsarr.get(1).toString(); + throw new PubnubException(getErrorObject(PNERROBJ_BAD_REQUEST, 1, error)); + } catch (JSONException e) { + JSONObject jso; + try { + jso = new JSONObject(page); + throw new PubnubException(getErrorObject(PNERROBJ_BAD_REQUEST, 2, jso.toString())); + } catch (JSONException e1) { + throw new PubnubException(getErrorObject(PNERROBJ_INVALID_JSON, 2)); + } + } + case HttpUtil.HTTP_BAD_GATEWAY: + throw new PubnubException(getErrorObject(PNERROBJ_BAD_GATEWAY, url)); + case HttpUtil.HTTP_CLIENT_TIMEOUT: + throw new PubnubException(getErrorObject(PNERROBJ_CLIENT_TIMEOUT, url)); + case HttpUtil.HTTP_GATEWAY_TIMEOUT: + throw new PubnubException(getErrorObject(PNERROBJ_GATEWAY_TIMEOUT, url)); + case HttpUtil.HTTP_INTERNAL_ERROR: + throw new PubnubException(getErrorObject(PNERROBJ_INTERNAL_ERROR, url)); + default: + if (excp != null) throw excp; + break; + } + return new HttpResponse(pcr.getResponseStatusCode(), pcr.getResponse()); + } + + public void shutdown() { + if (connection != null) connection.disconnect(); + } +} + diff --git a/codenameone/src/com/pubnub/api/Logger.java b/codenameone/src/com/pubnub/api/Logger.java new file mode 100644 index 000000000..1f6575107 --- /dev/null +++ b/codenameone/src/com/pubnub/api/Logger.java @@ -0,0 +1,59 @@ +package com.pubnub.api; + +import com.codename1.io.Log; + +class Cn1Logger { + + private Log log; + + public Cn1Logger(Class c) { + Log log = Log.getInstance(); + } + + public void debug(String s) { + log.p(s, Log.DEBUG); + } + + public void trace(String s) { + log.p(s,Log.INFO); + } + + public void error(String s) { + log.p(s,Log.ERROR); + } + + public void info(String s) { + log.p(s,Log.INFO); + } +} + +class Logger extends AbstractLogger { + + private Class _class; + private Cn1Logger log; + + public Logger(Class _class) { + this._class = _class; + this.log = new Cn1Logger(this._class); + } + + @Override + protected void nativeDebug(String s) { + log.debug(s); + } + + @Override + protected void nativeVerbose(String s) { + log.trace(s); + } + + @Override + protected void nativeError(String s) { + log.error(s); + } + + @Override + protected void nativeInfo(String s) { + log.info(s); + } +} diff --git a/codenameone/src/com/pubnub/api/NonSubscribeManager.java b/codenameone/src/com/pubnub/api/NonSubscribeManager.java new file mode 100644 index 000000000..fb1060b68 --- /dev/null +++ b/codenameone/src/com/pubnub/api/NonSubscribeManager.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +class NonSubscribeManager extends AbstractNonSubscribeManager { + + public NonSubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public void clearRequestQueue() { + _waiting.clear(); + } +} diff --git a/codenameone/src/com/pubnub/api/Pubnub.java b/codenameone/src/com/pubnub/api/Pubnub.java new file mode 100644 index 000000000..594b78a81 --- /dev/null +++ b/codenameone/src/com/pubnub/api/Pubnub.java @@ -0,0 +1,555 @@ +package com.pubnub.api; + + +import java.util.Hashtable; +import java.util.Random; + +/** + * Pubnub object facilitates querying channels for messages and listening on + * channels for presence/message events + * + * @author Pubnub + * + */ + +public class Pubnub extends PubnubCore { + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL on ? + */ + 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); + } + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param ssl_on + * 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); + } + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + */ + public Pubnub(String publish_key, String subscribe_key) { + super(publish_key, subscribe_key, "", "", false); + } + + /** + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param ssl + */ + public Pubnub(String publish_key, String subscribe_key, boolean ssl) { + super(publish_key, subscribe_key, "", "", ssl); + } + + /** + * @param publish_key + * @param subscribe_key + * @param secret_key + */ + public Pubnub(String publish_key, String subscribe_key, String secret_key) { + super(publish_key, subscribe_key, secret_key, "", false); + } + + /** + * Sets value for UUID + * + * @param uuid + * UUID value for Pubnub client + */ + public void setUUID(String uuid) { + this.UUID = uuid.toString(); + } + + protected String uuid() { + + String valueBeforeMD5; + String valueAfterMD5; + Random mySecureRand = new Random(); + String s_id = String.valueOf(PubnubCore.class.hashCode()); + StringBuffer sbValueBeforeMD5 = new StringBuffer(); + try { + long time = System.currentTimeMillis(); + long rand = 0; + rand = mySecureRand.nextLong(); + sbValueBeforeMD5.append(s_id); + sbValueBeforeMD5.append(":"); + sbValueBeforeMD5.append(Long.toString(time)); + sbValueBeforeMD5.append(":"); + sbValueBeforeMD5.append(Long.toString(rand)); + valueBeforeMD5 = sbValueBeforeMD5.toString(); + byte[] array = PubnubCrypto.md5(valueBeforeMD5); + StringBuffer sb = new StringBuffer(); + for (int j = 0; j < array.length; ++j) { + int b = array[j] & 0xFF; + if (b < 0x10) { + sb.append('0'); + } + sb.append(Integer.toHexString(b)); + } + valueAfterMD5 = sb.toString(); + String raw = valueAfterMD5.toUpperCase(); + sb = new StringBuffer(); + sb.append(raw.substring(0, 8)); + sb.append("-"); + sb.append(raw.substring(8, 12)); + sb.append("-"); + sb.append(raw.substring(12, 16)); + sb.append("-"); + sb.append(raw.substring(16, 20)); + sb.append("-"); + sb.append(raw.substring(20)); + return sb.toString(); + } catch (Exception e) { + return null; + } + } + + /** + * This method sets timeout value for subscribe/presence. Default value is + * 310000 milliseconds i.e. 310 seconds + * + * @param timeout + * Timeout value in milliseconds for subscribe/presence + */ + public void setSubscribeTimeout(int timeout) { + super.setSubscribeTimeout(timeout); + } + + /** + * This method returns timeout value for subscribe/presence. + * + * @return Timeout value in milliseconds for subscribe/presence + */ + public int getSubscribeTimeout() { + return super.getSubscribeTimeout(); + } + + /** + * This method set timeout value for non subscribe operations like publish, + * history, hereNow. Default value is 15000 milliseconds i.e. 15 seconds. + * + * @param timeout + * Timeout value in milliseconds for Non subscribe operations + * like publish, history, hereNow + */ + public void setNonSubscribeTimeout(int timeout) { + super.setNonSubscribeTimeout(timeout); + } + /** + * This method returns timeout value for non subscribe operations like publish, history, hereNow + * + * @return Timeout value in milliseconds for for Non subscribe operations like publish, history, hereNow + */ + public int getNonSubscribeTimeout() { + return super.getNonSubscribeTimeout(); + } + + protected String getUserAgent() { + return "Java/" + VERSION; + } + + /** + * Send a message to a channel. + * + * @param args + * Hashtable containing channel name, message. + * @param callback + * object of sub class of Callback class + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + */ + @Deprecated + @Override + public void publish(Hashtable args, Callback callback) { + super.publish(args, callback); + } + + /** + * Send a message to a channel. + * + * @param args + * Hashtable containing channel name, message, callback + * @deprecated As of version 3.5.2 . Will be removed in 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + * + */ + @Deprecated + @Override + public void publish(Hashtable args) { + super.publish(args); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, long end, int count, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(final String channel, long start, long end, + int count, boolean reverse, final Callback callback) { + super.detailedHistory(channel, start, end, count, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(final String channel, long start, long end, int count, + boolean reverse, final Callback callback) { + super.detailedHistory(channel, start, end, count, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, long start, boolean reverse, + Callback callback) { + super.detailedHistory(channel, start, reverse, callback); + } + + /** + * + * Read history for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(String channel, long start, boolean reverse, + Callback callback) { + super.detailedHistory(channel, start, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, long end, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, long start, long end, + Callback callback) { + super.detailedHistory(channel, start, end, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param callback + * Callback + */ + + public void history(String channel, long start, long end, Callback callback) { + super.detailedHistory(channel, start, end, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, long end, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, long start, long end, + boolean reverse, Callback callback) { + super.detailedHistory(channel, start, end, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(String channel, long start, long end, boolean reverse, + Callback callback) { + super.detailedHistory(channel, start, end, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, int count, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, int count, boolean reverse, + Callback callback) { + super.detailedHistory(channel, count, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(String channel, int count, boolean reverse, + Callback callback) { + super.detailedHistory(channel, count, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, boolean reverse, Callback callback)} + */ + @Deprecated + public void detailedHistory(String channel, boolean reverse, + Callback callback) { + super.detailedHistory(channel, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + + public void history(String channel, boolean reverse, Callback callback) { + super.detailedHistory(channel, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Maximum number of messages + * @param callback + * Callback object + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, int count, Callback callback)} + */ + @Deprecated + public void detailedHistory(String channel, int count, Callback callback) { + super.detailedHistory(channel, count, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Maximum number of messages + * @param callback + * Callback object + */ + @Override + public void history(String channel, int count, Callback callback) { + super.detailedHistory(channel, count, callback); + } + + /** + * Unsubscribe/Disconnect from channel. + * + * @param args + * Hashtable containing channel name. + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + */ + @Deprecated + public void unsubscribe(Hashtable args) { + String[] channelList = (String[]) args.get("channels"); + if (channelList == null) { + channelList = new String[] { (String) args.get("channel") }; + } + unsubscribe(channelList); + } + + /** + * + * Listen for a message on a channel. + * + * @param args + * Hashtable containing channel name + * @param callback + * Callback + * @exception PubnubException + * Throws PubnubException if Callback is null + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . + */ + @Deprecated + public void subscribe(Hashtable args, Callback callback) + throws PubnubException { + args.put("callback", callback); + super.subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param args + * Hashtable containing channel name, callback + * @exception PubnubException + * Throws PubnubException if Callback is null + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + */ + @Deprecated + public void subscribe(Hashtable args) throws PubnubException { + super.subscribe(args); + } + + +} diff --git a/codenameone/src/com/pubnub/api/PubnubCrypto.java b/codenameone/src/com/pubnub/api/PubnubCrypto.java new file mode 100644 index 000000000..c620d9739 --- /dev/null +++ b/codenameone/src/com/pubnub/api/PubnubCrypto.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +class PubnubCrypto extends PubnubCryptoCore { + + public PubnubCrypto(String CIPHER_KEY) { + super(CIPHER_KEY); + } + + public PubnubCrypto(String CIPHER_KEY, String INITIALIZATION_VECTOR) { + super(CIPHER_KEY, INITIALIZATION_VECTOR); + } + +} diff --git a/codenameone/src/com/pubnub/api/PubnubUtil.java b/codenameone/src/com/pubnub/api/PubnubUtil.java new file mode 100644 index 000000000..2261873b6 --- /dev/null +++ b/codenameone/src/com/pubnub/api/PubnubUtil.java @@ -0,0 +1,50 @@ +package com.pubnub.api; + +import com.codename1.io.Util; +import org.json.*; + +/** + * PubnubUtil class provides utility methods like urlEncode etc + * @author Pubnub + * + */ +public class PubnubUtil extends PubnubUtilCore { + + /** + * Returns encoded String + * + * @param sUrl + * , input string + * @return , encoded string + */ + public static String urlEncode(String sUrl) { + return Util.encodeUrl(sUrl); + } + /** + * Convert input String to JSONObject, JSONArray, or String + * + * @param str + * JSON data in string format + * + * @return JSONArray or JSONObject or String + */ + static Object stringToJSON(String str) { + try { + return new JSONArray(str); + } catch (JSONException e) { + } + try { + return new JSONObject(str); + } catch (JSONException ex) { + } + try { + return Integer.parseInt(str); + } catch (Exception ex) { + } + try { + return Double.parseDouble(str); + } catch (Exception ex) { + } + return str; + } +} diff --git a/codenameone/src/com/pubnub/api/SubscribeManager.java b/codenameone/src/com/pubnub/api/SubscribeManager.java new file mode 100644 index 000000000..a1916237a --- /dev/null +++ b/codenameone/src/com/pubnub/api/SubscribeManager.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +class SubscribeManager extends AbstractSubscribeManager { + + public SubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public void clearRequestQueue() { + _waiting.clear(); + } +} diff --git a/codenameone/src/com/pubnub/api/SubscribeWorker.java b/codenameone/src/com/pubnub/api/SubscribeWorker.java new file mode 100644 index 000000000..aeead6794 --- /dev/null +++ b/codenameone/src/com/pubnub/api/SubscribeWorker.java @@ -0,0 +1,113 @@ +package com.pubnub.api; + +//import java.net.SocketTimeoutException; +import java.util.Hashtable; +import java.util.Vector; +import static com.pubnub.api.PubnubError.*; + +class SubscribeWorker extends AbstractSubscribeWorker { + private Exception excp = null; + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, headers); + } + + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, windowInterval, headers); + } + void process(HttpRequest hreq) { + HttpResponse hresp = null; + int currentRetryAttempt = (hreq.isDar())?1:maxRetries; + log.verbose("disconnectAndResubscribe is " + hreq.isDar()); + if (hreq.getWorker() != null) { + log.verbose("Request placed by worker " + hreq.getWorker().getThread().getName()); + if (hreq.getWorker()._die) { + log.verbose("The thread which placed the request has died, so ignore the request : " + hreq.getWorker().getThread().getName()); + return; + } + } + if (!hreq.isSubzero() && windowInterval != 0) { + try { + Thread.sleep(windowInterval); + } catch (InterruptedException e) { + } + } + hreq.setWorker(this); + while (!_die && currentRetryAttempt <= maxRetries) { + try { + log.debug(hreq.getUrl()); + hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders()); + if (hresp != null + && HttpUtil.checkResponseSuccess(hresp + .getStatusCode())) { + currentRetryAttempt = 1; + break; + } + } /*catch (SocketTimeoutException e) { + log.verbose("No Traffic , Read Timeout Exception in Fetch : " + e.toString()); + if (_die) { + log.verbose("Asked to Die, Don't do back from DAR processing"); + break; + } + if (hreq.isDar()) { + hreq.getResponseHandler().handleBackFromDar(hreq); + return; + } + break; + + } */catch (PubnubException e) { + excp = e; + switch (e.getPubnubError().errorCode) { + case PNERR_FORBIDDEN: + case PNERR_UNAUTHORIZED: + log.verbose("Authentication Failure : " + e.toString()); + currentRetryAttempt++; + break; + default: + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":currentRetryAttempt) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + break; + } + + } catch (Exception e) { + excp = e; + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":currentRetryAttempt) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + } + + try { + Thread.sleep(retryInterval); + } catch (InterruptedException e) { + } + } + if (!_die) { + if (hresp == null) { + log.debug("Error in fetching url : " + hreq.getUrl()); + if (hreq.isDar()) { + log.verbose("Exhausted number of retries"); + hreq.getResponseHandler().handleTimeout(hreq); + } else { + + if (excp != null && excp instanceof PubnubException && ((PubnubException) excp).getPubnubError() != null) { + hreq.getResponseHandler().handleError(hreq, ((PubnubException) excp).getPubnubError()); + } else { + hreq.getResponseHandler().handleError(hreq, getErrorObject(PNERROBJ_HTTP_ERROR, 1)); + } + } + return; + } + log.debug(hresp.getResponse()); + hreq.getResponseHandler().handleResponse(hreq, hresp.getResponse()); + } + + } + + public void shutdown() { + if (httpclient != null) httpclient.shutdown(); + } +} diff --git a/gwt/3.3/api/PubnubGwt.jar b/gwt/3.3/api/PubnubGwt.jar new file mode 100644 index 000000000..4b394808e Binary files /dev/null and b/gwt/3.3/api/PubnubGwt.jar differ diff --git a/gwt/3.3/api/build.xml b/gwt/3.3/api/build.xml new file mode 100644 index 000000000..bfa8ff98b --- /dev/null +++ b/gwt/3.3/api/build.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gwt/3.3/api/src/com/pubnub/gwt/api/Pubnub.gwt.xml b/gwt/3.3/api/src/com/pubnub/gwt/api/Pubnub.gwt.xml new file mode 100644 index 000000000..6b47b7e5a --- /dev/null +++ b/gwt/3.3/api/src/com/pubnub/gwt/api/Pubnub.gwt.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/gwt/3.3/api/src/com/pubnub/gwt/api/client/Callback.java b/gwt/3.3/api/src/com/pubnub/gwt/api/client/Callback.java new file mode 100644 index 000000000..0c9dd76da --- /dev/null +++ b/gwt/3.3/api/src/com/pubnub/gwt/api/client/Callback.java @@ -0,0 +1,20 @@ +/** + * + */ +package com.pubnub.gwt.api.client; + +/** + * @author Pubnub + * + */ +public abstract class Callback { + public void callback(String channel, Object message) {} + + public void error(String channel, Object message) {} + + public void connect(String channel) {} + + public void reconnect(String channel) {} + + public void disconnect(String channel) {} +} diff --git a/gwt/3.3/api/src/com/pubnub/gwt/api/client/Pubnub.java b/gwt/3.3/api/src/com/pubnub/gwt/api/client/Pubnub.java new file mode 100644 index 000000000..09659e2a1 --- /dev/null +++ b/gwt/3.3/api/src/com/pubnub/gwt/api/client/Pubnub.java @@ -0,0 +1,212 @@ +/** + * + */ +package com.pubnub.gwt.api.client; + +import com.google.gwt.core.client.JavaScriptObject; +import com.google.gwt.json.client.JSONArray; +import com.google.gwt.json.client.JSONObject; +import com.pubnub.gwt.api.client.Callback; + +/** + * @author Pubnub + * + */ +public class Pubnub extends JavaScriptObject { + protected Pubnub() { + } + private native void alert(String message) /*-{ + alert(message); + }-*/; + private static native Pubnub _init(String origin, String pubkey, String subkey, boolean ssl) /*-{ + if (ssl) + ssl_setting = "on"; + else + ssl_setting = "off"; + + p = $wnd.PUBNUB.init({ + 'publish_key' : pubkey, + 'subscribe_key' : subkey, + 'ssl' : ssl_setting, + 'origin' : origin, + }); + return p; + + }-*/; + + private static native void _time(Callback cb) /*-{ + $wnd.PUBNUB.time( + function(message){ + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)("", message.toString()); + } + ); + }-*/; + + private final native void _uuid(Callback cb) /*-{ + this.uuid( + function(message){ + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)("", message); + } + ); + }-*/; + private final native String _uuid() /*-{ + return this.uuid(); + }-*/; + + private final native void _publish(String channel, String obj, Callback cb) /*-{ + + + this.publish({ + "channel" : channel, + "message" : eval("(" + obj + ")"), + "callback" : function(message){ + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + } + }); + }-*/; + + private final native void _publishStr(String channel, String obj, Callback cb) /*-{ + this.publish({ + "channel" : channel, + "message" : obj, + "callback" : function(message){ + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + } + }); + +}-*/; + + private final native void _subscribe(String channel, Callback cb)/*-{ + this.subscribe({ + "channel" : channel, + "callback" : function(message){ + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + }, + "error" : function(message){ + cb.@com.pubnub.gwt.api.client.Callback::error(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + }, + "connect" : function(){ + cb.@com.pubnub.gwt.api.client.Callback::connect(Ljava/lang/String;)(channel); + }, + "reconnect" : function(){ + cb.@com.pubnub.gwt.api.client.Callback::reconnect(Ljava/lang/String;)(channel); + }, + "disconnect" : function(){ + cb.@com.pubnub.gwt.api.client.Callback::disconnect(Ljava/lang/String;)(channel); + }, + }); + }-*/; + + private native final void _history(String channel, int limit, Callback cb) /*-{ + return this.history({ + "channel" : channel, + "limit" : limit, + "callback" : function(message) { + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + } + }); + }-*/; + + private native final void _unsubscribe(String channel) /*-{ + this.unsubscribe({ + "channel" : channel + }); + }-*/; + + private native final void _here_now(String channel, Callback cb) /*-{ + this.here_now({ + "channel" : channel, + "callback" : function(message){ + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + } + }); + }-*/; + + private native final void _detailedHistory(String channel, String start, String end, int count, boolean reverse, Callback cb) /*-{ + param = {"channel" : channel}; + if ( start != "-1") + param["start"] = start; + if ( end != "-1") + param["end"] = end; + + if (count > -1) + param["count"] = count; + + param["reverse"] = reverse; + + param["callback"] = function(message) { + cb.@com.pubnub.gwt.api.client.Callback::callback(Ljava/lang/String;Ljava/lang/Object;)(channel, message); + }; + + this.detailedHistory(param); + }-*/; + + //=================== Public Methods + + public static Pubnub init() { + return _init("pubsub.pubnub.com", "demo", "demo", true); + } + + public static Pubnub init(String pubkey, String subkey, boolean ssl) { + return _init("pubsub.pubnub.com", pubkey, subkey, ssl); + } + public static Pubnub init(String origin, String pubkey, String subkey, boolean ssl) { + return _init(origin, pubkey, subkey, ssl); + } + public final void time(Callback cb) { + _time(cb); + } + + public final void uuid(Callback cb) { + _uuid(cb); + } + public final String uuid() { + return _uuid(); + } + + public final void publish(String channel, JSONObject obj, Callback cb) { + _publish(channel, obj.toString(), cb); + } + + public final void publish(String channel, String obj, Callback cb) { + _publishStr(channel, obj, cb); + } + + public final void publish(String channel, JSONArray obj, Callback cb) { + _publish(channel, obj.toString(), cb); + } + + public final void subscribe(String channel, Callback cb) { + _subscribe(channel, cb); + } + + public final void unsubscribe(String channel) { + _unsubscribe(channel); + } + + public final void presence(String channel, Callback cb) { + _subscribe(channel + "-pnpres", cb); + } + + public final void here_now(String channel, Callback cb) { + _here_now(channel, cb); + } + + public final void history(String channel, int limit, Callback cb) { + _history(channel, limit, cb); + } + + public final void detailedHistory(String channel, long start, long end, int count, boolean reverse, Callback cb) { + _detailedHistory(channel, String.valueOf(start), String.valueOf(end), count, reverse, cb); + } + + public final void detailedHistory(String channel, long start, boolean reverse, Callback cb) { + _detailedHistory(channel, String.valueOf(start), "-1", -1, reverse, cb); + + } + + public final void detailedHistory(String channel, int count, Callback cb) { + _detailedHistory(channel, "-1", "-1", count, false, cb); + + } +} diff --git a/gwt/3.3/examples/PubnubExample/.gwt/.gwt-log b/gwt/3.3/examples/PubnubExample/.gwt/.gwt-log new file mode 100644 index 000000000..0e3159d0f --- /dev/null +++ b/gwt/3.3/examples/PubnubExample/.gwt/.gwt-log @@ -0,0 +1,2570 @@ +Module location: file:/home/workpn/workspace/PublishExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Removing invalidated units +Finding entry point classes +Rebinding com.google.gwt.i18n.client.impl.LocaleInfoImpl + Invoking generator com.google.gwt.i18n.rebind.LocaleInfoGenerator + Processing interface com.google.gwt.i18n.client.constants.NumberConstantsImpl + Generating method body for percentPattern() + Generating method body for zeroDigit() + Generating method body for scientificPattern() + Generating method body for decimalSeparator() + Generating method body for notANumber() + Generating method body for minusSign() + Generating method body for infinity() + Generating method body for exponentialSymbol() + Generating method body for plusSign() + Generating method body for currencyPattern() + Generating method body for monetaryGroupingSeparator() + Generating method body for groupingSeparator() + Generating method body for perMill() + Generating method body for monetarySeparator() + Generating method body for decimalPattern() + Generating method body for percent() + Generating method body for defCurrencyCode() + Adding '3' new generated units + Removing invalidated units +Rebinding com.google.gwt.resources.client.CommonResources.Bundle + Adding '1' new generated units + Removing invalidated units +Module location: file:/home/workpn/workspace/PublishExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Removing invalidated units +Finding entry point classes +Rebinding com.google.gwt.i18n.client.impl.LocaleInfoImpl + Invoking generator com.google.gwt.i18n.rebind.LocaleInfoGenerator + Processing interface com.google.gwt.i18n.client.constants.NumberConstantsImpl + Generating method body for percentPattern() + Generating method body for zeroDigit() + Generating method body for scientificPattern() + Generating method body for decimalSeparator() + Generating method body for notANumber() + Generating method body for minusSign() + Generating method body for infinity() + Generating method body for exponentialSymbol() + Generating method body for plusSign() + Generating method body for currencyPattern() + Generating method body for monetaryGroupingSeparator() + Generating method body for groupingSeparator() + Generating method body for perMill() + Generating method body for monetarySeparator() + Generating method body for decimalPattern() + Generating method body for percent() + Generating method body for defCurrencyCode() + Adding '3' new generated units + Removing invalidated units +Rebinding com.google.gwt.resources.client.CommonResources.Bundle + Adding '1' new generated units + Removing invalidated units +Module location: file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Removing invalidated units +Finding entry point classes +Rebinding com.google.gwt.i18n.client.impl.LocaleInfoImpl + Invoking generator com.google.gwt.i18n.rebind.LocaleInfoGenerator + Processing interface com.google.gwt.i18n.client.constants.NumberConstantsImpl + Generating method body for percentPattern() + Generating method body for zeroDigit() + Generating method body for scientificPattern() + Generating method body for decimalSeparator() + Generating method body for notANumber() + Generating method body for minusSign() + Generating method body for infinity() + Generating method body for exponentialSymbol() + Generating method body for plusSign() + Generating method body for currencyPattern() + Generating method body for monetaryGroupingSeparator() + Generating method body for groupingSeparator() + Generating method body for perMill() + Generating method body for monetarySeparator() + Generating method body for decimalPattern() + Generating method body for percent() + Generating method body for defCurrencyCode() + Adding '3' new generated units + Removing invalidated units +Module location: file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Removing invalidated units +Finding entry point classes +Rebinding com.google.gwt.i18n.client.impl.LocaleInfoImpl + Invoking generator com.google.gwt.i18n.rebind.LocaleInfoGenerator + Processing interface com.google.gwt.i18n.client.constants.NumberConstantsImpl + Generating method body for percentPattern() + Generating method body for zeroDigit() + Generating method body for scientificPattern() + Generating method body for decimalSeparator() + Generating method body for notANumber() + Generating method body for minusSign() + Generating method body for infinity() + Generating method body for exponentialSymbol() + Generating method body for plusSign() + Generating method body for currencyPattern() + Generating method body for monetaryGroupingSeparator() + Generating method body for groupingSeparator() + Generating method body for perMill() + Generating method body for monetarySeparator() + Generating method body for decimalPattern() + Generating method body for percent() + Generating method body for defCurrencyCode() + Adding '3' new generated units + Removing invalidated units +Module location: file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Validating newly compiled units + [ERROR] Errors in 'file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/client/PubnubExample.java' + [ERROR] Line 294: Duplicate local variable lbl + [ERROR] Line 298: CheckBox cannot be resolved to a type + [ERROR] Line 302: Syntax error, insert ";" to complete LocalVariableDeclarationStatement + [ERROR] Line 302: btn cannot be resolved + [ERROR] Line 303: btn cannot be resolved + [ERROR] Line 304: btn cannot be resolved + [ERROR] Line 315: btn cannot be resolved +Removing invalidated units +Finding entry point classes + [ERROR] Unable to find type 'com.pubnub.gwt.examples.client.PubnubExample' + [ERROR] Hint: Previous compiler errors may have made this type unavailable + [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly +Module location: file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Validating newly compiled units + [ERROR] Errors in 'file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/client/PubnubExample.java' + [ERROR] Line 294: Duplicate local variable lbl + [ERROR] Line 298: CheckBox cannot be resolved to a type + [ERROR] Line 302: Syntax error, insert ";" to complete LocalVariableDeclarationStatement + [ERROR] Line 302: btn cannot be resolved + [ERROR] Line 303: btn cannot be resolved + [ERROR] Line 304: btn cannot be resolved + [ERROR] Line 315: btn cannot be resolved +Removing invalidated units +Finding entry point classes + [ERROR] Unable to find type 'com.pubnub.gwt.examples.client.PubnubExample' + [ERROR] Hint: Previous compiler errors may have made this type unavailable + [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly +Module location: file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Removing invalidated units +Finding entry point classes +Rebinding com.google.gwt.i18n.client.impl.LocaleInfoImpl + Invoking generator com.google.gwt.i18n.rebind.LocaleInfoGenerator + Processing interface com.google.gwt.i18n.client.constants.NumberConstantsImpl + Generating method body for percentPattern() + Generating method body for zeroDigit() + Generating method body for scientificPattern() + Generating method body for decimalSeparator() + Generating method body for notANumber() + Generating method body for minusSign() + Generating method body for infinity() + Generating method body for exponentialSymbol() + Generating method body for plusSign() + Generating method body for currencyPattern() + Generating method body for monetaryGroupingSeparator() + Generating method body for groupingSeparator() + Generating method body for perMill() + Generating method body for monetarySeparator() + Generating method body for decimalPattern() + Generating method body for percent() + Generating method body for defCurrencyCode() + Adding '3' new generated units + Removing invalidated units +Module location: file:/home/workpn/workspace/PubnubExample/src/com/pubnub/gwt/examples/PublishExample.gwt.xml +Loading inherited module 'com.google.gwt.user.User' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/User.gwt.xml + Loading inherited module 'com.google.gwt.canvas.Canvas' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/Canvas.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.canvas.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/canvas/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/Core.gwt.xml + Loading inherited module 'com.google.gwt.dev.jjs.intrinsic.Intrinsic' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/dev/jjs/intrinsic/Intrinsic.gwt.xml + Loading inherited module 'com.google.gwt.lang.LongLib' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-dev.jar!/com/google/gwt/lang/LongLib.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/Emulation.gwt.xml + Loading inherited module 'com.google.gwt.logging.LogImpl' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/logging/LogImpl.gwt.xml + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/xhr/XMLHttpRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CompilerParameters' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CompilerParameters.gwt.xml + Loading inherited module 'com.google.gwt.core.EmulateJsStack' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/EmulateJsStack.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.AsyncFragmentLoader' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/AsyncFragmentLoader.gwt.xml + Loading inherited module 'com.google.gwt.core.XSLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/XSLinker.gwt.xml + Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CrossSiteIframeLinker.gwt.xml + Loading inherited module 'com.google.gwt.user.UserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/UserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.EmulationWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/emul/EmulationWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.emul.Emulation' + Module 'com.google.gwt.emul.Emulation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.CoreWithUserAgent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/core/CoreWithUserAgent.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/text/Text.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/EventBase.gwt.xml + Loading inherited module 'com.google.web.bindery.event.Event' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/web/bindery/event/Event.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.DomEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/DomEvent.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.dom.TouchEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/dom/TouchEvent.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.event.logical.LogicalEvent' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/event/logical/LogicalEvent.gwt.xml + Loading inherited module 'com.google.gwt.event.EventBase' + Module 'com.google.gwt.event.EventBase' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/animation/Animation.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/editor/Editor.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'javax.validation.Validation' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/javax/validation/Validation.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/resources/Resources.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.http.HTTP' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/http/HTTP.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.jsonp.Jsonp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/jsonp/Jsonp.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.layout.Layout' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/layout/Layout.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.animation.Animation' + Module 'com.google.gwt.animation.Animation' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.Media' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/Media.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.media.dom.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/media/dom/DOM.gwt.xml + Loading inherited module 'com.google.gwt.touch.Touch' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/touch/Touch.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.uibinder.UiBinder' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/uibinder/UiBinder.gwt.xml + Loading inherited module 'com.google.gwt.resources.Resources' + Module 'com.google.gwt.resources.Resources' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.AsyncProxy' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/AsyncProxy.gwt.xml + Loading inherited module 'com.google.gwt.user.RemoteService' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RemoteService.gwt.xml + Loading inherited module 'com.google.gwt.http.HTTP' + Module 'com.google.gwt.http.HTTP' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DocumentRoot' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DocumentRoot.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.DOM' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/DOM.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Window.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.HTTPRequest' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/HTTPRequest.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.xhr.XMLHttpRequest' + Module 'com.google.gwt.xhr.XMLHttpRequest' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.History' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/History.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.i18n.I18N' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/i18n/I18N.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/regexp/RegExp.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safehtml/SafeHtml.gwt.xml + Loading inherited module 'com.google.gwt.regexp.RegExp' + Module 'com.google.gwt.regexp.RegExp' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Popup' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Popup.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Form' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Form.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.TextBox' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/TextBox.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Focus' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Focus.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ImageBundle' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ImageBundle.gwt.xml + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ClippedImage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ClippedImage' + Module 'com.google.gwt.user.ClippedImage' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.RichText' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/RichText.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.SplitPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/SplitPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.CaptionPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/CaptionPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Window' + Module 'com.google.gwt.user.Window' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Tree' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Tree.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.Hyperlink' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/Hyperlink.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.FileUpload' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/FileUpload.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ResizeLayoutPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ResizeLayoutPanel.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.ScrollPanel' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/ScrollPanel.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.datepicker.DatePicker' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/datepicker/DatePicker.gwt.xml + Loading inherited module 'com.google.gwt.user.cellview.CellView' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/cellview/CellView.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.cell.Cell' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/cell/Cell.gwt.xml + Loading inherited module 'com.google.gwt.dom.DOM' + Module 'com.google.gwt.dom.DOM' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.text.Text' + Module 'com.google.gwt.text.Text' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.editor.Editor' + Module 'com.google.gwt.editor.Editor' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.view.View' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/view/View.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.safecss.SafeCss' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/safecss/SafeCss.gwt.xml + Loading inherited module 'com.google.gwt.safehtml.SafeHtml' + Module 'com.google.gwt.safehtml.SafeHtml' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.storage.Storage' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/storage/Storage.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.user.UserAgent' + Module 'com.google.gwt.user.UserAgent' has already been loaded and will be skipped +Loading inherited module 'com.google.gwt.user.theme.clean.Clean' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/user/theme/clean/Clean.gwt.xml +Loading inherited module 'com.pubnub.gwt.api.Pubnub' + Module location: jar:file:/home/workpn/Desktop/PubnubGwt.jar!/com/pubnub/gwt/api/Pubnub.gwt.xml + Loading inherited module 'com.google.gwt.user.User' + Module 'com.google.gwt.user.User' has already been loaded and will be skipped + Loading inherited module 'com.google.gwt.json.JSON' + Module location: jar:file:/usr/local/eclipse3.6_helios/plugins/com.google.gwt.eclipse.sdkbundle_2.3.0.r36v201105191508/gwt-2.3.0/gwt-user.jar!/com/google/gwt/json/JSON.gwt.xml + Loading inherited module 'com.google.gwt.core.Core' + Module 'com.google.gwt.core.Core' has already been loaded and will be skipped +Public resources found in... +Translatable source found in... +Removing invalidated units +Finding entry point classes +Rebinding com.google.gwt.i18n.client.impl.LocaleInfoImpl + Invoking generator com.google.gwt.i18n.rebind.LocaleInfoGenerator + Processing interface com.google.gwt.i18n.client.constants.NumberConstantsImpl + Generating method body for percentPattern() + Generating method body for zeroDigit() + Generating method body for scientificPattern() + Generating method body for decimalSeparator() + Generating method body for notANumber() + Generating method body for minusSign() + Generating method body for infinity() + Generating method body for exponentialSymbol() + Generating method body for plusSign() + Generating method body for currencyPattern() + Generating method body for monetaryGroupingSeparator() + Generating method body for groupingSeparator() + Generating method body for perMill() + Generating method body for monetarySeparator() + Generating method body for decimalPattern() + Generating method body for percent() + Generating method body for defCurrencyCode() + Adding '3' new generated units + Removing invalidated units diff --git a/gwt/3.3/examples/PubnubExample/build.xml b/gwt/3.3/examples/PubnubExample/build.xml new file mode 100644 index 000000000..70452ccb2 --- /dev/null +++ b/gwt/3.3/examples/PubnubExample/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gwt/3.3/examples/PubnubExample/pubnubexample.war b/gwt/3.3/examples/PubnubExample/pubnubexample.war new file mode 100644 index 000000000..5648d4f6f Binary files /dev/null and b/gwt/3.3/examples/PubnubExample/pubnubexample.war differ diff --git a/gwt/3.3/examples/PubnubExample/src/com/pubnub/gwt/examples/PubnubExample.gwt.xml b/gwt/3.3/examples/PubnubExample/src/com/pubnub/gwt/examples/PubnubExample.gwt.xml new file mode 100644 index 000000000..dce555208 --- /dev/null +++ b/gwt/3.3/examples/PubnubExample/src/com/pubnub/gwt/examples/PubnubExample.gwt.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/gwt/3.3/examples/PubnubExample/war/WEB-INF/classes/com/pubnub/gwt/examples/PublishExample.gwt.xml b/gwt/3.3/examples/PubnubExample/war/WEB-INF/classes/com/pubnub/gwt/examples/PublishExample.gwt.xml new file mode 100644 index 000000000..1585465c7 --- /dev/null +++ b/gwt/3.3/examples/PubnubExample/war/WEB-INF/classes/com/pubnub/gwt/examples/PublishExample.gwt.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + ', backslash:'\\\\', ei: {quotes: '\"\\''},eo: {a: '\"quoted\"', b:\"don't\"}, quotes: [\"'\", '\"']}"); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = new JSONObject( + "{foo: [true, false,9876543210, 0.0, 1.00000001, 1.000000000001, 1.00000000000000001," + + " .00000000000000001, 2.00, 0.1, 2e100, -32,[],{}, \"string\"], " + + " to : null, op : 'Good'," + + "ten:10} postfix comment"); + j.put("String", "98.6"); + j.put("JSONObject", new JSONObject()); + j.put("JSONArray", new JSONArray()); + j.put("int", 57); + j.put("double", 123456789012345678901234567890.); + j.put("true", true); + j.put("false", false); + j.put("null", JSONObject.NULL); + j.put("bool", "true"); + j.put("zero", -0.0); + j.put("\\u2028", "\u2028"); + j.put("\\u2029", "\u2029"); + a = j.getJSONArray("foo"); + a.put(666); + a.put(2001.99); + a.put("so \"fine\"."); + a.put("so ."); + a.put(true); + a.put(false); + a.put(new JSONArray()); + a.put(new JSONObject()); + j.put("keys", JSONObject.getNames(j)); + System.out.println(j.toString(4)); + System.out.println(XML.toString(j)); + + System.out.println("String: " + j.getDouble("String")); + System.out.println(" bool: " + j.getBoolean("bool")); + System.out.println(" to: " + j.getString("to")); + System.out.println(" true: " + j.getString("true")); + System.out.println(" foo: " + j.getJSONArray("foo")); + System.out.println(" op: " + j.getString("op")); + System.out.println(" ten: " + j.getInt("ten")); + System.out.println(" oops: " + j.optBoolean("oops")); + + s = "First \u0009<content> This is \"content\". 3 JSON does not preserve the sequencing of elements and contents. III T H R E EContent text is an implied structure in XML. JSON does not have implied structure:7everything is explicit.!]]>"; + j = XML.toJSONObject(s); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + ja = JSONML.toJSONArray(s); + System.out.println(ja.toString(4)); + System.out.println(JSONML.toString(ja)); + System.out.println(""); + + s = "unodostrestruequatrocinqoseis"; + ja = JSONML.toJSONArray(s); + System.out.println(ja.toString(4)); + System.out.println(JSONML.toString(ja)); + System.out.println(""); + + s = " "; + j = XML.toJSONObject(s); + + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + ja = JSONML.toJSONArray(s); + System.out.println(ja.toString(4)); + System.out.println(JSONML.toString(ja)); + System.out.println(""); + + j = XML.toJSONObject("Sample BookThis is chapter 1. It is not very long or interesting.This is chapter 2. Although it is longer than chapter 1, it is not any more interesting."); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = XML.toJSONObject(""); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = XML.toJSONObject(" Fred fbs0001 Scerbo B "); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = XML.toJSONObject("Repository Address Special Collections LibraryABC UniversityMain Library, 40 Circle DriveOurtown, Pennsylvania17654 USA"); + System.out.println(j.toString()); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = XML.toJSONObject("deluxe&"toot"&toot;Aeksbonusbonus2"); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = HTTP.toJSONObject("GET / HTTP/1.0\nAccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\nAccept-Language: en-us\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461)\nHost: www.nokko.com\nConnection: keep-alive\nAccept-encoding: gzip, deflate\n"); + System.out.println(j.toString(2)); + System.out.println(HTTP.toString(j)); + System.out.println(""); + + j = HTTP.toJSONObject("HTTP/1.1 200 Oki Doki\nDate: Sun, 26 May 2002 17:38:52 GMT\nServer: Apache/1.3.23 (Unix) mod_perl/1.26\nKeep-Alive: timeout=15, max=100\nConnection: Keep-Alive\nTransfer-Encoding: chunked\nContent-Type: text/html\n"); + System.out.println(j.toString(2)); + System.out.println(HTTP.toString(j)); + System.out.println(""); + + j = new JSONObject("{nix: null, nux: false, null: 'null', 'Request-URI': '/', Method: 'GET', 'HTTP-Version': 'HTTP/1.0'}"); + System.out.println(j.toString(2)); + System.out.println("isNull: " + j.isNull("nix")); + System.out.println(" has: " + j.has("nix")); + System.out.println(XML.toString(j)); + System.out.println(HTTP.toString(j)); + System.out.println(""); + + j = XML.toJSONObject(""+"\n\n"+""+ + ""+ + "GOOGLEKEY '+search+' 0 10 true false latin1 latin1"+ + ""+ + ""); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = new JSONObject("{Envelope: {Body: {\"ns1:doGoogleSearch\": {oe: \"latin1\", filter: true, q: \"'+search+'\", key: \"GOOGLEKEY\", maxResults: 10, \"SOAP-ENV:encodingStyle\": \"http://schemas.xmlsoap.org/soap/encoding/\", start: 0, ie: \"latin1\", safeSearch:false, \"xmlns:ns1\": \"urn:GoogleSearch\"}}}}"); + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + + j = CookieList.toJSONObject(" f%oo = b+l=ah ; o;n%40e = t.wo "); + System.out.println(j.toString(2)); + System.out.println(CookieList.toString(j)); + System.out.println(""); + + j = Cookie.toJSONObject("f%oo=blah; secure ;expires = April 24, 2002"); + System.out.println(j.toString(2)); + System.out.println(Cookie.toString(j)); + System.out.println(""); + + j = new JSONObject("{script: 'It is not allowed in HTML to send a close script tag in a stringso we insert a backslash before the /'}"); + System.out.println(j.toString()); + System.out.println(""); + + JSONTokener jt = new JSONTokener("{op:'test', to:'session', pre:1}{op:'test', to:'session', pre:2}"); + j = new JSONObject(jt); + System.out.println(j.toString()); + System.out.println("pre: " + j.optInt("pre")); + int i = jt.skipTo('{'); + System.out.println(i); + j = new JSONObject(jt); + System.out.println(j.toString()); + System.out.println(""); + + a = CDL.toJSONArray("Comma delimited list test, '\"Strip\"Quotes', 'quote, comma', No quotes, 'Single Quotes', \"Double Quotes\"\n1,'2',\"3\"\n,'It is \"good,\"', \"It works.\"\n\n"); + + s = CDL.toString(a); + System.out.println(s); + System.out.println(""); + System.out.println(a.toString(4)); + System.out.println(""); + a = CDL.toJSONArray(s); + System.out.println(a.toString(4)); + System.out.println(""); + + a = new JSONArray(" [\"\", next is an implied null , , ok,] "); + System.out.println(a.toString()); + System.out.println(""); + System.out.println(XML.toString(a)); + System.out.println(""); + + j = new JSONObject("{ fun => with non-standard forms ; forgiving => This package can be used to parse formats that are similar to but not stricting conforming to JSON; why=To make it easier to migrate existing data to JSON,one = [[1.00]]; uno=[[{1=>1}]];'+':+6e66 ;pluses=+++;empty = '' , 'double':0.666,true: TRUE, false: FALSE, null=NULL;[true] = [[!,@;*]]; string=> o. k. ; \r oct=0666; hex=0x666; dec=666; o=0999; noh=0x0x}"); + System.out.println(j.toString(4)); + System.out.println(""); + if (j.getBoolean("true") && !j.getBoolean("false")) { + System.out.println("It's all good"); + } + + System.out.println(""); + j = new JSONObject(j, new String[] {"dec", "oct", "hex", "missing"}); + System.out.println(j.toString(4)); + + System.out.println(""); + System.out.println(new JSONStringer().array().value(a).value(j).endArray()); + + j = new JSONObject("{string: \"98.6\", long: 2147483648, int: 2147483647, longer: 9223372036854775807, double: 9223372036854775808}"); + System.out.println(j.toString(4)); + + System.out.println("\ngetInt"); + System.out.println("int " + j.getInt("int")); + System.out.println("long " + j.getInt("long")); + System.out.println("longer " + j.getInt("longer")); + //System.out.println("double " + j.getInt("double")); + //System.out.println("string " + j.getInt("string")); + + System.out.println("\ngetLong"); + System.out.println("int " + j.getLong("int")); + System.out.println("long " + j.getLong("long")); + System.out.println("longer " + j.getLong("longer")); + //System.out.println("double " + j.getLong("double")); + //System.out.println("string " + j.getLong("string")); + + System.out.println("\ngetDouble"); + System.out.println("int " + j.getDouble("int")); + System.out.println("long " + j.getDouble("long")); + System.out.println("longer " + j.getDouble("longer")); + System.out.println("double " + j.getDouble("double")); + System.out.println("string " + j.getDouble("string")); + + j.put("good sized", 9223372036854775807L); + System.out.println(j.toString(4)); + + a = new JSONArray("[2147483647, 2147483648, 9223372036854775807, 9223372036854775808]"); + System.out.println(a.toString(4)); + + System.out.println("\nKeys: "); + it = j.keys(); + while (it.hasNext()) { + s = (String)it.next(); + System.out.println(s + ": " + j.getString(s)); + } + + + System.out.println("\naccumulate: "); + j = new JSONObject(); + j.accumulate("stooge", "Curly"); + j.accumulate("stooge", "Larry"); + j.accumulate("stooge", "Moe"); + a = j.getJSONArray("stooge"); + a.put(5, "Shemp"); + System.out.println(j.toString(4)); + + System.out.println("\nwrite:"); + System.out.println(j.write(new StringWriter())); + + s = "122333"; + j = XML.toJSONObject(s); + System.out.println(j.toString(4)); + System.out.println(XML.toString(j)); + + s = "Content of the first chapterContent of the second chapter Content of the first subchapter Content of the second subchapterThird Chapter"; + j = XML.toJSONObject(s); + System.out.println(j.toString(4)); + System.out.println(XML.toString(j)); + + a = JSONML.toJSONArray(s); + System.out.println(a.toString(4)); + System.out.println(JSONML.toString(a)); + + Collection c = null; + Map m = null; + + j = new JSONObject(m); + a = new JSONArray(c); + j.append("stooge", "Joe DeRita"); + j.append("stooge", "Shemp"); + j.accumulate("stooges", "Curly"); + j.accumulate("stooges", "Larry"); + j.accumulate("stooges", "Moe"); + j.accumulate("stoogearray", j.get("stooges")); + j.put("map", m); + j.put("collection", c); + j.put("array", a); + a.put(m); + a.put(c); + System.out.println(j.toString(4)); + + s = "{plist=Apple; AnimalSmells = { pig = piggish; lamb = lambish; worm = wormy; }; AnimalSounds = { pig = oink; lamb = baa; worm = baa; Lisa = \"Why is the worm talking like a lamb?\" } ; AnimalColors = { pig = pink; lamb = black; worm = pink; } } "; + j = new JSONObject(s); + System.out.println(j.toString(4)); + + s = " (\"San Francisco\", \"New York\", \"Seoul\", \"London\", \"Seattle\", \"Shanghai\")"; + a = new JSONArray(s); + System.out.println(a.toString()); + + s = "The content of b and The content of cdoremi"; + j = XML.toJSONObject(s); + + System.out.println(j.toString(2)); + System.out.println(XML.toString(j)); + System.out.println(""); + ja = JSONML.toJSONArray(s); + System.out.println(ja.toString(4)); + System.out.println(JSONML.toString(ja)); + System.out.println(""); + + s = "111111111111111"; + j = JSONML.toJSONObject(s); + System.out.println(j); + ja = JSONML.toJSONArray(s); + System.out.println(ja); + + + System.out.println("\nTesting Exceptions: "); + + System.out.print("Exception: "); + try { + a = new JSONArray("[\n\r\n\r}"); + System.out.println(a.toString()); + } catch (Exception e) { + System.out.println(e); + } + + System.out.print("Exception: "); + try { + a = new JSONArray("<\n\r\n\r "); + System.out.println(a.toString()); + } catch (Exception e) { + System.out.println(e); + } + + System.out.print("Exception: "); + try { + a = new JSONArray(); + a.put(Double.NEGATIVE_INFINITY); + a.put(Double.NaN); + System.out.println(a.toString()); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + System.out.println(j.getDouble("stooge")); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + System.out.println(j.getDouble("howard")); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + System.out.println(j.put(null, "howard")); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + System.out.println(a.getDouble(0)); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + System.out.println(a.get(-1)); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + System.out.println(a.put(Double.NaN)); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + j = XML.toJSONObject(" "); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + j = XML.toJSONObject(" "); + } catch (Exception e) { + System.out.println(e); + } + System.out.print("Exception: "); + try { + j = XML.toJSONObject("'. */ + public static final Character GT = new Character('>'); + + /** The Character '<'. */ + public static final Character LT = new Character('<'); + + /** The Character '?'. */ + public static final Character QUEST = new Character('?'); + + /** The Character '"'. */ + public static final Character QUOT = new Character('"'); + + /** The Character '/'. */ + public static final Character SLASH = new Character('/'); + + /** + * Replace special characters with XML escapes: + *
+     * & (ampersand) is replaced by &amp;
+     * < (less than) is replaced by &lt;
+     * > (greater than) is replaced by &gt;
+     * " (double quote) is replaced by &quot;
+     * 
+ * @param string The string to be escaped. + * @return The escaped string. + */ + public static String escape(String string) { + StringBuffer sb = new StringBuffer(); + for (int i = 0, len = string.length(); i < len; i++) { + char c = string.charAt(i); + switch (c) { + case '&': + sb.append("&"); + break; + case '<': + sb.append("<"); + break; + case '>': + sb.append(">"); + break; + case '"': + sb.append("""); + break; + default: + sb.append(c); + } + } + return sb.toString(); + } + + /** + * Throw an exception if the string contains whitespace. + * Whitespace is not allowed in tagNames and attributes. + * @param string + * @throws JSONException + */ + public static void noSpace(String string) throws JSONException { + int i, length = string.length(); + if (length == 0) { + throw new JSONException("Empty string."); + } + for (i = 0; i < length; i += 1) { + if (Character.isWhitespace(string.charAt(i))) { + throw new JSONException("'" + string + + "' contains a space character."); + } + } + } + + /** + * Scan the content following the named tag, attaching it to the context. + * @param x The XMLTokener containing the source string. + * @param context The JSONObject that will include the new material. + * @param name The tag name. + * @return true if the close tag is processed. + * @throws JSONException + */ + private static boolean parse(XMLTokener x, JSONObject context, + String name) throws JSONException { + char c; + int i; + String n; + JSONObject o = null; + String s; + Object t; + +// Test for and skip past these forms: +// +// +// +// +// Report errors for these forms: +// <> +// <= +// << + + t = x.nextToken(); + +// "); + return false; + } + x.back(); + } else if (c == '[') { + t = x.nextToken(); + if (t.equals("CDATA")) { + if (x.next() == '[') { + s = x.nextCDATA(); + if (s.length() > 0) { + context.accumulate("content", s); + } + return false; + } + } + throw x.syntaxError("Expected 'CDATA['"); + } + i = 1; + do { + t = x.nextMeta(); + if (t == null) { + throw x.syntaxError("Missing '>' after ' 0); + return false; + } else if (t == QUEST) { + +// "); + return false; + } else if (t == SLASH) { + +// Close tag + + } else if (t == SLASH) { + if (x.nextToken() != GT) { + throw x.syntaxError("Misshaped tag"); + } + if (o.length() > 0) { + context.accumulate(n, o); + } else { + context.accumulate(n, ""); + } + return false; + +// Content, between <...> and + + } else if (t == GT) { + for (;;) { + t = x.nextContent(); + if (t == null) { + if (n != null) { + throw x.syntaxError("Unclosed tag " + n); + } + return false; + } else if (t instanceof String) { + s = (String)t; + if (s.length() > 0) { + o.accumulate("content", JSONObject.stringToValue(s)); + } + +// Nested element + + } else if (t == LT) { + if (parse(x, o, n)) { + if (o.length() == 0) { + context.accumulate(n, ""); + } else if (o.length() == 1 && + o.opt("content") != null) { + context.accumulate(n, o.opt("content")); + } else { + context.accumulate(n, o); + } + return false; + } + } + } + } else { + throw x.syntaxError("Misshaped tag"); + } + } + } + } + + + /** + * Convert a well-formed (but not necessarily valid) XML string into a + * JSONObject. Some information may be lost in this transformation + * because JSON is a data format and XML is a document format. XML uses + * elements, attributes, and content text, while JSON uses unordered + * collections of name/value pairs and arrays of values. JSON does not + * does not like to distinguish between elements and attributes. + * Sequences of similar elements are represented as JSONArrays. Content + * text may be placed in a "content" member. Comments, prologs, DTDs, and + * <[ [ ]]> are ignored. + * @param string The source string. + * @return A JSONObject containing the structured data from the XML string. + * @throws JSONException + */ + public static JSONObject toJSONObject(String string) throws JSONException { + JSONObject o = new JSONObject(); + XMLTokener x = new XMLTokener(string); + while (x.more() && x.skipPast("<")) { + parse(x, o, null); + } + return o; + } + + + /** + * Convert a JSONObject into a well-formed, element-normal XML string. + * @param o A JSONObject. + * @return A string. + * @throws JSONException + */ + public static String toString(Object o) throws JSONException { + return toString(o, null); + } + + + /** + * Convert a JSONObject into a well-formed, element-normal XML string. + * @param o A JSONObject. + * @param tagName The optional name of the enclosing tag. + * @return A string. + * @throws JSONException + */ + public static String toString(Object o, String tagName) + throws JSONException { + StringBuffer b = new StringBuffer(); + int i; + JSONArray ja; + JSONObject jo; + String k; + Iterator keys; + int len; + String s; + Object v; + if (o instanceof JSONObject) { + +// Emit + + if (tagName != null) { + b.append('<'); + b.append(tagName); + b.append('>'); + } + +// Loop thru the keys. + + jo = (JSONObject)o; + keys = jo.keys(); + while (keys.hasNext()) { + k = keys.next().toString(); + v = jo.opt(k); + if (v == null) { + v = ""; + } + if (v instanceof String) { + s = (String)v; + } else { + s = null; + } + +// Emit content in body + + if (k.equals("content")) { + if (v instanceof JSONArray) { + ja = (JSONArray)v; + len = ja.length(); + for (i = 0; i < len; i += 1) { + if (i > 0) { + b.append('\n'); + } + b.append(escape(ja.get(i).toString())); + } + } else { + b.append(escape(v.toString())); + } + +// Emit an array of similar keys + + } else if (v instanceof JSONArray) { + ja = (JSONArray)v; + len = ja.length(); + for (i = 0; i < len; i += 1) { + v = ja.get(i); + if (v instanceof JSONArray) { + b.append('<'); + b.append(k); + b.append('>'); + b.append(toString(v)); + b.append("'); + } else { + b.append(toString(v, k)); + } + } + } else if (v.equals("")) { + b.append('<'); + b.append(k); + b.append("/>"); + +// Emit a new tag + + } else { + b.append(toString(v, k)); + } + } + if (tagName != null) { + +// Emit the close tag + + b.append("'); + } + return b.toString(); + +// XML does not have good support for arrays. If an array appears in a place +// where XML is lacking, synthesize an element. + + } else if (o instanceof JSONArray) { + ja = (JSONArray)o; + len = ja.length(); + for (i = 0; i < len; ++i) { + v = ja.opt(i); + b.append(toString(v, (tagName == null) ? "array" : tagName)); + } + return b.toString(); + } else { + s = (o == null) ? "null" : escape(o.toString()); + return (tagName == null) ? "\"" + s + "\"" : + (s.length() == 0) ? "<" + tagName + "/>" : + "<" + tagName + ">" + s + ""; + } + } +} \ No newline at end of file diff --git a/gwt/3.3/src/org/json/XMLTokener.java b/gwt/3.3/src/org/json/XMLTokener.java new file mode 100644 index 000000000..501cdad27 --- /dev/null +++ b/gwt/3.3/src/org/json/XMLTokener.java @@ -0,0 +1,365 @@ +package org.json; + +/* +Copyright (c) 2002 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +/** + * The XMLTokener extends the JSONTokener to provide additional methods + * for the parsing of XML texts. + * @author JSON.org + * @version 2010-01-30 + */ +public class XMLTokener extends JSONTokener { + + + /** The table of entity values. It initially contains Character values for + * amp, apos, gt, lt, quot. + */ + public static final java.util.HashMap entity; + + static { + entity = new java.util.HashMap(8); + entity.put("amp", XML.AMP); + entity.put("apos", XML.APOS); + entity.put("gt", XML.GT); + entity.put("lt", XML.LT); + entity.put("quot", XML.QUOT); + } + + /** + * Construct an XMLTokener from a string. + * @param s A source string. + */ + public XMLTokener(String s) { + super(s); + } + + /** + * Get the text in the CDATA block. + * @return The string up to the ]]>. + * @throws JSONException If the ]]> is not found. + */ + public String nextCDATA() throws JSONException { + char c; + int i; + StringBuffer sb = new StringBuffer(); + for (;;) { + c = next(); + if (end()) { + throw syntaxError("Unclosed CDATA"); + } + sb.append(c); + i = sb.length() - 3; + if (i >= 0 && sb.charAt(i) == ']' && + sb.charAt(i + 1) == ']' && sb.charAt(i + 2) == '>') { + sb.setLength(i); + return sb.toString(); + } + } + } + + + /** + * Get the next XML outer token, trimming whitespace. There are two kinds + * of tokens: the '<' character which begins a markup tag, and the content + * text between markup tags. + * + * @return A string, or a '<' Character, or null if there is no more + * source text. + * @throws JSONException + */ + public Object nextContent() throws JSONException { + char c; + StringBuffer sb; + do { + c = next(); + } while (Character.isWhitespace(c)); + if (c == 0) { + return null; + } + if (c == '<') { + return XML.LT; + } + sb = new StringBuffer(); + for (;;) { + if (c == '<' || c == 0) { + back(); + return sb.toString().trim(); + } + if (c == '&') { + sb.append(nextEntity(c)); + } else { + sb.append(c); + } + c = next(); + } + } + + + /** + * Return the next entity. These entities are translated to Characters: + * & ' > < ". + * @param a An ampersand character. + * @return A Character or an entity String if the entity is not recognized. + * @throws JSONException If missing ';' in XML entity. + */ + public Object nextEntity(char a) throws JSONException { + StringBuffer sb = new StringBuffer(); + for (;;) { + char c = next(); + if (Character.isLetterOrDigit(c) || c == '#') { + sb.append(Character.toLowerCase(c)); + } else if (c == ';') { + break; + } else { + throw syntaxError("Missing ';' in XML entity: &" + sb); + } + } + String s = sb.toString(); + Object e = entity.get(s); + return e != null ? e : a + s + ";"; + } + + + /** + * Returns the next XML meta token. This is used for skipping over + * and structures. + * @return Syntax characters (< > / = ! ?) are returned as + * Character, and strings and names are returned as Boolean. We don't care + * what the values actually are. + * @throws JSONException If a string is not properly closed or if the XML + * is badly structured. + */ + public Object nextMeta() throws JSONException { + char c; + char q; + do { + c = next(); + } while (Character.isWhitespace(c)); + switch (c) { + case 0: + throw syntaxError("Misshaped meta tag"); + case '<': + return XML.LT; + case '>': + return XML.GT; + case '/': + return XML.SLASH; + case '=': + return XML.EQ; + case '!': + return XML.BANG; + case '?': + return XML.QUEST; + case '"': + case '\'': + q = c; + for (;;) { + c = next(); + if (c == 0) { + throw syntaxError("Unterminated string"); + } + if (c == q) { + return Boolean.TRUE; + } + } + default: + for (;;) { + c = next(); + if (Character.isWhitespace(c)) { + return Boolean.TRUE; + } + switch (c) { + case 0: + case '<': + case '>': + case '/': + case '=': + case '!': + case '?': + case '"': + case '\'': + back(); + return Boolean.TRUE; + } + } + } + } + + + /** + * Get the next XML Token. These tokens are found inside of angle + * brackets. It may be one of these characters: / > = ! ? or it + * may be a string wrapped in single quotes or double quotes, or it may be a + * name. + * @return a String or a Character. + * @throws JSONException If the XML is not well formed. + */ + public Object nextToken() throws JSONException { + char c; + char q; + StringBuffer sb; + do { + c = next(); + } while (Character.isWhitespace(c)); + switch (c) { + case 0: + throw syntaxError("Misshaped element"); + case '<': + throw syntaxError("Misplaced '<'"); + case '>': + return XML.GT; + case '/': + return XML.SLASH; + case '=': + return XML.EQ; + case '!': + return XML.BANG; + case '?': + return XML.QUEST; + +// Quoted string + + case '"': + case '\'': + q = c; + sb = new StringBuffer(); + for (;;) { + c = next(); + if (c == 0) { + throw syntaxError("Unterminated string"); + } + if (c == q) { + return sb.toString(); + } + if (c == '&') { + sb.append(nextEntity(c)); + } else { + sb.append(c); + } + } + default: + +// Name + + sb = new StringBuffer(); + for (;;) { + sb.append(c); + c = next(); + if (Character.isWhitespace(c)) { + return sb.toString(); + } + switch (c) { + case 0: + return sb.toString(); + case '>': + case '/': + case '=': + case '!': + case '?': + case '[': + case ']': + back(); + return sb.toString(); + case '<': + case '"': + case '\'': + throw syntaxError("Bad character in a name"); + } + } + } + } + + + /** + * Skip characters until past the requested string. + * If it is not found, we are left at the end of the source with a result of false. + * @param to A string to skip past. + * @throws JSONException + */ + public boolean skipPast(String to) throws JSONException { + boolean b; + char c; + int i; + int j; + int offset = 0; + int n = to.length(); + char[] circle = new char[n]; + + /* + * First fill the circle buffer with as many characters as are in the + * to string. If we reach an early end, bail. + */ + + for (i = 0; i < n; i += 1) { + c = next(); + if (c == 0) { + return false; + } + circle[i] = c; + } + /* + * We will loop, possibly for all of the remaining characters. + */ + for (;;) { + j = offset; + b = true; + /* + * Compare the circle buffer with the to string. + */ + for (i = 0; i < n; i += 1) { + if (circle[j] != to.charAt(i)) { + b = false; + break; + } + j += 1; + if (j >= n) { + j -= n; + } + } + /* + * If we exit the loop with b intact, then victory is ours. + */ + if (b) { + return true; + } + /* + * Get the next character. If there isn't one, then defeat is ours. + */ + c = next(); + if (c == 0) { + return false; + } + /* + * Shove the character in the circle buffer and advance the + * circle offset. The offset is mod n. + */ + circle[offset] = c; + offset += 1; + if (offset >= n) { + offset -= n; + } + } + } +} diff --git a/gwt/3.3/src/pubnub/api/Callback.java b/gwt/3.3/src/pubnub/api/Callback.java new file mode 100644 index 000000000..cd7d9c97e --- /dev/null +++ b/gwt/3.3/src/pubnub/api/Callback.java @@ -0,0 +1,16 @@ +package pubnub.api; + +public interface Callback { + + public abstract boolean subscribeCallback(String channel, Object message); + + public abstract boolean presenceCallback(String channel, Object message); + + public abstract void errorCallback(String channel, Object message); + + public abstract void connectCallback(String channel); + + public abstract void reconnectCallback(String channel); + + public abstract void disconnectCallback(String channel); +} diff --git a/gwt/3.3/src/pubnub/api/Pubnub.java b/gwt/3.3/src/pubnub/api/Pubnub.java new file mode 100644 index 000000000..890d3a0d1 --- /dev/null +++ b/gwt/3.3/src/pubnub/api/Pubnub.java @@ -0,0 +1,1424 @@ +package pubnub.api; + +import com.ning.http.client.*; +import com.ning.http.client.AsyncHttpClientConfig.Builder; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.Future; +import java.util.zip.GZIPInputStream; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.security.Key; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Iterator; + +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.CipherOutputStream; +import javax.crypto.Mac; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +/** + * PubNub 3.2 Real-time Push Cloud API + * + * @author Stephen Blum 3.1 + * @author Leonardo Redmond 3.2 Revision + * @package pubnub.api + */ +public class Pubnub { + private String ORIGIN = "pubsub.pubnub.com"; + private String PUBLISH_KEY = ""; + private String SUBSCRIBE_KEY = ""; + private String SECRET_KEY = ""; + public String CIPHER_KEY = ""; + private boolean SSL = false; + private String sessionUUID = ""; + private String parameters = ""; + + private class ChannelStatus { + String channel; + boolean connected, first; + } + + private List subscriptions; + + /** + * PubNub 3.1 with Cipher Key + * + * Prepare PubNub State. + * + * @param String + * Publish Key. + * @param String + * Subscribe Key. + * @param String + * Secret Key. + * @param String + * Cipher Key. + * @param boolean SSL Enabled. + */ + public Pubnub(String publish_key, String subscribe_key, String secret_key, + String cipher_key, boolean ssl_on) { + this.init(publish_key, subscribe_key, secret_key, cipher_key, ssl_on); + } + + /** + * PubNub 3.0 + * + * Prepare PubNub Class State. + * + * @param String + * Publish Key. + * @param String + * Subscribe Key. + * @param String + * Secret Key. + * @param boolean SSL Enabled. + */ + public Pubnub(String publish_key, String subscribe_key, String secret_key, + boolean ssl_on) { + this.init(publish_key, subscribe_key, secret_key, "", ssl_on); + } + + /** + * PubNub 2.0 Compatibility + * + * Prepare PubNub Class State. + * + * @param String + * Publish Key. + * @param String + * Subscribe Key. + */ + public Pubnub(String publish_key, String subscribe_key) { + this.init(publish_key, subscribe_key, "", "", false); + } + + /** + * PubNub 3.0 without SSL + * + * Prepare PubNub Class State. + * + * @param String + * Publish Key. + * @param String + * Subscribe Key. + * @param String + * Secret Key. + */ + public Pubnub(String publish_key, String subscribe_key, String secret_key) { + this.init(publish_key, subscribe_key, secret_key, "", false); + } + + /** + * Init + * + * Prepare PubNub Class State. + * + * @param String + * Publish Key. + * @param String + * Subscribe Key. + * @param String + * Secret Key. + * @param String + * Cipher Key. + * @param boolean SSL Enabled. + */ + public void init(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on) { + this.PUBLISH_KEY = publish_key; + this.SUBSCRIBE_KEY = subscribe_key; + this.SECRET_KEY = secret_key; + this.CIPHER_KEY = cipher_key; + this.SSL = ssl_on; + + if (this.sessionUUID.equals("")) + sessionUUID = UUID.randomUUID().toString(); + // SSL On? + if (this.SSL) { + this.ORIGIN = "https://" + this.ORIGIN; + } else { + this.ORIGIN = "https://" + this.ORIGIN; + } + } + + /** + * Publish + * + * Send a message to a channel. + * + * @param String + * channel name. + * @param JSONObject + * message. + * @return JSONArray. + */ + public JSONArray publish(String channel, JSONObject message) { + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("message", message); + return publish(args); + } + + /** + * Publish + * + * Send a message to a channel. + * + * @param HashMap + * containing channel name, message. + * @return JSONArray. + */ + public JSONArray publish(HashMap args) { + + String channel = (String) args.get("channel"); + Object message = args.get("message"); + + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + if (this.CIPHER_KEY.length() > 0) { + // Encrypt Message + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + message = pc.encrypt(obj); + } else { + message = obj; + } + // System.out.println(); + } else if (message instanceof String) { + String obj = (String) message; + if (this.CIPHER_KEY.length() > 0) { + // Encrypt Message + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + try { + message = pc.encrypt(obj); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + message = obj; + } + message = "\"" + message + "\""; + + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + + if (this.CIPHER_KEY.length() > 0) { + // Encrypt Message + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + message = pc.encryptJSONArray(obj); + } else { + message = obj; + } + System.out.println(); + } + + // Generate String to Sign + String signature = "0"; + + if (this.SECRET_KEY.length() > 0) { + StringBuilder string_to_sign = new StringBuilder(); + string_to_sign.append(this.PUBLISH_KEY).append('/') + .append(this.SUBSCRIBE_KEY).append('/') + .append(this.SECRET_KEY).append('/').append(channel) + .append('/').append(message.toString()); + + // Sign Message + signature = PubnubCrypto.getHMacSHA256(this.SECRET_KEY, + string_to_sign.toString()); + } + + // Build URL + List url = new ArrayList(); + url.add("publish"); + url.add(this.PUBLISH_KEY); + url.add(this.SUBSCRIBE_KEY); + url.add(signature); + url.add(channel); + url.add("0"); + url.add(message.toString()); + + return _request(url); + } + + /** + * Subscribe + * + * Listen for a message on a channel. + * + * @param String + * channel name. + * @param Callback + * function callback. + */ + public void subscribe(String channel, Callback callback) { + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("callback", callback); + subscribe(args); + } + + /** + * Subscribe + * + * Listen for a message on a channel. + * + * @param HashMap + * containing channel name, function callback. + */ + public void subscribe(HashMap args) { + args.put("timetoken", "0"); + this._subscribe(args); + } + + /** + * Subscribe - Private Interface + * + * Patch provided by petereddy on GitHub + * + * @param HashMap + * containing channel name, function callback, + * timetoken. + */ + private void _subscribe(HashMap args) { + + String channel = (String) args.get("channel"); + String timetoken = (String) args.get("timetoken"); + Callback callback; + + // Validate Arguments + if (args.get("callback") != null) { + callback = (Callback) args.get("callback"); + } else { + System.out.println("Invalid Callback."); + return; + } + + if (channel == null || channel.equals("")) { + callback.errorCallback(channel, "Invalid Channel."); + return; + } + + // Ensure Single Connection + if (subscriptions != null && subscriptions.size() > 0) { + boolean channel_exist = false; + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + channel_exist = true; + break; + } + } + if (!channel_exist) { + ChannelStatus cs = new ChannelStatus(); + cs.channel = channel; + cs.connected = true; + subscriptions.add(cs); + } else { + callback.errorCallback(channel, "Already Connected"); + return; + } + } else { + // New Channel + ChannelStatus cs = new ChannelStatus(); + cs.channel = channel; + cs.connected = true; + subscriptions = new ArrayList(); + subscriptions.add(cs); + } + + while (true) { + try { + // Build URL + List url = java.util.Arrays.asList("subscribe", + this.SUBSCRIBE_KEY, channel, "0", timetoken); + + // Stop Connection? + boolean is_disconnect = false; + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + if (!it.connected) { + subscriptions.remove(it); + callback.disconnectCallback(channel); + is_disconnect = true; + break; + } + } + } + if (is_disconnect) + return; + + // Wait for Message + JSONArray response = _request(url); + + // Stop Connection? + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + if (!it.connected) { + subscriptions.remove(it); + callback.disconnectCallback(channel); + is_disconnect = true; + break; + } + } + } + + if (is_disconnect) + return; + + // Problem? + if (response == null || response.optInt(1) == 0) { + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + if (it.connected && it.first) { + subscriptions.remove(it); + callback.disconnectCallback(channel); + } else { + subscriptions.remove(it); + callback.errorCallback(channel, + "Lost Network Connection"); + } + } + + } + // Ensure Connected (Call Time Function) + boolean is_reconnected = false; + while (true) { + double time_token = this.time(); + if (time_token == 0.0) { + + Thread.sleep(5000); + } else { + // Reconnect Callback + callback.reconnectCallback(channel); + // this._subscribe(args); + is_reconnected = true; + break; + } + } + if (is_reconnected) { + continue; + } + } else { + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + // Connect Callback + if (!it.first) { + it.first = true; + callback.connectCallback(channel); + + break; + } + } + } + } + + JSONArray messages = response.optJSONArray(0); + + // Update TimeToken + if (response.optString(1).length() > 0) + timetoken = response.optString(1); + + for (int i = 0; messages.length() > i; i++) { + JSONObject message = messages.optJSONObject(i); + if (message != null) { + + if (this.CIPHER_KEY.length() > 0) { + // Decrypt Message + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + message = pc.decrypt(message); + } + if (callback != null) + if (!callback.subscribeCallback(channel, message)) return; + } else { + + JSONArray arr = messages.optJSONArray(i); + if (arr != null) { + if (this.CIPHER_KEY.length() > 0) { + PubnubCrypto pc = new PubnubCrypto( + this.CIPHER_KEY); + arr = pc.decryptJSONArray(arr); + ; + } + if (callback != null) + if (!callback.subscribeCallback(channel, arr)) return; + } else { + String msgs = messages.getString(0); + if (this.CIPHER_KEY.length() > 0) { + PubnubCrypto pc = new PubnubCrypto( + this.CIPHER_KEY); + msgs = pc.decrypt(msgs); + } + if (callback != null) + if (!callback.subscribeCallback(channel, msgs)) return; + } + } + } + } catch (Exception e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + } + + /** + * Presence + * + * Listen for a message on a channel & add presence info. + * + * @param String + * channel name. + * @param Callback + * function callback. + */ + public void presence(String channel, Callback callback) { + HashMap args = new HashMap(2); + args.put("channel", channel + "-pnpres"); + args.put("callback", callback); + subscribe(args); + } + + /** + * Presence + * + * Listen for a message on a channel & add presence info. + * + * @param HashMap + * containing channel name, function callback. + */ + public void presence(HashMap args) { + args.put("timetoken", "0"); + this._presence(args); + } + + /** + * Presence - Private Interface + * + * Implemented by Leonardo Redmond on GitHub + * + * @param HashMap + * containing channel name, function callback, + * timetoken. + */ + private void _presence(HashMap args) { + + String channel = (String) args.get("channel"); + String timetoken = (String) args.get("timetoken"); + Callback callback; + + // Validate Arguments + if (args.get("callback") != null) { + callback = (Callback) args.get("callback"); + } else { + System.out.println("Invalid Callback."); + return; + } + + if (channel == null || channel.equals("")) { + callback.errorCallback(channel, "Invalid Channel."); + return; + } + + // Ensure Single Connection + if (subscriptions != null && subscriptions.size() > 0) { + boolean channel_exist = false; + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + channel_exist = true; + break; + } + } + if (!channel_exist) { + ChannelStatus cs = new ChannelStatus(); + cs.channel = channel; + cs.connected = true; + subscriptions.add(cs); + } else { + callback.errorCallback(channel, "Already Connected"); + return; + } + } else { + // New Channel + ChannelStatus cs = new ChannelStatus(); + cs.channel = channel; + cs.connected = true; + subscriptions = new ArrayList(); + subscriptions.add(cs); + } + + while (true) { + try { + // Build URL + List url = java.util.Arrays.asList("subscribe", + this.SUBSCRIBE_KEY, channel, "0", timetoken); + + // Stop Connection? + boolean is_disconnect = false; + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + if (!it.connected) { + subscriptions.remove(it); + callback.disconnectCallback(channel); + is_disconnect = true; + break; + } + } + } + if (is_disconnect) + return; + + // Wait for Message + JSONArray response = _request(url); + + // Stop Connection? + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + if (!it.connected) { + subscriptions.remove(it); + callback.disconnectCallback(channel); + is_disconnect = true; + break; + } + } + } + + if (is_disconnect) + return; + + // Problem? + if (response == null || response.optInt(1) == 0) { + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + if (it.connected && it.first) { + subscriptions.remove(it); + callback.disconnectCallback(channel); + } else { + subscriptions.remove(it); + callback.errorCallback(channel, + "Lost Network Connection"); + } + } + + } + // Ensure Connected (Call Time Function) + boolean is_reconnected = false; + while (true) { + double time_token = this.time(); + if (time_token == 0.0) { + + Thread.sleep(5000); + } else { + // Reconnect Callback + callback.reconnectCallback(channel); + // this._subscribe(args); + is_reconnected = true; + break; + } + } + if (is_reconnected) { + continue; + } + } else { + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel)) { + // Connect Callback + if (!it.first) { + it.first = true; + callback.connectCallback(channel); + + break; + } + } + } + } + + JSONArray messages = response.optJSONArray(0); + + // Update TimeToken + if (response.optString(1).length() > 0) + timetoken = response.optString(1); + + for (int i = 0; messages.length() > i; i++) { + JSONObject message = messages.optJSONObject(i); + if (message != null) { + + if (this.CIPHER_KEY.length() > 0) { + // Decrypt Message + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + message = pc.decrypt(message); + } + if (callback != null) + if (!callback.presenceCallback(channel, message)) return; + } else { + + JSONArray arr = messages.optJSONArray(i); + if (arr != null) { + if (this.CIPHER_KEY.length() > 0) { + PubnubCrypto pc = new PubnubCrypto( + this.CIPHER_KEY); + arr = pc.decryptJSONArray(arr); + } + if (callback != null) + if (!callback.presenceCallback(channel, arr)) return; + } else { + String msgs = messages.getString(0); + if (this.CIPHER_KEY.length() > 0) { + PubnubCrypto pc = new PubnubCrypto( + this.CIPHER_KEY); + msgs = pc.decrypt(msgs); + } + if (callback != null) + if (!callback.presenceCallback(channel, msgs)) return; + } + } + } + } catch (Exception e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + } + + /** + * Here Now + * + * Load presence information from a channel + * + * @param String channel name. + * @return JSONObject of here_now + */ + public JSONArray here_now(String channel) { + List url = new ArrayList(); + + url.add("v2"); + url.add("presence"); + url.add("sub_key"); + url.add(this.SUBSCRIBE_KEY); + url.add("channel"); + url.add(channel); + + JSONArray response = _request(url); + + if (this.CIPHER_KEY.length() > 0) { + // Decrypt Messages + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + return pc.decryptJSONArray(response); + } else { + return response; + } + } + /** + * History + * + * Load history from a channel. + * + * @param String + * channel name. + * @param int limit history count response. + * @return JSONArray of history. + */ + public JSONArray history(String channel, int limit) { + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("limit", limit); + return history(args); + } + + /** + * History + * + * Load history from a channel. + * + * @param HashMap + * containing channel name, limit history count + * response. + * @return JSONArray of history. + */ + public JSONArray history(HashMap args) { + + String channel = (String) args.get("channel"); + int limit = Integer.parseInt(args.get("limit").toString()); + + List url = new ArrayList(); + + url.add("history"); + url.add(this.SUBSCRIBE_KEY); + url.add(channel); + url.add("0"); + url.add(Integer.toString(limit)); + + JSONArray response = _request(url); + + if (this.CIPHER_KEY.length() > 0) { + // Decrypt Messages + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + return pc.decryptJSONArray(response); + } else { + return response; + } + } + + /** + * DetailedHistory + * + * DetailedHistory from PubNub Cloud. + * + * @return JSONArray of detailed history. + */ + public JSONArray detailedHistory(String channel, long start, long end, int count, Boolean reverse) { + parameters = ""; + if (count == -1) count = 100; + if (count == -1) count = 100; + parameters = "?count=" + count; + if (reverse) + parameters = parameters + "&" + "reverse=" + reverse.toString().toLowerCase(); + if (start != -1) + parameters = parameters + "&" + "start=" + Long.toString(start).toLowerCase(); + if (end != -1) + parameters = parameters + "&" + "end=" + Long.toString(end).toLowerCase(); + + List url = new ArrayList(); + url.add("v2"); + url.add("history"); + url.add("sub-key"); + url.add(this.SUBSCRIBE_KEY); + url.add("channel"); + url.add(channel); + + JSONArray response = _request(url); + + if (this.CIPHER_KEY.length() > 0) { + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY); + try { + return pc.decryptJSONArray(response.getJSONArray(0)); + } catch (JSONException e) { + return response; + } + } else { + return response; + } + } + + public JSONArray detailedHistory(String channel, long start, boolean reverse) { + return detailedHistory(channel, start, -1, -1, reverse); + } + + public JSONArray detailedHistory(String channel, int count) { + return detailedHistory(channel, -1, -1, count, false); + } + /** + * Time + * + * Timestamp from PubNub Cloud. + * + * @return double timestamp. + */ + public double time() { + List url = new ArrayList(); + + url.add("time"); + url.add("0"); + + JSONArray response = _request(url); + + return response.optDouble(0); + } + + /** + * UUID + * + * 32 digit UUID generation at client side. + * + * @return String uuid. + */ + public static String uuid() { + UUID uuid = UUID.randomUUID(); + return uuid.toString(); + } + + /** + * Unsubscribe + * + * Unsubscribe/Disconnect to channel. + * + * @param HashMap + * containing channel name. + */ + public void unsubscribe(HashMap args) { + String channel = (String) args.get("channel"); + for (ChannelStatus it : subscriptions) { + if (it.channel.equals(channel) && it.connected) { + it.connected = false; + it.first = false; + break; + } + } + } + + /** + * Request URL + * + * @param List + * request of url directories. + * @return JSONArray from JSON response. + */ + private JSONArray _request(List url_components) { + String json = ""; + StringBuilder url = new StringBuilder(); + Iterator url_iterator = url_components.iterator(); + String request_for = url_components.get(0); + String request_type = url_components.get(1); + + url.append(this.ORIGIN); + + // Generate URL with UTF-8 Encoding + while (url_iterator.hasNext()) { + try { + String url_bit = (String) url_iterator.next(); + url.append("/").append(_encodeURIcomponent(url_bit)); + } catch (Exception e) { + // e.printStackTrace(); + JSONArray jsono = new JSONArray(); + try { + jsono.put("Failed UTF-8 Encoding URL."); + } catch (Exception jsone) { + } + return jsono; + } + } + if (request_for.equals("subscribe") || request_for.equals("presence")) + url.append("?uuid=").append(this.sessionUUID); + if (request_for.equals("v2") && request_type.equals("history")) + url.append(parameters); + + AsyncHttpClient ahc = null; + try { + // Prepare Asynchronous HTTP Request + Builder cb = new AsyncHttpClientConfig.Builder(); + cb.setRequestTimeoutInMs(310000); + AsyncHttpClientConfig config = cb.build(); + ahc = new AsyncHttpClient(config); + RequestBuilder rb = new RequestBuilder("GET"); + rb.setUrl(url.toString()); + rb.addHeader("V", "3.1"); + rb.addHeader("User-Agent", "Java"); + rb.addHeader("Accept-Encoding", "gzip"); + Request request = rb.build(); + + // Execute Request + Future f = ahc.executeRequest(request, + new AsyncCompletionHandler() { + + @Override + public String onCompleted(Response r) throws Exception { + + String ce = r.getHeader("Content-Encoding"); + InputStream resulting_is = null; + InputStream is = r.getResponseBodyAsStream(); + + if (ce != null && ce.equalsIgnoreCase("gzip")) { + // Decoding using 'gzip' + + try { + resulting_is = new GZIPInputStream(is); + } catch (IOException e) { + resulting_is = is; + } catch (Exception e) { + resulting_is = is; + } + } else { + // Default (encoding is null OR 'identity') + resulting_is = is; + } + + String line = "", json = ""; + BufferedReader reader = new BufferedReader( + new InputStreamReader(resulting_is, "UTF8")); + + // Read JSON Message + while ((line = reader.readLine()) != null) { + json += line; + } + + reader.close(); + + return json; + } + }); + json = f.get(); + ahc.close(); + + } catch (Exception e) { + + // Response If Failed JSONP HTTP Request. + JSONArray jsono = new JSONArray(); + try { + if (request_for != null) { + if (request_for.equals("time")) { + jsono.put("0"); + } else if (request_for.equals("history")) { + jsono.put("Error: Failed JSONP HTTP Request."); + } else if (request_for.equals("publish")) { + jsono.put("0"); + jsono.put("Error: Failed JSONP HTTP Request."); + } else if (request_for.equals("subscribe")) { + jsono.put("0"); + jsono.put("0"); + } + } + } catch (Exception jsone) { + } + + if (ahc != null) { + ahc.close(); + } + return jsono; + } + + // Parse JSON String + try { + if (json.contains("uuids")) { + JSONArray resp = new JSONArray(); + resp.put(json); + return resp; + } + return new JSONArray(json); + } catch (Exception e) { + JSONArray jsono = new JSONArray(); + + try { + jsono.put("Error: Failed JSON Parsing."); + } catch (Exception jsone) { + } + + // Return Failure to Parse + return jsono; + } + } + + private String _encodeURIcomponent(String s) { + StringBuilder o = new StringBuilder(); + for (Character ch : s.toCharArray()) { + if (isUnsafe(ch)) { + o.append('%'); + o.append(toHex(ch / 16)); + o.append(toHex(ch % 16)); + } else + o.append(encodeToUTF8(ch.toString())); + } + return o.toString(); + } + + private char toHex(int ch) { + return (char) (ch < 10 ? '0' + ch : 'A' + ch - 10); + } + + private boolean isUnsafe(char ch) { + return " ~`!@#$%^&*()+=[]\\{}|;':\",./<>?".indexOf(ch) >= 0; + } + + private String encodeToUTF8(String s) { + try { + String enc = URLEncoder.encode(s, "UTF-8").replace("+", "%20"); + return enc; + } catch (UnsupportedEncodingException e) { + + } + return s; + } + +} + +class Base64Encoder { + + // Mapping table from 6-bit nibbles to Base64 characters. + private static char[] map1 = new char[64]; + static { + int i=0; + for (char c='A'; c<='Z'; c++) map1[i++] = c; + for (char c='a'; c<='z'; c++) map1[i++] = c; + for (char c='0'; c<='9'; c++) map1[i++] = c; + map1[i++] = '+'; + map1[i++] = '/'; + } + + // Mapping table from Base64 characters to 6-bit nibbles. + private static byte[] map2 = new byte[128]; + static { + for (int i=0; iin. + * @return A character array with the Base64 encoded data. + */ + public static char[] encode (byte[] in, int iLen) { + int oDataLen = (iLen*4+2)/3; // output length without padding + int oLen = ((iLen+2)/3)*4; // output length including padding + char[] out = new char[oLen]; + int ip = 0; + int op = 0; + while (ip < iLen) { + int i0 = in[ip++] & 0xff; + int i1 = ip < iLen ? in[ip++] & 0xff : 0; + int i2 = ip < iLen ? in[ip++] & 0xff : 0; + int o0 = i0 >>> 2; + int o1 = ((i0 & 3) << 4) | (i1 >>> 4); + int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6); + int o3 = i2 & 0x3F; + out[op++] = map1[o0]; + out[op++] = map1[o1]; + out[op] = op < oDataLen ? map1[o2] : '='; + op++; + out[op] = op < oDataLen ? map1[o3] : '='; + op++; + } + return out; + } + + /** + * Decodes a string from Base64 format. + * + * @param s a Base64 String to be decoded. + * @return A String containing the decoded data. + * @throws IllegalArgumentException if the input is not valid Base64 encoded data. + */ + public static String decodeString (String s) { + return new String(decode(s)); + } + + /** + * Decodes a byte array from Base64 format. + * + * @param s a Base64 String to be decoded. + * @return An array containing the decoded data bytes. + * @throws IllegalArgumentException if the input is not valid Base64 encoded data. + */ + public static byte[] decode (String s) { + return decode(s.toCharArray()); + } + + /** + * Decodes a byte array from Base64 format. + * No blanks or line breaks are allowed within the Base64 encoded data. + * + * @param in a character array containing the Base64 encoded data. + * @return An array containing the decoded data bytes. + * @throws IllegalArgumentException if the input is not valid Base64 encoded data. + */ + public static byte[] decode (char[] in) { + int iLen = in.length; + if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4."); + while (iLen > 0 && in[iLen-1] == '=') iLen--; + int oLen = (iLen*3) / 4; + byte[] out = new byte[oLen]; + int ip = 0; + int op = 0; + while (ip < iLen) { + int i0 = in[ip++]; + int i1 = in[ip++]; + int i2 = ip < iLen ? in[ip++] : 'A'; + int i3 = ip < iLen ? in[ip++] : 'A'; + if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) + throw new IllegalArgumentException ("Illegal character in Base64 encoded data."); + int b0 = map2[i0]; + int b1 = map2[i1]; + int b2 = map2[i2]; + int b3 = map2[i3]; + if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) + throw new IllegalArgumentException ("Illegal character in Base64 encoded data."); + int o0 = ( b0 <<2) | (b1>>>4); + int o1 = ((b1 & 0xf)<<4) | (b2>>>2); + int o2 = ((b2 & 3)<<6) | b3; + out[op++] = (byte)o0; + if (op it = message.keys(); + + while (it.hasNext()) { + String key = it.next(); + String val = message.getString(key); + message_encrypted.put(key, encrypt(val)); + } + return message_encrypted; + + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Decrypt + * + * @param JSONObject Encrypted message + * @return JSONObject Message decrypted + */ + @SuppressWarnings("unchecked") + public JSONObject decrypt(JSONObject message_encrypted) { + try { + JSONObject message_decrypted = new JSONObject(); + Iterator it = message_encrypted.keys(); + + while (it.hasNext()) { + String key = it.next(); + String encrypted_str = message_encrypted.getString(key); + String decrypted_str = decrypt(encrypted_str); + message_decrypted.put(key, decrypted_str); + } + return message_decrypted; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Encrypt JSONArray + * + * @param JSONArray - Encrypted JSONArray + * @return JSONArray - Decrypted JSONArray + */ + public JSONArray encryptJSONArray(JSONArray jsona_arry) { + try { + JSONArray jsona_decrypted = new JSONArray(); + + for (int i = 0; i < jsona_arry.length(); i++) { + Object o = jsona_arry.get(i); + if (o != null) { + if (o instanceof JSONObject) { + jsona_decrypted.put(i, encrypt((JSONObject)o)); + } else if (o instanceof JSONArray) { + jsona_decrypted.put(i, encryptJSONArray((JSONArray)o)); + } else if (o instanceof String) { + jsona_decrypted.put(i, encrypt(o.toString())); + } + } + } + + return jsona_decrypted; + + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Decrypt JSONArray + * + * @param JSONArray - Encrypted JSONArray + * @return JSONArray - Decrypted JSONArray + */ + public JSONArray decryptJSONArray(JSONArray jsona_encrypted) { + try { + JSONArray jsona_decrypted = new JSONArray(); + + for (int i = 0; i < jsona_encrypted.length(); i++) { + Object o = jsona_encrypted.get(i); + if (o != null) { + if (o instanceof JSONObject) { + jsona_decrypted.put(i, decrypt((JSONObject)o)); + } else if (o instanceof JSONArray) { + jsona_decrypted.put(i, decryptJSONArray((JSONArray)o)); + } else if (o instanceof String) { + jsona_decrypted.put(i, decrypt(o.toString())); + } + } + } + + return jsona_decrypted; + + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Encrypt + * + * @param String plain text to encrypt + * @return String cipher text + * @throws Exception + */ + public String encrypt(String plain_text) throws Exception { + byte[] out = transform(true, plain_text.getBytes()); + return new String(Base64Encoder.encode(out)); + } + + /** + * Decrypt + * + * @param String cipherText + * @return String + * @throws Exception + */ + public String decrypt(String cipher_text) throws Exception { + byte[] out = transform(false, Base64Encoder.decode(cipher_text)); + return new String(out).trim(); + } + + /** + * AES Encryption + * + * @param boolean encrypt_or_decrypt ENCRYPT/DECRYPT mode + * @param ByteArray input_bytes + * @return ByteArray + * @throws Exception + */ + private byte[] transform(boolean encrypt_or_decrypt, byte[] input_bytes) throws Exception { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] iv_bytes = "0123456789012345".getBytes(); + byte[] key_bytes = md5(this.CIPHER_KEY); + + SecretKeySpec key = new SecretKeySpec(key_bytes, "AES"); + IvParameterSpec ivSpec = new IvParameterSpec(iv_bytes); + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + + if (encrypt_or_decrypt) { + cipher.init(Cipher.ENCRYPT_MODE, key, ivSpec); + ByteArrayInputStream b_in = new ByteArrayInputStream(input_bytes); + CipherInputStream c_in = new CipherInputStream(b_in, cipher); + int ch; + while ((ch = c_in.read()) >= 0) { + output.write(ch); + } + c_in.close(); + } else { + cipher.init(Cipher.DECRYPT_MODE, key, ivSpec); + CipherOutputStream c_out = new CipherOutputStream(output, cipher); + c_out.write(input_bytes); + c_out.close(); + } + return output.toByteArray(); + } + + /** + * Sign Message + * + * @param String input + * @return String as HashText + */ + public static String getHMacSHA256(String secret_key, String input) { + try { + Key KEY = new SecretKeySpec(input.getBytes("UTF-8"), "HmacSHA256"); + Mac sha256_HMAC = Mac.getInstance("HMACSHA256"); + + sha256_HMAC.init(KEY); + byte[] mac_data = sha256_HMAC.doFinal(secret_key.getBytes()); + + BigInteger number = new BigInteger(1, mac_data); + String hashtext = number.toString(16); + + return hashtext; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + /** + * Get MD5 + * @param string + * @return + */ + public static byte[] md5(String string) { + byte[] hash; + + try { + hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8")); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("MD5 should be supported!", e); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("UTF-8 should be supported!", e); + } + + StringBuilder hex = new StringBuilder(hash.length * 2); + for (byte b : hash) { + if ((b & 0xFF) < 0x10) hex.append("0"); + hex.append(Integer.toHexString(b & 0xFF)); + } + return hexStringToByteArray(hex.toString()); + } + + public static byte[] hexStringToByteArray(String s) { + int len = s.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + + Character.digit(s.charAt(i+1), 16)); + } + return data; + } +} \ No newline at end of file diff --git a/gwt/3.3/src/pubnub/example/PubnubExample.java b/gwt/3.3/src/pubnub/example/PubnubExample.java new file mode 100644 index 000000000..135579e91 --- /dev/null +++ b/gwt/3.3/src/pubnub/example/PubnubExample.java @@ -0,0 +1,408 @@ +package src.pubnub.example; + +import java.util.HashMap; +import java.util.Iterator; + +import org.json.JSONArray; +import org.json.JSONObject; +import pubnub.api.Pubnub; +import pubnub.api.Callback; + +public class PubnubExample { + + /** + * @param params + */ + public static void main(String[] params) { + + System.out.println("\nRunning publish()"); + PublishExample(); + + System.out.println("\nRunning history()"); + HistoryExample(); + + System.out.println("\nRunning timestamp()"); + TimestampExample(); + + System.out.println("\nRunning here_now()"); + HereNowExample(); + + System.out.println("\nRunning detailedHistory()"); + DetailedHistoryExample(); + +// System.out.println("\nRunning presence()"); +// PresenceExample(); + + System.out.println("\nRunning subscribe()"); + SubscribeExample(); + + } + + private static void PublishExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = "enigma"; // (Cipher key is optional) + String channel = "hello_world"; + + int publish_message_count = 1; + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + int count = 0; + while (true) { + if (count >= publish_message_count) break; + count ++; + + // Create JSON Message + JSONObject message = new JSONObject(); + try { + message.put("text", "Hello World!" + count); + /* + * message.put("title", "Java Client PubNub"; + * message.put("some_val", "This is a push to all users! Fighting!" + * message.put("url", "http://www.pubnub.com" + */ + } catch (org.json.JSONException jsonError) { + } + + // Publish + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("message", message); + JSONArray response = null; + response = pubnub.publish(args); + System.out.println(response); + + args = new HashMap(2); + args.put("channel", channel); + args.put("message", "Hello World"); + response = pubnub.publish(args); + System.out.println(response); + + JSONArray array = new JSONArray(); + array.put("Sunday"); + array.put("Monday"); + array.put("Tuesday"); + array.put("Wednesday"); + array.put("Thursday"); + array.put("Friday"); + array.put("Saturday"); + + args = new HashMap(2); + args.put("channel", channel); + args.put("message", array); + + response = pubnub.publish(args); + System.out.println(response); + } + } + + private static void HistoryExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = "enigma"; // (Cipher key is optional) + String channel = "hello_world"; + int limit = 1; + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("limit", limit); + + // Get History + JSONArray response = pubnub.history(args); + + // Print Response from PubNub JSONP REST Service + System.out.println(response); + + try { + if (response != null) { + for (int i = 0; i < response.length(); i ++) { + JSONObject jsono = response.optJSONObject(i); + if (jsono != null) { + @SuppressWarnings("rawtypes") + Iterator keys = jsono.keys(); + while (keys.hasNext()) { + System.out.println(jsono.get(keys.next().toString()) + " "); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void DetailedHistoryExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = "enigma"; // (Cipher key is optional) + String channel = "hello_world"; + int count = 1; + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + + // Get History + JSONArray response = pubnub.detailedHistory(channel, count); + + // Print Response from PubNub JSONP REST Service + System.out.println(response); + + try { + if (response != null) { + for (int i = 0; i < response.length(); i ++) { + JSONObject jsono = response.optJSONObject(i); + if (jsono != null) { + @SuppressWarnings("rawtypes") + Iterator keys = jsono.keys(); + while (keys.hasNext()) { + System.out.println(jsono.get(keys.next().toString()) + " "); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void TimestampExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = ""; // (Cipher key is optional) + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + + // Print Server Time + System.out.println("Time: " + Double.toString(pubnub.time())); + } + + private static void SubscribeExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = ""; // (Cipher key is optional) + String channel = "hello_world"; + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + + // Callback Interface when a Message is Received + class Receiver implements Callback { + + public boolean subscribeCallback(String channel, Object message) { + + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + @SuppressWarnings("rawtypes") + Iterator keys = obj.keys(); + while (keys.hasNext()) { + System.out.print(obj.get(keys.next().toString()) + " "); + } + System.out.println(); + } else if (message instanceof String) { + String obj = (String) message; + System.out.print(obj + " "); + System.out.println(); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + System.out.print(obj.toString() + " "); + System.out.println(); + } + } catch (Exception e) { + e.printStackTrace(); + } + // Continue Listening? + return true; + } + + @Override + public void errorCallback(String channel, Object message) { + System.err.println("Channel:" + channel + "-" + message.toString()); + + } + + @Override + public void connectCallback(String channel) { + System.out.println("Connected to channel :" + channel); + System.out.println("Waiting for a message from publisher ..."); + } + + @Override + public void reconnectCallback(String channel) { + System.out.println("Reconnected to channel :" + channel); + } + + @Override + public void disconnectCallback(String channel) { + System.out.println("Disconnected to channel :" + channel); + } + + @Override + public boolean presenceCallback(String channel, Object message) { + return false; + } + } + + HashMap args = new HashMap(6); + args.put("channel", channel); + args.put("callback", new Receiver()); // callback to get response + + // Listen for Messages (Subscribe) + pubnub.subscribe(args); + } + + private static void PresenceExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = ""; // (Cipher key is optional) + String channel = "hello_world"; + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + + // Callback Interface when a Message is Received + class Receiver implements Callback { + + public boolean presenceCallback(String channel, Object message) { + + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + @SuppressWarnings("rawtypes") + Iterator keys = obj.keys(); + while (keys.hasNext()) { + System.out.print(obj.get(keys.next().toString()) + " "); + } + System.out.println(); + } else if (message instanceof String) { + String obj = (String) message; + System.out.print(obj + " "); + System.out.println(); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + System.out.print(obj.toString() + " "); + System.out.println(); + } + } catch (Exception e) { + e.printStackTrace(); + } + // Continue Listening? + return true; + } + + @Override + public void errorCallback(String channel, Object message) { + System.err.println("Channel:" + channel + "-" + message.toString()); + + } + + @Override + public void connectCallback(String channel) { + System.out.println("Connected to channel :" + channel); + System.out.println("Waiting for subscribe or unsubscribe message ..."); + } + + @Override + public void reconnectCallback(String channel) { + System.out.println("Reconnected to channel :" + channel); + } + + @Override + public void disconnectCallback(String channel) { + System.out.println("Disconnected to channel :" + channel); + } + + @Override + public boolean subscribeCallback(String channel, Object message) { + return false; + } + } + + HashMap args = new HashMap(6); + args.put("channel", channel + "-pnpres"); + args.put("callback", new Receiver()); // callback to get response + + // Listen for Messages (Presence) + pubnub.presence(args); + } + + private static void HereNowExample() { + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = "demo"; + String cipher_key = ""; // (Cipher key is optional) + String channel = "hello_world"; + + Pubnub pubnub = new Pubnub( + publish_key, + subscribe_key, + secret_key, + cipher_key, + true + ); + + // Get Here Now + JSONArray response = pubnub.here_now(channel); + + // Print Response from PubNub JSONP REST Service + System.out.println(response); + + try { + if (response != null) { + for (int i = 0; i < response.length(); i ++) { + JSONObject jsono = response.optJSONObject(i); + if (jsono != null) { + @SuppressWarnings("rawtypes") + Iterator keys = jsono.keys(); + while (keys.hasNext()) { + System.out.println(jsono.get(keys.next().toString()) + " "); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/gwt/3.3/src/pubnub/unit_test/PubnubUnitTest.java b/gwt/3.3/src/pubnub/unit_test/PubnubUnitTest.java new file mode 100644 index 000000000..cb9944e16 --- /dev/null +++ b/gwt/3.3/src/pubnub/unit_test/PubnubUnitTest.java @@ -0,0 +1,538 @@ +package pubnub.unit_test; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Iterator; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.junit.Test; + +import pubnub.api.Callback; +import pubnub.api.Pubnub; + +public class PubnubUnitTest { + + private static boolean deliveryStatus = false; + private Pubnub pubnub = new Pubnub( + "demo", + "demo", + "", + "", + true + ); + private String channel = "hello_world"; + private int limit = 1; + + @Test + public void testPublishHashMapOfStringObject() { + pubnub.CIPHER_KEY = "enigma"; + JSONObject message = new JSONObject(); + try { + message.put("text", "Hello World!"); + } catch (org.json.JSONException jsonError) { + jsonError.printStackTrace(); + } + + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("message", message); + JSONArray response = null; + response = pubnub.publish(args); + + try { + assertFalse(response.get(2).toString().equals("0")); + System.out.println("PASS: TestPublish"); + } catch (JSONException e) { + fail("FAIL: TestPublish"); + } + } + + @Test + public void testSubscribeHashMapOfStringObject() { + pubnub.CIPHER_KEY = ""; + // Callback Interface when a Message is Received + class Receiver implements Callback { + + public boolean subscribeCallback(String channel, Object message) { + + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + @SuppressWarnings("rawtypes") + Iterator keys = obj.keys(); + while (keys.hasNext()) { + System.out.print(obj.get(keys.next().toString()) + " "); + } + System.out.println(); + } else if (message instanceof String) { + String obj = (String) message; + System.out.print(obj + " "); + System.out.println(); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + System.out.print(obj.toString() + " "); + System.out.println(); + } + } catch (Exception e) { + e.printStackTrace(); + } + deliveryStatus = true; + // Continue Listening? + return false; + } + + @Override + public void errorCallback(String channel, Object message) { + System.err.println("Channel:" + channel + "-" + message.toString()); + + } + + @Override + public void connectCallback(String channel) { + System.out.println("Connected to channel :" + channel); + System.out.println("Waiting for a message from publisher ..."); + } + + @Override + public void reconnectCallback(String channel) { + System.out.println("Reconnected to channel :" + channel); + } + + @Override + public void disconnectCallback(String channel) { + System.out.println("Disconnected to channel :" + channel); + } + + @Override + public boolean presenceCallback(String channel, Object message) { + return false; + } + } + + HashMap args = new HashMap(6); + args.put("channel", channel); + args.put("callback", new Receiver()); + + deliveryStatus = false; + // Listen for Messages (Subscribe) + pubnub.subscribe(args); + JSONObject json = new JSONObject(); + try { + json.put("text", "hi"); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + while (!deliveryStatus); + assertTrue(deliveryStatus); + System.out.println("PASS: TestSubscribe"); + } + + @Test + public void testPresenceHashMapOfStringObject() { + pubnub.CIPHER_KEY = ""; + // Callback Interface when a Message is Received + class Receiver implements Callback { + + public boolean presenceCallback(String channel, Object message) { + + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + @SuppressWarnings("rawtypes") + Iterator keys = obj.keys(); + while (keys.hasNext()) { + System.out.print(obj.get(keys.next().toString()) + " "); + } + System.out.println(); + } else if (message instanceof String) { + String obj = (String) message; + System.out.print(obj + " "); + System.out.println(); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + System.out.print(obj.toString() + " "); + System.out.println(); + } + } catch (Exception e) { + e.printStackTrace(); + } + deliveryStatus = true; + // Continue Listening? + return false; + } + + @Override + public void errorCallback(String channel, Object message) { + System.err.println("Channel:" + channel + "-" + message.toString()); + } + + @Override + public void connectCallback(String channel) { + System.out.println("Connected to channel :" + channel); + System.out.println("Waiting for subscribe or unsubscribe message ..."); + } + + @Override + public void reconnectCallback(String channel) { + System.out.println("Reconnected to channel :" + channel); + } + + @Override + public void disconnectCallback(String channel) { + System.out.println("Disconnected to channel :" + channel); + } + + @Override + public boolean subscribeCallback(String channel, Object message) { + return false; + } + } + + HashMap args = new HashMap(6); + args.put("channel", channel + "-pnpres"); + args.put("callback", new Receiver()); // callback to get response + + deliveryStatus = false; + // Listen for Messages (Presence) + pubnub.presence(args); + while (!deliveryStatus); + assertTrue(deliveryStatus); + System.out.println("PASS: TestPresence"); + } + + @Test + public void testHere_now() { + pubnub.CIPHER_KEY = ""; + // Get Here Now + JSONArray response = pubnub.here_now(channel); + + try { + assertNotNull(response); + System.out.println("PASS: TestHere_Now"); + } catch (Exception e) { + fail("FAIL: TestHere_Now"); + } + } + + @Test + public void testUnencryptedHistoryHashMapOfStringObject() { + // Context setup + pubnub.CIPHER_KEY = ""; + JSONObject message = new JSONObject(); + try { + message.put("text", "Hello World!"); + } catch (org.json.JSONException jsonError) { + jsonError.printStackTrace(); + } + + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("message", message); + JSONArray response = null; + response = pubnub.publish(args); + + // Test begins + args = new HashMap(2); + args.put("channel", channel); + args.put("limit", limit); + + // Get History + response = pubnub.history(args); + + try { + assertNotNull(response); + System.out.println("PASS: TestUnencryptedHistory"); + } catch (Exception e) { + fail("FAIL: TestUnencryptedHistory"); + } + } + + @Test + public void testEncryptedHistoryHashMapOfStringObject() { + // Context setup + pubnub.CIPHER_KEY = "enigma"; + JSONObject message = new JSONObject(); + try { + message.put("text", "Hello World!"); + } catch (org.json.JSONException jsonError) { + jsonError.printStackTrace(); + } + + HashMap args = new HashMap(2); + args.put("channel", channel); + args.put("message", message); + JSONArray response = null; + response = pubnub.publish(args); + + // Test begins + args = new HashMap(2); + args.put("channel", channel); + args.put("limit", limit); + + // Get History + response = pubnub.history(args); + + try { + assertNotNull(response); + System.out.println("PASS: TestEncryptedHistory"); + } catch (Exception e) { + fail("FAIL: TestEncryptedHistory"); + } + } + + @Test + public void testUnencryptedDetailedHistory() { + // Context setup for Detailed History + pubnub.CIPHER_KEY = ""; + int total_msg = 10; + long starttime = (long) pubnub.time(); + HashMap inputs = new HashMap(); + for (int i = 0; i < total_msg / 2; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long midtime = (long) pubnub.time(); + for (int i = total_msg / 2; i < total_msg; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long endtime = (long)pubnub.time(); + + // Get History + JSONArray response = pubnub.detailedHistory(channel, total_msg); + + // Print Response from PubNub JSONP REST Service + System.out.println(response); + + try { + assertNotNull(response); + System.out.println("PASS: TestUnencryptedDetailedHistory"); + } catch (Exception e) { + fail("FAIL: TestUnencryptedDetailedHistory"); + } + } + + @Test + public void testEncryptedDetailedHistory() { + // Context setup for Detailed History + pubnub.CIPHER_KEY = "enigma"; + int total_msg = 10; + long starttime = (long) pubnub.time(); + HashMap inputs = new HashMap(); + for (int i = 0; i < total_msg / 2; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long midtime = (long) pubnub.time(); + for (int i = total_msg / 2; i < total_msg; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long endtime = (long)pubnub.time(); + + // Get History + JSONArray response = pubnub.detailedHistory(channel, total_msg); + + // Print Response from PubNub JSONP REST Service + System.out.println(response); + + try { + assertNotNull(response); + System.out.println("PASS: TestEncryptedDetailedHistory"); + } catch (Exception e) { + fail("FAIL: TestEncryptedDetailedHistory"); + } + } + + @Test + public void testUnencryptedDetailedHistoryParams() { + // Context setup for Detailed History + pubnub.CIPHER_KEY = ""; + int total_msg = 10; + long starttime = (long) pubnub.time(); + HashMap inputs = new HashMap(); + for (int i = 0; i < total_msg / 2; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long midtime = (long) pubnub.time(); + for (int i = total_msg / 2; i < total_msg; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long endtime = (long)pubnub.time(); + + // Get History + JSONArray response; + System.out.println("DetailedHistory with start & end"); + response = pubnub.detailedHistory(channel, starttime, midtime, total_msg / 2, true); + System.out.println(response); + try { + assertNotNull(response); + } catch (Exception e) { + fail("FAIL: TestUnencryptedDetailedHistoryParams"); + } + + System.out.println("DetailedHistory with start & reverse = true"); + response = pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, true); + System.out.println(response); + try { + assertNotNull(response); + } catch (Exception e) { + fail("FAIL: TestUnencryptedDetailedHistoryParams"); + } + + System.out.println("DetailedHistory with start & reverse = false"); + response = pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, false); + System.out.println(response); + try { + assertNotNull(response); + System.out.println("PASS: TestUnencryptedDetailedHistoryParams"); + } catch (Exception e) { + fail("FAIL: TestUnencryptedDetailedHistoryParams"); + } + } + + @Test + public void testEncryptedDetailedHistoryParams() { + // Context setup for Detailed History + pubnub.CIPHER_KEY = "enigma"; + int total_msg = 10; + long starttime = (long) pubnub.time(); + HashMap inputs = new HashMap(); + for (int i = 0; i < total_msg / 2; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long midtime = (long) pubnub.time(); + for (int i = total_msg / 2; i < total_msg; i++) { + String msg = Integer.toString(i); + JSONObject json = new JSONObject(); + try { + json.put("text", msg); + } catch (JSONException e) { + e.printStackTrace(); + } + pubnub.publish(channel, json); + long t = (long) pubnub.time(); + inputs.put(t, msg); + System.out.println("Message # " + Integer.toString(i) + " published"); + } + + long endtime = (long)pubnub.time(); + + // Get History + JSONArray response; + System.out.println("DetailedHistory with start & end"); + response = pubnub.detailedHistory(channel, starttime, midtime, total_msg / 2, true); + System.out.println(response); + try { + assertNotNull(response); + } catch (Exception e) { + fail("FAIL: TestEncryptedDetailedHistoryParams"); + } + + System.out.println("DetailedHistory with start & reverse = true"); + response = pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, true); + System.out.println(response); + try { + assertNotNull(response); + } catch (Exception e) { + fail("FAIL: TestEncryptedDetailedHistoryParams"); + } + + System.out.println("DetailedHistory with start & reverse = false"); + response = pubnub.detailedHistory(channel, midtime, -1, total_msg / 2, false); + System.out.println(response); + try { + assertNotNull(response); + System.out.println("PASS: TestEncryptedDetailedHistoryParams"); + } catch (Exception e) { + fail("FAIL: TestEncryptedDetailedHistoryParams"); + } + } + + @Test + public void testTime() { + assertNotNull(pubnub.time()); + } + + @Test + public void testUuid() { + assertNotNull(Pubnub.uuid()); + } +} diff --git a/gwt/3.3/src/pubnub/unit_test/PubnubUnitTestRunner.java b/gwt/3.3/src/pubnub/unit_test/PubnubUnitTestRunner.java new file mode 100644 index 000000000..475e61483 --- /dev/null +++ b/gwt/3.3/src/pubnub/unit_test/PubnubUnitTestRunner.java @@ -0,0 +1,21 @@ +package pubnub.unit_test; + +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.notification.Failure; + +public class PubnubUnitTestRunner { + + public static void main(String[] args) { + Result result = JUnitCore.runClasses(PubnubUnitTest.class); + for (Failure failure : result.getFailures()) { + System.out.println(failure.toString()); + } + if (result.getFailureCount() != 0) { + System.out.println("Pubnub Unit Test Failed: # of failures - " + result.getFailureCount()); + } else { + System.out.println("Pubnub Unit Test Completed Successfully."); + } + } + +} diff --git a/gwt/3.3/test/PubnubExample.jar b/gwt/3.3/test/PubnubExample.jar new file mode 100644 index 000000000..883d76008 Binary files /dev/null and b/gwt/3.3/test/PubnubExample.jar differ diff --git a/gwt/3.3/test/PubnubUnitTest.jar b/gwt/3.3/test/PubnubUnitTest.jar new file mode 100644 index 000000000..624380e87 Binary files /dev/null and b/gwt/3.3/test/PubnubUnitTest.jar differ diff --git a/gwt/LICENSE b/gwt/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/gwt/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/gwt/README.md b/gwt/README.md new file mode 100644 index 000000000..7aeca6160 --- /dev/null +++ b/gwt/README.md @@ -0,0 +1,15 @@ +##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. +##### http://www.pubnub.com/account + +## PubNub 3.3 Real-time Cloud Push API - GWT + +www.pubnub.com - PubNub Real-time Push Service in the Cloud. +http://www.pubnub.com/tutorial/java-push-api + +Please reference the unit-tests and examples for usage on basic functionality, +including presence(), here_now(), and detailedHistory(). + +To run the example app, copy the pubnubexample.war in gwt/3.3/examples/PubnubExample/ to the webapps dir of tomcat, +and restart tomcat. Then visit :/pubnubexample/PubnubExample.html + +You can find a running demo of the example app running here: http://geremy.pubnub.com:8080/pubnubexample/PubnubExample.html \ No newline at end of file diff --git a/j2me/LICENSE b/j2me/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/j2me/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/j2me/Pubnub-MicroEdition-3.5.6.jar b/j2me/Pubnub-MicroEdition-3.5.6.jar new file mode 100644 index 000000000..7035f890f Binary files /dev/null and b/j2me/Pubnub-MicroEdition-3.5.6.jar differ diff --git a/j2me/Pubnub-MicroEdition-Debug-3.5.6.jar b/j2me/Pubnub-MicroEdition-Debug-3.5.6.jar new file mode 100644 index 000000000..c6402da7b Binary files /dev/null and b/j2me/Pubnub-MicroEdition-Debug-3.5.6.jar differ diff --git a/j2me/README.md b/j2me/README.md new file mode 100644 index 000000000..4ca16bef8 --- /dev/null +++ b/j2me/README.md @@ -0,0 +1,247 @@ +## PubNub 3.3 Real-time Cloud Push API - J2ME +### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. +### http://www.pubnub.com/account + +PubNub is a Massively Scalable Real-time Service for Web and Mobile Games. +This is a cloud-based service for broadcasting Real-time messages +to thousands of web and mobile clients simultaneously. + +#### Example configuration + +-Project tested on Netbeans 7 IDE and Java ME SDK 3.0 Device Manager +-Device Configuration - CLDC-1.1 +-Device Profile - MIDP-2.0 + + +####Init + +```java + Pubnub pubnub = new Pubnub( + "demo", // PUBLISH_KEY + "demo", // SUBSCRIBE_KEY + "", // SECRET_KEY + "", // CIPHER_KEY (optional) + false // SSL_ON? + ); +``` + + +####Callback +Set Callback when pubnub object create. +```java + public interface Callback { + public abstract void publishCallback(String channel,Object message,Object responce); + public abstract void subscribeCallback(String channel,Object message); + public abstract void historyCallback(String channel,Object message); + public abstract void errorCallback(String channel, Object message); + public abstract void connectCallback(String channel); + public abstract void reconnectCallback(String channel); + public abstract void disconnectCallback(String channel); + public abstract void hereNowCallback(String channel,Object message); + public abstract void presenceCallback(String channel,Object message); + public abstract void detailedHistoryCallback(String channel,Object message); + } +``` +####Publish + +```java + try { + // Create JSON Message + JSONObject message = new JSONObject(); + // Create Hashtable parameter + message.put("some_key", "Hello World!"); + + Hashtable args = new Hashtable(2); + args.put("channel", "hello_world"); // Channel Name + args.put("message", message); // JSON Message + _pubnub.publish(args); + + } catch (JSONException ex) { + ex.printStackTrace(); + } +``` +Pass result to Publish Callback + +```java + public void publishCallback(String channel, Object message, Object response) { + JSONArray meg = (JSONArray) response; + System.out.println("Message sent response:" + message.toString() + + " on channel:" + channel); + try { + int success = Integer.parseInt(meg.get(0).toString()); + if (success == 1) { + stringItem.setLabel("Publish"); + stringItem.setText("Message sent successfully on channel:" + + channel + "\n" + message.toString()); + } else { + stringItem.setLabel("Publish"); + stringItem.setText("Message sent failure on channel:" + channel + + "\n" + message.toString()); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } +``` + +####Subscribe + +```java + // Callback Interface when a Message is Received + public void subscribeCallback(String channel, Object message) { + System.out.println("Message recevie on channel:" + channel + + " Message:" + message.toString()); + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + Alert a = new Alert("Received", obj.toString(), null, null); + a.setTimeout(Alert.FOREVER); + getDisplay().setCurrent(a, form); + + Enumeration keys = obj.keys(); + while (keys.hasMoreElements()) { + System.out.println(obj.get(keys.nextElement().toString()) + + " "); + } + + } else if (message instanceof String) { + String obj = (String) message; + System.out.print(obj + " "); + System.out.println(); + + Alert a = new Alert("Received", obj.toString(), null, null); + a.setTimeout(Alert.FOREVER); + getDisplay().setCurrent(a, form); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + System.out.print(obj.toString() + " "); + System.out.println(); + + Alert a = new Alert("Received", obj.toString(), null, null); + a.setTimeout(Alert.FOREVER); + getDisplay().setCurrent(a, form); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + + // Callback Interface when a channel is connected + public void connectCallback(String channel) { + System.out.println("Connect channel:" + channel); + } + + // Callback Interface when a channel is reconnected + public void reconnectCallback(String channel) { + System.out.println("Reconnect channel:" + channel); + } + + // Callback Interface when a channel is disconnected + public void disconnectCallback(String channel) { + System.out.println("Disconnect channel:" + channel); + } + + // Callback Interface when error occurs + public void errorCallback(String channel, Object message) { + System.out.println("Error on channel:" + channel + " Message:" + message.toString()); + } + + Hashtable args = new Hashtable(6); + args.put("channel", "hello_world"); + // Listen for Messages (Subscribe) + _pubnub.subscribe(args); + +``` + +####History +###DEPRECATED! Please use / migrate existing to detailedHistory() (see below) + +```java + // Create HashMap parameter + Hashtable args = new Hashtable(2); + args.put("channel", "hello_world"); + args.put("limit", new Integer(2)); // Limit + + // Get History + _pubnub.history(args); + + public void historyCallback(String channel, Object message) { + JSONArray meg = (JSONArray) message; + System.out.println("History recevie on channel:" + channel + " Message:" + meg.toString()); + + stringItem.setLabel("History"); + stringItem.setText("History recevie on channel:" + channel + "\n" + meg.toString()); + } +``` + +####Detailed History +Retrieve published messages. +#####Required Parameters +'channel'- Channel name +#####Options Parameters +######'start'- Start timetoken +######'end'- End timetoken +######'reverse'- false = oldest first (default), true = newest first +######'count'-Number of History messages. Defaults to 100. + +```java + Hashtable args = new Hashtable(); + args.put("channel", Channel); + args.put("count", 2+""); + _pubnub.detailedHistory(args); + + //Callback + public void detailedHistoryCallback(String channel, Object message) { + stringItem.setLabel("DetailedHistory"); + stringItem.setText("channel:" + channel + "\n" + message); + } +``` + + +####Unsubscribe + +```java + // Create Hashtable parameter + Hashtable args = new Hashtable(1); + String channel = "hello_world"; + args.put("channel", channel); + _pubnub.unsubscribe(args); +``` + +####Time + +```java + // Get server time + long time = pubnub.time(); + System.out.println("Time : "+time); +``` + +####here_now + +```java + // Who is currently on the channel? + Hashtable args = new Hashtable(); + args.put("channel", channel); + pubnub.here_now(args); + + + + public void hereNowCallback(String channel, Object message) { + stringItem.setLabel("HereNow"); + stringItem.setText("HereNow on channel:" + channel + "\n" + message.toString()); + } +``` + + +#### Presence +Join a subscriber list on a channel. Callback events can be, Join - Shows availability on a channel or Leave - Disconnected to channel means removed from the list of subscribers. +```java + _pubnub.presence(Channel); + + //Callback + public void presenceCallback(String channel, Object message) { + stringItem.setLabel("Presence"); + stringItem.setText("channel:" + channel + "\n" + message.toString()); + } +``` \ No newline at end of file diff --git a/j2me/build.xml b/j2me/build.xml new file mode 100644 index 000000000..a8da65cff --- /dev/null +++ b/j2me/build.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/j2me/examples/PubnubExample/PubnubExample.jad b/j2me/examples/PubnubExample/PubnubExample.jad new file mode 100644 index 000000000..e121143eb --- /dev/null +++ b/j2me/examples/PubnubExample/PubnubExample.jad @@ -0,0 +1,8 @@ +MIDlet-1: PubnubExample,,com.pubnub.examples.me.PubnubExample +MIDlet-Jar-Size: 133733 +MIDlet-Jar-URL: PubnubExample.jar +MIDlet-Name: PubnubExample MIDlet Suite +MIDlet-Vendor: MIDlet Suite Vendor +MIDlet-Version: 1.0.0 +MicroEdition-Configuration: CLDC-1.1 +MicroEdition-Profile: MIDP-2.0 diff --git a/j2me/examples/PubnubExample/PubnubExample.jar b/j2me/examples/PubnubExample/PubnubExample.jar new file mode 100644 index 000000000..b68cb9475 Binary files /dev/null and b/j2me/examples/PubnubExample/PubnubExample.jar differ diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/AuthKeyConfig.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/AuthKeyConfig.java new file mode 100644 index 000000000..521d05cd1 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/AuthKeyConfig.java @@ -0,0 +1,39 @@ +package com.pubnub.examples.me; + +import java.util.Hashtable; + +import javax.microedition.lcdui.ChoiceGroup; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class AuthKeyConfig extends PubnubCommand { + + public AuthKeyConfig(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Set Auth Keys"); + } + + protected void initForm() { + final TextField txtAuthKey = new TextField("Auth Key : ", "", 255, TextField.ANY); + + form = new Form("History"); + form.append(txtAuthKey); + form.addCommand(new Command("Set Auth Key", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + _pubnub.setAuthKey(txtAuthKey.getString()); + display.setCurrent(menu); + } + }); + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/DetailedHistory.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/DetailedHistory.java new file mode 100644 index 000000000..91335ea9f --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/DetailedHistory.java @@ -0,0 +1,60 @@ +package com.pubnub.examples.me; + +import java.util.Hashtable; + +import javax.microedition.lcdui.ChoiceGroup; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class DetailedHistory extends PubnubCommand { + + public DetailedHistory(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Detailed History"); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel : ", "", 255, TextField.ANY); + final TextField txtCount = new TextField("Count : ", "1", 10, TextField.NUMERIC); + final ChoiceGroup cg = new ChoiceGroup("Reverse?",ChoiceGroup.EXCLUSIVE); + cg.append("Yes", null); + cg.append("No", null); + + form = new Form("History"); + form.append(txtChannel); + form.append(txtCount); + form.append(cg); + form.addCommand(new Command("Get History", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + + + _pubnub.detailedHistory(txtChannel.getString(), + Integer.parseInt(txtCount.getString()), + cg.isSelected(0)?true:false, + new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + display.setCurrent(menu); + + } + }); + + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/DisconnectAndResubscribe.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/DisconnectAndResubscribe.java new file mode 100644 index 000000000..d1beb95f5 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/DisconnectAndResubscribe.java @@ -0,0 +1,21 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Form; + +import com.pubnub.api.Pubnub; + +public class DisconnectAndResubscribe extends PubnubCommand { + + public DisconnectAndResubscribe(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Disconnect & Resub"); + } + + public void handler() { + _pubnub.disconnectAndResubscribe(); + } + protected void initForm() { + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/HereNow.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/HereNow.java new file mode 100644 index 000000000..ab65b686e --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/HereNow.java @@ -0,0 +1,44 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class HereNow extends PubnubCommand { + + public HereNow(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu,"Here Now"); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel: ", "", 255, TextField.ANY); + form = new Form("Here Now"); + form.append(txtChannel); + form.addCommand(new Command("Here Now", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + _pubnub.hereNow(txtChannel.getString(), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + display.setCurrent(menu); + + } + }); + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/History.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/History.java new file mode 100644 index 000000000..d2a85e2b5 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/History.java @@ -0,0 +1,46 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class History extends PubnubCommand { + + public History(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "History"); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel : ", "", 255, TextField.ANY); + final TextField txtCount = new TextField("Count : ", "", 10, TextField.NUMERIC); + form = new Form("History"); + form.append(txtChannel); + form.append(txtCount); + form.addCommand(new Command("Get History", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + _pubnub.history(txtChannel.getString(), Integer.parseInt(txtCount.getString()), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + display.setCurrent(menu); + + } + }); + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Presence.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Presence.java new file mode 100644 index 000000000..13597ef54 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Presence.java @@ -0,0 +1,50 @@ +package com.pubnub.examples.me; + +import java.util.Hashtable; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Presence extends PubnubCommand { + + public Presence(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Presence"); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel: ", "", 255, TextField.ANY); + form = new Form("Subscribe"); + form.append(txtChannel); + form.addCommand(new Command("Subscribe", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + + try { + _pubnub.presence(txtChannel.getString(), new Callback() { + public void successCallback(String channel, Object message) { + notifyUser("Channel " + channel + " : " + message.toString()); + } + public void errorCallback(String channel, PubnubError error) { + notifyUser("Channel " + channel + " : " + error.toString()); + } + }); + display.setCurrent(menu); + + } catch (Exception e) { + + } + + }}); + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Publish.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Publish.java new file mode 100644 index 000000000..a23421df4 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Publish.java @@ -0,0 +1,64 @@ +package com.pubnub.examples.me; + +import java.util.Hashtable; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; +import com.pubnub.api.PubnubException; + +import org.json.me.JSONException; +import org.json.me.JSONObject; + +public class Publish extends PubnubCommand { + + + public Publish(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display,menu, "Publish"); + cmd = new Command("Publish", Command.ITEM, 0); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel: ", "", 255, TextField.ANY); + final TextField txtMessage = new TextField("Message: ", "", 255, TextField.ANY); + form = new Form("Publish"); + form.append(txtChannel); + form.append(txtMessage); + form.addCommand(new Command("Publish", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + try { + JSONObject message = new JSONObject(); + message.put("message", txtMessage.getString()); + + Hashtable args = new Hashtable(2); + args.put("channel", txtChannel.getString()); // Channel Name + args.put("message", message); // JSON Message + _pubnub.publish(args, new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(channel + " : " + error.toString()); + } + }); + display.setCurrent(menu); + + } catch (JSONException ex) { + + } + + }}); + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubCommand.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubCommand.java new file mode 100644 index 000000000..9683fb0a5 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubCommand.java @@ -0,0 +1,76 @@ +package com.pubnub.examples.me; + +import java.util.Enumeration; + +import javax.microedition.lcdui.Alert; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Form; + +import org.json.me.JSONArray; +import org.json.me.JSONObject; + +import com.pubnub.api.Pubnub; + +public abstract class PubnubCommand { + + protected Display display; + protected Form menu; + protected Form form; + protected Pubnub _pubnub; + + protected Command cmd; + + + protected abstract void initForm(); + + public PubnubCommand(Pubnub pubnub, Display display, Form menu, String command) { + this.display = display; + this.menu = menu; + this._pubnub = pubnub; + this.cmd = new Command(command, Command.ITEM, 0); + } + + public void notifyUser(Object message) { + try { + if (message instanceof JSONObject) { + JSONObject obj = (JSONObject) message; + Alert a = new Alert("Received", obj.toString(), null, null); + a.setTimeout(Alert.FOREVER); + display.setCurrent(a, menu); + + Enumeration keys = obj.keys(); + while (keys.hasMoreElements()) { + } + + } else if (message instanceof String) { + String obj = (String) message; + Alert a = new Alert("Received", obj.toString(), null, null); + a.setTimeout(Alert.FOREVER); + display.setCurrent(a, menu); + } else if (message instanceof JSONArray) { + JSONArray obj = (JSONArray) message; + Alert a = new Alert("Received", obj.toString(), null, null); + a.setTimeout(Alert.FOREVER); + display.setCurrent(a, menu); + } + } catch (Exception e) { + + } + + } + + public void handler() { + + if (form == null) + initForm(); + display.setCurrent(form); + + } + + public Command getCommand() { + return cmd; + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubDemoConsole.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubDemoConsole.java new file mode 100644 index 000000000..7c64dfd84 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubDemoConsole.java @@ -0,0 +1,106 @@ +package com.pubnub.examples.me; + +import javax.microedition.midlet.MIDlet; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubException; + +import java.util.Enumeration; +import java.util.Hashtable; +import javax.microedition.lcdui.*; + +import org.json.me.JSONArray; +import org.json.me.JSONException; +import org.json.me.JSONObject; + +public class PubnubDemoConsole extends MIDlet { + + private boolean midletPaused = false; + + Pubnub _pubnub; + Display display; + + PubnubMenu menu; + + public PubnubDemoConsole() { + } + + + + + + private void init() { + _pubnub = new Pubnub("demo", "demo", "demo", false); + display = Display.getDisplay(this); + menu = new PubnubMenu(_pubnub, display, this); + + } + + /** + * Performs an action assigned to the Mobile Device - MIDlet Started point. + */ + public void startMIDlet() { + init(); + switchDisplayable(null, menu.getMenu()); + _pubnub.setResumeOnReconnect(true); + } + + /** + * Performs an action assigned to the Mobile Device - MIDlet Resumed point. + */ + public void resumeMIDlet() { + } + + public void switchDisplayable(Alert alert, Displayable nextDisplayable) { + Display display = this.display; + if (alert == null) { + display.setCurrent(nextDisplayable); + } else { + display.setCurrent(alert, nextDisplayable); + } + } + + /** + * Exits MIDlet. + */ + public void exitMIDlet() { + switchDisplayable(null, null); + destroyApp(true); + notifyDestroyed(); + } + + /** + * Called when MIDlet is started. Checks whether the MIDlet have been + * already started and initialize/starts or resumes the MIDlet. + */ + public void startApp() { + + if (midletPaused) { + resumeMIDlet(); + } else { + + startMIDlet(); + } + midletPaused = false; + } + + /** + * Called when MIDlet is paused. + */ + public void pauseApp() { + midletPaused = true; + } + + /** + * Called to signal the MIDlet to terminate. + * + * @param unconditional + * if true, then the MIDlet has to be unconditionally terminated + * and all resources has to be released. + */ + public void destroyApp(boolean unconditional) { + } + + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubMenu.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubMenu.java new file mode 100644 index 000000000..cde87198e --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/PubnubMenu.java @@ -0,0 +1,128 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; + +import com.pubnub.api.Pubnub; + +public class PubnubMenu { + private Form menu; + private Pubnub pubnub; + private Display display; + private PubnubDemoConsole app; + public PubnubMenu(Pubnub pubnub, Display display, PubnubDemoConsole app) { + this.pubnub = pubnub; + this.display = display; + this.app = app; + } + + public Form getMenu() { + final Publish publish; + final History history; + final Subscribe subscribe; + final DetailedHistory detailedHistory; + final HereNow hereNow; + final Presence presence; + final Unsubscribe unsubscribe; + + final ToggleResumeOnReconnect toggleResumeOnReconnect; + final Time time; + final DisconnectAndResubscribe disconnectAndResubscribe; + final AuthKeyConfig authKeyConfig; + if (menu == null) { + final Command exitCommand; + final Command publishCommand; + final Command historyCommand; + final Command subscribeCommand; + final Command timeCommand; + + final Command unsubscribeCommand; + + final Command hereNowCommand; + final Command presenceCommand; + final Command detailedHistoryCommand; + final Command disconnectAndResubscribeCommand; + final Command toggleResumeOnReconnectCommand; + final Command authKeyConfigCommand; + + menu = new Form("Pubnub Demo Console"); + publish = new Publish(pubnub, display, menu); + history = new History(pubnub, display, menu); + subscribe = new Subscribe(pubnub,display,menu); + presence = new Presence(pubnub,display,menu); + detailedHistory = new DetailedHistory(pubnub,display,menu); + hereNow = new HereNow(pubnub,display,menu); + unsubscribe = new Unsubscribe(pubnub,display,menu); + toggleResumeOnReconnect = new ToggleResumeOnReconnect(pubnub,display,menu); + disconnectAndResubscribe = new DisconnectAndResubscribe(pubnub,display,menu); + authKeyConfig = new AuthKeyConfig(pubnub,display,menu); + time = new Time(pubnub,display,menu); + + + toggleResumeOnReconnectCommand = new Command("ToggleResumeOnReconnect", Command.ITEM, 0); + menu.addCommand(toggleResumeOnReconnectCommand); + disconnectAndResubscribeCommand = new Command("DisconnectAndResubscribe",Command.ITEM, 0); + menu.addCommand(disconnectAndResubscribeCommand); + detailedHistoryCommand = new Command("DetailedHistory", Command.ITEM, 0); + menu.addCommand(detailedHistoryCommand); + presenceCommand = new Command("Presence", Command.ITEM, 0); + menu.addCommand(presenceCommand); + publishCommand = publish.getCommand(); + menu.addCommand(publishCommand); + timeCommand = new Command("Time", Command.ITEM, 2); + menu.addCommand(timeCommand); + historyCommand = new Command("History", Command.ITEM, 1); + menu.addCommand(historyCommand); + subscribeCommand = new Command("Subscribe", Command.ITEM, 0); + menu.addCommand(subscribeCommand); + unsubscribeCommand = new Command("Unsubscribe", Command.ITEM, 0); + menu.addCommand(unsubscribeCommand); + + hereNowCommand = new Command("HereNow", Command.ITEM, 1); + menu.addCommand(hereNowCommand); + exitCommand = new Command("Exit", Command.EXIT, 0); + menu.addCommand(exitCommand); + authKeyConfigCommand = new Command("Set Auth Key", Command.ITEM, 0); + menu.addCommand(authKeyConfigCommand); + + menu.setCommandListener(new CommandListener() { + + public void commandAction(Command command, Displayable displayable) { + if (command == exitCommand) { + app.exitMIDlet(); + } else if (command == historyCommand) { + history.handler(); + } else if (command == publishCommand) { + publish.handler(); + } else if (command == subscribeCommand) { + subscribe.handler(); + } else if (command == timeCommand) { + time.handler(); + } else if (command == unsubscribeCommand) { + unsubscribe.handler(); + } else if (command == hereNowCommand) { + hereNow.handler(); + } else if (command == presenceCommand) { + presence.handler(); + } else if (command == detailedHistoryCommand) { + detailedHistory.handler(); + } else if (command == disconnectAndResubscribeCommand) { + disconnectAndResubscribe.handler(); + } else if (command == toggleResumeOnReconnectCommand) { + toggleResumeOnReconnect.handler(); + } else if (command == authKeyConfigCommand) { + authKeyConfig.handler(); + } + + + } + }); + } + + return menu; + + } +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Subscribe.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Subscribe.java new file mode 100644 index 000000000..7599ece05 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Subscribe.java @@ -0,0 +1,65 @@ +package com.pubnub.examples.me; + +import java.util.Hashtable; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Subscribe extends PubnubCommand { + + public Subscribe(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Subscribe"); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel: ", "", 255, TextField.ANY); + form = new Form("Subscribe"); + form.append(txtChannel); + form.addCommand(new Command("Subscribe", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + Hashtable args = new Hashtable(); + args.put("channel", txtChannel.getString()); + + try { + _pubnub.subscribe(args, new Callback() { + public void connectCallback(String channel, Object message) { + notifyUser("CONNECT on channel:" + channel); + } + + public void disconnectCallback(String channel, Object message) { + notifyUser("DISCONNECT on channel:" + channel); + } + + public void reconnectCallback(String channel, Object message) { + notifyUser("RECONNECT on channel:" + channel); + } + + public void successCallback(String channel, Object message) { + notifyUser("Channel " + channel + " : " + message.toString()); + } + public void errorCallback(String channel, PubnubError error) { + notifyUser("Channel " + channel + " : " + error.toString()); + } + }); + display.setCurrent(menu); + + } catch (Exception e) { + + } + + }}); + + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Time.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Time.java new file mode 100644 index 000000000..824e0bc8a --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Time.java @@ -0,0 +1,29 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Form; + +import com.pubnub.api.Callback; +import com.pubnub.api.Pubnub; +import com.pubnub.api.PubnubError; + +public class Time extends PubnubCommand { + + public Time(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Time"); + } + + protected void initForm() { + } + public void handler() { + _pubnub.time( new Callback() { + public void successCallback(String channel, Object message) { + notifyUser(message.toString()); + } + + public void errorCallback(String channel, PubnubError error) { + notifyUser(error.toString()); + } + }); + } +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/ToggleResumeOnReconnect.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/ToggleResumeOnReconnect.java new file mode 100644 index 000000000..57bbcf036 --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/ToggleResumeOnReconnect.java @@ -0,0 +1,22 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Form; + +import com.pubnub.api.Pubnub; + +public class ToggleResumeOnReconnect extends PubnubCommand { + + public ToggleResumeOnReconnect(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Toggle Resume on Reconnect"); + } + + public void handler() { + _pubnub.setResumeOnReconnect((_pubnub.isResumeOnReconnect())?false:true); + } + + protected void initForm() { + + } + +} diff --git a/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Unsubscribe.java b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Unsubscribe.java new file mode 100644 index 000000000..6b579676f --- /dev/null +++ b/j2me/examples/PubnubExample/src/com/pubnub/examples/me/Unsubscribe.java @@ -0,0 +1,35 @@ +package com.pubnub.examples.me; + +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Form; +import javax.microedition.lcdui.TextField; + +import com.pubnub.api.Pubnub; + +public class Unsubscribe extends PubnubCommand { + + public Unsubscribe(Pubnub pubnub, Display display, Form menu) { + super(pubnub, display, menu, "Unsubscribe"); + } + + protected void initForm() { + final TextField txtChannel = new TextField("Channel: ", "", 255, TextField.ANY); + form = new Form("Unsubscribe"); + form.append(txtChannel); + form.addCommand(new Command("Unsubscribe", Command.OK, 2)); + + form.setCommandListener(new CommandListener() { + public void commandAction(Command arg0, Displayable arg1) { + _pubnub.unsubscribe(txtChannel.getString()); + display.setCurrent(menu); + + } + }); + + + } + +} diff --git a/j2me/libs/bouncycastle.jar b/j2me/libs/bouncycastle.jar new file mode 100644 index 000000000..61c4c38d7 Binary files /dev/null and b/j2me/libs/bouncycastle.jar differ diff --git a/j2me/libs/cldc_1.1.jar b/j2me/libs/cldc_1.1.jar new file mode 100644 index 000000000..670fe0a1b Binary files /dev/null and b/j2me/libs/cldc_1.1.jar differ diff --git a/j2me/libs/jsonme.jar b/j2me/libs/jsonme.jar new file mode 100644 index 000000000..a55f7dcad Binary files /dev/null and b/j2me/libs/jsonme.jar differ diff --git a/j2me/libs/jsr177_1.0.jar b/j2me/libs/jsr177_1.0.jar new file mode 100644 index 000000000..9ab4f2b87 Binary files /dev/null and b/j2me/libs/jsr177_1.0.jar differ diff --git a/j2me/libs/midp_2.0.jar b/j2me/libs/midp_2.0.jar new file mode 100644 index 000000000..0eb005a99 Binary files /dev/null and b/j2me/libs/midp_2.0.jar differ diff --git a/j2me/libs/tinylinegzip.jar b/j2me/libs/tinylinegzip.jar new file mode 100644 index 000000000..40cfcd1ca Binary files /dev/null and b/j2me/libs/tinylinegzip.jar differ diff --git a/j2me/src/com/pubnub/api/Pubnub.java b/j2me/src/com/pubnub/api/Pubnub.java new file mode 100644 index 000000000..f22549dee --- /dev/null +++ b/j2me/src/com/pubnub/api/Pubnub.java @@ -0,0 +1,89 @@ +package com.pubnub.api; + +import org.bouncycastle.util.SecureRandom; +import org.json.me.*; + +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, + String cipher_key, boolean ssl_on, String initialization_vector) { + super(publish_key, subscribe_key, secret_key, cipher_key, ssl_on, initialization_vector); + } + + 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); + } + + /** + * UUID + * + * 32 digit UUID generation at client side. + * + * @return String uuid. + */ + public String uuid() { + + String valueBeforeMD5; + String valueAfterMD5; + SecureRandom mySecureRand = new SecureRandom(); + String s_id = String.valueOf(PubnubCore.class.hashCode()); + StringBuffer sbValueBeforeMD5 = new StringBuffer(); + try { + long time = System.currentTimeMillis(); + long rand = 0; + rand = mySecureRand.nextLong(); + sbValueBeforeMD5.append(s_id); + sbValueBeforeMD5.append(":"); + sbValueBeforeMD5.append(Long.toString(time)); + sbValueBeforeMD5.append(":"); + sbValueBeforeMD5.append(Long.toString(rand)); + valueBeforeMD5 = sbValueBeforeMD5.toString(); + byte[] array = PubnubCrypto.md5(valueBeforeMD5); + StringBuffer sb = new StringBuffer(); + for (int j = 0; j < array.length; ++j) { + int b = array[j] & 0xFF; + if (b < 0x10) { + sb.append('0'); + } + sb.append(Integer.toHexString(b)); + } + valueAfterMD5 = sb.toString(); + String raw = valueAfterMD5.toUpperCase(); + sb = new StringBuffer(); + sb.append(raw.substring(0, 8)); + sb.append("-"); + sb.append(raw.substring(8, 12)); + sb.append("-"); + sb.append(raw.substring(12, 16)); + sb.append("-"); + sb.append(raw.substring(16, 20)); + sb.append("-"); + sb.append(raw.substring(20)); + return sb.toString(); + } catch (Exception e) { + return null; + } + } + + protected String getUserAgent() { + return "J2me/" + VERSION; + } +} diff --git a/j2me/src1/com/pubnub/api/HttpClientCore.java b/j2me/src1/com/pubnub/api/HttpClientCore.java new file mode 100644 index 000000000..c66d3744c --- /dev/null +++ b/j2me/src1/com/pubnub/api/HttpClientCore.java @@ -0,0 +1,228 @@ +package com.pubnub.api; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Hashtable; + +import javax.microedition.io.Connector; +import javax.microedition.io.HttpConnection; + +import com.tinyline.util.GZIPInputStream; + +import org.json.me.*; + +public class HttpClientCore extends HttpClient { + private int requestTimeout = 310000; + private int connectionTimeout = 5000; + private HttpConnection hc; + + private void init() { + + } + + public HttpClientCore(int connectionTimeout, int requestTimeout, Hashtable headers) { + init(); + this.setRequestTimeout(requestTimeout); + this.setConnectionTimeout(connectionTimeout); + this._headers = headers; + } + + + public int getRequestTimeout() { + return requestTimeout; + } + + public void setRequestTimeout(int requestTimeout) { + this.requestTimeout = requestTimeout; + } + + private String readResponse(HttpConnection hconn) { + InputStream in = null; + String prefix = ""; + try { + StringBuffer b = new StringBuffer(); + int ch; + b.append(prefix); + in = hconn.openInputStream(); + if ("gzip".equals(hconn.getEncoding())) + in= new GZIPInputStream(in); + + byte[] data = null; + ByteArrayOutputStream tmp = new ByteArrayOutputStream(); + + while ((ch = in.read()) != -1) { + tmp.write(ch); + } + data = tmp.toByteArray(); + tmp.close(); + b.append(new String(data, "UTF-8")); + + if (b.length() > 0) { + return b.toString(); + } else + return null; + + } catch (IOException ioe) { + return null; + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + } + } + } + } + + public boolean isRedirect(int rc) { + return (rc == HttpConnection.HTTP_MOVED_PERM + || rc == HttpConnection.HTTP_MOVED_TEMP + || rc == HttpConnection.HTTP_SEE_OTHER || rc == HttpConnection.HTTP_TEMP_REDIRECT); + } + + public boolean isOk(int rc) { + return (rc == HttpConnection.HTTP_OK); + } + + public boolean checkResponse(int rc) { + + return (rc == HttpConnection.HTTP_OK || isRedirect(rc)); + } + + public HttpResponse fetch(String url) throws PubnubException, IOException { + return fetch(url, null); + } + + public HttpResponse fetch(String url, Hashtable headers) throws PubnubException, IOException { + if (url == null) + throw new IOException("Invalid Url"); + + int follow = 5; + int rc = 0; + hc = null; + String response = null; + + while (follow-- > 0) { + + hc = (HttpConnection) Connector.open(url, Connector.READ_WRITE, + true); + hc.setRequestMethod(HttpConnection.GET); + if (_headers != null) { + Enumeration en = _headers.keys(); + while (en.hasMoreElements()) { + String key = (String) en.nextElement(); + String val = (String) _headers.get(key); + hc.setRequestProperty(key, val); + } + } + if (headers != null) { + Enumeration en = headers.keys(); + while (en.hasMoreElements()) { + String key = (String) en.nextElement(); + String val = (String) headers.get(key); + hc.setRequestProperty(key, val); + } + } + + rc = hc.getResponseCode(); + + + + if (!checkResponse(rc)) { + break; + } else if (!isRedirect(rc)) { + break; + } + + url = hc.getHeaderField("Location"); + + if (url == null) { + throw new IOException("No Location header"); + } + + if (url.startsWith("/")) { + StringBuffer b = new StringBuffer(); + b.append("https://"); + b.append(hc.getHost()); + b.append(':'); + b.append(hc.getPort()); + b.append(url); + url = b.toString(); + } else if (url.startsWith("ttp:")) { + url = "h" + url; + } + hc.close(); + } + + if (follow == 0) { + throw new IOException("Too many redirects"); + } + + response = readResponse(hc); + switch (rc) { + case HttpUtil.HTTP_FORBIDDEN: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_FORBIDDEN, response)); + case HttpUtil.HTTP_UNAUTHORIZED: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_UNAUTHORIZED, response)); + case HttpUtil.HTTP_BAD_REQUEST: + try { + JSONArray jsarr = new JSONArray(response); + String error = jsarr.get(1).toString(); + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_BAD_REQUEST, 1, error)); + } catch (JSONException e) { + JSONObject jso; + try { + jso = new JSONObject(response); + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_BAD_REQUEST, 2, jso.toString())); + } catch (JSONException e1) { + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_INVALID_JSON, 2)); + } + } + case HttpUtil.HTTP_BAD_GATEWAY: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_BAD_GATEWAY, url)); + case HttpUtil.HTTP_CLIENT_TIMEOUT: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_CLIENT_TIMEOUT, url)); + case HttpUtil.HTTP_GATEWAY_TIMEOUT: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_GATEWAY_TIMEOUT, url)); + case HttpUtil.HTTP_INTERNAL_ERROR: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_INTERNAL_ERROR, url)); + default: + break; + } + + hc.close(); + return new HttpResponse(rc, response); + } + + public int getConnectionTimeout() { + // TODO Auto-generated method stub + return 0; + } + + public void setConnectionTimeout(int connectionTimeout) { + // TODO Auto-generated method stub + + } + + public void abortCurrentRequest() { + // TODO Auto-generated method stub + + } + + public boolean checkResponseSuccess(int rc) { + return (rc == HttpConnection.HTTP_OK); + } + + public void shutdown() { + try { + if (hc != null) { + hc.close(); + } + + } catch (IOException e) { + + } + } +} diff --git a/j2me/src1/com/pubnub/api/NonSubscribeManager.java b/j2me/src1/com/pubnub/api/NonSubscribeManager.java new file mode 100644 index 000000000..91310d1c7 --- /dev/null +++ b/j2me/src1/com/pubnub/api/NonSubscribeManager.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +class NonSubscribeManager extends AbstractNonSubscribeManager { + + public NonSubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public void clearRequestQueue() { + _waiting.removeAllElements(); + } +} diff --git a/j2me/src1/com/pubnub/api/PubnubCrypto.java b/j2me/src1/com/pubnub/api/PubnubCrypto.java new file mode 100644 index 000000000..46963fc11 --- /dev/null +++ b/j2me/src1/com/pubnub/api/PubnubCrypto.java @@ -0,0 +1,47 @@ +package com.pubnub.api; + +import org.bouncycastle.crypto.digests.SHA256Digest; +import org.bouncycastle.crypto.macs.HMac; +import org.bouncycastle.crypto.params.KeyParameter; +import org.bouncycastle.util.BigInteger; + +public class PubnubCrypto extends PubnubCryptoCore { + + public PubnubCrypto(String CIPHER_KEY) { + super(CIPHER_KEY); + } + + public PubnubCrypto(String CIPHER_KEY, String IV) { + super(CIPHER_KEY, IV); + } + + /** + * Sign Message + * + * @param String + * input + * @return String as HashText + */ + public String getHMacSHA256(String secret_key, String input) { + + String signature = "0"; + try { + HMac m = new HMac(new SHA256Digest()); + m.init(new KeyParameter(secret_key.getBytes("UTF-8"))); + byte[] bytes = input.getBytes("UTF-8"); + m.update(bytes, 0, bytes.length); + byte[] mac = new byte[m.getMacSize()]; + m.doFinal(mac, 0); + BigInteger number = new BigInteger(1,mac); + String hashtext = number.toString(); + signature = hashtext; + } catch (java.io.UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + return signature; + } + +} diff --git a/j2me/src1/com/pubnub/api/PubnubUtil.java b/j2me/src1/com/pubnub/api/PubnubUtil.java new file mode 100644 index 000000000..2b4c59679 --- /dev/null +++ b/j2me/src1/com/pubnub/api/PubnubUtil.java @@ -0,0 +1,147 @@ +package com.pubnub.api; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import org.json.me.*; + +public class PubnubUtil extends PubnubUtilCore { + + + private static String replace( String str, String pattern, String replace ) { + int s = 0; + int e = 0; + StringBuffer result = new StringBuffer(); + + while ( (e = str.indexOf( pattern, s ) ) >= 0 ) { + result.append(str.substring( s, e ) ); + result.append( replace ); + s = e+pattern.length(); + } + result.append( str.substring( s ) ); + return result.toString(); + } + + /** + * Returns encoded String + * + * @param sUrl + * , input string + * @return , encoded string + */ + public static String urlEncode(String sUrl) { + try { + return replace(encode(sUrl, "UTF-8"),"+", "%20"); + } catch (UnsupportedEncodingException e) { + return null; + } + } + + + public static String encode(String s, String enc) + throws UnsupportedEncodingException { + + boolean needToChange = false; + boolean wroteUnencodedChar = false; + int maxBytesPerChar = 10; + StringBuffer out = new StringBuffer(s.length()); + ByteArrayOutputStream buf = new ByteArrayOutputStream(maxBytesPerChar); + + OutputStreamWriter writer = new OutputStreamWriter(buf, enc); + + for (int i = 0; i < s.length(); i++) { + int c = (int) s.charAt(i); + if (dontNeedEncoding(c)) { + if (c == ' ') { + c = '+'; + needToChange = true; + } + out.append((char)c); + wroteUnencodedChar = true; + } else { + try { + if (wroteUnencodedChar) { + writer = new OutputStreamWriter(buf, enc); + wroteUnencodedChar = false; + } + writer.write(c); + if (c >= 0xD800 && c <= 0xDBFF) { + + if ( (i+1) < s.length()) { + int d = (int) s.charAt(i+1); + if (d >= 0xDC00 && d <= 0xDFFF) { + writer.write(d); + i++; + } + } + } + writer.flush(); + } catch (IOException e) { + buf.reset(); + continue; + } + byte[] ba = buf.toByteArray(); + for (int j = 0; j < ba.length; j++) { + out.append('%'); + char ch = CCharacter.forDigit((ba[j] >> 4) & 0xF, 16); + out.append(ch); + ch = CCharacter.forDigit(ba[j] & 0xF, 16); + out.append(ch); + } + buf.reset(); + needToChange = true; + } + } + + return (needToChange? out.toString() : s); + } + + static class CCharacter { + public static char forDigit(int digit, int radix) { + if ((digit >= radix) || (digit < 0)) { + return '\0'; + } + if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) { + return '\0'; + } + if (digit < 10) { + return (char)('0' + digit); + } + return (char)('a' - 10 + digit); + } + } + public static boolean dontNeedEncoding(int ch) { + int len = _dontNeedEncoding.length(); + boolean en = false; + for (int i =0; i< len; i++) { + if (_dontNeedEncoding.charAt(i) == ch) { + en = true; + break; + } + } + + return en; + } + + /** + * Convert input String to JSONObject, JSONArray, or String + * + * @param str + * JSON data in string format + * + * @return JSONArray or JSONObject or String + */ + static Object stringToJSON(String str) { + try { + return new JSONArray(str); + } catch (JSONException e) { + } + try { + return new JSONObject(str); + } catch (JSONException ex) { + } + return str; + } + private static String _dontNeedEncoding = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -_.*"; +} diff --git a/j2me/src1/com/pubnub/api/SubscribeManager.java b/j2me/src1/com/pubnub/api/SubscribeManager.java new file mode 100644 index 000000000..f6105f943 --- /dev/null +++ b/j2me/src1/com/pubnub/api/SubscribeManager.java @@ -0,0 +1,24 @@ +package com.pubnub.api; + +class SubscribeManager extends AbstractSubscribeManager { + + public SubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public void resetWorkersConnections() { + for (int i = 0; i < _workers.length; i++) { + _workers[i].die(); + _workers[i].interruptWorker(); + Worker w = getWorker(); + w.setThread(new Thread(w,name)); + _workers[i] = w; + w.startWorker(); + } + } + + public void clearRequestQueue() { + _waiting.removeAllElements(); + } +} diff --git a/j2me/src1/com/pubnub/api/SubscribeWorker.java b/j2me/src1/com/pubnub/api/SubscribeWorker.java new file mode 100644 index 000000000..d83faf446 --- /dev/null +++ b/j2me/src1/com/pubnub/api/SubscribeWorker.java @@ -0,0 +1,105 @@ +package com.pubnub.api; + +import java.util.Hashtable; +import java.util.Vector; + +class SubscribeWorker extends AbstractSubscribeWorker { + + private Exception excp = null; + + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, headers); + } + + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, windowInterval, headers); + } + + void process(HttpRequest hreq) { + HttpResponse hresp = null; + int currentRetryAttempt = (hreq.isDar())?1:maxRetries; + log.verbose("disconnectAndResubscribe is " + hreq.isDar()); + boolean sleep = false; + if (!hreq.isSubzero() && windowInterval != 0) { + try { + Thread.sleep(windowInterval); + } catch (InterruptedException e) { + } + } + while (!_die && currentRetryAttempt <= maxRetries) { + if (sleep) { + try { + Thread.sleep(retryInterval); + } catch (InterruptedException e) { + } + sleep = true; + } + try { + log.debug(hreq.getUrl()); + hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders()); + if (hresp != null + && HttpUtil.checkResponseSuccess(hresp + .getStatusCode())) { + currentRetryAttempt = 1; + break; + } + } /*catch (SocketTimeoutException e) { + log.verbose("No Traffic , Read Timeout Exception in Fetch : " + e.toString()); + if (hreq.isDar()) { + hreq.getResponseHandler().handleBackFromDar(hreq); + return; + } + break; + + }*/catch (PubnubException e) { + excp = e; + switch (e.getPubnubError().errorCode) { + case PubnubError.PNERR_FORBIDDEN: + case PubnubError.PNERR_UNAUTHORIZED: + log.verbose("Authentication Failure : " + e.toString()); + currentRetryAttempt = maxRetries + 1; + break; + default: + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":String.valueOf(currentRetryAttempt)) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + break; + } + + } catch (Exception e) { + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":String.valueOf(currentRetryAttempt)) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + } + + + } + if (!_die) { + if (hresp == null) { + log.debug("Error in fetching url : " + hreq.getUrl()); + if (hreq.isDar()) { + log.verbose("Exhausted number of retries"); + hreq.getResponseHandler().handleTimeout(hreq); + } else { + if (excp != null && excp instanceof PubnubException && ((PubnubException) excp).getPubnubError() != null) { + hreq.getResponseHandler().handleError(hreq, ((PubnubException) excp).getPubnubError()); + } else { + hreq.getResponseHandler().handleError(hreq, PubnubError.getErrorObject(PubnubError.PNERROBJ_HTTP_ERROR, 1)); + } + } + return; + } + log.debug(hresp.getResponse()); + hreq.getResponseHandler().handleResponse(hreq, hresp.getResponse()); + } + + } + public void shutdown() { + if (httpclient != null) httpclient.shutdown(); + } + +} diff --git a/j2me/srcLogging/com/pubnub/api/Logger.java b/j2me/srcLogging/com/pubnub/api/Logger.java new file mode 100644 index 000000000..087a1208d --- /dev/null +++ b/j2me/srcLogging/com/pubnub/api/Logger.java @@ -0,0 +1,32 @@ +package com.pubnub.api; + + + +class Logger extends AbstractLogger { + private Class _class; + + public Logger(Class _class) { + this._class = _class; + } + + protected void nativeDebug(String s) { + System.out.println("["+Thread.activeCount()+ "] Thread ID : " + Thread.currentThread().hashCode() + " " + s); + + } + + protected void nativeVerbose(String s) { + System.out.println("["+Thread.activeCount()+ "] Thread ID : " + Thread.currentThread().hashCode() + " " + s); + } + + + protected void nativeError(String s) { + System.out.println("["+Thread.activeCount()+ "] Thread ID : " + Thread.currentThread().hashCode() + " " + s); + + } + + protected void nativeInfo(String s) { + System.out.println("["+Thread.activeCount()+ "] Thread ID : " + Thread.currentThread().hashCode() + " " + s); + + } + +} diff --git a/java/LICENSE b/java/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/java/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/java/Pubnub-StandardEdition-3.5.6.jar b/java/Pubnub-StandardEdition-3.5.6.jar new file mode 100644 index 000000000..ede71a8ac Binary files /dev/null and b/java/Pubnub-StandardEdition-3.5.6.jar differ diff --git a/java/Pubnub-StandardEdition-Debug-3.5.6.jar b/java/Pubnub-StandardEdition-Debug-3.5.6.jar new file mode 100644 index 000000000..cf021e2b6 Binary files /dev/null and b/java/Pubnub-StandardEdition-Debug-3.5.6.jar differ diff --git a/java/README.md b/java/README.md new file mode 100644 index 000000000..aabcc3575 --- /dev/null +++ b/java/README.md @@ -0,0 +1,194 @@ +##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. +##### http://www.pubnub.com/account + +## PubNub 3.5 Real-time Cloud Push API - JAVA + +www.pubnub.com - PubNub Real-time Push Service in the Cloud. + +Please reference the demo app in jars/PubnubDemoConsole.jar for an example of using PubNub +Asyncronously in your applications! + +Additional Java docs are available at [doc/index.html](doc/index.html) + +###To browse source +Checkout [srcPubnubApi](/java/srcPubnubApi) + +###To setup with your IDE: +[Check out the Eclipse video walkthrough here!](https://vimeo.com/69587309) + +1. Add new project with java/ as the root +2. Set the new project source as java/srcPubnubApi +3. Add java/Pubnub-Standardedition-3.5.jar and 3.5/libs/*.jar as project libaries +4. You should be able to run PubnubDemoConsole and PubnubExample via your IDE + +###To build from the CL, run: +``` +$ ant clean build +$ ant +``` + +###To test from the CL, run: +``` +$ ant test +``` + +###To be really cool and clean, build, and test at once! +``` +$ ant clean build test +``` + +[A quick video demo of building with ant from the command line can be viewed here](https://vimeo.com/76488749). +###Configuring Logging + +[Check out the logging video walkthrough here!](https://vimeo.com/71309975) + +Pubnub implements swappable logging using SLF4J, which allows you to switch different logging frameworks easily. All the logging calls using SLF4J API will be delegated to the underlying logging framework. + +Before you enable logging, you need to create a "debug-build" version of the Pubnub-StandardEdition.jar. + +####To create a debug-build + +1. Go to Terminal on Mac/Linux or command-line on Windows +2. Change directory to the Java folder where you have cloned the git java repo of pubnub (https://github.com/pubnub/java.git) +3. Type "ant debug-build" +4. The debug version of Pubnub-StandardEdition jar file (e.g Pubnub-StandardEdition-3.x.x.jar) will be created. +5. Add this jar as a reference in your project. + +To implement logging using log4j you need to add the following references to the project. Using log4j you can log to console or a file or both. + +1. slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API +2. slf4j-log4j jar file (e.g. slf4j-log4j-1.7.5.jar or a latest version) which acts as a bridge between slf4j and log4j +3. log4j jar file (log4j-1.2.17.jar or a latest version), which provides the underlying logging framework +4. Along with these references you need to add the log4j.properties file in the CLASSPATH + +For example, in your log4j.properties file, configure it to write the logs to a log file: +```java +# Root logger option +log4j.rootLogger=ALL, FILE + +# Direct log messages to a log file +log4j.appender.FILE =org.apache.log4j.FileAppender +log4j.appender.FILE.File=/Users/rajat/Projects/eclipsews/log4jloging.log +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +``` + +More info can be found here http://www.tutorialspoint.com/log4j/log4j_configuration.htm + + +ii) To implement logging using simple slf4j you need to add the following references to the project +- slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API +- slf4j-simple jar file (e.g. slf4j-simple-1.7.5.jar or a latest version) which provides the underlying logging framework +- Along with these references you need to add the simplelogger.properties file in the CLASSPATH + +iii) To implement logging using logback-classic you need to add the following references to the project +- slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API +- logback-classic and logback-core jar files which provide the underlying logging framework + +iv) To implement logging using java.util.logging you need to add the following references to the project +- slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API +- slf4j-jdk14 jar file which acts as a bridge between slf4j and java +- JVM runtime provides the underlying logging framework + +v) To implement logging using commons-logging you need to add the following references to the project +- slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API +- slf4j-jcl jar file which acts as a bridge between slf4j and common-logging +- common-logging.jar file which acts as an abstraction layer +- The underlying logging framework is chosen dynamically by commons-logging + +vi) To implement no logging you have two options + +Option 1: +- Add the reference of slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API and nothing else. + +Option 2: +- Add the reference of slf4j-api jar file (e.g. slf4j-api-1.7.5.jar or a latest version) which is the SLF4J API. +- And add a reference to slf4j-nop jar file (e.g. slf4j-nop-1.7.5.jar or a latest version). + + +More info on SLF4J can be found at http://stackoverflow.com/questions/8737204/how-slf4j-works-no-log-getting-created + +###To run the DemoConsole: +``` +$ cd jars +$ java -jar PubnubDemoConsole.jar +``` + +###Heres an example of running PubnubDemoConsole: + +``` +$~/pubnub/java/java/jars$ java -jar PubnubDemoConsole.jar +HINT: To test Re-connect and catch-up + Disconnect your machine from network/internet and + re-connect your machine after sometime +Enable SSL ? Enter Y for Yes, else N +N + +SSL not enabled +Enter cipher key for encryption feature +If you don't want to avail at this time, press ENTER + +No Cipher key provided +ENTER 1 FOR Subscribe (Currently subscribed to no channels.) +ENTER 2 FOR Publish +ENTER 3 FOR Presence +ENTER 4 FOR Detailed History +ENTER 5 FOR Here_Now +ENTER 6 FOR Unsubscribe +ENTER 7 FOR Presence-Unsubscribe +ENTER 8 FOR Time +ENTER 9 FOR EXIT OR QUIT +ENTER 10 FOR Disconnect-And-Resubscribe +ENTER 11 FOR Toggle Resume On Reconnect + +ENTER 0 to display this menu +1 +Subscribe: Enter Channel name +hello_world +Subscribed to following channels: +hello_world +ENTER 1 FOR Subscribe (Currently subscribed to hello_world) +ENTER 2 FOR Publish +ENTER 3 FOR Presence +ENTER 4 FOR Detailed History +ENTER 5 FOR Here_Now +ENTER 6 FOR Unsubscribe +ENTER 7 FOR Presence-Unsubscribe +ENTER 8 FOR Time +ENTER 9 FOR EXIT OR QUIT +ENTER 10 FOR Disconnect-And-Resubscribe +ENTER 11 FOR Toggle Resume On Reconnect + +ENTER 0 to display this menu + +SUBSCRIBE : CONNECT on channel:hello_world +1 +Subscribe: Enter Channel name +my_channel +Subscribed to following channels: +hello_world : my_channel +ENTER 1 FOR Subscribe (Currently subscribed to hello_world,my_channel) +ENTER 2 FOR Publish +ENTER 3 FOR Presence +ENTER 4 FOR Detailed History +ENTER 5 FOR Here_Now +ENTER 6 FOR Unsubscribe +ENTER 7 FOR Presence-Unsubscribe +ENTER 8 FOR Time +ENTER 9 FOR EXIT OR QUIT +ENTER 10 FOR Disconnect-And-Resubscribe +ENTER 11 FOR Toggle Resume On Reconnect + +ENTER 0 to display this menu +SUBSCRIBE : CONNECT on channel:my_channel +2 +Publish: Enter Channel name +hello_world +Enter the message for publish. To exit loop enter QUIT +"hello, world!" +PUBLISH : [1,"Sent","13597534956712683"] +SUBSCRIBE : hello_world : class java.lang.String : hello, world! +SUBSCRIBE : hello_world : class java.lang.String : 3ZoxkVMB97lf09jpFU9gtw== +SUBSCRIBE : hello_world : class java.lang.String : 3ZoxkVMB97lf09jpFU9gtw== +``` +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/pubnub/java/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/java/build.xml b/java/build.xml new file mode 100644 index 000000000..225d40938 --- /dev/null +++ b/java/build.xml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html new file mode 100644 index 000000000..e6d022125 --- /dev/null +++ b/java/doc/allclasses-frame.html @@ -0,0 +1,41 @@ + + + + + + +All Classes + + + + + + + + + + + +All Classes +
+ + + + + +
Callback +
+HttpUtil +
+Pubnub +
+PubnubError +
+PubnubException +
+PubnubUtil +
+
+ + + diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html new file mode 100644 index 000000000..8e5dabeb0 --- /dev/null +++ b/java/doc/allclasses-noframe.html @@ -0,0 +1,41 @@ + + + + + + +All Classes + + + + + + + + + + + +All Classes +
+ + + + + +
Callback +
+HttpUtil +
+Pubnub +
+PubnubError +
+PubnubException +
+PubnubUtil +
+
+ + + diff --git a/java/doc/com/pubnub/api/Callback.html b/java/doc/com/pubnub/api/Callback.html new file mode 100644 index 000000000..257187f2e --- /dev/null +++ b/java/doc/com/pubnub/api/Callback.html @@ -0,0 +1,382 @@ + + + + + + +Callback + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.pubnub.api +
+Class Callback

+
+java.lang.Object
+  extended by com.pubnub.api.Callback
+
+
+
+
public abstract class Callback
extends java.lang.Object
+ + +

+Abstract class to be subclassed by objects being passed as callbacks to + Pubnub APIs Default implementation for all methods is blank +

+ +

+

+
Author:
+
Pubnub
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
Callback() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidconnectCallback(java.lang.String channel, + java.lang.Object message) + +
+          This callback will be invoked on getting connected to a channel
+ voiddisconnectCallback(java.lang.String channel, + java.lang.Object message) + +
+          This callback is invoked on getting disconnected from a channel
+ voiderrorCallback(java.lang.String channel, + java.lang.Object message) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . + Replaced by errorCallback(String channel, PubnubError error)
+ voiderrorCallback(java.lang.String channel, + PubnubError error) + +
+          This callback will be invoked when an error occurs
+ voidreconnectCallback(java.lang.String channel, + java.lang.Object message) + +
+          This callback is invoked on getting reconnected to a channel after + getting disconnected
+abstract  voidsuccessCallback(java.lang.String channel, + java.lang.Object message) + +
+          This callback will be invoked when a message is received on the channel
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Callback

+
+public Callback()
+
+
+ + + + + + + + +
+Method Detail
+ +

+successCallback

+
+public abstract void successCallback(java.lang.String channel,
+                                     java.lang.Object message)
+
+
This callback will be invoked when a message is received on the channel +

+

+
Parameters:
channel - Channel Name
message - Message
+
+
+
+ +

+errorCallback

+
+public void errorCallback(java.lang.String channel,
+                          PubnubError error)
+
+
This callback will be invoked when an error occurs +

+

+
Parameters:
channel - Channel Name
error - error
+
+
+
+ +

+errorCallback

+
+public void errorCallback(java.lang.String channel,
+                          java.lang.Object message)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . + Replaced by errorCallback(String channel, PubnubError error) +

+

This callback will be invoked when an error occurs +

+

+
Parameters:
channel - Channel Name
message - Message
+
+
+
+ +

+connectCallback

+
+public void connectCallback(java.lang.String channel,
+                            java.lang.Object message)
+
+
This callback will be invoked on getting connected to a channel +

+

+
Parameters:
channel - Channel Name
+
+
+
+ +

+reconnectCallback

+
+public void reconnectCallback(java.lang.String channel,
+                              java.lang.Object message)
+
+
This callback is invoked on getting reconnected to a channel after + getting disconnected +

+

+
Parameters:
channel - Channel Name
+
+
+
+ +

+disconnectCallback

+
+public void disconnectCallback(java.lang.String channel,
+                               java.lang.Object message)
+
+
This callback is invoked on getting disconnected from a channel +

+

+
Parameters:
channel - Channel Name
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/HttpUtil.html b/java/doc/com/pubnub/api/HttpUtil.html new file mode 100644 index 000000000..fef19cb45 --- /dev/null +++ b/java/doc/com/pubnub/api/HttpUtil.html @@ -0,0 +1,521 @@ + + + + + + +HttpUtil + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.pubnub.api +
+Class HttpUtil

+
+java.lang.Object
+  extended by com.pubnub.api.HttpUtil
+
+
+
+
public class HttpUtil
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intHTTP_BAD_GATEWAY + +
+           
+static intHTTP_BAD_REQUEST + +
+           
+static intHTTP_CLIENT_TIMEOUT + +
+           
+static intHTTP_FORBIDDEN + +
+           
+static intHTTP_GATEWAY_TIMEOUT + +
+           
+static intHTTP_INTERNAL_ERROR + +
+           
+static intHTTP_MOVED_PERM + +
+           
+static intHTTP_MOVED_TEMP + +
+           
+static intHTTP_OK + +
+           
+static intHTTP_SEE_OTHER + +
+           
+static intHTTP_UNAUTHORIZED + +
+           
+  + + + + + + + + + + +
+Constructor Summary
HttpUtil() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static booleancheckResponse(int rc) + +
+           
+static booleancheckResponseSuccess(int rc) + +
+           
+static booleanisOk(int rc) + +
+           
+static booleanisRedirect(int rc) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+HTTP_MOVED_PERM

+
+public static final int HTTP_MOVED_PERM
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_MOVED_TEMP

+
+public static final int HTTP_MOVED_TEMP
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_SEE_OTHER

+
+public static final int HTTP_SEE_OTHER
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_OK

+
+public static final int HTTP_OK
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_FORBIDDEN

+
+public static final int HTTP_FORBIDDEN
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_UNAUTHORIZED

+
+public static final int HTTP_UNAUTHORIZED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_BAD_REQUEST

+
+public static final int HTTP_BAD_REQUEST
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_BAD_GATEWAY

+
+public static final int HTTP_BAD_GATEWAY
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_CLIENT_TIMEOUT

+
+public static final int HTTP_CLIENT_TIMEOUT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_GATEWAY_TIMEOUT

+
+public static final int HTTP_GATEWAY_TIMEOUT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+HTTP_INTERNAL_ERROR

+
+public static final int HTTP_INTERNAL_ERROR
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+HttpUtil

+
+public HttpUtil()
+
+
+ + + + + + + + +
+Method Detail
+ +

+isRedirect

+
+public static boolean isRedirect(int rc)
+
+
+
+
+
+
+ +

+isOk

+
+public static boolean isOk(int rc)
+
+
+
+
+
+
+ +

+checkResponse

+
+public static boolean checkResponse(int rc)
+
+
+
+
+
+
+ +

+checkResponseSuccess

+
+public static boolean checkResponseSuccess(int rc)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/Pubnub.html b/java/doc/com/pubnub/api/Pubnub.html new file mode 100644 index 000000000..b32365cb9 --- /dev/null +++ b/java/doc/com/pubnub/api/Pubnub.html @@ -0,0 +1,2383 @@ + + + + + + +Pubnub + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.pubnub.api +
+Class Pubnub

+
+java.lang.Object
+  extended by com.pubnub.api.Pubnub
+
+
+
+
public class Pubnub
extends java.lang.Object
+ + +

+Pubnub object facilitates querying channels for messages and listening on + channels for presence/message events +

+ +

+

+
Author:
+
Pubnub
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
Pubnub(java.lang.String publish_key, + java.lang.String subscribe_key) + +
+          Pubnub Constructor
Pubnub(java.lang.String publish_key, + java.lang.String subscribe_key, + boolean ssl) + +
+           
Pubnub(java.lang.String publish_key, + java.lang.String subscribe_key, + java.lang.String secret_key) + +
+           
Pubnub(java.lang.String publish_key, + java.lang.String subscribe_key, + java.lang.String secret_key, + boolean ssl_on) + +
+          Pubnub Constructor
Pubnub(java.lang.String publish_key, + java.lang.String subscribe_key, + java.lang.String secret_key, + java.lang.String cipher_key, + boolean ssl_on) + +
+          Pubnub Constructor
Pubnub(java.lang.String publish_key, + java.lang.String subscribe_key, + java.lang.String secret_key, + java.lang.String cipher_key, + boolean ssl_on, + java.lang.String initialization_vector) + +
+          Constructor for Pubnub Class
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddetailedHistory(java.lang.String channel, + boolean reverse, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, boolean reverse, Callback callback)
+ voiddetailedHistory(java.lang.String channel, + int count, + boolean reverse, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, int count, boolean reverse, Callback callback)
+ voiddetailedHistory(java.lang.String channel, + int count, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, int count, Callback callback)
+ voiddetailedHistory(java.lang.String channel, + long start, + boolean reverse, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, boolean reverse, Callback callback)
+ voiddetailedHistory(java.lang.String channel, + long start, + long end, + boolean reverse, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, long end, boolean reverse, Callback callback)
+ voiddetailedHistory(java.lang.String channel, + long start, + long end, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, long end, Callback callback)
+ voiddetailedHistory(java.lang.String channel, + long start, + long end, + int count, + boolean reverse, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, long end, int count, boolean reverse, Callback callback)
+ voiddisconnectAndResubscribe() + +
+          Disconnect from all channels, and resubscribe
+ voiddisconnectAndResubscribe(PubnubError error) + +
+          Disconnect from all channels, and resubscribe
+ voiddisconnectAndResubscribeWithTimetoken(java.lang.String timetoken) + +
+          Disconnect from all channels, and resubscribe
+ voiddisconnectAndResubscribeWithTimetoken(java.lang.String timetoken, + PubnubError error) + +
+          Disconnect from all channels, and resubscribe
+ java.lang.StringgetAuthKey() + +
+          This method returns auth key.
+ booleangetCacheBusting() + +
+          Get Cache Busting value
+ java.lang.StringgetCurrentlySubscribedChannelNames() + +
+          This method returns all channel names currently subscribed to in form of + a comma separated String
+ java.lang.StringgetDomain() + +
+          Returns domain
+ intgetMaxRetries() + +
+          Returns current max retries for Subscribe
+ intgetNonSubscribeTimeout() + +
+          This method returns timeout value for non subscribe operations like publish, history, hereNow
+ java.lang.StringgetOrigin() + +
+          Returns origin
+ booleangetResumeOnReconnect() + +
+          Returns Resume on Reconnect current setting
+ intgetRetryInterval() + +
+          Returns current retry interval for subscribe
+ java.lang.String[]getSubscribedChannelsArray() + +
+          This method returns array of channel names, currently subscribed to
+ intgetSubscribeTimeout() + +
+          This method returns timeout value for subscribe/presence.
+ java.lang.StringgetUUID() + +
+          Gets current UUID
+ intgetWindowInterval() + +
+          Returns current window interval for subscribe
+ voidhereNow(java.lang.String channel, + Callback callback) + +
+          Read presence information from a channel
+ voidhistory(java.util.Hashtable args) + +
+          Read history from a channel.
+ voidhistory(java.lang.String channel, + boolean reverse, + Callback callback) + +
+          Read History for a channel.
+ voidhistory(java.lang.String channel, + int count, + boolean reverse, + Callback callback) + +
+          Read History for a channel.
+ voidhistory(java.lang.String channel, + int count, + Callback callback) + +
+          Read History for a channel.
+ voidhistory(java.lang.String channel, + long start, + boolean reverse, + Callback callback) + +
+          Read history for a channel.
+ voidhistory(java.lang.String channel, + long start, + long end, + boolean reverse, + Callback callback) + +
+          Read History for a channel.
+ voidhistory(java.lang.String channel, + long start, + long end, + Callback callback) + +
+          Read History for a channel.
+ voidhistory(java.lang.String channel, + long start, + long end, + int count, + boolean reverse, + Callback callback) + +
+          Read History for a channel.
+ booleanisResumeOnReconnect() + +
+          This method returns the state of Resume on Reconnect setting
+ voidpamAudit(Callback callback) + +
+          ULS Audit
+ voidpamAudit(java.lang.String channel, + Callback callback) + +
+          ULS audit by channel
+ voidpamAudit(java.lang.String channel, + java.lang.String auth_key, + Callback callback) + +
+          ULS audit by channel and auth key
+ voidpamGrant(java.lang.String channel, + boolean read, + boolean write, + Callback callback) + +
+          Grant r/w access based on channel
+ voidpamGrant(java.lang.String channel, + boolean read, + boolean write, + int ttl, + Callback callback) + +
+          Grant r/w access based on channel
+ voidpamGrant(java.lang.String channel, + java.lang.String auth_key, + boolean read, + boolean write, + Callback callback) + +
+          Grant r/w access based on channel and auth key
+ voidpamGrant(java.lang.String channel, + java.lang.String auth_key, + boolean read, + boolean write, + int ttl, + Callback callback) + +
+          Grant r/w access based on channel and auth key
+ voidpamRevoke(java.lang.String channel, + Callback callback) + +
+          ULS revoke by channel
+ voidpamRevoke(java.lang.String channel, + java.lang.String auth_key, + Callback callback) + +
+          ULS revoke by channel and auth key
+ voidpresence(java.lang.String channel, + Callback callback) + +
+          Listen for presence of subscribers on a channel
+ voidpublish(java.util.Hashtable args) + +
+          Deprecated. As of version 3.5.2 . Will be removed in 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated.
+ voidpublish(java.util.Hashtable args, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated.
+ voidpublish(java.lang.String channel, + java.lang.Double message, + Callback callback) + +
+          Send a message to a channel.
+ voidpublish(java.lang.String channel, + java.lang.Integer message, + Callback callback) + +
+          Send a message to a channel.
+ voidpublish(java.lang.String channel, + org.json.JSONArray message, + Callback callback) + +
+          Send a message to a channel.
+ voidpublish(java.lang.String channel, + org.json.JSONObject message, + Callback callback) + +
+          Send a message to a channel.
+ voidpublish(java.lang.String channel, + java.lang.String message, + Callback callback) + +
+          Send a message to a channel.
+ voidsetAuthKey(java.lang.String authKey) + +
+          This method sets auth key.
+ voidsetCacheBusting(boolean cacheBusting) + +
+          Enable/Disable Cache Busting
+ voidsetDomain(java.lang.String domain) + +
+          Sets domain value, default is "pubnub.com"
+ voidsetMaxRetries(int maxRetries) + +
+          This methods sets maximum number of retries for subscribe.
+ voidsetNonSubscribeTimeout(int timeout) + +
+          This method set timeout value for non subscribe operations like publish, + history, hereNow.
+ voidsetOrigin(java.lang.String origin) + +
+          Sets origin value, default is "pubsub"
+ voidsetResumeOnReconnect(boolean resumeOnReconnect) + +
+          If Resume on Reconnect is set to true, then Pubnub catches up on + reconnection after disconnection.
+ voidsetRetryInterval(int retryInterval) + +
+          This method sets retry interval for subscribe.
+ voidsetSubscribeTimeout(int timeout) + +
+          This method sets timeout value for subscribe/presence.
+ voidsetUUID(java.lang.String uuid) + +
+          Sets value for UUID
+ voidsetUUID(java.util.UUID uuid) + +
+          Sets value for UUID
+ voidsetWindowInterval(int windowInterval) + +
+          This method sets window interval for subscribe.
+ voidshutdown() + +
+          This method when called stops Pubnub threads
+ voidsubscribe(java.util.Hashtable args) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated.
+ voidsubscribe(java.util.Hashtable args, + Callback callback) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 .
+ voidsubscribe(java.lang.String[] channelsArr, + Callback callback) + +
+          Listen for a message on a channel.
+ voidsubscribe(java.lang.String[] channelsArr, + Callback callback, + long timetoken) + +
+          Listen for a message on a channel.
+ voidsubscribe(java.lang.String[] channelsArr, + Callback callback, + java.lang.String timetoken) + +
+          Listen for a message on a channel.
+ voidsubscribe(java.lang.String channel, + Callback callback) + +
+          Listen for a message on a channel.
+ voidsubscribe(java.lang.String channel, + Callback callback, + long timetoken) + +
+          Listen for a message on a channel.
+ voidsubscribe(java.lang.String channel, + Callback callback, + java.lang.String timetoken) + +
+          Listen for a message on a channel.
+ voidtime(Callback callback) + +
+          Read current time from PubNub Cloud.
+ voidunsetAuthKey() + +
+          This method unsets auth key.
+ voidunsubscribe(java.util.Hashtable args) + +
+          Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated.
+ voidunsubscribe(java.lang.String channel) + +
+          Unsubscribe/Disconnect from channel.
+ voidunsubscribe(java.lang.String[] channels) + +
+          Unsubscribe from channels.
+ voidunsubscribeAll() + +
+          Unsubscribe from all channel.
+ voidunsubscribePresence(java.lang.String channel) + +
+          Unsubscribe from presence channel.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Pubnub

+
+public Pubnub(java.lang.String publish_key,
+              java.lang.String subscribe_key,
+              java.lang.String secret_key,
+              java.lang.String cipher_key,
+              boolean ssl_on)
+
+
Pubnub Constructor +

+

+
Parameters:
publish_key - Publish Key
subscribe_key - Subscribe Key
secret_key - Secret Key
cipher_key - Cipher Key
ssl_on - SSL on ?
+
+
+ +

+Pubnub

+
+public Pubnub(java.lang.String publish_key,
+              java.lang.String subscribe_key,
+              java.lang.String secret_key,
+              boolean ssl_on)
+
+
Pubnub Constructor +

+

+
Parameters:
publish_key - Publish key
subscribe_key - Subscribe Key
secret_key - Secret Key
ssl_on - SSL on ?
+
+
+ +

+Pubnub

+
+public Pubnub(java.lang.String publish_key,
+              java.lang.String subscribe_key)
+
+
Pubnub Constructor +

+

+
Parameters:
publish_key - Publish Key
subscribe_key - Subscribe Key
+
+
+ +

+Pubnub

+
+public Pubnub(java.lang.String publish_key,
+              java.lang.String subscribe_key,
+              boolean ssl)
+
+
+
Parameters:
publish_key - Publish Key
subscribe_key - Subscribe Key
ssl -
+
+
+ +

+Pubnub

+
+public Pubnub(java.lang.String publish_key,
+              java.lang.String subscribe_key,
+              java.lang.String secret_key)
+
+
+
Parameters:
publish_key -
subscribe_key -
secret_key -
+
+
+ +

+Pubnub

+
+public Pubnub(java.lang.String publish_key,
+              java.lang.String subscribe_key,
+              java.lang.String secret_key,
+              java.lang.String cipher_key,
+              boolean ssl_on,
+              java.lang.String initialization_vector)
+
+
Constructor for Pubnub Class +

+

+
Parameters:
publish_key - Publish Key
subscribe_key - Subscribe Key
secret_key - Secret Key
cipher_key - Cipher Key
ssl_on - SSL enabled ?
initialization_vector - Initialization vector
+
+ + + + + + + + +
+Method Detail
+ +

+setUUID

+
+public void setUUID(java.util.UUID uuid)
+
+
Sets value for UUID +

+

+
Parameters:
uuid - UUID value for Pubnub client
+
+
+
+ +

+setSubscribeTimeout

+
+public void setSubscribeTimeout(int timeout)
+
+
This method sets timeout value for subscribe/presence. Default value is + 310000 milliseconds i.e. 310 seconds +

+

+
+
+
+
Parameters:
timeout - Timeout value in milliseconds for subscribe/presence
+
+
+
+ +

+getSubscribeTimeout

+
+public int getSubscribeTimeout()
+
+
This method returns timeout value for subscribe/presence. +

+

+
+
+
+ +
Returns:
Timeout value in milliseconds for subscribe/presence
+
+
+
+ +

+setNonSubscribeTimeout

+
+public void setNonSubscribeTimeout(int timeout)
+
+
This method set timeout value for non subscribe operations like publish, + history, hereNow. Default value is 15000 milliseconds i.e. 15 seconds. +

+

+
+
+
+
Parameters:
timeout - Timeout value in milliseconds for Non subscribe operations + like publish, history, hereNow
+
+
+
+ +

+getNonSubscribeTimeout

+
+public int getNonSubscribeTimeout()
+
+
This method returns timeout value for non subscribe operations like publish, history, hereNow +

+

+
+
+
+ +
Returns:
Timeout value in milliseconds for for Non subscribe operations like publish, history, hereNow
+
+
+
+ +

+publish

+
+@Deprecated
+public void publish(java.util.Hashtable args,
+                               Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +

+

Send a message to a channel. +

+

+
+
+
+
Parameters:
args - Hashtable containing channel name, message.
callback - object of sub class of Callback class
+
+
+
+ +

+publish

+
+@Deprecated
+public void publish(java.util.Hashtable args)
+
+
Deprecated. As of version 3.5.2 . Will be removed in 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +

+

Send a message to a channel. +

+

+
+
+
+
Parameters:
args - Hashtable containing channel name, message, callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       long start,
+                                       long end,
+                                       int count,
+                                       boolean reverse,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, long end, int count, boolean reverse, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
end - End time
count - Upper limit on number of messages to be returned
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    long start,
+                    long end,
+                    int count,
+                    boolean reverse,
+                    Callback callback)
+
+
Read History for a channel. +

+

+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
end - End time
count - Upper limit on number of messages to be returned
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       long start,
+                                       boolean reverse,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, boolean reverse, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    long start,
+                    boolean reverse,
+                    Callback callback)
+
+
Read history for a channel. +

+

+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       long start,
+                                       long end,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, long end, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
end - End time
callback - Callback
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    long start,
+                    long end,
+                    Callback callback)
+
+
Read History for a channel. +

+

+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
end - End time
callback - Callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       long start,
+                                       long end,
+                                       boolean reverse,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, long start, long end, boolean reverse, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
end - End time
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    long start,
+                    long end,
+                    boolean reverse,
+                    Callback callback)
+
+
Read History for a channel. +

+

+
Parameters:
channel - Channel name for which detailed history is required
start - Start time
end - End time
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       int count,
+                                       boolean reverse,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, int count, boolean reverse, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
count - Upper limit on number of messages to be returned
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    int count,
+                    boolean reverse,
+                    Callback callback)
+
+
Read History for a channel. +

+

+
Parameters:
channel - Channel name for which detailed history is required
count - Upper limit on number of messages to be returned
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       boolean reverse,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, boolean reverse, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    boolean reverse,
+                    Callback callback)
+
+
Read History for a channel. +

+

+
Parameters:
channel - Channel name for which detailed history is required
reverse - True if messages need to be in reverse order
callback - Callback
+
+
+
+ +

+detailedHistory

+
+@Deprecated
+public void detailedHistory(java.lang.String channel,
+                                       int count,
+                                       Callback callback)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + history(String channel, int count, Callback callback) +

+

Read DetailedHistory for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
count - Maximum number of messages
callback - Callback object
+
+
+
+ +

+history

+
+public void history(java.lang.String channel,
+                    int count,
+                    Callback callback)
+
+
Read History for a channel. +

+

+
+
+
+
Parameters:
channel - Channel name for which detailed history is required
count - Maximum number of messages
callback - Callback object
+
+
+
+ +

+unsubscribe

+
+@Deprecated
+public void unsubscribe(java.util.Hashtable args)
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +

+

Unsubscribe/Disconnect from channel. +

+

+
+
+
+
Parameters:
args - Hashtable containing channel name.
+
+
+
+ +

+subscribe

+
+@Deprecated
+public void subscribe(java.util.Hashtable args,
+                                 Callback callback)
+               throws PubnubException
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . +

+

Listen for a message on a channel. +

+

+
+
+
+
Parameters:
args - Hashtable containing channel name
callback - Callback +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+subscribe

+
+@Deprecated
+public void subscribe(java.util.Hashtable args)
+               throws PubnubException
+
+
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +

+

Listen for a message on a channel. +

+

+
+
+
+
Parameters:
args - Hashtable containing channel name, callback +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+pamGrant

+
+public void pamGrant(java.lang.String channel,
+                     java.lang.String auth_key,
+                     boolean read,
+                     boolean write,
+                     Callback callback)
+
+
Grant r/w access based on channel and auth key +

+

+
Parameters:
channel -
auth_key -
read -
write -
callback -
+
+
+
+ +

+pamGrant

+
+public void pamGrant(java.lang.String channel,
+                     boolean read,
+                     boolean write,
+                     Callback callback)
+
+
Grant r/w access based on channel +

+

+
Parameters:
channel -
read -
write -
callback -
+
+
+
+ +

+pamGrant

+
+public void pamGrant(java.lang.String channel,
+                     boolean read,
+                     boolean write,
+                     int ttl,
+                     Callback callback)
+
+
Grant r/w access based on channel +

+

+
Parameters:
channel -
read -
write -
ttl -
callback -
+
+
+
+ +

+pamGrant

+
+public void pamGrant(java.lang.String channel,
+                     java.lang.String auth_key,
+                     boolean read,
+                     boolean write,
+                     int ttl,
+                     Callback callback)
+
+
Grant r/w access based on channel and auth key +

+

+
Parameters:
channel -
auth_key -
read -
write -
ttl -
callback -
+
+
+
+ +

+pamAudit

+
+public void pamAudit(Callback callback)
+
+
ULS Audit +

+

+
Parameters:
callback -
+
+
+
+ +

+pamAudit

+
+public void pamAudit(java.lang.String channel,
+                     Callback callback)
+
+
ULS audit by channel +

+

+
Parameters:
channel -
callback -
+
+
+
+ +

+pamAudit

+
+public void pamAudit(java.lang.String channel,
+                     java.lang.String auth_key,
+                     Callback callback)
+
+
ULS audit by channel and auth key +

+

+
Parameters:
channel -
auth_key -
callback -
+
+
+
+ +

+pamRevoke

+
+public void pamRevoke(java.lang.String channel,
+                      java.lang.String auth_key,
+                      Callback callback)
+
+
ULS revoke by channel and auth key +

+

+
Parameters:
channel -
auth_key -
callback -
+
+
+
+ +

+pamRevoke

+
+public void pamRevoke(java.lang.String channel,
+                      Callback callback)
+
+
ULS revoke by channel +

+

+
Parameters:
channel -
callback -
+
+
+
+ +

+shutdown

+
+public void shutdown()
+
+
This method when called stops Pubnub threads +

+

+
+
+
+
+ +

+isResumeOnReconnect

+
+public boolean isResumeOnReconnect()
+
+
This method returns the state of Resume on Reconnect setting +

+

+ +
Returns:
Current state of Resume On Reconnect Setting
+
+
+
+ +

+setRetryInterval

+
+public void setRetryInterval(int retryInterval)
+
+
This method sets retry interval for subscribe. Pubnub API will make + maxRetries attempts to connect to pubnub servers. These attemtps will be + made at an interval of retryInterval milliseconds. +

+

+
Parameters:
retryInterval - Retry Interval in milliseconds
+
+
+
+ +

+setWindowInterval

+
+public void setWindowInterval(int windowInterval)
+
+
This method sets window interval for subscribe. +

+

+
Parameters:
windowInterval - Window Interval in milliseconds
+
+
+
+ +

+getRetryInterval

+
+public int getRetryInterval()
+
+
Returns current retry interval for subscribe +

+

+ +
Returns:
Current Retry Interval in milliseconds
+
+
+
+ +

+getWindowInterval

+
+public int getWindowInterval()
+
+
Returns current window interval for subscribe +

+

+ +
Returns:
Current Window Interval in milliseconds
+
+
+
+ +

+setMaxRetries

+
+public void setMaxRetries(int maxRetries)
+
+
This methods sets maximum number of retries for subscribe. Pubnub API + will make maxRetries attempts to connect to pubnub servers before timing + out. +

+

+
Parameters:
maxRetries - Max number of retries
+
+
+
+ +

+getMaxRetries

+
+public int getMaxRetries()
+
+
Returns current max retries for Subscribe +

+

+ +
Returns:
Current max retries
+
+
+
+ +

+setCacheBusting

+
+public void setCacheBusting(boolean cacheBusting)
+
+
Enable/Disable Cache Busting +

+

+
Parameters:
cacheBusting -
+
+
+
+ +

+getCacheBusting

+
+public boolean getCacheBusting()
+
+
Get Cache Busting value +

+

+ +
Returns:
current cache busting setting
+
+
+
+ +

+getCurrentlySubscribedChannelNames

+
+public java.lang.String getCurrentlySubscribedChannelNames()
+
+
This method returns all channel names currently subscribed to in form of + a comma separated String +

+

+ +
Returns:
Comma separated string with all channel names currently + subscribed
+
+
+
+ +

+setResumeOnReconnect

+
+public void setResumeOnReconnect(boolean resumeOnReconnect)
+
+
If Resume on Reconnect is set to true, then Pubnub catches up on + reconnection after disconnection. If false, then messages sent on the + channel between disconnection and reconnection are not received. +

+

+
Parameters:
resumeOnReconnect - True or False setting for Resume on Reconnect
+
+
+
+ +

+getResumeOnReconnect

+
+public boolean getResumeOnReconnect()
+
+
Returns Resume on Reconnect current setting +

+

+ +
Returns:
Resume on Reconnect setting
+
+
+
+ +

+setUUID

+
+public void setUUID(java.lang.String uuid)
+
+
Sets value for UUID +

+

+
Parameters:
uuid - UUID value for Pubnub client
+
+
+
+ +

+getUUID

+
+public java.lang.String getUUID()
+
+
Gets current UUID +

+

+ +
Returns:
uuid + current UUID value for Pubnub client
+
+
+
+ +

+publish

+
+public void publish(java.lang.String channel,
+                    org.json.JSONObject message,
+                    Callback callback)
+
+
Send a message to a channel. +

+

+
Parameters:
channel - Channel name
message - JSONObject to be published
callback - object of sub class of Callback class
+
+
+
+ +

+publish

+
+public void publish(java.lang.String channel,
+                    org.json.JSONArray message,
+                    Callback callback)
+
+
Send a message to a channel. +

+

+
Parameters:
channel - Channel name
message - JSONOArray to be published
callback - object of sub class of Callback class
+
+
+
+ +

+publish

+
+public void publish(java.lang.String channel,
+                    java.lang.String message,
+                    Callback callback)
+
+
Send a message to a channel. +

+

+
Parameters:
channel - Channel name
message - String to be published
callback - object of sub class of Callback class
+
+
+
+ +

+publish

+
+public void publish(java.lang.String channel,
+                    java.lang.Integer message,
+                    Callback callback)
+
+
Send a message to a channel. +

+

+
Parameters:
channel - Channel name
message - Integer to be published
callback - object of sub class of Callback class
+
+
+
+ +

+publish

+
+public void publish(java.lang.String channel,
+                    java.lang.Double message,
+                    Callback callback)
+
+
Send a message to a channel. +

+

+
Parameters:
channel - Channel name
message - Double to be published
callback - object of sub class of Callback class
+
+
+
+ +

+presence

+
+public void presence(java.lang.String channel,
+                     Callback callback)
+              throws PubnubException
+
+
Listen for presence of subscribers on a channel +

+

+
Parameters:
channel - Name of the channel on which to listen for join/leave i.e. + presence events
callback - object of sub class of Callback class +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+hereNow

+
+public void hereNow(java.lang.String channel,
+                    Callback callback)
+
+
Read presence information from a channel +

+

+
Parameters:
channel - Channel name
callback - object of sub class of Callback class
+
+
+
+ +

+history

+
+public void history(java.util.Hashtable args)
+
+
Read history from a channel. +

+

+
Parameters:
args - Hashtable containing channel name, limit, Callback
+
+
+
+ +

+time

+
+public void time(Callback callback)
+
+
Read current time from PubNub Cloud. +

+

+
Parameters:
callback - Callback object
+
+
+
+ +

+unsubscribe

+
+public void unsubscribe(java.lang.String[] channels)
+
+
Unsubscribe from channels. +

+

+
Parameters:
channels - String array containing channel names
+
+
+
+ +

+unsubscribeAll

+
+public void unsubscribeAll()
+
+
Unsubscribe from all channel. +

+

+
+
+
+
+ +

+unsubscribePresence

+
+public void unsubscribePresence(java.lang.String channel)
+
+
Unsubscribe from presence channel. +

+

+
Parameters:
channel - channel name as String.
+
+
+
+ +

+unsubscribe

+
+public void unsubscribe(java.lang.String channel)
+
+
Unsubscribe/Disconnect from channel. +

+

+
Parameters:
channel - channel name as String.
+
+
+
+ +

+subscribe

+
+public void subscribe(java.lang.String[] channelsArr,
+                      Callback callback)
+               throws PubnubException
+
+
Listen for a message on a channel. +

+

+
Parameters:
channelsArr - Array of channel names (string) to listen on
callback - Callback +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+subscribe

+
+public void subscribe(java.lang.String[] channelsArr,
+                      Callback callback,
+                      java.lang.String timetoken)
+               throws PubnubException
+
+
Listen for a message on a channel. +

+

+
Parameters:
channelsArr - Array of channel names (string) to listen on
callback - Callback
timetoken - Timetoken to use for subscribing +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+subscribe

+
+public void subscribe(java.lang.String[] channelsArr,
+                      Callback callback,
+                      long timetoken)
+               throws PubnubException
+
+
Listen for a message on a channel. +

+

+
Parameters:
channelsArr - Array of channel names (string) to listen on
callback - Callback
timetoken - Timetoken to use for subscribing +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+subscribe

+
+public void subscribe(java.lang.String channel,
+                      Callback callback)
+               throws PubnubException
+
+
Listen for a message on a channel. +

+

+
Parameters:
channel - Name of the channel
callback - Callback +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+subscribe

+
+public void subscribe(java.lang.String channel,
+                      Callback callback,
+                      java.lang.String timetoken)
+               throws PubnubException
+
+
Listen for a message on a channel. +

+

+
Parameters:
channel - Name of the channel
callback - Callback +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+subscribe

+
+public void subscribe(java.lang.String channel,
+                      Callback callback,
+                      long timetoken)
+               throws PubnubException
+
+
Listen for a message on a channel. +

+

+
Parameters:
channel - Name of the channel
callback - Callback
timetoken - Timetoken to use for subscribing +
Throws: +
PubnubException - Throws PubnubException if Callback is null
+
+
+
+ +

+disconnectAndResubscribeWithTimetoken

+
+public void disconnectAndResubscribeWithTimetoken(java.lang.String timetoken)
+
+
Disconnect from all channels, and resubscribe +

+

+
+
+
+
+ +

+disconnectAndResubscribeWithTimetoken

+
+public void disconnectAndResubscribeWithTimetoken(java.lang.String timetoken,
+                                                  PubnubError error)
+
+
Disconnect from all channels, and resubscribe +

+

+
+
+
+
+ +

+disconnectAndResubscribe

+
+public void disconnectAndResubscribe()
+
+
Disconnect from all channels, and resubscribe +

+

+
+
+
+
+ +

+disconnectAndResubscribe

+
+public void disconnectAndResubscribe(PubnubError error)
+
+
Disconnect from all channels, and resubscribe +

+

+
+
+
+
+ +

+getSubscribedChannelsArray

+
+public java.lang.String[] getSubscribedChannelsArray()
+
+
This method returns array of channel names, currently subscribed to +

+

+ +
Returns:
Array of channel names
+
+
+
+ +

+setOrigin

+
+public void setOrigin(java.lang.String origin)
+
+
Sets origin value, default is "pubsub" +

+

+
Parameters:
origin - Origin value
+
+
+
+ +

+getOrigin

+
+public java.lang.String getOrigin()
+
+
Returns origin +

+

+ +
Returns:
origin
+
+
+
+ +

+setDomain

+
+public void setDomain(java.lang.String domain)
+
+
Sets domain value, default is "pubnub.com" +

+

+
Parameters:
domain - Domain value
+
+
+
+ +

+getDomain

+
+public java.lang.String getDomain()
+
+
Returns domain +

+

+ +
Returns:
domain
+
+
+
+ +

+getAuthKey

+
+public java.lang.String getAuthKey()
+
+
This method returns auth key. Return null if not set +

+

+ +
Returns:
Auth Key. null if auth key not set
+
+
+
+ +

+setAuthKey

+
+public void setAuthKey(java.lang.String authKey)
+
+
This method sets auth key. +

+

+
Parameters:
authKey - . 0 length string or null unsets auth key
+
+
+
+ +

+unsetAuthKey

+
+public void unsetAuthKey()
+
+
This method unsets auth key. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/PubnubError.html b/java/doc/com/pubnub/api/PubnubError.html new file mode 100644 index 000000000..0504ba295 --- /dev/null +++ b/java/doc/com/pubnub/api/PubnubError.html @@ -0,0 +1,700 @@ + + + + + + +PubnubError + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.pubnub.api +
+Class PubnubError

+
+java.lang.Object
+  extended by com.pubnub.api.PubnubError
+
+
+
+
public class PubnubError
extends java.lang.Object
+ + +

+PubnubError object is passed to errorCallback. It contains details of error, like + error code, error string, and optional message +

+ +

+

+
Author:
+
Pubnub
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ interrorCode + +
+           
+ interrorCodeExtended + +
+           
+static intPNERR_CLIENT_TIMEOUT + +
+          Client Timeout .
+static intPNERR_CONNECT_EXCEPTION + +
+          Connect Exception .
+static intPNERR_DECRYPTION_ERROR + +
+          Decryption Error .
+static intPNERR_DISCONN_AND_RESUB + +
+          Disconnect and Resubscribe Received .
+static intPNERR_DISCONNECT + +
+          Disconnect .
+static intPNERR_ENCRYPTION_ERROR + +
+          Error while encrypting message to be published to Pubnub Cloud .
+static intPNERR_FORBIDDEN + +
+          Pubnub server returned HTTP 403 forbidden status code.
+static intPNERR_GATEWAY_TIMEOUT + +
+          Gateway Timeout
+static intPNERR_HTTP_ERROR + +
+          Please check network connectivity.
+static intPNERR_HTTP_RC_ERROR + +
+           
+static intPNERR_INVALID_JSON + +
+          Invalid Json .
+static intPNERR_NETWORK_ERROR + +
+          Please verify if network is reachable
+static intPNERR_PUBNUB_ERROR + +
+           
+static intPNERR_PUBNUB_EXCEPTION + +
+          Pubnub Exception .
+static intPNERR_SECRET_KEY_MISSING + +
+          Secret key not configured
+static intPNERR_TIMEOUT + +
+          Timeout Error .
+static intPNERR_UNAUTHORIZED + +
+          Pubnub server returned HTTP 401 unauthorized status code + Happens when authentication key is missing .
+static intPNERR_URL_OPEN + +
+          Error in opening URL .
+  + + + + + + + + + + +
+Constructor Summary
PubnubError(PubnubError error, + java.lang.String message) + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.StringgetErrorString() + +
+           
+ java.lang.StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+PNERR_TIMEOUT

+
+public static final int PNERR_TIMEOUT
+
+
Timeout Error . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_PUBNUB_ERROR

+
+public static final int PNERR_PUBNUB_ERROR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PNERR_CONNECT_EXCEPTION

+
+public static final int PNERR_CONNECT_EXCEPTION
+
+
Connect Exception . + Network Unreachable. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_HTTP_ERROR

+
+public static final int PNERR_HTTP_ERROR
+
+
Please check network connectivity. + Please contact support with error details if issue persists. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_CLIENT_TIMEOUT

+
+public static final int PNERR_CLIENT_TIMEOUT
+
+
Client Timeout . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_NETWORK_ERROR

+
+public static final int PNERR_NETWORK_ERROR
+
+
Please verify if network is reachable +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_PUBNUB_EXCEPTION

+
+public static final int PNERR_PUBNUB_EXCEPTION
+
+
Pubnub Exception . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_DISCONNECT

+
+public static final int PNERR_DISCONNECT
+
+
Disconnect . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_DISCONN_AND_RESUB

+
+public static final int PNERR_DISCONN_AND_RESUB
+
+
Disconnect and Resubscribe Received . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_GATEWAY_TIMEOUT

+
+public static final int PNERR_GATEWAY_TIMEOUT
+
+
Gateway Timeout +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_FORBIDDEN

+
+public static final int PNERR_FORBIDDEN
+
+
Pubnub server returned HTTP 403 forbidden status code. + Happens when wrong authentication key is used . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_UNAUTHORIZED

+
+public static final int PNERR_UNAUTHORIZED
+
+
Pubnub server returned HTTP 401 unauthorized status code + Happens when authentication key is missing . +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_SECRET_KEY_MISSING

+
+public static final int PNERR_SECRET_KEY_MISSING
+
+
Secret key not configured +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_ENCRYPTION_ERROR

+
+public static final int PNERR_ENCRYPTION_ERROR
+
+
Error while encrypting message to be published to Pubnub Cloud . + Please contact support with error details. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_DECRYPTION_ERROR

+
+public static final int PNERR_DECRYPTION_ERROR
+
+
Decryption Error . + Please contact support with error details. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_INVALID_JSON

+
+public static final int PNERR_INVALID_JSON
+
+
Invalid Json . + Please contact support with error details. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_URL_OPEN

+
+public static final int PNERR_URL_OPEN
+
+
Error in opening URL . + Please contact support with error details. +

+

+
See Also:
Constant Field Values
+
+
+ +

+PNERR_HTTP_RC_ERROR

+
+public static final int PNERR_HTTP_RC_ERROR
+
+
+
See Also:
Constant Field Values
+
+
+ +

+errorCode

+
+public final int errorCode
+
+
+
+
+
+ +

+errorCodeExtended

+
+public final int errorCodeExtended
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+PubnubError

+
+public PubnubError(PubnubError error,
+                   java.lang.String message)
+
+
+ + + + + + + + +
+Method Detail
+ +

+toString

+
+public java.lang.String toString()
+
+
+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+
+ +

+getErrorString

+
+public java.lang.String getErrorString()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/PubnubException.html b/java/doc/com/pubnub/api/PubnubException.html new file mode 100644 index 000000000..048a96236 --- /dev/null +++ b/java/doc/com/pubnub/api/PubnubException.html @@ -0,0 +1,337 @@ + + + + + + +PubnubException + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.pubnub.api +
+Class PubnubException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by com.pubnub.api.PubnubException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class PubnubException
extends java.lang.Exception
+ + +

+PubnubException is thrown by various Pubnub APIs +

+ +

+

+
Author:
+
PubnubCore
+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
PubnubException(PubnubError pubnubError) + +
+          Constructor for PubnubException Class with error message as argument
PubnubException(PubnubError pubnubError, + java.lang.String s) + +
+          Constructor for PubnubException Class with error message as argument
PubnubException(java.lang.String s) + +
+          Constructor for PubnubException Class with error message as argument
+  + + + + + + + + + + + + + + + +
+Method Summary
+ PubnubErrorgetPubnubError() + +
+           
+ java.lang.StringtoString() + +
+          Read the exception error message
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PubnubException

+
+public PubnubException(java.lang.String s)
+
+
Constructor for PubnubException Class with error message as argument +

+

+
Parameters:
s - Error message
+
+
+ +

+PubnubException

+
+public PubnubException(PubnubError pubnubError)
+
+
Constructor for PubnubException Class with error message as argument +

+

+
Parameters:
pubnubError - Error message
+
+
+ +

+PubnubException

+
+public PubnubException(PubnubError pubnubError,
+                       java.lang.String s)
+
+
Constructor for PubnubException Class with error message as argument +

+

+
Parameters:
s - Error message
+
+ + + + + + + + +
+Method Detail
+ +

+toString

+
+public java.lang.String toString()
+
+
Read the exception error message +

+

+
Overrides:
toString in class java.lang.Throwable
+
+
+ +
Returns:
String
+
+
+
+ +

+getPubnubError

+
+public PubnubError getPubnubError()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/PubnubUtil.html b/java/doc/com/pubnub/api/PubnubUtil.html new file mode 100644 index 000000000..cae32497e --- /dev/null +++ b/java/doc/com/pubnub/api/PubnubUtil.html @@ -0,0 +1,357 @@ + + + + + + +PubnubUtil + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.pubnub.api +
+Class PubnubUtil

+
+java.lang.Object
+  extended by com.pubnub.api.PubnubUtil
+
+
+
+
public class PubnubUtil
extends java.lang.Object
+ + +

+PubnubUtil class provides utility methods like urlEncode etc +

+ +

+

+
Author:
+
Pubnub
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
PubnubUtil() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static java.lang.String[]hashtableKeysToArray(java.util.Hashtable ht) + +
+          Returns string keys in a hashtable as array of string
+static java.lang.StringhashTableKeysToDelimitedString(java.util.Hashtable ht, + java.lang.String delimiter) + +
+          Returns string keys in a hashtable as delimited string
+static java.lang.StringjoinString(java.lang.String[] sourceArray, + java.lang.String delimiter) + +
+          Takes String[] of tokens, and String delimiter as input and returns + joined String
+static java.lang.String[]splitString(java.lang.String source, + java.lang.String delimiter) + +
+          Takes source and delimiter string as inputs and returns splitted string + in form of tokens in String array
+static java.lang.StringurlEncode(java.lang.String sUrl) + +
+          Returns encoded String
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+PubnubUtil

+
+public PubnubUtil()
+
+
+ + + + + + + + +
+Method Detail
+ +

+urlEncode

+
+public static java.lang.String urlEncode(java.lang.String sUrl)
+
+
Returns encoded String +

+

+
Parameters:
sUrl - , input string +
Returns:
, encoded string
+
+
+
+ +

+splitString

+
+public static java.lang.String[] splitString(java.lang.String source,
+                                             java.lang.String delimiter)
+
+
Takes source and delimiter string as inputs and returns splitted string + in form of tokens in String array +

+

+
Parameters:
source - , input String
delimiter - , delimiter to split on +
Returns:
String[] , tokens in and array
+
+
+
+ +

+joinString

+
+public static java.lang.String joinString(java.lang.String[] sourceArray,
+                                          java.lang.String delimiter)
+
+
Takes String[] of tokens, and String delimiter as input and returns + joined String +

+

+
Parameters:
sourceArray - , input tokens in String array
delimiter - , delimiter to join on +
Returns:
String , string of tokens joined by delimiter
+
+
+
+ +

+hashtableKeysToArray

+
+public static java.lang.String[] hashtableKeysToArray(java.util.Hashtable ht)
+
+
Returns string keys in a hashtable as array of string +

+

+
Parameters:
ht - , Hashtable +
Returns:
, string array with hash keys string
+
+
+
+ +

+hashTableKeysToDelimitedString

+
+public static java.lang.String hashTableKeysToDelimitedString(java.util.Hashtable ht,
+                                                              java.lang.String delimiter)
+
+
Returns string keys in a hashtable as delimited string +

+

+
Parameters:
ht - , Hashtable
delimiter - , String +
Returns:
, string array with hash keys string
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/package-frame.html b/java/doc/com/pubnub/api/package-frame.html new file mode 100644 index 000000000..8c3d3b1aa --- /dev/null +++ b/java/doc/com/pubnub/api/package-frame.html @@ -0,0 +1,51 @@ + + + + + + +com.pubnub.api + + + + + + + + + + + +com.pubnub.api + + + + +
+Classes  + +
+Callback +
+HttpUtil +
+Pubnub +
+PubnubError +
+PubnubUtil
+ + + + + + +
+Exceptions  + +
+PubnubException
+ + + + diff --git a/java/doc/com/pubnub/api/package-summary.html b/java/doc/com/pubnub/api/package-summary.html new file mode 100644 index 000000000..f3e83ab59 --- /dev/null +++ b/java/doc/com/pubnub/api/package-summary.html @@ -0,0 +1,185 @@ + + + + + + +com.pubnub.api + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package com.pubnub.api +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
CallbackAbstract class to be subclassed by objects being passed as callbacks to + Pubnub APIs Default implementation for all methods is blank
HttpUtil 
PubnubPubnub object facilitates querying channels for messages and listening on + channels for presence/message events
PubnubErrorPubnubError object is passed to errorCallback.
PubnubUtilPubnubUtil class provides utility methods like urlEncode etc
+  + +

+ + + + + + + + + +
+Exception Summary
PubnubExceptionPubnubException is thrown by various Pubnub APIs
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/com/pubnub/api/package-tree.html b/java/doc/com/pubnub/api/package-tree.html new file mode 100644 index 000000000..41d395271 --- /dev/null +++ b/java/doc/com/pubnub/api/package-tree.html @@ -0,0 +1,151 @@ + + + + + + +com.pubnub.api Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package com.pubnub.api +

+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html new file mode 100644 index 000000000..660b3fb9a --- /dev/null +++ b/java/doc/constant-values.html @@ -0,0 +1,350 @@ + + + + + + +Constant Field Values + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Constant Field Values

+
+
+Contents + + + + + + +
+com.pubnub.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
com.pubnub.api.HttpUtil
+public static final intHTTP_BAD_GATEWAY502
+public static final intHTTP_BAD_REQUEST400
+public static final intHTTP_CLIENT_TIMEOUT408
+public static final intHTTP_FORBIDDEN403
+public static final intHTTP_GATEWAY_TIMEOUT504
+public static final intHTTP_INTERNAL_ERROR500
+public static final intHTTP_MOVED_PERM301
+public static final intHTTP_MOVED_TEMP302
+public static final intHTTP_OK200
+public static final intHTTP_SEE_OTHER303
+public static final intHTTP_UNAUTHORIZED401
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
com.pubnub.api.PubnubError
+public static final intPNERR_CLIENT_TIMEOUT104
+public static final intPNERR_CONNECT_EXCEPTION102
+public static final intPNERR_DECRYPTION_ERROR116
+public static final intPNERR_DISCONN_AND_RESUB110
+public static final intPNERR_DISCONNECT109
+public static final intPNERR_ENCRYPTION_ERROR115
+public static final intPNERR_FORBIDDEN112
+public static final intPNERR_GATEWAY_TIMEOUT111
+public static final intPNERR_HTTP_ERROR103
+public static final intPNERR_HTTP_RC_ERROR128
+public static final intPNERR_INVALID_JSON117
+public static final intPNERR_NETWORK_ERROR106
+public static final intPNERR_PUBNUB_ERROR101
+public static final intPNERR_PUBNUB_EXCEPTION108
+public static final intPNERR_SECRET_KEY_MISSING114
+public static final intPNERR_TIMEOUT100
+public static final intPNERR_UNAUTHORIZED113
+public static final intPNERR_URL_OPEN120
+ +

+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html new file mode 100644 index 000000000..bc4ff0ea2 --- /dev/null +++ b/java/doc/deprecated-list.html @@ -0,0 +1,236 @@ + + + + + + +Deprecated List + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Deprecated Methods
com.pubnub.api.Pubnub.detailedHistory(String, boolean, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, boolean reverse, Callback callback) 
com.pubnub.api.Pubnub.detailedHistory(String, int, boolean, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, int count, boolean reverse, Callback callback) 
com.pubnub.api.Pubnub.detailedHistory(String, int, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, int count, Callback callback) 
com.pubnub.api.Pubnub.detailedHistory(String, long, boolean, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, boolean reverse, Callback callback) 
com.pubnub.api.Pubnub.detailedHistory(String, long, long, boolean, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, long end, boolean reverse, Callback callback) 
com.pubnub.api.Pubnub.detailedHistory(String, long, long, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, long end, Callback callback) 
com.pubnub.api.Pubnub.detailedHistory(String, long, long, int, boolean, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, long end, int count, boolean reverse, Callback callback) 
com.pubnub.api.Callback.errorCallback(String, Object) +
+          as of version 3.5.2 and will be removed with 3.6.0 . + Replaced by Callback.errorCallback(String channel, PubnubError error) 
com.pubnub.api.Pubnub.publish(Hashtable) +
+          As of version 3.5.2 . Will be removed in 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. 
com.pubnub.api.Pubnub.publish(Hashtable, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. 
com.pubnub.api.Pubnub.subscribe(Hashtable) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. 
com.pubnub.api.Pubnub.subscribe(Hashtable, Callback) +
+          as of version 3.5.2 and will be removed with 3.6.0 . 
com.pubnub.api.Pubnub.unsubscribe(Hashtable) +
+          as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. 
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html new file mode 100644 index 000000000..c5282f556 --- /dev/null +++ b/java/doc/help-doc.html @@ -0,0 +1,209 @@ + + + + + + +API Help + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

    +
  • Interfaces (italic)
  • Classes
  • Enums
  • Exceptions
  • Errors
  • Annotation Types
+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description +

    +

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary +

    +

  • Field Detail
  • Constructor Detail
  • Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

    +
  • Annotation Type declaration
  • Annotation Type description
  • Required Element Summary
  • Optional Element Summary
  • Element Detail
+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

    +
  • Enum declaration
  • Enum description
  • Enum Constant Summary
  • Enum Constant Detail
+
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
    +
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/index-all.html b/java/doc/index-all.html new file mode 100644 index 000000000..95d27ace6 --- /dev/null +++ b/java/doc/index-all.html @@ -0,0 +1,488 @@ + + + + + + +Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +C D E G H I P R S T U
+

+C

+
+
Callback - Class in com.pubnub.api
Abstract class to be subclassed by objects being passed as callbacks to + Pubnub APIs Default implementation for all methods is blank
Callback() - +Constructor for class com.pubnub.api.Callback +
  +
checkResponse(int) - +Static method in class com.pubnub.api.HttpUtil +
  +
checkResponseSuccess(int) - +Static method in class com.pubnub.api.HttpUtil +
  +
com.pubnub.api - package com.pubnub.api
 
connectCallback(String, Object) - +Method in class com.pubnub.api.Callback +
This callback will be invoked on getting connected to a channel +
+
+

+D

+
+
detailedHistory(String, long, long, int, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, long end, int count, boolean reverse, Callback callback) +
detailedHistory(String, long, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, boolean reverse, Callback callback) +
detailedHistory(String, long, long, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, long end, Callback callback) +
detailedHistory(String, long, long, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, long start, long end, boolean reverse, Callback callback) +
detailedHistory(String, int, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, int count, boolean reverse, Callback callback) +
detailedHistory(String, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, boolean reverse, Callback callback) +
detailedHistory(String, int, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Replaced + by + Pubnub.history(String channel, int count, Callback callback) +
disconnectCallback(String, Object) - +Method in class com.pubnub.api.Callback +
This callback is invoked on getting disconnected from a channel +
+
+

+E

+
+
errorCallback(String, PubnubError) - +Method in class com.pubnub.api.Callback +
This callback will be invoked when an error occurs +
errorCallback(String, Object) - +Method in class com.pubnub.api.Callback +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . + Replaced by Callback.errorCallback(String channel, PubnubError error) +
errorCode - +Variable in class com.pubnub.api.PubnubError +
  +
errorCodeExtended - +Variable in class com.pubnub.api.PubnubError +
  +
+
+

+G

+
+
getErrorString() - +Method in class com.pubnub.api.PubnubError +
  +
getNonSubscribeTimeout() - +Method in class com.pubnub.api.Pubnub +
This method returns timeout value for non subscribe operations like publish, history, hereNow +
getPubnubError() - +Method in exception com.pubnub.api.PubnubException +
  +
getSubscribeTimeout() - +Method in class com.pubnub.api.Pubnub +
This method returns timeout value for subscribe/presence. +
+
+

+H

+
+
history(String, long, long, int, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Read History for a channel. +
history(String, long, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Read history for a channel. +
history(String, long, long, Callback) - +Method in class com.pubnub.api.Pubnub +
Read History for a channel. +
history(String, long, long, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Read History for a channel. +
history(String, int, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Read History for a channel. +
history(String, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Read History for a channel. +
history(String, int, Callback) - +Method in class com.pubnub.api.Pubnub +
Read History for a channel. +
HTTP_BAD_GATEWAY - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_BAD_REQUEST - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_CLIENT_TIMEOUT - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_FORBIDDEN - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_GATEWAY_TIMEOUT - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_INTERNAL_ERROR - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_MOVED_PERM - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_MOVED_TEMP - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_OK - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_SEE_OTHER - +Static variable in class com.pubnub.api.HttpUtil +
  +
HTTP_UNAUTHORIZED - +Static variable in class com.pubnub.api.HttpUtil +
  +
HttpUtil - Class in com.pubnub.api
 
HttpUtil() - +Constructor for class com.pubnub.api.HttpUtil +
  +
+
+

+I

+
+
isOk(int) - +Static method in class com.pubnub.api.HttpUtil +
  +
isRedirect(int) - +Static method in class com.pubnub.api.HttpUtil +
  +
+
+

+P

+
+
pamAudit(Callback) - +Method in class com.pubnub.api.Pubnub +
ULS Audit +
pamAudit(String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS audit by channel +
pamAudit(String, String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS audit by channel and auth key +
pamGrant(String, String, boolean, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Grant r/w access based on channel and auth key +
pamGrant(String, boolean, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Grant r/w access based on channel +
pamGrant(String, boolean, boolean, int, Callback) - +Method in class com.pubnub.api.Pubnub +
Grant r/w access based on channel +
pamGrant(String, String, boolean, boolean, int, Callback) - +Method in class com.pubnub.api.Pubnub +
Grant r/w access based on channel and auth key +
pamRevoke(String, String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS revoke by channel and auth key +
pamRevoke(String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS revoke by channel +
PNERR_CLIENT_TIMEOUT - +Static variable in class com.pubnub.api.PubnubError +
Client Timeout . +
PNERR_CONNECT_EXCEPTION - +Static variable in class com.pubnub.api.PubnubError +
Connect Exception . +
PNERR_DECRYPTION_ERROR - +Static variable in class com.pubnub.api.PubnubError +
Decryption Error . +
PNERR_DISCONN_AND_RESUB - +Static variable in class com.pubnub.api.PubnubError +
Disconnect and Resubscribe Received . +
PNERR_DISCONNECT - +Static variable in class com.pubnub.api.PubnubError +
Disconnect . +
PNERR_ENCRYPTION_ERROR - +Static variable in class com.pubnub.api.PubnubError +
Error while encrypting message to be published to Pubnub Cloud . +
PNERR_FORBIDDEN - +Static variable in class com.pubnub.api.PubnubError +
Pubnub server returned HTTP 403 forbidden status code. +
PNERR_GATEWAY_TIMEOUT - +Static variable in class com.pubnub.api.PubnubError +
Gateway Timeout +
PNERR_HTTP_ERROR - +Static variable in class com.pubnub.api.PubnubError +
Please check network connectivity. +
PNERR_HTTP_RC_ERROR - +Static variable in class com.pubnub.api.PubnubError +
  +
PNERR_INVALID_JSON - +Static variable in class com.pubnub.api.PubnubError +
Invalid Json . +
PNERR_NETWORK_ERROR - +Static variable in class com.pubnub.api.PubnubError +
Please verify if network is reachable +
PNERR_PUBNUB_ERROR - +Static variable in class com.pubnub.api.PubnubError +
  +
PNERR_PUBNUB_EXCEPTION - +Static variable in class com.pubnub.api.PubnubError +
Pubnub Exception . +
PNERR_SECRET_KEY_MISSING - +Static variable in class com.pubnub.api.PubnubError +
Secret key not configured +
PNERR_TIMEOUT - +Static variable in class com.pubnub.api.PubnubError +
Timeout Error . +
PNERR_UNAUTHORIZED - +Static variable in class com.pubnub.api.PubnubError +
Pubnub server returned HTTP 401 unauthorized status code + Happens when authentication key is missing . +
PNERR_URL_OPEN - +Static variable in class com.pubnub.api.PubnubError +
Error in opening URL . +
publish(Hashtable, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +
publish(Hashtable) - +Method in class com.pubnub.api.Pubnub +
Deprecated. As of version 3.5.2 . Will be removed in 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +
Pubnub - Class in com.pubnub.api
Pubnub object facilitates querying channels for messages and listening on + channels for presence/message events
Pubnub(String, String, String, String, boolean) - +Constructor for class com.pubnub.api.Pubnub +
Pubnub Constructor +
Pubnub(String, String, String, boolean) - +Constructor for class com.pubnub.api.Pubnub +
Pubnub Constructor +
Pubnub(String, String) - +Constructor for class com.pubnub.api.Pubnub +
Pubnub Constructor +
Pubnub(String, String, boolean) - +Constructor for class com.pubnub.api.Pubnub +
  +
Pubnub(String, String, String) - +Constructor for class com.pubnub.api.Pubnub +
  +
Pubnub(String, String, String, String, boolean, String) - +Constructor for class com.pubnub.api.Pubnub +
Constructor for Pubnub Class +
PubnubError - Class in com.pubnub.api
PubnubError object is passed to errorCallback.
PubnubError(PubnubError, String) - +Constructor for class com.pubnub.api.PubnubError +
  +
PubnubException - Exception in com.pubnub.api
PubnubException is thrown by various Pubnub APIs
PubnubException(String) - +Constructor for exception com.pubnub.api.PubnubException +
Constructor for PubnubException Class with error message as argument +
PubnubException(PubnubError) - +Constructor for exception com.pubnub.api.PubnubException +
Constructor for PubnubException Class with error message as argument +
PubnubException(PubnubError, String) - +Constructor for exception com.pubnub.api.PubnubException +
Constructor for PubnubException Class with error message as argument +
PubnubUtil - Class in com.pubnub.api
PubnubUtil class provides utility methods like urlEncode etc
PubnubUtil() - +Constructor for class com.pubnub.api.PubnubUtil +
  +
+
+

+R

+
+
reconnectCallback(String, Object) - +Method in class com.pubnub.api.Callback +
This callback is invoked on getting reconnected to a channel after + getting disconnected +
+
+

+S

+
+
setNonSubscribeTimeout(int) - +Method in class com.pubnub.api.Pubnub +
This method set timeout value for non subscribe operations like publish, + history, hereNow. +
setSubscribeTimeout(int) - +Method in class com.pubnub.api.Pubnub +
This method sets timeout value for subscribe/presence. +
setUUID(UUID) - +Method in class com.pubnub.api.Pubnub +
Sets value for UUID +
subscribe(Hashtable, Callback) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . +
subscribe(Hashtable) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +
successCallback(String, Object) - +Method in class com.pubnub.api.Callback +
This callback will be invoked when a message is received on the channel +
+
+

+T

+
+
toString() - +Method in class com.pubnub.api.PubnubError +
  +
toString() - +Method in exception com.pubnub.api.PubnubException +
Read the exception error message +
+
+

+U

+
+
unsubscribe(Hashtable) - +Method in class com.pubnub.api.Pubnub +
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods + accepting Hashtable as arguments have been deprecated. +
urlEncode(String) - +Static method in class com.pubnub.api.PubnubUtil +
Returns encoded String +
+
+C D E G H I P R S T U + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/index.html b/java/doc/index.html new file mode 100644 index 000000000..c7436e69f --- /dev/null +++ b/java/doc/index.html @@ -0,0 +1,36 @@ + + + + + + +Generated Documentation (Untitled) + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="com/pubnub/api/package-summary.html">Non-frame version.</A> + + + diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html new file mode 100644 index 000000000..25acf69d6 --- /dev/null +++ b/java/doc/overview-tree.html @@ -0,0 +1,153 @@ + + + + + + +Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
com.pubnub.api
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/package-list b/java/doc/package-list new file mode 100644 index 000000000..2970ef510 --- /dev/null +++ b/java/doc/package-list @@ -0,0 +1 @@ +com.pubnub.api diff --git a/java/doc/resources/inherit.gif b/java/doc/resources/inherit.gif new file mode 100644 index 000000000..c814867a1 Binary files /dev/null and b/java/doc/resources/inherit.gif differ diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html new file mode 100644 index 000000000..42cfeae23 --- /dev/null +++ b/java/doc/serialized-form.html @@ -0,0 +1,184 @@ + + + + + + +Serialized Form + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Serialized Form

+
+
+ + + + + +
+Package com.pubnub.api
+ +

+ + + + + +
+Class com.pubnub.api.PubnubException extends java.lang.Exception implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+errormsg

+
+java.lang.String errormsg
+
+
+
+
+
+

+pubnubError

+
+PubnubError pubnubError
+
+
+
+
+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/java/doc/stylesheet.css b/java/doc/stylesheet.css new file mode 100644 index 000000000..6ea9e5161 --- /dev/null +++ b/java/doc/stylesheet.css @@ -0,0 +1,29 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} + diff --git a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java new file mode 100644 index 000000000..7a66204e3 --- /dev/null +++ b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java @@ -0,0 +1,563 @@ +package com.pubnub.examples; + +import com.pubnub.api.*; +import org.json.JSONArray; +import org.json.JSONObject; + +import java.util.Hashtable; +import java.util.Scanner; + +import static java.lang.System.out; + +public class PubnubDemoConsole { + + Pubnub pubnub; + String publish_key = "demo"; + String subscribe_key = "demo"; + String secret_key = ""; + String cipher_key = ""; + boolean SSL; + Scanner reader; + + public PubnubDemoConsole(String publish_key, String subscribe_key, String secret_key, + String cipher_key) { + this.publish_key = publish_key; + this.subscribe_key = subscribe_key; + this.secret_key = secret_key; + this.cipher_key = cipher_key; + } + + public PubnubDemoConsole() { + + } + + private void notifyUser(Object message) { + out.println(message.toString()); + } + + private void publish(String channel) { + notifyUser("Enter the message for publish. To exit loop enter QUIT"); + String message = ""; + + Callback cb = new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("PUBLISH : " + message); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("PUBLISH : " + error); + } + }; + + while (true) { + Hashtable args = new Hashtable(2); + message = reader.nextLine(); + if (message.equalsIgnoreCase("QUIT")) { + break; + } + + try { + Integer i = Integer.parseInt(message); + pubnub.publish(channel, i, cb); + continue; + } catch (Exception e) { + + } + try { + Double d = Double.parseDouble(message); + pubnub.publish(channel, d, cb); + continue; + } catch (Exception e) { + + } + try { + JSONArray js = new JSONArray(message); + pubnub.publish(channel, js, cb); + continue; + } catch (Exception e) { + + } + try { + JSONObject js = new JSONObject(message); + pubnub.publish(channel, js, cb); + continue; + } catch (Exception e) { + + } + pubnub.publish(channel, message, cb); + } + + } + + private void subscribe(final String channel) { + Hashtable args = new Hashtable(6); + args.put("channel", channel); + + try { + pubnub.subscribe(args, new Callback() { + + @Override + public void connectCallback(String channel, Object message) { + notifyUser("SUBSCRIBE : CONNECT on channel:" + channel + + " : " + message.getClass() + " : " + + message.toString()); + } + + @Override + public void disconnectCallback(String channel, Object message) { + notifyUser("SUBSCRIBE : DISCONNECT on channel:" + channel + + " : " + message.getClass() + " : " + + message.toString()); + } + + public void reconnectCallback(String channel, Object message) { + notifyUser("SUBSCRIBE : RECONNECT on channel:" + channel + + " : " + message.getClass() + " : " + + message.toString()); + } + + @Override + public void successCallback(String channel, Object message) { + notifyUser("SUBSCRIBE : " + channel + " : " + + message.getClass() + " : " + message.toString()); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + + /* + + # Switch on error code, see PubnubError.java + + if (error.errorCode == 112) { + # Bad Auth Key! + unsubscribe, get a new auth key, subscribe, etc... + } else if (error.errorCode == 113) { + # Need to set Auth Key ! + unsubscribe, set auth, resubscribe + } + + */ + + notifyUser("SUBSCRIBE : ERROR on channel " + channel + + " : " + error.toString()); + } + }); + + } catch (Exception e) { + } + } + + private void presence(String channel) { + try { + pubnub.presence(channel, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("PRESENCE : " + message); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("PRESENCE : " + error); + } + }); + } catch (PubnubException e) { + + } + } + + private void detailedHistory(String channel) { + pubnub.detailedHistory(channel, 2, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("DETAILED HISTORY : " + message); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("DETAILED HISTORY : " + error); + } + }); + } + + private void hereNow(String channel) { + pubnub.hereNow(channel, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("HERE NOW : " + message); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("HERE NOW : " + error); + } + }); + } + + private void unsubscribe(String channel) { + pubnub.unsubscribe(channel); + } + + private void unsubscribePresence(String channel) { + pubnub.unsubscribePresence(channel); + } + + private void time() { + pubnub.time(new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("TIME : " + message); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("TIME : " + error); + } + }); + } + + private void disconnectAndResubscribe() { + pubnub.disconnectAndResubscribe(); + + } + + private void disconnectAndResubscribeWithTimetoken(String timetoken) { + pubnub.disconnectAndResubscribeWithTimetoken(timetoken); + + } + + public void startDemo() { + reader = new Scanner(System.in); + notifyUser("HINT:\tTo test Re-connect and catch-up"); + notifyUser("\tDisconnect your machine from network/internet and"); + notifyUser("\tre-connect your machine after sometime"); + + this.SSL = getBooleanFromConsole("SSL"); + + if (this.publish_key.length() == 0) this.publish_key = getStringFromConsole("Publish Key"); + + if (this.subscribe_key.length() == 0) this.subscribe_key = getStringFromConsole("Subscribe Key"); + + if (this.secret_key.length() == 0) this.secret_key = getStringFromConsole("Secret Key", true); + + if (this.cipher_key.length() == 0) this.cipher_key = getStringFromConsole("Cipher Key", true); + + + pubnub = new Pubnub(this.publish_key, this.subscribe_key, this.secret_key, this.cipher_key, this.SSL); + + displayMenuOptions(); + + String channelName = null; + int command = 0; + while ((command = reader.nextInt()) != 9) { + reader.nextLine(); + switch (command) { + + case 0: + displayMenuOptions(); + break; + + case 1: + channelName = getStringFromConsole("Subscribe: Enter Channel name"); + subscribe(channelName); + + notifyUser("Subscribed to following channels: "); + notifyUser(PubnubUtil.joinString( + pubnub.getSubscribedChannelsArray(), " : ")); + break; + case 2: + channelName = getStringFromConsole("Channel Name"); + publish(channelName); + break; + case 3: + channelName = getStringFromConsole("Channel Name"); + presence(channelName); + break; + case 4: + channelName = getStringFromConsole("Channel Name"); + detailedHistory(channelName); + break; + case 5: + channelName = getStringFromConsole("Channel Name"); + hereNow(channelName); + break; + case 6: + channelName = getStringFromConsole("Channel Name"); + unsubscribe(channelName); + break; + case 7: + channelName = getStringFromConsole("Channel Name"); + unsubscribePresence(channelName); + break; + case 8: + time(); + break; + case 10: + disconnectAndResubscribe(); + break; + case 11: + notifyUser("Disconnect and Resubscribe with timetoken : Enter timetoken"); + String timetoken = getStringFromConsole("Timetoken"); + disconnectAndResubscribeWithTimetoken(timetoken); + break; + case 12: + pubnub.setResumeOnReconnect(pubnub.isResumeOnReconnect() ? false + : true); + notifyUser("RESUME ON RECONNECT : " + pubnub.isResumeOnReconnect()); + break; + case 13: + int maxRetries = getIntFromConsole("Max Retries"); + setMaxRetries(maxRetries); + break; + case 14: + int retryInterval = getIntFromConsole("Retry Interval"); + setRetryInterval(retryInterval); + break; + case 15: + int windowInterval = getIntFromConsole("Window Interval"); + setWindowInterval(windowInterval); + break; + case 16: + int subscribeTimeout = getIntFromConsole("Subscribe Timeout ( in milliseconds) "); + setSubscribeTimeout(subscribeTimeout); + break; + case 17: + int nonSubscribeTimeout = getIntFromConsole("Non Subscribe Timeout ( in milliseconds) "); + setNonSubscribeTimeout(nonSubscribeTimeout); + break; + case 18: + notifyUser("Set/Unset Auth Key: Enter blank for unsetting key"); + String authKey = getStringFromConsole("Auth Key"); + pubnub.setAuthKey(authKey); + break; + case 19: + pamGrant(); + break; + case 20: + pamRevoke(); + break; + case 21: + pamAudit(); + break; + case 22: + pubnub.setOrigin(getStringFromConsole("Origin")); + break; + case 23: + pubnub.setDomain(getStringFromConsole("Domain")); + break; + case 24: + pubnub.setCacheBusting(true); + break; + case 25: + pubnub.setCacheBusting(false); + break; + default: + notifyUser("Invalid Input"); + } + displayMenuOptions(); + } + notifyUser("Exiting"); + pubnub.shutdown(); + + } + + private String getStringFromConsole(String message, boolean optional) { + + int attempt_count = 0; + String input = null; + do { + if (attempt_count > 0) System.out.print("Invalid input. "); + String message1 = "Enter " + message ; + message1 = (optional)?message1+" ( Optional input. You can skip by pressing enter )":message1; + notifyUser(message1); + input = reader.nextLine(); + attempt_count++; + } while ((input == null || input.length() == 0) && !optional); + notifyUser(message + " : " + input); + return input; + } + + private String getStringFromConsole(String message) { + return getStringFromConsole(message, false); + } + private int getIntFromConsole(String message, boolean optional) { + + int attempt_count = 0; + String input = null; + int returnVal = -1; + do { + if (attempt_count > 0) notifyUser("Invalid input. "); + String message1 = "Enter " + message; + message1 = (optional)?message1+" ( Optional input. You can skip by pressing enter ) ":message1; + notifyUser(message1); + input = reader.nextLine(); + attempt_count++; + returnVal = Integer.parseInt(input); + } while ((input == null || input.length() == 0 || returnVal == -1) && !optional); + notifyUser(message + " : " + returnVal); + return returnVal; + } + + private int getIntFromConsole(String message) { + return getIntFromConsole(message, false); + } + + private boolean getBooleanFromConsole(String message, boolean optional) { + + int attempt_count = 0; + String input = null; + boolean returnVal = false; + do { + if (attempt_count > 0) notifyUser("Invalid input. "); + String message1 = message + " ? ( Enter Yes/No or Y/N )"; + message1 = (optional)?message1+" ( Optional input. You can skip by pressing enter ) ":message1; + notifyUser(message1); + input = reader.nextLine(); + attempt_count++; + } while ((input == null || input.length() == 0 || + ( !input.equalsIgnoreCase("yes") && !input.equalsIgnoreCase("no") && + !input.equalsIgnoreCase("y") && !input.equalsIgnoreCase("n"))) && !optional); + returnVal = (input.equalsIgnoreCase("y") || input.equalsIgnoreCase("yes"))?true:false; + notifyUser(message + " : " + returnVal); + return returnVal; + } + + private boolean getBooleanFromConsole(String message) { + return getBooleanFromConsole(message, false); + } + + private void pamGrant() { + String channel = getStringFromConsole("Channel"); + String auth_key = getStringFromConsole("Auth Key"); + boolean read = getBooleanFromConsole("Read"); + boolean write = getBooleanFromConsole("Write"); + int ttl = getIntFromConsole("TTL"); + + pubnub.pamGrant(channel, auth_key, read, write, ttl, new Callback() { + + @Override + public void successCallback(String channel, Object message) { + notifyUser("CHANNEL : " + channel + " , " + message.toString()); + + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("CHANNEL : " + channel + " , " + error.toString()); + } + + }); + } + + private void pamAudit() { + String channel = getStringFromConsole("Channel", true); + String auth_key = getStringFromConsole("Auth Key", true); + + Callback cb = new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("CHANNEL : " + channel + " , " + message.toString()); + + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("CHANNEL : " + channel + " , " + error.toString()); + } + }; + + if (channel != null && channel.length() > 0) { + if (auth_key != null && auth_key.length() != 0) { + pubnub.pamAudit(channel, auth_key, cb); + } else { + pubnub.pamAudit(channel, cb); + } + } else { + pubnub.pamAudit(cb); + } + + } + + private void pamRevoke() { + String channel = getStringFromConsole("Enter Channel"); + String auth_key = getStringFromConsole("Auth Key"); + + pubnub.pamRevoke(channel, auth_key, new Callback() { + + @Override + public void successCallback(String channel, Object message) { + notifyUser("CHANNEL : " + channel + " , " + message.toString()); + + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("CHANNEL : " + channel + " , " + error.toString()); + } + + }); + } + + private void setMaxRetries(int maxRetries) { + pubnub.setMaxRetries(maxRetries); + } + + private void setRetryInterval(int retryInterval) { + pubnub.setRetryInterval(retryInterval); + } + + private void setWindowInterval(int windowInterval) { + pubnub.setWindowInterval(windowInterval); + } + + private void setSubscribeTimeout(int subscribeTimeout) { + pubnub.setSubscribeTimeout(subscribeTimeout); + } + + private void setNonSubscribeTimeout(int nonSubscribeTimeout) { + pubnub.setNonSubscribeTimeout(nonSubscribeTimeout); + } + + private void displayMenuOptions() { + notifyUser("ENTER 1 FOR Subscribe " + + "(Currently subscribed to " + + this.pubnub.getCurrentlySubscribedChannelNames() + ")"); + notifyUser("ENTER 2 FOR Publish"); + notifyUser("ENTER 3 FOR Presence"); + notifyUser("ENTER 4 FOR Detailed History"); + notifyUser("ENTER 5 FOR Here_Now"); + notifyUser("ENTER 6 FOR Unsubscribe"); + notifyUser("ENTER 7 FOR Presence-Unsubscribe"); + notifyUser("ENTER 8 FOR Time"); + notifyUser("ENTER 9 FOR EXIT OR QUIT"); + notifyUser("ENTER 10 FOR Disconnect-And-Resubscribe"); + notifyUser("ENTER 11 FOR Disconnect-And-Resubscribe with timetoken"); + notifyUser("ENTER 12 FOR Toggle Resume On Reconnect ( current: " + pubnub.getResumeOnReconnect() + " )"); + notifyUser("ENTER 13 FOR Setting MAX Retries ( current: " + pubnub.getMaxRetries() + " )"); + notifyUser("ENTER 14 FOR Setting Retry Interval ( current: " + pubnub.getRetryInterval() + " milliseconds )"); + notifyUser("ENTER 15 FOR Setting Window Interval ( current: " + pubnub.getWindowInterval() + " milliseconds )"); + notifyUser("ENTER 16 FOR Setting Subscribe Timeout ( current: " + pubnub.getSubscribeTimeout() + " milliseconds )"); + notifyUser("ENTER 17 FOR Setting Non Subscribe Timeout ( current: " + pubnub.getNonSubscribeTimeout() + " milliseconds )"); + notifyUser("ENTER 18 FOR Setting/Unsetting auth key ( current: " + pubnub.getAuthKey() + " )"); + notifyUser("ENTER 19 FOR PAM grant"); + notifyUser("ENTER 20 FOR PAM revoke"); + notifyUser("ENTER 21 FOR PAM Audit"); + notifyUser("ENTER 22 FOR Setting Origin ( current: " + pubnub.getOrigin() + " )"); + notifyUser("ENTER 23 FOR Setting Domain ( current: "+ pubnub.getDomain() + " )"); + notifyUser("ENTER 24 FOR Enabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); + notifyUser("ENTER 25 FOR Disabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); + notifyUser("\nENTER 0 to display this menu"); + } + + /** + * @param args + */ + public static void main(String[] args) { + PubnubDemoConsole pdc; + if (args.length == 4) { + pdc = new PubnubDemoConsole(args[0], args[1], args[2], args[3]); + } else + pdc = new PubnubDemoConsole(); + pdc.startDemo(); + } + +} diff --git a/java/examples/src/com/pubnub/examples/PubnubPublishTest.java b/java/examples/src/com/pubnub/examples/PubnubPublishTest.java new file mode 100644 index 000000000..2041ddcb5 --- /dev/null +++ b/java/examples/src/com/pubnub/examples/PubnubPublishTest.java @@ -0,0 +1,166 @@ +package com.pubnub.examples; + +import java.util.Hashtable; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import com.pubnub.api.*; + +public class PubnubPublishTest { + + String channel = "pubnub_java_api"; + String channel_enc = "pubnub_java_api_enc"; + + Pubnub _pubnub; + Pubnub _pubnub_enc; + + Object[] messages; + + public PubnubPublishTest() { + _pubnub = new Pubnub("demo", "demo", false); + _pubnub_enc = new Pubnub("demo", "demo", "demo", "demo", false); + messages = new Object[3]; + messages[0] = "This is a string message"; + JSONArray jsarr = new JSONArray(); + jsarr.put("This is json array"); + jsarr.put("One more entry in json array"); + messages[1] = jsarr; + JSONObject jsobj = new JSONObject(); + try { + jsobj.put("msg1", "Hi"); + jsobj.put("msg2", "Java"); + } catch (JSONException e) { + e.printStackTrace(); + } + messages[2] = jsobj; + } + + /** + * @param params + */ + public static void main(String[] params) { + + PubnubPublishTest ppt = new PubnubPublishTest(); + ppt.runSubscribe(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + } + ppt.runPublish(); + ppt.runHistory(); + ppt.runDetailedHistory(); + try { + Thread.sleep(20000); + } catch (InterruptedException e) { + } + ppt._pubnub.shutdown(); + ppt._pubnub_enc.shutdown(); + } + + public void runSubscribe() { + try { + _pubnub.subscribe(new String[] { channel }, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("RECV : " + channel + " : " + message.getClass() + + " : " + message.toString()); + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("RECV : " + channel + " : " + + " : " + error.toString()); + } + + }); + _pubnub_enc.subscribe(new String[] { channel_enc }, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("RECV : " + channel + " : " + message.getClass() + + " : " + message.toString()); + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("RECV : " + channel + " : " + + " : " + error.toString()); + } + }); + + } catch (PubnubException e) { + e.printStackTrace(); + } + + } + + public void runPublish() { + for (int i = 0; i < 3; i++) { + publish(_pubnub, channel, messages[i]); + publish(_pubnub_enc, channel_enc, messages[i]); + } + } + + public void runHistory() { + history(_pubnub, channel); + history(_pubnub_enc, channel_enc); + } + + public void runDetailedHistory() { + detailedHistory(_pubnub, channel); + detailedHistory(_pubnub_enc, channel_enc); + } + + private static void notifyUser(Object message) { + System.out.println(message.toString()); + } + + public void publish(Pubnub pubnub, final String channel, final Object msg) { + Hashtable args = new Hashtable(2); + args.put("channel", channel); // Channel Name + args.put("message", msg); // JSON Message + pubnub.publish(args, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("SENT : " + channel + " : " + msg.getClass() + " : " + + message.toString()); + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("SENT : " + channel + " : " + + error.toString()); + } + }); + } + + public void history(Pubnub pubnub, final String channel) { + + pubnub.history(channel, 10, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("HISTORY : " + channel + " : " + message.getClass() + + " : " + message.toString()); + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("HISTORY : " + channel + + " : " + error.toString()); + } + }); + } + + public void detailedHistory(Pubnub pubnub, final String channel) { + + pubnub.detailedHistory(channel, 10, new Callback() { + @Override + public void successCallback(String channel, Object message) { + notifyUser("DETAILED HISTORY : " + channel + " : " + + message.getClass() + " : " + message.toString()); + } + @Override + public void errorCallback(String channel, PubnubError error) { + notifyUser("DETAILED HISTORY : " + channel + " : " + + " : " + error.toString()); + } + }); + } +} diff --git a/java/examples/src/com/pubnub/examples/PubnubTestClient.java b/java/examples/src/com/pubnub/examples/PubnubTestClient.java new file mode 100644 index 000000000..3cd128cfa --- /dev/null +++ b/java/examples/src/com/pubnub/examples/PubnubTestClient.java @@ -0,0 +1,75 @@ +package com.pubnub.examples; + +import java.util.Hashtable; + +import com.pubnub.api.*; + +public class PubnubTestClient { + Pubnub pubnub; + int recvSuccess; + int recvErrors; + int sendSuccess; + int sendErrors; + + PubnubTestClient() { + pubnub = new Pubnub("demo", "demo", "demo", false); + } + + public void runTest() { + Hashtable args = new Hashtable(); + args.put("channel", "TestClientChannel"); + try { + pubnub.subscribe(args, new Callback() { + @Override + public void successCallback(String channel, Object message) { + recvSuccess++; + } + @Override + public void errorCallback(String channel, PubnubError error) { + recvErrors++; + } + }); + + } catch (Exception e) { + + } + Callback publishCb = new Callback() { + @Override + public void successCallback(String channel, Object message) { + sendSuccess++; + } + @Override + public void errorCallback(String channel, PubnubError error) { + System.out.println(error.toString()); + sendErrors++; + } + }; + args.put("message", "Test Client Message"); + for (int i = 0; i < 10; i++) { + pubnub.publish(args, publishCb); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println("Send Success : " + sendSuccess); + System.out.println("Send Errors : " + sendErrors); + System.out.println("Receive Success : " + recvSuccess); + System.out.println("Receive Errors : " + recvErrors); + } + System.out.println("Send Success : " + sendSuccess); + System.out.println("Send Errors : " + sendErrors); + System.out.println("Receive Success : " + recvSuccess); + System.out.println("Receive Errors : " + recvErrors); + + } + + /** + * @param args + */ + public static void main(String[] args) { + new PubnubTestClient().runTest(); + + } + +} diff --git a/java/jars/Pubnub-UnitTests-3.5.6.jar b/java/jars/Pubnub-UnitTests-3.5.6.jar new file mode 100644 index 000000000..aaa41d675 Binary files /dev/null and b/java/jars/Pubnub-UnitTests-3.5.6.jar differ diff --git a/java/jars/PubnubDemoConsole.jar b/java/jars/PubnubDemoConsole.jar new file mode 100644 index 000000000..2ce732786 Binary files /dev/null and b/java/jars/PubnubDemoConsole.jar differ diff --git a/java/jars/PubnubExample.jar b/java/jars/PubnubExample.jar new file mode 100644 index 000000000..8ee246d46 Binary files /dev/null and b/java/jars/PubnubExample.jar differ diff --git a/java/libs/bcprov-jdk15on-1.47.jar b/java/libs/bcprov-jdk15on-1.47.jar new file mode 100644 index 000000000..0b80922e6 Binary files /dev/null and b/java/libs/bcprov-jdk15on-1.47.jar differ diff --git a/java/libs/hamcrest-all-1.3.jar b/java/libs/hamcrest-all-1.3.jar new file mode 100644 index 000000000..6f62ba00c Binary files /dev/null and b/java/libs/hamcrest-all-1.3.jar differ diff --git a/java/libs/json-20090211.jar b/java/libs/json-20090211.jar new file mode 100644 index 000000000..9f37e0dc5 Binary files /dev/null and b/java/libs/json-20090211.jar differ diff --git a/java/libs/junit-4.11.jar b/java/libs/junit-4.11.jar new file mode 100644 index 000000000..aaf744484 Binary files /dev/null and b/java/libs/junit-4.11.jar differ diff --git a/java/libs/log4j-1.2.17.jar b/java/libs/log4j-1.2.17.jar new file mode 100644 index 000000000..068867ebf Binary files /dev/null and b/java/libs/log4j-1.2.17.jar differ diff --git a/java/libs/org/eclipse/jdt/internal/jarinjarloader/JIJConstants.class b/java/libs/org/eclipse/jdt/internal/jarinjarloader/JIJConstants.class new file mode 100644 index 000000000..b0872594c Binary files /dev/null and b/java/libs/org/eclipse/jdt/internal/jarinjarloader/JIJConstants.class differ diff --git a/java/libs/org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader$ManifestInfo.class b/java/libs/org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader$ManifestInfo.class new file mode 100644 index 000000000..d54898040 Binary files /dev/null and b/java/libs/org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader$ManifestInfo.class differ diff --git a/java/libs/org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.class b/java/libs/org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.class new file mode 100644 index 000000000..d3b7c8aac Binary files /dev/null and b/java/libs/org/eclipse/jdt/internal/jarinjarloader/JarRsrcLoader.class differ diff --git a/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.class b/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.class new file mode 100644 index 000000000..3343bf373 Binary files /dev/null and b/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLConnection.class differ diff --git a/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandler.class b/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandler.class new file mode 100644 index 000000000..2857910f9 Binary files /dev/null and b/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandler.class differ diff --git a/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandlerFactory.class b/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandlerFactory.class new file mode 100644 index 000000000..10277711a Binary files /dev/null and b/java/libs/org/eclipse/jdt/internal/jarinjarloader/RsrcURLStreamHandlerFactory.class differ diff --git a/java/libs/slf4j-api-1.7.5.jar b/java/libs/slf4j-api-1.7.5.jar new file mode 100644 index 000000000..8f004d390 Binary files /dev/null and b/java/libs/slf4j-api-1.7.5.jar differ diff --git a/java/libs/slf4j-log4j12-1.7.5.jar b/java/libs/slf4j-log4j12-1.7.5.jar new file mode 100644 index 000000000..f5298b5e9 Binary files /dev/null and b/java/libs/slf4j-log4j12-1.7.5.jar differ diff --git a/java/libs/slf4j-nop-1.7.5.jar b/java/libs/slf4j-nop-1.7.5.jar new file mode 100644 index 000000000..42f5c15a0 Binary files /dev/null and b/java/libs/slf4j-nop-1.7.5.jar differ diff --git a/java/libs/slf4j-simple-1.7.5.jar b/java/libs/slf4j-simple-1.7.5.jar new file mode 100644 index 000000000..eca11dd41 Binary files /dev/null and b/java/libs/slf4j-simple-1.7.5.jar differ diff --git a/java/pom.xml b/java/pom.xml new file mode 100644 index 000000000..4be157e04 --- /dev/null +++ b/java/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + com.pubnub + pubnub + 3.5.6 + + jar + pubnub + PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second! + https://github.com/pubnub/java + + + https://github.com/pubnub/pubnub-api/blob/master/LICENSE + repo + + + + https://github.com/pubnub/java + scm:git:git://github.com/pubnub/java.git + + + + pubnub + Pubnub Inc. + support@pubnub.com + http://www.pubnub.com + + + + + + org.json + json + 20090211 + + + org.slf4j + slf4j-api + 1.7.5 + + + org.bouncycastle + bcprov-jdk16 + 1.46 + + + diff --git a/java/src/com/pubnub/api/Pubnub.java b/java/src/com/pubnub/api/Pubnub.java new file mode 100644 index 000000000..3558d3e27 --- /dev/null +++ b/java/src/com/pubnub/api/Pubnub.java @@ -0,0 +1,904 @@ +package com.pubnub.api; + +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Date; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.UUID; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import static com.pubnub.api.PubnubError.*; + +/** + * Pubnub object facilitates querying channels for messages and listening on + * channels for presence/message events + * + * @author Pubnub + * + */ + +public class Pubnub extends PubnubCore { + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL on ? + */ + 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); + } + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param ssl_on + * 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); + } + + /** + * Pubnub Constructor + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + */ + public Pubnub(String publish_key, String subscribe_key) { + super(publish_key, subscribe_key, "", "", false); + } + + /** + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param ssl + */ + public Pubnub(String publish_key, String subscribe_key, boolean ssl) { + super(publish_key, subscribe_key, "", "", ssl); + } + + /** + * @param publish_key + * @param subscribe_key + * @param secret_key + */ + public Pubnub(String publish_key, String subscribe_key, String secret_key) { + super(publish_key, subscribe_key, secret_key, "", false); + } + + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL enabled ? + * @param initialization_vector + * Initialization vector + */ + + public Pubnub(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on, String initialization_vector) { + super(publish_key, subscribe_key, secret_key, cipher_key, ssl_on, initialization_vector); + } + + /** + * Sets value for UUID + * + * @param uuid + * UUID value for Pubnub client + */ + public void setUUID(UUID uuid) { + this.UUID = uuid.toString(); + } + + protected String uuid() { + return java.util.UUID.randomUUID().toString(); + } + + /** + * This method sets timeout value for subscribe/presence. Default value is + * 310000 milliseconds i.e. 310 seconds + * + * @param timeout + * Timeout value in milliseconds for subscribe/presence + */ + public void setSubscribeTimeout(int timeout) { + super.setSubscribeTimeout(timeout); + } + + /** + * This method returns timeout value for subscribe/presence. + * + * @return Timeout value in milliseconds for subscribe/presence + */ + public int getSubscribeTimeout() { + return super.getSubscribeTimeout(); + } + + /** + * This method set timeout value for non subscribe operations like publish, + * history, hereNow. Default value is 15000 milliseconds i.e. 15 seconds. + * + * @param timeout + * Timeout value in milliseconds for Non subscribe operations + * like publish, history, hereNow + */ + public void setNonSubscribeTimeout(int timeout) { + super.setNonSubscribeTimeout(timeout); + } + /** + * This method returns timeout value for non subscribe operations like publish, history, hereNow + * + * @return Timeout value in milliseconds for for Non subscribe operations like publish, history, hereNow + */ + public int getNonSubscribeTimeout() { + return super.getNonSubscribeTimeout(); + } + + protected String getUserAgent() { + return "Java/" + VERSION; + } + + /** + * Send a message to a channel. + * + * @param args + * Hashtable containing channel name, message. + * @param callback + * object of sub class of Callback class + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + */ + @Deprecated + @Override + public void publish(Hashtable args, Callback callback) { + super.publish(args, callback); + } + + /** + * Send a message to a channel. + * + * @param args + * Hashtable containing channel name, message, callback + * @deprecated As of version 3.5.2 . Will be removed in 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + * + */ + @Deprecated + @Override + public void publish(Hashtable args) { + super.publish(args); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, long end, int count, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(final String channel, long start, long end, + int count, boolean reverse, final Callback callback) { + super.detailedHistory(channel, start, end, count, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(final String channel, long start, long end, int count, + boolean reverse, final Callback callback) { + super.detailedHistory(channel, start, end, count, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, long start, boolean reverse, + Callback callback) { + super.detailedHistory(channel, start, reverse, callback); + } + + /** + * + * Read history for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(String channel, long start, boolean reverse, + Callback callback) { + super.detailedHistory(channel, start, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, long end, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, long start, long end, + Callback callback) { + super.detailedHistory(channel, start, end, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param callback + * Callback + */ + + public void history(String channel, long start, long end, Callback callback) { + super.detailedHistory(channel, start, end, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, long start, long end, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, long start, long end, + boolean reverse, Callback callback) { + super.detailedHistory(channel, start, end, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(String channel, long start, long end, boolean reverse, + Callback callback) { + super.detailedHistory(channel, start, end, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, int count, boolean reverse, Callback callback)} + */ + @Deprecated + @Override + public void detailedHistory(String channel, int count, boolean reverse, + Callback callback) { + super.detailedHistory(channel, count, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void history(String channel, int count, boolean reverse, + Callback callback) { + super.detailedHistory(channel, count, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, boolean reverse, Callback callback)} + */ + @Deprecated + public void detailedHistory(String channel, boolean reverse, + Callback callback) { + super.detailedHistory(channel, reverse, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + + public void history(String channel, boolean reverse, Callback callback) { + super.detailedHistory(channel, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Maximum number of messages + * @param callback + * Callback object + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Replaced + * by + * {@link #history(String channel, int count, Callback callback)} + */ + @Deprecated + public void detailedHistory(String channel, int count, Callback callback) { + super.detailedHistory(channel, count, callback); + } + + /** + * + * Read History for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Maximum number of messages + * @param callback + * Callback object + */ + @Override + public void history(String channel, int count, Callback callback) { + super.detailedHistory(channel, count, callback); + } + + /** + * Unsubscribe/Disconnect from channel. + * + * @param args + * Hashtable containing channel name. + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + */ + @Deprecated + public void unsubscribe(Hashtable args) { + String[] channelList = (String[]) args.get("channels"); + if (channelList == null) { + channelList = new String[] { (String) args.get("channel") }; + } + unsubscribe(channelList); + } + + /** + * + * Listen for a message on a channel. + * + * @param args + * Hashtable containing channel name + * @param callback + * Callback + * @exception PubnubException + * Throws PubnubException if Callback is null + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . + */ + @Deprecated + public void subscribe(Hashtable args, Callback callback) + throws PubnubException { + args.put("callback", callback); + super.subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param args + * Hashtable containing channel name, callback + * @exception PubnubException + * Throws PubnubException if Callback is null + * @deprecated as of version 3.5.2 and will be removed with 3.6.0 . Methods + * accepting Hashtable as arguments have been deprecated. + */ + @Deprecated + public void subscribe(Hashtable args) throws PubnubException { + super.subscribe(args); + } + + private String pamSign(String key, String data) throws PubnubException { + Mac sha256_HMAC; + + try { + sha256_HMAC = Mac.getInstance("HmacSHA256"); + SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(), + "HmacSHA256"); + sha256_HMAC.init(secret_key); + byte[] hmacData = sha256_HMAC.doFinal(data.getBytes("UTF-8")); + return new String(Base64Encoder.encode(hmacData)).replace('+', '-') + .replace('/', '_'); + } catch (InvalidKeyException e1) { + throw new PubnubException(getErrorObject(PubnubError.PNERROBJ_ULSSIGN_ERROR, 1, "Invalid Key : " + e1.toString())); + } catch (NoSuchAlgorithmException e1) { + throw new PubnubException(getErrorObject(PubnubError.PNERROBJ_ULSSIGN_ERROR, 2, "Invalid Algorithm : " + e1.toString())); + } catch (IllegalStateException e1) { + throw new PubnubException(getErrorObject(PubnubError.PNERROBJ_ULSSIGN_ERROR, 3, "Invalid State : " + e1.toString())); + } catch (UnsupportedEncodingException e1) { + throw new PubnubException(getErrorObject(PubnubError.PNERROBJ_ULSSIGN_ERROR, 4, "Unsupported encoding : " + e1.toString())); + } + } + + /** Grant r/w access based on channel and auth key + * @param channel + * @param auth_key + * @param read + * @param write + * @param callback + */ + public void pamGrant(final String channel, String auth_key, boolean read, + boolean write, final Callback callback) { + pamGrant(channel, auth_key, read, write, -1, callback); + } + + /** Grant r/w access based on channel + * @param channel + * @param read + * @param write + * @param callback + */ + public void pamGrant(final String channel, boolean read, + boolean write, final Callback callback) { + pamGrant(channel, null, read, write, -1, callback); + } + + /** Grant r/w access based on channel + * @param channel + * @param read + * @param write + * @param ttl + * @param callback + */ + public void pamGrant(final String channel, boolean read, + boolean write, int ttl, final Callback callback) { + pamGrant(channel, null, read, write, ttl, callback); + } + + /** Grant r/w access based on channel and auth key + * @param channel + * @param auth_key + * @param read + * @param write + * @param ttl + * @param callback + */ + public void pamGrant(final String channel, String auth_key, boolean read, + boolean write, int ttl, final Callback callback) { + + Hashtable parameters = PubnubUtil.hashtableClone(params); + + String r = (read) ? "1" : "0"; + String w = (write) ? "1" : "0"; + + String signature = "0"; + + int timestamp = (int) ((new Date().getTime()) / 1000); + + if (this.SECRET_KEY.length() == 0) { + callback.errorCallback(channel, + getErrorObject(PNERROBJ_SECRET_KEY_MISSING, 1)); + return; + } + + String sign_input = this.SUBSCRIBE_KEY + "\n" + this.PUBLISH_KEY + "\n" + "grant" + "\n" ; + + if (auth_key != null && auth_key.length() > 0) + sign_input += "auth=" + auth_key + "&" ; + + sign_input += "channel=" + channel + "&" + "r=" + r + "&" + "timestamp=" + timestamp + + ((ttl > -1)?"&" + "ttl=" + ttl:"") + + "&" + "w=" + w; + + + try { + signature = pamSign(this.SECRET_KEY, sign_input); + } catch (PubnubException e1) { + callback.errorCallback(channel, + e1.getPubnubError()); + return; + } + + + parameters.put("w", w); + parameters.put("timestamp", String.valueOf(timestamp)); + parameters.put("signature", signature); + parameters.put("r", r); + parameters.put("channel", channel); + + if (auth_key != null && auth_key.length() > 0 ) parameters.put("auth", auth_key); + if (ttl > 0) parameters.put("ttl", String.valueOf(ttl)); + + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "grant", "sub-key", + this.SUBSCRIBE_KEY + }; + + HttpRequest hreq = new HttpRequest(urlComponents, parameters, + new ResponseHandler() { + public void handleResponse(HttpRequest hreq, String response) { + JSONObject jso; + try { + jso = new JSONObject(response); + } catch (JSONException e) { + handleError(hreq, getErrorObject( + PNERROBJ_INVALID_JSON, 4, + response)); + return; + } + callback.successCallback(channel, jso); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + return; + } + }); + + _request(hreq, nonSubscribeManager); + + } + + /** ULS Audit + * @param callback + */ + public void pamAudit(final Callback callback) { + + Hashtable parameters = PubnubUtil.hashtableClone(params); + parameters.remove("auth"); + + String signature = "0"; + + int timestamp = (int) ((new Date().getTime()) / 1000); + + if (this.SECRET_KEY.length() == 0) { + callback.errorCallback("", + getErrorObject(PNERROBJ_SECRET_KEY_MISSING, 2)); + return; + } + + String sign_input = this.SUBSCRIBE_KEY + "\n" + this.PUBLISH_KEY + "\n" + + "audit" + "\n" + + "timestamp=" + timestamp; + + + try { + signature = pamSign(this.SECRET_KEY, sign_input); + } catch (PubnubException e1) { + callback.errorCallback("", + e1.getPubnubError()); + return; + } + + parameters.put("timestamp", String.valueOf(timestamp)); + parameters.put("signature", signature); + + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "audit", "sub-key", + this.SUBSCRIBE_KEY + }; + + HttpRequest hreq = new HttpRequest(urlComponents, parameters, + new ResponseHandler() { + public void handleResponse(HttpRequest hreq, String response) { + JSONObject jso; + try { + jso = new JSONObject(response); + } catch (JSONException e) { + handleError(hreq, getErrorObject( + PNERROBJ_INVALID_JSON, 5, + response)); + return; + } + callback.successCallback("", jso); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback("", error); + return; + } + }); + + _request(hreq, nonSubscribeManager); + + } + + /** ULS audit by channel + * @param channel + * @param callback + */ + public void pamAudit(final String channel, + final Callback callback) { + + Hashtable parameters = PubnubUtil.hashtableClone(params); + parameters.remove("auth"); + + String signature = "0"; + + int timestamp = (int) ((new Date().getTime()) / 1000); + + if (this.SECRET_KEY.length() == 0) { + callback.errorCallback(channel, + getErrorObject(PNERROBJ_SECRET_KEY_MISSING , 3)); + return; + } + + String sign_input = this.SUBSCRIBE_KEY + "\n" + this.PUBLISH_KEY + "\n" + + "audit" + "\n" + "channel=" + + channel + "&" + "timestamp=" + timestamp; + + try { + signature = pamSign(this.SECRET_KEY, sign_input); + } catch (PubnubException e1) { + callback.errorCallback(channel, + e1.getPubnubError()); + return; + } + + parameters.put("timestamp", String.valueOf(timestamp)); + parameters.put("signature", signature); + parameters.put("channel", channel); + + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "audit", "sub-key", + this.SUBSCRIBE_KEY + }; + + HttpRequest hreq = new HttpRequest(urlComponents, parameters, + new ResponseHandler() { + public void handleResponse(HttpRequest hreq, String response) { + JSONObject jso; + try { + jso = new JSONObject(response); + } catch (JSONException e) { + handleError(hreq, getErrorObject( + PNERROBJ_INVALID_JSON, 6, + response)); + return; + } + callback.successCallback(channel, jso); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + return; + } + }); + + _request(hreq, nonSubscribeManager); + + } + + /** ULS audit by channel and auth key + * @param channel + * @param auth_key + * @param callback + */ + public void pamAudit(final String channel, String auth_key, + final Callback callback) { + + Hashtable parameters = PubnubUtil.hashtableClone(params); + + String signature = "0"; + + int timestamp = (int) ((new Date().getTime()) / 1000); + + if (this.SECRET_KEY.length() == 0) { + callback.errorCallback(channel, + getErrorObject(PNERROBJ_SECRET_KEY_MISSING, 4)); + return; + } + + String sign_input = this.SUBSCRIBE_KEY + "\n" + this.PUBLISH_KEY + "\n" + + "audit" + "\n" + "auth=" + auth_key + "&" + "channel=" + + channel + "&" + "timestamp=" + timestamp; + + + try { + signature = pamSign(this.SECRET_KEY, sign_input); + } catch (PubnubException e1) { + callback.errorCallback(channel, + e1.getPubnubError()); + return; + } + + parameters.put("timestamp", String.valueOf(timestamp)); + parameters.put("signature", signature); + parameters.put("channel", channel); + parameters.put("auth", auth_key); + + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "audit", "sub-key", + this.SUBSCRIBE_KEY + }; + + HttpRequest hreq = new HttpRequest(urlComponents, parameters, + new ResponseHandler() { + public void handleResponse(HttpRequest hreq, String response) { + JSONObject jso; + try { + jso = new JSONObject(response); + } catch (JSONException e) { + handleError(hreq, PubnubError.getErrorObject( + PubnubError.PNERROBJ_INVALID_JSON, 2, + response)); + return; + } + callback.successCallback(channel, jso); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + return; + } + }); + + _request(hreq, nonSubscribeManager); + + } + + /** ULS revoke by channel and auth key + * @param channel + * @param auth_key + * @param callback + */ + public void pamRevoke(String channel, String auth_key, Callback callback) { + pamGrant(channel, auth_key, false, false, callback); + } + + + /** ULS revoke by channel + * @param channel + * @param callback + */ + public void pamRevoke(String channel, Callback callback) { + pamGrant(channel, null, false, false, callback); + } + +} diff --git a/java/src1/com/pubnub/api/HttpClientCore.java b/java/src1/com/pubnub/api/HttpClientCore.java new file mode 100644 index 000000000..473ac8ba7 --- /dev/null +++ b/java/src1/com/pubnub/api/HttpClientCore.java @@ -0,0 +1,216 @@ +package com.pubnub.api; + +import java.io.ByteArrayOutputStream; +import java.util.zip.GZIPInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import com.pubnub.api.PubnubException; +import static com.pubnub.api.PubnubError.*; + +class HttpClientCore extends HttpClient { + private int requestTimeout = 310000; + private int connectionTimeout = 5000; + HttpURLConnection connection; + protected static Logger log = new Logger(Worker.class); + + private void init() { + HttpURLConnection.setFollowRedirects(true); + } + + public HttpClientCore(int connectionTimeout, int requestTimeout, Hashtable headers) { + init(); + this.setRequestTimeout(requestTimeout); + this.setConnectionTimeout(connectionTimeout); + this._headers = headers; + } + + public int getRequestTimeout() { + return requestTimeout; + } + + public void setRequestTimeout(int requestTimeout) { + this.requestTimeout = requestTimeout; + } + + public int getConnectionTimeout() { + return connectionTimeout; + } + + public void setConnectionTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + } + + public boolean isRedirect(int rc) { + return (rc == HttpURLConnection.HTTP_MOVED_PERM + || rc == HttpURLConnection.HTTP_MOVED_TEMP || rc == HttpURLConnection.HTTP_SEE_OTHER); + } + + public boolean checkResponse(int rc) { + return (rc == HttpURLConnection.HTTP_OK || isRedirect(rc)); + } + + public boolean checkResponseSuccess(int rc) { + return (rc == HttpURLConnection.HTTP_OK); + } + + private static String readInput(InputStream in) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte bytes[] = new byte[1024]; + + int n = in.read(bytes); + + while (n != -1) { + out.write(bytes, 0, n); + n = in.read(bytes); + } + + return new String(out.toString()); + } + + public HttpResponse fetch(String url) throws PubnubException, SocketTimeoutException { + return fetch(url, null); + } + + public synchronized HttpResponse fetch(String url, Hashtable headers) + throws PubnubException, SocketTimeoutException { + URL urlobj = null; + log.verbose("FETCHING URL : " + url); + try { + urlobj = new URL(url); + } catch (MalformedURLException e3) { + throw new PubnubException(getErrorObject(PNERROBJ_MALFORMED_URL,url)); + } + try { + connection = (HttpURLConnection) urlobj.openConnection(); + } catch (IOException e2) { + throw new PubnubException(getErrorObject(PNERROBJ_URL_OPEN, url)); + } + try { + connection.setRequestMethod("GET"); + } catch (ProtocolException e1) { + throw new PubnubException(PNERROBJ_PROTOCOL_EXCEPTION); + } + if (_headers != null) { + Enumeration en = _headers.keys(); + while (en.hasMoreElements()) { + String key = (String) en.nextElement(); + String val = (String) _headers.get(key); + connection.addRequestProperty(key, val); + } + } + if (headers != null) { + Enumeration en = headers.keys(); + while (en.hasMoreElements()) { + String key = (String) en.nextElement(); + String val = (String) headers.get(key); + connection.addRequestProperty(key, val); + } + } + connection.setReadTimeout(requestTimeout); + connection.setConnectTimeout(connectionTimeout); + + /* + try { + connection.connect(); + } catch (SocketTimeoutException e) { + throw e; + } catch (IOException e) { + throw new PubnubException(getErrorObject(PNERROBJ_CONNECT_EXCEPTION, url + " : " + e.toString())); + } + */ + + int rc = HttpURLConnection.HTTP_INTERNAL_ERROR; + try { + rc = connection.getResponseCode(); + } catch (SocketTimeoutException ste) { + throw ste; + } + catch (IOException e) { + throw new PubnubException(getErrorObject(PNERROBJ_HTTP_RC_ERROR, url + " : " + e.toString())); + } + + + InputStream is = null; + String encoding = connection.getContentEncoding(); + + if (encoding == null || !encoding.equals("gzip")) { + try { + is = connection.getInputStream(); + } catch (IOException e) { + if (rc == HttpURLConnection.HTTP_OK) + throw new PubnubException(getErrorObject(PNERROBJ_GETINPUTSTREAM, 1, url)); + is = connection.getErrorStream(); + } + + } else { + try { + is = new GZIPInputStream(connection.getInputStream()); + } catch (IOException e) { + if (rc == HttpURLConnection.HTTP_OK) + throw new PubnubException(getErrorObject(PNERROBJ_GETINPUTSTREAM, 2, url)); + is = connection.getErrorStream(); + } + } + + String page = null; + try { + page = readInput(is); + } catch (IOException e) { + throw new PubnubException(getErrorObject(PNERROBJ_READINPUT, url)); + } + + log.verbose("URL = " + url + " : RESPONSE = " + page); + switch (rc) { + case HttpURLConnection.HTTP_FORBIDDEN: + throw new PubnubException(getErrorObject(PNERROBJ_FORBIDDEN, page)); + case HttpURLConnection.HTTP_UNAUTHORIZED: + throw new PubnubException(getErrorObject(PNERROBJ_UNAUTHORIZED, page)); + case HttpURLConnection.HTTP_BAD_REQUEST: + try { + JSONArray jsarr = new JSONArray(page); + String error = jsarr.get(1).toString(); + throw new PubnubException(getErrorObject(PNERROBJ_BAD_REQUEST, 1, error)); + } catch (JSONException e) { + JSONObject jso; + try { + jso = new JSONObject(page); + throw new PubnubException(getErrorObject(PNERROBJ_BAD_REQUEST, 2, jso.toString())); + } catch (JSONException e1) { + throw new PubnubException(getErrorObject(PNERROBJ_INVALID_JSON, 2)); + } + } + case HttpURLConnection.HTTP_BAD_GATEWAY: + throw new PubnubException(getErrorObject(PNERROBJ_BAD_GATEWAY, url)); + case HttpURLConnection.HTTP_CLIENT_TIMEOUT: + throw new PubnubException(getErrorObject(PNERROBJ_CLIENT_TIMEOUT, url)); + case HttpURLConnection.HTTP_GATEWAY_TIMEOUT: + throw new PubnubException(getErrorObject(PNERROBJ_GATEWAY_TIMEOUT, url)); + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw new PubnubException(getErrorObject(PNERROBJ_INTERNAL_ERROR, url + " : " + rc)); + default: + break; + } + return new HttpResponse(rc, page); + } + + public boolean isOk(int rc) { + return (rc == HttpURLConnection.HTTP_OK); + } + + public void shutdown() { + if (connection != null) connection.disconnect(); + } +} + diff --git a/java/src1/com/pubnub/api/NonSubscribeManager.java b/java/src1/com/pubnub/api/NonSubscribeManager.java new file mode 100644 index 000000000..fb1060b68 --- /dev/null +++ b/java/src1/com/pubnub/api/NonSubscribeManager.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +class NonSubscribeManager extends AbstractNonSubscribeManager { + + public NonSubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public void clearRequestQueue() { + _waiting.clear(); + } +} diff --git a/java/src1/com/pubnub/api/PubnubCrypto.java b/java/src1/com/pubnub/api/PubnubCrypto.java new file mode 100644 index 000000000..7f1b5da81 --- /dev/null +++ b/java/src1/com/pubnub/api/PubnubCrypto.java @@ -0,0 +1,11 @@ +package com.pubnub.api; + +class PubnubCrypto extends PubnubCryptoCore { + + public PubnubCrypto(String CIPHER_KEY) { + super(CIPHER_KEY); + } + public PubnubCrypto(String CIPHER_KEY, String IV) { + super(CIPHER_KEY, IV); + } +} diff --git a/java/src1/com/pubnub/api/PubnubUtil.java b/java/src1/com/pubnub/api/PubnubUtil.java new file mode 100644 index 000000000..25d52aed9 --- /dev/null +++ b/java/src1/com/pubnub/api/PubnubUtil.java @@ -0,0 +1,61 @@ +package com.pubnub.api; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * PubnubUtil class provides utility methods like urlEncode etc + * @author Pubnub + * + */ +public class PubnubUtil extends PubnubUtilCore { + + /** + * Returns encoded String + * + * @param sUrl + * , input string + * @return , encoded string + */ + public static String urlEncode(String sUrl) { + try { + return URLEncoder.encode(sUrl, "UTF-8").replace("+", "%20"); + } catch (UnsupportedEncodingException e) { + return null; + } + } + /** + * Convert input String to JSONObject, JSONArray, or String + * + * @param str + * JSON data in string format + * + * @return JSONArray or JSONObject or String + */ + static Object stringToJSON(String str) { + try { + return new JSONArray(str); + } catch (JSONException e) { + } + try { + return new JSONObject(str); + } catch (JSONException ex) { + } + try { + return Integer.parseInt(str); + } catch (Exception ex) { + } + try { + return Double.parseDouble(str); + } catch (Exception ex) { + } + return str; + } +} diff --git a/java/src1/com/pubnub/api/SubscribeManager.java b/java/src1/com/pubnub/api/SubscribeManager.java new file mode 100644 index 000000000..a1916237a --- /dev/null +++ b/java/src1/com/pubnub/api/SubscribeManager.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +class SubscribeManager extends AbstractSubscribeManager { + + public SubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public void clearRequestQueue() { + _waiting.clear(); + } +} diff --git a/java/src1/com/pubnub/api/SubscribeWorker.java b/java/src1/com/pubnub/api/SubscribeWorker.java new file mode 100644 index 000000000..5251098c0 --- /dev/null +++ b/java/src1/com/pubnub/api/SubscribeWorker.java @@ -0,0 +1,113 @@ +package com.pubnub.api; + +import java.net.SocketTimeoutException; +import java.util.Hashtable; +import java.util.Vector; +import static com.pubnub.api.PubnubError.*; + +class SubscribeWorker extends AbstractSubscribeWorker { + + private Exception excp = null; + + SubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, + maxRetries, retryInterval, windowInterval, headers); + } + + void process(HttpRequest hreq) { + HttpResponse hresp = null; + int currentRetryAttempt = (hreq.isDar())?1:maxRetries; + log.verbose("disconnectAndResubscribe is " + hreq.isDar()); + if (hreq.getWorker() != null) { + log.verbose("Request placed by worker " + hreq.getWorker().getThread().getName()); + if (hreq.getWorker()._die) { + log.verbose("The thread which placed the request has died, so ignore the request : " + hreq.getWorker().getThread().getName()); + return; + } + } + hreq.setWorker(this); + if (!hreq.isSubzero() && windowInterval != 0) { + try { + Thread.sleep(windowInterval); + } catch (InterruptedException e) { + } + } + boolean sleep = false; + while (!_die && currentRetryAttempt <= maxRetries) { + if (sleep) { + try { + Thread.sleep(retryInterval); + } catch (InterruptedException e) { + } + } + sleep = true; + try { + log.debug(hreq.getUrl()); + hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders()); + if (hresp != null + && HttpUtil.checkResponseSuccess(hresp + .getStatusCode())) { + currentRetryAttempt = 1; + break; + } + } catch (SocketTimeoutException e) { + log.verbose("No Traffic , Read Timeout Exception in Fetch : " + e.toString()); + if (_die) { + log.verbose("Asked to Die, Don't do back from DAR processing"); + break; + } + if (hreq.isDar()) { + hreq.getResponseHandler().handleBackFromDar(hreq); + return; + } + break; + + } catch (PubnubException e) { + excp = e; + switch (e.getPubnubError().errorCode) { + case PNERR_FORBIDDEN: + case PNERR_UNAUTHORIZED: + log.verbose("Authentication Failure : " + e.toString()); + currentRetryAttempt = maxRetries + 1; + break; + default: + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":currentRetryAttempt) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + break; + } + + } catch (Exception e) { + excp = e; + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":currentRetryAttempt) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + } + + } + if (!_die) { + if (hresp == null) { + log.debug("Error in fetching url : " + hreq.getUrl()); + if (hreq.isDar()) { + log.verbose("Exhausted number of retries"); + hreq.getResponseHandler().handleTimeout(hreq); + } else { + if (excp != null && excp instanceof PubnubException && ((PubnubException) excp).getPubnubError() != null) { + hreq.getResponseHandler().handleError(hreq, ((PubnubException) excp).getPubnubError()); + } else { + hreq.getResponseHandler().handleError(hreq, getErrorObject(PNERROBJ_HTTP_ERROR, 1)); + } + } + return; + } + log.debug(hresp.getResponse()); + hreq.getResponseHandler().handleResponse(hreq, hresp.getResponse()); + } + + } + + public void shutdown() { + if (httpclient != null) httpclient.shutdown(); + } +} diff --git a/java/srcLogging/com/pubnub/api/Logger.java b/java/srcLogging/com/pubnub/api/Logger.java new file mode 100644 index 000000000..98b4d4d0d --- /dev/null +++ b/java/srcLogging/com/pubnub/api/Logger.java @@ -0,0 +1,34 @@ +package com.pubnub.api; + +import org.slf4j.LoggerFactory; + + +class Logger extends AbstractLogger { + private Class _class; + private org.slf4j.Logger log; + + public Logger(Class _class) { + this._class = _class; + this.log = LoggerFactory.getLogger(this._class); + } + + @Override + protected void nativeDebug(String s) { + log.debug(s); + } + + @Override + protected void nativeVerbose(String s) { + log.trace(s); + } + + @Override + protected void nativeError(String s) { + log.error(s); + } + + @Override + protected void nativeInfo(String s) { + log.info(s); + } +} diff --git a/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java b/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java new file mode 100644 index 000000000..b44420da6 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java @@ -0,0 +1,45 @@ +package com.pubnub.api; + +abstract class AbstractLogger { + + private static boolean LOGGING = false; + + private static String VERSION = ""; + + protected abstract void nativeDebug(String s); + + protected abstract void nativeVerbose(String s); + + protected abstract void nativeError(String s); + + protected abstract void nativeInfo(String s); + + private String prepareString(String s) { + return "[" + VERSION + "] : " + "[" + System.currentTimeMillis() + "] : " + + "["+Thread.activeCount() + + "] Thread HashCode : " + Thread.currentThread().hashCode() + + ", Thread Name : " + Thread.currentThread().getName() + + ", " + s; + } + + public void debug(String s) { + if (LOGGING) + nativeDebug(prepareString(s)); + } + + public void verbose(String s) { + if (LOGGING) + nativeVerbose(prepareString(s)); + } + + public void info(String s) { + if (LOGGING) + nativeInfo(prepareString(s)); + } + + public void error(String s) { + if (LOGGING) + nativeError(prepareString(s)); + } + +} diff --git a/java/srcPubnubApi/com/pubnub/api/Base64Encoder.java b/java/srcPubnubApi/com/pubnub/api/Base64Encoder.java new file mode 100644 index 000000000..3461a6d78 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/Base64Encoder.java @@ -0,0 +1,170 @@ +package com.pubnub.api; + +/** + * Simple base64 encoder, can be implemented in other platforms. + * + */ +class Base64Encoder { + + // Mapping table from 6-bit nibbles to Base64 characters. + private static char[] map1 = new char[64]; + static { + int i = 0; + for (char c = 'A'; c <= 'Z'; c++) + map1[i++] = c; + for (char c = 'a'; c <= 'z'; c++) + map1[i++] = c; + for (char c = '0'; c <= '9'; c++) + map1[i++] = c; + map1[i++] = '+'; + map1[i++] = '/'; + } + + // Mapping table from Base64 characters to 6-bit nibbles. + private static byte[] map2 = new byte[128]; + static { + for (int i = 0; i < map2.length; i++) + map2[i] = -1; + for (int i = 0; i < 64; i++) + map2[map1[i]] = (byte) i; + } + + /** + * Encodes a string into Base64 format. No blanks or line breaks are + * inserted. + * + * @param s + * a String to be encoded. + * @return A String with the Base64 encoded data. + */ + public static String encodeString(String s) { + return new String(encode(s.getBytes())); + } + + /** + * Encodes a byte array into Base64 format. No blanks or line breaks are + * inserted. + * + * @param in + * an array containing the data bytes to be encoded. + * @return A character array with the Base64 encoded data. + */ + public static char[] encode(byte[] in) { + return encode(in, in.length); + } + + /** + * Encodes a byte array into Base64 format. No blanks or line breaks are + * inserted. + * + * @param in + * an array containing the data bytes to be encoded. + * @param iLen + * number of bytes to process in in. + * @return A character array with the Base64 encoded data. + */ + public static char[] encode(byte[] in, int iLen) { + int oDataLen = (iLen * 4 + 2) / 3; // output length without padding + int oLen = ((iLen + 2) / 3) * 4; // output length including padding + char[] out = new char[oLen]; + int ip = 0; + int op = 0; + while (ip < iLen) { + int i0 = in[ip++] & 0xff; + int i1 = ip < iLen ? in[ip++] & 0xff : 0; + int i2 = ip < iLen ? in[ip++] & 0xff : 0; + int o0 = i0 >>> 2; + int o1 = ((i0 & 3) << 4) | (i1 >>> 4); + int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6); + int o3 = i2 & 0x3F; + out[op++] = map1[o0]; + out[op++] = map1[o1]; + out[op] = op < oDataLen ? map1[o2] : '='; + op++; + out[op] = op < oDataLen ? map1[o3] : '='; + op++; + } + return out; + } + + /** + * Decodes a string from Base64 format. + * + * @param s + * a Base64 String to be decoded. + * @return A String containing the decoded data. + * @throws IllegalArgumentException + * if the input is not valid Base64 encoded data. + */ + public static String decodeString(String s) { + return new String(decode(s)); + } + + /** + * Decodes a byte array from Base64 format. + * + * @param s + * a Base64 String to be decoded. + * @return An array containing the decoded data bytes. + * @throws IllegalArgumentException + * if the input is not valid Base64 encoded data. + */ + public static byte[] decode(String s) { + return decode(s.toCharArray()); + } + + /** + * Decodes a byte array from Base64 format. No blanks or line breaks are + * allowed within the Base64 encoded data. + * + * @param in + * a character array containing the Base64 encoded data. + * @return An array containing the decoded data bytes. + * @throws IllegalArgumentException + * if the input is not valid Base64 encoded data. + */ + public static byte[] decode(char[] in) { + int iLen = in.length; + if (iLen % 4 != 0) + throw new IllegalArgumentException( + "Length of Base64 encoded input string is not a multiple of 4."); + while (iLen > 0 && in[iLen - 1] == '=') + iLen--; + int oLen = (iLen * 3) / 4; + byte[] out = new byte[oLen]; + int ip = 0; + int op = 0; + while (ip < iLen) { + int i0 = in[ip++]; + int i1 = in[ip++]; + int i2 = ip < iLen ? in[ip++] : 'A'; + int i3 = ip < iLen ? in[ip++] : 'A'; + if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) + throw new IllegalArgumentException( + "Illegal character in Base64 encoded data."); + int b0 = map2[i0]; + int b1 = map2[i1]; + int b2 = map2[i2]; + int b3 = map2[i3]; + if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) + throw new IllegalArgumentException( + "Illegal character in Base64 encoded data."); + int o0 = (b0 << 2) | (b1 >>> 4); + int o1 = ((b1 & 0xf) << 4) | (b2 >>> 2); + int o2 = ((b2 & 3) << 6) | b3; + out[op++] = (byte) o0; + if (op < oLen) + out[op++] = (byte) o1; + if (op < oLen) + out[op++] = (byte) o2; + } + return out; + } + + /** + * This class is not instantiable. + */ + private Base64Encoder() { + } + +} // end class Base64Encoder diff --git a/java/srcPubnubApi/com/pubnub/api/Callback.java b/java/srcPubnubApi/com/pubnub/api/Callback.java new file mode 100644 index 000000000..19acab2c3 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/Callback.java @@ -0,0 +1,77 @@ +package com.pubnub.api; + +/** + * Abstract class to be subclassed by objects being passed as callbacks to + * Pubnub APIs Default implementation for all methods is blank + * + * @author Pubnub + * + */ +public abstract class Callback { + + /** + * This callback will be invoked when a message is received on the channel + * + * @param channel + * Channel Name + * @param message + * Message + * + */ + public abstract void successCallback(String channel, Object message); + + /** + * This callback will be invoked when an error occurs + * + * @param channel + * Channel Name + * @param error + * error + */ + public void errorCallback(String channel, PubnubError error) { + errorCallback(channel,error.toString()); + } + + /** + * This callback will be invoked when an error occurs + * + * @param channel + * Channel Name + * @param message + * Message + *@deprecated as of version 3.5.2 and will be removed with 3.6.0 . + * Replaced by {@link #errorCallback(String channel, PubnubError error)} + */ + public void errorCallback(String channel, Object message) { + + } + + /** + * This callback will be invoked on getting connected to a channel + * + * @param channel + * Channel Name + */ + public void connectCallback(String channel, Object message) { + } + + /** + * This callback is invoked on getting reconnected to a channel after + * getting disconnected + * + * @param channel + * Channel Name + */ + public void reconnectCallback(String channel, Object message) { + } + + /** + * This callback is invoked on getting disconnected from a channel + * + * @param channel + * Channel Name + */ + public void disconnectCallback(String channel, Object message) { + } + +} diff --git a/java/srcPubnubApi/com/pubnub/api/Channel.java b/java/srcPubnubApi/com/pubnub/api/Channel.java new file mode 100644 index 000000000..d8ad32b6c --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/Channel.java @@ -0,0 +1,13 @@ +package com.pubnub.api; + +/** + * @author PubnubCore + * + */ +class Channel { + String name; + boolean connected; + boolean subscribed; + boolean error; + Callback callback; +} diff --git a/java/srcPubnubApi/com/pubnub/api/HttpClient.java b/java/srcPubnubApi/com/pubnub/api/HttpClient.java new file mode 100644 index 000000000..b6fabba12 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/HttpClient.java @@ -0,0 +1,34 @@ +package com.pubnub.api; + +import java.io.IOException; +import java.util.Hashtable; +import com.pubnub.api.PubnubException; + +abstract class HttpClient { + + protected Hashtable _headers; + + public static HttpClient getClient(int connectionTimeout, int requestTimeout, Hashtable headers) { + return new HttpClientCore(connectionTimeout, requestTimeout, headers); + } + + public void reset() { + shutdown(); + } + + public abstract int getRequestTimeout(); + + public abstract void setRequestTimeout(int requestTimeout); + + public abstract int getConnectionTimeout(); + + public abstract void setConnectionTimeout(int connectionTimeout); + + public abstract void shutdown(); + + public abstract HttpResponse fetch(String url) throws IOException, + PubnubException; + + public abstract HttpResponse fetch(String url, Hashtable headers) + throws IOException, PubnubException; +} diff --git a/java/srcPubnubApi/com/pubnub/api/HttpRequest.java b/java/srcPubnubApi/com/pubnub/api/HttpRequest.java new file mode 100644 index 000000000..594a96214 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/HttpRequest.java @@ -0,0 +1,126 @@ +package com.pubnub.api; + +import java.util.Enumeration; +import java.util.Hashtable; + +import com.pubnub.api.PubnubUtil; + +class HttpRequest { + private volatile ResponseHandler responseHandler; + private Hashtable headers; + private String[] urlComponents; + private Hashtable params; + private String url; + private boolean dar; + private boolean subzero; + private Worker _worker; + + public boolean isSubzero() { + return subzero; + } + + public void setWorker(Worker worker) { + this._worker = worker; + } + + public Worker getWorker() { + return this._worker; + } + public void setSubzero(boolean subzero) { + this.subzero = subzero; + } + + public boolean isDar() { + return dar; + } + + public void setDar(boolean dar) { + this.dar = dar; + } + + public HttpRequest(String[] urlComponents, Hashtable params, + Hashtable headers, ResponseHandler rh) { + this.setUrlComponents(urlComponents); + this.setParams(params); + this.setHeaders(headers); + this.setResponseHandler(rh); + } + + public HttpRequest(String[] urlComponents, Hashtable params, + ResponseHandler rh) { + this.setUrlComponents(urlComponents); + this.setParams(params); + this.setResponseHandler(rh); + } + + public HttpRequest(String[] urlComponents, ResponseHandler rh) { + this.setUrlComponents(urlComponents); + this.setResponseHandler(rh); + } + + public String[] getUrlComponents() { + return urlComponents; + } + + public void setUrlComponents(String[] urlComponents) { + this.urlComponents = urlComponents; + } + + public Hashtable getParams() { + return params; + } + + public void setParams(Hashtable params) { + this.params = params; + } + + public ResponseHandler getResponseHandler() { + return responseHandler; + } + + public void setResponseHandler(ResponseHandler responseHandler) { + this.responseHandler = responseHandler; + } + + public Hashtable getHeaders() { + return headers; + } + + public void setHeaders(Hashtable headers) { + this.headers = headers; + } + + public String getUrl() { + + if (url != null) { + return url; + } + + String url = PubnubUtil.joinString(urlComponents, "/"); + + if (this.params != null && this.params.size() > 0) { + StringBuffer sb = new StringBuffer(); + sb.append(url).append("?"); + + Enumeration paramsKeys = this.params.keys(); + boolean first = true; + while (paramsKeys.hasMoreElements()) { + if (!first) { + sb.append("&"); + } else + first = false; + + String key = (String) paramsKeys.nextElement(); + sb.append(PubnubUtil.urlEncode((String) key)) + .append("=") + .append(PubnubUtil.urlEncode((String) this.params + .get(key))); + } + + url = sb.toString(); + } + this.url = url; + + return this.url; + } +} diff --git a/java/srcPubnubApi/com/pubnub/api/HttpResponse.java b/java/srcPubnubApi/com/pubnub/api/HttpResponse.java new file mode 100644 index 000000000..9e6732a11 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/HttpResponse.java @@ -0,0 +1,28 @@ +package com.pubnub.api; + +class HttpResponse { + private int statusCode; + private String response; + + public String getResponse() { + return response; + } + + public void setResposnse(String resposnse) { + this.response = resposnse; + } + + public int getStatusCode() { + return statusCode; + } + + public void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + + public HttpResponse(int statusCode, String response) { + this.setResposnse(response); + this.setStatusCode(statusCode); + } + +} diff --git a/java/srcPubnubApi/com/pubnub/api/HttpUtil.java b/java/srcPubnubApi/com/pubnub/api/HttpUtil.java new file mode 100644 index 000000000..3023770e4 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/HttpUtil.java @@ -0,0 +1,31 @@ +package com.pubnub.api; + +public class HttpUtil { + public static final int HTTP_MOVED_PERM = 301; + public static final int HTTP_MOVED_TEMP = 302; + public static final int HTTP_SEE_OTHER = 303; + public static final int HTTP_OK = 200; + public static final int HTTP_FORBIDDEN = 403; + public static final int HTTP_UNAUTHORIZED = 401; + public static final int HTTP_BAD_REQUEST = 400; + public static final int HTTP_BAD_GATEWAY = 502; + public static final int HTTP_CLIENT_TIMEOUT = 408; + public static final int HTTP_GATEWAY_TIMEOUT = 504; + public static final int HTTP_INTERNAL_ERROR = 500; + + public static boolean isRedirect(int rc) { + return (rc == HttpUtil.HTTP_MOVED_PERM + || rc == HttpUtil.HTTP_MOVED_TEMP || rc == HttpUtil.HTTP_SEE_OTHER); + } + public static boolean isOk(int rc) { + return (rc == HttpUtil.HTTP_OK); + } + + public static boolean checkResponse(int rc) { + return (rc == HttpUtil.HTTP_OK || isRedirect(rc)); + } + + public static boolean checkResponseSuccess(int rc) { + return (rc == HttpUtil.HTTP_OK); + } +} diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java new file mode 100644 index 000000000..7a7f44569 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/PubnubCore.java @@ -0,0 +1,1711 @@ +package com.pubnub.api; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Random; + +import org.bouncycastle.crypto.DataLengthException; +import org.bouncycastle.crypto.InvalidCipherTextException; +import org.bouncycastle.util.encoders.Hex; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + + +/** + * Pubnub object facilitates querying channels for messages and listening on + * channels for presence/message events + * + * @author Pubnub + * + */ + +abstract class PubnubCore { + + private String HOSTNAME = "pubsub"; + private int HOSTNAME_SUFFIX = 1; + private String DOMAIN = "pubnub.com"; + private String ORIGIN_STR = null; + protected String PUBLISH_KEY = ""; + protected String SUBSCRIBE_KEY = ""; + protected String SECRET_KEY = ""; + private String CIPHER_KEY = ""; + private String IV = null; + private volatile String AUTH_STR = null; + private volatile boolean CACHE_BUSTING = true; + protected Hashtable params; + private volatile boolean resumeOnReconnect; + + private boolean SSL = true; + protected String UUID = null; + private Subscriptions subscriptions; + + protected SubscribeManager subscribeManager; + protected NonSubscribeManager nonSubscribeManager; + private volatile String _timetoken = "0"; + private volatile String _saved_timetoken = "0"; + + private String PRESENCE_SUFFIX = "-pnpres"; + protected static String VERSION = ""; + private Random generator = new Random(); + + private static Logger log = new Logger(PubnubCore.class); + + protected abstract String getUserAgent(); + + /** + * This method when called stops Pubnub threads + */ + public void shutdown() { + nonSubscribeManager.stop(); + subscribeManager.stop(); + } + + /** + * This method returns the state of Resume on Reconnect setting + * + * @return Current state of Resume On Reconnect Setting + */ + public boolean isResumeOnReconnect() { + return resumeOnReconnect; + } + + /** + * This method sets retry interval for subscribe. Pubnub API will make + * maxRetries attempts to connect to pubnub servers. These attemtps will be + * made at an interval of retryInterval milliseconds. + * + * @param retryInterval + * Retry Interval in milliseconds + */ + public void setRetryInterval(int retryInterval) { + subscribeManager.setRetryInterval(retryInterval); + } + + /** + * This method sets window interval for subscribe. + * + * @param windowInterval + * Window Interval in milliseconds + */ + public void setWindowInterval(int windowInterval) { + subscribeManager.setWindowInterval(windowInterval); + } + + /** + * Returns current retry interval for subscribe + * @return Current Retry Interval in milliseconds + */ + public int getRetryInterval() { + return subscribeManager.retryInterval; + } + + /** + * Returns current window interval for subscribe + * @return Current Window Interval in milliseconds + */ + public int getWindowInterval() { + return subscribeManager.windowInterval; + } + + /** + * This methods sets maximum number of retries for subscribe. Pubnub API + * will make maxRetries attempts to connect to pubnub servers before timing + * out. + * + * @param maxRetries + * Max number of retries + */ + public void setMaxRetries(int maxRetries) { + subscribeManager.setMaxRetries(maxRetries); + } + + /** + * Returns current max retries for Subscribe + * @return Current max retries + */ + public int getMaxRetries() { + return subscribeManager.maxRetries; + } + + protected String getPubnubUrl() { + + if (ORIGIN_STR == null) { + // SSL On? + if (this.SSL) { + ORIGIN_STR = "https://"; + } else { + ORIGIN_STR = "https://"; + } + ORIGIN_STR += HOSTNAME; + ORIGIN_STR += ((!this.CACHE_BUSTING)?"":"-" + String.valueOf(HOSTNAME_SUFFIX)); + ORIGIN_STR += "." + DOMAIN; + } + return ORIGIN_STR; + } + + /** + * Enable/Disable Cache Busting + * + * @param cacheBusting + */ + public void setCacheBusting(boolean cacheBusting) { + this.CACHE_BUSTING = cacheBusting; + } + + /** + * Get Cache Busting value + * @return current cache busting setting + */ + public boolean getCacheBusting() { + return this.CACHE_BUSTING; + } + + /** + * This method returns all channel names currently subscribed to in form of + * a comma separated String + * + * @return Comma separated string with all channel names currently + * subscribed + */ + public String getCurrentlySubscribedChannelNames() { + String currentChannels = subscriptions.getChannelString(); + return currentChannels.equals("") ? "no channels." : currentChannels; + } + + /** + * If Resume on Reconnect is set to true, then Pubnub catches up on + * reconnection after disconnection. If false, then messages sent on the + * channel between disconnection and reconnection are not received. + * + * @param resumeOnReconnect + * True or False setting for Resume on Reconnect + */ + public void setResumeOnReconnect(boolean resumeOnReconnect) { + this.resumeOnReconnect = resumeOnReconnect; + } + + /** + * Returns Resume on Reconnect current setting + * @return Resume on Reconnect setting + */ + public boolean getResumeOnReconnect() { + return this.resumeOnReconnect; + } + + protected abstract String uuid(); + + /** + * Sets value for UUID + * + * @param uuid + * UUID value for Pubnub client + */ + public void setUUID(String uuid) { + this.UUID = uuid; + } + + /** + * Gets current UUID + * + * @return uuid + * current UUID value for Pubnub client + */ + public String getUUID() { + return this.UUID; + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL enabled ? + * @param initialization_vector + * Initialization vector + */ + + public PubnubCore(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on, String initialization_vector) { + this.init(publish_key, subscribe_key, secret_key, cipher_key, ssl_on, initialization_vector); + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param cipher_key + * Cipher Key + * @param ssl_on + * SSL enabled ? + */ + + public PubnubCore(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on) { + this.init(publish_key, subscribe_key, secret_key, cipher_key, ssl_on); + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + * @param ssl_on + * SSL enabled ? + */ + + public PubnubCore(String publish_key, String subscribe_key, + String secret_key, boolean ssl_on) { + this.init(publish_key, subscribe_key, secret_key, "", ssl_on); + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + */ + + public PubnubCore(String publish_key, String subscribe_key) { + this.init(publish_key, subscribe_key, "", "", false); + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + */ + + public PubnubCore(String publish_key, String subscribe_key, boolean ssl) { + this.init(publish_key, subscribe_key, "", "", ssl); + } + + /** + * + * Constructor for Pubnub Class + * + * @param publish_key + * Publish Key + * @param subscribe_key + * Subscribe Key + * @param secret_key + * Secret Key + */ + public PubnubCore(String publish_key, String subscribe_key, + String secret_key) { + this.init(publish_key, subscribe_key, secret_key, "", false); + } + + /** + * + * Initialize PubNub Object State. + * + * @param publish_key + * @param subscribe_key + * @param secret_key + * @param cipher_key + * @param ssl_on + */ + private void init(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on) { + this.init(publish_key, subscribe_key, secret_key, cipher_key, ssl_on, null); + } + + + /** + * + * Initialize PubNub Object State. + * + * @param publish_key + * @param subscribe_key + * @param secret_key + * @param cipher_key + * @param ssl_on + */ + private void init(String publish_key, String subscribe_key, + String secret_key, String cipher_key, boolean ssl_on, String initialization_vector) { + this.PUBLISH_KEY = publish_key; + this.SUBSCRIBE_KEY = subscribe_key; + this.SECRET_KEY = secret_key; + this.CIPHER_KEY = cipher_key; + this.SSL = ssl_on; + + if (UUID == null) + UUID = uuid(); + + if (subscriptions == null) + subscriptions = new Subscriptions(); + + if (subscribeManager == null) + subscribeManager = new SubscribeManager("Subscribe-Manager-" + + System.identityHashCode(this), 10000, 310000); + + if (nonSubscribeManager == null) + nonSubscribeManager = new NonSubscribeManager( + "Non-Subscribe-Manager-" + System.identityHashCode(this), + 10000, 15000); + + if (params == null) + params = new Hashtable(); + + subscribeManager.setHeader("V", VERSION); + subscribeManager.setHeader("Accept-Encoding", "gzip"); + subscribeManager.setHeader("User-Agent", getUserAgent()); + + nonSubscribeManager.setHeader("V", VERSION); + nonSubscribeManager.setHeader("Accept-Encoding", "gzip"); + nonSubscribeManager.setHeader("User-Agent", getUserAgent()); + + } + + /** + * This method sets timeout value for subscribe/presence. Default value is + * 310000 milliseconds i.e. 310 seconds + * + * @param timeout + * Timeout value in milliseconds for subscribe/presence + */ + protected void setSubscribeTimeout(int timeout) { + subscribeManager.setRequestTimeout(timeout); + this.disconnectAndResubscribe(); + } + + protected int getSubscribeTimeout() { + return subscribeManager.requestTimeout; + } + + /** + * This method set timeout value for non subscribe operations like publish, + * history, hereNow. Default value is 15000 milliseconds i.e. 15 seconds. + * + * @param timeout + * Timeout value in milliseconds for Non subscribe operations + * like publish, history, hereNow + */ + protected void setNonSubscribeTimeout(int timeout) { + nonSubscribeManager.setRequestTimeout(timeout); + } + + protected int getNonSubscribeTimeout() { + return nonSubscribeManager.requestTimeout; + } + + /** + * Send a message to a channel. + * + * @param channel + * Channel name + * @param message + * JSONObject to be published + * @param callback + * object of sub class of Callback class + */ + public void publish(String channel, JSONObject message, Callback callback) { + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("message", message); + args.put("callback", callback); + publish(args); + } + + /** + * Send a message to a channel. + * + * @param channel + * Channel name + * @param message + * JSONOArray to be published + * @param callback + * object of sub class of Callback class + */ + public void publish(String channel, JSONArray message, Callback callback) { + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("message", message); + args.put("callback", callback); + publish(args); + } + + /** + * Send a message to a channel. + * + * @param channel + * Channel name + * @param message + * String to be published + * @param callback + * object of sub class of Callback class + */ + public void publish(String channel, String message, Callback callback) { + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("message", message); + args.put("callback", callback); + publish(args); + } + + /** + * Send a message to a channel. + * + * @param channel + * Channel name + * @param message + * Integer to be published + * @param callback + * object of sub class of Callback class + */ + public void publish(String channel, Integer message, Callback callback) { + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("message", message); + args.put("callback", callback); + publish(args); + } + + /** + * Send a message to a channel. + * + * @param channel + * Channel name + * @param message + * Double to be published + * @param callback + * object of sub class of Callback class + */ + public void publish(String channel, Double message, Callback callback) { + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("message", message); + args.put("callback", callback); + publish(args); + } + + /** + * Send a message to a channel. + * + * @param args + * Hashtable containing channel name, message. + * @param callback + * object of sub class of Callback class + */ + public void publish(Hashtable args, Callback callback) { + args.put("callback", callback); + publish(args); + } + + /** + * Send a message to a channel. + * + * @param args + * Hashtable containing channel name, message, callback + */ + + public void publish(Hashtable args) { + + final String channel = (String) args.get("channel"); + final Object message = args.get("message"); + final Callback callback = (Callback) args.get("callback"); + String msgStr = message.toString(); + + if (this.CIPHER_KEY.length() > 0) { + // Encrypt Message + PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY, this.IV); + try { + if (message instanceof String) { + msgStr = "\"" + msgStr + "\""; + } + msgStr = "\"" + pc.encrypt(msgStr) + "\""; + } catch (DataLengthException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_ENCRYPTION_ERROR, 1, msgStr)); + return; + } catch (IllegalStateException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_ENCRYPTION_ERROR, 2, msgStr)); + return; + } catch (InvalidCipherTextException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_ENCRYPTION_ERROR, 3, msgStr)); + return; + } catch (Exception e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_ENCRYPTION_ERROR, 4, msgStr + " : " + e.toString())); + return; + } + } else { + if (message instanceof String) { + msgStr = "\"" + msgStr + "\""; + } + } + + // Generate String to Sign + String signature = "0"; + + if (this.SECRET_KEY.length() > 0) { + StringBuffer string_to_sign = new StringBuffer(); + string_to_sign.append(this.PUBLISH_KEY).append('/') + .append(this.SUBSCRIBE_KEY).append('/') + .append(this.SECRET_KEY).append('/').append(channel) + .append('/').append(msgStr); + + // Sign Message + try { + signature = new String(Hex.encode(PubnubCrypto + .md5(string_to_sign.toString())), "UTF-8"); + } catch (UnsupportedEncodingException e) { + + } + } + String[] urlComponents = { getPubnubUrl(), "publish", this.PUBLISH_KEY, + this.SUBSCRIBE_KEY, PubnubUtil.urlEncode(signature), + PubnubUtil.urlEncode(channel), "0", + PubnubUtil.urlEncode(msgStr) + }; + + HttpRequest hreq = new HttpRequest(urlComponents, params, + new ResponseHandler() { + public void handleResponse(HttpRequest hreq, String response) { + JSONArray jsarr; + try { + jsarr = new JSONArray(response); + } catch (JSONException e) { + handleError(hreq, + PubnubError.getErrorObject(PubnubError.PNERROBJ_INVALID_JSON, 1, response)); + return; + } + callback.successCallback(channel, jsarr); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + return; + } + }); + + _request(hreq, nonSubscribeManager); + } + + /** + * + * Listen for presence of subscribers on a channel + * + * @param channel + * Name of the channel on which to listen for join/leave i.e. + * presence events + * @param callback + * object of sub class of Callback class + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void presence(String channel, Callback callback) + throws PubnubException { + Hashtable args = new Hashtable(2); + args.put("channel", channel + PRESENCE_SUFFIX); + args.put("callback", callback); + subscribe(args); + } + + /** + * Read presence information from a channel + * + * @param channel + * Channel name + * @param callback + * object of sub class of Callback class + */ + public void hereNow(final String channel, final Callback callback) { + + String[] urlargs = { getPubnubUrl(), "v2", "presence", "sub_key", + this.SUBSCRIBE_KEY, "channel", channel + }; + + HttpRequest hreq = new HttpRequest(urlargs, params, + new ResponseHandler() { + public void handleResponse(HttpRequest hreq, String response) { + JSONObject jsobj; + try { + jsobj = new JSONObject(response); + } catch (JSONException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_JSON_ERROR, 1, response)); + return; + } + callback.successCallback(channel, jsobj); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + return; + } + }); + + _request(hreq, nonSubscribeManager); + } + + /** + * + * Read history from a channel. + * + * @param channel + * Channel Name + * @param limit + * Upper limit on number of messages in response + * + */ + public void history(String channel, int limit, Callback callback) { + Hashtable args = new Hashtable(2); + args.put("channel", channel); + args.put("limit", String.valueOf(limit)); + args.put("callback", callback); + history(args); + } + + /** + * + * Read history from a channel. + * + * @param args + * Hashtable containing channel name, limit, Callback + */ + public void history(Hashtable args) { + + final String channel = (String) args.get("channel"); + String limit = (String) args.get("limit"); + final Callback callback = (Callback) args.get("callback"); + + String[] urlargs = { getPubnubUrl(), "history", this.SUBSCRIBE_KEY, + PubnubUtil.urlEncode(channel), "0", limit + }; + + HttpRequest hreq = new HttpRequest(urlargs, params, + new ResponseHandler() { + + public void handleResponse(HttpRequest hreq, String response) { + JSONArray respArr; + try { + respArr = new JSONArray(response); + decryptJSONArray(respArr); + callback.successCallback(channel, respArr); + } catch (JSONException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_JSON_ERROR, 2, response)); + } catch (DataLengthException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 1, response)); + } catch (IllegalStateException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 2, response)); + } catch (InvalidCipherTextException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 3, response)); + } catch (IOException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 4, response)); + } catch (Exception e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 5, response + " : " + e.toString())); + } + + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + } + + }); + _request(hreq, nonSubscribeManager); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void detailedHistory(final String channel, long start, long end, + int count, boolean reverse, final Callback callback) { + Hashtable parameters = PubnubUtil.hashtableClone(params); + if (count == -1) + count = 100; + + parameters.put("count", String.valueOf(count)); + parameters.put("reverse", String.valueOf(reverse)); + + if (start != -1) + parameters.put("start", Long.toString(start).toLowerCase()); + + if (end != -1) + parameters.put("end", Long.toString(end).toLowerCase()); + + String[] urlargs = { getPubnubUrl(), "v2", "history", "sub-key", + this.SUBSCRIBE_KEY, "channel", PubnubUtil.urlEncode(channel) + }; + + HttpRequest hreq = new HttpRequest(urlargs, parameters, + new ResponseHandler() { + + public void handleResponse(HttpRequest hreq, String response) { + JSONArray respArr; + try { + respArr = new JSONArray(response); + decryptJSONArray((JSONArray) respArr.get(0)); + callback.successCallback(channel, respArr); + } catch (JSONException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_JSON_ERROR, 3)); + } catch (DataLengthException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 6, response)); + } catch (IllegalStateException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 7, response)); + } catch (InvalidCipherTextException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 8, response)); + } catch (IOException e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 9, response)); + } catch (Exception e) { + callback.errorCallback(channel, + PubnubError.getErrorObject(PubnubError.PNERROBJ_DECRYPTION_ERROR, 10, response + " : " + e.toString())); + } + + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(channel, error); + return; + } + + }); + _request(hreq, nonSubscribeManager); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void detailedHistory(String channel, long start, boolean reverse, + Callback callback) { + detailedHistory(channel, start, -1, -1, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param callback + * Callback + */ + public void detailedHistory(String channel, long start, long end, + Callback callback) { + detailedHistory(channel, start, end, -1, false, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param start + * Start time + * @param end + * End time + * @param reverse + * True if messages need to be in reverse order + * + * @param callback + * Callback + */ + public void detailedHistory(String channel, long start, long end, + boolean reverse, Callback callback) { + detailedHistory(channel, start, end, -1, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Upper limit on number of messages to be returned + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void detailedHistory(String channel, int count, boolean reverse, + Callback callback) { + detailedHistory(channel, -1, -1, count, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param reverse + * True if messages need to be in reverse order + * @param callback + * Callback + */ + public void detailedHistory(String channel, boolean reverse, + Callback callback) { + detailedHistory(channel, -1, -1, -1, reverse, callback); + } + + /** + * + * Read DetailedHistory for a channel. + * + * @param channel + * Channel name for which detailed history is required + * @param count + * Maximum number of messages + * @param callback + * Callback object + */ + public void detailedHistory(String channel, int count, Callback callback) { + detailedHistory(channel, -1, -1, count, false, callback); + } + + /** + * Read current time from PubNub Cloud. + * + * @param callback + * Callback object + */ + public void time(final Callback callback) { + + String[] url = { getPubnubUrl(), "time", "0" }; + HttpRequest hreq = new HttpRequest(url, params, new ResponseHandler() { + + public void handleResponse(HttpRequest hreq, String response) { + callback.successCallback(null, response); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + callback.errorCallback(null, error); + } + + }); + + _request(hreq, nonSubscribeManager); + } + + private boolean inputsValid(Hashtable args) throws PubnubException { + boolean channelMissing; + if (((Callback) args.get("callback")) == null) { + throw new PubnubException("Invalid Callback"); + } + Object _channels = args.get("channels"); + Object _channel = args.get("channel"); + + channelMissing = ((_channel == null || _channel.equals("")) && (_channels == null || _channels + .equals(""))) ? true : false; + + if (channelMissing) { + throw new PubnubException("Channel Missing"); + } + return true; + } + + private void leave(final String channel) { + + String[] urlargs = { getPubnubUrl(), "v2/presence/sub_key", + this.SUBSCRIBE_KEY, "channel", PubnubUtil.urlEncode(channel), + "leave" + }; + Hashtable params = new Hashtable(); + params.put("uuid", UUID); + + HttpRequest hreq = new HttpRequest(urlargs, params, + new ResponseHandler() { + + public void handleResponse(HttpRequest hreq, String response) { + + } + + public void handleError(HttpRequest hreq, PubnubError error) { + + } + + }); + _request(hreq, nonSubscribeManager); + } + + /** + * Unsubscribe from channels. + * + * @param channels + * String array containing channel names + */ + public void unsubscribe(String[] channels) { + for (int i = 0; i < channels.length; i++) { + subscriptions.removeChannel(channels[i]); + leave(channels[i]); + } + resubscribe(); + } + + /** + * Unsubscribe from all channel. + * + */ + public void unsubscribeAll() { + subscriptions.removeAllChannels(); + disconnectAndResubscribe(); + } + + /** + * Unsubscribe from presence channel. + * + * @param channel + * channel name as String. + */ + public void unsubscribePresence(String channel) { + unsubscribe(new String[] { channel + PRESENCE_SUFFIX }); + } + + /** + * Unsubscribe/Disconnect from channel. + * + * @param channel + * channel name as String. + */ + public void unsubscribe(String channel) { + unsubscribe(new String[] { channel }); + } + + /** + * Unsubscribe/Disconnect from channel. + * + * @param args + * Hashtable containing channel name. + */ + public void unsubscribe(Hashtable args) { + String[] channelList = (String[]) args.get("channels"); + if (channelList == null) { + channelList = new String[] { (String) args.get("channel") }; + } + unsubscribe(channelList); + } + + /** + * + * Listen for a message on a channel. + * + * @param args + * Hashtable containing channel name + * @param callback + * Callback + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(Hashtable args, Callback callback) + throws PubnubException { + args.put("callback", callback); + subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param args + * Hashtable containing channel name, callback + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(Hashtable args) throws PubnubException { + + if (!inputsValid(args)) { + return; + } + _subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param channelsArr + * Array of channel names (string) to listen on + * @param callback + * Callback + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(String[] channelsArr, Callback callback) + throws PubnubException { + subscribe(channelsArr, callback, "0"); + } + + /** + * + * Listen for a message on a channel. + * + * @param channelsArr + * Array of channel names (string) to listen on + * @param callback + * Callback + * @param timetoken + * Timetoken to use for subscribing + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(String[] channelsArr, Callback callback, + String timetoken) throws PubnubException { + + Hashtable args = new Hashtable(); + + args.put("channels", channelsArr); + args.put("callback", callback); + args.put("timetoken", timetoken); + subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param channelsArr + * Array of channel names (string) to listen on + * @param callback + * Callback + * @param timetoken + * Timetoken to use for subscribing + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(String[] channelsArr, Callback callback, + long timetoken) throws PubnubException { + + Hashtable args = new Hashtable(); + + args.put("channels", channelsArr); + args.put("callback", callback); + args.put("timetoken", String.valueOf(timetoken)); + subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param channel + * Name of the channel + * @param callback + * Callback + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(String channel, Callback callback) + throws PubnubException { + subscribe(channel, callback, "0"); + } + + /** + * + * Listen for a message on a channel. + * + * @param channel + * Name of the channel + * @param callback + * Callback + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(String channel, Callback callback, + String timetoken) throws PubnubException { + + Hashtable args = new Hashtable(); + + args.put("channel", channel); + args.put("callback", callback); + args.put("timetoken", timetoken); + subscribe(args); + } + + /** + * + * Listen for a message on a channel. + * + * @param channel + * Name of the channel + * @param callback + * Callback + * @param timetoken + * Timetoken to use for subscribing + * @exception PubnubException + * Throws PubnubException if Callback is null + */ + public void subscribe(String channel, Callback callback, + long timetoken) throws PubnubException { + + Hashtable args = new Hashtable(); + + args.put("channel", channel); + args.put("callback", callback); + args.put("timetoken", String.valueOf(timetoken)); + subscribe(args); + } + + private void callErrorCallbacks(String[] channelList, PubnubError error) { + for (int i = 0; i < channelList.length; i++) { + Callback cb = ((Channel) subscriptions.getChannel(channelList[i])).callback; + cb.errorCallback(channelList[i], error); + } + } + + private void decryptJSONArray(JSONArray messages) throws JSONException, DataLengthException, IllegalStateException, InvalidCipherTextException, IOException { + + if (CIPHER_KEY.length() > 0) { + for (int i = 0; i < messages.length(); i++) { + PubnubCrypto pc = new PubnubCrypto(CIPHER_KEY, IV); + + String message; + message = pc.decrypt(messages.get(i).toString()); + messages.put(i, PubnubUtil.stringToJSON(message)); + } + } + } + + /** + * @param args + * Hashtable + */ + private void _subscribe(Hashtable args) { + + String[] channelList = (String[]) args.get("channels"); + if (channelList == null) { + channelList = new String[] { (String) args.get("channel") }; + } + Callback callback = (Callback) args.get("callback"); + String timetoken = (String) args.get("timetoken"); + + if (!_timetoken.equals("0")) + _saved_timetoken = _timetoken; + _timetoken = (timetoken == null) ? "0" : timetoken; + + /* + * Scan through the channels array. If a channel does not exist in + * hashtable create a new entry with default values. If already exists + * and connected, then return + */ + + for (int i = 0; i < channelList.length; i++) { + String channel = channelList[i]; + Channel channelObj = (Channel) subscriptions.getChannel(channel); + + if (channelObj == null) { + Channel ch = new Channel(); + ch.name = channel; + ch.connected = false; + ch.callback = callback; + subscriptions.addChannel(ch); + } else if (channelObj.connected) { + + return; + } + } + _subscribe_base(true); + } + + private void _subscribe_base(boolean fresh) { + _subscribe_base(fresh, false, null); + } + private void _subscribe_base(boolean fresh, boolean dar) { + _subscribe_base(fresh, dar, null); + } + + private void _subscribe_base(Worker worker) { + _subscribe_base(false, false, worker); + } + + private void _subscribe_base(boolean fresh, Worker worker) { + _subscribe_base(fresh, false, worker); + } + + private boolean isWorkerDead(HttpRequest hreq) { + return (hreq == null || hreq.getWorker() == null)?false:hreq.getWorker()._die; + } + private void _subscribe_base(boolean fresh, boolean dar, Worker worker) { + String channelString = subscriptions.getChannelString(); + String[] channelsArray = subscriptions.getChannelNames(); + if (channelsArray.length <= 0) + return; + + if (channelString == null) { + callErrorCallbacks(channelsArray, + PubnubError.PNERROBJ_PARSING_ERROR); + return; + } + String[] urlComponents = { getPubnubUrl(), "subscribe", + PubnubCore.this.SUBSCRIBE_KEY, + PubnubUtil.urlEncode(channelString), "0", _timetoken + }; + + Hashtable params = PubnubUtil.hashtableClone(this.params); + params.put("uuid", UUID); + log.verbose("Subscribing with timetoken : " + _timetoken); + + HttpRequest hreq = new HttpRequest(urlComponents, params, + new ResponseHandler() { + + public void handleResponse(HttpRequest hreq, String response) { + + /* + * Check if response has channel names. A JSON response + * with more than 2 items means the response contains + * the channel names as well. The channel names are in a + * comma delimted string. Call success callback on all + * he channels passing the corresponding response + * message. + */ + + JSONArray jsa; + try { + jsa = new JSONArray(response); + + _timetoken = (!_saved_timetoken.equals("0") && isResumeOnReconnect()) ? _saved_timetoken + : jsa.get(1).toString(); + log.verbose("Resume On Reconnect is " + + isResumeOnReconnect()); + log.verbose("Saved Timetoken : " + _saved_timetoken); + log.verbose("In Response Timetoken : " + + jsa.get(1).toString()); + log.verbose("Timetoken value set to " + _timetoken); + _saved_timetoken = "0"; + log.verbose("Saved Timetoken reset to 0"); + if (!hreq.isDar()) { + subscriptions + .invokeConnectCallbackOnChannels(_timetoken); + } else { + subscriptions + .invokeReconnectCallbackOnChannels(_timetoken); + } + JSONArray messages = new JSONArray(jsa.get(0) + .toString()); + + if (jsa.length() > 2) { + /* + * Response has multiple channels + */ + + String[] _channels = PubnubUtil.splitString( + jsa.getString(2), ","); + + for (int i = 0; i < _channels.length; i++) { + Channel _channel = (Channel) subscriptions + .getChannel(_channels[i]); + if (_channel != null) { + JSONObject jsobj = null; + if (CIPHER_KEY.length() > 0 + && !_channel.name + .endsWith(PRESENCE_SUFFIX)) { + PubnubCrypto pc = new PubnubCrypto( + CIPHER_KEY, IV); + try { + String message = pc + .decrypt(messages + .get(i) + .toString()); + if (!isWorkerDead(hreq)) _channel.callback + .successCallback( + _channel.name, + PubnubUtil.parseJSON(PubnubUtil.stringToJSON(message))); + } catch (DataLengthException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 11, + messages.get(i).toString())); + } catch (IllegalStateException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 12, + messages.get(i).toString())); + } catch (InvalidCipherTextException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 13, + messages.get(i).toString())); + } catch (IOException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 14, + messages.get(i).toString())); + } catch (Exception e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 15, + messages.get(i).toString() + " : " + e.toString())); + } + + + } else { + if (!isWorkerDead(hreq)) _channel.callback.successCallback( + _channel.name, + PubnubUtil.parseJSON(messages.get(i))); + } + } + } + + } else { + /* + * Response for single channel Callback on + * single channel + */ + Channel _channel = subscriptions + .getFirstChannel(); + + if (_channel != null) { + for (int i = 0; i < messages.length(); i++) { + if (CIPHER_KEY.length() > 0 + && !_channel.name + .endsWith(PRESENCE_SUFFIX)) { + PubnubCrypto pc = new PubnubCrypto( + CIPHER_KEY, IV); + try { + String message = pc + .decrypt(messages + .get(i) + .toString()); + if (!isWorkerDead(hreq)) _channel.callback + .successCallback( + _channel.name, + PubnubUtil.parseJSON(PubnubUtil.stringToJSON(message))); + } catch (DataLengthException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 16, + messages.get(i).toString())); + } catch (IllegalStateException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 17, + messages.get(i).toString())); + } catch (InvalidCipherTextException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 18, + messages.get(i).toString())); + } catch (IOException e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 19, + messages.get(i).toString())); + } catch (Exception e) { + if (!isWorkerDead(hreq)) _channel.callback + .errorCallback( + _channel.name, + PubnubError.getErrorObject( + PubnubError.PNERROBJ_DECRYPTION_ERROR, 20, + messages.get(i).toString() + " : " + e.toString())); + } + } else { + if (!isWorkerDead(hreq)) _channel.callback.successCallback( + _channel.name, + PubnubUtil.parseJSON(messages.get(i))); + } + + } + } + + } + if (hreq.isSubzero()) { + log.verbose("Response of subscribe 0 request. Need to do dAr process again"); + _subscribe_base(false, hreq.isDar(), hreq.getWorker()); + } else + _subscribe_base(false); + } catch (JSONException e) { + if (hreq.isSubzero()) { + log.verbose("Response of subscribe 0 request. Need to do dAr process again"); + _subscribe_base(false, hreq.isDar(), hreq.getWorker()); + } else + _subscribe_base(false, hreq.getWorker()); + } + + } + + public void handleBackFromDar(HttpRequest hreq) { + _subscribe_base(false, hreq.getWorker()); + } + + public void handleError(HttpRequest hreq, PubnubError error) { + disconnectAndResubscribe(error); + } + + public void handleTimeout(HttpRequest hreq) { + log.verbose("Timeout Occurred, Calling disconnect callbacks on the channels"); + String timeoutTimetoken = (isResumeOnReconnect()) ? (_timetoken + .equals("0")) ? _saved_timetoken : _timetoken + : "0"; + log.verbose("Timeout Timetoken : " + timeoutTimetoken); + subscriptions + .invokeDisconnectCallbackOnChannels(timeoutTimetoken); + // disconnectAndResubscribe(); + + // subscriptions.removeAllChannels(); + } + + public String getTimetoken() { + return _timetoken; + } + }); + if (_timetoken.equals("0")) { + hreq.setSubzero(true); + log.verbose("This is a subscribe 0 request"); + } + hreq.setDar(dar); + if ( worker != null && worker instanceof Worker ) + hreq.setWorker(worker); + _request(hreq, subscribeManager, fresh); + } + + /** + * @param hreq + * @param connManager + * @param abortExisting + */ + private void _request(final HttpRequest hreq, RequestManager connManager, + boolean abortExisting) { + if (abortExisting) { + connManager.resetHttpManager(); + } + connManager.queue(hreq); + } + + /** + * @param hreq + * @param simpleConnManager + */ + protected void _request(final HttpRequest hreq, + RequestManager simpleConnManager) { + _request(hreq, simpleConnManager, false); + } + + private int getRandom() { + return Math.abs(this.generator.nextInt()); + } + + private void changeOrigin() { + this.ORIGIN_STR = null; + this.HOSTNAME_SUFFIX = getRandom(); + } + + private void resubscribe() { + changeOrigin(); + if (!_timetoken.equals("0")) + _saved_timetoken = _timetoken; + _timetoken = "0"; + log.verbose("Before Resubscribe Timetoken : " + _timetoken); + log.verbose("Before Resubscribe Saved Timetoken : " + _saved_timetoken); + _subscribe_base(true, true); + } + + private void resubscribe(String timetoken) { + changeOrigin(); + if (!timetoken.equals("0")) + _saved_timetoken = timetoken; + _timetoken = "0"; + log.verbose("Before Resubscribe Timetoken : " + _timetoken); + log.verbose("Before Resubscribe Saved Timetoken : " + _saved_timetoken); + _subscribe_base(true, true); + } + + /** + * Disconnect from all channels, and resubscribe + * + */ + public void disconnectAndResubscribeWithTimetoken(String timetoken) { + disconnectAndResubscribeWithTimetoken(timetoken, + PubnubError.PNERROBJ_DISCONN_AND_RESUB); + } + + /** + * Disconnect from all channels, and resubscribe + * + */ + public void disconnectAndResubscribeWithTimetoken(String timetoken, + PubnubError error) { + log.verbose("Received disconnectAndResubscribeWithTimetoken"); + subscriptions.invokeErrorCallbackOnChannels(error); + resubscribe(timetoken); + } + + /** + * Disconnect from all channels, and resubscribe + * + */ + public void disconnectAndResubscribe() { + disconnectAndResubscribe(PubnubError.PNERROBJ_DISCONNECT); + } + + /** + * Disconnect from all channels, and resubscribe + * + */ + public void disconnectAndResubscribe(PubnubError error) { + log.verbose("Received disconnectAndResubscribe"); + subscriptions.invokeErrorCallbackOnChannels(error); + resubscribe(); + } + + /** + * This method returns array of channel names, currently subscribed to + * + * @return Array of channel names + */ + public String[] getSubscribedChannelsArray() { + return subscriptions.getChannelNames(); + } + + /** + * Sets origin value, default is "pubsub" + * + * @param origin + * Origin value + */ + public void setOrigin(String origin) { + this.HOSTNAME = origin; + } + + /** + * Returns origin + * @return origin + */ + public String getOrigin() { + return this.HOSTNAME; + } + + /** + * Sets domain value, default is "pubnub.com" + * + * @param domain + * Domain value + */ + public void setDomain(String domain) { + this.DOMAIN = domain; + } + + /** + * Returns domain + * @return domain + */ + public String getDomain() { + return this.DOMAIN; + } + + /** + * This method returns auth key. Return null if not set + * + * @return Auth Key. null if auth key not set + */ + public String getAuthKey() { + return this.AUTH_STR; + } + + /** + * This method sets auth key. + * + * @param authKey + * . 0 length string or null unsets auth key + */ + public void setAuthKey(String authKey) { + + this.AUTH_STR = authKey; + if (authKey == null || authKey.length() == 0) { + params.remove("auth"); + } else { + params.put("auth", this.AUTH_STR); + } + resubscribe(); + } + + /** + * This method unsets auth key. + * + */ + public void unsetAuthKey() { + this.AUTH_STR = null; + params.remove("auth"); + resubscribe(); + } +} diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubCryptoCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubCryptoCore.java new file mode 100644 index 000000000..05ab54190 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/PubnubCryptoCore.java @@ -0,0 +1,180 @@ +package com.pubnub.api; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; + +import org.bouncycastle.crypto.DataLengthException; +import org.bouncycastle.crypto.Digest; +import org.bouncycastle.crypto.InvalidCipherTextException; +import org.bouncycastle.crypto.digests.MD5Digest; +import org.bouncycastle.crypto.digests.SHA256Digest; +import org.bouncycastle.crypto.engines.AESEngine; +import org.bouncycastle.crypto.modes.CBCBlockCipher; +import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; +import org.bouncycastle.crypto.params.KeyParameter; +import org.bouncycastle.crypto.params.ParametersWithIV; +import org.bouncycastle.util.encoders.Hex; + +/** + * PubNub 3.1 Cryptography + * + */ +abstract class PubnubCryptoCore { + + PaddedBufferedBlockCipher encryptCipher = null; + PaddedBufferedBlockCipher decryptCipher = null; + byte[] buf = new byte[16]; // input buffer + byte[] obuf = new byte[512]; // output buffer + byte[] key = null; + String IV = "0123456789012345"; + public static int blockSize = 16; + String CIPHER_KEY; + + public PubnubCryptoCore(String CIPHER_KEY) { + this.CIPHER_KEY = CIPHER_KEY; + } + public PubnubCryptoCore(String CIPHER_KEY, String initialization_vector) { + if (initialization_vector != null) this.IV = initialization_vector; + this.CIPHER_KEY = CIPHER_KEY; + } + + public void InitCiphers() throws UnsupportedEncodingException { + + key = new String(Hex.encode(sha256(this.CIPHER_KEY.getBytes("UTF-8"))), + "UTF-8").substring(0, 32).toLowerCase().getBytes("UTF-8"); + + encryptCipher = new PaddedBufferedBlockCipher(new CBCBlockCipher( + new AESEngine())); + + decryptCipher = new PaddedBufferedBlockCipher(new CBCBlockCipher( + new AESEngine())); + + // create the IV parameter + ParametersWithIV parameterIV = new ParametersWithIV(new KeyParameter( + key), IV.getBytes("UTF-8")); + + encryptCipher.init(true, parameterIV); + decryptCipher.init(false, parameterIV); + } + + public void ResetCiphers() { + if (encryptCipher != null) { + encryptCipher.reset(); + } + if (decryptCipher != null) { + decryptCipher.reset(); + } + } + + public String encrypt(String input) throws DataLengthException, + IllegalStateException, InvalidCipherTextException { + try { + InputStream st = new ByteArrayInputStream(input.getBytes("UTF-8")); + ByteArrayOutputStream ou = new ByteArrayOutputStream(); + CBCEncryptOrDecrypt(st, ou, true); + String s = new String(Base64Encoder.encode(ou.toByteArray())); + return s; + } catch (IOException ex) { + ex.printStackTrace(); + } + return "NULL"; + } + + /** + * Decrypt + * + * @param String + * cipherText + * @return String + * @throws Exception + */ + public String decrypt(String cipher_text) throws DataLengthException, + IllegalStateException, InvalidCipherTextException, IOException, IllegalArgumentException { + + byte[] cipher = Base64Encoder.decode(cipher_text); + InputStream st = new ByteArrayInputStream(cipher); + ByteArrayOutputStream ou = new ByteArrayOutputStream(); + CBCEncryptOrDecrypt(st, ou, false); + + return new String(ou.toByteArray()); + + } + + public void CBCEncryptOrDecrypt(InputStream in, OutputStream out, + boolean encrypt) throws DataLengthException, IllegalStateException, + InvalidCipherTextException, IOException { + if (encryptCipher == null || decryptCipher == null) { + InitCiphers(); + } + PaddedBufferedBlockCipher cipher = (encrypt) ? encryptCipher + : decryptCipher; + int noBytesRead = 0; // number of bytes read from input + int noBytesProcessed = 0; // number of bytes processed + + while ((noBytesRead = in.read(buf)) >= 0) { + noBytesProcessed = cipher + .processBytes(buf, 0, noBytesRead, obuf, 0); + out.write(obuf, 0, noBytesProcessed); + } + + noBytesProcessed = cipher.doFinal(obuf, 0); + out.write(obuf, 0, noBytesProcessed); + out.flush(); + in.close(); + out.close(); + } + + public static byte[] hexStringToByteArray(String s) { + int len = s.length(); + byte[] data = new byte[len / 2]; + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character + .digit(s.charAt(i + 1), 16)); + } + return data; + } + + /** + * Get MD5 + * + * @param string + * @return + */ + public static byte[] md5(String myString) { + MD5Digest digest = new MD5Digest(); + byte[] bytes = myString.getBytes(); + digest.update(bytes, 0, bytes.length); + byte[] md5 = new byte[digest.getDigestSize()]; + digest.doFinal(md5, 0); + StringBuffer hex = new StringBuffer(md5.length * 2); + for (int i = 0; i < md5.length; i++) { + byte b = md5[i]; + if ((b & 0xFF) < 0x10) { + hex.append("0"); + } + hex.append(Integer.toHexString(b & 0xFF)); + } + return hexStringToByteArray(hex.toString()); + } + + /** + * Get SHA256 + * + * @param string + * @return + */ + public static byte[] sha256(byte[] input) { + + Digest digest = new SHA256Digest(); + byte[] resBuf = new byte[digest.getDigestSize()]; + byte[] bytes = input; + digest.update(bytes, 0, bytes.length); + digest.doFinal(resBuf, 0); + return resBuf; + } + +} diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubError.java b/java/srcPubnubApi/com/pubnub/api/PubnubError.java new file mode 100644 index 000000000..ddaca2b26 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/PubnubError.java @@ -0,0 +1,424 @@ +package com.pubnub.api; + +/** + * PubnubError object is passed to errorCallback. It contains details of error, like + * error code, error string, and optional message + * + * @author Pubnub + * + */ +public class PubnubError { + + + // Error Codes + + /** + * Timeout Error . + */ + public static final int PNERR_TIMEOUT = 100; + + + /** + * + */ + public static final int PNERR_PUBNUB_ERROR = 101; + + /** + * Connect Exception . + * Network Unreachable. + */ + public static final int PNERR_CONNECT_EXCEPTION = 102; + + + /** + * Please check network connectivity. + * Please contact support with error details if issue persists. + */ + public static final int PNERR_HTTP_ERROR = 103; + + + + /** + * Client Timeout . + */ + public static final int PNERR_CLIENT_TIMEOUT = 104; + + + /** + * An ULS singature error occurred . + * Please contact support with error details. + */ + static final int PNERR_ULSSIGN_ERROR = 105; + + /** + * Please verify if network is reachable + */ + public static final int PNERR_NETWORK_ERROR = 106; + + /** + * Pubnub Exception . + */ + public static final int PNERR_PUBNUB_EXCEPTION = 108; + + + /** + * Disconnect . + */ + public static final int PNERR_DISCONNECT = 109; + + + /** + * Disconnect and Resubscribe Received . + */ + public static final int PNERR_DISCONN_AND_RESUB = 110; + + + /** + * Gateway Timeout + */ + public static final int PNERR_GATEWAY_TIMEOUT = 111; + + /** + * Pubnub server returned HTTP 403 forbidden status code. + * Happens when wrong authentication key is used . + */ + public static final int PNERR_FORBIDDEN = 112; + /** + * Pubnub server returned HTTP 401 unauthorized status code + * Happens when authentication key is missing . + */ + public static final int PNERR_UNAUTHORIZED = 113; + + /** + * Secret key not configured + */ + public static final int PNERR_SECRET_KEY_MISSING = 114; + + + // internal error codes + + /** + * Error while encrypting message to be published to Pubnub Cloud . + * Please contact support with error details. + */ + public static final int PNERR_ENCRYPTION_ERROR = 115; + + /** + * Decryption Error . + * Please contact support with error details. + */ + public static final int PNERR_DECRYPTION_ERROR = 116; + + /** + * Invalid Json . + * Please contact support with error details. + */ + public static final int PNERR_INVALID_JSON = 117; + + /** + * Unable to open input stream . + * Please contact support with error details. + */ + static final int PNERR_GETINPUTSTREAM = 118; + + /** + * Malformed URL . + * Please contact support with error details . + */ + static final int PNERR_MALFORMED_URL = 119; + + /** + * Error in opening URL . + * Please contact support with error details. + */ + public static final int PNERR_URL_OPEN = 120; + + /** + * JSON Error while processing API response. + * Please contact support with error details. + */ + static final int PNERR_JSON_ERROR = 121; + + /** + * Protocol Exception . + * Please contact support with error details. + */ + static final int PNERR_PROTOCOL_EXCEPTION = 122; + + /** + * Unable to read input stream . + * Please contact support with error details. + */ + static final int PNERR_READINPUT = 123; + + /** + * Bad gateway . + * Please contact support with error details. + */ + static final int PNERR_BAD_GATEWAY = 124; + + /** + * Pubnub server returned HTTP 502 internal server error status code. + * Please contact support with error details. + */ + static final int PNERR_INTERNAL_ERROR = 125; + + /** + * Parsing Error . + */ + static final int PNERR_PARSING_ERROR = 126; + + /** + * Bad Request . + * Please contact support with error details. + */ + static final int PNERR_BAD_REQUEST = 127; + + + public static final int PNERR_HTTP_RC_ERROR = 128; + + + + // Error Objects + + static final PubnubError PNERROBJ_TIMEOUT = + new PubnubError ( + PNERR_TIMEOUT, "Timeout Occurred" + ); + + static final PubnubError PNERROBJ_INTERNAL_ERROR = + new PubnubError ( + PNERR_INTERNAL_ERROR , "Internal Error" + ); + + static final PubnubError PNERROBJ_ENCRYPTION_ERROR = + new PubnubError ( + PNERR_ENCRYPTION_ERROR , + "Error while encrypting message to be published to Pubnub Cloud ." + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_DECRYPTION_ERROR = + new PubnubError ( + PNERR_DECRYPTION_ERROR , + "Decryption Error. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_INVALID_JSON = + new PubnubError ( + PNERR_INVALID_JSON , + "Invalid Json. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_JSON_ERROR = + new PubnubError ( + PNERR_JSON_ERROR , + "JSON Error while processing API response. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_MALFORMED_URL = + new PubnubError ( + PNERR_MALFORMED_URL , + "Malformed URL ." + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_PUBNUB_ERROR = + new PubnubError ( + PNERR_PUBNUB_ERROR , + "Pubnub Error" + ); + + static final PubnubError PNERROBJ_URL_OPEN = + new PubnubError ( + PNERR_URL_OPEN , + "Error opening url. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_PROTOCOL_EXCEPTION = + new PubnubError ( + PNERR_PROTOCOL_EXCEPTION , + "Protocol Exception. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_CONNECT_EXCEPTION = + new PubnubError ( + PNERR_CONNECT_EXCEPTION , + "Connect Exception. " + + "Please verify if network is reachable. " + ); + + static final PubnubError PNERROBJ_HTTP_RC_ERROR = + new PubnubError ( + PNERR_HTTP_RC_ERROR , + "Unable to get Response Code. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_GETINPUTSTREAM = + new PubnubError ( + PNERR_GETINPUTSTREAM , + "Unable to get Input Stream. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_READINPUT = + new PubnubError ( + PNERR_READINPUT , + "Unable to read Input Stream. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_BAD_REQUEST = + new PubnubError ( + PNERR_BAD_REQUEST , + "Bad request. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_HTTP_ERROR = + new PubnubError ( + PNERR_HTTP_ERROR , + "HTTP Error. " + + "Please check network connectivity. " + + "Please contact support with error details if issue persists." + ); + + static final PubnubError PNERROBJ_BAD_GATEWAY = + new PubnubError ( + PNERR_BAD_GATEWAY , + "Bad Gateway. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_CLIENT_TIMEOUT = + new PubnubError ( + PNERR_CLIENT_TIMEOUT , + "Client Timeout" + ); + + static final PubnubError PNERROBJ_GATEWAY_TIMEOUT = + new PubnubError ( + PNERR_GATEWAY_TIMEOUT , + "Gateway Timeout" + ); + + static final PubnubError PNERROBJ_5023_INTERNAL_ERROR = + new PubnubError ( + PNERR_INTERNAL_ERROR , + "Internal Server Error. " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_PARSING_ERROR = + new PubnubError ( + PNERR_PARSING_ERROR , + "Parsing Error" + ); + + static final PubnubError PNERROBJ_PUBNUB_EXCEPTION = + new PubnubError ( + PNERR_PUBNUB_EXCEPTION , + "Pubnub Exception" + ); + + static final PubnubError PNERROBJ_DISCONNECT = + new PubnubError ( + PNERR_DISCONNECT , + "Disconnect" + ); + + static final PubnubError PNERROBJ_DISCONN_AND_RESUB = + new PubnubError ( + PNERR_DISCONN_AND_RESUB , + "Disconnect and Resubscribe" + ); + + static final PubnubError PNERROBJ_FORBIDDEN = + new PubnubError ( + PNERR_FORBIDDEN , + "Authentication Failure. " + + "Incorrect Authentication Key" + ); + + static final PubnubError PNERROBJ_UNAUTHORIZED = + new PubnubError ( + PNERR_UNAUTHORIZED , + "Authentication Failure. " + + "Authentication Key is missing" + ); + + static final PubnubError PNERROBJ_SECRET_KEY_MISSING = + new PubnubError ( + PNERR_SECRET_KEY_MISSING , + "ULS configuration failed. Secret Key not configured. " + ); + + static final PubnubError PNERROBJ_ULSSIGN_ERROR = + new PubnubError ( + PNERR_ULSSIGN_ERROR , + "Invalid Signature . " + + "Please contact support with error details." + ); + + static final PubnubError PNERROBJ_5075_NETWORK_ERROR = + new PubnubError ( + PNERR_NETWORK_ERROR , + "Netowork Error. " + + "Please verify if network is reachable." + ); + + + public final int errorCode; + public final int errorCodeExtended; + private final String errorString; + private String message; + + private PubnubError(int errorCode, int errorCodeExtended, String errorString) { + this.errorCodeExtended = errorCodeExtended; + this.errorCode = errorCode; + this.errorString = errorString; + } + private PubnubError(int errorCode, String errorString) { + this.errorCodeExtended = 0; + this.errorCode = errorCode; + this.errorString = errorString; + } + private PubnubError(int errorCode, int errorCodeExtended, String errorString, String message) { + this.errorCodeExtended = errorCodeExtended; + this.errorCode = errorCode; + this.errorString = errorString; + this.message = message; + } + public PubnubError(PubnubError error, String message) { + this.errorCode = error.errorCode; + this.errorCodeExtended = error.errorCodeExtended; + this.errorString = error.errorString; + this.message = message; + } + public String toString() { + String value = "[Error: " + errorCode + "-" + errorCodeExtended + "] : " + errorString; + if (message != null && message.length() > 0) { + value += " : " + message; + } + return value; + } + + static PubnubError getErrorObject(PubnubError error, String message) { + return new PubnubError(error.errorCode, error.errorCodeExtended, error.errorString, message); + } + static PubnubError getErrorObject(PubnubError error, int errorCodeExtended) { + return new PubnubError(error.errorCode, errorCodeExtended, error.errorString); + } + static PubnubError getErrorObject(PubnubError error, int errorCodeExtended, String message) { + return new PubnubError(error.errorCode, errorCodeExtended, error.errorString, message); + } + public String getErrorString() { + return errorString; + } +} diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubException.java b/java/srcPubnubApi/com/pubnub/api/PubnubException.java new file mode 100644 index 000000000..42cf22a4f --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/PubnubException.java @@ -0,0 +1,61 @@ +package com.pubnub.api; + +/** + * PubnubException is thrown by various Pubnub APIs + * + * @author PubnubCore + */ +public class PubnubException extends Exception { + private String errormsg = ""; + private PubnubError pubnubError = PubnubError.PNERROBJ_PUBNUB_ERROR; + + + /** + * Constructor for PubnubException Class with error message as argument + * + * @param s + * Error message + */ + public PubnubException(String s) { + this.errormsg = s; + } + + /** + * Constructor for PubnubException Class with error message as argument + * + * @param pubnubError + * Error message + */ + public PubnubException(PubnubError pubnubError) { + this.pubnubError = pubnubError; + } + + /** + * Constructor for PubnubException Class with error message as argument + * + * @param s + * Error message + */ + public PubnubException(PubnubError pubnubError, String s) { + this.errormsg = s; + this.pubnubError = pubnubError; + } + + + /** + * Read the exception error message + * + * @return String + */ + public String toString() { + String msg = pubnubError.toString(); + if (errormsg.length() > 0 ) + msg = msg + " . " + errormsg; + return msg; + } + + public PubnubError getPubnubError() { + return pubnubError; + } + +} diff --git a/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java b/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java new file mode 100644 index 000000000..0ba4960f0 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/PubnubUtilCore.java @@ -0,0 +1,207 @@ +package com.pubnub.api; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +/** + * + * @author PubnubCore + */ +class PubnubUtilCore { + + /** + * Takes source and delimiter string as inputs and returns splitted string + * in form of tokens in String array + * + * @param source + * , input String + * @param delimiter + * , delimiter to split on + * @return String[] , tokens in and array + */ + public static String[] splitString(String source, String delimiter) { + + int delimiterCount = 0; + int index = 0; + String tmpStr = source; + + String[] splittedList; + + while ((index = tmpStr.indexOf(delimiter)) != -1) { + + tmpStr = tmpStr.substring(index + delimiter.length()); + delimiterCount++; + } + + splittedList = new String[delimiterCount + 1]; + + int counter = 0; + tmpStr = source; + + do { + int nextIndex = tmpStr.indexOf(delimiter, index + 1); + + if (nextIndex != -1) { + splittedList[counter++] = tmpStr.substring( + index + delimiter.length(), nextIndex); + tmpStr = tmpStr.substring(nextIndex); + + } else { + splittedList[counter++] = tmpStr.substring(index + + delimiter.length()); + tmpStr = tmpStr.substring(index + 1); + } + } while ((index = tmpStr.indexOf(delimiter)) != -1); + + return splittedList; + } + + /** + * Takes String[] of tokens, and String delimiter as input and returns + * joined String + * + * @param sourceArray + * , input tokens in String array + * @param delimiter + * , delimiter to join on + * @return String , string of tokens joined by delimiter + */ + public static String joinString(String[] sourceArray, String delimiter) { + StringBuffer sb = new StringBuffer(); + + for (int i = 0; i < sourceArray.length - 1; i++) { + sb.append(sourceArray[i]).append(delimiter); + } + sb.append(sourceArray[sourceArray.length - 1]); + + return sb.toString(); + } + + /** + * Returns string keys in a hashtable as array of string + * + * @param ht + * , Hashtable + * @return , string array with hash keys string + */ + public static synchronized String[] hashtableKeysToArray(Hashtable ht) { + Vector v = new Vector(); + String[] sa = null; + int count = 0; + + Enumeration e = ht.keys(); + while (e.hasMoreElements()) { + String s = (String) e.nextElement(); + v.addElement(s); + count++; + } + + sa = new String[count]; + v.copyInto(sa); + return sa; + + } + + /** + * Returns string keys in a hashtable as delimited string + * + * @param ht + * , Hashtable + * @param delimiter + * , String + * @return , string array with hash keys string + */ + public static synchronized String hashTableKeysToDelimitedString( + Hashtable ht, String delimiter) { + + StringBuffer sb = new StringBuffer(); + boolean first = true; + Enumeration e = ht.keys(); + + while (e.hasMoreElements()) { + + String s = (String) e.nextElement(); + + if (first) { + sb.append(s); + first = false; + } else { + sb.append(delimiter).append(s); + } + } + return sb.toString(); + + } + + static Hashtable hashtableClone(Hashtable ht) { + if (ht == null) + return null; + + Hashtable htresp = new Hashtable(); + Enumeration e = ht.keys(); + + while (e.hasMoreElements()) { + Object element = e.nextElement(); + htresp.put(element, ht.get(element)); + } + return htresp; + } + + static Hashtable hashtableClone(Hashtable ht1, Hashtable ht2) { + if (ht1 == null && ht2 == null) + return null; + + Hashtable htresp = new Hashtable(); + + if (ht1 != null) { + Enumeration e = ht1.keys(); + while (e.hasMoreElements()) { + Object element = e.nextElement(); + htresp.put(element, ht1.get(element)); + } + } + if (ht2 != null) { + Enumeration e = ht2.keys(); + while (e.hasMoreElements()) { + Object element = e.nextElement(); + htresp.put(element, ht2.get(element)); + } + } + return htresp; + } + + static Hashtable hashtableMerge(Hashtable dst, Hashtable src) { + if (dst == null) + return src; + if (src == null) + return dst; + + Enumeration e = src.keys(); + + while (e.hasMoreElements()) { + Object element = e.nextElement(); + dst.put(element, src.get(element)); + } + return dst; + } + /** + * Parse Json, change json string to string + * + * @param obj + * JSON data in string format + * + * @return JSONArray or JSONObject or String + */ + static Object parseJSON(Object obj) { + if (obj instanceof String) { + if (((String) obj).endsWith("\"") && ((String) obj).startsWith("\"")) + obj = ((String) obj).substring(1, ((String) obj).length() -1); + } + return obj; + } +} \ No newline at end of file diff --git a/java/srcPubnubApi/com/pubnub/api/RequestManager.java b/java/srcPubnubApi/com/pubnub/api/RequestManager.java new file mode 100644 index 000000000..251297fd4 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/RequestManager.java @@ -0,0 +1,349 @@ +package com.pubnub.api; + +import java.util.Hashtable; +import java.util.Vector; + +abstract class Worker implements Runnable { + private Vector _requestQueue; + protected volatile boolean _die; + private Thread thread; + protected HttpClient httpclient; + + protected static Logger log = new Logger(Worker.class); + + public Thread getThread() { + return thread; + } + + void setThread(Thread thread) { + this.thread = thread; + } + + void startWorker() { + thread.start(); + } + + void interruptWorker() { + thread.interrupt(); + } + + void resetConnection() { + httpclient.reset(); + } + + Worker(Vector _requestQueue, int connectionTimeout, int requestTimeout, Hashtable headers) { + this._requestQueue = _requestQueue; + this.httpclient = HttpClient.getClient(connectionTimeout, + requestTimeout, headers); + } + + void setConnectionTimeout(int timeout) { + if (httpclient != null) { + httpclient.setConnectionTimeout(timeout); + } + } + + void setRequestTimeout(int timeout) { + if (httpclient != null) { + httpclient.setRequestTimeout(timeout); + } + } + + public abstract void shutdown(); + + void die() { + _die = true; + shutdown(); + } + + abstract void process(HttpRequest hreq); + + public void run() { + do { + HttpRequest hreq = null; + while (!_die) { + + synchronized (_requestQueue) { + + if (_requestQueue.size() != 0) { + hreq = (HttpRequest) _requestQueue.firstElement(); + _requestQueue.removeElementAt(0); + break; + } + try { + _requestQueue.wait(1000); + } catch (InterruptedException e) { + } + } + } + if (hreq != null) { + if (!_die) { + process(hreq); + } + } + } while (!_die); + } +} + +class NonSubscribeWorker extends Worker { + + NonSubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, headers); + } + + void process(HttpRequest hreq) { + HttpResponse hresp = null; + try { + log.debug(hreq.getUrl()); + hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders()); + } catch (PubnubException pe) { + log.debug("Pubnub Exception in Fetch : " + pe.getPubnubError()); + if (!_die) + hreq.getResponseHandler().handleError(hreq, pe.getPubnubError()); + return; + } catch (Exception e) { + log.debug("Exception in Fetch : " + e.toString()); + if (!_die) + hreq.getResponseHandler().handleError(hreq, PubnubError.getErrorObject(PubnubError.PNERROBJ_HTTP_ERROR, 2, e.toString())); + return; + } + + if (!_die) { + if (hresp == null) { + log.debug("Error in fetching url : " + hreq.getUrl()); + hreq.getResponseHandler().handleError(hreq, PubnubError.getErrorObject(PubnubError.PNERROBJ_HTTP_ERROR , 3)); + return; + } + hreq.getResponseHandler().handleResponse(hreq, hresp.getResponse()); + } + } + + public void shutdown() { + if (httpclient != null) httpclient.shutdown(); + } + +} + +abstract class RequestManager { + + private static int _maxWorkers = 1; + protected Vector _waiting = new Vector(); + protected Worker _workers[]; + protected String name; + protected volatile int connectionTimeout; + protected volatile int requestTimeout; + protected Hashtable headers; + private static int count = 0; + + protected static Logger log = new Logger(RequestManager.class); + + public static int getWorkerCount() { + return _maxWorkers; + } + + public abstract Worker getWorker(); + + private void initManager(int maxCalls, String name) { + if (maxCalls < 1) { + maxCalls = 1; + } + this.name = name; + this.headers = new Hashtable(); + _workers = new Worker[maxCalls]; + + synchronized (_workers) { + for (int i = 0; i < maxCalls; ++i) { + Worker w = getWorker(); + w.setThread(new Thread(w, name + "-" + ++count)); + _workers[i] = w; + log.verbose("Starting new worker " + _workers[i].getThread().getName()); + w.startWorker(); + } + } + } + + public RequestManager(String name, int connectionTimeout, int requestTimeout) { + this.connectionTimeout = connectionTimeout; + this.requestTimeout = requestTimeout; + initManager(_maxWorkers, name); + } + + private void interruptWorkers() { + synchronized (_workers) { + for (int i = 0; i < _workers.length; i++) { + _workers[i].interruptWorker(); + } + } + } + + public void resetWorkers() { + synchronized (_workers) { + for (int i = 0; i < _workers.length; i++) { + log.verbose("Sending DIE to " + _workers[i].getThread().getName()); + _workers[i].die(); + _workers[i].interruptWorker(); + Worker w = getWorker(); + w.setThread(new Thread(w, name + "-" + ++count)); + _workers[i] = w; + log.verbose("Starting new worker " + _workers[i].getThread().getName()); + w.startWorker(); + } + } + } + + public void setHeader(String key, String value) { + this.headers.put(key, value); + } + + public abstract void clearRequestQueue(); + + public void resetHttpManager() { + clearRequestQueue(); + resetWorkers(); + } + + public void abortClearAndQueue(HttpRequest hreq) { + resetHttpManager(); + queue(hreq); + } + + public void queue(HttpRequest hreq) { + log.debug("Queued : " + hreq.getUrl()); + synchronized (_waiting) { + _waiting.addElement(hreq); + _waiting.notifyAll(); + } + } + + public static void setWorkerCount(int count) { + _maxWorkers = count; + } + + public void stop() { + synchronized (_workers) { + for (int i = 0; i < _maxWorkers; ++i) { + Worker w = _workers[i]; + w.die(); + } + } + synchronized (_waiting) { + _waiting.notifyAll(); + } + } +} + +abstract class AbstractSubscribeManager extends RequestManager { + + protected volatile int maxRetries = 5; + protected volatile int retryInterval = 5000; + protected volatile int windowInterval = 0; + + public AbstractSubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public Worker getWorker() { + return new SubscribeWorker(_waiting, + connectionTimeout, requestTimeout, + maxRetries, retryInterval, windowInterval, headers); + } + + public void setMaxRetries(int maxRetries) { + this.maxRetries = maxRetries; + for (int i = 0; i < _workers.length; i++) { + ((SubscribeWorker) _workers[i]).setMaxRetries(maxRetries); + } + } + + public void setRetryInterval(int retryInterval) { + this.retryInterval = retryInterval; + for (int i = 0; i < _workers.length; i++) { + ((SubscribeWorker) _workers[i]).setRetryInterval(retryInterval); + } + } + + public void setWindowInterval(int windowInterval) { + this.windowInterval = windowInterval; + for (int i = 0; i < _workers.length; i++) { + ((SubscribeWorker) _workers[i]).setWindowInterval(windowInterval); + } + } + + public void setConnectionTimeout(int timeout) { + this.connectionTimeout = timeout; + } + + public void setRequestTimeout(int timeout) { + this.requestTimeout = timeout; + } + + public void queue(HttpRequest hreq) { + synchronized (_waiting) { + clearRequestQueue(); + super.queue(hreq); + } + } +} + +abstract class AbstractNonSubscribeManager extends RequestManager { + public AbstractNonSubscribeManager(String name, int connectionTimeout, + int requestTimeout) { + super(name, connectionTimeout, requestTimeout); + } + + public Worker getWorker() { + return new NonSubscribeWorker(_waiting, connectionTimeout, + requestTimeout, headers); + } + + public void setConnectionTimeout(int timeout) { + this.connectionTimeout = timeout; + for (int i = 0; i < _workers.length; i++) { + _workers[i].setConnectionTimeout(timeout); + } + } + + public void setRequestTimeout(int timeout) { + this.requestTimeout = timeout; + for (int i = 0; i < _workers.length; i++) { + _workers[i].setRequestTimeout(timeout); + } + } + +} + +abstract class AbstractSubscribeWorker extends Worker { + protected volatile int maxRetries = 5; + protected volatile int retryInterval = 5000; + protected volatile int windowInterval = 0; + + AbstractSubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, headers); + this.maxRetries = maxRetries; + this.retryInterval= retryInterval; + } + + AbstractSubscribeWorker(Vector _requestQueue, int connectionTimeout, + int requestTimeout, int maxRetries, int retryInterval, int windowInterval, Hashtable headers) { + super(_requestQueue, connectionTimeout, requestTimeout, headers); + this.maxRetries = maxRetries; + this.retryInterval= retryInterval; + this.windowInterval = windowInterval; + } + + public void setMaxRetries(int maxRetries) { + this.maxRetries = maxRetries; + } + + public void setRetryInterval(int retryInterval) { + this.retryInterval = retryInterval; + } + + public void setWindowInterval(int windowInterval) { + this.windowInterval = windowInterval; + } + +} diff --git a/java/srcPubnubApi/com/pubnub/api/ResponseHandler.java b/java/srcPubnubApi/com/pubnub/api/ResponseHandler.java new file mode 100644 index 000000000..ad1f82ff4 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/ResponseHandler.java @@ -0,0 +1,16 @@ +package com.pubnub.api; + +/** + * @author PubnubCore + */ + +abstract class ResponseHandler { + public abstract void handleResponse(HttpRequest hreq, String response); + + public abstract void handleError(HttpRequest hreq, PubnubError error); + + public void handleTimeout(HttpRequest hreq) { + } + public void handleBackFromDar(HttpRequest hreq) { + } +} diff --git a/java/srcPubnubApi/com/pubnub/api/Subscriptions.java b/java/srcPubnubApi/com/pubnub/api/Subscriptions.java new file mode 100644 index 000000000..baffa5e76 --- /dev/null +++ b/java/srcPubnubApi/com/pubnub/api/Subscriptions.java @@ -0,0 +1,133 @@ +package com.pubnub.api; + +import java.util.Enumeration; +import java.util.Hashtable; + +import org.json.JSONArray; + +/** + * @author PubnubCore + * + */ +class Subscriptions { + private Hashtable channels; + + public Subscriptions() { + channels = new Hashtable(); + } + + public void addChannel(Channel channel) { + channels.put(channel.name, channel); + } + + public void removeChannel(String name) { + channels.remove(name); + } + + public void removeAllChannels() { + channels.clear(); + } + + public Channel getFirstChannel() { + Channel ch = null; + synchronized (channels) { + if (channels.size() > 0) { + ch = (Channel) channels.elements().nextElement(); + } + } + return ch; + + } + + public Channel getChannel(String name) { + return (Channel) channels.get(name); + } + + public String[] getChannelNames() { + + return PubnubUtil.hashtableKeysToArray(channels); + } + + public String getChannelString() { + return PubnubUtil.hashTableKeysToDelimitedString(channels, ","); + + } + + public void invokeConnectCallbackOnChannels(Object message) { + invokeConnectCallbackOnChannels(getChannelNames(), message); + } + + public void invokeDisconnectCallbackOnChannels(Object message) { + invokeDisconnectCallbackOnChannels(getChannelNames(), message); + } + + public void invokeErrorCallbackOnChannels(PubnubError error) { + /* + * Iterate over all the channels and call error callback for channels + */ + synchronized (channels) { + Enumeration ch = channels.elements(); + while (ch.hasMoreElements()) { + Channel _channel = (Channel) ch.nextElement(); + _channel.error = true; + _channel.callback.errorCallback(_channel.name, error); + } + } + } + + public void invokeConnectCallbackOnChannels(String[] channels, Object message) { + synchronized (channels) { + for (int i = 0; i < channels.length; i++) { + Channel _channel = (Channel) this.channels.get(channels[i]); + if (_channel != null) { + if (_channel.connected == false) { + _channel.connected = true; + if (_channel.subscribed == false) { + _channel.callback.connectCallback(_channel.name, + new JSONArray().put(1).put("Subscribe connected").put(message)); + } else { + _channel.subscribed = true; + _channel.callback.reconnectCallback(_channel.name, + new JSONArray().put(1).put("Subscribe reconnected").put(message)); + } + } + } + } + } + } + + public void invokeReconnectCallbackOnChannels(Object message) { + invokeReconnectCallbackOnChannels(getChannelNames(), message); + } + + public void invokeReconnectCallbackOnChannels(String[] channels, Object message) { + synchronized (channels) { + for (int i = 0; i < channels.length; i++) { + Channel _channel = (Channel) this.channels.get(channels[i]); + if (_channel != null) { + _channel.connected = true; + if ( _channel.error ) { + _channel.callback.reconnectCallback(_channel.name, + new JSONArray().put(1).put("Subscribe reconnected").put(message)); + _channel.error = false; + } + } + } + } + } + + public void invokeDisconnectCallbackOnChannels(String[] channels, Object message) { + synchronized (channels) { + for (int i = 0; i < channels.length; i++) { + Channel _channel = (Channel) this.channels.get(channels[i]); + if (_channel != null) { + if (_channel.connected == true) { + _channel.connected = false; + _channel.callback.disconnectCallback(_channel.name, + new JSONArray().put(0).put("Subscribe unable to connect").put(message)); + } + } + } + } + } +} diff --git a/java/srcTest/com/pubnub/api/PubnubTest.java b/java/srcTest/com/pubnub/api/PubnubTest.java new file mode 100644 index 000000000..9cbff0087 --- /dev/null +++ b/java/srcTest/com/pubnub/api/PubnubTest.java @@ -0,0 +1,1763 @@ +package com.pubnub.api; + +import static org.junit.Assert.*; + +import java.util.Hashtable; +import java.util.Random; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.junit.Test; + +public class PubnubTest { + + class SubscribeCallback extends Callback { + + private CountDownLatch latch; + + private Object response; + + public SubscribeCallback(CountDownLatch latch) { + this.latch = latch; + } + + public SubscribeCallback() { + + } + + public Object getResponse() { + return response; + } + + @Override + public void successCallback(String channel, Object message) { + response = message; + if (latch != null) + latch.countDown(); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + response = error; + if (latch != null) + latch.countDown(); + } + } + + class PublishCallback extends Callback { + + private CountDownLatch latch; + private int result = 0; + + public int getResult() { + return result; + } + + public PublishCallback(CountDownLatch latch) { + this.latch = latch; + } + + public PublishCallback() { + + } + + public void successCallback(String channel, Object message) { + JSONArray jsarr; + try { + jsarr = (JSONArray) message; + result = (Integer) jsarr.get(0); + } catch (JSONException e) { + e.printStackTrace(); + } + if (latch != null) + latch.countDown(); + } + + public void errorCallback(String channel, PubnubError error) { + JSONArray jsarr; + result = 0; + if (latch != null) + latch.countDown(); + } + + } + + class UlsCallback extends Callback { + + private CountDownLatch latch; + private int result = 0; + + public int getResult() { + return result; + } + + public UlsCallback(CountDownLatch latch) { + this.latch = latch; + } + + public UlsCallback() { + + } + + public void successCallback(String channel, Object message) { + JSONObject jso; + try { + jso = (JSONObject) message; + result = (Integer) jso.get("status"); + } catch (JSONException e) { + e.printStackTrace(); + } + if (latch != null) + latch.countDown(); + } + + public void errorCallback(String channel, PubnubError error) { + JSONArray jso; + result = 0; + if (latch != null) + latch.countDown(); + } + + } + + class HereNowCallback extends Callback { + + private int occupancy; + private String[] uuids; + private CountDownLatch latch; + + public int getOccupancy() { + return occupancy; + } + + public HereNowCallback(CountDownLatch latch) { + this.latch = latch; + } + + public HereNowCallback() { + + } + + @Override + public void successCallback(String channel, Object message) { + JSONObject resp = null; + try { + resp = new JSONObject(message.toString()); + } catch (JSONException e1) { + e1.printStackTrace(); + } + if (resp != null) { + try { + occupancy = (Integer) resp.get("occupancy"); + } catch (JSONException e) { + e.printStackTrace(); + } + } + if (latch != null) + latch.countDown(); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + if (latch != null) + latch.countDown(); + } + + } + + class PresenceCallback extends Callback { + + private String uuid; + private CountDownLatch latch; + + public String getUUID() { + return uuid; + } + + public PresenceCallback(CountDownLatch latch) { + this.latch = latch; + } + + public PresenceCallback() { + + } + + @Override + public void successCallback(String channel, Object message) { + JSONObject resp = null; + try { + resp = new JSONObject(message.toString()); + } catch (JSONException e1) { + e1.printStackTrace(); + } + if (resp != null) { + try { + uuid = (String) resp.get("uuid"); + } catch (JSONException e) { + e.printStackTrace(); + } + } + if (latch != null) + latch.countDown(); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + if (latch != null) + latch.countDown(); + } + + } + + class HistoryCallback extends Callback { + + private int count; + private String[] uuids; + private CountDownLatch latch; + + public int getCount() { + return count; + } + + public HistoryCallback(CountDownLatch latch) { + this.latch = latch; + } + + public HistoryCallback() { + + } + + @Override + public void successCallback(String channel, Object message) { + JSONArray resp = null; + try { + resp = (new JSONArray(message.toString())).getJSONArray(0); + } catch (JSONException e1) { + e1.printStackTrace(); + } + if (resp != null) { + count = resp.length(); + } + if (latch != null) + latch.countDown(); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + if (latch != null) + latch.countDown(); + } + + } + + Pubnub pubnub = new Pubnub("demo", "demo"); + Pubnub pubnub_enc = new Pubnub("demo", "demo", "demo", "demo", false); + String testSuccessMessage = ""; + + @Test + public void testPublishString() { + String channel = "java-unittest-" + Math.random(); + final String sendMessage = "Test Message " + Math.random(); + + final CountDownLatch latch = new CountDownLatch(2); + + final PublishCallback pbCb = new PublishCallback(latch); + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, sendMessage, pbCb); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + try { + pubnub.subscribe(args); + } catch (PubnubException e1) { + + } + + try { + latch.await(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + + } + assertEquals(1, pbCb.getResult()); + assertEquals(sendMessage, sbCb.getResponse()); + } + + @Test + public void testPublishJSONArray() { + String channel = "java-unittest-" + Math.random(); + final JSONArray sendMessage = new JSONArray().put(1).put("Test"); + + final CountDownLatch latch = new CountDownLatch(2); + + final PublishCallback pbCb = new PublishCallback(latch); + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, sendMessage, pbCb); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + try { + pubnub.subscribe(args); + } catch (PubnubException e1) { + + } + + try { + latch.await(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + + } + assertEquals(1, pbCb.getResult()); + assertEquals(sendMessage.toString(), sbCb.getResponse().toString()); + } + + @Test + public void testPublishJSONObject() { + String channel = "java-unittest-" + Math.random(); + + try { + final JSONObject sendMessage; + + sendMessage = new JSONObject().put("1", "Test"); + + final CountDownLatch latch = new CountDownLatch(2); + + final PublishCallback pbCb = new PublishCallback(latch); + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, sendMessage, pbCb); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + pubnub.subscribe(args); + + latch.await(30, TimeUnit.SECONDS); + assertEquals(1, pbCb.getResult()); + assertEquals(sendMessage.toString(), sbCb.getResponse().toString()); + } catch (Exception e) { + + } + } + + @Test + public void testPublishStringWithEncryption() { + String channel = "java-unittest-" + Math.random(); + final String sendMessage = "Test Message " + Math.random(); + + final CountDownLatch latch = new CountDownLatch(2); + + final PublishCallback pbCb = new PublishCallback(latch); + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + pubnub_enc.publish(channel, sendMessage, pbCb); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + try { + pubnub_enc.subscribe(args); + } catch (PubnubException e1) { + + } + + try { + latch.await(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + + } + assertEquals(1, pbCb.getResult()); + assertEquals(sendMessage, sbCb.getResponse()); + } + + @Test + public void testPublishJSONArrayWithEncryption() { + String channel = "java-unittest-" + Math.random(); + final JSONArray sendMessage = new JSONArray().put(1).put("Test"); + + final CountDownLatch latch = new CountDownLatch(2); + + final PublishCallback pbCb = new PublishCallback(latch); + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + pubnub_enc.publish(channel, sendMessage, pbCb); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + try { + pubnub_enc.subscribe(args); + } catch (PubnubException e1) { + + } + + try { + latch.await(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + + } + assertEquals(1, pbCb.getResult()); + assertEquals(sendMessage.toString(), sbCb.getResponse().toString()); + } + + @Test + public void testPublishJSONObjectWithEncryption() { + String channel = "java-unittest-" + Math.random(); + + try { + final JSONObject sendMessage; + + sendMessage = new JSONObject().put("1", "Test"); + + final CountDownLatch latch = new CountDownLatch(2); + + final PublishCallback pbCb = new PublishCallback(latch); + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + pubnub_enc.publish(channel, sendMessage, pbCb); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + pubnub_enc.subscribe(args); + + latch.await(30, TimeUnit.SECONDS); + assertEquals(1, pbCb.getResult()); + assertEquals(sendMessage.toString(), sbCb.getResponse().toString()); + } catch (Exception e) { + + } + } + + @Test + public void testHereNowOneUser() { + String channel = "java-unittest-" + Math.random(); + + try { + final JSONObject sendMessage; + + sendMessage = new JSONObject().put("1", "Test"); + + final CountDownLatch latch = new CountDownLatch(2); + + final HereNowCallback hnCb = new HereNowCallback(latch); + + SubscribeCallback sbCb = new SubscribeCallback(latch) { + @Override + public void connectCallback(String channel, Object message) { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + + } + pubnub.hereNow(channel, hnCb); + pubnub.unsubscribe(channel); + if (latch != null) + latch.countDown(); + } + }; + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", sbCb); + + pubnub.subscribe(args); + + latch.await(30, TimeUnit.SECONDS); + assertEquals(1, hnCb.getOccupancy()); + } catch (Exception e) { + + } + } + + @Test + public void testHistoryCountOne() { + String channel = "java-unittest-" + Math.random(); + final String sendMessage = "Test Message " + Math.random(); + final CountDownLatch latch = new CountDownLatch(3); + final int limit = 1; + final HistoryCallback hCb = new HistoryCallback(latch); + + pubnub.publish(channel, sendMessage, new PublishCallback(latch) { + @Override + public void successCallback(String channel, Object message) { + pubnub.publish(channel, sendMessage, + new PublishCallback(latch) { + @Override + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + pubnub.detailedHistory(channel, limit, hCb); + super.successCallback(channel, message); + } + }); + super.successCallback(channel, message); + } + }); + try { + latch.await(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertEquals(limit, hCb.getCount()); + } + + @Test + public void testHistory() { + String channel = "java-unittest-" + Math.random(); + final String sendMessage = "Test Message " + Math.random(); + final CountDownLatch latch = new CountDownLatch(3); + + final HistoryCallback hCb = new HistoryCallback(latch); + + pubnub.publish(channel, sendMessage, new PublishCallback(latch) { + @Override + public void successCallback(String channel, Object message) { + pubnub.publish(channel, sendMessage, + new PublishCallback(latch) { + @Override + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + pubnub.detailedHistory(channel, 100, hCb); + super.successCallback(channel, message); + } + }); + super.successCallback(channel, message); + } + }); + try { + latch.await(30, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertEquals(2, hCb.getCount()); + } + + @Test + public void testPresence() { + String channel = "java-unittest-" + Math.random(); + CountDownLatch latch = new CountDownLatch(2); + + PresenceCallback presenceCb = new PresenceCallback(latch); + + try { + pubnub.presence(channel, presenceCb); + + Pubnub pubnub2 = new Pubnub("demo", "demo"); + + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", new SubscribeCallback(latch)); + + pubnub2.subscribe(args); + + latch.await(30, TimeUnit.SECONDS); + assertEquals(pubnub2.UUID, presenceCb.getUUID()); + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestore() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(3); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(true); + final Hashtable args = new Hashtable(); + // args.put("channels", new String[]{channel, "b"}); + args.put("channel", channel); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(60, TimeUnit.SECONDS); + assertEquals(10, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreUnsubInSuccessCallback() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(5); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(true); + final Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 20, new PublishCallback( + latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(60, TimeUnit.SECONDS); + assertEquals(20, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreMultipleChannels() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(4); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(true); + final Hashtable args = new Hashtable(); + args.put("channels", new String[] { channel, "b" }); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(5000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(60, TimeUnit.SECONDS); + assertEquals(10, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreMultipleChannelsUnsubInSuccessCallback() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(6); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(true); + final Hashtable args = new Hashtable(); + args.put("channels", new String[] { channel, "b" }); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 20, new PublishCallback( + latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(5000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(90, TimeUnit.SECONDS); + assertEquals(20, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreFalse() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(3); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(false); + final Hashtable args = new Hashtable(); + // args.put("channels", new String[]{channel, "b"}); + args.put("channel", channel); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(90, TimeUnit.SECONDS); + assertNotEquals(10, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreFalseMultipleChannels() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(3); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(false); + final Hashtable args = new Hashtable(); + args.put("channels", new String[] { channel, "b" }); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + + }); + pubnub.subscribe(args); + latch.await(90, TimeUnit.SECONDS); + assertNotEquals(10, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreFalseUnsubInSuccessCallback() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(4); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(false); + final Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 20, new PublishCallback( + latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(90, TimeUnit.SECONDS); + assertNotEquals(20, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testConnectionRestoreFalseMultipleChannelsUnsubInSuccessCallback() { + String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(4); + + final SubscribeCallback subscribeCb = new SubscribeCallback(latch); + + try { + pubnub.setResumeOnReconnect(false); + final Hashtable args = new Hashtable(); + args.put("channels", new String[] { channel, "b" }); + args.put("callback", new SubscribeCallback(latch) { + public void connectCallback(String channel, Object message) { + pubnub.publish(channel, 10, new PublishCallback(latch) { + public void successCallback(String channel, + Object message) { + pubnub.unsubscribe(channel); + pubnub.publish(channel, 20, new PublishCallback( + latch) { + public void successCallback(String channel, + Object message) { + try { + Thread.sleep(2000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", channel); + args.put("callback", subscribeCb); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + latch.countDown(); + } + }); + latch.countDown(); + } + }); + latch.countDown(); + } + }); + pubnub.subscribe(args); + latch.await(90, TimeUnit.SECONDS); + assertNotEquals(20, subscribeCb.getResponse()); + + } catch (Exception e) { + e.printStackTrace(); + assertTrue(false); + } + } + + @Test + public void testSubscribeInMultipleThreads() { + final String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(100); + final Hashtable results = new Hashtable(); + final Hashtable inputs = new Hashtable(); + final Hashtable stats = new Hashtable(); + final int count = 100; + final Random rand = new Random(); + stats.put("connects", 0); + stats.put("count", 0); + stats.put("duplicate", false); + stats.put("wrong", false); + + class SubscribeThread implements Runnable { + + class PublishThread implements Runnable { + private String ch; + private int message; + + PublishThread(String ch, int message) { + this.ch = ch; + this.message = message; + } + + public void run() { + try { + Thread.sleep(rand.nextInt(20000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("message", message); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, + Object message) { + stats.put("count", (Integer) stats.get("count") + 1); + } + + @Override + public void errorCallback(String channel, + PubnubError error) { + + } + }); + pubnub.publish(args); + } + } + + private String ch; + + SubscribeThread(String ch) { + this.ch = ch; + } + + private void startPublish() { + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + } + + public void run() { + + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("callback", new Callback() { + + @Override + public void connectCallback(String channel, Object message) { + + stats.put("connects", + (Integer) (stats.get("connects")) + 1); + if ((Integer) stats.get("connects") >= count) + startPublish(); + } + + @Override + public void successCallback(String channel, Object message) { + int c = (results.get(channel) == null) ? 0 + : (Integer) results.get(channel); + int d = (inputs.get(channel) == null) ? 0 + : (Integer) inputs.get(channel); + if (((Integer) c).equals((Integer) message)) + stats.put("duplicate", true); + if (!(((Integer) d).equals((Integer) message))) + stats.put("wrong", true); + + assertEquals((Integer) d, (Integer) message); + results.put(channel, message); + stats.put("count", (Integer) stats.get("count") - 1); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + } + }); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + } + } + + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new SubscribeThread(channel + "-" + i)).start(); + } + + try { + latch.await(90, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertFalse((Boolean) stats.get("duplicate").equals(true)); + assertFalse((Boolean) stats.get("wrong").equals(true)); + assertEquals((Integer)0,(Integer) stats.get("count")); + + } + + @Test + public void testSubscribeInMultipleThreads3() { + final String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(100); + final Hashtable results = new Hashtable(); + final Hashtable inputs = new Hashtable(); + final Hashtable stats = new Hashtable(); + final int count = 100; + final Random rand = new Random(); + stats.put("connects", 0); + stats.put("count", 0); + stats.put("duplicate", false); + stats.put("wrong", false); + + class PublishThread implements Runnable { + private String ch; + private int message; + + PublishThread(String ch, int message) { + this.ch = ch; + this.message = message; + } + + public void run() { + try { + Thread.sleep(rand.nextInt(20000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("message", message); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, Object message) { + stats.put("count", (Integer) stats.get("count") + 1); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + + } + }); + pubnub.publish(args); + } + } + class SubscribeThread implements Runnable { + private String ch; + + SubscribeThread(String ch) { + this.ch = ch; + } + + private void startPublish() { + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + } + + public void run() { + try { + Thread.sleep(rand.nextInt(5000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, Object message) { + int c = (results.get(channel) == null) ? 0 + : (Integer) results.get(channel); + int d = (inputs.get(channel) == null) ? 0 + : (Integer) inputs.get(channel); + if (((Integer) c).equals((Integer) message)) + stats.put("duplicate", true); + if (!(((Integer) d).equals((Integer) message))) + stats.put("wrong", true); + assertEquals((Integer) d, (Integer) message); + results.put(channel, message); + stats.put("count", (Integer) stats.get("count") - 1); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + } + }); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + } + } + + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new SubscribeThread(channel + "-" + i)).start(); + } + for (int i = 1; i <= count; i++) { + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + + try { + latch.await(90, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertFalse((Boolean) stats.get("duplicate").equals(true)); + assertFalse((Boolean) stats.get("wrong").equals(true)); + // assertEquals((Integer)count,(Integer)results.get("count")); + + } + + @Test + public void testSubscribeInMultipleThreads2() { + final String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(100); + final Hashtable results = new Hashtable(); + final Hashtable inputs = new Hashtable(); + final Hashtable stats = new Hashtable(); + final int count = 100; + final Random rand = new Random(); + stats.put("connects", 0); + stats.put("count", 0); + stats.put("duplicate", false); + stats.put("wrong", false); + + class PublishThread implements Runnable { + private String ch; + private int message; + + PublishThread(String ch, int message) { + this.ch = ch; + this.message = message; + } + + public void run() { + try { + Thread.sleep(rand.nextInt(20000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("message", message); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, Object message) { + stats.put("count", (Integer) stats.get("count") + 1); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + + } + }); + pubnub.publish(args); + } + } + class SubscribeThread implements Runnable { + private String ch; + + SubscribeThread(String ch) { + this.ch = ch; + } + + private void startPublish() { + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + } + + public void run() { + try { + Thread.sleep(rand.nextInt(2000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, Object message) { + int c = (results.get(channel) == null) ? 0 + : (Integer) results.get(channel); + int d = (inputs.get(channel) == null) ? 0 + : (Integer) inputs.get(channel); + if (((Integer) c).equals((Integer) message)) + stats.put("duplicate", true); + if (!(((Integer) d).equals((Integer) message))) + stats.put("wrong", true); + assertEquals((Integer) d, (Integer) message); + results.put(channel, message); + stats.put("count", (Integer) stats.get("count") - 1); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public void errorCallback(String channel, PubnubError error) { + } + }); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + } + } + + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new SubscribeThread(channel + "-" + i)).start(); + } + for (int i = 1; i <= count; i++) { + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + + try { + latch.await(90, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertFalse((Boolean) stats.get("duplicate").equals(true)); + assertFalse((Boolean) stats.get("wrong").equals(true)); + // assertEquals((Integer)count,(Integer)results.get("count")); + + } + + @Test + public void testSubscribeInMultipleThreadsWithDarRorTrue() { + final String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(100); + final Hashtable results = new Hashtable(); + final Hashtable inputs = new Hashtable(); + final Hashtable stats = new Hashtable(); + final int count = 125; + final Random rand = new Random(); + stats.put("connects", 0); + stats.put("count", 0); + stats.put("duplicate", false); + stats.put("wrong", false); + + pubnub.setResumeOnReconnect(true); + + class DarThread implements Runnable { + private volatile boolean _die; + + public void stop() { + _die = true; + } + + public void run() { + while (!_die) { + pubnub.disconnectAndResubscribe(); + try { + Thread.sleep(rand.nextInt(5000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } + + class SubscribeThread implements Runnable { + + class PublishThread implements Runnable { + private String ch; + private int message; + + PublishThread(String ch, int message) { + this.ch = ch; + this.message = message; + } + + public void run() { + try { + Thread.sleep(rand.nextInt(20000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("message", message); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, + Object message) { + stats.put("count", (Integer) stats.get("count") + 1); + } + + @Override + public void errorCallback(String channel, + PubnubError error) { + + } + }); + pubnub.publish(args); + } + } + + private String ch; + + SubscribeThread(String ch) { + this.ch = ch; + } + + private void startPublish() { + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + } + + public void run() { + + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("callback", new Callback() { + + @Override + public void connectCallback(String channel, Object message) { + + stats.put("connects", + (Integer) (stats.get("connects")) + 1); + if ((Integer) stats.get("connects") >= count) { + startPublish(); + new Thread(new DarThread()).start(); + } + } + + @Override + public void successCallback(String channel, Object message) { + int c = (results.get(channel) == null) ? 0 + : (Integer) results.get(channel); + int d = (inputs.get(channel) == null) ? 0 + : (Integer) inputs.get(channel); + if (((Integer) c).equals((Integer) message)) { + stats.put("duplicate", true); + } + if (!(((Integer) d).equals((Integer) message))) + stats.put("wrong", true); + results.put(channel, message); + stats.put("count", (Integer) stats.get("count") - 1); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + } + }); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + } + } + + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new SubscribeThread(channel + "-" + i)).start(); + } + + try { + latch.await(120, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertFalse((Boolean) stats.get("duplicate").equals(true)); + assertFalse((Boolean) stats.get("wrong").equals(true)); + assertEquals((Integer)0, (Integer) stats.get("count")); + + } + + @Test + public void testSubscribeInMultipleThreadsWithDarRorFalse() { + final String channel = "java-unittest-" + Math.random(); + final CountDownLatch latch = new CountDownLatch(100); + final Hashtable results = new Hashtable(); + final Hashtable inputs = new Hashtable(); + final Hashtable stats = new Hashtable(); + final int count = 125; + final Random rand = new Random(); + stats.put("connects", 0); + stats.put("count", 0); + stats.put("duplicate", false); + stats.put("wrong", false); + + pubnub.setResumeOnReconnect(false); + + class DarThread implements Runnable { + private volatile boolean _die; + + public void stop() { + _die = true; + } + + public void run() { + while (!_die) { + pubnub.disconnectAndResubscribe(); + try { + Thread.sleep(rand.nextInt(10000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } + + class SubscribeThread implements Runnable { + + class PublishThread implements Runnable { + private String ch; + private int message; + + PublishThread(String ch, int message) { + this.ch = ch; + this.message = message; + } + + public void run() { + try { + Thread.sleep(rand.nextInt(20000)); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("message", message); + args.put("callback", new Callback() { + + @Override + public void successCallback(String channel, + Object message) { + stats.put("count", (Integer) stats.get("count") + 1); + } + + @Override + public void errorCallback(String channel, + PubnubError error) { + + } + }); + pubnub.publish(args); + } + } + + private String ch; + + SubscribeThread(String ch) { + this.ch = ch; + } + + private void startPublish() { + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new PublishThread(channel + "-" + i, i)).start(); + } + } + + public void run() { + + Hashtable args = new Hashtable(); + args.put("channel", ch); + args.put("callback", new Callback() { + + @Override + public void connectCallback(String channel, Object message) { + + stats.put("connects", + (Integer) (stats.get("connects")) + 1); + if ((Integer) stats.get("connects") >= count) { + startPublish(); + new Thread(new DarThread()).start(); + } + } + + @Override + public void successCallback(String channel, Object message) { + int c = (results.get(channel) == null) ? 0 + : (Integer) results.get(channel); + int d = (inputs.get(channel) == null) ? 0 + : (Integer) inputs.get(channel); + if (((Integer) c).equals((Integer) message)) { + stats.put("duplicate", true); + } + if (!(((Integer) d).equals((Integer) message))) + stats.put("wrong", true); + results.put(channel, message); + stats.put("count", (Integer) stats.get("count") - 1); + } + + @Override + public void errorCallback(String channel, PubnubError error) { + } + }); + try { + pubnub.subscribe(args); + } catch (PubnubException e) { + e.printStackTrace(); + } + } + } + + for (int i = 1; i <= count; i++) { + inputs.put(channel + "-" + i, i); + new Thread(new SubscribeThread(channel + "-" + i)).start(); + } + + try { + latch.await(150, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + assertFalse((Boolean) stats.get("duplicate").equals(true)); + assertFalse((Boolean) stats.get("wrong").equals(true)); + // assertEquals((Integer)count,(Integer)results.get("count")); + } + + @Test + public void testUlsGrantRW() { + final CountDownLatch latch = new CountDownLatch(1); + UlsCallback ulscb = new UlsCallback(latch); + Pubnub pubnub = new Pubnub("pub-c-a2650a22-deb1-44f5-aa87-1517049411d5", + "sub-c-a478dd2a-c33d-11e2-883f-02ee2ddab7fe", + "sec-c-YjFmNzYzMGMtYmI3NC00NzJkLTlkYzYtY2MwMzI4YTJhNDVh"); + pubnub.setDomain("pubnub.co"); + pubnub.setOrigin("uls-test"); + pubnub.setCacheBusting(false); + pubnub.pamGrant("hello-uls", "abcd", true, true, 1400, ulscb); + + try { + latch.await(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + assertEquals(200, ulscb.getResult()); + } + @Test + public void testUlsAuditSubKey() { + final CountDownLatch latch = new CountDownLatch(1); + UlsCallback ulscb = new UlsCallback(latch); + Pubnub pubnub = new Pubnub("pub-c-a2650a22-deb1-44f5-aa87-1517049411d5", + "sub-c-a478dd2a-c33d-11e2-883f-02ee2ddab7fe", + "sec-c-YjFmNzYzMGMtYmI3NC00NzJkLTlkYzYtY2MwMzI4YTJhNDVh"); + pubnub.setDomain("pubnub.co"); + pubnub.setOrigin("uls-test"); + pubnub.setCacheBusting(false); + pubnub.pamAudit(ulscb); + + try { + latch.await(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + assertEquals(200, ulscb.getResult()); + } + @Test + public void testUlsAuditChannel() { + final CountDownLatch latch = new CountDownLatch(1); + UlsCallback ulscb = new UlsCallback(latch); + Pubnub pubnub = new Pubnub("pub-c-a2650a22-deb1-44f5-aa87-1517049411d5", + "sub-c-a478dd2a-c33d-11e2-883f-02ee2ddab7fe", + "sec-c-YjFmNzYzMGMtYmI3NC00NzJkLTlkYzYtY2MwMzI4YTJhNDVh"); + pubnub.setDomain("pubnub.co"); + pubnub.setOrigin("uls-test"); + pubnub.setCacheBusting(false); + pubnub.pamAudit("hello-uls", ulscb); + + try { + latch.await(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + assertEquals(200, ulscb.getResult()); + } + @Test + public void testUlsAuditAuth() { + final CountDownLatch latch = new CountDownLatch(1); + UlsCallback ulscb = new UlsCallback(latch); + Pubnub pubnub = new Pubnub("pub-c-a2650a22-deb1-44f5-aa87-1517049411d5", + "sub-c-a478dd2a-c33d-11e2-883f-02ee2ddab7fe", + "sec-c-YjFmNzYzMGMtYmI3NC00NzJkLTlkYzYtY2MwMzI4YTJhNDVh"); + pubnub.setDomain("pubnub.co"); + pubnub.setOrigin("uls-test"); + pubnub.setCacheBusting(false); + pubnub.pamAudit("hello-uls", "abcd", ulscb); + + try { + latch.await(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + assertEquals(200, ulscb.getResult()); + } + @Test + public void testUlsRevoke() { + final CountDownLatch latch = new CountDownLatch(1); + UlsCallback ulscb = new UlsCallback(latch); + Pubnub pubnub = new Pubnub("pub-c-a2650a22-deb1-44f5-aa87-1517049411d5", + "sub-c-a478dd2a-c33d-11e2-883f-02ee2ddab7fe", + "sec-c-YjFmNzYzMGMtYmI3NC00NzJkLTlkYzYtY2MwMzI4YTJhNDVh"); + pubnub.setDomain("pubnub.co"); + pubnub.setOrigin("uls-test"); + pubnub.setCacheBusting(false); + pubnub.pamRevoke("hello-uls", "abcd", ulscb); + + try { + latch.await(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + assertEquals(200, ulscb.getResult()); + } +} diff --git a/scala/LICENSE b/scala/LICENSE new file mode 100644 index 000000000..3efa3922e --- /dev/null +++ b/scala/LICENSE @@ -0,0 +1,27 @@ +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +PubNub Real-time Cloud-Hosted Push API and Push Notification Client Frameworks +Copyright (c) 2013 PubNub Inc. +http://www.pubnub.com/ +http://www.pubnub.com/terms diff --git a/scala/src/com/pubnub/examples/PubnubDevConsole.scala b/scala/src/com/pubnub/examples/PubnubDevConsole.scala new file mode 100644 index 000000000..65ca172d4 --- /dev/null +++ b/scala/src/com/pubnub/examples/PubnubDevConsole.scala @@ -0,0 +1,452 @@ +//package com.pubnub.examples + +import com.pubnub.api._ +import java.util._ +import org.json._ +import java.lang.Integer + +object PubnubDevConsole { + var pub_key = "" + var sub_key = "" + var sec_key = "" + var cip_key = "" + var SSL = false + var reader: Scanner = null + var pubnub: Pubnub = null + + def getStringFromConsole(message: String, optional: Boolean = false): String = { + + var attempt_count = 0 + var input: String = null + do { + if (attempt_count > 0) print("Invalid input. ") + var message1 = "Enter " + message + message1 = if (optional) message1 + " ( Optional input. You can skip by pressing enter )" else message1 + notifyUser(message1) + input = reader.nextLine() + attempt_count += 1 + } while ((input == null || input.length() == 0) && !optional) + notifyUser(message + " : " + input) + return input + } + def getBooleanFromConsole(message: String, optional: Boolean = false): Boolean = { + + var attempt_count = 0 + var input: String = null + var returnVal = false + do { + if (attempt_count > 0) notifyUser("Invalid input. ") + var message1 = message + " ? ( Enter Yes/No or Y/N )" + message1 = if (optional) message1 + " ( Optional input. You can skip by pressing enter ) " else message1 + notifyUser(message1) + input = reader.nextLine() + attempt_count += 1 + } while ((input == null || input.length() == 0 || + (!input.equalsIgnoreCase("yes") && !input.equalsIgnoreCase("no") && + !input.equalsIgnoreCase("y") && !input.equalsIgnoreCase("n"))) && !optional) + returnVal = if (input.equalsIgnoreCase("y") || input.equalsIgnoreCase("yes")) true else false + notifyUser(message + " : " + returnVal) + return returnVal + } + def getIntFromConsole(message: String, optional: Boolean = false): Int = { + var attempt_count = 0 + var input: String = null + var returnVal = -1 + do { + if (attempt_count > 0) notifyUser("Invalid input. ") + var message1 = "Enter " + message + message1 = if (optional) message1 + " ( Optional input. You can skip by pressing enter ) " else message1 + notifyUser(message1) + input = reader.nextLine() + attempt_count += 1 + returnVal = Integer.parseInt(input) + } while ((input == null || input.length() == 0 || returnVal == -1) && !optional) + notifyUser(message + " : " + returnVal) + return returnVal + } + def notifyUser(msg: String) { + println(msg) + } + + def disconnectAndResubscribeWithTimetoken(timetoken: String = "0") { + pubnub.disconnectAndResubscribeWithTimetoken(timetoken) + } + + def disconnectAndResubscribe(msg: String = "") { + pubnub.disconnectAndResubscribe() + } + + def subscribe(channelName: String) { + + try { + pubnub.subscribe(channelName, new Callback() { + override def connectCallback(channel: String, message: Object) { + notifyUser("SUBSCRIBE : CONNECT on channel:" + channel + + " : " + message.getClass() + " : " + + message.toString()) + } + + override def disconnectCallback(channel: String, message: Object) { + notifyUser("SUBSCRIBE : DISCONNECT on channel:" + channel + + " : " + message.getClass() + " : " + + message.toString()) + } + + override def reconnectCallback(channel: String, message: Object) { + notifyUser("SUBSCRIBE : RECONNECT on channel:" + channel + + " : " + message.getClass() + " : " + + message.toString()) + } + + override def successCallback(channel: String, message: Object) { + notifyUser("SUBSCRIBE : " + channel + " : " + + message.getClass() + " : " + message.toString()) + } + + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("SUBSCRIBE : ERROR on channel " + channel + + " : " + error.toString()) + error.errorCode match { + case PubnubError.PNERR_FORBIDDEN => { pubnub.unsubscribe(channel);} + case PubnubError.PNERR_UNAUTHORIZED => {pubnub.unsubscribe(channel);} + case _ => {} + } + } + }) + + } catch { + case e: Exception => {} + + } + } + def publish(channel: String) { + notifyUser("Enter the message for publish. To exit loop enter QUIT") + var message = ""; + + var callback = new Callback() { + + override def successCallback(channel: String, message: Object) { + notifyUser("PUBLISH : " + message); + } + + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("PUBLISH : " + error); + } + } + while (true) { + var args = new Hashtable(2); + var parsed = false + message = reader.nextLine(); + if (message.equalsIgnoreCase("QUIT")) { + return + } + if (!parsed) { + try { + var i: Integer = message.toInt + pubnub.publish(channel, i, callback) + parsed = true + } catch { + case e: Exception => {} + } + } + if (!parsed) { + try { + var d = message.toDouble + parsed = true + pubnub.publish(channel, d, callback) + } catch { + case e: Exception => {} + + } + } + if (!parsed) { + try { + var js: JSONArray = new JSONArray(message) + parsed = true + pubnub.publish(channel, js, callback) + } catch { + case e: Exception => {} + + } + } + if (!parsed) { + try { + var js: JSONObject = new JSONObject(message); + pubnub.publish(channel, js, callback) + parsed = true + } catch { + case e: Exception => {} + + } + } + if (!parsed) { + pubnub.publish(channel, message, callback) + } + + } + + } + def presence(channel: String) { + + try { + pubnub.presence(channel, new Callback() { + + override def successCallback(channel: String, message: Object) { + notifyUser("PRESENCE : " + message) + } + + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("PRESENCE : " + error) + } + }) + } catch { + case e: PubnubException => {} + + } + } + def history(channel: String) { + + pubnub.history(channel, 2, new Callback() { + override def successCallback(channel: String, message: Object) { + notifyUser("DETAILED HISTORY : " + message) + } + + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("DETAILED HISTORY : " + error) + } + }) + } + def hereNow(channel: String) { + + pubnub.hereNow(channel, new Callback() { + @Override + override def successCallback(channel: String, message: Object) { + notifyUser("HERE NOW : " + message) + } + + @Override + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("HERE NOW : " + error) + } + }) + } + def unsubscribe(channel: String) { + pubnub.unsubscribe(channel) + } + def unsubscribePresence(channel: String) { + pubnub.unsubscribePresence(channel) + } + + def pamGrant() { + + var channel = getStringFromConsole("Channel") + var auth_key = getStringFromConsole("Auth Key") + var read = getBooleanFromConsole("Read") + var write = getBooleanFromConsole("Write") + + pubnub.pamGrant(channel, auth_key, read, write, new Callback() { + + override def successCallback(channel: String, message: Object) { + notifyUser("CHANNEL : " + channel + " , " + message.toString()) + + } + + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("CHANNEL : " + channel + " , " + error.toString()) + } + + }) + } + def pamRevoke() { + var channel = getStringFromConsole("Enter Channel") + var auth_key = getStringFromConsole("Auth Key") + + pubnub.pamRevoke(channel, auth_key, new Callback() { + + override def successCallback(channel: String, message: Object) { + notifyUser("CHANNEL : " + channel + " , " + message.toString()) + + } + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("CHANNEL : " + channel + " , " + error.toString()) + } + + }) + } + + def pamAudit() { + var channel = getStringFromConsole("Channel", true) + var auth_key = getStringFromConsole("Auth Key", true) + + var cb = new Callback() { + + override def successCallback(channel: String, message: Object) { + notifyUser("CHANNEL : " + channel + " , " + message.toString()) + + } + + override def errorCallback(channel: String, error: PubnubError) { + notifyUser("CHANNEL : " + channel + " , " + error.toString()) + } + } + + if (channel != null && channel.length() > 0) { + if (auth_key != null && auth_key.length() != 0) { + pubnub.pamAudit(channel, auth_key, cb) + } else { + pubnub.pamAudit(channel, cb) + } + } else { + pubnub.pamAudit(cb) + } + } + def startDemo() { + + reader = new Scanner(System.in) + notifyUser("HINT:\tTo test Re-connect and catch-up") + notifyUser("\tDisconnect your machine from network/internet and") + notifyUser("\tre-connect your machine after sometime") + + SSL = getBooleanFromConsole("SSL") + + if (pub_key.length() == 0) + pub_key = getStringFromConsole("Publish Key") + + if (sub_key.length() == 0) + sub_key = getStringFromConsole("Subscribe Key") + + if (sec_key.length() == 0) + sec_key = getStringFromConsole("Secret Key", true) + + if (cip_key.trim().length() == 0) + cip_key = getStringFromConsole("Cipher Key", true) + + pubnub = new Pubnub(pub_key, sub_key, sec_key, cip_key, SSL) + + var channelName: String = null + var command: Int = 0 + var loop: Boolean = true + while (loop) { + displayMenuOptions + command = reader.nextInt() + reader.nextLine() + command match { + + case 0 => + displayMenuOptions() + case 1 => + channelName = getStringFromConsole("Subscribe: Enter Channel name") + subscribe(channelName) + + notifyUser("Subscribed to following channels: ") + //notifyUser(PubnubUtil.joinString(pubnub.getSubscribedChannelsArray(), " : ")) + case 2 => + channelName = getStringFromConsole("Channel Name") + publish(channelName) + case 3 => + channelName = getStringFromConsole("Channel Name") + presence(channelName) + case 4 => + channelName = getStringFromConsole("Channel Name") + history(channelName) + case 5 => + channelName = getStringFromConsole("Channel Name") + hereNow(channelName) + case 6 => + channelName = getStringFromConsole("Channel Name") + unsubscribe(channelName) + case 7 => + channelName = getStringFromConsole("Channel Name") + unsubscribePresence(channelName) + case 8 => + pubnub.time(new Callback { + override def successCallback(channel: String, message: Object) { + notifyUser(message.toString()) + } + }) + case 9 => loop = false + case 10 => + disconnectAndResubscribe() + case 11 => + notifyUser("Disconnect and Resubscribe with timetoken : Enter timetoken") + var timetoken = getStringFromConsole("Timetoken") + disconnectAndResubscribeWithTimetoken(timetoken) + case 12 => + pubnub.setResumeOnReconnect(!pubnub.isResumeOnReconnect()) + notifyUser("RESUME ON RECONNECT : " + pubnub.isResumeOnReconnect()) + case 13 => + pubnub.setMaxRetries(getIntFromConsole("Max Retries")) + case 14 => + pubnub.setRetryInterval(getIntFromConsole("Retry Interval")) + case 15 => + pubnub.setSubscribeTimeout(getIntFromConsole("Subscribe Timeout ( in milliseconds) ")) + case 16 => + pubnub.setNonSubscribeTimeout(getIntFromConsole("Non Subscribe Timeout ( in milliseconds) ")) + case 17 => + notifyUser("Set/Unset Auth Key: Enter blank for unsetting key") + var authKey = getStringFromConsole("Auth Key") + pubnub.setAuthKey(authKey) + case 18 => + pamGrant() + case 19 => + pamRevoke() + case 20 => + pamAudit() + case 21 => + pubnub.setOrigin(getStringFromConsole("Origin")) + case 22 => + pubnub.setDomain(getStringFromConsole("Domain")) + case 23 => + pubnub.setCacheBusting(true) + case 24 => + pubnub.setCacheBusting(false) + case _ => + notifyUser("Invalid Input") + } + } + notifyUser("Exiting") + pubnub.shutdown() + } + + def displayMenuOptions() { + println("ENTER 1 FOR Subscribe " + + "(Currently subscribed to " + + pubnub.getCurrentlySubscribedChannelNames() + ")") + println("ENTER 2 FOR Publish") + println("ENTER 3 FOR Presence") + println("ENTER 4 FOR History") + println("ENTER 5 FOR Here_Now") + println("ENTER 6 FOR Unsubscribe") + println("ENTER 7 FOR Presence-Unsubscribe") + println("ENTER 8 FOR Time") + println("ENTER 9 FOR EXIT OR QUIT") + println("ENTER 10 FOR Disconnect-And-Resubscribe") + println("ENTER 11 FOR Disconnect-And-Resubscribe with timetoken") + println("ENTER 12 FOR Toggle Resume On Reconnect ( current: " + pubnub.getResumeOnReconnect() + " )") + println("ENTER 13 FOR Setting MAX Retries ( current: " + pubnub.getMaxRetries() + " )") + println("ENTER 14 FOR Setting Retry Interval ( current: " + pubnub.getRetryInterval() + " milliseconds )") + println("ENTER 15 FOR Setting Subscribe Timeout ( current: " + pubnub.getSubscribeTimeout() + " milliseconds )") + println("ENTER 16 FOR Setting Non Subscribe Timeout ( current: " + pubnub.getNonSubscribeTimeout() + " milliseconds )") + println("ENTER 17 FOR Setting/Unsetting auth key ( current: " + pubnub.getAuthKey() + " )") + println("ENTER 18 FOR PAM grant") + println("ENTER 19 FOR PAM revoke") + println("ENTER 20 FOR PAM Audit") + println("ENTER 21 FOR setting origin ( current: " + pubnub.getOrigin() + " )") + println("ENTER 22 FOR setting domain ( current: "+ pubnub.getDomain() + " )") + println("ENTER 23 FOR enabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )") + println("ENTER 24 FOR disabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )") + println("\nENTER 0 to display this menu") + } + + def main(args: Array[String]) { + + if (args.length == 4) { + pub_key = args(0) + sub_key = args(1) + sec_key = args(2) + cip_key = args(3) + } + startDemo + pubnub.shutdown() + } +}