KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > PoolManager


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 package com.sun.enterprise;
24
25 import java.util.Vector JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.util.Properties JavaDoc;
28 import java.util.concurrent.ConcurrentHashMap JavaDoc;
29 import java.security.Principal JavaDoc;
30 import javax.transaction.Transaction JavaDoc;
31 import javax.sql.XAConnection JavaDoc;
32 import com.sun.enterprise.resource.*;
33 import com.sun.enterprise.deployment.ResourceReferenceDescriptor;
34 import com.sun.enterprise.deployment.ConnectorDescriptor;
35 import javax.security.auth.Subject JavaDoc;
36 import javax.transaction.xa.Xid JavaDoc;
37 import javax.naming.Reference JavaDoc;
38 import javax.resource.spi.ManagedConnection JavaDoc;
39 import javax.resource.ResourceException JavaDoc;
40
41 import com.sun.enterprise.connectors.ConnectorConnectionPool;
42 import com.sun.enterprise.connectors.ConnectorConstants.PoolType;
43
44 /**
45  *
46  * PoolManager manages resource connections such as JDBC connections
47  *
48  */

49 public interface PoolManager {
50
51     // transaction support levels
52
static public final int NO_TRANSACTION = 0;
53     static public final int LOCAL_TRANSACTION = 1;
54     static public final int XA_TRANSACTION = 2;
55
56     // Authentication mechanism levels
57
static public final int BASIC_PASSWORD = 0;
58     static public final int KERBV5 = 1;
59
60     // Credential Interest levels
61
static public final String JavaDoc PASSWORD_CREDENTIAL = "javax.resource.spi.security.PasswordCredential";
62     static public final String JavaDoc GENERIC_CREDENTIAL = "javax.resource.spi.security.GenericCredential";
63
64     /**
65      * Obtain a transactional resource such as JDBC connection
66      *
67      * @param spec Specification for the resource
68      * @param alloc Allocator for the resource
69      * @param info Client security for this request
70      *
71      * @return An object that represents a connection to the resource
72      *
73      * @exception ResourceReferenceException Thrown if some error occurs while
74      * obtaining the resource
75      */

76     Object JavaDoc getResource(ResourceSpec spec, ResourceAllocator alloc,
77                        ClientSecurityInfo info)
78         throws PoolingException;
79
80     ResourceReferenceDescriptor
81         getResourceReference(String JavaDoc jndiName);
82
83     void resourceEnlisted(Transaction JavaDoc tran, ResourceHandle res)
84          throws IllegalStateException JavaDoc;
85
86     void resourceClosed(ResourceHandle res);
87
88     void resourceErrorOccurred(ResourceHandle res);
89
90     void transactionCompleted(Transaction JavaDoc tran, int status);
91
92     public void putbackResourceToPool(ResourceHandle h,
93                                       boolean errorOccurred);
94
95     public void putbackDirectToPool(ResourceHandle h, String JavaDoc poolName);
96
97     public ResourceHandle getResourceFromPool(ResourceSpec spec,
98                                               ResourceAllocator alloc,
99                                               ClientSecurityInfo info,
100                                               Transaction JavaDoc tran)
101         throws PoolingException;
102
103     public void registerResource(ResourceHandle resource)
104         throws PoolingException;
105
106     public void unregisterResource(ResourceHandle resource,
107                                    int xaresFlag);
108
109     public void emptyResourcePool(ResourceSpec spec);
110
111     public void killPool( String JavaDoc poolName );
112
113     public void reconfigPoolProperties( ConnectorConnectionPool ccp )
114             throws PoolingException;
115
116     //sets/resets the monitoring levels for the pool
117
public void disableMonitoring( String JavaDoc poolName);
118     public void setMonitoringEnabledHigh( String JavaDoc poolName);
119     public void setMonitoringEnabledLow( String JavaDoc poolName);
120     
121     //get the pooltable
122
public ConcurrentHashMap JavaDoc getPoolTable();
123
124     //register the MonitoringLevelListeners
125
public void initializeMonitoring();
126
127     public boolean switchOnMatching(String JavaDoc poolName);
128
129     public void killAllPools();
130
131     public void killFreeConnectionsInPools();
132
133     public void createEmptyConnectionPool(String JavaDoc name,
134         PoolType pt) throws PoolingException;
135
136     public ResourcePool getPool( String JavaDoc poolName );
137
138     public void setSelfManaged( String JavaDoc poolName, boolean flag );
139
140     public void lazyEnlist( ManagedConnection JavaDoc mc ) throws ResourceException JavaDoc;
141
142     public void postInvoke();
143 }
144
145
Popular Tags