summaryrefslogtreecommitdiffstats
path: root/collaboration
diff options
context:
space:
mode:
authornirmal070125 <nirmal070125@13f79535-47bb-0310-9956-ffa450edef68>2011-08-06 18:20:14 +0000
committernirmal070125 <nirmal070125@13f79535-47bb-0310-9956-ffa450edef68>2011-08-06 18:20:14 +0000
commit94ef23a1a25f056e0bf8f96d4bb97312ebc86f8b (patch)
tree826dcc8ec895387eecec1be765c0b73f2f02d7b1 /collaboration
parent3b3beac5adfa1995a9a4c92fd92a881f024be08e (diff)
added support to inclusion, added a test case to demonstrate layout algorithm
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1154566 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'collaboration')
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml4
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg1
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg2
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java8
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java83
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java16
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java41
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java17
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java4
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java52
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java306
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java18
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java45
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java33
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/test/layout/LayoutBuilderTest.java144
20 files changed, 563 insertions, 221 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
index 1cbc78b56d..722bdeb0a5 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
@@ -8,7 +8,9 @@
name="MyValueComposite2" >
-
+ <include name="store"/>
+ <include name="Calculator"/>
+ <include name="supplychain"/>
<service name="MyValueService" promote="MyValueServiceComponent">
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
index c029859d70..76052e23f7 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="1240" stroke="#919191"/><text x="500" font-size="10" dominant-baseline="mathematical" y="20" text-anchor="middle">CalculatorTest</text><rect x="200" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="250" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">CalculatorServiceComponent</text><polygon fill="#00CD66" points="180,210 210,210 225,225 210,240 180,240 195,225 " stroke="#008B45"/><text x="180" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><polygon fill="#BF3EFF" points="386,210 408,210 419,221 408,232 386,232 397,221 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="221" text-anchor="middle">subtractService</text><polygon fill="#BF3EFF" points="386,242 408,242 419,253 408,264 386,264 397,253 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="253" text-anchor="middle">divideService</text><polygon fill="#BF3EFF" points="386,274 408,274 419,285 408,296 386,296 397,285 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="285" text-anchor="middle">multiplyService</text><polygon fill="#BF3EFF" points="386,306 408,306 419,317 408,328 386,328 397,317 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="317" text-anchor="middle">addService</text><rect x="600" y="980" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="1130" text-anchor="middle">AddServiceComponent</text><polygon fill="#00CD66" points="580,990 610,990 625,1005 610,1020 580,1020 595,1005 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="1005" text-anchor="middle"></text><rect x="600" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">SubtractServiceComponent</text><polygon fill="#00CD66" points="580,210 610,210 625,225 610,240 580,240 595,225 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><rect x="600" y="720" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="870" text-anchor="middle">MultiplyServiceComponent</text><polygon fill="#00CD66" points="580,730 610,730 625,745 610,760 580,760 595,745 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="745" text-anchor="middle"></text><rect x="600" y="460" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="610" text-anchor="middle">DivideServiceComponent</text><polygon fill="#00CD66" points="580,470 610,470 625,485 610,500 580,500 595,485 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="485" text-anchor="middle"></text><polyline stroke-width="2" points="419,317 595,1005" stroke="black"/><polyline stroke-width="2" points="419,253 595,485" stroke="black"/><polyline stroke-width="2" points="419,285 595,745" stroke="black"/><polyline stroke-width="2" points="419,221 595,225" stroke="black"/></svg> \ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1400" rx="20" ry="20" height="1340" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="1140" stroke="#919191"/><text x="700" font-size="20" y="120" dominant-baseline="mathematical">CalculatorTest</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="20" 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="20" y="225" 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="20" y="221" 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="20" y="253" 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="20" y="285" 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="20" y="317" 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="20" 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="20" y="225" 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="20" 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="20" y="485" 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="20" 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="20" y="745" 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="20" 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="20" y="1005" 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 639,317 639,1005 795,1005" stroke="black"/><polyline fill="none" stroke-width="2" points="619,285 639,285 639,745 795,745" stroke="black"/><polyline fill="none" stroke-width="2" points="619,253 639,253 639,485 795,485" stroke="black"/></svg> \ No newline at end of file
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
index 6ba9f5c579..70540cfe70 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="1240" stroke="#919191"/><text x="500" font-size="10" dominant-baseline="mathematical" y="20" text-anchor="middle">Calculator</text><rect x="200" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="250" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">CalculatorServiceComponent</text><polygon fill="#00CD66" points="180,210 210,210 225,225 210,240 180,240 195,225 " stroke="#008B45"/><text x="180" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><polygon fill="#BF3EFF" points="386,210 408,210 419,221 408,232 386,232 397,221 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="221" text-anchor="middle">subtractService</text><polygon fill="#BF3EFF" points="386,242 408,242 419,253 408,264 386,264 397,253 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="253" text-anchor="middle">divideService</text><polygon fill="#BF3EFF" points="386,274 408,274 419,285 408,296 386,296 397,285 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="285" text-anchor="middle">multiplyService</text><polygon fill="#BF3EFF" points="386,306 408,306 419,317 408,328 386,328 397,317 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical" y="317" text-anchor="middle">addService</text><rect x="600" y="980" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="1130" text-anchor="middle">AddServiceComponent</text><polygon fill="#00CD66" points="580,990 610,990 625,1005 610,1020 580,1020 595,1005 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="1005" text-anchor="middle"></text><rect x="600" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">SubtractServiceComponent</text><polygon fill="#00CD66" points="580,210 610,210 625,225 610,240 580,240 595,225 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><rect x="600" y="720" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="870" text-anchor="middle">MultiplyServiceComponent</text><polygon fill="#00CD66" points="580,730 610,730 625,745 610,760 580,760 595,745 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="745" text-anchor="middle"></text><rect x="600" y="460" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="610" text-anchor="middle">DivideServiceComponent</text><polygon fill="#00CD66" points="580,470 610,470 625,485 610,500 580,500 595,485 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="485" text-anchor="middle"></text><polyline stroke-width="2" points="419,317 595,1005" stroke="black"/><polyline stroke-width="2" points="419,253 595,485" stroke="black"/><polyline stroke-width="2" points="419,285 595,745" stroke="black"/><polyline stroke-width="2" points="419,221 595,225" stroke="black"/></svg> \ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1400" rx="20" ry="20" height="1340" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="1140" stroke="#919191"/><text x="700" 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="225" 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="221" 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="253" 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="285" 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="317" 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="225" 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="485" 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="745" 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="1005" 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"/><rect x="205" y="1170" alignment-baseline="central" fill="#E5E5C0" width="990" rx="20" ry="20" height="65" stroke="#919191"/><text x="210" font-size="15" y="1180" dominant-baseline="mathematical">Included Composites</text><text x="210" font-size="15" y="1205" dominant-baseline="mathematical"></text></svg> \ No newline at end of file
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
new file mode 100755
index 0000000000..9616f4fb2d
--- /dev/null
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1400" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="360" stroke="#919191"/><text x="700" font-size="15" y="120" dominant-baseline="mathematical">MyValueComposite2</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">MyValueServiceComponent</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="225" dominant-baseline="mathematical">myValueService</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="225" dominant-baseline="mathematical">stockQuoteService</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="265" dominant-baseline="mathematical">customerService</text><rect fill="#EEEE00" x="420" width="20" height="20" y="190" stroke="#EEC900"/><text x="420" font-size="15" y="190" dominant-baseline="mathematical">currency</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">StockQuoteMediatorComponent</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="225" dominant-baseline="mathematical">SQMediator</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="225" dominant-baseline="mathematical">stockQuoteService</text><rect fill="#EEEE00" x="820" width="20" height="20" y="190" stroke="#EEC900"/><text x="820" font-size="15" y="190" dominant-baseline="mathematical">currency</text><polygon fill="#00CD66" points="140,130 230,130 275,175 230,220 140,220 185,175 " stroke="#008B45"/><text x="140" font-size="15" y="175" dominant-baseline="mathematical">MyValueService</text><polygon fill="#BF3EFF" points="1140,130 1230,130 1275,175 1230,220 1140,220 1185,175 " stroke="#68228B"/><text x="1140" font-size="15" y="175" dominant-baseline="mathematical">CustomerService</text><polygon fill="#BF3EFF" points="1140,250 1230,250 1275,295 1230,340 1140,340 1185,295 " stroke="#68228B"/><text x="1140" font-size="15" y="295" dominant-baseline="mathematical">StockQuoteService</text><polyline fill="none" stroke-width="2" points="625,225 795,225" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" points="1025,225 1050,225 1050,295 1185,295" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" points="625,265 655,265 655,175 1185,175" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" points="275,175 310,175 310,225 395,225" stroke="black"/><rect x="205" y="390" alignment-baseline="central" fill="#E5E5C0" width="990" rx="20" ry="20" height="65" stroke="#919191"/><text x="210" font-size="15" y="400" dominant-baseline="mathematical">Included Composites</text><text x="210" font-size="15" y="425" dominant-baseline="mathematical"><a xlink:href="store_diagram.svg" xlink:actuate="onRequest" xlink:type="simple" xlink:show="new" xmlns:xlink="http://www.w3.org/1999/xlink"> store ,</a><a xlink:href="Calculator_diagram.svg" xlink:actuate="onRequest" xlink:type="simple" xlink:show="new" xmlns:xlink="http://www.w3.org/1999/xlink"> Calculator ,</a><a xlink:href="supplychain_diagram.svg" xlink:actuate="onRequest" xlink:type="simple" xlink:show="new" xmlns:xlink="http://www.w3.org/1999/xlink"> supplychain ,</a></text></svg> \ No newline at end of file
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg
index b37a777601..46eea2290d 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0" overflow="visible"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5E5" width="1450" rx="20" ry="20" height="770" stroke="#919191"/><text x="725" font-size="20" dominant-baseline="mathematical" y="20" text-anchor="middle">store</text><rect x="250" y="250" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="300" font-size="20" dominant-baseline="mathematical" y="400" text-anchor="middle">Store</text><polygon fill="#00CD66" points="230,260 260,260 275,275 260,290 230,290 245,275 " stroke="#008B45"/><text x="230" font-size="20" dominant-baseline="mathematical" y="275" text-anchor="middle">Widget</text><polygon fill="#BF3EFF" points="430,260 460,260 475,275 460,290 430,290 445,275 " stroke="#68228B"/><text x="430" font-size="20" dominant-baseline="mathematical" y="275" text-anchor="middle">catalog</text><polygon fill="#BF3EFF" points="430,300 460,300 475,315 460,330 430,330 445,315 " stroke="#68228B"/><text x="430" font-size="20" dominant-baseline="mathematical" y="315" text-anchor="middle">shoppingCart</text><polygon fill="#BF3EFF" points="430,340 460,340 475,355 460,370 430,370 445,355 " stroke="#68228B"/><text x="430" font-size="20" dominant-baseline="mathematical" y="355" text-anchor="middle">shoppingTotal</text><rect x="650" y="250" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="700" font-size="20" dominant-baseline="mathematical" y="400" text-anchor="middle">Catalog</text><polygon fill="#00CD66" points="630,260 660,260 675,275 660,290 630,290 645,275 " stroke="#008B45"/><text x="630" font-size="20" dominant-baseline="mathematical" y="275" text-anchor="middle">Catalog</text><polygon fill="#BF3EFF" points="830,260 860,260 875,275 860,290 830,290 845,275 " stroke="#68228B"/><text x="830" font-size="20" dominant-baseline="mathematical" y="275" text-anchor="middle">currencyConverter</text><rect fill="#EEEE00" x="670" width="20" height="20" y="240" stroke="#EEC900"/><text x="670" font-size="20" dominant-baseline="mathematical" y="240" text-anchor="middle">currencyCode</text><rect x="650" y="510" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="700" font-size="20" dominant-baseline="mathematical" y="660" text-anchor="middle">ShoppingCart</text><polygon fill="#00CD66" points="630,520 660,520 675,535 660,550 630,550 645,535 " stroke="#008B45"/><text x="630" font-size="20" dominant-baseline="mathematical" y="535" text-anchor="middle">Cart</text><polygon fill="#00CD66" points="630,560 660,560 675,575 660,590 630,590 645,575 " stroke="#008B45"/><text x="630" font-size="20" dominant-baseline="mathematical" y="575" text-anchor="middle">Total</text><rect x="1050" y="250" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1100" font-size="20" dominant-baseline="mathematical" y="400" text-anchor="middle">CurrencyConverter</text><polygon fill="#00CD66" points="1030,260 1060,260 1075,275 1060,290 1030,290 1045,275 " stroke="#008B45"/><text x="1030" font-size="20" dominant-baseline="mathematical" y="275" text-anchor="middle">CurrencyConverter</text><polyline stroke-width="2" points="475,355 645,575" stroke="black"/><polyline stroke-width="2" points="475,315 645,535" stroke="black"/><polyline stroke-width="2" points="475,275 645,275" stroke="black"/><polyline stroke-width="2" points="875,275 1045,275" stroke="black"/></svg>
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1800" rx="20" ry="20" height="820" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1400" rx="20" ry="20" height="620" stroke="#919191"/><text x="900" 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="225" 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="225" 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="265" 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="305" 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><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="225" 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="225" dominant-baseline="mathematical">currencyConverter</text><rect fill="#EEEE00" x="820" width="20" height="20" y="190" stroke="#EEC900"/><text x="820" font-size="15" y="190" dominant-baseline="mathematical">currencyCode</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="485" 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="525" 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="225" 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"/><rect x="205" y="650" alignment-baseline="central" fill="#E5E5C0" width="1390" rx="20" ry="20" height="65" stroke="#919191"/><text x="210" font-size="15" y="660" dominant-baseline="mathematical">Included Composites</text><text x="210" font-size="15" y="685" dominant-baseline="mathematical"></text></svg> \ No newline at end of file
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg
index d74fd8a16c..a56a2c1c79 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/supplychain_diagram.svg
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="2200" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1800" rx="20" ry="20" height="360" stroke="#919191"/><text x="1100" font-size="20" dominant-baseline="mathematical" y="120" text-anchor="middle">supplychain</text><rect x="400" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="450" font-size="20" dominant-baseline="mathematical" y="350" text-anchor="middle">CustomerComponent</text><polygon fill="#00CD66" points="380,210 410,210 425,225 410,240 380,240 395,225 " stroke="#008B45"/><text x="380" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">CustomerComponent</text><polygon fill="#BF3EFF" points="580,210 610,210 625,225 610,240 580,240 595,225 " stroke="#68228B"/><text x="580" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">retailer</text><rect x="800" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="850" font-size="20" dominant-baseline="mathematical" y="350" text-anchor="middle">RetailerComponent</text><polygon fill="#00CD66" points="780,210 810,210 825,225 810,240 780,240 795,225 " stroke="#008B45"/><text x="780" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">RetailerComponent</text><polygon fill="#BF3EFF" points="980,210 1010,210 1025,225 1010,240 980,240 995,225 " stroke="#68228B"/><text x="980" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">warehouse</text><rect x="1200" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1250" font-size="20" dominant-baseline="mathematical" y="350" text-anchor="middle">WarehouseComponent</text><polygon fill="#00CD66" points="1180,210 1210,210 1225,225 1210,240 1180,240 1195,225 " stroke="#008B45"/><text x="1180" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">WarehouseComponent</text><polygon fill="#BF3EFF" points="1380,210 1410,210 1425,225 1410,240 1380,240 1395,225 " stroke="#68228B"/><text x="1380" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">shipper</text><rect x="1600" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1650" font-size="20" dominant-baseline="mathematical" y="350" text-anchor="middle">ShipperComponent</text><polygon fill="#00CD66" points="1580,210 1610,210 1625,225 1610,240 1580,240 1595,225 " stroke="#008B45"/><text x="1580" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">ShipperComponent</text><polygon fill="#BF3EFF" points="1780,210 1810,210 1825,225 1810,240 1780,240 1795,225 " stroke="#68228B"/><text x="1780" font-size="20" dominant-baseline="mathematical" y="225" text-anchor="middle">customer</text><polyline stroke-width="2" points="625,225 795,225" stroke="black"/><polyline stroke-width="2" points="1025,225 1195,225" stroke="black"/><polyline stroke-width="2" points="1425,225 1595,225" stroke="black"/><polyline stroke-width="2" points="1825,225 395,225" stroke="black"/></svg> \ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="2200" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1800" rx="20" ry="20" height="360" stroke="#919191"/><text x="1100" font-size="15" y="120" dominant-baseline="mathematical">supplychain</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">CustomerComponent</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="225" dominant-baseline="mathematical">CustomerComponent</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="225" dominant-baseline="mathematical">retailer</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">RetailerComponent</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="225" dominant-baseline="mathematical">RetailerComponent</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="225" dominant-baseline="mathematical">warehouse</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">WarehouseComponent</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="225" dominant-baseline="mathematical">WarehouseComponent</text><polygon fill="#BF3EFF" points="1380,210 1410,210 1425,225 1410,240 1380,240 1395,225 " stroke="#68228B"/><text x="1380" font-size="15" y="225" dominant-baseline="mathematical">shipper</text><rect x="1600" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1600" font-size="15" y="350" dominant-baseline="mathematical">ShipperComponent</text><polygon fill="#00CD66" points="1580,210 1610,210 1625,225 1610,240 1580,240 1595,225 " stroke="#008B45"/><text x="1580" font-size="15" y="225" dominant-baseline="mathematical">ShipperComponent</text><polygon fill="#BF3EFF" points="1780,210 1810,210 1825,225 1810,240 1780,240 1795,225 " stroke="#68228B"/><text x="1780" font-size="15" y="225" dominant-baseline="mathematical">customer</text><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"/><polyline fill="none" stroke-width="2" points="1425,225 1595,225" stroke="black"/><polyline fill="none" stroke-width="2" points="1825,225 1860,225 1860,155 360,155 360,225 395,225" stroke="black"/><rect x="205" y="390" alignment-baseline="central" fill="#E5E5C0" width="1790" rx="20" ry="20" height="65" stroke="#919191"/><text x="210" font-size="15" y="400" dominant-baseline="mathematical">Included Composites</text><text x="210" font-size="15" y="425" dominant-baseline="mathematical"></text></svg> \ No newline at end of file
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java
index 66f99a739b..e42baa68ee 100644
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java
@@ -51,9 +51,9 @@ public class Composite extends Artifact{
return rectangle;
}
- //OBSOLETE
- public Element addElement(Document document, String svgNs, int x, int y) {
- return null;
- }
+// //OBSOLETE
+// public Element addElement(Document document, String svgNs, int x, int y) {
+// return null;
+// }
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
index c9381c9d50..9fc9144f5f 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
@@ -24,54 +24,61 @@ import org.w3c.dom.Element;
public class DashedWire extends Wire{
-
- public Element addElement(Document document, String svgNs,
- Reference aReference1, Reference aReference2){
+ @Override
+ public Element addElement(Document document, String svgNs, Object a,
+ Object b, int changingFactor, String color) {
Element polyline = document.createElementNS(svgNs, "polyline");
- int x1=aReference1.getxCoordinate()+aReference1.getHeight()*3/2;
- int y1=aReference1.getyCoordinate()+aReference1.getHeight()/2;
+ int x1=0,x2=0,y1=0,y2=0;
- int x2=aReference2.getxCoordinate()+aReference2.getHeight()/2;
- int y2=aReference2.getyCoordinate()+aReference2.getHeight()/2;
- //polyline.setAttributeNS(null,"class", "Connect");
- polyline.setAttributeNS(null, "points", x1+","+
- y1+" "+x2+","+y2
- );
- polyline.setAttributeNS(null, "stroke", "black");
- polyline.setAttributeNS(null, "stroke-dasharray", "3 3");
- polyline.setAttributeNS(null, "stroke-width", "2");
+ if(a instanceof Service && b instanceof Service){
+
+ Service aService1 = (Service)a;
+ Service aService2 = (Service)b;
+
+ x1=aService1.getxCoordinate()+aService1.getHeight()*3/2;
+ y1=aService1.getyCoordinate()+aService1.getHeight()/2;
+
+ x2=aService2.getxCoordinate()+aService2.getHeight()/2;
+ y2=aService2.getyCoordinate()+aService2.getHeight()/2;
+
+ }
- return polyline;
- }
+ else if(a instanceof Reference && b instanceof Reference){
+
+ Reference aReference1 = (Reference)a;
+ Reference aReference2 = (Reference)b;
+
+ x1=aReference1.getxCoordinate()+aReference1.getHeight()*3/2;
+ y1=aReference1.getyCoordinate()+aReference1.getHeight()/2;
+
+ x2=aReference2.getxCoordinate()+aReference2.getHeight()/2;
+ y2=aReference2.getyCoordinate()+aReference2.getHeight()/2;
+
+ }
+
+ polyline = setWireAttributes(x1, y1, x2, y2, polyline, changingFactor, color);
- public Element addElement(Document document, String svgNs,
- Service aService1, Service aService2){
-
- Element polyline = document.createElementNS(svgNs, "polyline");
- int x1=aService1.getxCoordinate()+aService1.getHeight()*3/2;
- int y1=aService1.getyCoordinate()+aService1.getHeight()/2;
-
- int x2=aService2.getxCoordinate()+aService2.getHeight()/2;
- int y2=aService2.getyCoordinate()+aService2.getHeight()/2;
- //polyline.setAttributeNS(null,"class", "Connect");
- polyline.setAttributeNS(null, "points", x1+","+
- y1+" "+x2+","+y2
- );
- polyline.setAttributeNS(null, "stroke", "black");
polyline.setAttributeNS(null, "stroke-dasharray", "3 3");
- polyline.setAttributeNS(null, "stroke-width", "2");
return polyline;
}
-
- @Override
- public Element addElement(Document document, String svgNs,
- Reference aReference, Service aService) {
- // TODO Auto-generated method stub
- return null;
- }
+
+ /**
+ * <script type="text/ecmascript"><![CDATA[
+ <SCRIPT LANGUAGE="JavaScript">
+
+var test = document.open("store_diagram.svg");
+
+</SCRIPT>
+ ]]></script>
+
+<!--rect x="0" y="0" alignment-baseline="central" fill="#E5E5D0" width="1400" rx="20" ry="20" height="560" stroke="#919191"/><rect x="200" y="100" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="360" stroke="#919191"/><text x="700" font-size="20" dominant-baseline="mathematical" y="120" text-anchor="middle">
+
+<a xlink:href="store_diagram.svg" xlink:show="new">MyValueComposite2</a></text-->
+
+ */
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java
index 36d3d29f20..22ec76ff09 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Layer.java
@@ -23,7 +23,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- * Structure of a "Composite" element in SCA, as a SVG element
+ * Structure of a "Outermost layer" : not a SCA artifact
*
*/
public class Layer extends Artifact{
@@ -50,10 +50,14 @@ public class Layer extends Artifact{
return rectangle;
}
-
- //OBSOLETE
- public Element addElement(Document document, String svgNs, int x, int y) {
- return null;
- }
+ public Element addElement(Document document, String svgNs, int x, int y,
+ int height, int width, String fillColor) {
+
+ Element rect = addElement(document, svgNs, x, y, height, width);
+ rect.setAttributeNS(null, "fill", fillColor);
+
+ return rect;
+ }
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java
new file mode 100755
index 0000000000..e03edfd0e2
--- /dev/null
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Link.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.impl.artifacts;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * An "a" element to link two SVG diagrams: not a SCA artifact
+ *
+ */
+public class Link {
+
+ public Element addElement(Document document, String svgNs, String fileName, String compName) {
+
+ Element link = document.createElementNS(svgNs, "a");
+ link.setAttributeNS(null, "xlink:href", fileName);
+ link.setAttributeNS(null, "xlink:show", "new");
+ link.setTextContent(" "+compName + " ,");
+
+ return link;
+ }
+
+}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
index 5ceece65bc..54fe2f5d04 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
@@ -24,9 +24,12 @@ import org.w3c.dom.Element;
public class NormalWire extends Wire{
-
- public Element addElement(Document document, String svgNs,
- Reference aReference, Service aService){
+ @Override
+ public Element addElement(Document document, String svgNs, Object a,
+ Object b, int changingFactor, String color) {
+
+ Reference aReference = (Reference)a;
+ Service aService = (Service)b;
Element polyline = document.createElementNS(svgNs, "polyline");
int x1=aReference.getxCoordinate()+aReference.getHeight()*3/2;
@@ -34,12 +37,8 @@ public class NormalWire extends Wire{
int x2=aService.getxCoordinate()+aService.getHeight()/2;
int y2=aService.getyCoordinate()+aService.getHeight()/2;
- //polyline.setAttributeNS(null,"class", "Connect");
- polyline.setAttributeNS(null, "points", x1+","+
- y1+" "+x2+","+y2
- );
- polyline.setAttributeNS(null, "stroke", "black");
- polyline.setAttributeNS(null, "stroke-width", "2");
+
+ polyline = setWireAttributes(x1, y1, x2, y2, polyline, changingFactor, color);
return polyline;
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
index 7457084eb6..40edf226c0 100644
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java
@@ -29,9 +29,9 @@ public class Text {
Element text = document.createElementNS(svgNs, "text");
text.setAttributeNS(null, "x", x+"");
text.setAttributeNS(null, "y", y+"");
- text.setAttributeNS(null, "text-anchor", "middle");
+ //text.setAttributeNS(null, "text-anchor", "middle");
text.setAttributeNS(null, "dominant-baseline", "mathematical");
- text.setAttributeNS(null, "font-size", "20");
+ text.setAttributeNS(null, "font-size", "15");
text.setTextContent(content);
return text;
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java
index 9c91ccc361..e173365f4a 100644
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Wire.java
@@ -23,26 +23,42 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public abstract class Wire {
-
-
+
public abstract Element addElement(Document document, String svgNs,
- Reference aReference, Service aService); //{
+ Object a, Object b, int changingFactor, String color);
+
+ public Element setWireAttributes(int x1, int y1, int x2, int y2,
+ Element polyline, int changingFactor, String color){
+
+ if(y1 == y2 && x2>x1){
+ polyline.setAttributeNS(null, "points", x1+","+
+ y1+" "+x2+","+y2
+ );
+ }
+ else if(y1 == y2 && x1>x2){
+ polyline.setAttributeNS(null, "points", x1+","+
+ y1+" "+(x1+changingFactor)+","+y1
+ +" "+(x1+changingFactor)+","+(y1-(changingFactor*2))
+ +" "+(x2-changingFactor)+","+(y1-(changingFactor*2))
+ +" "+(x2-changingFactor)+","+(y1)
+ +" "+(x2)+","+(y1)
+ );
+
+ }
+ else{
+ polyline.setAttributeNS(null, "points", x1+","+
+ y1+" "+(x1+changingFactor)+","+y1
+ +" "+(x1+changingFactor)+","+y2
+ +" "+x2+","+y2
+ );
+ }
+
+ polyline.setAttributeNS(null, "stroke", color);
+ polyline.setAttributeNS(null, "stroke-width", "2");
+ polyline.setAttributeNS(null, "fill", "none");
-// Element polyline = document.createElementNS(svgNs, "polyline");
-// int x1=aReference.getxCoordinate()+aReference.getHeight()*3/2;
-// int y1=aReference.getyCoordinate()+aReference.getHeight()/2;
-//
-// int x2=aService.getxCoordinate()+aService.getHeight()/2;
-// int y2=aService.getyCoordinate()+aService.getHeight()/2;
-// //polyline.setAttributeNS(null,"class", "Connect");
-// polyline.setAttributeNS(null, "points", x1+","+
-// y1+" "+x2+","+y2
-// );
-// polyline.setAttributeNS(null, "stroke", "black");
-// polyline.setAttributeNS(null, "stroke-width", "2");
-//
-// return polyline;
-// }
+ return polyline;
+ }
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
index 742575f501..57b9ffea40 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
@@ -20,6 +20,7 @@
package org.apache.tuscany.sca.impl.diagram;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.Map.Entry;
@@ -28,6 +29,7 @@ import org.apache.tuscany.sca.impl.artifacts.Component;
import org.apache.tuscany.sca.impl.artifacts.Composite;
import org.apache.tuscany.sca.impl.artifacts.DashedWire;
import org.apache.tuscany.sca.impl.artifacts.Layer;
+import org.apache.tuscany.sca.impl.artifacts.Link;
import org.apache.tuscany.sca.impl.artifacts.NormalWire;
import org.apache.tuscany.sca.impl.artifacts.Property;
import org.apache.tuscany.sca.impl.artifacts.Reference;
@@ -42,69 +44,77 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class DiagramGenerator {
-
+
private CompositeEntity comp;
-// private Entity[] entities;
-// private int height, width;
private Document doc;
-// private String compositeName;
private String svgNS ;
private Element svgRoot;
private ArrayList<Reference> refs= new ArrayList<Reference>();
private ArrayList<Service> sers= new ArrayList<Service>();
+
+ private int lastUsedChangingFactor = 0;
+ enum changingFactor{a(20), b(25), c(30), d(35), e(40), f(15);
+
+ private final int val;
+
+ private changingFactor(int x){
+ val = x;
+ }
+
+ public int getVal(){
+ return val;
+ }
+
+ };
+
+ enum color {black}//, violet, red, green};
+ private int previousWireColor = 0;
/**
- * Constructor to generate a SVG diagram for compositeName
- * with a given height and a width and consisting of entities.
+ * Constructor to generate a SVG diagram for a given CompositeEntity
+ * Object.
*/
public DiagramGenerator(CompositeEntity comp) {
+
this.comp = comp;
-// this.entities = comp.getComponentList();
-// this.height = comp.getHeight();
-// this.width = comp.getWidth();
-// this.compositeName = comp.getName();
-// comp.getServices();
+
}
-
+
/**
* Draws the diagram.
*/
public Document buildSVGDocument(){
-
+
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
doc = impl.createDocument(svgNS, "svg", null);
// Get the root element (the 'svg' element).
svgRoot = doc.getDocumentElement();
-
-// svgRoot.setAttributeNS(null, "width", ""+(width+400));
-// svgRoot.setAttributeNS(null, "height", ""+(height+200));
-
+
addLayer();
addComposite();
-
-
- for(Entity ent: comp.getComponentList()){
-
+
+ for(ComponentEntity ent: comp.getComponentList()){
+
addComponent(ent);
- addService(ent);
- addReference(ent);
- addProperties(ent);
+ addComponentService(ent);
+ addComponentReference(ent);
+ addComponentProperties(ent);
}
-
- addCompositeService(comp);
- addCompositeReference(comp);
- addCompositeProperties(comp);
-
+
+ addCompositeService();
+ addCompositeReference();
+ addCompositeProperties();
+
addComponentConnections();
addReferencePromotion();
addServicePromotion();
+ addInclusions();
+
return doc;
}
-
-
private void addLayer() {
@@ -112,7 +122,7 @@ public class DiagramGenerator {
Element layerElt = outerLayer.addElement(doc, svgNS, 0, 0, comp.getHeight()+200, comp.getWidth()+400);
svgRoot.appendChild(layerElt);
}
-
+
private void addReferencePromotion() {
for(Iterator it= comp.getPromoteAReference().entrySet().iterator();
@@ -120,10 +130,10 @@ public class DiagramGenerator {
Entry entry = (Entry) it.next();
String compositeRef = (String)entry.getKey();
String componentRef = (String)entry.getValue();
-
+
Reference r1 = getRef(compositeRef);
Reference r2 = getRef(componentRef);
-
+
if(r1 != null && r2 != null){
addWire(r2, r1);
}
@@ -137,27 +147,54 @@ public class DiagramGenerator {
Entry entry = (Entry) it.next();
String compositeSer = (String)entry.getKey();
String componentSer = (String)entry.getValue();
-
+
Service s1 = getSer(compositeSer);
Service s2 = getSer(componentSer);
-
+
if(s1 != null && s2 != null){
addWire(s1, s2);
}
}
}
-
+ private void addInclusions() {
+ Layer inclusionLayer = new Layer();
+ int constant = 5;
+ int x0 = comp.getX()+constant;
+ int y0 = comp.getY()+comp.getHeight()-(Component.DEFAULT_HEIGHT/2+constant);
+ int height = Component.DEFAULT_HEIGHT/2;
+ int width = comp.getWidth()-constant*2;
+
+ Element layerElt = inclusionLayer.addElement(doc, svgNS, x0, y0, height,
+ width , "#E5E5C0");
+
+ Element text = Text.addTextElement(doc, svgNS, x0+constant, y0+constant*2, "Included Composites");
+
+ svgRoot.appendChild(layerElt);
+ svgRoot.appendChild(text);
+
+ text = Text.addTextElement(doc, svgNS, x0+constant, y0+constant*7, "");
+
+ for(String includedComposite : comp.getIncludedComposites()){
+
+ Link link = new Link();
+ Element aLink = link.addElement(doc, svgNS, includedComposite+comp.getFileNameSuffix(), includedComposite);
+ text.appendChild(aLink);
+
+ }
+ svgRoot.appendChild(text);
+ }
+
/**
* Connects references to services.
*/
private void addComponentConnections() {
for(Entity ent: comp.getComponentList()){
- if(ent instanceof ComponentEntity){
-
+ //if(ent instanceof ComponentEntity){
+
for(Iterator it= ((ComponentEntity)ent).getReferenceToServiceMap().entrySet().iterator();
- it.hasNext();){
+ it.hasNext();){
Entry entry = (Entry) it.next();
String ref = (String)entry.getKey();
String ser = (String)entry.getValue();
@@ -169,28 +206,48 @@ public class DiagramGenerator {
addWire(r,s);
}
}
- }
+ //}
}
}
- private void addWire(Reference r, Service s) {
+ /**
+ * This is to remove overlapping of wire elements
+ */
+ private String getColor() {
+ previousWireColor =previousWireColor % color.values().length;
+ return color.values()[previousWireColor++].toString();
+ }
+
+
+ /**
+ * This is to remove overlapping of wire elements
+ */
+ private int getChangingFactor() {
+
+ lastUsedChangingFactor = lastUsedChangingFactor % changingFactor.values().length;
+ return changingFactor.values()[lastUsedChangingFactor++].getVal();
+
+ }
+
+ private void addWire(Reference r, Service s) {
+
Wire edge = new NormalWire();
- Element wire = edge.addElement(doc, svgNS, r, s);
+ Element wire = edge.addElement(doc, svgNS, r, s, getChangingFactor(), getColor());
svgRoot.appendChild(wire);
}
-
+
private void addWire(Service s1, Service s2) {
DashedWire edge = new DashedWire();
- Element wire = edge.addElement(doc, svgNS, s1, s2);
+ Element wire = edge.addElement(doc, svgNS, s1, s2, getChangingFactor(), getColor());
svgRoot.appendChild(wire);
}
-
+
private void addWire(Reference r1, Reference r2) {
DashedWire edge = new DashedWire();
- Element wire = edge.addElement(doc, svgNS, r1, r2);
+ Element wire = edge.addElement(doc, svgNS, r1, r2, getChangingFactor(), getColor());
svgRoot.appendChild(wire);
}
@@ -207,7 +264,7 @@ public class DiagramGenerator {
private Reference getRef(String ref) {
for(Reference r: refs){
-
+
if(r.getContainerName().equals(ref) || r.getName().equals(ref)){
return r;
}
@@ -215,7 +272,7 @@ public class DiagramGenerator {
return null;
}
- private void addProperties(Entity ent) {
+ private void addComponentProperties(ComponentEntity ent) {
int propLen = ent.getPropLength();
int x= ent.getX() + Property.SPACING_FOR_COMPONENT;
int y= ent.getY()-propLen/2;
@@ -224,18 +281,19 @@ public class DiagramGenerator {
Property pro = new Property();
Element property = pro.addElement(doc, svgNS, x, y, propLen);
Element text = Text.addTextElement(doc, svgNS, x, y, prop);
-
+
svgRoot.appendChild(property);
svgRoot.appendChild(text);
-
+
x += (propLen + Property.SPACING_FOR_COMPONENT);
-
+
pro.setName(prop);
pro.setContainerName(ent.getName());
}
}
- private void addReference(Entity ent) {
+ private void addComponentReference(ComponentEntity ent) {
+
int refHeight = ent.getRefHeight();
int x=(ent.getX()+ent.getWidth())-(refHeight*2/3);
int y=ent.getY() + Reference.SPACING_FOR_COMPONENT;
@@ -246,40 +304,30 @@ public class DiagramGenerator {
Element text = Text.addTextElement(doc, svgNS, x, y+refHeight/2, ref);
svgRoot.appendChild(polygon);
svgRoot.appendChild(text);
-
+
y += (refHeight + Reference.SPACING_FOR_COMPONENT);
-
+
refer.setName(ref);
refer.setContainerName(ent.getName());
refs.add(refer);
-
+
}
}
- private String[] setRefOrder(Entity e){
-
+ /**
+ * This method is used to organize the Component References,
+ * in a manner where they are stay approximately in-line with the
+ * connecting Service. This would enhance the clearness of the diagram.
+ */
+ private String[] setRefOrder(ComponentEntity e){
+
ArrayList<String> refs = e.getReferences();
ArrayList<String> sers = new ArrayList<String>();
String[] orderedRefs = new String[refs.size()];
- for(int i=0;i<refs.size();i++){
- sers.add(i, "");
- }
-
- if(e instanceof ComponentEntity){
- for(Iterator it= ((ComponentEntity)e).getReferenceToServiceMap().entrySet().iterator();it.hasNext();){
- Entry entry = (Entry) it.next();
- String ref = (String)entry.getKey();
- String ser = (String)entry.getValue();
- System.out.println("---------"+ref);
- int idx= refs.indexOf(ref);
- System.out.println("---------"+sers.get(idx));
- sers.remove(idx);
- sers.add(idx ,ser);
- System.out.println(refs.get(idx)+"---"+sers.get(idx));
+ //sers = new ArrayList<String>(e.getReferenceToServiceMap().values());
- }
- }
+ sers = buildReferenceToMappingServiceList(refs, e);
for(String eName: e.getAdjacentEntities()){
for(Entity ent: comp.getComponentList()){
@@ -289,11 +337,11 @@ public class DiagramGenerator {
for(String s1: ent.getServices()){
//System.err.println("XXXXX "+ s1 +" ::: "+s);
if(s1.equals(s) || s.equals(ent.getName())){
- System.err.println("|||||||| "+ sers.size()+ " ||| " + refs.size()+"|| "+orderedRefs.length);
+ //System.err.println("|||||||| "+ sers.size()+ " ||| " + refs.size()+"|| "+orderedRefs.length);
if(orderedRefs[ent.getLevel()] == null){
//System.err.println("XXXXX "+ sers.get(1)+ " ::::::: "+refs.get(1));
-// System.err.println("XXXXX "+ sers.get(2)+ " ::::::: "+refs.get(2));
-// System.err.println("XXXXX "+ sers.get(3)+ " ::::::: "+refs.get(3));
+ // System.err.println("XXXXX "+ sers.get(2)+ " ::::::: "+refs.get(2));
+ // System.err.println("XXXXX "+ sers.get(3)+ " ::::::: "+refs.get(3));
System.err.println("XXXXX "+ refs.get(sers.indexOf(s))+" ::: "+ent.getLevel()+" ::: "+ent.getName());
orderedRefs[ent.getLevel()] = refs.get(sers.indexOf(s));
break;
@@ -301,7 +349,7 @@ public class DiagramGenerator {
else{
for(int i=ent.getLevel();i<orderedRefs.length;i++){
if(orderedRefs[i]== null){
-
+
orderedRefs[i] = refs.get(sers.indexOf(s));
break;
}
@@ -317,7 +365,7 @@ public class DiagramGenerator {
}
}
}
-
+
//adding references which are not connected to any service
for(String ref : refs){
for(int i=0; i<orderedRefs.length ; i++){
@@ -330,18 +378,44 @@ public class DiagramGenerator {
}
}
}
-
+
return orderedRefs;
}
-
- private void addService(Entity ent) {
+
+ private ArrayList<String> buildReferenceToMappingServiceList(ArrayList<String> refs, ComponentEntity e) {
+
+ ArrayList<String> sers = new ArrayList<String>();
+
+ for(int i=0;i<refs.size();i++){
+ sers.add(i, "");
+ }
+
+ for(Iterator it= e.getReferenceToServiceMap().entrySet().iterator();
+ it.hasNext();){
+
+ Entry entry = (Entry) it.next();
+ String ref = (String)entry.getKey();
+ String ser = (String)entry.getValue();
+ //System.out.println("---------"+ref);
+ int idx= refs.indexOf(ref);
+ //System.out.println("---------"+sers.get(idx));
+ sers.remove(idx);
+ sers.add(idx ,ser);
+ //System.out.println(refs.get(idx)+"---"+sers.get(idx));
+
+ }
+
+ return sers;
+ }
+
+ private void addComponentService(ComponentEntity ent) {
int serHeight = ent.getSerHeight();
int x= ent.getX()-(serHeight*2/3);
int y= ent.getY() + Service.SPACING_FOR_COMPONENT;
System.out.println("''''''"+ent.getName() +" '''''' "+ ent.getServices().size());
for(String ser: ent.getServices()){
-
+
Service serve= new Service();
Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
Element text;
@@ -349,20 +423,20 @@ public class DiagramGenerator {
text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ser);
else
text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, "");
-
+
svgRoot.appendChild(polygon);
svgRoot.appendChild(text);
-
+
y += (serHeight + Service.SPACING_FOR_COMPONENT);
-
+
serve.setName(ser);
serve.setContainerName(ent.getName());
sers.add(serve);
}
}
-
- private void addCompositeService(CompositeEntity comp) {
-
+
+ private void addCompositeService() {
+
int serHeight = comp.getSerHeight();
int x= comp.getX()-(serHeight*2/3);
int y= comp.getY() + Service.SPACING_FOR_COMPOSITE;
@@ -370,7 +444,7 @@ public class DiagramGenerator {
System.err.println(serHeight);
System.out.println("''''''"+((CompositeEntity)comp).getName() +" '''''' "+ comp.getServices().size());
for(String ser: comp.getServices()){
-
+
Service serve= new Service();
Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
Element text;
@@ -378,20 +452,20 @@ public class DiagramGenerator {
text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ser);
else
text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, "");
-
+
svgRoot.appendChild(polygon);
svgRoot.appendChild(text);
-
+
y += (serHeight + Service.SPACING_FOR_COMPOSITE);
-
+
serve.setName(ser);
serve.setContainerName(comp.getName());
sers.add(serve);
}
}
- private void addCompositeReference(CompositeEntity comp) {
-
+ private void addCompositeReference() {
+
int refHeight = comp.getRefHeight();
int x=(comp.getX()+comp.getWidth())-(refHeight*2/3);
int y=comp.getY() + Reference.SPACING_FOR_COMPOSITE;
@@ -402,18 +476,18 @@ public class DiagramGenerator {
Element text = Text.addTextElement(doc, svgNS, x, y+refHeight/2, ref);
svgRoot.appendChild(polygon);
svgRoot.appendChild(text);
-
+
y += (refHeight + Reference.SPACING_FOR_COMPOSITE);
-
+
refer.setName(ref);
refer.setContainerName(comp.getName());
refs.add(refer);
-
+
}
-
+
}
-
- private void addCompositeProperties(CompositeEntity comp) {
+
+ private void addCompositeProperties() {
int propLen = comp.getPropLength();
int x= comp.getX() + Property.SPACING_FOR_COMPOSITE;
int y= comp.getY()-propLen/2;
@@ -422,47 +496,47 @@ public class DiagramGenerator {
Property pro = new Property();
Element property = pro.addElement(doc, svgNS, x, y, propLen);
Element text = Text.addTextElement(doc, svgNS, x, y, prop);
-
+
svgRoot.appendChild(property);
svgRoot.appendChild(text);
-
+
x += (propLen + Property.SPACING_FOR_COMPOSITE);
-
+
pro.setName(prop);
pro.setContainerName(comp.getName());
}
}
-
+
private void addComponent(Entity ent) {
Component comp = new Component();
System.err.println(ent.getX());
Element com = comp.addElement(doc, svgNS, ent.getX(), ent.getY(),
ent.getHeight(), ent.getWidth());
- Element text = Text.addTextElement(doc, svgNS, ent.getX()+(ent.getWidth()/4),
+ Element text = Text.addTextElement(doc, svgNS, ent.getX(),
ent.getY()+(ent.getHeight()+Component.TEXT_SPACING), ent.getName());
-
+
svgRoot.appendChild(com);
svgRoot.appendChild(text);
-
+
comp.setName(ent.getName());
}
private void addComposite() {
Composite composite = new Composite();
-
+
Element composi = composite.addElement(doc, svgNS, comp.getX(), comp.getY(), comp.getHeight(), comp.getWidth());
Element text = Text.addTextElement(doc, svgNS, comp.getX() +comp.getWidth()/2, comp.getY() +20, comp.getName());
-
+
svgRoot.appendChild(composi);
svgRoot.appendChild(text);
-
+
composite.setName(comp.getName());
-
-
+
+
}
-
-
+
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java
index f85a83bdb7..7507b4ab57 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java
@@ -48,7 +48,7 @@ public class ComponentEntity extends Entity{
public ComponentEntity(){
- super.setStartPosition(200);
+ setStartPosition(200);
setHeight(Component.DEFAULT_HEIGHT);
setWidth(Component.DEFAULT_WIDTH);
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java
index 0adffcc44e..810c0a8f09 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java
@@ -43,12 +43,14 @@ public class CompositeEntity extends Entity{
// public static final int defaultNoOfRefs= Component.DEFAULT_HEIGHT / (Reference.MAXIMUM_HEIGHT+Reference.SPACING); //same value for defaultNoOfSers
// public static final int defaultNoOfProps= Component.DEFAULT_WIDTH / (Property.MAXIMUM_HEIGHT+Property.SPACING);
+ private final String fileNameSuffix = "_diagram.svg";
private int maxInternalLevel=0;
private int maxInternalLane=0;
private ComponentEntity[] componentList;
private int[][] connections;
private HashMap<String, String> promoteAService = new HashMap<String, String>();
private HashMap<String, String> promoteAReference = new HashMap<String, String>();
+ private ArrayList<String> includedComposites = new ArrayList<String>();
//private HashSet<String> connectedEntities = new HashSet<String>();
@@ -201,6 +203,13 @@ public class CompositeEntity extends Entity{
promoteAReference.put(compositeRef, componentRef);
return true;
}
+
+ public boolean addToIncludedComposites(String composite){
+
+ includedComposites.add(composite);
+
+ return true;
+ }
public void setPromoteAReference(HashMap<String, String> promoteAReference) {
this.promoteAReference = promoteAReference;
@@ -252,6 +261,15 @@ public class CompositeEntity extends Entity{
}
+ public ArrayList<String> getIncludedComposites() {
+ return includedComposites;
+ }
+
+ public String getFileNameSuffix() {
+ return fileNameSuffix;
+ }
+
+
// public int getNoOfRefs(){
// return references.size();
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
index 4157f93409..07ee0d7c75 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
@@ -63,7 +63,7 @@ public class EntityBuilder {
composite = new CompositeEntity(compositeName);
- setParent(comps, composite);
+ setParent(comps);
//System.out.println("ComponentEntity "+comps[0].getLevel());
int[][] conns = buildConnectionMatrix(comps);
@@ -72,21 +72,25 @@ public class EntityBuilder {
composite.setConnections(conns);
LayoutBuilder buildLayout = new LayoutBuilder(comps , conns);
- buildLayout.buildEntities();
+ buildLayout.placeEntities();
System.out.println("conns "+conns[0][0]);
- buildCompositeService(docEle, composite);
- buildCompositeReference(docEle, composite);
- buildCompositeProperty(docEle, composite);
+ buildCompositeService(docEle);
+ buildCompositeReference(docEle);
+ buildCompositeProperty(docEle);
+
+ addInclusions(docEle);
composite.setAttributes();
return composite;
}
+
+
// private void assignCoordinates() {
//
// for(Entity ent: elts){
@@ -95,15 +99,14 @@ public class EntityBuilder {
// }
// }
- private void setParent(ComponentEntity[] comps, Entity parent) {
+ private void setParent(ComponentEntity[] comps) {
for(ComponentEntity comp: comps){
- comp.setParent(parent);
+ comp.setParent(composite);
}
}
- private void buildCompositeService(Element docEle,
- CompositeEntity composite) {
+ private void buildCompositeService(Element docEle) {
NodeList nl = docEle.getElementsByTagName("service");
System.err.println("^^^^^^^^^ "+nl.getLength());
@@ -136,8 +139,7 @@ public class EntityBuilder {
}
}
- private void buildCompositeReference(Element docEle,
- CompositeEntity composite) {
+ private void buildCompositeReference(Element docEle) {
NodeList nl = docEle.getElementsByTagName("reference");
//System.out.println("^^^^^^^^^ "+nl.getLength());
@@ -170,8 +172,7 @@ public class EntityBuilder {
}
}
- private void buildCompositeProperty(Element docEle,
- CompositeEntity composite) {
+ private void buildCompositeProperty(Element docEle) {
NodeList nl = docEle.getElementsByTagName("property");
//System.out.println("^^^^^^^^^ "+nl.getLength());
@@ -188,6 +189,24 @@ public class EntityBuilder {
}
}
}
+
+ private void addInclusions(Element docEle) {
+
+ NodeList nl = docEle.getElementsByTagName("include");
+ //System.out.println("^^^^^^^^^ "+nl.getLength());
+ if(nl != null && nl.getLength() > 0 ) {
+
+ for(int i = 0 ; i < nl.getLength();i++) {
+
+ Element elt = (Element)nl.item(i);
+
+ if(elt.getParentNode().getNodeName().equals("composite")){
+ String compToBeIncluded = elt.getAttribute("name");
+ composite.addToIncludedComposites(compToBeIncluded);
+ }
+ }
+ }
+ }
private int[][] buildConnectionMatrix(ComponentEntity[] comps) {
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
index 07f432d6a3..c2acdf8f89 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
@@ -25,7 +25,6 @@ public class LayoutBuilder {
private int[][] conns = null;
private Entity startEnt = null;
private int currentMaxLevel= 0;
- private int startPosition = 250;
/**
* Constructor which takes set of entities and their connection matrix
@@ -62,7 +61,7 @@ public class LayoutBuilder {
*
*
*/
- public Entity[] buildEntities(){
+ public Entity[] placeEntities(){
/**
* Finding the starting entity
@@ -73,19 +72,29 @@ public class LayoutBuilder {
if( isConnected(ent.getId()) ){
setPosition(ent, 0, 0);
startEnt = ent;
- System.out.println("startEnt "+ent.getName());
+ //System.out.println("startEnt "+ent.getId());
break;
}
}
assignPositions(startEnt);
+ assignPositionsOfIdleEntities();
assignCoordinates();
return elts;
}
+ private void assignPositionsOfIdleEntities() {
+
+ for(Entity ent: elts){
+ if(!ent.isPossitionSet()){
+ this.setPosition(ent, ++currentMaxLevel, 0);
+ }
+ }
+ }
+
private void assignCoordinates() {
for(Entity ent: elts){
@@ -102,10 +111,10 @@ public class LayoutBuilder {
if( entConns[i] == 1 ){
Entity nextEnt = findEntity(i);
- if(nextEnt.isPossitionSet()){
- currentMaxLevel = nextEnt.getLevel()+1; // for diagram clearness purpose
- }
- else if(nextEnt != null){
+// if(nextEnt.isPossitionSet()){
+// currentMaxLevel = nextEnt.getLevel()+1; // for diagram clearness purpose
+// }
+ if(nextEnt != null && !nextEnt.isPossitionSet()){
setPosition(nextEnt, currentMaxLevel, ent.getLane()+1);
assignPositions(nextEnt);
}
@@ -131,7 +140,7 @@ public class LayoutBuilder {
private boolean isConnected(int id) {
int[] entConns = conns[id];
- System.out.println("entConns "+entConns.length);
+ //System.out.println("entConns "+entConns.length);
for(int i=0; i<entConns.length; i++){
if(entConns[i] == 1){
@@ -149,4 +158,12 @@ public class LayoutBuilder {
ent.setPossitionSet(true);
}
+ public Entity getStartEnt() {
+ return startEnt;
+ }
+
+ public void setStartEnt(Entity startEnt) {
+ this.startEnt = startEnt;
+ }
+
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
index 0ab086b92a..4dc0799d8d 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
@@ -55,7 +55,7 @@ public class Main {
DiagramGenerator dg = new DiagramGenerator(comp);
Document svg =dg.buildSVGDocument();
- File outFile = new File(outFileDir+comp.getName()+"_diagram.svg");
+ File outFile = new File(outFileDir + comp.getName()+ comp.getFileNameSuffix());
XMLWriter writer = new XMLWriter();
writer.fileWriter(svg, outFile);
}
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/test/layout/LayoutBuilderTest.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/test/layout/LayoutBuilderTest.java
new file mode 100755
index 0000000000..3c3e96c0f2
--- /dev/null
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/test/layout/LayoutBuilderTest.java
@@ -0,0 +1,144 @@
+package org.apache.tuscany.sca.test.layout;
+
+import static org.junit.Assert.*;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.impl.layout.ComponentEntity;
+import org.apache.tuscany.sca.impl.layout.CompositeEntity;
+import org.apache.tuscany.sca.impl.layout.Entity;
+import org.apache.tuscany.sca.impl.layout.LayoutBuilder;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LayoutBuilderTest {
+
+ LayoutBuilder lb;
+ Entity[] ents;
+ Entity parent;
+ int[][] conns;
+
+ @Before
+ public void setUp() throws Exception {
+ parent = new CompositeEntity("composite");
+ parent.setX(200);
+ parent.setY(100);
+
+ ents = new Entity[5];
+ for(int i=0; i<ents.length ;i++){
+ ents[i] = new ComponentEntity();
+ ents[i].setId(i);
+ ents[i].setParent(parent);
+ }
+
+
+ }
+
+ @Test
+ public void testPlaceEntities() throws Exception {
+ //setUp();
+ Assert.assertEquals(5, ents.length);
+ Assert.assertEquals(200, ents[0].getStartPosition());
+
+ conns = new int[5][5];
+ for(int i=0; i<conns.length ;i++){
+ for(int j=0; j<conns.length ;j++){
+ //int x = Math.getExponent(Math.random());
+ if(i==j-1)
+ conns[i][j] = 1;
+ else
+ conns[i][j] = 0;
+ }
+ }
+
+ lb = new LayoutBuilder(ents, conns);
+
+ ents = lb.placeEntities();
+
+ Assert.assertEquals(5, ents.length);
+ Assert.assertEquals(0, lb.getStartEnt().getId());
+
+ Assert.assertEquals(0, ents[0].getLevel());
+ Assert.assertEquals(0, ents[1].getLevel());
+ Assert.assertEquals(0, ents[2].getLevel());
+ Assert.assertEquals(0, ents[3].getLevel());
+ Assert.assertEquals(0, ents[4].getLevel());
+
+ Assert.assertEquals(0, ents[0].getLane());
+ Assert.assertEquals(1, ents[1].getLane());
+ Assert.assertEquals(2, ents[2].getLane());
+ Assert.assertEquals(3, ents[3].getLane());
+ Assert.assertEquals(4, ents[4].getLane());
+
+
+ }
+
+ @Test
+ public void testPlaceEntities1() throws Exception {
+
+ conns = new int[5][5];
+ for(int i=0; i<conns.length ;i++){
+ for(int j=0; j<conns.length ;j++){
+ //int x = Math.getExponent(Math.random());
+ if(i==j-1 || i==j-4)
+ conns[i][j] = 1;
+ else
+ conns[i][j] = 0;
+ }
+ }
+ conns[3][4] = 0;
+
+ lb = new LayoutBuilder(ents, conns);
+
+ ents = lb.placeEntities();
+
+ Assert.assertEquals(5, ents.length);
+ Assert.assertEquals(0, lb.getStartEnt().getId());
+
+ Assert.assertEquals(0, ents[0].getLevel());
+ Assert.assertEquals(0, ents[1].getLevel());
+ Assert.assertEquals(0, ents[2].getLevel());
+ Assert.assertEquals(0, ents[3].getLevel());
+ Assert.assertEquals(1, ents[4].getLevel());
+
+ Assert.assertEquals(0, ents[0].getLane());
+ Assert.assertEquals(1, ents[1].getLane());
+ Assert.assertEquals(2, ents[2].getLane());
+ Assert.assertEquals(3, ents[3].getLane());
+ Assert.assertEquals(1, ents[4].getLane());
+
+ }
+
+ @Test
+ public void testPlaceEntities2() throws Exception {
+
+ conns = new int[5][5];
+ for(int i=0; i<conns.length ;i++){
+ for(int j=0; j<conns.length ;j++){
+ if(i*j>2 && i*j<=6)
+ conns[i][j] = 1;
+ else
+ conns[i][j] = 0;
+ }
+ }
+
+ lb = new LayoutBuilder(ents, conns);
+
+ ents = lb.placeEntities();
+
+ Assert.assertEquals(5, ents.length);
+ Assert.assertEquals(1, lb.getStartEnt().getId());
+
+ Assert.assertEquals(2, ents[0].getLevel());
+ Assert.assertEquals(0, ents[1].getLevel());
+ Assert.assertEquals(0, ents[2].getLevel());
+ Assert.assertEquals(0, ents[3].getLevel());
+ Assert.assertEquals(1, ents[4].getLevel());
+
+ Assert.assertEquals(0, ents[0].getLane());
+ Assert.assertEquals(0, ents[1].getLane());
+ Assert.assertEquals(2, ents[2].getLane());
+ Assert.assertEquals(1, ents[3].getLane());
+ Assert.assertEquals(1, ents[4].getLane());
+
+ }
+}