You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Adrian Crum (JIRA)" <ji...@apache.org> on 2014/03/11 17:51:43 UTC

[jira] [Assigned] (OFBIZ-4240) Override UiLabels / Properties through tenant specific database

     [ https://issues.apache.org/jira/browse/OFBIZ-4240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Crum reassigned OFBIZ-4240:
----------------------------------

    Assignee:     (was: Adrian Crum)

> 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
>            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 was sent by Atlassian JIRA
(v6.2#6252)