com.ibm.wsspi.anno.classsource

Interface ClassSource

All known subinterfaces:
ClassSource_Aggregate, ClassSource_ClassLoader, ClassSource_MappedContainer, ClassSource_MappedDirectory, ClassSource_MappedJar, ClassSource_MappedSimple

  1. public interface ClassSource

Field Summary

Modifier and Type Field and Description
  1. static
  2. java.lang.String
CLASS_EXTENSION
Constant extension for class resource names.
  1. static
  2. char
CLASS_SEPARATOR_CHAR
Constant class name separation character.
  1. static
  2. char
INNER_CLASS_SEPARATOR
Constant for inner classes.
  1. static
  2. char
RESOURCE_SEPARATOR_CHAR
Constant resource separation character.
  1. static
  2. java.lang.String
RESOURCE_SEPARATOR_STRING
Constant resource separation string.

Method Summary

Modifier and Type Method and Description
  1. void
close()
Close the class source.
  1. void
closeClassStream(java.lang.String className,java.io.InputStream inputStream)
Class the input stream which was opened for a specified class.
  1. void
closeResourceStream(java.lang.String className,java.lang.String resourceName,java.io.InputStream inputStream)
Class the input stream which was opened for a specified class.
  1. java.lang.String
getCanonicalName()
Answer the canonical name of the class source.
  1. int
getClassExclusionCount()
Answer the count of class resources which were excluded as duplicates resources for the same class.
  1. int
getClassInclusionCount()
Answer the count of class resources for distinct classes.
  1. java.lang.String
getClassNameFromResourceName(java.lang.String resourceName)
Convert a resource name to a class name.
  1. ClassSource_Factory
getFactory()
The factory used to create this class source.
  1. java.lang.String
getHashText()
A string representation of the class source suitable for logging.
  1. Util_InternMap
getInternMap()
Answer the string intern map of the class source.
  1. java.lang.String
getName()
A name for this class source.
  1. ClassSource
getParentSource()
Answer the parent of this class source.
  1. int
getResourceExclusionCount()
Answer the count of resources which were excluded from processing because they were not class resources.
  1. java.lang.String
getResourceNameFromClassName(java.lang.String className)
Convert a class name to a resource name.
  1. int
getResult(ClassSource_ScanCounts.ResultField resultField)
Answer a specific field from the scan results table.
  1. ClassSource_ScanCounts
getScanResults()
Answer statistics for a scan processing.
  1. java.lang.String
inconvertResourceName(java.lang.String externalResourceName)
Optional API for processing which uses an alternate form for resources.
  1. boolean
isClassResource(java.lang.String resourceName)
Tell if a specified resource is a class resource.
  1. boolean
isDirectoryResource(java.lang.String resourceName)
Tell if a specified resource is a directory resource.
  1. void
log(TraceComponent logger)
Log state information for the class source to a specified logger.
  1. void
logState()
Log state information for the class source.
  1. void
open()
Open the class source for use.
  1. java.io.InputStream
openClassStream(java.lang.String className)
Open an input stream for a named class.
  1. java.io.InputStream
openResourceStream(java.lang.String className,java.lang.String resourceName)
Open an input stream for a named class which has a specified resource name.
  1. java.lang.String
outconvertResourceName(java.lang.String internalResourceName)
Optional API for processing which uses an alternate form for resources.
  1. java.lang.String
resourceAppend(java.lang.String head,java.lang.String tail)
Perform a resource append operation: This places a resource separator between the supplied values.
  1. void
scanClasses(ClassSource_Streamer streamer,java.util.Set<java.lang.String> i_seedClassNamesSet,ClassSource_Aggregate.ScanPolicy scanPolicy)
Entry point for scanning a class source which is a child of an aggregate class source.
  1. boolean
scanReferencedClass(java.lang.String referencedClassNam,ClassSource_Streamer streamer)
Required entry point for scans of referenced classes.
  1. boolean
scanSpecificSeedClass(java.lang.String specificClassName,ClassSource_Streamer streamer)
Alternate scan processing step: Perform scanning only on specific class.
  1. void
setParentSource(ClassSource classSource)
Set the parent of this class source.

Field Detail

RESOURCE_SEPARATOR_CHAR

  1. static final char RESOURCE_SEPARATOR_CHAR

Constant resource separation character.

See Also:

RESOURCE_SEPARATOR_STRING

  1. static final java.lang.String RESOURCE_SEPARATOR_STRING

Constant resource separation string.

See Also:

CLASS_SEPARATOR_CHAR

  1. static final char CLASS_SEPARATOR_CHAR

Constant class name separation character.

See Also:

CLASS_EXTENSION

  1. static final java.lang.String CLASS_EXTENSION

Constant extension for class resource names.

See Also:

