Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 16519 invoked from network); 9 Jul 2009 10:31:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Jul 2009 10:31:05 -0000 Received: (qmail 32587 invoked by uid 500); 9 Jul 2009 10:31:15 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 32551 invoked by uid 500); 9 Jul 2009 10:31:15 -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 32542 invoked by uid 99); 9 Jul 2009 10:31:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jul 2009 10:31:15 +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; Thu, 09 Jul 2009 10:31:04 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F1BFA2388892; Thu, 9 Jul 2009 10:30:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r792487 - in /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl: ComponentMetadata.java XmlHandler.java Date: Thu, 09 Jul 2009 10:30:42 -0000 To: commits@felix.apache.org From: fmeschbe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090709103042.F1BFA2388892@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmeschbe Date: Thu Jul 9 10:30:42 2009 New Revision: 792487 URL: http://svn.apache.org/viewvc?rev=792487&view=rev Log: FELIX-1284 implementation of "modified" attribute support Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java?rev=792487&r1=792486&r2=792487&view=diff ============================================================================== --- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java (original) +++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java Thu Jul 9 10:30:42 2009 @@ -75,6 +75,9 @@ // 112.5.12 deactivate can be specified (since DS 1.1) private String m_deactivate = null; + // 112.??.?? modified method (configuration update, since DS 1.1) + private String m_modified = null; + // 112.4.3 configuration-policy (since DS 1.1) private String m_configurationPolicy = null; @@ -235,6 +238,22 @@ /** + * Sets the name of the modified method + * + * @param modified a method name + * @since 1.2.0 (DS 1.1) + */ + public void setModified( String modified ) + { + if ( m_validated ) + { + return; + } + m_modified = modified; + } + + + /** * Used to add a property to the instance * * @param newProperty a property metadata object @@ -406,6 +425,18 @@ /** + * Returns the name of the modified method + * + * @return the name of the modified method + * @since 1.2.0 (DS 1.1) + */ + public String getModified() + { + return m_modified; + } + + + /** * Returns the associated ServiceMetadata * * @return a ServiceMetadata object or null if the Component does not provide any service @@ -532,6 +563,15 @@ m_deactivate = "deactivate"; } + // 112.??.?? modified can be specified (since DS 1.1) + if ( m_modified != null && m_namespaceCode < XmlHandler.DS_VERSION_1_1 ) + { + // require new namespace if modified is specified + logger.log( LogService.LOG_WARNING, + "Ignoring modified method declaration, DS 1.1 or later namespace required", this, null ); + m_modified = null; + } + // Next check if the properties are valid (and extract property values) Iterator propertyIterator = m_propertyMetaData.iterator(); while ( propertyIterator.hasNext() ) Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java?rev=792487&r1=792486&r2=792487&view=diff ============================================================================== --- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java (original) +++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/XmlHandler.java Thu Jul 9 10:30:42 2009 @@ -47,22 +47,22 @@ // Namespace URI of DS 1.0 public static final String NAMESPACE_URI = "http://www.osgi.org/xmlns/scr/v1.0.0"; - + // Namespace URI of DS 1.1 public static final String NAMESPACE_URI_1_1 = "http://www.osgi.org/xmlns/scr/v1.1.0"; - + // namespace code for non-DS namespace public static final int DS_VERSION_NONE = -1; - + // namespace code for the DS 1.0 specification public static final int DS_VERSION_1_0 = 0; - + // namespace code for the DS 1.0 specification public static final int DS_VERSION_1_1 = 1; // mapping of namespace URI to namespace code private static final Map NAMESPACE_CODE_MAP; - + // the bundle containing the XML resource being parsed private final Bundle m_bundle; @@ -201,6 +201,12 @@ m_currentComponent.setDeactivate( attrib.getProperty( "deactivate" ) ); } + // modified attribute is optional (since DS 1.1) + if ( attrib.getProperty( "modified" ) != null ) + { + m_currentComponent.setModified( attrib.getProperty( "modified" ) ); + } + // Add this component to the list m_components.add( m_currentComponent ); } @@ -292,7 +298,7 @@ m_currentComponent.addDependency( ref ); } - + // unexpected element else { @@ -306,7 +312,7 @@ throw new ParseException( "Exception during parsing", ex ); } } - + // unexpected namespace else {