COSMOS Design 238450
Make query and registration processing engines pluggable
|Hubert Leung||June 25, 2008|
|Process||Sizing||Names of people doing the work|
|Build and infrastructure||0||Saurabh Dravid|
|Code review, etc.*|
'* - includes other committer work (e.g. check-in, contribution tracking)
The framework for query and registration web services assumes users will use the query and registration processing framework provided in org.eclipse.cosmos.dc.cmdbf.services project. However, the framework is proven to be not generic enough for all types of MDRs. From the experience of writing example MDRs and prototypes, we have concluded that it is difficult to have a common query processing engine that work for all MDRs.
This enhancement is to adjust the framework code for query and registration web services so that we don't mandate the use of the query and registration processing frameworks in org.eclipse.cosmos.dc.cmdbf.services. Also, we want to let users plug-in another query/registration processing engine using well-defined APIs.
Add a level of abstraction around the query and registration processing framework to make it optional, and make it possible to replace the processing framework with another implementation.
CMDBf query service
Introduce a component called the query processing engine. This component is responsible for taking the CMDBf query request as input, process the request, and return the CMDBf query response. A query engine provides structured and reusable logic for processing the CMDBf query. It provides extensions points for users to provide code specific to the targeted data source. Each implementation of a query engine targets a certain type of MDR with a well-defined behavior (e.g. MDRs with relational database backend).
The AbstractQueryService class will have a member variable that is a reference to the query processing engine. The query service implementation class can set an instance of the query service, which will be used to process the query. COSMOS will ship a SimpleQueryEngine that uses the framework from org.eclipse.cosmos.dc.cmdbf.services. If the query engine is not set, the web service implementation class will need to override the GraphQuery() method of AbstractQueryService and provide custom query processing logic.
Here is a class diagram of the COSMOS framework.
The classes in yellow are part of the framework.
- AbstractQueryService: Superclass of all query service implementation classes.
- It has a protected reference to a query engine. Implementation classes can set the reference to an instance of query engine. The setQueryEngine method can also be called to set the value.
- It has a GraphQuery method which will be invoked when the graph query web service operation is called. The default implementation of this method is to invoke the query engine if it is set.
- QueryEngine: an interface definition for all query engine implementations to implement. It has a graphQuery method that take the query request as input.
The SimpleQueryEngine class is an implementation of a query engine that makes use of the query processing framework provided in org.eclipse.cosmos.samples.cmdbf.services.
The classes in red are part of the query processing framework from org.eclipse.cosmos.samples.cmdbf.services. The classes in white are extensions to this framework, and are provided by the adopter.
The ExampleQueryService class is an implementation class of the CMDBf query service. It will set a reference to an instance of the SimpleQueryEngine, and initialize the SimpleQueryEngine by setting a reference to a handler factory. Handlers will also be implemented to handle different elements of the query request.
(Note that the query processing framework is abbreviated in this diagram.)
The framework for registration service is parallel to that of the query service. COSMOS will provide a SimpleRegistrationEngine to handle registration requests using the framework from org.eclipse.cosmos.dc.cmdbf.services.
Impacts of this enhancement
The code generated by the toolkit will be affected.