Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 66768 invoked from network); 26 Jul 2008 18:14:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jul 2008 18:14:26 -0000 Received: (qmail 6424 invoked by uid 500); 26 Jul 2008 18:14:26 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 6390 invoked by uid 500); 26 Jul 2008 18:14:26 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 6379 invoked by uid 99); 26 Jul 2008 18:14:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jul 2008 11:14:26 -0700 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; Sat, 26 Jul 2008 18:13:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9BFBF238889C; Sat, 26 Jul 2008 11:13:35 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r680025 - in /felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin: PropertyHandler.java SCRDescriptorMojo.java Date: Sat, 26 Jul 2008 18:13:35 -0000 To: commits@felix.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080726181335.9BFBF238889C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Sat Jul 26 11:13:35 2008 New Revision: 680025 URL: http://svn.apache.org/viewvc?rev=680025&view=rev Log: FELIX-645 : Only apply global property if it hasn't been defined by the component itself. Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/PropertyHandler.java felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/PropertyHandler.java URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/PropertyHandler.java?rev=680025&r1=680024&r2=680025&view=diff ============================================================================== --- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/PropertyHandler.java (original) +++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/PropertyHandler.java Sat Jul 26 11:13:35 2008 @@ -332,7 +332,7 @@ * Process all found properties for the component. * @throws MojoExecutionException */ - public void processProperties() + public void processProperties(final Map globalProperties) throws MojoExecutionException { final Iterator propIter = properties.entrySet().iterator(); while ( propIter.hasNext() ) { @@ -341,6 +341,27 @@ final PropertyDescription desc = (PropertyDescription)entry.getValue(); this.processProperty(desc.propertyTag, propName, desc.field); } + // apply pre configured global properties + if ( globalProperties != null ) { + final Iterator globalPropIter = globalProperties.entrySet().iterator(); + while ( globalPropIter.hasNext() ) { + final Map.Entry entry = (Map.Entry)globalPropIter.next(); + final String name = entry.getKey().toString(); + + // check if the service already provides this property + if ( !properties.containsKey(name) ) { + final String value = entry.getValue().toString(); + + final Property p = new Property(); + p.setName(name); + p.setValue(value); + p.setType("String"); + p.setPrivate(true); + component.addProperty(p); + + } + } + } } protected static final class PropertyDescription { Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java?rev=680025&r1=680024&r2=680025&view=diff ============================================================================== --- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java (original) +++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java Sat Jul 26 11:13:35 2008 @@ -252,18 +252,6 @@ // Utility handler for propertie final PropertyHandler propertyHandler = new PropertyHandler(component, ocd); - // pre configured properties - final Iterator globalPropIter = this.properties.entrySet().iterator(); - while ( globalPropIter.hasNext() ) { - final Map.Entry entry = (Map.Entry)globalPropIter.next(); - final Property p = new Property(); - p.setName(entry.getKey().toString()); - p.setValue(entry.getValue().toString()); - p.setType("String"); - p.setPrivate(true); - component.addProperty(p); - } - JavaClassDescription currentDescription = description; do { // properties @@ -293,7 +281,7 @@ } while (inherited && currentDescription != null); // process properties - propertyHandler.processProperties(); + propertyHandler.processProperties(this.properties); // process references final Iterator refIter = references.entrySet().iterator();