Saturday, April 9, 2011

Apache Tuscany - Develop a simple tool that can be used to generate composite diagrams

Apache Tuscany provides a comprehensive infrastructure to simplify the task of developing and managing Service Oriented Architecture (SOA) solutions based on Service Component Architecture (SCA) standard. Tuscany Java SCA is a lightweight runtime that is designed to run standalone or provisioned to different host environments.
Task is to implement a tool which generates composite diagrams from the composite files to illustrate the SCA artifacts and their wirings. SCA artifacts are composite, component, service, reference.
This tool can serve multiple purposes:
1) Help to document Tuscany's tutorials and samples.
2) Integrate with the SCA domain manager to visualize the SCA domain (contributions, composites, nodes etc).
Implementation Plan:
Composite XML should be generated using the Tuscany's in-memory representation of the composite model. It will then give as an input for the Composite Analyser. Composite Analyser is not a single object but the whole program itself as a single unit. Composite Analyser then analyses the XML document and grab the relevant DOM Elements such as CompositeComponentServiceReferencePropertyWire, Text etc. and starts to build the SVG document using SVG DOM API of Apache Batik.
Basically Composite Analyser contains three objects, CompositeFileReader, LayoutBuilder, and SVGDocumentBuilder.
  • CompositeFileReader is responsible for reading the input composite XML file and provide the necessary details to LayoutBuilder.
  • LayoutBuilder then builds a layout which uses the space optimally and provides the details of positions and sizes of each artifact to SVGDocumentBuilder. I already researched on few layout building algorithms and tools (JGraphX) but further research will be done and will pick the most appropriate algorithm.
  • SVGDocumentBuilder creates the DOM Elements according to the layout and builds the final SVG composite diagram.
Since DOM elements (Composite, Component, Service, Reference, Property, Wire, Text etc.) will be used multiple times in order to build a single diagram, I am planning to create separate objects for those elements. Each object is responsible for creating its own element according to the requirement and giving it to the SVGDocumentBuilder. Most of the artifacts will hold a same structure and behaviour, therefore I have implemented following class diagram for the prototype.
In the prototype I built to create a SVG diagram using Apache Batik I used following SVG elements for each artifact mentioned above.
  • Composite, Component: “rect” SVG elements with rounded corners
  • Property: “rect” SVG element with equal height and width
  • Reference: “polygon” SVG element with 6 vertices and coordination of point B of the following sketch should be given to the addElement method.
  • Service: “polygon” SVG element with 6 vertices and coordination of point A of the following sketch should be given to the addElement method.
  • Wire: “polyline” SVG element used to connect a Reference and a Service object.
  • Text: “text” SVG element used to add a given text 
Following image shows a sample composite diagram which is built using Apache Batik as a prototype for this project after converting to PNG format. 
  1. Code of the tool which will be built.
  2. Tests to verify the accuracy of the diagrams generated.
  3. User documentation on operation of the tool and sample diagrams generated. 
Till May 10
  • Read on Tuscany SCA Java, understand the design, and concentrate on project relevant parts
  • Read on Scalable Vector Graphics (SVG) 1.1
  • Read on Apache Batik and write examples to get familiar
  • Recognize all the artifacts of SCA.
  • Research on layout building algorithms and tools and find out the appropriate algorithm 
May 11 - May 24
  • Finalize the process view after getting the comments from the developers’ community and from my mentor.
  • Start initial implementations - building artifact structures 
May 24 - July 10
  • Preparing for the mid-term evaluation of the project.  
July 12 - August 15
  • Implement Composite Analyzer
  • Improve performance by using parallel design patterns.
  • Develop test cases to verify the accuracy of the generated diagrams. 
August 16 - August 22
  • Wrap up the work done, and polishing up the code.
  • Preparing for the final evaluation. 
August 26
  • Final evaluation deadline.
Community Interactions:
Apache Tuscany developers’ community is the main community behind this project and I highly appreciate comments/ ideas of the expert developers of Tuscany and consider those as a great opportunity to learn and contribute more and more to the improvement of Tuscany.
I am Nirmal Fernando, final year undergraduate at Department of Computer Science and Engineering at University of Moratuwa, Sri Lanka. I am very competent at Java programming language, OOP, XML, XSL and data structures and algorithms. I am familiar with SOA concepts and web services.
I participated in GSoC 2010 for Apache Derby (RDBMS in Java) project and successfully finished the project. This is a sample of the work (final output) which I've done for Derby last summer (
You can find my profile and recommendations at LinkedIn (
I am looking forward to have an exciting summer with Apache Tuscany, and I consider this is a great opportunity to me, to apply my knowledge and skills into a real world application which benefits many people around the globe.