Closed kwin closed 2 months ago
@kwin Any update on how you solved it?
Unfortunately I don't have a solution. But it is marked for removal on 1st of June 2021 in https://experienceleague.adobe.com/docs/experience-manager-cloud-service/release-notes/deprecated-apis.html?lang=en , so we need to come up with a solution now.
@joerghoh Any idea how to replace those e.g. in https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/ff750e963a7ca3a1df49f4a9afa8aca4be4c63ef/bundle/src/main/java/com/adobe/acs/commons/util/ModeUtil.java? Basically starting from 1st of June ACS AEM Commons will stop working on AEMaaCS (again).
we hit the same problem for a couple of wcm.io modules.
the basic recommendation for replacing usage of SlingSettingsService is to create a custom OSGi config for the service and configure it differently for author/publish. this is fine if this is an individual service implemented in a customer project where code and configuration is all in one place and well managed.
however, for reusable libraries like ACS AEM Commons and wcm.io that have existing features using SlingSettingsServices for years and which are widely used in public this is more complex. introducing such a specific OSGi config for every use case is a) quite redundant and b) error-prone as this is a breaking change as a new mandatory OSGi config is introduced that was not mandatory before. not all users read the changelogs properly and may just oversee such a new fact, resulting in unexpected behavior either on publish or author side.
i was looking for a solution with getting rid of SlingSettingService, providing a central point to detect if the current instance is author or publish which is controlled by OSGi configuration - but still has a fallback mode that works as good as possible if a proper OSGi configuration is missing.
i came up with a solution like this: https://github.com/wcm-io/io.wcm.wcm.commons/blob/develop/src/main/java/io/wcm/wcm/commons/instancetype/InstanceTypeService.java implementation: https://github.com/wcm-io/io.wcm.wcm.commons/blob/develop/src/main/java/io/wcm/wcm/commons/instancetype/impl/InstanceTypeServiceImpl.java
it logs a warning message if a proper OSGi config is missing, but still should work as expected.
Similar approach was taken in the ASC's RequireAEMImpl [1] - basically, we create an OSGI configuration and put it in /apps/asset-share-commons/config.publish with the service.type value of "publish" ... and the use that to indicate if its AEM Publish or Author (since the runmode folders still resolve)
It looks like they also deprecated the ProductInfo stuff so we cant use versions to determine 6.x. vs AEM CS/SDK anymore - i updated the ASC one [1] in my working branch to check on the existence of an AEM CS/SDK only bundle since i couldnt find much else that would work for both "real cloud" AEM CS and AEM CS SDK. (suggestions welcome!)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@davidjgonzalez is there any viable alternative yet from Adobe itself? It's getting ridiculous to wait for it to be removed but no viable alternative (because let's fase it, runmodes are still a valid thing to use even in AEM as a cloud service, for example to see if its an author vs a publish)
@royteeuwen, unfortunately, nothing in the product itself - The POV being that things that depend on author/publish should depend on an OSGi configuration value that is set VIA the author/publish runmode, btu not the runmode itself.
Admittedly this does leak possible otherwise unnecessary layers into an app.
And also forces every framework to make their own osgi configuration / service again and again, in time you have 10 custom osgi configurations just to say, i'm an author / publish
To be clear, I'm not disagreeing :)
We can incorporate this into RequireAEM if we want (it's implemented in ASC now, so we can copy it over).
It is no longer deprecated since AEMaaCS 17569. Compare https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/2024.8.17465.20240813T175259Z-240700/org/apache/sling/settings/SlingSettingsService.html with https://javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/org/apache/sling/settings/SlingSettingsService.html.
wow, who finally pulled that string :D!
Since AEM SDK 2020.10.4423.20201028T010735Z-201028 the class
org.apache.sling.settings.SlingSettingsService
is deprecated: https://www.javadoc.io/doc/com.adobe.aem/aem-sdk-api/latest/org/apache/sling/settings/SlingSettingsService.html.We must replace the all usages of that class: https://github.com/Adobe-Consulting-Services/acs-aem-commons/search?q=SlingSettingsService
It is unclear right now what would be the recommended API now to figure out if one is on Author or on Publish (compare with https://github.com/adobe/aem-project-archetype/issues/528#issuecomment-725554749).