dain        2004/12/01 01:59:10

  Modified:    modules/openejb-builder/src/java/org/openejb/deployment
                        MDBContainerBuilder.java MdbBuilder.java
  Log:

  Converted to use GBeanData instead of GBeanMBean
  
  Revision  Changes    Path
  1.2       +5 -5      
openejb/modules/openejb-builder/src/java/org/openejb/deployment/MDBContainerBuilder.java
  
  Index: MDBContainerBuilder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/java/org/openejb/deployment/MDBContainerBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MDBContainerBuilder.java  10 Nov 2004 01:35:08 -0000      1.1
  +++ MDBContainerBuilder.java  1 Dec 2004 06:59:10 -0000       1.2
  @@ -57,7 +57,7 @@
   import javax.management.ObjectName;
   import javax.security.auth.Subject;
   
  -import org.apache.geronimo.gbean.jmx.GBeanMBean;
  +import org.apache.geronimo.gbean.GBeanData;
   import org.apache.geronimo.naming.deployment.ResourceEnvironmentBuilder;
   import org.apache.geronimo.naming.java.ReadOnlyContext;
   import org.apache.geronimo.transaction.UserTransactionImpl;
  @@ -258,7 +258,8 @@
           this.nonTransactedTimerName = nonTransactedTimerName;
       }
   
  -    public GBeanMBean createConfiguration() throws Exception {
  +    // todo this created GBeanDatas without and object name, which is a bad 
idea
  +    public GBeanData createConfiguration() throws Exception {
           // get the bean class
           Class beanClass = classLoader.loadClass(beanClassName);
   
  @@ -303,9 +304,8 @@
               }
           }
   
  -
           // create and initialize the GBean
  -        GBeanMBean gbean = new GBeanMBean(MDBContainer.GBEAN_INFO, 
classLoader);
  +        GBeanData gbean = new GBeanData(MDBContainer.GBEAN_INFO);
           gbean.setAttribute("containerId", containerId);
           gbean.setAttribute("ejbName", ejbName);
           gbean.setReferencePattern("ActivationSpecWrapper", 
activationSpecName);
  
  
  
  1.6       +17 -19    
openejb/modules/openejb-builder/src/java/org/openejb/deployment/MdbBuilder.java
  
  Index: MdbBuilder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/java/org/openejb/deployment/MdbBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MdbBuilder.java   19 Nov 2004 03:58:59 -0000      1.5
  +++ MdbBuilder.java   1 Dec 2004 06:59:10 -0000       1.6
  @@ -57,13 +57,12 @@
   
   import org.apache.geronimo.deployment.DeploymentException;
   import org.apache.geronimo.gbean.GBeanData;
  -import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.j2ee.deployment.EARContext;
   import org.apache.geronimo.j2ee.deployment.EJBModule;
   import org.apache.geronimo.j2ee.deployment.RefContext;
   import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
  -import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
   import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
  +import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
   import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
   import org.apache.geronimo.naming.java.ReadOnlyContext;
   import org.apache.geronimo.security.deploy.Security;
  @@ -123,10 +122,10 @@
                       messageDrivenBean.isSetActivationConfig() ? 
messageDrivenBean.getActivationConfig().getActivationConfigPropertyArray() : 
new ActivationConfigPropertyType[]{},
                       openejbMessageDrivenBean.getResourceAdapter(),
                       
messageDrivenBean.getMessagingType().getStringValue().trim(),
  -                    containerId,
  -                    cl);
  -            GBeanMBean messageDrivenGBean = createBean(earContext, 
ejbModule, containerId, messageDrivenBean, openejbMessageDrivenBean, 
activationSpecName, transactionPolicyHelper, security, cl);
  -            earContext.addGBean(messageDrivenObjectName, messageDrivenGBean);
  +                    containerId);
  +            GBeanData messageDrivenGBean = createBean(earContext, ejbModule, 
containerId, messageDrivenBean, openejbMessageDrivenBean, activationSpecName, 
transactionPolicyHelper, security, cl);
  +            messageDrivenGBean.setName(messageDrivenObjectName);
  +            earContext.addGBean(messageDrivenGBean);
           }
       }
   
  @@ -145,7 +144,7 @@
           }
       }
   
  -    private GBeanMBean createBean(EARContext earContext,
  +    private GBeanData createBean(EARContext earContext,
                                     EJBModule ejbModule,
                                     String containerId,
                                     MessageDrivenBeanType messageDrivenBean,
  @@ -195,7 +194,7 @@
           processEnvironmentRefs(builder, earContext, ejbModule, 
messageDrivenBean, openejbMessageDrivenBean, userTransaction, cl);
   
           try {
  -            GBeanMBean gbean = builder.createConfiguration();
  +            GBeanData gbean = builder.createConfiguration();
               gbean.setReferencePattern("TransactionContextManager", 
earContext.getTransactionContextManagerObjectName());
               gbean.setReferencePattern("TrackedConnectionAssociator", 
earContext.getConnectionTrackerObjectName());
               gbean.setReferencePattern("ActivationSpecWrapper", 
activationSpecWrapperName);
  @@ -206,15 +205,14 @@
       }
   
       private void addActivationSpecWrapperGBean(EARContext earContext,
  -                                               J2eeContext moduleJ2eeContext,
  -                                               URI uri,
  -                                               ObjectName activationSpecName,
  -                                               
OpenejbActivationConfigPropertyType[] openejbActivationConfigProperties,
  -                                               
ActivationConfigPropertyType[] activationConfigProperties,
  -                                               GerResourceLocatorType 
resourceAdapter,
  -                                               String 
messageListenerInterfaceName,
  -                                               String containerId,
  -                                               ClassLoader cl) throws 
DeploymentException {
  +            J2eeContext moduleJ2eeContext,
  +            URI uri,
  +            ObjectName activationSpecName,
  +            OpenejbActivationConfigPropertyType[] 
openejbActivationConfigProperties,
  +            ActivationConfigPropertyType[] activationConfigProperties,
  +            GerResourceLocatorType resourceAdapter,
  +            String messageListenerInterfaceName,
  +            String containerId) throws DeploymentException {
           RefContext refContext = earContext.getRefContext();
           ObjectName resourceAdapterObjectName = getResourceAdapterId(uri, 
resourceAdapter, refContext, moduleJ2eeContext);
           J2eeContext resourceAdapterJ2eeContext = new 
J2eeContextImpl(resourceAdapterObjectName, NameFactory.JCA_RESOURCE);
  @@ -224,7 +222,7 @@
           } catch (MalformedObjectNameException e) {
               throw new DeploymentException("Could not construct resource 
module name", e);
           }
  -        GBeanData activationSpecInfo = (GBeanData) 
refContext.getActivationSpecInfo(resourceModuleObjectName, 
messageListenerInterfaceName);
  +        GBeanData activationSpecInfo = 
refContext.getActivationSpecInfo(resourceModuleObjectName, 
messageListenerInterfaceName);
   
           if (activationSpecInfo == null) {
               throw new DeploymentException("no activation spec found for 
resource adapter: " + resourceAdapterObjectName + " and message listener type: 
" + messageListenerInterfaceName);
  @@ -257,7 +255,7 @@
               }
           }
               activationSpecInfo.setName(activationSpecName);
  -            earContext.addGBean(activationSpecInfo, cl);
  +            earContext.addGBean(activationSpecInfo);
       }
   
       private static ObjectName getResourceAdapterId(URI uri, 
GerResourceLocatorType resourceLocator, RefContext refContext, J2eeContext 
j2eeContext) throws DeploymentException {
  
  
  

Reply via email to