INNER_CLASS_SEPARATOR

  1. static final char INNER_CLASS_SEPARATOR

Constant for inner classes.

See Also:

Method Detail

getHashText

  1. java.lang.String getHashText()

A string representation of the class source suitable for logging. The hash text should include a unique identifier (usually the base hash code of the class source) plus the most relevant descriptive information for the class source.

Returns:
A string representation of the class source suitable for logging.

logState

  1. void logState()

Log state information for the class source.


log

  1. void log(TraceComponent logger)

Log state information for the class source to a specified logger. State information uses 'debug' log enablement.

Parameters:
logger - A logger which is to receive state information.

getFactory

  1. ClassSource_Factory getFactory( )

The factory used to create this class source. Other factory based objects created by the class source will use this factory.

Returns:
The factory used to create this class source.

getParentSource

  1. ClassSource getParentSource()

Answer the parent of this class source. Answer null if none is set.

Returns:
The parent of this class source.

setParentSource

  1. void setParentSource(ClassSource classSource)

Set the parent of this class source.


getName

  1. java.lang.String getName()

A name for this class source.

The class source name is used as a unique ID when storing values to annotation targets. See com.ibm.wsspi.anno.targets.AnnotationTargets_Targets#getClassSourceNames().

When adding class sources to an aggregate, the names of the child class sources must be unique.

Returns:
A name for this class source.

getCanonicalName

  1. java.lang.String getCanonicalName( )

Answer the canonical name of the class source. All use of the class source uses the canonical name.

Returns:
The canonical name of the class source.
See Also:

open

  1. void open()
  2. throws ClassSource_Exception
Open the class source for use. This will open any underlying objects.
Throws:
ClassSource_Exception - Thrown if the class source could not be opened.

close

  1. void close()
  2. throws ClassSource_Exception
Close the class source. Close any underlying objects.
Throws:
ClassSource_Exception - Thrown if the class source could not be closed.

getInternMap

  1. Util_InternMap getInternMap()

Answer the string intern map of the class source.

Class sources intern all class names of scanned classes.

Returns:
The intern map of the class source.

scanClasses

  1. void scanClasses(ClassSource_Streamer streamer,
  2. java.util.Set<java.lang.String> i_seedClassNamesSet,
  3. ClassSource_Aggregate.ScanPolicy scanPolicy)

Entry point for scanning a class source which is a child of an aggregate class source.

Parameters:
streamer - A selection and processing helper for the scan operation.
i_seedClassNamesSet - The accumulated seed class names.
scanPolicy - The scan policy of the class source (recorded by the parent).

getScanResults

  1. ClassSource_ScanCounts getScanResults( )

Answer statistics for a scan processing. (These are only available after scanning is complete.)

Returns:
Statistics for scan processing.

getResult

  1. int getResult(ClassSource_ScanCounts.ResultField resultField)

Answer a specific field from the scan results table.

Parameters:
resultField - The scan results field which is to be retrieved.
Returns:
The value of the requested scan results field.

scanSpecificSeedClass

  1. boolean scanSpecificSeedClass(java.lang.String specificClassName,
  2. ClassSource_Streamer streamer)
  3. throws ClassSource_Exception

Alternate scan processing step: Perform scanning only on specific class.

streamer - A selection and processing helper for the scan operation.
Returns:
True if the streamer processed the class. Otherwise, false.
Throws:
ClassSource_Exception - Thrown in case of an error during scan processing.

scanReferencedClass

  1. boolean scanReferencedClass(java.lang.String referencedClassNam,
  2. ClassSource_Streamer streamer)
  3. throws ClassSource_Exception

Required entry point for scans of referenced classes.

Parameters:
referencedClassNam - The names of a referenced classes which requires scanning.
streamer - A selection and processing helper for the scan operation.
Returns:
True if the streamer processed the class. Otherwise, false.
Throws:
ClassSource_Exception - Thrown in case of an error during scan processing.

resourceAppend

  1. java.lang.String resourceAppend( java.lang.String head,
  2. java.lang.String tail)

Perform a resource append operation: This places a resource separator between the supplied values.

Parameters:
head - The first value to put into the concatenated value.
tail - The second value to put into the concatenated value.
Returns:
The first value concatenated with a resource separator and with the second value.

isDirectoryResource

  1. boolean isDirectoryResource(java.lang.String resourceName)

Tell if a specified resource is a directory resource. Resources which end with the resource separator are directory resources.

Parameters:
resourceName - The resource name to test.
Returns:
True if the resource is a directory resource. Otherwise, false.

isClassResource

  1. boolean isClassResource(java.lang.String resourceName)

Tell if a specified resource is a class resource. A resource is a class resource if and only if it has the class extension.

Parameters:
resourceName - The resource which is to be tested.
Returns:
True if the resource is a class resource. Otherwise, false.

