diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout')
2 files changed, 45 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/Entity.java b/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/Entity.java index 582b8ed37b..678846d585 100755 --- a/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/Entity.java +++ b/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/Entity.java @@ -31,6 +31,8 @@ public abstract class Entity { private ArrayList<String> properties = new ArrayList<String>(); private HashSet<String> adjacentEntities = new HashSet<String>(); + + private String implementation; public abstract void referenceHeight(); @@ -255,5 +257,14 @@ public abstract class Entity { public Entity getParent() { return parent; } + + public String getImplementation() { + return implementation; + } + + public void setImplementation(String implementation) { + this.implementation = implementation; + } + } diff --git a/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/EntityBuilder.java b/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/EntityBuilder.java index 33ff1209cb..70171e484c 100755 --- a/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/EntityBuilder.java +++ b/sca-java-2.x/trunk/modules/composite-diagram/src/main/java/org/apache/tuscany/sca/diagram/layout/EntityBuilder.java @@ -340,6 +340,7 @@ public class EntityBuilder { elts[i].setId(i); elts[i].setName(nVal.getAttribute("name")); + setImplementation(nVal, elts[i]); setServices(nVal, elts[i]); setReferences(nVal, elts[i]); setProperties(nVal, elts[i]); @@ -684,6 +685,39 @@ public class EntityBuilder { } + private void setImplementation(Element nVal, ComponentEntity ent) { + NodeList nodes = nVal.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + if (nodes.item(i) instanceof Element) { + Element elt = (Element)nodes.item(i); + String name = elt.getNodeName(); + if (name != null && name.contains(":")) { + name = name.substring(name.indexOf(':') + 1).trim(); + } + if (name != null && name.startsWith("implementation.")) { + String type = name.substring("implementation.".length()); + if ("implementation.java".equals(name)) { + String cls = elt.getAttribute("class"); + ent.setImplementation(type + ":" + extractClassName(cls)); + } else { + ent.setImplementation(type); + } + break; + } + } + } + } + + private String extractClassName(String classAttr){ + if(classAttr==null) { + return ""; + } else { + int index = classAttr.lastIndexOf('.'); + return classAttr.substring(index+1); + } + } + /** * * This will extract the service name part from the class attribute of |