You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ni...@apache.org on 2011/07/26 15:00:58 UTC

svn commit: r1151079 - in /tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik: input/ output/ src/main/java/org/apache/tuscany/sca/impl/artifacts/ src/main/java/org/apache/tuscany/sca/impl/diagram/ src/main/java/org/apache/tusca...

Author: nirmal070125
Date: Tue Jul 26 13:00:55 2011
New Revision: 1151079

URL: http://svn.apache.org/viewvc?rev=1151079&view=rev
Log:
Refactored the code a bit

Added:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java   (with props)
Modified:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Component.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Property.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Service.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/Entity.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml?rev=1151079&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml Tue Jul 26 13:00:55 2011
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<!-- MyValueComposite Wires examples -->
+
+<composite     xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+
+               targetNamespace="http://foo.com"
+
+               name="MyValueComposite2" >
+
+ 
+
+   <service name="MyValueService" promote="MyValueServiceComponent">
+
+         <interface.java interface="services.myvalue.MyValueService"/>
+
+         <binding.ws port="http://www.myvalue.org/MyValueService#
+
+               wsdl.endpoint(MyValueService/MyValueServiceSOAP)"/>
+
+   </service>
+
+ 
+
+   <component name="MyValueServiceComponent">
+
+         <implementation.java
+
+               class="services.myvalue.MyValueServiceImpl"/>
+
+         <property name="currency">EURO</property>
+
+         <service name="MyValueService"/>
+
+         <reference name="customerService"/>
+
+         <reference name="stockQuoteService"/>
+
+   </component>
+
+ 
+
+   <wire source="MyValueServiceComponent/stockQuoteService"
+
+         target="StockQuoteMediatorComponent"/>
+
+ 
+
+   <component name="StockQuoteMediatorComponent">
+
+         <implementation.java class="services.myvalue.SQMediatorImpl"/>
+
+         <property name="currency">EURO</property>
+
+         <reference name="stockQuoteService"/>
+
+   </component>
+
+ 
+
+   <reference name="CustomerService"
+
+         promote="MyValueServiceComponent/customerService">
+
+         <interface.java interface="services.customer.CustomerService"/>
+
+         <binding.sca/>
+
+   </reference>
+
+ 
+
+   <reference name="StockQuoteService" 
+
+         promote="StockQuoteMediatorComponent">
+
+         <interface.java
+
+               interface="services.stockquote.StockQuoteService"/>
+
+         <binding.ws port="http://www.stockquote.org/StockQuoteService#
+
+               wsdl.endpoint(StockQuoteService/StockQuoteServiceSOAP)"/>
+
+   </reference>
+
+ 
+
+</composite>
\ No newline at end of file

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite_with_compositeService.xml
------------------------------------------------------------------------------
    svn:executable = *

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/store_diagram.svg Tue Jul 26 13:00:55 2011
@@ -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="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 " stro
 ke="#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="mi
 ddle">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
