[Jboss-cvs] JBossAS SVN: r56174 - branches/Branch_4_0/server/src/main/org/jboss/naming
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 23 07:25:31 EDT 2006
Author: darran.lofthouse at jboss.com
Date: 2006-08-23 07:25:29 -0400 (Wed, 23 Aug 2006)
New Revision: 56174
Modified:
branches/Branch_4_0/server/src/main/org/jboss/naming/JNDIView.java
Log:
JBAS-3547 - Display the ENC for all web application. If this is not possible log the error to debug and continue.
Modified: branches/Branch_4_0/server/src/main/org/jboss/naming/JNDIView.java
===================================================================
--- branches/Branch_4_0/server/src/main/org/jboss/naming/JNDIView.java 2006-08-23 10:13:25 UTC (rev 56173)
+++ branches/Branch_4_0/server/src/main/org/jboss/naming/JNDIView.java 2006-08-23 11:25:29 UTC (rev 56174)
@@ -43,6 +43,8 @@
import org.jboss.ejb.Container;
import org.jboss.ejb.EjbModule;
import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.web.AbstractWebDeployerMBean;
+import org.jboss.web.WebApplication;
/**
* A simple utlity mbean that allows one to recursively list the default
@@ -83,14 +85,55 @@
*/
public String list(boolean verbose)
{
- StringBuffer buffer = new StringBuffer(4096);
- Set ejbModules = null;
+ StringBuffer buffer = new StringBuffer(4096);
Context context = null;
ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ // Get all deployed web applications so that we can list their
+ // java: namespaces which are ClassLoader local
+ Iterator it = (Iterator) server.getAttribute(AbstractWebDeployerMBean.OBJECT_NAME, "DeployedApplications");
+
+ if (it.hasNext() == true)
+ {
+ buffer.append("<h1>Web Applications</h1>\n");
+ }
+
+ while (it.hasNext() == true)
+ {
+ WebApplication webApplication = (WebApplication) it.next();
+
+ Thread.currentThread().setContextClassLoader(webApplication.getClassLoader());
+
+ buffer.append("<h2>java:comp namespace of the " + webApplication.getDeploymentInfo().getCanonicalName()
+ + " application:</h2>\n");
+
+ try
+ {
+ context = new InitialContext();
+ context = (Context) context.lookup("java:comp");
+ }
+ catch (NamingException e)
+ {
+ buffer.append("Failed on lookup, " + e.toString(true));
+ formatException(buffer, e);
+ continue;
+ }
+ buffer.append("<pre>\n");
+ list(context, " ", buffer, verbose);
+ buffer.append("</pre>\n");
+ }
+
+ }
+ catch (Throwable e)
+ {
+ log.debug("Unable to list web applications ENC", e);
+ }
+
// Get all deployed applications so that we can list their
// java: namespaces which are ClassLoader local
-
+ Set ejbModules = null;
try
{
ejbModules = server.queryNames(EjbModule.EJB_MODULE_QUERY_NAME, null);
@@ -227,6 +270,44 @@
Context context = null;
ClassLoader currentLoader = Thread.currentThread().getContextClassLoader();
+ openJndiTag(buffer);
+ try
+ {
+ // Get all deployed web applications so that we can list their
+ // java: namespaces which are ClassLoader local
+ Iterator it = (Iterator) server.getAttribute(AbstractWebDeployerMBean.OBJECT_NAME, "DeployedApplications");
+
+ while ( it.hasNext()==true )
+ {
+ WebApplication webApplication = (WebApplication) it.next();
+ openWebModuleTag(buffer, webApplication.getDeploymentInfo().getCanonicalName());
+
+ Thread.currentThread().setContextClassLoader(webApplication.getClassLoader());
+
+ try
+ {
+ context = new InitialContext();
+ context = (Context) context.lookup("java:comp");
+
+ listXML(context, buffer);
+ }
+ catch (NamingException e)
+ {
+ buffer.append("Failed on lookup, " + e.toString(true));
+ formatException(buffer, e);
+ continue;
+ }
+ finally
+ {
+ closeWebModuleTag(buffer);
+ }
+ }
+ }
+ catch (Throwable e)
+ {
+ log.debug("Unable to list web applications ENC", e);
+ }
+
/* Get all deployed applications so that we can list their
java: namespaces which are ClassLoader local
*/
@@ -236,15 +317,13 @@
}
catch (Exception e)
{
- log.error("getDeployedApplications failed", e);
- openJndiTag(buffer);
+ log.error("getDeployedApplications failed", e);
appendErrorTag(buffer,
"Failed to getDeployedApplications " + e.toString());
closeJndiTag(buffer);
return buffer.toString();
}
- openJndiTag(buffer);
// List each application JNDI namespace
for (Iterator i = ejbModules.iterator(); i.hasNext();)
{
@@ -686,6 +765,17 @@
buffer.append("</jndi>\n");
}
+ private void openWebModuleTag(StringBuffer buffer, String file)
+ {
+ buffer.append("<webmodule>\n");
+ buffer.append("<file>").append(file).append("</file>\n");
+ }
+
+ private void closeWebModuleTag(StringBuffer buffer)
+ {
+ buffer.append("</webmodule>\n");
+ }
+
private void openEjbModuleTag(StringBuffer buffer, String file)
{
buffer.append("<ejbmodule>\n");
More information about the jboss-cvs-commits
mailing list