Luca De Petrillo created KARAF-7686:
---------------------------------------

             Summary: Factory PIDs not working with static config admin
                 Key: KARAF-7686
                 URL: https://issues.apache.org/jira/browse/KARAF-7686
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.4.3
         Environment: Static Karaf runtime
            Reporter: Luca De Petrillo


The static config component, used in static Karaf runtimes, does not correctly 
handle Factory PIDs. As a result, features leveraging factory configurations, 
like PAX JDBC, does not detect static configuration defined in the karaf etc 
folder.

 

For more information, the culprit is this line in the code handling 
ManagedServiceFactory configurations, which is performed before invoking the 
"{_}factory.updated{_}" method: 
[https://github.com/apache/karaf/blob/a4d055ab4a3bfc9f2f05145c6b0a436ba0b28efd/services/staticcm/src/main/java/org/apache/karaf/services/staticcm/StaticConfigAdminImpl.java#L90]
{code:java}
if (config.getPid().equals(pid) && config.getFactoryPid() != null) {{code}
 where "pid" is the SERVICE_PID of the ManagedServiceFactory, which is 
"org.ops4j.datasource" for PAX JDBC.

 
As far as I can tell, for ManagedServiceFactory the SERVICE_PID correspondence 
should be checked against the configuration's factory PID, not the 
configuration PID itself. As an example, for a DS configuration of Pax JDBC, 
the configuration PID would be defined in a file named 
"org.ops4j.datasource-dsname.cfg" inside the Karaf's etc directory, so its PID 
would be "org.ops4j.datasource-dsname", with the factory PID 
"org.ops4j.datasource".

 

So, the static config component of Karaf should be changed, in order to check 
for the configuration correspondence on the factory PID. 

Additionally, the line 
[https://github.com/apache/karaf/blob/a4d055ab4a3bfc9f2f05145c6b0a436ba0b28efd/services/staticcm/src/main/java/org/apache/karaf/services/staticcm/StaticConfigAdminImpl.java#L92]
 should be changed too, in order to pass to the ManagedServiceFactory update 
method, the actual configuration PID, not the "base" factory PID.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to