You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by sj...@apache.org on 2016/09/09 20:54:17 UTC

[15/15] asterixdb-bad git commit: Fixed structure

Fixed structure


Project: http://git-wip-us.apache.org/repos/asf/asterixdb-bad/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb-bad/commit/0921e3c9
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb-bad/tree/0921e3c9
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb-bad/diff/0921e3c9

Branch: refs/heads/master
Commit: 0921e3c9b8ccd2646f75b9769d9589cbb2720558
Parents: bdba1b8
Author: Steven Glenn Jacobs <sj...@ucr.edu>
Authored: Fri Sep 9 13:53:53 2016 -0700
Committer: Steven Glenn Jacobs <sj...@ucr.edu>
Committed: Fri Sep 9 13:53:53 2016 -0700

----------------------------------------------------------------------
 .gitignore                                      |   50 +
 asterix-opt/pom.xml                             |  206 +
 .../org/apache/asterix/bad/BADConstants.java    |   41 +
 .../org/apache/asterix/bad/ChannelJobInfo.java  |   48 +
 .../apache/asterix/bad/ChannelJobService.java   |  145 +
 .../bad/lang/BADCompilationProvider.java        |   52 +
 .../asterix/bad/lang/BADLangExtension.java      |  106 +
 .../asterix/bad/lang/BADParserFactory.java      |   38 +
 .../bad/lang/BADQueryTranslatorExtension.java   |   53 +
 .../bad/lang/BADQueryTranslatorFactory.java     |   41 +
 .../asterix/bad/lang/BADStatementExecutor.java  |   46 +
 .../bad/lang/statement/BrokerDropStatement.java |   99 +
 .../lang/statement/ChannelDropStatement.java    |  166 +
 .../statement/ChannelSubscribeStatement.java    |  202 +
 .../statement/ChannelUnsubscribeStatement.java  |  154 +
 .../lang/statement/CreateBrokerStatement.java   |  105 +
 .../lang/statement/CreateChannelStatement.java  |  373 ++
 .../bad/metadata/BADMetadataExtension.java      |  109 +
 .../bad/metadata/BADMetadataIndexes.java        |   66 +
 .../bad/metadata/BADMetadataRecordTypes.java    |   89 +
 .../org/apache/asterix/bad/metadata/Broker.java |   69 +
 .../asterix/bad/metadata/BrokerSearchKey.java   |   45 +
 .../bad/metadata/BrokerTupleTranslator.java     |  118 +
 .../apache/asterix/bad/metadata/Channel.java    |   96 +
 .../bad/metadata/ChannelEventsListener.java     |  237 +
 .../asterix/bad/metadata/ChannelSearchKey.java  |   45 +
 .../bad/metadata/ChannelTupleTranslator.java    |  159 +
 .../InsertBrokerNotifierForChannelRule.java     |  317 ++
 .../bad/runtime/NotifyBrokerOperator.java       |   90 +
 .../bad/runtime/NotifyBrokerPOperator.java      |  111 +
 .../bad/runtime/NotifyBrokerRuntime.java        |  138 +
 .../bad/runtime/NotifyBrokerRuntimeFactory.java |   55 +
 .../RepetitiveChannelOperatorDescriptor.java    |   83 +
 .../RepetitiveChannelOperatorNodePushable.java  |  125 +
 .../src/main/resources/lang-extension/lang.txt  |  179 +
 .../asterix/bad/test/BADExecutionTest.java      |   98 +
 .../asterix/bad/test/BADOptimizerTest.java      |   60 +
 .../conf/asterix-build-configuration.xml        |  110 +
 asterix-opt/src/test/resources/conf/cluster.xml |   49 +
 .../conf/hyracks-deployment.properties          |   21 +
 .../src/test/resources/conf/test.properties     |   22 +
 .../queries/channel/channel-create.aql          |   36 +
 .../queries/channel/channel-subscribe.aql       |   40 +
 .../queries/channel/channel-unsubscribe.aql     |   38 +
 .../results/channel/channel-create.plan         |   30 +
 .../results/channel/channel-subscribe.plan      |   44 +
 .../results/channel/channel-unsubscribe.plan    |   44 +
 .../create_channel_check_datasets.1.ddl.aql     |   34 +
 .../create_channel_check_datasets.2.update.aql  |    0
 .../create_channel_check_datasets.3.query.aql   |    7 +
 .../create_channel_check_metadata.1.ddl.aql     |   34 +
 .../create_channel_check_metadata.2.update.aql  |    0
 .../create_channel_check_metadata.3.query.aql   |    3 +
 .../drop_channel_check_datasets.1.ddl.aql       |   38 +
 .../drop_channel_check_datasets.2.update.aql    |    3 +
 .../drop_channel_check_datasets.3.query.aql     |    7 +
 .../drop_channel_check_metadata.1.ddl.aql       |   38 +
 .../drop_channel_check_metadata.2.update.aql    |    3 +
 .../drop_channel_check_metadata.3.query.aql     |    3 +
 ...scribe_channel_check_subscriptions.1.ddl.aql |   34 +
 ...ibe_channel_check_subscriptions.2.update.aql |    7 +
 ...ribe_channel_check_subscriptions.3.query.aql |    4 +
 .../create_channel_check_datasets.1.adm         |    3 +
 .../create_channel_check_metadata.1.adm         |    2 +
 .../drop_channel_check_datasets.1.adm           |    5 +
 .../drop_channel_check_metadata.1.adm           |    3 +
 .../subscribe_channel_check_subscriptions.1.adm |    4 +
 .../current/VERSION                             |    5 -
 .../dncp_block_verification.log.curr            |    0
 build/test/data/dfs/data/data1/current/VERSION  |    6 -
 build/test/data/dfs/data/data1/in_use.lock      |    1 -
 .../current/VERSION                             |    5 -
 build/test/data/dfs/data/data2/current/VERSION  |    6 -
 build/test/data/dfs/data/data2/in_use.lock      |    1 -
 .../current/VERSION                             |    5 -
 .../dncp_block_verification.log.curr            |    0
 build/test/data/dfs/data/data3/current/VERSION  |    6 -
 build/test/data/dfs/data/data3/in_use.lock      |    1 -
 .../current/VERSION                             |    5 -
 build/test/data/dfs/data/data4/current/VERSION  |    6 -
 build/test/data/dfs/data/data4/in_use.lock      |    1 -
 build/test/data/dfs/name1/current/VERSION       |    7 -
 .../edits_inprogress_0000000000000000001        |  Bin 1048576 -> 0 bytes
 .../name1/current/fsimage_0000000000000000000   |  Bin 204 -> 0 bytes
 .../current/fsimage_0000000000000000000.md5     |    1 -
 build/test/data/dfs/name1/current/seen_txid     |    1 -
 build/test/data/dfs/name1/in_use.lock           |    1 -
 build/test/data/dfs/name2/current/VERSION       |    7 -
 .../edits_inprogress_0000000000000000001        |  Bin 1048576 -> 0 bytes
 .../name2/current/fsimage_0000000000000000000   |  Bin 204 -> 0 bytes
 .../current/fsimage_0000000000000000000.md5     |    1 -
 build/test/data/dfs/name2/current/seen_txid     |    1 -
 build/test/data/dfs/name2/in_use.lock           |    1 -
 pom.xml                                         |  206 -
 .../org/apache/asterix/bad/BADConstants.java    |   41 -
 .../org/apache/asterix/bad/ChannelJobInfo.java  |   48 -
 .../apache/asterix/bad/ChannelJobService.java   |  145 -
 .../bad/lang/BADCompilationProvider.java        |   52 -
 .../asterix/bad/lang/BADLangExtension.java      |  106 -
 .../asterix/bad/lang/BADParserFactory.java      |   38 -
 .../bad/lang/BADQueryTranslatorExtension.java   |   53 -
 .../bad/lang/BADQueryTranslatorFactory.java     |   41 -
 .../asterix/bad/lang/BADStatementExecutor.java  |   46 -
 .../bad/lang/statement/BrokerDropStatement.java |   99 -
 .../lang/statement/ChannelDropStatement.java    |  166 -
 .../statement/ChannelSubscribeStatement.java    |  202 -
 .../statement/ChannelUnsubscribeStatement.java  |  154 -
 .../lang/statement/CreateBrokerStatement.java   |  105 -
 .../lang/statement/CreateChannelStatement.java  |  373 --
 .../bad/metadata/BADMetadataExtension.java      |  109 -
 .../bad/metadata/BADMetadataIndexes.java        |   66 -
 .../bad/metadata/BADMetadataRecordTypes.java    |   89 -
 .../org/apache/asterix/bad/metadata/Broker.java |   69 -
 .../asterix/bad/metadata/BrokerSearchKey.java   |   45 -
 .../bad/metadata/BrokerTupleTranslator.java     |  118 -
 .../apache/asterix/bad/metadata/Channel.java    |   96 -
 .../bad/metadata/ChannelEventsListener.java     |  237 -
 .../asterix/bad/metadata/ChannelSearchKey.java  |   45 -
 .../bad/metadata/ChannelTupleTranslator.java    |  159 -
 .../InsertBrokerNotifierForChannelRule.java     |  317 --
 .../bad/runtime/NotifyBrokerOperator.java       |   90 -
 .../bad/runtime/NotifyBrokerPOperator.java      |  111 -
 .../bad/runtime/NotifyBrokerRuntime.java        |  138 -
 .../bad/runtime/NotifyBrokerRuntimeFactory.java |   55 -
 .../RepetitiveChannelOperatorDescriptor.java    |   83 -
 .../RepetitiveChannelOperatorNodePushable.java  |  125 -
 src/main/resources/git.properties               |   22 -
 src/main/resources/lang-extension/lang.txt      |  179 -
 .../asterix/bad/test/BADExecutionTest.java      |   98 -
 .../asterix/bad/test/BADOptimizerTest.java      |   60 -
 .../conf/asterix-build-configuration.xml        |  110 -
 src/test/resources/conf/cluster.xml             |   49 -
 .../conf/hyracks-deployment.properties          |   21 -
 src/test/resources/conf/test.properties         |   22 -
 .../queries/channel/channel-create.aql          |   36 -
 .../queries/channel/channel-subscribe.aql       |   40 -
 .../queries/channel/channel-unsubscribe.aql     |   38 -
 .../results/channel/channel-create.plan         |   30 -
 .../results/channel/channel-subscribe.plan      |   44 -
 .../results/channel/channel-unsubscribe.plan    |   44 -
 .../create_channel_check_datasets.1.ddl.aql     |   34 -
 .../create_channel_check_datasets.2.update.aql  |    0
 .../create_channel_check_datasets.3.query.aql   |    7 -
 .../create_channel_check_metadata.1.ddl.aql     |   34 -
 .../create_channel_check_metadata.2.update.aql  |    0
 .../create_channel_check_metadata.3.query.aql   |    3 -
 .../drop_channel_check_datasets.1.ddl.aql       |   38 -
 .../drop_channel_check_datasets.2.update.aql    |    3 -
 .../drop_channel_check_datasets.3.query.aql     |    7 -
 .../drop_channel_check_metadata.1.ddl.aql       |   38 -
 .../drop_channel_check_metadata.2.update.aql    |    3 -
 .../drop_channel_check_metadata.3.query.aql     |    3 -
 ...scribe_channel_check_subscriptions.1.ddl.aql |   34 -
 ...ibe_channel_check_subscriptions.2.update.aql |    7 -
 ...ribe_channel_check_subscriptions.3.query.aql |    4 -
 .../create_channel_check_datasets.1.adm         |    3 -
 .../create_channel_check_metadata.1.adm         |    2 -
 .../drop_channel_check_datasets.1.adm           |    5 -
 .../drop_channel_check_metadata.1.adm           |    3 -
 .../subscribe_channel_check_subscriptions.1.adm |    4 -
 target/.plxarc                                  |    1 -
 target/asterix-opt-0.8.9-SNAPSHOT.jar           |  Bin 165124 -> 0 bytes
 target/checkstyle-checker.xml                   |    5 -
 target/checkstyle-result.xml                    |  119 -
 target/checkstyle-rules.xml                     |    5 -
 target/classes/META-INF/DEPENDENCIES            |  489 --
 target/classes/META-INF/LICENSE                 |  202 -
 target/classes/META-INF/NOTICE                  |    8 -
 target/classes/git.properties                   |   22 -
 target/classes/lang-extension/lang.txt          |  179 -
 .../bad/BADConstants$ChannelJobType.class       |  Bin 1190 -> 0 bytes
 .../org/apache/asterix/bad/BADConstants.class   |  Bin 1005 -> 0 bytes
 .../org/apache/asterix/bad/ChannelJobInfo.class |  Bin 1673 -> 0 bytes
 .../apache/asterix/bad/ChannelJobService.class  |  Bin 6182 -> 0 bytes
 .../asterix/bad/lang/BADAQLParser$1.class       |  Bin 240 -> 0 bytes
 .../bad/lang/BADAQLParser$FunctionName.class    |  Bin 725 -> 0 bytes
 .../bad/lang/BADAQLParser$IndexParams.class     |  Bin 794 -> 0 bytes
 .../asterix/bad/lang/BADAQLParser$JJCalls.class |  Bin 521 -> 0 bytes
 .../lang/BADAQLParser$LookaheadSuccess.class    |  Bin 567 -> 0 bytes
 .../apache/asterix/bad/lang/BADAQLParser.class  |  Bin 100260 -> 0 bytes
 .../bad/lang/BADAQLParserConstants.class        |  Bin 8427 -> 0 bytes
 .../bad/lang/BADAQLParserTokenManager.class     |  Bin 47691 -> 0 bytes
 .../bad/lang/BADCompilationProvider.class       |  Bin 1308 -> 0 bytes
 .../asterix/bad/lang/BADLangExtension$1.class   |  Bin 912 -> 0 bytes
 .../asterix/bad/lang/BADLangExtension.class     |  Bin 6111 -> 0 bytes
 .../asterix/bad/lang/BADParserFactory.class     |  Bin 855 -> 0 bytes
 ...BADQueryTranslatorExtension$LazyHolder.class |  Bin 1155 -> 0 bytes
 .../bad/lang/BADQueryTranslatorExtension.class  |  Bin 1573 -> 0 bytes
 .../bad/lang/BADQueryTranslatorFactory.class    |  Bin 1892 -> 0 bytes
 .../asterix/bad/lang/BADStatementExecutor.class |  Bin 1750 -> 0 bytes
 .../asterix/bad/lang/JavaCharStream.class       |  Bin 9889 -> 0 bytes
 .../asterix/bad/lang/ParseException.class       |  Bin 3760 -> 0 bytes
 .../org/apache/asterix/bad/lang/Token.class     |  Bin 1265 -> 0 bytes
 .../apache/asterix/bad/lang/TokenMgrError.class |  Bin 2865 -> 0 bytes
 .../lang/statement/BrokerDropStatement.class    |  Bin 5083 -> 0 bytes
 .../lang/statement/ChannelDropStatement.class   |  Bin 9347 -> 0 bytes
 .../statement/ChannelSubscribeStatement.class   |  Bin 10902 -> 0 bytes
 .../statement/ChannelUnsubscribeStatement.class |  Bin 4351 -> 0 bytes
 .../lang/statement/CreateBrokerStatement.class  |  Bin 5718 -> 0 bytes
 .../lang/statement/CreateChannelStatement.class |  Bin 23785 -> 0 bytes
 .../bad/metadata/BADMetadataExtension.class     |  Bin 4750 -> 0 bytes
 .../bad/metadata/BADMetadataIndexes.class       |  Bin 2816 -> 0 bytes
 .../bad/metadata/BADMetadataRecordTypes.class   |  Bin 3178 -> 0 bytes
 .../apache/asterix/bad/metadata/Broker.class    |  Bin 1509 -> 0 bytes
 .../asterix/bad/metadata/BrokerSearchKey.class  |  Bin 1266 -> 0 bytes
 .../bad/metadata/BrokerTupleTranslator.class    |  Bin 5829 -> 0 bytes
 .../apache/asterix/bad/metadata/Channel.class   |  Bin 2781 -> 0 bytes
 .../bad/metadata/ChannelEventsListener$1.class  |  Bin 906 -> 0 bytes
 .../bad/metadata/ChannelEventsListener.class    |  Bin 12124 -> 0 bytes
 .../asterix/bad/metadata/ChannelSearchKey.class |  Bin 1271 -> 0 bytes
 .../bad/metadata/ChannelTupleTranslator.class   |  Bin 7302 -> 0 bytes
 .../InsertBrokerNotifierForChannelRule.class    |  Bin 15855 -> 0 bytes
 .../bad/runtime/NotifyBrokerOperator.class      |  Bin 2629 -> 0 bytes
 .../bad/runtime/NotifyBrokerPOperator.class     |  Bin 7083 -> 0 bytes
 .../bad/runtime/NotifyBrokerRuntime.class       |  Bin 7215 -> 0 bytes
 .../runtime/NotifyBrokerRuntimeFactory.class    |  Bin 1944 -> 0 bytes
 .../RepetitiveChannelOperatorDescriptor.class   |  Bin 3383 -> 0 bytes
 ...epetitiveChannelOperatorNodePushable$1.class |  Bin 1000 -> 0 bytes
 .../RepetitiveChannelOperatorNodePushable.class |  Bin 4481 -> 0 bytes
 target/generated-resources/javacc/grammar.jj    | 2949 ------------
 .../apache/asterix/bad/lang/BADAQLParser.java   | 4407 ------------------
 .../asterix/bad/lang/BADAQLParserConstants.java |  454 --
 .../bad/lang/BADAQLParserTokenManager.java      | 3701 ---------------
 .../apache/asterix/bad/lang/JavaCharStream.java |  617 ---
 .../apache/asterix/bad/lang/ParseException.java |  187 -
 .../org/apache/asterix/bad/lang/Token.java      |  131 -
 .../apache/asterix/bad/lang/TokenMgrError.java  |  147 -
 target/maven-archiver/pom.properties            |    5 -
 .../META-INF/DEPENDENCIES                       |  489 --
 .../META-INF/LICENSE                            |  202 -
 .../META-INF/NOTICE                             |    8 -
 .../compile/default-compile/createdFiles.lst    |   49 -
 .../compile/default-compile/inputFiles.lst      |   39 -
 .../default-testCompile/createdFiles.lst        |    2 -
 .../default-testCompile/inputFiles.lst          |    2 -
 target/rat.txt                                  |   72 -
 target/test-classes/META-INF/DEPENDENCIES       |  489 --
 target/test-classes/META-INF/LICENSE            |  202 -
 target/test-classes/META-INF/NOTICE             |    8 -
 .../conf/asterix-build-configuration.xml        |  110 -
 target/test-classes/conf/cluster.xml            |   49 -
 .../conf/hyracks-deployment.properties          |   21 -
 target/test-classes/conf/test.properties        |   22 -
 .../queries/channel/channel-create.aql          |   36 -
 .../queries/channel/channel-subscribe.aql       |   40 -
 .../queries/channel/channel-unsubscribe.aql     |   38 -
 .../results/channel/channel-create.plan         |   30 -
 .../results/channel/channel-subscribe.plan      |   44 -
 .../results/channel/channel-unsubscribe.plan    |   44 -
 .../asterix/bad/test/BADExecutionTest.class     |  Bin 4444 -> 0 bytes
 .../asterix/bad/test/BADOptimizerTest.class     |  Bin 1922 -> 0 bytes
 .../create_channel_check_datasets.1.ddl.aql     |   34 -
 .../create_channel_check_datasets.2.update.aql  |    0
 .../create_channel_check_datasets.3.query.aql   |    7 -
 .../create_channel_check_metadata.1.ddl.aql     |   34 -
 .../create_channel_check_metadata.2.update.aql  |    0
 .../create_channel_check_metadata.3.query.aql   |    3 -
 .../drop_channel_check_datasets.1.ddl.aql       |   38 -
 .../drop_channel_check_datasets.2.update.aql    |    3 -
 .../drop_channel_check_datasets.3.query.aql     |    7 -
 .../drop_channel_check_metadata.1.ddl.aql       |   38 -
 .../drop_channel_check_metadata.2.update.aql    |    3 -
 .../drop_channel_check_metadata.3.query.aql     |    3 -
 ...scribe_channel_check_subscriptions.1.ddl.aql |   34 -
 ...ibe_channel_check_subscriptions.2.update.aql |    7 -
 ...ribe_channel_check_subscriptions.3.query.aql |    4 -
 .../create_channel_check_datasets.1.adm         |    3 -
 .../create_channel_check_metadata.1.adm         |    2 -
 .../drop_channel_check_datasets.1.adm           |    5 -
 .../drop_channel_check_metadata.1.adm           |    3 -
 .../subscribe_channel_check_subscriptions.1.adm |    4 -
 271 files changed, 4880 insertions(+), 20776 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..35234a6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,50 @@
