package org.jboss.ejb; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Method; import javax.management.MBeanServer; import javax.management.ObjectName; import javax.management.RuntimeOperationsException; import org.jboss.system.ServiceMBeanSupport; /** The ContainerRelectionMBean implementation. * @author Scott.Stark@jboss.org * @version $Revision: 1.3 $ * *
Revisions: *
2001030 Marc Fleury: *
");
ObjectName containerName = new ObjectName(":service=Container,jndiName="+jndiName);
Class homeClass = (Class) server.invoke(containerName, "getHome", null, null);
buffer.append("\nHome class = "+homeClass);
buffer.append("\nClassLoader: "+homeClass.getClassLoader());
buffer.append("\nCodeSource: "+homeClass.getProtectionDomain().getCodeSource());
buffer.append("\n- Methods:");
Method[] homeMethods = homeClass.getMethods();
for(int m = 0; m < homeMethods.length; m ++)
buffer.append("\n--- "+homeMethods[m]);
Class remoteClass = (Class) server.invoke(containerName, "getRemote", null, null);
buffer.append("\nRemote class = "+remoteClass);
buffer.append("\n- Methods:");
Method[] remoteMethods = remoteClass.getMethods();
for(int m = 0; m < remoteMethods.length; m ++)
buffer.append("\n--- "+remoteMethods[m]);
buffer.append("\n\n");
}
catch(Throwable e)
{
if( e instanceof RuntimeOperationsException )
{
RuntimeOperationsException roe = (RuntimeOperationsException) e;
e = roe.getTargetException();
}
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
buffer.append(sw.toString());
buffer.append("\n\n");
}
return buffer.toString();
}
public String getName()
{
return "ContainerRelection";
}
}