User: schaefera
Date: 01/11/26 22:15:26
Modified: src/main/org/jboss/ejb Application.java Container.java
ContainerFactory.java
Log:
Add next layer of JSR-77. This time the EJBs are added. To check it out
open the HTML-Adaptor, look under domain: SingleJBoss and let the
testsuite run (refresh from time to time).
Revision Changes Path
1.23 +20 -5 jboss/src/main/org/jboss/ejb/Application.java
Index: Application.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Application.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Application.java 2001/11/26 21:46:51 1.22
+++ Application.java 2001/11/27 06:15:26 1.23
@@ -14,8 +14,10 @@
import java.util.Hashtable;
import javax.ejb.EJBLocalHome;
+import javax.management.ObjectName;
import org.jboss.system.Service;
+import org.jboss.management.j2ee.EJB;
/**
* An Application represents a collection of beans that are deployed as a
@@ -28,7 +30,7 @@
* @see ContainerFactory
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
- * @version $Revision: 1.22 $
+ * @version $Revision: 1.23 $
*/
public class Application
implements Service
@@ -209,12 +211,21 @@
for (Iterator i = containers.values().iterator(); i.hasNext();)
{
Container con = (Container)i.next();
- con.init();
+ con.init();
}
for (Iterator i = containers.values().iterator(); i.hasNext();)
{
Container con = (Container)i.next();
- con.start();
+ con.start();
+ // Create JSR-77 EJB-Wrapper
+ ObjectName lEJB = EJB.create(
+ con.mbeanServer,
+ getModuleName(),
+ con.getBeanMetaData()
+ );
+ if( lEJB != null ) {
+ con.mEJBObjectName = lEJB.toString();
+ }
}
}
@@ -226,12 +237,16 @@
for (Iterator i = containers.values().iterator(); i.hasNext();)
{
Container con = (Container)i.next();
- con.stop();
+ con.stop();
}
for (Iterator i = containers.values().iterator(); i.hasNext();)
{
Container con = (Container)i.next();
- con.destroy();
+ // Remove JSR-77 EJB-Wrapper
+ if( con.mEJBObjectName != null ) {
+ EJB.destroy( con.mbeanServer, con.mEJBObjectName );
+ }
+ con.destroy();
}
}
1.62 +6 -2 jboss/src/main/org/jboss/ejb/Container.java
Index: Container.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Container.java,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- Container.java 2001/11/26 03:12:24 1.61
+++ Container.java 2001/11/27 06:15:26 1.62
@@ -73,7 +73,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>.
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.61 $
+ * @version $Revision: 1.62 $
*
* <p><b>Revisions:</b>
*
@@ -149,10 +149,14 @@
/** ??? */
protected Class localInterface;
-
+
+ /** ObjectName of the JSR-77 EJB representation **/
+ protected String mEJBObjectName;
+
// We need the visibility on the MBeanServer for prototyping, it will be removed
in the future FIXME marcf
//protected MBeanServer mbeanServer;
public MBeanServer mbeanServer;
+
// Public --------------------------------------------------------
1.100 +1 -63 jboss/src/main/org/jboss/ejb/ContainerFactory.java
Index: ContainerFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- ContainerFactory.java 2001/11/26 21:46:51 1.99
+++ ContainerFactory.java 2001/11/27 06:15:26 1.100
@@ -70,7 +70,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Antman</a>.
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
-* @version $Revision: 1.99 $
+* @version $Revision: 1.100 $
*/
public class ContainerFactory
extends ServiceMBeanSupport
@@ -371,11 +371,6 @@
//app.init();
// Start application
app.start();
- // Startup the Management MBean Wrapper for the containers
- Iterator i = app.containers.values().iterator();
- while( i.hasNext() ) {
- handleContainerManagement( (Container) i.next(), true );
- }
// Done
log.info( "Deployed application: " + app.getName() );
@@ -486,11 +481,6 @@
// Undeploy application
log.info( "Undeploying:" + url );
- // Shutdown the Management MBean Wrapper for the containers
- Iterator i = app.containers.values().iterator();
- while( i.hasNext() ) {
- handleContainerManagement( (Container) i.next(), false );
- }
app.stop();
//app.destroy();
try {
@@ -676,58 +666,6 @@
// **************
// Helper Methods
// **************
-
- /**
- * Either creates the Management MBean wrapper for a container and start
- * it or it destroy it.
- **/
- private void handleContainerManagement( Container container, boolean doStart )
- {
- try
- {
- // Create and register the ContainerMBean
- ObjectName name = new ObjectName( "Management", "jndiName",
container.getBeanMetaData().getJndiName() );
- if( doStart )
- {
- getServer().createMBean(
- "org.jboss.management.ContainerManagement",
- name,
- new Object[] { container },
- new String[] { "org.jboss.ejb.Container" }
- );
- //getServer().invoke( name, "init", new Object[] {}, new String[] {} );
- //getServer().invoke( name, "start", new Object[] {}, new String[] {} );
- getServer().invoke(getServiceControllerName(),
- "registerAndStartService",
- new Object[] {name, null},
- new String[] {"javax.management.ObjectName",
"java.lang.String"});
- }
- else
- {
- getServer().invoke(getServiceControllerName(),
- "undeploy",
- new Object[] {name},
- new String[] {"javax.management.ObjectName"});
- // If not startup then assume that the MBean is there
- //getServer().invoke( name, "stop", new Object[] {}, new String[] {} );
- //getServer().invoke( name, "destroy", new Object[] {}, new String[] {}
);
- // Unregister the MBean to avoid future name conflicts
- //getServer().unregisterMBean( name );
- }
- }
- catch( Exception e )
- {
- if( e instanceof RuntimeMBeanException )
- {
- e = ((RuntimeMBeanException) e).getTargetException();
- }
- if( e instanceof MBeanException )
- {
- e = ((MBeanException) e).getTargetException();
- }
- log.error("handleContainerManagement", e);
- }
- }
/**
* Perform the common steps to initializing a container.
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development