KEMBAR78
Custom audit rules in Jdeveloper extension | PPTX
Presented by
Vinay Kumar
SILBURY IT SOLUTION GMBH
10/04/2014
Custom Audit Rules in Jdeveloper 12c
• Audit in JDeveloper
• Extension in Jdeveloper 12c
• Set up extension environment
• Creation Extension project
• Create Audit Rule
• Suppress Warning
• Run Extension
• Test Extension
Agenda
• 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
• 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
.
.
• Install Extension SDK (Help- Check for updates)
• Search for Extension SDK
• Add this update in your Jdeveloper
Setting up Extension workspace
Create New Extension project
File -> New- Applications -> Extension Application
extension.xml & Manifest.MF
Bundled as .zip
Distributed through Jdeveloper update center Or Drive
• `
New Extension Application
Application structure
Add Dependencies
Create new custom rule
.
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
Properties file
Label definition file
.
Rule Id mapped in extension.xml
•.
Class should extend analyzer
.
Report violated rule to AuditContenxt
• 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
• 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
• 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.
.
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
SuppressWarning Annotation
• Indicate to suppress this warning in workspace for all elements.
• Suppressed warning in jdeveloper by annotation.
SuppressWarning Annotation
• 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
Run & Test Audit Rule Extension
• 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
.
• Analyzer Class-Oracle Documentation
• Developing Extensions for Oracle Jdeveloper
• blog on extension
• blog by Richard
References
.
Happy Auditing With Jdeveloper
Thanks

Custom audit rules in Jdeveloper extension

  • 1.
    Presented by Vinay Kumar SILBURYIT SOLUTION GMBH 10/04/2014 Custom Audit Rules in Jdeveloper 12c
  • 2.
    • Audit inJDeveloper • Extension in Jdeveloper 12c • Set up extension environment • Creation Extension project • Create Audit Rule • Suppress Warning • Run Extension • Test Extension Agenda
  • 3.
    • Audit isa 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 hasa 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
  • 5.
  • 6.
  • 7.
    • Install ExtensionSDK (Help- Check for updates) • Search for Extension SDK • Add this update in your Jdeveloper Setting up Extension workspace
  • 8.
    Create New Extensionproject File -> New- Applications -> Extension Application extension.xml & Manifest.MF Bundled as .zip Distributed through Jdeveloper update center Or Drive
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
    Extension.xml Java Analyzer classmapping with rule Audit Hook display name Rule Id mapping Severity element can be set to one from these options. -Error -Warning -Incomplete -Advisory -Assist
  • 15.
  • 16.
    . Rule Id mappedin extension.xml •. Class should extend analyzer
  • 17.
    . Report violated ruleto AuditContenxt
  • 18.
    • A visitorover 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 frameworktraverses 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 voidenter(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 AuditManager 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
  • 22.
    SuppressWarning Annotation • Indicateto suppress this warning in workspace for all elements.
  • 23.
    • Suppressed warningin jdeveloper by annotation. SuppressWarning Annotation
  • 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
  • 25.
    Run & TestAudit Rule Extension
  • 26.
    • Create bundle.xmlin 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
  • 27.
  • 28.
    • Analyzer Class-OracleDocumentation • Developing Extensions for Oracle Jdeveloper • blog on extension • blog by Richard References
  • 30.
  • 31.
    Happy Auditing WithJdeveloper Thanks

Editor's Notes

  • #4 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.
  • #5 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.