Save This Page
Home » glassfish-v2ur2-b04-src » javax.resource.cci » [javadoc | source]
    1   /*
    2    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    3    * 
    4    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    5    * 
    6    * The contents of this file are subject to the terms of either the GNU
    7    * General Public License Version 2 only ("GPL") or the Common Development
    8    * and Distribution License("CDDL") (collectively, the "License").  You
    9    * may not use this file except in compliance with the License. You can obtain
   10    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   11    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   12    * language governing permissions and limitations under the License.
   13    * 
   14    * When distributing the software, include this License Header Notice in each
   15    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   16    * Sun designates this particular file as subject to the "Classpath" exception
   17    * as provided by Sun in the GPL Version 2 section of the License file that
   18    * accompanied this code.  If applicable, add the following below the License
   19    * Header, with the fields enclosed by brackets [] replaced by your own
   20    * identifying information: "Portions Copyrighted [year]
   21    * [name of copyright owner]"
   22    * 
   23    * Contributor(s):
   24    * 
   25    * If you wish your version of this file to be governed by only the CDDL or
   26    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   27    * elects to include this software in this distribution under the [CDDL or GPL
   28    * Version 2] license."  If you don't indicate a single choice of license, a
   29    * recipient has the option to distribute your version of this file under
   30    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   31    * its licensees as provided above.  However, if you add GPL Version 2 code
   32    * and therefore, elected the GPL Version 2 license, then the option applies
   33    * only if the new code is made subject to such option by the copyright
   34    * holder.
   35    */
   36   
   37   package javax.resource.cci;
   38   
   39   import javax.resource.ResourceException;
   40   import javax.resource.NotSupportedException;
   41   
   42   
   43   /** The <code>javax.resource.cci.Interaction</code> enables a component to 
   44    *  execute EIS functions. An Interaction instance supports the following ways 
   45    *  of interacting with an EIS instance:
   46    *  <UL>
   47    *     <LI><code>execute</code> method that takes an input Record, output
   48    *         Record and an InteractionSpec. This method executes the EIS 
   49    *         function represented by the InteractionSpec and updates the 
   50    *         output Record
   51    *     <LI><code>execute</code> method that takes an input Record and an 
   52    *         InteractionSpec. This method implementation executes the EIS 
   53    *         function represented by the InteractionSpec and produces the 
   54    *         output Record as a return value.
   55    *  </UL>
   56    *  <p>An Interaction instance is created from a Connection and is required
   57    *  to maintain its association with the Connection instance. The close method
   58    *  releases all resources maintained by the resource adapter for the 
   59    *  Interaction. The close of an Interaction instance should not close the 
   60    *  associated Connection instance.
   61    *       
   62    *  @author  Rahul Sharma
   63    *  @version 0.8
   64    *  @since   0.8
   65    *  @see     java.sql.ResultSet
   66   **/
   67   
   68   public interface Interaction {
   69     
   70     /** Closes the current Interaction and release all the resources
   71      *  held for this instance by the resource adapter. The close of an 
   72      *  Interaction instance does not close the associated Connection 
   73      *  instance. It is recommended that Interaction instances be
   74      *  closed explicitly to free any held resources.
   75      *
   76      *  @throws  ResourceException Failed to close the Interaction
   77      *                             instance. Invoking close on an 
   78      *                             already closed Interaction should 
   79      *                             also throw this exception. 
   80     **/
   81     public
   82     void close() throws ResourceException;
   83   
   84   
   85     /** Gets the Connection associated with the Interaction.
   86      *
   87      *  @return   Connection instance associated with the Interaction
   88     **/
   89     public
   90     Connection getConnection();
   91   
   92     /** Executes an interaction represented by the InteractionSpec.
   93      *  This form of invocation takes an input Record and updates
   94      *  the output Record. 
   95      *  
   96      *  @param   ispec   InteractionSpec representing a target EIS 
   97      *                   data/function module   
   98      *  @param   input   Input Record
   99      *  @param   output  Output Record
  100      * 
  101      *  @return  true if execution of the EIS function has been 
  102      *           successful and output Record has been updated; false
  103      *           otherwise
  104      *
  105      *  @throws  ResourceException   Exception if execute operation
  106      *                               fails. Examples of error cases
  107      *                               are:
  108      *         <UL>
  109      *           <LI> Resource adapter internal, EIS-specific or 
  110      *                communication error 
  111      *           <LI> Invalid specification of an InteractionSpec, 
  112      *                input or output record structure
  113      *           <LI> Errors in use of input or output Record
  114      *           <LI> Invalid connection associated with this 
  115      *                Interaction
  116      *	     </UL>
  117      *  @throws NotSupportedException Operation not supported 
  118      *                             
  119     **/
  120     public
  121     boolean execute(InteractionSpec ispec, 
  122   		  Record input, 
  123   		  Record output) throws ResourceException;
  124   
  125     /** Executes an interaction represented by the InteractionSpec.
  126      *  This form of invocation takes an input Record and returns an 
  127      *  output Record if the execution of the Interaction has been
  128      *  successfull.
  129      *  
  130      *  @param   ispec   InteractionSpec representing a target EIS 
  131      *                   data/function module   
  132      *  @param   input   Input Record
  133   
  134      *  @return  output Record if execution of the EIS function has been 
  135      *           successful; null otherwise
  136      *
  137      *  @throws  ResourceException   Exception if execute operation
  138      *                               fails. Examples of error cases
  139      *                               are:
  140      *         <UL>
  141      *           <LI> Resource adapter internal, EIS-specific or 
  142      *                communication error 
  143      *           <LI> Invalid specification of an InteractionSpec 
  144      *                or input record structure
  145      *           <LI> Errors in use of input Record or creation
  146      *                of an output Record
  147      *           <LI> Invalid connection associated with this 
  148      *                Interaction
  149      *	     </UL>
  150      *  @throws NotSupportedException Operation not supported 
  151     **/
  152     public
  153     Record execute(InteractionSpec ispec, 
  154   		 Record input) throws ResourceException;
  155   
  156     /** Gets the first ResourceWarning from the chain of warnings
  157      *  associated with this Interaction instance.
  158      *
  159      *  @return   ResourceWarning at top of the warning chain
  160      *  @throws   ResourceException  Failed to get ResourceWarnings
  161      *                               associated with Interaction  
  162      **/
  163     public
  164     ResourceWarning getWarnings()  throws ResourceException;
  165   
  166     /** Clears all the warning reported by this Interaction instance. After 
  167      *  a call to this method, the method getWarnings will return null 
  168      *  until a new warning is reported for this Interaction.
  169      * 
  170      *  @throws   ResourceException  Failed to clear ResourceWarnings
  171      *                               associated with Interaction  
  172    **/
  173     public 
  174     void clearWarnings() throws ResourceException;
  175   
  176   }

Save This Page
Home » glassfish-v2ur2-b04-src » javax.resource.cci » [javadoc | source]