org.pf.tools.cda.base.model
Class ClassContainer

java.lang.Object
  extended by org.pf.tools.cda.base.model.AModelObject
      extended by org.pf.tools.cda.base.model.AAnalyzableElement
          extended by org.pf.tools.cda.base.model.GenericClassContainer
              extended by org.pf.tools.cda.base.model.ClassContainer
All Implemented Interfaces:
java.lang.Comparable, org.pf.bif.lifecycle.IReleasable, IAnalyzableElement, IClassContainingElement, IContainer, IExplorableElement, IExplorableElementVisiting, IExplorationModelObject, IObjectProperties, IStructureVisiting

public class ClassContainer
extends GenericClassContainer

A ClassContainer is typically a classpath element that contains one or more classes (i.e. a directory or an archive)

Version:
1.8
Author:
Manfred Duchrow

Field Summary
static ClassContainer[] EMPTY_ARRAY
           
 
Fields inherited from class org.pf.tools.cda.base.model.GenericClassContainer
EMPTY_GENERIC_CONTAINER_ARRAY
 
Fields inherited from class org.pf.tools.cda.base.model.AModelObject
EMPTY_MODEL_OBJECT_ARRAY
 
Fields inherited from interface org.pfsw.odem.IContainer
EMPTY_CONTAINER_ARRAY
 
Fields inherited from interface org.pf.tools.cda.base.model.IAnalyzableElement
EMPTY_BASE_ARRAY
 
Constructor Summary
ClassContainer(ContainerSpecificationElement containerSpec, Workset aWorkset)
          Initialize the new instance with default values.
 
Method Summary
 void changeAlias(java.lang.String aliasName)
          Sets the alias of this container.
 void changeThirdPartyFlag(boolean isThirdPartyLibrary)
          Sets whether or not this container is a third party library
 void close()
          Closes the underlying classpath element if it is an archive
static ClassContainer[] collectionToArray(java.util.Collection coll)
           
 java.lang.String displayString(org.pf.text.StringFilter folderFilter)
          Returns the name of this container for display.
static ClassContainer[] filterCorrectType(GenericClassContainer[] genericClassContainers)
           
 ContainerSpecificationElement getContainerSpecificationElement()
           
 ClassInformation getMainClass()
           
 java.lang.String getManifestContent()
           
 java.lang.String getName()
          Returns the name of the class container
 boolean getThirdPartyFlag()
           
 org.pf.text.Version getVersion()
          Returns the version of this container or null if no version is assigned to this container.
 boolean hasMainClass()
          Returns true if this container has a Main-Class declared in its manifest.
 boolean isArchive()
          Returns true if this container is an archive
 boolean isDirectory()
          Returns true if this container is a directory
 boolean isInitializable()
          Returns true if this class container can be initialized
 boolean isMetaData()
          Returns true if this class container is defined by meta data rather than binary files.
 boolean isThirdPartyLibrary()
          Returns true if this container represents a third party library.
 boolean isValid()
          Returns true if this class container is valid, that is it exists and can be read from.
 java.io.InputStream openClassFile(ClassInformation classInfo)
          Opens the class file that corresponds to the given class information in this container and returns the input stream.
 void reset()
          Resets the internal state.
 void setManifestContent(java.lang.String newValue)
           
 void setThirdPartyFlag(boolean isThirdPartyLibrary)
          Sets whether or not this container is a third party library
 java.lang.String shortDisplayString(org.pf.text.StringFilter folderFilter)
          Returns the short name of this container for display.
 java.lang.String toString()
           
 
Methods inherited from class org.pf.tools.cda.base.model.GenericClassContainer
accept, acceptContainers, acceptNamespaces, acceptTypes, addSubContainer, canHaveDependencies, compareTo, contains, createPackage, equals, findClassInfo, findOrCreateClassInfo, findOrCreatePackage, findPackage, getAlias, getAllContainedClasses, getAnalyzableElementType, getChildCount, getChildren, getClassification, getContext, getDirectReferredContainers, getIncludedContainers, getNamespaces, getNumberOfContainedClasses, getNumberOfContainedPackages, getPackageNamed, getPackages, getParentContainer, getRequiredClassFileVersion, getSubContainers, getWorkset, hashCode, hasVersion, isNotFoundContainer, isShortContainerNamesOn, isSoftwareComponent, packagesCollected, packagesCollected, processClassInformationObjects, processClassPackageObjects, refersTo, release, setAlias
 
