com.ptc.windchill.util
Class UnitIdentifierUtil

java.lang.Object
  extended bycom.ptc.windchill.util.UnitIdentifierUtil

public class UnitIdentifierUtil
extends Object


Field Summary
static char ASSEMBLY_SEPARATOR
          

Supported API: true
private static String CLASSNAME
           
static char MODULE_SEPARATOR
          

Supported API: true
static char PACKAGE_SEPARATOR
          

Supported API: true
private static String[] PACKAGE_UNITS
           
static char SUBSYSTEM_SEPARATOR
          

Supported API: true
 
Constructor Summary
UnitIdentifierUtil()
           
 
Method Summary
private static String concatenateNames(String name1, String name2, char delimeter)
           
static String getBaseUnitName(String identifier)
          Gets the base unit name from a unit identifier.
static String getModuleName(String identifier)
          Gets the module name from a unit identifier.
static String getModuleQualifiedName(String module_name, String unit_name)
          Gets the module qualified unit identifier, given a module name and a unit name.
static String getModuleQualifiedName(String module_name, String sub_name, String pkg_name)
          Gets the module qualified unit identifier, given a module name, subsystem name and and unit name.
static String getPackageName(String identifier)
          Gets the package name from a unit identifier.
static String getSubsystemName(String identifier)
          Gets the subsystem name from a unit identifier.
static String getUnitName(String identifier)
          Gets the unit name from a unit identifier- i.e., strip off the module qualification.
private static String getUnitName(String sub_name, String pkg_name)
           
static boolean isClassTarget(String target)
          Determine if target represents a class.
static boolean isFileTarget(String target)
          Determine if the target represents a file that lists the actual targets.
static boolean isModuleIdentifier(String identifier)
          Determine if identifier represents a module.
static boolean isModuleQualified(String identifier)
          Determine if identifier is module qualified (really a unit identifier).
static boolean isModuleTarget(String target)
          Determine if target represents a module.
static boolean isPackageIdentifier(String identifier)
          Determine if identifier represents a module.
protected static boolean isPackageQualified(String identifier)
          Determine if identifier is package qualified.
static boolean isPackageTarget(String target)
          Determine if target represents a package.
static boolean isRegistryTarget(String target)
          Determine if the target represents the entire registry.
static boolean isSubsystemIdentifier(String identifier)
          Determine if identifier represents a module.
static boolean isSubsystemTarget(String target)
          Determine if target represents a subsystem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

PACKAGE_UNITS

private static final String[] PACKAGE_UNITS

ASSEMBLY_SEPARATOR

public static final char ASSEMBLY_SEPARATOR


Supported API: true

See Also:
Constant Field Values

MODULE_SEPARATOR

public static final char MODULE_SEPARATOR


Supported API: true

See Also:
Constant Field Values

SUBSYSTEM_SEPARATOR

public static final char SUBSYSTEM_SEPARATOR


Supported API: true

See Also:
Constant Field Values

PACKAGE_SEPARATOR

public static final char PACKAGE_SEPARATOR


Supported API: true

See Also:
Constant Field Values
Constructor Detail

UnitIdentifierUtil

public UnitIdentifierUtil()
Method Detail

isPackageIdentifier

public static boolean isPackageIdentifier(String identifier)
Determine if identifier represents a module.
   Example Usage:
    UnitIdentifierUtil.isPackageIdentifier( "WNC/CommonCore:wt.util.LogFile" );  // return true (false positive)
    UnitIdentifierUtil.isPackageIdentifier( "WNC/CommonCore:wt.util" );          // return true
    UnitIdentifierUtil.isPackageIdentifier( "WNC/CommonCore:wt" );               // return true (if it is defined in property)
    UnitIdentifierUtil.isPackageIdentifier( "WNC/CommonCore:sub1" );             // return false
    UnitIdentifierUtil.isPackageIdentifier( "WNC/CommonCore" );                  // return false

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
boolean true if it represents a package (either package qualified or included in com.ptc.windchill.packaging.package_units property)

isPackageQualified

protected static boolean isPackageQualified(String identifier)
Determine if identifier is package qualified.
   Example Usage:
    UnitIdentifierUtil.isPackageQualified( "WNC/CommonCore:wt.util" );  // return true
    UnitIdentifierUtil.isPackageQualified( "WNC/CommonCore:wt" );       // return false
    UnitIdentifierUtil.isPackageQualified( "wt.util" );                 // return true

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
boolean true if it is package qualified (contains package separator)

isModuleQualified

public static boolean isModuleQualified(String identifier)
Determine if identifier is module qualified (really a unit identifier).
   Example Usage:
    UnitIdentifierUtil.isModuleQualified( "WNC/CommonCore:wt.util" );  // return true
    UnitIdentifierUtil.isModuleQualified( "WNC/CommonCore:" );         // return true
    UnitIdentifierUtil.isModuleQualified( "WNC/CommonCore" );          // return false
    UnitIdentifierUtil.isModuleQualified( ":" );                       // return true

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
boolean true if it is module qualified (contains module separator)

isFileTarget

public static boolean isFileTarget(String target)
Determine if the target represents a file that lists the actual targets.
   Example Usage:
    UnitIdentifierUtil.isRegistryTarget( "inputFile" );               // return true
    UnitIdentifierUtil.isRegistryTarget( "file" );                    // return true
    UnitIdentifierUtil.isRegistryTarget( "file=c:\inputFile.txt" );   // return true

  


Supported API: false

Parameters:
target - string that defines a target
Returns:
boolean true if it represents a file

isRegistryTarget

public static boolean isRegistryTarget(String target)
Determine if the target represents the entire registry.
   Example Usage:
    UnitIdentifierUtil.isRegistryTarget( "registry" );    // return true
    UnitIdentifierUtil.isRegistryTarget( "install" );     // return true
    UnitIdentifierUtil.isRegistryTarget( "*" );           // return true
    UnitIdentifierUtil.isRegistryTarget( "" );            // return true
    UnitIdentifierUtil.isRegistryTarget( null );          // return true

  


Supported API: false

Parameters:
target - string that defines a target
Returns:
boolean true if it represents the entire registry

isModuleTarget

public static boolean isModuleTarget(String target)
Determine if target represents a module.
   Example Usage:
    UnitIdentifierUtil.isModuleTarget( "WNC/CommonCore:wt.util" );  // return false
    UnitIdentifierUtil.isModuleTarget( "WNC/CommonCore:sub1" );     // return false
    UnitIdentifierUtil.isModuleTarget( "WNC/CommonCore:" );         // return true
    UnitIdentifierUtil.isModuleTarget( "WNC/CommonCore" );          // return true
    UnitIdentifierUtil.isModuleTarget( "registry" );                // return false

  


Supported API: true

Parameters:
target - external form for a unit identifier
Returns:
boolean true if it represents a module

isModuleIdentifier

public static boolean isModuleIdentifier(String identifier)
Determine if identifier represents a module.
   Example Usage:
    UnitIdentifierUtil.isModuleIdentifier( "WNC/CommonCore:wt.util" );  // return false
    UnitIdentifierUtil.isModuleIdentifier( "WNC/CommonCore:sub1" );     // return false
    UnitIdentifierUtil.isModuleIdentifier( "WNC/CommonCore:" );         // return false
    UnitIdentifierUtil.isModuleIdentifier( "WNC/CommonCore" );          // return true
    UnitIdentifierUtil.isModuleIdentifier( "registry" );                // return true  (false positive)

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
boolean true if it represents a module

isSubsystemTarget

public static boolean isSubsystemTarget(String target)
Determine if target represents a subsystem.
   Example Usage:
    UnitIdentifierUtil.isSubsystemTarget( "WNC/CommonCore:wt.util" );  // return false
    UnitIdentifierUtil.isSubsystemTarget( "WNC/CommonCore:wt" );       // return true
    UnitIdentifierUtil.isSubsystemTarget( "WNC/CommonCore:sub1" );     // return true
    UnitIdentifierUtil.isSubsystemTarget( "WNC/CommonCore" );          // return false

  


Supported API: false

Parameters:
target - external form for a unit identifier
Returns:
boolean true if it represents a subsystem (module qualified, but not package qualified)

isSubsystemIdentifier

