ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [3/3] git commit: ARGUS-35: fixes per review comments; removed unused code.
Date Thu, 04 Sep 2014 23:56:22 GMT
ARGUS-35: fixes per review comments; removed unused code.

Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/ea17097a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/ea17097a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/ea17097a

Branch: refs/heads/master
Commit: ea17097a2a21a7aa971abb29be7f18a15591a0ef
Parents: 83eca5e
Author: mneethiraj <mneethiraj@hortonworks.com>
Authored: Thu Sep 4 16:26:50 2014 -0700
Committer: mneethiraj <mneethiraj@hortonworks.com>
Committed: Thu Sep 4 16:26:50 2014 -0700

----------------------------------------------------------------------
 .../com/xasecure/audit/dao/DaoManagerBase.java  | 10 +++---
 .../xasecure/audit/model/HBaseAuditEvent.java   |  2 +-
 .../xasecure/audit/model/HdfsAuditEvent.java    |  2 +-
 .../xasecure/audit/model/HiveAuditEvent.java    |  2 +-
 .../xasecure/audit/model/KnoxAuditEvent.java    |  2 +-
 .../xasecure/audit/model/StormAuditEvent.java   |  2 +-
 .../audit/provider/DbAuditProvider.java         | 29 ---------------
 .../com/xasecure/audit/test/TestEvents.java     | 37 ++++++++++++++------
 8 files changed, 37 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/dao/DaoManagerBase.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/dao/DaoManagerBase.java b/agents-audit/src/main/java/com/xasecure/audit/dao/DaoManagerBase.java
