Hi,

I have bundled all the dependency jars into the
"tuscany-composite-diagram-0.0.1.jar", so that a user can execute the jar
from the command line. Following is the interface help:

You have 3 options:
---1) Default: Specify "Composite XML" file paths separated
---            by a space, with no arguments. This will
---            generate SVG and HTML output.
---     Eg: java -jar tuscany-composite-diagram-0.0.1.jar
---         //a//aa//a.composite //b//bb//b.composite
---
---2) SVG Only: Specify "Composite XML" file paths separated
---            by a space, with '-svg' argument.
---     Eg: java -jar tuscany-composite-diagram-0.0.1.jar -svg
---          //a//aa//a.composite //b//bb//b.composite
---
---3) HTML Only: Specify "Composite XML" file paths separated
---            by a space, with '-html' argument.
---     Eg: java -jar tuscany-composite-diagram-0.0.1.jar -html
---          //a//aa//a.composite //b//bb//b.composite
---

Code lives here:
https://svn.apache.org/repos/asf/tuscany/collaboration/GSoC-2011-Nirmal/

Here's a sample query and its result as printed in command line:

$ java -jar tuscany-composite-diagram-0.0.1.jar -svg
/media/798D-18B1/GSoC-2011/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/store.xml
/media/798D-18B1/GSoC-2011/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/Calculator.xml
--------------SVG Output for store--------------

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="
http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";
contentScriptType="text/ecmascript" zoomAndPan="magnify"
contentStyleType="text/css" viewBox="0 0 1800 820"
preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0"
alignment-baseline="middle" fill="#E5E5D0" width="1800" rx="20" ry="20"
height="820" stroke="#919191"/><rect x="200" y="100"
alignment-baseline="middle" fill="#E5E5E5" width="1400" rx="20" ry="20"
height="620" stroke="#919191"/><text x="220" font-size="15" y="120"
dominant-baseline="mathematical">store</text><rect x="400" y="200"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="400" font-size="15" y="350"
dominant-baseline="mathematical">Store</text><polygon fill="#00CD66"
points="380,210 410,210 425,225 410,240 380,240 395,225 "
stroke="#008B45"/><text x="380" font-size="15" y="209"
dominant-baseline="mathematical">Widget</text><polygon fill="#BF3EFF"
points="580,210 610,210 625,225 610,240 580,240 595,225 "
stroke="#68228B"/><text x="580" font-size="15" y="209"
dominant-baseline="mathematical">catalog</text><polygon fill="#BF3EFF"
points="580,250 610,250 625,265 610,280 580,280 595,265 "
stroke="#68228B"/><text x="580" font-size="15" y="249"
dominant-baseline="mathematical">shoppingCart</text><polygon fill="#BF3EFF"
points="580,290 610,290 625,305 610,320 580,320 595,305 "
stroke="#68228B"/><text x="580" font-size="15" y="289"
dominant-baseline="mathematical">shoppingTotal</text><rect x="800" y="200"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="800" font-size="15" y="350"
dominant-baseline="mathematical">Catalog</text><rect fill="#EEEE00" x="820"
width="20" height="20" y="190" stroke="#EEC900"/><text x="820"
font-size="15" y="189"
dominant-baseline="mathematical">currencyCode</text><polygon fill="#00CD66"
points="780,210 810,210 825,225 810,240 780,240 795,225 "
stroke="#008B45"/><text x="780" font-size="15" y="209"
dominant-baseline="mathematical">Catalog</text><polygon fill="#BF3EFF"
points="980,210 1010,210 1025,225 1010,240 980,240 995,225 "
stroke="#68228B"/><text x="980" font-size="15" y="209"
dominant-baseline="mathematical">currencyConverter</text><rect x="800"
y="460" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20"
height="130" stroke="#104E8B"/><text x="800" font-size="15" y="610"
dominant-baseline="mathematical">ShoppingCart</text><polygon fill="#00CD66"
points="780,470 810,470 825,485 810,500 780,500 795,485 "
stroke="#008B45"/><text x="780" font-size="15" y="469"
dominant-baseline="mathematical">Cart</text><polygon fill="#00CD66"
points="780,510 810,510 825,525 810,540 780,540 795,525 "
stroke="#008B45"/><text x="780" font-size="15" y="509"
dominant-baseline="mathematical">Total</text><rect x="1200" y="200"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="1200" font-size="15" y="350"
dominant-baseline="mathematical">CurrencyConverter</text><polygon
fill="#00CD66" points="1180,210 1210,210 1225,225 1210,240 1180,240 1195,225
" stroke="#008B45"/><text x="1180" font-size="15" y="209"
dominant-baseline="mathematical">CurrencyConverter</text><polyline
fill="none" stroke-width="2" points="625,305 645,305 645,525 795,525"
stroke="black"/><polyline fill="none" stroke-width="2" points="625,265
650,265 650,485 795,485" stroke="black"/><polyline fill="none"
stroke-width="2" points="625,225 795,225" stroke="black"/><polyline
fill="none" stroke-width="2" points="1025,225 1195,225"
stroke="black"/></svg>
-------------------------------------------------------------