+invIndex*
+primaryBTree*
+target
+.classpath
+.settings
+.project
+ClusterControllerService
+rttest
+mdtest
+ittest
+asterix_logs
+build
+asterixdb/asterix-app/src/test/resources/externallib
+asterixdb/asterix-app/opttest
+asterixdb/asterix-app/parserts
+asterixdb/asterix-app/library
+asterixdb/asterix-app/opt_parserts
+asterixdb/asterix-app/runtime_parserts
+asterixdb/asterix-app/data/csv/beer.csv
+asterixdb/asterix-installer/ittest
+asterixdb/asterix-installer/repliationtest
+asterixdb/asterix-installer/src/test/resources/clusterts/asterix-installer-*-SNAPSHOT-binary-assembly
+*-coredump
+*.pyc
+*.iml
+.idea
+*.ipr
+*.iws
+git.properties
+actual
+exception
+expected
+teststore1
+teststore2
+dev1
+dev2
+dev3
+dev4
+derby.log
+hadoop-conf-tmp
+metastore_db
+teststore
+output
+tmp
+dist
+*~
+.DS_Store
+*.swp
+.m2*
+�

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/pom.xml
----------------------------------------------------------------------
diff --git a/asterix-opt/pom.xml b/asterix-opt/pom.xml
new file mode 100644
index 0000000..72dcd33
--- /dev/null
+++ b/asterix-opt/pom.xml
@@ -0,0 +1,206 @@
+<!--
+ ! 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.
+ !-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.asterix</groupId>
+    <artifactId>apache-asterixdb</artifactId>
+    <version>0.8.9-SNAPSHOT</version>
+  </parent>
+  <artifactId>asterix-opt</artifactId>
+    <properties>
+    <asterix.version>0.8.9-SNAPSHOT</asterix.version>
+  </properties>
+    <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.asterix</groupId>
+        <artifactId>asterix-grammar-extension-maven-plugin</artifactId>
+        <version>${asterix.version}</version>
+        <configuration>
+          <base>${project.basedir}</base>
+          <gbase>../asterix-lang-aql/src/main/javacc/AQL.jj</gbase>
+          <gextension>src/main/resources/lang-extension/lang.txt</gextension>
+          <output>target/generated-resources/javacc/grammar.jj</output>
+          <parserClassName>BADAQLParser</parserClassName>
+          <packageName>org.apache.asterix.bad.lang</packageName>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>grammarix</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>javacc-maven-plugin</artifactId>
+        <version>2.6</version>
+        <executions>
+          <execution>
+            <id>javacc</id>
+            <goals>
+              <goal>javacc</goal>
+            </goals>
+            <configuration>
+              <isStatic>false</isStatic>
+              <javaUnicodeEscape>true</javaUnicodeEscape>
+              <sourceDirectory>target/generated-resources/javacc</sourceDirectory>
+            </configuration>
+          </execution>
+          <execution>
+            <id>javacc-jjdoc</id>
+            <goals>
+              <goal>jjdoc</goal>
+            </goals>
+            <phase>process-sources</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.9</version>
+        <executions>
+          <execution>
+            <id>add-source</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>${project.build.directory}/generated-sources/javacc/</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.asterix</groupId>
+                    <artifactId>asterix-grammar-extension-maven-plugin</artifactId>
+                    <versionRange>[${asterix.version},)</versionRange>
+                    <goals>
+                      <goal>grammarix</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>javacc-maven-plugin</artifactId>
+                    <versionRange>[2.6,)</versionRange>
+                    <goals>
+                      <goal>javacc</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-om</artifactId>
+      <version>${project.version}</version>
+      <type>jar</type>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hyracks</groupId>
+      <artifactId>hyracks-test-support</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-runtime</artifactId>
+      <version>${project.version}</version>
+      <type>jar</type>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hyracks</groupId>
+      <artifactId>algebricks-compiler</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hyracks</groupId>
+      <artifactId>hyracks-hdfs-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-common</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-test-framework</artifactId>
+      <version>${asterix.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-active</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-app</artifactId>
+      <version>${asterix.version}</version>
+      <type>jar</type>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-app</artifactId>
+      <version>${asterix.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-common</artifactId>
+      <version>${asterix.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/BADConstants.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/BADConstants.java b/asterix-opt/src/main/java/org/apache/asterix/bad/BADConstants.java
new file mode 100644
index 0000000..aeef031
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/BADConstants.java
@@ -0,0 +1,41 @@
+/*
+ * 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.asterix.bad;
+
+public interface BADConstants {
+    final String SubscriptionId = "subscriptionId";
+    final String BrokerName = "BrokerName";
+    final String BrokerDataverse = "DataverseName";
+    final String BrokerEndPoint = "BrokerEndPoint";
+    final String DeliveryTime = "deliveryTime";
+    final String ResultId = "resultId";
+    final String ChannelExecutionTime = "channelExecutionTime";
+    final String ChannelSubscriptionsType = "ChannelSubscriptionsType";
+    final String ChannelResultsType = "ChannelResultsType";
+    final String FEED_EXTENSION_NAME = "Feed";
+    final String CHANNEL_EXTENSION_NAME = "Subscriptions";
+    final String subscriptionEnding = "Results";
+    final String resultsEnding = "Channel";
+    final String BAD_METADATA_EXTENSION_NAME = "BADMetadataExtension";
+    final String BAD_DATAVERSE_NAME = "BAD";
+
+    public enum ChannelJobType {
+        REPETITIVE
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java b/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java
new file mode 100644
index 0000000..da0c43b
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java
@@ -0,0 +1,48 @@
+/*
+ * 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.asterix.bad;
+
+import java.util.List;
+
+import org.apache.asterix.active.ActiveJob;
+import org.apache.asterix.active.ActivityState;
+import org.apache.asterix.active.EntityId;
+import org.apache.asterix.bad.BADConstants.ChannelJobType;
+import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.api.job.JobSpecification;
+
+public class ChannelJobInfo extends ActiveJob {
+
+    private static final long serialVersionUID = 1L;
+    private List<String> locations;
+
+    public ChannelJobInfo(EntityId entityId, JobId jobId, ActivityState state, JobSpecification spec) {
+        super(entityId, jobId, state, ChannelJobType.REPETITIVE, spec);
+    }
+
+    public List<String> getLocations() {
+        return locations;
+
+    }
+
+    public void setLocations(List<String> locations) {
+        this.locations = locations;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobService.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobService.java b/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobService.java
new file mode 100644
index 0000000..8310f70
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/ChannelJobService.java
@@ -0,0 +1,145 @@
+/*
+ * 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.asterix.bad;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.asterix.active.EntityId;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.om.base.AOrderedList;
+import org.apache.asterix.om.base.AUUID;
+import org.apache.hyracks.api.client.HyracksConnection;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.api.job.JobSpecification;
+import org.json.JSONException;
+
+/**
+ * Provides functionality for running channel jobs and communicating with Brokers
+ */
+public class ChannelJobService {
+
+    private static final Logger LOGGER = Logger.getLogger(ChannelJobService.class.getName());
+    IHyracksClientConnection hcc;
+
+    public ChannelJobService() throws AsterixException {
+
+    }
+
+    public void runChannelJob(JobSpecification channeljobSpec, String strIP, int port) throws Exception {
+        hcc = new HyracksConnection(strIP, port);
+        JobId jobId = hcc.startJob(channeljobSpec);
+        hcc.waitForCompletion(jobId);
+    }
+
+    public void sendBrokerNotificationsForChannel(EntityId activeJobId, String brokerEndpoint,
+            AOrderedList subscriptionIds, String channelExecutionTime) throws HyracksDataException {
+        String formattedString;
+        try {
+            formattedString = formatJSON(activeJobId, subscriptionIds, channelExecutionTime);
+        } catch (JSONException e) {
+            throw new HyracksDataException(e);
+        }
+        sendMessage(brokerEndpoint, formattedString);
+    }
+
+    public String formatJSON(EntityId activeJobId, AOrderedList subscriptionIds, String channelExecutionTime)
+            throws JSONException {
+        String JSON = "{ \"dataverseName\":\"" + activeJobId.getDataverse() + "\", \"channelName\":\""
+                + activeJobId.getEntityName() + "\", \"" + BADConstants.ChannelExecutionTime + "\":\""
+                + channelExecutionTime + "\", \"subscriptionIds\":[";
+        for (int i = 0; i < subscriptionIds.size(); i++) {
+            AUUID subId = (AUUID) subscriptionIds.getItem(i);
+            String subString = subId.toSimpleString();
+            JSON += "\"" + subString + "\"";
+            if (i < subscriptionIds.size() - 1) {
+                JSON += ",";
+            }
+        }
+        JSON += "]}";
+        return JSON;
+
+    }
+
+    public static void sendMessage(String targetURL, String urlParameters) {
+        HttpURLConnection connection = null;
+        try {
+            //Create connection
+            URL url = new URL(targetURL);
+            connection = (HttpURLConnection) url.openConnection();
+            connection.setRequestMethod("POST");
+            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+
+            connection.setRequestProperty("Content-Length", Integer.toString(urlParameters.getBytes().length));
+            connection.setRequestProperty("Content-Language", "en-US");
+
+            connection.setUseCaches(false);
+            connection.setDoOutput(true);
+
+            //Send message
+            try {
+                DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
+                wr.writeBytes(urlParameters);
+                wr.close();
+            } catch (Exception e) {
+                throw new AsterixException("Broker connection failed to write", e);
+            }
+
+            if (LOGGER.isLoggable(Level.INFO)) {
+                int responseCode = connection.getResponseCode();
+                LOGGER.info("\nSending 'POST' request to URL : " + url);
+                LOGGER.info("Post parameters : " + urlParameters);
+                LOGGER.info("Response Code : " + responseCode);
+            }
+
+            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            String inputLine;
+            StringBuffer response = new StringBuffer();
+
+            while ((inputLine = in.readLine()) != null) {
+                response.append(inputLine);
+            }
+            in.close();
+
+            if (LOGGER.isLoggable(Level.INFO)) {
+                System.out.println(response.toString());
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (connection != null) {
+                connection.disconnect();
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "ChannelJobService";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java
new file mode 100644
index 0000000..42036af
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java
@@ -0,0 +1,52 @@
+/*
+ * 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.asterix.bad.lang;
+
+import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslatorFactory;
+import org.apache.asterix.compiler.provider.ILangCompilationProvider;
+import org.apache.asterix.lang.aql.rewrites.AQLRewriterFactory;
+import org.apache.asterix.lang.aql.visitor.AQLAstPrintVisitorFactory;
+import org.apache.asterix.lang.common.base.IAstPrintVisitorFactory;
+import org.apache.asterix.lang.common.base.IParserFactory;
+import org.apache.asterix.lang.common.base.IRewriterFactory;
+import org.apache.asterix.translator.AqlExpressionToPlanTranslatorFactory;
+
+public class BADCompilationProvider implements ILangCompilationProvider {
+
+    @Override
+    public IParserFactory getParserFactory() {
+        return new BADParserFactory();
+    }
+
+    @Override
+    public IRewriterFactory getRewriterFactory() {
+        return new AQLRewriterFactory();
+    }
+
+    @Override
+    public IAstPrintVisitorFactory getAstPrintVisitorFactory() {
+        return new AQLAstPrintVisitorFactory();
+    }
+
+    @Override
+    public ILangExpressionToPlanTranslatorFactory getExpressionToPlanTranslatorFactory() {
+        return new AqlExpressionToPlanTranslatorFactory();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java
new file mode 100644
index 0000000..9832fe6
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java
@@ -0,0 +1,106 @@
+/*
+ * 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.asterix.bad.lang;
+
+import java.util.List;
+
+import org.apache.asterix.algebra.base.ILangExtension;
+import org.apache.asterix.bad.metadata.Broker;
+import org.apache.asterix.bad.metadata.BrokerSearchKey;
+import org.apache.asterix.bad.metadata.Channel;
+import org.apache.asterix.bad.metadata.ChannelSearchKey;
+import org.apache.asterix.common.api.ExtensionId;
+import org.apache.asterix.compiler.provider.ILangCompilationProvider;
+import org.apache.asterix.compiler.provider.SqlppCompilationProvider;
+import org.apache.asterix.metadata.MetadataManager;
+import org.apache.asterix.metadata.MetadataTransactionContext;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
+import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
+
+public class BADLangExtension implements ILangExtension {
+
+    public static final ExtensionId EXTENSION_ID = new ExtensionId(BADLangExtension.class.getSimpleName(), 0);
+
+    @Override
+    public ExtensionId getId() {
+        return EXTENSION_ID;
+    }
+
+    @Override
+    public void configure(List<Pair<String, String>> args) {
+    }
+
+    @Override
+    public ILangCompilationProvider getLangCompilationProvider(Language lang) {
+        switch (lang) {
+            case AQL:
+                return new BADCompilationProvider();
+            case SQLPP:
+                return new SqlppCompilationProvider();
+            default:
+                return null;
+        }
+    }
+
+    @Override
+    public ExtensionKind getExtensionKind() {
+        return ExtensionKind.LANG;
+    }
+
+    @Override
+    public boolean unnestToDataScan(Mutable<ILogicalOperator> opRef, IOptimizationContext context,
+            UnnestOperator unnestOp, ILogicalExpression unnestExpr, AbstractFunctionCallExpression functionCallExpr)
+                    throws AlgebricksException {
+        // TODO I dont need this?????
+        return false;
+    }
+
+    public static Broker getBroker(MetadataTransactionContext mdTxnCtx, String dataverseName, String brokerName)
+            throws AlgebricksException {
+        BrokerSearchKey brokerSearchKey = new BrokerSearchKey(dataverseName, brokerName);
+        List<Broker> brokers = MetadataManager.INSTANCE.getEntities(mdTxnCtx, brokerSearchKey);
+        if (brokers.isEmpty()) {
+            return null;
+        } else if (brokers.size() > 1) {
+            throw new AlgebricksException("Broker search key returned more than one broker");
+        } else {
+            return brokers.get(0);
+        }
+    }
+
+    public static Channel getChannel(MetadataTransactionContext mdTxnCtx, String dataverseName, String channelName)
+            throws AlgebricksException {
+        ChannelSearchKey channelSearchKey = new ChannelSearchKey(dataverseName, channelName);
+        List<Channel> channels = MetadataManager.INSTANCE.getEntities(mdTxnCtx, channelSearchKey);
+        if (channels.isEmpty()) {
+            return null;
+        } else if (channels.size() > 1) {
+            throw new AlgebricksException("Channel search key returned more than one channel");
+        } else {
+            return channels.get(0);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java
new file mode 100644
index 0000000..58bca17
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java
@@ -0,0 +1,38 @@
+/*
+ * 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.asterix.bad.lang;
+
+import java.io.Reader;
+
+import org.apache.asterix.lang.common.base.IParser;
+import org.apache.asterix.lang.common.base.IParserFactory;
+
+public class BADParserFactory implements IParserFactory {
+
+    @Override
+    public IParser createParser(String query) {
+        return new BADAQLParser(query);
+    }
+
+    @Override
+    public IParser createParser(Reader reader) {
+        return new BADAQLParser(reader);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java
new file mode 100644
index 0000000..4198230
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java
@@ -0,0 +1,53 @@
+/*
+ * 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.asterix.bad.lang;
+
+import java.util.List;
+
+import org.apache.asterix.app.cc.CompilerExtensionManager;
+import org.apache.asterix.app.cc.IStatementExecutorExtension;
+import org.apache.asterix.common.api.ExtensionId;
+import org.apache.asterix.runtime.util.AsterixAppContextInfo;
+import org.apache.asterix.translator.IStatementExecutorFactory;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+
+public class BADQueryTranslatorExtension implements IStatementExecutorExtension {
+
+    public static final ExtensionId BAD_QUERY_TRANSLATOR_EXTENSION_ID = new ExtensionId(
+            BADQueryTranslatorExtension.class.getSimpleName(), 0);
+
+    private static class LazyHolder {
+        private static final IStatementExecutorFactory INSTANCE = new BADQueryTranslatorFactory(
+                (CompilerExtensionManager) AsterixAppContextInfo.INSTANCE.getExtensionManager());
+    }
+
+    @Override
+    public ExtensionId getId() {
+        return BAD_QUERY_TRANSLATOR_EXTENSION_ID;
+    }
+
+    @Override
+    public void configure(List<Pair<String, String>> args) {
+    }
+
+    @Override
+    public IStatementExecutorFactory getQueryTranslatorFactory() {
+        return LazyHolder.INSTANCE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java
new file mode 100644
index 0000000..b8a6050
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.asterix.bad.lang;
+
+import java.util.List;
+
+import org.apache.asterix.app.cc.CompilerExtensionManager;
+import org.apache.asterix.app.translator.DefaultStatementExecutorFactory;
+import org.apache.asterix.app.translator.QueryTranslator;
+import org.apache.asterix.common.app.SessionConfig;
+import org.apache.asterix.compiler.provider.ILangCompilationProvider;
+import org.apache.asterix.lang.common.base.Statement;
+
+public class BADQueryTranslatorFactory extends DefaultStatementExecutorFactory {
+
+    public BADQueryTranslatorFactory(CompilerExtensionManager ccExtensionManager) {
+        super(ccExtensionManager);
+    }
+
+    @Override
+    public QueryTranslator create(List<Statement> statements, SessionConfig conf,
+            ILangCompilationProvider compilationProvider) {
+        return new BADStatementExecutor(statements, conf, compilationProvider, cExtensionManager);
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java
new file mode 100644
index 0000000..1c17794
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java
@@ -0,0 +1,46 @@
+/*
+ * 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.asterix.bad.lang;
+
+import java.util.List;
+
+import org.apache.asterix.app.cc.CompilerExtensionManager;
+import org.apache.asterix.app.translator.QueryTranslator;
+import org.apache.asterix.common.app.SessionConfig;
+import org.apache.asterix.compiler.provider.ILangCompilationProvider;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+
+public class BADStatementExecutor extends QueryTranslator {
+
+    public BADStatementExecutor(List<Statement> aqlStatements, SessionConfig conf,
+            ILangCompilationProvider compliationProvider, CompilerExtensionManager ccExtensionManager) {
+        super(aqlStatements, conf, compliationProvider, ccExtensionManager);
+    }
+
+    @Override
+    protected void handleDataverseDropStatement(AqlMetadataProvider metadataProvider, Statement stmt,
+            IHyracksClientConnection hcc) throws Exception {
+        //super(metadataProvider, stmt, hcc);
+        //TODO: need to drop channels and brokers
+        //TODO: need to check if datasets or functions are in use by channels
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java
new file mode 100644
index 0000000..d89617b
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java
@@ -0,0 +1,99 @@
+/*
+ * 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.asterix.bad.lang.statement;
+
+import org.apache.asterix.algebra.extension.IExtensionStatement;
+import org.apache.asterix.app.translator.QueryTranslator;
+import org.apache.asterix.bad.lang.BADLangExtension;
+import org.apache.asterix.bad.metadata.Broker;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.asterix.metadata.MetadataManager;
+import org.apache.asterix.metadata.MetadataTransactionContext;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.translator.IStatementExecutor;
+import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
+import org.apache.asterix.translator.IStatementExecutor.Stats;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.api.dataset.IHyracksDataset;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class BrokerDropStatement implements IExtensionStatement {
+
+    private final Identifier dataverseName;
+    private final Identifier brokerName;
+    private boolean ifExists;
+
+    public BrokerDropStatement(Identifier dataverseName, Identifier brokerName, boolean ifExists) {
+        this.brokerName = brokerName;
+        this.dataverseName = dataverseName;
+        this.ifExists = ifExists;
+    }
+
+    public boolean getIfExists() {
+        return ifExists;
+    }
+
+    public Identifier getDataverseName() {
+        return dataverseName;
+    }
+
+    public Identifier getBrokerName() {
+        return brokerName;
+    }
+
+    @Override
+    public byte getKind() {
+        return Kind.EXTENSION;
+    }
+
+    @Override
+    public byte getCategory() {
+        return Category.DDL;
+    }
+
+    @Override
+    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws AsterixException {
+        return null;
+    }
+
+    @Override
+    public void handle(IStatementExecutor statementExecutor, AqlMetadataProvider metadataProvider,
+            IHyracksClientConnection hcc, IHyracksDataset hdc, ResultDelivery resultDelivery, Stats stats)
+                    throws HyracksDataException, AlgebricksException {
+        //TODO: dont drop a broker that's being used
+        MetadataTransactionContext mdTxnCtx = null;
+        try {
+            mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
+            metadataProvider.setMetadataTxnContext(mdTxnCtx);
+            Broker broker = BADLangExtension.getBroker(mdTxnCtx, dataverseName.getValue(), brokerName.getValue());
+            if (broker == null) {
+                throw new AlgebricksException("A broker with this name " + brokerName + " doesn't exist.");
+            }
+            MetadataManager.INSTANCE.deleteEntity(mdTxnCtx, broker);
+            MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+        } catch (Exception e) {
+            QueryTranslator.abort(e, e, mdTxnCtx);
+            throw new HyracksDataException(e);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java
new file mode 100644
index 0000000..60fcf1f
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java
@@ -0,0 +1,166 @@
+/*
+ * 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.asterix.bad.lang.statement;
+
+import org.apache.asterix.active.ActiveJobNotificationHandler;
+import org.apache.asterix.active.ActiveRuntimeId;
+import org.apache.asterix.active.EntityId;
+import org.apache.asterix.active.message.ActiveManagerMessage;
+import org.apache.asterix.algebra.extension.IExtensionStatement;
+import org.apache.asterix.app.translator.QueryTranslator;
+import org.apache.asterix.bad.BADConstants;
+import org.apache.asterix.bad.lang.BADLangExtension;
+import org.apache.asterix.bad.metadata.Channel;
+import org.apache.asterix.bad.metadata.ChannelEventsListener;
+import org.apache.asterix.bad.runtime.RepetitiveChannelOperatorNodePushable;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.messaging.api.ICCMessageBroker;
+import org.apache.asterix.external.feed.api.IActiveLifecycleEventSubscriber;
+import org.apache.asterix.external.feed.api.IActiveLifecycleEventSubscriber.ActiveLifecycleEvent;
+import org.apache.asterix.external.feed.management.ActiveLifecycleEventSubscriber;
+import org.apache.asterix.lang.common.statement.DropDatasetStatement;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.asterix.metadata.MetadataManager;
+import org.apache.asterix.metadata.MetadataTransactionContext;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.runtime.util.AsterixAppContextInfo;
+import org.apache.asterix.translator.IStatementExecutor;
+import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
+import org.apache.asterix.translator.IStatementExecutor.Stats;
+import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.api.dataset.IHyracksDataset;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class ChannelDropStatement implements IExtensionStatement {
+
+    private final Identifier dataverseName;
+    private final Identifier channelName;
+    private boolean ifExists;
+
+    public ChannelDropStatement(Identifier dataverseName, Identifier channelName, boolean ifExists) {
+        this.dataverseName = dataverseName;
+        this.channelName = channelName;
+        this.ifExists = ifExists;
+    }
+
+    public Identifier getDataverseName() {
+        return dataverseName;
+    }
+
+    public Identifier getChannelName() {
+        return channelName;
+    }
+
+    public boolean getIfExists() {
+        return ifExists;
+    }
+
+    @Override
+    public byte getKind() {
+        return Kind.EXTENSION;
+    }
+
+    @Override
+    public byte getCategory() {
+        return Category.DDL;
+    }
+
+    @Override
+    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws AsterixException {
+        return null;
+    }
+
+    @Override
+    public void handle(IStatementExecutor statementExecutor, AqlMetadataProvider metadataProvider,
+            IHyracksClientConnection hcc, IHyracksDataset hdc, ResultDelivery resultDelivery, Stats stats)
+                    throws HyracksDataException, AlgebricksException {
+        boolean txnActive = false;
+        EntityId entityId = new EntityId(BADConstants.CHANNEL_EXTENSION_NAME, dataverseName.getValue(),
+                channelName.getValue());
+        ChannelEventsListener listener = (ChannelEventsListener) ActiveJobNotificationHandler.INSTANCE
+                .getActiveEntityListener(entityId);
+        IActiveLifecycleEventSubscriber eventSubscriber = new ActiveLifecycleEventSubscriber();
+        boolean subscriberRegistered = false;
+        Channel channel = null;
+
+        MetadataTransactionContext mdTxnCtx = null;
+        try {
+            mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
+            txnActive = true;
+            channel = BADLangExtension.getChannel(mdTxnCtx, dataverseName.getValue(), channelName.getValue());
+            MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+            txnActive = false;
+            if (channel == null) {
+                if (ifExists) {
+                    MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+                    return;
+                } else {
+                    throw new AlgebricksException("There is no channel with this name " + channelName + ".");
+                }
+            }
+            if (listener != null) {
+                subscriberRegistered = listener.isChannelActive(entityId, eventSubscriber);
+            }
+            if (!subscriberRegistered) {
+                throw new AsterixException("Channel " + channelName + " is not running");
+            }
+
+            ICCMessageBroker messageBroker = (ICCMessageBroker) AsterixAppContextInfo.INSTANCE.getCCApplicationContext()
+                    .getMessageBroker();
+            AlgebricksAbsolutePartitionConstraint locations = channel.getPartitionConstraint();
+            int partition = 0;
+            for (String location : locations.getLocations()) {
+                messageBroker.sendApplicationMessageToNC(
+                        new ActiveManagerMessage(ActiveManagerMessage.STOP_ACTIVITY, "cc",
+                                new ActiveRuntimeId(channel.getChannelId(),
+                                        RepetitiveChannelOperatorNodePushable.class.getSimpleName(), partition++)),
+                        location);
+            }
+            eventSubscriber.assertEvent(ActiveLifecycleEvent.ACTIVE_JOB_ENDED);
+
+            //Drop the Channel Datasets
+            //TODO: Need to find some way to handle if this fails.
+            //TODO: Prevent datasets for Channels from being dropped elsewhere
+            DropDatasetStatement dropStmt = new DropDatasetStatement(dataverseName,
+                    new Identifier(channel.getResultsDatasetName()), true);
+            ((QueryTranslator) statementExecutor).handleDatasetDropStatement(metadataProvider, dropStmt, hcc);
+
+            dropStmt = new DropDatasetStatement(dataverseName, new Identifier(channel.getSubscriptionsDataset()), true);
+            ((QueryTranslator) statementExecutor).handleDatasetDropStatement(metadataProvider, dropStmt, hcc);
+
+            if (subscriberRegistered) {
+                listener.deregisterEventSubscriber(eventSubscriber);
+            }
+
+            //Remove the Channel Metadata
+            MetadataManager.INSTANCE.deleteEntity(mdTxnCtx, channel);
+            MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+        } catch (Exception e) {
+            e.printStackTrace();
+            if (txnActive) {
+                QueryTranslator.abort(e, e, mdTxnCtx);
+            }
+            throw new HyracksDataException(e);
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelSubscribeStatement.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelSubscribeStatement.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelSubscribeStatement.java
new file mode 100644
index 0000000..bfa6bf1
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelSubscribeStatement.java
@@ -0,0 +1,202 @@
+/*
+ * 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.asterix.bad.lang.statement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.asterix.algebra.extension.IExtensionStatement;
+import org.apache.asterix.app.translator.QueryTranslator;
+import org.apache.asterix.bad.BADConstants;
+import org.apache.asterix.bad.lang.BADLangExtension;
+import org.apache.asterix.bad.metadata.Broker;
+import org.apache.asterix.bad.metadata.Channel;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.literal.StringLiteral;
+import org.apache.asterix.lang.common.statement.InsertStatement;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.statement.UpsertStatement;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.asterix.metadata.MetadataManager;
+import org.apache.asterix.metadata.MetadataTransactionContext;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.translator.IStatementExecutor;
+import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
+import org.apache.asterix.translator.IStatementExecutor.Stats;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.api.dataset.IHyracksDataset;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class ChannelSubscribeStatement implements IExtensionStatement {
+
+    private final Identifier dataverseName;
+    private final Identifier channelName;
+    private final Identifier brokerDataverseName;
+    private final Identifier brokerName;
+    private final List<Expression> argList;
+    private final String subscriptionId;
+    private final int varCounter;
+
+    public ChannelSubscribeStatement(Identifier dataverseName, Identifier channelName, List<Expression> argList,
+            int varCounter, Identifier brokerDataverseName, Identifier brokerName, String subscriptionId) {
+        this.channelName = channelName;
+        this.dataverseName = dataverseName;
+        this.brokerDataverseName = brokerDataverseName;
+        this.brokerName = brokerName;
+        this.argList = argList;
+        this.subscriptionId = subscriptionId;
+        this.varCounter = varCounter;
+    }
+
+    public Identifier getDataverseName() {
+        return dataverseName;
+    }
+
+    public Identifier getBrokerDataverseName() {
+        return brokerDataverseName;
+    }
+
+    public Identifier getChannelName() {
+        return channelName;
+    }
+
+    public Identifier getBrokerName() {
+        return brokerName;
+    }
+
+    public List<Expression> getArgList() {
+        return argList;
+    }
+
+    public int getVarCounter() {
+        return varCounter;
+    }
+
+    public String getSubscriptionId() {
+        return subscriptionId;
+    }
+
+    @Override
+    public byte getKind() {
+        return Kind.EXTENSION;
+    }
+
+    @Override
+    public byte getCategory() {
+        return Category.QUERY;
+    }
+
+    @Override
+    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws AsterixException {
+        return null;
+    }
+
+    @Override
+    public void handle(IStatementExecutor statementExecutor, AqlMetadataProvider metadataProvider,
+            IHyracksClientConnection hcc, IHyracksDataset hdc, ResultDelivery resultDelivery, Stats stats)
+                    throws HyracksDataException, AlgebricksException {
+
+        MetadataTransactionContext mdTxnCtx = null;
+        try {
+            mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
+
+            Channel channel = BADLangExtension.getChannel(mdTxnCtx, dataverseName.getValue(), channelName.getValue());
+            if (channel == null) {
+                throw new AsterixException("There is no channel with this name " + channelName + ".");
+            }
+            Broker broker = BADLangExtension.getBroker(mdTxnCtx, brokerDataverseName.getValue(), brokerName.getValue());
+            if (broker == null) {
+                throw new AsterixException("There is no broker with this name " + brokerName + ".");
+            }
+
+            String subscriptionsDatasetName = channel.getSubscriptionsDataset();
+            List<String> returnField = new ArrayList<String>();
+            returnField.add(BADConstants.SubscriptionId);
+
+            if (argList.size() != channel.getFunction().getArity()) {
+                throw new AsterixException("Channel expected " + channel.getFunction().getArity()
+                        + " parameters but got " + argList.size());
+            }
+
+            Query subscriptionTuple = new Query(false);
+
+            List<FieldBinding> fb = new ArrayList<FieldBinding>();
+            LiteralExpr leftExpr = new LiteralExpr(new StringLiteral(BADConstants.BrokerDataverse));
+            Expression rightExpr = new LiteralExpr(new StringLiteral(broker.getDataverseName()));
+            fb.add(new FieldBinding(leftExpr, rightExpr));
+
+            leftExpr = new LiteralExpr(new StringLiteral(BADConstants.BrokerName));
+            rightExpr = new LiteralExpr(new StringLiteral(broker.getBrokerName()));
+            fb.add(new FieldBinding(leftExpr, rightExpr));
+
+            if (subscriptionId != null) {
+                leftExpr = new LiteralExpr(new StringLiteral(BADConstants.SubscriptionId));
+
+                List<Expression> UUIDList = new ArrayList<Expression>();
+                UUIDList.add(new LiteralExpr(new StringLiteral(subscriptionId)));
+                FunctionIdentifier function = AsterixBuiltinFunctions.UUID_CONSTRUCTOR;
+                FunctionSignature UUIDfunc = new FunctionSignature(function.getNamespace(), function.getName(),
+                        function.getArity());
+                CallExpr UUIDCall = new CallExpr(UUIDfunc, UUIDList);
+
+                rightExpr = UUIDCall;
+                fb.add(new FieldBinding(leftExpr, rightExpr));
+            }
+
+            for (int i = 0; i < argList.size(); i++) {
+                leftExpr = new LiteralExpr(new StringLiteral("param" + i));
+                rightExpr = argList.get(i);
+                fb.add(new FieldBinding(leftExpr, rightExpr));
+            }
+            RecordConstructor recordCon = new RecordConstructor(fb);
+            subscriptionTuple.setBody(recordCon);
+
+            subscriptionTuple.setVarCounter(varCounter);
+
+            if (subscriptionId == null) {
+                InsertStatement insert = new InsertStatement(dataverseName, new Identifier(subscriptionsDatasetName),
+                        subscriptionTuple, varCounter, false, returnField);
+                ((QueryTranslator) statementExecutor).handleInsertUpsertStatement(metadataProvider, insert, hcc, hdc,
+                        resultDelivery, stats, false);
+            } else {
+                UpsertStatement upsert = new UpsertStatement(dataverseName, new Identifier(subscriptionsDatasetName),
+                        subscriptionTuple, varCounter);
+                ((QueryTranslator) statementExecutor).handleInsertUpsertStatement(metadataProvider, upsert, hcc, hdc,
+                        resultDelivery, stats, false);
+            }
+
+            MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+        } catch (Exception e) {
+            QueryTranslator.abort(e, e, mdTxnCtx);
+            throw new HyracksDataException(e);
+        }
+
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelUnsubscribeStatement.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelUnsubscribeStatement.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelUnsubscribeStatement.java
new file mode 100644
index 0000000..17e3ad2
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/ChannelUnsubscribeStatement.java
@@ -0,0 +1,154 @@
+/*
+ * 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.asterix.bad.lang.statement;
+
+import java.util.List;
+
+import org.apache.asterix.algebra.extension.IExtensionStatement;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.translator.IStatementExecutor;
+import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
+import org.apache.asterix.translator.IStatementExecutor.Stats;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.api.dataset.IHyracksDataset;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class ChannelUnsubscribeStatement implements IExtensionStatement {
+
+    private final Identifier dataverseName;
+    private final Identifier channelName;
+    private final String subscriptionId;
+    private final int varCounter;
+    private VariableExpr vars;
+    private List<String> dataverses;
+    private List<String> datasets;
+
+    public ChannelUnsubscribeStatement(VariableExpr vars, Identifier dataverseName, Identifier channelName,
+            String subscriptionId, int varCounter, List<String> dataverses, List<String> datasets) {
+        this.vars = vars;
+        this.channelName = channelName;
+        this.dataverseName = dataverseName;
+        this.subscriptionId = subscriptionId;
+        this.varCounter = varCounter;
+        this.dataverses = dataverses;
+        this.datasets = datasets;
+    }
+
+    public Identifier getDataverseName() {
+        return dataverseName;
+    }
+
+    public VariableExpr getVariableExpr() {
+        return vars;
+    }
+
+    public Identifier getChannelName() {
+        return channelName;
+    }
+
+    public String getsubScriptionId() {
+        return subscriptionId;
+    }
+
+    public List<String> getDataverses() {
+        return dataverses;
+    }
+
+    public List<String> getDatasets() {
+        return datasets;
+    }
+
+    public int getVarCounter() {
+        return varCounter;
+    }
+
+    @Override
+    public byte getKind() {
+        return Kind.EXTENSION;
+    }
+
+    @Override
+    public byte getCategory() {
+        return Category.UPDATE;
+    }
+
+    @Override
+    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws AsterixException {
+        return null;
+    }
+
+    @Override
+    public void handle(IStatementExecutor statementExecutor, AqlMetadataProvider metadataProvider,
+            IHyracksClientConnection hcc, IHyracksDataset hdc, ResultDelivery resultDelivery, Stats stats)
+                    throws HyracksDataException, AlgebricksException {
+        /*  ChannelUnsubscribeStatement stmtChannelSub = (ChannelUnsubscribeStatement) stmt;
+        String dataverseName = getActiveDataverse(stmtChannelSub.getDataverseName());
+        Identifier channelName = stmtChannelSub.getChannelName();
+        MetadataTransactionContext mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
+        metadataProvider.setMetadataTxnContext(mdTxnCtx);
+        MetadataLockManager.INSTANCE.readChannelBegin(dataverseName, dataverseName + "." + channelName);
+        try {
+            Channel channel = MetadataManager.INSTANCE.getChannel(mdTxnCtx, dataverseName, channelName.getValue());
+            if (channel == null) {
+                throw new AsterixException("There is no channel with this name " + channelName + ".");
+            }
+            Identifier subscriptionsDatasetName = new Identifier(channel.getSubscriptionsDataset());
+        
+            VariableExpr vars = stmtChannelSub.getVariableExpr();
+        
+            //Need a condition to say subscription-id = sid
+            OperatorExpr condition = new OperatorExpr();
+            FieldAccessor fa = new FieldAccessor(vars, new Identifier(ActiveConstants.SubscriptionId));
+            condition.addOperand(fa);
+            condition.setCurrentop(true);
+            condition.addOperator("=");
+        
+            String sid = stmtChannelSub.getsubScriptionId();
+            List<Expression> UUIDList = new ArrayList<Expression>();
+            UUIDList.add(new LiteralExpr(new StringLiteral(sid)));
+        
+            FunctionIdentifier function = AsterixBuiltinFunctions.UUID_CONSTRUCTOR;
+            FunctionSignature UUIDfunc = new FunctionSignature(function.getNamespace(), function.getName(),
+                    function.getArity());
+            CallExpr UUIDCall = new CallExpr(UUIDfunc, UUIDList);
+        
+            condition.addOperand(UUIDCall);
+        
+            DeleteStatement delete = new DeleteStatement(vars, new Identifier(dataverseName), subscriptionsDatasetName,
+                    condition, stmtChannelSub.getVarCounter(), stmtChannelSub.getDataverses(),
+                    stmtChannelSub.getDatasets());
+            AqlDeleteRewriteVisitor visitor = new AqlDeleteRewriteVisitor();
+            delete.accept(visitor, null);
+        
+            handleDeleteStatement(metadataProvider, delete, hcc);
+            MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+        
+        } catch (Exception e) {
+            abort(e, e, mdTxnCtx);
+            throw e;
+        } finally {
+            MetadataLockManager.INSTANCE.readChannelEnd(dataverseName, dataverseName + "." + channelName);
+        }*/
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/CreateBrokerStatement.java
----------------------------------------------------------------------
diff --git a/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/CreateBrokerStatement.java b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/CreateBrokerStatement.java
new file mode 100644
index 0000000..5b480ae
--- /dev/null
+++ b/asterix-opt/src/main/java/org/apache/asterix/bad/lang/statement/CreateBrokerStatement.java
@@ -0,0 +1,105 @@
+/*
+ * 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.asterix.bad.lang.statement;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.asterix.algebra.extension.IExtensionStatement;
+import org.apache.asterix.app.translator.QueryTranslator;
+import org.apache.asterix.bad.lang.BADLangExtension;
+import org.apache.asterix.bad.metadata.Broker;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
+import org.apache.asterix.metadata.MetadataManager;
+import org.apache.asterix.metadata.MetadataTransactionContext;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.translator.IStatementExecutor;
+import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
+import org.apache.asterix.translator.IStatementExecutor.Stats;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.client.IHyracksClientConnection;
+import org.apache.hyracks.api.dataset.IHyracksDataset;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class CreateBrokerStatement implements IExtensionStatement {
+
+    private static final Logger LOGGER = Logger.getLogger(CreateBrokerStatement.class.getName());
+    private final Identifier dataverseName;
+    private final Identifier brokerName;
+    private String endPointName;
+
+    public CreateBrokerStatement(Identifier dataverseName, Identifier brokerName, String endPointName) {
+        this.brokerName = brokerName;
+        this.dataverseName = dataverseName;
+        this.endPointName = endPointName;
+    }
+
+    public String getEndPointName() {
+        return endPointName;
+    }
+
+    public Identifier getDataverseName() {
+        return dataverseName;
+    }
+
+    public Identifier getBrokerName() {
+        return brokerName;
+    }
+
+    @Override
+    public byte getKind() {
+        return Kind.EXTENSION;
+    }
+
+    @Override
+    public byte getCategory() {
+        return Category.DDL;
+    }
+
+    @Override
+    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws AsterixException {
+        return null;
+    }
+
+    @Override
+    public void handle(IStatementExecutor statementExecutor, AqlMetadataProvider metadataProvider,
+            IHyracksClientConnection hcc, IHyracksDataset hdc, ResultDelivery resultDelivery, Stats stats)
+                    throws HyracksDataException, AlgebricksException {
+        MetadataTransactionContext mdTxnCtx = null;
+        try {
+            mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
+            metadataProvider.setMetadataTxnContext(mdTxnCtx);
+            Broker broker = BADLangExtension.getBroker(mdTxnCtx, dataverseName.getValue(), brokerName.getValue());
+            if (broker != null) {
+                throw new AlgebricksException("A broker with this name " + brokerName + " already exists.");
+            }
+            broker = new Broker(dataverseName.getValue(), brokerName.getValue(), endPointName);
+            MetadataManager.INSTANCE.addEntity(mdTxnCtx, broker);
+            MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
+        } catch (Exception e) {
+            if (mdTxnCtx != null) {
+                QueryTranslator.abort(e, e, mdTxnCtx);
+            }
+            LOGGER.log(Level.WARNING, "Failed creating a broker", e);
+            throw new HyracksDataException(e);
+        }
+    }
+}
\ No newline at end of file