asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjaco...@apache.org
Subject [12/12] asterixdb-bad git commit: Initial commit
Date Fri, 09 Sep 2016 20:41:51 GMT
Initial commit


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

Branch: refs/heads/master
Commit: bdba1b863020f90549095fead46e63184e55d25a
Parents: 
Author: Steven Glenn Jacobs <sjaco002@ucr.edu>
Authored: Fri Sep 9 13:40:18 2016 -0700
Committer: Steven Glenn Jacobs <sjaco002@ucr.edu>
Committed: Fri Sep 9 13:40:18 2016 -0700

----------------------------------------------------------------------
 .classpath                                      |   42 +
 .project                                        |   28 +
 .settings/org.eclipse.core.resources.prefs      |    7 +
 .settings/org.eclipse.jdt.core.prefs            |    5 +
 .settings/org.eclipse.m2e.core.prefs            |    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 0 -> 1048576 bytes
 .../name1/current/fsimage_0000000000000000000   |  Bin 0 -> 204 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 0 -> 1048576 bytes
 .../name2/current/fsimage_0000000000000000000   |  Bin 0 -> 204 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 0 -> 165124 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 0 -> 1190 bytes
 .../org/apache/asterix/bad/BADConstants.class   |  Bin 0 -> 1005 bytes
 .../org/apache/asterix/bad/ChannelJobInfo.class |  Bin 0 -> 1673 bytes
 .../apache/asterix/bad/ChannelJobService.class  |  Bin 0 -> 6182 bytes
 .../asterix/bad/lang/BADAQLParser$1.class       |  Bin 0 -> 240 bytes
 .../bad/lang/BADAQLParser$FunctionName.class    |  Bin 0 -> 725 bytes
 .../bad/lang/BADAQLParser$IndexParams.class     |  Bin 0 -> 794 bytes
 .../asterix/bad/lang/BADAQLParser$JJCalls.class |  Bin 0 -> 521 bytes
 .../lang/BADAQLParser$LookaheadSuccess.class    |  Bin 0 -> 567 bytes
 .../apache/asterix/bad/lang/BADAQLParser.class  |  Bin 0 -> 100260 bytes
 .../bad/lang/BADAQLParserConstants.class        |  Bin 0 -> 8427 bytes
 .../bad/lang/BADAQLParserTokenManager.class     |  Bin 0 -> 47691 bytes
 .../bad/lang/BADCompilationProvider.class       |  Bin 0 -> 1308 bytes
 .../asterix/bad/lang/BADLangExtension$1.class   |  Bin 0 -> 912 bytes
 .../asterix/bad/lang/BADLangExtension.class     |  Bin 0 -> 6111 bytes
 .../asterix/bad/lang/BADParserFactory.class     |  Bin 0 -> 855 bytes
 ...BADQueryTranslatorExtension$LazyHolder.class |  Bin 0 -> 1155 bytes
 .../bad/lang/BADQueryTranslatorExtension.class  |  Bin 0 -> 1573 bytes
 .../bad/lang/BADQueryTranslatorFactory.class    |  Bin 0 -> 1892 bytes
 .../asterix/bad/lang/BADStatementExecutor.class |  Bin 0 -> 1750 bytes
 .../asterix/bad/lang/JavaCharStream.class       |  Bin 0 -> 9889 bytes
 .../asterix/bad/lang/ParseException.class       |  Bin 0 -> 3760 bytes
 .../org/apache/asterix/bad/lang/Token.class     |  Bin 0 -> 1265 bytes
 .../apache/asterix/bad/lang/TokenMgrError.class |  Bin 0 -> 2865 bytes
 .../lang/statement/BrokerDropStatement.class    |  Bin 0 -> 5083 bytes
 .../lang/statement/ChannelDropStatement.class   |  Bin 0 -> 9347 bytes
 .../statement/ChannelSubscribeStatement.class   |  Bin 0 -> 10902 bytes
 .../statement/ChannelUnsubscribeStatement.class |  Bin 0 -> 4351 bytes
 .../lang/statement/CreateBrokerStatement.class  |  Bin 0 -> 5718 bytes
 .../lang/statement/CreateChannelStatement.class |  Bin 0 -> 23785 bytes
 .../bad/metadata/BADMetadataExtension.class     |  Bin 0 -> 4750 bytes
 .../bad/metadata/BADMetadataIndexes.class       |  Bin 0 -> 2816 bytes
 .../bad/metadata/BADMetadataRecordTypes.class   |  Bin 0 -> 3178 bytes
 .../apache/asterix/bad/metadata/Broker.class    |  Bin 0 -> 1509 bytes
 .../asterix/bad/metadata/BrokerSearchKey.class  |  Bin 0 -> 1266 bytes
 .../bad/metadata/BrokerTupleTranslator.class    |  Bin 0 -> 5829 bytes
 .../apache/asterix/bad/metadata/Channel.class   |  Bin 0 -> 2781 bytes
 .../bad/metadata/ChannelEventsListener$1.class  |  Bin 0 -> 906 bytes
 .../bad/metadata/ChannelEventsListener.class    |  Bin 0 -> 12124 bytes
 .../asterix/bad/metadata/ChannelSearchKey.class |  Bin 0 -> 1271 bytes
 .../bad/metadata/ChannelTupleTranslator.class   |  Bin 0 -> 7302 bytes
 .../InsertBrokerNotifierForChannelRule.class    |  Bin 0 -> 15855 bytes
 .../bad/runtime/NotifyBrokerOperator.class      |  Bin 0 -> 2629 bytes
 .../bad/runtime/NotifyBrokerPOperator.class     |  Bin 0 -> 7083 bytes
 .../bad/runtime/NotifyBrokerRuntime.class       |  Bin 0 -> 7215 bytes
 .../runtime/NotifyBrokerRuntimeFactory.class    |  Bin 0 -> 1944 bytes
 .../RepetitiveChannelOperatorDescriptor.class   |  Bin 0 -> 3383 bytes
 ...epetitiveChannelOperatorNodePushable$1.class |  Bin 0 -> 1000 bytes
 .../RepetitiveChannelOperatorNodePushable.class |  Bin 0 -> 4481 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 0 -> 4444 bytes
 .../asterix/bad/test/BADOptimizerTest.class     |  Bin 0 -> 1922 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 +
 209 files changed, 20862 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/.classpath
