Exemplo n.º 1
0
        /// <summary>
        /// Creates a <see cref="System.Management.Automation.Job"/> object that performs a query against the wrapped object model.
        /// </summary>
        /// <param name="session">Remote session to query</param>
        /// <param name="baseQuery">Query parameters</param>
        /// <returns><see cref="System.Management.Automation.Job"/> object that performs a query against the wrapped object model</returns>
        internal override StartableJob CreateQueryJob(CimSession session, QueryBuilder baseQuery)
        {
            CimQuery query = baseQuery as CimQuery;

            if (query == null)
            {
                throw new ArgumentNullException("baseQuery");
            }

            TerminatingErrorTracker tracker = TerminatingErrorTracker.GetTracker(this.CmdletInvocationInfo, isStaticCmdlet: false);

            if (tracker.IsSessionTerminated(session))
            {
                return(null);
            }

            if (!IsSupportedSession(session, tracker))
            {
                return(null);
            }

            CimJobContext jobContext = this.CreateJobContext(session, targetObject: null);
            StartableJob  queryJob   = query.GetQueryJob(jobContext);

            return(queryJob);
        }
Exemplo n.º 2
0
        internal override StartableJob CreateQueryJob(CimSession session, QueryBuilder baseQuery)
        {
            CimQuery cimQuery = baseQuery as CimQuery;

            if (cimQuery != null)
            {
                TerminatingErrorTracker tracker = TerminatingErrorTracker.GetTracker(this.CmdletInvocationInfo, false);
                if (!tracker.IsSessionTerminated(session))
                {
                    if (this.IsSupportedSession(session, tracker))
                    {
                        CimJobContext cimJobContext = this.CreateJobContext(session, null);
                        StartableJob  queryJob      = cimQuery.GetQueryJob(cimJobContext);
                        return(queryJob);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                throw new ArgumentNullException("baseQuery");
            }
        }