com.ptc.windchill.structconf.xconf
Class Paths

java.lang.Object
  extended bycom.ptc.windchill.structconf.xconf.Paths

public class Paths
extends Object

Utility class for easily looking up standard paths. This class maintains a global default and thread local settings. Therefore, long running servers can use this class and still allow for thread-specific changes to paths.

Before using static getter methods, make sure that you have called Paths.initThreadLocal(product_root_directory); if you only care about thread local settings or Paths.init(product_root_directory, true) if you want to set a process global default value.

See Also:
initThreadLocal(java.io.File), init(java.io.File,boolean)

Field Summary
private static File defaultProductRootDirectory__
           
private static File defaultTargetRootdirectory__
           
private static InheritableThreadLocal productRootDirectory__
           
private static InheritableThreadLocal targetRootdirectory__
           
 
Constructor Summary
Paths()
           
 
Method Summary
static File getProductRootDirectory()
          Return the product root directory.
static File getTargetRootDirectory()
          Return the root directory into which derived file may be written.
static void init(File product_root_directory, boolean change_global_default)
          Initialize the product root directory.
static void initThreadLocal(File product_root_directory)
          This is the equivalent of init(product_root_directory, false).
static String relativizePathToProductRoot(File path)
           
static String relativizePathToTargetRoot(File path)
           
private static void throwNotInitialized()
          Determine if the product root directory has been initialized yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultProductRootDirectory__

private static File defaultProductRootDirectory__

defaultTargetRootdirectory__

private static File defaultTargetRootdirectory__

productRootDirectory__

private static final InheritableThreadLocal productRootDirectory__

targetRootdirectory__

private static final InheritableThreadLocal targetRootdirectory__
Constructor Detail

Paths

public Paths()
Method Detail

initThreadLocal

public static void initThreadLocal(File product_root_directory)
This is the equivalent of init(product_root_directory, false).

See Also:
init(java.io.File,boolean)

init

public static void init(File product_root_directory,
                        boolean change_global_default)
Initialize the product root directory. All other directories are derived from this directory. You must call this method on this class before using getters.

Parameters:
change_global_default - if true changes the thread local setting as well as the global default

throwNotInitialized

private static void throwNotInitialized()
Determine if the product root directory has been initialized yet.


getProductRootDirectory

public static File getProductRootDirectory()
Return the product root directory.

Returns:
a non-null file
Throws:
RuntimeException - if init has not been called.
See Also:
initThreadLocal(java.io.File), init(java.io.File,boolean)

getTargetRootDirectory

public static File getTargetRootDirectory()
Return the root directory into which derived file may be written.

Returns:
a non-null file
Throws:
RuntimeException - if init has not been called.
See Also:
initThreadLocal(java.io.File), init(java.io.File,boolean)

relativizePathToTargetRoot

public static String relativizePathToTargetRoot(File path)

relativizePathToProductRoot

public static String relativizePathToProductRoot(File path)