Extension SDK 10.1.2

oracle.jdeveloper.audit.service
Class Profile

java.lang.Object
  extended byoracle.jdeveloper.audit.service.Profile

public class Profile
extends java.lang.Object

A set of analyzers with category, rule, and metric bean properties configured to specific values. A profile is essentially an analyzer factory which instantiates exactly one analyzer for each analyzer class registered with Audit and configures the properties of its beans.

Profiles are typically created with the URL of a profile file by the profile repository. The profile name and the bean property values are lazily loaded from the profile file. An auditor causes the profile to instantiate the analyzers and configure the bean properties at the start of an audit, and to release the analyzer and bean instances to the garbage collector at the end of an audit. If rerun, the auditor will cause the same profile to instantiate and configure new instances. A profile can be created in one of three ways:

  1. With a URL of a profile file. The profile name will be obtained from the file and the analyzer classes will be all those registered with Audit. The bean property configuration will be loaded and applied when the analyzer instances are created. The instances will be created on demand.
  2. With an existing profile and a new name and URL. The bean property configuration will be copied from the existing profile; if the existing profile was modified, the bean property configuration will revert to its saved state (effectively, the instances of the existing profile are given to the new profile).
  3. With one or more analyzer instances: The set of analyzer classes and instances will be those provided to the constructor. The bean property configuration will be deduced from the instances on demand.
Creation with a URL is used by the profile repository to create the profiles used by the profile dialog, and can also be used by an Audit extension to create a default profile from a profile file installed with the extension. Creation with an existing profile is used by the profile dialog Save As action. Creation with analyzer instances is used by clients that invoke Audit programmatically with specific analyzers and are only interested in a limited set of analyzers.

See Also:
Analyzer

Nested Class Summary
static class Profile.Setter
          An XML encodable setter class.
 
Field Summary
static AuditType AUDIT
           
static AuditType METRICS
           
 
Constructor Summary
Profile(AuditType type, java.lang.String name)
          Creates a new profile with all registered analyzers and with all beans in their default state, then enables all rules or metrics.
Profile(AuditType type, java.lang.String name, Analyzer analyzer)
          Creates a new profile with a specific analyzer.
Profile(AuditType type, java.lang.String name, Analyzer[] analyzers)
          Creates a new profile with specific analyzers.
Profile(AuditType type, java.net.URL url)
          Creates a new profile with all registered analyzers configured from a profile file.
Profile(AuditType type, java.net.URL url, java.lang.String name)
          Creates a new profile with all registered analyzers configured from a profile file.
 
Method Summary
 java.util.Iterator analyzers()
          Iterates the analyzers of this profile.
 java.util.Iterator beans()
          Iterates the profileable beans of this profile.
 void clear()
          Clears the instances of this profile.
 Profile createCopyAndRevert(java.lang.String name)
          Creates a new profile that is an identical copy of this profile, including any modified bean properties, and reverts this profile to its saved state.
 boolean equals(java.lang.Object object)
           
 Analyzer getAnalyzer(java.lang.Class analyzerClass)
          Gets the instance of an analyzer class from this profile.
 Profileable getBean(java.lang.Class analyzerClass, java.lang.String name)
          Gets an instance of a bean, a metric or rule, from this profile.
 java.lang.String getName()
          Gets the name of this profile.
 AuditType getType()
          Gets the type of this profile.
 java.net.URL getURL()
          Gets the URL where the contents of this profile are saved, or null if new.
 int hashCode()
           
 boolean isModified()
          Gets whether properties of the beans in this profile have been modified from their saved state.
 boolean isPredefined()
          Gets whether this profile is predefined.
 void revert()
           
 void save(java.net.URL url)
           
 void setModified(boolean modified)
          Sets whether properties of the beans in this profile have been modified from their saved state.
 void setPredefined(boolean predefined)
          Sets whether this profile is predefined.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AUDIT

public static final AuditType AUDIT

METRICS

public static final AuditType METRICS
Constructor Detail

Profile

public Profile(AuditType type,
               java.net.URL url)
Creates a new profile with all registered analyzers configured from a profile file.

Parameters:
type - The feature type (Audit or Metrics) of this profile.
url - The url of a profile file.

Profile

public Profile(AuditType type,
               java.net.URL url,
               java.lang.String name)
Creates a new profile with all registered analyzers configured from a profile file. If possible, the name should be supplied so that the file does not have to be read to determine the name.

Parameters:
type - The feature type (Audit or Metrics) of this profile.
url - The url of a profile file.
name - The name of the profile, or null to use the name in the file.

Profile

public Profile(AuditType type,
               java.lang.String name,
               Analyzer analyzer)
Creates a new profile with a specific analyzer.

Parameters:
type - The feature type (Audit or Metrics) of this profile.
name - The name of this profile.
analyzer - The single analyzer for this profile.

Profile

public Profile(AuditType type,
               java.lang.String name,
               Analyzer[] analyzers)
Creates a new profile with specific analyzers.

Parameters:
type - The feature type (Audit or Metrics) of this profile.
name - The name of this profile.
analyzers - An array of one or more analyzers for this profile.

Profile

public Profile(AuditType type,
               java.lang.String name)
Creates a new profile with all registered analyzers and with all beans in their default state, then enables all rules or metrics.

Parameters:
type - The feature type (AUDIT or METRICS) of this profile.
name - The name of this profile.
Method Detail

createCopyAndRevert

public Profile createCopyAndRevert(java.lang.String name)
Creates a new profile that is an identical copy of this profile, including any modified bean properties, and reverts this profile to its saved state. The semantics of this method may seem strange, but it does exactly what the Save As action needs.

Parameters:
name - The name for the copy.
Throws:
java.lang.IllegalArgumentException - if the profile is not reusable.

getName

public java.lang.String getName()
Gets the name of this profile.


isModified

public boolean isModified()
Gets whether properties of the beans in this profile have been modified from their saved state.


setPredefined

public void setPredefined(boolean predefined)
Sets whether this profile is predefined.


isPredefined

public boolean isPredefined()
Gets whether this profile is predefined.


setModified

public void setModified(boolean modified)
Sets whether properties of the beans in this profile have been modified from their saved state.

Parameters:
modified - true if properties have been modified.

getType

public AuditType getType()
Gets the type of this profile.

Returns:
AUDIT or METRICS.

getURL

public java.net.URL getURL()
Gets the URL where the contents of this profile are saved, or null if new.


getAnalyzer

public Analyzer getAnalyzer(java.lang.Class analyzerClass)
Gets the instance of an analyzer class from this profile.

Parameters:
analyzerClass - The class for which to get the instance.
Returns:
The singleton instance of the class.

getBean

public Profileable getBean(java.lang.Class analyzerClass,
                           java.lang.String name)
Gets an instance of a bean, a metric or rule, from this profile.


analyzers

public java.util.Iterator analyzers()
Iterates the analyzers of this profile.


beans

public java.util.Iterator beans()
Iterates the profileable beans of this profile.

Returns:
an iterator yielding the rules, metrics, and categories of this profile.

clear

public void clear()
Clears the instances of this profile.


revert

public void revert()

save

public void save(java.net.URL url)
          throws java.io.IOException
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object object)

hashCode

public int hashCode()

toString

public java.lang.String toString()

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.