com.ptc.windchill.util
Class ModuleArtifact

java.lang.Object
  extended byjava.io.File
      extended bycom.ptc.windchill.util.ModuleArtifact
All Implemented Interfaces:
Comparable, Serializable
Direct Known Subclasses:
ClassArtifact, InstalledModuleArtifact

public class ModuleArtifact
extends File
implements Serializable

ModuleArtifact is a specialization of the File class defines an artifact according to a standard set of components. If the object is constructed with a null unit, it is considered to be a file for a module, therefore the qualified module name will be used as the name space for the file. If the object is constructed with a zero length string ("") unit, it is considered to be an empty package, so the qualified module name will NOT be used as the name space for the file. To construct an object that represents the directory for a type of artifact, the two argument constructor MUST be used.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private  String artifactDir
           
protected  ModuleArtifact artifactFile
           
private  String artifactName
           
private static String CLASSNAME
           
private  String fileExtension
           
private  String fileName
           
private  String moduleDir
           
protected  ModuleArtifact moduleFile
           
private  String moduleName
           
private static String RESOURCE
           
private  String unitDir
           
protected  ModuleArtifact unitFile
           
private  String unitName
           
private static char UNIX_SEPARATOR
           
static ModuleArtifact WINDCHILL_BIN
          Windchill install bin location.
static ModuleArtifact WINDCHILL_LOG
          Windchill install log file location.
static ModuleArtifact WINDCHILL_RB
          Windchill install resource bundle location.
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
protected ModuleArtifact(String file_name)
          Constructor to "wrap" File constructor.
  ModuleArtifact(String module, String artifact)
          Constructs a ModuleArtifact that represents the directory for a particular type of artifact.
  ModuleArtifact(String module, String artifact, String unit)
          Constructs a ModuleArtifact that represents the directory for a specific unit (module, subsystem, or package), for a particular type of artifact.
  ModuleArtifact(String artifact, String qualified_unit, String name, String extension)
          Constructs a ModuleArtifact that represents a specific file, for a particular type of artifact.
  ModuleArtifact(String module, String artifact, String unit, String name, String extension)
          Constructs a ModuleArtifact that represents a specific file, for a particular type of artifact.
 
Method Summary
protected static String buildFilePath(String module, String artifact)
           
protected static String buildFilePath(String module, String artifact, String unit, String name, String extension)
           
 String getArtifactDir()
          Gets the value of the attribute: artifactDir; The directory for the type of artifact, which is directly under the module's root directory.
 ModuleArtifact getArtifactFile()
          Gets the full path of the artifact location.
 String getArtifactName()
          Gets the value of the attribute: artifactName; The name of the artifact.
 String getFileExtension()
          Gets the value of the attribute: fileExtension; The extension of the file name.
 String getFileName()
          Gets the value of the attribute: fileName; The base name of the file.
 String getModuleDir()
          Gets the value of the attribute: moduleDir; The root directory for the module.
 ModuleArtifact getModuleFile()
          Gets the full path of the module location.
 String getModuleName()
          Gets the value of the attribute: moduleName; The name of the module.
 File getParentFile()
          Returns this ModuleArtifact's parent as a ModuleArtifact instance.
 String getQualifiedUnit()
          Module qualified Package, or Subsystem, name.
 String getRelativePath(File relative_to)
          Gets the portion of the path relative to the artifact location.
static String getRelativePath(File descendent, File ancestor)
          Gets the portion of the desendent path that is relative to the ancestor path.
static String getStandardPath(File file)
          Gets CanonicalPath, unless CanonicalPath resolves to a symbolically linked path, in which case it gets the AbsolutePath.
 String getUnitDir()
          Gets the value of the attribute: unitDir; The directory of the unit.
protected static String getUnitDir(String module, String artifactDir, String unqualifiedUnit)
           
 ModuleArtifact getUnitFile()
          Gets the full path of the unit location.
 String getUnitName()
          Gets the value of the attribute: unitName; The name of the package or subsystem unit.
private  void init(String module, String artifact)
           
protected  void initialize(String module, String artifact)
           
protected  void initialize(String module, String artifact, String unit, String name, String extension)
          Initialize the ModuleArtifact that represents a specific file, for a particular type of artifact.
static boolean isAncestor(File descendent, File ancestor)
          Determine if one path is an ancestor to another.
protected static boolean isModuleNameSpaced(String unit)
           
protected  ModuleArtifact newInstance(String module, String artifact)
          Construct new instance of this object.
