public class DefaultModelFactory extends java.lang.Object implements ModelFactory
The getModelAdapters(oracle.ide.model.Element, java.net.URL, oracle.ide.model.Project, oracle.ide.model.Workspace) method gets models corresponding to workspaces,
projects, directories, and files based on Element, URL, or
both. Each project is qualified by the workspace that contains it; each
directory is qualified by the workspace and project that contains it, and
each file is qualified by the workspace, project, and directory that contains
it. For example, if a project is contained by two workspaces and both
workspaces are audited, two models corresponding to the project will be
created and processed, one for each workspace.
Usually there is only one model type for an Element type, but
Audit does support registering multiple model types for an Element
type. In such a case, a model for each type will be created.
Directories and files are incorporated into projects through content sets. A content set defines one or more root directories and a pattern filter to be applied to the relative paths of files and directories directly or indirectly contained by a root directory.
A single directory can be contained by multiple content sets, possibly with different roots, and therefore implying different relative paths. Because of the semantic significance of the relative path (Java packages and so on), a model will be created for each different root directory among the content sets containing the directory.
Further, for each file in a directory which mapped to multiple models, a file model of the file will be created for each directory.
Files and directories are keyed by workspace, project, and URL. Whenever the models for a key have not yet been created, all the models for that key are created, and all the containing models are also created.
The algorithm is basically this:
Element must have been
supplied and is used to determine the URL(s).
Element is not supplied, it is determined from the URL.
ModelTypeFactory.
For each container model and for each type, a model is created.
Element supplied only maps to some of the models implied
by its URL(s), only those models are returned to the caller, but all the
created models are retained internally.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this factory.
|
java.lang.Object |
getAttribute(java.lang.Object key)
Gets an Audit object model configuration attribute, or null if none.
|
java.util.Map |
getAttributes()
Gets the Audit object model configuration attributes.
|
java.util.Collection<ModelAdapter> |
getContainedModelAdapters(Element element,
java.net.URL url,
ContainerModelAdapter container)
Gets the models in a container corresponding to an
Element. |
ContentCache |
getContentSetCache(Project project,
Workspace workspace)
Gets the
ContentCache for a workspace, or a project in a workspace. |
IntersectedFilters |
getFileFilters()
Gets the supplemental filters to use when filtering application content,
projects, and project content.
|
long |
getMaximumFileSize()
Gets the size of the largest file that can be audited, in Mb.
|
<T extends ModelAdapter> |
getModelAdapter(java.lang.Class<T> type,
java.net.URL url,
Project project,
Workspace workspace)
Gets the model adapter of a type corresponding to a URL, or null if none.
|
java.util.Collection<ModelAdapter> |
getModelAdapters(Element element,
java.net.URL url,
Project project,
Workspace workspace)
Gets the models corresponding to an
Element or URL. |
Location |
getModelRoot()
Gets the location of the root object of the aggregated Audit object model.
|
ModelTypeFactory |
getModelTypeFactory()
Gets the model type factory used by this model factory.
|
void |
getOrCreateModelAdapters(java.util.Collection<ModelAdapter> models,
Element element,
java.net.URL url,
Project project,
Workspace workspace)
The workspace/project/URL key is computed.
|
WorkingSet |
getWorkingSet()
Gets the working set to use when filtering projects and project content.
|
void |
setFileFilters(IntersectedFilters filters)
Sets the supplemental filters to use when filtering application content,
projects, and project content.
|
void |
setMaximumFileSize(long maximumFileSize)
Sets the size of the largest auditable file.
|
void |
setWorkingSet(WorkingSet workingSet)
Sets the working set to use when filtering projects and project content.
|
java.lang.String |
toString() |
public ModelTypeFactory getModelTypeFactory()
ModelFactorygetModelTypeFactory in interface ModelFactorypublic void setMaximumFileSize(long maximumFileSize)
ModelFactorysetMaximumFileSize in interface ModelFactorymaximumFileSize - The size, in Mb, of the largest file that can be audited.public long getMaximumFileSize()
ModelFactorygetMaximumFileSize in interface ModelFactorypublic void setWorkingSet(WorkingSet workingSet)
ModelFactorysetWorkingSet in interface ModelFactorypublic WorkingSet getWorkingSet()
ModelFactorygetWorkingSet in interface ModelFactorypublic void setFileFilters(IntersectedFilters filters)
ModelFactorysetFileFilters in interface ModelFactorypublic IntersectedFilters getFileFilters()
ModelFactorygetFileFilters in interface ModelFactorypublic Location getModelRoot()
ModelFactorygetModelRoot in interface ModelFactorypublic ContentCache getContentSetCache(Project project, Workspace workspace)
ModelFactoryContentCache for a workspace, or a project in a workspace.getContentSetCache in interface ModelFactoryproject - The project, if getting the cache for the project, or
null if getting the cache for the workspace.workspace - The workspace.public java.util.Collection<ModelAdapter> getModelAdapters(Element element, java.net.URL url, Project project, Workspace workspace)
ModelFactoryElement or URL.getModelAdapters in interface ModelFactoryelement - The element.url - The URL containing the element. Ignored if
element is a node or a directory.project - The project containing the element. Ignored if
element corresponds to a project.workspace - The workspace containing the element. Ignored if
element corresponds to a workspace.public <T extends ModelAdapter> T getModelAdapter(java.lang.Class<T> type, java.net.URL url, Project project, Workspace workspace)
ModelFactorygetModelAdapter in interface ModelFactorytype - The Class of the model type of the model.url - The URL containing the model.project - The project containing the model.workspace - The workspace containing the model.public java.util.Collection<ModelAdapter> getContainedModelAdapters(Element element, java.net.URL url, ContainerModelAdapter container)
ModelFactoryElement.getContainedModelAdapters in interface ModelFactoryelement - The element.url - The URL of the element, null to extract from element.container - The container containing the element.public void close()
ModelFactoryclose in interface ModelFactorypublic java.lang.Object getAttribute(java.lang.Object key)
ModelFactorygetAttribute in interface ModelFactoryAuditor.setAttribute(java.lang.Object, java.lang.Object)public java.util.Map getAttributes()
ModelFactorygetAttributes in interface ModelFactorypublic void getOrCreateModelAdapters(java.util.Collection<ModelAdapter> models, Element element, java.net.URL url, Project project, Workspace workspace)
Element is not supplied, it is determined form the URL.
ModelTypeFactory.
For each container model and for each type, a model is created.
Element supplied only maps to some of the models implied
by its URL(s), only those models are returned to the caller, but all the
created models are retained.public java.lang.String toString()
toString in class java.lang.Object