+<?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 " stro
 ke="#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="#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><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

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Artifact.java Tue Jul 26 13:00:55 2011
@@ -47,8 +47,8 @@ public abstract class Artifact {
 	public abstract Element addElement(Document document, String svgNs, 
 			int x, int y, int height, int width);
 	
-	public abstract Element addElement(Document document, String svgNs, 
-			int x, int y);
+//	public abstract Element addElement(Document document, String svgNs, 
+//			int x, int y);
 	
 	public int getHeight() {
 		return height;

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Component.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Component.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Component.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Component.java Tue Jul 26 13:00:55 2011
@@ -62,7 +62,4 @@ public class Component extends Artifact{
 		
 	}
 	
-	
-	
-
 }

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Composite.java Tue Jul 26 13:00:55 2011
@@ -56,6 +56,4 @@ public class Composite extends Artifact{
 		return null;
 	}
 	
-	
-
 }

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Property.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Property.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Property.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Property.java Tue Jul 26 13:00:55 2011
@@ -24,8 +24,10 @@ import org.w3c.dom.Element;
 
 public class Property extends Artifact{
 	
-	public static final int MAXIMUM_HEIGHT = 20 ; //default value
-	public static final int SPACING = 20 ;	//default value
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT = 20 ;	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE = 60 ;
+	public static final int SPACING_FOR_COMPONENT = 20 ;
+	public static final int SPACING_FOR_COMPOSITE = 60 ;
 	
 
 	/**
@@ -62,11 +64,5 @@ public class Property extends Artifact{
 		return addElement(document, svgNs, x, y, height, height);
 	}
 
-	
-	public Element addElement(Document document, String svgNs, int x, int y) {
-		
-
-		return addElement(document, svgNs, x, y, MAXIMUM_HEIGHT);
-	}
 
 }

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Reference.java Tue Jul 26 13:00:55 2011
@@ -24,8 +24,11 @@ import org.w3c.dom.Element;
 
 public class Reference extends Artifact {
 	
-	public static final int MAXIMUM_HEIGHT = 30 ;	//default value
-	public static final int SPACING = 10 ;	//default value
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT = 30 ;	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE = 90 ;
+	public static final int SPACING_FOR_COMPONENT = 10 ;
+	public static final int SPACING_FOR_COMPOSITE = 30 ;
+	
 	
 
 	/**
@@ -70,10 +73,4 @@ public class Reference extends Artifact 
 		return this.addElement(document, svgNs, x, y, height, height*3/2);
 	}
 
-	
-	public Element addElement(Document document, String svgNs, int x, int y) {
-		
-		return this.addElement(document, svgNs, x, y, MAXIMUM_HEIGHT);
-	}
-
 }

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Service.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Service.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Service.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Service.java Tue Jul 26 13:00:55 2011
@@ -24,8 +24,10 @@ import org.w3c.dom.Element;
 
 public class Service extends Artifact{
 
-	public static final int MAXIMUM_HEIGHT = 30 ;	//default value
-	public static final int SPACING = 10 ;	//default value
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT = 30 ;	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE = 90 ;
+	public static final int SPACING_FOR_COMPONENT = 10 ;
+	public static final int SPACING_FOR_COMPOSITE = 30 ;
 	
 
 	/**
@@ -77,14 +79,5 @@ public class Service extends Artifact{
 		return this.addElement(document, svgNs, x, y, height, height*3/2);
 	}
 
-	/**
-	 * Use default height
-	 */
-	public Element addElement(Document document, String svgNs, int x, int y) {
-		
-		return this.addElement(document, svgNs, x, y, MAXIMUM_HEIGHT);
 		
-	}
-	
-	
 }

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/diagram/DiagramGenerator.java Tue Jul 26 13:00:55 2011
@@ -31,6 +31,7 @@ import org.apache.tuscany.sca.impl.artif
 import org.apache.tuscany.sca.impl.artifacts.Service;
 import org.apache.tuscany.sca.impl.artifacts.Text;
 import org.apache.tuscany.sca.impl.artifacts.Wire;
+import org.apache.tuscany.sca.impl.layout.ComponentEntity;
 import org.apache.tuscany.sca.impl.layout.Entity;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
