2 Replies Latest reply on Feb 10, 2015 1:35 PM by mani_mylavarapu

    forge is great but...

    fazertyplus

      Hello,

       

      I lke to use forge to create applications. The possibility to create addons is the best feature of forge but it is laking of documentation.

      I recently found some explanation in the forge hol but I still have a lot of questions:

      What are /How to use ...:

           - DependencyInstaller / Dependency

           - ProjectFactory

           - AbstractProjectCommand

           - AddAddonDependencyCommand

           - UIWizardStep / UIWizard

           - ScaffoldProvider

           - ...

       

      Can someone explain the structure of the addons created by forge?

      - addon

           - addon-api

           - addon-impl

           - addon-parent

           - addon-test

       

      I'm creating an addon. How this addon can 'call' another addon:

      For example:

          - I would like from the addon to create a JPA entity

          - I would like from the addon to install an addon within a project with specific parameters

       

      I would like also a simple example showing how to use templates.

       

      Thanks

        • 1. Re: forge is great but...
          gastaldi

          Hello,

           

          Let me try to answer these in sequence:

           

          - DependencyInstaller is a service that can be @Injected (or looked up through the AddonRegistry) to add dependencies in your build descriptor

          -  ProjectFactory creates and finds projects. Projects are found/created through ProjectProvider implementations (Maven, Gradle, etc)

          - AbstractProjectCommand is a specialization of UICommand providing a getProject method and some methods (isProjectRequired()) that are bound to the existence of a Project in the current context in order to work

          - AddAddonDependencyCommand as the name says, adds addon dependencies to a project.

          - UIWizardStep/UIWizard are specializations of UICommand to provide multi-step wizards. See core/ui at master · forge/core · GitHub for more info

          - ScaffoldProvider is an SPI to support multiple scaffold implementations

           

          The structure proposed by new forge addons provides a clean separation of concerns, so you avoid for example, using implementation details on addons that will consume your addon.

           

          For an addon to call another addon, you need to @Inject the service the other addon exposes. See forge/core · GitHub for more info

          To create a JPA Entity, you can @Inject the PersistenceOperations service from the javaee addon.

           

          At last, but not least, see the "Process a Freemarker Template" example in http://forge.jboss.org/document/run-forge-embedded

           

          Hope that helps!

           

          George Gastaldi

          • 2. Re: forge is great but...
            mani_mylavarapu

            George.

            Beautifully explained Thank you!I had the same doubts.