RANGER-203: Component specific audit objects are placed with generic authz audit object, to enable auditing for all components from generic policy engine.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/2b00241a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/2b00241a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/2b00241a Branch: refs/heads/stack Commit: 2b00241aaf7e46dd77439593afb47c9d1595b072 Parents: 665af61 Author: Madhan Neethiraj <[email protected]> Authored: Wed Jan 7 10:35:00 2015 -0800 Committer: Madhan Neethiraj <[email protected]> Committed: Wed Jan 7 11:18:37 2015 -0800 ---------------------------------------------------------------------- .../ranger/audit/dao/AuthzAuditEventDao.java | 29 ++ .../apache/ranger/audit/dao/DaoManagerBase.java | 46 +- .../audit/dao/RangerHBaseAuditEventDao.java | 29 -- .../audit/dao/RangerHdfsAuditEventDao.java | 29 -- .../audit/dao/RangerHiveAuditEventDao.java | 29 -- .../audit/dao/RangerKnoxAuditEventDao.java | 29 -- .../audit/dao/RangerStormAuditEventDao.java | 29 -- .../audit/entity/AuthzAuditEventDbObj.java | 258 +++++++++++ .../ranger/audit/entity/XXBaseAuditEvent.java | 228 ---------- .../ranger/audit/entity/XXBaseAuditEvent_.java | 48 -- .../ranger/audit/entity/XXHBaseAuditEvent.java | 84 ---- .../ranger/audit/entity/XXHBaseAuditEvent_.java | 32 -- .../ranger/audit/entity/XXHdfsAuditEvent.java | 75 ---- .../ranger/audit/entity/XXHdfsAuditEvent_.java | 31 -- .../ranger/audit/entity/XXHiveAuditEvent.java | 86 ---- .../ranger/audit/entity/XXHiveAuditEvent_.java | 32 -- .../ranger/audit/entity/XXKnoxAuditEvent.java | 82 ---- .../ranger/audit/entity/XXStormAuditEvent.java | 82 ---- .../ranger/audit/model/AuditEventBase.java | 334 -------------- .../ranger/audit/model/AuthzAuditEvent.java | 443 +++++++++++++++++++ .../ranger/audit/model/HBaseAuditEvent.java | 128 ------ .../ranger/audit/model/HdfsAuditEvent.java | 107 ----- .../ranger/audit/model/HiveAuditEvent.java | 127 ------ .../ranger/audit/model/KnoxAuditEvent.java | 98 ---- .../ranger/audit/model/StormAuditEvent.java | 98 ---- .../audit/provider/BufferedAuditProvider.java | 21 +- .../audit/provider/MultiDestAuditProvider.java | 5 - .../apache/ranger/audit/test/TestEvents.java | 212 +++++---- .../src/main/resources/META-INF/persistence.xml | 7 +- .../pdp/knox/filter/RangerPDPKnoxFilter.java | 4 +- .../hbase/RangerAuthorizationCoprocessor.java | 4 +- .../namenode/RangerFSPermissionChecker.java | 4 +- .../hive/authorizer/RangerHiveAuthorizer.java | 6 +- lookup-client/src/scripts/run-audit-test.sh | 7 +- .../storm/authorizer/RangerStormAuthorizer.java | 4 +- 35 files changed, 882 insertions(+), 1985 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/AuthzAuditEventDao.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/AuthzAuditEventDao.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/AuthzAuditEventDao.java new file mode 100644 index 0000000..ee4c211 --- /dev/null +++ b/agents-audit/src/main/java/org/apache/ranger/audit/dao/AuthzAuditEventDao.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 + * + * 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.ranger.audit.dao; + +import org.apache.ranger.audit.entity.AuthzAuditEventDbObj; + +public class AuthzAuditEventDao extends BaseDao<AuthzAuditEventDbObj> { + + public AuthzAuditEventDao(DaoManagerBase daoManager) { + super(daoManager); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/DaoManagerBase.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/DaoManagerBase.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/DaoManagerBase.java index af7cfb4..3531e05 100644 --- a/agents-audit/src/main/java/org/apache/ranger/audit/dao/DaoManagerBase.java +++ b/agents-audit/src/main/java/org/apache/ranger/audit/dao/DaoManagerBase.java @@ -28,53 +28,17 @@ public abstract class DaoManagerBase { abstract public EntityManager getEntityManager(); - private RangerHBaseAuditEventDao mHBaseDao = null; - private RangerHdfsAuditEventDao mHdfsDao = null; - private RangerHiveAuditEventDao mHiveDao = null; - private RangerKnoxAuditEventDao mKnoxDao = null; - private RangerStormAuditEventDao mStormDao = null; + private AuthzAuditEventDao mAuthzAuditDao = null; public DaoManagerBase() { } - public RangerHBaseAuditEventDao getXAHBaseAuditEventDao() { - if(mHBaseDao == null) { - mHBaseDao = new RangerHBaseAuditEventDao(this); + public AuthzAuditEventDao getAuthzAuditEventDao() { + if(mAuthzAuditDao == null) { + mAuthzAuditDao = new AuthzAuditEventDao(this); } - return mHBaseDao; - } - - public RangerHdfsAuditEventDao getXAHdfsAuditEventDao() { - if(mHdfsDao == null) { - mHdfsDao = new RangerHdfsAuditEventDao(this); - } - - return mHdfsDao; - } - - public RangerHiveAuditEventDao getXAHiveAuditEventDao() { - if(mHiveDao == null) { - mHiveDao = new RangerHiveAuditEventDao(this); - } - - return mHiveDao; - } - - public RangerKnoxAuditEventDao getXAKnoxAuditEventDao() { - if(mKnoxDao == null) { - mKnoxDao = new RangerKnoxAuditEventDao(this); - } - - return mKnoxDao; - } - - public RangerStormAuditEventDao getXAStormAuditEventDao() { - if(mStormDao == null) { - mStormDao = new RangerStormAuditEventDao(this); - } - - return mStormDao; + return mAuthzAuditDao; } } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHBaseAuditEventDao.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHBaseAuditEventDao.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHBaseAuditEventDao.java deleted file mode 100644 index 1d6cd93..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHBaseAuditEventDao.java +++ /dev/null @@ -1,29 +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.ranger.audit.dao; - -import org.apache.ranger.audit.entity.XXHBaseAuditEvent; - -public class RangerHBaseAuditEventDao extends BaseDao<XXHBaseAuditEvent> { - - public RangerHBaseAuditEventDao(DaoManagerBase daoManager) { - super(daoManager); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHdfsAuditEventDao.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHdfsAuditEventDao.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHdfsAuditEventDao.java deleted file mode 100644 index 566dee9..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHdfsAuditEventDao.java +++ /dev/null @@ -1,29 +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.ranger.audit.dao; - -import org.apache.ranger.audit.entity.XXHdfsAuditEvent; - -public class RangerHdfsAuditEventDao extends BaseDao<XXHdfsAuditEvent> { - - public RangerHdfsAuditEventDao(DaoManagerBase daoManager) { - super(daoManager); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHiveAuditEventDao.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHiveAuditEventDao.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHiveAuditEventDao.java deleted file mode 100644 index f94523d..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerHiveAuditEventDao.java +++ /dev/null @@ -1,29 +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.ranger.audit.dao; - -import org.apache.ranger.audit.entity.XXHiveAuditEvent; - -public class RangerHiveAuditEventDao extends BaseDao<XXHiveAuditEvent> { - - public RangerHiveAuditEventDao(DaoManagerBase daoManager) { - super(daoManager); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerKnoxAuditEventDao.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerKnoxAuditEventDao.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerKnoxAuditEventDao.java deleted file mode 100644 index 21ec1af..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerKnoxAuditEventDao.java +++ /dev/null @@ -1,29 +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.ranger.audit.dao; - -import org.apache.ranger.audit.entity.XXKnoxAuditEvent; - -public class RangerKnoxAuditEventDao extends BaseDao<XXKnoxAuditEvent> { - - public RangerKnoxAuditEventDao(DaoManagerBase daoManager) { - super(daoManager); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerStormAuditEventDao.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerStormAuditEventDao.java b/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerStormAuditEventDao.java deleted file mode 100644 index 71b5e50..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/dao/RangerStormAuditEventDao.java +++ /dev/null @@ -1,29 +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.ranger.audit.dao; - -import org.apache.ranger.audit.entity.XXStormAuditEvent; - -public class RangerStormAuditEventDao extends BaseDao<XXStormAuditEvent> { - - public RangerStormAuditEventDao(DaoManagerBase daoManager) { - super(daoManager); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/AuthzAuditEventDbObj.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/AuthzAuditEventDbObj.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/AuthzAuditEventDbObj.java new file mode 100644 index 0000000..435393e --- /dev/null +++ b/agents-audit/src/main/java/org/apache/ranger/audit/entity/AuthzAuditEventDbObj.java @@ -0,0 +1,258 @@ +/* + * 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.ranger.audit.entity; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +import org.apache.ranger.audit.model.EnumRepositoryType; +import org.apache.ranger.audit.model.AuthzAuditEvent; + +/** + * Entity implementation class for Entity: AuthzAuditEventDbObj + * + */ +@Entity +@Table(name="xa_access_audit") +public class AuthzAuditEventDbObj implements Serializable { + private static final long serialVersionUID = 1L; + + private long auditId; + private int repositoryType; + private String repositoryName; + private String user; + private Date timeStamp; + private String accessType; + private String resourcePath; + private String resourceType; + private String action; + private int accessResult; + private String agentId; + private long policyId; + private String resultReason; + private String aclEnforcer; + private String sessionId; + private String clientType; + private String clientIP; + private String requestData; + + + public AuthzAuditEventDbObj() { + super(); + } + + public AuthzAuditEventDbObj(AuthzAuditEvent event) { + super(); + + this.repositoryType = event.getRepositoryType(); + this.repositoryName = event.getRepositoryName(); + this.user = event.getUser(); + this.timeStamp = event.getEventTime(); + this.accessType = event.getAccessType(); + this.resourcePath = event.getResourcePath(); + this.resourceType = event.getResourceType(); + this.action = event.getAction(); + this.accessResult = event.getAccessResult(); + this.agentId = event.getAgentId(); + this.policyId = event.getPolicyId(); + this.resultReason = event.getResultReason(); + this.aclEnforcer = event.getAclEnforcer(); + this.sessionId = event.getSessionId(); + this.clientType = event.getClientType(); + this.clientIP = event.getClientIP(); + this.requestData = event.getRequestData(); + } + + @Id + @SequenceGenerator(name="XA_ACCESS_AUDIT_SEQ",sequenceName="XA_ACCESS_AUDIT_SEQ",allocationSize=1) + @GeneratedValue(strategy=GenerationType.AUTO,generator="XA_ACCESS_AUDIT_SEQ") + @Column(name = "id", unique = true, nullable = false) + public long getAuditId() { + return this.auditId; + } + + public void setAuditId(long auditId) { + this.auditId = auditId; + } + + @Column(name = "repo_type") + public int getRepositoryType() { + return this.repositoryType ; + } + + public void setRepositoryType(int repositoryType) { + this.repositoryType = repositoryType; + } + + @Column(name = "repo_name") + public String getRepositoryName() { + return this.repositoryName; + } + + public void setRepositoryName(String repositoryName) { + this.repositoryName = repositoryName; + } + + @Column(name = "request_user") + public String getUser() { + return this.user; + } + + public void setUser(String user) { + this.user = user; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "event_time") + public Date getTimeStamp() { + return this.timeStamp; + } + + public void setTimeStamp(Date timeStamp) { + this.timeStamp = timeStamp; + } + + @Column(name = "access_type") + public String getAccessType() { + return this.accessType; + } + + public void setAccessType(String accessType) { + this.accessType = accessType; + } + + @Column(name = "resource_path") + public String getResourcePath() { + return this.resourcePath; + } + + public void setResourcePath(String resourcePath) { + this.resourcePath = resourcePath; + } + + @Column(name = "resource_type") + public String getResourceType() { + return this.resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + @Column(name = "action") + public String getAction() { + return this.action; + } + + public void setAction(String action) { + this.action = action; + } + + @Column(name = "access_result") + public int getAccessResult() { + return this.accessResult; + } + + public void setAccessResult(int accessResult) { + this.accessResult = accessResult; + } + + @Column(name = "agent_id") + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId; + } + + @Column(name = "policy_id") + public long getPolicyId() { + return this.policyId; + } + + public void setPolicyId(long policyId) { + this.policyId = policyId; + } + + @Column(name = "result_reason") + public String getResultReason() { + return this.resultReason; + } + + public void setResultReason(String resultReason) { + this.resultReason = resultReason; + } + + @Column(name = "acl_enforcer") + public String getAclEnforcer() { + return this.aclEnforcer; + } + + public void setAclEnforcer(String aclEnforcer) { + this.aclEnforcer = aclEnforcer; + } + + @Column(name = "session_id") + public String getSessionId() { + return this.sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + @Column(name = "client_type") + public String getClientType() { + return this.clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } + + @Column(name = "client_ip") + public String getClientIP() { + return this.clientIP; + } + + public void setClientIP(String clientIP) { + this.clientIP = clientIP; + } + + @Column(name = "request_data") + public String getRequestData() { + return this.requestData; + } + + public void setRequestData(String requestData) { + this.requestData = requestData; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent.java deleted file mode 100644 index 9293c72..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent.java +++ /dev/null @@ -1,228 +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.ranger.audit.entity; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.SequenceGenerator; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import org.apache.ranger.audit.model.AuditEventBase; - -/** - * Entity implementation class for Entity: XABaseAuditEvent - * - */ -@Entity -@Inheritance -@DiscriminatorColumn(name="audit_type", discriminatorType=javax.persistence.DiscriminatorType.INTEGER, length=2) -@DiscriminatorValue("0") -@Table(name="xa_access_audit") -public class XXBaseAuditEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private long auditId; - private String agentId; - private String user; - private Date timeStamp; - private long policyId; - private String accessType; - private int accessResult; - private String resultReason; - private String aclEnforcer; - private int repositoryType; - private String repositoryName; - private String sessionId; - private String clientType; - private String clientIP; - private String action; - - public XXBaseAuditEvent() { - super(); - } - - public XXBaseAuditEvent(AuditEventBase event) { - this.agentId = event.getAgentId(); - this.user = event.getUser(); - this.timeStamp = event.getEventTime(); - this.policyId = event.getPolicyId(); - this.accessType = event.getAccessType(); - this.accessResult = event.getAccessResult(); - this.resultReason = event.getResultReason(); - this.aclEnforcer = event.getAclEnforcer(); - this.repositoryType = event.getRepositoryType(); - this.repositoryName = event.getRepositoryName(); - this.sessionId = event.getSessionId(); - this.clientType = event.getClientType(); - this.clientIP = event.getClientIP(); - this.action = event.getAction(); - } - - @Id - @SequenceGenerator(name="XA_ACCESS_AUDIT_SEQ",sequenceName="XA_ACCESS_AUDIT_SEQ",allocationSize=1) - @GeneratedValue(strategy=GenerationType.AUTO,generator="XA_ACCESS_AUDIT_SEQ") - @Column(name = "id", unique = true, nullable = false) - public long getAuditId() { - return this.auditId; - } - - public void setAuditId(long auditId) { - this.auditId = auditId; - } - - @Column(name = "agent_id") - public String getAgentId() { - return agentId; - } - - public void setAgentId(String agentId) { - this.agentId = agentId; - } - - @Column(name = "request_user") - public String getUser() { - return this.user; - } - - public void setUser(String user) { - this.user = user; - } - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "event_time") - public Date getTimeStamp() { - return this.timeStamp; - } - - public void setTimeStamp(Date timeStamp) { - this.timeStamp = timeStamp; - } - - @Column(name = "policy_id") - public long getPolicyId() { - return this.policyId; - } - - public void setPolicyId(long policyId) { - this.policyId = policyId; - } - - @Column(name = "access_type") - public String getAccessType() { - return this.accessType; - } - - public void setAccessType(String accessType) { - this.accessType = accessType; - } - - @Column(name = "access_result") - public int getAccessResult() { - return this.accessResult; - } - - public void setAccessResult(int accessResult) { - this.accessResult = accessResult; - } - - @Column(name = "result_reason") - public String getResultReason() { - return this.resultReason; - } - - public void setResultReason(String resultReason) { - this.resultReason = resultReason; - } - - @Column(name = "acl_enforcer") - public String getAclEnforcer() { - return this.aclEnforcer; - } - - public void setAclEnforcer(String aclEnforcer) { - this.aclEnforcer = aclEnforcer; - } - - @Column(name = "repo_type") - public int getRepositoryType() { - return this.repositoryType ; - } - - public void setRepositoryType(int repositoryType) { - this.repositoryType = repositoryType; - } - - @Column(name = "repo_name") - public String getRepositoryName() { - return this.repositoryName; - } - - public void setRepositoryName(String repositoryName) { - this.repositoryName = repositoryName; - } - - @Column(name = "session_id") - public String getSessionId() { - return this.sessionId; - } - - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - @Column(name = "client_type") - public String getClientType() { - return this.clientType; - } - - public void setClientType(String clientType) { - this.clientType = clientType; - } - - @Column(name = "client_ip") - public String getClientIP() { - return this.clientIP; - } - - public void setClientIP(String clientIP) { - this.clientIP = clientIP; - } - - @Column(name = "action") - public String getAction() { - return this.action; - } - - public void setAction(String action) { - this.action = action; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent_.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent_.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent_.java deleted file mode 100644 index 1e33181..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXBaseAuditEvent_.java +++ /dev/null @@ -1,48 +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.ranger.audit.entity; - -import java.util.Date; - -import javax.annotation.Generated; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -import org.apache.ranger.audit.model.EnumRepositoryType; - -@Generated(value="Dali", date="2014-02-04T07:25:42.940-0800") -@StaticMetamodel(XXBaseAuditEvent.class) -public class XXBaseAuditEvent_ { - public static volatile SingularAttribute<XXBaseAuditEvent, Long> auditId; - public static volatile SingularAttribute<XXBaseAuditEvent, String> agentId; - public static volatile SingularAttribute<XXBaseAuditEvent, String> user; - public static volatile SingularAttribute<XXBaseAuditEvent, Date> timeStamp; - public static volatile SingularAttribute<XXBaseAuditEvent, Long> policyId; - public static volatile SingularAttribute<XXBaseAuditEvent, String> accessType; - public static volatile SingularAttribute<XXBaseAuditEvent, Short> accessResult; - public static volatile SingularAttribute<XXBaseAuditEvent, String> resultReason; - public static volatile SingularAttribute<XXBaseAuditEvent, String> aclEnforcer; - public static volatile SingularAttribute<XXBaseAuditEvent, EnumRepositoryType> repositoryType; - public static volatile SingularAttribute<XXBaseAuditEvent, String> repositoryName; - public static volatile SingularAttribute<XXBaseAuditEvent, String> sessionId; - public static volatile SingularAttribute<XXBaseAuditEvent, String> clientType; - public static volatile SingularAttribute<XXBaseAuditEvent, String> clientIP; - public static volatile SingularAttribute<XXBaseAuditEvent, String> action; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent.java deleted file mode 100644 index efcb37b..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent.java +++ /dev/null @@ -1,84 +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.ranger.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import org.apache.ranger.audit.model.EnumRepositoryType; -import org.apache.ranger.audit.model.HBaseAuditEvent; - -/** - * Entity implementation class for Entity: XAHBaseAuditEvent - * - */ -@Entity -@DiscriminatorValue("1") -public class XXHBaseAuditEvent extends XXBaseAuditEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private String resourcePath; - private String resourceType; - private String requestData; - - - public XXHBaseAuditEvent() { - super(); - } - - public XXHBaseAuditEvent(HBaseAuditEvent event) { - super(event); - - this.resourcePath = event.getResourcePath(); - this.resourceType = event.getResourceType(); - this.requestData = event.getRequestData(); - } - - @Column(name = "resource_path") - public String getResourcePath() { - return this.resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - @Column(name = "resource_type") - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @Column(name = "request_data") - public String getRequestData() { - return this.requestData; - } - - public void setRequestData(String requestData) { - this.requestData = requestData; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent_.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent_.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent_.java deleted file mode 100644 index bbab25b..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHBaseAuditEvent_.java +++ /dev/null @@ -1,32 +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.ranger.audit.entity; - -import javax.annotation.Generated; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -@Generated(value="Dali", date="2014-02-02T14:05:13.483-0800") -@StaticMetamodel(XXHBaseAuditEvent.class) -public class XXHBaseAuditEvent_ extends XXBaseAuditEvent_ { - public static volatile SingularAttribute<XXHBaseAuditEvent, String> resourcePath; - public static volatile SingularAttribute<XXHBaseAuditEvent, String> resourceType; - public static volatile SingularAttribute<XXHBaseAuditEvent, String> requestData; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent.java deleted file mode 100644 index 1bcebbe..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent.java +++ /dev/null @@ -1,75 +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.ranger.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; - -import org.apache.ranger.audit.model.HdfsAuditEvent; - -/** - * Entity implementation class for Entity: XXHdfsAuditEvent - * - */ -@Entity -@DiscriminatorValue("2") -public class XXHdfsAuditEvent extends XXBaseAuditEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private String resourcePath; - private String resourceType; - - - public XXHdfsAuditEvent() { - super(); - } - - public XXHdfsAuditEvent(HdfsAuditEvent event) { - super(event); - - this.resourcePath = event.getResourcePath(); - this.resourceType = event.getResourceType(); - } - - @Column(name = "resource_path") - public String getResourcePath() { - return this.resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - @Column(name = "resource_type") - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent_.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent_.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent_.java deleted file mode 100644 index 4f7c85e..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHdfsAuditEvent_.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 - * - * 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.ranger.audit.entity; - -import javax.annotation.Generated; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -@Generated(value="Dali", date="2014-02-02T14:05:13.489-0800") -@StaticMetamodel(XXHdfsAuditEvent.class) -public class XXHdfsAuditEvent_ extends XXBaseAuditEvent_ { - public static volatile SingularAttribute<XXHdfsAuditEvent, String> resourcePath; - public static volatile SingularAttribute<XXHdfsAuditEvent, String> resourceType; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent.java deleted file mode 100644 index b539be8..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent.java +++ /dev/null @@ -1,86 +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.ranger.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; - -import org.apache.ranger.audit.model.HiveAuditEvent; - -/** - * Entity implementation class for Entity: XXHiveAuditEvent - * - */ -@Entity -@DiscriminatorValue("3") -public class XXHiveAuditEvent extends XXBaseAuditEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private String resourcePath; - private String resourceType; - private String requestData; - - - public XXHiveAuditEvent() { - super(); - } - - public XXHiveAuditEvent(HiveAuditEvent event) { - super(event); - - this.resourcePath = event.getResourcePath(); - this.resourceType = event.getResourceType(); - this.requestData = event.getRequestData(); - } - - @Column(name = "resource_path") - public String getResourcePath() { - return this.resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - @Column(name = "resource_type") - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @Column(name = "request_data") - public String getRequestData() { - return this.requestData; - } - - public void setRequestData(String requestData) { - this.requestData = requestData; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent_.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent_.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent_.java deleted file mode 100644 index 2c4eea5..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXHiveAuditEvent_.java +++ /dev/null @@ -1,32 +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.ranger.audit.entity; - -import javax.annotation.Generated; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.StaticMetamodel; - -@Generated(value="Dali", date="2014-02-02T14:05:13.494-0800") -@StaticMetamodel(XXHiveAuditEvent.class) -public class XXHiveAuditEvent_ extends XXBaseAuditEvent_ { - public static volatile SingularAttribute<XXHiveAuditEvent, String> resourcePath; - public static volatile SingularAttribute<XXHiveAuditEvent, String> resourceType; - public static volatile SingularAttribute<XXHiveAuditEvent, String> requestData; -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXKnoxAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXKnoxAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXKnoxAuditEvent.java deleted file mode 100644 index 57fa105..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXKnoxAuditEvent.java +++ /dev/null @@ -1,82 +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.ranger.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import org.apache.ranger.audit.model.KnoxAuditEvent; - -/** - * Entity implementation class for Entity: XXHiveAuditEvent - * - */ -@Entity -@DiscriminatorValue("4") -public class XXKnoxAuditEvent extends XXBaseAuditEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private String resourcePath; - private String resourceType; - private String requestData; - - - public XXKnoxAuditEvent() { - super(); - } - - public XXKnoxAuditEvent(KnoxAuditEvent event) { - super(event); - - this.resourcePath = event.getResourcePath(); - this.resourceType = event.getResourceType(); - this.requestData = event.getRequestData(); - } - - @Column(name = "resource_path") - public String getResourcePath() { - return this.resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - @Column(name = "resource_type") - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @Column(name = "request_data") - public String getRequestData() { - return this.requestData; - } - - public void setRequestData(String requestData) { - this.requestData = requestData; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXStormAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXStormAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXStormAuditEvent.java deleted file mode 100644 index 9ffc6fb..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/entity/XXStormAuditEvent.java +++ /dev/null @@ -1,82 +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.ranger.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import org.apache.ranger.audit.model.StormAuditEvent; - -/** - * Entity implementation class for Entity: XXHiveAuditEvent - * - */ -@Entity -@DiscriminatorValue("5") -public class XXStormAuditEvent extends XXBaseAuditEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private String resourcePath; - private String resourceType; - private String requestData; - - - public XXStormAuditEvent() { - super(); - } - - public XXStormAuditEvent(StormAuditEvent event) { - super(event); - - this.resourcePath = event.getResourcePath(); - this.resourceType = event.getResourceType(); - this.requestData = event.getRequestData(); - } - - @Column(name = "resource_path") - public String getResourcePath() { - return this.resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - @Column(name = "resource_type") - public String getResourceType() { - return this.resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @Column(name = "request_data") - public String getRequestData() { - return this.requestData; - } - - public void setRequestData(String requestData) { - this.requestData = requestData; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/AuditEventBase.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/AuditEventBase.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/AuditEventBase.java index 0a5663e..f5753f0 100644 --- a/agents-audit/src/main/java/org/apache/ranger/audit/model/AuditEventBase.java +++ b/agents-audit/src/main/java/org/apache/ranger/audit/model/AuditEventBase.java @@ -27,344 +27,10 @@ import com.google.gson.annotations.SerializedName; public abstract class AuditEventBase { - protected static String FIELD_SEPARATOR = ";"; - - protected static final int MAX_ACTION_FIELD_SIZE = 1800 ; - protected static final int MAX_REQUEST_DATA_FIELD_SIZE = 1800 ; - - - @SerializedName("agent") - protected String agentId = null; - - @SerializedName("reqUser") - protected String user = null; - - @SerializedName("evtTime") - protected Date eventTime = new Date(); - - @SerializedName("policy") - protected long policyId = 0; - - @SerializedName("access") - protected String accessType = null; - - @SerializedName("result") - protected short accessResult = 0; // 0 - DENIED; 1 - ALLOWED; HTTP return code - - @SerializedName("reason") - protected String resultReason = null; - - @SerializedName("enforcer") - protected String aclEnforcer = null; - - @SerializedName("repoType") - protected int repositoryType = 0; - - @SerializedName("repo") - protected String repositoryName = null; - - @SerializedName("sess") - protected String sessionId = null; - - @SerializedName("cliType") - protected String clientType = null; - - @SerializedName("cliIP") - protected String clientIP = null; - - @SerializedName("action") - protected String action = null; - - @SerializedName("agentHost") - protected String agentHostname = null; - - @SerializedName("logType") - protected String logType = null; - - @SerializedName("id") - protected String eventId = null; - protected AuditEventBase() { } - - protected AuditEventBase(String agentId, - String user, - Date eventTime, - long policyId, - String accessType, - short accessResult, - String resultReason, - String aclEnforcer, - int repositoryType, - String repositoryName, - String sessionId, - String clientType, - String clientIP, - String action) { - this.agentId = agentId; - this.user = user; - this.eventTime = eventTime; - this.policyId = policyId; - this.accessType = accessType; - this.accessResult = accessResult; - this.resultReason = resultReason; - this.aclEnforcer = aclEnforcer; - this.repositoryType = repositoryType; - this.repositoryName = repositoryName; - this.sessionId = sessionId; - this.clientType = clientType; - this.clientIP = clientIP; - this.action = action; - } - - /** - * @return the agentId - */ - public String getAgentId() { - return agentId; - } - - /** - * @param agentId the agentId to set - */ - public void setAgentId(String agentId) { - this.agentId = agentId; - } - - /** - * @return the user - */ - public String getUser() { - return user; - } - - /** - * @param user the user to set - */ - public void setUser(String user) { - this.user = user; - } - - /** - * @return the timeStamp - */ - public Date getEventTime() { - return eventTime; - } - - /** - * @param timeStamp the timeStamp to set - */ - public void setEventTime(Date eventTime) { - this.eventTime = eventTime; - } - - /** - * @return the policyId - */ - public long getPolicyId() { - return policyId; - } - - /** - * @param policyId the policyId to set - */ - public void setPolicyId(long policyId) { - this.policyId = policyId; - } - - /** - * @return the accessType - */ - public String getAccessType() { - return accessType; - } - - /** - * @param accessType the accessType to set - */ - public void setAccessType(String accessType) { - this.accessType = accessType; - } - - /** - * @return the accessResult - */ - public short getAccessResult() { - return accessResult; - } - - /** - * @param accessResult the accessResult to set - */ - public void setAccessResult(short accessResult) { - this.accessResult = accessResult; - } - - /** - * @return the resultReason - */ - public String getResultReason() { - return resultReason; - } - - /** - * @param resultReason the resultReason to set - */ - public void setResultReason(String resultReason) { - this.resultReason = resultReason; - } - - /** - * @return the aclEnforcer - */ - public String getAclEnforcer() { - return aclEnforcer; - } - - /** - * @param aclEnforcer the aclEnforcer to set - */ - public void setAclEnforcer(String aclEnforcer) { - this.aclEnforcer = aclEnforcer; - } - - /** - * @return the repositoryType - */ - public int getRepositoryType() { - return repositoryType; - } - - /** - * @param repositoryType the repositoryType to set - */ - public void setRepositoryType(int repositoryType) { - this.repositoryType = repositoryType; - } - - /** - * @return the repositoryName - */ - public String getRepositoryName() { - return repositoryName; - } - - /** - * @param repositoryName the repositoryName to set - */ - public void setRepositoryName(String repositoryName) { - this.repositoryName = repositoryName; - } - - /** - * @return the sessionId - */ - public String getSessionId() { - return sessionId; - } - - /** - * @param sessionId the sessionId to set - */ - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - /** - * @return the clientType - */ - public String getClientType() { - return clientType; - } - - /** - * @param clientType the clientType to set - */ - public void setClientType(String clientType) { - this.clientType = clientType; - } - - /** - * @return the clientIP - */ - public String getClientIP() { - return clientIP; - } - - /** - * @param clientIP the clientIP to set - */ - public void setClientIP(String clientIP) { - this.clientIP = clientIP; - } - - /** - * @return the action - */ - public String getAction() { - return trim(action,MAX_ACTION_FIELD_SIZE) ; - } - - /** - * @param action the action to set - */ - public void setAction(String action) { - this.action = action; - } - - public String getAgentHostname() { - return agentHostname; - } - - public void setAgentHostname(String agentHostname) { - this.agentHostname = agentHostname; - } - - public String getLogType() { - return logType; - } - - public void setLogType(String logType) { - this.logType = logType; - } - - public String getEventId() { - return eventId; - } - - public void setEventId(String eventId) { - this.eventId = eventId; - } public abstract void persist(DaoManager daoManager); - - @Override - public String toString() { - return toString(new StringBuilder()).toString(); - } - - protected StringBuilder toString(StringBuilder sb) { - sb.append("agentId=").append(agentId).append(FIELD_SEPARATOR) - .append("user=").append(user).append(FIELD_SEPARATOR) - .append("eventTime=").append(eventTime).append(FIELD_SEPARATOR) - .append("policyId=").append(policyId).append(FIELD_SEPARATOR) - .append("accessType=").append(accessType).append(FIELD_SEPARATOR) - .append("accessResult=").append(accessResult).append(FIELD_SEPARATOR) - .append("resultReason=").append(resultReason).append(FIELD_SEPARATOR) - .append("aclEnforcer=").append(aclEnforcer).append(FIELD_SEPARATOR) - .append("repositoryType=").append(repositoryType).append(FIELD_SEPARATOR) - .append("repositoryName=").append(repositoryName).append(FIELD_SEPARATOR) - .append("sessionId=").append(sessionId).append(FIELD_SEPARATOR) - .append("clientType=").append(clientType).append(FIELD_SEPARATOR) - .append("clientIP=").append(clientIP).append(FIELD_SEPARATOR) - .append("action=").append(action).append(FIELD_SEPARATOR) - .append("agentHostname=").append(agentHostname).append(FIELD_SEPARATOR) - .append("logType=").append(logType).append(FIELD_SEPARATOR) - .append("eventId=").append(eventId).append(FIELD_SEPARATOR) - ; - return sb; - } protected String trim(String str, int len) { String ret = str ; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/AuthzAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/AuthzAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/AuthzAuditEvent.java new file mode 100644 index 0000000..d0c1526 --- /dev/null +++ b/agents-audit/src/main/java/org/apache/ranger/audit/model/AuthzAuditEvent.java @@ -0,0 +1,443 @@ +/* + * 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.ranger.audit.model; + +import java.util.Date; + +import org.apache.ranger.audit.dao.DaoManager; +import org.apache.ranger.audit.entity.AuthzAuditEventDbObj; + +import com.google.gson.annotations.SerializedName; + + +public class AuthzAuditEvent extends AuditEventBase { + protected static String FIELD_SEPARATOR = ";"; + + protected static final int MAX_ACTION_FIELD_SIZE = 1800 ; + protected static final int MAX_REQUEST_DATA_FIELD_SIZE = 1800 ; + + + @SerializedName("repoType") + protected int repositoryType = 0; + + @SerializedName("repo") + protected String repositoryName = null; + + @SerializedName("reqUser") + protected String user = null; + + @SerializedName("evtTime") + protected Date eventTime = new Date(); + + @SerializedName("access") + protected String accessType = null; + + @SerializedName("resource") + protected String resourcePath = null; + + @SerializedName("resType") + protected String resourceType = null; + + @SerializedName("action") + protected String action = null; + + @SerializedName("result") + protected short accessResult = 0; // 0 - DENIED; 1 - ALLOWED; HTTP return code + + @SerializedName("agent") + protected String agentId = null; + + @SerializedName("policy") + protected long policyId = 0; + + @SerializedName("reason") + protected String resultReason = null; + + @SerializedName("enforcer") + protected String aclEnforcer = null; + + @SerializedName("sess") + protected String sessionId = null; + + @SerializedName("cliType") + protected String clientType = null; + + @SerializedName("cliIP") + protected String clientIP = null; + + @SerializedName("reqData") + protected String requestData = null; + + @SerializedName("agentHost") + protected String agentHostname = null; + + @SerializedName("logType") + protected String logType = null; + + @SerializedName("id") + protected String eventId = null; + + + public AuthzAuditEvent() { + super(); + + this.repositoryType = 0; + } + + public AuthzAuditEvent(int repositoryType, + String repositoryName, + String user, + Date eventTime, + String accessType, + String resourcePath, + String resourceType, + String action, + short accessResult, + String agentId, + long policyId, + String resultReason, + String aclEnforcer, + String sessionId, + String clientType, + String clientIP, + String requestData) { + this.repositoryType = repositoryType; + this.repositoryName = repositoryName; + this.user = user; + this.eventTime = eventTime; + this.accessType = accessType; + this.resourcePath = resourcePath; + this.resourceType = resourceType; + this.action = action; + this.accessResult = accessResult; + this.agentId = agentId; + this.policyId = policyId; + this.resultReason = resultReason; + this.aclEnforcer = aclEnforcer; + this.sessionId = sessionId; + this.clientType = clientType; + this.clientIP = clientIP; + this.requestData = requestData; + } + + /** + * @return the repositoryType + */ + public int getRepositoryType() { + return repositoryType; + } + + /** + * @param repositoryType the repositoryType to set + */ + public void setRepositoryType(int repositoryType) { + this.repositoryType = repositoryType; + } + + /** + * @return the repositoryName + */ + public String getRepositoryName() { + return repositoryName; + } + + /** + * @param repositoryName the repositoryName to set + */ + public void setRepositoryName(String repositoryName) { + this.repositoryName = repositoryName; + } + + /** + * @return the user + */ + public String getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(String user) { + this.user = user; + } + + /** + * @return the timeStamp + */ + public Date getEventTime() { + return eventTime; + } + + /** + * @param timeStamp the timeStamp to set + */ + public void setEventTime(Date eventTime) { + this.eventTime = eventTime; + } + + /** + * @return the accessType + */ + public String getAccessType() { + return accessType; + } + + /** + * @param accessType the accessType to set + */ + public void setAccessType(String accessType) { + this.accessType = accessType; + } + + /** + * @return the resourcePath + */ + public String getResourcePath() { + return resourcePath; + } + + /** + * @param resourcePath the resourcePath to set + */ + public void setResourcePath(String resourcePath) { + this.resourcePath = resourcePath; + } + + /** + * @return the resourceType + */ + public String getResourceType() { + return resourceType; + } + + /** + * @param resourceType the resourceType to set + */ + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + /** + * @return the action + */ + public String getAction() { + return trim(action, MAX_ACTION_FIELD_SIZE) ; + } + + /** + * @param action the action to set + */ + public void setAction(String action) { + this.action = action; + } + + /** + * @return the accessResult + */ + public short getAccessResult() { + return accessResult; + } + + /** + * @param accessResult the accessResult to set + */ + public void setAccessResult(short accessResult) { + this.accessResult = accessResult; + } + + /** + * @return the agentId + */ + public String getAgentId() { + return agentId; + } + + /** + * @param agentId the agentId to set + */ + public void setAgentId(String agentId) { + this.agentId = agentId; + } + + /** + * @return the policyId + */ + public long getPolicyId() { + return policyId; + } + + /** + * @param policyId the policyId to set + */ + public void setPolicyId(long policyId) { + this.policyId = policyId; + } + + /** + * @return the resultReason + */ + public String getResultReason() { + return resultReason; + } + + /** + * @param resultReason the resultReason to set + */ + public void setResultReason(String resultReason) { + this.resultReason = resultReason; + } + + /** + * @return the aclEnforcer + */ + public String getAclEnforcer() { + return aclEnforcer; + } + + /** + * @param aclEnforcer the aclEnforcer to set + */ + public void setAclEnforcer(String aclEnforcer) { + this.aclEnforcer = aclEnforcer; + } + + /** + * @return the sessionId + */ + public String getSessionId() { + return sessionId; + } + + /** + * @param sessionId the sessionId to set + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + /** + * @return the clientType + */ + public String getClientType() { + return clientType; + } + + /** + * @param clientType the clientType to set + */ + public void setClientType(String clientType) { + this.clientType = clientType; + } + + /** + * @return the clientIP + */ + public String getClientIP() { + return clientIP; + } + + /** + * @param clientIP the clientIP to set + */ + public void setClientIP(String clientIP) { + this.clientIP = clientIP; + } + + /** + * @return the requestData + */ + public String getRequestData() { + return trim(requestData, MAX_REQUEST_DATA_FIELD_SIZE) ; + } + + /** + * @param requestData the requestData to set + */ + public void setRequestData(String requestData) { + this.requestData = requestData; + } + + public String getAgentHostname() { + return agentHostname; + } + + public void setAgentHostname(String agentHostname) { + this.agentHostname = agentHostname; + } + + public String getLogType() { + return logType; + } + + public void setLogType(String logType) { + this.logType = logType; + } + + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + + sb.append("AuthzAuditEvent{"); + toString(sb); + sb.append("}"); + + return sb.toString(); + } + + protected StringBuilder toString(StringBuilder sb) { + sb.append("repositoryType=").append(repositoryType).append(FIELD_SEPARATOR) + .append("repositoryName=").append(repositoryName).append(FIELD_SEPARATOR) + .append("user=").append(user).append(FIELD_SEPARATOR) + .append("eventTime=").append(eventTime).append(FIELD_SEPARATOR) + .append("accessType=").append(accessType).append(FIELD_SEPARATOR) + .append("resourcePath=").append(resourcePath).append(FIELD_SEPARATOR) + .append("resourceType=").append(resourceType).append(FIELD_SEPARATOR) + .append("action=").append(action).append(FIELD_SEPARATOR) + .append("accessResult=").append(accessResult).append(FIELD_SEPARATOR) + .append("agentId=").append(agentId).append(FIELD_SEPARATOR) + .append("policyId=").append(policyId).append(FIELD_SEPARATOR) + .append("resultReason=").append(resultReason).append(FIELD_SEPARATOR) + .append("aclEnforcer=").append(aclEnforcer).append(FIELD_SEPARATOR) + .append("sessionId=").append(sessionId).append(FIELD_SEPARATOR) + .append("clientType=").append(clientType).append(FIELD_SEPARATOR) + .append("clientIP=").append(clientIP).append(FIELD_SEPARATOR) + .append("requestData=").append(requestData).append(FIELD_SEPARATOR) + .append("agentHostname=").append(agentHostname).append(FIELD_SEPARATOR) + .append("logType=").append(logType).append(FIELD_SEPARATOR) + .append("eventId=").append(eventId).append(FIELD_SEPARATOR) + ; + return sb; + } + + @Override + public void persist(DaoManager daoManager) { + daoManager.getAuthzAuditEventDao().create(new AuthzAuditEventDbObj(this)); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/HBaseAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/HBaseAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/HBaseAuditEvent.java deleted file mode 100644 index 2a07fc0..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/model/HBaseAuditEvent.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.ranger.audit.model; - -import java.util.Date; - -import org.apache.ranger.audit.dao.DaoManager; -import org.apache.ranger.audit.entity.XXHBaseAuditEvent; - -import com.google.gson.annotations.SerializedName; - - -public class HBaseAuditEvent extends AuditEventBase { - @SerializedName("resource") - protected String resourcePath; - - @SerializedName("resType") - protected String resourceType; - - @SerializedName("reqData") - protected String requestData; - - public HBaseAuditEvent() { - this.repositoryType = EnumRepositoryType.HBASE; - } - - public HBaseAuditEvent(String agentId, - String user, - Date eventTime, - long policyId, - String accessType, - short accessResult, - String resultReason, - String aclEnforcer, - int repositoryType, - String repositoryName, - String sessionId, - String clientType, - String clientIP, - String resourcePath, - String resourceType, - String requestData, - String action) { - super(agentId, user, eventTime, policyId, accessType, accessResult, resultReason, aclEnforcer, repositoryType, repositoryName, sessionId, clientType, clientIP, action); - - this.resourcePath = resourcePath; - this.resourceType = resourceType; - this.requestData = requestData; - } - - /** - * @return the resourcePath - */ - public String getResourcePath() { - return resourcePath; - } - - /** - * @param resourcePath the resourcePath to set - */ - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - /** - * @return the resourceType - */ - public String getResourceType() { - return resourceType; - } - - /** - * @param resourceType the resourceType to set - */ - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - /** - * @return the requestData - */ - public String getRequestData() { - return trim(requestData,MAX_REQUEST_DATA_FIELD_SIZE) ; - } - - /** - * @param requestData the requestData to set - */ - public void setRequestData(String requestData) { - this.requestData = requestData; - } - - @Override - public void persist(DaoManager daoManager) { - daoManager.getXAHBaseAuditEventDao().create(new XXHBaseAuditEvent(this)); - } - - @Override - protected StringBuilder toString(StringBuilder sb) { - sb.append("HBaseAuditEvent{"); - - super.toString(sb) - .append("resourcePath=").append(resourcePath).append(FIELD_SEPARATOR) - .append("resourceType=").append(resourceType).append(FIELD_SEPARATOR) - .append("requestData=").append(requestData).append(FIELD_SEPARATOR); - - sb.append("}"); - - return sb; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/HdfsAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/HdfsAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/HdfsAuditEvent.java deleted file mode 100644 index 631c6a9..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/model/HdfsAuditEvent.java +++ /dev/null @@ -1,107 +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.ranger.audit.model; - -import java.util.Date; - -import org.apache.ranger.audit.dao.DaoManager; -import org.apache.ranger.audit.entity.XXHdfsAuditEvent; - -import com.google.gson.annotations.SerializedName; - -public class HdfsAuditEvent extends AuditEventBase { - @SerializedName("resource") - protected String resourcePath; - - @SerializedName("resType") - protected String resourceType; - - public HdfsAuditEvent() { - this.repositoryType = EnumRepositoryType.HDFS; - } - - public HdfsAuditEvent(String agentId, - String user, - Date eventTime, - long policyId, - String accessType, - short accessResult, - String resultReason, - String aclEnforcer, - int repositoryType, - String repositoryName, - String sessionId, - String clientType, - String clientIP, - String resourcePath, - String resourceType, - String action) { - super(agentId, user, eventTime, policyId, accessType, accessResult, resultReason, aclEnforcer, repositoryType, repositoryName, sessionId, clientType, clientIP, action); - - this.resourcePath = resourcePath; - this.resourceType = resourceType; - } - - /** - * @return the resourcePath - */ - public String getResourcePath() { - return resourcePath; - } - - /** - * @param resourcePath the resourcePath to set - */ - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - /** - * @return the resourceType - */ - public String getResourceType() { - return resourceType; - } - - /** - * @param resourceType the resourceType to set - */ - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - @Override - public void persist(DaoManager daoManager) { - daoManager.getXAHdfsAuditEventDao().create(new XXHdfsAuditEvent(this)); - } - - @Override - protected StringBuilder toString(StringBuilder sb) { - sb.append("HdfsAuditEvent{"); - - super.toString(sb) - .append("resourcePath=").append(resourcePath).append(FIELD_SEPARATOR) - .append("resourceType=").append(resourceType).append(FIELD_SEPARATOR); - - sb.append("}"); - - return sb; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/HiveAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/HiveAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/HiveAuditEvent.java deleted file mode 100644 index 2d3ffb1..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/model/HiveAuditEvent.java +++ /dev/null @@ -1,127 +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.ranger.audit.model; - -import java.util.Date; - -import org.apache.ranger.audit.dao.DaoManager; -import org.apache.ranger.audit.entity.XXHiveAuditEvent; - -import com.google.gson.annotations.SerializedName; - -public class HiveAuditEvent extends AuditEventBase { - @SerializedName("resource") - protected String resourcePath; - - @SerializedName("resType") - protected String resourceType; - - @SerializedName("reqData") - protected String requestData; - - public HiveAuditEvent() { - this.repositoryType = EnumRepositoryType.HIVE; - } - - public HiveAuditEvent(String agentId, - String user, - Date eventTime, - long policyId, - String accessType, - short accessResult, - String resultReason, - String aclEnforcer, - int repositoryType, - String repositoryName, - String sessionId, - String clientType, - String clientIP, - String resourcePath, - String resourceType, - String requestData, - String action) { - super(agentId, user, eventTime, policyId, accessType, accessResult, resultReason, aclEnforcer, repositoryType, repositoryName, sessionId, clientType, clientIP, action); - - this.resourcePath = resourcePath; - this.resourceType = resourceType; - this.requestData = requestData; - } - - /** - * @return the resourcePath - */ - public String getResourcePath() { - return resourcePath; - } - - /** - * @param resourcePath the resourcePath to set - */ - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - /** - * @return the resourceType - */ - public String getResourceType() { - return resourceType; - } - - /** - * @param resourceType the resourceType to set - */ - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - /** - * @return the requestData - */ - public String getRequestData() { - return trim(requestData,MAX_REQUEST_DATA_FIELD_SIZE); - } - - /** - * @param requestData the requestData to set - */ - public void setRequestData(String requestData) { - this.requestData = requestData; - } - - @Override - public void persist(DaoManager daoManager) { - daoManager.getXAHiveAuditEventDao().create(new XXHiveAuditEvent(this)); - } - - @Override - protected StringBuilder toString(StringBuilder sb) { - sb.append("HiveAuditEvent{"); - - super.toString(sb) - .append("resourcePath=").append(resourcePath).append(FIELD_SEPARATOR) - .append("resourceType=").append(resourceType).append(FIELD_SEPARATOR) - .append("requestData=").append(requestData).append(FIELD_SEPARATOR); - - sb.append("}"); - - return sb; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/KnoxAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/KnoxAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/KnoxAuditEvent.java deleted file mode 100644 index d4d6e0a..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/model/KnoxAuditEvent.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.apache.ranger.audit.model; - -import org.apache.ranger.audit.dao.DaoManager; -import org.apache.ranger.audit.entity.XXKnoxAuditEvent; - -import com.google.gson.annotations.SerializedName; - -/** - * 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. - */ - -public class KnoxAuditEvent extends AuditEventBase { - @SerializedName("resource") - protected String resourcePath; - - @SerializedName("resType") - protected String resourceType; - - @SerializedName("reqData") - protected String requestData; - - public KnoxAuditEvent() { - this.repositoryType = EnumRepositoryType.KNOX; - } - - /** - * @return the resourcePath - */ - public String getResourcePath() { - return resourcePath; - } - - /** - * @param resourcePath the resourcePath to set - */ - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - /** - * @return the resourceType - */ - public String getResourceType() { - return resourceType; - } - - /** - * @param resourceType the resourceType to set - */ - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - /** - * @return the requestData - */ - public String getRequestData() { - return trim(requestData, MAX_REQUEST_DATA_FIELD_SIZE); - } - - /** - * @param requestData - * the requestData to set - */ - public void setRequestData(String requestData) { - this.requestData = requestData; - } - - @Override - public void persist(DaoManager daoManager) { - daoManager.getXAKnoxAuditEventDao().create(new XXKnoxAuditEvent(this)); - } - - @Override - protected StringBuilder toString(StringBuilder sb) { - sb.append("KnoxAuditEvent{"); - - super.toString(sb).append("requestData=") - .append(requestData).append(FIELD_SEPARATOR); - - sb.append("}"); - - return sb; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/2b00241a/agents-audit/src/main/java/org/apache/ranger/audit/model/StormAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/model/StormAuditEvent.java b/agents-audit/src/main/java/org/apache/ranger/audit/model/StormAuditEvent.java deleted file mode 100644 index 264b123..0000000 --- a/agents-audit/src/main/java/org/apache/ranger/audit/model/StormAuditEvent.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.apache.ranger.audit.model; - -import org.apache.ranger.audit.dao.DaoManager; -import org.apache.ranger.audit.entity.XXStormAuditEvent; - -import com.google.gson.annotations.SerializedName; - -/** - * 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. - */ - -public class StormAuditEvent extends AuditEventBase { - @SerializedName("resource") - protected String resourcePath; - - @SerializedName("resType") - protected String resourceType; - - @SerializedName("reqData") - protected String requestData; - - public StormAuditEvent() { - this.repositoryType = EnumRepositoryType.STORM; - } - - /** - * @return the resourcePath - */ - public String getResourcePath() { - return resourcePath; - } - - /** - * @param resourcePath the resourcePath to set - */ - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - /** - * @return the resourceType - */ - public String getResourceType() { - return resourceType; - } - - /** - * @param resourceType the resourceType to set - */ - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - /** - * @return the requestData - */ - public String getRequestData() { - return trim(requestData, MAX_REQUEST_DATA_FIELD_SIZE); - } - - /** - * @param requestData - * the requestData to set - */ - public void setRequestData(String requestData) { - this.requestData = requestData; - } - - @Override - public void persist(DaoManager daoManager) { - daoManager.getXAStormAuditEventDao().create(new XXStormAuditEvent(this)); - } - - @Override - protected StringBuilder toString(StringBuilder sb) { - sb.append("StormAuditEvent{"); - - super.toString(sb).append("requestData=") - .append(requestData).append(FIELD_SEPARATOR); - - sb.append("}"); - - return sb; - } -}
