[Jboss-cvs] JBossAS SVN: r56175 - in branches/Branch_3_2: hibernate-int server/src/main/org/jboss/naming server/src/main/org/jboss/web system/src/main/org/jboss/deployment
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 23 07:51:50 EDT 2006
Author: darran.lofthouse at jboss.com
Date: 2006-08-23 07:51:45 -0400 (Wed, 23 Aug 2006)
New Revision: 56175
Modified:
branches/Branch_3_2/hibernate-int/.project
branches/Branch_3_2/server/src/main/org/jboss/naming/JNDIView.java
branches/Branch_3_2/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java
branches/Branch_3_2/system/src/main/org/jboss/deployment/DeploymentInfo.java
Log:
JBAS-3547 - List the ENC for all deployed web applications. Also merged a couple of depedent changes from Branch_4_0.
Modified: branches/Branch_3_2/hibernate-int/.project
===================================================================
--- branches/Branch_3_2/hibernate-int/.project 2006-08-23 11:25:29 UTC (rev 56174)
+++ branches/Branch_3_2/hibernate-int/.project 2006-08-23 11:51:45 UTC (rev 56175)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>hibernate</name>
+ <name>hibernate-int</name>
<comment></comment>
<projects>
</projects>
Modified: branches/Branch_3_2/server/src/main/org/jboss/naming/JNDIView.java
===================================================================
--- branches/Branch_3_2/server/src/main/org/jboss/naming/JNDIView.java 2006-08-23 11:25:29 UTC (rev 56174)
+++ branches/Branch_3_2/server/src/main/org/jboss/naming/JNDIView.java 2006-08-23 11:51:45 UTC (rev 56175)
@@ -40,6 +40,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
@@ -74,14 +76,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);
@@ -196,6 +239,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
*/
@@ -205,15 +286,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();)
{
@@ -609,6 +688,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");
Modified: branches/Branch_3_2/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java
===================================================================
--- branches/Branch_3_2/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java 2006-08-23 11:25:29 UTC (rev 56174)
+++ branches/Branch_3_2/server/src/main/org/jboss/web/AbstractWebDeployerMBean.java 2006-08-23 11:51:45 UTC (rev 56175)
@@ -33,6 +33,10 @@
*/
public interface AbstractWebDeployerMBean extends org.jboss.deployment.SubDeployerMBean {
+ // default object name
+ public static final javax.management.ObjectName OBJECT_NAME = org.jboss.mx.util.ObjectNameFactory
+ .create("jboss.web:service=WebServer");
+
/**
* Get the flag indicating if the normal Java2 parent first class loading model should be used over the servlet 2.3 web container first model.
* @return true for parent first, false for the servlet 2.3 model
Modified: branches/Branch_3_2/system/src/main/org/jboss/deployment/DeploymentInfo.java
===================================================================
--- branches/Branch_3_2/system/src/main/org/jboss/deployment/DeploymentInfo.java 2006-08-23 11:25:29 UTC (rev 56174)
+++ branches/Branch_3_2/system/src/main/org/jboss/deployment/DeploymentInfo.java 2006-08-23 11:51:45 UTC (rev 56175)
@@ -410,6 +410,15 @@
// deployer = null;
}
+ /** The sortName concatenated with the canonical names of all parents. */
+ public String getCanonicalName()
+ {
+ String name = shortName;
+ if (parent != null)
+ name = parent.getCanonicalName() + "/" + name;
+ return name;
+ }
+
public int hashCode()
{
return url.hashCode();
More information about the jboss-cvs-commits
mailing list