extensions/net.sf.basedb.hdfs/trunk/src/net/sf/basedb/hdfs/Hdfs.java

Code
Comments
Other
Rev Date Author Line
1330 01 Apr 11 nicklas 1 /**
1330 01 Apr 11 nicklas 2   $Id$
1330 01 Apr 11 nicklas 3
1330 01 Apr 11 nicklas 4   Copyright (C) 2011 Nicklas Nordborg
1330 01 Apr 11 nicklas 5
1330 01 Apr 11 nicklas 6   This file is part of BASE - BioArray Software Environment.
1330 01 Apr 11 nicklas 7   Available at http://base.thep.lu.se/
1330 01 Apr 11 nicklas 8
1330 01 Apr 11 nicklas 9   BASE is free software; you can redistribute it and/or
1330 01 Apr 11 nicklas 10   modify it under the terms of the GNU General Public License
1330 01 Apr 11 nicklas 11   as published by the Free Software Foundation; either version 3
1330 01 Apr 11 nicklas 12   of the License, or (at your option) any later version.
1330 01 Apr 11 nicklas 13
1330 01 Apr 11 nicklas 14   BASE is distributed in the hope that it will be useful,
1330 01 Apr 11 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
1330 01 Apr 11 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1330 01 Apr 11 nicklas 17   GNU General Public License for more details.
1330 01 Apr 11 nicklas 18
1330 01 Apr 11 nicklas 19   You should have received a copy of the GNU General Public License
1330 01 Apr 11 nicklas 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
1330 01 Apr 11 nicklas 21 */
1330 01 Apr 11 nicklas 22 package net.sf.basedb.hdfs;
1330 01 Apr 11 nicklas 23
1330 01 Apr 11 nicklas 24 /**
1330 01 Apr 11 nicklas 25   Global constants for the Hdfs package.
1330 01 Apr 11 nicklas 26   @author Nicklas
1330 01 Apr 11 nicklas 27   @since 1.0
1330 01 Apr 11 nicklas 28 */
1330 01 Apr 11 nicklas 29 public class Hdfs 
1330 01 Apr 11 nicklas 30 {
1330 01 Apr 11 nicklas 31   /**
1330 01 Apr 11 nicklas 32     The current version of this package.
1330 01 Apr 11 nicklas 33   */
1453 03 Nov 11 nicklas 34   public static final String VERSION = "1.1-dev";
1330 01 Apr 11 nicklas 35
1330 01 Apr 11 nicklas 36   /**
1330 01 Apr 11 nicklas 37     Set the currents thread's context class loader to the
1330 01 Apr 11 nicklas 38     class loader that loaded this class. The class loader that
1330 01 Apr 11 nicklas 39     is currently the context class loader is returned and can be
1330 01 Apr 11 nicklas 40     restored by calling {@link #resetContextClassLoader(ClassLoader)}.
1330 01 Apr 11 nicklas 41     <p>
1330 01 Apr 11 nicklas 42
1330 01 Apr 11 nicklas 43     NOTE! Calls to this method must be paired with calls to 
1330 01 Apr 11 nicklas 44     {@link #resetContextClassLoader()} or class loading schemes
1330 01 Apr 11 nicklas 45     may be messed up.
1330 01 Apr 11 nicklas 46     @return The old class loader that was the context class loader
1330 01 Apr 11 nicklas 47   */
1330 01 Apr 11 nicklas 48   public static final ClassLoader setContextClassLoader()
1330 01 Apr 11 nicklas 49   {
1330 01 Apr 11 nicklas 50     Thread current = Thread.currentThread();
1330 01 Apr 11 nicklas 51     ClassLoader old = current.getContextClassLoader();
1330 01 Apr 11 nicklas 52     current.setContextClassLoader(Hdfs.class.getClassLoader());
1330 01 Apr 11 nicklas 53     return old;
1330 01 Apr 11 nicklas 54   }
1330 01 Apr 11 nicklas 55   
1330 01 Apr 11 nicklas 56   /**
1330 01 Apr 11 nicklas 57     Reset the currents thread's context class loader to
1330 01 Apr 11 nicklas 58     the class loader that was stored when {@link #setContextClassLoader()}
1330 01 Apr 11 nicklas 59     was called.
1330 01 Apr 11 nicklas 60     <p>
1330 01 Apr 11 nicklas 61     
1330 01 Apr 11 nicklas 62     NOTE! Calls to this method must be paired with calls to 
1330 01 Apr 11 nicklas 63     {@link #setContextClassLoader()} or class loading schemes
1330 01 Apr 11 nicklas 64     may be messed up.
1330 01 Apr 11 nicklas 65   */
1330 01 Apr 11 nicklas 66   public static final void resetContextClassLoader(ClassLoader old)
1330 01 Apr 11 nicklas 67   {
1330 01 Apr 11 nicklas 68     Thread.currentThread().setContextClassLoader(old);
1330 01 Apr 11 nicklas 69   }
1330 01 Apr 11 nicklas 70   
1330 01 Apr 11 nicklas 71 }