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/08/09 19:43:00 UTC

svn commit: r1155442 - in /tuscany/collaboration/GSoC-2011-Nirmal: CompositeDiagramGeneratorUsingBatik/output/ CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ CompositeDiagramGeneratorUsingBatik/src/main/java/or...

Author: nirmal070125
Date: Tue Aug  9 17:42:59 2011
New Revision: 1155442

URL: http://svn.apache.org/viewvc?rev=1155442&view=rev
Log:
provide support for tuscany composite object and bit of refactoring

Added:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java   (with props)
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/TuscanyCompositeEntityBuilder.java   (with props)
Modified:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.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/ComponentEntity.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.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/impl/layout/LayoutBuilder.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/main/Main.java
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramShellPlugin/src/main/java/org/apache/tuscany/sca/diagram/shell/DrawShellCommand.java

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg?rev=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/MyValueComposite2_diagram.svg Tue Aug  9 17:42:59 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="#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">myVal
 ueService</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="#B
 F3EFF" 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
+<?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="130" 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">myVal
 ueService</text><polygon fill="#BF3EFF" points="510,210 540,210 555,225 540,240 510,240 525,225 " stroke="#68228B"/><text x="510" font-size="15" y="225" dominant-baseline="mathematical">stockQuoteService</text><polygon fill="#BF3EFF" points="510,250 540,250 555,265 540,280 510,280 525,265 " stroke="#68228B"/><text x="510" 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="660" y="200" fill-opacity="0.75" fill="#3D59AB" width="130" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="660" font-size="15" y="350" dominant-baseline="mathematical">StockQuoteMediatorComponent</text><polygon fill="#00CD66" points="640,210 670,210 685,225 670,240 640,240 655,225 " stroke="#008B45"/><text x="640" font-size="15" y="225" dominant-baseline="mathematical">SQMediator</text><polygon fill="#B
 F3EFF" points="770,210 800,210 815,225 800,240 770,240 785,225 " stroke="#68228B"/><text x="770" font-size="15" y="225" dominant-baseline="mathematical">stockQuoteService</text><rect fill="#EEEE00" x="680" width="20" height="20" y="190" stroke="#EEC900"/><text x="680" 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="555,225 655
 ,225" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" points="815,225 840,225 840,295 1185,295" stroke="black"/><polyline fill="none" stroke-dasharray="3 3" stroke-width="2" points="555,265 585,265 585,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 x
 link: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

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ComponentArtifact.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+public class ComponentArtifact extends Artifact{
+		
+
+	/**
+	 * Create an element with specified height and width
+	 */
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height, int width) {
+		
+		this.setHeight(height);
+		this.setWidth(width);
+		this.setxCoordinate(x);
+		this.setyCoordinate(y);
+		
+		Element rectangle = document.createElementNS(svgNs, "rect");
+		rectangle.setAttributeNS(null, "x", x+"");
+		rectangle.setAttributeNS(null, "y", y+"");
+		rectangle.setAttributeNS(null, "rx", getRoundCorner());
+		rectangle.setAttributeNS(null, "ry", getRoundCorner());
+		rectangle.setAttributeNS(null, "width", width+"");
+		rectangle.setAttributeNS(null, "height", height+"");
+		rectangle.setAttributeNS(null, "fill", "#3D59AB");
+		rectangle.setAttributeNS(null, "stroke", "#104E8B");
+		rectangle.setAttributeNS(null, "fill-opacity", "0.75");
+		return rectangle;
+	}
+
+	/**
+	 * Create an element with default height and width
+	 */
+	public Element addElement(Document document, String svgNs, int x, int y) {
+
+		return addElement(document, svgNs, x, y, Constant.COMPONENT_DEFAULT_HEIGHT, Constant.COMPONENT_DEFAULT_WIDTH);
+		
+	}
+	
+}

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

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/CompositeArtifact.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,59 @@
+/*
+ * 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;
+
+/**
+ * Structure of a "Composite" element in SCA, as a SVG element
+ *
+ */
+public class CompositeArtifact extends Artifact{
+
+
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height, int width) {
+		
+		this.setHeight(height);
+		this.setWidth(width);
+		this.setxCoordinate(x);
+		this.setyCoordinate(y);
+		
+		Element rectangle = document.createElementNS(svgNs, "rect");
+		rectangle.setAttributeNS(null, "x", x+"");
+		rectangle.setAttributeNS(null, "y", y+"");
+		rectangle.setAttributeNS(null, "rx", getRoundCorner());
+		rectangle.setAttributeNS(null, "ry", getRoundCorner());
+		rectangle.setAttributeNS(null, "width", width+"");
+		rectangle.setAttributeNS(null, "height", height+"");
+		rectangle.setAttributeNS(null, "fill", "#E5E5E5");
+		rectangle.setAttributeNS(null, "stroke", "#919191");
+		rectangle.setAttributeNS(null, "alignment-baseline", "central");
+		
+		return rectangle;
+	}
+
+//	//OBSOLETE
+//	public Element addElement(Document document, String svgNs, int x, int y) {
+//		return null;
+//	}
+	
+}

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

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/Constant.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,26 @@
+package org.apache.tuscany.sca.impl.artifacts;
+
+public final class Constant {
+	
+	public static final int COMPONENT_DEFAULT_WIDTH = 200 ;
+	public static final int COMPONENT_DEFAULT_HEIGHT = 130 ;
+	public static final int COMPONENT_TEXT_SPACING = 20 ;
+	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_PROPERTY = 20 ;	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY = 60 ;
+	public static final int SPACING_FOR_COMPONENT_OF_PROPERTY = 20 ;
+	public static final int SPACING_FOR_COMPOSITE_OF_PROPERTY = 60 ;
+	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_REFERENCE = 30 ;	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE = 90 ;
+	public static final int SPACING_FOR_COMPONENT_OF_REFERENCE = 10 ;
+	public static final int SPACING_FOR_COMPOSITE_OF_REFERENCE = 30 ;
+	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_SERVICE = 30 ;	
+	public static final int DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE = 90 ;
+	public static final int SPACING_FOR_COMPONENT_OF_SERVICE = 10 ;
+	public static final int SPACING_FOR_COMPOSITE_OF_SERVICE = 30 ;
+	
+	
+
+}

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

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java?rev=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/DashedWire.java Tue Aug  9 17:42:59 2011
@@ -22,7 +22,7 @@ package org.apache.tuscany.sca.impl.arti
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-public class DashedWire extends Wire{
+public class DashedWire extends WireArtifact{
 	
 	@Override
 	public Element addElement(Document document, String svgNs, Object a,
@@ -31,10 +31,10 @@ public class DashedWire extends Wire{
 		Element polyline = document.createElementNS(svgNs, "polyline");
 		int x1=0,x2=0,y1=0,y2=0;
 		
-		if(a instanceof Service && b instanceof Service){
+		if(a instanceof ServiceArtifact && b instanceof ServiceArtifact){
 			
-			Service aService1 = (Service)a;
-			Service aService2 = (Service)b;
+			ServiceArtifact aService1 = (ServiceArtifact)a;
+			ServiceArtifact aService2 = (ServiceArtifact)b;
 			
 			x1=aService1.getxCoordinate()+aService1.getHeight()*3/2;
 			y1=aService1.getyCoordinate()+aService1.getHeight()/2;
@@ -44,10 +44,10 @@ public class DashedWire extends Wire{
 			
 		}
 		
-		else if(a instanceof Reference && b instanceof Reference){
+		else if(a instanceof ReferenceArtifact && b instanceof ReferenceArtifact){
 			
-			Reference aReference1 = (Reference)a;
-			Reference aReference2 = (Reference)b;
+			ReferenceArtifact aReference1 = (ReferenceArtifact)a;
+			ReferenceArtifact aReference2 = (ReferenceArtifact)b;
 			
 			x1=aReference1.getxCoordinate()+aReference1.getHeight()*3/2;
 			y1=aReference1.getyCoordinate()+aReference1.getHeight()/2;

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java?rev=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/NormalWire.java Tue Aug  9 17:42:59 2011
@@ -22,14 +22,14 @@ package org.apache.tuscany.sca.impl.arti
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-public class NormalWire extends Wire{
+public class NormalWire extends WireArtifact{
 	
 	@Override
 	public Element addElement(Document document, String svgNs, Object a,
 			Object b, int changingFactor, String color) {
 		
-		Reference aReference = (Reference)a;
-		Service aService = (Service)b;
+		ReferenceArtifact aReference = (ReferenceArtifact)a;
+		ServiceArtifact aService = (ServiceArtifact)b;
 		
 		Element polyline = document.createElementNS(svgNs, "polyline");
 		int x1=aReference.getxCoordinate()+aReference.getHeight()*3/2;

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/PropertyArtifact.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+public class PropertyArtifact extends Artifact{
+	
+	/**
+	 * Property is a square.
+	 * 			 ___
+	 * 			|	|
+	 * 			|___|
+	 * 
+	 */
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height, int width) {
+		
+		this.setHeight(height);
+		this.setWidth(width);
+		this.setxCoordinate(x);
+		this.setyCoordinate(y);
+		
+		Element rectangle = document.createElementNS(svgNs, "rect");
+		rectangle.setAttributeNS(null, "x", x+"");
+		rectangle.setAttributeNS(null, "y", y+"");
+		rectangle.setAttributeNS(null, "width", height+"");
+		rectangle.setAttributeNS(null, "height", height+"");
+		rectangle.setAttributeNS(null, "fill", "#EEEE00");
+		rectangle.setAttributeNS(null, "stroke", "#EEC900");
+		//rectangle.setAttributeNS(null, "fill-opacity", "0.75");
+		
+		return rectangle;
+	}
+	
+	
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height) {
+		
+		return addElement(document, svgNs, x, y, height, height);
+	}
+
+
+}

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

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ReferenceArtifact.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,70 @@
+/*
+ * 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;
+
+public class ReferenceArtifact extends Artifact {
+	
+
+	/**
+	 * In a Reference the (x,y) coordinates refers to the top corner edge of the polygon
+	 * 		       (x,y)______
+	 * 				  	\     \ 
+	 * 					 \     \
+	 * 					 /     /
+	 * 					/____ /
+	 */
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height, int width) {
+		
+
+		this.setHeight(height);
+		this.setWidth(width);
+		this.setxCoordinate(x);
+		this.setyCoordinate(y);
+		
+		int halfOfHeight = height/2;
+		
+		Element polygon = document.createElementNS(svgNs, "polygon");
+		polygon.setAttributeNS(null, "points", 
+				""+ x +","+y+" " +
+				""+ (x+2*halfOfHeight) +","+(y)+" " +
+				""+ (x+3*halfOfHeight) +","+(y+halfOfHeight)+" " +
+				""+ (x+2*halfOfHeight) +","+(y+2*halfOfHeight)+" " +
+				""+ (x) +","+(y+2*halfOfHeight)+" " +
+				""+ (x+halfOfHeight) +","+(y+halfOfHeight)+" "
+			);
+		
+		polygon.setAttributeNS(null, "fill", "#BF3EFF");
+		polygon.setAttributeNS(null, "stroke", "#68228B");
+		
+		return polygon;
+	}
+	
+	
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height) {
+		
+		return this.addElement(document, svgNs, x, y, height, height*3/2);
+	}
+
+}

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

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/ServiceArtifact.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+public class ServiceArtifact extends Artifact{
+
+	
+
+	/**
+	 * In a Service the (x,y) coordinates refers to the top corner edge of the polygon
+	 * 		       (x,y)______
+	 * 				  	\     \ 
+	 * 					 \     \
+	 * 					 /     /
+	 * 					/____ /
+	 */
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height, int width) {
+		
+		this.setHeight(height);
+		this.setWidth(width);
+		this.setxCoordinate(x);
+		this.setyCoordinate(y);
+		
+		int halfOfHeight = height/2;
+		
+		Element polygon = document.createElementNS(svgNs, "polygon");
+		polygon.setAttributeNS(null, "points", 
+				""+ x +","+y+" " +
+				""+ (x+2*halfOfHeight) +","+(y)+" " +
+				""+ (x+3*halfOfHeight) +","+(y+halfOfHeight)+" " +
+				""+ (x+2*halfOfHeight) +","+(y+2*halfOfHeight)+" " +
+				""+ (x) +","+(y+2*halfOfHeight)+" " +
+				""+ (x+halfOfHeight) +","+(y+halfOfHeight)+" "
+			);
+		
+		polygon.setAttributeNS(null, "fill", "#00CD66");
+		polygon.setAttributeNS(null, "stroke", "#008B45");
+		
+		return polygon;
+	}
+	
+	/**
+	 * Width is 3/2 times of the height
+	 * @param document
+	 * @param svgNs
+	 * @param x
+	 * @param y
+	 * @param height
+	 * @return
+	 */
+	public Element addElement(Document document, String svgNs, int x, int y,
+			int height) {
+		
+		return this.addElement(document, svgNs, x, y, height, height*3/2);
+	}
+
+		
+}

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

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/artifacts/WireArtifact.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,64 @@
+/*
+ * 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;
+
+public abstract class WireArtifact {
+		
+	public abstract Element addElement(Document document, String svgNs, 
+			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");
+		
+		return polyline;
+	}
+
+
+}

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

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=1155442&r1=1155441&r2=1155442&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 Aug  9 17:42:59 2011
@@ -25,17 +25,18 @@ import java.util.Iterator;
 import java.util.Map.Entry;
 
 import org.apache.batik.dom.svg.SVGDOMImplementation;
-import org.apache.tuscany.sca.impl.artifacts.Component;
-import org.apache.tuscany.sca.impl.artifacts.Composite;
+import org.apache.tuscany.sca.impl.artifacts.ComponentArtifact;
+import org.apache.tuscany.sca.impl.artifacts.CompositeArtifact;
+import org.apache.tuscany.sca.impl.artifacts.Constant;
 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;
-import org.apache.tuscany.sca.impl.artifacts.Service;
+import org.apache.tuscany.sca.impl.artifacts.PropertyArtifact;
+import org.apache.tuscany.sca.impl.artifacts.ReferenceArtifact;
+import org.apache.tuscany.sca.impl.artifacts.ServiceArtifact;
 import org.apache.tuscany.sca.impl.artifacts.Text;
-import org.apache.tuscany.sca.impl.artifacts.Wire;
+import org.apache.tuscany.sca.impl.artifacts.WireArtifact;
 import org.apache.tuscany.sca.impl.layout.ComponentEntity;
 import org.apache.tuscany.sca.impl.layout.CompositeEntity;
 import org.apache.tuscany.sca.impl.layout.Entity;
@@ -49,8 +50,8 @@ public class DiagramGenerator {
 	private Document doc;
 	private String svgNS ;
 	private Element svgRoot;
-	private ArrayList<Reference> refs= new ArrayList<Reference>();
-	private ArrayList<Service> sers= new ArrayList<Service>();
+	private ArrayList<ReferenceArtifact> refs= new ArrayList<ReferenceArtifact>();
+	private ArrayList<ServiceArtifact> sers= new ArrayList<ServiceArtifact>();
 	
 	private int lastUsedChangingFactor = 0;
 	enum changingFactor{a(20), b(25), c(30), d(35), e(40), f(15);
@@ -129,14 +130,19 @@ public class DiagramGenerator {
 		it.hasNext();){
 			Entry entry = (Entry) it.next(); 
 			String compositeRef = (String)entry.getKey(); 
-			String componentRef = (String)entry.getValue();
+			ArrayList<String> componentRef = (ArrayList<String>)entry.getValue();
 
-			Reference r1 = getRef(compositeRef);
-			Reference r2 = getRef(componentRef);
+			ReferenceArtifact r1 = getRef(compositeRef);
+			
+			for(String ref: componentRef){
+				
+				ReferenceArtifact r2 = getRef(ref);
 
-			if(r1 != null && r2 != null){
-				addWire(r2, r1);
+				if(r1 != null && r2 != null){
+					addWire(r2, r1);
+				}
 			}
+			
 		}
 	}
 
@@ -148,8 +154,8 @@ public class DiagramGenerator {
 			String compositeSer = (String)entry.getKey(); 
 			String componentSer = (String)entry.getValue();
 
-			Service s1 = getSer(compositeSer);
-			Service s2 = getSer(componentSer);
+			ServiceArtifact s1 = getSer(compositeSer);
+			ServiceArtifact s2 = getSer(componentSer);
 
 			if(s1 != null && s2 != null){
 				addWire(s1, s2);
@@ -161,8 +167,8 @@ public class DiagramGenerator {
 		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 y0 = comp.getY()+comp.getHeight()-(Constant.COMPONENT_DEFAULT_HEIGHT/2+constant);
+		int height = Constant.COMPONENT_DEFAULT_HEIGHT/2;
 		int width = comp.getWidth()-constant*2;
 		
 		Element layerElt = inclusionLayer.addElement(doc, svgNS, x0, y0, height, 
@@ -199,8 +205,8 @@ public class DiagramGenerator {
 					String ref = (String)entry.getKey(); 
 					String ser = (String)entry.getValue();
 
-					Reference r = getRef(ref);
-					Service s = getSer(ser);
+					ReferenceArtifact r = getRef(ref);
+					ServiceArtifact s = getSer(ser);
 
 					if(r != null && s != null){
 						addWire(r,s);
@@ -230,30 +236,30 @@ public class DiagramGenerator {
 
 	}
 
-	private void addWire(Reference r, Service s) {
+	private void addWire(ReferenceArtifact r, ServiceArtifact s) {
 		
-		Wire edge = new NormalWire();
+		WireArtifact edge = new NormalWire();
 		Element wire = edge.addElement(doc, svgNS, r, s, getChangingFactor(), getColor());
 		svgRoot.appendChild(wire);
 	}
 
-	private void addWire(Service s1, Service s2) {
+	private void addWire(ServiceArtifact s1, ServiceArtifact s2) {
 
 		DashedWire edge = new DashedWire();
 		Element wire = edge.addElement(doc, svgNS, s1, s2, getChangingFactor(), getColor());
 		svgRoot.appendChild(wire);
 	}
 
-	private void addWire(Reference r1, Reference r2) {
+	private void addWire(ReferenceArtifact r1, ReferenceArtifact r2) {
 
 		DashedWire edge = new DashedWire();
 		Element wire = edge.addElement(doc, svgNS, r1, r2, getChangingFactor(), getColor());
 		svgRoot.appendChild(wire);
 	}
 
-	private Service getSer(String ser) {
+	private ServiceArtifact getSer(String ser) {
 
-		for(Service s: sers){
+		for(ServiceArtifact s: sers){
 			if(s.getContainerName().equals(ser) || s.getName().equals(ser)){
 				return s;
 			}
@@ -261,9 +267,9 @@ public class DiagramGenerator {
 		return null;
 	}
 
-	private Reference getRef(String ref) {
+	private ReferenceArtifact getRef(String ref) {
 
-		for(Reference r: refs){
+		for(ReferenceArtifact r: refs){
 
 			if(r.getContainerName().equals(ref) || r.getName().equals(ref)){
 				return r;
@@ -274,18 +280,18 @@ public class DiagramGenerator {
 
 	private void addComponentProperties(ComponentEntity ent) {
 		int propLen = ent.getPropLength();
-		int x= ent.getX() + Property.SPACING_FOR_COMPONENT;
+		int x= ent.getX() + Constant.SPACING_FOR_COMPONENT_OF_PROPERTY;
 		int y= ent.getY()-propLen/2;
 
 		for(String prop: ent.getProperties()){
-			Property pro = new Property();
+			PropertyArtifact pro = new PropertyArtifact();
 			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);
+			x += (propLen + Constant.SPACING_FOR_COMPONENT_OF_PROPERTY);
 
 			pro.setName(prop);
 			pro.setContainerName(ent.getName());
@@ -296,16 +302,16 @@ public class DiagramGenerator {
 		
 		int refHeight = ent.getRefHeight();
 		int x=(ent.getX()+ent.getWidth())-(refHeight*2/3);
-		int y=ent.getY() + Reference.SPACING_FOR_COMPONENT;
+		int y=ent.getY() + Constant.SPACING_FOR_COMPONENT_OF_REFERENCE;
 
 		for(String ref: setRefOrder(ent)){
-			Reference refer= new Reference();
+			ReferenceArtifact refer= new ReferenceArtifact();
 			Element polygon = refer.addElement(doc, svgNS, x, y, refHeight);
 			Element text = Text.addTextElement(doc, svgNS, x, y+refHeight/2, ref);
 			svgRoot.appendChild(polygon);
 			svgRoot.appendChild(text);
 
-			y += (refHeight + Reference.SPACING_FOR_COMPONENT);
+			y += (refHeight + Constant.SPACING_FOR_COMPONENT_OF_REFERENCE);
 
 			refer.setName(ref);
 			refer.setContainerName(ent.getName());
@@ -411,12 +417,12 @@ public class DiagramGenerator {
 	private void addComponentService(ComponentEntity ent) {
 		int serHeight = ent.getSerHeight();
 		int x= ent.getX()-(serHeight*2/3);
-		int y= ent.getY() + Service.SPACING_FOR_COMPONENT;
+		int y= ent.getY() + Constant.SPACING_FOR_COMPONENT_OF_SERVICE;
 
 		System.out.println("''''''"+ent.getName() +" '''''' "+ ent.getServices().size());
 		for(String ser: ent.getServices()){
 
-			Service serve= new Service();
+			ServiceArtifact serve= new ServiceArtifact();
 			Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
 			Element text;
 			if(!ser.endsWith("Impl"))
@@ -427,7 +433,7 @@ public class DiagramGenerator {
 			svgRoot.appendChild(polygon);
 			svgRoot.appendChild(text);
 
-			y += (serHeight + Service.SPACING_FOR_COMPONENT);
+			y += (serHeight + Constant.SPACING_FOR_COMPONENT_OF_SERVICE);
 
 			serve.setName(ser);
 			serve.setContainerName(ent.getName());
@@ -439,13 +445,13 @@ public class DiagramGenerator {
 
 		int serHeight = comp.getSerHeight();
 		int x= comp.getX()-(serHeight*2/3);
-		int y= comp.getY() + Service.SPACING_FOR_COMPOSITE;
+		int y= comp.getY() + Constant.SPACING_FOR_COMPOSITE_OF_SERVICE;
 
 		System.err.println(serHeight);
 		System.out.println("''''''"+((CompositeEntity)comp).getName() +" '''''' "+ comp.getServices().size());
 		for(String ser: comp.getServices()){
 
-			Service serve= new Service();
+			ServiceArtifact serve= new ServiceArtifact();
 			Element polygon = serve.addElement(doc, svgNS, x, y, serHeight);
 			Element text;
 			if(!ser.endsWith("Impl"))
@@ -456,7 +462,7 @@ public class DiagramGenerator {
 			svgRoot.appendChild(polygon);
 			svgRoot.appendChild(text);
 
-			y += (serHeight + Service.SPACING_FOR_COMPOSITE);
+			y += (serHeight + Constant.SPACING_FOR_COMPOSITE_OF_SERVICE);
 
 			serve.setName(ser);
 			serve.setContainerName(comp.getName());
@@ -468,16 +474,16 @@ public class DiagramGenerator {
 
 		int refHeight = comp.getRefHeight();
 		int x=(comp.getX()+comp.getWidth())-(refHeight*2/3);
-		int y=comp.getY() + Reference.SPACING_FOR_COMPOSITE;
+		int y=comp.getY() + Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE;
 
 		for(String ref: comp.getReferences()){
-			Reference refer= new Reference();
+			ReferenceArtifact refer= new ReferenceArtifact();
 			Element polygon = refer.addElement(doc, svgNS, x, y, refHeight);
 			Element text = Text.addTextElement(doc, svgNS, x, y+refHeight/2, ref);
 			svgRoot.appendChild(polygon);
 			svgRoot.appendChild(text);
 
-			y += (refHeight + Reference.SPACING_FOR_COMPOSITE);
+			y += (refHeight + Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE);
 
 			refer.setName(ref);
 			refer.setContainerName(comp.getName());
@@ -489,18 +495,18 @@ public class DiagramGenerator {
 
 	private void addCompositeProperties() {
 		int propLen = comp.getPropLength();
-		int x= comp.getX() + Property.SPACING_FOR_COMPOSITE;
+		int x= comp.getX() + Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY;
 		int y= comp.getY()-propLen/2;
 
 		for(String prop: comp.getProperties()){
-			Property pro = new Property();
+			PropertyArtifact pro = new PropertyArtifact();
 			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);
+			x += (propLen + Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY);
 
 			pro.setName(prop);
 			pro.setContainerName(comp.getName());
@@ -509,12 +515,12 @@ public class DiagramGenerator {
 
 	private void addComponent(Entity ent) {
 
-		Component comp = new Component();
+		ComponentArtifact comp = new ComponentArtifact();
 		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.getY()+(ent.getHeight()+Component.TEXT_SPACING), ent.getName());
+				ent.getY()+(ent.getHeight()+Constant.COMPONENT_TEXT_SPACING), ent.getName());
 
 		svgRoot.appendChild(com);
 		svgRoot.appendChild(text);
@@ -524,7 +530,7 @@ public class DiagramGenerator {
 
 	private void addComposite() {
 
-		Composite composite = new Composite();
+		CompositeArtifact composite = new CompositeArtifact();
 
 		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());

Modified: 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=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/ComponentEntity.java Tue Aug  9 17:42:59 2011
@@ -23,10 +23,11 @@ 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;
+import org.apache.tuscany.sca.impl.artifacts.ComponentArtifact;
+import org.apache.tuscany.sca.impl.artifacts.Constant;
+import org.apache.tuscany.sca.impl.artifacts.PropertyArtifact;
+import org.apache.tuscany.sca.impl.artifacts.ReferenceArtifact;
+import org.apache.tuscany.sca.impl.artifacts.ServiceArtifact;
 
 /**
  * Represents an unit (a component including its references, services, properties
@@ -49,45 +50,48 @@ public class ComponentEntity extends Ent
 	public ComponentEntity(){
 		
 		setStartPosition(200);
-		setHeight(Component.DEFAULT_HEIGHT);
-		setWidth(Component.DEFAULT_WIDTH);
+		setHeight(Constant.COMPONENT_DEFAULT_HEIGHT);
+		setWidth(Constant.COMPONENT_DEFAULT_HEIGHT);
 		
 		setDefaultNoOfSers(
-				Component.DEFAULT_HEIGHT / 
-				(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT+Service.SPACING_FOR_COMPONENT));
+				Constant.COMPONENT_DEFAULT_HEIGHT / 
+				(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_SERVICE +
+						Constant.SPACING_FOR_COMPONENT_OF_SERVICE));
 		setDefaultNoOfRefs(
-				Component.DEFAULT_HEIGHT / 
-				(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT+Reference.SPACING_FOR_COMPONENT));
+				Constant.COMPONENT_DEFAULT_HEIGHT / 
+				(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_REFERENCE +
+						Constant.SPACING_FOR_COMPONENT_OF_REFERENCE));
 		setDefaultNoOfProps(
-				Component.DEFAULT_WIDTH / 
-				(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT+Property.SPACING_FOR_COMPONENT));
+				Constant.COMPONENT_DEFAULT_WIDTH / 
+				(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_PROPERTY +
+						Constant.SPACING_FOR_COMPONENT_OF_PROPERTY));
 	}
 	
 	public void referenceHeight(){
 		if(getDefaultNoOfRefs() < getNoOfRefs()){
 
-			setRefHeight((Component.DEFAULT_HEIGHT / getNoOfRefs()) - Reference.SPACING_FOR_COMPONENT);
+			setRefHeight((Constant.COMPONENT_DEFAULT_HEIGHT / getNoOfRefs()) - Constant.SPACING_FOR_COMPONENT_OF_REFERENCE);
 		}
 		else
-			setRefHeight(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT);
+			setRefHeight(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_REFERENCE);
 	}
 	
 	public void serviceHeight(){
 		if(getDefaultNoOfSers() < getNoOfSers()){
 
-			setSerHeight((Component.DEFAULT_HEIGHT / getNoOfSers()) - Service.SPACING_FOR_COMPONENT);
+			setSerHeight((Constant.COMPONENT_DEFAULT_HEIGHT / getNoOfSers()) - Constant.SPACING_FOR_COMPONENT_OF_SERVICE);
 		}
 		else
-			setSerHeight(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT);
+			setSerHeight(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_SERVICE);
 	}
 	
 	public void propertyLength(){
 		if(getDefaultNoOfProps() < getNoOfProps()){
 
-			setPropLength((Component.DEFAULT_WIDTH / getNoOfProps()) - Property.SPACING_FOR_COMPONENT);
+			setPropLength((Constant.COMPONENT_DEFAULT_WIDTH / getNoOfProps()) - Constant.SPACING_FOR_COMPONENT_OF_PROPERTY);
 		}
 		else
-			setPropLength(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT);
+			setPropLength(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPONENT_OF_PROPERTY);
 	}
 	
 	/**

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java?rev=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java Tue Aug  9 17:42:59 2011
@@ -23,11 +23,12 @@ 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.Composite;
-import org.apache.tuscany.sca.impl.artifacts.Property;
-import org.apache.tuscany.sca.impl.artifacts.Reference;
-import org.apache.tuscany.sca.impl.artifacts.Service;
+import org.apache.tuscany.sca.impl.artifacts.ComponentArtifact;
+import org.apache.tuscany.sca.impl.artifacts.CompositeArtifact;
+import org.apache.tuscany.sca.impl.artifacts.Constant;
+import org.apache.tuscany.sca.impl.artifacts.PropertyArtifact;
+import org.apache.tuscany.sca.impl.artifacts.ReferenceArtifact;
+import org.apache.tuscany.sca.impl.artifacts.ServiceArtifact;
 
 /**
  * Represents an unit (a component including its references, services, properties
@@ -49,7 +50,7 @@ public class CompositeEntity extends Ent
 	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 HashMap<String, ArrayList<String>> promoteAReference = new HashMap<String, ArrayList<String>>();
 	private ArrayList<String> includedComposites = new ArrayList<String>();
 	//private HashSet<String> connectedEntities = new HashSet<String>();
 	
@@ -76,27 +77,27 @@ public class CompositeEntity extends Ent
 		
 		if(getDefaultNoOfRefs() < getNoOfRefs()){
 
-			setRefHeight((getHeight() / getNoOfRefs()) - Reference.SPACING_FOR_COMPOSITE);
+			setRefHeight((getHeight() / getNoOfRefs()) - Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE);
 		}
 		else
-			setRefHeight(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE);
+			setRefHeight(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE);
 	}
 	
 	public void serviceHeight(){
 		if(getDefaultNoOfSers() < getNoOfSers()){
-			setSerHeight((getHeight() / getNoOfSers()) - Service.SPACING_FOR_COMPOSITE);
+			setSerHeight((getHeight() / getNoOfSers()) - Constant.SPACING_FOR_COMPOSITE_OF_SERVICE);
 		}
 		else
-			setSerHeight(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE);
+			setSerHeight(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE);
 	}
 	
 	public void propertyLength(){
 		if(getDefaultNoOfProps() < getNoOfProps()){
 
-			setPropLength((getWidth() / getNoOfProps()) - Property.SPACING_FOR_COMPOSITE);
+			setPropLength((getWidth() / getNoOfProps()) - Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY);
 		}
 		else
-			setPropLength(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE);
+			setPropLength(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY);
 	}
 	
 //	/**
@@ -141,12 +142,12 @@ public class CompositeEntity extends Ent
 //	}
 
 	public void calcHeight(int initPoint) {
-		setHeight((Component.DEFAULT_HEIGHT * getSpaceFactor()) * (maxInternalLevel + 1) + initPoint);
+		setHeight((Constant.COMPONENT_DEFAULT_HEIGHT * getSpaceFactor()) * (maxInternalLevel + 1) + initPoint);
 	}
 	
 	public void calcWidth(int initPoint) {
 		System.err.println("maxInternalLane "+maxInternalLane);
-		setWidth((Component.DEFAULT_WIDTH * getSpaceFactor()) * (maxInternalLane + 1) + initPoint);
+		setWidth((Constant.COMPONENT_DEFAULT_WIDTH * getSpaceFactor()) * (maxInternalLane + 1) + initPoint);
 	}
 	
 	private int max(int a, int b){
@@ -194,13 +195,17 @@ public class CompositeEntity extends Ent
 	}
 	
 	public boolean addToPromoteAReference(String compositeRef, String componentRef){
-		//ref = ref.toLowerCase();
-		//ser = ser.toLowerCase();
+		ArrayList<String> list;
 		
-		if (promoteAReference.containsKey(compositeRef))
-			return false;
+		if (promoteAReference.containsKey(compositeRef)){
+			list = promoteAReference.get(compositeRef);		
+		}
+		else{
+			list = new ArrayList<String>();
+		}
 		
-		promoteAReference.put(compositeRef, componentRef);
+		list.add(componentRef);
+		promoteAReference.put(compositeRef, list);
 		return true;
 	}
 	
@@ -211,11 +216,11 @@ public class CompositeEntity extends Ent
 		return true;
 	}
 
-	public void setPromoteAReference(HashMap<String, String> promoteAReference) {
+	public void setPromoteAReference(HashMap<String, ArrayList<String>> promoteAReference) {
 		this.promoteAReference = promoteAReference;
 	}
 
-	public HashMap<String, String> getPromoteAReference() {
+	public HashMap<String, ArrayList<String>> getPromoteAReference() {
 		return promoteAReference;
 	}
 
@@ -247,13 +252,16 @@ public class CompositeEntity extends Ent
 		
 		setDefaultNoOfSers(
 				 getHeight()/ 
-				(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE+Service.SPACING_FOR_COMPOSITE));
+				(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE +
+						Constant.SPACING_FOR_COMPOSITE_OF_SERVICE));
 		setDefaultNoOfRefs(
 				getHeight()/ 
-				(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE+Reference.SPACING_FOR_COMPOSITE));
+				(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE +
+						Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE));
 		setDefaultNoOfProps(
 				getWidth()/ 
-				(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE+Property.SPACING_FOR_COMPOSITE));
+				(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY +
+						Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY));
 		
 		referenceHeight();
 		serviceHeight();

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=1155442&r1=1155441&r2=1155442&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 Aug  9 17:42:59 2011
@@ -21,7 +21,6 @@ package org.apache.tuscany.sca.impl.layo
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import org.apache.tuscany.sca.impl.artifacts.Component;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -29,16 +28,11 @@ import org.w3c.dom.NodeList;
 public class EntityBuilder {
 
 	private Document dom;
-	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 ComponentEntity startEnt = null;
-	//private String compositeName;
 	
 	CompositeEntity composite = null;
 	
@@ -75,7 +69,7 @@ public class EntityBuilder {
 		buildLayout.placeEntities();
 		
 		
-		System.out.println("conns "+conns[0][0]);
+		//System.out.println("conns "+conns[0][0]);
 		
 		
 		buildCompositeService(docEle);
@@ -109,7 +103,7 @@ public class EntityBuilder {
 	private void buildCompositeService(Element docEle) {
 
 		NodeList nl = docEle.getElementsByTagName("service");
-		System.err.println("^^^^^^^^^ "+nl.getLength());
+		//System.err.println("^^^^^^^^^ "+nl.getLength());
 		if(nl != null && nl.getLength() > 0 ) {
 			
 			for(int i = 0 ; i < nl.getLength();i++) {
@@ -153,18 +147,23 @@ public class EntityBuilder {
 					String compositeRef = elt.getAttribute("name");
 					composite.addAReference(compositeRef);
 
-					String target = elt.getAttribute("promote");
-
-					String reference, referenceComp;
-					String[] arr1 = extractComp(target);
-					referenceComp = arr1[0];
-					reference = arr1[1];
-
-					if(reference == null){
-						composite.addToPromoteAReference(compositeRef, referenceComp);
-					}
-					else{
-						composite.addToPromoteAReference(compositeRef, reference);
+					String targetStr = elt.getAttribute("promote");
+					
+					String[] targets = targetStr.split(" ");
+					
+					for(String target: targets){
+
+						String reference, referenceComp;
+						String[] arr1 = extractComp(target);
+						referenceComp = arr1[0];
+						reference = arr1[1];
+
+						if(reference == null){
+							composite.addToPromoteAReference(compositeRef, referenceComp);
+						}
+						else{
+							composite.addToPromoteAReference(compositeRef, reference);
+						}
 					}
 
 				}
@@ -281,7 +280,7 @@ public class EntityBuilder {
 			for(String name: ent.getAdjacentEntities()){
 				ComponentEntity e2 = findEntity(comps, name);
 				if(ent != null && e2 != null){
-					System.out.println("^^^^^^^^^ "+e2.getName());
+					//System.out.println("^^^^^^^^^ "+e2.getName());
 					connections[ent.getId()][e2.getId()] = 1;
 				}
 			}
@@ -326,33 +325,7 @@ public class EntityBuilder {
 		return connections;
 	}
 
-	/**
-	 * 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 ComponentEntity[] buildComponentEntities(Element docEle){
 		
 		ComponentEntity[] elts = null;
@@ -481,9 +454,9 @@ public class EntityBuilder {
 				ComponentEntity e1 = findEntity(elts, referenceComp);
 				//ComponentEntity e2 = findEntity(comps, serviceComp);
 				
-				System.out.println("^^^^^^^^^ "+e1.getName());
+				//System.out.println("^^^^^^^^^ "+e1.getName());
 				if(e1 != null){
-					System.out.println("^^^^^^^^^ "+e1.getId());
+					//System.out.println("^^^^^^^^^ "+e1.getId());
 					//connections[e1.getId()][e2.getId()] = 1;
 					createConnection(e1, reference, serviceComp, service);
 				}
@@ -585,6 +558,7 @@ public class EntityBuilder {
 //	}
 
 	
+	@SuppressWarnings("unused")
 	private void print(ComponentEntity[] elts) {
 
 		for(ComponentEntity ent: elts){

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java?rev=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/LayoutBuilder.java Tue Aug  9 17:42:59 2011
@@ -67,7 +67,7 @@ public class LayoutBuilder {
 		 * Finding the starting entity
 		 */
 		for(int i = 0 ; i < elts.length; i++) {
-			
+			//System.out.println("ELts "+elts.length);
 			Entity ent = elts[i];
 			if( isConnected(ent.getId()) ){
 				setPosition(ent, 0, 0);
@@ -78,7 +78,10 @@ public class LayoutBuilder {
 			
 		}
 		
-		assignPositions(startEnt);
+		if(startEnt!=null){
+			assignPositions(startEnt);
+		}
+		
 		assignPositionsOfIdleEntities();
 		assignCoordinates();
 		

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/TuscanyCompositeEntityBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/TuscanyCompositeEntityBuilder.java?rev=1155442&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/TuscanyCompositeEntityBuilder.java (added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/TuscanyCompositeEntityBuilder.java Tue Aug  9 17:42:59 2011
@@ -0,0 +1,359 @@
+/*
+ * 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.List;
+
+import org.apache.tuscany.sca.assembly.*;
+
+public class TuscanyCompositeEntityBuilder {
+
+	private Composite tuscanyComp;
+	//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;
+	
+	CompositeEntity composite = null;
+	
+	/**
+	 * Constructor which initiates the DOM document
+	 * @param aDom DOM document
+	 */
+	public TuscanyCompositeEntityBuilder(Composite comp){
+		tuscanyComp = comp;
+	}
+
+	public CompositeEntity buildCompositeEntity(){
+				
+		String compositeName;
+		compositeName = tuscanyComp.getName().getLocalPart();
+		System.out.println("compositeName "+compositeName);
+		
+		ComponentEntity[] comps = buildComponentEntities();
+		
+		buildWires(tuscanyComp.getWires(), comps);
+		
+		composite = new CompositeEntity(compositeName);
+		
+		setParent(comps);
+		
+		System.out.println("ComponentEntity "+comps[0].getId());
+		int[][] conns = buildConnectionMatrix(comps);
+		System.out.println("ComponentEntity "+conns[0][0]);
+		
+		composite.setComponentList(comps);
+		composite.setConnections(conns);
+		
+		LayoutBuilder buildLayout = new LayoutBuilder(comps , conns);
+		buildLayout.placeEntities();
+		
+		
+		System.out.println("conns "+conns[0][0]);
+		
+		
+		buildCompositeService();
+		buildCompositeReference();
+		buildCompositeProperty();
+		
+		addInclusions();
+		
+		composite.setAttributes();
+		
+		return composite;
+	}
+	
+		
+	private void setParent(ComponentEntity[] comps) {
+
+		for(ComponentEntity comp: comps){
+			comp.setParent(composite);
+		}
+	}
+
+	private void buildCompositeService() {
+		
+		List<Service> sers = tuscanyComp.getServices();
+		
+		for(int i = 0 ; i < sers.size(); i++) {
+			Service compositeSer = sers.get(i);
+			composite.addAService(compositeSer.getName());
+			String service = ((CompositeService)compositeSer).getPromotedService().getName();
+			
+			composite.addToPromoteAService(compositeSer.getName(), service);
+		}
+
+	}
+	
+	private void buildCompositeReference() {
+		
+		List<Reference> refs = tuscanyComp.getReferences();
+		
+		for(int i = 0 ; i < refs.size(); i++) {
+			Reference compositeRef = refs.get(i);
+			composite.addAReference(compositeRef.getName());
+			
+			List<ComponentReference> promotedRefs = ((CompositeReference)compositeRef).getPromotedReferences();
+			
+			for(ComponentReference ref: promotedRefs){
+				String reference = ref.getName();
+				
+				composite.addToPromoteAReference(compositeRef.getName(), reference);
+			}
+			
+		}
+
+	}
+	
+	private void buildCompositeProperty() {
+
+		List<Property> props = tuscanyComp.getProperties();
+		
+		for(int i = 0 ; i < props.size(); i++) {
+			Property compositeProp = props.get(i);
+			composite.addAProperty(compositeProp.getName());
+		}
+
+	}
+	
+	private void addInclusions() {
+		
+		List<Composite> includes = tuscanyComp.getIncludes();
+		
+		for(int i = 0 ; i < includes.size(); i++) {
+			Composite anInclude = includes.get(i);
+			composite.addToIncludedComposites(anInclude.getName().getLocalPart());
+		}
+
+	}
+
+	private int[][] buildConnectionMatrix(ComponentEntity[] comps) {
+
+		int[][] connections = new int[comps.length][comps.length];
+		connections = initConnections(connections);
+		 
+		for(Entity ent: comps){
+			for(String name: ent.getAdjacentEntities()){
+				ComponentEntity e2 = findEntity(comps, name);
+				if(ent != null && e2 != null){
+					//System.out.println("^^^^^^^^^ "+e2.getName());
+					connections[ent.getId()][e2.getId()] = 1;
+				}
+			}
+				
+		}
+
+		return connections;
+	}
+	
+	private String extractComp(ComponentEntity[] elts, String str, boolean isReference) {
+		
+		if(isReference){
+			for(ComponentEntity elt: elts){
+				for(String ref: elt.getReferences()){
+					if(ref.equals(str)){
+						return elt.getName();
+					}
+				}
+			}
+		}
+		else{
+			for(ComponentEntity elt: elts){
+				for(String ser: elt.getServices()){
+					if(ser.equals(str)){
+						return elt.getName();
+					}
+				}
+			}
+		}
+		return "";
+		
+	}
+
+	private int[][] initConnections(int[][] connections) {
+
+		for(int i=0; i<connections.length ; i++){
+			for(int j=0; j<connections.length ; j++){
+				connections[i][j] =0;
+			}
+		}
+		return connections;
+	}
+
+	
+	public ComponentEntity[] buildComponentEntities(){
+		
+		ComponentEntity[] elts = null;
+		
+		List<Component> components = tuscanyComp.getComponents();
+		
+		elts = new ComponentEntity[components.size()];
+		
+		for(int i = 0 ; i < components.size() ;i++) {
+			Component aComp = components.get(i);
+			
+			elts[i] = new ComponentEntity();
+			elts[i].setId(i);
+			elts[i].setName(aComp.getName());
+			
+			setServices(aComp.getServices(), elts[i]);
+			setReferences(aComp.getReferences(), elts[i]);
+			setProperties(aComp.getProperties(), elts[i]);
+			
+			elts[i].referenceHeight();
+			elts[i].serviceHeight();
+			elts[i].propertyLength();
+		}
+		
+
+		return elts;
+
+	}
+	
+	private void buildWires(List<Wire> wires, ComponentEntity[] elts) {
+
+		for(int i = 0 ; i < wires.size(); i++) {
+			String service, serviceComp, reference, referenceComp;
+			Wire aWire = wires.get(i);
+			
+			reference = aWire.getSource().getName();
+			service = aWire.getTarget().getName();
+			
+			referenceComp = extractComp(elts, reference, true);
+			serviceComp = extractComp(elts, service, false);
+			
+			ComponentEntity e1 = findEntity(elts, referenceComp);
+			
+			//System.out.println("^^^^^^^^^ "+e1.getName());
+			if(e1 != null){
+				//System.out.println("^^^^^^^^^ "+e1.getId());
+				//connections[e1.getId()][e2.getId()] = 1;
+				createConnection(e1, reference, serviceComp, service);
+			}
+		}
+
+	}
+
+	private ComponentEntity findEntity(ComponentEntity[] elts, String componentName) {
+
+		for(ComponentEntity e: elts){
+			if(e.getName().equals(componentName)){
+				return e;
+			}
+		}
+		return null;
+	}
+
+	private void setReferences(List<ComponentReference> refs, ComponentEntity ent) {
+
+		for(int i = 0 ; i < refs.size() ;i++) {
+			ent.addAReference(refs.get(i).getName());
+		}
+
+	}
+
+	private void createConnection(ComponentEntity ent, String reference,
+			String serviceComp, String service) {
+
+		String referenceComp = ent.getName();
+
+		if(reference != null &&  service != null){
+
+			ent.addToRefToSerMap(reference, service);
+			ent.addAnAdjacentEntity(serviceComp);
+			addToConnectedEntities(referenceComp, serviceComp);
+			addToConnectedEntities(serviceComp, referenceComp);
+		}
+		else if(reference == null &&  service != null){
+			ent.addToRefToSerMap(referenceComp, service);
+			ent.addAnAdjacentEntity(serviceComp);
+			addToConnectedEntities(referenceComp, serviceComp);
+			addToConnectedEntities(serviceComp, referenceComp);
+		}
+		else if(reference != null &&  service == null){
+			ent.addToRefToSerMap(reference, serviceComp);
+			ent.addAnAdjacentEntity(serviceComp);
+			addToConnectedEntities(referenceComp, serviceComp);
+			addToConnectedEntities(serviceComp, referenceComp);
+		}
+		else{
+			ent.addToRefToSerMap(referenceComp, serviceComp);
+			ent.addAnAdjacentEntity(serviceComp);
+			addToConnectedEntities(referenceComp, serviceComp);
+			addToConnectedEntities(serviceComp, referenceComp);
+		}
+	}
+
+
+	@SuppressWarnings("unused")
+	private void print(ComponentEntity[] elts) {
+
+		for(ComponentEntity ent: elts){
+			System.out.println(ent.getName()+" : "+ent.getLevel()+" : "
+					+ent.getLane()+" : "+ent.getX()+" : "+ent.getY());
+		}
+	}
+
+
+	private void addToConnectedEntities(String ent1, String ent2) {
+		System.err.println(ent1+" : "+ent2);
+		ArrayList<String> list;
+		if(connectedEntities.containsKey(ent1)){
+			list = connectedEntities.get(ent1);
+			
+		}
+		else{
+			list =new ArrayList<String>();
+			
+		}
+		list.add(ent2);
+		connectedEntities.put(ent1, list);
+	}
+
+	private void setServices(List<ComponentService> sers, ComponentEntity ent) {
+
+		for(int i = 0 ; i < sers.size() ;i++) {
+			ent.addAService(sers.get(i).getName());
+		}
+		
+	}
+
+
+	private void setProperties(List<ComponentProperty> props, ComponentEntity ent) {
+
+		for(int i = 0 ; i < props.size(); i++) {
+			ent.addAProperty(props.get(i).getName());
+		}
+
+	}
+
+	public int getTotalWidth() {
+		return totalWidth;
+	}
+
+	public int getTotalHeight() {
+		return totalHeight;
+	}
+
+
+
+}

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

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=1155442&r1=1155441&r2=1155442&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 Aug  9 17:42:59 2011
@@ -24,10 +24,8 @@ 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.ComponentEntity;
 import org.apache.tuscany.sca.impl.layout.CompositeEntity;
 import org.apache.tuscany.sca.impl.layout.EntityBuilder;
-import org.apache.tuscany.sca.impl.layout.LayoutBuilder;
 import org.w3c.dom.Document;
 
 public class Main {
@@ -43,15 +41,7 @@ public class Main {
 		Document doc =reader.parseXMLFile(System.getProperty("user.dir")+"/input/composite_with_compositeService.xml");//composite1.xml composite_with_compositeService.xml");
 		EntityBuilder eb = new EntityBuilder(doc);
 		CompositeEntity comp =eb.buildCompositeEntity();
-		System.out.println("comp "+comp.getName());
 		
-//		ComponentEntity[] ents = comp.getComponentList();
-//		int[][] conns = comp.getConnections();
-//		System.out.println("entConns "+conns.length);
-//		LayoutBuilder buildLayout = new LayoutBuilder(ents , conns);
-//		buildLayout.buildEntities();
-		
-		//DiagramGenerator dg = new DiagramGenerator(ents, eb.getTotalHeight(), eb.getTotalWidth(), eb.getCompositeName());
 		DiagramGenerator dg = new DiagramGenerator(comp);
 		Document svg =dg.buildSVGDocument();
 		

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramShellPlugin/src/main/java/org/apache/tuscany/sca/diagram/shell/DrawShellCommand.java
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramShellPlugin/src/main/java/org/apache/tuscany/sca/diagram/shell/DrawShellCommand.java?rev=1155442&r1=1155441&r2=1155442&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramShellPlugin/src/main/java/org/apache/tuscany/sca/diagram/shell/DrawShellCommand.java (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramShellPlugin/src/main/java/org/apache/tuscany/sca/diagram/shell/DrawShellCommand.java Tue Aug  9 17:42:59 2011
@@ -35,6 +35,7 @@ import org.apache.tuscany.sca.impl.diagr
 import org.apache.tuscany.sca.impl.io.XMLWriter;
 import org.apache.tuscany.sca.impl.layout.CompositeEntity;
 import org.apache.tuscany.sca.impl.layout.EntityBuilder;
+import org.apache.tuscany.sca.impl.layout.TuscanyCompositeEntityBuilder;
 import org.apache.tuscany.sca.shell.Command;
 import org.apache.tuscany.sca.shell.Shell;
 import org.apache.tuscany.sca.shell.jline.CompositeURICompletor;
@@ -75,14 +76,16 @@ public class DrawShellCommand implements
         //TODO: really all we want is to pass the Tuscany Composite object to the SVG drawing code,
         //      but for now as that requires an XML file to the Composite to XML:
         
-        String compositeXML = Utils.modelToXML(composite, false, node.getExtensionPointRegistry());
-        DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-        Document doc = db.parse(new ByteArrayInputStream(compositeXML.getBytes()));
-        EntityBuilder eb = new EntityBuilder(doc);
+//        String compositeXML = Utils.modelToXML(composite, false, node.getExtensionPointRegistry());
+//        DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+//        Document doc = db.parse(new ByteArrayInputStream(compositeXML.getBytes()));
+//        EntityBuilder eb = new EntityBuilder(doc);
+        
+        TuscanyCompositeEntityBuilder eb = new TuscanyCompositeEntityBuilder(composite);
         CompositeEntity comp = eb.buildCompositeEntity();
         DiagramGenerator dg = new DiagramGenerator(comp);
         Document svg = dg.buildSVGDocument();
-        File outFile = File.createTempFile("tmp", "svg");
+        File outFile = File.createTempFile("tmp", ".svg");
         XMLWriter writer = new XMLWriter();
         writer.fileWriter(svg, outFile);