1 2 Previous Next 19 Replies Latest reply: Feb 20, 2013 11:33 AM by BradW RSS

    Is it possible to have one common JHeadStart ADF Library?

    BradW
      We have a project where we are going to have 6 different UI Projects. However, I'd like to have a common UI project where we can share our common VM templates across all UI Projects. Is this possible? If so, do you have any recommendations?

      I'd really like to avoid having to copy a common template change into 6 projects.

      Thanks,


      BradW
        • 1. Re: Is it possible to have one common JHeadStart ADF Library?
          Stephen J.
          Hi Brad,
          I don't know if there's a way to do this from within JHeadstart or JDeveloper, but you might be able to do it from your version management tool.

          In subversion (if that's what you're using) you could create a repository for just your custom templates, then include that as an external source in the repositories for all of your apps.
          • 2. Re: Is it possible to have one common JHeadStart ADF Library?
            BradW
            Thanks Stephen. That was helpful. I'll see what I can do on this. I'll also post an update here on this.
            • 3. Re: Is it possible to have one common JHeadStart ADF Library?
              BradW
              I tried to do this in a sample project.
              1) Included the resources from the common JHS application into a sample application.
              2) Enabled JHS on sample application
              3) Removed templates directory from sample application
              4) Fired up JAG and got exception

              So, it looks like the directories have to exist inside of the project itself.

              I will try and see if we can use some good old fashioned Windows linked directories to see if this helps the situation.

              Regardless, it would be great if JHS was configurable in a way to allow development approaches using some of the commonly accepted Architecture Patterns for large Enterprise applications.


              Thanks,


              BradW
              • 4. Re: Is it possible to have one common JHeadStart ADF Library?
                BradW
                Ok, so I was able to do this.

                1) Removed the resource dependency with the common ui project.
                2) Delete the config, default and nls folders inside of the templates directory of the sample project
                3) Create symbolic links on Windows 7 using the mklink -d config ..\..\CommonUI\templates\config etc

                I was then able to open up the JAG. I think this may work out well as it doesn't really know about the common directories. Any user templates go under templates/custom, which should be just fine. Any common templates get updated via the common project.

                From an automated build perspective, all should be well as we don't care about the JAG at that point.

                Thanks for leading me down an ok work around.


                BradW
                • 5. Re: Is it possible to have one common JHeadStart ADF Library?
                  BradW
                  While not ideal, we may have a solution which works without having to duplicate a lot of code everywhere.
                  • 6. Re: Is it possible to have one common JHeadStart ADF Library?
                    Steven Davelaar-Oracle
                    Brad,

                    If you want to share Jhs templates accross UI projects, you can simply change the application-level property "Templates Base Directory". In this property, you can specify either an absolute path, or a path relative to the project root. You can also use ..\.. to go down and up the folder structure to reach your UICommon project.

                    Steven Davelaar,
                    Jheadstart Team.
                    • 7. Re: Is it possible to have one common JHeadStart ADF Library?
                      BradW
                      Thanks Steven. I guess I just assumed that the templates all had to be relative to the public_html folder. If not, I'm wondering how the application would be packaged up for deployment as the templates need to be there.

                      I'll give this a try later today.

                      Thanks,


                      BradW
                      • 8. Re: Is it possible to have one common JHeadStart ADF Library?
                        Steven Davelaar-Oracle
                        Brad,

                        Ahh, you mean the ADF Faces .jspx page templates?
                        I thought you meant velocity generation templates, so ignore my previous reply then.

                        Yes, for .jspx page templates you can create a common JHS ADF library, see also the dev guide, section 2.4

                        Steven Davelaar,
                        Jheadstart Team.
                        • 9. Re: Is it possible to have one common JHeadStart ADF Library?
                          BradW
                          Thanks for the tip Steven. However, this doesn't help me share templates between ViewController projects. Each JHS View Controller project would need to have it's own page templates. What I would like to have been able to do is have one set of page templates that is shared across the different View Controller projects. If we needed a custom page template, we would just make sure it is unique across the different services. So,if we have 6 Sub System View Controller projects all wanting to share the same page template, there would be no way of doing this right now. We would need to copy the templates to the different projects. Is this a correct assumption?

                          Thanks again for the document reference. Good information.


                          BradW
                          • 10. Re: Is it possible to have one common JHeadStart ADF Library?
                            Steven Davelaar-Oracle
                            Brad,

                            I am a bit confused. When you started this thread you talked about Velocity vm templates.
                            You can share those using a relative path in application-level setting Templates base Directory. Make sure that all application definition files in all your UI projects point to the same directory,
                            This allows you to share one set of JHeadstart generator Velocity templates accross all projects.
                            You cannot share vm templates using an ADF library, and it wouldnt make sense either because you don't need them at runtime.

                            To share generated runtime ADF Faces templates, you need to package them in an ADF library and import that library in your UI projects.

                            Is this what you are looking for?

                            Steven Davelaar,
                            Jheadstart Team.
                            • 11. Re: Is it possible to have one common JHeadStart ADF Library?
                              BradW
                              Hi Steven. I think I'm talking about both. :) I also think that you've covered this off nicely now. Thanks.
                              • 12. Re: Is it possible to have one common JHeadStart ADF Library?
                                BradW
                                I am attempting to try what you were suggesting. The JHS Velocity Templates work great via a relative path.

                                However, I'm having challenges with having the JHS JSF templates. I've created an ADF Library with my jsf templates. They show up in the SubSystem page templates. However, whenever I try to run the application, I get the following errors:
                                java.lang.NullPointerException
                                     at oracle.jheadstart.controller.jsf.util.MessageFactory.getMessageText(MessageFactory.java:161)
                                     at oracle.jheadstart.controller.jsf.util.MessageFactory.getMessage(MessageFactory.java:127)
                                     at oracle.jheadstart.controller.jsf.util.MessageFactory.getMessage(MessageFactory.java:121)
                                     at oracle.jheadstart.controller.jsf.util.MessageFactoryMap.get(MessageFactoryMap.java:107)
                                at javax.el.MapELResolver.getValue(MapELResolver.java:164)
                                etc.

                                If I copy the JHS templates to the SubSystem application public_html location, the application works fine. It seems that the JHS controller can't find the template in the WAR file as an ADF Library. The ADF Library is there and the page templates are also there. You see a common/pageTemplates directory right inside of the jar file for the library in the WEB-INF/lib folder. I can even create a new page and use the template successfully.

                                To me, the ADF Library looks good. However, at runtime, the error is raised. Note: I am using ADF 11.1.2.3 and the latest JHS implementation.

                                Any suggestions?


                                BradW
                                • 13. Re: Is it possible to have one common JHeadStart ADF Library?
                                  Steven Davelaar-Oracle
                                  Brad,

                                  Hmm, quite strange, the NPE in MessageFactory is on this line:

                                  message = RenderingContext.getCurrentInstance().getTranslatedString(messageId);

                                  So, that would imply the RenderingContext is null which is unrelated to JHeadstart. I have no clue what the issue can be.

                                  Can you try to create a testcase using HR schema that reproduces the error and send it to idevcoe_nl@oracle.com?

                                  Thanks,
                                  Steven Davelaar,
                                  JHeadstart Team.
                                  • 14. Re: Is it possible to have one common JHeadStart ADF Library?
                                    BradW
                                    Ok, will do.

                                    Note, I also tried creating a standalone template and include it in the View Controller project and it works! I will see if I can package this up for you soon.
                                    1 2 Previous Next