/// <summary>
        /// Dispose Method
        /// </summary>
        /// <param name="disposing">If should free managed objects</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (m_eventLog != null)
                {
                    m_eventLog.Dispose();
                    m_eventLog = null;
                }

                if (m_propertyBagWriter != null)
                {
                    m_propertyBagWriter.Dispose();
                    m_propertyBagWriter = null;
                }
                if (m_pipeLine != null)
                {
                    m_pipeLine.Dispose();
                    m_pipeLine = null;
                }
                if (m_runSpace != null)
                {
                    m_runSpace.Close();
                    m_runSpace = null;
                }
            }
        }
        /// <summary>
        /// Initialize all values, as well as start the pipeline and await for data
        /// </summary>
        /// <param name="moduleDefinition">The module definition for the classifier</param>
        /// <param name="rule">The rule definition for the rule that this represents</param>
        /// <param name="propertyDefinition">The property definition for the property that this rule modifies</param>
        public PowerShellRuleHoster(
            IFsrmPipelineModuleDefinition moduleDefinition,
            IFsrmClassificationRule rule,
            IFsrmPropertyDefinition propertyDefinition
            )
        {
            m_propertyBagWriter = new BlockablePropertyBagEnumerator();
            m_ruleName          = rule.Name;

            // create the waitHandles and initialize them
            // *note the pipeline waitHandle is created in CreateAndBeginPipeline
            m_powershellPaused = new WaitHandle[(int)m_waitHandleIndex.Count];
            m_powershellPaused[(int)m_waitHandleIndex.Enumerator] = m_propertyBagWriter.RequestedDataWaitHandle;

            // cache the method info for adding the GetStream to PropertyBag
            Type extensionClassForPropertyBag = typeof(ExtensionClassForPropertyBag);

            m_getStreamMethodInfo = extensionClassForPropertyBag.GetMethod("GetStream");


            string fileText = GetScriptText(rule);

            // this enables users to create a scriptblock rather then enumerate over the PropertyBagList
            m_scriptText = "$PropertyBagList | &{" + fileText + "}\n";

            // construct the runspace and set global proxy values for powershell script to use
            m_runSpace = RunspaceFactory.CreateRunspace();
            m_runSpace.Open();
            m_runSpace.SessionStateProxy.SetVariable("ModuleDefinition", moduleDefinition);
            m_runSpace.SessionStateProxy.SetVariable("PropertyBagList", m_propertyBagWriter);
            m_runSpace.SessionStateProxy.SetVariable("Rule", rule);
            m_runSpace.SessionStateProxy.SetVariable("PropertyDefinition", propertyDefinition);

            //launch the pipeline creation
            CreateAndBeginPipeline();
        }
        /// <summary>
        /// Initialize all values, as well as start the pipeline and await for data
        /// </summary>
        /// <param name="moduleDefinition">The module definition for the classifier</param>
        /// <param name="rule">The rule definition for the rule that this represents</param>
        /// <param name="propertyDefinition">The property definition for the property that this rule modifies</param>
        public PowerShellRuleHoster(
            IFsrmPipelineModuleDefinition moduleDefinition,
            IFsrmClassificationRule rule,
            IFsrmPropertyDefinition propertyDefinition
            )
        {
            m_propertyBagWriter = new BlockablePropertyBagEnumerator();
            m_ruleName = rule.Name;

            // create the waitHandles and initialize them
            // *note the pipeline waitHandle is created in CreateAndBeginPipeline
            m_powershellPaused = new WaitHandle[(int)m_waitHandleIndex.Count];
            m_powershellPaused[(int)m_waitHandleIndex.Enumerator] = m_propertyBagWriter.RequestedDataWaitHandle;

            // cache the method info for adding the GetStream to PropertyBag
            Type extensionClassForPropertyBag = typeof(ExtensionClassForPropertyBag);
            m_getStreamMethodInfo = extensionClassForPropertyBag.GetMethod("GetStream");

            string fileText = GetScriptText(rule);

            // this enables users to create a scriptblock rather then enumerate over the PropertyBagList
            m_scriptText = "$PropertyBagList | &{" + fileText + "}\n";

            // construct the runspace and set global proxy values for powershell script to use
            m_runSpace = RunspaceFactory.CreateRunspace();
            m_runSpace.Open();
            m_runSpace.SessionStateProxy.SetVariable("ModuleDefinition", moduleDefinition);
            m_runSpace.SessionStateProxy.SetVariable("PropertyBagList", m_propertyBagWriter);
            m_runSpace.SessionStateProxy.SetVariable("Rule", rule);
            m_runSpace.SessionStateProxy.SetVariable("PropertyDefinition", propertyDefinition);

            //launch the pipeline creation
            CreateAndBeginPipeline();
        }
        /// <summary>
        /// Dispose Method
        /// </summary>
        /// <param name="disposing">If should free managed objects</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (m_eventLog != null)
                {
                    m_eventLog.Dispose();
                    m_eventLog = null;
                }

                if (m_propertyBagWriter != null)
                {
                    m_propertyBagWriter.Dispose();
                    m_propertyBagWriter = null;
                }
                if (m_pipeLine != null)
                {
                    m_pipeLine.Dispose();
                    m_pipeLine = null;
                }
                if (m_runSpace != null)
                {
                    m_runSpace.Close();
                    m_runSpace = null;
                }
            }
        }