Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

COSMOS Design 224166

Revision as of 16:56, 21 May 2008 by Unnamed Poltroon (Talk) (New page: == Improve the Graph Response Viewer == === Change History === {|{{BMTableStyle}} !align="left"|Name: !align="left"|Date: !align="left"|Revised Sections: |- |Ali Mehregani |05/21/2008 |...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Improve the Graph Response Viewer

Change History

Name: Date: Revised Sections:
Ali Mehregani 05/21/2008
  • Initial version

Workload Estimation

Rough workload estimate in person weeks
Process Sizing Names of people doing the work
Design .5 Ali
Code 2.5 Ali
Test .5 Ali
Documentation 0
Build and infrastructure 0
Code review, etc.* 0
TOTAL 3.5

Terminologies/Acronyms

The terminologies/acronyms below are commonly used throughout this document. The list below defines each term regarding how it is used in this document:

Term Definition
MDR Management Data Repository

}

Purpose

This enhancement is associated with bugzilla 224166.

The purpose of this enhancement is to improve the graph response view displayed when querying an MDR. The view is currently convoluted and difficult to interpret by a novice user. This design document lists a number of changes to improve usability and overall structure of the view.

The image below indicates a number of usability issues with the current view: Graph response.png

Implementation Detail

This section outlines an alternative layout to address the issues displayed above. The new layout will consist of two parts:

  1. A graphical view to display a visual overview of the response
  2. A logical tree structure to traverse through the elements of the response

Analysis

CMDBf specifies an XML-based syntax by which queries are submitted to the query service, which reports back a query result from the available MDRs, also using XML syntax. As part of our implementation of the query service, we internally accept POJOs to represent a graph of the query, and return the query result as a set of POJOs. The job of the transformers is to convert POJOs to and from the XML syntax detailed in the CMDBf specification.

As part of COSMOS Design 200222, a set of query transformations and an SML-repository-specific query service were designed and implemented. In an effort to make these components reusable, the query transformations will be refactored to share common components needed by other libraries in this design. The initial candidate classes to be moved to the common module are IXMLWritable, QueryServiceUtil (which will be renamed) and some of the fields in IQueryTransformerConstants (the ones pertaining to character constants and general SAX parsing).

In addition, the previously implemented packages will be renamed to include the word "provisional", which in the API contract specifications we are reusing from the TPTP project, indicates that the APIs are experimental and will be evolved into stable public APIs.

Here is a simple example that illustrates the incoming query input transformation:

InputStream inputStream = new ByteArrayInputStream(example1().getBytes());
Query query = QueryInputTransformer.transform(inputStream);

Assume that example1() returns a String containing the XML syntax for a <query> as specified in the CMDBf spec.

Registration

CMDBf specifies a registration service by which MDRs register items and relationships with the federating CMDB. The process for registration involves an XML-based transaction, similar to how the query service works. This enhancement will provide a transformer to convert a registration request from XML to a POJO graph structure, and will also provide the reverse of that transformation. In addition, it will provide another transformer that will convert a registration response output by the MDR from a POJO graph structure to the XML-based syntax expected by the CMDBf spec, and will again provide a reverse of that transformation. The reverse transformations are needed by some clients of the registration service, and also are useful in unit testing of the implementation.

The following new classes will provide these transformations:

org.eclipse.cosmos.dc.cmdbf.services.provisional.registration.transform.RegistrationInputTransformer
org.eclipse.cosmos.dc.cmdbf.services.provisional.registration.transform.RegistrationOutputTransformer

The following are the transformation APIs on the RegistrationInputTransformer class:

static public RegisterRequest transform(InputStream)
static public InputStream transform(RegisterRequest)

The following are the transformation APIs on the RegistrationOutputTransformer class:

static public RegisterResponse transform(InputStream)
static public InputStream transform(RegisterResponse)

RegisterRequest and RegisterResponse POJOs will consist of APIs and classes that match or closely mirror the corresponding element names in the CMDBf data model. RegisterRequest will reside in the org.eclipse.cosmos.dc.cmdbf.services.provisional.registration.transform.input.artifacts package and RegisterResponse will live in the org.eclipse.cosmos.dc.cmdbf.services.provisional.registration.transform.response.artifacts package.

Here is a simple example that illustrates the incoming registration input transformation:

InputStream inputStream = new ByteArrayInputStream(example1().getBytes());
RegisterRequest registerRequest = RegistrationInputTransformer.transform(inputStream);

Assume that example1() returns a String containing the XML syntax for a <registerRequest> as specified in the CMDBf spec.

Services

Query

The class diagram below displays the interfaces and default implementations that will be included for the query service. All that a contributor is required to do is to register the classes that will be used as handlers for the selectors. The default implementation of the CMDBf query operation will look up the appropriate handlers and will invoke them accordingly.


QueryService-v1.png

The following is a snippet of code that illustrates how a contributor can register a set of selector handlers with the default implementation of ISelectorHandlerFactory.:

 SelectorHandlerFactory.getInstance().addHandlers
 (
        new URI ("http://cosmos.org/mdrId"), 
        ISelectorHandlerFactory.ITEM_TEMPLATE,
        new String[]
        {
             "org.eclipse.cosmos.sample.handlers.InstanceIdHandler",
             "org.eclipse.cosmos.sample.handlers.RecordTypeHandler",
             "org.eclipse.cosmos.sample.handlers.PropertyValueHandler",
             "org.eclipse.cosmos.sample.handlers.XPath1Handler"
        }
 );

Once the selectors are registered a client can make use of the CMDBf query service using the default implementation of ICMDBfQueryOperation. The argument passed into the initialize method represents a data provider that will be passed to each of the selector handlers. The selector handlers can cast the argument to a specific type that can process native queries that is understandable by a specific data provider. The following snippet of code illustrates how the query operation can be invoked:

 // Create a CMDBf query operation object and have it initialized
 CMDBfQueryOperation cmdbfQueryOperation = new CMDBfQueryOperation();
 cmdbfQueryOperation.initialize(new SampleDataProvider());
		
 // Execute the query
 Query query = retrieveQuery();
 cmdbfQueryOperation.execute(query);	

Assuming retrieveQuery() will return a POJO representation of a CMDBf query.

Registration

The diagram below shows the relationship between the classes of the registration service. The APIs are very symmetric to the ones provided for the query service. An adopter will need to subscribe register handlers for specific MDR IDs. The subscribed register handlers will be invoked if the MDR ID of the registration request matches that of the ID associated with the handler.

RegistrationService-v2.png

The snippet of code below shows how a client can subscribe a registration handler. CustomRegistrationHandler is expected to be an implementation of IRegisterHandler.


 RegisterHandlerSubscription.getInstance().addHandler
 (
      new URI("http://cosmos.org/mdrId"), 
      new CustomRegistrationHandler()
 );

The default implementation of ICMDBfRegistrationOperation can be used to process a registration request. The snippet below shows how a client can use the operation:

 // Perform the initialization
 CMDBfRegistrationOperation registrationOperation = new CMDBfRegistrationOperation();
 registrationOperation.initialize(new SampleDataProvider());
	
 // Execute the operation
 Registration registration = retrieveRegistration();
 registrationOperation.execute(registration);

Assuming retrieveRegistration() will return a POJO representation of a CMDBf registration request.

Test Coverage

Unit tests will need to perform the following tests:

  • Transform a RegisterRequest POJO to XML and back to a POJO, and compare the start and end POJOs
  • Transform a RegisterResponse POJO to XML and back to a POJO, and compare the start and end POJOs
  • Process an empty query
  • Processing a query with just one item
  • Processing a query with a relationship and no items
  • Processing a query with matching items and an unmatched relationship
  • Processing a query with matching items and a matched relationship
  • Processing a query with a relationship that has cardinality
  • Processing a query with unregistered selector handlers
  • Processing an empty registration request
  • Processing a registration request with one item
  • Processing a registration request with matched items and missing relationship
  • Processing a registration request with matched items and a relationship
  • Processing a registration request with a relationship and no items
  • Processing a registration request with missing registration handlers

Task Breakdown

The following section includes the tasks required to complete this enhancement .

CMDBf-PertChart-v1.png


  1. Refactor plugin, package and class names in cmdbf.query plugin to represent the 5 different jar configurations
  2. Refactor the JUnits for the query transformation
  3. Create graph representation of registration request and response
  4. Create the registration input transformer
  5. Create the registration output transformer
  6. Add in JUnits for the registration transformer
  7. Add in the APIs for processing a CMDBf query
  8. Implement a generic implementation of the CMDBf query processor
  9. Add in JUnits for the CMDBf query APIs
  10. Modify the SML repository to make use of the new API set
  11. Add in the APIs for processing a CMDBf registration request
  12. Implement a generic implementation of the CMDBf registration processor
  13. Add in JUnits for the registration APIs

Open Issues/Questions

All reviewer feedback should go in the Talk page for 204959.


Back to the top