User: schaefera
Date: 01/05/21 22:08:00
Modified: src/main/org/jboss/ejb ContainerFactory.java
ContainerFactoryMBean.java
Log:
Modified the EJB deployment therefore that it can report the deployed
EJBs for a given application to the Data Collector.
Revision Changes Path
1.68 +66 -12 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.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- ContainerFactory.java 2001/02/27 16:48:08 1.67
+++ ContainerFactory.java 2001/05/22 05:08:00 1.68
@@ -65,6 +65,9 @@
import org.jboss.metadata.XmlFileLoader;
import org.jboss.logging.Logger;
+import org.jboss.mgt.EJB;
+import org.jboss.mgt.Module;
+
/**
* A ContainerFactory is used to deploy EJB applications. It can be given a URL to
* an EJB-jar or EJB-JAR XML file, which will be used to instantiate containers and
make
@@ -79,7 +82,7 @@
* @author Peter Antman ([EMAIL PROTECTED])
* @author Scott Stark([EMAIL PROTECTED])
*
-* @version $Revision: 1.67 $
+* @version $Revision: 1.68 $
*/
public class ContainerFactory
extends org.jboss.util.ServiceMBeanSupport
@@ -254,16 +257,16 @@
* @exception MalformedURLException
* @exception DeploymentException
*/
- public void deploy( String url )
+ public void deploy( String url, String appId )
throws MalformedURLException, DeploymentException
{
// Delegate to "real" deployment
- deploy( new URL( url ) );
+ deploy( new URL( url ), appId );
}
//
// Richard Gyger
//
- public void deploy( String appUrl, String[] jarUrls )
+ public void deploy( String appUrl, String[] jarUrls, String appId )
throws MalformedURLException, DeploymentException
{
// Delegate to "real" deployment
@@ -272,7 +275,7 @@
for( int i = 0; i < tmp.length; i++ )
tmp[ i ] = new URL( jarUrls[ i ] );
- deploy( new URL( appUrl ), tmp );
+ deploy( new URL( appUrl ), tmp, appId );
}
/**
@@ -301,15 +304,15 @@
*
* @exception DeploymentException
*/
- public synchronized void deploy( URL url )
+ public synchronized void deploy( URL url, String appId )
throws DeploymentException
{
- deploy( url, new URL[]{ url } );
+ deploy( url, new URL[]{ url }, appId );
}
//
// Richard Gyger
//
- public synchronized void deploy( URL appUrl, URL[] jarUrls )
+ public synchronized void deploy( URL appUrl, URL[] jarUrls, String appId )
throws DeploymentException
{
// Create application
@@ -329,9 +332,11 @@
// create the _real_ classloader for this app
ClassLoader cl = new URLClassLoader( jarUrls,
Thread.currentThread().getContextClassLoader() );
app.setClassLoader( cl );
+ // Create data container for deployed EJBs management data
+ Module module = new Module( "EJB", "??" );
for( int i = 0; i < jarUrls.length; i++ )
- deploy( app, jarUrls[ i ], cl );
+ deploy( app, jarUrls[ i ], cl, module );
// Init application
app.init();
@@ -346,6 +351,22 @@
log.log( "Deployed application: " + app.getName() );
// Register deployment. Use the application name in the hashtable
deployments.put( appUrl, app );
+ // Save EJBs management data: application
+ log.log( "Add module: " + module + ", to app: " + appId );
+ getServer().invoke(
+ new ObjectName( "Management", "service", "Collector" ),
+ "saveModule",
+ new Object[] {
+ appId,
+ new Integer( org.jboss.mgt.Application.EJBS ),
+ module
+ },
+ new String[] {
+ String.class.getName(),
+ Integer.TYPE.getName(),
+ module.getClass().getName()
+ }
+ );
}
catch( Exception e )
{
@@ -370,7 +391,7 @@
}
}
- private void deploy( Application app, URL url, ClassLoader cl )
+ private void deploy( Application app, URL url, ClassLoader cl, Module module )
throws NamingException, Exception
{
// Create a file loader with which to load the files
@@ -435,7 +456,10 @@
BeanMetaData bean = (BeanMetaData) beans.next();
log.log( "Deploying " + bean.getEjbName() );
- app.addContainer( createContainer( bean, cl, localCl ) );
+ EJB ejb = new EJB();
+ module.addItem( ejb );
+ ejb.setName( bean.getEjbName() );
+ app.addContainer( createContainer( bean, cl, localCl, ejb ) );
}
}
@@ -463,6 +487,25 @@
log.log( "Undeploying:" + url );
app.stop();
app.destroy();
+ try
+ {
+ // Remove EJBs management data
+ getServer().invoke(
+ new ObjectName( "Management", "service", "Collector" ),
+ "removeModule",
+ new Object[] {
+ url.toString(),
+ new Integer( org.jboss.mgt.Application.EJBS )
+ },
+ new String[] {
+ "".getClass().getName(),
+ Integer.TYPE.getName()
+ }
+ );
+ }
+ catch( Exception e ) {
+ log.exception( e );
+ }
try {
if ( app.getClassLoader() != null ) {
// Remove from webserver
@@ -508,27 +551,38 @@
// Container Creation
// ******************
- private Container createContainer( BeanMetaData bean, ClassLoader cl, ClassLoader
localCl )
+ private Container createContainer( BeanMetaData bean, ClassLoader cl, ClassLoader
localCl, EJB ejb )
throws Exception
{
// Added message driven deployment
if( bean.isMessageDriven() )
{
+ ejb.setType( EJB.MESSAGE );
return createMessageDrivenContainer( bean, cl, localCl );
}
else if( bean.isSession() ) // Is session?
{
if( ( (SessionMetaData) bean ).isStateless() ) // Is stateless?
{
+ ejb.setType( EJB.STATELESS_SESSION );
return createStatelessSessionContainer( bean, cl, localCl );
}
else // Stateful
{
+ ejb.setType( EJB.STATEFUL_SESSION );
return createStatefulSessionContainer( bean, cl, localCl );
}
}
else // Entity
{
+ if( ( (EntityMetaData) bean ).isBMP() )
+ {
+ ejb.setType( EJB.ENTITY_BMP );
+ }
+ else
+ {
+ ejb.setType( EJB.ENTITY_CMP );
+ }
return createEntityContainer( bean, cl, localCl );
}
}
1.11 +16 -4 jboss/src/main/org/jboss/ejb/ContainerFactoryMBean.java
Index: ContainerFactoryMBean.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/ContainerFactoryMBean.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ContainerFactoryMBean.java 2001/02/21 06:20:10 1.10
+++ ContainerFactoryMBean.java 2001/05/22 05:08:00 1.11
@@ -15,7 +15,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author Juha Lindfors ([EMAIL PROTECTED])
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public interface ContainerFactoryMBean
extends org.jboss.util.ServiceMBean
@@ -32,14 +32,26 @@
/**
* Deploy an application
*
- * @param url
+ * @param url URL to the directory with the given EJBs to be deployed
+ * @param appId Id of the application this EJBs belongs to
+ * used for management
* @exception MalformedURLException
* @exception DeploymentException
*/
- public void deploy(String url)
+ public void deploy(String url, String appId )
throws MalformedURLException, DeploymentException;
- public void deploy( String appUurl, String[] jarUrls )
+ /**
+ * Deploy an application
+ *
+ * @param appUrl Url to the application itself
+ * @param jarUrls Array of URLs to the JAR files containing the EJBs
+ * @param appId Id of the application this EJBs belongs to
+ * used for management
+ * @exception MalformedURLException
+ * @exception DeploymentException
+ */
+ public void deploy( String appUurl, String[] jarUrls, String appId )
throws MalformedURLException, DeploymentException;
/**
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development