@@ -38,15 +39,19 @@ import org.w3c.dom.Element;
 
 public class DiagramGenerator {
 	
-	Entity[] entities;
-	int height, width;
-	Document doc;
-	String compositeName;
-	String svgNS ;
-	Element svgRoot;
-	ArrayList<Reference> refs= new ArrayList<Reference>();
-	ArrayList<Service> sers= new ArrayList<Service>();
-
+	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>();
+
+	/**
+	 * Constructor to generate a SVG diagram for compositeName
+	 * with a given height and a width and consisting of entities.
+	 */
 	public DiagramGenerator(Entity[] entities, int height, int width, String compositeName) {
 		this.entities = entities;
 		this.height = height;
@@ -54,6 +59,9 @@ public class DiagramGenerator {
 		this.compositeName = compositeName;
 	}
 	
+	/**
+	 * Draws the diagram.
+	 */
 	public Document buildSVGDocument(){
 		DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
 		svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
@@ -63,6 +71,7 @@ public class DiagramGenerator {
 		svgRoot = doc.getDocumentElement();
 		
 		addComposite();
+		
 		for(Entity ent: entities){
 			addComponent(ent);
 			addService(ent);
@@ -70,23 +79,36 @@ public class DiagramGenerator {
 			addProperties(ent);
 		}
 		
+		addConnections();
+		
+		return doc;
+	}
+	
+	/**
+	 * Connects references to services.
+	 */
+	private void addConnections() {
+
 		for(Entity ent: entities){
-			for(Iterator it= ent.getReferenceToServiceMap().entrySet().iterator();it.hasNext();){
-				Entry entry = (Entry) it.next(); 
-				String ref = (String)entry.getKey(); 
-				String ser = (String)entry.getValue();
-				
-				Reference r = getRef(ref);
-				Service s = getSer(ser);
+			if(ent instanceof ComponentEntity){
 				
-				if(r != null && s != null){
-					addWire(r,s);
+				for(Iterator it= ((ComponentEntity)ent).getReferenceToServiceMap().entrySet().iterator();
+							it.hasNext();){
+					Entry entry = (Entry) it.next(); 
+					String ref = (String)entry.getKey(); 
+					String ser = (String)entry.getValue();
+
+					Reference r = getRef(ref);
+					Service s = getSer(ser);
+
+					if(r != null && s != null){
+						addWire(r,s);
+					}
 				}
 			}
 		}
-		return doc;
 	}
-	
+
 	private void addWire(Reference r, Service s) {
 
 		Wire edge = new Wire();
@@ -117,7 +139,7 @@ public class DiagramGenerator {
 
 	private void addProperties(Entity ent) {
 		int propLen = ent.getPropLength();
-		int x=ent.getX()+Property.SPACING;
+		int x= ent.getX() + Property.SPACING_FOR_COMPONENT;
 		int y= ent.getY()-propLen/2;
 
 		for(String prop: ent.getProperties()){
@@ -128,17 +150,17 @@ public class DiagramGenerator {
 			svgRoot.appendChild(property);
 			svgRoot.appendChild(text);
 			
-			x += (propLen + Property.SPACING);
+			x += (propLen + Property.SPACING_FOR_COMPONENT);
 			
 			pro.setName(prop);
-			pro.setContainerName(ent.getComponentName());
+			pro.setContainerName(ent.getName());
 		}
 	}
 
 	private void addReference(Entity ent) {
 		int refHeight = ent.getRefHeight();
 		int x=(ent.getX()+ent.getWidth())-(refHeight*2/3);
-		int y=ent.getY()+Reference.SPACING;
+		int y=ent.getY() + Reference.SPACING_FOR_COMPONENT;
 
 		for(String ref: setRefOrder(ent)){
 			Reference refer= new Reference();
@@ -147,10 +169,10 @@ public class DiagramGenerator {
 			svgRoot.appendChild(polygon);
 			svgRoot.appendChild(text);
 			
-			y += (refHeight + Reference.SPACING);
+			y += (refHeight + Reference.SPACING_FOR_COMPONENT);
 			
 			refer.setName(ref);
-			refer.setContainerName(ent.getComponentName());
+			refer.setContainerName(ent.getName());
 			refs.add(refer);
 			
 		}
@@ -166,33 +188,35 @@ public class DiagramGenerator {
 			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));
-			
+		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));
+
+			}
 		}
 		
 		for(String eName: e.getAdjacentEntities()){
 			for(Entity ent: entities){
 
-				if(ent.getComponentName().equals(eName)){
+				if(ent.getName().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())){
+							if(s1.equals(s) || s.equals(ent.getName())){
 								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(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());
+									System.err.println("XXXXX "+ refs.get(sers.indexOf(s))+" ::: "+ent.getLevel()+" ::: "+ent.getName());
 									orderedRefs[ent.getLevel()] = refs.get(sers.indexOf(s));
 									break;
 								}
@@ -221,10 +245,12 @@ public class DiagramGenerator {
 	
 	private void addService(Entity ent) {
 		int serHeight = ent.getSerHeight();
-		int x=ent.getX()-(serHeight*2/3);
-		int y=ent.getY()+Service.SPACING;
+		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;
@@ -236,10 +262,10 @@ public class DiagramGenerator {
 			svgRoot.appendChild(polygon);
 			svgRoot.appendChild(text);
 			
-			y += (serHeight + Service.SPACING);
+			y += (serHeight + Service.SPACING_FOR_COMPONENT);
 			
 			serve.setName(ser);
-			serve.setContainerName(ent.getComponentName());
+			serve.setContainerName(ent.getName());
 			sers.add(serve);
 		}
 	}
@@ -250,12 +276,12 @@ public class DiagramGenerator {
 		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), 
-				ent.getY()+(ent.getHeight()+Component.TEXT_SPACING), ent.getComponentName());
+				ent.getY()+(ent.getHeight()+Component.TEXT_SPACING), ent.getName());
 		
 		svgRoot.appendChild(com);
 		svgRoot.appendChild(text);
 		
-		comp.setName(ent.getComponentName());
+		comp.setName(ent.getName());
 	}
 
 	private void addComposite() {

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java?rev=1151079&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java Tue Jul 26 13:00:55 2011
@@ -0,0 +1,251 @@
+/*
+ * 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.layout;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.apache.tuscany.sca.impl.artifacts.Component;
+import org.apache.tuscany.sca.impl.artifacts.Property;
+import org.apache.tuscany.sca.impl.artifacts.Reference;
+import org.apache.tuscany.sca.impl.artifacts.Service;
+
+/**
+ * Represents an unit (a component including its references, services, properties
+ * and adjacent units) in the diagram.
+ *
+ */
+public class ComponentEntity extends Entity{
+	
+//	private String componentName;
+//	private int X, Y, level=-1, lane=-1, refHeight, serHeight, propLength;
+//	private final int height= Component.DEFAULT_HEIGHT, width= Component.DEFAULT_WIDTH;
+//	public static final int defaultNoOfSers= Component.DEFAULT_HEIGHT / (Service.MAXIMUM_HEIGHT+Service.SPACING);
+//	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 HashMap<String, String> referenceToServiceMap = new HashMap<String, String>();
+	//private HashSet<String> connectedEntities = new HashSet<String>();
+	
+	
+	public ComponentEntity(){
+		
+		setHeight(Component.DEFAULT_HEIGHT);
+		setWidth(Component.DEFAULT_WIDTH);
+		
+		setDefaultNoOfSers(
+				Component.DEFAULT_HEIGHT / 
+				(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT+Service.SPACING_FOR_COMPONENT));
+		setDefaultNoOfRefs(
+				Component.DEFAULT_HEIGHT / 
+				(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT+Reference.SPACING_FOR_COMPONENT));
+		setDefaultNoOfProps(
+				Component.DEFAULT_WIDTH / 
+				(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT+Property.SPACING_FOR_COMPONENT));
+	}
+	
+	public void referenceHeight(){
+		if(getDefaultNoOfRefs() < getNoOfRefs()){
+
+			setRefHeight((Component.DEFAULT_HEIGHT / getNoOfRefs()) - Reference.SPACING_FOR_COMPONENT);
+		}
+		else
+			setRefHeight(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT);
+	}
+	
+	public void serviceHeight(){
+		if(getDefaultNoOfSers() < getNoOfSers()){
+
+			setSerHeight((Component.DEFAULT_HEIGHT / getNoOfSers()) - Service.SPACING_FOR_COMPONENT);
+		}
+		else
+			setSerHeight(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT);
+	}
+	
+	public void propertyLength(){
+		if(getDefaultNoOfProps() < getNoOfProps()){
+
+			setPropLength((Component.DEFAULT_WIDTH / getNoOfProps()) - Property.SPACING_FOR_COMPONENT);
+		}
+		else
+			setPropLength(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT);
+	}
+	
+	/**
+	 * Put a value to referenceToServiceMap
+	 * @param ref
+	 * @param ser
+	 * @return successfully added or not
+	 */
+	//assumption there can not be two services for the same reference
+	public boolean addToRefToSerMap(String ref, String ser){
+		//ref = ref.toLowerCase();
+		//ser = ser.toLowerCase();
+		
+		if (referenceToServiceMap.containsKey(ref))
+			return false;
+		
+		referenceToServiceMap.put(ref, ser);
+		return true;
+	}
+	
+	/**
+	 * Retrieve a service name for a given reference
+	 * @param ref
+	 * @return service name
+	 */
+	public String getSerOfRef(String ref){
+		//ref = ref.toLowerCase();
+		
+		if (!referenceToServiceMap.containsKey(ref))
+			return null;
+		
+		return referenceToServiceMap.get(ref);
+	}
+	
+	public HashMap<String, String> getReferenceToServiceMap() {
+		return referenceToServiceMap;
+	}
+	
+	public void setReferenceToServiceMap(
+			HashMap<String, String> referenceToServiceMap) {
+		this.referenceToServiceMap = referenceToServiceMap;
+	}
+	
+	
+//	public int getNoOfRefs(){
+//		return references.size();
+//	}
+//	
+//	public int getNoOfSers(){
+//		return services.size();
+//	}
+//	
+//	public int getNoOfProps(){
+//		return properties.size();
+//	}
+//	
+//	public int getNoOfAdjacentUnits(){
+//		return adjacentEntities.size();
+//	}
+//	
+//	/**
+//	 * Put a value to referenceToServiceMap
+//	 * @param ref
+//	 * @param ser
+//	 * @return successfully added or not
+//	 */
+//	//assumption there can not be two services for the same reference
+//	public boolean addToRefToSerMap(String ref, String ser){
+//		//ref = ref.toLowerCase();
+//		//ser = ser.toLowerCase();
+//		
+//		if (referenceToServiceMap.containsKey(ref))
+//			return false;
+//		
+//		referenceToServiceMap.put(ref, ser);
+//		return true;
+//	}
+//	
+//	/**
+//	 * Retrieve a service name for a given reference
+//	 * @param ref
+//	 * @return service name
+//	 */
+//	public String getSerOfRef(String ref){
+//		//ref = ref.toLowerCase();
+//		
+//		if (!referenceToServiceMap.containsKey(ref))
+//			return null;
+//		
+//		return referenceToServiceMap.get(ref);
+//	}
+//	
+//	public void addAService(String serName){
+//		//serName = serName.toLowerCase();
+//		services.add(serName);
+//		
+//	}
+//	
+//	public void addAReference(String refName){
+//		//refName = refName.toLowerCase();
+//		references.add(refName);
+//		
+//	}
+//	
+//	public void addAProperty(String propName){
+//		//propName = propName.toLowerCase();
+//		properties.add(propName);
+//		
+//	}
+//	
+//	public void addAnAdjacentEntity(String x){
+////		System.out.println("eee "+x);
+//		adjacentEntities.add(x);
+//		
+//	}
+//	
+//	public void addAnConnectedEntity(String x){
+////		System.out.println("eee "+x);
+//		adjacentEntities.add(x);
+//		
+//	}
+//	
+//	public HashMap<String, String> getReferenceToServiceMap() {
+//		return referenceToServiceMap;
+//	}
+//	public void setReferenceToServiceMap(
+//			HashMap<String, String> referenceToServiceMap) {
+//		this.referenceToServiceMap = referenceToServiceMap;
+//	}
+//	public ArrayList<String> getProperties() {
+//		return properties;
+//	}
+//	public void setProperties(ArrayList<String> properties) {
+//		this.properties = properties;
+//	}
+//	public HashSet<String> getAdjacentEntities() {
+//		return adjacentEntities;
+//	}
+//	public void setAdjacentEntities(HashSet<String> adjacentEntities) {
+//		this.adjacentEntities = adjacentEntities;
+//	}
+//	public void setServices(ArrayList<String> services) {
+//		this.services = services;
+//	}
+//	
+//	public ArrayList<String> getServices() {
+//		return services;
+//	}
+//	
+//	public ArrayList<String> getReferences() {
+//		return references;
+//	}
+
+//	public void setConnectedEntities(HashSet<String> connectedEntities) {
+//		this.connectedEntities = connectedEntities;
+//	}
+//
+//	public HashSet<String> getConnectedEntities() {
+//		return connectedEntities;
+//	}
+
+}

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/Entity.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/Entity.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/Entity.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/Entity.java Tue Jul 26 13:00:55 2011
@@ -1,94 +1,117 @@
-/*
- * 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.layout;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 
-import org.apache.tuscany.sca.impl.artifacts.Component;
-import org.apache.tuscany.sca.impl.artifacts.Property;
-import org.apache.tuscany.sca.impl.artifacts.Reference;
-import org.apache.tuscany.sca.impl.artifacts.Service;
+public abstract class Entity {
 
-/**
- * Represents an unit (a component including its references, services, properties
- * and adjacent units) in the diagram.
- *
- */
-public class Entity {
-	
-	private String componentName;
-	private int X, Y, level=-1, lane=-1, refHeight, serHeight, propLength;
-	private final int height= Component.DEFAULT_HEIGHT, width= Component.DEFAULT_WIDTH;
-	public static final int defaultNoOfSers= Component.DEFAULT_HEIGHT / (Service.MAXIMUM_HEIGHT+Service.SPACING);
-	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 HashMap<String, String> referenceToServiceMap = new HashMap<String, String>();
-	
+	private String name; // a unique name
+	private int x; // x coordinate
+	private int y; // y coordinate
+	private int level=-1; // corresponding row which this entity is placed
+	private int lane=-1; // corresponding column which this entity is placed
+	private int height; // height of the entity
+	private int width; // width of the entity
+	private int refHeight; // height of a reference element
+	private int serHeight; // height of a service element
+	private int propLength; // length of a property element
+	private int defaultNoOfSers; // default # of service elements
+	private int defaultNoOfRefs; // default # of reference elements
+	private int defaultNoOfProps; // default # of property elements
+		
 	private ArrayList<String> references = new ArrayList<String>();
-	private ArrayList<String> refProperties = new ArrayList<String>();
 	
 	private ArrayList<String> services = new ArrayList<String>();
-	private ArrayList<String> serProperties = new ArrayList<String>();
 	
 	private ArrayList<String> properties = new ArrayList<String>();
-	private ArrayList<String> propProperties = new ArrayList<String>();
 	
 	private HashSet<String> adjacentEntities = new HashSet<String>();
-	private HashSet<String> connectedEntities = new HashSet<String>();
 	
+	public abstract void referenceHeight();
+	public abstract void serviceHeight();
+	public abstract void propertyLength();
 	
-	public Entity(){
-		
-		
+	public String getName() {
+		return name;
 	}
-	
-	public void referenceHeight(){
-		if(Entity.defaultNoOfRefs < getNoOfRefs()){
-
-			refHeight = (Component.DEFAULT_HEIGHT / getNoOfRefs()) - Reference.SPACING;
-		}
-		else
-			refHeight = Reference.MAXIMUM_HEIGHT;
+	public void setName(String name) {
+		this.name = name;
 	}
-	
-	public void serviceHeight(){
-		if(Entity.defaultNoOfSers < getNoOfSers()){
-
-			serHeight = (Component.DEFAULT_HEIGHT / getNoOfSers()) - Service.SPACING;
-		}
-		else
-			serHeight = Service.MAXIMUM_HEIGHT;
+	public int getX() {
+		return x;
 	}
-	
-	public void propertyLength(){
-		if(Entity.defaultNoOfProps < getNoOfProps()){
-
-			propLength = (Component.DEFAULT_WIDTH / getNoOfProps()) - Property.SPACING;
-		}
-		else
-			propLength = Property.MAXIMUM_HEIGHT;
+	public void setX(int x) {
+		this.x = x;
+	}
+	public int getY() {
+		return y;
+	}
+	public void setY(int y) {
+		this.y = y;
+	}
+	public int getLevel() {
+		return level;
+	}
+	public void setLevel(int level) {
+		this.level = level;
+	}
+	public int getLane() {
+		return lane;
+	}
+	public void setLane(int lane) {
+		this.lane = lane;
+	}
+	public int getHeight() {
+		return height;
+	}
+	public void setHeight(int height) {
+		this.height = height;
+	}
+	public int getWidth() {
+		return width;
+	}
+	public void setWidth(int width) {
+		this.width = width;
+	}
+	public int getRefHeight() {
+		return refHeight;
+	}
+	public void setRefHeight(int refHeight) {
+		this.refHeight = refHeight;
+	}
+	public int getSerHeight() {
+		return serHeight;
+	}
+	public void setSerHeight(int serHeight) {
+		this.serHeight = serHeight;
+	}
+	public int getPropLength() {
+		return propLength;
+	}
+	public void setPropLength(int propLength) {
+		this.propLength = propLength;
+	}
+	public int getDefaultNoOfSers() {
+		return defaultNoOfSers;
+	}
+	public void setDefaultNoOfSers(int defaultNoOfSers) {
+		this.defaultNoOfSers = defaultNoOfSers;
+	}
+	public int getDefaultNoOfRefs() {
+		return defaultNoOfRefs;
+	}
+	public void setDefaultNoOfRefs(int defaultNoOfRefs) {
+		this.defaultNoOfRefs = defaultNoOfRefs;
+	}
+	public int getDefaultNoOfProps() {
+		return defaultNoOfProps;
+	}
+	public void setDefaultNoOfProps(int defaultNoOfProps) {
+		this.defaultNoOfProps = defaultNoOfProps;
 	}
 	
+	
 	public int getNoOfRefs(){
 		return references.size();
 	}
@@ -105,37 +128,6 @@ public class Entity {
 		return adjacentEntities.size();
 	}
 	
-	/**
-	 * Put a value to referenceToServiceMap
-	 * @param ref
-	 * @param ser
-	 * @return successfully added or not
-	 */
-	//assumption there can not be two services for the same reference
-	public boolean addToRefToSerMap(String ref, String ser){
-		//ref = ref.toLowerCase();
-		//ser = ser.toLowerCase();
-		
-		if (referenceToServiceMap.containsKey(ref))
-			return false;
-		
-		referenceToServiceMap.put(ref, ser);
-		return true;
-	}
-	
-	/**
-	 * Retrieve a service name for a given reference
-	 * @param ref
-	 * @return service name
-	 */
-	public String getSerOfRef(String ref){
-		//ref = ref.toLowerCase();
-		
-		if (!referenceToServiceMap.containsKey(ref))
-			return null;
-		
-		return referenceToServiceMap.get(ref);
-	}
 	
 	public void addAService(String serName){
 		//serName = serName.toLowerCase();
@@ -167,20 +159,7 @@ public class Entity {
 		
 	}
 	
-	public void setComponentName(String componentName) {
-		this.componentName = componentName;
-	}
-	public String getComponentName() {
-		return componentName;
-	}
 	
-	public HashMap<String, String> getReferenceToServiceMap() {
-		return referenceToServiceMap;
-	}
-	public void setReferenceToServiceMap(
-			HashMap<String, String> referenceToServiceMap) {
-		this.referenceToServiceMap = referenceToServiceMap;
-	}
 	public ArrayList<String> getProperties() {
 		return properties;
 	}
@@ -200,93 +179,10 @@ public class Entity {
 	public ArrayList<String> getServices() {
 		return services;
 	}
-
-	public int getX() {
-		return X;
-	}
-
-	public void setX(int x) {
-		X = x;
-	}
-
-	public int getY() {
-		return Y;
-	}
-
-	public void setY(int y) {
-		Y = y;
-	}
-
-	public int getLevel() {
-		return level;
-	}
-
-	public void setLevel(int level) {
-		this.level = level;
-	}
-
-	public int getLane() {
-		return lane;
-	}
-
-	public void setLane(int lane) {
-		this.lane = lane;
-	}
-
-	public ArrayList<String> getRefProperties() {
-		return refProperties;
-	}
 	
 	public ArrayList<String> getReferences() {
 		return references;
 	}
-
-	public void setRefProperties(ArrayList<String> refProperties) {
-		this.refProperties = refProperties;
-	}
-
-	public ArrayList<String> getSerProperties() {
-		return serProperties;
-	}
-
-	public void setSerProperties(ArrayList<String> serProperties) {
-		this.serProperties = serProperties;
-	}
-
-	public ArrayList<String> getPropProperties() {
-		return propProperties;
-	}
-
-	public void setPropProperties(ArrayList<String> propProperties) {
-		this.propProperties = propProperties;
-	}
-
-	public int getRefHeight() {
-		return refHeight;
-	}
-
-	public int getSerHeight() {
-		return serHeight;
-	}
-
-	public int getPropLength() {
-		return propLength;
-	}
-
-	public void setConnectedEntities(HashSet<String> connectedEntities) {
-		this.connectedEntities = connectedEntities;
-	}
-
-	public HashSet<String> getConnectedEntities() {
-		return connectedEntities;
-	}
-
-	public int getHeight() {
-		return height;
-	}
-
-	public int getWidth() {
-		return width;
-	}
-
+	
+	
 }

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java Tue Jul 26 13:00:55 2011
@@ -37,9 +37,9 @@ public class EntityBuilder {
 	private HashMap<String, ArrayList<String>> connectedEntities = new HashMap<String, ArrayList<String>>();
 	private int totalWidth=0;
 	private int totalHeight=0;
-	private Entity startEnt = null;
+	private ComponentEntity startEnt = null;
 	private String compositeName;
-	Entity[] elts = null;
+	ComponentEntity[] elts = null;
 	
 	/**
 	 * Constructor which initiates the DOM document
@@ -76,7 +76,7 @@ public class EntityBuilder {
 	 * 
 	 * @return
 	 */
-	public Entity[] buildEntities(){
+	public ComponentEntity[] buildEntities(){
 		
 		//get the root element
 		Element docEle = dom.getDocumentElement();
@@ -86,12 +86,12 @@ public class EntityBuilder {
 		//get a nodelist of elements
 		NodeList nl = docEle.getElementsByTagName("component");
 		if(nl != null && nl.getLength() > 0 ) {
-			elts = new Entity[nl.getLength()];
+			elts = new ComponentEntity[nl.getLength()];
 			for(int i = 0 ; i < nl.getLength();i++) {
-				elts[i] = new Entity();
+				elts[i] = new ComponentEntity();
 				Element nVal = (Element)nl.item(i);
 				//System.out.println(nVal.hasAttribute("name"));
-				elts[i].setComponentName(nVal.getAttribute("name"));
+				elts[i].setName(nVal.getAttribute("name"));
 				setServices(nVal, elts[i]);
 				setReferences(nVal, elts[i]);
 				setProperties(nVal, elts[i]);
@@ -131,8 +131,8 @@ public class EntityBuilder {
 					reference = null;
 				}
 				
-				Entity e = findEntity(referenceComp);
-				System.out.println("^^^^^^^^^ "+e.getComponentName());
+				ComponentEntity e = findEntity(referenceComp);
+				System.out.println("^^^^^^^^^ "+e.getName());
 				if(e != null){
 					createConnection(e, reference, serviceComp, service);
 				}
@@ -148,17 +148,17 @@ public class EntityBuilder {
 
 	}
 	
-	private Entity findEntity(String componentName) {
+	private ComponentEntity findEntity(String componentName) {
 
-		for(Entity e: elts){
-			if(e.getComponentName().equals(componentName)){
+		for(ComponentEntity e: elts){
+			if(e.getName().equals(componentName)){
 				return e;
 			}
 		}
 		return null;
 	}
 
-	private void setReferences(Element nVal, Entity ent) {
+	private void setReferences(Element nVal, ComponentEntity ent) {
 
 		NodeList nl = nVal.getElementsByTagName("reference");
 		if(nl != null && nl.getLength() > 0 ) {
@@ -188,10 +188,10 @@ public class EntityBuilder {
 		}
 	}
 
-	private void createConnection(Entity ent, String reference,
+	private void createConnection(ComponentEntity ent, String reference,
 			String serviceComp, String service) {
 
-		String referenceComp = ent.getComponentName();
+		String referenceComp = ent.getName();
 		
 		if(reference != null &&  service != null){
 			 
@@ -220,10 +220,10 @@ public class EntityBuilder {
 		}
 	}
 
-	private void calculateProperties(Entity[] elts) {
+	private void calculateProperties(ComponentEntity[] elts) {
 		int level=0, lane=0;
 
-		for(Entity ent: elts){
+		for(ComponentEntity ent: elts){
 			level = max(level, ent.getLevel());
 			lane = max(lane, ent.getLane());
 
@@ -241,22 +241,22 @@ public class EntityBuilder {
 	}
 
 	
-	private void print(Entity[] elts) {
+	private void print(ComponentEntity[] elts) {
 
-		for(Entity ent: elts){
-			System.out.println(ent.getComponentName()+" : "+ent.getLevel()+" : "
+		for(ComponentEntity ent: elts){
+			System.out.println(ent.getName()+" : "+ent.getLevel()+" : "
 					+ent.getLane()+" : "+ent.getX()+" : "+ent.getY());
 		}
 	}
 
-	private void positionEntities(Entity[] ents){
+	private void positionEntities(ComponentEntity[] ents){
 		
-		for(Entity ent: ents){
+		for(ComponentEntity ent: ents){
 			if(ent.getAdjacentEntities().size() != 0 || ents.length==1){
 				setPosition(ent, initPoint, initPoint, 0, 0);
 				levelCount.add(0, 1);
 				startEnt = ent;
-				System.err.println(ent.getComponentName());
+				System.err.println(ent.getName());
 				break;
 			}
 		}
@@ -267,16 +267,16 @@ public class EntityBuilder {
 
 	}
 
-	private void assignPositions(Entity[] ents, Entity ent){
+	private void assignPositions(ComponentEntity[] ents, ComponentEntity ent){
 		int i=0;
 		if(ent.getAdjacentEntities().size()>0){
 			
-			System.out.println(ent.getComponentName());
+			System.out.println(ent.getName());
 			for(String name: ent.getAdjacentEntities()){
 				//System.out.println("eee "+name);
-				for(Entity aEnt: ents){
+				for(ComponentEntity aEnt: ents){
 					i++;
-					if(name.equalsIgnoreCase(aEnt.getComponentName())){
+					if(name.equalsIgnoreCase(aEnt.getName())){
 						int lane = ent.getLane()+1;
 						if(levelCount.size()<= lane){
 							levelCount.add(lane, 1);
@@ -300,14 +300,14 @@ public class EntityBuilder {
 
 
 		else{
-			ArrayList<String> conns = connectedEntities.get(ent.getComponentName());
+			ArrayList<String> conns = connectedEntities.get(ent.getName());
 			System.err.println(conns.size());
 			if(conns.size()>0){
 
 				for(String conn: conns){
-					System.err.println("conn "+conn +" : "+ent.getComponentName());
-					for(Entity e: ents){
-						if(e.getLane() == -1 && e.getComponentName().equals(conn)){
+					System.err.println("conn "+conn +" : "+ent.getName());
+					for(ComponentEntity e: ents){
+						if(e.getLane() == -1 && e.getName().equals(conn)){
 
 							int lane = ent.getLane()-1;
 							System.err.println(lane);
@@ -323,7 +323,7 @@ public class EntityBuilder {
 		}
 	}
 
-	private void setPosition(Entity ent, int x, int y, int level, int lane){
+	private void setPosition(ComponentEntity ent, int x, int y, int level, int lane){
 		ent.setX(x);
 		ent.setY(y);
 		ent.setLevel(level);
@@ -352,7 +352,7 @@ public class EntityBuilder {
 		connectedEntities.put(ent1, list);
 	}
 
-	private void setServices(Element nVal, Entity ent) {
+	private void setServices(Element nVal, ComponentEntity ent) {
 
 		NodeList nl = nVal.getElementsByTagName("service");
 		if(nl != null && nl.getLength() > 0 ) {
@@ -361,6 +361,7 @@ public class EntityBuilder {
 				ent.addAService(elt.getAttribute("name"));
 			}
 		}
+		else{
 		
 		NodeList nl1 = nVal.getElementsByTagName("implementation.java");
 		if(nl1 != null && nl1.getLength() > 0 ) {
@@ -372,9 +373,11 @@ public class EntityBuilder {
 			}
 		}
 		
+		}
+		
 	}
 
-	private void setProperties(Element nVal, Entity ent) {
+	private void setProperties(Element nVal, ComponentEntity ent) {
 
 		NodeList nl = nVal.getElementsByTagName("property");
 		if(nl != null && nl.getLength() > 0 ) {

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java?rev=1151079&r1=1151078&r2=1151079&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java Tue Jul 26 13:00:55 2011
@@ -24,7 +24,7 @@ import java.io.File;
 import org.apache.tuscany.sca.impl.diagram.DiagramGenerator;
 import org.apache.tuscany.sca.impl.io.XMLReader;
 import org.apache.tuscany.sca.impl.io.XMLWriter;
-import org.apache.tuscany.sca.impl.layout.Entity;
+import org.apache.tuscany.sca.impl.layout.ComponentEntity;
 import org.apache.tuscany.sca.impl.layout.EntityBuilder;
 import org.w3c.dom.Document;
 
@@ -38,9 +38,9 @@ public class Main {
 	public static void main(String[] args) throws Exception {
 
 		XMLReader reader = new XMLReader();
-		Document doc =reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite3.xml");
+		Document doc =reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite.xml");
 		EntityBuilder eb = new EntityBuilder(doc);
-		Entity[] ents =eb.buildEntities();
+		ComponentEntity[] ents =eb.buildEntities();
 		DiagramGenerator dg = new DiagramGenerator(ents, eb.getTotalHeight(), eb.getTotalWidth(), eb.getCompositeName());
 		Document svg =dg.buildSVGDocument();
 		File outFile = new File(outFileDir+eb.getCompositeName()+"_diagram.svg");