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:17:04 UTC

[sling-org-apache-sling-tenant] annotated tag org.apache.sling.tenant-1.1.0 created (now d548214)

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

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


      at d548214  (tag)
 tagging a2d78c7d3d65be1ebf6ddf6708e1bb95da27855c (commit)
      by Timothée Maret
      on Thu Jan 12 14:09:42 2017 +0000

- Log -----------------------------------------------------------------
org.apache.sling.tenant-1.1.0
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new dd95051  SLING-2656 Commit a first shot at Multi Tenancy Support
     new 58a6e6d  SLING-2656 Throw IllegalArgumentException instead of InvalidSyntaxException from the getTenants(String) method
     new 4ab4b53  SLING-2656 remove unused private method
     new 40ca9b3  SLING-2671 Allow multi-value property
     new 9180dcd  SLING-2676 Simple tenant administration through the Web Console (thanks Amit Gupta for providing the patch).
     new a2a8b2b  SLING-2676 Catch exceptions from TenantCustomizer and log
     new 63efd90  Use latest releases and update to new parent pom
     new 6dc26a8  Update to latest parent pom and use latest releases in launchpad
     new edc5c0c  Improve Tenant:
     new 3d19cf8  Declare implementation concept for TenantProvider and -Customizer:
     new 9308e05  SLING-2710 Define TenantManager API
     new ecc9435  SLING-2828 : TenantRoot folder fails to get created. Apply patch from Florentin Wandeler
     new 39fe118  Minor javadoc updates
     new ba92657  Implementation is mostly resource based
     new 185afb9  Minor javadoc updates
     new 4300cd6  Clean up dependencies in pom
     new e5b3e38  [maven-release-plugin] prepare release org.apache.sling.tenant-1.0.0
     new 9807ed6  [maven-release-plugin] prepare for next development iteration
     new 9fa1ae4  Correct reactor pom and update to parent pom 16
     new bff71ef  Update to latest parent pom
     new df9a557  Update to parent pom 18
     new 2dbf317  SLING-3245 Scan all potential path map candidates and don't abort at first candidate which may not map to a Tenant
     new dbe4555  SLING-3247 Guard against ClassCastException checking whether the session actually is a JackrabbitSession
     new e748798  SLING-3376 - TenantProvider passes tenant with old state to TenantCustomizer
     new 859fc0e  Update to parent pom v19
     new da3c22d  [maven-release-plugin] prepare release org.apache.sling.tenant-1.0.2
     new a5c73e0  [maven-release-plugin] prepare for next development iteration
     new 778d25b  Update to latest parent pom 20
     new fdd29f4  Update to Sling Parent POM 22 with baselining enabled
     new be144ae  SLING-4698 - Set parent.relativePath to empty for all modules
     new 54e7c6c  SLING-4753 Commit the Resource Resolver before passing it to Tenant Customizers This closes #92 thanks to Agraj for the patch
     new 8ca93a9  Update contrib modules to Parent 23
     new 2f01843  SLING-4529 remove empty directories from Subversion
     new 9654a08  set parent version to 24 and add empty relativePath where missing
     new 6b535af  Update the contrib reactor to parent 25
     new 85cfa0b  Switch to parent pom 26
     new ee0f9f1  SLING-5240 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant
     new f0f6065  SLING-4234 : Tenant create implementation does not match with the API
     new 7036dd0  SLING-3695 : TenantProvider throws NPE when listing tenants root tenant resource does not exist. Apply patch from Timothee Maret
     new 6eca920  SLING-5240 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant
     new a5beb13  SLING-5240 - Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant
     new a704c35  SLING-4753 - Commit the Resource Resolver before passing it to Tenant Customizers
     new 9a5202d  [maven-release-plugin] prepare release org.apache.sling.tenant-1.1.0
     new a2d78c7  [maven-release-plugin] copy for tag org.apache.sling.tenant-1.1.0

The 44 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.


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

[sling-org-apache-sling-tenant] 03/18: Update to Sling Parent POM 22 with baselining enabled

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

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

commit fdd29f45e3871688666a69e6d2827b95d05fab4a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Oct 1 06:52:29 2014 +0000

    Update to Sling Parent POM 22 with baselining enabled
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1628620 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index b79f21b..7530350 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>20</version>
+        <version>22</version>
         <relativePath>../../../parent/pom.xml</relativePath>
     </parent>
 

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

[sling-org-apache-sling-tenant] 02/18: Update to latest parent pom 20

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

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

