CdkGeneratorArchitecture

Version 3

    Description

      RichFaces CDK has flexible architecture alike Model-View-Controller design pattern implementation. The main entry point for all build tools is LibraryBuilder, that plays controller role. That class gets information about project configuration from the CdkContext, the interface that defines access to build options, input and output locations. Each particular build tools such as Maven, Ant or Eclipse builder should provide its own implementation of that interface only. LibraryBuilder itself should not relay to any particular build tool features but use that context only.

      LibraryBuilder calls a set of model builders that gather information from different sources ( Java class annotations, XML configurations, Renderer templates ) and store that inforlation in the Model. RichFaces CDK naming conventions

      LibraryModel encapsulates all information about JSF components and other objects in the current project. To speed-up development build iterations, that model could be serialized into some place in build directory therefore CDK would bypass some actions if source files has not be changed since last build. That class also contains internal procedures that keep model consistent and simplify model manipulations ( prevent duplicate values for the same objects, check links between related JSF components, lookup methods, visitor pattern support etc. ).

      Prepared model is verified by the Validator class that checks it for proper references, duplicate values and uses implementation of the NamingConventions interface to infer optional values according to the current RichFaces CDK naming conventions.

      Because even the same model objects could provide different files and classes, for example renderer template can be written as JSF Renderer Java class and as JBDS Visual Editor template, CDK contains set of writers for each particular type (<<View>> part of MVC pattern >>). Those writers are called from LibraryBuilder controller and use model to generate their output.

    Core CDK functionality implemented by using dependency injection framework Google Guice that instantiated concrete implementation of parsers, validator, generators, and utility classes and put all of them together.

    UML class diagramm:

    MVC.png