public class Workset extends AAnalyzableElement implements org.pfsw.odem.IExplorationContext, IClassContainingElement, IWorksetInitializationListener
IWorksetInitializationListener.EventType
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_DIRTY |
EMPTY_MODEL_OBJECT_ARRAY
EMPTY_BASE_ARRAY
Constructor and Description |
---|
Workset(java.lang.String worksetName)
Initialize the new instance with a name.
|
Workset(java.lang.String worksetName,
java.lang.String... classpathElements)
Convenience constructor that allows to specify a new workset with the given name
and an arbitrary list or classpath elements (folders, jar files, war files, ...).
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(org.pfsw.odem.IExplorableElementVisitor visitor)
Implementation of the visitor pattern (GOF) for all derived interfaces
if IExplorableElement.
|
boolean |
acceptTypes(org.pfsw.odem.ITypesVisitor visitor)
Implementation of the visitor pattern (GOF) for all derived interfaces
if IExplorableElement.
|
void |
addClasspathPartDefinition(ClasspathPartDefinition partDefinition)
Adds the classpath definition to this workset.
|
void |
addClasspathPartDefinitions(ClasspathPartDefinition... partDefinitions)
Adds all specified classpath definitions to this workset.
|
void |
addIgnoreFilter(StringFilter filter)
Adds the given filter to the filter collection that defines which
classes should be ignored (i.e.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a listener that will be informed about important property changes.
|
void |
addReleaseListener(org.pfsw.bif.lifecycle.IReleasable releasable)
Add a listener that should be notified when this workset gets released.
|
void |
addViewFilter(StringFilter filter)
Adds the given filter to the view filter collection that defines which
classes should not be shown as dependencies.
|
boolean |
areAllClassesCollected()
Returns true if all classes have been collected.
|
boolean |
areAllContainersInitialized()
Returns true if all containers of this workset have been initialized.
|
boolean |
areAllDependenciesResolved()
Returns true if all elements in this workset have been sufficiently
resolved.
|
void |
beClean()
Sets the internal state to NOT dirty.
|
void |
beDirty()
Sets the internal state to not dirty.
|
boolean |
canBeAnalyzedForDependencies()
Returns true if this element can (currently) be analyzed for its
dependencies to other elements.
|
ClasspathPartDefinition[] |
classpathDefinitions()
Returns an array of this workset's classpath part definitions.
|
void |
closeAllPhysicalContainers()
Closes all underlying files of physical class containers (e.g.
|
protected CollectionUtil |
coll() |
Workset |
copy()
Returns a copy of this workset, where all internal elements are also
copies of their origins.
|
protected java.util.List<ClasspathPartDefinition> |
copyClasspathParts() |
java.util.List<ClassInformation> |
findClassInfos(ClassInformationFilter classFilter)
Finds all classInfo object that match the given filter.
|
java.util.List<ClassInformation> |
findClassInfos(java.util.Collection<java.lang.String> classNames)
Finds all classInfo object that correspond to the given class names.
|
java.lang.Object |
findInCache(java.lang.String section,
java.lang.Object key)
Tries to find a cached object that was stored under the given key in the
specified cache section.
|
boolean |
followClass(java.lang.String className)
Returns true, if an analyzer should follow the class with the given name.
|
ClassInformation[] |
getAllContainedClasses()
Returns all classes that are contained in this element or any of its
structural sub-elements.
|
AnalyzableElementType |
getAnalyzableElementType()
Returns the type of the analyzable element.
|
java.lang.Boolean |
getAutoReloadable() |
protected StructuredCache |
getCache() |
java.lang.Boolean |
getCalculatingHashesEnabled() |
int |
getChildCount()
Returns the current number of children.
|
AModelObject[] |
getChildren()
Returns the children
|
GenericClassContainer[] |
getClassContainers()
Returns the array or all class containers that are currently in this workset.
|
ClassInformation |
getClassInfo(java.lang.String className)
Returns the ClassInformation object corresponding to the given className.
|
protected IClassInformationFactory |
getClassInformationFactory() |
ClasspathMetadata |
getClasspathMetadata() |
java.util.List<ClasspathPartDefinition> |
getClasspathParts()
Returns all the classpath element definitions that are specified for
this workset
|
IClassSpace |
getClassSpace()
Returns the class space of this workset which holds all class containers
|
protected ClassSpace |
getClassSpaceAndFactory() |
ComponentModel |
getComponentModel() |
SoftwareComponent[] |
getComponents() |
java.util.Collection<org.pfsw.odem.IContainer> |
getContainers()
Returns a collection of all class containers that are currently contained in this workset.
|
org.pfsw.odem.IExplorationContext |
getContext()
Returns this workset itself
|
java.lang.String |
getDescription()
Returns the description of this workset
|
java.lang.String |
getFilename()
Returns the name of the file this workset was loaded from
|
StringFilterCollection |
getFollowIgnorePatterns()
Return the filters that define which classes must not be analyzed
|
protected ClassFileVersion |
getHighestClassFileVersion() |
java.lang.Boolean |
getIncludeResourceFiles() |
protected org.pfsw.tools.cda.base.model.Workset.InitState |
getInitState() |
Variables |
getLocalVariables() |
java.lang.String |
getName()
Returns the name of this workset
|
GenericClassContainer |
getNotFoundClassesContainer()
Returns the special container that is used to hold all classes that
are referred to from other classes, but are not found in any container
of the specified classpath parts.
|
int |
getNumberOfClassContainers()
Returns the number of containers in this workset
|
int |
getNumberOfContainedClasses()
Returns the number of classes in this workset
|
int |
getNumberOfContainedPackages()
Returns the number of packages in this container
|
int |
getNumberOfContainedResources()
Returns the number of resources in this workset.
|
protected AModelObject |
getParent()
Returns the parent model object, which is always null for a workset.
|
ClassContainer[] |
getPhysicalClassContainers()
Returns all "physical" containers (i.e.
|
protected java.beans.PropertyChangeSupport |
getPropertyChangeSupport() |
protected java.util.List<org.pfsw.bif.lifecycle.IReleasable> |
getReleaseListeners() |
ClassFileVersion |
getRequiredClassFileVersion()
Returns the highest class file version that one of the contained classes
is based on.
|
int |
getResolvedClassesCounter()
Returns the internal counter for resolved classes.
|
java.lang.Boolean |
getShortContainerNames() |
java.lang.Boolean |
getSpringBeanAnalysisEnabled() |
long |
getTimeForClassResolving()
Returns the time (in milliseconds) that has been passed (so far) to resolve
all classes in this workset.
|
VariablePool |
getVariablePool() |
StringFilterCollection |
getViewFilters()
Returns the filter collection that is defined to prevent classes from
being displayed.
|
Workset |
getWorkset()
Returns this workset
|
protected boolean |
hasParent()
Returns true if this object has a parent model object.
|
void |
incResolvedClassesCounter()
Increments the internal counter for resolved classes by 1.
|
protected void |
initHighestClassFileVersion() |
void |
initializationEvent(IWorksetInitializationListener.EventType type,
Workset workset)
Will be called for each event during workset initialization.
|
protected void |
initPhysicalContainers()
Iterate over all (physical) containers and initialize them from additional
meta-data.
|
protected java.lang.String |
inspectString()
Returns a string representation that is more convenient for object
inspection with JOI.
|
boolean |
isAutoReloadable()
Returns true if this workset should automatically be reloaded on startup
if it was loaded at last shutdown.
|
boolean |
isCalculatingHashesEnabled() |
boolean |
isDirty()
Returns true, if the workset has been modified
|
protected void |
isDirty(boolean newValue) |
protected boolean |
isEqual(java.util.List<ClasspathPartDefinition> listA,
java.util.List<ClasspathPartDefinition> listB) |
boolean |
isIncludeResourceFilesOn()
Returns true if for this workset container should include
resource files in its container analysis.
|
boolean |
isNew()
Returns true, if this workset has not been made persistent and therefore
has no filename associated.
|
boolean |
isShortContainerNamesOn()
Returns true if for this workset container names should be shown
in a short form.
|
boolean |
isSpringAnalysisEnabled()
Returns whether or not dependencies should also be detected by analyzing spring bean declarations.
|
void |
modifyAutoReloadable(java.lang.Boolean bool)
Sets the new value for the auto-reload flag and changes the state of the
workset to dirty.
|
void |
modifyCalculatingHashesEnabled(java.lang.Boolean enabled)
Sets whether or not calculation of hashes is supported.
|
void |
modifyDescription(java.lang.String newDescription)
Sets the new description and changes the state of the workset to dirty.
|
void |
modifyIgnorePatterns(StringFilterCollection newPatterns)
Sets the new ignore patterns and changes the state of the workset to dirty.
|
void |
modifyIncludeResourceFiles(java.lang.Boolean bool)
Sets the new value for the includeResourceFiles flag and changes
the state of the workset to dirty.
|
void |
modifyName(java.lang.String newName)
Sets the new name and changes the state of the workset to dirty.
|
void |
modifyShortContainerNames(java.lang.Boolean bool)
Sets the new value for the shortContainerNames flag and changes the state of the
workset to dirty.
|
void |
modifySpringBeanAnalysisEnabled(java.lang.Boolean enabled)
Sets whether or not dependencies should also be detected by analyzing spring bean declarations.
|
void |
modifyViewFilters(StringFilterCollection newFilters)
Sets the new view filters and changes the state of the workset to dirty.
|
boolean |
processClassContainersObjects(java.util.Collection<GenericClassContainer> collection,
IGenericClassContainerProcessor processor)
Calls the given processor's process() method for each contained class container object and
adds all class package objects that the processor wants (matches)
to the given collection.
|
boolean |
processClassContainersObjects(IGenericClassContainerProcessor processor)
Calls the given processor's process() method for each contained class container object.
|
boolean |
processClassInformationObjects(java.util.Collection<ClassInformation> collection,
IClassInformationProcessor<?> processor)
Calls the given processor for each contained class info object and
adds all class info objects that the processor wants (matches) to the given collection.
|
boolean |
processClassInformationObjects(IClassInformationProcessor<ClassInformation> processor)
Calls the given processor for each contained class info object.
|
boolean |
processClassPackageObjects(java.util.Collection<ClassPackage> collection,
IClassPackageProcessor processor)
Calls the given processor for each contained class package object and
adds all class package objects that the processor wants (matches)
to the given collection (if the collection is not null).
|
boolean |
processClassPackageObjects(IClassPackageProcessor processor)
Calls the given processor's process() method for each contained class package object.
|
boolean |
processResourceInformationObjects(IResourceInformationProcessor processor)
Calls the given processor for each contained resource info object in all containers.
|
boolean |
processSoftwareComponents(java.util.Collection<SoftwareComponent> collection,
ISoftwareComponentProcessor processor)
Calls the given processor for each contained component object and
adds all component objects that the processor wants
to the given collection.
|
boolean |
processSpringBeans(ISpringBeanProcessor beanProcessor)
Calls the given processor for each contained spring bean object in all containers.
|
boolean |
refersTo(IAnalyzableElement element)
Returns always false
|
void |
release()
Release all referred resources (particularly the cache) and archives
that have been extracted to temporary folders.
|
protected void |
releaseContainers() |
void |
releaseForReInitialization()
Release archives that have been extracted to temporary folders.
|
protected void |
releasePhysicalContainers()
Iterate over all physical containers and inform them that it is now okay
to release any external resources (e.g.
|
protected void |
releaseReleasables() |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener so that it will not be informed about important
property changes anymore.
|
void |
removeReleaseListener(org.pfsw.bif.lifecycle.IReleasable releasable)
Removes a formerly added listener for releasing resources.
|
protected void |
resetCache() |
protected void |
resetClasspathParts() |
protected void |
resetClassSpace() |
protected void |
resetFollowIgnorePatterns() |
protected void |
resetResolvedClasses() |
protected void |
resetVariables() |
protected void |
resetViewFilters() |
void |
setAutoReloadable(java.lang.Boolean newValue) |
protected void |
setCache(StructuredCache newValue) |
void |
setCalculatingHashesEnabled(java.lang.Boolean calculatingHashesEnabled) |
protected void |
setClasspathMetadata(ClasspathMetadata newValue) |
protected void |
setClasspathParts(java.util.List<ClasspathPartDefinition> newValue) |
void |
setClassSpaceAndFactory(ClassSpace newValue) |
void |
setComponentModel(ComponentModel newValue) |
void |
setDescription(java.lang.String newValue)
Sets the description of this workset
|
void |
setFilename(java.lang.String newValue)
Sets the filename this workset was stored under
|
protected void |
setFollowIgnorePatterns(StringFilterCollection newValue) |
void |
setGlobalVariables(Variables vars) |
protected void |
setHighestClassFileVersion(ClassFileVersion newValue) |
void |
setIncludeResourceFiles(java.lang.Boolean includeResourceFiles) |
protected void |
setInitState(org.pfsw.tools.cda.base.model.Workset.InitState newValue) |
void |
setLocalVariables(Variables vars) |
protected void |
setName(java.lang.String newValue) |
protected void |
setPropertyChangeSupport(java.beans.PropertyChangeSupport newValue) |
void |
setShortContainerNames(java.lang.Boolean newValue) |
void |
setSpringBeanAnalysisEnabled(java.lang.Boolean springBeanAnalysisEnabled) |
protected void |
setVariablePool(VariablePool newValue) |
protected void |
setViewFilters(StringFilterCollection newValue) |
void |
storeInCache(java.lang.String section,
java.lang.Object key,
java.lang.Object value)
Stores the given value under the specified key in the given section
of the cache.
|
java.lang.String |
toString() |
boolean |
updateFrom(Workset anotherWorkset)
Takes over all data from the given workset and then resets internal
caches and dependent information.
|
apply, applyOnChildren, applyOnStack, applySelf, canHaveDependencies, compareTo, countAllElementsRecursivly, getNumberOfAncestors, getOtherProperties, getProperty, getPropertyNames, setOtherProperties, setProperty, str, visitStackObjects
public static final java.lang.String ATTR_DIRTY
public Workset(java.lang.String worksetName)
worksetName
- The name of the new workset (must not be null).java.lang.IllegalArgumentException
- if worksetName is null.public Workset(java.lang.String worksetName, java.lang.String... classpathElements)
worksetName
- classpathElements
- public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public ClassInformation getClassInfo(java.lang.String className)
className
- The fully qualified class name (must not be null).public IClassSpace getClassSpace()
public boolean followClass(java.lang.String className)
public void addIgnoreFilter(StringFilter filter)
public void addViewFilter(StringFilter filter)
public void addClasspathPartDefinition(ClasspathPartDefinition partDefinition)
public void addClasspathPartDefinitions(ClasspathPartDefinition... partDefinitions)
public GenericClassContainer[] getClassContainers()
public java.util.Collection<org.pfsw.odem.IContainer> getContainers()
getContainers
in interface org.pfsw.odem.IExplorationContext
public ClassContainer[] getPhysicalClassContainers()
public GenericClassContainer getNotFoundClassesContainer()
public ClasspathPartDefinition[] classpathDefinitions()
public ClassInformation[] getAllContainedClasses()
getAllContainedClasses
in interface IAnalyzableElement
public void storeInCache(java.lang.String section, java.lang.Object key, java.lang.Object value)
section
- The name of the cache sectionkey
- The key under which the value can be found againvalue
- The object to cachepublic java.lang.Object findInCache(java.lang.String section, java.lang.Object key)
section
- The name of the sectionkey
- The key under which the value can be foundpublic java.util.List<ClassInformation> findClassInfos(ClassInformationFilter classFilter)
classFilter
- The filter that decides which classes are returned (must not be null).public java.util.List<ClassInformation> findClassInfos(java.util.Collection<java.lang.String> classNames)
classNames
- The full qualified class names to be found (must not be null).public void release()
release
in interface org.pfsw.bif.lifecycle.IReleasable
public void releaseForReInitialization()
public void closeAllPhysicalContainers()
public boolean areAllContainersInitialized()
public void incResolvedClassesCounter()
public boolean areAllDependenciesResolved()
public boolean areAllClassesCollected()
areAllDependenciesResolved()
public boolean isAutoReloadable()
public boolean isSpringAnalysisEnabled()
public boolean isShortContainerNamesOn()
public boolean isIncludeResourceFilesOn()
public boolean canBeAnalyzedForDependencies()
canBeAnalyzedForDependencies
in interface IAnalyzableElement
canBeAnalyzedForDependencies
in class AAnalyzableElement
public void beClean()
public void beDirty()
public void modifyName(java.lang.String newName)
public void modifyDescription(java.lang.String newDescription)
public void modifyAutoReloadable(java.lang.Boolean bool)
public void modifyShortContainerNames(java.lang.Boolean bool)
public void modifyIncludeResourceFiles(java.lang.Boolean bool)
public void modifySpringBeanAnalysisEnabled(java.lang.Boolean enabled)
public void modifyCalculatingHashesEnabled(java.lang.Boolean enabled)
public void modifyViewFilters(StringFilterCollection newFilters)
public void modifyIgnorePatterns(StringFilterCollection newPatterns)
public Workset copy()
The following instance variables are not copied:
public boolean updateFrom(Workset anotherWorkset)
public boolean isNew()
public long getTimeForClassResolving()
public void setGlobalVariables(Variables vars)
public Variables getLocalVariables()
public void setLocalVariables(Variables vars)
public int getNumberOfContainedClasses()
getNumberOfContainedClasses
in interface IClassContainingElement
public int getNumberOfContainedPackages()
public int getNumberOfClassContainers()
public int getNumberOfContainedResources()
public ClassFileVersion getRequiredClassFileVersion()
getRequiredClassFileVersion
in interface IClassContainingElement
public boolean processClassInformationObjects(java.util.Collection<ClassInformation> collection, IClassInformationProcessor<?> processor)
collection
- The collection to which the matching objects will be added. If this parameter
is null only the process() method of the given processor will be called, but never the matches() method.processor
- The processor that decides whether or not an object must be added (must not be null).public boolean processClassInformationObjects(IClassInformationProcessor<ClassInformation> processor)
processor
- The processor that gets called for each class object.public boolean processClassPackageObjects(java.util.Collection<ClassPackage> collection, IClassPackageProcessor processor)
collection
- The collection to which the matching objects will be added. If this parameter
is null only the process() method of the given processor will be called, but never the matches() method.processor
- The processor that decides whether or not an object must be added (must not be null)public boolean processClassPackageObjects(IClassPackageProcessor processor)
processor
- The processor that that will be invoked for each package (must not be null).public boolean processClassContainersObjects(java.util.Collection<GenericClassContainer> collection, IGenericClassContainerProcessor processor)
collection
- The collection to which the matching objects will be added. If this parameter
is null only the process() method of the given processor will be called, but never the matches() method.processor
- The processor that decides whether or not an object must be added (must not be null).public boolean processClassContainersObjects(IGenericClassContainerProcessor processor)
processor
- The processor that gets called for each container.public boolean processSoftwareComponents(java.util.Collection<SoftwareComponent> collection, ISoftwareComponentProcessor processor)
collection
- The collection to which the matching objects will be added (might be null)processor
- The processor that decides whether or not an object must be added (must not be null)public boolean processResourceInformationObjects(IResourceInformationProcessor processor)
processor
- The processor that will be called for each contained resource object (must not be null).public boolean processSpringBeans(ISpringBeanProcessor beanProcessor)
beanProcessor
- The processor that will be called for each contained spring bean object (must not be null).public void addReleaseListener(org.pfsw.bif.lifecycle.IReleasable releasable)
public void removeReleaseListener(org.pfsw.bif.lifecycle.IReleasable releasable)
public AnalyzableElementType getAnalyzableElementType()
getAnalyzableElementType
in interface IAnalyzableElement
public java.lang.String getName()
getName
in interface org.pfsw.odem.IExplorationModelObject
getName
in class AModelObject
public java.lang.String getDescription()
getDescription
in interface org.pfsw.odem.IExplorationContext
public void setDescription(java.lang.String newValue)
public void setClassSpaceAndFactory(ClassSpace newValue)
public StringFilterCollection getFollowIgnorePatterns()
public StringFilterCollection getViewFilters()
public java.util.List<ClasspathPartDefinition> getClasspathParts()
public ClasspathMetadata getClasspathMetadata()
public VariablePool getVariablePool()
public java.lang.String getFilename()
public void setFilename(java.lang.String newValue)
public boolean isDirty()
public java.lang.Boolean getAutoReloadable()
public void setAutoReloadable(java.lang.Boolean newValue)
public java.lang.Boolean getShortContainerNames()
public java.lang.Boolean getIncludeResourceFiles()
public void setIncludeResourceFiles(java.lang.Boolean includeResourceFiles)
public java.lang.Boolean getSpringBeanAnalysisEnabled()
public void setSpringBeanAnalysisEnabled(java.lang.Boolean springBeanAnalysisEnabled)
public void setShortContainerNames(java.lang.Boolean newValue)
public ComponentModel getComponentModel()
public void setComponentModel(ComponentModel newValue)
public int getResolvedClassesCounter()
public boolean isCalculatingHashesEnabled()
public java.lang.Boolean getCalculatingHashesEnabled()
public void setCalculatingHashesEnabled(java.lang.Boolean calculatingHashesEnabled)
public void initializationEvent(IWorksetInitializationListener.EventType type, Workset workset)
initializationEvent
in interface IWorksetInitializationListener
public boolean refersTo(IAnalyzableElement element)
refersTo
in interface IAnalyzableElement
element
- The other element to check if this analyzable element directly refers to itpublic org.pfsw.odem.IExplorationContext getContext()
getContext
in interface org.pfsw.odem.IExplorationModelObject
public boolean accept(org.pfsw.odem.IExplorableElementVisitor visitor)
accept
in interface org.pfsw.odem.IExplorableElementVisiting
visitor
- The implementor of the vistor interface to be called by this methodpublic boolean acceptTypes(org.pfsw.odem.ITypesVisitor visitor)
acceptTypes
in interface org.pfsw.odem.IExplorableElementVisiting
visitor
- The implementor of the vistor interface to be called by this methodpublic int getChildCount()
getChildCount
in class AModelObject
public AModelObject[] getChildren()
getChildren
in class AModelObject
public Workset getWorkset()
getWorkset
in interface IAnalyzableElement
getWorkset
in class AModelObject
public SoftwareComponent[] getComponents()
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean hasParent()
hasParent
in class AModelObject
protected AModelObject getParent()
getParent
in class AModelObject
protected void resetClassSpace()
protected void resetFollowIgnorePatterns()
protected void resetViewFilters()
protected void resetVariables()
protected void resetClasspathParts()
protected void resetResolvedClasses()
protected void resetCache()
protected IClassInformationFactory getClassInformationFactory()
protected java.util.List<ClasspathPartDefinition> copyClasspathParts()
protected void initHighestClassFileVersion()
protected void initPhysicalContainers()
protected void releasePhysicalContainers()
protected boolean isEqual(java.util.List<ClasspathPartDefinition> listA, java.util.List<ClasspathPartDefinition> listB)
protected void releaseReleasables()
protected void releaseContainers()
protected java.util.List<org.pfsw.bif.lifecycle.IReleasable> getReleaseListeners()
protected java.lang.String inspectString()
protected CollectionUtil coll()
coll
in class AModelObject
protected void setName(java.lang.String newValue)
protected ClassSpace getClassSpaceAndFactory()
protected void setFollowIgnorePatterns(StringFilterCollection newValue)
protected void setViewFilters(StringFilterCollection newValue)
protected void setClasspathParts(java.util.List<ClasspathPartDefinition> newValue)
protected void setClasspathMetadata(ClasspathMetadata newValue)
protected StructuredCache getCache()
protected void setCache(StructuredCache newValue)
protected void setVariablePool(VariablePool newValue)
protected void isDirty(boolean newValue)
protected org.pfsw.tools.cda.base.model.Workset.InitState getInitState()
protected void setInitState(org.pfsw.tools.cda.base.model.Workset.InitState newValue)
protected ClassFileVersion getHighestClassFileVersion()
protected void setHighestClassFileVersion(ClassFileVersion newValue)
protected java.beans.PropertyChangeSupport getPropertyChangeSupport()
protected void setPropertyChangeSupport(java.beans.PropertyChangeSupport newValue)