Namespace: Consultingwerk.Util
Class 
ClassHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:ClassHelper
Purpose:Class contains generic supporting routines to work
with classes
Syntax:Static methods only, private constructor to disallow
instance creation
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Mon Jul 12 20:31:09 CEST 2010
Notes:This file is intended for GUI for .NET only
The result temp-table description is in Consultingwerk/Util/TempTables/ttClassNames.i
Provides logging for .classpath file usage through the "ClassHelper"
custom log entry type
More extensive logging can be activated through the "ClassHelperExt"
logging type



Top Method Summary
Options Name Purpose
+ CHARACTER ClassName (character, character) Returns the full class name based on package and class name
+ Progress.Lang.Class ClassNameToClass (character, logical) Returns the Progress.Lang.Class reference for a type referenced by either the type name (ie "Consultingwerk.CharacterType" )
+ CHARACTER ClassNameToFile (character) Converts a class name into the source code file name (.cls)
+ Progress.Lang.Class FileNameToClass (character) Returns the Progress.Lang.Class reference for a type referenced by either the .cls or .r file name
+ Progress.Lang.Class FileNameToClass (character, logical) Returns the Progress.Lang.Class reference for a type referenced by either the .cls or .r file name
+ CHARACTER FileNameToClassName (character) Returns the Class Name for a type referenced by either the .cls or .r file name
+ GetClassNames (character, character, logical, character, character, table) Returns all class names found in the specified root directory that match the specified base type (class or interface), optionally including abstract classes
+ GetClassNames (character, character, logical, character, table) Returns all class names found in the specified root directory that match the specified base type (class or interface), optionally including abstract classes
+ GetClassNames (character, character, table) Returns all class names found in the specified root directory that match the specified base type (class or interface)
+ GetClassNames (character, table) Returns all class names found in the specified root directory that match the specified base type (class or interface)
+ GetClassNames (table) Returns all class names found in the specified root directory that match the specified base type, optionally including abstract classes
# LOGICAL GetClassNamesFromExternalRuntime (character, character, logical, character) Starts a separate Progress client to perform the Class name lookup.
+ GetClassNamesInClassPath (character, logical, table) Returns all class names found in the directories specified in the .classpath file and that match the specified base type, optionally including or excluding abstract classes
+ GetClassNamesInClassPath (character, table) Returns all class names found in the directories specified in the .classpath file and that match the specified base type
+ GetClassNamesInClassPathNoDotNet (character, logical, table) Returns all class names found in the directories specified in the .classpath file and that match the specified base type, optionally including or excluding abstract classes
+ GetClassNamesInProcedureLibrary (character, character, logical, table) Returns all class names found in the specified root directory that match the specified base type (class or interface), optionally including abstract classes
+ GetClassNamesNoDotNet (character, character, logical, character, table) Returns all class names found in the specified root directory that match the specified base type (class or interface), optionally including abstract classes
+ LOGICAL HasStaticPropertyOfType (Class, Class) Verifies if the given class type has a static property of the given type
+ LOGICAL IsAbstract (character) Returns true when the given class name is a valid abstract class
+ LOGICAL IsInCallStack (Class) Returns if an instance of the given class is in the call stack
+ LOGICAL IsInCallStack (Class, character) Returns if an instance of the given class is in the call stack
+ INTEGER NumInstances (Class) Returns the current number of instances of the given class
+ CHARACTER ShortClassName (Class) Returns the ShortClassName for the given Class object
+ CHARACTER ShortPackageName (character) Returns the class name with a shortened package name
+ CHARACTER ShortPackageName (Class) Returns the class name with a shortened package name
+ Consultingwerk.ClassName SplitClassName (character) Splits a full class name into package and class name
+ LOGICAL ValidateClassName (character) Validates a class name for invalid characters
+ LOGICAL ValidatePackageName (character) Validates a package name for invalid characters
+ WriteClassPath () Writes the current PROPATH in a tabular fashion to the log file
+ WriteLogMessage (character) Writes a message to the logfile

Top Constructor Summary
Options Name Purpose
# ClassHelper () Constructor for the ClassHelper class

Top Property Summary
Options Name Purpose
+ CHARACTER ClassPathFile
+ LOGICAL ForceIncludeSmartComponents
+ CHARACTER LogfileName
+ LOGICAL UseExternalRuntimeForGetClassNames
+ LOGICAL UseRcodeOnlyForExternalRuntime


Method Detail
Top

PUBLIC CHARACTER ClassName (character, character)

Purpose: Returns the full class name based on package and class name
Notes: Package may be empty

Parameters:
pcPackageName CHARACTER
The name of the package
pcClassName CHARACTER
The name of the class
Returns CHARACTER
The full class name
Top

PUBLIC Progress.Lang.Class ClassNameToClass (character, logical)

Purpose: Returns the Progress.Lang.Class reference for a type referenced
by either the type name (ie "Consultingwerk.CharacterType" )
Notes:

Parameters:
pcTypeName CHARACTER
The file name
plThrowExceptionIfNotType LOGICAL
If TRUE, an exception is thrown if the name does not represent an OOABL type
Returns Progress.Lang.Class
The Progress.Lang.Class reference of the matching type
Top

