/*
 * Created on December 10, 2003
 *
 * InteractionImpl.java is used to test the J2EE Connector
 * as implemented by JOnAS. This class implements the Interaction
 * (cci) classes.
 *  
 */
package ersatz.resourceadapter;

import javax.resource.ResourceException;
import javax.resource.NotSupportedException;
import javax.resource.cci.Interaction;
import javax.resource.cci.InteractionSpec;
import javax.resource.cci.Connection;
import javax.resource.cci.Record;
import javax.resource.cci.ResourceWarning;
/**
 * @author Bob Kruse
 *
 * Jtest Resource Adapter
 *
 * used to test the J2EE Connector as implemented by JOnAS.
 * 
 */
public class InteractionImpl 
        implements Interaction
{

    private Record output;
    private boolean closed = false;
    private ConnectionImpl con;
    private ManagedConnectionImpl mcon;
    String cName = "InteractionImpl";
    
    public InteractionImpl(ConnectionImpl c) {
        Utility.log(cName+".constructor");
        con=c;
    }
    public InteractionImpl(ConnectionImpl c, ManagedConnectionImpl mc) {
        Utility.log(cName+".constructor");
        con=c;
        mcon=mc;
    }
    /*
      If an Interaction implementation does not support a variant of the execute
      method, the method must throw a javax.resource.NotSupportedException.
    */
    public boolean execute(InteractionSpec ispec,
        Record input, 
        Record output) throws ResourceException
    {
        NotSupportedException nse = new NotSupportedException(
                  "InteractionImpl.execute is not currently supported");
        Utility.log(cName+".execute "+nse.toString());
        throw nse;
    }
    public Record execute(InteractionSpec ispec,
        Record input) throws ResourceException
    {
        NotSupportedException nse = new NotSupportedException(
                  "InteractionImpl.execute is not currently supported");
        Utility.log(cName+".execute "+nse.toString());
        throw nse;
    }
    public void close()
               throws ResourceException
    {
        Utility.log(cName+".close");
        closed=true;
    }
    public Connection getConnection()
    {
        Utility.log(cName+".getConnection");
        return con;
    }
    public ResourceWarning getWarnings()
                               throws ResourceException           
    {
        Utility.log(cName+".getWarnings");
        NotSupportedException nse = new NotSupportedException(
                  "InteractionImpl.getWarnings is not currently supported");
        throw nse;
    }
    public void clearWarnings()
                       throws ResourceException
    {
        Utility.log(cName+".clearWarnings");
        NotSupportedException nse = new NotSupportedException(
                       "InteractionImpl.clearWarnings is not currently supported");
        throw nse;
    }

}
