summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik
diff options
context:
space:
mode:
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik')
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml50
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/Calculator_diagram.svg2
-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/pom.xml6
-rw-r--r--collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Text.java2
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java73
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java47
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java2
9 files changed, 178 insertions, 8 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml
new file mode 100755
index 0000000000..7d00becf2d
--- /dev/null
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorTest">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent" />
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" target="MultiplyServiceComponent" />
+ <reference name="divideService" target="DivideServiceComponent" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ <reference name="dividetestService" target="AddServiceComponent" />
+ </component>
+
+</composite> \ 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 66318f9eb9..6ba9f5c579 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="900" rx="20" ry="20" height="1140" stroke="#919191"/><text x="450" font-size="20" dominant-baseline="mathematical" y="20" text-anchor="middle">Calculator</text><rect x="100" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="150" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">CalculatorServiceComponent</text><polygon fill="#BF3EFF" points="286,110 318,110 334,121 318,132 286,132 302,121 " stroke="#68228B"/><text x="286" font-size="20" dominant-baseline="mathematical" y="121" text-anchor="middle">addService</text><polygon fill="#BF3EFF" points="286,142 318,142 334,153 318,164 286,164 302,153 " stroke="#68228B"/><text x="286" font-size="20" dominant-baseline="mathematical" y="153" text-anchor="middle">subtractService</text><polygon fill="#BF3EFF" points="286,174 318,174 334,185 318,196 286,196 302,185 " stroke="#68228B"/><text x="286" font-size="20" dominant-baseline="mathematical" y="185" text-anchor="middle">multiplyService</text><polygon fill="#BF3EFF" points="286,206 318,206 334,217 318,228 286,228 302,217 " stroke="#68228B"/><text x="286" font-size="20" dominant-baseline="mathematical" y="217" text-anchor="middle">divideService</text><rect x="500" y="880" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="1030" text-anchor="middle">AddServiceComponent</text><rect x="500" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">SubtractServiceComponent</text><rect x="500" y="620" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="770" text-anchor="middle">MultiplyServiceComponent</text><rect x="500" y="360" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="510" text-anchor="middle">DivideServiceComponent</text></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="#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
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg
index eb7fece1ac..db517b9b29 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"><rect x="0" y="0" alignment-baseline="central" fill="#E5E5E5" width="1300" rx="20" ry="20" height="620" stroke="#919191"/><text x="650" font-size="20" dominant-baseline="mathematical" y="20" text-anchor="middle">store</text><rect x="100" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="150" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">Store</text><polygon fill="#00CD66" points="80,110 110,110 125,125 110,140 80,140 95,125 " stroke="#008B45"/><text x="80" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">Widget</text><polygon fill="#BF3EFF" points="280,110 310,110 325,125 310,140 280,140 295,125 " stroke="#68228B"/><text x="280" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">catalog</text><polygon fill="#BF3EFF" points="280,150 310,150 325,165 310,180 280,180 295,165 " stroke="#68228B"/><text x="280" font-size="20" dominant-baseline="mathematical" y="165" text-anchor="middle">shoppingCart</text><polygon fill="#BF3EFF" points="280,190 310,190 325,205 310,220 280,220 295,205 " stroke="#68228B"/><text x="280" font-size="20" dominant-baseline="mathematical" y="205" text-anchor="middle">shoppingTotal</text><rect x="500" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">Catalog</text><polygon fill="#00CD66" points="480,110 510,110 525,125 510,140 480,140 495,125 " stroke="#008B45"/><text x="480" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">Catalog</text><polygon fill="#BF3EFF" points="680,110 710,110 725,125 710,140 680,140 695,125 " stroke="#68228B"/><text x="680" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">currencyConverter</text><rect fill="#EEEE00" x="520" width="20" height="20" y="90" stroke="#EEC900"/><text x="520" font-size="20" dominant-baseline="mathematical" y="90" text-anchor="middle">currencyCode</text><rect x="500" y="360" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="510" text-anchor="middle">ShoppingCart</text><polygon fill="#00CD66" points="480,370 510,370 525,385 510,400 480,400 495,385 " stroke="#008B45"/><text x="480" font-size="20" dominant-baseline="mathematical" y="385" text-anchor="middle">Cart</text><polygon fill="#00CD66" points="480,410 510,410 525,425 510,440 480,440 495,425 " stroke="#008B45"/><text x="480" font-size="20" dominant-baseline="mathematical" y="425" text-anchor="middle">Total</text><rect x="900" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="950" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">CurrencyConverter</text><polyline stroke-width="2" points="325,205 495,425" stroke="black"/><polyline stroke-width="2" points="325,165 495,385" stroke="black"/><polyline stroke-width="2" points="325,125 495,125" 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="#E5E5E5" width="1400" rx="20" ry="20" height="720" stroke="#919191"/><text x="700" font-size="10" dominant-baseline="mathematical" y="20" text-anchor="middle">store</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">Store</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">Widget</text><polygon fill="#BF3EFF" points="380,210 410,210 425,225 410,240 380,240 395,225 " stroke="#68228B"/><text x="380" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle">catalog</text><polygon fill="#BF3EFF" points="380,250 410,250 425,265 410,280 380,280 395,265 " stroke="#68228B"/><text x="380" font-size="10" dominant-baseline="mathematical" y="265" text-anchor="middle">shoppingCart</text><polygon fill="#BF3EFF" points="380,290 410,290 425,305 410,320 380,320 395,305 " stroke="#68228B"/><text x="380" font-size="10" dominant-baseline="mathematical" y="305" text-anchor="middle">shoppingTotal</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">Catalog</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">Catalog</text><polygon fill="#00CD66" points="580,250 610,250 625,265 610,280 580,280 595,265 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="265" text-anchor="middle"></text><polygon fill="#BF3EFF" points="780,210 810,210 825,225 810,240 780,240 795,225 " stroke="#68228B"/><text x="780" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle">currencyConverter</text><rect fill="#EEEE00" x="620" width="20" height="20" y="190" stroke="#EEC900"/><text x="620" font-size="10" dominant-baseline="mathematical" y="190" text-anchor="middle">currencyCode</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">ShoppingCart</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">Cart</text><polygon fill="#00CD66" points="580,510 610,510 625,525 610,540 580,540 595,525 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="525" text-anchor="middle">Total</text><polygon fill="#00CD66" points="580,550 610,550 625,565 610,580 580,580 595,565 " stroke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="565" text-anchor="middle"></text><rect x="1000" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1050" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">CurrencyConverter</text><polygon fill="#00CD66" points="980,210 1010,210 1025,225 1010,240 980,240 995,225 " stroke="#008B45"/><text x="980" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><polyline stroke-width="2" points="425,305 595,525" stroke="black"/><polyline stroke-width="2" points="425,265 595,485" stroke="black"/><polyline stroke-width="2" points="425,225 595,225" stroke="black"/><polyline stroke-width="2" points="825,225 995,225" stroke="black"/></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 6a465e70f2..cf0569359f 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="#E5E5E5" width="1700" rx="20" ry="20" height="360" stroke="#919191"/><text x="850" font-size="20" dominant-baseline="mathematical" y="20" text-anchor="middle">supplychain</text><rect x="100" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="150" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">CustomerComponent</text><polygon fill="#BF3EFF" points="280,110 310,110 325,125 310,140 280,140 295,125 " stroke="#68228B"/><text x="280" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">retailer</text><rect x="500" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="550" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">RetailerComponent</text><polygon fill="#BF3EFF" points="680,110 710,110 725,125 710,140 680,140 695,125 " stroke="#68228B"/><text x="680" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">warehouse</text><rect x="900" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="950" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">WarehouseComponent</text><polygon fill="#BF3EFF" points="1080,110 1110,110 1125,125 1110,140 1080,140 1095,125 " stroke="#68228B"/><text x="1080" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">shipper</text><rect x="1300" y="100" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1350" font-size="20" dominant-baseline="mathematical" y="250" text-anchor="middle">ShipperComponent</text><polygon fill="#BF3EFF" points="1480,110 1510,110 1525,125 1510,140 1480,140 1495,125 " stroke="#68228B"/><text x="1480" font-size="20" dominant-baseline="mathematical" y="125" text-anchor="middle">customer</text></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="#E5E5E5" width="1800" rx="20" ry="20" height="460" stroke="#919191"/><text x="900" font-size="10" dominant-baseline="mathematical" y="20" text-anchor="middle">supplychain</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">CustomerComponent</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="380,210 410,210 425,225 410,240 380,240 395,225 " stroke="#68228B"/><text x="380" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle">retailer</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">RetailerComponent</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><polygon fill="#BF3EFF" points="780,210 810,210 825,225 810,240 780,240 795,225 " stroke="#68228B"/><text x="780" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle">warehouse</text><rect x="1000" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1050" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">WarehouseComponent</text><polygon fill="#00CD66" points="980,210 1010,210 1025,225 1010,240 980,240 995,225 " stroke="#008B45"/><text x="980" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><polygon fill="#BF3EFF" points="1180,210 1210,210 1225,225 1210,240 1180,240 1195,225 " stroke="#68228B"/><text x="1180" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle">shipper</text><rect x="1400" y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="1450" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">ShipperComponent</text><polygon fill="#00CD66" points="1380,210 1410,210 1425,225 1410,240 1380,240 1395,225 " stroke="#008B45"/><text x="1380" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><polygon fill="#BF3EFF" points="1580,210 1610,210 1625,225 1610,240 1580,240 1595,225 " stroke="#68228B"/><text x="1580" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle">customer</text><polyline stroke-width="2" points="425,225 595,225" stroke="black"/><polyline stroke-width="2" points="825,225 995,225" stroke="black"/><polyline stroke-width="2" points="1225,225 1395,225" stroke="black"/><polyline stroke-width="2" points="1625,225 195,225" stroke="black"/></svg> \ No newline at end of file
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml
index 46489481ff..f7636d210f 100644
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml
@@ -98,6 +98,12 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-base-runtime</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
</dependencies>
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..fabbf40873 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
@@ -31,7 +31,7 @@ public class Text {
text.setAttributeNS(null, "y", y+"");
text.setAttributeNS(null, "text-anchor", "middle");
text.setAttributeNS(null, "dominant-baseline", "mathematical");
- text.setAttributeNS(null, "font-size", "20");
+ text.setAttributeNS(null, "font-size", "10");
text.setTextContent(content);
return text;
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 af7437d494..8c86248663 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
@@ -107,6 +107,7 @@ public class DiagramGenerator {
private Reference getRef(String ref) {
for(Reference r: refs){
+
if(r.getContainerName().equals(ref) || r.getName().equals(ref)){
return r;
}
@@ -139,7 +140,7 @@ public class DiagramGenerator {
int x=(ent.getX()+ent.getWidth())-(refHeight*2/3);
int y=ent.getY()+Reference.SPACING;
- for(String ref: ent.getReferences()){
+ for(String ref: setRefOrder(ent)){
Reference refer= new Reference();
Element polygon = refer.addElement(doc, svgNS, x, y, refHeight);
Element text = Text.addTextElement(doc, svgNS, x, y+refHeight/2, ref);
@@ -155,6 +156,69 @@ public class DiagramGenerator {
}
}
+ private String[] setRefOrder(Entity 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, "");
+ }
+
+ for(Iterator it= e.getReferenceToServiceMap().entrySet().iterator();it.hasNext();){
+ Entry entry = (Entry) it.next();
+ String ref = (String)entry.getKey();
+ String ser = (String)entry.getValue();
+
+ 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));
+
+ }
+
+ for(String eName: e.getAdjacentEntities()){
+ for(Entity ent: entities){
+
+ if(ent.getComponentName().equals(eName)){
+ for(String s : sers){
+ for(String s1: ent.getServices()){
+ //System.err.println("XXXXX "+ s1 +" ::: "+s);
+ if(s1.equals(s) || s.equals(ent.getComponentName())){
+ 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 "+ refs.get(sers.indexOf(s))+" ::: "+ent.getLevel()+" ::: "+ent.getComponentName());
+ orderedRefs[ent.getLevel()] = refs.get(sers.indexOf(s));
+ break;
+ }
+ else{
+ for(int i=ent.getLevel();i<orderedRefs.length;i++){
+ if(orderedRefs[i]== null){
+
+ orderedRefs[i] = refs.get(sers.indexOf(s));
+ break;
+ }
+ else{
+ if(i==orderedRefs.length)
+ System.out.println("GRRR");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return orderedRefs;
+ }
+
private void addService(Entity ent) {
int serHeight = ent.getSerHeight();
int x=ent.getX()-(serHeight*2/3);
@@ -163,7 +227,12 @@ public class DiagramGenerator {
for(String ser: ent.getServices()){
Service serve= new Service();
Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
- Element text = Text.addTextElement(doc, svgNS, x, y+serHeight/2, ser);
+ Element text;
+ if(!ser.endsWith("Impl"))
+ 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);
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 3251fd5d75..168915f40c 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
@@ -29,20 +29,52 @@ import org.w3c.dom.NodeList;
public class EntityBuilder {
private Document dom;
- private final int initPoint = 100;//initial point
+ private final int initPoint = 200;//initial point
private final int spaceX = Component.DEFAULT_WIDTH*2;
private final int spaceY = Component.DEFAULT_HEIGHT*2;
private ArrayList<Integer> levelCount = new ArrayList<Integer>();//keeps track of levels used in lanes
+ //components connected to each other are tracked using following map
private HashMap<String, ArrayList<String>> connectedEntities = new HashMap<String, ArrayList<String>>();
private int totalWidth=0;
private int totalHeight=0;
private Entity startEnt = null;
private String compositeName;
+ /**
+ * Constructor which initiates the DOM document
+ * @param aDom DOM document
+ */
public EntityBuilder(Document aDom){
dom = aDom;
}
+ /**
+ * Layout Building Algorithm
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * An Entity object represents a component element of a composite XML.
+ * Here we position (i.e. assigning a level and a lane) all such components
+ * in a unique cell of a grid.
+ *
+ * lane0 lane1 lane2 lane3 ....
+ * _______________________________
+ * level0 | | | | |
+ * |_______|_______|_______|_______|
+ * level1 | | | | |
+ * |_______|_______|_______|_______|
+ * level2 | | | | |
+ *
+ * 1) Determining the Entity at level0, lane0 (starting entity)
+ * -First Entity in the list of Entities which has one or more adjacent Entities
+ * -If there is only one Entity it will eventually chosen
+ *
+ * 2) Get adjacent Entities of starting Entity.
+ * * If there are adjacent entities;
+ * *For each adjacent Entity;
+ *
+ *
+ * @return
+ */
public Entity[] buildEntities(){
Entity[] elts = null;
//get the root element
@@ -146,6 +178,8 @@ public class EntityBuilder {
}
if(i<ents.length)
assignPositions(ents, aEnt);
+// else
+// System.out.println(i+ " <<<<< "+ents.length);
break;
}
@@ -242,6 +276,17 @@ public class EntityBuilder {
ent.addAService(elt.getAttribute("name"));
}
}
+
+ NodeList nl1 = nVal.getElementsByTagName("implementation.java");
+ if(nl1 != null && nl1.getLength() > 0 ) {
+ for(int i = 0 ; i < nl1.getLength();i++) {
+ Element elt = (Element)nl1.item(i);
+ System.out.println(elt.getAttribute("class"));
+ String serName = elt.getAttribute("class").split("\\.")[1];
+ ent.addAService(serName);
+ }
+ }
+
}
private void setProperties(Element nVal, Entity ent) {
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 6f8f047adc..3f62f38cb5 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
@@ -38,7 +38,7 @@ public class Main {
public static void main(String[] args) throws Exception {
XMLReader reader = new XMLReader();
- Document doc =reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite2.xml");
+ Document doc =reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite3.xml");
EntityBuilder eb = new EntityBuilder(doc);
Entity[] ents =eb.buildEntities();
DiagramGenerator dg = new DiagramGenerator(ents, eb.getTotalHeight(), eb.getTotalWidth(), eb.getCompositeName());