protected  ModuleArtifact newInstance(String module, String artifact, String unit)
          Construct new instance of this object.
protected  ModuleArtifact newInstance(String module, String artifact, String unit, String file_name, String extension)
          Construct new instance of this object.
 ModuleArtifact setArtifactDir(String artifact_dir)
          

Supported API: false
 ModuleArtifact setFileExtension(String extension)
          

Supported API: false
 ModuleArtifact setFileName(String name)
          

Supported API: false
 ModuleArtifact setModuleDir(String module_dir)
          

Supported API: false
 ModuleArtifact setUnitDir(String unit_dir)
          

Supported API: false
protected static String unitDir(String unit)
           
protected static String unitDir(String module, String unit)
           
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getName, getParent, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

WINDCHILL_BIN

public static final ModuleArtifact WINDCHILL_BIN
Windchill install bin location.

Supported API: false


WINDCHILL_RB

public static final ModuleArtifact WINDCHILL_RB
Windchill install resource bundle location.

Supported API: false


WINDCHILL_LOG

public static final ModuleArtifact WINDCHILL_LOG
Windchill install log file location.

Supported API: false


moduleName

private String moduleName

artifactName

private String artifactName

unitName

private String unitName

moduleDir

private String moduleDir

artifactDir

private String artifactDir

unitDir

private String unitDir

fileName

private String fileName

fileExtension

private String fileExtension

UNIX_SEPARATOR

private static final char UNIX_SEPARATOR
See Also:
Constant Field Values

moduleFile

protected ModuleArtifact moduleFile

artifactFile

protected ModuleArtifact artifactFile

unitFile

protected ModuleArtifact unitFile
Constructor Detail

ModuleArtifact

public ModuleArtifact(String module,
                      String artifact)
Constructs a ModuleArtifact that represents the directory for a particular type of artifact.

Supported API: false

Parameters:
module -
artifact -

ModuleArtifact

public ModuleArtifact(String module,
                      String artifact,
                      String unit)
Constructs a ModuleArtifact that represents the directory for a specific unit (module, subsystem, or package), for a particular type of artifact. The unit argument is either a package ('.' separated) or a subsystem ('/' separated). Passing a package using File.separator syntax will not work! If the unit argument is an empty string, it is interpretted as a top-level package. If the unit argument is null, it is interpretted as a module file, and the qualified module name will be used as a name space. A module name space is also applied to subsystems.

Supported API: false

Parameters:
module -
artifact -
unit -

ModuleArtifact

public ModuleArtifact(String module,
                      String artifact,
                      String unit,
                      String name,
                      String extension)
Constructs a ModuleArtifact that represents a specific file, for a particular type of artifact. The unit argument is either a package ('.' separated) or a subsystem ('/' separated). Passing a package using File.separator syntax will not work! If the unit argument is an empty string, it is interpretted as a top-level package. If the unit argument is null, it is interpretted as a module file, and the qualified module name will be used as a name space for the file. A module name space is also applied to subsystem files.

Supported API: false

Parameters:
module -
artifact -
unit -
name -
extension -

ModuleArtifact

public ModuleArtifact(String artifact,
                      String qualified_unit,
                      String name,
                      String extension)
Constructs a ModuleArtifact that represents a specific file, for a particular type of artifact. The unit argument is either a package ('.' separated) or a subsystem ('/' separated). Passing a package using File.separator syntax will not work! If the unit argument is an empty string, it is interpretted as a top-level package. If the unit argument is null, it is interpretted as a module file, and the qualified module name will be used as a name space for the file. A module name space is also applied to subsystem files.

Supported API: false

Parameters:
artifact -
qualified_unit -
name -
extension -

ModuleArtifact

protected ModuleArtifact(String file_name)
Constructor to "wrap" File constructor.

Method Detail

getModuleName

public String getModuleName()
Gets the value of the attribute: moduleName; The name of the module.

Supported API: false

Returns:
String

getArtifactName

public String getArtifactName()
Gets the value of the attribute: artifactName; The name of the artifact.

Supported API: false

Returns:
String

getUnitName

public String getUnitName()
Gets the value of the attribute: unitName; The name of the package or subsystem unit. Packages contain '.' separators and Subsystems contain '/' separators.

Supported API: false

Returns:
String

getModuleDir

public String getModuleDir()
Gets the value of the attribute: moduleDir; The root directory for the module.

Supported API: false

Returns:
String

getArtifactDir

public String getArtifactDir()
Gets the value of the attribute: artifactDir; The directory for the type of artifact, which is directly under the module's root directory.

