diff --git a/android/Pubnub-Android-3.5.2.jar b/android/Pubnub-Android-3.5.2.jar index 8955dbc94..eea437a9d 100644 Binary files a/android/Pubnub-Android-3.5.2.jar and b/android/Pubnub-Android-3.5.2.jar differ diff --git a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar index 8955dbc94..eea437a9d 100644 Binary files a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar and b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar differ diff --git a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar index 8955dbc94..eea437a9d 100644 Binary files a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar and b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar differ diff --git a/blackberry/Pubnub-BlackBerry-3.5.2.jar b/blackberry/Pubnub-BlackBerry-3.5.2.jar index 16c53e788..3acf8010d 100644 Binary files a/blackberry/Pubnub-BlackBerry-3.5.2.jar and b/blackberry/Pubnub-BlackBerry-3.5.2.jar 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..f3fc4a5f0 --- /dev/null +++ b/codenameone/PubnubClientSDK/build.xml @@ -0,0 +1,187 @@ + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zipping rim native code + + + + + + + + + + + + + + + + + Zipping Android native code + + + + + + + + + + + + + + + + + Zipping win native code + + + + + + + + + + + + + + + + + Zipping ios native code + + + + + + + + + + + + + + + + + Zipping me native code + + + + 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..3169393fa --- /dev/null +++ b/codenameone/build.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + 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/lib/pubnub-codenameone-3.5.2.cn1lib b/codenameone/examples/PubnubDevConsole/lib/pubnub-codenameone-3.5.2.cn1lib new file mode 100644 index 000000000..414285a0c Binary files /dev/null and b/codenameone/examples/PubnubDevConsole/lib/pubnub-codenameone-3.5.2.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/pubnub-codenameone-3.5.2.cn1lib b/codenameone/pubnub-codenameone-3.5.2.cn1lib new file mode 100644 index 000000000..ca180e8aa Binary files /dev/null and b/codenameone/pubnub-codenameone-3.5.2.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("http://") || 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..baa7f0d6d --- /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, 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..c67b1d3d8 --- /dev/null +++ b/codenameone/src/com/pubnub/api/SubscribeWorker.java @@ -0,0 +1,102 @@ +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); + } + + 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); + 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/j2me/Pubnub-MicroEdition-3.5.2.jar b/j2me/Pubnub-MicroEdition-3.5.2.jar index 6ece1223e..f44c27e41 100644 Binary files a/j2me/Pubnub-MicroEdition-3.5.2.jar and b/j2me/Pubnub-MicroEdition-3.5.2.jar differ diff --git a/j2me/src1/com/pubnub/api/SubscribeWorker.java b/j2me/src1/com/pubnub/api/SubscribeWorker.java index f40dd5f07..33c387cf0 100644 --- a/j2me/src1/com/pubnub/api/SubscribeWorker.java +++ b/j2me/src1/com/pubnub/api/SubscribeWorker.java @@ -20,8 +20,8 @@ void process(HttpRequest hreq) { log.debug(hreq.getUrl()); hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders()); if (hresp != null - && httpclient.checkResponseSuccess(hresp - .getStatusCode())) { + && HttpUtil.checkResponseSuccess(hresp + .getStatusCode())) { currentRetryAttempt = 1; break; } diff --git a/java/Pubnub-StandardEdition-3.5.2.jar b/java/Pubnub-StandardEdition-3.5.2.jar index b567a5513..d6e9981cf 100644 Binary files a/java/Pubnub-StandardEdition-3.5.2.jar and b/java/Pubnub-StandardEdition-3.5.2.jar differ diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html index dfe580664..c3533a592 100644 --- a/java/doc/allclasses-frame.html +++ b/java/doc/allclasses-frame.html @@ -2,12 +2,12 @@ - + All Classes - + @@ -23,6 +23,8 @@ Callback
+HttpUtil +
Pubnub
PubnubError diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html index 0e2a2023e..b37ab577a 100644 --- a/java/doc/allclasses-noframe.html +++ b/java/doc/allclasses-noframe.html @@ -2,12 +2,12 @@ - + All Classes - + @@ -23,6 +23,8 @@ Callback
+HttpUtil +
Pubnub
PubnubError diff --git a/java/doc/com/pubnub/api/Callback.html b/java/doc/com/pubnub/api/Callback.html index 5e720e000..a9ea5ecf1 100644 --- a/java/doc/com/pubnub/api/Callback.html +++ b/java/doc/com/pubnub/api/Callback.html @@ -2,12 +2,12 @@ - + Callback - + @@ -54,7 +54,7 @@  PREV CLASS  - NEXT CLASSNEXT CLASS
FRAMES    NO FRAMES   @@ -348,7 +348,7 @@

 PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/java/doc/com/pubnub/api/HttpUtil.html b/java/doc/com/pubnub/api/HttpUtil.html new file mode 100644 index 000000000..09d88197f --- /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 index 3b1db8f38..2b085649c 100644 --- a/java/doc/com/pubnub/api/Pubnub.html +++ b/java/doc/com/pubnub/api/Pubnub.html @@ -2,12 +2,12 @@ - + Pubnub - + @@ -53,7 +53,7 @@ PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -2144,7 +2144,7 @@

PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   diff --git a/java/doc/com/pubnub/api/PubnubError.html b/java/doc/com/pubnub/api/PubnubError.html index 77e3470af..ae58e949a 100644 --- a/java/doc/com/pubnub/api/PubnubError.html +++ b/java/doc/com/pubnub/api/PubnubError.html @@ -2,12 +2,12 @@ - + PubnubError - + diff --git a/java/doc/com/pubnub/api/PubnubException.html b/java/doc/com/pubnub/api/PubnubException.html index f66332271..fe367feee 100644 --- a/java/doc/com/pubnub/api/PubnubException.html +++ b/java/doc/com/pubnub/api/PubnubException.html @@ -2,12 +2,12 @@ - + PubnubException - + diff --git a/java/doc/com/pubnub/api/PubnubUtil.html b/java/doc/com/pubnub/api/PubnubUtil.html index 139336b8e..745329424 100644 --- a/java/doc/com/pubnub/api/PubnubUtil.html +++ b/java/doc/com/pubnub/api/PubnubUtil.html @@ -2,12 +2,12 @@ - + PubnubUtil - + diff --git a/java/doc/com/pubnub/api/package-frame.html b/java/doc/com/pubnub/api/package-frame.html index 44973baf8..44807cb7e 100644 --- a/java/doc/com/pubnub/api/package-frame.html +++ b/java/doc/com/pubnub/api/package-frame.html @@ -2,12 +2,12 @@ - + com.pubnub.api - + @@ -25,6 +25,8 @@
Callback
+HttpUtil +
Pubnub
PubnubError diff --git a/java/doc/com/pubnub/api/package-summary.html b/java/doc/com/pubnub/api/package-summary.html index 2fb75c9a0..3bd674a1f 100644 --- a/java/doc/com/pubnub/api/package-summary.html +++ b/java/doc/com/pubnub/api/package-summary.html @@ -2,12 +2,12 @@ - + com.pubnub.api - + @@ -92,6 +92,10 @@