PUBLIC CHARACTER ClassNameToFile (character)

Purpose: Converts a class name into the source code file name (.cls)
Notes:

Parameters:
pcClassName CHARACTER
The ClassName to convert into a source code file name
Returns CHARACTER
The file name of the class source code
Top

PUBLIC Progress.Lang.Class FileNameToClass (character)

Purpose: Returns the Progress.Lang.Class reference for a type referenced
by either the .cls or .r file name
Notes:

Parameters:
pcFileName CHARACTER
The file name
Returns Progress.Lang.Class
The Progress.Lang.Class reference of the matching type
Top

PUBLIC Progress.Lang.Class FileNameToClass (character, logical)

Purpose: Returns the Progress.Lang.Class reference for a type referenced
by either the .cls or .r file name
Notes:

Parameters:
pcFileName CHARACTER
The file name
plThrowExceptionIfNotType LOGICAL
If TRUE, an exception is thrown if the filename does not represent an OOABL type
Returns Progress.Lang.Class
The Progress.Lang.Class reference of the matching type
Top

PUBLIC CHARACTER FileNameToClassName (character)

Purpose: Returns the Class Name for a type referenced by either the .cls or
.r file name
Notes: Does not verify if it's a valid class name

Parameters:
pcFileName CHARACTER
The file name
Returns CHARACTER
The resulting class name
Top

