Author: clement
Date: Mon Sep 15 05:53:29 2008
New Revision: 695456

URL: http://svn.apache.org/viewvc?rev=695456&view=rev
Log:
Changes the 'interface' attribute of the service dependency handler to be 
'specification'. This change remove a differentiation between service 
dependencies description. The 'interface' attribute stills supported but 
becomes deprecated. 
The Core XML-Schema is modified according to this change.

Modified:
    
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
    felix/trunk/ipojo/core/src/main/resources/core.xsd
    
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
    
felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml

Modified: 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java?rev=695456&r1=695455&r2=695456&view=diff
==============================================================================
--- 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
 (original)
+++ 
felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
 Mon Sep 15 05:53:29 2008
@@ -314,7 +314,15 @@
         for (int i = 0; deps != null && i < deps.length; i++) {
             // Create the dependency metadata
             String field = deps[i].getAttribute("field");
+            
             String serviceSpecification = deps[i].getAttribute("interface");
+            // the 'interface' attribute is deprecated
+            if (serviceSpecification != null) {
+                warn("The 'interface' attribute is deprecated, use the 
'specification' attribute instead");
+            } else {
+                serviceSpecification = deps[i].getAttribute("specification");
+            }
+            
             String filter = deps[i].getAttribute("filter");
             String opt = deps[i].getAttribute("optional");
             boolean optional = opt != null && opt.equalsIgnoreCase("true");
@@ -426,26 +434,6 @@
         }
     }
 
