Details
-
Improvement
-
Status: Open
-
Normal
-
Resolution: Unresolved
-
None
-
None
-
None
-
1
-
Pulsar
-
!Pulsar - Misc brXM
Description
At this moment, the HstModel interface looks as follows:
public interface HstModel { ClassLoader getWebsiteClassLoader(); VirtualHosts getVirtualHosts(); HstSiteMapMatcher getHstSiteMapMatcher(); HstLinkCreator getHstLinkCreator(); }
The implementation contains:
public HstModelImpl(final Session session, final String contextPath, final ClassLoader websiteClassLoader, final ComponentManager websiteComponentManager, final HstNodeLoadingCache hstNodeLoadingCache, final HstConfigurationLoadingCache hstConfigurationLoadingCache) throws RepositoryException { // SNIP hstLinkCreator = new DefaultHstLinkCreator(); configureHstLinkCreator(); private void configureHstLinkCreator() { final List<String> binaryLocations = websiteComponentManager.getComponent(HstLinkCreator.class.getName() + ".binaryLocations"); hstLinkCreator.setBinaryLocations(binaryLocations.toArray(new String[binaryLocations.size()])); // SNIP }
The HstLinkCreator instance lives in the platform webapp, and is instantiated hard-coded
hstLinkCreator = new DefaultHstLinkCreator();
After this, it gets configured by using certain beans from the websiteComponentManager, for example the binaryLocations.
The question now is, do we really want to use
hstLinkCreator = new DefaultHstLinkCreator();
Could we have this wired by Spring configuration in the platform webapp? The advantage is that it is more flexible, and we can hook in different link creators, for example during integration tests. Tricky part is that every endproject webapp however needs its OWN HstLinkCreator instance because the configureHstLinkCreator() is done PER endproject webapp (ok and also by the platform webapp since that one also contains the hst-core).
We could opt for wiring in the platform webapp via Spring an HstLinkCreatorFactory which is used to create a new HstLinkCreator intance. Also the custom configuration could be handled by having the HstLinkCreatorFactory creation method as extra argument the website component manager