tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Harper" <rob...@iat-cti.com>
Subject RE: How to get a handle to tomcat Mbean Server?
Date Tue, 28 Sep 2004 22:06:24 GMT
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:jyothi_honnavalli@merck.com]
> 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message