Esempio n. 1
0
        public void disconnect(ConnectionID connID, float timeout)
        {
            Console.WriteLine("WORKER OBJECT - disconnecting ...");

            WorkerConnectionID hpeconnID = (WorkerConnectionID)connID;

            string user_port_name     = connID.getUser().getInstanceName() + ":" + connID.getUserPortName();
            string provider_port_name = connID.getProvider().getInstanceName() + ":" + connID.getProviderPortName();

            if (!port_manager.isReleased(user_port_name))
            {
                Console.WriteLine(": DISCONNECT - EXCEPTION RELEASE PORT - " + user_port_name);
                throw new CCAExceptionImpl(CCAExceptionType.UsesPortNotReleased);
            }

            if (!connectionList.ContainsKey(connID.ToString()))
            {
                throw new CCAExceptionImpl(CCAExceptionType.PortNotConnected);
            }

            connectionList.Remove(connID.ToString());
            Console.WriteLine(": disconnecting " + user_port_name + " from " + provider_port_name);

            connByUserPort.Remove(user_port_name);
            connByProviderPort.Remove(provider_port_name);

            if (connectionProperties.ContainsKey(connID))
            {
                connectionProperties.Remove(connID);
            }
        }
 public ManagerConnectionIDImpl(ComponentID provider,
                                string providesPortName,
                                ComponentID user,
                                string usesPortName,
                                WorkerConnectionID worker_connections)
     :  base(provider, providesPortName, user, usesPortName, worker_connections)
 {
     this.nodes  = nodes;
     this.ignore = false;
 }
Esempio n. 3
0
        public void releasePort(string portName)
        {
            if (!usesPortNamesInv.ContainsKey(portName))
            {
                //foreach (string key in usesPortNamesInv.Keys) Console.WriteLine ("key = " + key);
                throw new CCAExceptionImpl(CCAExceptionType.PortNotDefined);
            }

            ConnectionID conn;

            connByUserPort.TryGetValue(portName, out conn);
            WorkerConnectionID hpeconn = (WorkerConnectionID)conn;

            port_manager.addPortRelease(portName);
            //foreach (string key in usesPortNamesInv.Keys) Console.WriteLine ("key = " + key);
        }
Esempio n. 4
0
        public void disconnectAll(ComponentID id1, ComponentID id2, float timeout)
        {
            // TODO: IT IS NECESSARY TO IMPLEMEMENT THE timeout
            if (id1 == null)
            {
                throw new CCAExceptionImpl(CCAExceptionType.BadPortName);
            }

            IList <ConnectionID> willDisconnect = new List <ConnectionID>();

            try
            {
                // TEST IF ALL PORTS CAN BE DISCONNECT.
                foreach (ConnectionID conn in connectionList.Values)
                {
                    ComponentID user     = conn.getUser();
                    ComponentID provider = conn.getProvider();
                    if ((user.Equals(id1) && provider.Equals(id2)) ||
                        (user.Equals(id2) && provider.Equals(id1)) ||
                        (id2 == null && (user.Equals(id1) || provider.Equals(id1))))
                    {
                        WorkerConnectionID hpeconn = (WorkerConnectionID)conn;
                        //hpeconn.blockFetched();
                        willDisconnect.Add(conn);
                    }
                }
            }
            catch (CCAExceptionImpl e)
            {
                foreach (ConnectionID conn in willDisconnect)
                {
                    WorkerConnectionID hpeconn = (WorkerConnectionID)conn;
                    //hpeconn.unblockFetched();
                }
                throw e;
            }


            // ONLY EXECUTE THIS LOOP IF ALL CONNECTIONS ARE RELEASED.
            foreach (ConnectionID conn in willDisconnect)
            {
                disconnect(conn, timeout);
            }
        }
Esempio n. 5
0
        private Port getPortProceed(string portName)
        {
            ConnectionID conn;

            connByUserPort.TryGetValue(portName, out conn);
            WorkerConnectionID hpeconn = (WorkerConnectionID)conn;

            string providesPortName = conn.getProvider().getInstanceName() + ":" + conn.getProviderPortName();

            Port providesPort;

            providesPorts.TryGetValue(providesPortName, out providesPort);

            Console.WriteLine("PORT TYPE of " + providesPortName + " = " + providesPort.GetType());

            port_manager.addPortFetch(portName);

            return(providesPort);
        }
            public ManagerConnectionID(ComponentID provider, string providesPortName, ComponentID user, string usesPortName, WorkerConnectionID worker_connection)
            {
                this.provider          = provider;
                this.providesPortName  = providesPortName;
                this.user              = user;
                this.usesPortName      = usesPortName;
                this.worker_connection = worker_connection;

                connectionString = User + "." + UsesPortName + "->" + Provider + "." + ProvidesPortName;
            }