tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nirmal070...@apache.org
Subject svn commit: r1142395 - in /tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik: ./ input/ output/ src/main/java/org/apache/tuscany/sca/impl/diagram/ src/main/java/org/apache/tuscany/sca/impl/layout/
Date Sun, 03 Jul 2011 08:11:18 GMT
Author: nirmal070125
Date: Sun Jul  3 08:11:18 2011
New Revision: 1142395

URL: http://svn.apache.org/viewvc?rev=1142395&view=rev
Log:
add support to wire element

Added:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
  (with props)
Modified:
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite1.xml
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml
    tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml
    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/EntityBuilder.java

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite1.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite1.xml?rev=1142395&r1=1142394&r2=1142395&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite1.xml
(original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite1.xml
Sun Jul  3 08:11:18 2011
@@ -39,7 +39,9 @@
 
     <component name="ShipperComponent">
         <implementation.java class="supplychain.ShipperComponentImpl" />
-        <reference name="customer" target="CustomerComponent"/>
+        <reference name="customer" />
     </component>
+    
+    <wire source="ShipperComponent/customer" target="CustomerComponent" />
 
 </composite>
\ No newline at end of file

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml?rev=1142395&r1=1142394&r2=1142395&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml
(original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/input/composite3.xml
Sun Jul  3 08:11:18 2011
@@ -44,7 +44,7 @@
 
     <component name="DivideServiceComponent">
         <implementation.java class="calculator.DivideServiceImpl"/>
-        <reference name="dividetestService" target="AddServiceComponent" />
+        <!-- reference name="dividetestService" target="AddServiceComponent" / -->
     </component>
 
 </composite>
\ No newline at end of file

Added: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg?rev=1142395&view=auto
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
(added)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
Sun Jul  3 08:11:18 2011
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg" contentScriptType="text/ecmascript" zoomAndPan="magnify"
contentStyleType="text/css" preserveAspectRatio="xMidYMid meet" version="1.0"><rect
x="0" y="0" alignment-baseline="central" fill="#E5E5E5" width="1000" rx="20" ry="20" height="1240"
stroke="#919191"/><text x="500" font-size="10" dominant-baseline="mathematical" y="20"
text-anchor="middle">CalculatorTest</text><rect x="200" y="200" fill-opacity="0.75"
fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="250"
font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">CalculatorServiceComponent</text><polygon
fill="#00CD66" points="180,210 210,210 225,225 210,240 180,240 195,225 " stroke="#008B45"/><text
x="180" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><polygon
fill="#BF3EFF" points="386,210 408,210 419,221 408,2
 32 386,232 397,221 " stroke="#68228B"/><text x="386" font-size="10" dominant-baseline="mathematical"
y="221" text-anchor="middle">subtractService</text><polygon fill="#BF3EFF" points="386,242
408,242 419,253 408,264 386,264 397,253 " stroke="#68228B"/><text x="386" font-size="10"
dominant-baseline="mathematical" y="253" text-anchor="middle">divideService</text><polygon
fill="#BF3EFF" points="386,274 408,274 419,285 408,296 386,296 397,285 " stroke="#68228B"/><text
x="386" font-size="10" dominant-baseline="mathematical" y="285" text-anchor="middle">multiplyService</text><polygon
fill="#BF3EFF" points="386,306 408,306 419,317 408,328 386,328 397,317 " stroke="#68228B"/><text
x="386" font-size="10" dominant-baseline="mathematical" y="317" text-anchor="middle">addService</text><rect
x="600" y="980" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="1130"
text-anchor="middl
 e">AddServiceComponent</text><polygon fill="#00CD66" points="580,990 610,990
625,1005 610,1020 580,1020 595,1005 " stroke="#008B45"/><text x="580" font-size="10"
dominant-baseline="mathematical" y="1005" text-anchor="middle"></text><rect x="600"
y="200" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text
x="650" font-size="10" dominant-baseline="mathematical" y="350" text-anchor="middle">SubtractServiceComponent</text><polygon
fill="#00CD66" points="580,210 610,210 625,225 610,240 580,240 595,225 " stroke="#008B45"/><text
x="580" font-size="10" dominant-baseline="mathematical" y="225" text-anchor="middle"></text><rect
x="600" y="720" fill-opacity="0.75" fill="#3D59AB" width="200" rx="20" ry="20" height="130"
stroke="#104E8B"/><text x="650" font-size="10" dominant-baseline="mathematical" y="870"
text-anchor="middle">MultiplyServiceComponent</text><polygon fill="#00CD66" points="580,730
610,730 625,745 610,760 580,760 595,745 " s
 troke="#008B45"/><text x="580" font-size="10" dominant-baseline="mathematical" y="745"
text-anchor="middle"></text><rect x="600" y="460" fill-opacity="0.75" fill="#3D59AB"
width="200" rx="20" ry="20" height="130" stroke="#104E8B"/><text x="650" font-size="10"
dominant-baseline="mathematical" y="610" text-anchor="middle">DivideServiceComponent</text><polygon
fill="#00CD66" points="580,470 610,470 625,485 610,500 580,500 595,485 " stroke="#008B45"/><text
x="580" font-size="10" dominant-baseline="mathematical" y="485" text-anchor="middle"></text><polyline
stroke-width="2" points="419,317 595,1005" stroke="black"/><polyline stroke-width="2"
points="419,253 595,485" stroke="black"/><polyline stroke-width="2" points="419,285
595,745" stroke="black"/><polyline stroke-width="2" points="419,221 595,225" stroke="black"/></svg>
\ No newline at end of file

Propchange: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/output/CalculatorTest_diagram.svg
------------------------------------------------------------------------------
    svn:executable = *

Modified: tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml?rev=1142395&r1=1142394&r2=1142395&view=diff
==============================================================================
--- tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml (original)
+++ tuscany/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/pom.xml Sun
Jul  3 08:11:18 2011
@@ -103,7 +103,12 @@
             <artifactId>tuscany-base-runtime</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
-
+        
+        <dependency>
+            <groupId>org.apache.ws.commons.schema</groupId>
+            <artifactId>XmlSchema</artifactId>
+            <version>1.4.3</version>
+        </dependency>
     </dependencies>
 
 

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=1142395&r1=1142394&r2=1142395&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
Sun Jul  3 08:11:18 2011
@@ -170,7 +170,7 @@ public class DiagramGenerator {
 			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);
@@ -189,7 +189,7 @@ public class DiagramGenerator {
 							if(s1.equals(s) || s.equals(ent.getComponentName())){
 								System.err.println("|||||||| "+ sers.size()+ " ||| " + refs.size()+"|| "+orderedRefs.length);
 								if(orderedRefs[ent.getLevel()] == null){
-//									System.err.println("XXXXX "+ sers.get(1)+ " ::::::: "+refs.get(1));
+									System.err.println("XXXXX "+ sers.get(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());

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=1142395&r1=1142394&r2=1142395&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
Sun Jul  3 08:11:18 2011
@@ -39,6 +39,7 @@ public class EntityBuilder {
 	private int totalHeight=0;
 	private Entity startEnt = null;
 	private String compositeName;
+	Entity[] elts = null;
 	
 	/**
 	 * Constructor which initiates the DOM document
@@ -76,7 +77,7 @@ public class EntityBuilder {
 	 * @return
 	 */
 	public Entity[] buildEntities(){
-		Entity[] elts = null;
+		
 		//get the root element
 		Element docEle = dom.getDocumentElement();
 		compositeName = docEle.getAttribute("name");
@@ -99,6 +100,44 @@ public class EntityBuilder {
 				elts[i].propertyLength();
 			}
 		}
+		//sec. 5.4 in the spec
+		nl = docEle.getElementsByTagName("wire");
+		System.out.println("^^^^^^^^^ "+nl.getLength());
+		if(nl != null && nl.getLength() > 0 ) {
+			for(int i = 0 ; i < nl.getLength();i++) {
+				Element elt = (Element)nl.item(i);
+				String source = elt.getAttribute("source");
+				String target = elt.getAttribute("target");
+				String service, serviceComp, reference, referenceComp;
+				
+				System.out.println("^^^^^^^^^ "+source+" ::: "+target);
+				if(target.contains("/")){
+					String[] arr = target.split("/");
+					serviceComp = arr[0];
+					service = arr[1];
+				}
+				else{
+					serviceComp = target;
+					service = null;
+				}
+				
+				if(source.contains("/")){
+					String[] arr = source.split("/");
+					referenceComp = arr[0];
+					reference = arr[1];
+				}
+				else{
+					referenceComp = source;
+					reference = null;
+				}
+				
+				Entity e = findEntity(referenceComp);
+				System.out.println("^^^^^^^^^ "+e.getComponentName());
+				if(e != null){
+					createConnection(e, reference, serviceComp, service);
+				}
+			}
+		}
 
 		positionEntities(elts);
 
@@ -108,6 +147,78 @@ public class EntityBuilder {
 		return elts;
 
 	}
+	
+	private Entity findEntity(String componentName) {
+
+		for(Entity e: elts){
+			if(e.getComponentName().equals(componentName)){
+				return e;
+			}
+		}
+		return null;
+	}
+
+	private void setReferences(Element nVal, Entity ent) {
+
+		NodeList nl = nVal.getElementsByTagName("reference");
+		if(nl != null && nl.getLength() > 0 ) {
+			for(int i = 0 ; i < nl.getLength();i++) {
+				Element elt = (Element)nl.item(i);
+				String target = elt.getAttribute("target");
+				String ref = elt.getAttribute("name");
+				if(target.contains("/")){
+					String[] arr = target.split("/");
+					createConnection(ent, ref, arr[0], arr[1]);
+//					ent.addToRefToSerMap(ref, arr[1]);
+//					ent.addAnAdjacentEntity(arr[0]);
+//					addToConnectedEntities(ent.getComponentName(), arr[0]);
+//					addToConnectedEntities(arr[0], ent.getComponentName());
+				}
+				else if(!target.equals("")){
+					createConnection(ent, ref, target, null);
+//					ent.addToRefToSerMap(ref, target);
+//					ent.addAnAdjacentEntity(target);
+//					addToConnectedEntities(ent.getComponentName(), target);
+//					addToConnectedEntities(target, ent.getComponentName());
+				}
+
+				ent.addAReference(ref);
+
+			}
+		}
+	}
+
+	private void createConnection(Entity ent, String reference,
+			String serviceComp, String service) {
+
+		String referenceComp = ent.getComponentName();
+		
+		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);
+		}
+	}
 
 	private void calculateProperties(Entity[] elts) {
 		int level=0, lane=0;
@@ -224,33 +335,7 @@ public class EntityBuilder {
 		return str.split("/");
 	}
 
-	private void setReferences(Element nVal, Entity ent) {
-
-		NodeList nl = nVal.getElementsByTagName("reference");
-		if(nl != null && nl.getLength() > 0 ) {
-			for(int i = 0 ; i < nl.getLength();i++) {
-				Element elt = (Element)nl.item(i);
-				String target = elt.getAttribute("target");
-				String ref = elt.getAttribute("name");
-				if(target.contains("/")){
-					ent.addToRefToSerMap(ref,  target.split("/")[1]);
-					ent.addAnAdjacentEntity(target.split("/")[0]);
-					addToConnectedEntities(ent.getComponentName(), target.split("/")[0]);
-					addToConnectedEntities(target.split("/")[0], ent.getComponentName());
-				}
-				else if(!target.equals("")){
-					
-					ent.addToRefToSerMap(ref, target);
-					ent.addAnAdjacentEntity(target);
-					addToConnectedEntities(ent.getComponentName(), target);
-					addToConnectedEntities(target, ent.getComponentName());
-				}
-
-				ent.addAReference(ref);
-
-			}
-		}
-	}
+	
 
 	private void addToConnectedEntities(String ent1, String ent2) {
 		System.err.println(ent1+" : "+ent2);



Mime
View raw message