[kepler-users] get list of connected ports

Ufuk Utku Turuncoglu turuncu at ucar.edu
Tue Apr 28 10:43:23 PDT 2009


Hi,

I want to get connected port list and connected actor names. My case is 
follows,

actor A has port Ap1 and this port connect to another actor (B) and its 
port Bp1. In this case, i can get actor B name from actor A using 
following code,

In actor A:

            int i = -1;
            Iterator connections = port.connectedPortList().iterator();
            while (connections.hasNext()) {
                i++;
                // get connected ports and its containers
                connection[i] = (Port) connections.next();
                container[i] = connection[i].getContainer();
                String name = container[i].getName();
               
                // check: connected actor is actor B or not
                if (name.contains("Name of actor B")) {
                    connected = true;
                }
            }

it normally returns name of connected actor (in our case actor B) but if 
i put these two actors into a composite actor the actor name returns as 
composite actor name like "CompositeActor". I think that i miss 
something here. Is it necessary to implement a fix to handle Composite 
actor case or is there any generic solution for it.

Any suggestion will be helpful,

Thanks,

--ufuk



More information about the Kepler-users mailing list