REQUIREMENT mime.plugin.access.sql92 |
Type | NEW |
Priority | MEDIUM |
Status | CLOSED |
Topic | XmlBlaster allows to access messages filtered with statements conform to the search conditions of defined in sql92. | ||||||||||||
Des cription |
XmlBlaster allows you to query messages based on their meta information with a syntax conform to the search conditions defined by sql92. This syntax is the same as the one adopted by the JMS specification (ver. 1.1). This plugin does a search on the client properties of the qos used to publish a given message. Note that the content of the message is not checked, please use the mime.plugin.access.xpath or mime.plugin.access.regex plugins for such full text filter tasks. A typical use case would be the same as you have for a message selector in jms. Suppose for example you have designed a solution to manage a taxi center in a town. The taxis are motorcycles, small cars, big cars, mini-vans and limousines. The town is divided into several geographical areas. Every GUI is associated with one of these areas. You would choose an approach where each of the taxis is a topic (a given oid). Additionally you would give the topic's keys a structure similar to the following: <taxi type='motorcycle|small car|big car|mini-van|limousine'/>. Every unit would publish a message with a key <key oid='ti4747'><taxi type='limousine' /></key>(in this case a limo) and in the qos it would add a client property xPos=100 and yPos=120. Let's say your GUI is interested in all limos in a limited area. Then it would subscribe with XPATH to //taxi[@type='limousine']and with the query for the Sql92Filter to be xPos BETWEEN 0 AND 100 AND yPos BETWEEN 20 AND 130. This filter is available for synchronous access with get() and asynchronous access with subscribe()
and as a filter for xmlBlaster cluster support.
Multiple filters can be specified in one subscribe/get invocation. Each of them may address another plugin. They are sequentially executed and if one filter denies access (the match() method returns 'false') the message is not delivered. The filters are logically AND connected.
The cascading approach for XPath/exact query and filters: Query Syntax (based on the jms specification). It is practically the same as the jms specification with an additional REGEX keyword (see below) and a well defined behaviour for cases where the identifier is null (in jms the behaviour is undefined when an expression contains a null identifier (i.e. if the client property on which a query is made does not exist).
|
||||||||||||
Example XML |
<!-- cut and paste this text and save it in a file called sql92.xml and then invoke in the same directory java javaclients.script.XmlScript -requestFile sql92.xml --> <xmlBlaster> <connect/> <subscribe> <key queryType='XPATH'>//taxi[@type='limousine']</key> <qos> <filter type='Sql92Filter'> xPos BETWEEN 0 AND 100 AND yPos BETWEEN 20 AND 130 </filter> </qos> </subscribe> <!-- you should become this one --> <publish> <key oid='ti4747'><taxi type='limousine'/></key> <content>just some content</content> <qos> <clientProperty type='Integer' name='xPos'>100</clientProperty> <clientProperty type='Integer' name='yPos'>120</clientProperty> </qos> </publish> <!-- this one should be rejected by the mime plugin --> <publish> <key oid='ti4747'><taxi type='limousine'/></key> <content>just some content</content> <qos> <clientProperty type='Integer' name='xPos'>110</clientProperty> <clientProperty type='Integer' name='yPos'>120</clientProperty> </qos> </publish> <unsubscribe><key queryType='XPATH'>//taxi[@type='limousine']</key></unsubscribe> <erase><key oid='ti4747'></erase> <disconnect /> </xmlBlaster> |
||||||||||||
Example CPP |
Here an example with the C++ command line clients: java org.xmlBlaster.Main PublishDemo -clientProperty.key phone -clientProperty.value 1200003 SubscribeDemo -filter.type Sql92Filter -filter.query "phone LIKE '12%3'" If you change the publisher -clientProperty.value to for example '1000003' the subscriber won't receive the message. |
||||||||||||
Configure |
These parameters allow to configure the regex plugin.
Example entry in MimeAccessPlugin[Sql92Filter][1.0]=org.xmlBlaster.engine.mime.sql92.Sql92Filter,cacheQuery=false
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
||||||||||||
See | http://www.cacas.org/java/gnu/regexp/ | ||||||||||||
See | http://developer.java.sun.com/developer/technicalArticles/releases/1.4regex/ | ||||||||||||
See API | org.xmlBlaster.engine.mime.sql92.Sql92Filter | ||||||||||||
See API | org.xmlBlaster.util.qos.AccessFilterQos | ||||||||||||
See API | org.xmlBlaster.engine.mime.I_AccessFilter | ||||||||||||
See API | org.xmlBlaster.util.plugin.I_Plugin | ||||||||||||
See REQ | mime.plugin.accessfilter.howto | ||||||||||||
See REQ | mime.plugin.accessfilter | ||||||||||||
See REQ | cluster | ||||||||||||
See TEST | org.xmlBlaster.test.mime.TestGetSql92Filter | ||||||||||||
See TEST | org.xmlBlaster.test.classtest.Sql92SelectorTest |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/mime.plugin.access.sql92.xml