KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > distrans > JOTMHelper


1 /*
2   Copyright (C) 2001-2003 Lionel Seinturier <Lionel.Seinturier@lip6.fr>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.distrans;
19
20 import javax.naming.NamingException JavaDoc;
21
22 import org.objectweb.jotm.Jotm;
23 import org.objectweb.jotm.TraceTm;
24
25 /**
26  * Helper class used to retrieve the JOTM singleton instance
27  * used by JAC.
28  *
29  * @author Lionel Seinturier <Lionel.Seinturier@lip6.fr>
30  * @version 1.0
31  */

32 public class JOTMHelper {
33
34     /** The singleton instance of JOTM. */
35     private static Jotm jotm;
36
37     public static Jotm get() {
38         
39         if ( jotm != null )
40             return jotm;
41         
42         /**
43          * Creates an instance of JOTM with a local transaction factory
44          * which is not bound to a registry.
45          */

46         try {
47             jotm = new Jotm(true,false);
48         } catch (NamingException JavaDoc ne) {
49             ne.printStackTrace();
50             System.exit(1);
51         }
52         TraceTm.configure();
53         
54         return jotm;
55     }
56
57 }
58
Popular Tags