getClassNameFromResourceName

  1. java.lang.String getClassNameFromResourceName( java.lang.String resourceName)

Convert a resource name to a class name. Conversion strips the class extension and converts all resource separators to class separators. Note that the inner class separator is not changed by the conversion.

Parameters:
resourceName - The resource to convert to a class name.
Returns:
The class name for the resource.

getResourceNameFromClassName

  1. java.lang.String getResourceNameFromClassName( java.lang.String className)

Convert a class name to a resource name. Conversion changes the class separator to the resource separator and adds the class extension. The inner class separator is not changed by the conversion.

Parameters:
className - The class name to convert to a resource.
Returns:
The resource for the class name.

inconvertResourceName

  1. java.lang.String inconvertResourceName( java.lang.String externalResourceName)

Optional API for processing which uses an alternate form for resources. For example, directory based processing may change the resource separator to a platform specific separator.

Parameters:
externalResourceName - The external form of the resource.
Returns:
The internal form of the resource.

outconvertResourceName

  1. java.lang.String outconvertResourceName( java.lang.String internalResourceName)

Optional API for processing which uses an alternate form for resources. For example, directory based processing may change the resource separator to a platform specific separator.

Parameters:
internalResourceName - The internal form of the resource.
Returns:
The external form of the resource.

openClassStream

  1. java.io.InputStream openClassStream( java.lang.String className)
  2. throws ClassSource_Exception

Open an input stream for a named class.

Note the distinct cases: If no resource is available for the class, answer null. If a resource is available but cannot be opened, throw an exception.

Parameters:
className - The name of the class for which to open an input stream.
Returns:
The input stream for the named class. Null if no resource is available for the class.
Throws:
ClassSource_Exception - Thrown in case a resource is available for the class, but that resource could not be opened.

openResourceStream

  1. java.io.InputStream openResourceStream( java.lang.String className,
  2. java.lang.String resourceName)
  3. throws ClassSource_Exception

Open an input stream for a named class which has a specified resource name.

This code point is exposed to minimize class name to resource name conversion: Processing which prefers to use the resource name will generate a class name, but should not be forced to discard the resource name.

Note the distinct cases: If no resource is available for the class, answer null. If a resource is available but cannot be opened, throw an exception.

Parameters:
className - The name of the class for which to open an input stream.
Returns:
The input stream for the named class. Null if no resource is available for the class.
Throws:
ClassSource_Exception - Thrown in case a resource is available for the class, but that resource could not be opened.

closeClassStream

  1. void closeClassStream(java.lang.String className,
  2. java.io.InputStream inputStream)
  3. throws ClassSource_Exception

Class the input stream which was opened for a specified class.

Parameters:
className - The class for which the input stream was opened.
inputStream - The input stream which is to be closed.
Throws:
ClassSource_Exception - Thrown in case the input stream could not be closed.

closeResourceStream

  1. void closeResourceStream(java.lang.String className,
  2. java.lang.String resourceName,
  3. java.io.InputStream inputStream)
  4. throws ClassSource_Exception

Class the input stream which was opened for a specified class.

This code point is exposed to minimize class name to resource name conversion: Processing which prefers to use the resource name will generate a class name, but should not be forced to discard the resource name.

Parameters:
className - The class for which the input stream was opened.
inputStream - The input stream which is to be closed.
Throws:
ClassSource_Exception - Thrown in case the input stream could not be closed.

getResourceExclusionCount

  1. int getResourceExclusionCount()

Answer the count of resources which were excluded from processing because they were not class resources. This includes all container resources and all resources which do not have the class extension.

Returns:
The count of resources excluded from processing as non-class resources.
See Also:

getClassExclusionCount

  1. int getClassExclusionCount()

Answer the count of class resources which were excluded as duplicates resources for the same class. For example, an aggregate class source may contain a resource for the same class in two different child class sources. Only one of these is processed; the others are excluded and will contribute to the exclusion count.

Class resources skipping by the stream are not included in this count.

The class inclusion count plus the class exclusion count add up to the count of all class resources encountered during processing.

Classes from non-seed class sources are not included in either statistic.

Returns:
The count of class resources for duplicate classes.
See Also:
getClassInclusionCount(), isClassResource(String), ClassSource_Streamer#doProcess(String)

getClassInclusionCount

  1. int getClassInclusionCount()

Answer the count of class resources for distinct classes. For example, an aggregate class source may contain a resource for the same class in two different child class sources. The class inclusion count is incremented just once for the entire set of duplicating class resources. The exclusion count is incremented once for each of the other duplicating class resources.

Class resources skipping by the stream are not included in this count.

Returns:
The count of class resources for distinct classes.
See Also:
getClassExclusionCount(), isClassResource(String), ClassSource_Streamer#doProcess(String)