geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment ConnectorDeploymentPlanner.java ResourceAdapterHelperImpl.java
Date Wed, 26 Nov 2003 02:17:40 GMT
djencks     2003/11/25 18:17:40

  Modified:    modules/core/src/java/org/apache/geronimo/connector
                        BootstrapContext.java
               modules/core/src/java/org/apache/geronimo/connector/deployment
                        ConnectorDeploymentPlanner.java
                        ResourceAdapterHelperImpl.java
  Log:
  Changes to let mdbs deploy.
  
  Revision  Changes    Path
  1.2       +14 -5     incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/BootstrapContext.java
  
  Index: BootstrapContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/BootstrapContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BootstrapContext.java	17 Nov 2003 00:46:09 -0000	1.1
  +++ BootstrapContext.java	26 Nov 2003 02:17:40 -0000	1.2
  @@ -72,8 +72,16 @@
   
       private WorkManager workManager;
       private XATerminator xATerminator;
  -    
  -        
  +
  +    public BootstrapContext() {
  +
  +    }
  +
  +    public BootstrapContext(WorkManager workManager, XATerminator xaTerminator) {
  +        this.workManager = workManager;
  +        this.xATerminator = xaTerminator;
  +    }
  +
       /**
        * @param workManager The workManager to set.
        */
  @@ -113,10 +121,11 @@
       public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
           GeronimoMBeanInfo rc = new GeronimoMBeanInfo();
           rc.setTargetClass(BootstrapContext.class);
  +        rc.addOperationsDeclaredIn(javax.resource.spi.BootstrapContext.class);
           rc.addEndpoint(new GeronimoMBeanEndpoint("WorkManager",WorkManager.class, new ObjectName("geronimo.jca:role=WorkManager"),
true));
           rc.addEndpoint(new GeronimoMBeanEndpoint("XATerminator",XATerminator.class, new
ObjectName("geronimo.transaction:role=TransactionManager"), true));
           return rc;
       }
  -    
  -    
  +
  +
   }
  
  
  
  1.7       +50 -48    incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ConnectorDeploymentPlanner.java
  
  Index: ConnectorDeploymentPlanner.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ConnectorDeploymentPlanner.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConnectorDeploymentPlanner.java	24 Nov 2003 00:04:32 -0000	1.6
  +++ ConnectorDeploymentPlanner.java	26 Nov 2003 02:17:40 -0000	1.7
  @@ -199,14 +199,7 @@
           //deploy ra
           ObjectName resourceAdapterName = null;
           if (gra.getResourceAdapterClass() != null) {
  -            MBeanMetadata raMD = getMBeanMetadata(raCS.getName(), deploymentUnitName, baseURI);
  -            raMD.setCode(gra.getResourceAdapterClass());
  -            raMD.setName(buildResourceAdapterDeploymentName(gra));
  -            configureMBeanMetadata(gra.getConfigProperty(), raMD);
  -            addTasks(raMD, deploymentPlan);
  -            resourceAdapterName = raMD.getName();
  -            ObjectName bootstrapContextName = buildBootstrapContextName(gra);
  -            ResourceAdapterHelperImpl.addMBeanInfo(raMD.getGeronimoMBeanInfo(), bootstrapContextName);
  +            resourceAdapterName = planResourceAdapter(deploymentPlan, gra, raCS, deploymentUnitName,
baseURI);
           }
   
   
  @@ -215,31 +208,8 @@
               GeronimoConnectionDefinition gcd = gra.getGeronimoOutboundResourceAdapter().getGeronimoConnectionDefinition(i);
               assert gcd != null: "Null GeronimoConnectionDefinition";
               //deploy cm factory
  -            GeronimoConnectionManagerFactory gcmf = gcd.getGeronimoConnectionManagerFactory();
  -            assert gcmf != null: "Null GeronimoConnectionManagerFactory";
  -            MBeanMetadata cmfMD = getMBeanMetadata(raCS.getName(), deploymentUnitName,
baseURI);
  -            cmfMD.setGeronimoMBeanDescriptor(gcmf.getConnectionManagerFactoryDescriptor());
  -            cmfMD.setName(buildConnectionManagerFactoryDeploymentName(gcd));
  -            adaptConfigProperties(gcmf.getConfigProperty(), null, cmfMD.getAttributeValues());
  -            addTasks(cmfMD, deploymentPlan);
  -
  -
  -            MBeanMetadata mcfMD = getMBeanMetadata(raCS.getName(), deploymentUnitName,
baseURI);
  -            mcfMD.setCode(gcd.getManagedConnectionFactoryClass());
  -            mcfMD.setName(buildManagedConnectionFactoryDeploymentName(gcd));
  -            configureMBeanMetadata(gcd.getConfigProperty(), mcfMD);
  -            ManagedConnectionFactoryHelper.addMBeanInfo(mcfMD.getGeronimoMBeanInfo(), resourceAdapterName,
cmfMD.getName());
  -            Map attributes = mcfMD.getAttributeValues();
  -            attributes.put("ConnectionFactoryImplClass", gcd.getConnectionFactoryImplClass());
  -            attributes.put("ConnectionFactoryInterface", gcd.getConnectionFactoryInterface());
  -            attributes.put("ConnectionImplClass", gcd.getConnectionImplClass());
  -            attributes.put("ConnectionInterface", gcd.getConnectionInterface());
  -            attributes.put("ManagedConnectionFactoryClass", gcd.getManagedConnectionFactoryClass());
  -            if (resourceAdapterName != null) {
  -                attributes.put("ResourceAdapterName", resourceAdapterName);
  -            }
  -            attributes.put("ConnectionManagerFactoryName", cmfMD.getName());
  -            addTasks(mcfMD, deploymentPlan);
  +            planManagedConnectionFactory(deploymentPlan, gcd, raCS, deploymentUnitName,
baseURI, resourceAdapterName);
  +
   
           }
           plans.add(deploymentPlan);
  @@ -247,6 +217,51 @@
           return true;
       }
   
  +    //Public access is bad, but these need to be accessible for testing from other packages.
  +    //TODO find a way to make these package access
  +    public void planManagedConnectionFactory(DeploymentPlan deploymentPlan, GeronimoConnectionDefinition
gcd, ClassSpaceMetadata raCS, ObjectName deploymentUnitName, URI baseURI, ObjectName resourceAdapterName)
throws DeploymentException {
  +        GeronimoConnectionManagerFactory gcmf = gcd.getGeronimoConnectionManagerFactory();
  +        assert gcmf != null: "Null GeronimoConnectionManagerFactory";
  +        MBeanMetadata cmfMD = getMBeanMetadata(raCS.getName(), deploymentUnitName, baseURI);
  +        cmfMD.setGeronimoMBeanDescriptor(gcmf.getConnectionManagerFactoryDescriptor());
  +        cmfMD.setName(buildConnectionManagerFactoryDeploymentName(gcd));
  +        adaptConfigProperties(gcmf.getConfigProperty(), null, cmfMD.getAttributeValues());
  +        addTasks(cmfMD, deploymentPlan);
  +
  +
  +        MBeanMetadata mcfMD = getMBeanMetadata(raCS.getName(), deploymentUnitName, baseURI);
  +        mcfMD.setCode(gcd.getManagedConnectionFactoryClass());
  +        mcfMD.setName(buildManagedConnectionFactoryDeploymentName(gcd));
  +        configureMBeanMetadata(gcd.getConfigProperty(), mcfMD);
  +        ManagedConnectionFactoryHelper.addMBeanInfo(mcfMD.getGeronimoMBeanInfo(), resourceAdapterName,
cmfMD.getName());
  +        Map attributes = mcfMD.getAttributeValues();
  +        attributes.put("ConnectionFactoryImplClass", gcd.getConnectionFactoryImplClass());
  +        attributes.put("ConnectionFactoryInterface", gcd.getConnectionFactoryInterface());
  +        attributes.put("ConnectionImplClass", gcd.getConnectionImplClass());
  +        attributes.put("ConnectionInterface", gcd.getConnectionInterface());
  +        attributes.put("ManagedConnectionFactoryClass", gcd.getManagedConnectionFactoryClass());
  +        if (resourceAdapterName != null) {
  +            attributes.put("ResourceAdapterName", resourceAdapterName);
  +        }
  +        attributes.put("ConnectionManagerFactoryName", cmfMD.getName());
  +        addTasks(mcfMD, deploymentPlan);
  +    }
  +
  +    //Public access is bad, but these need to be accessible for testing from other packages.
  +    //TODO find a way to make these package access
  +    public ObjectName planResourceAdapter(DeploymentPlan deploymentPlan, GeronimoResourceAdapter
gra, ClassSpaceMetadata raCS, ObjectName deploymentUnitName, URI baseURI) throws DeploymentException
{
  +        ObjectName resourceAdapterName;
  +        MBeanMetadata raMD = getMBeanMetadata(raCS.getName(), deploymentUnitName, baseURI);
  +        raMD.setCode(gra.getResourceAdapterClass());
  +        raMD.setName(buildResourceAdapterDeploymentName(gra));
  +        configureMBeanMetadata(gra.getConfigProperty(), raMD);
  +        addTasks(raMD, deploymentPlan);
  +        resourceAdapterName = raMD.getName();
  +        ObjectName bootstrapContextName = buildBootstrapContextName(gra);
  +        ResourceAdapterHelperImpl.addMBeanInfo(raMD.getGeronimoMBeanInfo(), bootstrapContextName);
  +        return resourceAdapterName;
  +    }
  +
       /**
        *
        * @param redeployURL
  @@ -307,9 +322,6 @@
           DeployGeronimoMBean createTask =
                   new DeployGeronimoMBean(getServer(), metadata);
           plan.addTask(createTask);
  -//        InitializeMBeanInstance initTask =
  -//                new InitializeMBeanInstance(getServer(), metadata);
  -//        plan.addTask(initTask);
           StartMBeanInstance startTask =
                   new StartMBeanInstance(getServer(), metadata);
           plan.addTask(startTask);
  @@ -338,7 +350,7 @@
   
       private ObjectName buildResourceAdapterDeploymentName(GeronimoResourceAdapter gra)
{
           return JMXUtil.getObjectName(
  -                "geronimo.management:j2eeType=JCAResourceAdapter,name="
  +                "geronimo.j2ee:J2eeType=ResourceAdapter,name="
                   + gra.getName());
       }
   
  @@ -356,16 +368,6 @@
       }
   
   
  -    private ObjectName buildMCFHelperDeploymentName(GeronimoConnectionDefinition gcd) {
  -        return JMXUtil.getObjectName(
  -                "geronimo.management:j2eeType=MCFHelper,name="
  -                + gcd.getName());
  -    }
  -
  -    /**
  -     * @param gra
  -     * @return
  -     */
       private ObjectName buildBootstrapContextName(GeronimoResourceAdapter gra) {
           return JMXUtil.getObjectName(
                   gra.getBootstrapContext());
  
  
  
  1.5       +3 -3      incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ResourceAdapterHelperImpl.java
  
  Index: ResourceAdapterHelperImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ResourceAdapterHelperImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ResourceAdapterHelperImpl.java	25 Nov 2003 17:28:36 -0000	1.4
  +++ ResourceAdapterHelperImpl.java	26 Nov 2003 02:17:40 -0000	1.5
  @@ -94,7 +94,7 @@
        * @see org.apache.geronimo.kernel.service.GeronimoMBeanTarget#canStart()
        */
       public boolean canStart() {
  -        return bootstrapContext != null;
  +        return true;
       }
   
       /* (non-Javadoc)
  @@ -180,7 +180,7 @@
                                       ObjectName bootstrapContextName) {
           mbeanInfo.setTargetClass(TARGET_NAME, ResourceAdapterHelperImpl.class.getName());
   
  -        mbeanInfo.addOperationsDeclaredIn(ResourceAdapterHelper.class);
  +        mbeanInfo.addOperationsDeclaredIn(ResourceAdapterHelper.class, TARGET_NAME);
   
           mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("BootstrapContext", BootstrapContext.class.getName(),
bootstrapContextName, true, TARGET_NAME));
   
  
  
  

Mime
View raw message