[jboss-cvs] JBossAS SVN: r59487 - projects/security/security-spi/trunk/src/main/org/jboss/security/audit.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 10 12:23:09 EST 2007
Author: anil.saldhana at jboss.com
Date: 2007-01-10 12:23:08 -0500 (Wed, 10 Jan 2007)
New Revision: 59487
Modified:
projects/security/security-spi/trunk/src/main/org/jboss/security/audit/AuditEvent.java
Log:
detailed info. This class should become an interface for implementations to plugin
Modified: projects/security/security-spi/trunk/src/main/org/jboss/security/audit/AuditEvent.java
===================================================================
--- projects/security/security-spi/trunk/src/main/org/jboss/security/audit/AuditEvent.java 2007-01-10 17:22:02 UTC (rev 59486)
+++ projects/security/security-spi/trunk/src/main/org/jboss/security/audit/AuditEvent.java 2007-01-10 17:23:08 UTC (rev 59487)
@@ -5,8 +5,10 @@
* See terms of license at gnu.org.
*/
package org.jboss.security.audit;
-
-import java.util.HashMap;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -19,7 +21,7 @@
{
private String auditLevel = AuditLevel.INFO;
- private Map contextMap = new HashMap();
+ private Map<String,Object> contextMap = new HashMap<String,Object>();
private Exception underlyingException = null;
@@ -50,7 +52,7 @@
* Set a non-modifiable Context Map
* @param cmap Map that is final
*/
- public void setContextMap(final Map cmap)
+ public void setContextMap(final Map<String,Object> cmap)
{
this.contextMap = cmap;
}
@@ -77,7 +79,41 @@
{
StringBuilder sbu = new StringBuilder();
sbu.append("[").append(auditLevel).append("]");
- sbu.append(contextMap);
+ sbu.append(dissectContextMap());
return sbu.toString();
}
+
+ /**
+ * Provide additional information about the entities in
+ * the context map
+ * @return
+ */
+ private String dissectContextMap()
+ {
+ StringBuilder sbu = new StringBuilder();
+ if(contextMap != null)
+ {
+ for(String key:contextMap.keySet())
+ {
+ sbu.append(key).append("=");
+ Object obj = contextMap.get(key);
+ if(obj instanceof Object[])
+ {
+ Object[] arr = (Object[])obj;
+ obj = Arrays.asList(arr);
+ }
+ if(obj instanceof Collection)
+ {
+ Collection coll = (Collection)obj;
+ for(Object o:coll)
+ {
+ sbu.append(o).append(";");
+ }
+ }
+ else
+ sbu.append(obj).append(";");
+ }
+ }
+ return sbu.toString();
+ }
}
More information about the jboss-cvs-commits
mailing list