Fix issue Felix-866
The 'interface attribute of the 'provides' element becomes 'specifications' The semantic doesn't change.
Fix issue Felix-867
The ServiceProperty annotation was able to target Method. However this is not possible. Service properties can only be attached to fields.
Fix issue Felix-868
The Component annontation did'nt support the factory methods. So, the 'factory_method' attribute was added to support the configuration of factory methods.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@729971 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
index 49866d0..e28120e 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
@@ -264,7 +264,7 @@
* @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
*/
public void visitEnd() {
- m_prov.addAttribute(new Attribute("interface", m_itfs + "}"));
+ m_prov.addAttribute(new Attribute("specifications", m_itfs + "}"));
}
}
@@ -307,6 +307,11 @@
private String m_managedservice;
/**
+ * Factory-Method.
+ */
+ private String m_method;
+
+ /**
* Element properties.
*/
private Element m_props;
@@ -342,6 +347,10 @@
m_managedservice = arg1.toString();
return;
}
+ if (arg0.equals("factory_method")) {
+ m_method = arg1.toString();
+ return;
+ }
}
/**
@@ -365,6 +374,9 @@
if (m_immediate != null) {
m_elem.addAttribute(new Attribute("immediate", m_immediate));
}
+ if (m_method != null) {
+ m_elem.addAttribute(new Attribute("factory-method", m_method));
+ }
if (m_propagation != null) {
if (m_props == null) {
m_props = new Element("properties", "");
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
index b139231..8bccc28 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MethodCollector.java
@@ -61,9 +61,6 @@
if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Property;")) {
return processProperty();
}
- if (arg0.equals("Lorg/apache/felix/ipojo/annotations/ServiceProperty;")) {
- return processServiceProperty();
- }
if (arg0.equals("Lorg/apache/felix/ipojo/annotations/Validate;")) {
return processValidate();
}
@@ -120,20 +117,6 @@
}
/**
- * Process @serviceProperty annotation.
- * @return the visitor parsing the visited annotation.
- */
- private AnnotationVisitor processServiceProperty() {
- if (! m_collector.getIds().containsKey("provides")) {
- System.err.println("The component does not provide services, skipping ServiceProperty for " + m_name);
- return null;
- } else {
- Element provides = (Element) m_collector.getIds().get("provides");
- return new PropertyAnnotationParser(provides, m_name);
- }
- }
-
- /**
* Process @property annotation.
* @return the visitor parsing the visited annotation.
*/
diff --git a/ipojo/manipulator/src/main/resources/core.xsd b/ipojo/manipulator/src/main/resources/core.xsd
index d98fca3..4731b49 100644
--- a/ipojo/manipulator/src/main/resources/core.xsd
+++ b/ipojo/manipulator/src/main/resources/core.xsd
@@ -319,9 +319,13 @@
<xs:documentation>List of service specific properties.</xs:documentation>
</xs:annotation></xs:element>
</xs:sequence>
- <xs:attribute name="interface" type="xs:string" use="optional">
+ <xs:attribute name="interface" type="xs:string" use="prohibited">
<xs:annotation>
- <xs:documentation>The list of interfaces of the service to expose. By default, all interfaces implemented by the component implementation class are published.</xs:documentation>
+ <xs:documentation>Deprecated attribute, use 'specifications' instead of 'interface'</xs:documentation>
+ </xs:annotation></xs:attribute>
+ <xs:attribute name="specifications" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation>The list of service specifications (i.e. interfaces) to expose. By default, all interfaces implemented by the component implementation class are published.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="factory" type="xs:string" use="prohibited">
<xs:annotation>