001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.activemq.broker.util;
019
020 import java.text.SimpleDateFormat;
021 import java.util.Date;
022 import java.util.HashMap;
023 import java.util.Map;
024
025 public class AuditLogEntry {
026
027 protected String user = "anonymous";
028 protected long timestamp;
029 protected String operation;
030 protected String remoteAddr;
031
032 SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss,SSS");
033
034 protected Map<String, Object> parameters = new HashMap<String, Object>();
035
036 public String getUser() {
037 return user;
038 }
039
040 public void setUser(String user) {
041 this.user = user;
042 }
043
044 public long getTimestamp() {
045 return timestamp;
046 }
047
048 public void setTimestamp(long timestamp) {
049 this.timestamp = timestamp;
050 }
051
052 public String getFormattedTime() {
053 return formatter.format(new Date(timestamp));
054 }
055
056 public String getOperation() {
057 return operation;
058 }
059
060 public void setOperation(String operation) {
061 this.operation = operation;
062 }
063
064 public String getRemoteAddr() {
065 return remoteAddr;
066 }
067
068 public void setRemoteAddr(String remoteAddr) {
069 this.remoteAddr = remoteAddr;
070 }
071
072 public Map<String, Object> getParameters() {
073 return parameters;
074 }
075
076 public void setParameters(Map<String, Object> parameters) {
077 this.parameters = parameters;
078 }
079 }