KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > connectors > inflow > BasicResourceAllocator


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.connectors.inflow;
24
25 import com.sun.enterprise.resource.PoolingException;
26 import com.sun.enterprise.resource.AbstractConnectorAllocator;
27 import com.sun.enterprise.resource.ResourceAllocator;
28 import com.sun.enterprise.resource.ResourceHandle;
29 import com.sun.enterprise.resource.ResourceSpec;
30 import com.sun.enterprise.resource.XAResourceWrapper;
31 import com.sun.logging.LogDomains;
32
33 import java.util.Set JavaDoc;
34 import java.util.logging.Level JavaDoc;
35 import java.util.logging.Logger JavaDoc;
36
37 import javax.resource.ResourceException JavaDoc;
38 import javax.transaction.xa.XAResource JavaDoc;
39
40 public class BasicResourceAllocator extends AbstractConnectorAllocator {
41
42     private static Logger JavaDoc logger =
43     LogDomains.getLogger(LogDomains.RSR_LOGGER);
44
45     private static final String JavaDoc JMS_RESOURCE_FACTORY = "JMS";
46
47     public BasicResourceAllocator () {}
48
49     public ResourceHandle createResource()
50         throws PoolingException {
51         throw new UnsupportedOperationException JavaDoc();
52     }
53
54     public ResourceHandle createResource(XAResource JavaDoc xaResource)
55          throws PoolingException {
56
57         ResourceHandle resourceHandle = null;
58         ResourceSpec spec =
59                 new ResourceSpec(JMS_RESOURCE_FACTORY,
60                                  ResourceSpec.JMS);
61         
62         if (xaResource != null) {
63             
64             logger.logp(Level.FINEST,
65                     "BasicResourceAllocator", "createResource",
66                     "NOT NULL", xaResource);
67             
68             try {
69                 resourceHandle = new ResourceHandle(
70                         null, //no object present
71
spec,
72                         this, null);
73                 
74                 if (logger.isLoggable(Level.FINEST)) {
75                     xaResource = new XAResourceWrapper(xaResource);
76                 }
77                     
78                 resourceHandle.fillInResourceObjects(null, xaResource);
79
80             } catch (Exception JavaDoc e) {
81                 throw (PoolingException) (new PoolingException()).initCause(e);
82             }
83         } else {
84             logger.logp(Level.FINEST,
85                     "BasicResourceAllocator", "createResource",
86                     "NULL", xaResource);
87         }
88
89         return resourceHandle;
90     }
91     
92
93     public void closeUserConnection(ResourceHandle resourceHandle)
94         throws PoolingException {
95         throw new UnsupportedOperationException JavaDoc();
96     }
97
98
99     public boolean matchConnection(ResourceHandle resourceHandle) {
100         return false;
101     }
102
103     public boolean supportsReauthentication() {
104         return false;
105     }
106
107     public void cleanup(ResourceHandle resourceHandle)
108         throws PoolingException {
109         throw new UnsupportedOperationException JavaDoc();
110     }
111
112     public Set JavaDoc getInvalidConnections(Set JavaDoc connectionSet) throws ResourceException JavaDoc {
113         throw new UnsupportedOperationException JavaDoc();
114     }
115
116     public boolean isConnectionValid( ResourceHandle resource ) {
117         throw new UnsupportedOperationException JavaDoc();
118     }
119
120 }
121
Popular Tags