incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1549754 - in /sling/trunk/bundles/extensions/webconsolesecurityprovider: ./ src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/
Date Tue, 10 Dec 2013 04:07:10 GMT
Author: cziegeler
Date: Tue Dec 10 04:07:10 2013
New Revision: 1549754

URL: http://svn.apache.org/r1549754
Log:
SLING-3271 : Make Sling imports dynamic

Modified:
    sling/trunk/bundles/extensions/webconsolesecurityprovider/pom.xml
    sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
    sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
    sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java

Modified: sling/trunk/bundles/extensions/webconsolesecurityprovider/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/webconsolesecurityprovider/pom.xml?rev=1549754&r1=1549753&r2=1549754&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/webconsolesecurityprovider/pom.xml (original)
+++ sling/trunk/bundles/extensions/webconsolesecurityprovider/pom.xml Tue Dec 10 04:07:10
2013
@@ -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>

Modified: sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java?rev=1549754&r1=1549753&r2=1549754&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
(original)
+++ sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
Tue Dec 10 04:07:10 2013
@@ -41,6 +41,9 @@ import org.osgi.service.cm.ManagedServic
  */
 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;
     }
 

Modified: sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java?rev=1549754&r1=1549753&r2=1549754&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
(original)
+++ sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
Tue Dec 10 04:07:10 2013
@@ -72,9 +72,10 @@ public class SlingWebConsoleSecurityProv
 
     private Repository repository;
 
-    public void setService(final Repository repo) {
-        this.repository = repo;
+    public SlingWebConsoleSecurityProvider(final Object repository) {
+        this.repository = (Repository)repository;
     }
+
     // ---------- SCR integration
 
     /**

Modified: sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java?rev=1549754&r1=1549753&r2=1549754&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java
(original)
+++ sling/trunk/bundles/extensions/webconsolesecurityprovider/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java
Tue Dec 10 04:07:10 2013
@@ -50,10 +50,10 @@ public class SlingWebConsoleSecurityProv
     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) {



Mime
View raw message