001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package javax.resource.spi;
031:
032: import javax.resource.ResourceException;
033: import javax.security.auth.Subject;
034: import javax.transaction.xa.XAResource;
035: import java.io.PrintWriter;
036:
037: /**
038: * Interface for the resource adapter's connection instance. This
039: * interface is used by the app server and is normally not visible
040: * to the application itself.
041: */
042: public interface ManagedConnection {
043: /**
044: * Creates a new connection handle for the underlying physical connection.
045: */
046: public Object getConnection(Subject subject,
047: ConnectionRequestInfo requestInfo) throws ResourceException;
048:
049: /**
050: * Associates an application-level connection handle with a ManagedConnection
051: */
052: public void associateConnection(Object connection)
053: throws ResourceException;
054:
055: /**
056: * Adds a new listener.
057: */
058: public void addConnectionEventListener(
059: ConnectionEventListener listener);
060:
061: /**
062: * Removes an old new listener.
063: */
064: public void removeConnectionEventListener(
065: ConnectionEventListener listener);
066:
067: /**
068: * Returns an XAResource for the connection.
069: */
070: public XAResource getXAResource() throws ResourceException;
071:
072: /**
073: * Returns a LocalTransaction.
074: */
075: public LocalTransaction getLocalTransaction()
076: throws ResourceException;
077:
078: /**
079: * Returns the meta data for the connection.
080: */
081: public ManagedConnectionMetaData getMetaData()
082: throws ResourceException;
083:
084: /**
085: * Sets the log stream.
086: */
087: public void setLogWriter(PrintWriter log) throws ResourceException;
088:
089: /**
090: * Returns the log stream.
091: */
092: public PrintWriter getLogWriter() throws ResourceException;
093:
094: /**
095: * Cleanup the physical connection.
096: */
097: public void cleanup() throws ResourceException;
098:
099: /**
100: * Destroys the physical connection.
101: */
102: public void destroy() throws ResourceException;
103: }
|