You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ch...@apache.org on 2003/11/17 01:46:09 UTC

cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector BootstrapContext.java

chirino     2003/11/16 16:46:09

  Modified:    modules/core/src/conf boot-service.xml
               modules/core/src/java/org/apache/geronimo/connector/work
                        GeronimoWorkManager.java
               modules/core/src/java/org/apache/geronimo/transaction
                        TransactionManagerProxy.java
  Added:       modules/core/src/deploy connector-service.xml
               modules/core/src/java/org/apache/geronimo/connector
                        BootstrapContext.java
  Removed:     modules/core/src/deploy workmanager-service.xml
  Log:
  Adding BootstrapContext for jca.
  
  Revision  Changes    Path
  1.22      +2 -2      incubator-geronimo/modules/core/src/conf/boot-service.xml
  
  Index: boot-service.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/conf/boot-service.xml,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- boot-service.xml	16 Nov 2003 00:52:22 -0000	1.21
  +++ boot-service.xml	17 Nov 2003 00:46:09 -0000	1.22
  @@ -34,7 +34,7 @@
       </mbean>
   
       <mbean name="geronimo.transaction:role=TransactionManager"
  -           descriptor="org/apache/geronimo/transaction/TransactionManagerProxy.xml">
  +           descriptor="org.apache.geronimo.transaction.TransactionManagerProxy">
       </mbean>
   
       <mbean name="geronimo.connector:role=CachedConnectionManager"
  
  
  
  1.3       +19 -32    incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java
  
  Index: GeronimoWorkManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/work/GeronimoWorkManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GeronimoWorkManager.java	16 Nov 2003 23:12:07 -0000	1.2
  +++ GeronimoWorkManager.java	17 Nov 2003 00:46:09 -0000	1.3
  @@ -63,6 +63,7 @@
   import javax.resource.spi.work.WorkManager;
   import javax.resource.spi.work.WorkRejectedException;
   
  +import org.apache.geronimo.common.Classes;
   import org.apache.geronimo.connector.work.pool.WorkExecutorPool;
   import org.apache.geronimo.kernel.management.State;
   import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
  @@ -109,37 +110,6 @@
       }
   
       /**
  -     * Provides the GeronimoMBean description for this class
  -     * @return
  -     */
  -    public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
  -
  -        // TODO: add descriptions to all operations.
  -        GeronimoMBeanInfo rc = new GeronimoMBeanInfo();
  -        rc.setTargetClass(GeronimoWorkManager.class);
  -        rc.addOperationInfo(
  -            new GeronimoOperationInfo(
  -                "setSyncExecutor",
  -                new GeronimoParameterInfo[] { new GeronimoParameterInfo("pool", WorkExecutorPool.class, "")},
  -                MBeanOperationInfo.ACTION,
  -                ""));
  -        rc.addOperationInfo(
  -            new GeronimoOperationInfo(
  -                "setStartExecutor",
  -                new GeronimoParameterInfo[] { new GeronimoParameterInfo("pool", WorkExecutorPool.class, "")},
  -                MBeanOperationInfo.ACTION,
  -                ""));
  -        rc.addOperationInfo(
  -            new GeronimoOperationInfo(
  -                "setAsyncExecutor",
  -                new GeronimoParameterInfo[] { new GeronimoParameterInfo("pool", WorkExecutorPool.class, "")},
  -                MBeanOperationInfo.ACTION,
  -                ""));
  -        return rc;
  -
  -    }
  -
  -    /**
        * Set the executor in charge of the processing of synchronous works.
        * @param anExecutorPool An executor.
        */
  @@ -317,4 +287,21 @@
       public void doFail() {
       }
   
  +    
  +    /**
  +     * Provides the GeronimoMBean description for this class
  +     * @return
  +     */
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
  +
  +        // TODO: add descriptions to all operations.
  +        GeronimoMBeanInfo rc = new GeronimoMBeanInfo();
  +        rc.setTargetClass(GeronimoWorkManager.class);
  +        rc.addOperationFor( Classes.getMethod(GeronimoWorkManager.class, "setSyncExecutor") ); 
  +        rc.addOperationFor( Classes.getMethod(GeronimoWorkManager.class, "setStartExecutor") ); 
  +        rc.addOperationFor( Classes.getMethod(GeronimoWorkManager.class, "setAsyncExecutor") ); 
  +        return rc;
  +
  +    }
  +    
   }
  
  
  
  1.3       +57 -4     incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java
  
  Index: TransactionManagerProxy.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/transaction/TransactionManagerProxy.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TransactionManagerProxy.java	11 Nov 2003 21:11:58 -0000	1.2
  +++ TransactionManagerProxy.java	17 Nov 2003 00:46:09 -0000	1.3
  @@ -55,8 +55,7 @@
    */
   package org.apache.geronimo.transaction;
   
  -import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
  -
  +import javax.resource.spi.XATerminator;
   import javax.transaction.HeuristicMixedException;
   import javax.transaction.HeuristicRollbackException;
   import javax.transaction.InvalidTransactionException;
  @@ -66,6 +65,12 @@
   import javax.transaction.SystemException;
   import javax.transaction.Transaction;
   import javax.transaction.TransactionManager;
  +import javax.transaction.xa.XAException;
  +import javax.transaction.xa.Xid;
  +
  +import org.apache.geronimo.connector.work.GeronimoWorkManager;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
   
   /**
    * A wrapper for a TransactionManager that wraps all Transactions in a TransactionProxy
  @@ -75,7 +80,7 @@
    *
    * @version $Revision$ $Date$
    */
  -public class TransactionManagerProxy implements TransactionManager {
  +public class TransactionManagerProxy implements TransactionManager, XATerminator {
       private final TransactionManager delegate;
       private final ThreadLocal threadTx = new ThreadLocal();
   
  @@ -159,4 +164,52 @@
           }
           tx.setRollbackOnly();
       }
  +
  +    /**
  +     * @see javax.resource.spi.XATerminator#commit(javax.transaction.xa.Xid, boolean)
  +     */
  +    public void commit(Xid arg0, boolean arg1) throws XAException {
  +        throw new XAException("Not implemented.");
  +    }
  +
  +    /**
  +     * @see javax.resource.spi.XATerminator#forget(javax.transaction.xa.Xid)
  +     */
  +    public void forget(Xid arg0) throws XAException {
  +        throw new XAException("Not implemented.");
  +    }
  +
  +    /**
  +     * @see javax.resource.spi.XATerminator#prepare(javax.transaction.xa.Xid)
  +     */
  +    public int prepare(Xid arg0) throws XAException {
  +        throw new XAException("Not implemented.");
  +    }
  +
  +    /**
  +     * @see javax.resource.spi.XATerminator#recover(int)
  +     */
  +    public Xid[] recover(int arg0) throws XAException {
  +        throw new XAException("Not implemented.");
  +    }
  +
  +    /**
  +     * @see javax.resource.spi.XATerminator#rollback(javax.transaction.xa.Xid)
  +     */
  +    public void rollback(Xid arg0) throws XAException {
  +        throw new XAException("Not implemented.");
  +    }
  +    
  +    /**
  +     * Provides the GeronimoMBean description for this class
  +     * @return
  +     */
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
  +        GeronimoMBeanInfo rc = new GeronimoMBeanInfo();
  +        rc.setTargetClass(TransactionManagerProxy.class);
  +        rc.addOperationsDeclaredIn(TransactionManager.class);
  +        rc.addOperationsDeclaredIn(XATerminator.class);
  +        return rc;
  +    }
  +    
   }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/deploy/connector-service.xml
  
  Index: connector-service.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <components>
      <class-space name="geronimo.system:role=ClassSpace,name=System"/>
  
      <!-- ============================================================ -->
      <!-- Starts the Work Manager                                      -->
      <!-- ============================================================ -->
      <mbean descriptor="org.apache.geronimo.connector.work.GeronimoWorkManager"
      	name="geronimo.jca:role=WorkManager">
      </mbean>
      
      <!-- ============================================================ -->
      <!-- Starts the Work Executor Pool in charge of the treatment of  -->
      <!-- synchronous works                                            -->
      <!-- ============================================================ -->
      <mbean descriptor="org.apache.geronimo.connector.work.pool.SyncWorkExecutorPool"
      	name="geronimo.jca:role=SynchWorkExecutorPool">
          <constructor>
              <arg type="int">1</arg>
              <arg type="int">1</arg>
          </constructor>
      </mbean>
  
      <!-- ============================================================ -->
      <!-- Starts the Work Executor Pool in charge of the treatment of  -->
      <!-- synchronous works until the work start.                      -->
      <!-- ============================================================ -->
      <mbean descriptor="org.apache.geronimo.connector.work.pool.StartWorkExecutorPool"
      	name="geronimo.jca:role=StartWorkExecutorPool">
          <constructor>
              <arg type="int">1</arg>
              <arg type="int">1</arg>
          </constructor>
      </mbean>
  
      <!-- ============================================================ -->
      <!-- Starts the Work Executor Pool in charge of the treatment of  -->
      <!-- asynchronous works.                                          -->
      <!-- ============================================================ -->
      <mbean descriptor="org.apache.geronimo.connector.work.pool.ScheduleWorkExecutorPool"
      	name="geronimo.jca:role=ScheduleWorkExecutorPool">
          <constructor>
              <arg type="int">1</arg>
              <arg type="int">1</arg>
          </constructor>
      </mbean>
  
  
      <!-- ============================================================ -->
      <!-- ============================================================ -->
      <mbean name="geronimo.transaction:role=BootstrapContext"
             descriptor="org.apache.geronimo.connector.BootstrapContext">
      </mbean>    
  
  </components>
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/BootstrapContext.java
  
  Index: BootstrapContext.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.connector;
  
  import java.util.Timer;
  
  import javax.management.ObjectName;
  import javax.resource.spi.UnavailableException;
  import javax.resource.spi.XATerminator;
  import javax.resource.spi.work.WorkManager;
  
  import org.apache.geronimo.kernel.service.GeronimoMBeanEndpoint;
  import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/11/17 00:46:09 $
   */
  public class BootstrapContext implements javax.resource.spi.BootstrapContext {
  
      private WorkManager workManager;
      private XATerminator xATerminator;
      
          
      /**
       * @param workManager The workManager to set.
       */
      public void setWorkManager(WorkManager workManager) {
          this.workManager = workManager;
      }
  
      /**
       * @param terminator The xATerminator to set.
       */
      public void setXATerminator(XATerminator terminator) {
          xATerminator = terminator;
      }
  
      /**
       * @see javax.resource.spi.BootstrapContext#getWorkManager()
       */
      public WorkManager getWorkManager() {
          return workManager;
      }
  
      /**
       * @see javax.resource.spi.BootstrapContext#getXATerminator()
       */
      public XATerminator getXATerminator() {
          return xATerminator;
      }
  
      /**
       * @see javax.resource.spi.BootstrapContext#createTimer()
       */
      public Timer createTimer() throws UnavailableException {
          return new Timer();
      }
  
  
      public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
          GeronimoMBeanInfo rc = new GeronimoMBeanInfo();
          rc.setTargetClass(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;
      }
      
      
  }