Exemple #1
0
        /*
        Create a container:

        hostAddress = the IP address of the host
        hostPort = the port through which the host communicates
        localPort = the local port through which agents communicate
         */
        private static jade.wrapper.AgentContainer CreateContainer(string containerName, bool isMainContainer, string hostAddress, string hostPort, string localPort)
        {
            ProfileImpl p = new ProfileImpl();

            if (containerName != String.Empty)
                p.setParameter(Profile.CONTAINER_NAME, containerName);

            p.setParameter(Profile.MAIN, isMainContainer.ToString());

            if (localPort != null)
                p.setParameter(Profile.LOCAL_PORT, localPort);

            if (hostAddress != String.Empty)
                p.setParameter(Profile.MAIN_HOST, hostAddress);

            if (hostPort != String.Empty)
                p.setParameter(Profile.MAIN_PORT, hostPort);

            if (isMainContainer == true)
            {
                return Runtime.instance().createMainContainer(p);
            }
            else
            {
                return Runtime.instance().createAgentContainer(p);
            }
        }