Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


oracle.jdevimpl.audit.model
Class DefaultModelFactory

java.lang.Object
  extended by oracle.jdevimpl.audit.model.DefaultModelFactory

All Implemented Interfaces:
ModelFactory

public class DefaultModelFactory
extends java.lang.Object
implements ModelFactory

The default Audit model adapter factory.

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:


Method Summary
 void addModelAdapters(java.util.Collection<ModelAdapter> models, Element element, java.net.URL url, Project project, Workspace workspace)
          If the URL is not supplied, then the Element must have been supplied and is used to determine the URL(s).
 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 project and workspace.
 int getGeneration()
           
 long getMaximumFileSize()
          Gets the size of the largest file that can be audited, in Mb.
<T extends ModelAdapter>
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 of the 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.
 void setMaximumFileSize(long maximumFileSize)
          Sets the size of the largest auditable file.
 void setWorkingSet(WorkingSet workingSet)
          Sets whether to filter projects by their current working set.
 java.lang.String toString()
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Method Detail

getModelTypeFactory

public ModelTypeFactory getModelTypeFactory()
Description copied from interface: ModelFactory
Gets the model type factory used by this model factory.
Specified by:
getModelTypeFactory in interface ModelFactory

setMaximumFileSize

public void setMaximumFileSize(long maximumFileSize)
Description copied from interface: ModelFactory
Sets the size of the largest auditable file.
Specified by:
setMaximumFileSize in interface ModelFactory
Parameters:
maximumFileSize - The size, in Mb, of the largest file that can be audited.

getMaximumFileSize

public long getMaximumFileSize()
Description copied from interface: ModelFactory
Gets the size of the largest file that can be audited, in Mb.
Specified by:
getMaximumFileSize in interface ModelFactory

setWorkingSet

public void setWorkingSet(WorkingSet workingSet)
Description copied from interface: ModelFactory
Sets whether to filter projects by their current working set.
Specified by:
setWorkingSet in interface ModelFactory

getWorkingSet

public WorkingSet getWorkingSet()
Description copied from interface: ModelFactory
Gets the working set to use when filtering projects.
Specified by:
getWorkingSet in interface ModelFactory

getModelRoot

public Location getModelRoot()
Gets the location of the root of the Audit object model.
Specified by:
getModelRoot in interface ModelFactory

getContentSetCache

public ContentCache getContentSetCache(Project project,
                                       Workspace workspace)
Description copied from interface: ModelFactory
Gets the ContentCache for a project and workspace.
Specified by:
getContentSetCache in interface ModelFactory

getModelAdapters

public java.util.Collection<ModelAdapter> getModelAdapters(Element element,
                                                           java.net.URL url,
                                                           Project project,
                                                           Workspace workspace)
Description copied from interface: ModelFactory
Gets the models corresponding to an Element or URL.
Specified by:
getModelAdapters in interface ModelFactory
Parameters:
element - 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.

addModelAdapters

public void addModelAdapters(java.util.Collection<ModelAdapter> models,
                             Element element,
                             java.net.URL url,
                             Project project,
                             Workspace workspace)
If the URL is not supplied, then the Element must have been supplied and is used to determine the URL(s).

getModelAdapter

public <T extends ModelAdapter> ModelAdapter getModelAdapter(java.lang.Class<T> type,
                                                             java.net.URL url,
                                                             Project project,
                                                             Workspace workspace)
Description copied from interface: ModelFactory
Gets the model adapter of a type corresponding to a URL, or null if none.

Using the Class of the model type to identify the model type is problematic (the concrete model type classes are not in the public API), and hopefully will be replaced with some kind of public identifier.

Specified by:
getModelAdapter in interface ModelFactory
Parameters:
type - 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.

getContainedModelAdapters

public java.util.Collection<ModelAdapter> getContainedModelAdapters(Element element,
                                                                    java.net.URL url,
                                                                    ContainerModelAdapter container)
Description copied from interface: ModelFactory
Gets the models in a container corresponding to an Element.
Specified by:
getContainedModelAdapters in interface ModelFactory
Parameters:
element - The element.
url - The URL of the element, null to extract from element.
container - The container containing the element.

close

public void close()
Description copied from interface: ModelFactory
Closes this factory.
Specified by:
close in interface ModelFactory

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Description copied from interface: ModelFactory
Gets an Audit object model configuration attribute, or null if none.
Specified by:
getAttribute in interface ModelFactory
See Also:
Auditor.setAttribute(java.lang.Object, java.lang.Object)

getAttributes

public java.util.Map getAttributes()
Description copied from interface: ModelFactory
Gets the Audit object model configuration attributes.
Specified by:
getAttributes in interface ModelFactory

getGeneration

public int getGeneration()

getOrCreateModelAdapters

public void getOrCreateModelAdapters(java.util.Collection<ModelAdapter> models,
                                     Element element,
                                     java.net.URL url,
                                     Project project,
                                     Workspace workspace)