~ubuntu-branches/ubuntu/oneiric/ehcache/oneiric

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/transaction/manager/btm/EhCacheXAResourceHolder.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2010-06-23 10:35:31 UTC
  • mfrom: (1.1.5 upstream) (2.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100623103531-ra0qdpmotoz6ygct
Tags: 2.1.0-1
Merge changes from Thierry's PPA and upload to Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *  Copyright 2003-2010 Terracotta, Inc.
 
3
 *
 
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
 
5
 *  you may not use this file except in compliance with the License.
 
6
 *  You may obtain a copy of the License at
 
7
 *
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 *  Unless required by applicable law or agreed to in writing, software
 
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
 
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 *  See the License for the specific language governing permissions and
 
14
 *  limitations under the License.
 
15
 */
 
16
package net.sf.ehcache.transaction.manager.btm;
 
17
 
 
18
import bitronix.tm.resource.common.AbstractXAResourceHolder;
 
19
import bitronix.tm.resource.common.ResourceBean;
 
20
 
 
21
import javax.transaction.xa.XAResource;
 
22
import java.util.ArrayList;
 
23
import java.util.Date;
 
24
import java.util.List;
 
25
 
 
26
/**
 
27
 * EHCache implementation of BTM's XAResourceHolder
 
28
 *
 
29
 * @author lorban
 
30
 */
 
31
public class EhCacheXAResourceHolder extends AbstractXAResourceHolder {
 
32
 
 
33
    private final XAResource resource;
 
34
    private final ResourceBean bean;
 
35
 
 
36
    /**
 
37
     * Create a new EhCacheXAResourceHolder for a particular XAResource
 
38
     * @param resource the required XAResource
 
39
     * @param bean the required ResourceBean
 
40
     */
 
41
    public EhCacheXAResourceHolder(XAResource resource, ResourceBean bean) {
 
42
        this.resource = resource;
 
43
        this.bean = bean;
 
44
    }
 
45
 
 
46
    /**
 
47
     * {@inheritDoc}
 
48
     */
 
49
    public XAResource getXAResource() {
 
50
        return resource;
 
51
    }
 
52
 
 
53
    /**
 
54
     * Method is only there to remain compatible with pre-2.0.0 version of BTM
 
55
     * @return the ResourceBean associated with this Resource
 
56
     * @deprecated for compatibility with pre-2.0.0 version of BTM
 
57
     */
 
58
    @Deprecated
 
59
    public ResourceBean getResourceBean() {
 
60
        return bean;
 
61
    }
 
62
 
 
63
    /**
 
64
     * {@inheritDoc}
 
65
     */
 
66
    public void close() throws Exception {
 
67
        throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
 
68
    }
 
69
 
 
70
    /**
 
71
     * {@inheritDoc}
 
72
     */
 
73
    public Object getConnectionHandle() throws Exception {
 
74
        throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
 
75
    }
 
76
 
 
77
    /**
 
78
     * {@inheritDoc}
 
79
     */
 
80
    public Date getLastReleaseDate() {
 
81
        throw new UnsupportedOperationException("EhCacheXAResourceHolder cannot be used with an XAPool");
 
82
    }
 
83
 
 
84
    /**
 
85
     * {@inheritDoc}
 
86
     */
 
87
    public List getXAResourceHolders() {
 
88
        List xaResourceHolders = new ArrayList(1);
 
89
        xaResourceHolders.add(this);
 
90
        return xaResourceHolders;
 
91
    }
 
92
 
 
93
}