Exemple #1
0
        public override string Execute()
        {
            var sid   = m_Args.AttrByName(CONFIG_SID_ATTR).ValueAsULong();
            var cname = m_Args.AttrByName(CONFIG_NAME_ATTR).Value;
            var param = m_Args.AttrByName(CONFIG_PARAM_ATTR).Value;
            var value = m_Args.AttrByName(CONFIG_VALUE_ATTR).Value;
            var call  = m_Args[CONFIG_CALL_ATTR, CONFIG_CALL_LIST_ATTR];

            //todo: add accept: header to return json etc...

            //cman{ sid=123 call-list{} }}; // for Help
            //cman{ sid=123 call{ directsql{sql="select 2+2 from DUAL"} }};

            var sb = new StringBuilder(1024);

            sb.AppendLine(AppRemoteTerminal.MARKUP_PRAGMA);
            sb.Append("<push><f color=gray>");
            sb.AppendLine("Component Manager");
            sb.AppendLine("----------------------");

            if (sid == 0 && cname.IsNullOrWhiteSpace())
            {
                listAll(sb);
            }
            else
            {
                ApplicationComponent cmp = null;
                if (sid > 0)
                {
                    cmp = ApplicationComponent.GetAppComponentBySID(App, sid);
                }
                if (cmp == null && cname.IsNotNullOrWhiteSpace())
                {
                    cmp = ApplicationComponent.GetAppComponentByCommonName(App, cname);
                }
                if (cmp != null)
                {
                    if (call.Exists)
                    {
                        doCall(sb, cmp, call, call.IsSameName(CONFIG_CALL_LIST_ATTR));
                    }
                    else
                    {
                        details(sb, cmp, param, value);
                    }
                }
                else
                {
                    sb.AppendFormat("<f color=red>Component with the supplied SID and CommonName was not found\n");
                }
            }

            sb.AppendLine("<pop>");

            return(sb.ToString());
        }
Exemple #2
0
        public override string Execute()
        {
            var sid   = m_Args.AttrByName(CONFIG_SID_ATTR).ValueAsULong();
            var cname = m_Args.AttrByName(CONFIG_NAME_ATTR).Value;
            var param = m_Args.AttrByName(CONFIG_PARAM_ATTR).Value;
            var value = m_Args.AttrByName(CONFIG_VALUE_ATTR).Value;

            var sb = new StringBuilder(1024);

            sb.AppendLine(AppRemoteTerminal.MARKUP_PRAGMA);
            sb.Append("<push><f color=gray>");
            sb.AppendLine("Component Manager");
            sb.AppendLine("----------------------");

            if (sid == 0 && cname.IsNullOrWhiteSpace())
            {
                listAll(sb);
            }
            else
            {
                ApplicationComponent cmp = null;
                if (sid > 0)
                {
                    cmp = ApplicationComponent.GetAppComponentBySID(App, sid);
                }
                if (cmp == null && cname.IsNotNullOrWhiteSpace())
                {
                    cmp = ApplicationComponent.GetAppComponentByCommonName(App, cname);
                }
                if (cmp != null)
                {
                    details(sb, cmp, param, value);
                }
                else
                {
                    sb.AppendFormat("<f color=red>Component with the supplied SID and CommonName was not found\n");
                }
            }

            sb.AppendLine("<pop>");

            return(sb.ToString());
        }
Exemple #3
0
        public static ApplicationComponent GetApplicationComponentBySIDorName(IApplication app, IConfigSectionNode args)
        {
            if (args == null || !args.Exists)
            {
                return(null);
            }

            ApplicationComponent cmp = null;
            var sid   = args.AttrByName(CONFIG_SID_ATTR).ValueAsULong();
            var cname = args.AttrByName(CONFIG_NAME_ATTR).Value;

            if (sid > 0)
            {
                cmp = ApplicationComponent.GetAppComponentBySID(app, sid);
            }

            if (cmp == null && cname.IsNotNullOrWhiteSpace())
            {
                cmp = ApplicationComponent.GetAppComponentByCommonName(app, cname);
            }
            return(cmp);
        }