001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.transaction.manager;
019
020 import javax.transaction.xa.XAResource;
021 import javax.transaction.xa.Xid;
022 import javax.transaction.xa.XAException;
023
024 import org.apache.geronimo.transaction.manager.NamedXAResource;
025
026 /**
027 *
028 *
029 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
030 *
031 * */
032 public class WrapperNamedXAResource implements NamedXAResource {
033
034 private final XAResource xaResource;
035 private final String name;
036
037 public WrapperNamedXAResource(XAResource xaResource, String name) {
038 this.xaResource = xaResource;
039 this.name = name;
040 }
041
042 public String getName() {
043 return name;
044 }
045
046 public void commit(Xid xid, boolean onePhase) throws XAException {
047 xaResource.commit(xid, onePhase);
048 }
049
050 public void end(Xid xid, int flags) throws XAException {
051 xaResource.end(xid, flags);
052 }
053
054 public void forget(Xid xid) throws XAException {
055 xaResource.forget(xid);
056 }
057
058 public int getTransactionTimeout() throws XAException {
059 return xaResource.getTransactionTimeout();
060 }
061
062 public boolean isSameRM(XAResource other) throws XAException {
063 if (other instanceof WrapperNamedXAResource) {
064 return xaResource.isSameRM(((WrapperNamedXAResource)other).xaResource);
065 }
066 return false;
067 }
068
069 public int prepare(Xid xid) throws XAException {
070 return xaResource.prepare(xid);
071 }
072
073 public Xid[] recover(int flag) throws XAException {
074 return xaResource.recover(flag);
075 }
076
077 public void rollback(Xid xid) throws XAException {
078 xaResource.rollback(xid);
079 }
080
081 public boolean setTransactionTimeout(int seconds) throws XAException {
082 return xaResource.setTransactionTimeout(seconds);
083 }
084
085 public void start(Xid xid, int flags) throws XAException {
086 xaResource.start(xid, flags);
087 }
088 }
089
090