User: user57  
  Date: 02/02/15 23:47:50

  Modified:    src/main/org/jboss/security/plugins
                        JaasSecurityManagerService.java
  Log:
   o log some startup details as debug instead of info
   o using features of ServiceMBeanSupport
  
  Revision  Changes    Path
  1.12      +32 -28    
jbosssx/src/main/org/jboss/security/plugins/JaasSecurityManagerService.java
  
  Index: JaasSecurityManagerService.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosssx/src/main/org/jboss/security/plugins/JaasSecurityManagerService.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JaasSecurityManagerService.java   8 Feb 2002 23:56:19 -0000       1.11
  +++ JaasSecurityManagerService.java   16 Feb 2002 07:47:50 -0000      1.12
  @@ -47,17 +47,19 @@
   import org.jboss.util.TimedCachePolicy;
   
   /**
  - *   This is a JMX service which manages JAAS based SecurityManagers.
  - *    JAAS SecurityManagers are responsible for validating credentials
  - *    associated with principals. The service defaults to the
  - *    org.jboss.security.plugins.JaasSecurityManager implementation but
  - *    this can be changed via the securityManagerClass property.
  + * This is a JMX service which manages JAAS based SecurityManagers.
  + * JAAS SecurityManagers are responsible for validating credentials
  + * associated with principals. The service defaults to the
  + * org.jboss.security.plugins.JaasSecurityManager implementation but
  + * this can be changed via the securityManagerClass property.
    *
  - *   @see JaasSecurityManager
  - *   @see SubjectSecurityManager
  - *   @author <a href="[EMAIL PROTECTED]">Oleg Nitz</a>
  - *   @author <a href="[EMAIL PROTECTED]">Rickard Oberg</a>
  - *   @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
  + * @see JaasSecurityManager
  + * @see SubjectSecurityManager
  + * 
  + * @author <a href="[EMAIL PROTECTED]">Oleg Nitz</a>
  + * @author <a href="[EMAIL PROTECTED]">Rickard Oberg</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>
  + * @version $Revision: 1.12 $
    */
   public class JaasSecurityManagerService
      extends ServiceMBeanSupport
  @@ -92,7 +94,9 @@
      {
         // use thread-local principal and credential propagation
         SecurityAssociation.setServer();
  -      // Get a log interface
  +
  +      // Get a log interface, required for some statics below
  +      // can not use instance field inherited from ServiceMBeanSupport
         log = Logger.getLogger(JaasSecurityManagerService.class);
   
      }
  @@ -189,22 +193,16 @@
         }
      }
   
  -   public String getName()
  -   {
  -      return "JAAS Security Manager";
  -   }
  -
      protected ObjectName getObjectName(MBeanServer server, ObjectName name)
         throws MalformedObjectNameException
      {
         JaasSecurityManagerService.server = server;
  -      return super.getObjectName(server, name);
  +      return name == null ? OBJECT_NAME : name;
      }
   
      protected void startService() throws Exception
  -   {     
  -      InitialContext ic = new InitialContext();
  -
  +   {
  +      boolean debug = log.isDebugEnabled();
         Context ctx = new InitialContext();
         parser = ctx.getNameParser("");
   
  @@ -216,35 +214,41 @@
         String factoryName = SecurityDomainObjectFactory.class.getName();
         Reference ref = new Reference("javax.naming.Context", refAddr, factoryName, 
null);
         ctx.rebind(SECURITY_MGR_PATH, ref);
  -      log.info("startService, securityMgrCtxPath="+SECURITY_MGR_PATH);
  +      if (debug) {
  +         log.debug("securityMgrCtxPath="+SECURITY_MGR_PATH);
  +      }
   
         refAddr = new StringRefAddr("nns", "JSMCachePolicy");
         factoryName = DefaultCacheObjectFactory.class.getName();
         ref = new Reference("javax.naming.Context", refAddr, factoryName, null);
         ctx.rebind(DEFAULT_CACHE_POLICY_PATH, ref);
  -      log.info("startService, cachePolicyCtxPath="+cacheJndiName);
  +      if (debug) {
  +         log.debug("cachePolicyCtxPath="+cacheJndiName);
  +      }
   
         // Bind the default SecurityProxyFactory instance under 
java:/SecurityProxyFactory
         SecurityProxyFactory proxyFactory = (SecurityProxyFactory) 
securityProxyFactoryClass.newInstance();
         ctx.bind("java:/SecurityProxyFactory", proxyFactory);
  -      log.info("startService, SecurityProxyFactory="+proxyFactory);
  +      if (debug) {
  +         log.debug("SecurityProxyFactory="+proxyFactory);
  +      }
      }
   
  -   protected void stopService()
  +   protected void stopService() throws Exception
      {
  -      InitialContext ic;
  +      InitialContext ic = new InitialContext();
  +      
         try
         {
  -         ic = new InitialContext();
            ic.unbind(SECURITY_MGR_PATH);
         }
         catch(CommunicationException e)
         {
            // Do nothing, the naming services is already stopped
         }
  -      catch(Exception e)
  +      finally
         {
  -         log.error("stopService", e);
  +         ic.close();
         }
      }
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to