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 10:16:15 UTC

[sling-org-apache-sling-settings] 06/15: SLING-2089 - adding getAbsolutePathWithinSlingHome() method

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

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

commit 9897382e0ab709e84749072861236caf604078ad
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Sat Jun 11 03:14:16 2011 +0000

    SLING-2089 - adding getAbsolutePathWithinSlingHome() method
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1134512 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                       |  2 +-
 .../java/org/apache/sling/settings/SlingSettingsService.java  |  7 +++++++
 .../apache/sling/settings/impl/SlingSettingsServiceImpl.java  | 11 ++++++++++-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0bdf93d..7bbc7db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,7 @@
                             http://sling.apache.org/site/sling-settings-orgapacheslingsettings.html
                         </Bundle-DocURL>
                         <Export-Package>
-                            org.apache.sling.settings;version=1.0.0
+                            org.apache.sling.settings;version=1.1.0
                         </Export-Package>
                         <Private-Package>
                             org.apache.sling.settings.impl
diff --git a/src/main/java/org/apache/sling/settings/SlingSettingsService.java b/src/main/java/org/apache/sling/settings/SlingSettingsService.java
index f8b6904..cd5e175 100644
--- a/src/main/java/org/apache/sling/settings/SlingSettingsService.java
+++ b/src/main/java/org/apache/sling/settings/SlingSettingsService.java
@@ -67,6 +67,13 @@ public interface SlingSettingsService {
      */
     String RUN_MODES_PROPERTY = "sling.run.modes";
 
+    /**
+     * Utility method to generate an absolute path
+     * within Sling Home.
+     *
+     * @since 1.1.0
+     */
+    String getAbsolutePathWithinSlingHome(String relativePath);
 
     /**
      * The identifier of the running Sling instance.
diff --git a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
index da47c2b..2d2b958 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -23,6 +23,8 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashSet;
@@ -62,7 +64,6 @@ public class SlingSettingsServiceImpl
 
     /** Flag indicating a delayed start of this service. */
     private boolean delayedStart = false;
-
     /**
      * Create the service and search the Sling home urls and
      * get/create a sling id.
@@ -216,6 +217,14 @@ public class SlingSettingsServiceImpl
         return null;
     }
 
+
+    /**
+     * @see org.apache.sling.settings.SlingSettingsService#getAbsolutePathWithinSlingHome()
+     */
+    public String getAbsolutePathWithinSlingHome(String relativePath) {
+        return new File(slingHome, relativePath).getAbsolutePath();
+    }
+
     /**
      * @see org.apache.sling.settings.SlingSettingsService#getSlingId()
      */

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