com.ptc.windchill.util
Class ArtifactDir

java.lang.Object
  extended bycom.ptc.windchill.util.ArtifactDir
All Implemented Interfaces:
Serializable

public class ArtifactDir
extends Object
implements Serializable

Artifacts are persistable files, such as: source files; class files; scripts for creating the database; model data (mdata) files; and so forth. This class represents the types of artifacts known to the system, and provides methods for finding the directorys in which those artifacts reside. The types of artifacts are represented in this class by static strings, such as ArtifactDir.BIN, ArtifactDir.SRC, etc. These strings are immutable. Each type of artifact resides under a specified sudirectory of the root directory for the module in which it is defined. The module root locations are defined by properties; for example, the location of a module named ModuleA is specified by a property named "ModuleA.dir". The subdirectory for a given artifact type, Aritfact.XXX, is defined by a property generally of the form "wt.xxx.dir". See the source code for details. Within the subdirectory for the artifact type, artifacts are further organized in a directory structure which mirrors the module's package structure (see ModuleArtifact class for details). Two static methods are provided for determining the directory for an artifact type: artifactDir (String, boolean, String), which returns the fully qualified path of the directory; and subDirectoryForArtifact (String), which returns only the name of the subdirectory containing the artifact type. Note, artifactDir() is the preferred method for locating artifacts of a specific module. It includes additional behavior for the "default module". The class initializer loads three Hashtables used for determining the subdirectory assigned for an artifact: artifactDirs, loaded from properties of the form "wt.xxx.dir" as discussed above; oldArtifacts, loaded from properties of the form "wt.generation.yyy.dir" used for the default module (retained to support developers of earlier Windchill versions); and defaults, loaded with default values to be used in the event that the subdirectory cannot be resolved by the other tables.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static Hashtable artifactDirs
           
static String BIN
          

Supported API: false
static String CACHE
          

Supported API: false
private static String CLASSNAME
           
static String CUSTOM
          

Supported API: false
static String DB
          

Supported API: false
private static Hashtable defaults
           
static String GEN
          

Supported API: false
static String LOG
          

Supported API: false
static String MDATA
          

Supported API: false
private static Hashtable oldArtifacts
           
static String RB
          

Supported API: false
static String RBI
          

Supported API: false
private static String RESOURCE
           
static String SQL
           
static String SRC
          

Supported API: false
 
Constructor Summary
ArtifactDir()
           
 
Method Summary
static String artifactDir(String moduleDir, boolean isDefaultModule, String artifactType)
          Given the type of artifact, returns the directory which contains artifacts of that type.
protected static boolean isEmpty(String string)
           
protected static void setArtifactDir(String artifactType, String theValue)
           
protected static void setDefault(String artifactType, String theValue)
           
protected static void setOldArtifact(String artifactType, String theValue)
           
static String subDirForArtifact(String artifactType)
          

Supported API: false
static String subDirForOldArtifact(String artifactType)
          

Supported API: false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

BIN

public static final String BIN


Supported API: false


SRC

public static final String SRC


Supported API: false


GEN

public static final String GEN


Supported API: false


RBI

public static final String RBI


Supported API: false


RB

public static final String RB


Supported API: false


MDATA

public static final String MDATA


Supported API: false


DB

public static final String DB


Supported API: false


CUSTOM

public static final String CUSTOM


Supported API: false


LOG

public static final String LOG


Supported API: false


CACHE

public static final String CACHE


Supported API: false


SQL

public static final String SQL

artifactDirs

private static Hashtable artifactDirs

oldArtifacts

private static Hashtable oldArtifacts

defaults

private static Hashtable defaults
Constructor Detail

ArtifactDir

public ArtifactDir()
Method Detail

artifactDir

public static String artifactDir(String moduleDir,
                                 boolean isDefaultModule,
                                 String artifactType)