commit 778d25bcc4eafe8d9fdf0eda29c62459a157bc8a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Sep 2 14:49:28 2014 +0000

    Update to latest parent pom 20
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1622027 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d94d814..b79f21b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>19</version>
+        <version>20</version>
         <relativePath>../../../parent/pom.xml</relativePath>
     </parent>
 

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

[sling-org-apache-sling-tenant] 15/18: SLING-5240 - Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant

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

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

commit a5beb13abb6375b5402eda89d0ee14aee8918b5d
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Tue Dec 20 12:41:50 2016 +0000

    SLING-5240 - Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant
    
    * Applying Carsten Ziegeler's patch, thanks!
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1775286 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                                 | 2 +-
 src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java  | 2 +-
 .../java/org/apache/sling/tenant/internal/TenantProviderImplTest.java   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 12aaba9..3ada5d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,7 +82,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
-            <version>2.3.0</version>
+            <version>2.5.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
index ad9ad82..a70c137 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
@@ -422,7 +422,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         T result = null;
 
         try {
-            resolver = factory.getAdministrativeResourceResolver(null);
+            resolver = factory.getServiceResourceResolver(null);
             result = task.call(resolver);
         } catch (LoginException le) {
             // unexpected, thus ignore
diff --git a/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java b/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java
index 495d103..c3ff612 100644
--- a/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java
+++ b/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java
@@ -38,7 +38,7 @@ public class TenantProviderImplTest {
         final ResourceResolverFactory rrf = Mockito.mock(ResourceResolverFactory.class);
         final BundleContext context = Mockito.mock(BundleContext.class);
         final ResourceResolver rr = Mockito.mock(ResourceResolver.class);
-        Mockito.when(rrf.getAdministrativeResourceResolver(
+        Mockito.when(rrf.getServiceResourceResolver(
                 Mockito.anyMapOf(String.class, Object.class))).thenReturn(rr);
         set(provider, "factory", rrf);
         provider.activate(context, new HashMap<String, Object>());

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

[sling-org-apache-sling-tenant] 14/18: SLING-5240 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant

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

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

commit 6eca92046cbb633c3227bd9924c7c9e7fffb3b71
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Jan 5 10:20:39 2016 +0000

    SLING-5240 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1723033 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/tenant/internal/TenantProviderImpl.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
index 367dff0..ad9ad82 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
@@ -401,7 +401,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                     tenantProps.putAll(props);
                 }
             } catch (Exception e) {
-                log.info("addTenant: Unexpected problem calling TenantCustomizer " + ts, e);
+                log.info("addTenant/updateTenant: Unexpected problem calling TenantCustomizer " + ts, e);
             }
         }
         // call tenant hooks
@@ -412,7 +412,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                     tenantProps.putAll(props);
                 }
             } catch (Exception e) {
-                log.info("removeTenant: Unexpected problem calling TenantManagerHook " + ts, e);
+                log.info("addTenant/updateTenant: Unexpected problem calling TenantManagerHook " + ts, e);
             }
         }
     }

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

[sling-org-apache-sling-tenant] 01/18: [maven-release-plugin] prepare for next development iteration

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

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

commit a5c73e0417aa964daa3d4e3c1bde42e492c14c19
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Aug 12 06:21:34 2014 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1617416 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 69c30dd..d94d814 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
     </parent>
 
     <artifactId>org.apache.sling.tenant</artifactId>
-    <version>1.0.2</version>
+    <version>1.0.3-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Tenant</name>
@@ -37,13 +37,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tenant-1.0.2
+            scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tenant-1.0.2
+            scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/tags/org.apache.sling.tenant-1.0.2
+            http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tenant
         </url>
     </scm>
 

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

[sling-org-apache-sling-tenant] 18/18: [maven-release-plugin] copy for tag org.apache.sling.tenant-1.1.0

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

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

commit a2d78c7d3d65be1ebf6ddf6708e1bb95da27855c
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 12 14:09:42 2017 +0000

    [maven-release-plugin] copy for tag org.apache.sling.tenant-1.1.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tenant-1.1.0@1778439 13f79535-47bb-0310-9956-ffa450edef68

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

[sling-org-apache-sling-tenant] 06/18: Update contrib modules to Parent 23

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

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

commit 8ca93a9b27f481813ea614294b015793dbd93bf6
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:10:59 2015 +0000

    Update contrib modules to Parent 23
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1687503 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 027e540..e1a252d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>22</version>
+        <version>23</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-tenant] 08/18: set parent version to 24 and add empty relativePath where missing

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

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