index eb367b0..0718bec 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/dao/DaoManagerBase.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/dao/DaoManagerBase.java
@@ -37,7 +37,7 @@ public abstract class DaoManagerBase {
     public DaoManagerBase() {
 	}
 
-	public XAHBaseAuditEventDao getXAHBaseAuditEvent() {
+	public XAHBaseAuditEventDao getXAHBaseAuditEventDao() {
 		if(mHBaseDao == null) {
 			mHBaseDao = new XAHBaseAuditEventDao(this);
 		}
@@ -45,7 +45,7 @@ public abstract class DaoManagerBase {
 		return mHBaseDao;
 	}
 
-	public XAHdfsAuditEventDao getXAHdfsAuditEvent() {
+	public XAHdfsAuditEventDao getXAHdfsAuditEventDao() {
 		if(mHdfsDao == null) {
 			mHdfsDao = new XAHdfsAuditEventDao(this);
 		}
@@ -53,7 +53,7 @@ public abstract class DaoManagerBase {
 		return mHdfsDao;
 	}
 
-	public XAHiveAuditEventDao getXAHiveAuditEvent() {
+	public XAHiveAuditEventDao getXAHiveAuditEventDao() {
 		if(mHiveDao == null) {
 			mHiveDao = new XAHiveAuditEventDao(this);
 		}
@@ -61,7 +61,7 @@ public abstract class DaoManagerBase {
 		return mHiveDao;
 	}
 
-	public XAKnoxAuditEventDao getXAKnoxAuditEvent() {
+	public XAKnoxAuditEventDao getXAKnoxAuditEventDao() {
 		if(mKnoxDao == null) {
 			mKnoxDao = new XAKnoxAuditEventDao(this);
 		}
@@ -69,7 +69,7 @@ public abstract class DaoManagerBase {
 		return mKnoxDao;
 	}
 
-	public XAStormAuditEventDao getXAStormAuditEvent() {
+	public XAStormAuditEventDao getXAStormAuditEventDao() {
 		if(mStormDao == null) {
 			mStormDao = new XAStormAuditEventDao(this);
 		}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
index 8a703ac..a4ac43b 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
@@ -82,7 +82,7 @@ public class HBaseAuditEvent extends AuditEventBase {
 
 	@Override
 	public void persist(DaoManager daoManager) {
-		daoManager.getXAHBaseAuditEvent().create(new XXHBaseAuditEvent(this));
+		daoManager.getXAHBaseAuditEventDao().create(new XXHBaseAuditEvent(this));
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
index b037988..deff445 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
@@ -65,7 +65,7 @@ public class HdfsAuditEvent extends AuditEventBase {
 
 	@Override
 	public void persist(DaoManager daoManager) {
-		daoManager.getXAHdfsAuditEvent().create(new XXHdfsAuditEvent(this));
+		daoManager.getXAHdfsAuditEventDao().create(new XXHdfsAuditEvent(this));
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
index d7538aa..07f6f94 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
@@ -82,7 +82,7 @@ public class HiveAuditEvent extends AuditEventBase {
 
 	@Override
 	public void persist(DaoManager daoManager) {
-		daoManager.getXAHiveAuditEvent().create(new XXHiveAuditEvent(this));
+		daoManager.getXAHiveAuditEventDao().create(new XXHiveAuditEvent(this));
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
index fe0aa50..545de1c 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
@@ -75,7 +75,7 @@ public class KnoxAuditEvent extends AuditEventBase {
 
 	@Override
 	public void persist(DaoManager daoManager) {
-		daoManager.getXAKnoxAuditEvent().create(new XXKnoxAuditEvent(this));
+		daoManager.getXAKnoxAuditEventDao().create(new XXKnoxAuditEvent(this));
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
index ac9e4ac..0dfcc39 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
@@ -75,7 +75,7 @@ public class StormAuditEvent extends AuditEventBase {
 
 	@Override
 	public void persist(DaoManager daoManager) {
-		daoManager.getXAStormAuditEvent().create(new XXStormAuditEvent(this));
+		daoManager.getXAStormAuditEventDao().create(new XXStormAuditEvent(this));
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/provider/DbAuditProvider.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/DbAuditProvider.java b/agents-audit/src/main/java/com/xasecure/audit/provider/DbAuditProvider.java
index b489128..2106d0a 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/DbAuditProvider.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/DbAuditProvider.java
@@ -30,22 +30,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import com.xasecure.audit.dao.DaoManager;
-import com.xasecure.audit.dao.XAHBaseAuditEventDao;
-import com.xasecure.audit.dao.XAHdfsAuditEventDao;
-import com.xasecure.audit.dao.XAHiveAuditEventDao;
-import com.xasecure.audit.dao.XAKnoxAuditEventDao;
-import com.xasecure.audit.dao.XAStormAuditEventDao;
-import com.xasecure.audit.entity.XXHBaseAuditEvent;
-import com.xasecure.audit.entity.XXHdfsAuditEvent;
-import com.xasecure.audit.entity.XXHiveAuditEvent;
-import com.xasecure.audit.entity.XXKnoxAuditEvent;
-import com.xasecure.audit.entity.XXStormAuditEvent;
 import com.xasecure.audit.model.AuditEventBase;
-import com.xasecure.audit.model.HBaseAuditEvent;
-import com.xasecure.audit.model.HdfsAuditEvent;
-import com.xasecure.audit.model.HiveAuditEvent;
-import com.xasecure.audit.model.KnoxAuditEvent;
-import com.xasecure.audit.model.StormAuditEvent;
 
 
 /*
@@ -58,11 +43,6 @@ public class DbAuditProvider implements AuditProvider {
 
 	private EntityManagerFactory entityManagerFactory;
 	private DaoManager          daoManager;
-	private XAHBaseAuditEventDao hbaseDao;
-	private XAHdfsAuditEventDao hdfsDao;
-	private XAHiveAuditEventDao hiveDao;
-	private XAKnoxAuditEventDao knoxDao;
-	private XAStormAuditEventDao stormDao ;
 	
 	private int                 mCommitBatchSize  = 1;
 	private long                mLastCommitTime   = 0;
@@ -138,12 +118,6 @@ public class DbAuditProvider implements AuditProvider {
    	    daoManager = new DaoManager();
    	    daoManager.setEntityManagerFactory(entityManagerFactory);
 
-		hbaseDao = daoManager.getXAHBaseAuditEvent();
-		hdfsDao = daoManager.getXAHdfsAuditEvent();
-		hiveDao = daoManager.getXAHiveAuditEvent();
-		knoxDao = daoManager.getXAKnoxAuditEvent();
-		stormDao = daoManager.getXAStormAuditEvent() ;
-
 		return true;
 	}
 	
@@ -159,9 +133,6 @@ public class DbAuditProvider implements AuditProvider {
 		} finally {
 			entityManagerFactory = null;
 			daoManager    = null;
-			hbaseDao      = null;
-			hdfsDao       = null;
-			hiveDao       = null;
 		}
 	}
 	

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/ea17097a/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java b/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
index a674dc6..39b5804 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
@@ -68,19 +68,10 @@ public class TestEvents {
 
         	int eventCount = (strEventCount == null) ? 1024 : Integer.parseInt(strEventCount);
 
-        	AuditEventBase[] auditEvents = {
-	            new HBaseAuditEvent(),
-	            new HdfsAuditEvent(),
-	            new HiveAuditEvent(),
-	            new KnoxAuditEvent(),
-	            new StormAuditEvent(),
-        	};
-
         	for(int i = 0; i < eventCount; i++) {
-        		AuditEventBase event = auditEvents[i % auditEvents.length];
+        		AuditEventBase event = getTestEvent(i);
 
 	            LOG.info("==> TestEvents.main(" + (i+1) + "): adding " + event.getClass().getName());
-        		event.setEventTime(new Date());
         		provider.log(event);
 
                 if(i != 0 && ((i % 100) == 0))
@@ -93,4 +84,30 @@ public class TestEvents {
 
         LOG.info("<== TestEvents.main()");
     }
+    
+    private static AuditEventBase getTestEvent(int idx) {
+    	AuditEventBase event = null;
+ 
+		switch(idx % 5) {
+			case 0:
+				event = new HdfsAuditEvent();
+			break;
+			case 1:
+				event = new HBaseAuditEvent();
+			break;
+			case 2:
+				event = new HiveAuditEvent();
+			break;
+			case 3:
+				event = new KnoxAuditEvent();
+			break;
+			case 4:
+				event = new StormAuditEvent();
+			break;
+		}
+		event.setEventTime(new Date());
+		event.setResultReason(Integer.toString(idx));
+
+		return event;
+    }
 }


Mime
View raw message