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.
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.
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.
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.
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.
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.
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
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.
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?
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:
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 184.108.40.206 and the latest JHS implementation.
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 firstname.lastname@example.org?