commit 9654a086559f815c32895402269a7c6943b04fbd
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 7 07:36:29 2015 +0000

    set parent version to 24 and add empty relativePath where missing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1689588 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e1a252d..cdbeeaf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>23</version>
+        <version>24</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-tenant] 12/18: SLING-4234 : Tenant create implementation does not match with the API

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

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

commit f0f6065ae043e3cc93504c1e87bcd879429337ff
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jan 4 13:36:51 2016 +0000

    SLING-4234 : Tenant create implementation does not match with the API
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1722867 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/tenant/TenantManager.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/tenant/TenantManager.java b/src/main/java/org/apache/sling/tenant/TenantManager.java
index 63f3a07..94d5b55 100644
--- a/src/main/java/org/apache/sling/tenant/TenantManager.java
+++ b/src/main/java/org/apache/sling/tenant/TenantManager.java
@@ -60,10 +60,9 @@ public interface TenantManager {
      *            though, that this map contain at least the
      *            {@link Tenant#PROP_NAME} and {@link Tenant#PROP_DESCRIPTION}
      *            properties.
-     * @return The newly created {@link Tenant} instance.
+     * @return The newly created {@link Tenant} instance or {@code null} if a tenant
+     *         with the id already exists.
      * @throws NullPointerException if {@code tenantId} is {@code null}.
-     * @throws IllegalArgumentException if a tenant with the same
-     *             {@code tentantId} already exists.
      */
     Tenant create(String tenantId, Map<String, Object> properties);
 

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

[sling-org-apache-sling-tenant] 04/18: SLING-4698 - Set parent.relativePath to empty for all modules

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

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

commit be144ae4c952057092899a9602a3a10c02eca9a8
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu May 7 10:14:40 2015 +0000

    SLING-4698 - Set parent.relativePath to empty for all modules
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1678154 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7530350..027e540 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>22</version>
-        <relativePath>../../../parent/pom.xml</relativePath>
+        <relativePath/>
     </parent>
 
     <artifactId>org.apache.sling.tenant</artifactId>

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

[sling-org-apache-sling-tenant] 09/18: Update the contrib reactor to parent 25

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

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

commit 6b535af99454e4ee16385ad0959b3a47786ce567
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Oct 5 10:04:15 2015 +0000

    Update the contrib reactor to parent 25
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1706781 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index cdbeeaf..7699813 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>24</version>
+        <version>25</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-tenant] 07/18: SLING-4529 remove empty directories from Subversion

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

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

commit 2f01843927d6b78bf7d6a1107b7f98fce49890e5
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Jul 6 16:03:48 2015 +0000

    SLING-4529 remove empty directories from Subversion
    
    * tenant
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1689442 13f79535-47bb-0310-9956-ffa450edef68

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

[sling-org-apache-sling-tenant] 17/18: [maven-release-plugin] prepare release org.apache.sling.tenant-1.1.0

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

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

commit 9a5202d1b6ffaa078ff861a76e442476ba79de47
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 12 14:09:29 2017 +0000

    [maven-release-plugin] prepare release org.apache.sling.tenant-1.1.0
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1778438 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3ada5d3..b00b7d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,11 +23,11 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>26</version>
-        <relativePath/>
+        <relativePath />
     </parent>
 
     <artifactId>org.apache.sling.tenant</artifactId>
-    <version>1.0.3-SNAPSHOT</version>
+    <version>1.1.0</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Tenant</name>
@@ -37,13 +37,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant
+            scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tenant-1.1.0
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant
+            scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.tenant-1.1.0
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/tenant
+            http://svn.apache.org/viewvc/sling/tags/org.apache.sling.tenant-1.1.0
         </url>
     </scm>
 

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

[sling-org-apache-sling-tenant] 05/18: SLING-4753 Commit the Resource Resolver before passing it to Tenant Customizers This closes #92 thanks to Agraj for the patch

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

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

commit 54e7c6ca1724239b40c9d4377a005e7e22ffbe5a
Author: Amit Gupta <am...@apache.org>
AuthorDate: Wed May 27 09:06:26 2015 +0000

    SLING-4753 Commit the Resource Resolver before passing it to Tenant Customizers
    This closes #92 thanks to Agraj for the patch
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1681937 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
index 5c48496..72fe197 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
@@ -209,6 +209,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                     // create the tenant
                     Resource tenantRes = createTenantResource(adminResolver, tenantId, properties);
                     TenantImpl tenant = new TenantImpl(tenantRes);
+                    adminResolver.commit();
                     customizeTenant(tenantRes, tenant);
                     adminResolver.commit();
 

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

[sling-org-apache-sling-tenant] 11/18: SLING-5240 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant

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

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

commit ee0f9f1971a3bc8cffb60a90dc86d360f84f7852
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jan 4 13:34:17 2016 +0000

    SLING-5240 : Remove getAdministrativeResourceResolver() usage from org.apache.sling.tenant
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1722866 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/tenant/TenantManager.java     | 10 +--
 .../sling/tenant/internal/TenantProviderImpl.java  | 78 +++++++++++++++++++---
 .../apache/sling/tenant/spi/TenantCustomizer.java  |  8 ++-
 ...enantCustomizer.java => TenantManagerHook.java} | 42 ++++++------
 .../org/apache/sling/tenant/spi/package-info.java  |  2 +-
 5 files changed, 102 insertions(+), 38 deletions(-)

