[ https://issues.apache.org/jira/browse/OFBIZ-4240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015112#comment-13015112 ]
Adrian Crum commented on OFBIZ-4240: ------------------------------------ >From my perspective, having the ability to override UI label files with entity >data is a worthwhile improvement. In multi-tenant deployments, tenants would >be able to customize their UI labels. Implementing that capability will not be a simple task: Entities to store the properties need to be defined, UtilProperties.java needs to be refactored, and all code that uses UI labels will need to supply a delegator name to the appropriate UtilProperties method. > Override UiLabels / Properties through tenant specific database > --------------------------------------------------------------- > > Key: OFBIZ-4240 > URL: https://issues.apache.org/jira/browse/OFBIZ-4240 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: SVN trunk > Reporter: PR > Assignee: Adrian Crum > Priority: Minor > Labels: properties > > UtilProperties being in base gets complied and loaded first ahead of both > entity and service modules. So, as such the service and entity classes won't > be available there directly. Now the attempt is to have a embedded service > call within the UtilProperties.getBundle(.....) method right after the lines > below > Properties newProps = getProperties(resource, candidateLocale); > if (UtilValidate.isNotEmpty(newProps)) { > // The last bundle we found becomes the > parent of the new bundle > The idea is that by default a set of properties would be loaded from the > UiLabels.xml files. However, right after we should be able to call a service > to override any labels (in newProps) passing the newProps as an argument. > So far, so good ? > Next the problem... How to configure a service call? Find the below usage in > base module > ClassLoader loader = Thread.currentThread().getContextClassLoader(); > Iterator<Init> cachedClassLoaders = ServiceLoader.load(Init.class, > loader).iterator(); > while (cachedClassLoaders.hasNext()) { > Init cachedClassLoader = cachedClassLoaders.next(); > try { > cachedClassLoader.loadClasses(loader); > } catch (Exception e) { > Debug.logError(e, "Could not pre-initialize dynamically > loaded class: ", module); > } > } > So, can we write a class say UtilTenantProperties under webtools and load > that dynamically? This class can then be used to load the appropriate > delegator to query properties to override and return an updated newProps and > rest continues as before? The reason thinking of webtools is to eventually > use the webtools label manager to manage and update the override fields into > the database. > Also perhaps we would need UtilTenantProperties or better still > UtilPropertiesOverride (to make it useful even in single tenant cases) as > interface under base module and then have the implementation under webtools > linked to META-INF/services file entry. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira