Improve javadoc of the instance creator
Fix several concurrency issues with the configuration admin (such as Felix-732)
Commit a test suite testing configuration admin support
Improve the documentation of XSD Schemas (external handlers)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@698589 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd b/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd
index 943608e..78406b3 100644
--- a/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd
+++ b/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd
@@ -22,20 +22,66 @@
 	elementFormDefault="qualified">	
 
     <xs:complexType name="PublisherType">
-    	<xs:attribute name="name" type="xs:string" use="required"></xs:attribute>
-    	<xs:attribute name="field" type="xs:string" use="required"></xs:attribute>
-    	<xs:attribute name="topics" type="xs:string" use="optional"></xs:attribute>
-    	<xs:attribute name="synchronous" type="xs:boolean" use="optional"></xs:attribute>
-    	<xs:attribute name="data-key" type="xs:string" use="optional"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of an event publisher.</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="name" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>The name of the event publisher, acting as a unique identifier.
+The name of the POJO's field that will be used to send events. The field is initialized at component instantiation time. The type of the field must be "org.apache.felix.ipojo.handlers.event.publisher.Publisher".</xs:documentation>
+        	</xs:annotation></xs:attribute>
+    	<xs:attribute name="field" type="xs:string" use="required">
+    		<xs:annotation>
+    			<xs:documentation>The name of the POJO field associated to this event publisher.
+Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending.</xs:documentation>
+    		</xs:annotation></xs:attribute>
+    	<xs:attribute name="topics" type="xs:string" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>The comma-separated-list of the topics on which events will be sent. All subscribers that are listening to one of these topics will receive the events.</xs:documentation></xs:annotation></xs:attribute>
+    	<xs:attribute name="synchronous" type="xs:boolean" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>Determines if event sending is synchronous or not. By default, events are sent asynchronously, but you can specify there the desired behaviour of the Publisher.
+The default value of this attribute is "false".</xs:documentation>
+    		</xs:annotation></xs:attribute>
+    	<xs:attribute name="data-key" type="xs:string" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>The data key is used when you want to send data events. This attribute's value is the key, in the event's dictionary, in which sent data are stored. When you use the sendData method of the Publisher, the given object is placed in the event dictionary, associated with the specified data-key.
+The default value of this attribute is user.data.</xs:documentation></xs:annotation></xs:attribute>
     </xs:complexType>
     
     <xs:complexType name="SubscriberType">
-    	<xs:attribute name="name" type="xs:string" use="required"></xs:attribute>
-    	<xs:attribute name="callback" type="xs:string" use="required"></xs:attribute>
-    	<xs:attribute name="topics" type="xs:string" use="optional"></xs:attribute>
-    	<xs:attribute name="filter" type="xs:string" use="optional"></xs:attribute>
-    	<xs:attribute name="data-key" type="xs:string" use="optional"></xs:attribute>
-    	<xs:attribute name="data-type" type="xs:string" use="optional"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of an event subscriber.</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="name" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>The name of the event subscriber, acting as a unique identifier.</xs:documentation></xs:annotation></xs:attribute>
+    	<xs:attribute name="callback" type="xs:string" use="required">
+    		<xs:annotation>
+    			<xs:documentation>The name of the POJO's method that will be called each time an event is received.
+This method takes only one parameter, of typeorg.osgi.service.event.Eventby default, but this type can be overridden by defining the data-key and/or the data-type attributes.</xs:documentation>
+    		</xs:annotation></xs:attribute>
+    	<xs:attribute name="topics" type="xs:string" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>The comma-separated-list of the topics that the handler will listen to. Each event sent on a topic present in this list will be sent to the specified callback method.</xs:documentation></xs:annotation></xs:attribute>
+    	<xs:attribute name="filter" type="xs:string" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>The event filter is used to filter incoming events before sending them to the callback.
+The syntax of this field is described in the OSGi EventAdmin Specification. If you don't specify a filter, all events sent on the listened topics will be considered.</xs:documentation>
+    		</xs:annotation></xs:attribute>
+    	<xs:attribute name="data-key" type="xs:string" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>The data key is used when you want to receive data events. This attribute's value is the key corresponding to the received data in the event's dictionary.
+If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event.
+This attribute is generally used with the data-typeattribute to specify the received object type.
+If an event is received and it does not contain such a key, it is ignored (with a warning message).</xs:documentation>
+    		</xs:annotation></xs:attribute>
+    	<xs:attribute name="data-type" type="xs:string" use="optional">
+    		<xs:annotation>
+    			<xs:documentation>This attribute is associated to the data-key attribute. It specifies the type of objects (java.lang.Object by default) that the callback expects.
+It is used to determine the unique callback method (in case of multiple methods with the same name) and to check type compliance at event reception.
+Data events that are not corresponding to the specified type will be ignored (with a warning message).</xs:documentation>
+    		</xs:annotation></xs:attribute>
     </xs:complexType>
     
     <xs:element name="publisher" type="PublisherType"></xs:element>
diff --git a/ipojo/handler/extender/src/main/resources/extender-pattern.xsd b/ipojo/handler/extender/src/main/resources/extender-pattern.xsd
index 96f4063..0e2ed9f 100644
--- a/ipojo/handler/extender/src/main/resources/extender-pattern.xsd
+++ b/ipojo/handler/extender/src/main/resources/extender-pattern.xsd
@@ -22,8 +22,21 @@
 	elementFormDefault="qualified">
 	<xs:element name="extender" type="ExtenderType"></xs:element>
 	<xs:complexType name="ExtenderType">
-		<xs:attribute name="onArrival" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="onDeparture" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="extension" type="xs:string" use="required"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of the extender pattern configuration.
+The extender tracks extensions. The particularity of this architecture-style is that extensions are packaged in different bundles. An extension is detected by analyzing the bundle. The mark is currently a header in the bundle manifest. At each time a matching bundle appears or disappears, a callback is invoked. </xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="onArrival" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>Declaring the method to invoke when a matching bundle arrives</xs:documentation>
+        	</xs:annotation></xs:attribute>
+		<xs:attribute name="onDeparture" type="xs:string" use="required">
+			<xs:annotation>
+				<xs:documentation>Declaring the method to invoke when a matching bundle leaves</xs:documentation>
+			</xs:annotation></xs:attribute>
+		<xs:attribute name="extension" type="xs:string" use="required">
+			<xs:annotation>
+				<xs:documentation>Declaring the looked manifest header.</xs:documentation>
+			</xs:annotation></xs:attribute>
 	</xs:complexType>	
 </xs:schema>
\ No newline at end of file
diff --git a/ipojo/handler/jmx/src/main/resources/jmx.xsd b/ipojo/handler/jmx/src/main/resources/jmx.xsd
index e31ea2e..80152e9 100644
--- a/ipojo/handler/jmx/src/main/resources/jmx.xsd
+++ b/ipojo/handler/jmx/src/main/resources/jmx.xsd
@@ -24,37 +24,154 @@
 
 	<xs:complexType name="JMXType">
 
+		<xs:annotation>
+			<xs:documentation>
+				Description of a JMX managed component.
+			</xs:documentation>
+		</xs:annotation>
 		<xs:choice minOccurs="0" maxOccurs="unbounded">
-			<xs:element name="method" type="JMXMethod"></xs:element>
-			<xs:element name="property" type="JMXProperty"></xs:element>
+			<xs:element name="method" type="JMXMethod">
+				<xs:annotation>
+					<xs:documentation>
+						The list of methods to expose.
+					</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="property" type="JMXProperty">
+				<xs:annotation>
+					<xs:documentation>
+						The list of attributes to expose.
+					</xs:documentation>
+				</xs:annotation>
+			</xs:element>
 		</xs:choice>
 		<xs:attribute name="usesMOSGi" type="xs:boolean"
 			use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					Determines if the component must be register on the
+					MOSGi MBean server or not.
+				</xs:documentation>
+			</xs:annotation>
 		</xs:attribute>
 		<xs:attribute name="objectName" type="xs:string"
 			use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					The complete object name of the managed component.