Supported API: false

Returns:
String

getUnitDir

public String getUnitDir()
Gets the value of the attribute: unitDir; The directory of the unit.

Supported API: false

Returns:
String

getFileName

public String getFileName()
Gets the value of the attribute: fileName; The base name of the file.

Supported API: false

Returns:
String

getFileExtension

public String getFileExtension()
Gets the value of the attribute: fileExtension; The extension of the file name.

Supported API: false

Returns:
String

getQualifiedUnit

public String getQualifiedUnit()
Module qualified Package, or Subsystem, name.

Supported API: false

Returns:
String

getRelativePath

public String getRelativePath(File relative_to)
Gets the portion of the path relative to the artifact location.

Supported API: false

Parameters:
relative_to -
Returns:
String

getParentFile

public File getParentFile()
Returns this ModuleArtifact's parent as a ModuleArtifact instance.

Supported API: false

Returns:
File

getModuleFile

public ModuleArtifact getModuleFile()
Gets the full path of the module location.

Supported API: false

Returns:
ModuleArtifact

getArtifactFile

public ModuleArtifact getArtifactFile()
Gets the full path of the artifact location.

Supported API: false

Returns:
ModuleArtifact

getUnitFile

public ModuleArtifact getUnitFile()
Gets the full path of the unit location.

Supported API: false

Returns:
ModuleArtifact

setModuleDir

public ModuleArtifact setModuleDir(String module_dir)


Supported API: false

Parameters:
module_dir -
Returns:
ModuleArtifact

setUnitDir

public ModuleArtifact setUnitDir(String unit_dir)


Supported API: false

Parameters:
unit_dir -
Returns:
ModuleArtifact

setArtifactDir

public ModuleArtifact setArtifactDir(String artifact_dir)


Supported API: false

Parameters:
artifact_dir -
Returns:
ModuleArtifact

setFileName

public ModuleArtifact setFileName(String name)


Supported API: false

Parameters:
name -
Returns:
ModuleArtifact

setFileExtension

public ModuleArtifact setFileExtension(String extension)


Supported API: false

Parameters:
extension -
Returns:
ModuleArtifact

isAncestor

public static boolean isAncestor(File descendent,
                                 File ancestor)
Determine if one path is an ancestor to another. For example: x:/Windchill/src is an ancestor to x:/Windchill/src/wt/fc

Supported API: false

Parameters:
descendent -
ancestor -
Returns:
boolean

getRelativePath

public static String getRelativePath(File descendent,
                                     File ancestor)
Gets the portion of the desendent path that is relative to the ancestor path.

Supported API: false

Parameters:
descendent -
ancestor -
Returns:
String

getStandardPath

public static String getStandardPath(File file)
Gets CanonicalPath, unless CanonicalPath resolves to a symbolically linked path, in which case it gets the AbsolutePath.

Supported API: false

Parameters:
file -
Returns:
String path

newInstance

protected ModuleArtifact newInstance(String module,
                                     String artifact)
Construct new instance of this object.


newInstance

protected ModuleArtifact newInstance(String module,
                                     String artifact,
                                     String unit)
Construct new instance of this object.


newInstance

protected ModuleArtifact newInstance(String module,
                                     String artifact,
                                     String unit,
                                     String file_name,
                                     String extension)
Construct new instance of this object.


initialize

protected void initialize(String module,
                          String artifact,
                          String unit,
                          String name,
                          String extension)
Initialize the ModuleArtifact that represents a specific file, for a particular type of artifact. The unit argument is either a package ('.' separated) or a subsystem ('/' separated). Passing a package using File.separator syntax will not work! If the unit argument is an empty string, it is interpretted as a top-level package. If the unit argument is null, it is interpretted as a module file, and the qualified module name will be used as a name space for the file. A module name space is also applied to subsystem files.


init

private void init(String module,
                  String artifact)

initialize

protected void initialize(String module,
                          String artifact)

buildFilePath

protected static String buildFilePath(String module,
                                      String artifact)

buildFilePath

protected static String buildFilePath(String module,
                                      String artifact,
                                      String unit,
                                      String name,
                                      String extension)

getUnitDir

protected static String getUnitDir(String module,
                                   String artifactDir,
                                   String unqualifiedUnit)

unitDir

protected static String unitDir(String module,
                                String unit)

unitDir

protected static String unitDir(String unit)

isModuleNameSpaced

protected static boolean isModuleNameSpaced(String unit)