Given the type of artifact, returns the directory which contains artifacts of that type. This is determined by a properties lookup, allowing for user configuration. For example, artifacts of type ArtifactDir.SRC ("src") are by default located in the "src" subdirectory. but by setting the property wt.src.dir="mySource", the user specifies that artifacts of this type are instead found in the "mySource" subdirectory. The algorithm for this function is as follows: 1. If isDefaultModule=true and the "old" property for the artifactType was found, return its value (from oldArtifacts hashtable). 2. If !isDefaultModule and the "new" property for the type was found (in artifactDirs hashtable), return moduleDir + File.separator + hashtable value. 3. If a "default" value for the artifactType is found (in defaults hashtable), return moduleDir + File.separator + hashtable value. 4. Otherwise, return moduleDir + File.separator + artifactType. The artifactTypes are: ArtifactDir.BIN = "bin" ArtifactDir.SRC= "src" ArtifactDir.GEN = "gen" ArtifactDir.RBI = "rbi" ArtifactDir.RB = "rb" ArtifactDir.MDATA = "mData" ArtifactDir.SQL = "sql" ArtifactDir.SQL_SERVER_DIR = "sqlServer" ArtifactDir.ORACLE_SQL_DIR = "oracle" ArtifactDir.CUSTOM = "custom" ArtifactDir.LOG = "logs" ArtifactDir.CACHE = "cache" The artifactDirs hashtable is initialized as follows: ArtifactDir.BIN : property("wt.bin.dir") ArtifactDir.SRC : property("wt.source.dir") ArtifactDir.GEN : property("wt.gen.dir") ArtifactDir.RBI : property( "wt.rb.source.dir") ArtifactDir.RB : property( "wt.rb.bin.dir") ArtifactDir.MDATA : property( "wt.mData.dir") ArtifactDir.SQL : property( "wt.sql.dir") ArtifactDir.SQL_SERVER_DIR : property("wt.sql_server.dir" ArtifactDir.ORACLE_SQL_DIR : property( "wt.sql.dir") ArtifactDir.CUSTOM : property( "wt.custom.dir") ArtifactDir.LOG : "logs" ArtifactDir.CACHE : "cache" The oldArtifacts hashtable is initialized: ArtifactDir.BIN : property("wt.generation.bin.dir") ArtifactDir.SRC : property("wt.generation.source.dir") ArtifactDir.GEN : property("wt.generation.gen.dir") ArtifactDir.RBI : property( "wt.resource.source.dir") ArtifactDir.RB : property("wt.resource.bin.dir") ArtifactDir.MDATA : property( "wt.generation.source.dir") ArtifactDir.SQL : property("wt.generation.sql.dir") ArtifactDir.SQL_SERVER_DIR : property("wt.generation.sqlServer.dir") ArtifactDir.ORACLE_SQL_DIR : property("wt.generation.sql.dir") ArtifactDir.CUSTOM : property( "wt.generationcustom.dir") The defaults hashtable is initialized: ArtifactDir.BIN : "codebase" ArtifactDir.SRC : "src" ArtifactDir.GEN : "gen" ArtifactDir.RBI : "src" ArtifactDir.RB : "codebase" ArtifactDir.MDATA : "src" ArtifactDir.SQL : "db" + File.separator + "sql" ArtifactDir.SQL_SERVER_DIR : "db" + File.separator + "sqlServer" ArtifactDir.ORACLE_SQL_DIR : "db" + File.separator + "sql" ArtifactDir.CUSTOM : "wtCustom" ArtifactDir.LOG : "logs" ArtifactDir.CACHE : "cache"

Supported API: false

Parameters:
moduleDir -
isDefaultModule -
artifactType -
Returns:
String

subDirForArtifact

public static String subDirForArtifact(String artifactType)


Supported API: false

Parameters:
artifactType -
Returns:
String

subDirForOldArtifact

public static String subDirForOldArtifact(String artifactType)


Supported API: false

Parameters:
artifactType -
Returns:
String

setArtifactDir

protected static void setArtifactDir(String artifactType,
                                     String theValue)

setOldArtifact

protected static void setOldArtifact(String artifactType,
                                     String theValue)

setDefault

protected static void setDefault(String artifactType,
                                 String theValue)

isEmpty

protected static boolean isEmpty(String string)