예제 #1
0
        private void parseCommandLine(string[] args)
        {
            string tport          = null;
            uint   ft_type        = (uint)mamaFtType.MAMA_FT_TYPE_MULTICAST;
            bool   displayVersion = false;

            for (int i = 0; i < args.Length;)
            {
                if ((args[i].CompareTo("-h")) == 0 ||
                    (args[i].CompareTo("-?")) == 0)
                {
                    usage(0);
                }

                if ((args[i].CompareTo("-g") == 0) ||
                    (args[i].CompareTo("-group") == 0))
                {
                    myGroup = args[i + 1];
                    i      += 2;
                    continue;
                }

                if ((args[i].CompareTo("-w") == 0) ||
                    (args[i].CompareTo("-weight") == 0))
                {
                    myWeight = Convert.ToUInt32(args[i + 1]);
                    i       += 2;
                    continue;
                }

                if (args[i].CompareTo("-m") == 0)
                {
                    myMiddleware = args[i + 1];
                    i           += 2;
                    continue;
                }

                if ((args[i].CompareTo("-t") == 0) ||
                    (args[i].CompareTo("-tport") == 0))
                {
                    tport = args[i + 1];
                    i    += 2;
                    continue;
                }

                if (args[i].CompareTo("-v") == 0)
                {
                    if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    else
                    {
                        mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
                        Mama.enableLogging(mamaLogLevel);
                    }
                    i++;
                    continue;
                }

                if (args[i].CompareTo("-version") == 0)
                {
                    displayVersion = true;
                    break;
                }

                if (args[i].CompareTo("-b") == 0)
                {
                    ft_type = (uint)mamaFtType.MAMA_FT_TYPE_BRIDGE;
                    i++;
                    continue;
                }

                i++;
            }

            myBridge = Mama.loadBridge(myMiddleware);

            Mama.open();

            if (displayVersion)
            {
                Console.WriteLine(Mama.getVersion(myBridge));
                Exit(0);
            }

            myTimer = new MamaTimer();

            myTransport = new MamaTransport();
            myTransport.create(tport, myBridge);

            if (myGroup == null)
            {
                Console.WriteLine("No FT group name specified");
                usage(1);
            }

            switch (ft_type)
            {
            case (uint)mamaFtType.MAMA_FT_TYPE_MULTICAST:
                myFtMember = new MamaMulticastFtMember();
                break;

            case (uint)mamaFtType.MAMA_FT_TYPE_BRIDGE:
                myFtMember = new MamaBridgeFtMember();
                break;

            default:
                Console.WriteLine("No FT type specified");
                usage(1);
                break;
            }
        }
예제 #2
0
		private void parseCommandLine (string[] args)
		{
			string tport = null;
			uint ft_type = (uint)mamaFtType.MAMA_FT_TYPE_MULTICAST;
			bool displayVersion = false;
			for (int i = 0; i < args.Length; )
			{
				if ((args[i].CompareTo ("-h")) == 0 ||
					(args[i].CompareTo ("-?")) == 0)
				{
					usage (0);
				}

				if ((args[i].CompareTo ("-g") == 0) ||
					(args[i].CompareTo ("-group") == 0))
				{
					myGroup = args[i+1];
					i += 2;
					continue;
				}

				if ((args[i].CompareTo ("-w") == 0) ||
					(args[i].CompareTo ("-weight") == 0))
				{
					myWeight = Convert.ToUInt32 (args[i+1]);
					i += 2;
					continue;
				}

				if (args[i].CompareTo ("-m") == 0)
				{
					myMiddleware = args[i+1];
					i += 2;
					continue;
				}

				if ((args[i].CompareTo ("-t") == 0) ||
					(args[i].CompareTo ("-tport") == 0))
				{
					tport = args[i+1];
					i += 2;
					continue;
				}

				if (args[i].CompareTo ("-v") == 0)
				{
					if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_WARN)
					{
						mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_NORMAL;
						Mama.enableLogging (mamaLogLevel);
					}
					else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_NORMAL)
					{
						mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINE;
						Mama.enableLogging (mamaLogLevel);
					}
					else if (mamaLogLevel == MamaLogLevel.MAMA_LOG_LEVEL_FINE)
					{
						mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINER;
						Mama.enableLogging (mamaLogLevel);
					}
					else
					{
						mamaLogLevel = MamaLogLevel.MAMA_LOG_LEVEL_FINEST;
						Mama.enableLogging (mamaLogLevel);
					}
					i++;
					continue;
				}

				if (args[i].CompareTo ("-version") == 0)
				{
					displayVersion = true;
					break;
				}

				if (args[i].CompareTo ("-b") == 0)
				{
					ft_type = (uint)mamaFtType.MAMA_FT_TYPE_BRIDGE;
					continue;
				}

                i++;
			}

			myBridge = Mama.loadBridge(myMiddleware);

			Mama.open();

			if (displayVersion)
			{
				Console.WriteLine (Mama.getVersion (myBridge));
				Exit (0);
			}

			myTimer = new MamaTimer();

			myTransport = new MamaTransport();
			myTransport.create(tport, myBridge);

			if (myGroup == null)
			{
				Console.WriteLine ("No FT group name specified");
				usage(1);
			}

			switch (ft_type)
			{
				case (uint)mamaFtType.MAMA_FT_TYPE_MULTICAST:
					myFtMember = new MamaMulticastFtMember ();
					break;

				case (uint)mamaFtType.MAMA_FT_TYPE_BRIDGE:
					myFtMember = new MamaBridgeFtMember ();
					break;

				default:
					Console.WriteLine ("No FT type specified");
					usage(1);
					break;
			}
		}