--------------SVG Output for Calculator--------------

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="
http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink";
contentScriptType="text/ecmascript" zoomAndPan="magnify"
contentStyleType="text/css" viewBox="0 0 1400 1340"
preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0"
alignment-baseline="middle" fill="#E5E5D0" width="1400" rx="20" ry="20"
height="1340" stroke="#919191"/><rect x="200" y="100"
alignment-baseline="middle" fill="#E5E5E5" width="1000" rx="20" ry="20"
height="1140" stroke="#919191"/><text x="220" font-size="15" y="120"
dominant-baseline="mathematical">Calculator</text><rect x="400" y="200"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="400" font-size="15" y="350"
dominant-baseline="mathematical">CalculatorServiceComponent</text><polygon
fill="#00CD66" points="380,210 410,210 425,225 410,240 380,240 395,225 "
stroke="#008B45"/><text x="380" font-size="15" y="209"
dominant-baseline="mathematical">CalculatorService</text><polygon
fill="#BF3EFF" points="586,210 608,210 619,221 608,232 586,232 597,221 "
stroke="#68228B"/><text x="586" font-size="15" y="209"
dominant-baseline="mathematical">addService</text><polygon fill="#BF3EFF"
points="586,242 608,242 619,253 608,264 586,264 597,253 "
stroke="#68228B"/><text x="586" font-size="15" y="241"
dominant-baseline="mathematical">subtractService</text><polygon
fill="#BF3EFF" points="586,274 608,274 619,285 608,296 586,296 597,285 "
stroke="#68228B"/><text x="586" font-size="15" y="273"
dominant-baseline="mathematical">multiplyService</text><polygon
fill="#BF3EFF" points="586,306 608,306 619,317 608,328 586,328 597,317 "
stroke="#68228B"/><text x="586" font-size="15" y="305"
dominant-baseline="mathematical">divideService</text><rect x="800" y="200"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="800" font-size="15" y="350"
dominant-baseline="mathematical">AddServiceComponent</text><polygon
fill="#00CD66" points="780,210 810,210 825,225 810,240 780,240 795,225 "
stroke="#008B45"/><text x="780" font-size="15" y="209"
dominant-baseline="mathematical">AddService</text><rect x="800" y="460"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="800" font-size="15" y="610"
dominant-baseline="mathematical">SubtractServiceComponent</text><polygon
fill="#00CD66" points="780,470 810,470 825,485 810,500 780,500 795,485 "
stroke="#008B45"/><text x="780" font-size="15" y="469"
dominant-baseline="mathematical">SubtractService</text><rect x="800" y="720"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="800" font-size="15" y="870"
dominant-baseline="mathematical">MultiplyServiceComponent</text><polygon
fill="#00CD66" points="780,730 810,730 825,745 810,760 780,760 795,745 "
stroke="#008B45"/><text x="780" font-size="15" y="729"
dominant-baseline="mathematical">MultiplyService</text><rect x="800" y="980"
fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="800" font-size="15" y="1130"
dominant-baseline="mathematical">DivideServiceComponent</text><polygon
fill="#00CD66" points="780,990 810,990 825,1005 810,1020 780,1020 795,1005 "
stroke="#008B45"/><text x="780" font-size="15" y="989"
dominant-baseline="mathematical">DivideService</text><polyline fill="none"
stroke-width="2" points="619,221 639,221 639,225 795,225"
stroke="black"/><polyline fill="none" stroke-width="2" points="619,317
644,317 644,1005 795,1005" stroke="black"/><polyline fill="none"
stroke-width="2" points="619,285 649,285 649,745 795,745"
stroke="black"/><polyline fill="none" stroke-width="2" points="619,253
654,253 654,485 795,485" stroke="black"/></svg>
-------------------------------------------------------------


Thanks.

On Mon, Aug 15, 2011 at 8:27 PM, Nirmal Fernando <nirmal070...@gmail.com>wrote:

