You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by yo...@apache.org on 2016/08/20 21:29:33 UTC
incubator-eagle git commit: EAGLE-487 use guice module better in app
framework use guice module better in app framework
Repository: incubator-eagle
Updated Branches:
refs/heads/develop b31bac50b -> 6d21774a2
EAGLE-487 use guice module better in app framework
use guice module better in app framework
https://issues.apache.org/jira/browse/EAGLE-487
Author: @yonzhang <yo...@gmail.com>
Closes: #368
Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/6d21774a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/6d21774a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/6d21774a
Branch: refs/heads/develop
Commit: 6d21774a26753ca5ede259f3c6966ba9a0572982
Parents: b31bac5
Author: yonzhang <yo...@gmail.com>
Authored: Sat Aug 20 14:33:32 2016 -0700
Committer: yonzhang <yo...@gmail.com>
Committed: Sat Aug 20 14:33:32 2016 -0700
----------------------------------------------------------------------
.../src/main/resources/application.conf | 4 +-
.../app/module/ApplicationExtensionLoader.java | 5 +-
.../app/module/ApplicationGuiceModule.java | 12 ++--
.../impl/ApplicationProviderServiceImpl.java | 10 ++--
.../app/test/ApplicationTestGuiceModule.java | 7 ++-
.../app/ApplicationProviderServiceTest.java | 4 +-
.../dataproc/impl/storm/StormSpoutProvider.java | 2 +-
.../persistence/MetadataStoreFactory.java | 51 ----------------
.../persistence/MetadataStoreModuleFactory.java | 51 ++++++++++++++++
.../service/memory/MemoryMetadataStore.java | 7 ++-
.../eagle-policy/eagle-policy-base/pom.xml | 61 --------------------
eagle-core/eagle-policy/pom.xml | 35 -----------
eagle-core/pom.xml | 1 -
.../hbase/HBaseAuditLogAppProvider.java | 14 +++++
.../eagle/server/module/GuideBundleLoader.java | 30 ++++++++--
.../apache/eagle/server/module/ServeModule.java | 31 ----------
.../eagle/server/module/ServerModule.java | 37 ++++++++++++
17 files changed, 158 insertions(+), 204 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/resources/application.conf b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/resources/application.conf
index 094fd92..60595b1 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/resources/application.conf
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/resources/application.conf
@@ -24,7 +24,7 @@
"localMode" : "true"
},
"spout" : {
- "kafkaBrokerZkQuorum": "localhost:2181",
+ "kafkaBrokerZkQuorum": "server.eagle.apache.org:2181",
"kafkaBrokerZkBasePath": "/kafka",
"stormKafkaUseSameZkQuorumWithKafkaBroker": true,
"stormKafkaTransactionZkQuorum": "",
@@ -34,7 +34,7 @@
"stormKafkaFetchSizeBytes": 1048586,
},
"zkConfig" : {
- "zkQuorum" : "localhost:2181",
+ "zkQuorum" : "server.eagle.apache.org:2181",
"zkRoot" : "/alert",
"zkSessionTimeoutMs" : 10000,
"connectionTimeoutMs" : 10000,
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationExtensionLoader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationExtensionLoader.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationExtensionLoader.java
index 061e134..762b5fe 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationExtensionLoader.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationExtensionLoader.java
@@ -18,6 +18,7 @@ package org.apache.eagle.app.module;
import com.google.inject.Guice;
import com.google.inject.Module;
+import com.google.inject.Stage;
import org.apache.eagle.app.service.ApplicationProviderService;
import org.apache.eagle.common.module.ModuleRegistry;
import org.apache.eagle.common.module.ModuleRegistryImpl;
@@ -27,10 +28,10 @@ import org.slf4j.LoggerFactory;
public class ApplicationExtensionLoader {
private final static Logger LOGGER = LoggerFactory.getLogger(ApplicationExtensionLoader.class);
public static ModuleRegistry load(Module ... context){
- LOGGER.info("Loading application extension modules");
+ LOGGER.warn("Loading application extension modules");
ModuleRegistry registry = new ModuleRegistryImpl();
Guice.createInjector(context).getInstance(ApplicationProviderService.class).getProviders().forEach((provider)->{
- LOGGER.info("Registering modules from {}",provider);
+ LOGGER.warn("Registering modules from {}",provider);
provider.register(registry);
});
return registry;
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
index 50efc0f..757a428 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/module/ApplicationGuiceModule.java
@@ -18,19 +18,23 @@ package org.apache.eagle.app.module;
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
+import com.google.inject.util.Providers;
import org.apache.eagle.app.service.ApplicationManagementService;
import org.apache.eagle.app.service.impl.ApplicationManagementServiceImpl;
import org.apache.eagle.app.service.ApplicationProviderService;
-import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl;
import org.apache.eagle.metadata.service.ApplicationDescService;
public class ApplicationGuiceModule extends AbstractModule {
+ private ApplicationProviderService appProviderInst;
+ public ApplicationGuiceModule(ApplicationProviderService appProviderInst){
+ this.appProviderInst = appProviderInst;
+ }
+
@Override
protected void configure() {
- bind(ApplicationProviderServiceImpl.class).in(Singleton.class);
- bind(ApplicationProviderService.class).to(ApplicationProviderServiceImpl.class).in(Singleton.class);
- bind(ApplicationDescService.class).to(ApplicationProviderServiceImpl.class).in(Singleton.class);
+ bind(ApplicationProviderService.class).toProvider(Providers.of(appProviderInst));
+ bind(ApplicationDescService.class).toProvider(Providers.of(appProviderInst));
bind(ApplicationManagementService.class).to(ApplicationManagementServiceImpl.class).in(Singleton.class);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
index b32e9ca..ec2ad6c 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/impl/ApplicationProviderServiceImpl.java
@@ -44,13 +44,13 @@ public class ApplicationProviderServiceImpl implements ApplicationProviderServic
@Inject
public ApplicationProviderServiceImpl(Config config){
- LOG.info("Initializing {}",this.getClass().getCanonicalName());
+ LOG.warn("Initializing {}",this.getClass().getCanonicalName());
this.config = config;
String appProviderLoaderClass = this.config.hasPath(APP_PROVIDER_LOADER_CLASS_KEY)?
this.config.getString(APP_PROVIDER_LOADER_CLASS_KEY):ApplicationProviderLoader.getDefaultAppProviderLoader();
- LOG.info("Initializing {} = {}",APP_PROVIDER_LOADER_CLASS_KEY,appProviderLoaderClass);
+ LOG.warn("Initializing {} = {}",APP_PROVIDER_LOADER_CLASS_KEY,appProviderLoaderClass);
appProviderLoader = initializeAppProviderLoader(appProviderLoaderClass);
- LOG.info("Initialized {}",appProviderLoader);
+ LOG.warn("Initialized {}",appProviderLoader);
reload();
}
@@ -65,9 +65,9 @@ public class ApplicationProviderServiceImpl implements ApplicationProviderServic
public synchronized void reload(){
appProviderLoader.reset();
- LOG.info("Loading application providers ...");
+ LOG.warn("Loading application providers ...");
appProviderLoader.load();
- LOG.info("Loaded {} application providers",appProviderLoader.getProviders().size());
+ LOG.warn("Loaded {} application providers",appProviderLoader.getProviders().size());
}
public Collection<ApplicationProvider> getProviders(){
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationTestGuiceModule.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationTestGuiceModule.java b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationTestGuiceModule.java
index 4f7b2b4..b50a661 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationTestGuiceModule.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/test/ApplicationTestGuiceModule.java
@@ -18,8 +18,12 @@ package org.apache.eagle.app.test;
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
+import com.typesafe.config.ConfigFactory;
import org.apache.eagle.app.module.ApplicationExtensionLoader;
import org.apache.eagle.app.module.ApplicationGuiceModule;
+import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl;
+import org.apache.eagle.app.spi.ApplicationProvider;
import org.apache.eagle.common.module.CommonGuiceModule;
import org.apache.eagle.common.module.GlobalScope;
import org.apache.eagle.common.module.ModuleRegistry;
@@ -29,7 +33,8 @@ public class ApplicationTestGuiceModule extends AbstractModule{
@Override
protected void configure() {
CommonGuiceModule common = new CommonGuiceModule();
- ApplicationGuiceModule app = new ApplicationGuiceModule();
+ ApplicationProviderService instance = new ApplicationProviderServiceImpl(ConfigFactory.load());
+ ApplicationGuiceModule app = new ApplicationGuiceModule(instance);
MemoryMetadataStore store = new MemoryMetadataStore();
install(common);
install(app);
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
index 543a834..6f32521 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/test/java/org/apache/eagle/app/ApplicationProviderServiceTest.java
@@ -19,8 +19,10 @@ package org.apache.eagle.app;
import com.google.inject.Guice;
import com.google.inject.Injector;
+import com.typesafe.config.ConfigFactory;
import org.apache.eagle.app.module.ApplicationGuiceModule;
import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl;
import org.apache.eagle.app.spi.ApplicationProvider;
import org.apache.eagle.common.module.CommonGuiceModule;
import org.apache.eagle.metadata.model.ApplicationDesc;
@@ -33,7 +35,7 @@ import java.util.Collection;
public class ApplicationProviderServiceTest {
private final static Logger LOGGER = LoggerFactory.getLogger(ApplicationProviderServiceTest.class);
- private Injector injector = Guice.createInjector(new CommonGuiceModule(),new ApplicationGuiceModule(), new MemoryMetadataStore());
+ private Injector injector = Guice.createInjector(new CommonGuiceModule(),new ApplicationGuiceModule(new ApplicationProviderServiceImpl(ConfigFactory.load())), new MemoryMetadataStore());
@Test
public void testApplicationProviderManagerInit(){
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
index 7d69bbd..18f3dc0 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
@@ -6,7 +6,7 @@
* (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
+ * 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,
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreFactory.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreFactory.java
deleted file mode 100644
index 32eb839..0000000
--- a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreFactory.java
+++ /dev/null
@@ -1,51 +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
- * <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.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-import org.apache.eagle.metadata.service.memory.MemoryMetadataStore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MetadataStoreFactory {
- 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;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreModuleFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreModuleFactory.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreModuleFactory.java
new file mode 100644
index 0000000..9a71fdb
--- /dev/null
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/persistence/MetadataStoreModuleFactory.java
@@ -0,0 +1,51 @@
+/*
+ * 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.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.apache.eagle.metadata.service.memory.MemoryMetadataStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MetadataStoreModuleFactory {
+ 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 getModule(){
+ 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/MemoryMetadataStore.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/MemoryMetadataStore.java b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/MemoryMetadataStore.java
index cfb173e..6b5845c 100644
--- a/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/MemoryMetadataStore.java
+++ b/eagle-core/eagle-metadata/eagle-metadata-base/src/main/java/org/apache/eagle/metadata/service/memory/MemoryMetadataStore.java
@@ -16,6 +16,7 @@
*/
package org.apache.eagle.metadata.service.memory;
+import com.google.inject.Singleton;
import org.apache.eagle.alert.metadata.IMetadataDao;
import org.apache.eagle.alert.metadata.impl.InMemMetadataDaoImpl;
import org.apache.eagle.metadata.persistence.MetadataStore;
@@ -25,8 +26,8 @@ import org.apache.eagle.metadata.service.SiteEntityService;
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);
+ bind(SiteEntityService.class).to(SiteEntityEntityServiceMemoryImpl.class).in(Singleton.class);
+ bind(ApplicationEntityService.class).to(ApplicationEntityServiceMemoryImpl.class).in(Singleton.class);
+ bind(IMetadataDao.class).to(InMemMetadataDaoImpl.class).in(Singleton.class);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-policy/eagle-policy-base/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-policy/eagle-policy-base/pom.xml b/eagle-core/eagle-policy/eagle-policy-base/pom.xml
deleted file mode 100644
index 13bb0d9..0000000
--- a/eagle-core/eagle-policy/eagle-policy-base/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.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.
- -->
-
-<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-policy-parent</artifactId>
- <version>0.5.0-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>eagle-policy-base</artifactId>
- <packaging>jar</packaging>
- <name>eagle-policy-base</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-entity-base</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-client-base</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-metric</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.eagle</groupId>
- <artifactId>eagle-data-process</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.siddhi</groupId>
- <artifactId>siddhi-extension-string</artifactId>
- <version>${siddhi.version}</version>
- </dependency>
- </dependencies>
-</project>
-
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/eagle-policy/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-policy/pom.xml b/eagle-core/eagle-policy/pom.xml
deleted file mode 100644
index 1a2c23e..0000000
--- a/eagle-core/eagle-policy/pom.xml
+++ /dev/null
@@ -1,35 +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-core</artifactId>
- <version>0.5.0-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>eagle-policy-parent</artifactId>
- <packaging>pom</packaging>
-
- <name>eagle-policy-parent</name>
- <modules>
- <module>eagle-policy-base</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-core/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/pom.xml b/eagle-core/pom.xml
index 320ea74..1d2862d 100644
--- a/eagle-core/pom.xml
+++ b/eagle-core/pom.xml
@@ -36,7 +36,6 @@
<modules>
<module>eagle-data-process</module>
- <module>eagle-policy</module>
<module>eagle-alert-parent</module>
<module>eagle-query</module>
<module>eagle-embed</module>
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java b/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
index d6e319a..d9ae0ab 100644
--- a/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
+++ b/eagle-security/eagle-security-hbase-auditlog/src/main/java/org/apache/eagle/security/hbase/HBaseAuditLogAppProvider.java
@@ -19,7 +19,9 @@
package org.apache.eagle.security.hbase;
+import com.google.inject.AbstractModule;
import org.apache.eagle.app.spi.AbstractApplicationProvider;
+import org.apache.eagle.common.module.ModuleRegistry;
/**
* Since 8/5/16.
@@ -29,4 +31,16 @@ public class HBaseAuditLogAppProvider extends AbstractApplicationProvider<HBaseA
public HBaseAuditLogApplication getApplication() {
return new HBaseAuditLogApplication();
}
+
+ @Override
+ public void register(ModuleRegistry registry) {
+
+ }
+
+ private static class MyModule extends AbstractModule {
+ @Override
+ protected void configure() {
+
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-server/src/main/java/org/apache/eagle/server/module/GuideBundleLoader.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/module/GuideBundleLoader.java b/eagle-server/src/main/java/org/apache/eagle/server/module/GuideBundleLoader.java
index 3dc3eec..d4ecaf7 100644
--- a/eagle-server/src/main/java/org/apache/eagle/server/module/GuideBundleLoader.java
+++ b/eagle-server/src/main/java/org/apache/eagle/server/module/GuideBundleLoader.java
@@ -18,11 +18,15 @@ package org.apache.eagle.server.module;
import com.google.inject.Module;
import com.hubspot.dropwizard.guice.GuiceBundle;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
import org.apache.eagle.app.module.ApplicationExtensionLoader;
+import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.app.service.impl.ApplicationProviderServiceImpl;
import org.apache.eagle.common.module.GlobalScope;
import org.apache.eagle.common.module.ModuleRegistry;
import org.apache.eagle.metadata.persistence.MetadataStore;
-import org.apache.eagle.metadata.persistence.MetadataStoreFactory;
+import org.apache.eagle.metadata.persistence.MetadataStoreModuleFactory;
import org.apache.eagle.server.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,18 +35,32 @@ import java.util.List;
public class GuideBundleLoader {
private final static Logger LOGGER = LoggerFactory.getLogger(GuideBundleLoader.class);
+
public static GuiceBundle<ServerConfig> load(List<Module> modules){
- MetadataStore metadataStoreModule = MetadataStoreFactory.getInstance();
- ServeModule serveBaseModule = new ServeModule();
- GuiceBundle.Builder<ServerConfig> builder = GuiceBundle.newBuilder();
+ /*
+ We use tow injectors, one is Dropwizard injector, the other injector is to instantiate ApplicationProvider and
+ load sub modules from applications
+ so we need make Config and ApplicationProviderServiceImpl to have a global instance across multiple injectors
+ */
+
+ // Eagle server module
+ Config config = ConfigFactory.load();
+ ApplicationProviderService appProviderSvc = new ApplicationProviderServiceImpl(config);
+ ServerModule serveBaseModule = new ServerModule(appProviderSvc);
+
+ // load application specific modules
ModuleRegistry registry = ApplicationExtensionLoader.load(serveBaseModule);
+
+ // add application specific modules
+ MetadataStore metadataStoreModule = MetadataStoreModuleFactory.getModule();
List<Module> metadataExtensions = metadataStoreModule.getModules(registry);
int extensionNum = 0;
+ GuiceBundle.Builder<ServerConfig> builder = GuiceBundle.newBuilder();
if(metadataExtensions!=null){
extensionNum = metadataExtensions.size();
metadataExtensions.forEach(builder::addModule);
}
- LOGGER.info("Loaded {} modules (scope: metadata)",extensionNum,metadataStoreModule);
+ LOGGER.warn("Loaded {} modules (scope: metadataStore)",extensionNum);
List<Module> globalExtensions = registry.getModules(GlobalScope.class);
extensionNum = 0;
@@ -50,7 +68,7 @@ public class GuideBundleLoader {
extensionNum = globalExtensions.size();
globalExtensions.forEach(builder::addModule);
}
- LOGGER.info("Loaded {} modules (scope: global)",extensionNum,metadataStoreModule);
+ LOGGER.warn("Loaded {} modules (scope: global)",extensionNum);
if(modules!=null) modules.forEach(builder::addModule);
return builder.addModule(serveBaseModule)
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-server/src/main/java/org/apache/eagle/server/module/ServeModule.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/module/ServeModule.java b/eagle-server/src/main/java/org/apache/eagle/server/module/ServeModule.java
deleted file mode 100644
index 3b7d7f9..0000000
--- a/eagle-server/src/main/java/org/apache/eagle/server/module/ServeModule.java
+++ /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
- * <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.server.module;
-
-import com.google.inject.AbstractModule;
-import org.apache.eagle.app.module.ApplicationGuiceModule;
-import org.apache.eagle.common.module.CommonGuiceModule;
-import org.apache.eagle.metadata.persistence.MetadataStoreFactory;
-
-public class ServeModule extends AbstractModule {
- @Override
- protected void configure() {
- install(new CommonGuiceModule());
- install(new ApplicationGuiceModule());
- install(MetadataStoreFactory.getInstance());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/6d21774a/eagle-server/src/main/java/org/apache/eagle/server/module/ServerModule.java
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/java/org/apache/eagle/server/module/ServerModule.java b/eagle-server/src/main/java/org/apache/eagle/server/module/ServerModule.java
new file mode 100644
index 0000000..47e34b3
--- /dev/null
+++ b/eagle-server/src/main/java/org/apache/eagle/server/module/ServerModule.java
@@ -0,0 +1,37 @@
+/*
+ * 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.server.module;
+
+import com.google.inject.AbstractModule;
+import org.apache.eagle.app.module.ApplicationGuiceModule;
+import org.apache.eagle.app.service.ApplicationProviderService;
+import org.apache.eagle.common.module.CommonGuiceModule;
+import org.apache.eagle.metadata.persistence.MetadataStoreModuleFactory;
+
+public class ServerModule extends AbstractModule {
+ private ApplicationProviderService appProviderInst;
+ public ServerModule(ApplicationProviderService appProviderInst){
+ this.appProviderInst = appProviderInst;
+ }
+
+ @Override
+ protected void configure() {
+ install(new CommonGuiceModule());
+ install(new ApplicationGuiceModule(appProviderInst));
+ install(MetadataStoreModuleFactory.getModule());
+ }
+}