View Javadoc

1   /*
2    * Copyright (c) 2004 Peter Antman, Mogul  <peter.antman@mogul.com>
3    *
4    * $Id: UtilsConfig.java,v 1.1.1.1 2004/05/19 12:07:31 pra Exp $
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 2 of the License, or (at your option) any later version
10   * 
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  package org.backsource.utils.xml;
21  /***
22   * UtilsConfig.java
23   *
24   *
25   * Created: Fri Apr 23 10:05:04 2004
26   *
27   * @author <a href="mailto:pra@mogul.com">Peter Antman</a>
28   * @version $Revision: 1.1.1.1 $
29   */
30  
31  public class UtilsConfig {
32     private static ThreadLocal threadLocal = null;
33     
34     boolean namespaceAware = false;
35     public UtilsConfig (){   
36     }
37     public void setNamespaceAware(boolean aware) {
38        this.namespaceAware = aware;
39     }
40     public boolean isNamespaceAware() {
41        return namespaceAware;
42     }
43  
44     public static synchronized void setContextConfig(UtilsConfig conf) {
45  	if (threadLocal == null)
46  	    threadLocal = new ThreadLocal();
47  
48  	threadLocal.set(conf);
49     }
50  
51     public static synchronized UtilsConfig getContextConfig() {
52        UtilsConfig c = null;
53        if (threadLocal != null) {
54           c = (UtilsConfig)threadLocal.get();
55        }
56        return c;
57     }
58  }// UtilsConfig