public void setServices(gov.cca.Services services)
        {
            this.services = services;

            Console.WriteLine("---- BEFORE REGISTERING USES PORT {0} {1} {2}", this.ThisFacet, this.Id_unit, this.CID);

            foreach (string portName in PortNames)
            {
                services.registerUsesPort(portName, "", new TypeMapImpl());
            }

            services.addProvidesPort(this, Constants.DEFAULT_PROVIDES_PORT_IMPLEMENTS, this.ClassName, new TypeMapImpl());

            InitializePort initialize_port_wrapper = new InitializePortWrapper(((InitializePort)this).on_initialize, ((InitializePort)this).after_initialize);

            services.addProvidesPort(initialize_port_wrapper, Constants.INITIALIZE_PORT_NAME, Constants.INITIALIZE_PORT_TYPE, new TypeMapImpl());

            ReconfigurationAdvicePort reconfiguration_port_wrapper = new ReconfigurationAdvicePortWrapper(((ReconfigurationAdvicePort)this).changePort);

            services.addProvidesPort(reconfiguration_port_wrapper, Constants.RECONFIGURE_PORT_NAME, Constants.RECONFIGURE_PORT_TYPE, new TypeMapImpl());

            if (Kind == Constants.KIND_COMPUTATION || Kind == Constants.KIND_SYNCHRONIZER || Kind == Constants.KIND_APPLICATION)
            {
                gov.cca.ports.GoPort app_port_wrapper = new GoPortWrapper(((gov.cca.ports.GoPort) this).go, this.GetType());
                services.addProvidesPort(app_port_wrapper, Constants.GO_PORT_NAME, Constants.GO_PORT_TYPE, new TypeMapImpl());
            }
        }
Exemple #2
0
 public void setServices(Services services)
 {
     this.frw_services = services;
     frw_registry      = (ServiceRegistry)frw_services.getPort(Constants.REGISTRY_PORT_NAME);
     frw_registry.addSingletonService(Constants.BUILDER_SERVICE_PORT_TYPE, this);
     frw_builder = (BuilderService)frw_services.getPort(Constants.BUILDER_SERVICE_PORT_NAME);
 }
Exemple #3
0
 public void releaseServices(gov.cca.Services services)
 {
     if (releaseRegister.ContainsKey(services))
     {
         ComponentRelease callBack;
         releaseRegister.TryGetValue(services, out callBack);
         callBack.releaseServices(services);
     }
 }
Exemple #4
0
        void Services.addProvidesPort(Port inPort, string portName, string type, gov.cca.TypeMap properties)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                gov.cca.Services ws = WorkerServices;
                ws.addProvidesPort(inPort, portName, type, properties);
            }
            frw.addProvidesPort(inPort, mkPortName(portName), type, properties);
        }
Exemple #5
0
        void Services.registerUsesPort(string portName, string type, gov.cca.TypeMap properties)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                gov.cca.Services ws = WorkerServices;
                ws.registerUsesPort(portName, type, properties);
            }
            frw.registerUsesPort(mkPortName(portName), type, properties);
        }
        void Services.removeProvidesPort(string portName)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                int[] nodes = cid.WorkerNodes;
                //for (int i=0; i<nodes.Length; i++)
                foreach (int i in WorkerServices.Keys)
                {
                    gov.cca.Services ws = WorkerServices[i];
                    ws.removeProvidesPort(portName);
                }
            }
            frw.removeProvidesPort(mkPortName(portName));
        }
        void Services.addProvidesPort(Port inPort, string portName, string type, gov.cca.TypeMap properties)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                int[] nodes = cid.WorkerNodes;
                //for (int i=0; i<nodes.Length; i++)
                foreach (int i in WorkerServices.Keys)
                {
                    gov.cca.Services ws = WorkerServices[i];
                    ws.addProvidesPort(inPort, portName, type, properties);
                }
            }
            frw.addProvidesPort(inPort, mkPortName(portName), type, properties);
        }
Exemple #8
0
        void Services.removeProvidesPort(string portName)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                gov.cca.Services ws = WorkerServices;
                try
                {
                    ws.removeProvidesPort(portName);
                }
                catch (Exception e)
                {
                    //if (e.getCCAExceptionType () != CCAExceptionType.PortNotDefined)
                    //	throw e;
                }
            }
            frw.removeProvidesPort(mkPortName(portName));
        }
        void Services.releasePort(string portName)
        {
            //	Console.WriteLine ("RELEASE PORT 1.0 " + portName + "/" + mkPortName(portName) + " --- " + cid.getInstanceName());
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            //	Console.WriteLine ("RELEASE PORT 1.1 " + portName +  " --- " + (cid_inner == null ? "NULL" : cid_inner.getInstanceName()));
            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                int[] nodes = cid.WorkerNodes;
                //for (int i=0; i<nodes.Length; i++)
                foreach (int i in WorkerServices.Keys)
                {
                    //		Console.WriteLine ("RELEASE PORT 2 - i=" + i + " - nodes[i]=" + nodes[i]  /*+ " - " + WorkerServices.Length + " - " + nodes.Length*/);
                    gov.cca.Services ws = WorkerServices[i];
                    ws.releasePort(portName);
                }
            }
            //	Console.WriteLine ("RELEASE PORT 4 " + portName);
            frw.releasePort(mkPortName(portName));
            //	Console.WriteLine ("RELEASE PORT 5 " + portName);
        }
Exemple #10
0
        void Services.releasePort(string portName)
        {
            //	Console.WriteLine ("RELEASE PORT 1.0 " + portName + "/" + mkPortName(portName) + " --- " + cid.getInstanceName());
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            //	Console.WriteLine ("RELEASE PORT 1.1 " + portName +  " --- " + (cid_inner == null ? "NULL" : cid_inner.getInstanceName()));
            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                //		Console.WriteLine ("RELEASE PORT 2 - ");
                gov.cca.Services ws = WorkerServices;
                try {
                    ws.releasePort(portName);
                }
                catch (Exception e)
                {
                    //		Console.WriteLine ("RELEASE PORT 3");
                    //if (e.getCCAExceptionType () != CCAExceptionType.PortNotDefined)
                    //	throw e;
                }
            }
            //	Console.WriteLine ("RELEASE PORT 4 " + portName);
            frw.releasePort(mkPortName(portName));
            //	Console.WriteLine ("RELEASE PORT 5 " + portName);
        }