ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stoa...@apache.org
Subject [36/51] [abbrv] ambari git commit: Move auditlog related bindings from ControllerModule to AuditLoggerModule
Date Thu, 24 Mar 2016 12:09:08 GMT
Move auditlog related bindings from ControllerModule to AuditLoggerModule


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9ca59070
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9ca59070
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9ca59070

Branch: refs/heads/audit_logging
Commit: 9ca59070bb6b7dfa761e1875091dce4bfe0e7a5d
Parents: 565c2ea
Author: Daniel Gergely <dgergely@hortonworks.com>
Authored: Thu Mar 10 15:18:08 2016 +0100
Committer: Toader, Sebastian <stoader@hortonworks.com>
Committed: Thu Mar 24 13:06:49 2016 +0100

----------------------------------------------------------------------
 .../ambari/server/audit/AuditLoggerModule.java  | 60 ++++++++++++++++++
 .../server/controller/ControllerModule.java     | 66 --------------------
 2 files changed, 60 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca59070/ambari-server/src/main/java/org/apache/ambari/server/audit/AuditLoggerModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/AuditLoggerModule.java
b/ambari-server/src/main/java/org/apache/ambari/server/audit/AuditLoggerModule.java
index 3c1938b..876c4d9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/audit/AuditLoggerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/AuditLoggerModule.java
@@ -18,10 +18,39 @@
 
 package org.apache.ambari.server.audit;
 
+import org.apache.ambari.server.audit.request.RequestAuditEventCreator;
+import org.apache.ambari.server.audit.request.RequestAuditLogger;
+import org.apache.ambari.server.audit.request.RequestAuditLoggerImpl;
+import org.apache.ambari.server.audit.request.eventcreator.AlertGroupEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.AlertTargetEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.BlueprintEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.BlueprintExportEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ComponentEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ConfigurationChangeEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.CredentialEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.DefaultEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.GroupEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.HostEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.MemberEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.PrivilegeEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.RecommendationIgnoreEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.RepositoryEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.RepositoryVersionEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.RequestEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ServiceConfigDownloadEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ServiceEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.UnauthorizedEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.UpgradeEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.UpgradeItemEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.UserEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ValidationIgnoreEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ViewInstanceEventCreator;
+import org.apache.ambari.server.audit.request.eventcreator.ViewPrivilegeEventCreator;
 import org.apache.ambari.server.configuration.Configuration;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
+import com.google.inject.multibindings.Multibinder;
 import com.google.inject.name.Names;
 
 public class AuditLoggerModule extends AbstractModule {
@@ -32,5 +61,36 @@ public class AuditLoggerModule extends AbstractModule {
 
     // set AuditLoggerDefaultImpl to be used by BufferedAuditLogger
     bind(AuditLogger.class).annotatedWith(Names.named(BufferedAuditLogger.InnerLogger)).to(AuditLoggerDefaultImpl.class);
+
+    // binding for audit event creators
+    Multibinder<RequestAuditEventCreator> auditLogEventCreatorBinder = Multibinder.newSetBinder(binder(),
RequestAuditEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(DefaultEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ComponentEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ServiceEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(UnauthorizedEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ConfigurationChangeEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(UserEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(GroupEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(MemberEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(PrivilegeEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(BlueprintExportEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ServiceConfigDownloadEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(BlueprintEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ViewInstanceEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ViewPrivilegeEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(RepositoryEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(RepositoryVersionEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(AlertGroupEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(AlertTargetEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(HostEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(UpgradeEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(UpgradeItemEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(RecommendationIgnoreEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(ValidationIgnoreEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(CredentialEventCreator.class);
+    auditLogEventCreatorBinder.addBinding().to(RequestEventCreator.class);
+
+    bind(RequestAuditLogger.class).to(RequestAuditLoggerImpl.class);
+
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca59070/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
index 74cd698..91d6b4d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
@@ -25,7 +25,6 @@ import com.google.gson.GsonBuilder;
 import com.google.inject.AbstractModule;
 import com.google.inject.Scopes;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
-import com.google.inject.multibindings.Multibinder;
 import com.google.inject.name.Names;
 import com.google.inject.persist.PersistModule;
 import com.google.inject.persist.jpa.AmbariJpaPersistModule;
@@ -41,34 +40,6 @@ import org.apache.ambari.server.actionmanager.HostRoleCommandFactoryImpl;
 import org.apache.ambari.server.actionmanager.RequestFactory;
 import org.apache.ambari.server.actionmanager.StageFactory;
 import org.apache.ambari.server.actionmanager.StageFactoryImpl;
-import org.apache.ambari.server.audit.request.RequestAuditEventCreator;
-import org.apache.ambari.server.audit.request.RequestAuditLogger;
-import org.apache.ambari.server.audit.request.RequestAuditLoggerImpl;
-import org.apache.ambari.server.audit.request.eventcreator.AlertGroupEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.AlertTargetEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.BlueprintEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.BlueprintExportEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.CredentialEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.HostEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.PrivilegeEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.GroupEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.MemberEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.RecommendationIgnoreEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.RepositoryEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.RepositoryVersionEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.RequestEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ServiceConfigDownloadEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.UnauthorizedEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ConfigurationChangeEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.DefaultEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ComponentEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ServiceEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.UpgradeEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.UpgradeItemEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.UserEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ValidationIgnoreEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ViewInstanceEventCreator;
-import org.apache.ambari.server.audit.request.eventcreator.ViewPrivilegeEventCreator;
 import org.apache.ambari.server.checks.AbstractCheckDescriptor;
 import org.apache.ambari.server.checks.UpgradeCheckRegistry;
 import org.apache.ambari.server.configuration.Configuration;
@@ -397,8 +368,6 @@ public class ControllerModule extends AbstractModule {
 
     bind(AuthenticationEntryPoint.class).to(AmbariEntryPoint.class).in(Scopes.SINGLETON);
 
-    bindAuditLog();
-
     requestStaticInjection(ExecutionCommandWrapper.class);
     requestStaticInjection(DatabaseChecker.class);
     requestStaticInjection(KerberosChecker.class);
@@ -408,41 +377,6 @@ public class ControllerModule extends AbstractModule {
     registerUpgradeChecks();
   }
 
-  /**
-   * Binds AuditLog related classes
-   */
-  private void bindAuditLog() {
-    Multibinder<RequestAuditEventCreator> auditLogEventCreatorBinder = Multibinder.newSetBinder(binder(),
RequestAuditEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(DefaultEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ComponentEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ServiceEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(UnauthorizedEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ConfigurationChangeEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(UserEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(GroupEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(MemberEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(PrivilegeEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(BlueprintExportEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ServiceConfigDownloadEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(BlueprintEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ViewInstanceEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ViewPrivilegeEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(RepositoryEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(RepositoryVersionEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(AlertGroupEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(AlertTargetEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(HostEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(UpgradeEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(UpgradeItemEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(RecommendationIgnoreEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(ValidationIgnoreEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(CredentialEventCreator.class);
-    auditLogEventCreatorBinder.addBinding().to(RequestEventCreator.class);
-
-    bind(RequestAuditLogger.class).to(RequestAuditLoggerImpl.class);
-  }
-
-
   // ----- helper methods ----------------------------------------------------
 
   private PersistModule buildJpaPersistModule() {


Mime
View raw message