public static boolean isSubsystemIdentifier(String identifier)
Determine if identifier represents a module.
   Example Usage:
    UnitIdentifierUtil.isSubsystemIdentifier( "WNC/CommonCore:wt.util" );  // return false
    UnitIdentifierUtil.isSubsystemIdentifier( "WNC/CommonCore:sub1" );     // return true
    UnitIdentifierUtil.isSubsystemIdentifier( "WNC/CommonCore:wt" );       // return false
    UnitIdentifierUtil.isSubsystemIdentifier( "WNC/CommonCore" );          // return false

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
boolean true if it represents a subsystem

isPackageTarget

public static boolean isPackageTarget(String target)
Determine if target represents a package.
   Example Usage:
    UnitIdentifierUtil.isPackageTarget( "WNC/CommonCore:wt.util.*" );  // return true
    UnitIdentifierUtil.isPackageTarget( "WNC/CommonCore:wt.util" );    // return false

  


Supported API: false

Parameters:
target - an identifier to process, package target must end with "*" to distinguish from a class
Returns:
boolean true if it represents a package

isClassTarget

public static boolean isClassTarget(String target)
Determine if target represents a class.
   Example Usage:
    UnitIdentifierUtil.isClassTarget( "WNC/CommonCore:wt.util.*" );        // return false
    UnitIdentifierUtil.isClassTarget( "WNC/CommonCore:wt.util" );          // return true   (false positive)
    UnitIdentifierUtil.isClassTarget( "WNC/CommonCore:wt.util.LogFile" );  // return true

  


Supported API: true

Parameters:
target - an identifier to process, class target must not end with "*" and must contain a package separator "."
Returns:
boolean true if it represents a class

getModuleName

public static String getModuleName(String identifier)
Gets the module name from a unit identifier.
   Example Usage:
    UnitIdentifierUtil.getModuleName( "WNC/CommonCore:wt.util.*" );        // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleName( "WNC/CommonCore:wt.util" );          // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleName( "WNC/CommonCore:wt.util.LogFile" );  // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleName( "WNC/CommonCore:sub1" );             // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleName( "WNC/CommonCore" );                  // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleName( "wt.util" );                         // return ""

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
String the module name, otherwise empty string ""

getSubsystemName

public static String getSubsystemName(String identifier)
Gets the subsystem name from a unit identifier.
   Example Usage:
    UnitIdentifierUtil.getSubsystemName( "WNC/CommonCore:wt.util.*" );        // return ""
    UnitIdentifierUtil.getSubsystemName( "WNC/CommonCore:wt.util" );          // return ""
    UnitIdentifierUtil.getSubsystemName( "wt.util" );                         // return ""
    UnitIdentifierUtil.getSubsystemName( "WNC/CommonCore:wt.util.LogFile" );  // return ""
    UnitIdentifierUtil.getSubsystemName( "WNC/CommonCore:sub1" );             // return "sub1"
    UnitIdentifierUtil.getSubsystemName( "WNC/CommonCore" );                  // return ""
    UnitIdentifierUtil.getSubsystemName( "WNC/Windchill:ApplicationServices/Indexing/wt.index");
                                              // return "ApplicationServices/Indexing"

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
String the subsystem name

getPackageName

public static String getPackageName(String identifier)
Gets the package name from a unit identifier.
   Example Usage:
    UnitIdentifierUtil.getPackageName( "WNC/CommonCore:wt.util.*" );        // return "wt.util.*"
    UnitIdentifierUtil.getPackageName( "WNC/CommonCore:wt.util" );          // return "wt.util"
    UnitIdentifierUtil.getPackageName( "wt.util" );                         // return "wt.util"
    UnitIdentifierUtil.getPackageName( "WNC/CommonCore:wt.util.LogFile" );  // return "wt.util.LogFile"
    UnitIdentifierUtil.getPackageName( "WNC/CommonCore:sub1" );             // return ""
    UnitIdentifierUtil.getPackageName( "WNC/CommonCore" );                  // return ""
    UnitIdentifierUtil.getPackageName( "WNC/Windchill:ApplicationServices/Indexing/wt.index");
                                                                            // return "wt.index"

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
String the package name

getUnitName

