2. • Audit in JDeveloper
• Extension in Jdeveloper 12c
• Set up extension environment
• Creation Extension project
• Create Audit Rule
• Suppress Warning
• Run Extension
• Test Extension
Agenda
3. • Audit is a planned and documented activity performed by qualified personnel to determine by
investigation, examination, or evaluation of objective evidence, the adequacy and compliance with
established procedures, or applicable documents, and the effectiveness of implementation
• Analysis of code with set of metrics and guidelines .
• Auditing in Jdeveloper- Auditing is the static analysis of code for adherence to rules and metrics that
define programming standards. Auditing finds defects that make code difficult to improve and
maintain. The JDeveloper auditing tools help you find and fix such defects. Code can be audited even
when it is not compilable or executable.
What is Audit
4. • JDeveloper has a built in Audit framework with lots of rules that
you can turn on or off.
• Also can create new custom audit rules .
• Based on Visitor design pattern.
• Able to create new Audit rules.
• Rules can be configurable
• Generate warning or error compile time.
• Help in improving code quality.
• Auditing finds defects that make code difficult to improve and
maintain
• JDeveloper auditing feature to analyze Java code for
conformance to programming standards.
Audit Framework in jdeveloper
7. • Install Extension SDK (Help- Check for updates)
• Search for Extension SDK
• Add this update in your Jdeveloper
Setting up Extension workspace
8. Create New Extension project
File -> New- Applications -> Extension Application
extension.xml & Manifest.MF
Bundled as .zip
Distributed through Jdeveloper update center Or Drive
14. Extension.xml
Java Analyzer class mapping
with rule
Audit Hook display name
Rule Id mapping
Severity element can be set to one from these options.
-Error
-Warning
-Incomplete
-Advisory
-Assist
18. • A visitor over the Audit object models which verifies rules and/or computes metrics.
• Analyzer subclass implements visitor methods which are invoked by the Audit
framework as it traverses the Audit object models i.e. enter & exit
• Visitor methods (enter & exit) report violations and measurements using the
reporting methods of a context object passed to them.
• getRules & getMetrics provide rules& metric of analyzer to framework .
• Analyzers (classes) are registered with the AuditManager at startup by IDE
extensions.
oracle.jdeveloper.audit.analyzer.Analyzer
19. • Audit framework traverses the constructs of the object models corresponding to the nodes being
audited and at each construct invokes the applicable enter and exit methods of each registered
analyzer.
• enter and exit methods accept two parameters, a context and a construct.
• Visitor method called each workspace, source class, document, element, attribute, method.
• Violations and measurements, suppression are reported by the visitor methods using the report
method.
• Setting attributes for child & parent construct.
interface AuditContext
Context, construct
20. • public void enter(AuditContext context, Workspace workspace)
This methods contains the workspace (application) validation code. In our case we do not use it.
• public void enter(AuditContext context, Project project)
This methods contains the project validation code. In our case we do not use it.
• public void enter(AuditContext context, Document document)
This method contains the code to analyze and validate documents.
• public void enter(AuditContext context, Element element)
This method contains the code to analyze and validate individual element.
.
21. Analyzers registered
with Audit Manager
on start up by IDE
Each analyzer create
instance and fetch
rules using getRules
method
each construct
invokes methods of
registered analyzer
Enter & exit method
invoked as per match
the construct
Check/analyze
information in visitor
methods and report
to context
Audit framework flow
24. • Make Extension.jpr
• Deploy to Target Platform
• Run Extension
• New Jdevloper instance open
• Tools -> Preferences -> Audit -> Profiles and find rule
• Test rule.
Run & Test Audit Rule Extension
26. • Create bundle.xml in project
• Create an extension package which consists of a JAR that is packaged in
an extension bundle archive
• Change extension JAR files into a .zip file for distribution
Packaging Extension
How presentation will benefit audience: Adult learners are more interested in a subject if they know how or why it is important to them.Presenter’s level of expertise in the subject: Briefly state your credentials in this area, or explain why participants should listen to you.
Example objectivesAt the end of this lesson, you will be able to:Save files to the team Web server.Move files to different locations on the team Web server.Share files on the team Web server.