> Hi All,
>
> On Sat, Aug 13, 2011 at 12:05 PM, Nirmal Fernando 
> <nirmal070...@gmail.com>wrote:
>
>>
>>
>> On Thu, Aug 11, 2011 at 8:20 PM, Nirmal Fernando 
>> <nirmal070...@gmail.com>wrote:
>>
>>> Hi Jean,
>>>
>>> On Wed, Aug 10, 2011 at 11:16 AM, Jean-Sebastien Delfino <
>>> jsdelf...@apache.org> wrote:
>>>
>>>> Hi Nirmal,
>>>>
>>>> I've reviewed your latest update and it looks pretty good. I have a
>>>> few suggestions to make it even better:
>>>>
>>>> - Generate a simple HTML document around the SVG. That'll help set a
>>>> title for the document, a link to the original composite (assuming
>>>> it's online) and any other decoration you'd like to add around the
>>>> diagram.
>>>>
>>>
>>> I'll provide a HTML wrapper!
>>>
>>
>> I have added the HTML wrapper (
>> https://svn.apache.org/repos/asf/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java
>> ).
>>
>> I used Canvg (http://code.google.com/p/canvg/) which was released under
>> MIT license (compatible with Apache 2 license:
>> http://www.apache.org/legal/resolved.html#category-a) and I included the
>> two Java Script files of Canvg + the MIT license file under resources
>> directory (
>> https://svn.apache.org/repos/asf/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/resources/
>> ).
>>
>> I think there is a procedure when including source from another license,
>> which I am not familiar with!
>>
>
> I avoided using Canvg since, it is not needed. I modified the HTMLWrapper
> code (
> https://svn.apache.org/repos/asf/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java),
> now it's simply embedding the svg document, inside a HTML.
>
>>
>>
>>>
>>>
>>>>
>>>> - Use groups (<svg:g>) to nest the various shapes you're generating.
>>>> This should help simplify your code as you won't have to worry about
>>>> positioning related shapes (as they'll be naturally nested).
>>>>
>>>
>>> I'm not sure whether this is necessary, since the dimensions of artifacts
>>> changes dynamically (i.e. according to their quantity), I should position
>>> each artifact dynamically. You have different thoughts?
>>>
>>>
>>>>
>>>> - To help navigate nested composites and included composites, generate
>>>> links to their diagrams (perhaps you've already done that but I
>>>> couldn't see it with the example diagrams you've committed).
>>>>
>>>
>>> Ya, I've already done that, please see "MyValueComposite2_diagram.svg"
>>> from your web browser.
>>>
>>>
>>>>
>>>> - Position the titles below or above the services and references.
>>>> Right now they're kind of mixed with the services / references.
>>>>
>>>
>>> It was in displayed in the center of the services/references. I added
>>> them to top of each service/reference!
>>>
>>>
>>>>
>>>> These are only suggestions. Think about about them and decide yourself
>>>> if you think they're good ideas or not. At this point I think you know
>>>> better than me what's feasible and what makes more sense...
>>>>
>>>
>>> Thanks for the valuable thoughts!
>>>
>>>
>>>> --
>>>> Jean-Sebastien
>>>>
>>>> On Sat, Aug 6, 2011 at 12:04 PM, C.S. Nirmal J. Fernando (JIRA)
>>>> <dev@tuscany.apache.org> wrote:
>>>> >
>>>> >    [
>>>> https://issues.apache.org/jira/browse/TUSCANY-3496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080446#comment-13080446]
>>>> >
>>>> > C.S. Nirmal J. Fernando edited comment on TUSCANY-3496 at 8/6/11 7:03
>>>> PM:
>>>> >
>>>> --------------------------------------------------------------------------
>>>> >
>>>> > Hi All,
>>>> >
>>>> > I have almost finished implementing the necessary requirements of
>>>> Composite Diagram Generator as per now, and starting to testing the tool.
>>>> >
>>>> > You can find the code up to date from
>>>> https://svn.apache.org/repos/asf/tuscany/collaboration/GSoC-2011-Nirmal/
>>>> >
>>>> > Herewith I have attached 4 SVG images, created using the tool, and the
>>>> 4 attached composites files were created/modified just for the feature
>>>> validation process, thus may not be meaningful.
>>>> >
>>>> > Please download and open the SVG images using your web browser, then
>>>> only you'll get to see the 'inclusion' links working. Also you should place
>>>> all 4 SVG images in one place to get the links to work.
>>>> >
>>>> > PS: You may notice that the images are not scrollable, I couldn't find
>>>> a way to make SVG scrollable yet (I spent very little time on it ), for now
>>>> you may want to zoom in and out.
>>>>
>>>
>> I fixed this! :) Now you could see the whole diagram!
>>
>>
>>>  >
>>>> > Waiting for your comments!
>>>> >
>>>> > Thanks.
>>>> >
>>>> >      was (Author: nirmal):
>>>> >    Hi All,
>>>> >
>>>> > I have almost finished implementing the necessary requirements of
>>>> Composite Diagram Generator as per now, and starting to testing the tool.
>>>> >
>>>> > You can find the code up to date from
>>>> https://svn.apache.org/repos/asf/tuscany/collaboration/GSoC-2011-Nirmal/
>>>> >
>>>> > Herewith I have attached 4 SVG images, created using the tool, and the
>>>> 4 attached composites files were created/modified just for the feature
>>>> validation process, thus may not be meaningful.
>>>> >
>>>> > Please download and open the SVG images using your web browser, then
>>>> only you'll get to see the 'inclusion' links working. Also you should place
>>>> all 4 SVG images in one place to get the links to work.
>>>> >
>>>> > Waiting for your comments!
>>>> >
>>>> > Thanks.
>>>> >
>>>> >> Develop a simple tool that can be used to generate composite diagrams
>>>> from the xml files
>>>> >>
>>>> ----------------------------------------------------------------------------------------
>>>> >>
>>>> >>                 Key: TUSCANY-3496
>>>> >>                 URL:
>>>> https://issues.apache.org/jira/browse/TUSCANY-3496
>>>> >>             Project: Tuscany
>>>> >>          Issue Type: Wish
>>>> >>          Components: Java SCA Community Ideas
>>>> >>    Affects Versions: Java-SCA-1.x
>>>> >>            Reporter: Raymond Feng
>>>> >>            Assignee: C.S. Nirmal J. Fernando
>>>> >>              Labels: gsoc, gsoc2010, gsoc2011, mentor
>>>> >>         Attachments: Calculator.xml, Calculator_diagram.svg,
>>>> CompositeDiagramGeneratorUsingBatik-Maven.zip,
>>>> CompositeDiagramGeneratorUsingBatik.zip, MyValueComposite2.xml,
>>>> MyValueComposite2_diagram.svg, proposed_design_1.jpg, store.xml,
>>>> store_diagram.svg, supplychain.xml, supplychain_diagram.svg
>>>> >>
>>>> >>   Original Estimate: 1m
>>>> >>  Remaining Estimate: 1m
>>>> >>
>>>> >> I'm looking a simple tool (web based or command) that can generate
>>>> the composite diagrams from a list of composite files. One technology we 
>>>> can
>>>> try is the Apache Batik project.
>>>> >> http://xmlgraphics.apache.org/batik/
>>>> >> This tool can serve multiple purposes:
>>>> >> 1) Help document our tutorials and samples
>>>> >> 2) Be integrated with the SCA domain manager to visualize the SCA
>>>> domain (contributions, composites, nodes etc)
>>>> >
>>>> > --
>>>> > This message is automatically generated by JIRA.
>>>> > For more information on JIRA, see:
>>>> http://www.atlassian.com/software/jira
>>>> >
>>>> >
>>>> >
>>>>
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Nirmal
>>>
>>>
>>> C.S.Nirmal J. Fernando
>>> Department of Computer Science & Engineering,
>>> Faculty of Engineering,
>>> University of Moratuwa,
>>> Sri Lanka.
>>>
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>>
>> Thanks.
>>
>>
>> --
>> Best Regards,
>> Nirmal
>>
>> C.S.Nirmal J. Fernando
>> Department of Computer Science & Engineering,
>> Faculty of Engineering,
>> University of Moratuwa,
>> Sri Lanka.
>>
>> Blog: http://nirmalfdo.blogspot.com/
>>
>>
>
>
> --
> Best Regards,
> Nirmal
>
> C.S.Nirmal J. Fernando
> Department of Computer Science & Engineering,
> Faculty of Engineering,
> University of Moratuwa,
> Sri Lanka.
>
> Blog: http://nirmalfdo.blogspot.com/
>
>


-- 
Best Regards,
Nirmal

C.S.Nirmal J. Fernando
Department of Computer Science & Engineering,
Faculty of Engineering,
University of Moratuwa,
Sri Lanka.

Blog: http://nirmalfdo.blogspot.com/

Reply via email to