maguro      2004/11/05 18:46:51

  Added:       modules/core/src/java/org/openejb/corba/transaction
                        ClientTransactionInterceptor.java
                        ServerTransactionInterceptor.java
                        TransactionInitializer.java
  Log:

  Intermediate CORBA checkin
  
  Revision  Changes    Path
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/transaction/ClientTransactionInterceptor.java
  
  Index: ClientTransactionInterceptor.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: ClientTransactionInterceptor.java,v 1.1 2004/11/05 23:46:50 maguro Exp $
   */
  package org.openejb.corba.transaction;
  
  import org.omg.CORBA.LocalObject;
  import org.omg.PortableInterceptor.ClientRequestInfo;
  import org.omg.PortableInterceptor.ClientRequestInterceptor;
  import org.omg.PortableInterceptor.ForwardRequest;
  
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/11/05 23:46:50 $
   */
  class ClientTransactionInterceptor extends LocalObject implements 
ClientRequestInterceptor {
  
      private final int slotId;
  
      public ClientTransactionInterceptor(int slotId) {
          this.slotId = slotId;
      }
  
      public void receive_exception(ClientRequestInfo ri) throws ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void receive_other(ClientRequestInfo ri) throws ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void receive_reply(ClientRequestInfo ri) {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void send_poll(ClientRequestInfo ri) {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void send_request(ClientRequestInfo ri) throws ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void destroy() {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      /**
       * Returns the name of the interceptor.
       * <p/>
       * Each Interceptor may have a name that may be used administratively
       * to order the lists of Interceptors. Only one Interceptor of a given
       * name can be registered with the ORB for each Interceptor type. An
       * Interceptor may be anonymous, i.e., have an empty string as the name
       * attribute. Any number of anonymous Interceptors may be registered with
       * the ORB.
       *
       * @return the name of the interceptor.
       */
      public String name() {
          return "ClientTransactionInterceptor";
      }
  }
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/transaction/ServerTransactionInterceptor.java
  
  Index: ServerTransactionInterceptor.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: ServerTransactionInterceptor.java,v 1.1 2004/11/05 23:46:50 maguro Exp $
   */
  package org.openejb.corba.transaction;
  
  import org.omg.CORBA.LocalObject;
  import org.omg.PortableInterceptor.ServerRequestInterceptor;
  import org.omg.PortableInterceptor.ServerRequestInfo;
  import org.omg.PortableInterceptor.ForwardRequest;
  
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/11/05 23:46:50 $
   */
  class ServerTransactionInterceptor extends LocalObject implements 
ServerRequestInterceptor {
  
      private final int slotId;
  
      public ServerTransactionInterceptor(int slotId) {
          this.slotId = slotId;
      }
  
      public void receive_request(ServerRequestInfo ri) throws ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void receive_request_service_contexts(ServerRequestInfo ri) throws 
ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void send_exception(ServerRequestInfo ri) throws ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void send_other(ServerRequestInfo ri) throws ForwardRequest {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void send_reply(ServerRequestInfo ri) {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      public void destroy() {
          //To change body of implemented methods use File | Settings | File Templates.
      }
  
      /**
       * Returns the name of the interceptor.
       * <p/>
       * Each Interceptor may have a name that may be used administratively
       * to order the lists of Interceptors. Only one Interceptor of a given
       * name can be registered with the ORB for each Interceptor type. An
       * Interceptor may be anonymous, i.e., have an empty string as the name
       * attribute. Any number of anonymous Interceptors may be registered with
       * the ORB.
       *
       * @return the name of the interceptor.
       */
      public String name() {
          return "ServerTransactionInterceptor";
      }
  }
  
  
  
  1.1                  
openejb/modules/core/src/java/org/openejb/corba/transaction/TransactionInitializer.java
  
  Index: TransactionInitializer.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: TransactionInitializer.java,v 1.1 2004/11/05 23:46:50 maguro Exp $
   */
  package org.openejb.corba.transaction;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.omg.CORBA.LocalObject;
  import org.omg.PortableInterceptor.ORBInitInfo;
  import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
  import org.omg.PortableInterceptor.ORBInitializer;
  
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/11/05 23:46:50 $
   */
  public class TransactionInitializer extends LocalObject implements ORBInitializer {
      private final Log log = LogFactory.getLog(TransactionInitializer.class);
  
      private static int slotId;
  
      /**
       * Called during ORB initialization.  If it is expected that initial
       * services registered by an interceptor will be used by other
       * interceptors, then those initial services shall be registered at
       * this point via calls to
       * <code>ORBInitInfo.register_initial_reference</code>.
       *
       * @param info provides initialization attributes and operations by
       *             which Interceptors can be registered.
       */
      public void pre_init(ORBInitInfo info) {
          slotId = info.allocate_slot_id();
          
          try {
              info.add_client_request_interceptor(new 
ClientTransactionInterceptor(slotId));
              info.add_server_request_interceptor(new 
ServerTransactionInterceptor(slotId));
          } catch (DuplicateName duplicateName) {
              duplicateName.printStackTrace();
          }
      }
  
      /**
       * Called during ORB initialization. If a service must resolve initial
       * references as part of its initialization, it can assume that all
       * initial references will be available at this point.
       * <p/>
       * Calling the <code>post_init</code> operations is not the final
       * task of ORB initialization. The final task, following the
       * <code>post_init</code> calls, is attaching the lists of registered
       * interceptors to the ORB. Therefore, the ORB does not contain the
       * interceptors during calls to <code>post_init</code>. If an
       * ORB-mediated call is made from within <code>post_init</code>, no
       * request interceptors will be invoked on that call.
       * Likewise, if an operation is performed which causes an IOR to be
       * created, no IOR interceptors will be invoked.
       *
       * @param info provides initialization attributes and
       *             operations by which Interceptors can be registered.
       */
      public void post_init(ORBInitInfo info) {
      }
  
  }
  
  
  

Reply via email to