+					The syntax of this attribute must be compliant with
+					the ObjectName syntax, detailed in the JMX
+					specification. If neither domain nor name attributes
+					are specified, the default value is determined by
+					the package, the type and the instance name of the
+					component. This attribute overrides the domain and
+					name attributes.
+				</xs:documentation>
+			</xs:annotation>
 		</xs:attribute>
-		<xs:attribute name="domain" type="xs:string" use="optional"></xs:attribute>
-		<xs:attribute name="name" type="xs:string" use="optional"></xs:attribute>
+		<xs:attribute name="domain" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					The domain of the managed object (i.e., the left
+					part of the object name). This attribute must be
+					compliant with the domain syntax, as described in
+					the JMX specification.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="name" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					The name property of the managed object. The value
+					of this attribute must comply with the ObjectName
+					value syntax, as described in the JMX specification.
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
 
+		<xs:attribute name="preRegister" type="xs:string"
+			use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					Specifies method to carry out operations before
+					beeing registered from the MBean server. The
+					signature of the specified method must be :
+					"ObjectName preRegister(MBeanServer server,
+					ObjectName name) throws Exception".
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="postRegister" type="xs:string"
+			use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					Specifies method to carry out operations after
+					beeing registered from the MBean server. The
+					signature of the specified method must be : "void
+					postRegister(Boolean registrationDone)".
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="preDeregister" type="xs:string"
+			use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					Specifies method to carry out operations before
+					beeing unregistered from the MBean server. The
+					signature of the specified method must be : "void
+					preDeregister() throws Exception".
+				</xs:documentation>
+			</xs:annotation>
+		</xs:attribute>
+		<xs:attribute name="postDeregister" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>
+					Specifies method to carry out operations after
+					beeing unregistered from the MBean server. The
+					signature of the specified method must be : 
+					"void postDeregister()".</xs:documentation>
+			</xs:annotation></xs:attribute>
 	</xs:complexType>
 
 	<xs:complexType name="JMXProperty">
-		<xs:attribute name="field" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="name" type="xs:string" use="optional"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of an attribute to expose.</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="field" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>The name of the component's field to expose.</xs:documentation></xs:annotation></xs:attribute>
+		<xs:attribute name="name" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>The name of the property as it will appear in JMX. If unspecified, the default value is the name of the exposed field.</xs:documentation></xs:annotation></xs:attribute>
 		<xs:attribute name="rights" use="optional">
-			<xs:simpleType>
-				<xs:restriction base="xs:string">
+            <xs:annotation>
+            	<xs:documentation>Specify the access permission of the exposed field.</xs:documentation>
+            </xs:annotation>
+            <xs:simpleType>
+                <xs:annotation>
+                	<xs:documentation>Access permission of an exposed field. Accepted values are "r" (read-only access, the default value) and "w" (read and write access).</xs:documentation>
+                </xs:annotation>
+                <xs:restriction base="xs:string">
 					<xs:enumeration value="r"></xs:enumeration>
 					<xs:enumeration value="w"></xs:enumeration>
 				</xs:restriction>
 			</xs:simpleType>
 		</xs:attribute>
-		<xs:attribute name="notification" type="xs:boolean" use="optional"></xs:attribute>
+		<xs:attribute name="notification" type="xs:boolean" use="optional">
+			<xs:annotation>
+				<xs:documentation>Enable or disable attribute change notification sending for this property. If set to &quot;true&quot;, a notification is sent each time the value of the field changes.</xs:documentation></xs:annotation></xs:attribute>
 	</xs:complexType>
 
 	<xs:complexType name="JMXMethod">
-		<xs:attribute name="name" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="description" type="xs:string" use="optional"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of a method to expose.</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="name" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>The name of the method to expose. If multiple methods have the same name, all of them are exposed.</xs:documentation>
+        	</xs:annotation></xs:attribute>
+		<xs:attribute name="description" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>The description of the exposed method, as it will appear in JMX.</xs:documentation></xs:annotation></xs:attribute>
 	</xs:complexType>
 </xs:schema>