Methods inherited from class org.pf.tools.cda.base.model.AAnalyzableElement
canBeAnalyzedForDependencies
 
Methods inherited from class org.pf.tools.cda.base.model.AModelObject
apply, countAllElementsRecursivly, getNumberOfAncestors, getProperty, getPropertyNames, setProperty
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pfsw.odem.IObjectProperties
getProperty, getPropertyNames, setProperty
 

Field Detail

EMPTY_ARRAY

public static final ClassContainer[] EMPTY_ARRAY
Constructor Detail

ClassContainer

public ClassContainer(ContainerSpecificationElement containerSpec,
                      Workset aWorkset)
Initialize the new instance with default values.

Method Detail

getContainerSpecificationElement

public ContainerSpecificationElement getContainerSpecificationElement()

getThirdPartyFlag

public boolean getThirdPartyFlag()

setThirdPartyFlag

public void setThirdPartyFlag(boolean isThirdPartyLibrary)
Sets whether or not this container is a third party library


getManifestContent

public java.lang.String getManifestContent()

setManifestContent

public void setManifestContent(java.lang.String newValue)

collectionToArray

public static ClassContainer[] collectionToArray(java.util.Collection coll)

filterCorrectType

public static ClassContainer[] filterCorrectType(GenericClassContainer[] genericClassContainers)

getName

public java.lang.String getName()
Returns the name of the class container

Specified by:
getName in interface IExplorationModelObject
Specified by:
getName in class AModelObject

openClassFile

public java.io.InputStream openClassFile(ClassInformation classInfo)
                                  throws java.io.IOException
Opens the class file that corresponds to the given class information in this container and returns the input stream.

Throws:
java.io.IOException

getMainClass

public ClassInformation getMainClass()

isThirdPartyLibrary

public boolean isThirdPartyLibrary()
Returns true if this container represents a third party library.

Overrides:
isThirdPartyLibrary in class GenericClassContainer

isInitializable

public boolean isInitializable()
Returns true if this class container can be initialized


isValid

public boolean isValid()
Returns true if this class container is valid, that is it exists and can be read from.

Specified by:
isValid in class GenericClassContainer

isMetaData

public boolean isMetaData()
Returns true if this class container is defined by meta data rather than binary files.


isArchive

public boolean isArchive()
Returns true if this container is an archive


isDirectory

public boolean isDirectory()
Returns true if this container is a directory


hasMainClass

public boolean hasMainClass()
Returns true if this container has a Main-Class declared in its manifest.


close

public void close()
Closes the underlying classpath element if it is an archive


toString

public java.lang.String toString()
Overrides:
toString in class GenericClassContainer

displayString

public java.lang.String displayString(org.pf.text.StringFilter folderFilter)
Returns the name of this container for display. This may be a shortened version if isShortContainerNamesOn() returns true.

Overrides:
displayString in class GenericClassContainer
Parameters:
folderFilter - A filter for the trailing folder names that must be retained for display
See Also:
GenericClassContainer.isShortContainerNamesOn()

shortDisplayString

public java.lang.String shortDisplayString(org.pf.text.StringFilter folderFilter)
Returns the short name of this container for display.

Parameters:
folderFilter - A filter for the trailing folder names that must be retained for display

reset

public void reset()
Resets the internal state. That means a new initialization of this container is necessary in order to use it.


changeThirdPartyFlag

public void changeThirdPartyFlag(boolean isThirdPartyLibrary)
Sets whether or not this container is a third party library


changeAlias

public void changeAlias(java.lang.String aliasName)
Sets the alias of this container.


getVersion

public org.pf.text.Version getVersion()
Description copied from class: GenericClassContainer
Returns the version of this container or null if no version is assigned to this container.

Overrides:
getVersion in class GenericClassContainer