You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:52:28 UTC

[sling-org-apache-sling-launchpad-installer] 06/10: SLING-1953 Support provisioning of all file types

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

rombert pushed a commit to annotated tag org.apache.sling.launchpad.installer-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-installer.git

commit efc43423ab9583ded2035a078b1679ea1ec7fabf
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jan 28 10:26:29 2011 +0000

    SLING-1953 Support provisioning of all file types
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/launchpad/installer@1064622 13f79535-47bb-0310-9956-ffa450edef68
---
 .../installer/impl/LaunchpadConfigInstaller.java   | 42 ++++++++++++++++------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java b/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java
index 82ce5c2..c2f6435 100644
--- a/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java
+++ b/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java
@@ -29,28 +29,48 @@ import org.slf4j.LoggerFactory;
 
 public class LaunchpadConfigInstaller {
 
-    /** Resources supplied under this path by
-     *  LaunchpadContentProvider are considered for installation
+    /**
+     * Resources supplied under this path by
+     * LaunchpadContentProvider are considered for installation
+     * as configurations
      */
     private static final String ROOT_CONFIG_PATH = "resources/config";
 
-    private static Logger LOGGER = LoggerFactory.getLogger(LaunchpadConfigInstaller.class);
+    /**
+     * Resources supplied under this path by
+     * LaunchpadContentProvider are considered for installation
+     * as files
+     */
+    private static final String ROOT_INSTALL_PATH = "resources/install";
 
     public static void install(final OsgiInstaller installer,
             final LaunchpadContentProvider resourceProvider) {
-        LOGGER.info("Activating launchpad config installer, resources path={}", ROOT_CONFIG_PATH);
-        Collection<InstallableResource> installables = new HashSet<InstallableResource>();
+        final Logger logger = LoggerFactory.getLogger(LaunchpadConfigInstaller.class);
+        logger.info("Activating launchpad config installer, configuration path={}, install path={}",
+                ROOT_CONFIG_PATH, ROOT_INSTALL_PATH);
+
+        final Collection<InstallableResource> installables = new HashSet<InstallableResource>();
 
-        Iterator<String> configPaths = resourceProvider.getChildren(ROOT_CONFIG_PATH);
+        // configurations
+        final Iterator<String> configPaths = resourceProvider.getChildren(ROOT_CONFIG_PATH);
         while (configPaths.hasNext()) {
-            String path = configPaths.next();
-            LOGGER.info("Config launchpad file will be installed: {}", path);
-            InputStream stream = resourceProvider.getResourceAsStream(path);
-            installables.add(new InstallableResource(path, stream, null, null, InstallableResource.TYPE_PROPERTIES, 0));
+            final String path = configPaths.next();
+            logger.info("Config launchpad file will be installed: {}", path);
+            final InputStream stream = resourceProvider.getResourceAsStream(path);
+            installables.add(new InstallableResource(path, stream, null, null, InstallableResource.TYPE_PROPERTIES, null));
+        }
+
+        // files
+        final Iterator<String> filePaths = resourceProvider.getChildren(ROOT_INSTALL_PATH);
+        while (filePaths.hasNext()) {
+            final String path = filePaths.next();
+            logger.info("Launchpad file will be installed: {}", path);
+            final InputStream stream = resourceProvider.getResourceAsStream(path);
+            installables.add(new InstallableResource(path, stream, null, null, InstallableResource.TYPE_FILE, null));
         }
 
         final InstallableResource [] toInstall = installables.toArray(new InstallableResource []{});
         installer.registerResources("launchpad", (toInstall));
-        LOGGER.info("{} resources registered with OsgiInstaller", toInstall.length);
+        logger.info("{} resources registered with OsgiInstaller", toInstall.length);
     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.