I don't know if this helps but this is a function I use to load the user
database. After that, I use the different methods implemented in the
org.apache.catalina.UserDatabase class. I found the functions and the parameters
needed by searching the source for the function I wanted. I use this to
dynamically add and search for users. I can also add roles and add roles to
users.


private void loadUserDatabase()
{
  if(MBeanServerFactory.findMBeanServer(null).size() > 0)
  {
    m_BeanServer = (MBeanServer) BeanServerFactory.findMBeanServer(null).get(0);
  }
  else
  {
    m_BeanServer = MBeanServerFactory.createMBeanServer();
  }

  try
  {
    ObjectName obname = new ObjectName( userDB );
    MBeanInfo info = m_BeanServer.getMBeanInfo( obname );
    MBeanOperationInfo opInfo[] = info.getOperations();
    MBeanAttributeInfo atribInfo[] = info.getAttributes();
    for( int i = 0; i < opInfo.length; i++ )
    {
      log( "loadUserDatabase", "Operation: " + opInfo[i].getName() + " is
defined" );
    }

    for( int i = 0; i < atribInfo.length; i++ )
    {
      log( "loadUserDatabase", "Attribute: " + atribInfo[i].getName() + " = " +
m_BeanServer.getAttribute( obname, atribInfo[i].getName() ) );
    }
  }
  catch( Exception e )
  {
    e.printStackTrace();
  }
}

Robert S. Harper
801.265.8800 ex. 255
> -----Original Message-----
> From: Honnavalli, Jyothi [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 28, 2004 3:30 PM
> To: 'Tomcat Users List'
> Subject: How to get a handle to tomcat Mbean Server?
> 
> Hi All,
> 
> I was just learning 'bt Mbeans. To begin with, I was learning to use and
> test the Mbeans that are already existing in tomcat so I get to know how
> Mbeans work.  I have written my own Agent called UserManager to call the
[snip]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to