diff --git a/src/main/java/org/apache/sling/tenant/TenantManager.java b/src/main/java/org/apache/sling/tenant/TenantManager.java
index 23b1c1a..63f3a07 100644
--- a/src/main/java/org/apache/sling/tenant/TenantManager.java
+++ b/src/main/java/org/apache/sling/tenant/TenantManager.java
@@ -47,7 +47,7 @@ public interface TenantManager {
      * properties.
      * <p>
      * After creating the tenant, the
-     * {@link org.apache.sling.tenant.spi.TenantCustomizer#setup(Tenant, org.apache.sling.api.resource.ResourceResolver)}
+     * {@link org.apache.sling.tenant.spi.TenantManagerHook#setup(Tenant)}
      * method is called to allow customizers to configure additional properties.
      * <p>
      * Before returning the newly created tenant object the data is persisted.
@@ -72,7 +72,7 @@ public interface TenantManager {
      * property if the value is {@code null}.
      * <p>
      * Before returning the
-     * {@link org.apache.sling.tenant.spi.TenantCustomizer#setup(Tenant, org.apache.sling.api.resource.ResourceResolver)}
+     * {@link org.apache.sling.tenant.spi.TenantManagerHook#change(Tenant)}
      * method is called to allow customizers to configure additional properties.
      *
      * @param tenant The tenant whose property is to be set or remove.
@@ -88,7 +88,7 @@ public interface TenantManager {
      * Sets or removes multiple properties on the tenant.
      * <p>
      * Before returning the
-     * {@link org.apache.sling.tenant.spi.TenantCustomizer#setup(Tenant, org.apache.sling.api.resource.ResourceResolver)}
+     * {@link org.apache.sling.tenant.spi.TenantManagerHook#change(Tenant)}
      * method is called to allow customizers to configure additional properties.
      *
      * @param tenant The tenant whose properties are to be modified.
@@ -103,7 +103,7 @@ public interface TenantManager {
      * Removes one or more properties from the tenant.
      * <p>
      * Before returning the
-     * {@link org.apache.sling.tenant.spi.TenantCustomizer#setup(Tenant, org.apache.sling.api.resource.ResourceResolver)}
+     * {@link org.apache.sling.tenant.spi.TenantManagerHook#change(Tenant)}
      * method is called to allow customizers to configure additional properties
      * unless the {@code properties} parameter is {@code null} or empty.
      *
@@ -120,7 +120,7 @@ public interface TenantManager {
      * Removes the given tenant.
      * <p>
      * Before returning the
-     * {@link org.apache.sling.tenant.spi.TenantCustomizer#remove(Tenant, org.apache.sling.api.resource.ResourceResolver)}
+     * {@link org.apache.sling.tenant.spi.TenantManagerHook#remove(Tenant)}
      * method is called to allow customizers to implement further cleanup upon
      * tenant removal.
      *
diff --git a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
index 72fe197..83be26e 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
@@ -32,12 +32,12 @@ import java.util.TreeMap;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.References;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.ModifiableValueMap;
@@ -53,6 +53,7 @@ import org.apache.sling.tenant.TenantManager;
 import org.apache.sling.tenant.TenantProvider;
 import org.apache.sling.tenant.internal.console.WebConsolePlugin;
 import org.apache.sling.tenant.spi.TenantCustomizer;
+import org.apache.sling.tenant.spi.TenantManagerHook;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
@@ -69,15 +70,20 @@ import org.slf4j.LoggerFactory;
         label = "Apache Sling Tenant Provider",
         description = "Service responsible for providing Tenants",
         immediate = true)
-@Service
-@Properties(value = {
-    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Apache Sling Tenant Provider")
-})
-@Reference(
+@Service(value = {TenantProvider.class, TenantManager.class})
+@Property(name = Constants.SERVICE_DESCRIPTION, value = "Apache Sling Tenant Provider")
+@References({
+    @Reference(
         name = "tenantSetup",
         referenceInterface = TenantCustomizer.class,
         cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
-        policy = ReferencePolicy.DYNAMIC)
+        policy = ReferencePolicy.DYNAMIC),
+    @Reference(
+            name = "hook",
+            referenceInterface = TenantManagerHook.class,
+            cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE,
+            policy = ReferencePolicy.DYNAMIC)
+})
 public class TenantProviderImpl implements TenantProvider, TenantManager {
 
     /** default log */
@@ -96,6 +102,9 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
     private SortedMap<Comparable<Object>, TenantCustomizer> registeredTenantHandlers = new TreeMap<Comparable<Object>, TenantCustomizer>(
         Collections.reverseOrder());
 
+    private SortedMap<Comparable<Object>, TenantManagerHook> registeredHooks = new TreeMap<Comparable<Object>, TenantManagerHook>(
+            Collections.reverseOrder());
+
     @Property(
             value = {},
             unbounded = PropertyUnbounded.ARRAY,
@@ -146,9 +155,25 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         return registeredTenantHandlers.values();
     }
 
+    @SuppressWarnings("unused")
+    private synchronized void bindHook(TenantManagerHook action, Map<String, Object> config) {
+        registeredHooks.put(ServiceUtil.getComparableForServiceRanking(config), action);
+    }
+
+    @SuppressWarnings("unused")
+    private synchronized void unbindHook(TenantManagerHook action, Map<String, Object> config) {
+        registeredHooks.remove(ServiceUtil.getComparableForServiceRanking(config));
+    }
+
+    private synchronized Collection<TenantManagerHook> getHooks() {
+        return registeredHooks.values();
+    }
+
+    @Override
     public Tenant getTenant(final String tenantId) {
         if (tenantId != null && tenantId.length() > 0) {
             return call(new ResourceResolverTask<Tenant>() {
+                @Override
                 public Tenant call(ResourceResolver resolver) {
                     Resource tenantRes = getTenantResource(resolver, tenantId);
                     return (tenantRes != null) ? new TenantImpl(tenantRes) : null;
@@ -160,10 +185,12 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         return null;
     }
 
+    @Override
     public Iterator<Tenant> getTenants() {
         return getTenants(null);
     }
 
+    @Override
     public Iterator<Tenant> getTenants(final String tenantFilter) {
         final Filter filter;
         if (tenantFilter != null && tenantFilter.length() > 0) {
@@ -177,6 +204,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         }
 
         Iterator<Tenant> result = call(new ResourceResolverTask<Iterator<Tenant>>() {
+            @Override
             public Iterator<Tenant> call(ResourceResolver resolver) {
                 Resource tenantRootRes = resolver.getResource(tenantRootPath);
 
@@ -202,15 +230,17 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         return result;
     }
 
+    @Override
     public Tenant create(final String tenantId, final Map<String, Object> properties) {
         return call(new ResourceResolverTask<Tenant>() {
+            @Override
             public Tenant call(ResourceResolver adminResolver) {
                 try {
                     // create the tenant
                     Resource tenantRes = createTenantResource(adminResolver, tenantId, properties);
                     TenantImpl tenant = new TenantImpl(tenantRes);
                     adminResolver.commit();
-                    customizeTenant(tenantRes, tenant);
+                    customizeTenant(tenantRes, tenant, true);
                     adminResolver.commit();
 
                     // refresh tenant instance, as it copies property from
@@ -231,8 +261,10 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         });
     }
 
+    @Override
     public void remove(final Tenant tenant) {
         call(new ResourceResolverTask<Void>() {
+            @Override
             public Void call(ResourceResolver resolver) {
                 try {
                     Resource tenantRes = getTenantResource(resolver, tenant.getId());
@@ -245,6 +277,14 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                                 log.info("removeTenant: Unexpected problem calling TenantCustomizer " + ts, e);
                             }
                         }
+                        // call tenant hooks
+                        for (TenantManagerHook ts : getHooks()) {
+                            try {
+                                ts.remove(tenant);
+                            } catch (Exception e) {
+                                log.info("removeTenant: Unexpected problem calling TenantManagerHook " + ts, e);
+                            }
+                        }
 
                         resolver.delete(tenantRes);
                         resolver.commit();
@@ -258,8 +298,10 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         });
     }
 
+    @Override
     public void setProperty(final Tenant tenant, final String name, final Object value) {
         updateProperties(tenant, new PropertiesUpdater() {
+            @Override
             public void update(ModifiableValueMap properties) {
                 if (value != null) {
                     properties.put(name, value);
@@ -270,8 +312,10 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         });
     }
 
+    @Override
     public void setProperties(final Tenant tenant, final Map<String, Object> properties) {
         updateProperties(tenant, new PropertiesUpdater() {
+            @Override
             public void update(ModifiableValueMap vm) {
                 for (Entry<String, Object> entry : properties.entrySet()) {
                     if (entry.getValue() != null) {
@@ -284,8 +328,10 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         });
     }
 
+    @Override
     public void removeProperties(final Tenant tenant, final String... propertyNames) {
         updateProperties(tenant, new PropertiesUpdater() {
+            @Override
             public void update(ModifiableValueMap properties) {
                 for (String name : propertyNames) {
                     properties.remove(name);
@@ -334,7 +380,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         return resolver.getResource(tenantRootPath + "/" + tenantId);
     }
 
-    private void customizeTenant(final Resource tenantRes, final Tenant tenant) {
+    private void customizeTenant(final Resource tenantRes, final Tenant tenant, boolean isCreate) {
 
         // call tenant setup handler
         Map<String, Object> tenantProps = tenantRes.adaptTo(ModifiableValueMap.class);
@@ -355,6 +401,17 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                 log.info("addTenant: Unexpected problem calling TenantCustomizer " + ts, e);
             }
         }
+        // call tenant hooks
+        for (TenantManagerHook ts : getHooks()) {
+            try {
+                Map<String, Object> props = (isCreate ? ts.setup(tenant) : ts.change(tenant));
+                if (props != null) {
+                    tenantProps.putAll(props);
+                }
+            } catch (Exception e) {
+                log.info("removeTenant: Unexpected problem calling TenantManagerHook " + ts, e);
+            }
+        }
     }
 
     private <T> T call(ResourceResolverTask<T> task) {
@@ -377,6 +434,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
 
     private void updateProperties(final Tenant tenant, final PropertiesUpdater updater) {
         call(new ResourceResolverTask<Void>() {
+            @Override
             public Void call(ResourceResolver resolver) {
                 try {
                     Resource tenantRes = getTenantResource(resolver, tenant.getId());
@@ -388,7 +446,7 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                             ((TenantImpl) tenant).loadProperties(tenantRes);
                         }
 
-                        customizeTenant(tenantRes, tenant);
+                        customizeTenant(tenantRes, tenant, false);
                         resolver.commit();
 
                         if (tenant instanceof TenantImpl) {
diff --git a/src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java b/src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java
index 18785da..345197b 100644
--- a/src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java
+++ b/src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java
@@ -30,7 +30,11 @@ import aQute.bnd.annotation.ConsumerType;
  *
  * Tools can hook into the tenant creation, changing a tenant and removing
  * thereof by implementing this interface.
+ *
+ * @deprecated This interface will not be supported in future versions. Use
+ *             {@link TenantManagerHook} instead.
  */
+@Deprecated
 @ConsumerType
 public interface TenantCustomizer {
 
@@ -54,7 +58,7 @@ public interface TenantCustomizer {
      *         property accessor methods. {@code null} or an empty map may be
      *         returned to not add properties.
      */
-    public Map<String, Object> setup(Tenant tenant, ResourceResolver resolver);
+    Map<String, Object> setup(Tenant tenant, ResourceResolver resolver);
 
     /**
      * Called to remove the setup for the given Tenant. This reverts all changes
@@ -72,5 +76,5 @@ public interface TenantCustomizer {
      *            persistence for further cleanup. Note, that this
      *            {@code resolver} will have administrative privileges.
      */
-    public void remove(Tenant tenant, ResourceResolver resolver);
+    void remove(Tenant tenant, ResourceResolver resolver);
 }
diff --git a/src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java b/src/main/java/org/apache/sling/tenant/spi/TenantManagerHook.java
similarity index 64%
copy from src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java
copy to src/main/java/org/apache/sling/tenant/spi/TenantManagerHook.java
index 18785da..612f086 100644
--- a/src/main/java/org/apache/sling/tenant/spi/TenantCustomizer.java
+++ b/src/main/java/org/apache/sling/tenant/spi/TenantManagerHook.java
@@ -20,7 +20,6 @@ package org.apache.sling.tenant.spi;
 
 import java.util.Map;
 
-import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.tenant.Tenant;
 
 import aQute.bnd.annotation.ConsumerType;
@@ -30,47 +29,50 @@ import aQute.bnd.annotation.ConsumerType;
  *
  * Tools can hook into the tenant creation, changing a tenant and removing
  * thereof by implementing this interface.
+ *
+ * @since 1.1
  */
 @ConsumerType
-public interface TenantCustomizer {
+public interface TenantManagerHook {
 
     /**
-     * Method called to create or update the given tenant. The method may return
-     * additional properties to be added to the Tenant's property list. The
-     * ResourceResolver allows for access to the persistence.
+     * Method called to create the given tenant. The method may return
+     * additional properties to be added to the Tenant's property list.
      * <p>
-     * The {@code ResourceResolver.commit} method must not be called by this
-     * method.
+     * This method is not expected to throw an exception. Any exception thrown
+     * is logged but otherwise ignored.
+     *
+     * @param tenant The {@link Tenant} to be configured by this call
+     * @return Additional properties to be added to the tenant. These properties
+     *         may later be accessed through the {@linkplain Tenant tenant's}
+     *         property accessor methods. {@code null} or an empty map may be
+     *         returned to not add properties.
+     */
+    Map<String, Object> setup(Tenant tenant);
+
+    /**
+     * Method called to update the given tenant. The method may return
+     * additional properties to be added to the Tenant's property list.
      * <p>
      * This method is not expected to throw an exception. Any exception thrown
      * is logged but otherwise ignored.
      *
      * @param tenant The {@link Tenant} to be configured by this call
-     * @param resolver The {@code ResourceResolver} providing access to the
-     *            persistence for further setup. Note, that this
-     *            {@code resolver} will have administrative privileges.
      * @return Additional properties to be added to the tenant. These properties
      *         may later be accessed through the {@linkplain Tenant tenant's}
      *         property accessor methods. {@code null} or an empty map may be
      *         returned to not add properties.
      */
-    public Map<String, Object> setup(Tenant tenant, ResourceResolver resolver);
+    Map<String, Object> change(Tenant tenant);
 
     /**
      * Called to remove the setup for the given Tenant. This reverts all changes
-     * done by the #setup method. The ResourceResolver allows for access to the
-     * persistence.
-     * <p>
-     * The {@code ResourceResolver.commit} method must not be called by this
-     * method.
+     * done by the #setup method.
      * <p>
      * This method is not expected to throw an exception. Any exception thrown
      * is logged but otherwise ignored.
      *
      * @param tenant The {@link Tenant} about to be removed
-     * @param resolver The {@code ResourceResolver} providing access to the
-     *            persistence for further cleanup. Note, that this
-     *            {@code resolver} will have administrative privileges.
      */
-    public void remove(Tenant tenant, ResourceResolver resolver);
+    void remove(Tenant tenant);
 }
diff --git a/src/main/java/org/apache/sling/tenant/spi/package-info.java b/src/main/java/org/apache/sling/tenant/spi/package-info.java
index fa458c7..aa5c3f6 100644
--- a/src/main/java/org/apache/sling/tenant/spi/package-info.java
+++ b/src/main/java/org/apache/sling/tenant/spi/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.0")
+@Version("1.1")
 package org.apache.sling.tenant.spi;
 
 import aQute.bnd.annotation.Version;

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

[sling-org-apache-sling-tenant] 13/18: SLING-3695 : TenantProvider throws NPE when listing tenants root tenant resource does not exist. Apply patch from Timothee Maret

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

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

commit 7036dd045f6f3b34c269f81405d2751dff1ed35e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Jan 4 13:45:54 2016 +0000

    SLING-3695 : TenantProvider throws NPE when listing tenants root tenant resource does not exist. Apply patch from Timothee Maret
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1722868 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 10 ++++
 .../sling/tenant/internal/TenantProviderImpl.java  | 27 ++++++-----
 .../tenant/internal/TenantProviderImplTest.java    | 56 ++++++++++++++++++++++
 3 files changed, 81 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8bd500c..12aaba9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -127,5 +127,15 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.10.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+        </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
index 83be26e..367dff0 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
@@ -122,14 +122,14 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
     private WebConsolePlugin plugin;
 
     @Activate
-    private void activate(final BundleContext bundleContext, final Map<String, Object> properties) {
+    protected void activate(final BundleContext bundleContext, final Map<String, Object> properties) {
         this.tenantRootPath = PropertiesUtil.toString(properties.get(TENANT_ROOT), RESOURCE_TENANT_ROOT);
         this.adapterFactory = new TenantAdapterFactory(bundleContext, this, PropertiesUtil.toStringArray(properties.get(TENANT_PATH_MATCHER), DEFAULT_PATH_MATCHER));
         this.plugin = new WebConsolePlugin(bundleContext, this);
     }
 
     @Deactivate
-    private void deactivate() {
+    protected void deactivate() {
         if (this.adapterFactory != null) {
             this.adapterFactory.dispose();
             this.adapterFactory = null;
@@ -204,21 +204,24 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
         }
 
         Iterator<Tenant> result = call(new ResourceResolverTask<Iterator<Tenant>>() {
+            @SuppressWarnings("unchecked")
             @Override
             public Iterator<Tenant> call(ResourceResolver resolver) {
                 Resource tenantRootRes = resolver.getResource(tenantRootPath);
-
-                List<Tenant> tenantList = new ArrayList<Tenant>();
-                Iterator<Resource> tenantResourceList = tenantRootRes.listChildren();
-                while (tenantResourceList.hasNext()) {
-                    Resource tenantRes = tenantResourceList.next();
-
-                    if (filter == null || filter.matches(ResourceUtil.getValueMap(tenantRes))) {
-                        TenantImpl tenant = new TenantImpl(tenantRes);
-                        tenantList.add(tenant);
+                if ( tenantRootRes != null ) {
+                    List<Tenant> tenantList = new ArrayList<Tenant>();
+                    Iterator<Resource> tenantResourceList = tenantRootRes.listChildren();
+                    while (tenantResourceList.hasNext()) {
+                        Resource tenantRes = tenantResourceList.next();
+
+                        if (filter == null || filter.matches(ResourceUtil.getValueMap(tenantRes))) {
+                            TenantImpl tenant = new TenantImpl(tenantRes);
+                            tenantList.add(tenant);
+                        }
                     }
+                    return tenantList.iterator();
                 }
-                return tenantList.iterator();
+                return Collections.EMPTY_LIST.iterator();
             }
         });
 
diff --git a/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java b/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java
new file mode 100644
index 0000000..495d103
--- /dev/null
+++ b/src/test/java/org/apache/sling/tenant/internal/TenantProviderImplTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.tenant.internal;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.tenant.Tenant;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.osgi.framework.BundleContext;
+
+public class TenantProviderImplTest {
+
+    @Test
+    public void testListTenantsWithoutTenantRoot() throws Exception {
+        TenantProviderImpl provider = new TenantProviderImpl();
+        final ResourceResolverFactory rrf = Mockito.mock(ResourceResolverFactory.class);
+        final BundleContext context = Mockito.mock(BundleContext.class);
+        final ResourceResolver rr = Mockito.mock(ResourceResolver.class);
+        Mockito.when(rrf.getAdministrativeResourceResolver(
+                Mockito.anyMapOf(String.class, Object.class))).thenReturn(rr);
+        set(provider, "factory", rrf);
+        provider.activate(context, new HashMap<String, Object>());
+        Iterator<Tenant> tenants = provider.getTenants();
+        TestCase.assertNotNull(tenants);
+        TestCase.assertFalse(tenants.hasNext());
+    }
+
+    private static void set(Object o, String name, Object value) throws Exception {
+        final Field f = o.getClass().getDeclaredField(name);
+        f.setAccessible(true);
+        f.set(o, value);
+    }
+
+}

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

[sling-org-apache-sling-tenant] 10/18: Switch to parent pom 26

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

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

commit 85cfa0b11b8207f8fa2d70099876debee9643e82
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Jan 3 14:07:46 2016 +0000

    Switch to parent pom 26
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1722720 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7699813..8bd500c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>25</version>
+        <version>26</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-tenant] 16/18: SLING-4753 - Commit the Resource Resolver before passing it to Tenant Customizers

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

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

commit a704c35e9afb9137421082bd1fe90afbccc545a7
Author: Timothée Maret <tm...@apache.org>
AuthorDate: Thu Jan 12 13:50:44 2017 +0000

    SLING-4753 - Commit the Resource Resolver before passing it to Tenant Customizers
    
    * Revert commit r1681937
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/tenant@1778434 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
index a70c137..cff472e 100644
--- a/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
+++ b/src/main/java/org/apache/sling/tenant/internal/TenantProviderImpl.java
@@ -242,7 +242,6 @@ public class TenantProviderImpl implements TenantProvider, TenantManager {
                     // create the tenant
                     Resource tenantRes = createTenantResource(adminResolver, tenantId, properties);
                     TenantImpl tenant = new TenantImpl(tenantRes);
-                    adminResolver.commit();
                     customizeTenant(tenantRes, tenant, true);
                     adminResolver.commit();
 

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