You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by gh...@apache.org on 2019/12/21 08:47:45 UTC

[sling-org-apache-sling-installer-provider-installhook] branch master updated (a8255bb -> 9adba77)

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

ghenzler pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git.


    from a8255bb  Merge pull request #2 from apache/feature/SLING-8291_expose-error
     new f45a29a  SLING-8949 Handle two digits versions correctly
     new ca524dd  SLING-8948 Ignore Installer Vault Package Install Hook when being used with the feature model
     new b7d3f00  Merge branch 'master' of git@github.com:apache/sling-org-apache-sling-installer-provider-installhook.git
     new 52e56eb  SLING-8713 Use commons-lang3
     new 9adba77  SLING-8714 Add scope to all dependencies

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            | 13 +++--
 src/main/appended-resources/META-INF/MANIFEST.MF   |  2 +-
 .../provider/installhook/OsgiInstallerHook.java    |  4 +-
 .../installhook/OsgiInstallerHookEntry.java        | 58 ++++++++++++++++++++++
 4 files changed, 70 insertions(+), 7 deletions(-)
 create mode 100644 src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHookEntry.java


[sling-org-apache-sling-installer-provider-installhook] 02/05: SLING-8948 Ignore Installer Vault Package Install Hook when being used with the feature model

Posted by gh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git

commit ca524dd129ddd13a8f847292d94e009e7f3f49cd
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Sat Dec 21 00:26:08 2019 +0100

    SLING-8948 Ignore Installer Vault Package Install Hook when being used
    with the feature model
---
 pom.xml                                            |  2 +-
 src/main/appended-resources/META-INF/MANIFEST.MF   |  2 +-
 .../installhook/OsgiInstallerHookEntry.java        | 58 ++++++++++++++++++++++
 3 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4b62962..48395ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
     </parent>
 
     <artifactId>org.apache.sling.installer.provider.installhook</artifactId>
