User: d_jencks
  Date: 02/02/22 14:54:25

  Modified:    src/main/org/jboss/naming JNDIView.java
  Log:
  made jndi view and bean cache monitor work again.  Added listSnapshots method to 
bean cache monitor so you can actually see the results via jmx
  
  Revision  Changes    Path
  1.17      +47 -40    jboss/src/main/org/jboss/naming/JNDIView.java
  
  Index: JNDIView.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/naming/JNDIView.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JNDIView.java     22 Feb 2002 07:02:53 -0000      1.16
  +++ JNDIView.java     22 Feb 2002 22:54:25 -0000      1.17
  @@ -38,7 +38,8 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Stark</a>.
    * @author Vladimir Blagojevic <[EMAIL PROTECTED]>
  - * @version $Revision: 1.16 $
  + * @author <a href="mailto:[EMAIL PROTECTED]";>David Jencks</a>
  + * @version $Revision: 1.17 $
    */
   public class JNDIView 
      extends ServiceMBeanSupport 
  @@ -69,8 +70,7 @@
         */
         try
         {
  -         ejbModules = server.queryNames(
  -            ObjectNameFactory.create("jboss.j2ee:service=EjbModule,*"), null);
  +         ejbModules = server.queryNames(EjbModule.EJB_MODULE_QUERY_NAME, null);
         }
         catch(Throwable e)
         {
  @@ -172,7 +172,7 @@
       **/
      public String listXML() {
         StringBuffer buffer = new StringBuffer();
  -      Iterator ejbModules = null;
  +      Set ejbModules = null;
         Context context = null;
         ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
   
  @@ -181,11 +181,7 @@
         */
         try
         {
  -         ejbModules = (Iterator) server.invoke(
  -            EJBDeployerMBean.OBJECT_NAME,
  -            "getDeployedApplications",
  -            new Object[] { },
  -            new String[] { });
  +         ejbModules = server.queryNames(EjbModule.EJB_MODULE_QUERY_NAME, null);
         }
         catch(Exception e)
         {
  @@ -205,47 +201,58 @@
         buffer.append( "<jndi>" );
         buffer.append( '\n' );
         // List each application JNDI namespace
  -      while(ejbModules.hasNext())
  +      for (Iterator i = ejbModules.iterator(); i.hasNext(); )
         {
  -         EjbModule app = (EjbModule) ejbModules.next();
  -         Iterator iter = app.getContainers().iterator();
  +         ObjectName app = (ObjectName) i.next();
            buffer.append( "<ejbmodule>" );
            buffer.append( '\n' );
  -         buffer.append( "<file>" + app.getName() + "</file>" );
  +         buffer.append( "<file>" + app.getKeyProperty("url") + "</file>" );
            buffer.append( '\n' );
  -         while(iter.hasNext())
  +         try 
            {
  -            Container con = (Container)iter.next();
  -            /* Set the thread class loader to that of the container as
  -               the class loader is used by the java: context object
  -               factory to partition the container namespaces.
  -            */
  -            Thread.currentThread().setContextClassLoader(con.getClassLoader());
  -            String bean = con.getBeanMetaData().getEjbName();
  -            buffer.append( "<context>" );
  -            buffer.append( '\n' );
  -            buffer.append( "<name>java:comp</name>" );
  -            buffer.append( '\n' );
  -            buffer.append( "<attribute name=\"bean\">" + bean + "</attribute>" );
  -            buffer.append( '\n' );
  -            try
  -            {
  -               context = new InitialContext();
  -               context = (Context)context.lookup("java:comp");
  -            }
  -            catch(NamingException e)
  +            Collection containers = (Collection)server.getAttribute(app, 
"Containers");
  +            for (Iterator iter = containers.iterator(); iter.hasNext();)
               {
  -               buffer.append( "<error>" );
  +               Container con = (Container)iter.next();
  +               /* Set the thread class loader to that of the container as
  +                  the class loader is used by the java: context object
  +                  factory to partition the container namespaces.
  +               */
  +               Thread.currentThread().setContextClassLoader(con.getClassLoader());
  +               String bean = con.getBeanMetaData().getEjbName();
  +               buffer.append( "<context>" );
                  buffer.append( '\n' );
  -               buffer.append( "<message>" + "Failed on lookup, " + e.toString( true 
) + "</message>" );
  +               buffer.append( "<name>java:comp</name>" );
                  buffer.append( '\n' );
  -               buffer.append( "</error>" );
  +               buffer.append( "<attribute name=\"bean\">" + bean + "</attribute>" );
  +               buffer.append( '\n' );
  +               try
  +               {
  +                  context = new InitialContext();
  +                  context = (Context)context.lookup("java:comp");
  +               }
  +               catch(NamingException e)
  +               {
  +                  buffer.append( "<error>" );
  +                  buffer.append( '\n' );
  +                  buffer.append( "<message>" + "Failed on lookup, " + e.toString( 
true ) + "</message>" );
  +                  buffer.append( '\n' );
  +                  buffer.append( "</error>" );
  +                  buffer.append( '\n' );
  +                  continue;
  +               }
  +               listXML( context, buffer );
  +               buffer.append( "</context>" );
                  buffer.append( '\n' );
  -               continue;
               }
  -            listXML( context, buffer );
  -            buffer.append( "</context>" );
  -            buffer.append( '\n' );
  +         }
  +         catch(Throwable e)
  +         {
  +            log.error("getConainers failed", e);
  +            buffer.append("<pre>");
  +            buffer.append("Failed to get ejbs in module\n");
  +            formatException(buffer, e);
  +            buffer.append("</pre>");
            }
            buffer.append( "</ejbmodule>" );
            buffer.append( '\n' );
  
  
  

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

Reply via email to