Return-Path: Delivered-To: apmail-sling-commits-archive@www.apache.org Received: (qmail 76842 invoked from network); 18 Jan 2011 09:26:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jan 2011 09:26:14 -0000 Received: (qmail 41540 invoked by uid 500); 18 Jan 2011 09:26:14 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 41480 invoked by uid 500); 18 Jan 2011 09:26:13 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 41473 invoked by uid 99); 18 Jan 2011 09:26:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jan 2011 09:26:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jan 2011 09:26:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 510E223889EA; Tue, 18 Jan 2011 09:25:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1060265 - in /sling/trunk/installer/factories/deploymentpck: pom.xml src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java Date: Tue, 18 Jan 2011 09:25:45 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110118092545.510E223889EA@eris.apache.org> Author: cziegeler Date: Tue Jan 18 09:25:44 2011 New Revision: 1060265 URL: http://svn.apache.org/viewvc?rev=1060265&view=rev Log: First version of deployment package support for the installer. Modified: sling/trunk/installer/factories/deploymentpck/pom.xml sling/trunk/installer/factories/deploymentpck/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java Modified: sling/trunk/installer/factories/deploymentpck/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/deploymentpck/pom.xml?rev=1060265&r1=1060264&r2=1060265&view=diff ============================================================================== --- sling/trunk/installer/factories/deploymentpck/pom.xml (original) +++ sling/trunk/installer/factories/deploymentpck/pom.xml Tue Jan 18 09:25:44 2011 @@ -52,7 +52,7 @@ org.apache.sling.installer.factories.deploypck.impl.Activator - org.apache.sling.installer.factories.deploypck..impl.* + org.apache.sling.installer.factories.deploypck.impl.* Modified: sling/trunk/installer/factories/deploymentpck/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/deploymentpck/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java?rev=1060265&r1=1060264&r2=1060265&view=diff ============================================================================== --- sling/trunk/installer/factories/deploymentpck/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java (original) +++ sling/trunk/installer/factories/deploymentpck/src/main/java/org/apache/sling/installer/factories/deploypck/impl/Activator.java Tue Jan 18 09:25:44 2011 @@ -50,6 +50,7 @@ public class Activator implements Servic */ 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 Servic 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 props = new Hashtable(); + 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 props = new Hashtable(); - 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(); }