You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Ben Zahler (Jira)" <ji...@apache.org> on 2019/10/25 12:19:00 UTC
[jira] [Created] (JCRVLT-388) Subpackage not installed in defined
order
Ben Zahler created JCRVLT-388:
---------------------------------
Summary: Subpackage not installed in defined order
Key: JCRVLT-388
URL: https://issues.apache.org/jira/browse/JCRVLT-388
Project: Jackrabbit FileVault
Issue Type: Bug
Reporter: Ben Zahler
I have a package with subpackages that need to be installed in a specific order.
In my case, one package contains the content and the other package contains permissions to be installed on top of that content.
My package has the following filter:
<workspaceFilter version="1.0">
<filter root="/etc/packages/com.axa.ch.aem/aem-apps-sites-content-3.57.2-SNAPSHOT.zip" />
<filter root="/etc/packages/com.axa.ch.aem/aem-permissions-author-3.57.2-SNAPSHOT.zip" />
</workspaceFilter>
*Expected*: aem-apps-sites-content is installed first, then aem-permissions-author
*Actual*: Installation order is not deterministic and not defined by the filter definition.
I did check the source code and found out that the order is defined from reading the files in the zip file (using java.util.zip), so this cannot (and probably should be) changed.
My suggesion is to order the subpages by adding the following method to Importer.java and calling it from here:
[https://github.com/apache/jackrabbit-filevault/blob/60c66c3cb7fe456c6e1fd6599736afdddec862a4/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/Importer.java#L472|https://github.com/apache/jackrabbit-filevault/blob/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/io/Importer.java#L472]
{color:#808080}private List<String> getOrderedSubPackages(){{color}
List<String> orderedSubPackages = {color:#cc7832}new {color}LinkedList<>(){color:#cc7832};
{color}{color:#cc7832} if {color}({color:#cc7832}this{color}.{color:#9876aa}filter {color}== {color:#cc7832}null {color}|| {color:#cc7832}this{color}.{color:#9876aa}subPackages {color}== {color:#cc7832}null {color}|| {color:#cc7832}this{color}.{color:#9876aa}subPackages{color}.isEmpty()) {
{color:#cc7832}return {color}orderedSubPackages{color:#cc7832};
{color} }
{color:#cc7832}final {color}List<String> unOrderedSubPackages = {color:#cc7832}new {color}ArrayList<>({color:#cc7832}this{color}.{color:#9876aa}subPackages{color}){color:#cc7832};{color}{color:#cc7832}
{color}{color:#cc7832}
{color}{color:#cc7832} for {color}(PathFilterSet filterSet : {color:#cc7832}this{color}.{color:#9876aa}filter{color}.getFilterSets()) {
{color:#cc7832}for {color}(String subPackage : unOrderedSubPackages) {
{color:#cc7832}if {color}(filterSet.contains(subPackage) && !orderedSubPackages.contains(subPackage)) {
orderedSubPackages.add(subPackage){color:#cc7832};
{color} }
}
}
{color:#cc7832}return {color}orderedSubPackages{color:#cc7832};
{color}}
Let me know if you think this makes sense, if yes I'm happy to check out/ build the code and provide a patch with unit tests.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)