PUBLIC GetClassNames (character, character, logical, character, character, table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type (class or interface), optionally
including abstract classes
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
pcPath CHARACTER
The directory to look in (including sub folders)
plIncludeAbstract LOGICAL
Include abstract classes in the search
pcPrefix CHARACTER
The prefix (name space/package name) to add to the returned class names
pcSubdirectory CHARACTER
The sub directory relatively to the pcPath
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNames (character, character, logical, character, table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type (class or interface), optionally
including abstract classes
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
pcPath CHARACTER
The directory to look in (including sub folders)
plIncludeAbstract LOGICAL
Include abstract classes in the search
pcPrefix CHARACTER
The prefix (name space/package name) to add to the returned class names
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNames (character, character, table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type (class or interface)
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
pcPath CHARACTER
The directory to look in (including sub folders)
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNames (character, table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type (class or interface)
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNames (table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type, optionally including abstract
classes
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework, uses Progress.Lang.Object as the base
type for the ClassLookup through GetClassNames (pcBaseType, OUTPUT TABLE ttClassNames)

Parameters:
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PROTECTED LOGICAL GetClassNamesFromExternalRuntime (character, character, logical, character)

Purpose: Starts a separate Progress client to perform the Class name lookup.
Notes: This appears to increase the reliability (reduction of AVM crashes)

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
pcPath CHARACTER
The directory to look in (including sub folders)
plIncludeAbstract LOGICAL
Include abstract classes in the search
pcPrefix CHARACTER
The prefix (name space/package name) to add to the returned class names
Returns LOGICAL
Logical value indicating if the external runtime could be started
Top

PUBLIC GetClassNamesInClassPath (character, logical, table)

Purpose: Returns all class names found in the directories specified in the
.classpath file and that match the specified base type, optionally
including or excluding abstract classes
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
plIncludeAbstract LOGICAL
Include abstract classes in the search
return_ttClassNames TEMP-TABLE return_ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNamesInClassPath (character, table)

Purpose: Returns all class names found in the directories specified in the
.classpath file and that match the specified base type
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
return_ttClassNames TEMP-TABLE return_ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNamesInClassPathNoDotNet (character, logical, table)

Purpose: Returns all class names found in the directories specified in the
.classpath file and that match the specified base type, optionally
including or excluding abstract classes
Notes: The routine is an alternative to GetClassNamesInClassPath and does
not require access to the .NET Framework (suitable for 10.2B AppServer
and UNIX)

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
plIncludeAbstract LOGICAL
Include abstract classes in the search
return_ttClassNames TEMP-TABLE return_ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNamesInProcedureLibrary (character, character, logical, table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type (class or interface), optionally
including abstract classes
Notes: The routine is designed to run on a windows client only, as it
uses the .NET Framework

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
pcProcedureLibraryName CHARACTER
The path to the procedure library
plIncludeAbstract LOGICAL
Include abstract classes in the search
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC GetClassNamesNoDotNet (character, character, logical, character, table)

Purpose: Returns all class names found in the specified root directory
that match the specified base type (class or interface), optionally
including abstract classes
Notes: The routine is an alternative to GetClassNames and does not require
access to the .NET Framework (suitable for 10.2B AppServer and
UNIX or PASOE which does not support .NET on Windows as well)

Parameters:
pcBaseType CHARACTER
The base type (class or interface) that the returned classes need to match
pcPath CHARACTER
The directory to look in (including sub folders)
plIncludeAbstract LOGICAL
Include abstract classes in the search
pcPrefix CHARACTER
The prefix (name space/package name) to add to the returned class names
ttClassNames TEMP-TABLE ttClassNames
OUTPUT Temp-Table with the list of matching class names
Top

PUBLIC LOGICAL HasStaticPropertyOfType (Class, Class)

Purpose: Verifies if the given class type has a static property of the
given type
Notes:

Parameters:
poClassType Progress.Lang.Class
The class to look for the property in
poPropertyType Progress.Lang.Class
The type of property to look for
Returns LOGICAL
Logical value indicating if the class has a static property of the given type
Top

PUBLIC LOGICAL IsAbstract (character)

Purpose: Returns true when the given class name is a valid abstract class
Notes: Returns false when the class is not abstract or the class name is invalid

Parameters:
pcClassName CHARACTER
The name of the class to test
Returns LOGICAL
Logical value indicating if the class name represents a valid abstract class
Top

PUBLIC LOGICAL IsInCallStack (Class)

Purpose: Returns if an instance of the given class is in the call stack
Notes: Checks by investigating the PROGRAM-NAME() function

Parameters:
poType Progress.Lang.Class
The type to locate in the call stack
Returns LOGICAL
Logical value indicating if an instance of the given class is in the call stack
Top

PUBLIC LOGICAL IsInCallStack (Class, character)

Purpose: Returns if an instance of the given class is in the call stack
Notes: Checks by investigating the PROGRAM-NAME() function

Parameters:
poType Progress.Lang.Class
The type to locate in the call stack
pcMethodName CHARACTER
The name of the method
Returns LOGICAL
Logical value indicating if an instance of the given class is in the call stack
Top

PUBLIC INTEGER NumInstances (Class)

Purpose: Returns the current number of instances of the given class
Notes: Iterates the SESSION:FIRST object chain

Parameters:
poClass Progress.Lang.Class
The class to count instances from
Returns INTEGER
The number of instances of the class
Top

PUBLIC CHARACTER ShortClassName (Class)

Purpose: Returns the ShortClassName for the given Class object
Notes: The short name is the class name without the package

Parameters:
poClass Progress.Lang.Class
The class to return the short name for
Returns CHARACTER
The short name of the class
Top

PUBLIC CHARACTER ShortPackageName (character)

Purpose: Returns the class name with a shortened package name
Notes: The package name will the build based on upper case letters
of the package name only. The SmartBusinessEntityAdapter will
be returned as C.SC.I.SmartBusinessEntityAdapter

Parameters:
pcClassName CHARACTER
The class reference to return the shortened class/package name for
Returns CHARACTER
The shortened class/package name
Top

PUBLIC CHARACTER ShortPackageName (Class)

Purpose: Returns the class name with a shortened package name
Notes: The package name will the build based on upper case letters
of the package name only. The SmartBusinessEntityAdapter will
be returned as C.SC.I.SmartBusinessEntityAdapter

Parameters:
poClass Progress.Lang.Class
The class reference to return the shortened class/package name for
Returns CHARACTER
The shortened class/package name
Top

PUBLIC Consultingwerk.ClassName SplitClassName (character)

Purpose: Splits a full class name into package and class name
Notes: Performs no validation of type, just splits based on last period

Parameters:
pcFullClassName CHARACTER
The full class name to split
Returns Consultingwerk.ClassName
The Consultingwerk.ClassName that represents the parts of the class name
Top

PUBLIC LOGICAL ValidateClassName (character)

Purpose: Validates a class name for invalid characters
Notes:

Parameters:
pcClassName CHARACTER
The class name to validate
Returns LOGICAL
Logical value indicating if the class name is valid
Top

PUBLIC LOGICAL ValidatePackageName (character)

Purpose: Validates a package name for invalid characters
Notes:

Parameters:
pcClassName CHARACTER
The class name to validate
Returns LOGICAL
Logical value indicating if the class name is valid
Top

PUBLIC WriteClassPath ()

Purpose: Writes the current PROPATH in a tabular fashion to the log file
Notes: ABL stores the PROPATH as a comma-separated list of directories.
(ABL strips the operating-specific separation characters (a colon
( : ) on UNIX; a semicolon ( ; ) in Windows) and replaces them with
commas.

Top

PUBLIC WriteLogMessage (character)

Purpose: Writes a message to the logfile
Notes: Does nothing, when the ClassHelper:LogfileName is not set

Parameters:
pcMessage CHARACTER
The message to be written to the logfile


Constructor Detail
Top

PROTECTED ClassHelper ()

Purpose: Constructor for the ClassHelper class
Notes: Protected default constructor



Property Detail
Top

PUBLIC CHARACTER ClassPathFile


Returns CHARACTER
Top

PUBLIC LOGICAL ForceIncludeSmartComponents


Returns LOGICAL
Top

PUBLIC CHARACTER LogfileName


Returns CHARACTER
Top

PUBLIC LOGICAL UseExternalRuntimeForGetClassNames


Returns LOGICAL
Top

PUBLIC LOGICAL UseRcodeOnlyForExternalRuntime


Returns LOGICAL


Temp-Table Detail

Temp-Table return_ttClassNames

Defined in:

Temp-Table ttClassNames

Defined in:


©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       15.04.2024 06:16:31