-//    /**
-//     * GetterCallback Method.
-//     * @param pojo : the pojo object on which the field is accessed
-//     * @param fieldName : the field name.
-//     * @param value : the value passed to the field (by the previous 
handler).
-//     * @return the object that the dependency handler want to push.
-//     * @see org.apache.felix.ipojo.Handler#onGet(Object, java.lang.String, 
java.lang.Object)
-//     */
-//    public Object onGet(Object pojo, String fieldName, Object value) {
-//        for (int i = 0; i < m_dependencies.length; i++) {
-//            Dependency dep = m_dependencies[i];
-//            if (fieldName.equals(dep.getField())) {
-//                // The field name is a dependency, return the get
-//                return dep.get();
-//            }
-//        }
-//        // Else return the value
-//        return value;
-//    }
-
     /**
      * Handler start method.
      * @see org.apache.felix.ipojo.Handler#start()

Modified: felix/trunk/ipojo/core/src/main/resources/core.xsd
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/resources/core.xsd?rev=695456&r1=695455&r2=695456&view=diff
==============================================================================
--- felix/trunk/ipojo/core/src/main/resources/core.xsd (original)
+++ felix/trunk/ipojo/core/src/main/resources/core.xsd Mon Sep 15 05:53:29 2008
@@ -249,6 +249,7 @@
        </xs:complexType>
        
        <xs:complexType name="ServiceDependencyType">
+           <xs:attribute name="specification" type="xs:string" use="optional"/>
                <xs:attribute name="optional" type="xs:boolean" use="optional">
                </xs:attribute>
                <xs:attribute name="aggregate" type="xs:boolean" use="optional">

Modified: 
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java?rev=695456&r1=695455&r2=695456&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
 Mon Sep 15 05:53:29 2008
@@ -279,7 +279,7 @@
                 // Add the complete requires
                 req = new Element("requires", "");
                 if (m_specification != null) {
-                    req.addAttribute(new Attribute("interface", 
m_specification));
+                    req.addAttribute(new Attribute("specification", 
m_specification));
                 }
                 if (m_aggregate != null) {
                     req.addAttribute(new Attribute("aggregate", m_aggregate));
@@ -303,7 +303,7 @@
                     req.addAttribute(new Attribute("from", m_from));
                 }
             } else {
-                String itf = req.getAttribute("interface");
+                String itf = req.getAttribute("specification");
                 String aggregate = req.getAttribute("aggregate");
                 String optional = req.getAttribute("optional");
                 String filter = req.getAttribute("filter");
@@ -312,7 +312,7 @@
                 String from = req.getAttribute("from");
                 if (m_specification != null) {
                     if (itf == null) {
-                        req.addAttribute(new Attribute("interface", 
m_specification));
+                        req.addAttribute(new Attribute("specification", 
m_specification));
                     } else if (! m_specification.equals(itf)) {
                         System.err.println("The required specification is not 
the same than previouly : " + m_specification + " & " + itf);
                         return;

Modified: 
felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml?rev=695456&r1=695455&r2=695456&view=diff
==============================================================================
--- 
felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml 
(original)
+++ 
felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml 
Mon Sep 15 05:53:29 2008
@@ -74,7 +74,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
                name="MRefCheckServiceProvider" architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService">
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService">
                        <callback type="bind" method="refBind" />
                        <callback type="unbind" method="refUnbind" />
                </requires>
@@ -189,7 +189,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
                name="MRefOptionalCheckServiceProvider" architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
                        optional="true">
                        <callback type="bind" method="refBind" />
                        <callback type="unbind" method="refUnbind" />
@@ -200,7 +200,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
                name="MBothOptionalCheckServiceProvider" architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
                        optional="true">
                        <callback type="bind" method="bothBind" />
                        <callback type="unbind" method="bothUnbind" />
@@ -271,7 +271,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
                name="DIMRefOptionalCheckServiceProvider" architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
                        optional="true"
                        
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
                        <callback type="bind" method="refBind" />
@@ -283,7 +283,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.MethodCheckServiceProvider"
                name="DIMBothOptionalCheckServiceProvider" architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
                        optional="true"
                        
default-implementation="org.apache.felix.ipojo.test.scenarios.component.FooServiceDefaultImpl">
                        <callback type="bind" method="bothBind" />
@@ -348,7 +348,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.MethodMultipleCheckService"
                name="MRefMultipleCheckServiceProvider" architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
                        aggregate="true">
                        <callback type="bind" method="refBind" />
                        <callback type="unbind" method="refUnbind" />
@@ -418,7 +418,7 @@
                name="MRefOptionalMultipleCheckServiceProvider"
                architecture="true">
                <requires
-                       
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
+                       
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
                        aggregate="true" optional="true">
                        <callback type="bind" method="refBind" />
                        <callback type="unbind" method="refUnbind" />
@@ -430,14 +430,14 @@
        <component
                
classname="org.apache.felix.ipojo.test.scenarios.component.ListCheckService"
                name="SimpleListCheckServiceProvider" architecture="true">
-               <requires field="fs" 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"/>
+               <requires field="fs" 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"/>
                <provides />
        </component>
        <component
                
classname="org.apache.felix.ipojo.test.scenarios.component.ListCheckService"
                name="OptionalListCheckServiceProvider"
                architecture="true">
-               <requires 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
+               <requires 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
                <provides />
        </component>
        
@@ -455,7 +455,7 @@
                
classname="org.apache.felix.ipojo.test.scenarios.component.VectorCheckService"
                name="OptionalVectorCheckServiceProvider"
                architecture="true">
-               <requires 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
+               <requires 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
                <provides />
        </component>
        
@@ -463,14 +463,14 @@
        <component
                
classname="org.apache.felix.ipojo.test.scenarios.component.SetCheckService"
                name="SimpleSetCheckServiceProvider" architecture="true">
-               <requires field="fs" 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"/>
+               <requires field="fs" 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"/>
                <provides />
        </component>
        <component
                
classname="org.apache.felix.ipojo.test.scenarios.component.SetCheckService"
                name="OptionalSetCheckServiceProvider"
                architecture="true">
-               <requires 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
+               <requires 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
                <provides />
        </component>
        
@@ -478,14 +478,14 @@
        <component
                
classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckService"
                name="SimpleCollectionCheckServiceProvider" architecture="true">
-               <requires field="fs" 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"/>
+               <requires field="fs" 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"/>
                <provides />
        </component>
        <component
                
classname="org.apache.felix.ipojo.test.scenarios.component.CollectionCheckService"
                name="OptionalCollectionCheckServiceProvider"
                architecture="true">
-               <requires 
interface="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
+               <requires 
specification="org.apache.felix.ipojo.test.scenarios.service.dependency.service.FooService"
 field="fs" optional="true" />
                <provides />
        </component>
        


Reply via email to