blob: b9c8271d50b31b0d7897678998cdb1f75b51cc7b [file] [log] [blame]
Clement Escoffier6c546352008-11-10 09:49:32 +00001<!--
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18-->
Clement Escoffierd2ce8982008-11-25 14:47:49 +000019<xs:schema targetNamespace="org.apache.felix.ipojo.handlers.event"
20 xmlns="org.apache.felix.ipojo.handlers.event"
Clement Escoffier6c546352008-11-10 09:49:32 +000021 xmlns:xs="http://www.w3.org/2001/XMLSchema"
22 elementFormDefault="qualified">
23
24 <xs:complexType name="PublisherType">
25 <xs:annotation>
26 <xs:documentation>Description of an event publisher.</xs:documentation>
27 </xs:annotation>
28 <xs:attribute name="name" type="xs:string" use="required">
29 <xs:annotation>
30 <xs:documentation>The name of the event publisher, acting as a unique identifier.
31The 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>
32 </xs:annotation></xs:attribute>
33 <xs:attribute name="field" type="xs:string" use="required">
34 <xs:annotation>
35 <xs:documentation>The name of the POJO field associated to this event publisher.
36Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending.</xs:documentation>
37 </xs:annotation></xs:attribute>
38 <xs:attribute name="topics" type="xs:string" use="optional">
39 <xs:annotation>
40 <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>
41 <xs:attribute name="synchronous" type="xs:boolean" use="optional">
42 <xs:annotation>
43 <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.
44The default value of this attribute is "false".</xs:documentation>
45 </xs:annotation></xs:attribute>
46 <xs:attribute name="data-key" type="xs:string" use="optional">
47 <xs:annotation>
48 <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.
49The default value of this attribute is user.data.</xs:documentation></xs:annotation></xs:attribute>
50 </xs:complexType>
51
52 <xs:complexType name="SubscriberType">
53 <xs:annotation>
54 <xs:documentation>Description of an event subscriber.</xs:documentation>
55 </xs:annotation>
56 <xs:attribute name="name" type="xs:string" use="required">
57 <xs:annotation>
58 <xs:documentation>The name of the event subscriber, acting as a unique identifier.</xs:documentation></xs:annotation></xs:attribute>
59 <xs:attribute name="callback" type="xs:string" use="required">
60 <xs:annotation>
61 <xs:documentation>The name of the POJO's method that will be called each time an event is received.
62This 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>
63 </xs:annotation></xs:attribute>
64 <xs:attribute name="topics" type="xs:string" use="optional">
65 <xs:annotation>
66 <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>
67 <xs:attribute name="filter" type="xs:string" use="optional">
68 <xs:annotation>
69 <xs:documentation>The event filter is used to filter incoming events before sending them to the callback.
70The 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>
71 </xs:annotation></xs:attribute>
72 <xs:attribute name="data-key" type="xs:string" use="optional">
73 <xs:annotation>
74 <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.
75If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event.
76This attribute is generally used with the data-typeattribute to specify the received object type.
77If an event is received and it does not contain such a key, it is ignored (with a warning message).</xs:documentation>
78 </xs:annotation></xs:attribute>
79 <xs:attribute name="data-type" type="xs:string" use="optional">
80 <xs:annotation>
81 <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.
82It 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.
83Data events that are not corresponding to the specified type will be ignored (with a warning message).</xs:documentation>
84 </xs:annotation></xs:attribute>
85 </xs:complexType>
86
87 <xs:element name="publisher" type="PublisherType"></xs:element>
88 <xs:element name="subscriber" type="SubscriberType"></xs:element>
89
90</xs:schema>