Fix FELIX-3190
Added a getComponentMetadata method to Factory.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1195533 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/pom.xml b/ipojo/core/pom.xml
index d1b36f1..95107c5 100644
--- a/ipojo/core/pom.xml
+++ b/ipojo/core/pom.xml
@@ -31,7 +31,9 @@
<properties>
<!--
- * 1.8.1 : change in the MethodInterceptor interface (FELIX-3144)
+ 1.8.1:
+ * change in the MethodInterceptor interface (FELIX-3144)
+ * change in the Factory interface (FELIX-3190)
-->
<ipojo.package.version>1.8.1</ipojo.package.version>
</properties>
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java
index 3ca69fe..f18c1d3 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/Factory.java
@@ -155,4 +155,10 @@
*/
String getVersion();
+ /**
+ * Gets the component type metadata (Element - Attribute structure)
+ * @return the root element of the component metadata. The result must <b>not</b> be modified.
+ */
+ Element getComponentMetadata();
+
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
index e237d6f..8cef70e 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
@@ -175,14 +175,13 @@
/**
* Defines the handler type description.
- * @see ComponentDescription
+ * @see ComponentTypeDescription
*/
private class HandlerTypeDescription extends ComponentTypeDescription {
/**
* Creates the HandlerTypeDescription.
* @param factory the factory.
- * @see ComponentTypeDescription#ComponentTypeDescription(Factory)
*/
public HandlerTypeDescription(IPojoFactory factory) {
super(factory);
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
index 49f1649..9fd8934 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java
@@ -349,6 +349,15 @@
}
/**
+ * Gets the component metadata.
+ * @return the component metadata
+ * @see org.apache.felix.ipojo.Factory#getComponentMetadata()
+ */
+ public Element getComponentMetadata() {
+ return m_componentMetadata;
+ }
+
+ /**
* Computes the list of missing handlers. This method is called with the monitor lock.
* @return the list of missing handlers.
* @see org.apache.felix.ipojo.Factory#getMissingHandlers()
diff --git a/ipojo/tests/core/factories/pom.xml b/ipojo/tests/core/factories/pom.xml
index d592ad5..b363e84 100644
--- a/ipojo/tests/core/factories/pom.xml
+++ b/ipojo/tests/core/factories/pom.xml
@@ -1,28 +1,28 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>ipojo.tests</groupId>
<artifactId>ipojo.tests</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
+ <relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -35,6 +35,8 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo</artifactId>
+ <version>${ipojo.core.snapshot}</version>
+ <scope></scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
diff --git a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java
index ce53f39..81bbc9e 100644
--- a/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java
+++ b/ipojo/tests/core/factories/src/main/java/org/apache/felix/ipojo/test/scenarios/factories/ComponentDesc.java
@@ -198,6 +198,9 @@
// Check Description equality
ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider2.getProperty("component.description");
assertNotNull("check description equality", desc);
+
+ // Check that we have the complete metadata
+ assertNotNull(fooProvider2.getComponentMetadata());
}
/**
@@ -263,6 +266,9 @@
// Check Description equality
ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProviderDyn2.getProperty("component.description");
assertNotNull("check description equality", desc);
+
+ // Check that we have the complete metadata
+ assertNotNull(fooProvider2.getComponentMetadata());
}
/**
@@ -346,6 +352,8 @@
ComponentTypeDescription desc = (ComponentTypeDescription) sr_foobarProvider.getProperty("component.description");
assertNotNull("check description equality", desc);
+ // Check that we have the complete metadata
+ assertNotNull(foobarProvider.getComponentMetadata());
}
private boolean containsSpecification(String value, Element[] array) {