[jboss-cvs] JBossAS SVN: r99602 - in projects/security/picketbox/trunk/security-jboss-sx/jbosssx: src/main/java/org/jboss/resource/security and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 19 13:51:40 EST 2010


Author: anil.saldhana at jboss.com
Date: 2010-01-19 13:51:39 -0500 (Tue, 19 Jan 2010)
New Revision: 99602

Added:
   projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/
   projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java
Modified:
   projects/security/picketbox/trunk/security-jboss-sx/jbosssx/pom.xml
   projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java
   projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
   projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java
Log:
get rid of AS jmx library dep

Modified: projects/security/picketbox/trunk/security-jboss-sx/jbosssx/pom.xml
===================================================================
--- projects/security/picketbox/trunk/security-jboss-sx/jbosssx/pom.xml	2010-01-19 17:54:51 UTC (rev 99601)
+++ projects/security/picketbox/trunk/security-jboss-sx/jbosssx/pom.xml	2010-01-19 18:51:39 UTC (rev 99602)
@@ -155,12 +155,6 @@
          </exclusions>
       </dependency>
       <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-jmx</artifactId>
-         <version>4.2.1.GA</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
          <groupId>org.jboss.security</groupId>
          <artifactId>jbossxacml</artifactId>
          <version>2.0.4</version>

Modified: projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java
===================================================================
--- projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java	2010-01-19 17:54:51 UTC (rev 99601)
+++ projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java	2010-01-19 18:51:39 UTC (rev 99602)
@@ -32,7 +32,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.util.MBeanServerLocator;
 import org.jboss.security.auth.spi.AbstractServerLoginModule;
 
 

Modified: projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
===================================================================
--- projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java	2010-01-19 17:54:51 UTC (rev 99601)
+++ projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java	2010-01-19 18:51:39 UTC (rev 99602)
@@ -29,7 +29,7 @@
 import javax.management.ObjectName;
 
 import org.jboss.crypto.CryptoUtil;
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.util.MBeanServerLocator;
 
 /**
  * PriviledgedActions used by login modules for decoding passwords

Modified: projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java
===================================================================
--- projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java	2010-01-19 17:54:51 UTC (rev 99601)
+++ projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java	2010-01-19 18:51:39 UTC (rev 99602)
@@ -28,7 +28,7 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.util.MBeanServerLocator;
 
 /**
  * PriviledgedActions used by login modules for decoding passwords

Added: projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java
===================================================================
--- projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java	                        (rev 0)
+++ projects/security/picketbox/trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java	2010-01-19 18:51:39 UTC (rev 99602)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.util;
+
+import java.util.Iterator;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+/**
+ * A helper class to locate an MBeanServer.
+ *      
+ * MBeanServer lookup strategy enhanced to allow the explicit
+ * setting of a particular instance to be returned. This is needed to
+ * allow re-using the jdk5 ManagementFactory.getPlatformMBeanServer()
+ * as our main MBeanServer. The DefaultDomain name of this server cannot
+ * be set, and it seems to be "null" by default (probably a bug).
+ *
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a> 
+ * @version $Revision: 57200 $
+ */
+public class MBeanServerLocator
+{
+   /** The MBeanServer to return, if set */
+   private static MBeanServer instance = null;
+   
+   /**
+    * Private CTOR to disable instantiation
+    */
+   private MBeanServerLocator()
+   {
+      // empty
+   }   
+
+   /**
+    * Optionally set the MBeanServer to be returned
+    * by calls to locateJBoss(). Setting this back
+    * to null reverts to the normal lookup strategy.
+    * 
+    * @param server the main jboss MBeanServer or null
+    */
+   public static void setJBoss(MBeanServer server)
+   {
+      synchronized (MBeanServerLocator.class)
+      {
+         instance = server;
+      }
+   }
+   
+   /**
+    * Returns the first MBeanServer registered under the agentID
+    * 
+    * @param agentID the id of the MBeanServer to look for
+    * @return the first MBeanServer with an agentID
+    */
+   public static MBeanServer locate(final String agentID)
+   {
+      MBeanServer server = (MBeanServer)
+         MBeanServerFactory.findMBeanServer(agentID).iterator().next();
+
+      return server;
+   }
+
+   /**
+    * Returns the first available MBeanServer
+    * 
+    * @return the first available MBeanServer
+    */
+   public static MBeanServer locate()
+   {
+      return locate(null);
+   }
+
+   /**
+    * Returns the main jboss MBeanServer.
+    * 
+    * If there is one set using setJBoss(), it will be returned.
+    * Otherwise the strategy is to return the first MBeanServer
+    * registered under the "jboss" id (or else, default domain name)
+    * 
+    * @return the main jboss MBeanServer
+    * @throws IllegalStateException when no MBeanServer can be found
+    */
+   public static MBeanServer locateJBoss()
+   {
+      synchronized (MBeanServerLocator.class)
+      {
+         if (instance != null)
+         {
+            return instance;
+         }
+      }      
+      for (Iterator i = MBeanServerFactory.findMBeanServer(null).iterator(); i.hasNext(); )
+      {
+         MBeanServer server = (MBeanServer) i.next();
+         if (server.getDefaultDomain().equals("jboss"))
+         {
+            return server;
+         }
+      }
+      throw new IllegalStateException("No 'jboss' MBeanServer found!");
+   }   
+}




More information about the jboss-cvs-commits mailing list