/** * This method returns the invocation link associated with the supplied * source and target operation nodes. * * @param source The source * @param target The target * @return The invocation link, or null if not found */ public InvocationLink getInvocationLink(OperationNode source, OperationNode target) { InvocationLink ret=null; for (InvocationLink eil : getInvocationLinks()) { if (eil.getSource() == source && eil.getTarget() == target) { ret = eil; break; } } return (ret); }
ServiceNode focus=sg.getServiceNode(focusServiceType); java.util.Iterator<ServiceNode> serviceNodeIter=sg.getServiceNodes().iterator(); if (sg.getUsageLink(node, focus) != null) { continue; if (!isServiceProvider(sg, node, focus, visited)) { java.util.Iterator<InvocationLink> ilIter=sg.getInvocationLinks().iterator(); if (node.getOperations().contains(il.getSource()) || node.getOperations().contains(il.getTarget())) { ilIter.remove(); java.util.Iterator<UsageLink> ulIter=sg.getUsageLinks().iterator(); if (ul.getSource() == node || ul.getTarget() == node) { ulIter.remove();
tsn = sg.getServiceNode(id.getServiceType()); tsn = sg.getServiceNodeForInterface(id.getInterface()); UsageLink existingul=sg.getUsageLink(sn, tsn); UsageLink ul=new UsageLink(); ul.setSource(sn); ul.setTarget(tsn); ul.getInvocations().add(id); sg.getUsageLinks().add(ul); existingul.getInvocations().add(id); OperationNode topn=tsn.getOperation(id.getOperation()); InvocationLink existingil=sg.getInvocationLink(opn, topn); InvocationLink il=new InvocationLink(); il.setSource(opn); il.setTarget(topn); il.getInvocations().add(id); sg.getInvocationLinks().add(il); } else { LOG.fine("Link between source '"+opn
if (!ul.getSource().getProperties().containsKey(ServiceGraphLayout.WIDTH)) { if (LOG.isLoggable(Level.FINER)) { LOG.fine("Source node on usage link with definition '"+ul.getSource().getService()+"' does not have layout information"); if (!ul.getTarget().getProperties().containsKey(ServiceGraphLayout.WIDTH)) { if (LOG.isLoggable(Level.FINER)) { LOG.fine("Target node on usage link with definition '"+ul.getTarget().getService()+"' does not have layout information"); int x1=(int)(((Integer)ul.getSource().getProperties().get(ServiceGraphLayout.X_POSITION) +(Integer)ul.getSource().getProperties().get(ServiceGraphLayout.WIDTH)) * ratio); int y1=(int)(((Integer)ul.getSource().getProperties().get(ServiceGraphLayout.Y_POSITION)) * ratio); int x2=(int)(((Integer)ul.getTarget().getProperties().get(ServiceGraphLayout.X_POSITION)) * ratio); int y2=(int)(((Integer)ul.getTarget().getProperties().get(ServiceGraphLayout.Y_POSITION)) * ratio); int x3=(int)(((Integer)ul.getTarget().getProperties().get(ServiceGraphLayout.X_POSITION)) * ratio); int y3=(int)(((Integer)ul.getTarget().getProperties().get(ServiceGraphLayout.Y_POSITION) +(Integer)ul.getTarget().getProperties().get(ServiceGraphLayout.HEIGHT)) * ratio); int x4=(int)(((Integer)ul.getSource().getProperties().get(ServiceGraphLayout.X_POSITION) +(Integer)ul.getSource().getProperties().get(ServiceGraphLayout.WIDTH)) * ratio); int y4=(int)(((Integer)ul.getSource().getProperties().get(ServiceGraphLayout.Y_POSITION) +(Integer)ul.getSource().getProperties().get(ServiceGraphLayout.HEIGHT)) * ratio); Severity severity=getInvocationSeverity(ul.getInvocations());
if (sg.getUsageLink(focus, node) != null) { return (true); for (UsageLink ul : sg.getUsageLinks()) { if (ul.getTarget() == node) { if (isServiceProvider(sg, ul.getSource(), focus, visited)) { return (true);
/** * This method returns the usage link associated with the supplied * source and target service nodes. * * @param source The source * @param target The target * @return The usage link, or null if not found */ public UsageLink getUsageLink(ServiceNode source, ServiceNode target) { UsageLink ret=null; for (UsageLink eul : getUsageLinks()) { if (eul.getSource() == source && eul.getTarget() == target) { ret = eul; break; } } return (ret); }
for (ServiceNode sn : sg.getServiceNodes()) { if (sn.getProperties().get(ServiceNode.INITIAL_NODE) == Boolean.TRUE) { initialNodes.add(sn); layoutService(sg, sn, SERVICE_INITIAL_HORIZONTAL_PADDING, _height+SERVICE_VERTICAL_PADDING); sg.getProperties().put(ServiceGraphLayout.HEIGHT, _height); sg.getProperties().put(ServiceGraphLayout.WIDTH, _width);
/** * This method returns the description to be used for the * invocation link. * * @param il The invocation link * @return The description */ protected String getDescription(UsageLink ul) { return (ul.getSource().getService().getServiceType() +" -> "+ul.getTarget().getService().getServiceType()); }
/** * This method returns the description to be used for the * invocation link. * * @param il The invocation link * @return The description */ protected String getDescription(InvocationLink il) { return (il.getTarget().getService().getServiceType() +" -> "+il.getTarget().getOperation().getName()); }
/** * This method builds a service graph from a collection of service * definitions. If specified, the result will focus on a nominated service, * only showing its direct client services, and the services it directly * or indirectly calls. * * @param sds The service definitions * @param sits The situations * @param focusServiceType The optional service type to focus on * @return The service graph */ public static ServiceGraph buildGraph(java.util.Set<ServiceDefinition> sds, java.util.List<Situation> sits, String focusServiceType) { ServiceGraph ret=buildGraph(sds, sits); if (focusServiceType != null) { filter(ret, focusServiceType); } return (ret); }
public int compare(UsageLink o1, UsageLink o2) { // TODO: May need to sort based on interface's localpart, if a fully qualified name return (o1.getTarget().getService().getServiceType().compareTo( o2.getTarget().getService().getServiceType())); } });
public int compare(ServiceNode o1, ServiceNode o2) { // TODO: May need to sort based on interface's localpart, if a fully qualified name return (o1.getService().getServiceType().compareTo(o2.getService().getServiceType())); } });
public int compare(OperationNode o1, OperationNode o2) { return (o1.getOperation().getName().compareTo(o2.getOperation().getName())); } });
/** * This method determines whether the supplied service node * requires layout. * * @param sn The service node * @return Whether the service node requires layout */ protected boolean requiresLayout(ServiceNode sn) { return (sn.getProperties().get(ServiceGraphLayout.X_POSITION) == null); }
/** * This method returns the set of service definitions that * initiate business activity (i.e. have no client services). * * @param sds The service definitions * @return The set of initial services */ public static java.util.Set<ServiceDefinition> getInitialServices(java.util.Collection<ServiceDefinition> sds) { java.util.Set<ServiceDefinition> ret= new java.util.HashSet<ServiceDefinition>(); for (ServiceDefinition sd : sds) { java.util.Set<ServiceDefinition> clients= getServiceClients(sd, sds); if (clients.size() == 0) { ret.add(sd); } } return (ret); }
/** * This method returns the service node associated with * the supplied service interface. * * @param intf The interface * @return The service node, or null if not found */ public ServiceNode getServiceNodeForInterface(String intf) { ServiceNode ret=null; for (ServiceNode sn : _nodes) { if (sn.getService().getInterface(intf) != null) { ret = sn; break; } } return (ret); }
/** * This method returns the operation node associated with * the supplied name. * * @param name The operation name * @return The operation node, or null if not found */ public OperationNode getOperation(String name) { OperationNode ret=null; for (OperationNode opn : _operations) { if (opn.getOperation().getName().equals(name)) { ret = opn; break; } } return (ret); }
/** * This method returns the service node associated with * the supplied service interface. * * @param serviceType The service type * @return The service node, or null if not found */ public ServiceNode getServiceNode(String serviceType) { ServiceNode ret=null; for (ServiceNode sn : _nodes) { if (sn.getService().getServiceType().equals(serviceType)) { ret = sn; break; } } return (ret); }