summaryrefslogtreecommitdiffstats
path: root/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java')
-rwxr-xr-xcollaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java47
1 files changed, 46 insertions, 1 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
index 3251fd5d75..168915f40c 100755
--- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
+++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/EntityBuilder.java
@@ -29,20 +29,52 @@ import org.w3c.dom.NodeList;
public class EntityBuilder {
private Document dom;
- private final int initPoint = 100;//initial point
+ private final int initPoint = 200;//initial point
private final int spaceX = Component.DEFAULT_WIDTH*2;
private final int spaceY = Component.DEFAULT_HEIGHT*2;
private ArrayList<Integer> levelCount = new ArrayList<Integer>();//keeps track of levels used in lanes
+ //components connected to each other are tracked using following map
private HashMap<String, ArrayList<String>> connectedEntities = new HashMap<String, ArrayList<String>>();
private int totalWidth=0;
private int totalHeight=0;
private Entity startEnt = null;
private String compositeName;
+ /**
+ * Constructor which initiates the DOM document
+ * @param aDom DOM document
+ */
public EntityBuilder(Document aDom){
dom = aDom;
}
+ /**
+ * Layout Building Algorithm
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * An Entity object represents a component element of a composite XML.
+ * Here we position (i.e. assigning a level and a lane) all such components
+ * in a unique cell of a grid.
+ *
+ * lane0 lane1 lane2 lane3 ....
+ * _______________________________
+ * level0 | | | | |
+ * |_______|_______|_______|_______|
+ * level1 | | | | |
+ * |_______|_______|_______|_______|
+ * level2 | | | | |
+ *
+ * 1) Determining the Entity at level0, lane0 (starting entity)
+ * -First Entity in the list of Entities which has one or more adjacent Entities
+ * -If there is only one Entity it will eventually chosen
+ *
+ * 2) Get adjacent Entities of starting Entity.
+ * * If there are adjacent entities;
+ * *For each adjacent Entity;
+ *
+ *
+ * @return
+ */
public Entity[] buildEntities(){
Entity[] elts = null;
//get the root element
@@ -146,6 +178,8 @@ public class EntityBuilder {
}
if(i<ents.length)
assignPositions(ents, aEnt);
+// else
+// System.out.println(i+ " <<<<< "+ents.length);
break;
}
@@ -242,6 +276,17 @@ public class EntityBuilder {
ent.addAService(elt.getAttribute("name"));
}
}
+
+ NodeList nl1 = nVal.getElementsByTagName("implementation.java");
+ if(nl1 != null && nl1.getLength() > 0 ) {
+ for(int i = 0 ; i < nl1.getLength();i++) {
+ Element elt = (Element)nl1.item(i);
+ System.out.println(elt.getAttribute("class"));
+ String serName = elt.getAttribute("class").split("\\.")[1];
+ ent.addAService(serName);
+ }
+ }
+
}
private void setProperties(Element nVal, Entity ent) {