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:14:30 UTC
[sling-org-apache-sling-serviceusermapper] annotated tag
org.apache.sling.serviceusermapper-1.2.6 created (now 9653955)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag org.apache.sling.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git.
at 9653955 (tag)
tagging 2e569e5aaf5e955431ce201c8d8b5250871e577f (commit)
by Carsten Ziegeler
on Mon Mar 27 08:29:12 2017 +0000
- Log -----------------------------------------------------------------
org.apache.sling.serviceusermapper-1.2.6
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new e689b69 Working on a prototype to deprecate loginAdministrative
new c5e0963 change api: use ServiceFactory approach and service bundle is actually the using bundle
new 7d98561 Switch back to using a regular ServiceUserName service tacking the service bundle as an argument.
new 1b03026 Implement support for service based ResourceResolver and Session access
new 3ecf9df Implement support for service based ResourceResolver and Session access
new f39b2fc SLING-2944 Implement Service User Mapper
new 0a5259b SLING-2944 : Replace administrative login by service-based login
new e9b4e3e Update to parent pom 18
new 145bf95 SLING-3286 - Remove plugin version overrides from poms
new e1a1537 Add svn info
new ce124d6 [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.0.0
new b1c7389 [maven-release-plugin] prepare for next development iteration
new e40493e Update to parent pom v19
new 90f2a66 SLING-3578 : Support mapping amendments
new fe71e7f [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.0.2
new 0394164 [maven-release-plugin] prepare for next development iteration
new dad1f70 SLING-3465 : Wrong description for "user.mapping" property of ServiceUserMapperImpl. Apply patch from Tobias Bocanegra and also fix the copied info in the new MappingConfigAmendment
new a8f6248 SLING-3757 : cannot add more than 1 service user with the OSGI console
new 3c2449b [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.0.4
new d6a1293 [maven-release-plugin] prepare for next development iteration
new fdec4ca Updated to parent version 20
new a151b5a Update to Sling Parent POM 22 with baselining enabled
new 3d65ad7 SLING-3854 - Add configuration option to restrict service user mapper to system users
new eb2a1ce SLING-4312: Register an osgi service for each available service user
new 84260c0 SLING-4312: revert revision 1661081 due to a compile error on java 1.6
new 79cfa85 [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.1.0
new 23de558 [maven-release-plugin] prepare for next development iteration
new d3e3149 SLING-4312: Register an osgi service for each available service user (+ change tests to mockito)
new 6bc2582 SLING-4312: changed name from ServiceUserMapping to ServiceUserMapped and removed all metohds
new dd3c265 SLING-4495 : Improve ServiceUserMapperImpl#isValidUser
new ff10f6a SLING-4312 : update javadocs
new 8f7e8ab [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.0
new ddeb68b [maven-release-plugin] prepare for next development iteration
new 8f8ddd7 Add missing licence header
new 87a8eef SLING-4742 Service User Mapper: Web Console Name Hints for Mapping Configurations
new d10ff51 Update to Sling Parent 23
new 470edb7 set parent version to 24 and add empty relativePath where missing
new 9780c5b SLING-4930 - InventoryPrinter for service user mappings
new d45db0b SLING-4930 - keep only the 'mappings by user' section, I think the raw mappings are redundant
new 1029fe5 SLING-4930 : InventoryPrinter for Service User Mappings
new 6934258 SLING-4930 : InventoryPrinter for Service User Mappings
new ccf117e SLING-4895: Service registry should not be called from within synchronized block
new b1a6848 SLING-5019 : ServiceUserMappedBundleFilter should be immediate
new bebc3e4 SLING-5006 restart ServiceUserMapped services in case a ServiceUserValidator has been changed.
new c904ef4 Update the main reactor to parent 25
new ff12b1f SLING-5006: do service registrations asyncronously and outside syncronized area
new c98618d SLING-5006: set executorService to null on deactivate
new 07e1e1b [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.2
new ae5f528 [maven-release-plugin] prepare for next development iteration
new 54e156d [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.4
new cb28970 [maven-release-plugin] prepare for next development iteration
new aed1e64 Switch back to 1.2.3-SNAPSHOT
new 5d8bd40 Switch to parent pom 26
new 8013242 SLING-5484 - more logging for ServiceUserMapperImpl.getServiceUserID and related methods
new 87c737f SLING-5484 - add debug log for default user
new f2dda72 SLING-5484 - typo
new c32106c SLING-5484 - log the active mappings update as well
new ece541c SLING-5484 - tweak debug logs
new 8a5761a SLING-6397 : Error logged by ServiceUserMapperImpl while unregistering an already unregistered service
new c3f5d9d [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.4
new ce974aa [maven-release-plugin] prepare for next development iteration
new dfbde94 SLING-6555 : Migrate to R6 annotations, clean up dependencies
new 847de08 SLING-6555 : Migrate to R6 annotations, clean up dependencies
new ece807e use Sling Parent 30
new f217eff add missing Felix SCR annotations
new 0baa5ba Remove unused SCR plugin, fix javadoc
new 743c855 [maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.6
new 2e569e5 [maven-release-plugin] copy for tag org.apache.sling.serviceusermapper-1.2.6
The 68 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-serviceusermapper] 03/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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 5d8bd40501d3662be0da827eac872a0d778f1ae7
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/bundles/extensions/serviceusermapper@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 6d54673..dfb768d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,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-serviceusermapper] 18/18:
[maven-release-plugin] copy for tag
org.apache.sling.serviceusermapper-1.2.6
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 2e569e5aaf5e955431ce201c8d8b5250871e577f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 27 08:29:12 2017 +0000
[maven-release-plugin] copy for tag org.apache.sling.serviceusermapper-1.2.6
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.6@1788848 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-serviceusermapper] 15/18: add missing Felix
SCR annotations
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit f217eff8eeab69e777130789031077d4203287f9
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 18:53:25 2017 +0000
add missing Felix SCR annotations
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1785728 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pom.xml b/pom.xml
index 2927cbf..98c87cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,11 @@
<artifactId>osgi.core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.event</artifactId>
<version>1.3.1</version>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 06/18: SLING-5484 - typo
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit f2dda72982b456f3ca769bb8d07cfb15b4339d7b
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Feb 4 14:24:48 2016 +0000
SLING-5484 - typo
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1728486 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index e0e8220..cdf82f0 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -391,7 +391,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
return true;
}
}
- log.debug("isValidUser: No validator accepte userId [{}] -> invalid", userId);
+ log.debug("isValidUser: No validator accepted userId [{}] -> invalid", userId);
return false;
} else {
log.debug("isValidUser: No active validators for userId [{}] -> valid", userId);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 07/18: SLING-5484 - log
the active mappings update as well
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit c32106cc3aa9fae4cec512261d05dcfef2760a4c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Feb 4 14:48:22 2016 +0000
SLING-5484 - log the active mappings update as well
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1728490 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index cdf82f0..edd22dd 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -240,6 +240,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
activeMappings = mappings.toArray(new Mapping[mappings.size()]);
+ log.debug("Active mappings updated: {}", mappings);
RegistrationSet registrationSet = updateServiceRegistrations(activeMappings);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 13/18: SLING-6555 :
Migrate to R6 annotations, clean up dependencies
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 847de08596bdc5a1f4c7c4362e89c7fbb3925033
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 23 12:40:32 2017 +0000
SLING-6555 : Migrate to R6 annotations, clean up dependencies
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1784118 13f79535-47bb-0310-9956-ffa450edef68
---
.../impl/MappingConfigAmendment.java | 24 +++++++++++++---------
.../impl/ServiceUserMapperImpl.java | 24 +++++++++++++---------
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java b/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java
index 1d10c38..ff631cf 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java
@@ -68,19 +68,23 @@ public class MappingConfigAmendment implements Comparable<MappingConfigAmendment
void configure(final Config config) {
final String[] props = config.user_mapping();
- final ArrayList<Mapping> mappings = new ArrayList<Mapping>(props.length);
- for (final String prop : props) {
- if (prop != null && prop.trim().length() > 0 ) {
- try {
- final Mapping mapping = new Mapping(prop.trim());
- mappings.add(mapping);
- } catch (final IllegalArgumentException iae) {
- logger.info("configure: Ignoring '{}': {}", prop, iae.getMessage());
+ if ( props != null ) {
+ final ArrayList<Mapping> mappings = new ArrayList<Mapping>(props.length);
+ for (final String prop : props) {
+ if (prop != null && prop.trim().length() > 0 ) {
+ try {
+ final Mapping mapping = new Mapping(prop.trim());
+ mappings.add(mapping);
+ } catch (final IllegalArgumentException iae) {
+ logger.info("configure: Ignoring '{}': {}", prop, iae.getMessage());
+ }
}
}
- }
- this.serviceUserMappings = mappings.toArray(new Mapping[mappings.size()]);
+ this.serviceUserMappings = mappings.toArray(new Mapping[mappings.size()]);
+ } else {
+ this.serviceUserMappings = new Mapping[0];
+ }
this.serviceRanking = config.service_ranking();
}
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index 314046b..75c8599 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -106,19 +106,23 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
final String[] props = config.user_mapping();
- final ArrayList<Mapping> mappings = new ArrayList<Mapping>(props.length);
- for (final String prop : props) {
- if (prop != null && prop.trim().length() > 0 ) {
- try {
- final Mapping mapping = new Mapping(prop.trim());
- mappings.add(mapping);
- } catch (final IllegalArgumentException iae) {
- log.error("configure: Ignoring '{}': {}", prop, iae.getMessage());
+ if ( props != null ) {
+ final ArrayList<Mapping> mappings = new ArrayList<Mapping>(props.length);
+ for (final String prop : props) {
+ if (prop != null && prop.trim().length() > 0 ) {
+ try {
+ final Mapping mapping = new Mapping(prop.trim());
+ mappings.add(mapping);
+ } catch (final IllegalArgumentException iae) {
+ log.error("configure: Ignoring '{}': {}", prop, iae.getMessage());
+ }
}
}
- }
- this.globalServiceUserMappings = mappings.toArray(new Mapping[mappings.size()]);
+ this.globalServiceUserMappings = mappings.toArray(new Mapping[mappings.size()]);
+ } else {
+ this.globalServiceUserMappings = new Mapping[0];
+ }
this.defaultUser = config.user_default();
RegistrationSet registrationSet = null;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 04/18: SLING-5484 - more
logging for ServiceUserMapperImpl.getServiceUserID and related methods
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 80132424248f70d32e05cfd3458a2a1ea57d397c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Feb 4 10:43:11 2016 +0000
SLING-5484 - more logging for ServiceUserMapperImpl.getServiceUserID and related methods
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1728437 13f79535-47bb-0310-9956-ffa450edef68
---
.../serviceusermapping/impl/ServiceUserMapperImpl.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index 6b545f1..fbb3465 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -193,7 +193,12 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
public String getServiceUserID(final Bundle bundle, final String subServiceName) {
final String serviceName = getServiceName(bundle);
final String userId = internalGetUserId(serviceName, subServiceName);
- return isValidUser(userId, serviceName, subServiceName) ? userId : null;
+ final boolean valid = isValidUser(userId, serviceName, subServiceName);
+ final String result = valid ? userId : null;
+ log.debug(
+ "getServiceUserID(bundle {}, subServiceName {}) returns [{}] (raw userId={}, valid={})",
+ new Object[] { bundle, subServiceName, result, userId, valid });
+ return result;
}
protected synchronized void bindAmendment(final MappingConfigAmendment amendment, final Map<String, Object> props) {
@@ -313,6 +318,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
if (serviceRegistration != null) {
try {
serviceRegistration.unregister();
+ log.debug("Unregistered ServiceUserMapped {}", registration.mapping);
} catch (IllegalStateException e) {
log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e);
}
@@ -337,6 +343,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
new ServiceUserMappedImpl(), properties);
ServiceRegistration oldServiceRegistration = registration.setService(serviceRegistration);
+ log.debug("Activated ServiceUserMapped {}", registration.mapping);
if (oldServiceRegistration != null) {
try {
@@ -354,6 +361,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
for (final Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, subServiceName);
if (userId != null) {
+ log.debug("Got userId [{}] from {}/{}", new Object[] { userId, serviceName, subServiceName });
return userId;
}
}
@@ -362,6 +370,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
for (Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, null);
if (userId != null) {
+ log.debug("Got userId [{}] from {}/<no subServiceName>", userId, serviceName);
return userId;
}
}
@@ -372,17 +381,22 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
private boolean isValidUser(final String userId, final String serviceName, final String subServiceName) {
if (userId == null) {
+ log.debug("isValidUser: userId is null -> invalid");
return false;
}
if ( !validators.isEmpty() ) {
for (final ServiceUserValidator validator : validators) {
if ( validator.isValid(userId, serviceName, subServiceName) ) {
+ log.debug("isValidUser: Validator {} accepts userId [{}] -> valid", validator, userId);
return true;
}
}
+ log.debug("isValidUser: No validator accepte userId [{}] -> invalid", userId);
return false;
+ } else {
+ log.debug("isValidUser: No active validators for userId [{}] -> valid", userId);
+ return true;
}
- return true;
}
static String getServiceName(final Bundle bundle) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 14/18: use Sling Parent
30
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit ece807e97d7aa308efe30cbd379b95658e290dbb
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 10:22:30 2017 +0000
use Sling Parent 30
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1785621 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 59f901b..2927cbf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>29</version>
+ <version>30</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-serviceusermapper] 16/18: Remove unused SCR
plugin, fix javadoc
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 0baa5bafb1934d6be1cfdb58aee6f76631163dc6
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Mar 24 11:23:56 2017 +0000
Remove unused SCR plugin, fix javadoc
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1788409 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 18 +++++++++---------
.../sling/serviceusermapping/ServiceUserValidator.java | 2 ++
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 98c87cb..2195ab0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,10 +49,6 @@
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
@@ -70,6 +66,15 @@
</instructions>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <excludePackageNames>
+ org.apache.sling.serviceusermapping.impl
+ </excludePackageNames>
+ </configuration>
+ </plugin>
</plugins>
</build>
<dependencies>
@@ -102,11 +107,6 @@
<artifactId>osgi.core</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.event</artifactId>
<version>1.3.1</version>
diff --git a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java
index eaa77f7..72faa34 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java
@@ -29,6 +29,8 @@ public interface ServiceUserValidator {
* Validates the configured service user ID.
*
* @param serviceUserId The ID of the configured service user.
+ * @param serviceName The name of the service
+ * @param subServiceName The optional sub service name.
* @return {@code true} if the configured service user is valid; {@code false} otherwise.
*/
boolean isValid(String serviceUserId, String serviceName, String subServiceName);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 11/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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit ce974aad436a61970998d97ac2a23abdf438baa3
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Mon Dec 19 13:18:22 2016 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1775084 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3831fc8..d3a6b4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<artifactId>org.apache.sling.serviceusermapper</artifactId>
<packaging>bundle</packaging>
- <version>1.2.4</version>
+ <version>1.2.5-SNAPSHOT</version>
<name>Apache Sling Service User Mapper</name>
<description>
@@ -40,9 +40,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.4</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.4</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.serviceusermapper-1.2.4</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/serviceusermapper</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit cb289700c382695f357b649b520faf7fcfc5334c
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Dec 30 09:24:58 2015 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1722291 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 09e315d..ca7069c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<artifactId>org.apache.sling.serviceusermapper</artifactId>
<packaging>bundle</packaging>
- <version>1.2.4</version>
+ <version>1.2.5-SNAPSHOT</version>
<name>Apache Sling Service User Mapper</name>
<description>
@@ -40,9 +40,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.4</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.4</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.serviceusermapper-1.2.4</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/serviceusermapper</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 02/18: Switch back to
1.2.3-SNAPSHOT
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit aed1e647478733b42f646127a4e2b2a6c5a695a5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Dec 30 09:30:31 2015 +0000
Switch back to 1.2.3-SNAPSHOT
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1722293 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index ca7069c..6d54673 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<artifactId>org.apache.sling.serviceusermapper</artifactId>
<packaging>bundle</packaging>
- <version>1.2.5-SNAPSHOT</version>
+ <version>1.2.3-SNAPSHOT</version>
<name>Apache Sling Service User Mapper</name>
<description>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 05/18: SLING-5484 - add
debug log for default user
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 87c737f5313d8aa638cb837e68ca03cdf4c6d734
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Feb 4 14:06:49 2016 +0000
SLING-5484 - add debug log for default user
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1728484 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index fbb3465..e0e8220 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -375,7 +375,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
}
- // finally, fall back to default user
+ log.debug("No mapping found, fallback to default user [{}]", this.defaultUser);
return this.defaultUser;
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 10/18:
[maven-release-plugin] prepare release
org.apache.sling.serviceusermapper-1.2.4
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit c3f5d9df7c9932e2c9c8bad887b6abacbee202a4
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Mon Dec 19 13:18:05 2016 +0000
[maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.4
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1775082 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index dfb768d..3831fc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<artifactId>org.apache.sling.serviceusermapper</artifactId>
<packaging>bundle</packaging>
- <version>1.2.3-SNAPSHOT</version>
+ <version>1.2.4</version>
<name>Apache Sling Service User Mapper</name>
<description>
@@ -40,9 +40,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/serviceusermapper</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.4</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.4</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.serviceusermapper-1.2.4</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 09/18: SLING-6397 :
Error logged by ServiceUserMapperImpl while unregistering an already
unregistered service
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 8a5761ad4313dfad754264552ff21550d74636d9
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Dec 14 09:58:21 2016 +0000
SLING-6397 : Error logged by ServiceUserMapperImpl while unregistering an already unregistered service
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1774158 13f79535-47bb-0310-9956-ffa450edef68
---
.../impl/ServiceUserMapperImpl.java | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index d4bc867..b2f980e 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -151,10 +151,10 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
@Deactivate
synchronized void deactivate() {
- RegistrationSet registrationSet = null;
+ // this call does not unregister the mappings, but they should be unbound
+ // through the unbind methods anyway
updateServiceRegistrations(new Mapping[0]);
bundleContext = null;
- this.executeServiceRegistrationsAsync(registrationSet);
if (executorService != null) {
executorService.shutdown();
executorService = null;
@@ -305,13 +305,13 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
- private void executeServiceRegistrations(RegistrationSet registrationSet) {
+ private void executeServiceRegistrations(final RegistrationSet registrationSet) {
if (registrationSet == null) {
return;
}
- for (Registration registration : registrationSet.removed) {
+ for (final Registration registration : registrationSet.removed) {
ServiceRegistration serviceRegistration = registration.setService(null);
@@ -320,8 +320,8 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
try {
serviceRegistration.unregister();
log.debug("Unregistered ServiceUserMapped {}", registration.mapping);
- } catch (IllegalStateException e) {
- log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e);
+ } catch (final IllegalStateException e) {
+ // this can happen on shutdown, therefore we just ignore it and don't log
}
}
}
@@ -332,7 +332,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
return;
}
- for (Registration registration : registrationSet.added) {
+ for (final Registration registration : registrationSet.added) {
Mapping mapping = registration.mapping;
final Dictionary<String, Object> properties = new Hashtable<String, Object>();
if (mapping.getSubServiceName() != null) {
@@ -349,8 +349,8 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
if (oldServiceRegistration != null) {
try {
oldServiceRegistration.unregister();
- } catch (IllegalStateException e) {
- log.error("cannot unregister ServiceUserMapped {}", registration.mapping, e);
+ } catch (final IllegalStateException e) {
+ // this can happen on shutdown, therefore we just ignore it and don't log
}
}
}
@@ -359,9 +359,9 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
private String internalGetUserId(final String serviceName, final String subServiceName) {
log.debug(
- "internalGetUserId: {} active mappings, looking for mapping for {}/{}",
+ "internalGetUserId: {} active mappings, looking for mapping for {}/{}",
new Object[] { this.activeMappings.length, serviceName, subServiceName });
-
+
for (final Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, subServiceName);
if (userId != null) {
@@ -372,9 +372,9 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
// second round without serviceInfo
log.debug(
- "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>",
+ "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>",
this.activeMappings.length, serviceName);
-
+
for (Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, null);
if (userId != null) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 08/18: SLING-5484 -
tweak debug logs
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit ece541ce3e09f2b31d32dac81bf9899b06b292db
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Feb 5 12:06:31 2016 +0000
SLING-5484 - tweak debug logs
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1728647 13f79535-47bb-0310-9956-ffa450edef68
---
.../serviceusermapping/impl/ServiceUserMapperImpl.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index edd22dd..d4bc867 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -240,7 +240,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
activeMappings = mappings.toArray(new Mapping[mappings.size()]);
- log.debug("Active mappings updated: {}", mappings);
+ log.debug("Active mappings updated: {} mappings active", mappings.size());
RegistrationSet registrationSet = updateServiceRegistrations(activeMappings);
@@ -358,7 +358,10 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
private String internalGetUserId(final String serviceName, final String subServiceName) {
- // try with serviceInfo first
+ log.debug(
+ "internalGetUserId: {} active mappings, looking for mapping for {}/{}",
+ new Object[] { this.activeMappings.length, serviceName, subServiceName });
+
for (final Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, subServiceName);
if (userId != null) {
@@ -368,6 +371,10 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
// second round without serviceInfo
+ log.debug(
+ "internalGetUserId: {} active mappings, looking for mapping for {}/<no subServiceName>",
+ this.activeMappings.length, serviceName);
+
for (Mapping mapping : this.activeMappings) {
final String userId = mapping.map(serviceName, null);
if (userId != null) {
@@ -376,7 +383,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
}
- log.debug("No mapping found, fallback to default user [{}]", this.defaultUser);
+ log.debug("internalGetUserId: no mapping found, fallback to default user [{}]", this.defaultUser);
return this.defaultUser;
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 12/18: SLING-6555 :
Migrate to R6 annotations, clean up dependencies
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit dfbde948459f5c88247463d438895144aa134275
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 23 12:29:06 2017 +0000
SLING-6555 : Migrate to R6 annotations, clean up dependencies
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1784117 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 69 ++-----
.../serviceusermapping/ServiceUserMapped.java | 2 +-
.../serviceusermapping/ServiceUserMapper.java | 3 +-
.../serviceusermapping/ServiceUserValidator.java | 2 +-
.../impl/MappingConfigAmendment.java | 67 ++++---
.../impl/MappingInventoryPrinter.java | 31 ++--
.../impl/ServiceUserMappedBundleFilter.java | 7 +-
.../impl/ServiceUserMapperImpl.java | 73 +++-----
.../sling/serviceusermapping/package-info.java | 6 +-
.../impl/ServiceUserMapperImplTest.java | 205 ++++++++++-----------
10 files changed, 190 insertions(+), 275 deletions(-)
diff --git a/pom.xml b/pom.xml
index d3a6b4a..59f901b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>26</version>
+ <version>29</version>
<relativePath />
</parent>
@@ -58,14 +58,16 @@
<configuration>
<instructions>
<Import-Package>
- org.apache.sling.commons.json,
org.apache.felix.inventory;resolution:=optional,
*
</Import-Package>
- <DynamicImport-Package>
+ <DynamicImport-Package>
org.apache.felix.inventory
</DynamicImport-Package>
- </instructions>
+ <Embed-Dependency>
+ org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**
+ </Embed-Dependency>
+ </instructions>
</configuration>
</plugin>
</plugins>
@@ -78,18 +80,12 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.commons.osgi</artifactId>
- <version>2.1.0</version>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.utils</artifactId>
+ <version>1.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.commons.json</artifactId>
- <version>2.0.6</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.inventory</artifactId>
<version>1.0.0</version>
@@ -97,69 +93,34 @@
</dependency>
<dependency>
- <groupId>javax.jcr</groupId>
- <artifactId>jcr</artifactId>
- <version>2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-api</artifactId>
- <version>2.4.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.3.0</version>
- <scope>provided</scope>
+ <artifactId>osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>org.osgi.service.event</artifactId>
+ <version>1.3.1</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bndlib</artifactId>
- <scope>provided</scope>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>test</scope>
</dependency>
-
- <!-- using log4j under slf4j to allow fine-grained logging config (see src/test/resources/log4j.properties) -->
<dependency>
<groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.13</version>
- <scope>test</scope>
+ <artifactId>slf4j-simple</artifactId>
</dependency>
-
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
diff --git a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapped.java b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapped.java
index 949a1bf..921dffb 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapped.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapped.java
@@ -18,7 +18,7 @@
*/
package org.apache.sling.serviceusermapping;
-import aQute.bnd.annotation.ProviderType;
+import org.osgi.annotation.versioning.ProviderType;
/**
* The <code>ServiceUserMapped</code> is a marker service that can be used to ensure that there is an already registered mapping for a certain service/subService.
diff --git a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapper.java b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapper.java
index 21e801d..d8e6701 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapper.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserMapper.java
@@ -18,10 +18,9 @@
*/
package org.apache.sling.serviceusermapping;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
-import aQute.bnd.annotation.ProviderType;
-
/**
* The <code>ServiceUserMapper</code> service can be used to map a service
* provided by a bundle to the ID of a user account used to access the
diff --git a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java
index 7930582..eaa77f7 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/ServiceUserValidator.java
@@ -16,7 +16,7 @@
*/
package org.apache.sling.serviceusermapping;
-import aQute.bnd.annotation.ConsumerType;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* The {@code ServiceUserValidator} allows to implement validation of configured
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java b/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java
index 9b981e9..1d10c38 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/MappingConfigAmendment.java
@@ -19,47 +19,42 @@
package org.apache.sling.serviceusermapping.impl;
import java.util.ArrayList;
-import java.util.Map;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Modified;
-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.Service;
-import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.osgi.framework.Constants;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Component(metatype=true,
- name="org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended",
- label="Apache Sling Service User Mapper Service Amendment",
- description="An amendment mapping for the user mapping service.",
- configurationFactory=true,
- policy=ConfigurationPolicy.REQUIRE)
-@Service(value={MappingConfigAmendment.class})
-@Properties({
- @Property(name=Constants.SERVICE_RANKING, intValue=0, propertyPrivate=false,
- label="Ranking",
- description="Amendments are processed in order of their ranking, an amendment with a higher ranking has" +
- " precedence over a mapping with a lower ranking."),
- @Property(name="webconsole.configurationFactory.nameHint", value="Mapping: {user.mapping}")
-})
+@Designate(factory=true, ocd=MappingConfigAmendment.Config.class)
+@Component(name = "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended",
+ configurationPolicy=ConfigurationPolicy.REQUIRE,
+ service={MappingConfigAmendment.class},
+ property= {
+ "webconsole.configurationFactory.nameHint=Mapping: {user.mapping}",
+ })
public class MappingConfigAmendment implements Comparable<MappingConfigAmendment> {
- @Property(
- label = "Service Mappings",
+ @ObjectClassDefinition(name ="Apache Sling Service User Mapper Service Amendment",
+ description="An amendment mapping for the user mapping service.")
+ public @interface Config {
+
+ @AttributeDefinition(name = "Ranking",
+ description="Amendments are processed in order of their ranking, an amendment with a higher ranking has" +
+ " precedence over a mapping with a lower ranking.")
+ int service_ranking() default 0;
+
+ @AttributeDefinition(name = "Service Mappings",
description = "Provides mappings from service name to user names. "
+ "Each entry is of the form 'bundleId [ \":\" subServiceName ] \"=\" userName' "
+ "where bundleId and subServiceName identify the service and userName "
- + "defines the name of the user to provide to the service. Invalid entries are logged and ignored.",
- unbounded = PropertyUnbounded.ARRAY)
- private static final String PROP_SERVICE2USER_MAPPING = "user.mapping";
-
- private static final String[] PROP_SERVICE2USER_MAPPING_DEFAULT = {};
+ + "defines the name of the user to provide to the service. Invalid entries are logged and ignored.")
+ String[] user_mapping() default {};
+ }
/** default logger */
private final Logger logger = LoggerFactory.getLogger(getClass());
@@ -70,9 +65,8 @@ public class MappingConfigAmendment implements Comparable<MappingConfigAmendment
@Activate
@Modified
- void configure(final Map<String, Object> config) {
- final String[] props = PropertiesUtil.toStringArray(config.get(PROP_SERVICE2USER_MAPPING),
- PROP_SERVICE2USER_MAPPING_DEFAULT);
+ void configure(final Config config) {
+ final String[] props = config.user_mapping();
final ArrayList<Mapping> mappings = new ArrayList<Mapping>(props.length);
for (final String prop : props) {
@@ -87,13 +81,14 @@ public class MappingConfigAmendment implements Comparable<MappingConfigAmendment
}
this.serviceUserMappings = mappings.toArray(new Mapping[mappings.size()]);
- this.serviceRanking = PropertiesUtil.toInteger(config.get(Constants.SERVICE_RANKING), 0);
+ this.serviceRanking = config.service_ranking();
}
public Mapping[] getServiceUserMappings() {
return this.serviceUserMappings;
}
+ @Override
public int compareTo(final MappingConfigAmendment o) {
// Sort by rank in descending order.
if ( this.serviceRanking > o.serviceRanking ) {
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/MappingInventoryPrinter.java b/src/main/java/org/apache/sling/serviceusermapping/impl/MappingInventoryPrinter.java
index b431b19..e3488f5 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/MappingInventoryPrinter.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/MappingInventoryPrinter.java
@@ -18,6 +18,7 @@
*/
package org.apache.sling.serviceusermapping.impl;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
@@ -27,23 +28,18 @@ import java.util.TreeMap;
import org.apache.felix.inventory.Format;
import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.json.JSONException;
-import org.apache.sling.commons.json.io.JSONWriter;
+import org.apache.felix.utils.json.JSONWriter;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
/** InventoryPrinter for service user mappings */
-@Component
-@Service(value = InventoryPrinter.class)
-@Properties({
- @Property(name = InventoryPrinter.FORMAT, value = { "JSON", "TEXT" }),
- @Property(name = InventoryPrinter.NAME, value = "slingserviceusers"),
- @Property(name = InventoryPrinter.TITLE, value = "Sling Service User Mappings"),
- @Property(name = InventoryPrinter.WEBCONSOLE, boolValue = true)
-})
+@Component(service = InventoryPrinter.class,
+ property = {
+ InventoryPrinter.FORMAT + "=JSON",
+ InventoryPrinter.FORMAT + "=TEXT",
+ InventoryPrinter.TITLE + "=Sling Service User Mappings",
+ InventoryPrinter.WEBCONSOLE + ":Boolean=true"
+ })
public class MappingInventoryPrinter implements InventoryPrinter {
@Reference
@@ -80,7 +76,7 @@ public class MappingInventoryPrinter implements InventoryPrinter {
return result;
}
- private void asJSON(JSONWriter w, Mapping m) throws JSONException {
+ private void asJSON(JSONWriter w, Mapping m) throws IOException {
w.object();
w.key("serviceName").value(m.getServiceName());
w.key("subServiceName").value(m.getSubServiceName());
@@ -88,12 +84,11 @@ public class MappingInventoryPrinter implements InventoryPrinter {
w.endObject();
}
- private void renderJson(PrintWriter out) throws JSONException {
+ private void renderJson(PrintWriter out) throws IOException {
final List<Mapping> data = mapper.getActiveMappings();
final Map<String, List<Mapping>> byUser = getMappingsByUser(data);
final JSONWriter w = new JSONWriter(out);
- w.setTidy(true);
w.object();
w.key("title").value("Service User Mappings");
w.key("mappingsCount").value(data.size());
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMappedBundleFilter.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMappedBundleFilter.java
index c2179d2..a8b0719 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMappedBundleFilter.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMappedBundleFilter.java
@@ -23,8 +23,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceEvent;
@@ -32,12 +30,13 @@ import org.osgi.framework.ServiceReference;
import org.osgi.framework.hooks.service.EventListenerHook;
import org.osgi.framework.hooks.service.FindHook;
import org.osgi.framework.hooks.service.ListenerHook;
+import org.osgi.service.component.annotations.Component;
-@Component(immediate=true) // framework gets/ungets hooks each time
-@Service(value = {EventListenerHook.class, FindHook.class} )
/**
* The <code>ServiceUserMappingBundleFilter</code> only allows the bundle for which the service mapping is available to see it.
*/
+@Component(immediate=true, // framework gets/ungets hooks each time
+ service = {EventListenerHook.class, FindHook.class} )
public class ServiceUserMappedBundleFilter implements EventListenerHook, FindHook {
@Override
diff --git a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
index b2f980e..314046b 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImpl.java
@@ -35,18 +35,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-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.Modified;
-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.commons.osgi.PropertiesUtil;
import org.apache.sling.serviceusermapping.ServiceUserMapped;
import org.apache.sling.serviceusermapping.ServiceUserMapper;
import org.apache.sling.serviceusermapping.ServiceUserValidator;
@@ -54,47 +42,39 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Component(
- metatype = true,
- label = "Apache Sling Service User Mapper Service",
- description = "Configuration for the service mapping service names to names of users.")
-@Service(value={ServiceUserMapper.class, ServiceUserMapperImpl.class})
-@References( {
- @Reference(name="amendment",
- referenceInterface=MappingConfigAmendment.class,
- cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE,
- policy=ReferencePolicy.DYNAMIC,
- updated="updateAmendment"),
- @Reference(name = "serviceUserValidator ", referenceInterface = ServiceUserValidator.class,
- bind = "bindServiceUserValidator", unbind = "unbindServiceUserValidator",
- cardinality= ReferenceCardinality.OPTIONAL_MULTIPLE, policy= ReferencePolicy.DYNAMIC)
-
-})
-
+@Designate(ocd = ServiceUserMapperImpl.Config.class)
+@Component(service = {ServiceUserMapper.class, ServiceUserMapperImpl.class})
public class ServiceUserMapperImpl implements ServiceUserMapper {
- @Property(
- label = "Service Mappings",
+ @ObjectClassDefinition(name = "Apache Sling Service User Mapper Service",
+ description = "Configuration for the service mapping service names to names of users.")
+ public @interface Config {
+
+ @AttributeDefinition(name = "Service Mappings",
description = "Provides mappings from service name to user names. "
+ "Each entry is of the form 'bundleId [ \":\" subServiceName ] \"=\" userName' "
+ "where bundleId and subServiceName identify the service and userName "
- + "defines the name of the user to provide to the service. Invalid entries are logged and ignored.",
- unbounded = PropertyUnbounded.ARRAY)
- private static final String PROP_SERVICE2USER_MAPPING = "user.mapping";
+ + "defines the name of the user to provide to the service. Invalid entries are logged and ignored.")
+ String[] user_mapping() default {};
- private static final String[] PROP_SERVICE2USER_MAPPING_DEFAULT = {};
-
- private static final String PROP_DEFAULT_USER = "user.default";
-
- @Property(
- name = PROP_DEFAULT_USER,
- label = "Default User",
+ @AttributeDefinition(name = "Default User",
description = "The name of the user to use as the default if no service mapping"
+ "applies. If this property is missing or empty no default user is defined.")
- private static final String PROP_DEFAULT_USER_DEFAULT = null;
+ String user_default();
+ }
/** default log */
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -119,13 +99,12 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
@Activate
@Modified
- synchronized void configure(BundleContext bundleContext, final Map<String, Object> config) {
+ synchronized void configure(BundleContext bundleContext, final Config config) {
if (registerAsync && executorService == null) {
executorService = Executors.newSingleThreadExecutor();
}
- final String[] props = PropertiesUtil.toStringArray(config.get(PROP_SERVICE2USER_MAPPING),
- PROP_SERVICE2USER_MAPPING_DEFAULT);
+ final String[] props = config.user_mapping();
final ArrayList<Mapping> mappings = new ArrayList<Mapping>(props.length);
for (final String prop : props) {
@@ -140,7 +119,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
}
this.globalServiceUserMappings = mappings.toArray(new Mapping[mappings.size()]);
- this.defaultUser = PropertiesUtil.toString(config.get(PROP_DEFAULT_USER), PROP_DEFAULT_USER_DEFAULT);
+ this.defaultUser = config.user_default();
RegistrationSet registrationSet = null;
this.bundleContext = bundleContext;
@@ -172,6 +151,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
* bind the serviceUserValidator
* @param serviceUserValidator
*/
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE, policy= ReferencePolicy.DYNAMIC)
protected synchronized void bindServiceUserValidator(final ServiceUserValidator serviceUserValidator) {
validators.add(serviceUserValidator);
restartAllActiveServiceUserMappedServices();
@@ -201,6 +181,7 @@ public class ServiceUserMapperImpl implements ServiceUserMapper {
return result;
}
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE,policy=ReferencePolicy.DYNAMIC,updated="updateAmendment")
protected synchronized void bindAmendment(final MappingConfigAmendment amendment, final Map<String, Object> props) {
final Long key = (Long) props.get(Constants.SERVICE_ID);
RegistrationSet registrationSet = null;
diff --git a/src/main/java/org/apache/sling/serviceusermapping/package-info.java b/src/main/java/org/apache/sling/serviceusermapping/package-info.java
index 8eadc1a..69a2cdd 100644
--- a/src/main/java/org/apache/sling/serviceusermapping/package-info.java
+++ b/src/main/java/org/apache/sling/serviceusermapping/package-info.java
@@ -17,10 +17,6 @@
* under the License.
*/
-@Version("1.2")
-@Export(optional = "provide:=true")
+@org.osgi.annotation.versioning.Version("1.2.1")
package org.apache.sling.serviceusermapping;
-import aQute.bnd.annotation.Export;
-import aQute.bnd.annotation.Version;
-
diff --git a/src/test/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImplTest.java b/src/test/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImplTest.java
index 553f312..199f6f7 100644
--- a/src/test/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImplTest.java
+++ b/src/test/java/org/apache/sling/serviceusermapping/impl/ServiceUserMapperImplTest.java
@@ -26,18 +26,17 @@ import java.util.Dictionary;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.apache.sling.serviceusermapping.ServiceUserValidator;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
+import junit.framework.TestCase;
+
public class ServiceUserMapperImplTest {
private static final String BUNDLE_SYMBOLIC1 = "bundle1";
@@ -68,23 +67,16 @@ public class ServiceUserMapperImplTest {
when(BUNDLE2.getSymbolicName()).thenReturn(BUNDLE_SYMBOLIC2);
}
-
-
-
@Test
public void test_getServiceUserID() {
- @SuppressWarnings("serial")
- Map<String, Object> config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String[] {
- BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
- BUNDLE_SYMBOLIC2 + "=" + ANOTHER, //
- BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
- BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB //
- });
- put("user.default", NONE);
- }
- };
+ ServiceUserMapperImpl.Config config = mock(ServiceUserMapperImpl.Config.class);
+ when(config.user_mapping()).thenReturn(new String[] {
+ BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
+ BUNDLE_SYMBOLIC2 + "=" + ANOTHER, //
+ BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
+ BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB //
+ });
+ when(config.user_default()).thenReturn(NONE);
final ServiceUserMapperImpl sum = new ServiceUserMapperImpl();
sum.configure(null, config);
@@ -99,23 +91,20 @@ public class ServiceUserMapperImplTest {
@Test
public void test_getServiceUserID_WithServiceUserValidator() {
- @SuppressWarnings("serial")
- Map<String, Object> config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String[] {
- BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
- BUNDLE_SYMBOLIC2 + "=" + ANOTHER, //
- BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
- BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB //
- });
- put("user.default", NONE);
- }
- };
+ ServiceUserMapperImpl.Config config = mock(ServiceUserMapperImpl.Config.class);
+ when(config.user_mapping()).thenReturn(new String[] {
+ BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
+ BUNDLE_SYMBOLIC2 + "=" + ANOTHER, //
+ BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
+ BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB //
+ });
+ when(config.user_default()).thenReturn(NONE);
final ServiceUserMapperImpl sum = new ServiceUserMapperImpl();
sum.configure(null, config);
ServiceUserValidator serviceUserValidator = new ServiceUserValidator() {
+ @Override
public boolean isValid(String serviceUserId, String serviceName,
String subServiceName) {
if (SAMPLE.equals(serviceUserId)) {
@@ -136,41 +125,39 @@ public class ServiceUserMapperImplTest {
@Test
public void test_amendment() {
- @SuppressWarnings("serial")
- Map<String, Object> config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String[] {
- BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
- BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
- });
- put("user.default", NONE);
- }
- };
+ ServiceUserMapperImpl.Config config = mock(ServiceUserMapperImpl.Config.class);
+ when(config.user_mapping()).thenReturn(new String[] {
+ BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
+ BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
+ });
+ when(config.user_default()).thenReturn(NONE);
final ServiceUserMapperImpl sum = new ServiceUserMapperImpl();
sum.configure(null, config);
final MappingConfigAmendment mca1 = new MappingConfigAmendment();
- @SuppressWarnings("serial")
- final Map<String, Object> mca1Config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String [] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER});
- put(Constants.SERVICE_ID, 1L);
- put(Constants.SERVICE_RANKING, 100);
- }
- };
+
+ MappingConfigAmendment.Config mca1Config = mock(MappingConfigAmendment.Config.class);
+ when(mca1Config.user_mapping()).thenReturn(new String[] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER});
+ when(mca1Config.service_ranking()).thenReturn(100);
+ Map<String, Object> mca1ConfigMap = new HashMap<>();
+ mca1ConfigMap.put("user.mapping", mca1Config.user_mapping());
+ mca1ConfigMap.put("service.ranking", mca1Config.service_ranking());
+ mca1ConfigMap.put("service.id", 1L);
+
mca1.configure(mca1Config);
- sum.bindAmendment(mca1, mca1Config);
+ sum.bindAmendment(mca1, mca1ConfigMap);
final MappingConfigAmendment mca2 = new MappingConfigAmendment();
- @SuppressWarnings("serial")
- final Map<String, Object> mca2Config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String [] {BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB});
- put(Constants.SERVICE_ID, 2L);
- put(Constants.SERVICE_RANKING, 200);
- }
- };
+
+ MappingConfigAmendment.Config mca2Config = mock(MappingConfigAmendment.Config.class);
+ when(mca2Config.user_mapping()).thenReturn(new String[] {BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB});
+ when(mca2Config.service_ranking()).thenReturn(200);
+ Map<String, Object> mca2ConfigMap = new HashMap<>();
+ mca2ConfigMap.put("user.mapping", mca2Config.user_mapping());
+ mca2ConfigMap.put("service.ranking", mca2Config.service_ranking());
+ mca2ConfigMap.put("service.id", 2L);
+
mca2.configure(mca2Config);
- sum.bindAmendment(mca2, mca2Config);
+ sum.bindAmendment(mca2, mca2ConfigMap);
TestCase.assertEquals(SAMPLE, sum.getServiceUserID(BUNDLE1, null));
TestCase.assertEquals(ANOTHER, sum.getServiceUserID(BUNDLE2, null));
@@ -182,37 +169,36 @@ public class ServiceUserMapperImplTest {
@Test
public void test_amendmentOverlap() {
- @SuppressWarnings("serial")
- final Map<String, Object> config = new HashMap<String, Object>() {
- {
- put("user.default", NONE);
- }
- };
+ ServiceUserMapperImpl.Config config = mock(ServiceUserMapperImpl.Config.class);
+ when(config.user_mapping()).thenReturn(new String[] {});
+ when(config.user_default()).thenReturn(NONE);
final ServiceUserMapperImpl sum = new ServiceUserMapperImpl();
sum.configure(null, config);
final MappingConfigAmendment mca1 = new MappingConfigAmendment();
- @SuppressWarnings("serial")
- final Map<String, Object> mca1Config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String [] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER});
- put(Constants.SERVICE_RANKING, 100);
- }
- };
+
+ MappingConfigAmendment.Config mca1Config = mock(MappingConfigAmendment.Config.class);
+ when(mca1Config.user_mapping()).thenReturn(new String[] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER});
+ when(mca1Config.service_ranking()).thenReturn(100);
+ Map<String, Object> mca1ConfigMap = new HashMap<>();
+ mca1ConfigMap.put("user.mapping", mca1Config.user_mapping());
+ mca1ConfigMap.put("service.ranking", mca1Config.service_ranking());
+
mca1.configure(mca1Config);
final MappingConfigAmendment mca2 = new MappingConfigAmendment();
- @SuppressWarnings("serial")
- final Map<String, Object> mca2Config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String [] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER_SUB});
- put(Constants.SERVICE_RANKING, 200);
- }
- };
+
+ MappingConfigAmendment.Config mca2Config = mock(MappingConfigAmendment.Config.class);
+ when(mca2Config.user_mapping()).thenReturn(new String[] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER_SUB});
+ when(mca2Config.service_ranking()).thenReturn(200);
+ Map<String, Object> mca2ConfigMap = new HashMap<>();
+ mca2ConfigMap.put("user.mapping", mca2Config.user_mapping());
+ mca2ConfigMap.put("service.ranking", mca2Config.service_ranking());
+
mca2.configure(mca2Config);
- sum.bindAmendment(mca1, mca1Config);
- sum.bindAmendment(mca2, mca2Config);
+ sum.bindAmendment(mca1, mca1ConfigMap);
+ sum.bindAmendment(mca2, mca2ConfigMap);
TestCase.assertEquals(ANOTHER_SUB, sum.getServiceUserID(BUNDLE2, ""));
}
@@ -221,16 +207,13 @@ public class ServiceUserMapperImplTest {
@Test
public void test_amendmentServiceUserMapping() {
- @SuppressWarnings("serial")
- Map<String, Object> config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String[] {
- BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
- BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
+
+ ServiceUserMapperImpl.Config config = mock(ServiceUserMapperImpl.Config.class);
+ when(config.user_mapping()).thenReturn(new String[] {
+ BUNDLE_SYMBOLIC1 + "=" + SAMPLE, //
+ BUNDLE_SYMBOLIC1 + ":" + SUB + "=" + SAMPLE_SUB, //
});
- put("user.default", NONE);
- }
- };
+ when(config.user_default()).thenReturn(NONE);
final ServiceUserMapperImpl sum = new ServiceUserMapperImpl();
sum.registerAsync = false;
@@ -240,34 +223,36 @@ public class ServiceUserMapperImplTest {
TestCase.assertEquals(2, context.getRegistrations(ServiceUserMappedImpl.SERVICEUSERMAPPED).size());
final MappingConfigAmendment mca1 = new MappingConfigAmendment();
- @SuppressWarnings("serial")
- final Map<String, Object> mca1Config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String [] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER});
- put(Constants.SERVICE_ID, 1L);
- put(Constants.SERVICE_RANKING, 100);
- }
- };
+
+ MappingConfigAmendment.Config mca1Config = mock(MappingConfigAmendment.Config.class);
+ when(mca1Config.user_mapping()).thenReturn(new String[] {BUNDLE_SYMBOLIC2 + "=" + ANOTHER});
+ when(mca1Config.service_ranking()).thenReturn(100);
+ Map<String, Object> mca1ConfigMap = new HashMap<>();
+ mca1ConfigMap.put("user.mapping", mca1Config.user_mapping());
+ mca1ConfigMap.put("service.ranking", mca1Config.service_ranking());
+ mca1ConfigMap.put("service.id", 1L);
+
mca1.configure(mca1Config);
- sum.bindAmendment(mca1, mca1Config);
+ sum.bindAmendment(mca1, mca1ConfigMap);
TestCase.assertEquals(3, context.getRegistrations(ServiceUserMappedImpl.SERVICEUSERMAPPED).size());
final MappingConfigAmendment mca2 = new MappingConfigAmendment();
- @SuppressWarnings("serial")
- final Map<String, Object> mca2Config = new HashMap<String, Object>() {
- {
- put("user.mapping", new String [] {BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB});
- put(Constants.SERVICE_ID, 2L);
- put(Constants.SERVICE_RANKING, 200);
- }
- };
+
+ MappingConfigAmendment.Config mca2Config = mock(MappingConfigAmendment.Config.class);
+ when(mca2Config.user_mapping()).thenReturn(new String[] {BUNDLE_SYMBOLIC2 + ":" + SUB + "=" + ANOTHER_SUB});
+ when(mca2Config.service_ranking()).thenReturn(200);
+ Map<String, Object> mca2ConfigMap = new HashMap<>();
+ mca2ConfigMap.put("user.mapping", mca2Config.user_mapping());
+ mca2ConfigMap.put("service.ranking", mca2Config.service_ranking());
+ mca2ConfigMap.put("service.id", 2L);
+
mca2.configure(mca2Config);
- sum.bindAmendment(mca2, mca2Config);
+ sum.bindAmendment(mca2, mca2ConfigMap);
TestCase.assertEquals(4, context.getRegistrations(ServiceUserMappedImpl.SERVICEUSERMAPPED).size());
- sum.unbindAmendment(mca1, mca1Config);
+ sum.unbindAmendment(mca1, mca1ConfigMap);
TestCase.assertEquals(3, context.getRegistrations(ServiceUserMappedImpl.SERVICEUSERMAPPED).size());
}
@@ -282,6 +267,7 @@ public class ServiceUserMapperImplTest {
public ServiceRegistrationContextHelper() {
when(bundleContext.registerService(any(String.class), any(Object.class), any(Dictionary.class)))
.then(new Answer<ServiceRegistration>() {
+ @Override
public ServiceRegistration answer(InvocationOnMock invocationOnMock) throws Throwable {
Object[] arguments = invocationOnMock.getArguments();
@@ -301,14 +287,17 @@ public class ServiceUserMapperImplTest {
return new ServiceRegistration() {
+ @Override
public ServiceReference getReference() {
return null;
}
+ @Override
public void setProperties(Dictionary dictionary) {
}
+ @Override
public void unregister() {
serviceRegistrations.remove(registeredObject);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-serviceusermapper] 17/18:
[maven-release-plugin] prepare release
org.apache.sling.serviceusermapper-1.2.6
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.serviceusermapper-1.2.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-serviceusermapper.git
commit 743c855205060a637cd295dde9f904cb9e9ca118
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 27 08:28:59 2017 +0000
[maven-release-plugin] prepare release org.apache.sling.serviceusermapper-1.2.6
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper@1788847 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2195ab0..add0a18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
<artifactId>org.apache.sling.serviceusermapper</artifactId>
<packaging>bundle</packaging>
- <version>1.2.5-SNAPSHOT</version>
+ <version>1.2.6</version>
<name>Apache Sling Service User Mapper</name>
<description>
@@ -40,9 +40,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/serviceusermapper</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/serviceusermapper</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.6</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.serviceusermapper-1.2.6</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.serviceusermapper-1.2.6</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.