Skip to content
mdutoo edited this page Jul 3, 2012 · 9 revisions

This started as an output of #65 "Service discovery by parsing implementation source code".

Overview

2012.06.29 @mkalam-alami update

  • Enunciate: Generates documentation & clients for web services. Uses apt-jelly for annotation processing.
  • Qdox: Javadoc parser, can parse annotations/comments/etc, quite simple, not updated since 2010 but still has active members (a v2.0, with support of Java 1.7 is on its way). Used by Maven to parse code during plugins generations. (@mkalam-alami's preference for "code discovery")
  • JavaParser: Java 1.5 code parser, not very active anymore.
  • Parboiled: Generic grammar-based parser, has a maintained, Java 1.6-compatible grammar, except it doesn't parse the comments (can be fixed by tweaking the grammar). Recent, with active community.
  • ANTLR: Parser generator, grammars are available for Java 1.6, but seems quite complex to use (Parboiled claims to be a good balance between 'hacky Regexps' & full-blown parser generators such as ANTLR).

Sonar

sonar architecture

sonar is

sonar architecture - core engine : squid

sonar architecture - metrics

sonar-core-plugin :

  • CorePlugin : hooks all extensions in
  • an extension implements (Server)Extension and various business interfaces (ex. Chart, Metrics)
  • ex. UserManagedMetrics implements api.measures.Metrics and api.ServerExtension

sonar-plugin-api :

  • measures.Measure has name, value, a few variations...
  • measures.CoreMetrics defines NCLOC, nb of files...

sonar-squid-java-plugin :

  • bridges.Bridge interface has visitor methods : onFile(), onClass(), onMethod()...
  • all impls created in bridges.BridgeFactory
  • bridges.CopyBasicMeasuresBridge copies squid metrics to sonar ones
  • ast.JavaAstScanner : here all AST visitors are plugged in getVisitorClasses()
  • ex. KLOC visitor ast.visitor.LinesOfCodeVisitor uses Source to get metric
  • ex. ClassVisitor measures nb of class, itf, abstract in visitToken()

sonar-ws-client :

provides & query metrics, rules...

TODO how to add nb ws metric :

  • create a new AstVisitor, look at annotations in onClass(), hack JavaAstScanner to hook it in
  • then either call EasySOA directly
  • or hack create another bridge to put it in sonar and hack BridgeFactory to put it in, ?? hack CoreMetrics / implement a new ServerExtension, hack UI (?) or do something like CustomMeasuresWidget

sonar architecture - coding rules

  • sonar-check-api
  • check.Rule
  • sonar-findbugs-plugin :
  • FindbugsSensor parses findbugs report, creates & saves Violations in sonar SensorContext

TODO How to extend them :

sonar plugins

sonar plugins - test coverage

sonar plugins - architecture

Swagger

what : REST API framework

more about fct :

more about impl :

examples :

more about client gen codegen https://github.com/wordnik/swagger-codegen :

integrating it with easysoa - ideas :

  • (replaces easysoa doc & test ui) TODO in web discovery : recognize the swagger spec and upload it in the model as primary interface (instead of wadl) ; then make it useful : doc & test playground (add a link in the different environments to the api doc in the swagger online doc UI, possibly embedded), test (generate shell commands for CLI & test generation, or even embed it). NB. this renders copying the bare HTML doc itself useless.
  • LATER ? in code discovery : parse swagger annotations and enrich the easysoa doc model with them as well as the easysoa doc ui, compare it with the json spec got from web discovery, ?? in client code compare spec with server's, add versioning...
Clone this wiki locally