http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/entity/XXHiveAuditEvent_.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/entity/XXHiveAuditEvent_.java b/agents-audit/src/main/java/com/xasecure/audit/entity/XXHiveAuditEvent_.java deleted file mode 100644 index 328ac96..0000000 --- a/agents-audit/src/main/java/com/xasecure/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 com.xasecure.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/413fcb68/agents-audit/src/main/java/com/xasecure/audit/entity/XXKnoxAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/entity/XXKnoxAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/entity/XXKnoxAuditEvent.java deleted file mode 100644 index cea07b8..0000000 --- a/agents-audit/src/main/java/com/xasecure/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 com.xasecure.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import com.xasecure.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/413fcb68/agents-audit/src/main/java/com/xasecure/audit/entity/XXStormAuditEvent.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/entity/XXStormAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/entity/XXStormAuditEvent.java deleted file mode 100644 index 44fee67..0000000 --- a/agents-audit/src/main/java/com/xasecure/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 com.xasecure.audit.entity; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -import com.xasecure.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/413fcb68/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java b/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java deleted file mode 100644 index be066de..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java +++ /dev/null @@ -1,378 +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 com.xasecure.audit.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; - -import com.xasecure.audit.dao.DaoManager; - - -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 ; - if (str != null) { - if (str.length() > len) { - ret = str.substring(0,len) ; - } - } - return ret ; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/model/EnumRepositoryType.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/EnumRepositoryType.java b/agents-audit/src/main/java/com/xasecure/audit/model/EnumRepositoryType.java deleted file mode 100644 index 0dddef3..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/model/EnumRepositoryType.java +++ /dev/null @@ -1,37 +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 com.xasecure.audit.model; - -public final class EnumRepositoryType { - - public static final int HDFS = 1 ; - - public static final int HBASE = 2 ; - - public static final int HIVE = 3 ; - - public static final int XAAGENT = 4 ; - - public static final int KNOX = 5; - - public static final int STORM = 6 ; - - -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/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 deleted file mode 100644 index 4a35ea4..0000000 --- a/agents-audit/src/main/java/com/xasecure/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 com.xasecure.audit.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; - -import com.xasecure.audit.dao.DaoManager; -import com.xasecure.audit.entity.XXHBaseAuditEvent; - - -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/413fcb68/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 deleted file mode 100644 index b9a6870..0000000 --- a/agents-audit/src/main/java/com/xasecure/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 com.xasecure.audit.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; - -import com.xasecure.audit.dao.DaoManager; -import com.xasecure.audit.entity.XXHdfsAuditEvent; - -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/413fcb68/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 deleted file mode 100644 index 5765bed..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java +++ /dev/null @@ -1,126 +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 com.xasecure.audit.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.xasecure.audit.dao.DaoManager; -import com.xasecure.audit.entity.XXHiveAuditEvent; - -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/413fcb68/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 deleted file mode 100644 index dd18057..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.xasecure.audit.model; - -import com.google.gson.annotations.SerializedName; -import com.xasecure.audit.dao.DaoManager; -import com.xasecure.audit.entity.XXKnoxAuditEvent; - -/** - * 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/413fcb68/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 deleted file mode 100644 index f911068..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.xasecure.audit.model; - -import com.google.gson.annotations.SerializedName; -import com.xasecure.audit.dao.DaoManager; -import com.xasecure.audit.entity.XXStormAuditEvent; - -/** - * 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; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/AsyncAuditProvider.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/AsyncAuditProvider.java b/agents-audit/src/main/java/com/xasecure/audit/provider/AsyncAuditProvider.java deleted file mode 100644 index 4070f47..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/AsyncAuditProvider.java +++ /dev/null @@ -1,272 +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 com.xasecure.audit.provider; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.xasecure.audit.model.AuditEventBase; - -public class AsyncAuditProvider extends MultiDestAuditProvider implements - Runnable { - - private static final Log LOG = LogFactory.getLog(AsyncAuditProvider.class); - - private static int sThreadCount = 0; - - private BlockingQueue<AuditEventBase> mQueue = null; - private Thread mThread = null; - private boolean mStopThread = false; - private String mName = null; - private int mMaxQueueSize = 10 * 1024; - private int mMaxFlushInterval = 5000; // 5 seconds - - // Summary of logs handled - private AtomicLong lifeTimeInLogCount = new AtomicLong(0); // Total count, including drop count - private AtomicLong lifeTimeOutLogCount = new AtomicLong(0); - private AtomicLong lifeTimeDropCount = new AtomicLong(0); - private AtomicLong intervalInLogCount = new AtomicLong(0); - private AtomicLong intervalOutLogCount = new AtomicLong(0); - private AtomicLong intervalDropCount = new AtomicLong(0); - private long lastIntervalLogTime = System.currentTimeMillis(); - private int intervalLogDurationMS = 60000; - - public AsyncAuditProvider(String name, int maxQueueSize, int maxFlushInterval) { - LOG.info("AsyncAuditProvider(" + name + "): creating.."); - - if(maxQueueSize < 1) { - LOG.warn("AsyncAuditProvider(" + name + "): invalid maxQueueSize=" + maxQueueSize + ". will use default " + mMaxQueueSize); - - maxQueueSize = mMaxQueueSize; - } - - mName = name; - mMaxQueueSize = maxQueueSize; - mMaxFlushInterval = maxFlushInterval; - - mQueue = new ArrayBlockingQueue<AuditEventBase>(mMaxQueueSize); - } - - public AsyncAuditProvider(String name, int maxQueueSize, int maxFlushInterval, AuditProvider provider) { - this(name, maxQueueSize, maxFlushInterval); - - addAuditProvider(provider); - } - - @Override - public void init(Properties props) { - LOG.info("AsyncAuditProvider(" + mName + ").init()"); - - super.init(props); - } - - public int getIntervalLogDurationMS() { - return intervalLogDurationMS; - } - - public void setIntervalLogDurationMS(int intervalLogDurationMS) { - this.intervalLogDurationMS = intervalLogDurationMS; - } - - @Override - public void log(AuditEventBase event) { - LOG.debug("AsyncAuditProvider.logEvent(AuditEventBase)"); - - queueEvent(event); - } - - @Override - public void start() { - mThread = new Thread(this, "AsyncAuditProvider" + (++sThreadCount)); - - mThread.setDaemon(true); - mThread.start(); - - super.start(); - } - - @Override - public void stop() { - mStopThread = true; - - try { - mThread.join(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - super.stop(); - } - - @Override - public void waitToComplete() { - waitToComplete(0); - - super.waitToComplete(); - } - - @Override - public void run() { - LOG.info("==> AsyncAuditProvider.run()"); - - while (!mStopThread) { - AuditEventBase event = null; - try { - event = dequeueEvent(); - - if (event != null) { - super.log(event); - } else { - flush(); - } - } catch (Exception excp) { - logFailedEvent(event, excp); - } - } - - try { - flush(); - } catch (Exception excp) { - LOG.error("AsyncAuditProvider.run()", excp); - } - - LOG.info("<== AsyncAuditProvider.run()"); - } - - private void queueEvent(AuditEventBase event) { - // Increase counts - lifeTimeInLogCount.incrementAndGet(); - intervalInLogCount.incrementAndGet(); - - if(! mQueue.offer(event)) { - lifeTimeDropCount.incrementAndGet(); - intervalDropCount.incrementAndGet(); - } - } - - private AuditEventBase dequeueEvent() { - AuditEventBase ret = mQueue.poll(); - - try { - while(ret == null && !mStopThread) { - logSummaryIfRequired(); - - if (mMaxFlushInterval > 0 && isFlushPending()) { - long timeTillNextFlush = getTimeTillNextFlush(); - - if (timeTillNextFlush <= 0) { - break; // force flush - } - - ret = mQueue.poll(timeTillNextFlush, TimeUnit.MILLISECONDS); - } else { - // Let's wake up for summary logging - long waitTime = intervalLogDurationMS - (System.currentTimeMillis() - lastIntervalLogTime); - waitTime = waitTime <= 0 ? intervalLogDurationMS : waitTime; - - ret = mQueue.poll(waitTime, TimeUnit.MILLISECONDS); - } - } - } catch(InterruptedException excp) { - LOG.error("AsyncAuditProvider.dequeueEvent()", excp); - } - - if(ret != null) { - lifeTimeOutLogCount.incrementAndGet(); - intervalOutLogCount.incrementAndGet(); - } - - logSummaryIfRequired(); - - return ret; - } - - private void logSummaryIfRequired() { - long intervalSinceLastLog = System.currentTimeMillis() - lastIntervalLogTime; - - if (intervalSinceLastLog > intervalLogDurationMS) { - if (intervalInLogCount.get() > 0 || intervalOutLogCount.get() > 0 ) { - long queueSize = mQueue.size(); - - LOG.info("AsyncAuditProvider-stats:" + mName + ": past " + formatIntervalForLog(intervalSinceLastLog) - + ": inLogs=" + intervalInLogCount.get() - + ", outLogs=" + intervalOutLogCount.get() - + ", dropped=" + intervalDropCount.get() - + ", currentQueueSize=" + queueSize); - - LOG.info("AsyncAuditProvider-stats:" + mName + ": process lifetime" - + ": inLogs=" + lifeTimeInLogCount.get() - + ", outLogs=" + lifeTimeOutLogCount.get() - + ", dropped=" + lifeTimeDropCount.get()); - } - - lastIntervalLogTime = System.currentTimeMillis(); - intervalInLogCount.set(0); - intervalOutLogCount.set(0); - intervalDropCount.set(0); - } - } - - private boolean isEmpty() { - return mQueue.isEmpty(); - } - - private void waitToComplete(long maxWaitSeconds) { - LOG.debug("==> AsyncAuditProvider.waitToComplete()"); - - for (long waitTime = 0; !isEmpty() - && (maxWaitSeconds <= 0 || maxWaitSeconds > waitTime); waitTime++) { - try { - Thread.sleep(1000); - } catch (Exception excp) { - // ignore - } - } - - LOG.debug("<== AsyncAuditProvider.waitToComplete()"); - } - - private long getTimeTillNextFlush() { - long timeTillNextFlush = mMaxFlushInterval; - - if (mMaxFlushInterval > 0) { - long lastFlushTime = getLastFlushTime(); - - if (lastFlushTime != 0) { - long timeSinceLastFlush = System.currentTimeMillis() - - lastFlushTime; - - if (timeSinceLastFlush >= mMaxFlushInterval) - timeTillNextFlush = 0; - else - timeTillNextFlush = mMaxFlushInterval - timeSinceLastFlush; - } - } - - return timeTillNextFlush; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProvider.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProvider.java b/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProvider.java deleted file mode 100644 index e026cec..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProvider.java +++ /dev/null @@ -1,36 +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 com.xasecure.audit.provider; - -import java.util.Properties; - -import com.xasecure.audit.model.AuditEventBase; - -public interface AuditProvider { - public void log(AuditEventBase event); - - public void init(Properties prop); - public void start(); - public void stop(); - public void waitToComplete(); - - public boolean isFlushPending(); - public long getLastFlushTime(); - public void flush(); -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java b/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java deleted file mode 100644 index 4913b4b..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java +++ /dev/null @@ -1,243 +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 com.xasecure.audit.provider; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.xasecure.audit.provider.hdfs.HdfsAuditProvider; - - -/* - * TODO: - * 1) Flag to enable/disable audit logging - * 2) Failed path to be recorded - * 3) Repo name, repo type from configuration - */ - -public class AuditProviderFactory { - - public enum ApplicationType { Unknown, Hdfs, HiveCLI, HiveServer2, HBaseMaster, HBaseRegionalServer, Knox, Storm }; - - private static final Log LOG = LogFactory.getLog(AuditProviderFactory.class); - - private static final String AUDIT_IS_ENABLED_PROP = "xasecure.audit.is.enabled" ; - private static final String AUDIT_DB_IS_ENABLED_PROP = "xasecure.audit.db.is.enabled" ; - private static final String AUDIT_HDFS_IS_ENABLED_PROP = "xasecure.audit.hdfs.is.enabled"; - private static final String AUDIT_LOG4J_IS_ENABLED_PROP = "xasecure.audit.log4j.is.enabled" ; - - private static final int AUDIT_ASYNC_MAX_QUEUE_SIZE_DEFAULT = 10 * 1024; - private static final int AUDIT_ASYNC_MAX_FLUSH_INTERVAL_DEFAULT = 5 * 1000; - - private static AuditProviderFactory sFactory; - - private AuditProvider mProvider = null; - private boolean mInitDone = false; - - private AuditProviderFactory() { - LOG.info("AuditProviderFactory: creating.."); - - mProvider = getDefaultProvider(); - } - - public static AuditProviderFactory getInstance() { - if(sFactory == null) { - synchronized(AuditProviderFactory.class) { - if(sFactory == null) { - sFactory = new AuditProviderFactory(); - } - } - } - - return sFactory; - } - - public static AuditProvider getAuditProvider() { - return AuditProviderFactory.getInstance().getProvider(); - } - - public AuditProvider getProvider() { - return mProvider; - } - - public boolean isInitDone() { - return mInitDone; - } - - public synchronized void init(Properties props, ApplicationType appType) { - LOG.info("AuditProviderFactory: initializing.."); - - if(mInitDone) { - LOG.warn("AuditProviderFactory.init(): already initialized!", new Exception()); - - return; - } - mInitDone = true; - - setApplicationType(appType); - - boolean isEnabled = BaseAuditProvider.getBooleanProperty(props, AUDIT_IS_ENABLED_PROP, false); - boolean isAuditToDbEnabled = BaseAuditProvider.getBooleanProperty(props, AUDIT_DB_IS_ENABLED_PROP, false); - boolean isAuditToHdfsEnabled = BaseAuditProvider.getBooleanProperty(props, AUDIT_HDFS_IS_ENABLED_PROP, false); - boolean isAuditToLog4jEnabled = BaseAuditProvider.getBooleanProperty(props, AUDIT_LOG4J_IS_ENABLED_PROP, false); - - if(!isEnabled || !(isAuditToDbEnabled || isAuditToHdfsEnabled || isAuditToLog4jEnabled)) { - LOG.info("AuditProviderFactory: Audit not enabled.."); - - mProvider = getDefaultProvider(); - - return; - } - - List<AuditProvider> providers = new ArrayList<AuditProvider>(); - - if(isAuditToDbEnabled) { - DbAuditProvider dbProvider = new DbAuditProvider(); - - boolean isAuditToDbAsync = BaseAuditProvider.getBooleanProperty(props, DbAuditProvider.AUDIT_DB_IS_ASYNC_PROP, false); - - if(isAuditToDbAsync) { - int maxQueueSize = BaseAuditProvider.getIntProperty(props, DbAuditProvider.AUDIT_DB_MAX_QUEUE_SIZE_PROP, AUDIT_ASYNC_MAX_QUEUE_SIZE_DEFAULT); - int maxFlushInterval = BaseAuditProvider.getIntProperty(props, DbAuditProvider.AUDIT_DB_MAX_FLUSH_INTERVAL_PROP, AUDIT_ASYNC_MAX_FLUSH_INTERVAL_DEFAULT); - - AsyncAuditProvider asyncProvider = new AsyncAuditProvider("DbAuditProvider", maxQueueSize, maxFlushInterval, dbProvider); - - providers.add(asyncProvider); - } else { - providers.add(dbProvider); - } - } - - if(isAuditToHdfsEnabled) { - HdfsAuditProvider hdfsProvider = new HdfsAuditProvider(); - - boolean isAuditToHdfsAsync = BaseAuditProvider.getBooleanProperty(props, HdfsAuditProvider.AUDIT_HDFS_IS_ASYNC_PROP, false); - - if(isAuditToHdfsAsync) { - int maxQueueSize = BaseAuditProvider.getIntProperty(props, HdfsAuditProvider.AUDIT_HDFS_MAX_QUEUE_SIZE_PROP, AUDIT_ASYNC_MAX_QUEUE_SIZE_DEFAULT); - int maxFlushInterval = BaseAuditProvider.getIntProperty(props, HdfsAuditProvider.AUDIT_HDFS_MAX_FLUSH_INTERVAL_PROP, AUDIT_ASYNC_MAX_FLUSH_INTERVAL_DEFAULT); - - AsyncAuditProvider asyncProvider = new AsyncAuditProvider("HdfsAuditProvider", maxQueueSize, maxFlushInterval, hdfsProvider); - - providers.add(asyncProvider); - } else { - providers.add(hdfsProvider); - } - } - - if(isAuditToLog4jEnabled) { - Log4jAuditProvider log4jProvider = new Log4jAuditProvider(); - - boolean isAuditToLog4jAsync = BaseAuditProvider.getBooleanProperty(props, Log4jAuditProvider.AUDIT_LOG4J_IS_ASYNC_PROP, false); - - if(isAuditToLog4jAsync) { - int maxQueueSize = BaseAuditProvider.getIntProperty(props, Log4jAuditProvider.AUDIT_LOG4J_MAX_QUEUE_SIZE_PROP, AUDIT_ASYNC_MAX_QUEUE_SIZE_DEFAULT); - int maxFlushInterval = BaseAuditProvider.getIntProperty(props, Log4jAuditProvider.AUDIT_LOG4J_MAX_FLUSH_INTERVAL_PROP, AUDIT_ASYNC_MAX_FLUSH_INTERVAL_DEFAULT); - - AsyncAuditProvider asyncProvider = new AsyncAuditProvider("Log4jAuditProvider", maxQueueSize, maxFlushInterval, log4jProvider); - - providers.add(asyncProvider); - } else { - providers.add(log4jProvider); - } - } - - if(providers.size() == 0) { - mProvider = getDefaultProvider(); - } else if(providers.size() == 1) { - mProvider = providers.get(0); - } else { - MultiDestAuditProvider multiDestProvider = new MultiDestAuditProvider(); - - multiDestProvider.addAuditProviders(providers); - - mProvider = multiDestProvider; - } - - mProvider.init(props); - mProvider.start(); - - JVMShutdownHook jvmShutdownHook = new JVMShutdownHook(mProvider); - - Runtime.getRuntime().addShutdownHook(jvmShutdownHook); - } - - private static void setApplicationType(ApplicationType appType) { - String strAppType = null; - - switch(appType) { - case Hdfs: - strAppType = "hdfs"; - break; - - case HiveCLI: - strAppType = "hiveCli"; - break; - - case HiveServer2: - strAppType = "hiveServer2"; - break; - - case HBaseMaster: - strAppType = "hbaseMaster"; - break; - - case HBaseRegionalServer: - strAppType = "hbaseRegional"; - break; - - case Knox: - strAppType = "knox"; - break; - - case Storm: - strAppType = "storm"; - break; - - case Unknown: - strAppType = "unknown"; - break; - } - - MiscUtil.setApplicationType(strAppType); - } - - private AuditProvider getDefaultProvider() { - return new DummyAuditProvider(); - } - - private static class JVMShutdownHook extends Thread { - AuditProvider mProvider; - - public JVMShutdownHook(AuditProvider provider) { - mProvider = provider; - } - - public void run() { - mProvider.waitToComplete(); - mProvider.stop(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/BaseAuditProvider.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/BaseAuditProvider.java b/agents-audit/src/main/java/com/xasecure/audit/provider/BaseAuditProvider.java deleted file mode 100644 index ccf8a4a..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/BaseAuditProvider.java +++ /dev/null @@ -1,173 +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 com.xasecure.audit.provider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.concurrent.atomic.AtomicLong; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import com.xasecure.audit.model.AuditEventBase; - -public abstract class BaseAuditProvider implements AuditProvider { - private static final Log LOG = LogFactory.getLog(BaseAuditProvider.class); - - private static final String AUDIT_LOG_FAILURE_REPORT_MIN_INTERVAL_PROP = "xasecure.audit.log.failure.report.min.interval.ms"; - - private int mLogFailureReportMinIntervalInMs = 60 * 1000; - - private AtomicLong mFailedLogLastReportTime = new AtomicLong(0); - private AtomicLong mFailedLogCountSinceLastReport = new AtomicLong(0); - private AtomicLong mFailedLogCountLifeTime = new AtomicLong(0); - - - public BaseAuditProvider() { - } - - @Override - public void init(Properties props) { - LOG.info("BaseAuditProvider.init()"); - - mLogFailureReportMinIntervalInMs = getIntProperty(props, AUDIT_LOG_FAILURE_REPORT_MIN_INTERVAL_PROP, 60 * 1000); - } - - public void logFailedEvent(AuditEventBase event) { - logFailedEvent(event, null); - } - - public void logFailedEvent(AuditEventBase event, Throwable excp) { - long now = System.currentTimeMillis(); - - long timeSinceLastReport = now - mFailedLogLastReportTime.get(); - long countSinceLastReport = mFailedLogCountSinceLastReport.incrementAndGet(); - long countLifeTime = mFailedLogCountLifeTime.incrementAndGet(); - - if(timeSinceLastReport >= mLogFailureReportMinIntervalInMs) { - mFailedLogLastReportTime.set(now); - mFailedLogCountSinceLastReport.set(0); - - if(excp != null) { - LOG.warn("failed to log audit event: " + MiscUtil.stringify(event), excp); - } else { - LOG.warn("failed to log audit event: " + MiscUtil.stringify(event)); - } - - if(countLifeTime > 1) { // no stats to print for the 1st failure - LOG.warn("Log failure count: " + countSinceLastReport + " in past " + formatIntervalForLog(timeSinceLastReport) + "; " + countLifeTime + " during process lifetime"); - } - } - } - - public static Map<String, String> getPropertiesWithPrefix(Properties props, String prefix) { - Map<String, String> prefixedProperties = new HashMap<String, String>(); - - if(props != null && prefix != null) { - for(String key : props.stringPropertyNames()) { - if(key == null) { - continue; - } - - String val = props.getProperty(key); - - if(key.startsWith(prefix)) { - key = key.substring(prefix.length()); - - if(key == null) { - continue; - } - - prefixedProperties.put(key, val); - } - } - } - - return prefixedProperties; - } - - public static boolean getBooleanProperty(Properties props, String propName, boolean defValue) { - boolean ret = defValue; - - if(props != null && propName != null) { - String val = props.getProperty(propName); - - if(val != null) { - ret = Boolean.valueOf(val); - } - } - - return ret; - } - - public static int getIntProperty(Properties props, String propName, int defValue) { - int ret = defValue; - - if(props != null && propName != null) { - String val = props.getProperty(propName); - - if(val != null) { - try { - ret = Integer.parseInt(val); - } catch(NumberFormatException excp) { - ret = defValue; - } - } - } - - return ret; - } - - - public static String getStringProperty(Properties props, String propName) { - String ret = null; - - if(props != null && propName != null) { - String val = props.getProperty(propName); - if ( val != null){ - ret = val; - } - } - - return ret; - } - - public String getTimeDiffStr(long time1, long time2) { - long timeInMs = Math.abs(time1 - time2); - return formatIntervalForLog(timeInMs); - } - - public String formatIntervalForLog(long timeInMs) { - long hours = timeInMs / (60 * 60 * 1000); - long minutes = (timeInMs / (60 * 1000)) % 60; - long seconds = (timeInMs % (60 * 1000)) / 1000; - long mSeconds = (timeInMs % (1000)); - - if (hours > 0) - return String.format("%02d:%02d:%02d.%03d hours", hours, minutes, - seconds, mSeconds); - else if (minutes > 0) - return String.format("%02d:%02d.%03d minutes", minutes, seconds, - mSeconds); - else if (seconds > 0) - return String.format("%02d.%03d seconds", seconds, mSeconds); - else - return String.format("%03d milli-seconds", mSeconds); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/BufferedAuditProvider.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/BufferedAuditProvider.java b/agents-audit/src/main/java/com/xasecure/audit/provider/BufferedAuditProvider.java deleted file mode 100644 index 94b853c..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/BufferedAuditProvider.java +++ /dev/null @@ -1,93 +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 com.xasecure.audit.provider; - -import java.util.Properties; - -import com.xasecure.audit.model.AuditEventBase; - -public abstract class BufferedAuditProvider extends BaseAuditProvider { - private LogBuffer<AuditEventBase> mBuffer = null; - private LogDestination<AuditEventBase> mDestination = null; - - @Override - public void init(Properties props) { - super.init(props); - } - - @Override - public void log(AuditEventBase event) { - if(event.getAgentHostname() == null) { - event.setAgentHostname(MiscUtil.getHostname()); - } - - if(event.getLogType() == null) { - event.setLogType("RangerAudit"); - } - - if(event.getEventId() == null) { - event.setEventId(MiscUtil.generateUniqueId()); - } - - if(! mBuffer.add(event)) { - logFailedEvent(event); - } - } - - @Override - public void start() { - mBuffer.start(mDestination); - } - - @Override - public void stop() { - mBuffer.stop(); - } - - @Override - public void waitToComplete() { - } - - @Override - public boolean isFlushPending() { - return false; - } - - @Override - public long getLastFlushTime() { - return 0; - } - - @Override - public void flush() { - } - - protected LogBuffer<AuditEventBase> getBuffer() { - return mBuffer; - } - - protected LogDestination<AuditEventBase> getDestination() { - return mDestination; - } - - protected void setBufferAndDestination(LogBuffer<AuditEventBase> buffer, - LogDestination<AuditEventBase> destination) { - mBuffer = buffer; - mDestination = destination; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/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 deleted file mode 100644 index 8657961..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/DbAuditProvider.java +++ /dev/null @@ -1,356 +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 com.xasecure.audit.provider; - -import java.util.ArrayList; -import java.util.Map; -import java.util.Properties; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import com.xasecure.audit.dao.DaoManager; -import com.xasecure.audit.model.AuditEventBase; -import com.xasecure.authorization.hadoop.utils.XaSecureCredentialProvider; - - -/* - * NOTE: - * - Instances of this class are not thread-safe. - */ -public class DbAuditProvider extends BaseAuditProvider { - - private static final Log LOG = LogFactory.getLog(DbAuditProvider.class); - - public static final String AUDIT_DB_IS_ASYNC_PROP = "xasecure.audit.db.is.async"; - public static final String AUDIT_DB_MAX_QUEUE_SIZE_PROP = "xasecure.audit.db.async.max.queue.size" ; - public static final String AUDIT_DB_MAX_FLUSH_INTERVAL_PROP = "xasecure.audit.db.async.max.flush.interval.ms"; - - private static final String AUDIT_DB_BATCH_SIZE_PROP = "xasecure.audit.db.batch.size" ; - private static final String AUDIT_DB_RETRY_MIN_INTERVAL_PROP = "xasecure.audit.db.config.retry.min.interval.ms"; - private static final String AUDIT_JPA_CONFIG_PROP_PREFIX = "xasecure.audit.jpa."; - private static final String AUDIT_DB_CREDENTIAL_PROVIDER_FILE = "xasecure.audit.credential.provider.file"; - private static final String AUDIT_DB_CREDENTIAL_PROVIDER_ALIAS = "auditDBCred"; - private static final String AUDIT_JPA_JDBC_PASSWORD = "javax.persistence.jdbc.password"; - - private EntityManagerFactory entityManagerFactory; - private DaoManager daoManager; - - private int mCommitBatchSize = 1; - private int mDbRetryMinIntervalMs = 60 * 1000; - private long mLastCommitTime = System.currentTimeMillis(); - private ArrayList<AuditEventBase> mUncommitted = new ArrayList<AuditEventBase>(); - private Map<String, String> mDbProperties = null; - private long mLastDbFailedTime = 0; - - public DbAuditProvider() { - LOG.info("DbAuditProvider: creating.."); - } - - @Override - public void init(Properties props) { - LOG.info("DbAuditProvider.init()"); - - super.init(props); - - mDbProperties = BaseAuditProvider.getPropertiesWithPrefix(props, AUDIT_JPA_CONFIG_PROP_PREFIX); - mCommitBatchSize = BaseAuditProvider.getIntProperty(props, AUDIT_DB_BATCH_SIZE_PROP, 1000); - mDbRetryMinIntervalMs = BaseAuditProvider.getIntProperty(props, AUDIT_DB_RETRY_MIN_INTERVAL_PROP, 15 * 1000); - - boolean isAsync = BaseAuditProvider.getBooleanProperty(props, AUDIT_DB_IS_ASYNC_PROP, false); - - if(! isAsync) { - mCommitBatchSize = 1; // Batching not supported in sync mode - } - - String jdbcPassword = getCredentialString(BaseAuditProvider.getStringProperty(props, AUDIT_DB_CREDENTIAL_PROVIDER_FILE), AUDIT_DB_CREDENTIAL_PROVIDER_ALIAS); - - if(jdbcPassword != null && !jdbcPassword.isEmpty()) { - mDbProperties.put(AUDIT_JPA_JDBC_PASSWORD, jdbcPassword); - } - } - - @Override - public void log(AuditEventBase event) { - LOG.debug("DbAuditProvider.log()"); - - boolean isSuccess = false; - - try { - if(preCreate(event)) { - DaoManager daoMgr = daoManager; - - if(daoMgr != null) { - event.persist(daoMgr); - - isSuccess = postCreate(event); - } - } - } catch(Exception excp) { - logDbError("DbAuditProvider.log(): failed", excp); - } finally { - if(! isSuccess) { - logFailedEvent(event); - } - } - } - - @Override - public void start() { - LOG.info("DbAuditProvider.start()"); - - init(); - } - - @Override - public void stop() { - LOG.info("DbAuditProvider.stop()"); - - cleanUp(); - } - - @Override - public void waitToComplete() { - LOG.info("DbAuditProvider.waitToComplete()"); - } - - @Override - public boolean isFlushPending() { - return mUncommitted.size() > 0; - } - - @Override - public long getLastFlushTime() { - return mLastCommitTime; - } - - @Override - public void flush() { - if(mUncommitted.size() > 0) { - boolean isSuccess = commitTransaction(); - - if(! isSuccess) { - for(AuditEventBase evt : mUncommitted) { - logFailedEvent(evt); - } - } - - mUncommitted.clear(); - } - } - - private synchronized boolean init() { - long now = System.currentTimeMillis(); - - if((now - mLastDbFailedTime) < mDbRetryMinIntervalMs) { - return false; - } - - LOG.info("DbAuditProvider: init()"); - - try { - entityManagerFactory = Persistence.createEntityManagerFactory("xa_server", mDbProperties); - - daoManager = new DaoManager(); - daoManager.setEntityManagerFactory(entityManagerFactory); - - daoManager.getEntityManager(); // this forces the connection to be made to DB - } catch(Exception excp) { - logDbError("DbAuditProvider: DB initalization failed", excp); - - cleanUp(); - - return false; - } - - return true; - } - - private synchronized void cleanUp() { - LOG.info("DbAuditProvider: cleanUp()"); - - try { - if(entityManagerFactory != null && entityManagerFactory.isOpen()) { - entityManagerFactory.close(); - } - } catch(Exception excp) { - LOG.error("DbAuditProvider.cleanUp(): failed", excp); - } finally { - entityManagerFactory = null; - daoManager = null; - } - } - - private boolean isDbConnected() { - EntityManager em = getEntityManager(); - - return em != null && em.isOpen(); - } - - private EntityManager getEntityManager() { - DaoManager daoMgr = daoManager; - - if(daoMgr != null) { - try { - return daoMgr.getEntityManager(); - } catch(Exception excp) { - logDbError("DbAuditProvider.getEntityManager(): failed", excp); - - cleanUp(); - } - } - - return null; - } - - private void clearEntityManager() { - try { - EntityManager em = getEntityManager(); - - if(em != null) { - em.clear(); - } - } catch(Exception excp) { - LOG.warn("DbAuditProvider.clearEntityManager(): failed", excp); - } - } - - private EntityTransaction getTransaction() { - EntityManager em = getEntityManager(); - - return em != null ? em.getTransaction() : null; - } - - private boolean isInTransaction() { - EntityTransaction trx = getTransaction(); - - return trx != null && trx.isActive(); - } - - private boolean beginTransaction() { - EntityTransaction trx = getTransaction(); - - if(trx != null && !trx.isActive()) { - trx.begin(); - } - - if(trx == null) { - LOG.warn("DbAuditProvider.beginTransaction(): trx is null"); - } - - return trx != null; - } - - private boolean commitTransaction() { - boolean ret = false; - EntityTransaction trx = null; - - try { - trx = getTransaction(); - - if(trx != null && trx.isActive()) { - trx.commit(); - - ret =true; - } else { - throw new Exception("trx is null or not active"); - } - } catch(Exception excp) { - logDbError("DbAuditProvider.commitTransaction(): failed", excp); - - cleanUp(); // so that next insert will try to init() - } finally { - mLastCommitTime = System.currentTimeMillis(); - - clearEntityManager(); - } - - return ret; - } - - private boolean preCreate(AuditEventBase event) { - boolean ret = true; - - if(!isDbConnected()) { - ret = init(); - } - - if(ret) { - if(! isInTransaction()) { - ret = beginTransaction(); - } - } - - return ret; - } - - private boolean postCreate(AuditEventBase event) { - boolean ret = true; - - if(mCommitBatchSize <= 1) { - ret = commitTransaction(); - } else { - mUncommitted.add(event); - - if((mUncommitted.size() % mCommitBatchSize) == 0) { - ret = commitTransaction(); - - if(! ret) { - for(AuditEventBase evt : mUncommitted) { - if(evt != event) { - logFailedEvent(evt); - } - } - } - - mUncommitted.clear(); - } - } - return ret; - } - - private void logDbError(String msg, Exception excp) { - long now = System.currentTimeMillis(); - - if((now - mLastDbFailedTime) > mDbRetryMinIntervalMs) { - mLastDbFailedTime = now; - } - - LOG.warn(msg, excp); - } - - private String getCredentialString(String url,String alias) { - String ret = null; - - if(url != null && alias != null) { - char[] cred = XaSecureCredentialProvider.getInstance().getCredentialString(url,alias); - - if ( cred != null ) { - ret = new String(cred); - } - } - - return ret; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/DebugTracer.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/DebugTracer.java b/agents-audit/src/main/java/com/xasecure/audit/provider/DebugTracer.java deleted file mode 100644 index 6453708..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/DebugTracer.java +++ /dev/null @@ -1,28 +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 com.xasecure.audit.provider; - -public interface DebugTracer { - void debug(String msg); - void debug(String msg, Throwable excp); - void info(String msg); - void info(String msg, Throwable excp); - void warn(String msg); - void warn(String msg, Throwable excp); - void error(String msg); - void error(String msg, Throwable excp); -} http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/agents-audit/src/main/java/com/xasecure/audit/provider/DummyAuditProvider.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/DummyAuditProvider.java b/agents-audit/src/main/java/com/xasecure/audit/provider/DummyAuditProvider.java deleted file mode 100644 index 73f4b27..0000000 --- a/agents-audit/src/main/java/com/xasecure/audit/provider/DummyAuditProvider.java +++ /dev/null @@ -1,65 +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 com.xasecure.audit.provider; - -import java.util.Properties; - -import com.xasecure.audit.model.AuditEventBase; - - -public class DummyAuditProvider implements AuditProvider { - @Override - public void init(Properties prop) { - // intentionally left empty - } - - @Override - public void log(AuditEventBase event) { - // intentionally left empty - } - - @Override - public void start() { - // intentionally left empty - } - - @Override - public void stop() { - // intentionally left empty - } - - @Override - public void waitToComplete() { - // intentionally left empty - } - - @Override - public boolean isFlushPending() { - return false; - } - - @Override - public long getLastFlushTime() { - return 0; - } - - @Override - public void flush() { - // intentionally left empty - } -}