public static String getUnitName(String identifier)
Gets the unit name from a unit identifier- i.e., strip off the module qualification.
   Example Usage:
    UnitIdentifierUtil.getUnitName( "WNC/CommonCore:wt.util.*" );        // return "wt.util.*"
    UnitIdentifierUtil.getUnitName( "WNC/CommonCore:wt.util" );          // return "wt.util"
    UnitIdentifierUtil.getUnitName( "wt.util" );                         // return "wt.util"
    UnitIdentifierUtil.getUnitName( "WNC/CommonCore:wt.util.LogFile" );  // return "wt.util.LogFile"
    UnitIdentifierUtil.getUnitName( "WNC/CommonCore:sub1" );             // return "sub1"
    UnitIdentifierUtil.getUnitName( "WNC/CommonCore" );                  // return "WNC/CommonCore"
    UnitIdentifierUtil.getUnitName( "WNC/Windchill:ApplicationServices/Indexing/wt.index");
                                        // return "ApplicationServices/Indexing/wt.index"

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
String the unit name

getBaseUnitName

public static String getBaseUnitName(String identifier)
Gets the base unit name from a unit identifier. That is, the most basic level of identifier, without any upper level qualification.
   Example Usage:
    UnitIdentifierUtil.getBaseUnitName( "WNC/CommonCore:wt.util.*" );        // return "wt.util.*"
    UnitIdentifierUtil.getBaseUnitName( "WNC/CommonCore:wt.util" );          // return "wt.util"
    UnitIdentifierUtil.getBaseUnitName( "wt.util" );                         // return "wt.util"
    UnitIdentifierUtil.getBaseUnitName( "WNC/CommonCore:wt.util.LogFile" );  // return "wt.util.LogFile"
    UnitIdentifierUtil.getBaseUnitName( "WNC/CommonCore:sub1" );             // return "sub1"
    UnitIdentifierUtil.getBaseUnitName( "WNC/CommonCore" );                  // return "WNC/CommonCore"
    UnitIdentifierUtil.getBaseUnitName( "WNC/Windchill:ApplicationServices/Indexing/wt.index");
                                        // return "wt.index"

  


Supported API: true

Parameters:
identifier - external form for a unit identifier
Returns:
String the base unit name

getModuleQualifiedName

public static String getModuleQualifiedName(String module_name,
                                            String unit_name)
Gets the module qualified unit identifier, given a module name and a unit name.
   Example Usage:
    UnitIdentifierUtil.getModuleQualifiedName( "WNC/CommonCore", "wt.util" );  // return "WNC/CommonCore:wt.util.*"
    UnitIdentifierUtil.getModuleQualifiedName( "WNC/CommonCore", "" );         // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleQualifiedName( "", "wt.util" );                // return "wt.util"
    UnitIdentifierUtil.getModuleQualifiedName( "", "" );                       // return ""

  


Supported API: true

Parameters:
module_name - module name
unit_name - unit (subsystem, package or class) name
Returns:
String module qualified unit name

getModuleQualifiedName

public static String getModuleQualifiedName(String module_name,
                                            String sub_name,
                                            String pkg_name)
Gets the module qualified unit identifier, given a module name, subsystem name and and unit name.
   Example Usage:
    UnitIdentifierUtil.getModuleQualifiedName( "WNC/CommonCore", "", "wt.util" );  // return "WNC/CommonCore:wt.util.*"
    UnitIdentifierUtil.getModuleQualifiedName( "WNC/CommonCore", "", "" );         // return "WNC/CommonCore"
    UnitIdentifierUtil.getModuleQualifiedName( "", "", "wt.util" );                // return "wt.util"
    UnitIdentifierUtil.getModuleQualifiedName( "", "", "" );                       // return ""
    UnitIdentifierUtil.getModuleQualifiedName( "WNC/CommonCore", "ApplicationServices/Indexing", "" );
                                                                                   // return "WNC/CommonCore:ApplicationServices/Indexing"
    UnitIdentifierUtil.getModuleQualifiedName( "WNC/CommonCore", "ApplicationServices/Indexing", "wt.util" );
                                                                                   // return "WNC/CommonCore:ApplicationServices/Indexing/wt.util"

  


Supported API: true

Parameters:
module_name - module name
Returns:
String module qualified unit name

getUnitName

private static String getUnitName(String sub_name,
                                  String pkg_name)

concatenateNames

private static String concatenateNames(String name1,
                                       String name2,
                                       char delimeter)