org.apache.activemq
diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java b/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java
index e4fd85445c..ae3592e736 100644
--- a/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java
+++ b/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java
@@ -41,9 +41,6 @@ import java.io.File;
@MessageLogger(projectCode = "AMQ")
public interface ActiveMQWebLogger extends BasicLogger {
- /**
- * The aerogear logger.
- */
ActiveMQWebLogger LOGGER = Logger.getMessageLogger(ActiveMQWebLogger.class, ActiveMQWebLogger.class.getPackage().getName());
@LogMessage(level = Logger.Level.INFO)
@@ -57,4 +54,4 @@ public interface ActiveMQWebLogger extends BasicLogger {
@LogMessage(level = Logger.Level.WARN)
@Message(id = 244003, value = "Temporary file not deleted on shutdown: {0}", format = Message.Format.MESSAGE_FORMAT)
void tmpFileNotDeleted(File tmpdir);
-}
\ No newline at end of file
+}
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index b612a5e505..198e1fbf9b 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -51,7 +51,6 @@
* [Embedding Apache ActiveMQ Artemis](embedding-activemq.md)
* [Apache Karaf](karaf.md)
* [Spring Integration](spring-integration.md)
-* [AeroGear Integration](aerogear-integration.md)
* [CDI Integration](cdi-integration.md)
* [Intercepting Operations](intercepting-operations.md)
* [Protocols and Interoperability](protocols-interoperability.md)
diff --git a/docs/user-manual/en/aerogear-integration.md b/docs/user-manual/en/aerogear-integration.md
deleted file mode 100644
index 0dbafb26ed..0000000000
--- a/docs/user-manual/en/aerogear-integration.md
+++ /dev/null
@@ -1,104 +0,0 @@
-# AeroGear Integration
-
-AeroGears push technology provides support for different push
-notification technologies like Google Cloud Messaging, Apple's APNs or
-Mozilla's SimplePush. Apache ActiveMQ Artemis allows you to configure a Connector
-Service that will consume messages from a queue and forward them to an
-AeroGear push server and subsequently sent as notifications to mobile
-devices.
-
-## Configuring an AeroGear Connector Service
-
-AeroGear Connector services are configured in the connector-services
-configuration:
-
-
- org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory
-
-
-
-
-
-
- true
-
-
-
-Shown are the required params for the connector service and are:
-
-- `endpoint`. The endpoint or URL of you AeroGear application.
-
-- `queue`. The name of the queue to consume from.
-
-- `application-id`. The application id of your mobile application in
- AeroGear.
-
-- `master-secret`. The secret of your mobile application in AeroGear.
-
-As well as these required parameters there are the following optional
-parameters
-
-- `ttl`. The time to live for the message once AeroGear receives it.
-
-- `badge`. The badge the mobile app should use for the notification.
-
-- `sound`. The sound the mobile app should use for the notification.
-
-- `filter`. A message filter(selector) to use on the connector.
-
-- `retry-interval`. If an error occurs on send, how long before we try
- again to connect.
-
-- `retry-attempts`. How many times we should try to reconnect after an
- error.
-
-- `variants`. A comma separated list of variants that should get the
- message.
-
-- `aliases`. A list of aliases that should get the message.
-
-- `device-types`. A list of device types that should get the messag.
-
-More in depth explanations of the AeroGear related parameters can be
-found in the [AeroGear Push docs](http://aerogear.org/push/)
-
-## How to send a message for AeroGear
-
-To send a message intended for AeroGear simply send a JMS Message and
-set the appropriate headers, like so
-
-``` java
-Message message = session.createMessage();
-
-message.setStringProperty("AEROGEAR_ALERT", "Hello this is a notification from ActiveMQ");
-
-producer.send(message);
-```
-
-
-The 'AEROGEAR_ALERT' property will be the alert sent to the mobile
-device.
-
-> **Note**
->
-> If the message does not contain this property then it will be simply
-> ignored and left on the queue
-
-Its also possible to override any of the other AeroGear parameters by
-simply setting them on the message, for instance if you wanted to set
-ttl of a message you would:
-
-``` java
-message.setIntProperty("AEROGEAR_TTL", 1234);
-```
-
-
-or if you wanted to set the list of variants you would use:
-
-``` java
-message.setStringProperty("AEROGEAR_VARIANTS", "variant1,variant2,variant3");
-```
-```
-
-Again refer to the AeroGear documentation for a more in depth view on
-how to use these settings
diff --git a/examples/features/sub-modules/aerogear/pom.xml b/examples/features/sub-modules/aerogear/pom.xml
deleted file mode 100644
index 8c92febfd1..0000000000
--- a/examples/features/sub-modules/aerogear/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.apache.activemq.examples.modules
- broker-modules
- 2.0.0-SNAPSHOT
-
-
-
-
-
-
- ${project.basedir}/../../../..
-
-
- aerogear
- jar
- ActiveMQ Artemis JMS AeroGear Example
-
-
-
- org.apache.activemq
- artemis-cli
- ${project.version}
-
-
-
-
-
-
- org.apache.activemq
- artemis-maven-plugin
-
-
- create
-
- create
-
-
- ${noServer}
-
-
- org.apache.activemq:artemis-aerogear-integration:${project.version}
-
-
-
-
- start
-
- cli
-
-
- ${noServer}
- true
- tcp://localhost:61616
-
- run
-
-
-
-
- runClient
-
- runClient
-
-
- org.apache.activemq.artemis.jms.example.AerogearExample
-
-
-
- stop
-
- cli
-
-
- ${noServer}
-
- stop
-
-
-
-
-
-
- org.apache.activemq.examples.modules
- aerogear
- ${project.version}
-
-
-
-
-
-
-
diff --git a/examples/features/sub-modules/aerogear/readme.html b/examples/features/sub-modules/aerogear/readme.html
deleted file mode 100644
index 4d0c964f70..0000000000
--- a/examples/features/sub-modules/aerogear/readme.html
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-
-
- ActiveMQ Artemis JMS AeroGear Example
-
-
-
-
-
- JMS AeroGear Example
-
-
- To run the example, simply type mvn verify from this directory, or mvn -PnoServer verify if you want to start and create the server manually.
-
- This example shows how you can send a message to a mobile device by leveraging AeroGears push technology which
- provides support for different push notification technologies like Google Cloud Messaging, Apple's APNs or
- Mozilla's SimplePush.
-
- For this example you will need an AeroGear Application running somewhere, a good way to do this is to deploy the
- Push Application on openshift , you can follow the AeroGear Push 0.X Quickstart.
-
- Once you have created your AeroGear Push Application you can create a mobile application. Simply log into the application
- on the web and create a new mobile application by clicking the 'create' button. Once created you will see an application id
- and a master secret, you will need the later to run the example.
-
- lastly you will need to create a variant. For this example we will be using Android so you will need to create a google project,
- this article explains how to do this.
- Once created click on your app then click 'add' to add a variant. choose 'google cloud messaging', enter your google
- API key and the project number from your google project and click create
-
- Now before we run the example we need a mobile application to receive it. Writing a mobile app is beyond the scope
- of this example but for testing purposes we have supplied an Android app you can use, simply install on your android phone.
- It can be found here . For a more in depth mobile
- app example visit the AeroGear site.
-
- Once you have installed the mobile app you will need to configure the following:
- AeroGear Unified Push URL : This is the URL where your aerogear server is running, something like http://myapp-mydomain.rhcloud.com
- AeroGear Variant ID : This is the ID of the variant you created in AeroGear
- AeroGear Variant Secret : This is the secret for your variant
- GCM Sender ID : this is the Google project Number you created on Google
- Variant : you can use this to target messages if needed.
-
-
- Once you set all these correctly you should get a message saying your mobile app is registered, if you log into
- your AeroGear app you should see it registered with the variant.
-
-
- Now to run the example simply run the following command
- 'mvn -Dendpoint=my aerogear url -Dapplicationid=my application id -Dmastersecret=my master secret -Djsse.enableSNIExtension=false clean verify'.
- If you arent using java 7 you can omit the 'jsse.enableSNIExtension=false'
-
- You should see something like this in your ActiveMQServer
-
-
-
- Dec 04, 2013 3:25:39 PM org.jboss.aerogear.unifiedpush.SenderClient submitPayload
- INFO: HTTP Response code from UnifiedPush Server: 302
- Dec 04, 2013 3:25:39 PM org.jboss.aerogear.unifiedpush.SenderClient submitPayload
- INFO: Performing redirect to 'https://myapp-mydomain.rhcloud.com/rest/sender/'
- Dec 04, 2013 3:25:40 PM org.jboss.aerogear.unifiedpush.SenderClient submitPayload
- INFO: HTTP Response code from UnifiedPush Server: 200
-
-
-
- And on your mobile app you should see a message from ActiveMQ
-
- Now lets look a bit more closely at the configuration in broker.xml
-
-
-
- <queues>
- <queue name="jms.queue.exampleQueue">
- <address>jms.queue.exampleQueue</address>
- </queue>
- </queues>
-
- <connector-services>
- <connector-service name="aerogear-connector">
- <factory-class>org.apache.activemq.integration.aerogear.AeroGearConnectorServiceFactory</factory-class>
- <param key="endpoint" value="${endpoint}"/>
- <param key="queue" value="jms.queue.exampleQueue"/>
- <param key="application-id" value="${applicationid}"/>
- <param key="master-secret" value="${mastersecret}"/>
- </connector-service>
- </connector-services>
-
-
-
- Firstly you will see that we have to create a core queue so it is available when the connector is started, the following are mandatory parameters:
-
- endpoint - The endpoint or URL of you AeroGear application
- queue - The name of the queue to consume from
- application-id - The application id of your mobile application in AeroGear
- master-secret - the secret of your mobile application in AeroGear
-
- as well as those there are also the following optional parameters
-
- ttl - The time to live for the message once AeroGear receives it
- badge - The badge the mobile app should use for the notification
- sound - The sound the mobile app should use for the notification
- filter - A message filter(selector) to use on the connector
- retry-interval - If an error occurs on send, how long before we try again
- retry-attempts - How many times we should try to reconnect after an error
- variants - A comma separated list of variants that should get the message
- aliases - A list of aliases that should get the message
- device-types - A list of device types that should get the message
-
- More in depth explanations of these can be found in the AeroGear docs.
- Now lets look at a snippet of code we used to send the message for our JMS client
-
-
- Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
-
- // Step 3. Perform a lookup on the Connection Factory
- ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
-
- // Step 4.Create a JMS Connection
- connection = cf.createConnection();
-
- // Step 5. Create a JMS Session
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Step 6. Create a JMS Message Producer
- MessageProducer producer = session.createProducer(queue);
-
- // Step 7. Create a Text Message
- Message message = session.createMessage();
-
- message.setStringProperty("AEROGEAR_ALERT", "Hello this is a notification from ActiveMQ");
-
- producer.send(message);
-
-
- The most important thing here is string propert we have set on the message, i.e. 'AEROGEAR_ALERT'. This is the
- actual alert that is sent via AeroGear
- As well as the alert itself you can override any of the above optional parameters in the same fashionby using the
- following propert names: AEROGEAR_SOUND,AEROGEAR_BADGE,AEROGEAR_TTL,AEROGEAR_VARIANTS,AEROGEAR_ALIASES and AEROGEAR_DEVICE_TYPES
-
-
diff --git a/examples/features/sub-modules/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java b/examples/features/sub-modules/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java
deleted file mode 100644
index 7d1a662533..0000000000
--- a/examples/features/sub-modules/aerogear/src/main/java/org/apache/activemq/artemis/jms/example/AerogearExample.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.InitialContext;
-
-/**
- * A simple JMS Queue example that creates a producer and consumer on a queue and sends then receives a message.
- */
-public class AerogearExample {
-
- public static void main(final String[] args) throws Exception {
- Connection connection = null;
- InitialContext initialContext = null;
- try {
- // Step 1. Create an initial context to perform the JNDI lookup.
- initialContext = new InitialContext();
-
- // Step 2. Perfom a lookup on the queue
- Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
-
- // Step 3. Perform a lookup on the Connection Factory
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 4.Create a JMS Connection
- connection = cf.createConnection();
-
- // Step 5. Create a JMS Session
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- // Step 6. Create a JMS Message Producer
- MessageProducer producer = session.createProducer(queue);
-
- // Step 7. Create a Text Message
- Message message = session.createMessage();
-
- message.setStringProperty("AEROGEAR_ALERT", "Hello this is a notification from ActiveMQ");
-
- producer.send(message);
-
- System.out.println("Sent message");
-
- System.out.println("now check your mobile app and press enter");
-
- System.in.read();
- } finally {
- // Step 12. Be sure to close our JMS resources!
- if (initialContext != null) {
- initialContext.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
-}
diff --git a/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml b/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 039e3c9b53..0000000000
--- a/examples/features/sub-modules/aerogear/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
- ./data/bindings
-
- ./data/journal
-
- ./data/largemessages
-
- ./data/paging
-
-
-
- tcp://localhost:61616
-
-
-
-
-
-
-
- org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/features/sub-modules/aerogear/src/main/resources/jndi.properties b/examples/features/sub-modules/aerogear/src/main/resources/jndi.properties
deleted file mode 100644
index 93537c415a..0000000000
--- a/examples/features/sub-modules/aerogear/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-queue.queue/exampleQueue=exampleQueue
diff --git a/examples/features/sub-modules/pom.xml b/examples/features/sub-modules/pom.xml
index ef473651fa..dbbd36ae83 100644
--- a/examples/features/sub-modules/pom.xml
+++ b/examples/features/sub-modules/pom.xml
@@ -49,7 +49,6 @@ under the License.
release
- aerogear
artemis-ra-rar
diff --git a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-chat.css b/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-chat.css
deleted file mode 100644
index 1a75b9f011..0000000000
--- a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-chat.css
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-* {
- margin: 0;
- padding: 0;
-}
-
-body {
- font-family: 'Helvetica Neue', Helvetica, Verdana, Arial, sans-serif;
- padding: 10px;
-}
-
-#disconnect {
- display: none;
-}
-
-#unsubscribe {
- display: none;
-}
-
-#subscribe {
- display: none;
-}
-
-#debug {
- background-color: #F0F0F0;
- font-size: 12px;
- height: 75%;
- overflow: auto;
- padding: 10px;
- position: absolute;
- right: 10px;
- top: 10px;
- width: 250px;
- z-index: 100;
-}
-
-#send_form {
- bottom: 5px;
- position: absolute;
- width: 99%;
-}
-
-#send_form #send_form_input {
- border: 1px solid #CCC;
- font-size: 16px;
- height: 20px;
- padding: 5px;
- width: 98%;
-}
-
-#send_form input[disabled] {
- background-color: #EEE;
-}
-
-#messages {
- bottom: 25px;
- left: 0;
- overflow: auto;
- padding: 5px;
- right: 0;
- top: 2em;
- z-index: -1;
-}
-
-.message {
- width: 95%;
-}
-
-form dt {
- clear:both;
- width:19%;
- float:left;
- text-align:right;
-}
-
-form dd {
- float:left;
- width:80%;
- margin:0 0 0.5em 0.25em;
-}
-
-input {
- width: 320px;
-}
diff --git a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-chat.js b/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-chat.js
deleted file mode 100644
index a4fe2e895d..0000000000
--- a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-chat.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-$( document ).ready( function () {
-
- var client,
- destination;
-
- $( '#connect_form' ).submit( function ( e ) {
-
- e.preventDefault();
-
- var url = $( '#connect_url' ).val(),
- loginName = $( '#connect_login' ).val(),
- passcode = $( '#connect_passcode' ).val();
-
- destination = $( '#destination' ).val();
-
- client = AeroGear.Notifier({
- name: 'stomp',
- type: 'stompws',
- settings: {
- connectURL: url
- }
- }).clients.stomp;
-
- var debug = function ( str ) {
- $( '#debug' ).append( str + "\n" );
- },
- onconnect = function () {
- debug( 'connected to Stomp');
- $( '#connect' ).fadeOut({
- duration: 'fast'
- });
- $( '#disconnect' ).fadeIn();
- $( '#send_form_input' ).removeAttr( 'disabled' );
- $( '#unsubscribe' ).fadeIn();
-
- client.debug( debug );
-
- var onsubscribe = function ( message ) {
- $( '#messages' ).append( "" + message.body + "
\n" );
- };
-
- client.subscribe({
- address: destination,
- callback: onsubscribe
- });
- };
-
- client.connect({
- login: loginName,
- password: passcode,
- onConnect: onconnect
- });
- });
-
- $( '#disconnect_form' ).submit( function ( e ) {
-
- e.preventDefault();
-
- var ondisconnect = function () {
- $( '#disconnect' ).fadeOut({
- duration: 'fast'
- });
- $( '#unsubscribe' ).fadeOut({
- duration: 'fast'
- });
- $( '#connect' ).fadeIn();
- $( '#send_form_input' ).attr( 'disabled', 'disabled' );
- $( '#messages' ).empty();
- $( '#debug' ).empty();
- };
-
- client.disconnect( ondisconnect );
- });
-
- $( '#unsubscribe_form' ).submit( function ( e ) {
-
- e.preventDefault();
-
- client.unsubscribe( [{ address: destination }] );
-
- $( '#unsubscribe' ).fadeOut({
- duration: 'fast'
- });
- });
-
- $( '#send_form' ).submit( function ( e ) {
-
- e.preventDefault();
-
- var text = $( '#send_form_input' ).val();
- if (text) {
- client.send( destination, text );
- $('#send_form_input').val( '' );
- }
- });
-
-});
diff --git a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-index.html b/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-index.html
deleted file mode 100644
index 434be6b778..0000000000
--- a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear-index.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
- Chat Example Using Stomp Over Web Sockets
-
-
-
-
-
-
-
-
-
-
-
-
-
Use the form above to connect to the Stomp server and subscribe to the destination.
-
Once connected, you can send messages to the destination with the text field at the bottom of this page
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear.min.js b/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear.min.js
deleted file mode 100644
index f45dfa0f5f..0000000000
--- a/examples/protocols/stomp/stomp-websockets/aerogear-chat/aerogear.min.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*! Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-(function(e,t){function r(e,t,r){if(4!==t.length)throw new h.exception.invalid("invalid aes block size");var n=e.c[r],a=t[0]^n[0],i=t[r?3:1]^n[1],s=t[2]^n[2];t=t[r?1:3]^n[3];var o,c,u,f,l=n.length/4-2,d=4,p=[0,0,0,0];o=e.n[r],e=o[0];var g=o[1],m=o[2],y=o[3],b=o[4];for(f=0;l>f;f++)o=e[a>>>24]^g[255&i>>16]^m[255&s>>8]^y[255&t]^n[d],c=e[i>>>24]^g[255&s>>16]^m[255&t>>8]^y[255&a]^n[d+1],u=e[s>>>24]^g[255&t>>16]^m[255&a>>8]^y[255&i]^n[d+2],t=e[t>>>24]^g[255&a>>16]^m[255&i>>8]^y[255&s]^n[d+3],d+=4,a=o,i=c,s=u;for(f=0;4>f;f++)p[r?3&-f:f]=b[a>>>24]<<24^b[255&i>>16]<<16^b[255&s>>8]<<8^b[255&t]^n[d++],o=a,a=i,i=s,s=t,t=o;return p}function n(e,t){var r,n,a,i=t.slice(0),s=e.u,o=e.c,c=s[0],u=s[1],h=s[2],f=s[3],l=s[4],d=s[5],p=s[6],g=s[7];for(r=0;64>r;r++)16>r?n=i[r]:(n=i[15&r+1],a=i[15&r+14],n=i[15&r]=0|(n>>>7^n>>>18^n>>>3^n<<25^n<<14)+(a>>>17^a>>>19^a>>>10^a<<15^a<<13)+i[15&r]+i[15&r+9]),n=n+g+(l>>>6^l>>>11^l>>>25^l<<26^l<<21^l<<7)+(p^l&(d^p))+o[r],g=p,p=d,d=l,l=0|f+n,f=h,h=u,u=c,c=0|n+(u&h^f&(u^h))+(u>>>2^u>>>13^u>>>22^u<<30^u<<19^u<<10);s[0]=0|s[0]+c,s[1]=0|s[1]+u,s[2]=0|s[2]+h,s[3]=0|s[3]+f,s[4]=0|s[4]+l,s[5]=0|s[5]+d,s[6]=0|s[6]+p,s[7]=0|s[7]+g}function a(e,t){var r,n=h.random.F[e],a=[];for(r in n)n.hasOwnProperty(r)&&a.push(n[r]);for(r=0;a.length>r;r++)a[r](t)}function i(e){e.c=s(e).concat(s(e)),e.H=new h.cipher.aes(e.c)}function s(e){for(var t=0;4>t&&(e.h[t]=0|e.h[t]+1,!e.h[t]);t++);return e.H.encrypt(e.h)}this.AeroGear={},AeroGear.Core=function(){if(this instanceof AeroGear.Core)throw"Invalid instantiation of base class AeroGear.Core";this.add=function(e){var t,r,n=this[this.collectionName]||{};if(this[this.collectionName]=n,!e)return this;if("string"==typeof e)n[e]=AeroGear[this.lib].adapters[this.type](e,this.config);else if(AeroGear.isArray(e))for(t=0;e.length>t;t++)r=e[t],"string"==typeof r?n[r]=AeroGear[this.lib].adapters[this.type](r,this.config):r.name&&(r.settings=AeroGear.extend(r.settings||{},this.config),r.settings.recordId=r.settings.recordId||r.recordId,n[r.name]=AeroGear[this.lib].adapters[r.type||this.type](r.name,r.settings));else{if(!e.name)return this;e.settings=AeroGear.extend(e.settings||{},this.config),e.settings.recordId=e.settings.recordId||e.recordId,n[e.name]=AeroGear[this.lib].adapters[e.type||this.type](e.name,e.settings)}return this[this.collectionName]=n,this},this.remove=function(e){var t,r,n=this[this.collectionName]||{};if("string"==typeof e)delete n[e];else if(AeroGear.isArray(e))for(t=0;e.length>t;t++)r=e[t],"string"==typeof r?delete n[r]:delete n[r.name];else e&&delete n[e.name];return this[this.collectionName]=n,this}},AeroGear.isArray=function(e){return"[object Array]"==={}.toString.call(e)},AeroGear.extend=function(e,t){var r;for(r in t)e[r]=t[r];return e},function(){function e(e,t,r){var n=t&&r||0,a=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){16>a&&(t[n+a++]=g[e])});16>a;)t[n+a++]=0;return t}function t(e,t){var r=t||0,n=p;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}function r(e,r,n){var a=r&&n||0,i=r||[];e=e||{};var s=null!=e.clockseq?e.clockseq:v,o=null!=e.msecs?e.msecs:(new Date).getTime(),c=null!=e.nsecs?e.nsecs:x+1,u=o-A+(c-x)/1e4;if(0>u&&null==e.clockseq&&(s=16383&s+1),(0>u||o>A)&&null==e.nsecs&&(c=0),c>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");A=o,x=c,v=s,o+=122192928e5;var h=(1e4*(268435455&o)+c)%4294967296;i[a++]=255&h>>>24,i[a++]=255&h>>>16,i[a++]=255&h>>>8,i[a++]=255&h;var f=268435455&1e4*(o/4294967296);i[a++]=255&f>>>8,i[a++]=255&f,i[a++]=16|15&f>>>24,i[a++]=255&f>>>16,i[a++]=128|s>>>8,i[a++]=255&s;for(var l=e.node||b,d=0;6>d;d++)i[a+d]=l[d];return r?r:t(i)}function n(e,r,n){var a=r&&n||0;"string"==typeof e&&(r="binary"==e?new d(16):null,e=null),e=e||{};var i=e.random||(e.rng||l)();if(i[6]=64|15&i[6],i[8]=128|63&i[8],r)for(var s=0;16>s;s++)r[a+s]=i[s];return r||t(i)}var a,i,s,o=this,c=Array(16);if(a=function(){for(var e,e,t=c,r=0,r=0;16>r;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=255&e>>>((3&r)<<3);return t},o.crypto&&crypto.getRandomValues){var u=new Uint32Array(4);s=function(){crypto.getRandomValues(u);for(var e=0;16>e;e++)c[e]=255&u[e>>2]>>>8*(3&e);return c}}try{var h=require("crypto").randomBytes;i=h&&function(){return h(16)}}catch(f){}for(var l=i||s||a,d="function"==typeof Buffer?Buffer:Array,p=[],g={},m=0;256>m;m++)p[m]=(m+256).toString(16).substr(1),g[p[m]]=m;var y=l(),b=[1|y[0],y[1],y[2],y[3],y[4],y[5]],v=16383&(y[6]<<8|y[7]),A=0,x=0,S=n;if(S.v1=r,S.v4=n,S.parse=e,S.unparse=t,S.BufferClass=d,S.mathRNG=a,S.nodeRNG=i,S.whatwgRNG=s,"undefined"!=typeof module)module.exports=S;else{var G=o.uuid;S.noConflict=function(){return o.uuid=G,S},o.uuid=S}}(),function(){var r=e!==t?e:exports,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=function(){try{document.createElement("$")}catch(e){return e}}();r.btoa||(r.btoa=function(e){for(var t,r,i=0,s=n,o="";e.charAt(0|i)||(s="=",i%1);o+=s.charAt(63&t>>8-8*(i%1))){if(r=e.charCodeAt(i+=.75),r>255)throw a;t=t<<8|r}return o}),r.atob||(r.atob=function(e){if(e=e.replace(/=+$/,""),1==e.length%4)throw a;for(var t,r,i=0,s=0,o="";r=e.charAt(s++);~r&&(t=i%4?64*t+r:r,i++%4)?o+=String.fromCharCode(255&t>>(6&-2*i)):0)r=n.indexOf(r);return o})}();var o=void 0,c=!0,u=!1,h={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(e){this.toString=function(){return"CORRUPT: "+this.message},this.message=e},invalid:function(e){this.toString=function(){return"INVALID: "+this.message},this.message=e},bug:function(e){this.toString=function(){return"BUG: "+this.message},this.message=e},notReady:function(e){this.toString=function(){return"NOT READY: "+this.message},this.message=e}}};"undefined"!=typeof module&&module.exports&&(module.exports=h),h.cipher.aes=function(e){this.n[0][0][0]||this.K();var t,r,n,a,i=this.n[0][4],s=this.n[1];t=e.length;var o=1;if(4!==t&&6!==t&&8!==t)throw new h.exception.invalid("invalid aes key size");for(this.c=[n=e.slice(0),a=[]],e=t;4*t+28>e;e++)r=n[e-1],(0===e%t||8===t&&4===e%t)&&(r=i[r>>>24]<<24^i[255&r>>16]<<16^i[255&r>>8]<<8^i[255&r],0===e%t&&(r=r<<8^r>>>24^o<<24,o=o<<1^283*(o>>7))),n[e]=n[e-t]^r;for(t=0;e;t++,e--)r=n[3&t?e:e-4],a[t]=4>=e||4>t?r:s[0][i[r>>>24]]^s[1][i[255&r>>16]]^s[2][i[255&r>>8]]^s[3][i[255&r]]},h.cipher.aes.prototype={encrypt:function(e){return r(this,e,0)},decrypt:function(e){return r(this,e,1)},n:[[[],[],[],[],[]],[[],[],[],[],[]]],K:function(){var e,t,r,n,a,i,s,o=this.n[0],c=this.n[1],u=o[4],h=c[4],f=[],l=[];for(e=0;256>e;e++)l[(f[e]=e<<1^283*(e>>7))^e]=e;for(t=r=0;!u[t];t^=n||1,r=l[r]||1)for(i=r^r<<1^r<<2^r<<3^r<<4,i=99^(i>>8^255&i),u[t]=i,h[i]=t,a=f[e=f[n=f[t]]],s=16843009*a^65537*e^257*n^16843008*t,a=257*f[i]^16843008*i,e=0;4>e;e++)o[e][t]=a=a<<24^a>>>8,c[e][i]=s=s<<24^s>>>8;for(e=0;5>e;e++)o[e]=o[e].slice(0),c[e]=c[e].slice(0)}},h.bitArray={bitSlice:function(e,t,r){return e=h.bitArray.U(e.slice(t/32),32-(31&t)).slice(1),r===o?e:h.bitArray.clamp(e,r-t)},extract:function(e,t,r){var n=Math.floor(31&-t-r);return(-32&(t+r-1^t)?e[0|t/32]<<32-n^e[0|t/32+1]>>>n:e[0|t/32]>>>n)&(1<32*e.length)return e;e=e.slice(0,Math.ceil(t/32));var r=e.length;return t&=31,r>0&&t&&(e[r-1]=h.bitArray.partial(t,e[r-1]&2147483648>>t-1,1)),e},partial:function(e,t,r){return 32===e?t:(r?0|t:t<<32-e)+1099511627776*e},getPartial:function(e){return Math.round(e/1099511627776)||32},equal:function(e,t){if(h.bitArray.bitLength(e)!==h.bitArray.bitLength(t))return u;var r,n=0;for(r=0;e.length>r;r++)n|=e[r]^t[r];return 0===n},U:function(e,t,r,n){var a;for(a=0,n===o&&(n=[]);t>=32;t-=32)n.push(r),r=0;if(0===t)return n.concat(e);for(a=0;e.length>a;a++)n.push(r|e[a]>>>t),r=e[a]<<32-t;return a=e.length?e[e.length-1]:0,e=h.bitArray.getPartial(a),n.push(h.bitArray.partial(31&t+e,t+e>32?r:n.pop(),1)),n},ba:function(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}},h.codec.utf8String={fromBits:function(e){var t,r,n="",a=h.bitArray.bitLength(e);for(t=0;a/8>t;t++)0===(3&t)&&(r=e[t/4]),n+=String.fromCharCode(r>>>24),r<<=8;return decodeURIComponent(escape(n))},toBits:function(e){e=unescape(encodeURIComponent(e));var t,r=[],n=0;for(t=0;e.length>t;t++)n=n<<8|e.charCodeAt(t),3===(3&t)&&(r.push(n),n=0);return 3&t&&r.push(h.bitArray.partial(8*(3&t),n)),r}},h.codec.hex={fromBits:function(e){var t,r="";for(t=0;e.length>t;t++)r+=((0|e[t])+0xf00000000000).toString(16).substr(4);return r.substr(0,h.bitArray.bitLength(e)/4)},toBits:function(e){var t,r,n=[];for(e=e.replace(/\s|0x/g,""),r=e.length,e+="00000000",t=0;e.length>t;t+=8)n.push(0^parseInt(e.substr(t,8),16));return h.bitArray.clamp(n,4*r)}},h.hash.sha256=function(e){this.c[0]||this.K(),e?(this.u=e.u.slice(0),this.p=e.p.slice(0),this.k=e.k):this.reset()},h.hash.sha256.hash=function(e){return(new h.hash.sha256).update(e).finalize()},h.hash.sha256.prototype={blockSize:512,reset:function(){return this.u=this.R.slice(0),this.p=[],this.k=0,this},update:function(e){"string"==typeof e&&(e=h.codec.utf8String.toBits(e));var t,r=this.p=h.bitArray.concat(this.p,e);for(t=this.k,e=this.k=t+h.bitArray.bitLength(e),t=-512&512+t;e>=t;t+=512)n(this,r.splice(0,16));return this},finalize:function(){var e,t=this.p,r=this.u,t=h.bitArray.concat(t,[h.bitArray.partial(1,1)]);for(e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(this.k/4294967296)),t.push(0|this.k);t.length;)n(this,t.splice(0,16));return this.reset(),r},R:[],c:[],K:function(){function e(e){return 0|4294967296*(e-Math.floor(e))}var t,r=0,n=2;e:for(;64>r;n++){for(t=2;n>=t*t;t++)if(0===n%t)continue e;8>r&&(this.R[r]=e(Math.pow(n,.5))),this.c[r]=e(Math.pow(n,1/3)),r++}}},h.mode.gcm={name:"gcm",encrypt:function(e,t,r,n,a){var i=t.slice(0);return t=h.bitArray,n=n||[],e=h.mode.gcm.O(c,e,i,n,r,a||128),t.concat(e.data,e.tag)},decrypt:function(e,t,r,n,a){var i=t.slice(0),s=h.bitArray,o=s.bitLength(i);if(a=a||128,n=n||[],o>=a?(t=s.bitSlice(i,o-a),i=s.bitSlice(i,0,o-a)):(t=i,i=[]),e=h.mode.gcm.O(u,e,i,n,r,a),!s.equal(e.tag,t))throw new h.exception.corrupt("gcm: tag doesn't match");return e.data},aa:function(e,t){var r,n,a,i,s,o=h.bitArray.ba;for(a=[0,0,0,0],i=t.slice(0),r=0;128>r;r++){for((n=0!==(e[Math.floor(r/32)]&1<<31-r%32))&&(a=o(a,i)),s=0!==(1&i[3]),n=3;n>0;n--)i[n]=i[n]>>>1|(1&i[n-1])<<31;i[0]>>>=1,s&&(i[0]^=-520093696)}return a},j:function(e,t,r){var n,a=r.length;for(t=t.slice(0),n=0;a>n;n+=4)t[0]^=4294967295&r[n],t[1]^=4294967295&r[n+1],t[2]^=4294967295&r[n+2],t[3]^=4294967295&r[n+3],t=h.mode.gcm.aa(t,e);return t},O:function(e,t,r,n,a,i){var s,o,c,u,f,l,d,p,g=h.bitArray;for(l=r.length,d=g.bitLength(r),p=g.bitLength(n),o=g.bitLength(a),s=t.encrypt([0,0,0,0]),96===o?(a=a.slice(0),a=g.concat(a,[1])):(a=h.mode.gcm.j(s,[0,0,0,0],a),a=h.mode.gcm.j(s,a,[0,0,Math.floor(o/4294967296),4294967295&o])),o=h.mode.gcm.j(s,[0,0,0,0],n),f=a.slice(0),n=o.slice(0),e||(n=h.mode.gcm.j(s,o,r)),u=0;l>u;u+=4)f[3]++,c=t.encrypt(f),r[u]^=c[0],r[u+1]^=c[1],r[u+2]^=c[2],r[u+3]^=c[3];return r=g.clamp(r,d),e&&(n=h.mode.gcm.j(s,o,r)),e=[Math.floor(p/4294967296),4294967295&p,Math.floor(d/4294967296),4294967295&d],n=h.mode.gcm.j(s,n,e),c=t.encrypt(a),n[0]^=c[0],n[1]^=c[1],n[2]^=c[2],n[3]^=c[3],{tag:g.bitSlice(n,0,i),data:r}}},h.misc.hmac=function(e,t){this.Q=t=t||h.hash.sha256;var r,n=[[],[]],a=t.prototype.blockSize/32;for(this.q=[new t,new t],e.length>a&&(e=t.hash(e)),r=0;a>r;r++)n[0][r]=909522486^e[r],n[1][r]=1549556828^e[r];this.q[0].update(n[0]),this.q[1].update(n[1])},h.misc.hmac.prototype.encrypt=h.misc.hmac.prototype.mac=function(e){return e=new this.Q(this.q[0]).update(e).finalize(),new this.Q(this.q[1]).update(e).finalize()},h.misc.pbkdf2=function(e,t,r,n,a){if(r=r||1e3,0>n||0>r)throw h.exception.invalid("invalid params to pbkdf2");"string"==typeof e&&(e=h.codec.utf8String.toBits(e)),"string"==typeof t&&(t=h.codec.utf8String.toBits(t)),a=a||h.misc.hmac,e=new a(e);var i,s,o,c,u=[],f=h.bitArray;for(c=1;(n||1)>32*u.length;c++){for(a=i=e.encrypt(f.concat(t,[c])),s=1;r>s;s++)for(i=e.encrypt(i),o=0;i.length>o;o++)a[o]^=i[o];u=u.concat(a)}return n&&(u=f.clamp(u,n)),u},h.prng=function(e){this.e=[new h.hash.sha256],this.l=[0],this.L=0,this.B={},this.J=0,this.N={},this.T=this.g=this.m=this.$=0,this.c=[0,0,0,0,0,0,0,0],this.h=[0,0,0,0],this.H=o,this.I=e,this.s=u,this.F={progress:{},seeded:{}},this.o=this.Z=0,this.C=1,this.D=2,this.X=65536,this.M=[0,48,64,96,128,192,256,384,512,768,1024],this.Y=3e4,this.W=80},h.prng.prototype={randomWords:function(e,t){var r,n=[];r=this.isReady(t);var a;if(r===this.o)throw new h.exception.notReady("generator isn't seeded");if(r&this.D){r=!(r&this.C),a=[];var o,c=0;for(this.T=a[0]=(new Date).valueOf()+this.Y,o=0;16>o;o++)a.push(0|4294967296*Math.random());for(o=0;this.e.length>o&&(a=a.concat(this.e[o].finalize()),c+=this.l[o],this.l[o]=0,!(!r&&this.L&1<=1<this.m&&(this.m=c),this.L++,this.c=h.hash.sha256.hash(this.c.concat(a)),this.H=new h.cipher.aes(this.c),r=0;4>r&&(this.h[r]=0|this.h[r]+1,!this.h[r]);r++);}for(r=0;e>r;r+=4)0===(r+1)%this.X&&i(this),a=s(this),n.push(a[0],a[1],a[2],a[3]);return i(this),n.slice(0,e)},setDefaultParanoia:function(e){this.I=e},addEntropy:function(e,t,r){r=r||"user";var n,i,s=(new Date).valueOf(),c=this.B[r],u=this.isReady(),f=0;switch(n=this.N[r],n===o&&(n=this.N[r]=this.$++),c===o&&(c=this.B[r]=0),this.B[r]=(this.B[r]+1)%this.e.length,typeof e){case"number":t===o&&(t=1),this.e[c].update([n,this.J++,1,t,s,1,0|e]);break;case"object":if(r=Object.prototype.toString.call(e),"[object Uint32Array]"===r){for(i=[],r=0;e.length>r;r++)i.push(e[r]);e=i}else for("[object Array]"!==r&&(f=1),r=0;e.length>r&&!f;r++)"number"!=typeof e[r]&&(f=1);if(!f){if(t===o)for(r=t=0;e.length>r;r++)for(i=e[r];i>0;)t++,i>>>=1;this.e[c].update([n,this.J++,2,t,s,e.length].concat(e))}break;case"string":t===o&&(t=e.length),this.e[c].update([n,this.J++,3,t,s,e.length]),this.e[c].update(e);break;default:f=1}if(f)throw new h.exception.bug("random: addEntropy only supports number, array of numbers or string");this.l[c]+=t,this.g+=t,u===this.o&&(this.isReady()!==this.o&&a("seeded",Math.max(this.m,this.g)),a("progress",this.getProgress()))},isReady:function(e){return e=this.M[e!==o?e:this.I],this.m&&this.m>=e?this.l[0]>this.W&&(new Date).valueOf()>this.T?this.D|this.C:this.C:this.g>=e?this.D|this.o:this.o},getProgress:function(e){return e=this.M[e?e:this.I],this.m>=e?1:this.g>e?1:this.g/e},startCollectors:function(){if(!this.s){if(e.addEventListener)e.addEventListener("load",this.v,u),e.addEventListener("mousemove",this.w,u);else{if(!document.attachEvent)throw new h.exception.bug("can't attach event");document.attachEvent("onload",this.v),document.attachEvent("onmousemove",this.w)}this.s=c}},stopCollectors:function(){this.s&&(e.removeEventListener?(e.removeEventListener("load",this.v,u),e.removeEventListener("mousemove",this.w,u)):e.detachEvent&&(e.detachEvent("onload",this.v),e.detachEvent("onmousemove",this.w)),this.s=u)},addEventListener:function(e,t){this.F[e][this.Z++]=t},removeEventListener:function(e,t){var r,n,a=this.F[e],i=[];for(n in a)a.hasOwnProperty(n)&&a[n]===t&&i.push(n);for(r=0;i.length>r;r++)n=i[r],delete a[n]},w:function(e){h.random.addEntropy([e.x||e.clientX||e.offsetX||0,e.y||e.clientY||e.offsetY||0],2,"mouse")},v:function(){h.random.addEntropy((new Date).valueOf(),2,"loadtime")}},h.random=new h.prng(6);try{if("undefined"!=typeof module&&module.exports){var f=require("crypto").randomBytes(128);h.random.addEntropy(f,1024,"crypto['randomBytes']")}else if(e&&e.crypto&&e.crypto.getRandomValues){var l=new Uint32Array(32);e.crypto.getRandomValues(l),h.random.addEntropy(l,1024,"crypto['getRandomValues']")}}catch(d){}h.bn=function(e){this.initWith(e)},h.bn.prototype={radix:24,maxMul:8,d:h.bn,copy:function(){return new this.d(this)},initWith:function(e){var t,r=0;switch(typeof e){case"object":this.limbs=e.limbs.slice(0);break;case"number":this.limbs=[e],this.normalize();break;case"string":for(e=e.replace(/^0x/,""),this.limbs=[],t=this.radix/4,r=0;e.length>r;r+=t)this.limbs.push(parseInt(e.substring(Math.max(e.length-r-t,0),e.length-r),16));break;default:this.limbs=[0]}return this},equals:function(e){"number"==typeof e&&(e=new this.d(e));var t,r=0;for(this.fullReduce(),e.fullReduce(),t=0;this.limbs.length>t||e.limbs.length>t;t++)r|=this.getLimb(t)^e.getLimb(t);return 0===r},getLimb:function(e){return e>=this.limbs.length?0:this.limbs[e]},greaterEquals:function(e){"number"==typeof e&&(e=new this.d(e));var t,r,n,a=0,i=0;for(t=Math.max(this.limbs.length,e.limbs.length)-1;t>=0;t--)r=this.getLimb(t),n=e.getLimb(t),i|=n-r&~a,a|=r-n&~i;return(i|~a)>>>31},toString:function(){this.fullReduce();var e,t,r="",n=this.limbs;for(e=0;this.limbs.length>e;e++){for(t=n[e].toString(16);this.limbs.length-1>e&&6>t.length;)t="0"+t;r=t+r}return"0x"+r},addM:function(e){"object"!=typeof e&&(e=new this.d(e));var t=this.limbs,r=e.limbs;for(e=t.length;r.length>e;e++)t[e]=0;for(e=0;r.length>e;e++)t[e]+=r[e];return this},doubleM:function(){var e,t,r=0,n=this.radix,a=this.radixMask,i=this.limbs;for(e=0;i.length>e;e++)t=i[e],t=t+t+r,i[e]=t&a,r=t>>n;return r&&i.push(r),this},halveM:function(){var e,t,r=0,n=this.radix,a=this.limbs;for(e=a.length-1;e>=0;e--)t=a[e],a[e]=t+r>>1,r=(1&t)<e;e++)t[e]=0;for(e=0;r.length>e;e++)t[e]-=r[e];return this},mod:function(e){var t=!this.greaterEquals(new h.bn(0));e=new h.bn(e).normalize();var r=new h.bn(this).normalize(),n=0;for(t&&(r=new h.bn(0).subM(r).normalize());r.greaterEquals(e);n++)e.doubleM();for(t&&(r=e.sub(r).normalize());n>0;n--)e.halveM(),r.greaterEquals(e)&&r.subM(e).normalize();return r.trim()},inverseMod:function(e){var t,r=new h.bn(1),n=new h.bn(0),a=new h.bn(this),i=new h.bn(e),s=1;if(!(1&e.limbs[0]))throw new h.exception.invalid("inverseMod: p must be odd");do for(1&a.limbs[0]&&(a.greaterEquals(i)||(t=a,a=i,i=t,t=r,r=n,n=t),a.subM(i),a.normalize(),r.greaterEquals(n)||r.addM(e),r.subM(n)),a.halveM(),1&r.limbs[0]&&r.addM(e),r.normalize(),r.halveM(),t=s=0;a.limbs.length>t;t++)s|=a.limbs[t];while(s);if(!i.equals(1))throw new h.exception.invalid("inverseMod: p and x must be relatively prime");return n},add:function(e){return this.copy().addM(e)},sub:function(e){return this.copy().subM(e)},mul:function(e){"number"==typeof e&&(e=new this.d(e));var t,r,n=this.limbs,a=e.limbs,i=n.length,s=a.length,o=new this.d,c=o.limbs,u=this.maxMul;for(t=0;this.limbs.length+e.limbs.length+1>t;t++)c[t]=0;for(t=0;i>t;t++){for(r=n[t],e=0;s>e;e++)c[t+e]+=r*a[e];--u||(u=this.maxMul,o.cnormalize())}return o.cnormalize().reduce()},square:function(){return this.mul(this)},power:function(e){"number"==typeof e?e=[e]:e.limbs!==o&&(e=e.normalize().limbs);var t,r,n=new this.d(1),a=this;for(t=0;e.length>t;t++)for(r=0;this.radix>r;r++)e[t]&1<e||0!==r&&-1!==r;e++)r=(a[e]||0)+r,t=a[e]=r&s,r=(r-t)*n;return-1===r&&(a[e-1]-=this.placeVal),this},cnormalize:function(){var e,t,r=0,n=this.ipv,a=this.limbs,i=a.length,s=this.radixMask;for(e=0;i-1>e;e++)r=a[e]+r,t=a[e]=r&s,r=(r-t)*n;return a[e]+=r,this},toBits:function(e){this.fullReduce(),e=e||this.exponent||this.bitLength();var t=Math.floor((e-1)/24),r=h.bitArray,n=[r.partial((-8&e+7)%this.radix||this.radix,this.getLimb(t))];for(t--;t>=0;t--)n=r.concat(n,[r.partial(Math.min(this.radix,e),this.getLimb(t))]),e-=this.radix;return n},bitLength:function(){this.fullReduce();for(var e=this.radix*(this.limbs.length-1),t=this.limbs[this.limbs.length-1];t;t>>>=1)e++;return-8&e+7}},h.bn.fromBits=function(e){var t=new this,r=[],n=h.bitArray,a=this.prototype,i=Math.min(this.bitLength||4294967296,n.bitLength(e)),s=i%a.radix||a.radix;for(r[0]=n.extract(e,0,s);i>s;s+=a.radix)r.unshift(n.extract(e,s,a.radix));return t.limbs=r,t},h.bn.prototype.ipv=1/(h.bn.prototype.placeVal=Math.pow(2,h.bn.prototype.radix)),h.bn.prototype.radixMask=(1<n;n++)i.offset[n]=Math.floor(t[n][0]/i.radix-a),i.fullOffset[n]=Math.ceil(t[n][0]/i.radix-a),i.factor[n]=t[n][1]*Math.pow(.5,e-t[n][0]+i.offset[n]*i.radix),i.fullFactor[n]=t[n][1]*Math.pow(.5,e-t[n][0]+i.fullOffset[n]*i.radix),i.modulus.addM(new h.bn(Math.pow(2,t[n][0])*t[n][1])),i.minOffset=Math.min(i.minOffset,-i.offset[n]);return i.d=r,i.modulus.cnormalize(),i.reduce=function(){var e,t,r,n,a=this.modOffset,i=this.limbs,s=this.offset,o=this.offset.length,c=this.factor;for(e=this.minOffset;i.length>a;){for(r=i.pop(),n=i.length,t=0;o>t;t++)i[n+s[t]]-=c[t]*r;e--,e||(i.push(0),this.cnormalize(),e=this.minOffset)}return this.cnormalize(),this},i.V=-1===i.fullMask?i.reduce:function(){var e,t,r=this.limbs,n=r.length-1;if(this.reduce(),n===this.modOffset-1){for(t=r[n]&this.fullMask,r[n]-=t,e=0;this.fullOffset.length>e;e++)r[n+this.fullOffset[e]]-=this.fullFactor[e]*t;this.normalize()}},i.fullReduce=function(){var e,t;for(this.V(),this.addM(this.modulus),this.addM(this.modulus),this.normalize(),this.V(),t=this.limbs.length;this.modOffset>t;t++)this.limbs[t]=0;for(e=this.greaterEquals(this.modulus),t=0;this.limbs.length>t;t++)this.limbs[t]-=this.modulus.limbs[t]*e;return this.cnormalize(),this},i.inverse=function(){return this.power(this.modulus.sub(2))},r.fromBits=h.bn.fromBits,r};var p=h.bn.pseudoMersennePrime;h.bn.prime={p127:p(127,[[0,-1]]),p25519:p(255,[[0,-19]]),p192k:p(192,[[32,-1],[12,-1],[8,-1],[7,-1],[6,-1],[3,-1],[0,-1]]),p224k:p(224,[[32,-1],[12,-1],[11,-1],[9,-1],[7,-1],[4,-1],[1,-1],[0,-1]]),p256k:p(256,[[32,-1],[9,-1],[8,-1],[7,-1],[6,-1],[4,-1],[0,-1]]),p192:p(192,[[0,-1],[64,-1]]),p224:p(224,[[0,1],[96,-1]]),p256:p(256,[[0,-1],[96,1],[192,1],[224,-1]]),p384:p(384,[[0,-1],[32,1],[96,-1],[128,-1]]),p521:p(521,[[0,-1]])},h.bn.random=function(e,t){"object"!=typeof e&&(e=new h.bn(e));for(var r,n,a=e.limbs.length,i=e.limbs[a-1]+1,s=new h.bn;;){do r=h.random.randomWords(a,t),0>r[a-1]&&(r[a-1]+=4294967296);while(Math.floor(r[a-1]/i)===Math.floor(4294967296/i));for(r[a-1]%=i,n=0;a-1>n;n++)r[n]&=e.radixMask;if(s.limbs=r,!s.greaterEquals(e))return s}},h.ecc={},h.ecc.point=function(e,t,r){t===o?this.isIdentity=c:(this.x=t,this.y=r,this.isIdentity=u),this.curve=e},h.ecc.point.prototype={toJac:function(){return new h.ecc.pointJac(this.curve,this.x,this.y,new this.curve.field(1))},mult:function(e){return this.toJac().mult(e,this).toAffine()},mult2:function(e,t,r){return this.toJac().mult2(e,this,t,r).toAffine()},multiples:function(){var e,t,r;if(this.S===o)for(r=this.toJac().doubl(),e=this.S=[new h.ecc.point(this.curve),this,r.toAffine()],t=3;16>t;t++)r=r.add(this),e.push(r.toAffine());return this.S},isValid:function(){return this.y.square().equals(this.curve.b.add(this.x.mul(this.curve.a.add(this.x.square()))))},toBits:function(){return h.bitArray.concat(this.x.toBits(),this.y.toBits())}},h.ecc.pointJac=function(e,t,r,n){t===o?this.isIdentity=c:(this.x=t,this.y=r,this.z=n,this.isIdentity=u),this.curve=e},h.ecc.pointJac.prototype={add:function(e){var t,r,n,a;if(this.curve!==e.curve)throw"sjcl['ecc']['add'](): Points must be on the same curve to add them!";return this.isIdentity?e.toJac():e.isIdentity?this:(t=this.z.square(),r=e.x.mul(t).subM(this.x),r.equals(0)?this.y.equals(e.y.mul(t.mul(this.z)))?this.doubl():new h.ecc.pointJac(this.curve):(t=e.y.mul(t.mul(this.z)).subM(this.y),n=r.square(),e=t.square(),a=r.square().mul(r).addM(this.x.add(this.x).mul(n)),e=e.subM(a),t=this.x.mul(n).subM(e).mul(t),n=this.y.mul(r.square().mul(r)),t=t.subM(n),r=this.z.mul(r),new h.ecc.pointJac(this.curve,e,t,r)))},doubl:function(){if(this.isIdentity)return this;var e=this.y.square(),t=e.mul(this.x.mul(4)),r=e.square().mul(8),e=this.z.square(),n=""+this.curve.a==""+new h.bn(-3)?this.x.sub(e).mul(3).mul(this.x.add(e)):this.x.square().mul(3).add(e.square().mul(this.curve.a)),e=n.square().subM(t).subM(t),t=t.sub(e).mul(n).subM(r),r=this.y.add(this.y).mul(this.z);return new h.ecc.pointJac(this.curve,e,t,r)},toAffine:function(){if(this.isIdentity||this.z.equals(0))return new h.ecc.point(this.curve);var e=this.z.inverse(),t=e.square();return new h.ecc.point(this.curve,this.x.mul(t).fullReduce(),this.y.mul(t.mul(e)).fullReduce())},mult:function(e,t){"number"==typeof e?e=[e]:e.limbs!==o&&(e=e.normalize().limbs);var r,n,a=new h.ecc.point(this.curve).toJac(),i=t.multiples();for(r=e.length-1;r>=0;r--)for(n=h.bn.prototype.radix-4;n>=0;n-=4)a=a.doubl().doubl().doubl().doubl().add(i[15&e[r]>>n]);return a},mult2:function(e,t,r,n){"number"==typeof e?e=[e]:e.limbs!==o&&(e=e.normalize().limbs),"number"==typeof r?r=[r]:r.limbs!==o&&(r=r.normalize().limbs);var a,i=new h.ecc.point(this.curve).toJac();t=t.multiples();var s,c,u=n.multiples();for(n=Math.max(e.length,r.length)-1;n>=0;n--)for(s=0|e[n],c=0|r[n],a=h.bn.prototype.radix-4;a>=0;a-=4)i=i.doubl().doubl().doubl().doubl().add(t[15&s>>a]).add(u[15&c>>a]);return i},isValid:function(){var e=this.z.square(),t=e.square(),e=t.mul(e);return this.y.square().equals(this.curve.b.mul(e).add(this.x.mul(this.curve.a.mul(t).add(this.x.square()))))}},h.ecc.curve=function(e,t,r,n,a,i){this.field=e,this.r=new h.bn(t),this.a=new e(r),this.b=new e(n),this.G=new h.ecc.point(this,new e(a),new e(i))},h.ecc.curve.prototype.fromBits=function(e){var t=h.bitArray,r=-8&this.field.prototype.exponent+7;if(e=new h.ecc.point(this,this.field.fromBits(t.bitSlice(e,0,r)),this.field.fromBits(t.bitSlice(e,r,2*r))),!e.isValid())throw new h.exception.corrupt("not on the curve!");return e},h.ecc.curves={c192:new h.ecc.curve(h.bn.prime.p192,"0xffffffffffffffffffffffff99def836146bc9b1b4d22831",-3,"0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1","0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012","0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"),c224:new h.ecc.curve(h.bn.prime.p224,"0xffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d",-3,"0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4","0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21","0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34"),c256:new h.ecc.curve(h.bn.prime.p256,"0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551",-3,"0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b","0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296","0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),c384:new h.ecc.curve(h.bn.prime.p384,"0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973",-3,"0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef","0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7","0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),k192:new h.ecc.curve(h.bn.prime.p192k,"0xfffffffffffffffffffffffe26f2fc170f69466a74defd8d",0,3,"0xdb4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d","0x9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d"),k224:new h.ecc.curve(h.bn.prime.p224k,"0x010000000000000000000000000001dce8d2ec6184caf0a971769fb1f7",0,5,"0xa1455b334df099df30fc28a169a467e9e47075a90f7e650eb6b7a45c","0x7e089fed7fba344282cafbd6f7e319f7c0b0bd59e2ca4bdb556d61a5"),k256:new h.ecc.curve(h.bn.prime.p256k,"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",0,7,"0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},h.ecc.P=function(e){h.ecc[e]={publicKey:function(e,t){this.f=e,this.i=e.r.bitLength(),this.A=t instanceof Array?e.fromBits(t):t,this.get=function(){var e=this.A.toBits(),t=h.bitArray.bitLength(e),r=h.bitArray.bitSlice(e,0,t/2),e=h.bitArray.bitSlice(e,t/2);return{x:r,y:e}}},secretKey:function(e,t){this.f=e,this.i=e.r.bitLength(),this.t=t,this.get=function(){return this.t.toBits()}},generateKeys:function(t,r,n){if(t===o&&(t=256),"number"==typeof t&&(t=h.ecc.curves["c"+t],t===o))throw new h.exception.invalid("no such curve");return n===o&&(n=h.bn.random(t.r,r)),r=t.G.mult(n),{pub:new h.ecc[e].publicKey(t,r),sec:new h.ecc[e].secretKey(t,n)}}}},h.ecc.P("elGamal"),h.ecc.elGamal.publicKey.prototype={kem:function(e){e=h.bn.random(this.f.r,e);var t=this.f.G.mult(e).toBits();return{key:h.hash.sha256.hash(this.A.mult(e).toBits()),tag:t}}},h.ecc.elGamal.secretKey.prototype={unkem:function(e){return h.hash.sha256.hash(this.f.fromBits(e).mult(this.t).toBits())},dh:function(e){return h.hash.sha256.hash(e.A.mult(this.t).toBits())}},h.ecc.P("ecdsa"),h.ecc.ecdsa.secretKey.prototype={sign:function(e,t,r,n){h.bitArray.bitLength(e)>this.i&&(e=h.bitArray.clamp(e,this.i));var a=this.f.r,i=a.bitLength();return n=n||h.bn.random(a.sub(1),t).add(1),t=this.f.G.mult(n).x.mod(a),e=h.bn.fromBits(e).add(t.mul(this.t)),r=r?e.inverseMod(a).mul(n).mod(a):e.mul(n.inverseMod(a)).mod(a),h.bitArray.concat(t.toBits(i),r.toBits(i))}},h.ecc.ecdsa.publicKey.prototype={verify:function(e,t,r){h.bitArray.bitLength(e)>this.i&&(e=h.bitArray.clamp(e,this.i));var n=h.bitArray,a=this.f.r,i=this.i,s=h.bn.fromBits(n.bitSlice(t,0,i)),n=h.bn.fromBits(n.bitSlice(t,i,2*i)),u=r?n:n.inverseMod(a),i=h.bn.fromBits(e).mul(u).mod(a),u=s.mul(u).mod(a),i=this.f.G.mult2(i,u,this.A).x;if(s.equals(0)||n.equals(0)||s.greaterEquals(a)||n.greaterEquals(a)||!i.equals(s)){if(r===o)return this.verify(e,t,c);throw new h.exception.corrupt("signature didn't check out")}return c}},AeroGear.Pipeline=function(e){return this instanceof AeroGear.Pipeline?(AeroGear.Core.call(this),this.config=e||{},this.lib="Pipeline",this.type=e?e.type||"Rest":"Rest",this.collectionName="pipes",this.add(e),t):new AeroGear.Pipeline(e)},AeroGear.Pipeline.prototype=AeroGear.Core,AeroGear.Pipeline.constructor=AeroGear.Pipeline,AeroGear.Pipeline.adapters={},AeroGear.Pipeline.adapters.Rest=function(e,r){if(!(this instanceof AeroGear.Pipeline.adapters.Rest))return new AeroGear.Pipeline.adapters.Rest(e,r);r=r||{};var n=r.endpoint||e,a={url:r.baseURL?r.baseURL+n:n,contentType:r.contentType||"application/json",dataType:r.dataType||"json",xhrFields:r.xhrFields},i=r.recordId||"id",s=r.authenticator||null,o=r.authorizer||null,c=r.pageConfig,u=r.timeout?1e3*r.timeout:6e4;this.getAjaxSettings=function(){return a},this.getAuthenticator=function(){return s},this.getAuthorizer=function(){return o},this.getRecordId=function(){return i},this.getTimeout=function(){return u},this.getPageConfig=function(){return c},this.updatePageConfig=function(e,t){t?(c={},c.metadataLocation=e.metadataLocation?e.metadataLocation:"webLinking",c.previousIdentifier=e.previousIdentifier?e.previousIdentifier:"previous",c.nextIdentifier=e.nextIdentifier?e.nextIdentifier:"next",c.parameterProvider=e.parameterProvider?e.parameterProvider:null):jQuery.extend(c,e)},c&&this.updatePageConfig(c,!0),this.webLinkingPageParser=function(e){var r,n,a,i,s,o={};n=e.getResponseHeader("Link").split(",");
-for(var u in n){r=n[u].trim().split(";");for(var h in r)a=r[h].trim(),0===a.indexOf("<")&&a.lastIndexOf(">")===r[h].length-1?i=a.substr(1,a.length-2).split("?")[1]:0===a.indexOf("rel=")&&(a.indexOf(c.previousIdentifier)>=0?s=c.previousIdentifier:a.indexOf(c.nextIdentifier)>=0&&(s=c.nextIdentifier));s&&(o[s]=i,s=t)}return o},this.headerPageParser=function(e){var t=e.getResponseHeader(c.previousIdentifier),r=e.getResponseHeader(c.nextIdentifier),n={},a={};return c.parameterProvider?(n=c.parameterProvider(e),a[c.previousIdentifier]=n[c.previousIdentifier],a[c.nextIdentifier]=n[c.nextIdentifier]):(a[c.previousIdentifier]=t?t.split("?")[1]:null,a[c.nextIdentifier]=r?r.split("?")[1]:null),a},this.bodyPageParser=function(e){var t={},r={};return c.parameterProvider?(r=c.parameterProvider(e),t[c.previousIdentifier]=r[c.previousIdentifier],t[c.nextIdentifier]=r[c.nextIdentifier]):(t[c.previousIdentifier]=e[c.previousIdentifier],t[c.nextIdentifier]=e[c.nextIdentifier]),t},this.formatJSONError=function(e){if("json"===this.getAjaxSettings().dataType)try{e.responseJSON=JSON.parse(e.responseText)}catch(t){}return e}},AeroGear.Pipeline.adapters.Rest.prototype.read=function(e){var r,n,a,i,s=this,o=this.getRecordId(),c=this.getAjaxSettings(),u=this.getPageConfig();if(e=e?e:{},e.query=e.query?e.query:{},r=e[o]?c.url+"/"+e[o]:c.url,u&&e.paging!==!1){e.paging||(e.paging={offset:e.offsetValue||0,limit:e.limitValue||10}),e.query=e.query||{};for(var h in e.paging)e.query[h]=e.paging[h]}return n=function(r,n,a){var i;u&&e.paging!==!1&&(i=s[u.metadataLocation+"PageParser"]("body"===u.metadataLocation?r:a),["previous","next"].forEach(function(n){r[n]=function(e,r,n){return function(a){return n.paging=!0,n.offsetValue=n.limitValue=t,n.query=r,n.success=a&&a.success?a.success:n.success,n.error=a&&a.error?a.error:n.error,e.read(n)}}(s,i[u[n+"Identifier"]],e)})),e.success&&e.success.apply(this,arguments)},a=function(t){t=s.formatJSONError(t),e.error&&e.error.apply(this,arguments)},i={type:"GET",data:e.query,success:n,error:a,url:r,statusCode:e.statusCode,complete:e.complete,headers:e.headers,timeout:this.getTimeout()},e.jsonp&&(i.dataType="jsonp",i.jsonp=e.jsonp.callback?e.jsonp.callback:"callback",e.jsonp.customCallback&&(i.jsonpCallback=e.jsonp.customCallback)),this.getAuthorizer()?this.getAuthorizer().execute(jQuery.extend({},e,i)):jQuery.ajax(jQuery.extend({},this.getAjaxSettings(),i))},AeroGear.Pipeline.adapters.Rest.prototype.save=function(t,r){var n,a,i,s,o,c,u,h=this,f=this.getRecordId(),l=this.getAjaxSettings();if(t=t||{},r=r||{},n=t[f]?"PUT":"POST",a=t[f]?l.url+"/"+t[f]:l.url,i=function(){r.success&&r.success.apply(this,arguments)},s=function(e){e=h.formatJSONError(e),r.error&&r.error.apply(this,arguments)},o=jQuery.extend({},l,{data:t,type:n,url:a,success:i,error:s,statusCode:r.statusCode,complete:r.complete,headers:r.headers,timeout:this.getTimeout()}),"FormData"in e){c=new FormData;for(u in t)c.append(u,t[u]),(t[u]instanceof File||t[u]instanceof Blob)&&(o.contentType=!1,o.processData=!1);o.contentType===!1&&(o.data=c),o.xhr=function(){var e=jQuery.ajaxSettings.xhr();return e.upload&&e.upload.addEventListener("progress",function(){r.progress&&r.progress.apply(this,arguments)},!1),e}}return"application/json"===o.contentType&&o.data&&"string"!=typeof o.data&&(o.data=JSON.stringify(o.data)),this.getAuthorizer()?this.getAuthorizer().execute(jQuery.extend({},r,o)):jQuery.ajax(jQuery.extend({},this.getAjaxSettings(),o))},AeroGear.Pipeline.adapters.Rest.prototype.remove=function(e,t){var r,n,a,i,s,o=this,c=this.getRecordId(),u=this.getAjaxSettings(),h="";return"string"==typeof e||"number"==typeof e?r=e:e&&e[c]?r=e[c]:e&&!t&&(t=e),t=t||{},h=r?"/"+r:"",n=u.url+h,a=function(){t.success&&t.success.apply(this,arguments)},i=function(e){e=o.formatJSONError(e),t.error&&t.error.apply(this,arguments)},s={type:"DELETE",url:n,success:a,error:i,statusCode:t.statusCode,complete:t.complete,headers:t.headers,timeout:this.getTimeout()},this.getAuthorizer()?this.getAuthorizer().execute(jQuery.extend({},t,s)):jQuery.ajax(jQuery.extend({},this.getAjaxSettings(),s))},AeroGear.DataManager=function(e){return this instanceof AeroGear.DataManager?(this.add=function(e){e=e||{};var t,r,n,a,i;e=AeroGear.isArray(e)?e:[e],e=e.map(function(e){if(i=e.settings||{},n=i.fallback===!1?!1:!0,n&&(a=i.preferred?i.preferred:AeroGear.DataManager.preferred,"string"!=typeof e&&(r=e.type||"Memory",!(r in AeroGear.DataManager.validAdapters))))for(t=0;a.length>t;t++)if(a[t]in AeroGear.DataManager.validAdapters)return("IndexedDB"===r||"WebSQL"===r)&&(e.settings=AeroGear.extend(e.settings||{},{async:!0})),e.type=a[t],e;return e},this),AeroGear.Core.call(this),this.add(e),this.add=this._add},this._add=this.add,this.remove=function(e){AeroGear.Core.call(this),this.remove(e),this.remove=this._remove},this._remove=this.remove,this.lib="DataManager",this.type=e?e.type||"Memory":"Memory",this.collectionName="stores",this.add(e),t):new AeroGear.DataManager(e)},AeroGear.DataManager.prototype=AeroGear.Core,AeroGear.DataManager.constructor=AeroGear.DataManager,AeroGear.DataManager.validAdapters={},AeroGear.DataManager.preferred=["IndexedDB","WebSQL","SessionLocal","Memory"],AeroGear.DataManager.validateAdapter=function(e,t){t.isValid()&&(AeroGear.DataManager.validAdapters[e]=t)},AeroGear.DataManager.adapters={},AeroGear.DataManager.STATUS_NEW=1,AeroGear.DataManager.STATUS_MODIFIED=2,AeroGear.DataManager.STATUS_REMOVED=0,AeroGear.DataManager.adapters.base=function(t,r){if(this instanceof AeroGear.DataManager.adapters.base)throw"Invalid instantiation of base class AeroGear.DataManager.adapters.base";r=r||{};var n=null,a=r.recordId?r.recordId:"id",i=r.crypto||{},s=i.options||{};this.getData=function(){return n||[]},this.setData=function(e){n=e},this.getRecordId=function(){return a},this.always=function(e,t,r){r&&r.call(this,e,t)},this.encrypt=function(r){var n;return i.agcrypto?(s.data=h.codec.utf8String.toBits(JSON.stringify(r)),n={id:r[a],data:i.agcrypto.encrypt(s)},e.localStorage.setItem("ag-"+t+"-IV",JSON.stringify({id:i.agcrypto.getIV()})),n):r},this.decrypt=function(r,n){var a,o;return i.agcrypto?(o=JSON.parse(e.localStorage.getItem("ag-"+t+"-IV"))||{},s.IV=o.id,r=AeroGear.isArray(r)?r:[r],a=r.map(function(e){return s.data=e.data,JSON.parse(h.codec.utf8String.fromBits(i.agcrypto.decrypt(s)))}),n?a[0]:a):r}},AeroGear.DataManager.adapters.Memory=function(e,r){return this instanceof AeroGear.DataManager.adapters.Memory?(AeroGear.DataManager.adapters.base.apply(this,arguments),this.emptyData=function(){this.setData(null)},this.addDataRecord=function(e){this.getData().push(e)},this.updateDataRecord=function(e,t){this.getData()[e]=t},this.removeDataRecord=function(e){this.getData().splice(e,1)},this.always=function(e,t,r){r&&r.call(this,e,t)},this.getAsync=function(){return r&&r.async?!0:!1},this.open=function(e){return jQuery.Deferred().resolve(t,"success",e&&e.success)},this.close=function(){},this.traverseObjects=function(e,t,r){for(;"object"==typeof t&&r;)e=Object.keys(t)[0],t=t[e],r=r[e];return t===r?!0:!1},t):new AeroGear.DataManager.adapters.Memory(e,r)},AeroGear.DataManager.adapters.Memory.isValid=function(){return!0},AeroGear.DataManager.adapters.Memory.prototype.read=function(e,r){var n,a={},i=jQuery.Deferred(),s=this.getAsync();return a[this.getRecordId()]=e,e?s?this.filter(a).then(function(e){n=e}):n=this.filter(a):n=this.getData(),s?(i.always(this.always),i.resolve(n,"success",r?r.success:t)):n},AeroGear.DataManager.adapters.Memory.prototype.save=function(e,r){var n=!1,a=jQuery.Deferred(),i=this.getAsync();if(e=AeroGear.isArray(e)?e:[e],r&&r.reset)this.setData(e);else if(this.getData()&&0!==this.getData().length)for(var s=0;e.length>s;s++){for(var o in this.getData())if(this.getData()[o][this.getRecordId()]===e[s][this.getRecordId()]){this.updateDataRecord(o,e[s]),n=!0;break}n||this.addDataRecord(e[s]),n=!1}else this.setData(e);return i?(a.always(this.always),a.resolve(this.getData(),"success",r?r.success:t)):this.getData()},AeroGear.DataManager.adapters.Memory.prototype.remove=function(e,r){var n,a,i,s=jQuery.Deferred(),o=this.getAsync();if(s.always(this.always),!e)return this.emptyData(),o?s.resolve(this.getData(),"success",r?r.success:t):this.getData();e=AeroGear.isArray(e)?e:[e];for(var c=0;e.length>c;c++){if("string"==typeof e[c]||"number"==typeof e[c])n=e[c];else{if(!e)continue;n=e[c][this.getRecordId()]}a=this.getData(!0);for(i in a)a[i][this.getRecordId()]===n&&this.removeDataRecord(i)}return o?s.resolve(this.getData(),"success",r?r.success:t):this.getData()},AeroGear.DataManager.adapters.Memory.prototype.filter=function(e,r,n){var a,i,s,o,c,u=this,h=jQuery.Deferred(),f=this.getAsync();return h.always(this.always),e?(a=this.getData().filter(function(t){var n,a,h=r?!1:!0,f=Object.keys(e);for(i=0;f.length>i;i++){if(e[f[i]].data)for(n=e[f[i]],a=n.matchAny?!1:!0,s=0;n.data.length>s;s++)if(AeroGear.isArray(t[f[i]]))if(t[f[i]].length){if(0===jQuery(t[f]).not(n.data).length&&0===jQuery(n.data).not(t[f]).length){a=!0;break}for(o=0;t[f[i]].length>o;o++){if(n.matchAny&&n.data[s]===t[f[i]][o]){if(a=!0,r)break;for(c=0;t[f[i]].length>c;c++)if(!r&&n.data[s]!==t[f[i]][c]){a=!1;break}}if(!n.matchAny&&n.data[s]!==t[f[i]][o]){a=!1;break}}}else a=!1;else if("object"==typeof n.data[s]){if(n.matchAny&&u.traverseObjects(f[i],n.data[s],t[f[i]])){a=!0;break}if(!n.matchAny&&!u.traverseObjects(f[i],n.data[s],t[f[i]])){a=!1;break}}else{if(n.matchAny&&n.data[s]===t[f[i]]){a=!0;break}if(!n.matchAny&&n.data[s]!==t[f[i]]){a=!1;break}}else if(AeroGear.isArray(t[f[i]]))if(a=r?!1:!0,t[f[i]].length)for(s=0;t[f[i]].length>s;s++){if(r&&e[f[i]]===t[f[i]][s]){a=!0;break}if(!r&&e[f[i]]!==t[f[i]][s]){a=!1;break}}else a=!1;else a="object"==typeof e[f[i]]?u.traverseObjects(f[i],e[f[i]],t[f[i]]):e[f[i]]===t[f[i]]?!0:!1;if(r&&a){h=!0;break}if(!r&&!a){h=!1;break}}return h}),f?h.resolve(a,"success",n?n.success:t):a):(a=this.getData()||[],f?h.resolve(a,"success",n?n.success:t):a)},AeroGear.DataManager.validateAdapter("Memory",AeroGear.DataManager.adapters.Memory),AeroGear.DataManager.adapters.SessionLocal=function(t,r){if(!(this instanceof AeroGear.DataManager.adapters.SessionLocal))return new AeroGear.DataManager.adapters.SessionLocal(t,r);AeroGear.DataManager.adapters.Memory.apply(this,arguments);var n=r.storageType||"sessionStorage",a=t,i=document.location.pathname.replace(/[\/\.]/g,"-"),s=a+i,o=e[n].getItem(s),c=o?this.decrypt(JSON.parse(o),!0):null;c&&AeroGear.DataManager.adapters.Memory.prototype.save.call(this,c,!0),this.getStoreType=function(){return n},this.getStoreKey=function(){return s}},AeroGear.DataManager.adapters.SessionLocal.isValid=function(){return!(!e.localStorage||!e.sessionStorage)},AeroGear.DataManager.adapters.SessionLocal.prototype=Object.create(new AeroGear.DataManager.adapters.Memory,{save:{value:function(r,n){var a,i=jQuery.Deferred(),s=n&&n.reset?n.reset:!1,o=e[this.getStoreType()].getItem(this.getStoreKey()),c=this.getAsync();c?AeroGear.DataManager.adapters.Memory.prototype.save.apply(this,[arguments[0],{reset:s,async:c}]).then(function(e){a=e}):a=AeroGear.DataManager.adapters.Memory.prototype.save.apply(this,[arguments[0],{reset:s}]),i.always(this.always);try{e[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(this.encrypt(a))),n&&n.success&&n.storageSuccess(a)}catch(u){if(o=o?JSON.parse(o):[],c?AeroGear.DataManager.adapters.Memory.prototype.save.apply(this,[o,{reset:s,async:c}]).then(function(e){a=e}):a=AeroGear.DataManager.adapters.Memory.prototype.save.apply(this,[o,{reset:s}]),n&&n.error)return c?i.reject(r,"error",n?n.error:t):n.error(u,r);throw c&&i.reject(),u}return c?i.resolve(a,"success",n?n.success:t):a},enumerable:!0,configurable:!0,writable:!0},remove:{value:function(r,n){var a,i=jQuery.Deferred(),s=this.getAsync();return s?AeroGear.DataManager.adapters.Memory.prototype.remove.apply(this,[arguments[0],{async:!0}]).then(function(e){a=e}):a=AeroGear.DataManager.adapters.Memory.prototype.remove.apply(this,arguments),e[this.getStoreType()].setItem(this.getStoreKey(),JSON.stringify(this.encrypt(a))),s?(i.always(this.always),i.resolve(a,status,n?n.success:t)):a},enumerable:!0,configurable:!0,writable:!0}}),AeroGear.DataManager.validateAdapter("SessionLocal",AeroGear.DataManager.adapters.SessionLocal),AeroGear.DataManager.adapters.IndexedDB=function(t,r){if(!e.indexedDB)throw"Your browser doesn't support IndexedDB";if(!(this instanceof AeroGear.DataManager.adapters.IndexedDB))return new AeroGear.DataManager.adapters.IndexedDB(t,r);AeroGear.DataManager.adapters.base.apply(this,arguments),r=r||{};var n,a=r.auto;this.getDatabase=function(){return n},this.setDatabase=function(e){n=e},this.getStoreName=function(){return t},this.getAsync=function(){return!0},this.run=function(e){var t=this;if(n)e.call(this,n);else{if(!a)throw"Database not opened";this.open().always(function(r,a){if("error"===a)throw"Database not opened";e.call(t,n)})}}},AeroGear.DataManager.adapters.IndexedDB.isValid=function(){return!!e.indexedDB},AeroGear.DataManager.adapters.IndexedDB.prototype.open=function(t){t=t||{};var r,n,a=this,i=this.getStoreName(),s=this.getRecordId(),o=jQuery.Deferred();return r=e.indexedDB.open(i),r.onsuccess=function(e){n=e.target.result,a.setDatabase(n),o.resolve(n,"success",t.success)},r.onerror=function(e){o.reject(e,"error",t.error)},r.onupgradeneeded=function(e){n=e.target.result,n.createObjectStore(i,{keyPath:s})},o.always(this.always),o.promise()},AeroGear.DataManager.adapters.IndexedDB.prototype.read=function(e,t){t=t||{};var r,n,a,i,s,o=this,c=[],u=(this.getDatabase(),this.getStoreName()),h=jQuery.Deferred();return s=function(s){s.objectStoreNames.contains(u)||h.resolve([],"success",t.success),r=s.transaction(u),n=r.objectStore(u),e?(i=n.get(e),i.onsuccess=function(){c.push(i.result)}):(a=n.openCursor(),a.onsuccess=function(e){var t=e.target.result;t&&(c.push(t.value),t.continue())}),r.oncomplete=function(){h.resolve(o.decrypt(c),"success",t.success)},r.onerror=function(e){h.reject(e,"error",t.error)}},this.run.call(this,s),h.always(this.always),h.promise()},AeroGear.DataManager.adapters.IndexedDB.prototype.save=function(e,t){t=t||{};var r,n,a,i=this,s=(this.getDatabase(),this.getStoreName()),o=jQuery.Deferred(),c=0;return a=function(a){if(r=a.transaction(s,"readwrite"),n=r.objectStore(s),t.reset&&n.clear(),AeroGear.isArray(e))for(c;e.length>c;c++)n.put(this.encrypt(e[c]));else n.put(this.encrypt(e));r.oncomplete=function(){i.read().done(function(e,r){"success"===r?o.resolve(e,r,t.success):o.reject(e,r,t.error)})},r.onerror=function(e){o.reject(e,"error",t.error)}},this.run.call(this,a),o.always(this.always),o.promise()},AeroGear.DataManager.adapters.IndexedDB.prototype.remove=function(e,t){t=t||{};var r,n,a,i=this,s=this.getDatabase(),o=this.getStoreName(),c=jQuery.Deferred(),u=0;return a=function(){if(n=s.transaction(o,"readwrite"),r=n.objectStore(o),e)for(e=AeroGear.isArray(e)?e:[e],u;e.length>u;u++)if("string"==typeof e[u]||"number"==typeof e[u])r.delete(e[u]);else{if(!e)continue;r.delete(e[u][this.getRecordId()])}else r.clear();n.oncomplete=function(){i.read().done(function(e,r){"success"===r?c.resolve(e,r,t.success):c.reject(e,r,t.error)})},n.onerror=function(e){c.reject(e,"error",t.error)}},this.run.call(this,a),c.always(this.always),c.promise()},AeroGear.DataManager.adapters.IndexedDB.prototype.filter=function(e,r,n){n=n||{};var a,i=this,s=jQuery.Deferred();return this.getDatabase(),a=function(){this.read().then(function(a,o){return"success"!==o?(s.reject(a,o,n.error),t):(AeroGear.DataManager.adapters.Memory.prototype.save.call(i,a,!0),AeroGear.DataManager.adapters.Memory.prototype.filter.call(i,e,r).then(function(e){s.resolve(e,"success",n.success)}),t)})},this.run.call(this,a),s.always(this.always),s.promise()},AeroGear.DataManager.adapters.IndexedDB.prototype.close=function(){var e=this.getDatabase();e&&e.close()},AeroGear.DataManager.validateAdapter("IndexedDB",AeroGear.DataManager.adapters.IndexedDB),AeroGear.DataManager.adapters.WebSQL=function(t,r){if(!e.openDatabase)throw"Your browser doesn't support WebSQL";if(!(this instanceof AeroGear.DataManager.adapters.WebSQL))return new AeroGear.DataManager.adapters.WebSQL(t,r);AeroGear.DataManager.adapters.base.apply(this,arguments),r=r||{};var n,a=r.auto;this.getDatabase=function(){return n},this.setDatabase=function(e){n=e},this.getStoreName=function(){return t},this.getAsync=function(){return!0},this.run=function(e){var t=this;if(n)e.call(this,n);else{if(!a)throw"Database not opened";this.open().always(function(r,a){if("error"===a)throw"Database not opened";e.call(t,n)})}}},AeroGear.DataManager.adapters.WebSQL.isValid=function(){return!!e.openDatabase},AeroGear.DataManager.adapters.WebSQL.prototype.open=function(t){t=t||{};var r,n,a,i=this,s="1",o=2097152,c=this.getRecordId(),u=this.getStoreName(),h=jQuery.Deferred();return a=e.openDatabase(u,s,"AeroGear WebSQL Store",o),n=function(e,r){h.reject(r,"error",t.error)},r=function(){i.setDatabase(a),h.resolve(a,"success",t.success)},a.transaction(function(e){e.executeSql("CREATE TABLE IF NOT EXISTS "+u+" ( "+c+" REAL UNIQUE, json)",[],r,n)}),h.always(this.always),h.promise()},AeroGear.DataManager.adapters.WebSQL.prototype.read=function(e,t){t=t||{};var r,n,a,i,s=this,o=[],c=this.getStoreName(),u=(this.getDatabase(),jQuery.Deferred()),h=0;return i=function(i){n=function(e,r){u.reject(r,"error",t.error)},r=function(e,r){var n=r.rows.length;for(h;n>h;h++)o.push(JSON.parse(r.rows.item(h).json));u.resolve(s.decrypt(o),"success",t.success)},a="SELECT * FROM "+c,e&&(a+=" WHERE ID = '"+e+"'"),i.transaction(function(e){e.executeSql(a,[],r,n)})},this.run.call(this,i),u.always(this.always),u.promise()},AeroGear.DataManager.adapters.WebSQL.prototype.save=function(e,t){t=t||{};var r,n,a,i=this,s=this.getRecordId(),o=(this.getDatabase(),this.getStoreName()),c=jQuery.Deferred();return a=function(a){r=function(e,r){c.reject(r,"error",t.error)},n=function(){i.read().done(function(e,r){"success"===r?c.resolve(e,r,t.success):c.reject(e,r,t.error)})},e=AeroGear.isArray(e)?e:[e],a.transaction(function(r){t.reset&&(r.executeSql("DROP TABLE "+o),r.executeSql("CREATE TABLE IF NOT EXISTS "+o+" ( "+s+" REAL UNIQUE, json)")),e.forEach(function(e){e=i.encrypt(e),r.executeSql("INSERT OR REPLACE INTO "+o+" ( id, json ) VALUES ( ?, ? ) ",[e[s],JSON.stringify(e)])})},r,n)},this.run.call(this,a),c.always(this.always),c.promise()},AeroGear.DataManager.adapters.WebSQL.prototype.remove=function(e,t){t=t||{};var r,n,a,i,s=this,o=this.getStoreName(),c=(this.getDatabase(),jQuery.Deferred()),u=0;return i=function(i){a=function(e,r){c.reject(r,"error",t.error)},n=function(){s.read().done(function(e,r){"success"===r?c.resolve(e,r,t.success):c.reject(e,r,t.error)})},r="DELETE FROM "+o,e?(e=AeroGear.isArray(e)?e:[e],i.transaction(function(t){for(u;e.length>u;u++)if("string"==typeof e[u]||"number"==typeof e[u])t.executeSql(r+" WHERE ID = ? ",[e[u]]);else{if(!e)continue;t.executeSql(r+" WHERE ID = ? ",[e[u][this.getRecordId()]])}},a,n)):i.transaction(function(e){e.executeSql(r,[],n,a)})},this.run.call(this,i),c.always(this.always),c.promise()},AeroGear.DataManager.adapters.WebSQL.prototype.filter=function(e,r,n){n=n||{};var a,i=this,s=jQuery.Deferred();return this.getDatabase(),a=function(){this.read().then(function(a,o){return"success"!==o?(s.reject(a,o,n.error),t):(AeroGear.DataManager.adapters.Memory.prototype.save.call(i,a,!0),AeroGear.DataManager.adapters.Memory.prototype.filter.call(i,e,r).then(function(e){s.resolve(e,"success",n.success)}),t)})},this.run.call(this,a),s.always(this.always),s.promise()},AeroGear.DataManager.validateAdapter("WebSQL",AeroGear.DataManager.adapters.WebSQL),AeroGear.Auth=function(e){return this instanceof AeroGear.Auth?(AeroGear.Core.call(this),this.lib="Auth",this.type=e?e.type||"Rest":"Rest",this.collectionName="modules",this.add(e),t):new AeroGear.Auth(e)},AeroGear.Auth.prototype=AeroGear.Core,AeroGear.Auth.constructor=AeroGear.Auth,AeroGear.Auth.adapters={},AeroGear.Auth.adapters.Rest=function(e,t){if(!(this instanceof AeroGear.Auth.adapters.Rest))return new AeroGear.Auth.adapters.Rest(e,t);t=t||{};var r=t.endpoints||{},n=e,a=t.baseURL||"";this.getSettings=function(){return t},this.getEndpoints=function(){return r},this.getName=function(){return n},this.getBaseURL=function(){return a},this.processOptions=function(e){var t={};return e.contentType&&(t.contentType=e.contentType),e.dataType&&(t.dataType=e.dataType),t.url=e.baseURL?e.baseURL:a,e.xhrFields&&(t.xhrFields=e.xhrFields),t}},AeroGear.Auth.adapters.Rest.prototype.enroll=function(e,t){t=t||{};var r=(this.getName(),this.getEndpoints()),n=function(){t.success&&t.success.apply(this,arguments)},a=function(e,r,n){var a;try{e.responseJSON=JSON.parse(e.responseText),a=[e,r,n]}catch(i){a=arguments}t.error&&t.error.apply(this,a)},i=jQuery.extend({},this.processOptions(t),{complete:t.complete,success:n,error:a,data:e});return i.url+=r.enroll?r.enroll:"auth/enroll","application/json"===i.contentType&&i.data&&"string"!=typeof i.data&&(i.data=JSON.stringify(i.data)),jQuery.ajax(jQuery.extend({},this.getSettings(),{type:"POST"},i))},AeroGear.Auth.adapters.Rest.prototype.login=function(e,t){t=t||{};var r=(this.getName(),this.getEndpoints()),n=function(){t.success&&t.success.apply(this,arguments)},a=function(e,r,n){var a;try{e.responseJSON=JSON.parse(e.responseText),a=[e,r,n]}catch(i){a=arguments}t.error&&t.error.apply(this,a)},i=jQuery.extend({},this.processOptions(t),{complete:t.complete,success:n,error:a,data:e});return i.url+=r.login?r.login:"auth/login","application/json"===i.contentType&&i.data&&"string"!=typeof i.data&&(i.data=JSON.stringify(i.data)),jQuery.ajax(jQuery.extend({},this.getSettings(),{type:"POST"},i))},AeroGear.Auth.adapters.Rest.prototype.logout=function(e){e=e||{};var t=(this.getName(),this.getEndpoints()),r=function(){e.success&&e.success.apply(this,arguments)},n=function(t,r,n){var a;try{t.responseJSON=JSON.parse(t.responseText),a=[t,r,n]}catch(i){a=arguments}e.error&&e.error.apply(this,a)},a=jQuery.extend({},this.processOptions(e),{complete:e.complete,success:r,error:n});return a.url+=t.logout?t.logout:"auth/logout",jQuery.ajax(jQuery.extend({},this.getSettings(),{type:"POST"},a))},AeroGear.Authorization=function(e){return this instanceof AeroGear.Authorization?(AeroGear.Core.call(this),this.lib="Authorization",this.type=e?e.type||"OAuth2":"OAuth2",this.collectionName="services",this.add(e),t):new AeroGear.Authorization(e)},AeroGear.Authorization.prototype=AeroGear.Core,AeroGear.Authorization.constructor=AeroGear.Authorization,AeroGear.Authorization.adapters={},AeroGear.Authorization.adapters.OAuth2=function(e,t){if(!(this instanceof AeroGear.Authorization.adapters.OAuth2))return new AeroGear.Authorization.adapters.OAuth2(e,t);t=t||{};var r,n=uuid(),a=t.clientId,i=t.redirectURL,s=t.validationEndpoint,o=t.scopes,c="ag-oauth2-"+a,u=t.authEndpoint+"?"+"response_type=token"+"&redirect_uri="+encodeURIComponent(i)+"&scope="+encodeURIComponent(o)+"&state="+encodeURIComponent(n)+"&client_id="+encodeURIComponent(a);this.getAccessToken=function(){return localStorage[c]&&(r=JSON.parse(localStorage[c]).accessToken),r},this.getState=function(){return n},this.getClientId=function(){return a},this.getLocalStorageName=function(){return c},this.getValidationEndpoint=function(){return s},this.createError=function(e){return e=e||{},AeroGear.extend(e,{authURL:u})},this.parseQueryString=function(e){for(var t,r={},n=e.substr(e.indexOf("#")+1),a=/([^&=]+)=([^&]*)/g;t=a.exec(n);)r[decodeURIComponent(t[1])]=decodeURIComponent(t[2]);return r}},AeroGear.Authorization.adapters.OAuth2.prototype.validate=function(e,r){r=r||{};var n,a,i=this,s=this.parseQueryString(e),o=this.getState();return a=function(){localStorage.setItem(i.getLocalStorageName(),JSON.stringify({accessToken:s.access_token})),r.success&&r.success.apply(this,arguments)},n=function(e){r.error&&r.error.call(this,i.createError(e))},s.error?(n.call(this,s),t):s.state!==o?(n.call(this,{error:"invalid_request",state:o,error_description:"state's do not match"}),t):(this.getValidationEndpoint()?jQuery.ajax({url:this.getValidationEndpoint()+"?access_token="+s.access_token,success:function(e){return i.getClientId()!==e.audience?(n.call(this,{error:"invalid_token"}),t):(a.call(this,s),t)},error:function(){n.call(this,{error:"invalid_token"})}}):a.call(this,s),t)},AeroGear.Authorization.adapters.OAuth2.prototype.execute=function(e){e=e||{};var t,r,n=this,a=e.url+"?access_token="+this.getAccessToken(),i="application/x-www-form-urlencoded";return t=function(){e.success&&e.success.apply(this,arguments)},r=function(t){e.error&&e.error.call(this,n.createError(t))},jQuery.ajax({url:a,type:e.type,contentType:i,success:t,error:r})},AeroGear.Notifier=function(e){return this instanceof AeroGear.Notifier?(AeroGear.Core.call(this),this.lib="Notifier",this.type=e?e.type||"vertx":"vertx",this.collectionName="clients",this.add(e),t):new AeroGear.Notifier(e)},AeroGear.Notifier.prototype=AeroGear.Core,AeroGear.Notifier.constructor=AeroGear.Notifier,AeroGear.Notifier.adapters={},AeroGear.Notifier.CONNECTING=0,AeroGear.Notifier.CONNECTED=1,AeroGear.Notifier.DISCONNECTING=2,AeroGear.Notifier.DISCONNECTED=3,AeroGear.Notifier.adapters.SimplePush=function(e,t){if(!(this instanceof AeroGear.Notifier.adapters.SimplePush))return new AeroGear.Notifier.adapters.SimplePush(e,t);t=t||{};var r=e,n=t.connectURL||"",a=t.useNative||!1,i=null,s=JSON.parse(localStorage.getItem("ag-push-store")||"{}");s.channels=s.channels||[];for(var o in s.channels)s.channels[o].state="available";localStorage.setItem("ag-push-store",JSON.stringify(s)),this.getSettings=function(){return t},this.getName=function(){return r},this.getConnectURL=function(){return n},this.setConnectURL=function(e){n=e},this.getUseNative=function(){return a},this.getClient=function(){return i},this.setClient=function(e){i=e},this.getPushStore=function(){return s},this.setPushStore=function(e){s=e,localStorage.setItem("ag-push-store",JSON.stringify(e))},this.processMessage=function(e){var t,r;if("register"===e.messageType&&200===e.status)t={channelID:e.channelID,version:e.version,state:"used"},s.channels=this.updateChannel(s.channels,t),this.setPushStore(s),t.pushEndpoint=e.pushEndpoint,jQuery(navigator.push).trigger(jQuery.Event(e.channelID+"-success",{target:{result:t}}));else{if("register"===e.messageType)throw"SimplePushRegistrationError";if("unregister"===e.messageType&&200===e.status)s.channels.splice(this.findChannelIndex(s.channels,"channelID",e.channelID),1),this.setPushStore(s);else{if("unregister"===e.messageType)throw"SimplePushUnregistrationError";if("notification"===e.messageType){r=e.updates;for(var n=0,a=r.length;a>n;n++)jQuery(navigator.push).trigger(jQuery.Event("push",{message:r[n]}));e.messageType="ack",i.send(JSON.stringify(e))}}}},this.generateHello=function(){var e=s.channels,t={messageType:"hello",uaid:"",channelIDs:[]};if(s.uaid&&(t.uaid=s.uaid),e&&""!==t.uaid)for(var r=e.length,n=r-1;n>-1;n--)t.channelIDs.push(s.channels[n].channelID);return JSON.stringify(t)},this.findChannelIndex=function(e,t,r){for(var n=0;e.length>n;n++)if(e[n][t]===r)return n},this.updateChannel=function(e,t){for(var r=0;e.length>r;r++)if(e[r].channelID===t.channelID){e[r].version=t.version,e[r].state=t.state;break}return e},this.bindSubscribeSuccess=function(e,t){jQuery(navigator.push).off(e+"-success"),jQuery(navigator.push).on(e+"-success",function(e){t.onsuccess(e)})}},AeroGear.Notifier.adapters.SimplePush.prototype.connect=function(e){e=e||{};var t=this,r=this.getUseNative()?new WebSocket(e.url||this.getConnectURL()):new SockJS(e.url||this.getConnectURL());r.onopen=function(){r.send(t.generateHello())},r.onerror=function(){e.onConnectError&&e.onConnectError.apply(this,arguments)},r.onmessage=function(r){var n=t.getPushStore();r=JSON.parse(r.data),"hello"===r.messageType?(r.uaid!==n.uaid&&(n.uaid=r.uaid,t.setPushStore(n)),e.onConnect&&e.onConnect(r)):t.processMessage(r)},r.onclose=function(){e.onClose&&e.onClose.apply(this,arguments)},this.setClient(r)},AeroGear.Notifier.adapters.SimplePush.prototype.disconnect=function(e){var t=this.getClient();t.close(),e&&e()},AeroGear.Notifier.adapters.SimplePush.prototype.subscribe=function(e,r){var n,a,i=!1,s=this.getClient(),o=this.getPushStore();r&&this.unsubscribe(this.getChannels()),e=AeroGear.isArray(e)?e:[e],o.channels=o.channels||[],a=o.channels.length;for(var c=0;e.length>c;c++)a&&(n=this.findChannelIndex(o.channels,"state","available"),n!==t&&(this.bindSubscribeSuccess(o.channels[n].channelID,e[c].requestObject),e[c].channelID=o.channels[n].channelID,e[c].state="used",setTimeout(function(e){return function(){jQuery(navigator.push).trigger(jQuery.Event(e.channelID+"-success",{target:{result:e}}))}}(e[c]),0),o.channels[n]=e[c],i=!0)),i||(e[c].channelID=e[c].channelID||uuid(),e[c].state="used",this.bindSubscribeSuccess(e[c].channelID,e[c].requestObject),s.send('{"messageType": "register", "channelID": "'+e[c].channelID+'"}'),o.channels.push(e[c])),i=!1;this.setPushStore(o)},AeroGear.Notifier.adapters.SimplePush.prototype.unsubscribe=function(e){var t=this.getClient();e=AeroGear.isArray(e)?e:[e];for(var r=0;e.length>r;r++)t.send('{"messageType": "unregister", "channelID": "'+e[r].channelID+'"}')},AeroGear.Notifier.adapters.vertx=function(e,t){if(!(this instanceof AeroGear.Notifier.adapters.vertx))return new AeroGear.Notifier.adapters.vertx(e,t);t=t||{};var r=t.channels||[],n=!!t.autoConnect||r.length,a=t.connectURL||"",i=AeroGear.Notifier.CONNECTING,s=null;this.getConnectURL=function(){return a},this.setConnectURL=function(e){a=e},this.getChannels=function(){return r},this.addChannel=function(e){r.push(e)},this.getChannelIndex=function(e){for(var t=0;r.length>t;t++)if(r[t].address===e)return t;return-1},this.removeChannel=function(e){var t=this.getChannelIndex(e.address);t>=0&&r.splice(t,1)},this.getState=function(){return i},this.setState=function(e){i=e},this.getBus=function(){return s},this.setBus=function(e){s=e},(n||r.length)&&this.connect({url:a,onConnect:t.onConnect,onDisconnect:t.onDisconnect,onConnectError:t.onConnectError})},AeroGear.Notifier.adapters.vertx.prototype.connect=function(e){e=e||{};var t=this,r=new vertx.EventBus(e.url||this.getConnectURL());r.onopen=function(){var r=t.getChannels().slice(0);t.setState(AeroGear.Notifier.CONNECTED),t.subscribe(r,!0),e.onConnect&&e.onConnect.apply(this,arguments)},r.onclose=function(){t.getState()===AeroGear.Notifier.DISCONNECTING?(t.setState(AeroGear.Notifier.DISCONNECTED),e.onDisconnect&&e.onDisconnect.apply(this,arguments)):e.onConnectError&&e.onConnectError.apply(this,arguments)},this.setBus(r)},AeroGear.Notifier.adapters.vertx.prototype.disconnect=function(){var e=this.getBus();this.getState()===AeroGear.Notifier.CONNECTED&&(this.setState(AeroGear.Notifier.DISCONNECTING),e.close())},AeroGear.Notifier.adapters.vertx.prototype.subscribe=function(e,t){var r=this.getBus();t&&this.unsubscribe(this.getChannels()),e=AeroGear.isArray(e)?e:[e];for(var n=0;e.length>n;n++)this.addChannel(e[n]),r.registerHandler(e[n].address,e[n].callback)},AeroGear.Notifier.adapters.vertx.prototype.unsubscribe=function(e){var t=this.getBus();e=AeroGear.isArray(e)?e:[e];for(var r=0;e.length>r;r++)this.removeChannel(e[r]),t.unregisterHandler(e[r].address,e[r].callback)},AeroGear.Notifier.adapters.vertx.prototype.send=function(e,t,r){var n=this.getBus();typeof t!==Boolean||r||(r=t,t=""),t=t||"",n[r?"publish":"send"](e,t)},AeroGear.Notifier.adapters.stompws=function(e,t){if(!(this instanceof AeroGear.Notifier.adapters.stompws))return new AeroGear.Notifier.adapters.stompws(e,t);t=t||{};var r=t.channels||[],n=!!t.autoConnect||r.length,a=t.connectURL||"",i=AeroGear.Notifier.CONNECTING,s=null;this.getConnectURL=function(){return a},this.setConnectURL=function(e){a=e},this.getChannels=function(){return r},this.addChannel=function(e){r.push(e)},this.getChannelIndex=function(e){for(var t=0;r.length>t;t++)if(r[t].address===e)return t;return-1},this.removeChannel=function(e){var t=this.getChannelIndex(e.address);
-t>=0&&r.splice(t,1)},this.getState=function(){return i},this.setState=function(e){i=e},this.getClient=function(){return s},this.setClient=function(e){s=e},!n&&!r.length||t.login||t.password||this.connect({url:a,onConnect:t.onConnect,onConnectError:t.onConnectError})},AeroGear.Notifier.adapters.stompws.prototype.connect=function(e){e=e||{};var t=this,r=new Stomp.client(e.url||this.getConnectURL(),e.protocol||"v11.stomp"),n=function(){var r=t.getChannels().slice(0);t.setState(AeroGear.Notifier.CONNECTED),t.subscribe(r,!0),e.onConnect&&e.onConnect.apply(this,arguments)},a=function(){t.setState(AeroGear.Notifier.DISCONNECTED),e.onConnectError&&e.onConnectError.apply(this,arguments)};r.connect(e.login,e.password,n,a,e.host),this.setClient(r)},AeroGear.Notifier.adapters.stompws.prototype.disconnect=function(e){var t=this,r=this.getClient(),n=function(){t.getState()===AeroGear.Notifier.DISCONNECTING&&(t.setState(AeroGear.Notifier.DISCONNECTED),e&&e.apply(this,arguments))};this.getState()===AeroGear.Notifier.CONNECTED&&(this.setState(AeroGear.Notifier.DISCONNECTING),r.disconnect(n))},AeroGear.Notifier.adapters.stompws.prototype.subscribe=function(e,t){var r=this.getClient();t&&this.unsubscribe(this.getChannels()),e=AeroGear.isArray(e)?e:[e];for(var n=0;e.length>n;n++)e[n].id=r.subscribe(e[n].address,e[n].callback),this.addChannel(e[n])},AeroGear.Notifier.adapters.stompws.prototype.debug=function(e){var t=this.getClient(),r=function(){e&&e.apply(this,arguments)};t&&(t.debug=r)},AeroGear.Notifier.adapters.stompws.prototype.unsubscribe=function(e){var t=this.getClient(),r=this.getChannels();e=AeroGear.isArray(e)?e:[e];for(var n=0;e.length>n;n++)t.unsubscribe(e[n].id||r[this.getChannelIndex(e[n].address)].id),this.removeChannel(e[n])},AeroGear.Notifier.adapters.stompws.prototype.send=function(e,t){var r={},n=this.getClient();t=t||"",t.headers&&(r=t.headers,t=t.body),n.send(e,r,t)},function(r,n){r.UnifiedPushClient=function(a,i,s){if(!a||!i||!s)throw"UnifiedPushClientException";return this instanceof r.UnifiedPushClient?(this.registerWithPushServer=function(t){t=t||{};var o=t.metadata||{};if(!o.deviceToken)throw"UnifiedPushRegistrationException";return o.categories=r.isArray(o.categories)?o.categories:o.categories?[o.categories]:[],n.ajax({contentType:"application/json",dataType:"json",type:"POST",url:s,headers:{Authorization:"Basic "+e.btoa(a+":"+i)},data:JSON.stringify(o),success:t.success,error:t.error,complete:t.complete})},this.unregisterWithPushServer=function(t,r){return r=r||{},n.ajax({contentType:"application/json",dataType:"json",type:"DELETE",url:s+"/"+t,headers:{Authorization:"Basic "+e.btoa(a+":"+i)},success:r.success,error:r.error,complete:r.complete})},t):new r.UnifiedPushClient(a,i,s)}}(AeroGear,jQuery),function(t,r){t.SimplePushClient=function(n){if(!(this instanceof t.SimplePushClient))return new t.SimplePushClient(n);if(this.options=n||{},!navigator.push||!this.options.useNative){if(this.options.useNative)if("WebSocket"in e)this.options.simplePushServerURL="wss://push.services.mozilla.com";else{if(!this.options.simplePushServerURL)throw"SimplePushConfigurationError";this.options.useNative=!1}var a=this,i={onConnect:function(){navigator.push=function(){return{register:function(){var e={onsuccess:function(){}};if(!a.simpleNotifier)throw"SimplePushConnectionError";return a.simpleNotifier.subscribe({requestObject:e,callback:function(e){r(navigator.push).trigger({type:"push",message:e})}}),e},unregister:function(e){a.simpleNotifier.unsubscribe(e)},reconnect:function(){a.simpleNotifier.connect(i)}}}(),navigator.setMessageHandler=function(e,t){r(navigator.push).on(e,function(e){var r=e.message;t.call(this,r)})},a.options.onConnect&&a.options.onConnect()},onClose:function(){a.simpleNotifier.disconnect(a.options.onClose)}};a.simpleNotifier=t.Notifier({name:"agPushNetwork",type:"SimplePush",settings:{connectURL:a.options.simplePushServerURL,useNative:a.options.useNative}}).clients.agPushNetwork,a.simpleNotifier.connect(i)}}}(AeroGear,jQuery),AeroGear.Crypto=function(){if(!e.crypto||!e.crypto.getRandomValues)throw"Your browser does not support the Web Crypto API";if(!(this instanceof AeroGear.Crypto))return new AeroGear.Crypto;var t,r,n,a;this.getSalt=function(){return a},this.getIV=function(){return n},this.getPrivateKey=function(){return t},this.getPublicKey=function(){return r},this.getRandomValue=function(){var e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]},this.deriveKey=function(e,t){a=t||(a?a:this.getRandomValue());var r=h.codec.utf8String,n=2048;return h.misc.pbkdf2(e,r.toBits(a),n)},this.encrypt=function(e){e=e||{};var t=h.mode.gcm,r=new h.cipher.aes(e.key);return n=e.IV||(n?n:this.getRandomValue()),t.encrypt(r,e.data,n,e.aad,128)},this.decrypt=function(e){e=e||{};var t=h.mode.gcm,r=new h.cipher.aes(e.key);return t.decrypt(r,e.data,e.IV||n,e.aad,128)},this.hash=function(e){return h.hash.sha256.hash(e)},this.sign=function(e){e=e||{};var t=e.keys||h.ecc.ecdsa.generateKeys(192),r=h.hash.sha256.hash(e.message);return t.sec.sign(r)},this.verify=function(e){e=e||{};var t=h.hash.sha256.hash(e.message);return e.keys.pub.verify(t,e.signature)},this.KeyPair=function(e,n){var a,i;return e&&n?(t=e,r=n):(a=h.ecc.elGamal.generateKeys(192,0),i=a.pub.kem(),r=i.key,t=a.sec.unkem(i.tag)),this}}})(this);
-//@ sourceMappingURL=aerogear.js.map
diff --git a/examples/protocols/stomp/stomp-websockets/aerogear-chat/stomp.js b/examples/protocols/stomp/stomp-websockets/aerogear-chat/stomp.js
deleted file mode 100644
index 97b55db077..0000000000
--- a/examples/protocols/stomp/stomp-websockets/aerogear-chat/stomp.js
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Generated by CoffeeScript 1.4.0
-(function() {
- var Byte, Client, Frame, Stomp,
- __hasProp = {}.hasOwnProperty;
-
- Byte = {
- LF: '\x0A',
- NULL: '\x00'
- };
-
- Frame = (function() {
-
- function Frame(command, headers, body) {
- this.command = command;
- this.headers = headers != null ? headers : {};
- this.body = body != null ? body : '';
- }
-
- Frame.prototype.toString = function() {
- var lines, name, value, _ref;
- lines = [this.command];
- _ref = this.headers;
- for (name in _ref) {
- if (!__hasProp.call(_ref, name)) continue;
- value = _ref[name];
- lines.push("" + name + ":" + value);
- }
- if (this.body) {
- lines.push("content-length:" + ('' + this.body).length);
- }
- lines.push(Byte.LF + this.body);
- return lines.join(Byte.LF);
- };
-
- Frame._unmarshallSingle = function(data) {
- var body, chr, command, divider, headerLines, headers, i, idx, len, line, start, trim, _i, _j, _ref, _ref1;
- divider = data.search(RegExp("" + Byte.LF + Byte.LF));
- headerLines = data.substring(0, divider).split(Byte.LF);
- command = headerLines.shift();
- headers = {};
- trim = function(str) {
- return str.replace(/^\s+|\s+$/g, '');
- };
- line = idx = null;
- for (i = _i = 0, _ref = headerLines.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
- line = headerLines[i];
- idx = line.indexOf(':');
- headers[trim(line.substring(0, idx))] = trim(line.substring(idx + 1));
- }
- body = '';
- start = divider + 2;
- if (headers['content-length']) {
- len = parseInt(headers['content-length']);
- body = ('' + data).substring(start, start + len);
- } else {
- chr = null;
- for (i = _j = start, _ref1 = data.length; start <= _ref1 ? _j < _ref1 : _j > _ref1; i = start <= _ref1 ? ++_j : --_j) {
- chr = data.charAt(i);
- if (chr === Byte.NULL) {
- break;
- }
- body += chr;
- }
- }
- return new Frame(command, headers, body);
- };
-
- Frame.unmarshall = function(datas) {
- var data;
- return (function() {
- var _i, _len, _ref, _results;
- _ref = datas.split(RegExp("" + Byte.NULL + Byte.LF + "*"));
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- data = _ref[_i];
- if ((data != null ? data.length : void 0) > 0) {
- _results.push(Frame._unmarshallSingle(data));
- }
- }
- return _results;
- })();
- };
-
- Frame.marshall = function(command, headers, body) {
- var frame;
- frame = new Frame(command, headers, body);
- return frame.toString() + Byte.NULL;
- };
-
- return Frame;
-
- })();
-
- Client = (function() {
-
- function Client(ws) {
- this.ws = ws;
- this.ws.binaryType = "arraybuffer";
- this.counter = 0;
- this.connected = false;
- this.heartbeat = {
- outgoing: 10000,
- incoming: 10000
- };
- this.subscriptions = {};
- }
-
- Client.prototype._transmit = function(command, headers, body) {
- var out;
- out = Frame.marshall(command, headers, body);
- if (typeof this.debug === "function") {
- this.debug(">>> " + out);
- }
- return this.ws.send(out);
- };
-
- Client.prototype._setupHeartbeat = function(headers) {
- var serverIncoming, serverOutgoing, ttl, v, _ref, _ref1,
- _this = this;
- if ((_ref = headers.version) !== Stomp.VERSIONS.V1_1 && _ref !== Stomp.VERSIONS.V1_2) {
- return;
- }
- _ref1 = (function() {
- var _i, _len, _ref1, _results;
- _ref1 = headers['heart-beat'].split(",");
- _results = [];
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
- v = _ref1[_i];
- _results.push(parseInt(v));
- }
- return _results;
- })(), serverOutgoing = _ref1[0], serverIncoming = _ref1[1];
- if (!(this.heartbeat.outgoing === 0 || serverIncoming === 0)) {
- ttl = Math.max(this.heartbeat.outgoing, serverIncoming);
- if (typeof this.debug === "function") {
- this.debug("send PING every " + ttl + "ms");
- }
- this.pinger = typeof window !== "undefined" && window !== null ? window.setInterval(function() {
- _this.ws.send(Byte.LF);
- return typeof _this.debug === "function" ? _this.debug(">>> PING") : void 0;
- }, ttl) : void 0;
- }
- if (!(this.heartbeat.incoming === 0 || serverOutgoing === 0)) {
- ttl = Math.max(this.heartbeat.incoming, serverOutgoing);
- if (typeof this.debug === "function") {
- this.debug("check PONG every " + ttl + "ms");
- }
- return this.ponger = typeof window !== "undefined" && window !== null ? window.setInterval(function() {
- var delta;
- delta = Date.now() - _this.serverActivity;
- if (delta > ttl * 2) {
- if (typeof _this.debug === "function") {
- _this.debug("did not receive server activity for the last " + delta + "ms");
- }
- return _this.ws.close();
- }
- }, ttl) : void 0;
- }
- };
-
- Client.prototype.connect = function(login, passcode, connectCallback, errorCallback, vhost) {
- var _this = this;
- this.connectCallback = connectCallback;
- if (typeof this.debug === "function") {
- this.debug("Opening Web Socket...");
- }
- this.ws.onmessage = function(evt) {
- var arr, c, data, frame, onreceive, _i, _len, _ref, _results;
- data = typeof ArrayBuffer !== 'undefined' && evt.data instanceof ArrayBuffer ? (arr = new Uint8Array(evt.data), typeof _this.debug === "function" ? _this.debug("--- got data length: " + arr.length) : void 0, ((function() {
- var _i, _len, _results;
- _results = [];
- for (_i = 0, _len = arr.length; _i < _len; _i++) {
- c = arr[_i];
- _results.push(String.fromCharCode(c));
- }
- return _results;
- })()).join('')) : evt.data;
- _this.serverActivity = Date.now();
- if (data === Byte.LF) {
- if (typeof _this.debug === "function") {
- _this.debug("<<< PONG");
- }
- return;
- }
- if (typeof _this.debug === "function") {
- _this.debug("<<< " + data);
- }
- _ref = Frame.unmarshall(data);
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- frame = _ref[_i];
- switch (frame.command) {
- case "CONNECTED":
- if (typeof _this.debug === "function") {
- _this.debug("connected to server " + frame.headers.server);
- }
- _this.connected = true;
- _this._setupHeartbeat(frame.headers);
- _results.push(typeof _this.connectCallback === "function" ? _this.connectCallback(frame) : void 0);
- break;
- case "MESSAGE":
- onreceive = _this.subscriptions[frame.headers.subscription];
- _results.push(typeof onreceive === "function" ? onreceive(frame) : void 0);
- break;
- case "RECEIPT":
- _results.push(typeof _this.onreceipt === "function" ? _this.onreceipt(frame) : void 0);
- break;
- case "ERROR":
- _results.push(typeof errorCallback === "function" ? errorCallback(frame) : void 0);
- break;
- default:
- _results.push(typeof _this.debug === "function" ? _this.debug("Unhandled frame: " + frame) : void 0);
- }
- }
- return _results;
- };
- this.ws.onclose = function() {
- var msg;
- msg = "Whoops! Lost connection to " + _this.ws.url;
- if (typeof _this.debug === "function") {
- _this.debug(msg);
- }
- _this._cleanUp();
- return typeof errorCallback === "function" ? errorCallback(msg) : void 0;
- };
- return this.ws.onopen = function() {
- var headers;
- if (typeof _this.debug === "function") {
- _this.debug('Web Socket Opened...');
- }
- headers = {
- "accept-version": Stomp.VERSIONS.supportedVersions(),
- "heart-beat": [_this.heartbeat.outgoing, _this.heartbeat.incoming].join(',')
- };
- if (vhost) {
- headers.host = vhost;
- }
- if (login) {
- headers.login = login;
- }
- if (passcode) {
- headers.passcode = passcode;
- }
- return _this._transmit("CONNECT", headers);
- };
- };
-
- Client.prototype.disconnect = function(disconnectCallback) {
- this._transmit("DISCONNECT");
- this.ws.onclose = null;
- this.ws.close();
- this._cleanUp();
- return typeof disconnectCallback === "function" ? disconnectCallback() : void 0;
- };
-
- Client.prototype._cleanUp = function() {
- this.connected = false;
- if (this.pinger) {
- if (typeof window !== "undefined" && window !== null) {
- window.clearInterval(this.pinger);
- }
- }
- if (this.ponger) {
- return typeof window !== "undefined" && window !== null ? window.clearInterval(this.ponger) : void 0;
- }
- };
-
- Client.prototype.send = function(destination, headers, body) {
- if (headers == null) {
- headers = {};
- }
- if (body == null) {
- body = '';
- }
- headers.destination = destination;
- return this._transmit("SEND", headers, body);
- };
-
- Client.prototype.subscribe = function(destination, callback, headers) {
- if (headers == null) {
- headers = {};
- }
- if (!headers.id) {
- headers.id = "sub-" + this.counter++;
- }
- headers.destination = destination;
- this.subscriptions[headers.id] = callback;
- this._transmit("SUBSCRIBE", headers);
- return headers.id;
- };
-
- Client.prototype.unsubscribe = function(id) {
- delete this.subscriptions[id];
- return this._transmit("UNSUBSCRIBE", {
- id: id
- });
- };
-
- Client.prototype.begin = function(transaction) {
- return this._transmit("BEGIN", {
- transaction: transaction
- });
- };
-
- Client.prototype.commit = function(transaction) {
- return this._transmit("COMMIT", {
- transaction: transaction
- });
- };
-
- Client.prototype.abort = function(transaction) {
- return this._transmit("ABORT", {
- transaction: transaction
- });
- };
-
- Client.prototype.ack = function(messageID, subscription, headers) {
- if (headers == null) {
- headers = {};
- }
- headers["message-id"] = messageID;
- headers.subscription = subscription;
- return this._transmit("ACK", headers);
- };
-
- Client.prototype.nack = function(messageID, subscription, headers) {
- if (headers == null) {
- headers = {};
- }
- headers["message-id"] = messageID;
- headers.subscription = subscription;
- return this._transmit("NACK", headers);
- };
-
- return Client;
-
- })();
-
- Stomp = {
- libVersion: "2.0.0-next",
- VERSIONS: {
- V1_0: '1.0',
- V1_1: '1.1',
- V1_2: '1.2',
- supportedVersions: function() {
- return '1.1,1.0';
- }
- },
- client: function(url, protocols) {
- var klass, ws;
- if (protocols == null) {
- protocols = ['v10.stomp', 'v11.stomp'];
- }
- klass = Stomp.WebSocketClass || WebSocket;
- ws = new klass(url, protocols);
- return new Client(ws);
- },
- over: function(ws) {
- return new Client(ws);
- },
- Frame: Frame
- };
-
- if (typeof window !== "undefined" && window !== null) {
- window.Stomp = Stomp;
- } else if (typeof exports !== "undefined" && exports !== null) {
- exports.Stomp = Stomp;
- Stomp.WebSocketClass = require('./test/server.mock.js').StompServerMock;
- } else {
- self.Stomp = Stomp;
- }
-
-}).call(this);
diff --git a/integration/activemq-aerogear-integration/pom.xml b/integration/activemq-aerogear-integration/pom.xml
deleted file mode 100644
index d11319a33b..0000000000
--- a/integration/activemq-aerogear-integration/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
- 4.0.0
-
-
- org.apache.activemq
- artemis-pom
- 2.0.0-SNAPSHOT
- ../../pom.xml
-
-
- artemis-aerogear-integration
- jar
- ActiveMQ Artemis Aerogear Integration
-
-
- ${project.basedir}/../..
-
-
-
-
- org.jboss.logging
- jboss-logging-processor
- provided
- true
-
-
-
-
- org.jboss.logging
- jboss-logging
-
-
- org.apache.activemq
- artemis-server
- ${project.version}
-
-
-
- org.jboss.aerogear
- unifiedpush-java-client
- 1.0.0
-
-
-
- org.jboss.resteasy
- resteasy-jackson-provider
- 2.3.2.Final
-
-
- org.jboss.spec.javax.annotation
- jboss-annotations-api_1.1_spec
-
-
-
-
-
-
diff --git a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearBundle.java b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearBundle.java
deleted file mode 100644
index 5855abefff..0000000000
--- a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearBundle.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.integration.aerogear;
-
-import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
-import org.jboss.logging.Messages;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageBundle;
-
-/**
- * Logger Code 23
- *
- * each message id must be 6 digits long starting with 10, the 3rd digit should be 9
- *
- * so 239000 to 239999
- */
-@MessageBundle(projectCode = "AMQ")
-public interface ActiveMQAeroGearBundle {
-
- ActiveMQAeroGearBundle BUNDLE = Messages.getBundle(ActiveMQAeroGearBundle.class);
-
- @Message(id = 239000, value = "endpoint can not be null")
- ActiveMQIllegalStateException endpointNull();
-
- @Message(id = 239001, value = "application-id can not be null")
- ActiveMQIllegalStateException applicationIdNull();
-
- @Message(id = 239002, value = "master-secret can not be null")
- ActiveMQIllegalStateException masterSecretNull();
-
- @Message(id = 239003, value = "{0}: queue {1} not found", format = Message.Format.MESSAGE_FORMAT)
- ActiveMQIllegalStateException noQueue(String connectorName, String queueName);
-}
diff --git a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java
deleted file mode 100644
index 66c000e209..0000000000
--- a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/ActiveMQAeroGearLogger.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.integration.aerogear;
-
-import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Logger;
-import org.jboss.logging.annotations.LogMessage;
-import org.jboss.logging.annotations.Message;
-import org.jboss.logging.annotations.MessageLogger;
-
-/**
- * Logger Code 23
- *
- * each message id must be 6 digits long starting with 18, the 3rd digit donates the level so
- *
- * INF0 1
- * WARN 2
- * DEBUG 3
- * ERROR 4
- * TRACE 5
- * FATAL 6
- *
- * so an INFO message would be 181000 to 181999
- */
-@MessageLogger(projectCode = "AMQ")
-public interface ActiveMQAeroGearLogger extends BasicLogger {
-
- /**
- * The aerogear logger.
- */
- ActiveMQAeroGearLogger LOGGER = Logger.getMessageLogger(ActiveMQAeroGearLogger.class, ActiveMQAeroGearLogger.class.getPackage().getName());
-
- @LogMessage(level = Logger.Level.INFO)
- @Message(id = 231001, value = "aerogear connector connected to {0}", format = Message.Format.MESSAGE_FORMAT)
- void connected(String endpoint);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 232003, value = "removing aerogear connector as credentials are invalid", format = Message.Format.MESSAGE_FORMAT)
- void reply401();
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 232004, value = "removing aerogear connector as endpoint is invalid", format = Message.Format.MESSAGE_FORMAT)
- void reply404();
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 232005, value = "removing aerogear connector as unexpected response {0} returned", format = Message.Format.MESSAGE_FORMAT)
- void replyUnknown(int status);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 232006, value = "unable to connect to aerogear server, retrying in {0} seconds", format = Message.Format.MESSAGE_FORMAT)
- void sendFailed(int retry);
-
- @LogMessage(level = Logger.Level.WARN)
- @Message(id = 232007, value = "removing aerogear connector unable to connect after {0} attempts, giving up", format = Message.Format.MESSAGE_FORMAT)
- void unableToReconnect(int retryAttempt);
-}
diff --git a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConnectorService.java b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConnectorService.java
deleted file mode 100644
index 5191524fd7..0000000000
--- a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConnectorService.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.integration.aerogear;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.core.filter.Filter;
-import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
-import org.apache.activemq.artemis.core.postoffice.Binding;
-import org.apache.activemq.artemis.core.postoffice.PostOffice;
-import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
-import org.apache.activemq.artemis.core.server.ConnectorService;
-import org.apache.activemq.artemis.core.server.Consumer;
-import org.apache.activemq.artemis.core.server.HandleStatus;
-import org.apache.activemq.artemis.core.server.MessageReference;
-import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.core.server.ServerMessage;
-import org.apache.activemq.artemis.utils.ConfigurationHelper;
-import org.jboss.aerogear.unifiedpush.JavaSender;
-import org.jboss.aerogear.unifiedpush.SenderClient;
-import org.jboss.aerogear.unifiedpush.message.MessageResponseCallback;
-import org.jboss.aerogear.unifiedpush.message.UnifiedMessage;
-
-public class AeroGearConnectorService implements ConnectorService, Consumer, MessageResponseCallback {
-
- private final String connectorName;
-
- private final PostOffice postOffice;
-
- private final ScheduledExecutorService scheduledThreadPool;
-
- private final String queueName;
-
- private final String endpoint;
-
- private final String applicationId;
-
- private final String applicationMasterSecret;
-
- private final int ttl;
-
- private final String badge;
-
- private final String sound;
-
- private final boolean contentAvailable;
-
- private final String actionCategory;
-
- private String[] variants;
-
- private String[] aliases;
-
- private String[] deviceTypes;
-
- private final String filterString;
-
- private final int retryInterval;
-
- private final int retryAttempts;
-
- private Queue queue;
-
- private Filter filter;
-
- private volatile boolean handled = false;
-
- private boolean started = false;
-
- private boolean reconnecting = false;
-
- public AeroGearConnectorService(String connectorName,
- Map configuration,
- PostOffice postOffice,
- ScheduledExecutorService scheduledThreadPool) {
- this.connectorName = connectorName;
- this.postOffice = postOffice;
- this.scheduledThreadPool = scheduledThreadPool;
- this.queueName = ConfigurationHelper.getStringProperty(AeroGearConstants.QUEUE_NAME, null, configuration);
- this.endpoint = ConfigurationHelper.getStringProperty(AeroGearConstants.ENDPOINT_NAME, null, configuration);
- this.applicationId = ConfigurationHelper.getStringProperty(AeroGearConstants.APPLICATION_ID_NAME, null, configuration);
- this.applicationMasterSecret = ConfigurationHelper.getStringProperty(AeroGearConstants.APPLICATION_MASTER_SECRET_NAME, null, configuration);
- this.ttl = ConfigurationHelper.getIntProperty(AeroGearConstants.TTL_NAME, AeroGearConstants.DEFAULT_TTL, configuration);
- this.badge = ConfigurationHelper.getStringProperty(AeroGearConstants.BADGE_NAME, null, configuration);
- this.sound = ConfigurationHelper.getStringProperty(AeroGearConstants.SOUND_NAME, AeroGearConstants.DEFAULT_SOUND, configuration);
- this.contentAvailable = ConfigurationHelper.getBooleanProperty(AeroGearConstants.CONTENT_AVAILABLE_NAME, false, configuration);
- this.actionCategory = ConfigurationHelper.getStringProperty(AeroGearConstants.ACTION_CATEGORY_NAME, null, configuration);
- this.filterString = ConfigurationHelper.getStringProperty(AeroGearConstants.FILTER_NAME, null, configuration);
- this.retryInterval = ConfigurationHelper.getIntProperty(AeroGearConstants.RETRY_INTERVAL_NAME, AeroGearConstants.DEFAULT_RETRY_INTERVAL, configuration);
- this.retryAttempts = ConfigurationHelper.getIntProperty(AeroGearConstants.RETRY_ATTEMPTS_NAME, AeroGearConstants.DEFAULT_RETRY_ATTEMPTS, configuration);
- String variantsString = ConfigurationHelper.getStringProperty(AeroGearConstants.VARIANTS_NAME, null, configuration);
- if (variantsString != null) {
- variants = variantsString.split(",");
- }
- String aliasesString = ConfigurationHelper.getStringProperty(AeroGearConstants.ALIASES_NAME, null, configuration);
- if (aliasesString != null) {
- aliases = aliasesString.split(",");
- }
- String deviceTypeString = ConfigurationHelper.getStringProperty(AeroGearConstants.DEVICE_TYPE_NAME, null, configuration);
- if (deviceTypeString != null) {
- deviceTypes = deviceTypeString.split(",");
- }
- }
-
- @Override
- public String getName() {
- return connectorName;
- }
-
- @Override
- public void start() throws Exception {
- if (started) {
- return;
- }
- if (filterString != null) {
- filter = FilterImpl.createFilter(filterString);
- }
-
- if (endpoint == null || endpoint.isEmpty()) {
- throw ActiveMQAeroGearBundle.BUNDLE.endpointNull();
- }
- if (applicationId == null || applicationId.isEmpty()) {
- throw ActiveMQAeroGearBundle.BUNDLE.applicationIdNull();
- }
- if (applicationMasterSecret == null || applicationMasterSecret.isEmpty()) {
- throw ActiveMQAeroGearBundle.BUNDLE.masterSecretNull();
- }
-
- Binding b = postOffice.getBinding(new SimpleString(queueName));
- if (b == null) {
- throw ActiveMQAeroGearBundle.BUNDLE.noQueue(connectorName, queueName);
- }
-
- queue = (Queue) b.getBindable();
-
- queue.addConsumer(this);
-
- started = true;
- }
-
- @Override
- public void stop() throws Exception {
- if (!started) {
- return;
- }
- queue.removeConsumer(this);
- }
-
- @Override
- public boolean isStarted() {
- return started;
- }
-
- @Override
- public HandleStatus handle(final MessageReference reference) throws Exception {
- if (reconnecting) {
- return HandleStatus.BUSY;
- }
- ServerMessage message = reference.getMessage();
-
- if (filter != null && !filter.match(message)) {
- if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) {
- ActiveMQServerLogger.LOGGER.trace("Reference " + reference + " is a noMatch on consumer " + this);
- }
- return HandleStatus.NO_MATCH;
- }
-
- //we only accept if the alert is set
- if (!message.containsProperty(AeroGearConstants.AEROGEAR_ALERT)) {
- return HandleStatus.NO_MATCH;
- }
-
- String alert = message.getTypedProperties().getProperty(AeroGearConstants.AEROGEAR_ALERT).toString();
-
- JavaSender sender = new SenderClient.Builder(endpoint).build();
-
- UnifiedMessage.Builder builder = new UnifiedMessage.Builder();
-
- builder.pushApplicationId(applicationId).masterSecret(applicationMasterSecret).alert(alert);
-
- String sound = message.containsProperty(AeroGearConstants.AEROGEAR_SOUND) ? message.getStringProperty(AeroGearConstants.AEROGEAR_SOUND) : this.sound;
-
- if (sound != null) {
- builder.sound(sound);
- }
-
- String badge = message.containsProperty(AeroGearConstants.AEROGEAR_BADGE) ? message.getStringProperty(AeroGearConstants.AEROGEAR_BADGE) : this.badge;
-
- if (badge != null) {
- builder.badge(badge);
- }
-
- boolean contentAvailable = message.containsProperty(AeroGearConstants.AEROGEAR_CONTENT_AVAILABLE) ? message.getBooleanProperty(AeroGearConstants.AEROGEAR_CONTENT_AVAILABLE) : this.contentAvailable;
-
- if (contentAvailable) {
- builder.contentAvailable();
- }
-
- String actionCategory = message.containsProperty(AeroGearConstants.AEROGEAR_ACTION_CATEGORY) ? message.getStringProperty(AeroGearConstants.AEROGEAR_ACTION_CATEGORY) : this.actionCategory;
-
- if (actionCategory != null) {
- builder.actionCategory(actionCategory);
- }
-
- Integer ttl = message.containsProperty(AeroGearConstants.AEROGEAR_TTL) ? message.getIntProperty(AeroGearConstants.AEROGEAR_TTL) : this.ttl;
-
- if (ttl != null) {
- builder.timeToLive(ttl);
- }
-
- String variantsString = message.containsProperty(AeroGearConstants.AEROGEAR_VARIANTS) ? message.getStringProperty(AeroGearConstants.AEROGEAR_VARIANTS) : null;
-
- String[] variants = variantsString != null ? variantsString.split(",") : this.variants;
-
- if (variants != null) {
- builder.variants(Arrays.asList(variants));
- }
-
- String aliasesString = message.containsProperty(AeroGearConstants.AEROGEAR_ALIASES) ? message.getStringProperty(AeroGearConstants.AEROGEAR_ALIASES) : null;
-
- String[] aliases = aliasesString != null ? aliasesString.split(",") : this.aliases;
-
- if (aliases != null) {
- builder.aliases(Arrays.asList(aliases));
- }
-
- String deviceTypesString = message.containsProperty(AeroGearConstants.AEROGEAR_DEVICE_TYPES) ? message.getStringProperty(AeroGearConstants.AEROGEAR_DEVICE_TYPES) : null;
-
- String[] deviceTypes = deviceTypesString != null ? deviceTypesString.split(",") : this.deviceTypes;
-
- if (deviceTypes != null) {
- builder.deviceType(Arrays.asList(deviceTypes));
- }
-
- Set propertyNames = message.getPropertyNames();
-
- for (SimpleString propertyName : propertyNames) {
- String nameString = propertyName.toString();
- if (nameString.startsWith("AEROGEAR_") && !AeroGearConstants.ALLOWABLE_PROPERTIES.contains(nameString)) {
- Object property = message.getTypedProperties().getProperty(propertyName);
- builder.attribute(nameString, property.toString());
- }
- }
-
- UnifiedMessage unifiedMessage = builder.build();
-
- sender.send(unifiedMessage, this);
-
- if (handled) {
- reference.acknowledge();
- return HandleStatus.HANDLED;
- } else if (!started) {
- //if we have been stopped we must return no match as we have been removed as a consumer,
- // anything else will cause an exception
- return HandleStatus.NO_MATCH;
- }
- //we must be reconnecting
- return HandleStatus.BUSY;
- }
-
- @Override
- public void onComplete(int statusCode) {
- if (statusCode != 200) {
- handled = false;
- if (statusCode == 401) {
- ActiveMQAeroGearLogger.LOGGER.reply401();
- } else if (statusCode == 404) {
- ActiveMQAeroGearLogger.LOGGER.reply404();
- } else {
- ActiveMQAeroGearLogger.LOGGER.replyUnknown(statusCode);
- }
-
- queue.removeConsumer(this);
- started = false;
- } else {
- handled = true;
- }
- }
-
- @Override
- public void onError(Throwable throwable) {
- ActiveMQAeroGearLogger.LOGGER.sendFailed(retryInterval);
- handled = false;
- reconnecting = true;
- scheduledThreadPool.schedule(new ReconnectRunnable(0), retryInterval, TimeUnit.SECONDS);
- }
-
- private class ReconnectRunnable implements Runnable {
-
- private int retryAttempt;
-
- private ReconnectRunnable(int retryAttempt) {
- this.retryAttempt = retryAttempt;
- }
-
- @Override
- public void run() {
- try {
- HttpURLConnection conn = (HttpURLConnection) new URL(endpoint).openConnection();
- conn.connect();
- reconnecting = false;
- ActiveMQAeroGearLogger.LOGGER.connected(endpoint);
- queue.deliverAsync();
- } catch (Exception e) {
- retryAttempt++;
- if (retryAttempts == -1 || retryAttempt < retryAttempts) {
- scheduledThreadPool.schedule(this, retryInterval, TimeUnit.SECONDS);
- } else {
- ActiveMQAeroGearLogger.LOGGER.unableToReconnect(retryAttempt);
- started = false;
- }
- }
- }
- }
-
- @Override
- public List getDeliveringMessages() {
- return Collections.emptyList();
- }
-
- @Override
- public void proceedDeliver(MessageReference reference) throws Exception {
- //noop
- }
-
- @Override
- public Filter getFilter() {
- return filter;
- }
-
- @Override
- public String debug() {
- return "aerogear connected to " + endpoint;
- }
-
- @Override
- public String toManagementString() {
- return "aerogear connected to " + endpoint;
- }
-
- @Override
- public void disconnect() {
- }
-}
diff --git a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConnectorServiceFactory.java b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConnectorServiceFactory.java
deleted file mode 100644
index 749c87a044..0000000000
--- a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConnectorServiceFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.integration.aerogear;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.apache.activemq.artemis.core.persistence.StorageManager;
-import org.apache.activemq.artemis.core.postoffice.PostOffice;
-import org.apache.activemq.artemis.core.server.ConnectorService;
-import org.apache.activemq.artemis.core.server.ConnectorServiceFactory;
-
-public class AeroGearConnectorServiceFactory implements ConnectorServiceFactory {
-
- @Override
- public ConnectorService createConnectorService(String connectorName,
- Map configuration,
- StorageManager storageManager,
- PostOffice postOffice,
- ScheduledExecutorService scheduledThreadPool) {
- return new AeroGearConnectorService(connectorName, configuration, postOffice, scheduledThreadPool);
- }
-
- @Override
- public Set getAllowableProperties() {
- return AeroGearConstants.ALLOWABLE_PROPERTIES;
- }
-
- @Override
- public Set getRequiredProperties() {
- return AeroGearConstants.REQUIRED_PROPERTIES;
- }
-}
diff --git a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConstants.java b/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConstants.java
deleted file mode 100644
index 07eda7735e..0000000000
--- a/integration/activemq-aerogear-integration/src/main/java/org/apache/activemq/artemis/integration/aerogear/AeroGearConstants.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.integration.aerogear;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.activemq.artemis.api.core.SimpleString;
-
-public class AeroGearConstants {
-
- public static final Set ALLOWABLE_PROPERTIES = new HashSet<>();
- public static final Set REQUIRED_PROPERTIES = new HashSet<>();
-
- public static final String QUEUE_NAME = "queue";
- public static final String ENDPOINT_NAME = "endpoint";
- public static final String APPLICATION_ID_NAME = "application-id";
- public static final String APPLICATION_MASTER_SECRET_NAME = "master-secret";
- public static final String TTL_NAME = "ttl";
- public static final String BADGE_NAME = "badge";
- public static final String SOUND_NAME = "sound";
- public static final String CONTENT_AVAILABLE_NAME = "content-available";
- public static final String ACTION_CATEGORY_NAME = "action-category";
- public static final String FILTER_NAME = "filter";
- public static final String RETRY_INTERVAL_NAME = "retry-interval";
- public static final String RETRY_ATTEMPTS_NAME = "retry-attempts";
- public static final String VARIANTS_NAME = "variants";
- public static final String ALIASES_NAME = "aliases";
- public static final String DEVICE_TYPE_NAME = "device-types";
-
- public static final SimpleString AEROGEAR_ALERT = new SimpleString("AEROGEAR_ALERT");
- public static final SimpleString AEROGEAR_SOUND = new SimpleString("AEROGEAR_SOUND");
- public static final SimpleString AEROGEAR_CONTENT_AVAILABLE = new SimpleString("AEROGEAR_CONTENT_AVAILABLE");
- public static final SimpleString AEROGEAR_ACTION_CATEGORY = new SimpleString("AEROGEAR_ACTION_CATEGORY");
- public static final SimpleString AEROGEAR_BADGE = new SimpleString("AEROGEAR_BADGE");
- public static final SimpleString AEROGEAR_TTL = new SimpleString("AEROGEAR_TTL");
- public static final SimpleString AEROGEAR_VARIANTS = new SimpleString("AEROGEAR_VARIANTS");
- public static final SimpleString AEROGEAR_ALIASES = new SimpleString("AEROGEAR_ALIASES");
- public static final SimpleString AEROGEAR_DEVICE_TYPES = new SimpleString("AEROGEAR_DEVICE_TYPES");
-
- public static final String DEFAULT_SOUND = "default";
- public static final Integer DEFAULT_TTL = 3600;
- public static final int DEFAULT_RETRY_INTERVAL = 5;
- public static final int DEFAULT_RETRY_ATTEMPTS = 5;
-
- static {
- ALLOWABLE_PROPERTIES.add(QUEUE_NAME);
- ALLOWABLE_PROPERTIES.add(ENDPOINT_NAME);
- ALLOWABLE_PROPERTIES.add(APPLICATION_ID_NAME);
- ALLOWABLE_PROPERTIES.add(APPLICATION_MASTER_SECRET_NAME);
- ALLOWABLE_PROPERTIES.add(TTL_NAME);
- ALLOWABLE_PROPERTIES.add(BADGE_NAME);
- ALLOWABLE_PROPERTIES.add(SOUND_NAME);
- ALLOWABLE_PROPERTIES.add(CONTENT_AVAILABLE_NAME);
- ALLOWABLE_PROPERTIES.add(ACTION_CATEGORY_NAME);
- ALLOWABLE_PROPERTIES.add(FILTER_NAME);
- ALLOWABLE_PROPERTIES.add(RETRY_INTERVAL_NAME);
- ALLOWABLE_PROPERTIES.add(RETRY_ATTEMPTS_NAME);
- ALLOWABLE_PROPERTIES.add(VARIANTS_NAME);
- ALLOWABLE_PROPERTIES.add(ALIASES_NAME);
- ALLOWABLE_PROPERTIES.add(DEVICE_TYPE_NAME);
-
- REQUIRED_PROPERTIES.add(QUEUE_NAME);
- REQUIRED_PROPERTIES.add(ENDPOINT_NAME);
- REQUIRED_PROPERTIES.add(APPLICATION_ID_NAME);
- REQUIRED_PROPERTIES.add(APPLICATION_MASTER_SECRET_NAME);
- }
-
-}
diff --git a/pom.xml b/pom.xml
index d182bbb4f8..5b056ad91d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,7 +53,6 @@
artemis-maven-plugin
artemis-server-osgi
integration/activemq-spring-integration
- integration/activemq-aerogear-integration
artemis-distribution
artemis-tools
tests
@@ -734,7 +733,6 @@
artemis-maven-plugin
artemis-jdbc-store
integration/activemq-spring-integration
- integration/activemq-aerogear-integration
tests
@@ -769,7 +767,6 @@
artemis-service-extensions
artemis-maven-plugin
integration/activemq-spring-integration
- integration/activemq-aerogear-integration
examples
tests
artemis-distribution
@@ -827,7 +824,6 @@
artemis-service-extensions
artemis-maven-plugin
integration/activemq-spring-integration
- integration/activemq-aerogear-integration
tests
@@ -869,7 +865,6 @@
artemis-service-extensions
artemis-maven-plugin
integration/activemq-spring-integration
- integration/activemq-aerogear-integration
tests
@@ -903,7 +898,6 @@
artemis-service-extensions
artemis-maven-plugin
integration/activemq-spring-integration
- integration/activemq-aerogear-integration
tests
examples
diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml
index afdaee2064..33d82b2d58 100644
--- a/tests/integration-tests/pom.xml
+++ b/tests/integration-tests/pom.xml
@@ -176,11 +176,6 @@
-