1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 package javax.resource.spi; 25 26 27 import javax.resource.ResourceException; 28 29 /** <p>ConnectionManager interface provides a hook for the resource adapter to 30 * pass a connection request to the application server. 31 * 32 * <p>An application server provides implementation of the ConnectionManager 33 * interface. This implementation is not specific to any particular type of 34 * the resource adapter or connection factory interface. 35 * 36 * <p>The ConnectionManager implementation delegates to the application 37 * server to enable latter to provide quality of services (QoS) - security, 38 * connection pool management, transaction management and error 39 * logging/tracing. 40 * 41 * <p>An application server implements these services in a generic manner, 42 * independent of any resource adapter and EIS specific mechanisms. The 43 * connector architecture does not specify how an application server 44 * implements these services; the implementation is specific to an 45 * application server. 46 * 47 * <p>After an application server hooks-in its services, the connection 48 * request gets delegated to a ManagedConnectionFactory instance either 49 * for the creation of a new physical connection or for the matching of 50 * an already existing physical connection. 51 * 52 * <p>An implementation class for ConnectionManager interface is 53 * required to implement the <code>java.io.Serializable</code> interface. 54 * 55 * <p>In the non-managed application scenario, the ConnectionManager 56 * implementation class can be provided either by a resource adapter (as 57 * a default ConnectionManager implementation) or by application 58 * developers. In both cases, QOS can be provided as components by third 59 * party vendors.</p> 60 * 61 * @since 0.6 62 * @author Rahul Sharma 63 * @see javax.resource.spi.ManagedConnectionFactory 64 **/ 65 66 public interface ConnectionManager 67 extends java.io.Serializable { 68 69 /** <p>The method allocateConnection gets called by the resource adapter's 70 * connection factory instance. This lets connection factory instance 71 * (provided by the resource adapter) pass a connection request to 72 * the ConnectionManager instance.</p> 73 * 74 * <p>The connectionRequestInfo parameter represents information specific 75 * to the resource adapter for handling of the connection request.</p> 76 * 77 * @param mcf 78 * used by application server to delegate 79 * connection matching/creation 80 * @param cxRequestInfo 81 * connection request Information 82 * 83 * @return connection handle with an EIS specific connection interface. 84 * 85 * 86 * @throws ResourceException Generic exception 87 * @throws ApplicationServerInternalException 88 * Application server specific exception 89 * @throws SecurityException Security related error 90 * @throws ResourceAllocationException 91 * Failed to allocate system resources for 92 * connection request 93 * @throws ResourceAdapterInternalException 94 * Resource adapter related error condition 95 **/ 96 public 97 Object allocateConnection(ManagedConnectionFactory mcf, 98 ConnectionRequestInfo cxRequestInfo) 99 throws ResourceException; 100 101 } 102