[jboss-cvs] JBossAS SVN: r63020 - projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun May 13 12:39:16 EDT 2007


Author: anil.saldhana at jboss.com
Date: 2007-05-13 12:39:16 -0400 (Sun, 13 May 2007)
New Revision: 63020

Removed:
   projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditContext.java
   projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditProvider.java
   projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/JBossAuditManager.java
   projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/SecurityActions.java
Log:
refactor classes to plugins or spi

Deleted: projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditContext.java
===================================================================
--- projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditContext.java	2007-05-13 16:38:20 UTC (rev 63019)
+++ projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditContext.java	2007-05-13 16:39:16 UTC (rev 63020)
@@ -1,56 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */ 
-package org.jboss.security.audit;
-
-import java.util.ArrayList;
-import java.util.List; 
-
-/**
- *  Context for Audit Purposes that manages a set of providers
- *  @see AuditProvider
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @version $Revision$
- *  @since  Aug 21, 2006
- */
-public class AuditContext 
-{
-   private String securityDomain = null;
-   
-   private List<AuditProvider> providerList = new ArrayList<AuditProvider>();
-   
-   public AuditContext(String securityDomainName)
-   { 
-      this.securityDomain = securityDomainName; 
-   }
-   
-   public void audit(AuditEvent ae)
-   {
-      int len = this.providerList.size();
-      
-      for(int i = 0; i < len; i++)
-      {
-         AuditProvider ap = (AuditProvider)this.providerList.get(i);
-         ap.audit(ae);
-      } 
-   }
-   
-   public void addProvider(AuditProvider ap)
-   {
-      providerList.add(ap);
-   }
-   
-   public void addProviders(List list)
-   {
-      providerList.addAll(list);
-   }
-   
-   public void replaceProviders(List list)
-   {
-      providerList.clear();
-      providerList = list;
-   }
-}

Deleted: projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditProvider.java
===================================================================
--- projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditProvider.java	2007-05-13 16:38:20 UTC (rev 63019)
+++ projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/AuditProvider.java	2007-05-13 16:39:16 UTC (rev 63020)
@@ -1,24 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */ 
-package org.jboss.security.audit;
-
-/**
- *  Audit Provider that can log audit events to an external
- *  sink
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @version $Revision$
- *  @since  Aug 21, 2006
- */
-public interface AuditProvider
-{
-   /**
-    * Perform an audit of the event passed
-    * A provider can log the audit as per needs.
-    * @param ae audit event that holds information on the audit
-    */
-  public void audit(AuditEvent ae);
-}

Deleted: projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/JBossAuditManager.java
===================================================================
--- projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/JBossAuditManager.java	2007-05-13 16:38:20 UTC (rev 63019)
+++ projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/JBossAuditManager.java	2007-05-13 16:39:16 UTC (rev 63020)
@@ -1,99 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */ 
-package org.jboss.security.audit;
-
-import java.security.PrivilegedActionException;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.jboss.security.audit.config.AuditProviderEntry;
-import org.jboss.security.audit.providers.LogAuditProvider;
-import org.jboss.security.config.ApplicationPolicy;
-import org.jboss.security.config.AuditInfo;
-import org.jboss.security.config.SecurityConfiguration; 
-
-/**
- *  Manages a set of AuditContext
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @version $Revision$
- *  @since  Aug 22, 2006
- */
-public class JBossAuditManager implements AuditManager
-{
-   private static ConcurrentHashMap contexts = new ConcurrentHashMap();
-   
-   private static AuditContext defaultContext = null;
-   
-   static
-   {
-      defaultContext = new AuditContext("Default_Context");
-      defaultContext.addProvider(new LogAuditProvider()); 
-   }
-
-   private String securityDomain;
-   
-   public JBossAuditManager(String secDomain)
-   {
-      this.securityDomain = secDomain;
-   }
-   
-   public AuditContext getAuditContext() throws PrivilegedActionException
-   {
-      AuditContext ac = (AuditContext)contexts.get(securityDomain);
-      if(ac == null)
-      {
-         ac = new AuditContext(securityDomain);
-         ApplicationPolicy ap = SecurityConfiguration.getApplicationPolicy(securityDomain);
-         if(ap != null)
-         {
-            AuditInfo ai = ap.getAuditInfo();
-            ClassLoader cl = SecurityActions.getContextClassLoader();
-            List<AuditProviderEntry> list = ai.get();
-            for(AuditProviderEntry ape:list)
-            {
-               String pname = ape.getName();
-               try
-               {
-                  ac.addProvider((AuditProvider) SecurityActions.loadClass(pname).newInstance());
-               }
-               catch (Exception e)
-               {
-                  throw new RuntimeException(e);
-               } 
-            }
-         }
-      }
-      return ac;
-   }
-   
-   public static AuditContext getAuditContext(String securityDomain)
-   {
-      AuditContext ac = (AuditContext)contexts.get(securityDomain);
-      if(ac == null)
-         ac = defaultContext;
-      return ac;
-   } 
-   
-   public static void addAuditContext(String securityDomain, AuditContext ac)
-   {
-      contexts.put(securityDomain, ac);
-   }
-
-   public void audit(AuditEvent ae)
-   {
-      AuditContext ac = null;
-      try
-      {
-         ac = getAuditContext();
-      }
-      catch (PrivilegedActionException e)
-      {
-        throw new RuntimeException(e);
-      }
-      ac.audit(ae); 
-   } 
-}

Deleted: projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/SecurityActions.java
===================================================================
--- projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/SecurityActions.java	2007-05-13 16:38:20 UTC (rev 63019)
+++ projects/security/security-jboss-sx/trunk/src/main/org/jboss/security/audit/SecurityActions.java	2007-05-13 16:39:16 UTC (rev 63020)
@@ -1,67 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2007, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.security.audit;
-
-import java.security.AccessController; 
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-//$Id$
-
-/**
- *  Privileged Blocks
- *  @author Anil.Saldhana at redhat.com
- *  @since  May 11, 2007 
- *  @version $Revision$
- */
-public class SecurityActions
-{
-   public static ClassLoader getContextClassLoader() throws PrivilegedActionException
-   {
-      return (ClassLoader) AccessController.doPrivileged(new PrivilegedExceptionAction()
-      { 
-         public Object run()
-         {
-            return Thread.currentThread().getContextClassLoader();
-         }
-      });
-   }
-   
-   public static Class loadClass(final String name) throws PrivilegedActionException 
-   {
-      return (Class) AccessController.doPrivileged(new PrivilegedExceptionAction()
-      {
-         public Object run() throws PrivilegedActionException
-         {
-            try
-            {
-               return getContextClassLoader().loadClass(name);
-            }
-            catch ( Exception e)
-            {
-               throw new PrivilegedActionException(e);
-            } 
-         }
-      });
-   }
-
-}




More information about the jboss-cvs-commits mailing list