This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.extensions.webconsolesecurityprovider-1.1.2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git
commit 739bbc56c300d439b85e5e9e019d997cf5528417 Author: Carsten Ziegeler <[email protected]> AuthorDate: Tue Dec 10 04:07:10 2013 +0000 SLING-3271 : Make Sling imports dynamic git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1549754 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 9 ++++++ .../internal/ServicesListener.java | 32 ++++++++-------------- .../internal/SlingWebConsoleSecurityProvider.java | 5 ++-- .../internal/SlingWebConsoleSecurityProvider2.java | 6 ++-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index c4650a2..31c1f3a 100644 --- a/pom.xml +++ b/pom.xml @@ -61,6 +61,15 @@ <Bundle-Activator> org.apache.sling.extensions.webconsolesecurityprovider.internal.Activator </Bundle-Activator> + <Import-Package> + !org.apache.sling.auth.core, + !org.apache.sling.api.resource, + * + </Import-Package> + <DynamicImport-Package> + org.apache.sling.api.resource;version="[2.3,3)", + org.apache.sling.auth.core;version="[1.0,2)" + </DynamicImport-Package> </instructions> </configuration> </plugin> diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java index fad370e..4dda83f 100644 --- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java +++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java @@ -41,6 +41,9 @@ import org.osgi.service.cm.ManagedService; */ public class ServicesListener { + private static final String AUTH_SUPPORT_CLASS = AuthenticationSupport.class.getName(); + private static final String REPO_CLASS = Repository.class.getName(); + /** The bundle context. */ private final BundleContext bundleContext; @@ -50,10 +53,6 @@ public class ServicesListener { /** The listener for the authentication support. */ private final Listener authSupportListener; - private final SlingWebConsoleSecurityProvider provider = new SlingWebConsoleSecurityProvider(); - - private final SlingWebConsoleSecurityProvider2 provider2 = new SlingWebConsoleSecurityProvider2(); - private enum State { NONE, PROVIDER, @@ -69,14 +68,13 @@ public class ServicesListener { /** The registration for the provider2 */ private ServiceRegistration provider2Reg; - /** * Start listeners */ public ServicesListener(final BundleContext bundleContext) { this.bundleContext = bundleContext; - this.authSupportListener = new Listener(AuthenticationSupport.class.getName()); - this.repositoryListener = new Listener(Repository.class.getName()); + this.authSupportListener = new Listener(AUTH_SUPPORT_CLASS); + this.repositoryListener = new Listener(REPO_CLASS); this.authSupportListener.start(); this.repositoryListener.start(); } @@ -86,8 +84,8 @@ public class ServicesListener { */ public synchronized void notifyChange() { // check if all services are available - final AuthenticationSupport authSupport = (AuthenticationSupport)this.authSupportListener.getService(); - final Repository repository = (Repository)this.repositoryListener.getService(); + final Object authSupport = this.authSupportListener.getService(); + final Object repository = this.repositoryListener.getService(); if ( registrationState == State.NONE ) { if ( authSupport != null ) { registerProvider2(authSupport); @@ -101,8 +99,6 @@ public class ServicesListener { } else if ( repository == null ) { unregisterProvider(); this.registrationState = State.NONE; - } else { - this.provider.setService(repository); } } else { if ( authSupport == null ) { @@ -112,8 +108,6 @@ public class ServicesListener { this.registrationState = State.NONE; } unregisterProvider2(); - } else { - this.provider2.setService(authSupport); } } } @@ -123,7 +117,6 @@ public class ServicesListener { this.provider2Reg.unregister(); this.provider2Reg = null; } - this.provider2.setService(null); } private void unregisterProvider() { @@ -131,28 +124,25 @@ public class ServicesListener { this.providerReg.unregister(); this.providerReg = null; } - this.provider.setService(null); } - private void registerProvider2(final AuthenticationSupport authSupport) { - this.provider2.setService(authSupport); + private void registerProvider2(final Object authSupport) { final Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put(Constants.SERVICE_PID, SlingWebConsoleSecurityProvider.class.getName()); props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Web Console Security Provider 2"); props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation"); this.provider2Reg = this.bundleContext.registerService( - new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, this.provider2, props); + new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, new SlingWebConsoleSecurityProvider2(authSupport), props); this.registrationState = State.PROVIDER2; } - private void registerProvider(final Repository repository) { - this.provider.setService(repository); + private void registerProvider(final Object repository) { final Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put(Constants.SERVICE_PID, SlingWebConsoleSecurityProvider.class.getName()); props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Web Console Security Provider"); props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation"); this.providerReg = this.bundleContext.registerService( - new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, this.provider, props); + new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, new SlingWebConsoleSecurityProvider(repository), props); this.registrationState = State.PROVIDER; } diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java index 566da32..37454e2 100644 --- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java +++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java @@ -72,9 +72,10 @@ public class SlingWebConsoleSecurityProvider extends AbstractWebConsoleSecurityP private Repository repository; - public void setService(final Repository repo) { - this.repository = repo; + public SlingWebConsoleSecurityProvider(final Object repository) { + this.repository = (Repository)repository; } + // ---------- SCR integration /** diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java index 8a8f1a2..7521fc9 100644 --- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java +++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java @@ -50,10 +50,10 @@ public class SlingWebConsoleSecurityProvider2 extends AbstractWebConsoleSecurityProvider implements WebConsoleSecurityProvider2 { - private AuthenticationSupport authenticator; + private final AuthenticationSupport authenticator; - public void setService(final AuthenticationSupport support) { - this.authenticator = support; + public SlingWebConsoleSecurityProvider2(final Object support) { + this.authenticator = (AuthenticationSupport)support; } private void invokeAuthenticator(final HttpServletRequest request, final HttpServletResponse response) { -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
