You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by av...@apache.org on 2018/01/02 21:59:43 UTC

[5/7] ambari git commit: AMBARI-22717 : Remove Anomaly Detection code from branch-3.0-ams. (avijayan)

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/hbase-site.xml b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/hbase-site.xml
deleted file mode 100644
index 66f0454..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/hbase-site.xml
+++ /dev/null
@@ -1,286 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- *
- * 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.
- */
--->
-<configuration>
-    
-    <property>
-      <name>dfs.client.read.shortcircuit</name>
-      <value>true</value>
-    </property>
-    
-    <property>
-      <name>hbase.client.scanner.caching</name>
-      <value>10000</value>
-    </property>
-    
-    <property>
-      <name>hbase.client.scanner.timeout.period</name>
-      <value>300000</value>
-    </property>
-    
-    <property>
-      <name>hbase.cluster.distributed</name>
-      <value>false</value>
-    </property>
-    
-    <property>
-      <name>hbase.hregion.majorcompaction</name>
-      <value>0</value>
-    </property>
-    
-    <property>
-      <name>hbase.hregion.max.filesize</name>
-      <value>4294967296</value>
-    </property>
-    
-    <property>
-      <name>hbase.hregion.memstore.block.multiplier</name>
-      <value>4</value>
-    </property>
-    
-    <property>
-      <name>hbase.hregion.memstore.flush.size</name>
-      <value>134217728</value>
-    </property>
-    
-    <property>
-      <name>hbase.hstore.blockingStoreFiles</name>
-      <value>200</value>
-    </property>
-    
-    <property>
-      <name>hbase.hstore.flusher.count</name>
-      <value>2</value>
-    </property>
-    
-    <property>
-      <name>hbase.local.dir</name>
-      <value>${hbase.tmp.dir}/local</value>
-    </property>
-    
-    <property>
-      <name>hbase.master.info.bindAddress</name>
-      <value>0.0.0.0</value>
-    </property>
-    
-    <property>
-      <name>hbase.master.info.port</name>
-      <value>61310</value>
-    </property>
-    
-    <property>
-      <name>hbase.master.normalizer.class</name>
-      <value>org.apache.hadoop.hbase.master.normalizer.SimpleRegionNormalizer</value>
-    </property>
-    
-    <property>
-      <name>hbase.master.port</name>
-      <value>61300</value>
-    </property>
-    
-    <property>
-      <name>hbase.master.wait.on.regionservers.mintostart</name>
-      <value>1</value>
-    </property>
-    
-    <property>
-      <name>hbase.normalizer.enabled</name>
-      <value>false</value>
-    </property>
-    
-    <property>
-      <name>hbase.normalizer.period</name>
-      <value>600000</value>
-    </property>
-    
-    <property>
-      <name>hbase.regionserver.global.memstore.lowerLimit</name>
-      <value>0.3</value>
-    </property>
-    
-    <property>
-      <name>hbase.regionserver.global.memstore.upperLimit</name>
-      <value>0.35</value>
-    </property>
-    
-    <property>
-      <name>hbase.regionserver.info.port</name>
-      <value>61330</value>
-    </property>
-    
-    <property>
-      <name>hbase.regionserver.port</name>
-      <value>61320</value>
-    </property>
-    
-    <property>
-      <name>hbase.regionserver.thread.compaction.large</name>
-      <value>2</value>
-    </property>
-    
-    <property>
-      <name>hbase.regionserver.thread.compaction.small</name>
-      <value>3</value>
-    </property>
-    
-    <property>
-      <name>hbase.replication</name>
-      <value>false</value>
-    </property>
-    
-    <property>
-      <name>hbase.rootdir</name>
-      <value>file:///var/lib/ambari-metrics-collector/hbase</value>
-    </property>
-    
-    <property>
-      <name>hbase.rpc.timeout</name>
-      <value>300000</value>
-    </property>
-    
-    <property>
-      <name>hbase.snapshot.enabled</name>
-      <value>false</value>
-    </property>
-    
-    <property>
-      <name>hbase.superuser</name>
-      <value>activity_explorer,activity_analyzer</value>
-    </property>
-    
-    <property>
-      <name>hbase.tmp.dir</name>
-      <value>/var/lib/ambari-metrics-collector/hbase-tmp</value>
-    </property>
-    
-    <property>
-      <name>hbase.zookeeper.leaderport</name>
-      <value>61388</value>
-    </property>
-    
-    <property>
-      <name>hbase.zookeeper.peerport</name>
-      <value>61288</value>
-    </property>
-    
-    <property>
-      <name>hbase.zookeeper.property.clientPort</name>
-      <value>61181</value>
-    </property>
-    
-    <property>
-      <name>hbase.zookeeper.property.dataDir</name>
-      <value>${hbase.tmp.dir}/zookeeper</value>
-    </property>
-    
-    <property>
-      <name>hbase.zookeeper.property.tickTime</name>
-      <value>6000</value>
-    </property>
-    
-    <property>
-      <name>hbase.zookeeper.quorum</name>
-      <value>c6401.ambari.apache.org</value>
-      <final>true</final>
-    </property>
-    
-    <property>
-      <name>hfile.block.cache.size</name>
-      <value>0.3</value>
-    </property>
-    
-    <property>
-      <name>phoenix.coprocessor.maxMetaDataCacheSize</name>
-      <value>20480000</value>
-    </property>
-    
-    <property>
-      <name>phoenix.coprocessor.maxServerCacheTimeToLiveMs</name>
-      <value>60000</value>
-    </property>
-    
-    <property>
-      <name>phoenix.groupby.maxCacheSize</name>
-      <value>307200000</value>
-    </property>
-    
-    <property>
-      <name>phoenix.mutate.batchSize</name>
-      <value>10000</value>
-    </property>
-    
-    <property>
-      <name>phoenix.query.keepAliveMs</name>
-      <value>300000</value>
-    </property>
-    
-    <property>
-      <name>phoenix.query.maxGlobalMemoryPercentage</name>
-      <value>15</value>
-    </property>
-    
-    <property>
-      <name>phoenix.query.rowKeyOrderSaltedTable</name>
-      <value>true</value>
-    </property>
-    
-    <property>
-      <name>phoenix.query.spoolThresholdBytes</name>
-      <value>20971520</value>
-    </property>
-    
-    <property>
-      <name>phoenix.query.timeoutMs</name>
-      <value>300000</value>
-    </property>
-    
-    <property>
-      <name>phoenix.sequence.saltBuckets</name>
-      <value>2</value>
-    </property>
-    
-    <property>
-      <name>phoenix.spool.directory</name>
-      <value>${hbase.tmp.dir}/phoenix-spool</value>
-    </property>
-    
-    <property>
-      <name>zookeeper.session.timeout</name>
-      <value>120000</value>
-    </property>
-    
-    <property>
-      <name>zookeeper.session.timeout.localHBaseCluster</name>
-      <value>120000</value>
-    </property>
-    
-    <property>
-      <name>zookeeper.znode.parent</name>
-      <value>/ams-hbase-unsecure</value>
-    </property>
-
-    <property>
-      <name>hbase.use.dynamic.jars</name>
-      <value>false</value>
-    </property>
-
-  </configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/input-config.properties
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/input-config.properties b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/input-config.properties
deleted file mode 100644
index ab106c4..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/resources/input-config.properties
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2011 The Apache Software Foundation
-#
-# 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.
-
-appIds=HOST
-
-collectorHost=localhost
-collectorPort=6188
-collectorProtocol=http
-
-zkQuorum=localhost:2181
-
-ambariServerHost=localhost
-clusterName=c1
-
-emaW=0.8
-emaN=3
-tukeysN=3
-pointInTimeTestInterval=300000
-pointInTimeTrainInterval=900000
-
-ksTestInterval=600000
-ksTrainInterval=600000
-hsdevNhp=3
-hsdevInterval=1800000;
-
-skipMetricPatterns=sdisk*,cpu_sintr*,proc*,disk*,boottime
-hosts=avijayan-ad-1.openstacklocal
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/ADServiceScalaModule.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/ADServiceScalaModule.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/ADServiceScalaModule.scala
deleted file mode 100644
index 8578a80..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/ADServiceScalaModule.scala
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.app
-
-import com.fasterxml.jackson.module.scala._
-import com.fasterxml.jackson.module.scala.deser.{ScalaNumberDeserializersModule, UntypedObjectDeserializerModule}
-import com.fasterxml.jackson.module.scala.introspect.{ScalaAnnotationIntrospector, ScalaAnnotationIntrospectorModule}
-
-/**
-  * Extended Jackson Module that fixes the Scala-Jackson BytecodeReadingParanamer issue.
-  */
-class ADServiceScalaModule extends JacksonModule
-  with IteratorModule
-  with EnumerationModule
-  with OptionModule
-  with SeqModule
-  with IterableModule
-  with TupleModule
-  with MapModule
-  with SetModule
-  with FixedScalaAnnotationIntrospectorModule
-  with UntypedObjectDeserializerModule
-  with EitherModule {
-
-  override def getModuleName = "ADServiceScalaModule"
-
-  object ADServiceScalaModule extends ADServiceScalaModule
-
-}
-
-
-trait FixedScalaAnnotationIntrospectorModule extends JacksonModule {
-  this += { _.appendAnnotationIntrospector(ScalaAnnotationIntrospector) }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
deleted file mode 100644
index 2d0dbdf..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionApp.scala
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-package org.apache.ambari.metrics.adservice.app
-
-import javax.ws.rs.Path
-import javax.ws.rs.container.{ContainerRequestFilter, ContainerResponseFilter}
-
-import org.apache.ambari.metrics.adservice.app.GuiceInjector.{withInjector, wrap}
-import org.apache.ambari.metrics.adservice.db.{AdAnomalyStoreAccessor, MetadataDatasource}
-import org.apache.ambari.metrics.adservice.metadata.MetricDefinitionService
-import org.apache.ambari.metrics.adservice.service.ADQueryService
-import org.glassfish.jersey.filter.LoggingFilter
-
-import com.codahale.metrics.health.HealthCheck
-import com.fasterxml.jackson.databind.{ObjectMapper, SerializationFeature}
-import com.fasterxml.jackson.datatype.joda.JodaModule
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
-import com.fasterxml.jackson.module.scala.DefaultScalaModule
-
-import io.dropwizard.Application
-import io.dropwizard.setup.Environment
-
-class AnomalyDetectionApp extends Application[AnomalyDetectionAppConfig] {
-  override def getName = "anomaly-detection-service"
-
-  override def run(t: AnomalyDetectionAppConfig, env: Environment): Unit = {
-    configure(t, env)
-  }
-
-  def configure(config: AnomalyDetectionAppConfig, env: Environment) {
-    withInjector(new AnomalyDetectionAppModule(config, env)) { injector =>
-      injector.instancesWithAnnotation(classOf[Path]).foreach { r => env.jersey().register(r) }
-      injector.instancesOfType(classOf[HealthCheck]).foreach { h => env.healthChecks.register(h.getClass.getName, h) }
-      injector.instancesOfType(classOf[ContainerRequestFilter]).foreach { f => env.jersey().register(f) }
-      injector.instancesOfType(classOf[ContainerResponseFilter]).foreach { f => env.jersey().register(f) }
-
-      //Initialize Services
-      injector.getInstance(classOf[MetadataDatasource]).initialize
-      injector.getInstance(classOf[MetricDefinitionService]).initialize
-      injector.getInstance(classOf[ADQueryService]).initialize
-    }
-    env.jersey.register(jacksonJaxbJsonProvider)
-    env.jersey.register(new LoggingFilter)
-  }
-
-  private def jacksonJaxbJsonProvider: JacksonJaxbJsonProvider = {
-    val provider = new JacksonJaxbJsonProvider()
-    val objectMapper = new ObjectMapper()
-    objectMapper.registerModule(new ADServiceScalaModule)
-    objectMapper.registerModule(new JodaModule)
-    objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false)
-    objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
-    objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
-    objectMapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, true)
-    provider.setMapper(objectMapper)
-    provider
-  }
-
-  override def bootstrapLogging(): Unit = {}
-}
-
-
-object AnomalyDetectionApp {
-  def main(args: Array[String]): Unit = new AnomalyDetectionApp().run(args: _*)
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppConfig.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppConfig.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppConfig.scala
deleted file mode 100644
index 58efa97..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppConfig.scala
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.app
-
-import javax.validation.Valid
-
-import org.apache.ambari.metrics.adservice.configuration.{HBaseConfiguration, _}
-
-import com.fasterxml.jackson.annotation.{JsonIgnore, JsonIgnoreProperties, JsonProperty}
-
-import io.dropwizard.Configuration
-
-/**
-  * Top Level AD System Manager config items.
-  */
-@JsonIgnoreProperties(ignoreUnknown=true)
-class AnomalyDetectionAppConfig extends Configuration {
-
-  /*
-   Metric Definition Service configuration
-    */
-  @Valid
-  private val metricDefinitionServiceConfiguration = new MetricDefinitionServiceConfiguration
-
-  @Valid
-  private val metricCollectorConfiguration = new MetricCollectorConfiguration
-
-  /*
-   Anomaly Query Service configuration
-    */
-  @Valid
-  private val adServiceConfiguration = new AdServiceConfiguration
-
-  /**
-    * LevelDB settings for metrics definitions
-    */
-  @Valid
-  private val metricDefinitionDBConfiguration = new MetricDefinitionDBConfiguration
-
-  /**
-    * Spark configurations
-    */
-  @Valid
-  private val sparkConfiguration = new SparkConfiguration
-
-  /*
-   AMS HBase Conf
-    */
-  @JsonIgnore
-  def getHBaseConf : org.apache.hadoop.conf.Configuration = {
-    HBaseConfiguration.getHBaseConf
-  }
-
-  @JsonProperty("metricDefinitionService")
-  def getMetricDefinitionServiceConfiguration: MetricDefinitionServiceConfiguration = {
-    metricDefinitionServiceConfiguration
-  }
-
-  @JsonProperty("adQueryService")
-  def getAdServiceConfiguration: AdServiceConfiguration = {
-    adServiceConfiguration
-  }
-
-  @JsonProperty("metricsCollector")
-  def getMetricCollectorConfiguration: MetricCollectorConfiguration = metricCollectorConfiguration
-
-  @JsonProperty("metricDefinitionDB")
-  def getMetricDefinitionDBConfiguration: MetricDefinitionDBConfiguration = metricDefinitionDBConfiguration
-
-  @JsonProperty("spark")
-  def getSparkConfiguration: SparkConfiguration = sparkConfiguration
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppModule.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppModule.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppModule.scala
deleted file mode 100644
index 68e9df9..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/AnomalyDetectionAppModule.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-package org.apache.ambari.metrics.adservice.app
-
-import org.apache.ambari.metrics.adservice.db._
-import org.apache.ambari.metrics.adservice.leveldb.LevelDBDataSource
-import org.apache.ambari.metrics.adservice.metadata.{MetricDefinitionService, MetricDefinitionServiceImpl}
-import org.apache.ambari.metrics.adservice.resource.{AnomalyResource, MetricDefinitionResource, RootResource}
-import org.apache.ambari.metrics.adservice.service.{ADQueryService, ADQueryServiceImpl}
-
-import com.codahale.metrics.health.HealthCheck
-import com.google.inject.AbstractModule
-import com.google.inject.multibindings.Multibinder
-
-import io.dropwizard.setup.Environment
-
-class AnomalyDetectionAppModule(config: AnomalyDetectionAppConfig, env: Environment) extends AbstractModule {
-  override def configure() {
-    bind(classOf[AnomalyDetectionAppConfig]).toInstance(config)
-    bind(classOf[Environment]).toInstance(env)
-    val healthCheckBinder = Multibinder.newSetBinder(binder(), classOf[HealthCheck])
-    healthCheckBinder.addBinding().to(classOf[DefaultHealthCheck])
-    bind(classOf[AnomalyResource])
-    bind(classOf[MetricDefinitionResource])
-    bind(classOf[RootResource])
-    bind(classOf[AdMetadataStoreAccessor]).to(classOf[AdMetadataStoreAccessorImpl])
-    bind(classOf[ADQueryService]).to(classOf[ADQueryServiceImpl])
-    bind(classOf[MetricDefinitionService]).to(classOf[MetricDefinitionServiceImpl])
-    bind(classOf[MetadataDatasource]).to(classOf[LevelDBDataSource])
-    bind(classOf[AdAnomalyStoreAccessor]).to(classOf[PhoenixAnomalyStoreAccessor])
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/DefaultHealthCheck.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/DefaultHealthCheck.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/DefaultHealthCheck.scala
deleted file mode 100644
index c36e8d2..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/DefaultHealthCheck.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-package org.apache.ambari.metrics.adservice.app
-
-import com.codahale.metrics.health.HealthCheck
-import com.codahale.metrics.health.HealthCheck.Result
-
-class DefaultHealthCheck extends HealthCheck {
-  override def check(): Result = Result.healthy()
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/GuiceInjector.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/GuiceInjector.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/GuiceInjector.scala
deleted file mode 100644
index 37da5f9..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/app/GuiceInjector.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-package org.apache.ambari.metrics.adservice.app
-
-import java.lang.annotation.Annotation
-
-import com.google.inject.{Guice, Injector, Module, TypeLiteral}
-
-import scala.collection.JavaConversions._
-import scala.language.implicitConversions
-import scala.reflect._
-
-object GuiceInjector {
-
-  def withInjector(modules: Module*)(fn: (Injector) => Unit) = {
-    val injector = Guice.createInjector(modules.toList: _*)
-    fn(injector)
-  }
-
-  implicit def wrap(injector: Injector): InjectorWrapper = new InjectorWrapper(injector)
-}
-
-class InjectorWrapper(injector: Injector) {
-  def instancesWithAnnotation[T <: Annotation](annotationClass: Class[T]): List[AnyRef] = {
-    injector.getAllBindings.filter { case (k, v) =>
-      !k.getTypeLiteral.getRawType.getAnnotationsByType[T](annotationClass).isEmpty
-    }.map { case (k, v) => injector.getInstance(k).asInstanceOf[AnyRef] }.toList
-  }
-
-  def instancesOfType[T: ClassTag](typeClass: Class[T]): List[T] = {
-    injector.findBindingsByType(TypeLiteral.get(classTag[T].runtimeClass)).map { b =>
-      injector.getInstance(b.getKey).asInstanceOf[T]
-    }.toList
-  }
-
-  def dumpBindings(): Unit = {
-    injector.getBindings.keySet() foreach { k =>
-      println(s"bind key = ${k.toString}")
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/AdServiceConfiguration.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/AdServiceConfiguration.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/AdServiceConfiguration.scala
deleted file mode 100644
index 11e9f28..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/AdServiceConfiguration.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.metrics.adservice.configuration
-
-import javax.validation.constraints.NotNull
-
-import com.fasterxml.jackson.annotation.JsonProperty
-
-/**
-  * Class to get Anomaly Service specific configuration.
-  */
-class AdServiceConfiguration {
-
-  @NotNull
-  var anomalyDataTtl: Long = _
-
-  @JsonProperty
-  def getAnomalyDataTtl: Long = anomalyDataTtl
-
-  @JsonProperty
-  def setAnomalyDataTtl(anomalyDataTtl: Long): Unit = {
-    this.anomalyDataTtl = anomalyDataTtl
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/HBaseConfiguration.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/HBaseConfiguration.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/HBaseConfiguration.scala
deleted file mode 100644
index a95ff15..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/HBaseConfiguration.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.metrics.adservice.configuration
-
-import java.net.{MalformedURLException, URISyntaxException}
-
-import org.apache.hadoop.conf.Configuration
-import org.slf4j.{Logger, LoggerFactory}
-
-object HBaseConfiguration {
-
-  val HBASE_SITE_CONFIGURATION_FILE: String = "hbase-site.xml"
-  val hbaseConf: org.apache.hadoop.conf.Configuration = new Configuration(true)
-  var isInitialized: Boolean = false
-  val LOG : Logger = LoggerFactory.getLogger("HBaseConfiguration")
-
-  /**
-    * Initialize the hbase conf from hbase-site present in classpath.
-    */
-  def initConfigs(): Unit = {
-    if (!isInitialized) {
-      var classLoader: ClassLoader = Thread.currentThread.getContextClassLoader
-      if (classLoader == null) classLoader = getClass.getClassLoader
-
-      try {
-        val hbaseResUrl = classLoader.getResource(HBASE_SITE_CONFIGURATION_FILE)
-        if (hbaseResUrl == null) throw new IllegalStateException("Unable to initialize the AD subsystem. No hbase-site present in the classpath.")
-
-        hbaseConf.addResource(hbaseResUrl.toURI.toURL)
-        isInitialized = true
-
-      } catch {
-        case me : MalformedURLException => println("MalformedURLException")
-        case ue : URISyntaxException => println("URISyntaxException")
-      }
-    }
-  }
-
-  def getHBaseConf: org.apache.hadoop.conf.Configuration = {
-    if (!isInitialized) {
-      initConfigs()
-    }
-    hbaseConf
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricCollectorConfiguration.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricCollectorConfiguration.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricCollectorConfiguration.scala
deleted file mode 100644
index 2530730..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricCollectorConfiguration.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.configuration
-
-import javax.validation.constraints.NotNull
-
-import com.fasterxml.jackson.annotation.JsonProperty
-
-/**
-  * Class to capture the Metrics Collector related configuration.
-  */
-class MetricCollectorConfiguration {
-
-  @NotNull
-  private var hosts: String = _
-
-  @NotNull
-  private var port: String = _
-
-  @NotNull
-  private var protocol: String = _
-
-  @NotNull
-  private var metadataEndpoint: String = _
-
-  @JsonProperty
-  def getHosts: String = hosts
-
-  @JsonProperty
-  def getPort: String = port
-
-  @JsonProperty
-  def getProtocol: String = protocol
-
-  @JsonProperty
-  def getMetadataEndpoint: String = metadataEndpoint
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionDBConfiguration.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionDBConfiguration.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionDBConfiguration.scala
deleted file mode 100644
index ef4e00c..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionDBConfiguration.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.configuration
-
-import javax.validation.constraints.NotNull
-
-import com.fasterxml.jackson.annotation.JsonProperty
-
-class MetricDefinitionDBConfiguration {
-
-  @NotNull
-  private var dbDirPath: String = _
-  private var verifyChecksums: Boolean = true
-  private var performParanoidChecks: Boolean = false
-
-  @JsonProperty("verifyChecksums")
-  def getVerifyChecksums: Boolean = verifyChecksums
-
-  @JsonProperty("performParanoidChecks")
-  def getPerformParanoidChecks: Boolean = performParanoidChecks
-
-  @JsonProperty("dbDirPath")
-  def getDbDirPath: String = dbDirPath
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionServiceConfiguration.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionServiceConfiguration.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionServiceConfiguration.scala
deleted file mode 100644
index a453f03..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/MetricDefinitionServiceConfiguration.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.metrics.adservice.configuration
-
-import com.fasterxml.jackson.annotation.JsonProperty
-
-/**
-  * Class to capture the Metric Definition Service configuration.
-  */
-class MetricDefinitionServiceConfiguration {
-
-  private val inputDefinitionDirectory: String = ""
-
-  @JsonProperty
-  def getInputDefinitionDirectory: String = inputDefinitionDirectory
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/SparkConfiguration.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/SparkConfiguration.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/SparkConfiguration.scala
deleted file mode 100644
index 30efdc7..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/configuration/SparkConfiguration.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.configuration
-
-import javax.validation.constraints.NotNull
-
-import com.fasterxml.jackson.annotation.JsonProperty
-
-class SparkConfiguration {
-
-  @NotNull
-  private var mode: String = _
-
-  @NotNull
-  private var masterHostPort: String = _
-
-  @JsonProperty
-  def getMode: String = mode
-
-  @JsonProperty
-  def getMasterHostPort: String = masterHostPort
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdAnomalyStoreAccessor.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdAnomalyStoreAccessor.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdAnomalyStoreAccessor.scala
deleted file mode 100644
index 676b09a..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdAnomalyStoreAccessor.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.db
-
-import org.apache.ambari.metrics.adservice.model.AnomalyType.AnomalyType
-import org.apache.ambari.metrics.adservice.model.MetricAnomalyInstance
-
-/**
-  * Trait for anomaly store accessor. (Phoenix)
-  */
-trait AdAnomalyStoreAccessor {
-
-  def initialize(): Unit
-
-  def getMetricAnomalies(anomalyType: AnomalyType,
-                         startTime: Long,
-                         endTime: Long,
-                         limit: Int) : List[MetricAnomalyInstance]
-
-  }

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessor.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessor.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessor.scala
deleted file mode 100644
index bcdb416..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessor.scala
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.metrics.adservice.db
-
-import org.apache.ambari.metrics.adservice.metadata.MetricSourceDefinition
-
-/**
-  * Trait used to talk to the AD Metadata Store.
-  */
-trait AdMetadataStoreAccessor {
-
-  /**
-    * Return all saved component definitions from DB.
-    * @return
-    */
-  def getSavedInputDefinitions: List[MetricSourceDefinition]
-
-  /**
-    * Save a set of component definitions
-    * @param metricSourceDefinitions Set of component definitions
-    * @return Success / Failure
-    */
-  def saveInputDefinitions(metricSourceDefinitions: List[MetricSourceDefinition]) : Boolean
-
-  /**
-    * Save a component definition
-    * @param metricSourceDefinition component definition
-    * @return Success / Failure
-    */
-  def saveInputDefinition(metricSourceDefinition: MetricSourceDefinition) : Boolean
-
-  /**
-    * Delete a component definition
-    * @param definitionName component definition
-    * @return
-    */
-  def removeInputDefinition(definitionName: String) : Boolean
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessorImpl.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessorImpl.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessorImpl.scala
deleted file mode 100644
index 7405459..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreAccessorImpl.scala
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.db
-
-import org.apache.ambari.metrics.adservice.metadata.MetricSourceDefinition
-import org.apache.commons.lang.SerializationUtils
-
-import com.google.inject.Inject
-
-/**
-  * Implementation of the AdMetadataStoreAccessor.
-  * Serves as the adaptor between metric definition service and LevelDB worlds.
-  */
-class AdMetadataStoreAccessorImpl extends AdMetadataStoreAccessor {
-
-  @Inject
-  var metadataDataSource: MetadataDatasource = _
-
-  @Inject
-  def this(metadataDataSource: MetadataDatasource) = {
-    this
-    this.metadataDataSource = metadataDataSource
-  }
-
-  /**
-    * Return all saved component definitions from DB.
-    *
-    * @return
-    */
-  override def getSavedInputDefinitions: List[MetricSourceDefinition] = {
-    val valuesFromStore : List[MetadataDatasource#Value] = metadataDataSource.getAll
-    val definitions = scala.collection.mutable.MutableList.empty[MetricSourceDefinition]
-
-    for (value : Array[Byte] <- valuesFromStore) {
-      val definition : MetricSourceDefinition = SerializationUtils.deserialize(value).asInstanceOf[MetricSourceDefinition]
-      if (definition != null) {
-        definitions.+=(definition)
-      }
-    }
-    definitions.toList
-  }
-
-  /**
-    * Save a set of component definitions
-    *
-    * @param metricSourceDefinitions Set of component definitions
-    * @return Success / Failure
-    */
-  override def saveInputDefinitions(metricSourceDefinitions: List[MetricSourceDefinition]): Boolean = {
-    for (definition <- metricSourceDefinitions) {
-      saveInputDefinition(definition)
-    }
-    true
-  }
-
-  /**
-    * Save a component definition
-    *
-    * @param metricSourceDefinition component definition
-    * @return Success / Failure
-    */
-  override def saveInputDefinition(metricSourceDefinition: MetricSourceDefinition): Boolean = {
-    val storeValue : MetadataDatasource#Value = SerializationUtils.serialize(metricSourceDefinition)
-    val storeKey : MetadataDatasource#Key = metricSourceDefinition.definitionName.getBytes()
-    metadataDataSource.put(storeKey, storeValue)
-    true
-  }
-
-  /**
-    * Delete a component definition
-    *
-    * @param definitionName component definition
-    * @return
-    */
-  override def removeInputDefinition(definitionName: String): Boolean = {
-    val storeKey : MetadataDatasource#Key = definitionName.getBytes()
-    metadataDataSource.delete(storeKey)
-    true
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreConstants.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreConstants.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreConstants.scala
deleted file mode 100644
index 3d273a3..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/AdMetadataStoreConstants.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.metrics.adservice.db
-
-object AdMetadataStoreConstants {
-
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  /* Table Name constants */
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-  val METRIC_PROFILE_TABLE_NAME = "METRIC_DEFINITION"
-
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  /* CREATE statement constants */
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-  val CREATE_METRIC_DEFINITION_TABLE: String = "CREATE TABLE IF NOT EXISTS %s (" +
-    "DEFINITION_NAME VARCHAR, " +
-    "DEFINITION_JSON VARCHAR, " +
-    "DEFINITION_SOURCE NUMBER, " +
-    "CREATED_TIME TIMESTAMP, " +
-    "UPDATED_TIME TIMESTAMP " +
-    "CONSTRAINT pk PRIMARY KEY (DEFINITION_NAME))"
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/ConnectionProvider.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/ConnectionProvider.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/ConnectionProvider.scala
deleted file mode 100644
index cc02ed4..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/ConnectionProvider.scala
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *//**
-  * 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.ambari.metrics.adservice.db
-
-import java.sql.Connection
-import java.sql.SQLException
-
-/**
-  * Provides a connection to the anomaly store.
-  */
-trait ConnectionProvider {
-  @throws[SQLException]
-  def getConnection: Connection
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/DefaultPhoenixDataSource.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/DefaultPhoenixDataSource.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/DefaultPhoenixDataSource.scala
deleted file mode 100644
index d9396de..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/DefaultPhoenixDataSource.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-package org.apache.ambari.metrics.adservice.db
-
-import org.apache.commons.logging.LogFactory
-import org.apache.hadoop.conf.Configuration
-import org.apache.hadoop.hbase.client.ConnectionFactory
-import org.apache.hadoop.hbase.client.HBaseAdmin
-import java.io.IOException
-import java.sql.Connection
-import java.sql.DriverManager
-import java.sql.SQLException
-
-object DefaultPhoenixDataSource {
-  private[db] val LOG = LogFactory.getLog(classOf[DefaultPhoenixDataSource])
-  private val ZOOKEEPER_CLIENT_PORT = "hbase.zookeeper.property.clientPort"
-  private val ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum"
-  private val ZNODE_PARENT = "zookeeper.znode.parent"
-  private val connectionUrl = "jdbc:phoenix:%s:%s:%s"
-}
-
-class DefaultPhoenixDataSource(var hbaseConf: Configuration) extends PhoenixConnectionProvider {
-
-  val zookeeperClientPort: String = hbaseConf.getTrimmed(DefaultPhoenixDataSource.ZOOKEEPER_CLIENT_PORT, "2181")
-  val zookeeperQuorum: String = hbaseConf.getTrimmed(DefaultPhoenixDataSource.ZOOKEEPER_QUORUM)
-  val znodeParent: String = hbaseConf.getTrimmed(DefaultPhoenixDataSource.ZNODE_PARENT, "/ams-hbase-unsecure")
-  final private var url : String = _
-
-  if (zookeeperQuorum == null || zookeeperQuorum.isEmpty) {
-    throw new IllegalStateException("Unable to find Zookeeper quorum to access HBase store using Phoenix.")
-  }
-  url = String.format(DefaultPhoenixDataSource.connectionUrl, zookeeperQuorum, zookeeperClientPort, znodeParent)
-
-
-  /**
-    * Get HBaseAdmin for table ops.
-    *
-    * @return @HBaseAdmin
-    * @throws IOException
-    */
-  @throws[IOException]
-  override def getHBaseAdmin: HBaseAdmin = ConnectionFactory.createConnection(hbaseConf).getAdmin.asInstanceOf[HBaseAdmin]
-
-  /**
-    * Get JDBC connection to HBase store. Assumption is that the hbase
-    * configuration is present on the classpath and loaded by the caller into
-    * the Configuration object.
-    * Phoenix already caches the HConnection between the client and HBase
-    * cluster.
-    *
-    * @return @java.sql.Connection
-    */
-  @throws[SQLException]
-  override def getConnection: Connection = {
-    DefaultPhoenixDataSource.LOG.debug("Metric store connection url: " + url)
-    try DriverManager.getConnection(url)
-    catch {
-      case e: SQLException =>
-        DefaultPhoenixDataSource.LOG.warn("Unable to connect to HBase store using Phoenix.", e)
-        throw e
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/MetadataDatasource.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/MetadataDatasource.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/MetadataDatasource.scala
deleted file mode 100644
index 7b223a2..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/MetadataDatasource.scala
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.db
-
-trait MetadataDatasource {
-
-  type Key = Array[Byte]
-  type Value = Array[Byte]
-
-  /**
-    *  Idempotent call at the start of the application to initialize db
-    */
-  def initialize(): Unit
-
-  /**
-    * This function obtains the associated value to a key. It requires the (key-value) pair to be in the DataSource
-    *
-    * @param key
-    * @return the value associated with the passed key.
-    */
-  def apply(key: Key): Value = get(key).get
-
-  /**
-    * This function obtains the associated value to a key, if there exists one.
-    *
-    * @param key
-    * @return the value associated with the passed key.
-    */
-  def get(key: Key): Option[Value]
-
-  /**
-    * This function obtains all the values
-    *
-    * @return the list of values
-    */
-  def getAll: List[Value]
-
-  /**
-    * This function associates a key to a value, overwriting if necessary
-    */
-  def put(key: Key, value: Value): Unit
-
-  /**
-    * Delete key from the db
-    */
-  def delete(key: Key): Unit
-
-  /**
-    * This function updates the DataSource by deleting, updating and inserting new (key-value) pairs.
-    *
-    * @param toRemove which includes all the keys to be removed from the DataSource.
-    * @param toUpsert which includes all the (key-value) pairs to be inserted into the DataSource.
-    *                 If a key is already in the DataSource its value will be updated.
-    * @return the new DataSource after the removals and insertions were done.
-    */
-  def update(toRemove: Seq[Key], toUpsert: Seq[(Key, Value)]): Unit
-
-  /**
-    * This function closes the DataSource, without deleting the files used by it.
-    */
-  def close(): Unit
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixAnomalyStoreAccessor.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixAnomalyStoreAccessor.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixAnomalyStoreAccessor.scala
deleted file mode 100644
index 53e6dee..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixAnomalyStoreAccessor.scala
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.metrics.adservice.db
-
-import java.sql.{Connection, PreparedStatement, ResultSet, SQLException}
-import java.util.concurrent.TimeUnit.SECONDS
-
-import org.apache.ambari.metrics.adservice.app.AnomalyDetectionAppConfig
-import org.apache.ambari.metrics.adservice.configuration.HBaseConfiguration
-import org.apache.ambari.metrics.adservice.metadata.{MetricDefinitionService, MetricKey}
-import org.apache.ambari.metrics.adservice.model.AnomalyDetectionMethod.AnomalyDetectionMethod
-import org.apache.ambari.metrics.adservice.model.AnomalyType.AnomalyType
-import org.apache.ambari.metrics.adservice.model._
-import org.apache.hadoop.hbase.util.RetryCounterFactory
-import org.slf4j.{Logger, LoggerFactory}
-
-import com.google.inject.Inject
-
-/**
-  * Phoenix query handler class.
-  */
-class PhoenixAnomalyStoreAccessor extends AdAnomalyStoreAccessor {
-
-  @Inject
-  var configuration: AnomalyDetectionAppConfig = _
-
-  @Inject
-  var metricDefinitionService: MetricDefinitionService = _
-
-  var datasource: PhoenixConnectionProvider = _
-  val LOG : Logger = LoggerFactory.getLogger(classOf[PhoenixAnomalyStoreAccessor])
-
-  @Override
-  def initialize(): Unit = {
-
-    datasource = new DefaultPhoenixDataSource(HBaseConfiguration.getHBaseConf)
-    val retryCounterFactory = new RetryCounterFactory(10, SECONDS.toMillis(3).toInt)
-
-    val ttl = configuration.getAdServiceConfiguration.getAnomalyDataTtl
-    try {
-      var conn : Connection = getConnectionRetryingOnException(retryCounterFactory)
-      var stmt = conn.createStatement
-
-      //Create Method parameters table.
-      val methodParametersSql = String.format(PhoenixQueryConstants.CREATE_METHOD_PARAMETERS_TABLE,
-        PhoenixQueryConstants.METHOD_PARAMETERS_TABLE_NAME)
-      stmt.executeUpdate(methodParametersSql)
-
-      //Create Point in Time anomaly table
-      val pointInTimeAnomalySql = String.format(PhoenixQueryConstants.CREATE_PIT_ANOMALY_METRICS_TABLE_SQL,
-        PhoenixQueryConstants.PIT_ANOMALY_METRICS_TABLE_NAME,
-        ttl.asInstanceOf[Object])
-      stmt.executeUpdate(pointInTimeAnomalySql)
-
-      //Create Trend Anomaly table
-      val trendAnomalySql = String.format(PhoenixQueryConstants.CREATE_TREND_ANOMALY_METRICS_TABLE_SQL,
-        PhoenixQueryConstants.TREND_ANOMALY_METRICS_TABLE_NAME,
-        ttl.asInstanceOf[Object])
-      stmt.executeUpdate(trendAnomalySql)
-
-      //Create model snapshot table.
-      val snapshotSql = String.format(PhoenixQueryConstants.CREATE_MODEL_SNAPSHOT_TABLE,
-        PhoenixQueryConstants.MODEL_SNAPSHOT)
-      stmt.executeUpdate(snapshotSql)
-
-      conn.commit()
-    } catch {
-      case e: SQLException => throw e
-    }
-  }
-
-  @Override
-  def getMetricAnomalies(anomalyType: AnomalyType, startTime: Long, endTime: Long, limit: Int) : List[MetricAnomalyInstance] = {
-    val anomalies = scala.collection.mutable.MutableList.empty[MetricAnomalyInstance]
-    val conn : Connection = getConnection
-    var stmt : PreparedStatement = null
-    var rs : ResultSet = null
-    val s : Season = Season(Range(-1,-1), SeasonType.DAY)
-
-    try {
-      stmt = prepareAnomalyMetricsGetSqlStatement(conn, anomalyType, startTime, endTime, limit)
-      rs = stmt.executeQuery
-      if (anomalyType.equals(AnomalyType.POINT_IN_TIME)) {
-        while (rs.next()) {
-          val uuid: Array[Byte] = rs.getBytes("METRIC_UUID")
-          val timestamp: Long = rs.getLong("ANOMALY_TIMESTAMP")
-          val metricValue: Double = rs.getDouble("METRIC_VALUE")
-          val methodType: AnomalyDetectionMethod = AnomalyDetectionMethod.withName(rs.getString("METHOD_NAME"))
-          val season: Season = Season.fromJson(rs.getString("SEASONAL_INFO"))
-          val anomalyScore: Double = rs.getDouble("ANOMALY_SCORE")
-          val modelSnapshot: String = rs.getString("MODEL_PARAMETERS")
-
-          val metricKey: MetricKey = metricDefinitionService.getMetricKeyFromUuid(uuid)
-          val anomalyInstance: MetricAnomalyInstance = new PointInTimeAnomalyInstance(metricKey, timestamp,
-            metricValue, methodType, anomalyScore, season, modelSnapshot)
-          anomalies.+=(anomalyInstance)
-        }
-      } else {
-        while (rs.next()) {
-          val uuid: Array[Byte] = rs.getBytes("METRIC_UUID")
-          val anomalyStart: Long = rs.getLong("ANOMALY_PERIOD_START")
-          val anomalyEnd: Long = rs.getLong("ANOMALY_PERIOD_END")
-          val referenceStart: Long = rs.getLong("TEST_PERIOD_START")
-          val referenceEnd: Long = rs.getLong("TEST_PERIOD_END")
-          val methodType: AnomalyDetectionMethod = AnomalyDetectionMethod.withName(rs.getString("METHOD_NAME"))
-          val season: Season = Season.fromJson(rs.getString("SEASONAL_INFO"))
-          val anomalyScore: Double = rs.getDouble("ANOMALY_SCORE")
-          val modelSnapshot: String = rs.getString("MODEL_PARAMETERS")
-
-          val metricKey: MetricKey = metricDefinitionService.getMetricKeyFromUuid(uuid)
-          val anomalyInstance: MetricAnomalyInstance = TrendAnomalyInstance(metricKey,
-            TimeRange(anomalyStart, anomalyEnd),
-            TimeRange(referenceStart, referenceEnd),
-            methodType, anomalyScore, season, modelSnapshot)
-          anomalies.+=(anomalyInstance)
-        }
-      }
-    } catch {
-      case e: SQLException => throw e
-    }
-
-    anomalies.toList
-  }
-
-  @throws[SQLException]
-  private def prepareAnomalyMetricsGetSqlStatement(connection: Connection, anomalyType: AnomalyType, startTime: Long, endTime: Long, limit: Int): PreparedStatement = {
-
-    val sb = new StringBuilder
-
-    if (anomalyType.equals(AnomalyType.POINT_IN_TIME)) {
-      sb.++=(String.format(PhoenixQueryConstants.GET_PIT_ANOMALY_METRIC_SQL, PhoenixQueryConstants.PIT_ANOMALY_METRICS_TABLE_NAME))
-    } else {
-      sb.++=(String.format(PhoenixQueryConstants.GET_TREND_ANOMALY_METRIC_SQL, PhoenixQueryConstants.TREND_ANOMALY_METRICS_TABLE_NAME))
-    }
-
-    sb.append(" LIMIT " + limit)
-    var stmt: java.sql.PreparedStatement = null
-    try {
-      stmt = connection.prepareStatement(sb.toString)
-
-      var pos = 1
-      stmt.setLong(pos, startTime)
-
-      pos += 1
-      stmt.setLong(pos, endTime)
-
-      stmt.setFetchSize(limit)
-
-    } catch {
-      case e: SQLException =>
-        if (stmt != null)
-          return stmt
-        throw e
-    }
-    stmt
-  }
-
-  @throws[SQLException]
-  private def getConnection: Connection = datasource.getConnection
-
-  @throws[SQLException]
-  @throws[InterruptedException]
-  private def getConnectionRetryingOnException (retryCounterFactory : RetryCounterFactory) : Connection = {
-    val retryCounter = retryCounterFactory.create
-    while(true) {
-      try
-        return getConnection
-      catch {
-        case e: SQLException =>
-          if (!retryCounter.shouldRetry) {
-            LOG.error("HBaseAccessor getConnection failed after " + retryCounter.getMaxAttempts + " attempts")
-            throw e
-          }
-      }
-      retryCounter.sleepUntilNextRetry()
-    }
-    null
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixConnectionProvider.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixConnectionProvider.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixConnectionProvider.scala
deleted file mode 100644
index 1faf1ba..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixConnectionProvider.scala
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  *//**
-  * 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.ambari.metrics.adservice.db
-
-import org.apache.hadoop.hbase.client.HBaseAdmin
-import java.io.IOException
-
-/**
-  * 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
-  * <p/>
-  * http://www.apache.org/licenses/LICENSE-2.0
-  * <p/>
-  * 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.
-  */
-trait PhoenixConnectionProvider extends ConnectionProvider {
-  /**
-    * Get HBaseAdmin for the Phoenix connection
-    *
-    * @return
-    * @throws IOException
-    */
-    @throws[IOException]
-    def getHBaseAdmin: HBaseAdmin
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixQueryConstants.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixQueryConstants.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixQueryConstants.scala
deleted file mode 100644
index d9774e0..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/db/PhoenixQueryConstants.scala
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ambari.metrics.adservice.db
-
-object PhoenixQueryConstants {
-
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  /* Table Name constants */
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-  val METRIC_PROFILE_TABLE_NAME = "METRIC_PROFILE"
-  val METHOD_PARAMETERS_TABLE_NAME = "METHOD_PARAMETERS"
-  val PIT_ANOMALY_METRICS_TABLE_NAME = "PIT_METRIC_ANOMALIES"
-  val TREND_ANOMALY_METRICS_TABLE_NAME = "TREND_METRIC_ANOMALIES"
-  val MODEL_SNAPSHOT = "MODEL_SNAPSHOT"
-
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  /* CREATE statement constants */
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-  val CREATE_METHOD_PARAMETERS_TABLE: String = "CREATE TABLE IF NOT EXISTS %s (" +
-    "METHOD_NAME VARCHAR, " +
-    "METHOD_TYPE VARCHAR, " +
-    "PARAMETERS VARCHAR " +
-    "CONSTRAINT pk PRIMARY KEY (METHOD_NAME)) " +
-    "DATA_BLOCK_ENCODING='FAST_DIFF', IMMUTABLE_ROWS=true, COMPRESSION='SNAPPY'"
-
-  val CREATE_PIT_ANOMALY_METRICS_TABLE_SQL: String = "CREATE TABLE IF NOT EXISTS %s (" +
-    "METRIC_UUID BINARY(20) NOT NULL, " +
-    "METHOD_NAME VARCHAR, " +
-    "ANOMALY_TIMESTAMP UNSIGNED_LONG NOT NULL, " +
-    "METRIC_VALUE DOUBLE, " +
-    "SEASONAL_INFO VARCHAR, " +
-    "ANOMALY_SCORE DOUBLE, " +
-    "MODEL_PARAMETERS VARCHAR, " +
-    "DETECTION_TIME UNSIGNED_LONG " +
-    "CONSTRAINT pk PRIMARY KEY (METRIC_UUID, METHOD_NAME, ANOMALY_TIMESTAMP)) " +
-    "DATA_BLOCK_ENCODING='FAST_DIFF', IMMUTABLE_ROWS=true, TTL=%s, COMPRESSION='SNAPPY'"
-
-  val CREATE_TREND_ANOMALY_METRICS_TABLE_SQL: String = "CREATE TABLE IF NOT EXISTS %s (" +
-    "METRIC_UUID BINARY(20) NOT NULL, " +
-    "METHOD_NAME VARCHAR, " +
-    "ANOMALY_PERIOD_START UNSIGNED_LONG NOT NULL, " +
-    "ANOMALY_PERIOD_END UNSIGNED_LONG NOT NULL, " +
-    "TEST_PERIOD_START UNSIGNED_LONG NOT NULL, " +
-    "TEST_PERIOD_END UNSIGNED_LONG NOT NULL, " +
-    "SEASONAL_INFO VARCHAR, " +
-    "ANOMALY_SCORE DOUBLE, " +
-    "MODEL_PARAMETERS VARCHAR, " +
-    "DETECTION_TIME UNSIGNED_LONG " +
-    "CONSTRAINT pk PRIMARY KEY (METRIC_UUID, METHOD_NAME, ANOMALY_PERIOD_START, ANOMALY_PERIOD_END, TEST_PERIOD_START, TEST_PERIOD_END)) " +
-    "DATA_BLOCK_ENCODING='FAST_DIFF', IMMUTABLE_ROWS=true, TTL=%s, COMPRESSION='SNAPPY'"
-
-  val CREATE_MODEL_SNAPSHOT_TABLE: String = "CREATE TABLE IF NOT EXISTS %s (" +
-    "METRIC_UUID BINARY(20) NOT NULL, " +
-    "METHOD_NAME VARCHAR, " +
-    "METHOD_TYPE VARCHAR, " +
-    "PARAMETERS VARCHAR, " +
-    "SNAPSHOT_TIME UNSIGNED_LONG NOT NULL " +
-    "CONSTRAINT pk PRIMARY KEY (METRIC_UUID, METHOD_NAME, SNAPSHOT_TIME)) " +
-    "DATA_BLOCK_ENCODING='FAST_DIFF', IMMUTABLE_ROWS=true, COMPRESSION='SNAPPY'"
-
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  /* UPSERT statement constants */
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-  val UPSERT_METHOD_PARAMETERS_SQL: String = "UPSERT INTO %s (METHOD_NAME, METHOD_TYPE, PARAMETERS) VALUES (?,?,?)"
-
-  val UPSERT_PIT_ANOMALY_METRICS_SQL: String = "UPSERT INTO %s (METRIC_UUID, ANOMALY_TIMESTAMP, METRIC_VALUE, METHOD_NAME, " +
-    "SEASONAL_INFO, ANOMALY_SCORE, MODEL_PARAMETERS, DETECTION_TIME) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
-
-  val UPSERT_TREND_ANOMALY_METRICS_SQL: String = "UPSERT INTO %s (METRIC_UUID, ANOMALY_PERIOD_START, ANOMALY_PERIOD_END, " +
-    "TEST_PERIOD_START, TEST_PERIOD_END, METHOD_NAME, ANOMALY_SCORE, MODEL_PARAMETERS, DETECTION_TIME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
-
-  val UPSERT_MODEL_SNAPSHOT_SQL: String = "UPSERT INTO %s (METRIC_UUID, METHOD_NAME, METHOD_TYPE, PARAMETERS) VALUES (?, ?, ?, ?)"
-
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  /* GET statement constants */
-  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-  val GET_METHOD_PARAMETERS_SQL: String = "SELECT METHOD_NAME, METHOD_TYPE, PARAMETERS FROM %s WHERE METHOD_NAME = %s"
-
-  val GET_PIT_ANOMALY_METRIC_SQL: String = "SELECT METRIC_UUID, ANOMALY_TIMESTAMP, METRIC_VALUE, METHOD_NAME, SEASONAL_INFO, " +
-    "ANOMALY_SCORE, MODEL_PARAMETERS, DETECTION_TIME FROM %s WHERE ANOMALY_TIMESTAMP > ? AND ANOMALY_TIMESTAMP <= ? " +
-    "ORDER BY ANOMALY_SCORE DESC"
-
-  val GET_TREND_ANOMALY_METRIC_SQL: String = "SELECT METRIC_UUID, ANOMALY_PERIOD_START, ANOMALY_PERIOD_END, TEST_PERIOD_START, " +
-    "TEST_PERIOD_END, METHOD_NAME, SEASONAL_INFO, ANOMALY_SCORE, MODEL_PARAMETERS, DETECTION_TIME FROM %s WHERE ANOMALY_PERIOD_END > ? " +
-    "AND ANOMALY_PERIOD_END <= ? ORDER BY ANOMALY_SCORE DESC"
-
-  val GET_MODEL_SNAPSHOT_SQL: String = "SELECT METRIC_UUID, METHOD_NAME, METHOD_TYPE, PARAMETERS FROM %s WHERE UUID = %s AND METHOD_NAME = %s"
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/25c18121/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDatasource.scala
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDatasource.scala b/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDatasource.scala
deleted file mode 100644
index 49ef272..0000000
--- a/ambari-metrics/ambari-metrics-anomaly-detection-service/src/main/scala/org/apache/ambari/metrics/adservice/leveldb/LevelDBDatasource.scala
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
-  * Licensed to the Apache Software Foundation (ASF) under one
-  * or more contributor license agreements.  See the NOTICE file
-  * distributed with this work for additional information
-  * regarding copyright ownership.  The ASF licenses this file
-  * to you under the Apache License, Version 2.0 (the
-  * "License"); you may not use this file except in compliance
-  * with the License.  You may obtain a copy of the License at
-  *
-  * http://www.apache.org/licenses/LICENSE-2.0
-  *
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
-
-package org.apache.ambari.metrics.adservice.leveldb
-
-import java.io.File
-
-import javax.inject.Inject
-
-import org.apache.ambari.metrics.adservice.app.AnomalyDetectionAppConfig
-import org.apache.ambari.metrics.adservice.configuration.MetricDefinitionDBConfiguration
-import org.apache.ambari.metrics.adservice.db.MetadataDatasource
-import org.iq80.leveldb.{DB, Options, WriteOptions}
-import org.iq80.leveldb.impl.Iq80DBFactory
-
-import com.google.inject.Singleton
-
-@Singleton
-class LevelDBDataSource() extends MetadataDatasource {
-
-  private var db: DB = _
-  @volatile var isInitialized: Boolean = false
-
-  var appConfig: AnomalyDetectionAppConfig = _
-
-  @Inject
-  def this(appConfig: AnomalyDetectionAppConfig) = {
-    this
-    this.appConfig = appConfig
-  }
-
-  override def initialize(): Unit = {
-    if (isInitialized) return 
-
-    val configuration: MetricDefinitionDBConfiguration = appConfig.getMetricDefinitionDBConfiguration
-
-    db = createDB(new LevelDbConfig {
-      override val createIfMissing: Boolean = true
-      override val verifyChecksums: Boolean = configuration.getVerifyChecksums
-      override val paranoidChecks: Boolean = configuration.getPerformParanoidChecks
-      override val path: String = configuration.getDbDirPath
-    })
-    isInitialized = true
-  }
-
-  private def createDB(levelDbConfig: LevelDbConfig): DB = {
-    import levelDbConfig._
-
-    val options = new Options()
-      .createIfMissing(createIfMissing)
-      .paranoidChecks(paranoidChecks) // raise an error as soon as it detects an internal corruption
-      .verifyChecksums(verifyChecksums) // force checksum verification of all data that is read from the file system on behalf of a particular read
-
-    Iq80DBFactory.factory.open(new File(path), options)
-  }
-
-  override def close(): Unit = {
-    db.close()
-  }
-
-  /**
-    * This function obtains the associated value to a key, if there exists one.
-    *
-    * @param key
-    * @return the value associated with the passed key.
-    */
-  override def get(key: Key): Option[Value] = Option(db.get(key))
-
-  /**
-    * This function obtains all the values
-    *
-    * @return the list of values
-    */
-  def getAll: List[Value] = {
-    val values = scala.collection.mutable.MutableList.empty[Value]
-    val iterator = db.iterator()
-    iterator.seekToFirst()
-    while (iterator.hasNext) {
-      val entry: java.util.Map.Entry[Key, Value] = iterator.next()
-      values.+=(entry.getValue)
-    }
-    values.toList
-  }
-
-  /**
-    * This function updates the DataSource by deleting, updating and inserting new (key-value) pairs.
-    *
-    * @param toRemove which includes all the keys to be removed from the DataSource.
-    * @param toUpsert which includes all the (key-value) pairs to be inserted into the DataSource.
-    *                 If a key is already in the DataSource its value will be updated.
-    */
-  override def update(toRemove: Seq[Key], toUpsert: Seq[(Key, Value)]): Unit = {
-    val batch = db.createWriteBatch()
-    toRemove.foreach { key => batch.delete(key) }
-    toUpsert.foreach { item => batch.put(item._1, item._2) }
-    db.write(batch, new WriteOptions())
-  }
-
-  override def put(key: Key, value: Value): Unit = {
-    db.put(key, value)
-  }
-
-  override def delete(key: Key): Unit = {
-    db.delete(key)
-  }
-}
-
-trait LevelDbConfig {
-  val createIfMissing: Boolean
-  val paranoidChecks: Boolean
-  val verifyChecksums: Boolean
-  val path: String
-}
\ No newline at end of file