Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-4240

Override UiLabels / Properties through tenant specific database

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • Trunk, Upcoming Branch
    • None
    • framework
    • Bug Crush Event - 21/2/2015

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            paulray PR
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: