This is an automated email from the ASF dual-hosted git repository.

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new d4f99c1  Remove packageinit and feature-content-extension as they have 
been moved into separate repositories.
d4f99c1 is described below

commit d4f99c1c93e129f0864f15f7ab9c7f8b9865c77e
Author: Karl Pauls <[email protected]>
AuthorDate: Wed Oct 10 12:58:04 2018 +0200

    Remove packageinit and feature-content-extension as they have been moved 
into separate repositories.
---
 featuremodel/feature-content-extension/README.md   |   6 -
 featuremodel/feature-content-extension/pom.xml     | 159 ------------------
 .../feature/extension/content/ContentHandler.java  | 153 -----------------
 .../content/ContentOrderMergeProcessor.java        |  67 --------
 ...e.sling.feature.builder.FeatureExtensionHandler |   1 -
 ...eature.launcher.spi.extensions.ExtensionHandler |   1 -
 packageinit/README.md                              |   5 -
 packageinit/pom.xml                                | 149 -----------------
 .../impl/ExecutionPlanRepoInitializer.java         | 182 --------------------
 .../ExecutionPlanRepoInitializerTest.java          | 183 ---------------------
 10 files changed, 906 deletions(-)

diff --git a/featuremodel/feature-content-extension/README.md 
b/featuremodel/feature-content-extension/README.md
deleted file mode 100644
index 7a5d244..0000000
--- a/featuremodel/feature-content-extension/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Apache Sling Featuremodel - Content Deployment Exension
-
-This module is part of the [Apache Sling](https://sling.apache.org) project.
-
-This project is about creating an Extension to the Sling Featuremodel Launcher 
to be able to precalculate a FSPackageRegistry and inject precalculated 
Executionplans to be deployed into the repository during startup.
-
diff --git a/featuremodel/feature-content-extension/pom.xml 
b/featuremodel/feature-content-extension/pom.xml
deleted file mode 100644
index 0bf8278..0000000
--- a/featuremodel/feature-content-extension/pom.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0"?><!-- Licensed to the Apache Software Foundation (ASF) 
-    under one or more contributor license agreements. See the NOTICE file 
distributed 
-    with this work for additional information regarding copyright ownership. 
-    The ASF licenses this file to You under the Apache License, Version 2.0 
(the 
-    "License"); you may not use this file except in compliance with the 
License. 
-    You may obtain a copy of the License at 
http://www.apache.org/licenses/LICENSE-2.0 
-    Unless required by applicable law or agreed to in writing, software 
distributed 
-    under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 
-    OR CONDITIONS OF ANY KIND, either express or implied. See the License for 
-    the specific language governing permissions and limitations under the 
License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.sling</groupId>
-        <artifactId>sling</artifactId>
-        <version>34</version>
-        <relativePath />
-    </parent>
-
-    <artifactId>org.apache.sling.feature.extension.content</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-    <name>Sling Featuremodel - Content Deployment Exension</name>
-
-    <licenses>
-        <!-- This is also in the Apache parent POM, but adding it here 
includes 
-            it in dependency-reduced-pom.xml so that it passes the rat check. 
-->
-        <license>
-            <name>The Apache Software License, Version 2.0</name>
-            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-        </license>
-    </licenses>
-
-    <properties>
-        <jdk.version>8</jdk.version>
-    </properties>
-
-
-    <build>
-        <plugins>
-        <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-shade-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                        <configuration>
-                            <minimizeJar>true</minimizeJar>
-                            <filters>
-                            <filter>
-                              <includes>
-                                
<include>org.apache.commons:collections:*</include>
-                              </includes>
-                              </filter>
-                            </filters>
-                        </configuration>
-                    </execution>
-                </executions>
-
-            </plugin>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        
<exclude>src/main/resources/META-INF/services/**</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.jackrabbit.vault</groupId>
-            <artifactId>org.apache.jackrabbit.vault</artifactId>
-            <version>3.2.4</version>
-            <scope>compile</scope>
-        </dependency>
-           <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature.launcher</artifactId>
-            <version>0.1.0-SNAPSHOT</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature.io</artifactId>
-            <version>0.1.3-SNAPSHOT</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature</artifactId>
-            <version>0.1.3-SNAPSHOT</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-nop</artifactId>
-            <version>1.7.25</version>
-            <scope>compile</scope>
-        </dependency>        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.johnzon</artifactId>
-            <version>1.0.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.converter</artifactId>
-            <version>1.0.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.jcr.jcr-wrapper</artifactId>
-            <version>2.0.0</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <artifactId>jackrabbit-spi-commons</artifactId>
-            <version>2.17.3</version>
-            <groupId>org.apache.jackrabbit</groupId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <artifactId>commons-io</artifactId>
-            <version>2.6</version>
-            <groupId>commons-io</groupId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <artifactId>jackrabbit-jcr-commons</artifactId>
-            <version>2.17.3</version>
-            <groupId>org.apache.jackrabbit</groupId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <artifactId>jackrabbit-spi</artifactId>
-            <version>2.17.3</version>
-            <groupId>org.apache.jackrabbit</groupId>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>commons-cli</groupId>
-            <artifactId>commons-cli</artifactId>
-            <version>1.3.1</version>
-            <scope>compile</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git 
a/featuremodel/feature-content-extension/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
 
b/featuremodel/feature-content-extension/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
deleted file mode 100644
index 1a57118..0000000
--- 
a/featuremodel/feature-content-extension/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.feature.extension.content;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.map.MultiValueMap;
-import org.apache.jackrabbit.vault.packaging.PackageId;
-import org.apache.jackrabbit.vault.packaging.SubPackageHandling;
-import org.apache.jackrabbit.vault.packaging.registry.ExecutionPlanBuilder;
-import org.apache.jackrabbit.vault.packaging.registry.PackageTask.Type;
-import org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry;
-import org.apache.sling.feature.Artifact;
-import org.apache.sling.feature.Configuration;
-import org.apache.sling.feature.Extension;
-import org.apache.sling.feature.ExtensionType;
-import org.apache.sling.feature.FeatureConstants;
-import org.apache.sling.feature.launcher.spi.LauncherPrepareContext;
-import org.apache.sling.feature.launcher.spi.extensions.ExtensionHandler;
-import 
org.apache.sling.feature.launcher.spi.extensions.ExtensionInstallationContext;
-
-public class ContentHandler implements ExtensionHandler {
-    
-    public static final String PACKAGEREGISTRY_HOME = "packageregistry.home";
-
-    private static final String REPOSITORY_HOME = "repository.home";
-
-    private static final String REGISTRY_FOLDER = "packageregistry";
-
-    private static ExecutionPlanBuilder 
buildExecutionPlan(Collection<Artifact> artifacts, LauncherPrepareContext 
prepareContext, File registryHome) throws Exception {
-
-        List<File> packageReferences = new ArrayList<File>();
-
-        for (final Artifact a : artifacts) {
-            final File file = prepareContext.getArtifactFile(a.getId());
-            if (file.exists()) {
-                packageReferences.add(file);
-            }
-
-        }
-        
-        if(!registryHome.exists()) {
-            registryHome.mkdirs();
-        }
-
-        FSPackageRegistry registry = new FSPackageRegistry(registryHome);
-
-        ExecutionPlanBuilder builder = registry.createExecutionPlan();
-
-        for (File pkgFile : packageReferences) {
-            PackageId pid = registry.registerExternal(pkgFile, true);
-            Map<PackageId, SubPackageHandling.Option> subPkgs = 
registry.getInstallState(pid).getSubPackages();
-            if (!subPkgs.isEmpty()) {
-                for (PackageId subId : subPkgs.keySet()) {
-                    SubPackageHandling.Option opt = subPkgs.get(subId);
-                    if (opt != SubPackageHandling.Option.IGNORE) {
-                        builder.addTask().with(subId).with(Type.EXTRACT);
-                    }
-                }
-            }
-
-            builder.addTask().with(pid).with(Type.EXTRACT);
-        }
-        builder.validate();
-        return builder;
-
-    }
-
-    @Override
-    public boolean handle(Extension extension, LauncherPrepareContext 
prepareContext,
-            ExtensionInstallationContext installationContext) throws Exception 
{
-        File registryHome = getRegistryHomeDir(installationContext);
-        if (extension.getType() == ExtensionType.ARTIFACTS
-                && 
extension.getName().equals(FeatureConstants.EXTENSION_NAME_CONTENT_PACKAGES)) {
-            MultiValueMap orderedArtifacts = MultiValueMap.decorate(new 
LinkedHashMap<Integer, Collection<Artifact>>());
-            for (final Artifact a : extension.getArtifacts()) {
-                int order;
-                // content-packages without explicit start-order to be 
installed last
-                if (a.getMetadata().get(Artifact.KEY_START_ORDER) != null) {
-                    order = a.getStartOrder();
-                } else {
-                    order = Integer.MAX_VALUE;
-                }
-                orderedArtifacts.put(order, a);
-            }
-            List<String> executionPlans = new ArrayList<String>();
-            for (Object key : orderedArtifacts.keySet()) {
-                @SuppressWarnings("unchecked")
-                Collection<Artifact> artifacts = 
orderedArtifacts.getCollection(key);
-                ExecutionPlanBuilder builder = buildExecutionPlan(artifacts, 
prepareContext, registryHome);
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                builder.save(baos);
-                executionPlans.add(baos.toString("UTF-8"));
-            }
-            final Configuration initcfg = new 
Configuration("org.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer");
-            initcfg.getProperties().put("executionplans", 
executionPlans.toArray(new String[executionPlans.size()]));
-            installationContext.addConfiguration(initcfg.getPid(), 
initcfg.getFactoryPid(), initcfg.getProperties());
-            
-            final Configuration registrycfg = new 
Configuration("org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry");
-            registrycfg.getProperties().put("homePath", REGISTRY_FOLDER);
-            installationContext.addConfiguration(registrycfg.getPid(), 
registrycfg.getFactoryPid(), registrycfg.getProperties());;
-
-            return true;
-        }
-        else {
-            return false;
-        }
-    }
-
-    private File getRegistryHomeDir(ExtensionInstallationContext 
installationContext) {
-        //read repository- home from framework properties (throw exception if 
repo.home not set)
-        String registryPath = System.getProperty(PACKAGEREGISTRY_HOME);
-        File registryHome;
-        if (registryPath != null) {
-            registryHome = Paths.get(registryPath).toFile();
-
-        } else {
-            String repoHome = 
installationContext.getFrameworkProperties().get(REPOSITORY_HOME);
-            if (repoHome == null) {
-                throw new IllegalStateException("Neither registry.home set nor 
repository.home configured.");
-            } 
-            registryHome = Paths.get(repoHome, REGISTRY_FOLDER).toFile();
-        }
-        if (!registryHome.exists()) {
-            registryHome.mkdirs();
-        }
-        if (!registryHome.isDirectory()) {
-            throw new IllegalStateException("Registry but points to file - 
must be directory");
-        }
-        return registryHome;
-    }
-}
diff --git 
a/featuremodel/feature-content-extension/src/main/java/org/apache/sling/feature/extension/content/ContentOrderMergeProcessor.java
 
b/featuremodel/feature-content-extension/src/main/java/org/apache/sling/feature/extension/content/ContentOrderMergeProcessor.java
deleted file mode 100644
index 3cc9e97..0000000
--- 
a/featuremodel/feature-content-extension/src/main/java/org/apache/sling/feature/extension/content/ContentOrderMergeProcessor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.feature.extension.content;
-
-import org.apache.sling.feature.Artifact;
-import org.apache.sling.feature.Extension;
-import org.apache.sling.feature.ExtensionType;
-import org.apache.sling.feature.Feature;
-import org.apache.sling.feature.FeatureConstants;
-import org.apache.sling.feature.KeyValueMap;
-import org.apache.sling.feature.builder.FeatureExtensionHandler;
-
-public class ContentOrderMergeProcessor implements FeatureExtensionHandler {
-    
-    private static final String DEFAULT_CONTENT_START_ORDER = 
"default.content.startorder";
-
-    /**
-     * Only postprocessing - relying on default merge strategy
-     * (non-Javadoc)
-     * @see 
org.apache.sling.feature.builder.FeatureExtensionHandler#canMerge(org.apache.sling.feature.Extension)
-     */
-    @Override
-    public boolean canMerge(Extension extension) {
-        return false;
-    }
-
-    /*
-     * Only postprocessing - relying on default merge strategy
-     * (non-Javadoc)
-     * @see 
org.apache.sling.feature.builder.FeatureExtensionHandler#merge(org.apache.sling.feature.Feature,
 org.apache.sling.feature.Feature, org.apache.sling.feature.Extension)
-     */
-    @Override
-    public void merge(Feature target, Feature source, Extension extension) {
-        // not merging
-    }
-
-    @Override
-    public void postProcess(Feature feature, Extension extension) {
-        if (extension.getType() == ExtensionType.ARTIFACTS
-                && 
extension.getName().equals(FeatureConstants.EXTENSION_NAME_CONTENT_PACKAGES)) {
-            String defaultOrder = 
feature.getVariables().get(DEFAULT_CONTENT_START_ORDER);
-            if (defaultOrder != null) {
-                for (Artifact a : extension.getArtifacts()) {
-                    KeyValueMap kvm = a.getMetadata();
-                    if(kvm.get(Artifact.KEY_START_ORDER) == null) {
-                        kvm.put(Artifact.KEY_START_ORDER, defaultOrder);
-                    }
-                }
-                feature.getVariables().remove(DEFAULT_CONTENT_START_ORDER);
-            }
-        }
-    }
-}
diff --git 
a/featuremodel/feature-content-extension/src/main/resources/META-INF/services/org.apache.sling.feature.builder.FeatureExtensionHandler
 
b/featuremodel/feature-content-extension/src/main/resources/META-INF/services/org.apache.sling.feature.builder.FeatureExtensionHandler
deleted file mode 100644
index 91b597c..0000000
--- 
a/featuremodel/feature-content-extension/src/main/resources/META-INF/services/org.apache.sling.feature.builder.FeatureExtensionHandler
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.sling.feature.extension.content.ContentOrderMergeProcessor
\ No newline at end of file
diff --git 
a/featuremodel/feature-content-extension/src/main/resources/META-INF/services/org.apache.sling.feature.launcher.spi.extensions.ExtensionHandler
 
b/featuremodel/feature-content-extension/src/main/resources/META-INF/services/org.apache.sling.feature.launcher.spi.extensions.ExtensionHandler
deleted file mode 100644
index b89c4aa..0000000
--- 
a/featuremodel/feature-content-extension/src/main/resources/META-INF/services/org.apache.sling.feature.launcher.spi.extensions.ExtensionHandler
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.sling.feature.extension.content.ContentHandler
diff --git a/packageinit/README.md b/packageinit/README.md
deleted file mode 100644
index 500d38e..0000000
--- a/packageinit/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Apache Sling JCR Package Initializer module
-
-This module is part of the [Apache Sling](https://sling.apache.org) project.
-
-This project is about creating a SlingRepositoryInitializer initializing the 
JCR Repository from a given FSPackageRegistry with precalculated ExecutionPlans.
diff --git a/packageinit/pom.xml b/packageinit/pom.xml
deleted file mode 100644
index 73cd312..0000000
--- a/packageinit/pom.xml
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.sling</groupId>
-    <artifactId>sling</artifactId>
-    <version>34</version>
-    <relativePath />
-  </parent>
-
-  <artifactId>org.apache.sling.jcr.packageinit</artifactId>
-  <packaging>bundle</packaging>
-  <version>0.0.1-SNAPSHOT</version>
-  <name>Apache Sling JCR Package Initializer module</name>
-  <description>
-         Installs packages into a JCR repository as SlingRepositoryInitializer 
based on a FileVault ExecutionPlan
-  </description>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <executions>
-                    <!-- Configure extra execution of 'manifest' in 
process-classes phase to make sure SCR metadata is generated before unit test 
runs -->
-                    <execution>
-                        <id>scr-metadata</id>
-                        <goals>
-                            <goal>manifest</goal>
-                        </goals>
-                        <configuration>
-                            
<supportIncrementalBuild>true</supportIncrementalBuild>
-                        </configuration>
-                    </execution>
-                </executions>
-                <configuration>
-                    <!-- Export SCR metadata to classpath to have them 
available in unit tests -->
-                    <exportScr>true</exportScr>
-                    <instructions>
-                        <!-- Enable processing of OSGI DS component 
annotations -->
-                        <_dsannotations>*</_dsannotations>
-                        <!-- Enable processing of OSGI metatype annotations -->
-                        <_metatypeannotations>*</_metatypeannotations>
-                        <Private-Package>
-                            org.apache.sling.jcr.packageinit.impl
-                        </Private-Package>
-                    </instructions>
-                 </configuration>
-            </plugin>
-          
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-             <groupId>org.osgi</groupId>
-             <artifactId>osgi.cmpn</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.component.annotations</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.service.metatype.annotations</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.jcr</groupId>
-            <artifactId>jcr</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.jcr.api</artifactId>
-            <version>2.4.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.launchpad.api</artifactId>
-            <version>1.1.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.installer.core</artifactId>
-            <version>3.5.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.jackrabbit.vault</groupId>
-            <artifactId>org.apache.jackrabbit.vault</artifactId>
-            <version>3.2.4</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.6</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
-            <version>2.3.2</version>
-            <scope>testing</scope>
-        </dependency>
-              <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <version>2.21.0</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git 
a/packageinit/src/main/java/org/apache/sling/jcr/packageinit/impl/ExecutionPlanRepoInitializer.java
 
b/packageinit/src/main/java/org/apache/sling/jcr/packageinit/impl/ExecutionPlanRepoInitializer.java
deleted file mode 100644
index 8631cf7..0000000
--- 
a/packageinit/src/main/java/org/apache/sling/jcr/packageinit/impl/ExecutionPlanRepoInitializer.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.jcr.packageinit.impl;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.jackrabbit.vault.packaging.registry.ExecutionPlan;
-import org.apache.jackrabbit.vault.packaging.registry.ExecutionPlanBuilder;
-import org.apache.jackrabbit.vault.packaging.registry.PackageRegistry;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.jcr.api.SlingRepositoryInitializer;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.metatype.annotations.AttributeDefinition;
-import org.osgi.service.metatype.annotations.Designate;
-import org.osgi.service.metatype.annotations.ObjectClassDefinition;
-import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jcr.Session;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-@Component(service = {SlingRepositoryInitializer.class},
-        property = {"service.ranking:Integer=200"})
-@Designate(ocd = ExecutionPlanRepoInitializer.Config.class)
-public class ExecutionPlanRepoInitializer implements 
SlingRepositoryInitializer {
-
-    private static final String EXECUTEDPLANS_FILE = "executedplans.file";
-    private List<String> executionPlans = new ArrayList<>();
-    
-    private File statusFile;
-
-    @ObjectClassDefinition(
-            name = "Executionplan based Repository Initializer"
-    )
-    @interface Config {
-        
-        @AttributeDefinition
-        String statusfilepath() default "";
-
-        @AttributeDefinition
-        String[] executionplans() default {};
-    }
-
-    /**
-     * The logger.
-     */
-    private final Logger logger = LoggerFactory.getLogger(getClass());
-    private BundleContext context;
-
-    @Activate
-    private void activate(BundleContext context, Config config) throws 
FileNotFoundException, IOException {
-        List<String> epCandidates = Arrays.asList(config.executionplans());
-        if (!epCandidates.isEmpty()) {
-            if(StringUtils.isEmpty(config.statusfilepath())) {
-                // if no  path is configured lookup default file in bundledata
-                statusFile = context.getDataFile(EXECUTEDPLANS_FILE);
-            } else {
-                Path statusFilePath = Paths.get(config.statusfilepath());
-                if (statusFilePath.isAbsolute()) {
-                    // only absolute references are considered for lookup of
-                    // external statusfile
-                    statusFile = statusFilePath.toFile();
-                } else {
-                    throw new IllegalStateException("Only absolute paths 
supported");
-                }
-            }
-            if (statusFile.exists()) {
-                // in case statusFile already exists read all hashes
-                List<Integer> executedHashes = new ArrayList<>();
-                try (BufferedReader br = new BufferedReader(new 
FileReader(statusFile))) {
-                    for (String line; (line = br.readLine()) != null;) {
-                        executedHashes.add(Integer.parseInt(line));
-                    }
-                }
-                processCandidates(epCandidates, executedHashes);
-            } else {
-               this.executionPlans.addAll(epCandidates);
-            }
-        }
-        this.context = context;
-    }
-
-    private void processCandidates(List<String> epCandidates, List<Integer> 
executedHashes) {
-        Iterator<String> candidateIt = epCandidates.iterator();
-        Iterator<Integer> executedHashesIt = executedHashes.iterator();
-        // iterate over candidates and crosscheck next found hash
-        while (candidateIt.hasNext()) {
-            String candidate = candidateIt.next();
-            if (!executedHashesIt.hasNext()) {
-                // if no further hashes are present add candidate
-                // (will iterate over rest and add rest)
-                executionPlans.add(candidate);
-            } else {
-                // if another hash was found check if it matches the
-                // next candidate
-                Integer executedHash = executedHashesIt.next();
-                if (isCandidateProcessed(candidate, executedHash)) {
-                    // already processed so no need to add - check
-                    // next plan
-                    continue;
-                } else {
-                    String msg = "Different content installed then configured 
- repository needs to be reset.";
-                    logger.error(msg);
-                    throw new IllegalStateException(msg);
-                }
-            }
-        }
-    }
-
-    private boolean isCandidateProcessed(String candidate, Integer 
executedHash) {
-        return executedHash.equals(Integer.valueOf(candidate.hashCode()));
-    }
-
-    @Override
-    public void processRepository(SlingRepository slingRepository) throws 
Exception {
-        if (executionPlans != null) {
-            ServiceTracker<PackageRegistry, ?> st = new 
ServiceTracker<>(context, PackageRegistry.class, null);
-            try {
-                st.open();
-                logger.info("Waiting for PackageRegistry.");
-                PackageRegistry registry = (PackageRegistry) 
st.waitForService(0);
-                logger.info("PackageRegistry found - starting execution of 
executionplan");
-                
-                @SuppressWarnings("deprecation")
-                Session session = slingRepository.loginAdministrative(null);
-                ExecutionPlanBuilder builder = registry.createExecutionPlan();
-                BufferedWriter writer = null;
-                try {
-                    writer = new BufferedWriter(new FileWriter(statusFile));
-                    for (String plan : executionPlans) {
-                        builder.load(new 
ByteArrayInputStream(plan.getBytes("UTF-8")));
-                        builder.with(session);
-                        ExecutionPlan xplan = builder.execute();
-                        logger.info("executionplan executed with {} entries", 
xplan.getTasks().size());
-                        // save hashes to file for crosscheck on subsequent 
startup to avoid double processing
-                        writer.write(String.valueOf(plan.hashCode()));
-                        writer.newLine();
-
-                    }
-                } finally {
-                    if (writer != null) {
-                        writer.close();
-                    }
-                }
-            } finally {
-                st.close();
-            }
-        } else {
-            logger.info("No executionplans configured skipping init.");
-        }
-    }
-}
diff --git 
a/packageinit/src/test/java/org/apache/sling/jcr/packageinit/ExecutionPlanRepoInitializerTest.java
 
b/packageinit/src/test/java/org/apache/sling/jcr/packageinit/ExecutionPlanRepoInitializerTest.java
deleted file mode 100644
index 40f4157..0000000
--- 
a/packageinit/src/test/java/org/apache/sling/jcr/packageinit/ExecutionPlanRepoInitializerTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sling.jcr.packageinit;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.vault.packaging.PackageException;
-import org.apache.jackrabbit.vault.packaging.registry.ExecutionPlan;
-import org.apache.jackrabbit.vault.packaging.registry.ExecutionPlanBuilder;
-import org.apache.jackrabbit.vault.packaging.registry.PackageRegistry;
-import org.apache.jackrabbit.vault.packaging.registry.impl.FSPackageRegistry;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.jcr.packageinit.impl.ExecutionPlanRepoInitializer;
-import org.apache.sling.testing.mock.osgi.MockOsgi;
-import org.apache.sling.testing.mock.sling.junit.SlingContext;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ExecutionPlanRepoInitializerTest {
-    
-    static String EXECUTIONPLAN_1 =
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                    "<executionPlan version=\"1.0\">\n" +
-                    "    <task cmd=\"extract\" 
packageId=\"my_packages:test_a:1.0\"/>\n" +
-                    "</executionPlan>\n";
-    
-    static String EXECUTIONPLAN_2 =
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                    "<executionPlan version=\"1.0\">\n" +
-                    "    <task cmd=\"extract\" 
packageId=\"my_packages:test_b:1.0\"/>\n" +
-                    "</executionPlan>\n";
-    
-    static String[] EXECUTIONSPLANS = {EXECUTIONPLAN_1, EXECUTIONPLAN_2};
-    
-    static String STATUSFILE_NAME = "executedplans.file";
-
-    @Rule
-    public final SlingContext context = new SlingContext();
-    
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-
-    @Mock
-    SlingRepository slingRepo;
-
-    @Spy
-    PackageRegistry registry = new FSPackageRegistry();
-
-    @Mock
-    ExecutionPlanBuilder builder;
-    
-    @Mock
-    ExecutionPlanBuilder builder2;
-
-
-    @Mock
-    ExecutionPlan xplan;
-
-    private File statusFile;
-    
-
-    @Before
-    public void setup() throws IOException, PackageException {
-        when(registry.createExecutionPlan()).thenReturn(builder);
-        when(builder.execute()).thenReturn(xplan);
-        this.statusFile = temporaryFolder.newFile(STATUSFILE_NAME + 
UUID.randomUUID());
-    }
-
-    @Test
-    public void waitForRegistryAndInstall() throws Exception {
-        ExecutionPlanRepoInitializer initializer = registerRepoInitializer();
-
-        CountDownLatch cdl = new CountDownLatch(1);
-        processRepository(initializer, cdl);
-
-        assertTrue("processRespository() should not be completed before 
FSRegistry is available", cdl.getCount() > 0);
-        ArgumentCaptor<InputStream> captor = 
ArgumentCaptor.forClass(InputStream.class);
-
-        
context.bundleContext().registerService(PackageRegistry.class.getName(), 
registry, null);
-        cdl.await(500, TimeUnit.MILLISECONDS);
-        verify(builder, times(2)).load(captor.capture());
-
-        Iterator<InputStream> isIt = captor.getAllValues().iterator();
-        for (String ep : EXECUTIONSPLANS) {
-            StringWriter writer = new StringWriter();
-            IOUtils.copy(isIt.next(), writer, "UTF-8");
-            assertEquals(writer.toString(), ep);
-        }
-    }
-
-    @Test
-    public void doubleExecute() throws Exception {
-        ExecutionPlanRepoInitializer initializer = registerRepoInitializer();
-
-        CountDownLatch cdl = new CountDownLatch(1);
-        processRepository(initializer, cdl);
-
-        assertTrue("processRespository() should not be completed before 
FSRegistry is available", cdl.getCount() > 0);
-        ArgumentCaptor<InputStream> captor = 
ArgumentCaptor.forClass(InputStream.class);
-
-        
context.bundleContext().registerService(PackageRegistry.class.getName(), 
registry, null);
-        cdl.await(500, TimeUnit.MILLISECONDS);
-        verify(builder, times(2)).load(captor.capture());
-        
-        // use different builder to reset captor
-        when(registry.createExecutionPlan()).thenReturn(builder2);
-        
-        MockOsgi.deactivate(initializer, context.bundleContext());
-        initializer = registerRepoInitializer();
-        processRepository(initializer, cdl);;
-        
-        cdl.await(500, TimeUnit.MILLISECONDS);
-        verify(builder2, never()).load(captor.capture());
-
-    }
-
-    private ExecutionPlanRepoInitializer registerRepoInitializer() {
-        ExecutionPlanRepoInitializer initializer = new 
ExecutionPlanRepoInitializer();
-        Dictionary<String, Object> props = new Hashtable<String, Object>();
-        props.put("executionplans", EXECUTIONSPLANS);
-        props.put("statusfilepath", statusFile.getAbsolutePath());
-        context.registerInjectActivateService(initializer, props);
-        return initializer;
-    }
-    
-
-    private void processRepository(ExecutionPlanRepoInitializer initializer, 
CountDownLatch cdl) {
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    initializer.processRepository(slingRepo);
-                    cdl.countDown();
-                } catch (Exception e) {
-                    fail("Should not have thrown any exception");
-                }
-
-            }
-        }).start();
-    }
-
-}

Reply via email to