You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2009/07/09 12:30:42 UTC

svn commit: r792487 - in /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl: ComponentMetadata.java XmlHandler.java

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
         {