You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ha...@apache.org on 2016/07/21 12:28:48 UTC

[04/11] incubator-eagle git commit: [EAGLE-382][EAGLE-385] Monitoring Application Framework Core

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
new file mode 100644
index 0000000..09377ab
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationEntity.java
@@ -0,0 +1,153 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.model;
+
+import org.apache.eagle.metadata.persistence.PersistenceEntity;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Site app management entity
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ApplicationEntity extends PersistenceEntity {
+    private String appId;
+    private SiteEntity site;
+
+    /**
+     * TODO: Think about keeping ApplicationDesc as a reference or deep clone into current instance
+     */
+    private ApplicationDesc descriptor;
+
+    private Map<String,Object> configuration = new HashMap<>();
+    private Map<String,String> context = new HashMap<>();
+    private Collection<StreamDesc> streams;
+    private Mode mode = Mode.CLUSTER;
+    private Status status = Status.INITIAILIZED;
+
+    public SiteEntity getSite() {
+        return site;
+    }
+
+    public void setSite(SiteEntity site) {
+        this.site = site;
+    }
+
+    public ApplicationDesc getDescriptor() {
+        return descriptor;
+    }
+
+    public void setDescriptor(ApplicationDesc descriptor) {
+        this.descriptor = descriptor;
+    }
+
+    public Map<String, Object> getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(Map<String, Object> configuration) {
+        this.configuration = configuration;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    @Override
+    public void ensureDefault() {
+        super.ensureDefault();
+        if(this.appId == null){
+            this.appId = String.format("EAGLE_APP_%s_%s",this.getSite().getSiteId(),this.getDescriptor().getType());
+        }
+        if(this.status == null){
+            this.status = Status.INITIAILIZED;
+        }
+    }
+
+    public Map<String, String> getContext() {
+        return context;
+    }
+
+    public void setContext(Map<String, String> context) {
+        this.context = context;
+    }
+
+    public Mode getMode() {
+        return mode;
+    }
+
+    public void setMode(Mode mode) {
+        this.mode = mode;
+    }
+
+    public Status getStatus() {
+        return status;
+    }
+
+    public void setStatus(Status status) {
+        this.status = status;
+    }
+
+    public Collection<StreamDesc> getStreams() {
+        return streams;
+    }
+
+    public void setStreams(Collection<StreamDesc> streams) {
+        this.streams = streams;
+    }
+
+    public static enum Status{
+        INITIAILIZED("INITIAILIZED"),
+        STARTING("STARTING"),
+        RUNNING("RUNNING"),
+        STOPPPING("STOPPPING"),
+        STOPPED("STOPPED");
+
+        private final String status;
+        Status(String status){
+            this.status = status;
+        }
+
+        @Override
+        public String toString() {
+            return status;
+        }
+    }
+
+    public static enum Mode{
+        LOCAL("LOCAL"),
+        CLUSTER("CLUSTER");
+        private final String name;
+
+        Mode(String name){
+            this.name = name;
+        }
+
+        @Override
+        public String toString() {
+            return this.name;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java
new file mode 100644
index 0000000..38d6aa7
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/ApplicationRawEntity.java
@@ -0,0 +1,72 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.model;
+
+import org.apache.eagle.metadata.persistence.PersistenceEntity;
+
+import java.util.Map;
+
+/**
+ * Site app management entity
+ */
+public class ApplicationRawEntity extends PersistenceEntity {
+    private String siteUuid;
+    private String appType;
+    private Map<String,Map> configuration;
+    private long createdTime;
+    private long modifiedTime;
+
+    public String getSiteUuid() {
+        return siteUuid;
+    }
+
+    public void setSiteUuid(String siteUuid) {
+        this.siteUuid = siteUuid;
+    }
+
+    public Map<String, Map> getConfiguration() {
+        return configuration;
+    }
+
+    public void setConfiguration(Map<String, Map> configuration) {
+        this.configuration = configuration;
+    }
+
+    public long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public long getModifiedTime() {
+        return modifiedTime;
+    }
+
+    public void setModifiedTime(long modifiedTime) {
+        this.modifiedTime = modifiedTime;
+    }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
new file mode 100644
index 0000000..345c935
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Configuration.java
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.model;
+
+import org.apache.eagle.metadata.utils.ConfigTemplateHelper;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.InputStream;
+import java.util.List;
+
+@XmlRootElement(name = "configuration")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Configuration {
+    @XmlElement(name = "property")
+    private List<Property> properties;
+
+    public List<Property> getProperties() {
+        return properties;
+    }
+
+    public Property getProperty(String name){
+        for(Property property :properties){
+            if(property.getName().equals(name)){
+                return property;
+            }
+        }
+        return null;
+    }
+
+    public boolean hasProperty(String name){
+        for(Property property :properties){
+            if(property.getName().equals(name)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static Configuration fromStream(InputStream inputStream) throws JAXBException {
+        return ConfigTemplateHelper.unmarshallFromXmlStream(inputStream);
+    }
+
+    public static Configuration fromResource(String resourceName) throws JAXBException {
+        return ConfigTemplateHelper.unmarshallFromResource(resourceName);
+    }
+    public static Configuration fromString(String xmlContent) throws JAXBException {
+        return ConfigTemplateHelper.unmarshallFromXMLString(xmlContent);
+    }
+
+    public int size(){
+        if(this.properties == null){
+            return 0;
+        }
+        return this.properties.size();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
new file mode 100644
index 0000000..642f760
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/Property.java
@@ -0,0 +1,56 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.model;
+
+public class Property {
+    private String name;
+    private String displayName;
+    private String value;
+    private String description;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java
new file mode 100644
index 0000000..5421c87
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/SiteEntity.java
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.model;
+
+import org.apache.eagle.metadata.persistence.PersistenceEntity;
+
+import java.util.Map;
+
+/**
+ * Dynamically registered site
+ */
+public class SiteEntity extends PersistenceEntity {
+    private String siteId;
+    private String siteName;
+    private String description;
+    private Map<String,String> context;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("SiteEntity[siteId = %s, siteName =%s, description = %s, uuid = %s]",getSiteId(),getSiteName(),getDescription(),getUuid());
+    }
+
+    public String getSiteId() {
+        return siteId;
+    }
+
+    public void setSiteId(String siteId) {
+        this.siteId = siteId;
+    }
+
+    public String getSiteName() {
+        return siteName;
+    }
+
+    public void setSiteName(String siteName) {
+        this.siteName = siteName;
+    }
+
+    public Map<String, String> getContext() {
+        return context;
+    }
+
+    public void setContext(Map<String, String> context) {
+        this.context = context;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java
new file mode 100644
index 0000000..c9f1e7f
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/model/StreamDesc.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+package org.apache.eagle.metadata.model;
+
+import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
+
+import java.util.Map;
+
+public class StreamDesc {
+    private String streamId;
+    private StreamDefinition streamSchema;
+    private Class<?> sinkType;
+    private Map<String,Object> sinkContext;
+
+    public String getStreamId() {
+        return streamId;
+    }
+
+    public void setStreamId(String streamId) {
+        this.streamId = streamId;
+    }
+
+    public StreamDefinition getStreamSchema() {
+        return streamSchema;
+    }
+
+    public void setStreamSchema(StreamDefinition streamSchema) {
+        this.streamSchema = streamSchema;
+    }
+
+    public Class<?> getSinkType() {
+        return sinkType;
+    }
+
+    public void setSinkType(Class<?> sinkType) {
+        this.sinkType = sinkType;
+    }
+
+    public Map<String, Object> getSinkContext() {
+        return sinkContext;
+    }
+
+    public void setSinkContext(Map<String, Object> sinkContext) {
+        this.sinkContext = sinkContext;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java
new file mode 100644
index 0000000..5e3c2f4
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MemoryMetadataStore.java
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.persistence;
+
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl;
+import org.apache.eagle.metadata.service.ApplicationEntityService;
+import org.apache.eagle.metadata.service.SiteEntityService;
+import org.apache.eagle.metadata.service.memory.ApplicationEntityServiceMemoryImpl;
+import org.apache.eagle.metadata.service.memory.SiteEntityEntityServiceMemoryImpl;
+
+public class MemoryMetadataStore extends MetadataStore {
+    @Override
+    protected void configure() {
+        bind(SiteEntityService.class).to(SiteEntityEntityServiceMemoryImpl.class);
+        bind(ApplicationEntityService.class).to(ApplicationEntityServiceMemoryImpl.class);
+        bind(IMetadataDao.class).to(InMemMetadataDaoImpl.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java
new file mode 100644
index 0000000..71b1476
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStore.java
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.persistence;
+
+import com.google.inject.AbstractModule;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class MetadataStore extends AbstractModule {
+    private final static Logger LOG = LoggerFactory.getLogger(MetadataStore.class);
+    public static final String METADATA_STORE_CONFIG_KEY = "metadata.store";
+
+    private static MetadataStore instance;
+    public static MetadataStore getInstance(){
+        String metadataStoreClass = null;
+        if(instance == null) {
+            try {
+                Config config = ConfigFactory.load();
+                if (config.hasPath(METADATA_STORE_CONFIG_KEY)) {
+                    metadataStoreClass = config.getString(METADATA_STORE_CONFIG_KEY);
+                    LOG.info("Using {} = {}",METADATA_STORE_CONFIG_KEY,metadataStoreClass);
+                }else{
+                    metadataStoreClass = MemoryMetadataStore.class.getCanonicalName();
+                    LOG.info("{} is not set, using default {}",METADATA_STORE_CONFIG_KEY,metadataStoreClass);
+                }
+                instance = (MetadataStore) Class.forName(metadataStoreClass).newInstance();
+            } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+                LOG.error("Failed to instantiate {}",metadataStoreClass,e);
+                throw new RuntimeException(e.getMessage(), e.getCause());
+            }
+        }
+        return instance;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.java
new file mode 100644
index 0000000..b63fb09
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceEntity.java
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.persistence;
+
+import org.apache.eagle.metadata.utils.UUIDGenerator;
+
+import java.io.Serializable;
+
+/**
+ * Metadata Persistence Entity
+ */
+public abstract class PersistenceEntity implements Serializable{
+    private String uuid;
+    private long createdTime;
+    private long modifiedTime;
+
+    public String getUuid(){
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid){
+        this.uuid = uuid;
+    }
+
+    public long getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(long createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public long getModifiedTime() {
+        return modifiedTime;
+    }
+
+    public void setModifiedTime(long modifiedTime) {
+        this.modifiedTime = modifiedTime;
+    }
+
+    public void ensureDefault(){
+        if(this.uuid == null || this.uuid.isEmpty()){
+            this.uuid = UUIDGenerator.newUUID();
+        }
+        if(createdTime == 0){
+            this.createdTime = System.currentTimeMillis();
+        }
+        this.modifiedTime = System.currentTimeMillis();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java
new file mode 100644
index 0000000..d525936
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/PersistenceService.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.persistence;
+
+import java.util.Collection;
+
+public interface PersistenceService<T extends PersistenceEntity> {
+    Collection<T> findAll();
+    T getByUUID(String uuid);
+    T create(T entity);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java
new file mode 100644
index 0000000..bcc68c4
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/package-info.java
@@ -0,0 +1,17 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.persistence;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
new file mode 100644
index 0000000..995693a
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/RestResponse.java
@@ -0,0 +1,259 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.resource;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.commons.lang3.time.StopWatch;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Response;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class RestResponse<T>{
+    private Long timestamp;
+    private boolean success = false;
+    private String message;
+    private String exception;
+    private T data;
+    private Long time;
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public boolean isSuccess() {
+        return success;
+    }
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    public static <E> RestResponseBuilder<E> builder(){
+        return new RestResponseBuilder<>();
+    }
+
+    public static <E> RestResponseBuilder<E> of(E data){
+        return RestResponse.<E>builder().data(data);
+    }
+
+    public static <E> RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
+        return RestResponse.<E>builder().of(func);
+    }
+
+    public static <E> RestResponseBuilder<E> of(Supplier<E> func){
+        return RestResponse.<E>builder().of(func);
+    }
+
+    public static <E> RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
+        return RestResponse.<E>builder().async(func);
+    }
+
+    public static <E> RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+        return RestResponse.<E>builder().async(func);
+    }
+
+    public static <E> RestResponseBuilder<E> verbose(boolean verbose) {
+        return RestResponse.<E>builder().verbose(verbose);
+    }
+
+    public String getException() {
+        return exception;
+    }
+
+    public void setThrowable(Throwable exception) {
+        this.setException(ExceptionUtils.getStackTrace(exception));
+    }
+
+    public void setException(String exception) {
+        this.exception = exception;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public Long getTime() {
+        return time;
+    }
+
+    public void setTime(Long time) {
+        this.time = time;
+    }
+
+    public static class RestResponseBuilder<E>{
+        RestResponse<E> current;
+        Response.Status status = Response.Status.OK;
+        boolean verbose = true;
+
+        public RestResponseBuilder(){
+            current = new RestResponse<>();
+        }
+
+        public RestResponseBuilder<E> success(boolean success){
+            this.current.setSuccess(success);
+            return this;
+        }
+
+        public RestResponseBuilder<E> message(String message){
+            this.current.setMessage(message);
+            return this;
+        }
+
+        public RestResponseBuilder<E> data(E data){
+            this.current.setData(data);
+            return this;
+        }
+
+        public RestResponseBuilder<E> status(Response.Status status){
+            this.status = status;
+            return this;
+        }
+        public RestResponseBuilder<E> exception(Throwable exception){
+            this.current.setThrowable(exception);
+            return this;
+        }
+
+        public RestResponseBuilder<E> type(Class<?> clazz){
+            return this;
+        }
+
+        public RestResponseBuilder<E> spend(Long spendMillis){
+            this.current.setTime(spendMillis);
+            return this;
+        }
+
+        public RestResponseBuilder<E> verbose(boolean verbose){
+            this.verbose = verbose;
+            return this;
+        }
+
+        public RestResponseBuilder<E> of(Consumer<RestResponseBuilder<E>> func){
+            StopWatch stopWatch = new StopWatch();
+            try {
+                stopWatch.start();
+                this.success(true).status(Response.Status.OK);
+                func.accept(this);
+            } catch (Exception ex){
+                this.success(false).data(null).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
+            } finally {
+                stopWatch.stop();
+                this.spend(stopWatch.getTime());
+            }
+            return this;
+        }
+
+        public RestResponseBuilder<E>  of(Supplier<E> func){
+            StopWatch stopWatch = new StopWatch();
+            try {
+                stopWatch.start();
+                this.success(true).status(Response.Status.OK).data(func.get());
+            } catch (Throwable ex){
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage());
+            } finally {
+                stopWatch.stop();
+                this.spend(stopWatch.getTime());
+            }
+            return this;
+        }
+
+        public RestResponseBuilder<E> async(UnhandledSupplier<E,Exception> func) {
+            CompletableFuture future = CompletableFuture.runAsync(() -> {
+                try {
+                    this.status(Response.Status.OK).success(true).data(func.get());
+                } catch (Throwable e) {
+                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(e.getMessage()).exception(e);
+                }
+            });
+            runAsync(future);
+            return this;
+        }
+
+        private void runAsync(CompletableFuture future){
+            StopWatch stopWatch = new StopWatch();
+            try {
+                stopWatch.start();
+                future.get();
+            } catch (InterruptedException ex) {
+                Thread.currentThread().interrupt();
+                future.cancel(true);
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            } catch (Throwable ex) {
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            } finally {
+                stopWatch.stop();
+                this.spend(stopWatch.getTime());
+            }
+        }
+
+        public RestResponseBuilder<E> async(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+            CompletableFuture future = CompletableFuture.runAsync(() -> {
+                try {
+                    func.accept(this);
+                    this.success(true);
+                } catch (Throwable ex) {
+                    this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+                }
+            });
+            runAsync(future);
+            return this;
+        }
+
+        public RestResponseBuilder<E> then(UnhandledConsumer<RestResponseBuilder<E>, Exception> func){
+            try {
+                func.accept(this);
+            } catch (Throwable ex) {
+                this.success(false).status(Response.Status.INTERNAL_SERVER_ERROR).message(ex.getMessage()).exception(ex);
+            }
+            return this;
+        }
+
+        public Response get(){
+            this.current.setTimestamp(System.currentTimeMillis());
+            if(!this.verbose){
+                this.current.setException(null);
+            }
+            return Response.status(this.status).entity(this.current).build();
+        }
+
+        public RestResponseBuilder<E> status(boolean success, Response.Status status) {
+            this.success(success);
+            this.status(status);
+            return this;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java
new file mode 100644
index 0000000..0e09e7c
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/SiteResource.java
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.resource;
+
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.service.SiteEntityService;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.Collection;
+
+@Path("/sites")
+@Singleton
+public class SiteResource {
+    private final SiteEntityService siteEntityService;
+
+    @Inject
+    public SiteResource(SiteEntityService siteEntityService){
+        this.siteEntityService = siteEntityService;
+    }
+
+    @GET
+    @Path("/")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Collection<SiteEntity> getAllSites(){
+        return siteEntityService.findAll();
+    }
+
+    @POST
+    @Path("/")
+    @Consumes(MediaType.APPLICATION_JSON)
+    @Produces(MediaType.APPLICATION_JSON)
+    public SiteEntity createSite(SiteEntity siteEntity){
+        return siteEntityService.create(siteEntity);
+    }
+
+    @GET
+    @Path("/{siteIdOrUUID}")
+    @Produces(MediaType.APPLICATION_JSON)
+    public SiteEntity getSiteByNameOrUUID(@PathParam("siteIdOrUUID") String siteIdOrUUID){
+        return siteEntityService.getBySiteIdOrUUID(siteIdOrUUID);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java
new file mode 100644
index 0000000..ecaba49
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UncheckedFunction.java
@@ -0,0 +1,29 @@
+package org.apache.eagle.metadata.resource;
+
+/**
+ * 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.
+ */
+@FunctionalInterface
+public interface UncheckedFunction<T, R> {
+
+    /**
+     * Applies this function to the given argument.
+     *
+     * @param t the function argument
+     * @return the function result
+     */
+    R apply(T t) throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java
new file mode 100644
index 0000000..a777977
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledConsumer.java
@@ -0,0 +1,22 @@
+package org.apache.eagle.metadata.resource;
+
+/**
+ * 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.
+ */
+@FunctionalInterface
+public interface UnhandledConsumer<T, E extends Exception> {
+    void accept(T o) throws E;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java
new file mode 100644
index 0000000..d8e2e88
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/resource/UnhandledSupplier.java
@@ -0,0 +1,29 @@
+package org.apache.eagle.metadata.resource;
+
+/**
+ * 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.
+ *
+ * @see java.util.function.Supplier
+ */
+@FunctionalInterface
+public interface UnhandledSupplier<T, E extends Exception> {
+    /**
+     * Gets a result.
+     *
+     * @return a result
+     */
+    T get() throws E;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java
new file mode 100644
index 0000000..33ab3dd
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationDescService.java
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.service;
+
+import org.apache.eagle.metadata.model.ApplicationDesc;
+
+import java.util.Collection;
+
+public interface ApplicationDescService {
+    Collection<ApplicationDesc> getApplicationDescs();
+    ApplicationDesc getApplicationDescByType(String appType);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java
new file mode 100644
index 0000000..9e05f9b
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/ApplicationEntityService.java
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.service;
+
+
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.persistence.PersistenceService;
+
+import java.util.Collection;
+
+public interface ApplicationEntityService extends PersistenceService<ApplicationEntity> {
+    Collection<ApplicationEntity> findBySiteId(String siteId);
+    ApplicationEntity getBySiteIdAndAppType(String siteId,String appType);
+    ApplicationEntity getByUUIDOrAppId(String uuid,String appId);
+    ApplicationEntity delete(ApplicationEntity applicationEntity);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java
new file mode 100644
index 0000000..2f5254d
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/SiteEntityService.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.service;
+
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.persistence.PersistenceService;
+
+public interface SiteEntityService extends PersistenceService<SiteEntity>{
+    SiteEntity getBySiteId(String siteId);
+    SiteEntity getBySiteIdOrUUID(String siteIdOrUUID);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java
new file mode 100644
index 0000000..200b5f2
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/ApplicationEntityServiceMemoryImpl.java
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.service.memory;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.eagle.metadata.model.ApplicationEntity;
+import org.apache.eagle.metadata.service.ApplicationDescService;
+import org.apache.eagle.metadata.service.ApplicationEntityService;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Singleton
+public class ApplicationEntityServiceMemoryImpl implements ApplicationEntityService {
+
+    private final ApplicationDescService applicationDescService;
+    private final Map<String,ApplicationEntity> applicationEntityMap;
+
+    @Inject
+    public ApplicationEntityServiceMemoryImpl(ApplicationDescService applicationDescService){
+        this.applicationDescService = applicationDescService;
+        this.applicationEntityMap = new HashMap<>();
+    }
+
+    @Override
+    public Collection<ApplicationEntity> findAll() {
+        return applicationEntityMap.values();
+    }
+
+    @Override
+    public ApplicationEntity getByUUID(String uuid) {
+        if(applicationEntityMap.containsKey(uuid)) {
+            return applicationEntityMap.get(uuid);
+        } else {
+            throw new IllegalArgumentException("Application (UUID: "+uuid+") is not found");
+        }
+    }
+
+    @Override
+    public ApplicationEntity create(ApplicationEntity entity) {
+        entity.ensureDefault();
+        if(getBySiteIdAndAppType(entity.getSite().getSiteId(),entity.getDescriptor().getType()) != null)
+            throw new IllegalArgumentException("Duplicated appId: "+entity.getAppId());
+        applicationEntityMap.put(entity.getUuid(),entity);
+        return entity;
+    }
+
+    @Override
+    public Collection<ApplicationEntity> findBySiteId(String siteId) {
+        return applicationEntityMap.values().stream().filter((app) -> siteId.equals(app.getSite().getSiteId())).collect(Collectors.toList());
+    }
+
+    @Override
+    public ApplicationEntity getBySiteIdAndAppType(String siteId, String appType) {
+        Optional<ApplicationEntity>  optional =
+                applicationEntityMap.values().stream()
+                        .filter((app) -> siteId.equals(app.getSite().getSiteId()) && appType.equals(app.getDescriptor().getType())).findAny();
+        if(optional.isPresent()){
+            return optional.get();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public ApplicationEntity getByUUIDOrAppId(String uuid, String appId) {
+        if(uuid == null && appId == null)
+            throw new IllegalArgumentException("uuid and appId are both null");
+        else if(uuid !=null){
+            return getByUUID(uuid);
+        }else {
+            Optional<ApplicationEntity> applicationEntity = applicationEntityMap.values().stream().filter((app) -> appId.equals(app.getAppId())).findAny();
+            if(applicationEntity.isPresent()){
+                return applicationEntity.get();
+            }else{
+                throw new IllegalArgumentException("Application with appId: "+appId+" not found");
+            }
+        }
+    }
+
+    @Override
+    public ApplicationEntity delete(ApplicationEntity applicationEntity) {
+        ApplicationEntity entity = getByUUIDOrAppId(applicationEntity.getUuid(),applicationEntity.getAppId());
+        return applicationEntityMap.remove(entity.getUuid());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.java
new file mode 100644
index 0000000..8e27c53
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/SiteEntityEntityServiceMemoryImpl.java
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.service.memory;
+
+import com.google.inject.Singleton;
+import org.apache.eagle.metadata.model.SiteEntity;
+import org.apache.eagle.metadata.service.SiteEntityService;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+@Singleton
+public class SiteEntityEntityServiceMemoryImpl implements SiteEntityService {
+    private Map<String,SiteEntity> nameSiteMap = new HashMap<>();
+
+    @Override
+    public Collection<SiteEntity> findAll() {
+        return nameSiteMap.values();
+    }
+
+    @Override
+    public SiteEntity getByUUID(String uuid) {
+        return nameSiteMap.values().stream().filter((site) -> uuid.equals(site.getUuid())).findAny().get();
+    }
+
+    @Override
+    public SiteEntity create(SiteEntity entity) {
+        if(getBySiteId(entity.getSiteId()) != null){
+            throw new IllegalArgumentException("Duplicated site: "+entity);
+        }
+        entity.ensureDefault();
+        nameSiteMap.put(entity.getSiteId(),entity);
+        return entity;
+    }
+
+    @Override
+    public SiteEntity getBySiteId(String siteName) {
+        return nameSiteMap.get(siteName);
+    }
+
+    @Override
+    public SiteEntity getBySiteIdOrUUID(String siteNameOrUUID) {
+        if(nameSiteMap.containsKey(siteNameOrUUID)){
+            return nameSiteMap.get(siteNameOrUUID);
+        } else {
+            return getByUUID(siteNameOrUUID);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java
new file mode 100644
index 0000000..2d4fa5f
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/ConfigTemplateHelper.java
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.utils;
+
+import com.google.common.base.Preconditions;
+import org.apache.eagle.metadata.model.Configuration;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.InputStream;
+import java.io.StringReader;
+
+public class ConfigTemplateHelper {
+    private final static Logger LOG = LoggerFactory.getLogger(ConfigTemplateHelper.class);
+    public static Configuration unmarshallFromXmlStream(InputStream inputStream) throws JAXBException {
+        Preconditions.checkNotNull(inputStream,"Input stream is null");
+        try {
+            JAXBContext jc = JAXBContext.newInstance(Configuration.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            return  (Configuration) unmarshaller.unmarshal(inputStream);
+        }catch (Exception ex){
+            LOG.error("Failed to unmarshall ConfigTemplate from stream",ex);
+            throw ex;
+        }
+    }
+
+    public static Configuration unmarshallFromResource(String resourceName) throws JAXBException {
+        String source = resourceName;
+        InputStream inputStream = ConfigTemplateHelper.class.getResourceAsStream(resourceName);
+        if(inputStream == null){
+            source = "/"+resourceName;
+//            LOG.debug("Unable to get resource from {}, retrying with ",resourceName,source);
+            inputStream = ConfigTemplateHelper.class.getResourceAsStream(source);
+        }
+        Preconditions.checkNotNull(inputStream, "Unable to load stream from resource " + source);
+        Configuration configuration =  unmarshallFromXmlStream(inputStream);
+        return configuration;
+    }
+
+    public static Configuration unmarshallFromXMLString(String xmlConfiguration) throws JAXBException {
+        try {
+            JAXBContext jc = JAXBContext.newInstance(Configuration.class);
+            Unmarshaller unmarshaller = jc.createUnmarshaller();
+            return  (Configuration) unmarshaller.unmarshal(new StringReader(xmlConfiguration));
+        }catch (Exception ex){
+            LOG.error("Failed to unmarshall ConfigTemplate from string",ex);
+            throw ex;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java
new file mode 100644
index 0000000..e9efd99
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/utils/UUIDGenerator.java
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.utils;
+
+import java.util.UUID;
+
+public class UUIDGenerator {
+    public static String newUUID(){
+        return UUID.randomUUID().toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml b/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
new file mode 100644
index 0000000..dd14854
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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">
+    <parent>
+        <artifactId>eagle-metadata</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-metadata-jdbc</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java
new file mode 100644
index 0000000..1fe2100
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-jdbc/src/main/java/org/apache/eagle/metadata/store/mysql/MySQLMetadataStore.java
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.store.mysql;
+
+import com.google.inject.Singleton;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.JdbcMetadataDaoImpl;
+import org.apache.eagle.metadata.persistence.MetadataStore;
+
+public class MySQLMetadataStore extends MetadataStore{
+    @Override
+    protected void configure() {
+        bind(IMetadataDao.class).to(JdbcMetadataDaoImpl.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml b/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml
new file mode 100644
index 0000000..f54b76c
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-mongo/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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">
+    <parent>
+        <artifactId>eagle-metadata</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>eagle-metadata-mongo</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-metadata-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java
new file mode 100644
index 0000000..81f12e6
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-mongo/src/main/java/org/apache/eagle/metadata/store/mongo/MongoMetadataStore.java
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+package org.apache.eagle.metadata.store.mongo;
+
+import com.google.inject.Singleton;
+import org.apache.eagle.alert.metadata.IMetadataDao;
+import org.apache.eagle.alert.metadata.impl.MongoMetadataDaoImpl;
+import org.apache.eagle.metadata.persistence.MetadataStore;
+
+public class MongoMetadataStore extends MetadataStore {
+    @Override
+    protected void configure() {
+        bind(IMetadataDao.class).to(MongoMetadataDaoImpl.class).in(Singleton.class);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-metadata/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/pom.xml b/eagle-core/eagle-metadata/pom.xml
new file mode 100644
index 0000000..676327e
--- /dev/null
+++ b/eagle-core/eagle-metadata/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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">
+    <parent>
+        <artifactId>eagle-core</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-metadata</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>eagle-metadata-jdbc</module>
+        <module>eagle-metadata-mongo</module>
+        <module>eagle-metadata-base</module>
+    </modules>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/pom.xml b/eagle-core/eagle-query/eagle-common/pom.xml
deleted file mode 100644
index af93aba..0000000
--- a/eagle-core/eagle-query/eagle-common/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.eagle</groupId>
-		<artifactId>eagle-query-parent</artifactId>
-		<version>0.5.0-incubating-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-	</parent>
-
-	<artifactId>eagle-common</artifactId>
-	<packaging>jar</packaging>
-	<name>eagle-common</name>
-
-	<dependencies>
-		<dependency>
-			<groupId>commons-configuration</groupId>
-			<artifactId>commons-configuration</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.hbase</groupId>
-			<artifactId>hbase-client</artifactId>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.hadoop</groupId>
-			<artifactId>hadoop-common</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>javax.mail</groupId>
-			<artifactId>mail</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.velocity</groupId>
-			<artifactId>velocity</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.google.code.gson</groupId>
-			<artifactId>gson</artifactId>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.google.guava</groupId>
-			<artifactId>guava</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.netflix.archaius</groupId>
-			<artifactId>archaius-core</artifactId>
-		</dependency>
-		
-		<dependency>
-			<groupId>org.mortbay.jetty</groupId>
-			<artifactId>jetty</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.mortbay.jetty</groupId>
-			<artifactId>jetty-util</artifactId>
-		</dependency>
-        <dependency>
-            <groupId>com.typesafe</groupId>
-            <artifactId>config</artifactId>
-        </dependency>
-	</dependencies>
-</project>
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF b/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100644
index c67816b..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-Manifest-Version: 1.0
-Class-Path: 
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/e21b073f/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.java b/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
deleted file mode 100644
index aec84a3..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/org/apache/eagle/common/Base64.java
+++ /dev/null
@@ -1,44 +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.eagle.common;
-
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.bind.DatatypeConverter;
-
-public class Base64 {
-
-	public static String decode(String salted) {
-		try {
-			return new String(DatatypeConverter.parseBase64Binary(salted), "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException("UTF-8 must be supported", e);
-		}
-	}
-
-	public static String encode(String plain) {
-		try {
-			return DatatypeConverter.printBase64Binary(plain.getBytes("UTF-8"));
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException("UTF-8 must be supported", e);
-		}
-	}
-
-}