├── cloudsdk ├── .gitignore ├── consumer-proguard-rules.pro ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ ├── org.kaazing.net.ws.WebSocketFactory │ │ │ │ ├── org.kaazing.net.sse.SseEventSourceFactory │ │ │ │ ├── org.kaazing.net.auth.BasicChallengeHandler │ │ │ │ ├── org.kaazing.net.auth.DispatchChallengeHandler │ │ │ │ └── org.kaazing.net.URLStreamHandlerFactorySpi │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ ├── io │ │ │ │ └── particle │ │ │ │ │ └── android │ │ │ │ │ └── sdk │ │ │ │ │ ├── cloud │ │ │ │ │ ├── SimpleParticleEventHandler.java │ │ │ │ │ ├── ParticleEventHandler.java │ │ │ │ │ ├── BroadcastContract.java │ │ │ │ │ ├── FunctionArgs.java │ │ │ │ │ ├── ParticleEventVisibility.java │ │ │ │ │ ├── exceptions │ │ │ │ │ │ ├── PartialDeviceListResultException.java │ │ │ │ │ │ └── ParticleLoginException.java │ │ │ │ │ ├── SDKGlobals.java │ │ │ │ │ ├── ParticleEvent.java │ │ │ │ │ ├── models │ │ │ │ │ │ ├── DeviceStateChange.java │ │ │ │ │ │ └── AccountInfo.java │ │ │ │ │ ├── ParticleUser.java │ │ │ │ │ └── ParticleCloudSDK.java │ │ │ │ │ ├── utils │ │ │ │ │ ├── Preconditions.java │ │ │ │ │ ├── Toaster.java │ │ │ │ │ ├── TLog.java │ │ │ │ │ └── ParticleInternalStringUtils.java │ │ │ │ │ └── persistance │ │ │ │ │ └── AppDataStorage.java │ │ │ └── org │ │ │ │ └── kaazing │ │ │ │ ├── net │ │ │ │ ├── sse │ │ │ │ │ ├── SseEventType.java │ │ │ │ │ ├── impl │ │ │ │ │ │ ├── SseEventStreamListener.java │ │ │ │ │ │ ├── legacy │ │ │ │ │ │ │ ├── EventSourceAdapter.java │ │ │ │ │ │ │ ├── EventSourceListener.java │ │ │ │ │ │ │ └── EventSourceEvent.java │ │ │ │ │ │ ├── SsePayload.java │ │ │ │ │ │ ├── url │ │ │ │ │ │ │ └── SseURLStreamHandlerFactorySpiImpl.java │ │ │ │ │ │ └── AuthenticatedEventSourceFactory.java │ │ │ │ │ └── SseException.java │ │ │ │ ├── ws │ │ │ │ │ ├── WebSocketMessageType.java │ │ │ │ │ ├── impl │ │ │ │ │ │ ├── url │ │ │ │ │ │ │ ├── WssURLStreamHandlerImpl.java │ │ │ │ │ │ │ └── WssURLStreamHandlerFactorySpiImpl.java │ │ │ │ │ │ ├── spi │ │ │ │ │ │ │ ├── WebSocketExtensionSpi.java │ │ │ │ │ │ │ └── WebSocketExtensionParameterValuesSpi.java │ │ │ │ │ │ ├── WsExtensionParameterValuesSpiImpl.java │ │ │ │ │ │ └── io │ │ │ │ │ │ │ └── WsMessageWriterImpl.java │ │ │ │ │ └── WebSocketMessageWriter.java │ │ │ │ ├── impl │ │ │ │ │ └── auth │ │ │ │ │ │ ├── BasicChallengeResponseFactory.java │ │ │ │ │ │ └── RealmUtils.java │ │ │ │ ├── auth │ │ │ │ │ └── LoginHandler.java │ │ │ │ └── URLStreamHandlerFactorySpi.java │ │ │ │ └── gateway │ │ │ │ ├── bridge │ │ │ │ └── ValidateOrigin.java │ │ │ │ └── client │ │ │ │ ├── impl │ │ │ │ ├── CommandMessage.java │ │ │ │ ├── Handler.java │ │ │ │ ├── wseb │ │ │ │ │ ├── CreateHandlerFactory.java │ │ │ │ │ ├── UpstreamHandlerFactory.java │ │ │ │ │ ├── DownstreamHandlerFactory.java │ │ │ │ │ ├── UpstreamHandlerListener.java │ │ │ │ │ ├── WebSocketEmulatedDecoder.java │ │ │ │ │ ├── CreateHandlerListener.java │ │ │ │ │ ├── WebSocketEmulatedEncoder.java │ │ │ │ │ ├── WebSocketEmulatedDecoderListener.java │ │ │ │ │ ├── CreateHandler.java │ │ │ │ │ ├── DownstreamHandler.java │ │ │ │ │ ├── UpstreamHandler.java │ │ │ │ │ ├── DownstreamHandlerListener.java │ │ │ │ │ ├── WebSocketEmulatedChannel.java │ │ │ │ │ ├── CreateChannel.java │ │ │ │ │ └── UpstreamChannel.java │ │ │ │ ├── WebSocketHandlerFactory.java │ │ │ │ ├── http │ │ │ │ │ ├── HttpRequestHandlerFactory.java │ │ │ │ │ ├── HttpRequestFactory.java │ │ │ │ │ ├── HttpRequestHandler.java │ │ │ │ │ ├── HttpRequestListener.java │ │ │ │ │ └── HttpRequestEvent.java │ │ │ │ ├── ws │ │ │ │ │ ├── ReadyState.java │ │ │ │ │ ├── WebSocketSelectedHandler.java │ │ │ │ │ ├── WebSocketSelectedChannel.java │ │ │ │ │ ├── CloseCommandMessage.java │ │ │ │ │ └── WebSocketHandshakeObject.java │ │ │ │ ├── DecoderInput.java │ │ │ │ ├── EncoderOutput.java │ │ │ │ ├── bridge │ │ │ │ │ ├── ProxyListener.java │ │ │ │ │ ├── ClassLoaderFactory.java │ │ │ │ │ └── Proxy.java │ │ │ │ ├── DecoderListener.java │ │ │ │ ├── wsn │ │ │ │ │ ├── WebSocketNativeEncoder.java │ │ │ │ │ └── WebSocketNativeChannel.java │ │ │ │ ├── WebSocketHandler.java │ │ │ │ ├── Channel.java │ │ │ │ └── util │ │ │ │ │ └── WSURI.java │ │ │ │ ├── transport │ │ │ │ ├── BridgeDelegate.java │ │ │ │ ├── http │ │ │ │ │ ├── HttpRequestDelegateFactory.java │ │ │ │ │ ├── HttpRequestDelegate.java │ │ │ │ │ └── HttpRequestDelegateListener.java │ │ │ │ ├── ws │ │ │ │ │ ├── BridgeSocketFactory.java │ │ │ │ │ ├── FrameProcessorListener.java │ │ │ │ │ ├── WebSocketDelegateFactory.java │ │ │ │ │ ├── BridgeSocket.java │ │ │ │ │ ├── WebSocketDelegate.java │ │ │ │ │ ├── WebSocketDelegateListener.java │ │ │ │ │ ├── WsMessage.java │ │ │ │ │ └── BridgeSocketImpl.java │ │ │ │ ├── ReadyStateChangedEvent.java │ │ │ │ ├── ErrorEvent.java │ │ │ │ ├── CloseEvent.java │ │ │ │ ├── LoadEvent.java │ │ │ │ ├── RedirectEvent.java │ │ │ │ ├── AuthenticateEvent.java │ │ │ │ ├── OpenEvent.java │ │ │ │ ├── IoBufferUtil.java │ │ │ │ ├── ProgressEvent.java │ │ │ │ └── Event.java │ │ │ │ └── util │ │ │ │ ├── auth │ │ │ │ └── LoginHandlerProvider.java │ │ │ │ ├── HttpURI.java │ │ │ │ └── URIUtils.java │ │ └── res │ │ │ └── values │ │ │ ├── oauth_client_creds.xml │ │ │ └── config.xml │ └── androidTest │ │ └── java │ │ └── io │ │ └── particle │ │ └── android │ │ └── sdk │ │ └── cloud │ │ └── ApplicationTest.java └── proguard-rules.pro ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── example_app ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── styles.xml │ │ │ ├── dimens.xml │ │ │ └── strings.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── menu │ │ │ ├── menu_splash.xml │ │ │ └── menu_value.xml │ │ └── layout │ │ │ ├── activity_splash.xml │ │ │ ├── activity_value.xml │ │ │ └── activity_login.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── io │ │ └── particle │ │ └── cloudsdk │ │ └── example_app │ │ └── SplashActivity.java ├── proguard-rules.pro └── build.gradle ├── README.md ├── RELEASE.md ├── .gitignore ├── gradle.properties ├── pom_generator_v1.gradle ├── .idea └── codeStyles │ └── Project.xml ├── bintray_upload_v1.gradle ├── CHANGELOG └── gradlew.bat /cloudsdk/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /cloudsdk/consumer-proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -dontwarn okio.** 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':cloudsdk' 2 | include ':example_app' 3 | 4 | -------------------------------------------------------------------------------- /cloudsdk/src/main/resources/META-INF/services/org.kaazing.net.ws.WebSocketFactory: -------------------------------------------------------------------------------- 1 | org.kaazing.net.ws.impl.DefaultWebSocketFactory -------------------------------------------------------------------------------- /cloudsdk/src/main/resources/META-INF/services/org.kaazing.net.sse.SseEventSourceFactory: -------------------------------------------------------------------------------- 1 | org.kaazing.net.sse.impl.DefaultEventSourceFactory -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/particle-iot-archived/spark-sdk-android/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /cloudsdk/src/main/resources/META-INF/services/org.kaazing.net.auth.BasicChallengeHandler: -------------------------------------------------------------------------------- 1 | org.kaazing.net.impl.auth.DefaultBasicChallengeHandler 2 | -------------------------------------------------------------------------------- /cloudsdk/src/main/resources/META-INF/services/org.kaazing.net.auth.DispatchChallengeHandler: -------------------------------------------------------------------------------- 1 | org.kaazing.net.impl.auth.DefaultDispatchChallengeHandler 2 | -------------------------------------------------------------------------------- /example_app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/particle-iot-archived/spark-sdk-android/HEAD/example_app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/particle-iot-archived/spark-sdk-android/HEAD/example_app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/particle-iot-archived/spark-sdk-android/HEAD/example_app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/particle-iot-archived/spark-sdk-android/HEAD/example_app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /cloudsdk/src/main/resources/META-INF/services/org.kaazing.net.URLStreamHandlerFactorySpi: -------------------------------------------------------------------------------- 1 | org.kaazing.net.ws.impl.url.WsURLStreamHandlerFactorySpiImpl 2 | org.kaazing.net.ws.impl.url.WssURLStreamHandlerFactorySpiImpl 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Particle Android Cloud SDK 2 | 3 | ## MOVED! 4 | 5 | The Cloud SDK has moved to [the new Particle Android repository!](https://github.com/particle-iot/particle-android) This repository is now deprecated and will not be updated. 6 | 7 | -------------------------------------------------------------------------------- /cloudsdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example_app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 26 16:59:54 EEST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/SimpleParticleEventHandler.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | /** 4 | * Created by Julius. 5 | */ 6 | 7 | public interface SimpleParticleEventHandler { 8 | void onEvent(String eventName, ParticleEvent particleEvent); 9 | } 10 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/ParticleEventHandler.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | 4 | public interface ParticleEventHandler extends SimpleParticleEventHandler { 5 | 6 | // FIXME: ugh, use a more specific exception here 7 | void onEventError(Exception e); 8 | } 9 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/BroadcastContract.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | 4 | public interface BroadcastContract { 5 | 6 | String BROADCAST_DEVICES_UPDATED = "BROADCAST_DEVICES_UPDATED"; 7 | String BROADCAST_SYSTEM_EVENT = "BROADCAST_SYSTEM_EVENT"; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/FunctionArgs.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public class FunctionArgs { 6 | 7 | @SerializedName("params") 8 | public final String params; 9 | 10 | public FunctionArgs(String params) { 11 | this.params = params; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /cloudsdk/src/main/res/values/oauth_client_creds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | spark-android-app-1234 7 | d34db33f164e458fdb8daffe48b4ffe9d34db33f 8 | 9 | -------------------------------------------------------------------------------- /example_app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /example_app/src/main/res/menu/menu_splash.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example_app/src/main/res/menu/menu_value.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /cloudsdk/src/androidTest/java/io/particle/android/sdk/cloud/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/ParticleEventVisibility.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | 4 | import android.support.annotation.IntDef; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | 9 | 10 | @IntDef({ParticleEventVisibility.PRIVATE, 11 | ParticleEventVisibility.PUBLIC}) 12 | @Retention(RetentionPolicy.SOURCE) 13 | public @interface ParticleEventVisibility { 14 | int PRIVATE = 1; 15 | int PUBLIC = 2; 16 | } 17 | -------------------------------------------------------------------------------- /example_app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SparkSDK_android_first_try 3 | 4 | Splash! 5 | Settings 6 | LoginActivity 7 | Login 8 | Device Info 9 | ValueActivity 10 | DeviceInfoActivity 11 | 12 | 13 | -------------------------------------------------------------------------------- /cloudsdk/src/main/res/values/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://api.particle.io 5 | 6 | 12 | NONE 13 | 14 | 15 | -------------------------------------------------------------------------------- /example_app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/ido/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /cloudsdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/jensck/Library/android-sdk-linux/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /example_app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/exceptions/PartialDeviceListResultException.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud.exceptions; 2 | 3 | import java.util.List; 4 | 5 | import io.particle.android.sdk.cloud.ParticleDevice; 6 | import retrofit.RetrofitError; 7 | 8 | public class PartialDeviceListResultException extends Exception { 9 | 10 | public final List devices; 11 | 12 | public PartialDeviceListResultException(List devices, Exception cause) { 13 | super(cause); 14 | this.devices = devices; 15 | } 16 | 17 | public PartialDeviceListResultException(List devices, RetrofitError error) { 18 | super(error); 19 | this.devices = devices; 20 | } 21 | 22 | public PartialDeviceListResultException(List devices) { 23 | super("Undefined error while fetching devices"); 24 | this.devices = devices; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/utils/Preconditions.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.utils; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | /** 6 | * Like Guava's Preconditions, but without the overwhelming method count cost 7 | */ 8 | public class Preconditions { 9 | 10 | public static void checkArgument(boolean condition, String errorMessage) { 11 | if (!condition) { 12 | throw new IllegalArgumentException(String.valueOf(errorMessage)); 13 | } 14 | } 15 | 16 | 17 | public static T checkNotNull(T reference) { 18 | if (reference == null) { 19 | throw new NullPointerException(); 20 | } 21 | return reference; 22 | } 23 | 24 | 25 | public static T checkNotNull(T reference, @Nullable Object errorMessage) { 26 | if (reference == null) { 27 | throw new NullPointerException(String.valueOf(errorMessage)); 28 | } 29 | return reference; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Making official releases 2 | 3 | These are the steps for releasing an updated version of the Particle SDK. 4 | For example, if you were releasing version `2.4.2`, you'd do the following: 5 | 6 | 1. Make sure the CHANGELOG is current 7 | 2. Pull from origin to ensure you have the latest upstream changes 8 | 3. Update the `version` field in `cloudsdk/build.gradle` to `'2.4.2'` 9 | 4. Build a release and publish it to JCenter. From the `cloudsdk` dir, 10 | do: `../gradlew clean build install bintrayUpload` 11 | 5. Submit a PR to the docs site updating the version code in `android.md` to `2.4.2` 12 | 6. Update the example app to pull the new version from JCenter, clean its build, and 13 | then build & run the example app as a final smoke test. 14 | 7. Commit and push the previous two changes 15 | 8. Tag the release: `git tag v2.4.2` (note the "v" at the beginning) 16 | 9. Push the tag: `git push origin v2.4.2` (again, note the "v") 17 | 10. (if applicable) announce the update via the appropriate channels 18 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/exceptions/ParticleLoginException.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud.exceptions; 2 | 3 | import org.json.JSONException; 4 | import org.json.JSONObject; 5 | 6 | /** 7 | * Created by Julius. 8 | */ 9 | public class ParticleLoginException extends ParticleCloudException { 10 | 11 | public ParticleLoginException(Exception exception) { 12 | super(exception); 13 | } 14 | 15 | /** 16 | * Server-provided multi-factor auth token. May be null. 17 | * 18 | * @return server-provided multi-factor auth token or null 19 | */ 20 | public String getMfaToken() { 21 | if (responseData == null || responseData.getBody() == null) { 22 | return null; 23 | } 24 | try { 25 | JSONObject jsonObject = new JSONObject(responseData.getBody()); 26 | if (jsonObject.has("mfa_token")) { 27 | return jsonObject.getString("mfa_token"); 28 | } 29 | 30 | } catch (JSONException ignore) { 31 | } 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/net/sse/SseEventType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.net.sse; 23 | 24 | public enum SseEventType { 25 | EOS, EMPTY, DATA; 26 | } -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/bridge/ValidateOrigin.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.bridge; 23 | 24 | final class ValidateOrigin { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/CommandMessage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl; 23 | 24 | public interface CommandMessage { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/transport/BridgeDelegate.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.transport; 23 | 24 | public interface BridgeDelegate { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/Handler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl; 23 | 24 | /** 25 | * Handler marker class 26 | */ 27 | public interface Handler { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/wseb/CreateHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.wseb; 23 | 24 | interface CreateHandlerFactory { 25 | CreateHandler createCreateHandler(); 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/wseb/UpstreamHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.wseb; 23 | 24 | interface UpstreamHandlerFactory { 25 | UpstreamHandler createUpstreamHandler(); 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/wseb/DownstreamHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.wseb; 23 | 24 | interface DownstreamHandlerFactory { 25 | DownstreamHandler createDownstreamHandler(); 26 | } 27 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/WebSocketHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl; 23 | 24 | public interface WebSocketHandlerFactory { 25 | 26 | WebSocketHandler createWebSocketHandler(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/http/HttpRequestHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.http; 23 | 24 | 25 | public interface HttpRequestHandlerFactory { 26 | 27 | HttpRequestHandler createHandler(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/ws/ReadyState.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.ws; 23 | 24 | /** 25 | * Values are CONNECTING = 0, OPEN = 1, CLOSING = 2, and CLOSED = 3; 26 | */ 27 | public enum ReadyState { 28 | CONNECTING, OPEN, CLOSING, CLOSED 29 | } -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/transport/http/HttpRequestDelegateFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.transport.http; 23 | 24 | public interface HttpRequestDelegateFactory { 25 | 26 | HttpRequestDelegate createHttpRequestDelegate(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/SDKGlobals.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | 4 | import android.content.Context; 5 | 6 | import javax.annotation.ParametersAreNonnullByDefault; 7 | 8 | import io.particle.android.sdk.persistance.AppDataStorage; 9 | import io.particle.android.sdk.persistance.SensitiveDataStorage; 10 | 11 | 12 | @ParametersAreNonnullByDefault 13 | public class SDKGlobals { 14 | 15 | private static volatile SensitiveDataStorage sensitiveDataStorage; 16 | private static volatile AppDataStorage appDataStorage; 17 | 18 | private static boolean isInitialized = false; 19 | 20 | 21 | public static synchronized void init(Context ctx) { 22 | ctx = ctx.getApplicationContext(); 23 | if (isInitialized) { 24 | return; 25 | } 26 | 27 | sensitiveDataStorage = new SensitiveDataStorage(ctx); 28 | appDataStorage = new AppDataStorage(ctx); 29 | 30 | isInitialized = true; 31 | } 32 | 33 | 34 | public static SensitiveDataStorage getSensitiveDataStorage() { 35 | return sensitiveDataStorage; 36 | } 37 | 38 | public static AppDataStorage getAppDataStorage() { 39 | return appDataStorage; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/DecoderInput.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl; 23 | 24 | import org.kaazing.gateway.client.util.WrappedByteBuffer; 25 | 26 | 27 | public interface DecoderInput { 28 | 29 | WrappedByteBuffer read(C channel); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/transport/ws/BridgeSocketFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.transport.ws; 23 | 24 | import java.io.IOException; 25 | 26 | interface BridgeSocketFactory { 27 | 28 | BridgeSocket createSocket(boolean secure) throws IOException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/transport/ws/FrameProcessorListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.transport.ws; 23 | 24 | import java.nio.ByteBuffer; 25 | 26 | interface FrameProcessorListener { 27 | 28 | void messageReceived(ByteBuffer buffer, String type); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/EncoderOutput.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl; 23 | 24 | import org.kaazing.gateway.client.util.WrappedByteBuffer; 25 | 26 | 27 | public interface EncoderOutput { 28 | 29 | void write(C channel, WrappedByteBuffer buf); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/io/particle/android/sdk/cloud/ParticleEvent.java: -------------------------------------------------------------------------------- 1 | package io.particle.android.sdk.cloud; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.Date; 6 | 7 | import javax.annotation.ParametersAreNonnullByDefault; 8 | 9 | 10 | // Normally it's bad form to use network data models as API data models, but considering that 11 | // for the moment, they'd be a 1:1 mapping, we'll just reuse this data model class. If the 12 | // network API changes, then we can write new classes for the network API models, without 13 | // impacting the public API of the SDK. 14 | @ParametersAreNonnullByDefault 15 | public class ParticleEvent { 16 | 17 | @SerializedName("coreid") 18 | public final String deviceId; 19 | 20 | @SerializedName("data") 21 | public final String dataPayload; 22 | 23 | @SerializedName("published_at") 24 | public final Date publishedAt; 25 | 26 | @SerializedName("ttl") 27 | public final int timeToLive; 28 | 29 | public ParticleEvent(String deviceId, String dataPayload, Date publishedAt, int timeToLive) { 30 | this.deviceId = deviceId; 31 | this.dataPayload = dataPayload; 32 | this.publishedAt = publishedAt; 33 | this.timeToLive = timeToLive; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/net/sse/impl/SseEventStreamListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.net.sse.impl; 23 | 24 | public interface SseEventStreamListener { 25 | 26 | void streamOpened(); 27 | void messageReceived(String eventName, String data); 28 | void streamErrored(Exception exception); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/transport/ReadyStateChangedEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.transport; 23 | 24 | public class ReadyStateChangedEvent extends Event { 25 | 26 | public ReadyStateChangedEvent(String[] params) { 27 | super(Event.READY_STATE_CHANGE, params); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/wseb/UpstreamHandlerListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.wseb; 23 | 24 | public interface UpstreamHandlerListener { 25 | 26 | void upstreamFailed(UpstreamChannel channel, Exception exception); 27 | void upstreamCompleted(UpstreamChannel channel); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/transport/ws/WebSocketDelegateFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.transport.ws; 23 | 24 | import java.net.URI; 25 | 26 | public interface WebSocketDelegateFactory { 27 | 28 | WebSocketDelegate createWebSocketDelegate(URI xoaUrl, URI originUrl, String wsProtocol); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/bridge/ProxyListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.bridge; 23 | 24 | import org.kaazing.gateway.client.impl.bridge.XoaEvent.XoaEventKind; 25 | 26 | public interface ProxyListener { 27 | 28 | void eventReceived(Proxy proxy, XoaEventKind name, Object[] params); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/ws/WebSocketSelectedHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.ws; 23 | 24 | import org.kaazing.gateway.client.impl.WebSocketHandler; 25 | 26 | public interface WebSocketSelectedHandler extends WebSocketHandler { 27 | 28 | public void setNextHandler(WebSocketHandler nextHandler); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/wseb/WebSocketEmulatedDecoder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl.wseb; 23 | 24 | import org.kaazing.gateway.client.impl.DecoderInput; 25 | 26 | public interface WebSocketEmulatedDecoder { 27 | 28 | void decode(C channel, DecoderInput in, WebSocketEmulatedDecoderListener listener); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/gateway/client/impl/DecoderListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.gateway.client.impl; 23 | 24 | import org.kaazing.gateway.client.util.WrappedByteBuffer; 25 | 26 | 27 | public interface DecoderListener { 28 | 29 | void messageDecoded(C channel, WrappedByteBuffer message); 30 | void messageDecoded(C channel, String message); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /cloudsdk/src/main/java/org/kaazing/net/ws/WebSocketMessageType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package org.kaazing.net.ws; 23 | 24 | /** 25 | * {@link WebSocketMessageType} represents the types of the messages that are 26 | * received by the {@link WebSocketMessageReader}. WebSocketMessageType.EOS 27 | * represents end-of-stream. 28 | */ 29 | public enum WebSocketMessageType { 30 | EOS, TEXT, BINARY; 31 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # OS X noise 6 | # Intellij 7 | .DS_Store 8 | 9 | # Files for the Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | 19 | # Gradle files 20 | .gradle/ 21 | build/ 22 | /*/build/ 23 | 24 | 25 | # Local configuration file (sdk path, etc) 26 | local.properties 27 | # no longer used, but we don't want this file to leak(!) 28 | bintray.properties 29 | # not used either, but better safe than sorry, in case of copy/paste accidents, etc. 30 | bintray_user_auth_secrets.properties 31 | 32 | 33 | # Proguard folder generated by Eclipse 34 | proguard/ 35 | 36 | # Log Files 37 | *.log 38 | 39 | 40 | # IDEA/Android Studio 41 | # We want to IGNORE most of .idea 42 | *.iml 43 | /.idea/* 44 | 45 | # IDEA/Android Studio exceptions 46 | # And these are the files we explicitly want to *KEEP*, 47 | !/.idea/codeStyles/ 48 | !/.idea/copyright/ 49 | !/.idea/fileTemplates/ 50 | !/.idea/inspectionProfiles/ 51 | !/.idea/scopes/ 52 | !/.idea/codeStyleSettings.xml 53 | !/.idea/encodings.xml 54 | !/.idea/.name 55 | 56 | # Keystore files 57 | *.jks 58 | 59 | # External native build folder generated in Android Studio 2.2 and later 60 | .externalNativeBuild 61 | 62 | # Google Services (e.g. APIs or Firebase) 63 | google-services.json 64 | 65 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | #org.gradle.jvmargs=-Xms256m -Xmx1024m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=128m 15 | org.gradle.jvmargs=-Xmx4096M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 16 | 17 | # When configured, Gradle will run in incubating parallel mode. 18 | # This option should only be used with decoupled projects. More details, visit 19 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 20 | org.gradle.parallel=true 21 | 22 | # run in daemon mode instead of initializing a new gradle process every time; speeds up re-building 23 | org.gradle.daemon=true 24 | 25 | #Configure only relevant projects 26 | #org.gradle.configureondemand=true 27 | -------------------------------------------------------------------------------- /example_app/src/main/res/layout/activity_value.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 18 | 19 |