Pubnub APIs Default implementation for all methods is blank +HttpUtil +  + + Pubnub Pubnub object facilitates querying channels for messages and listening on channels for presence/message events diff --git a/java/doc/com/pubnub/api/package-tree.html b/java/doc/com/pubnub/api/package-tree.html index 786d1017f..d7ecc24fc 100644 --- a/java/doc/com/pubnub/api/package-tree.html +++ b/java/doc/com/pubnub/api/package-tree.html @@ -2,12 +2,12 @@ - + com.pubnub.api Class Hierarchy - + @@ -87,7 +87,7 @@

  • java.lang.Object
      -
    • com.pubnub.api.Callback
    • com.pubnub.api.Pubnub
    • com.pubnub.api.PubnubError
    • com.pubnub.api.PubnubUtil
    • java.lang.Throwable (implements java.io.Serializable) +
    • com.pubnub.api.Callback
    • com.pubnub.api.HttpUtil
    • com.pubnub.api.Pubnub
    • com.pubnub.api.PubnubError
    • com.pubnub.api.PubnubUtil
    • java.lang.Throwable (implements java.io.Serializable)
      • java.lang.Exception diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html index 0ab37ae9c..d75f2fdbe 100644 --- a/java/doc/constant-values.html +++ b/java/doc/constant-values.html @@ -2,12 +2,12 @@ - + Constant Field Values - + @@ -96,6 +96,84 @@

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        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
        + +

        + +

        + diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html index 92d9d3022..56b8fc64d 100644 --- a/java/doc/deprecated-list.html +++ b/java/doc/deprecated-list.html @@ -2,12 +2,12 @@ - + Deprecated List - + diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html index 51603df5d..e3ac23686 100644 --- a/java/doc/help-doc.html +++ b/java/doc/help-doc.html @@ -2,12 +2,12 @@ - + API Help - + diff --git a/java/doc/index-all.html b/java/doc/index-all.html index 14ae0f7fd..c475f658b 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -2,12 +2,12 @@ - + Index - + @@ -76,7 +76,7 @@ -CDEGHPRSTU
        +CDEGHIPRSTU

        C

        @@ -84,6 +84,12 @@ 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 @@ -191,6 +197,53 @@
        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 +
         

        @@ -361,7 +414,7 @@
        Returns encoded String
        -C D E G H P R S T U +C D E G H I P R S T U diff --git a/java/doc/index.html b/java/doc/index.html index 555a2337b..b9b5e4827 100644 --- a/java/doc/index.html +++ b/java/doc/index.html @@ -2,7 +2,7 @@ - + Generated Documentation (Untitled) diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html index 32cc982d9..8611282ac 100644 --- a/java/doc/overview-tree.html +++ b/java/doc/overview-tree.html @@ -2,12 +2,12 @@ - + Class Hierarchy - + @@ -89,7 +89,7 @@

        • java.lang.Object
            -
          • com.pubnub.api.Callback
          • com.pubnub.api.Pubnub
          • com.pubnub.api.PubnubError
          • com.pubnub.api.PubnubUtil
          • java.lang.Throwable (implements java.io.Serializable) +
          • com.pubnub.api.Callback
          • com.pubnub.api.HttpUtil
          • com.pubnub.api.Pubnub
          • com.pubnub.api.PubnubError
          • com.pubnub.api.PubnubUtil
          • java.lang.Throwable (implements java.io.Serializable)
            • java.lang.Exception diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html index 83003ad10..c29493da5 100644 --- a/java/doc/serialized-form.html +++ b/java/doc/serialized-form.html @@ -2,12 +2,12 @@ - + Serialized Form - + diff --git a/java/jars/Pubnub-UnitTests-3.5.2.jar b/java/jars/Pubnub-UnitTests-3.5.2.jar index 1cc5547a9..6e1948d99 100644 Binary files a/java/jars/Pubnub-UnitTests-3.5.2.jar and b/java/jars/Pubnub-UnitTests-3.5.2.jar differ diff --git a/java/jars/PubnubDemoConsole.jar b/java/jars/PubnubDemoConsole.jar index dfef1e998..3cd9fb550 100644 Binary files a/java/jars/PubnubDemoConsole.jar and b/java/jars/PubnubDemoConsole.jar differ diff --git a/java/jars/PubnubExample.jar b/java/jars/PubnubExample.jar index 75753382f..783d45506 100644 Binary files a/java/jars/PubnubExample.jar and b/java/jars/PubnubExample.jar differ diff --git a/java/src1/com/pubnub/api/SubscribeWorker.java b/java/src1/com/pubnub/api/SubscribeWorker.java index 7b144c5ba..10199faa5 100644 --- a/java/src1/com/pubnub/api/SubscribeWorker.java +++ b/java/src1/com/pubnub/api/SubscribeWorker.java @@ -40,8 +40,8 @@ void process(HttpRequest hreq) { log.debug(hreq.getUrl()); hresp = httpclient.fetch(hreq.getUrl(), hreq.getHeaders()); if (hresp != null - && httpclient.checkResponseSuccess(hresp - .getStatusCode())) { + && HttpUtil.checkResponseSuccess(hresp + .getStatusCode())) { currentRetryAttempt = 1; break; } diff --git a/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java b/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java index a3b9d180b..b44420da6 100644 --- a/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java +++ b/java/srcPubnubApi/com/pubnub/api/AbstractLogger.java @@ -17,7 +17,7 @@ abstract class AbstractLogger { private String prepareString(String s) { return "[" + VERSION + "] : " + "[" + System.currentTimeMillis() + "] : " + "["+Thread.activeCount() + - "] Thread ID : " + Thread.currentThread().getId() + + "] Thread HashCode : " + Thread.currentThread().hashCode() + ", Thread Name : " + Thread.currentThread().getName() + ", " + s; } diff --git a/java/srcPubnubApi/com/pubnub/api/HttpClient.java b/java/srcPubnubApi/com/pubnub/api/HttpClient.java index 33242f5b6..b6fabba12 100644 --- a/java/srcPubnubApi/com/pubnub/api/HttpClient.java +++ b/java/srcPubnubApi/com/pubnub/api/HttpClient.java @@ -24,14 +24,6 @@ public void reset() { public abstract void setConnectionTimeout(int connectionTimeout); - public abstract boolean isRedirect(int rc); - - public abstract boolean checkResponse(int rc); - - public abstract boolean checkResponseSuccess(int rc); - - public abstract boolean isOk(int rc); - public abstract void shutdown(); public abstract HttpResponse fetch(String url) throws IOException, 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/RequestManager.java b/java/srcPubnubApi/com/pubnub/api/RequestManager.java index 5366a27d3..8ce4febbf 100644 --- a/java/srcPubnubApi/com/pubnub/api/RequestManager.java +++ b/java/srcPubnubApi/com/pubnub/api/RequestManager.java @@ -1,6 +1,5 @@ package com.pubnub.api; -import java.net.SocketTimeoutException; import java.util.Hashtable; import java.util.Vector;

        com.pubnub.api.PubnubError