[ 
https://issues.apache.org/jira/browse/OFBIZ-5458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870674#comment-13870674
 ] 

Adrian Crum commented on OFBIZ-5458:
------------------------------------

I can provide some direction on how to implement it, but I don't have time 
right now to write the code.

The first thing to do is find an insertion point - some place in the code path 
where we can insert the new behavior. Starting with UtilProperties.java, follow 
the code path to where the requested properties file is located 
(resolvePropertiesUrl method, line 883). That method calls the 
FlexibleLocation.resolveLocation method. The class uses a resolver class called 
ClasspathLocationResolver. That class calls the UtilURL.fromResource method. 
That method uses the current class loader to locate the properties file. So, 
that method is the insertion point - either we provide a means to locate a 
resource via the entity engine in that method, or we provide a class loader 
that uses the entity engine to locate resources.

The next thing to do is inject the new behavior in the insertion point. We 
can't reference the entity component from the base component due to build 
dependencies. So, we need to use something like SPI (java.util.ServiceLoader) 
to load a class from the entity component. There are many examples of this in 
the project (because the build dependency issue has always been a problem), 
like in the Converter framework and in UtilObject.java. The class being 
retrieved will have a method that returns a URL instance that can be used to 
read the resource from the entity engine.

Finally, we need a way to store the resource in the entity engine. I recommend 
following the existing Java resource pattern:

{code}
    <entity entity-name="JavaResource" package-name="org.ofbiz.entity.resource" 
title="Java Resource Entity">
      <field name="resourceName" type="id-vlong-ne"></field>
      <field name="resourceValue" type="object"></field>
      <field name="charSet" type="short-varchar"></field>
      <prim-key field="resourceName"/>
    </entity>
{code}

The charSet field is used when the resourceValue field contains a text file.


> getSystemPropertyValue is never called/used
> -------------------------------------------
>
>                 Key: OFBIZ-5458
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5458
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ALL APPLICATIONS, ALL COMPONENTS, framework
>         Environment: multi-tenant multi-server
>            Reporter: Pierre Smits
>            Priority: Critical
>
> getSystemPropertyValue which accesses and retrieves tenant specific 
> properties is never called/used regarding default settings for a tenant.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to