-    <version>1.0.5-SNAPSHOT</version>
+    <version>1.1.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Sling Installer Vault Package Install Hook</name>
diff --git a/src/main/appended-resources/META-INF/MANIFEST.MF b/src/main/appended-resources/META-INF/MANIFEST.MF
index 4889165..8f77165 100644
--- a/src/main/appended-resources/META-INF/MANIFEST.MF
+++ b/src/main/appended-resources/META-INF/MANIFEST.MF
@@ -1 +1 @@
-Main-Class: org.apache.sling.installer.provider.installhook.OsgiInstallerHook
+Main-Class: org.apache.sling.installer.provider.installhook.OsgiInstallerHookEntry
diff --git a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHookEntry.java b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHookEntry.java
new file mode 100644
index 0000000..4b1e1c0
--- /dev/null
+++ b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHookEntry.java
@@ -0,0 +1,58 @@
+/*
+    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.installer.provider.installhook;
+
+import org.apache.jackrabbit.vault.packaging.InstallContext;
+import org.apache.jackrabbit.vault.packaging.InstallHook;
+import org.apache.jackrabbit.vault.packaging.PackageException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OsgiInstallerHookEntry implements InstallHook {
+    private static final Logger LOG = LoggerFactory.getLogger(OsgiInstallerHookEntry.class);
+
+    public static String OSGI_INSTALLER_CLASSNAME = "org.apache.sling.installer.api.OsgiInstaller";
+    public static String HOOK_CLASSNAME = "org.apache.sling.installer.provider.installhook.OsgiInstallerHook";
+
+    @Override
+    public void execute(InstallContext context) throws PackageException {
+
+        try {
+            Class<?> osgiInstallerClass = getClass().getClassLoader().loadClass(OSGI_INSTALLER_CLASSNAME);
+            LOG.debug("Osgi Installer Class found: {}", osgiInstallerClass);
+            loadAndRunInstallHook(context);
+        } catch (ClassNotFoundException e) {
+            LOG.info("Class {} not found, skipping installer hook for package {}", OSGI_INSTALLER_CLASSNAME, context.getPackage().getId());
+        }
+    }
+
+    private void loadAndRunInstallHook(InstallContext context) throws PackageException {
+        InstallHook actualHook = null;
+        try {
+            Class<?> actualHookClass = getClass().getClassLoader().loadClass(HOOK_CLASSNAME);
+            actualHook = (InstallHook) actualHookClass.newInstance();
+        } catch (Exception e) {
+            LOG.error("Could not load/instantiate " + HOOK_CLASSNAME + ": " + e, e);
+            return;
+        }
+
+        actualHook.execute(context);
+    }
+
+}


[sling-org-apache-sling-installer-provider-installhook] 04/05: SLING-8713 Use commons-lang3

Posted by gh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git

commit 52e56ebf9b4e092984759647fa6a36e34daa811f
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Sat Dec 21 00:36:00 2019 +0100

    SLING-8713 Use commons-lang3
---
 pom.xml                                                             | 6 +++---
 .../sling/installer/provider/installhook/OsgiInstallerHook.java     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8e21325..910b6b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,9 +82,9 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.5</version>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <version>3.4</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
index 9815a03..a07baa8 100644
--- a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
+++ b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
@@ -38,7 +38,7 @@ import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jackrabbit.vault.fs.api.ProgressTrackerListener;
 import org.apache.jackrabbit.vault.fs.io.Archive;
 import org.apache.jackrabbit.vault.fs.io.Archive.Entry;


[sling-org-apache-sling-installer-provider-installhook] 01/05: SLING-8949 Handle two digits versions correctly

Posted by gh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git

commit f45a29a581980d15974e530263d91a5d435829d3
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Sat Dec 21 00:24:55 2019 +0100

    SLING-8949 Handle two digits versions correctly
---
 .../apache/sling/installer/provider/installhook/OsgiInstallerHook.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
index 6ca0eec..e9c6c44 100644
--- a/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
+++ b/src/main/java/org/apache/sling/installer/provider/installhook/OsgiInstallerHook.java
@@ -258,7 +258,7 @@ public class OsgiInstallerHook implements InstallHook {
 
                 if (resource.getState() == ResourceState.INSTALLED) {
                     String currentlyActiveBundleVersion = resource.getVersion().toString();
-                    if (!StringUtils.equals(currentlyActiveBundleVersion, bundle.version)) {
+                    if (!StringUtils.startsWith(currentlyActiveBundleVersion, bundle.version)) {
                         logger.log("Bundle " + bundle.symbolicName + " is installed with version "
                                 + currentlyActiveBundleVersion + " but package contains version " + bundle.version);
                         needsInstallation = true;


[sling-org-apache-sling-installer-provider-installhook] 03/05: Merge branch 'master' of git@github.com:apache/sling-org-apache-sling-installer-provider-installhook.git

Posted by gh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git

commit b7d3f00d5af69a0098a28be41d34f60dcc993f4b
Merge: ca524dd a8255bb
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Sat Dec 21 00:26:14 2019 +0100

    Merge branch 'master' of git@github.com:apache/sling-org-apache-sling-installer-provider-installhook.git

 pom.xml                                                           | 2 +-
 .../sling/installer/provider/installhook/OsgiInstallerHook.java   | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)



[sling-org-apache-sling-installer-provider-installhook] 05/05: SLING-8714 Add scope to all dependencies

Posted by gh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ghenzler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-installhook.git

commit 9adba7706e8930cdb668198249dc12876fa89c0b
Author: georg.henzler <ge...@netcentric.biz>
AuthorDate: Sat Dec 21 09:47:23 2019 +0100

    SLING-8714 Add scope to all dependencies
---
 pom.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pom.xml b/pom.xml
index 910b6b0..92b35b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,17 +63,20 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
             <groupId>org.apache.jackrabbit.vault</groupId>
             <artifactId>org.apache.jackrabbit.vault</artifactId>
             <version>${filevault.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-commons</artifactId>
             <version>${jackrabbit.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <dependency>
@@ -114,10 +117,12 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>