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/10/18 23:26:51 UTC

[sling-org-apache-sling-installer-factory-deploymentpackage] 02/32: First version of deployment package support for the installer.

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

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-deploymentpackage.git

commit ccb0e7cbd52ceaf6e4564b3cfbcbc04e12c9ed4f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Jan 18 09:25:44 2011 +0000

    First version of deployment package support for the installer.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1060265 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  2 +-
 .../factories/deploypck/impl/Activator.java        | 35 ++++++++++++----------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/pom.xml b/pom.xml
index 63ab30d..19b6165 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
                             org.apache.sling.installer.factories.deploypck.impl.Activator
                         </Bundle-Activator>
                         <Private-Package>
-                            org.apache.sling.installer.factories.deploypck..impl.*
+                            org.apache.sling.installer.factories.deploypck.impl.*
                         </Private-Package>
                     </instructions>
                 </configuration>
diff --git a/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java b/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java
index f5502c4..bff9c7b 100644
--- a/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java
+++ b/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java
@@ -50,6 +50,7 @@ public class Activator implements ServiceListener, BundleActivator {
      */
     public void start(final BundleContext context) throws Exception {
         this.bundleContext = context;
+        this.getAdmin();
         this.bundleContext.addServiceListener(this, "(" + Constants.OBJECTCLASS
                 + "=" + DEPLOYMENT_ADMIN + ")");
 
@@ -63,26 +64,30 @@ public class Activator implements ServiceListener, BundleActivator {
         this.bundleContext = null;
     }
 
+    private void getAdmin() {
+        this.deploymentAdminReference = this.bundleContext.getServiceReference(DEPLOYMENT_ADMIN);
+        if ( this.deploymentAdminReference != null ) {
+            final DeploymentAdmin deploymentAdmin = (DeploymentAdmin) this.bundleContext.getService(this.deploymentAdminReference);
+            if ( deploymentAdmin == null ) {
+                this.deploymentAdminReference = null;
+            } else {
+                final Dictionary<String, Object> props = new Hashtable<String, Object>();
+                props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Installer Support for Deployment Packages");
+                props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+                this.serviceReg = this.bundleContext.registerService(new String[] {ResourceTransformer.class.getName(),
+                        InstallTaskFactory.class.getName()},
+                    new DeploymentPackageInstaller(deploymentAdmin), props);
+            }
+        }
+    }
+
     /**
      * Wait for the deployment admin service.
      * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
      */
-    public synchronized void serviceChanged(ServiceEvent event) {
+    public synchronized void serviceChanged(final ServiceEvent event) {
         if ( event.getType() == ServiceEvent.REGISTERED && this.deploymentAdminReference == null ) {
-            this.deploymentAdminReference = this.bundleContext.getServiceReference(DEPLOYMENT_ADMIN);
-            if ( this.deploymentAdminReference != null ) {
-                final DeploymentAdmin deploymentAdmin = (DeploymentAdmin) this.bundleContext.getService(this.deploymentAdminReference);
-                if ( deploymentAdmin == null ) {
-                    this.deploymentAdminReference = null;
-                } else {
-                    final Dictionary<String, Object> props = new Hashtable<String, Object>();
-                    props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Installer Support for Deployment Packages");
-                    props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
-                    this.serviceReg = this.bundleContext.registerService(new String[] {ResourceTransformer.class.getName(),
-                            InstallTaskFactory.class.getName()},
-                        new DeploymentPackageInstaller(deploymentAdmin), props);
-                }
-            }
+            this.getAdmin();
         } else if ( event.getType() == ServiceEvent.UNREGISTERING && this.deploymentAdminReference != null ) {
             this.unregister();
         }

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