01: /**
02: *
03: * Copyright 2006 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.naming.reference;
17:
18: import org.apache.geronimo.kernel.Kernel;
19:
20: import javax.naming.NameNotFoundException;
21: import javax.naming.NamingException;
22: import javax.transaction.UserTransaction;
23:
24: /**
25: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
26: */
27: public class UserTransactionReference extends SimpleAwareReference {
28: public String getClassName() {
29: return UserTransaction.class.getName();
30: }
31:
32: public Object getContent() throws NamingException {
33: Kernel kernel = getKernel();
34: try {
35: return kernel.getGBean(UserTransaction.class);
36: } catch (Exception e) {
37: throw (NameNotFoundException) new NameNotFoundException(
38: "Error getting UserTransaction from kernel")
39: .initCause(e);
40: }
41: }
42: }
|