You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2021/05/25 07:10:00 UTC

[jira] [Commented] (SLING-10339) Execution plan failure for JCR Package Init

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

Konrad Windszus commented on SLING-10339:
-----------------------------------------

Removed workaround in https://github.com/apache/sling-org-apache-sling-jcr-packageinit/commit/c440bd01c22e02be7d590c2c392273d422a6349b as Sling Starter 12 now comes with FileVault 3.5.0 which contains that fix.

> Execution plan failure for JCR Package Init
> -------------------------------------------
>
>                 Key: SLING-10339
>                 URL: https://issues.apache.org/jira/browse/SLING-10339
>             Project: Sling
>          Issue Type: Improvement
>          Components: Starter
>    Affects Versions: JCR Package Init 1.0.2
>            Reporter: Hans-Peter Stoerr
>            Assignee: Konrad Windszus
>            Priority: Minor
>             Fix For: JCR Package Init 1.0.4
>
>
> I am using the feature model [content deployment extension|https://github.com/apache/sling-org-apache-sling-feature-extension-content] to deploy some content packages as a feature using the Sling feature launcher, since the simple [ContentPackageHandler|https://github.com/apache/sling-org-apache-sling-feature-launcher/blob/master/src/main/java/org/apache/sling/feature/launcher/impl/extensions/handlers/ContentPackageHandler.java] of the feature launcher is not able to specify an order in which the content-packages are installed and you have no control over when they are installed (in my case the installation failed since the packages are already installed before the repository was completely initialized with the service user sling-package-install.) However there is a problem with the FSPackageRegistry.contains that prevented this from working when package dependencies are specified in the content-packages: these are checked by ExecutionPlanBuilder as called from [ExecutionPlanRepoInitializer|https://github.com/apache/sling-org-apache-sling-jcr-packageinit/blob/master/src/main/java/org/apache/sling/jcr/packageinit/impl/ExecutionPlanRepoInitializer.java], but FSPackageRegistry.contains always returns false since the FSPackageRegistry isn't initialized yet. I reported that as a jackrabbit vault bug, but to make that work with the current version of Jackrabbit Vault I suggest to introduce a workaround: call FSPackageRegistry.packages() before executing the ExecutionPlan to initialize the FSPackageRegistry.
> Please note that this needs changing the unittest since the FSPackageRegistry cannot be initialized without setting a homeDir. Perhaps you could just use a Mockito mock instead of an actual FSPackageRegistry. (I could provide a patch if you tell me how to deal with the unittest issue.)
> BTW: it took me quite a while to find out that you can specify an installation order for the packages with the content deployment extension by specifying the packages e.g. like that in the feature - it's probably a good idea to mention that in the org.apache.sling.extension.content README.md:
> {code:java}
>   "content-packages:ARTIFACTS|required": [
>     {
>       "id": "com.composum.platform:composum-platform-commons-package:zip:${composum.platform.version}",
>       "start-order": "31"
>     },
>     {
>       "id": "com.composum.platform:composum-platform-cache-package:zip:${composum.platform.version}",
>       "start-order": "31"
>     }
>   ]{code}
> PS: Another think that took me a while to solve is that the bundles that are embedded in the packages get the start level 1. (The same thing happens when you deploy a package with the package manager.) The solution of that was to set the framework property felix.startlevel.bundle to something like 30 - this might even go into the starter.
> PS 2: another thing that should be mentioned somewhere is that the feature model content extension has to be in the classpath before the feature launcher since otherwise the standard feature launcher ContentPackageHandler is used.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)