\ No newline at end of file
diff --git a/ipojo/handler/temporal/src/main/resources/temporal.xsd b/ipojo/handler/temporal/src/main/resources/temporal.xsd
index e4d7778..8c22188 100644
--- a/ipojo/handler/temporal/src/main/resources/temporal.xsd
+++ b/ipojo/handler/temporal/src/main/resources/temporal.xsd
@@ -24,15 +24,23 @@
 
 	<xs:complexType name="TemporalServiceDependencyType">
 
-		<xs:attribute name="field" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="filter" type="xs:string" use="optional"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of a temporal dependency.</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="field" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>The implementation field supporting the dependency.</xs:documentation>
+        	</xs:annotation></xs:attribute>
+		<xs:attribute name="filter" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>Filter use to discover matching filter.</xs:documentation></xs:annotation></xs:attribute>
 		<xs:attribute name="timeout" type="xs:int" use="optional">
 			<xs:annotation>
-				<xs:documentation>Specifies the timeout after which the onTimeout policy is executed.
The value is the time in ms to wait. -1 is used to indicate an infinite wait. </xs:documentation>
+				<xs:documentation>Specifies the timeout after which the onTimeout policy is executed. The value is the time in ms to wait. -1 is used to indicate an infinite wait.</xs:documentation>
 			</xs:annotation></xs:attribute>
 		<xs:attribute name="onTimeout" use="optional" type="xs:string">
             <xs:annotation>
-            	<xs:documentation>Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires.
Several values are supported:
- 'nullable' means that a Nullable object will be injected
- 'empty-array' injects an empty array (only for aggregate dependency)
- 'null' injects Null
- any other value are interpreted as the default implementation class to use.

If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached.</xs:documentation>
+            	<xs:documentation>Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires. Several values are supported: 'nullable' means that a Nullable object will be injected, 'empty-array' injects an empty array (only for aggregate dependency), 'null' injects Null, any other value are interpreted as the default implementation class to use. If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached.</xs:documentation>
             </xs:annotation>
 		</xs:attribute>
 	</xs:complexType>
diff --git a/ipojo/handler/whiteboard/src/main/resources/whiteboard-pattern.xsd b/ipojo/handler/whiteboard/src/main/resources/whiteboard-pattern.xsd
index 5feb590..85aad08 100644
--- a/ipojo/handler/whiteboard/src/main/resources/whiteboard-pattern.xsd
+++ b/ipojo/handler/whiteboard/src/main/resources/whiteboard-pattern.xsd
@@ -22,9 +22,24 @@
 	elementFormDefault="qualified">
 	<xs:element name="wbp" type="WBPType"></xs:element>
 	<xs:complexType name="WBPType">
-		<xs:attribute name="onArrival" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="onDeparture" type="xs:string" use="required"></xs:attribute>
-		<xs:attribute name="onModification" type="xs:string" use="optional"></xs:attribute>
-		<xs:attribute name="filter" type="xs:string" use="required"></xs:attribute>
+        <xs:annotation>
+        	<xs:documentation>Description of the white-board architecture.</xs:documentation>
+        </xs:annotation>
+        <xs:attribute name="onArrival" type="xs:string" use="required">
+        	<xs:annotation>
+        		<xs:documentation>Declaring the method to invoke when a matching service arrives.</xs:documentation>
+        	</xs:annotation></xs:attribute>
+		<xs:attribute name="onDeparture" type="xs:string" use="required">
+			<xs:annotation>
+				<xs:documentation>Declaring the method to invoke when a matching service leaves.</xs:documentation>
+			</xs:annotation></xs:attribute>
+		<xs:attribute name="onModification" type="xs:string" use="optional">
+			<xs:annotation>
+				<xs:documentation>Method called when an injected service reference is modified but stills valid against the filter.</xs:documentation>
+			</xs:annotation></xs:attribute>
+		<xs:attribute name="filter" type="xs:string" use="required">
+			<xs:annotation>
+				<xs:documentation>Filter use to discover matching filter.</xs:documentation>
+			</xs:annotation></xs:attribute>
 	</xs:complexType>	
 </xs:schema>
\ No newline at end of file