----------------------------------------------------------------------
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..dfab2cd
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/classes" path="target/generated-sources/javacc">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/.project
----------------------------------------------------------------------
diff --git a/.project b/.project
new file mode 100644
index 0000000..4234ee0
--- /dev/null
+++ b/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>asterix-active</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.sonarlint.eclipse.core.sonarlintBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/.settings/org.eclipse.core.resources.prefs
----------------------------------------------------------------------
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..12e1c9a
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding//target/generated-sources/javacc=UTF-8
+encoding/<project>=UTF-8

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/.settings/org.eclipse.m2e.core.prefs
----------------------------------------------------------------------
diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION b/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
new file mode 100644
index 0000000..7b1e796
--- /dev/null
+++ b/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
@@ -0,0 +1,5 @@
+#Fri Sep 09 10:35:37 PDT 2016
+namespaceID=404750972
+cTime=0
+blockpoolID=BP-1853864992-192.168.8.104-1473442535767
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/dncp_block_verification.log.curr
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/dncp_block_verification.log.curr b/build/test/data/dfs/data/data1/current/BP-1853864992-192.168.8.104-1473442535767/dncp_block_verification.log.curr
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data1/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data1/current/VERSION b/build/test/data/dfs/data/data1/current/VERSION
new file mode 100644
index 0000000..a58b113
--- /dev/null
+++ b/build/test/data/dfs/data/data1/current/VERSION
@@ -0,0 +1,6 @@
+#Fri Sep 09 10:35:37 PDT 2016
+storageID=DS-142611376-192.168.8.104-52719-1473442537270
+clusterID=testClusterID
+cTime=0
+storageType=DATA_NODE
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data1/in_use.lock
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data1/in_use.lock b/build/test/data/dfs/data/data1/in_use.lock
new file mode 100644
index 0000000..e2d3355
--- /dev/null
+++ b/build/test/data/dfs/data/data1/in_use.lock
@@ -0,0 +1 @@
+44184@Sisyphus.local
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data2/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data2/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION b/build/test/data/dfs/data/data2/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
new file mode 100644
index 0000000..7b1e796
--- /dev/null
+++ b/build/test/data/dfs/data/data2/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
@@ -0,0 +1,5 @@
+#Fri Sep 09 10:35:37 PDT 2016
+namespaceID=404750972
+cTime=0
+blockpoolID=BP-1853864992-192.168.8.104-1473442535767
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data2/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data2/current/VERSION b/build/test/data/dfs/data/data2/current/VERSION
new file mode 100644
index 0000000..a58b113
--- /dev/null
+++ b/build/test/data/dfs/data/data2/current/VERSION
@@ -0,0 +1,6 @@
+#Fri Sep 09 10:35:37 PDT 2016
+storageID=DS-142611376-192.168.8.104-52719-1473442537270
+clusterID=testClusterID
+cTime=0
+storageType=DATA_NODE
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data2/in_use.lock
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data2/in_use.lock b/build/test/data/dfs/data/data2/in_use.lock
new file mode 100644
index 0000000..e2d3355
--- /dev/null
+++ b/build/test/data/dfs/data/data2/in_use.lock
@@ -0,0 +1 @@
+44184@Sisyphus.local
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION b/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
new file mode 100644
index 0000000..7b1e796
--- /dev/null
+++ b/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
@@ -0,0 +1,5 @@
+#Fri Sep 09 10:35:37 PDT 2016
+namespaceID=404750972
+cTime=0
+blockpoolID=BP-1853864992-192.168.8.104-1473442535767
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/dncp_block_verification.log.curr
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/dncp_block_verification.log.curr b/build/test/data/dfs/data/data3/current/BP-1853864992-192.168.8.104-1473442535767/dncp_block_verification.log.curr
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data3/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data3/current/VERSION b/build/test/data/dfs/data/data3/current/VERSION
new file mode 100644
index 0000000..7e828bf
--- /dev/null
+++ b/build/test/data/dfs/data/data3/current/VERSION
@@ -0,0 +1,6 @@
+#Fri Sep 09 10:35:37 PDT 2016
+storageID=DS-178448150-192.168.8.104-52786-1473442537270
+clusterID=testClusterID
+cTime=0
+storageType=DATA_NODE
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data3/in_use.lock
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data3/in_use.lock b/build/test/data/dfs/data/data3/in_use.lock
new file mode 100644
index 0000000..e2d3355
--- /dev/null
+++ b/build/test/data/dfs/data/data3/in_use.lock
@@ -0,0 +1 @@
+44184@Sisyphus.local
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data4/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data4/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION b/build/test/data/dfs/data/data4/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
new file mode 100644
index 0000000..7b1e796
--- /dev/null
+++ b/build/test/data/dfs/data/data4/current/BP-1853864992-192.168.8.104-1473442535767/current/VERSION
@@ -0,0 +1,5 @@
+#Fri Sep 09 10:35:37 PDT 2016
+namespaceID=404750972
+cTime=0
+blockpoolID=BP-1853864992-192.168.8.104-1473442535767
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data4/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data4/current/VERSION b/build/test/data/dfs/data/data4/current/VERSION
new file mode 100644
index 0000000..7e828bf
--- /dev/null
+++ b/build/test/data/dfs/data/data4/current/VERSION
@@ -0,0 +1,6 @@
+#Fri Sep 09 10:35:37 PDT 2016
+storageID=DS-178448150-192.168.8.104-52786-1473442537270
+clusterID=testClusterID
+cTime=0
+storageType=DATA_NODE
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/data/data4/in_use.lock
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/data/data4/in_use.lock b/build/test/data/dfs/data/data4/in_use.lock
new file mode 100644
index 0000000..e2d3355
--- /dev/null
+++ b/build/test/data/dfs/data/data4/in_use.lock
@@ -0,0 +1 @@
+44184@Sisyphus.local
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name1/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name1/current/VERSION b/build/test/data/dfs/name1/current/VERSION
new file mode 100644
index 0000000..71ca2e0
--- /dev/null
+++ b/build/test/data/dfs/name1/current/VERSION
@@ -0,0 +1,7 @@
+#Fri Sep 09 10:35:35 PDT 2016
+namespaceID=404750972
+clusterID=testClusterID
+cTime=0
+storageType=NAME_NODE
+blockpoolID=BP-1853864992-192.168.8.104-1473442535767
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name1/current/edits_inprogress_0000000000000000001
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name1/current/edits_inprogress_0000000000000000001 b/build/test/data/dfs/name1/current/edits_inprogress_0000000000000000001
new file mode 100644
index 0000000..f1ff235
Binary files /dev/null and b/build/test/data/dfs/name1/current/edits_inprogress_0000000000000000001 differ

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name1/current/fsimage_0000000000000000000
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name1/current/fsimage_0000000000000000000 b/build/test/data/dfs/name1/current/fsimage_0000000000000000000
new file mode 100644
index 0000000..c22c27e
Binary files /dev/null and b/build/test/data/dfs/name1/current/fsimage_0000000000000000000 differ

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name1/current/fsimage_0000000000000000000.md5
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name1/current/fsimage_0000000000000000000.md5 b/build/test/data/dfs/name1/current/fsimage_0000000000000000000.md5
new file mode 100644
index 0000000..645a3b7
--- /dev/null
+++ b/build/test/data/dfs/name1/current/fsimage_0000000000000000000.md5
@@ -0,0 +1 @@
+b8bf059807312f9ac971661b83eb3c56 *fsimage_0000000000000000000

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name1/current/seen_txid
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name1/current/seen_txid b/build/test/data/dfs/name1/current/seen_txid
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/build/test/data/dfs/name1/current/seen_txid
@@ -0,0 +1 @@
+1

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name1/in_use.lock
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name1/in_use.lock b/build/test/data/dfs/name1/in_use.lock
new file mode 100644
index 0000000..e2d3355
--- /dev/null
+++ b/build/test/data/dfs/name1/in_use.lock
@@ -0,0 +1 @@
+44184@Sisyphus.local
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name2/current/VERSION
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name2/current/VERSION b/build/test/data/dfs/name2/current/VERSION
new file mode 100644
index 0000000..71ca2e0
--- /dev/null
+++ b/build/test/data/dfs/name2/current/VERSION
@@ -0,0 +1,7 @@
+#Fri Sep 09 10:35:35 PDT 2016
+namespaceID=404750972
+clusterID=testClusterID
+cTime=0
+storageType=NAME_NODE
+blockpoolID=BP-1853864992-192.168.8.104-1473442535767
+layoutVersion=-47

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name2/current/edits_inprogress_0000000000000000001
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name2/current/edits_inprogress_0000000000000000001 b/build/test/data/dfs/name2/current/edits_inprogress_0000000000000000001
new file mode 100644
index 0000000..f1ff235
Binary files /dev/null and b/build/test/data/dfs/name2/current/edits_inprogress_0000000000000000001 differ

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name2/current/fsimage_0000000000000000000
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name2/current/fsimage_0000000000000000000 b/build/test/data/dfs/name2/current/fsimage_0000000000000000000
new file mode 100644
index 0000000..c22c27e
Binary files /dev/null and b/build/test/data/dfs/name2/current/fsimage_0000000000000000000 differ

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name2/current/fsimage_0000000000000000000.md5
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name2/current/fsimage_0000000000000000000.md5 b/build/test/data/dfs/name2/current/fsimage_0000000000000000000.md5
new file mode 100644
index 0000000..645a3b7
--- /dev/null
+++ b/build/test/data/dfs/name2/current/fsimage_0000000000000000000.md5
@@ -0,0 +1 @@
+b8bf059807312f9ac971661b83eb3c56 *fsimage_0000000000000000000

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name2/current/seen_txid
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name2/current/seen_txid b/build/test/data/dfs/name2/current/seen_txid
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/build/test/data/dfs/name2/current/seen_txid
@@ -0,0 +1 @@
+1

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/build/test/data/dfs/name2/in_use.lock
----------------------------------------------------------------------
diff --git a/build/test/data/dfs/name2/in_use.lock b/build/test/data/dfs/name2/in_use.lock
new file mode 100644
index 0000000..e2d3355
--- /dev/null
+++ b/build/test/data/dfs/name2/in_use.lock
@@ -0,0 +1 @@
+44184@Sisyphus.local
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/bdba1b86/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..72dcd33
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/BADConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/BADConstants.java b/src/main/java/org/apache/asterix/bad/BADConstants.java
new file mode 100644
index 0000000..aeef031
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java b/src/main/java/org/apache/asterix/bad/ChannelJobInfo.java
new file mode 100644
index 0000000..da0c43b
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/ChannelJobService.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/ChannelJobService.java b/src/main/java/org/apache/asterix/bad/ChannelJobService.java
new file mode 100644
index 0000000..8310f70
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java b/src/main/java/org/apache/asterix/bad/lang/BADCompilationProvider.java
new file mode 100644
index 0000000..42036af
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java b/src/main/java/org/apache/asterix/bad/lang/BADLangExtension.java
new file mode 100644
index 0000000..9832fe6
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java b/src/main/java/org/apache/asterix/bad/lang/BADParserFactory.java
new file mode 100644
index 0000000..58bca17
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java b/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorExtension.java
new file mode 100644
index 0000000..4198230
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java b/src/main/java/org/apache/asterix/bad/lang/BADQueryTranslatorFactory.java
new file mode 100644
index 0000000..b8a6050
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java b/src/main/java/org/apache/asterix/bad/lang/BADStatementExecutor.java
new file mode 100644
index 0000000..1c17794
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java b/src/main/java/org/apache/asterix/bad/lang/statement/BrokerDropStatement.java
new file mode 100644
index 0000000..d89617b
--- /dev/null
+++ b/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/bdba1b86/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java b/src/main/java/org/apache/asterix/bad/lang/statement/ChannelDropStatement.java
new file mode 100644
index 0000000..60fcf1f
--- /dev/null
+++ b/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


Mime
View raw message