public static void AddDataElementsToResource(XPathNavigator actionClassNode, IResourceAction resourceAction)
        {
            IResourceActionProperties resourceActionProperties = new ResourceActionProperties();
            XPathNodeIterator dataElementNodes = actionClassNode.Select(@"DataElements/DataElement");
            if (dataElementNodes != null && dataElementNodes.Count > 0)
            {
                while (dataElementNodes.MoveNext())
                {
                    IResourceActionProperty resourceActionProperty = new ResourceActionProperty();
                    XPathNavigator dataElementNode = dataElementNodes.Current;
                    AddDataElementToResource(dataElementNode, resourceActionProperty);
                    //ignore old EXECUTE property
                    if (!resourceActionProperty.Name.Equals("EXECUTE", StringComparison.InvariantCultureIgnoreCase))
                        resourceActionProperties.Add(resourceActionProperty);
                    else
                    {
                        bool value = Convert.ToBoolean(resourceActionProperty.Value, CultureInfo.InvariantCulture);
                        bool overridable = Convert.ToBoolean(resourceActionProperty.Override, CultureInfo.InvariantCulture);

                        if (overridable)
                        {
                            resourceAction.ExecutionOption = value ? ExecutionOption.OverridableDefaultTrue : ExecutionOption.OverridableDefaultFalse;
                        }
                        else
                        {
                            resourceAction.ExecutionOption = ExecutionOption.AlwaysExecute;
                        }
                    }
                }
            }

            (resourceAction as ResourceAction).Properties = resourceActionProperties;
        }
 /// <summary>
 /// Load the action properties contained in the assembly of the given type
 /// into the ResourceActionProperties
 /// </summary>
 /// <param name="actionAssembly">The assembly containing the action properties to be loaded</param>
 /// <param name="resourceAction">The ResourceAction that will store the action properties</param>
 /// <param name="actionPropertyType">The type of the aciton properties to be loaded</param>
 private void LoadActionProperties(Assembly actionAssembly, IResourceAction resourceAction, Type actionPropertyType)
 {
     Logger.LogDebug("Loading action properties class: " + actionPropertyType.FullName);
     resourceAction.PropertyClass = actionPropertyType.FullName;
     IActionPropertySet actionProperties = (IActionPropertySet)(actionAssembly.CreateInstance(actionPropertyType.FullName));
     IResourceActionProperties resourceActionProperties = new ResourceActionProperties();
     (resourceActionProperties as ResourceActionProperties).SetActionProperties(actionProperties);
     (resourceAction as ResourceAction).Properties = resourceActionProperties;
 }
 /// <summary>
 /// Create an ActionPropertySet that is empty for actions that do not
 /// implement their own property set
 /// </summary>
 /// <param name="resourceAction">The ResourceAction that will store the action properties</param>
 private void CreateActionProperties(IResourceAction resourceAction)
 {
     Logger.LogDebug("Creating action property set for action " + resourceAction.Name);
     ActionPropertySet actionProperties = new ActionPropertySet();
     resourceAction.PropertyClass = "EmptyActionPropertySet";
     IResourceActionProperties resourceActionProperties = new ResourceActionProperties();
     (resourceActionProperties as ResourceActionProperties).SetActionProperties(actionProperties);
     (resourceAction as ResourceAction).Properties = resourceActionProperties;
 }
        private bool AddIAction3(Type[] types, Assembly assembly, ResourceAction resourceAction)
        {
            Type action2Type = null;
            Type actionInstallerType = null;
            Type customDataType = null;

            foreach(Type type in types)
            {
                if (type.GetInterface(typeof(IAction3).FullName) != null && action2Type == null)
                    action2Type = type;
                if (typeof(ActionInstaller).IsAssignableFrom(type) && actionInstallerType == null)
                    actionInstallerType = type;
                if (type.GetInterface(typeof(ICustomDataType).FullName) != null && customDataType == null)
                    customDataType = type;
            }

            if (action2Type == null)
                return false;

            Logger.LogDebug("Loading action class: " + action2Type.FullName);
            resourceAction.ActionClass = action2Type.FullName;
            IAction3 action2 = assembly.CreateInstance(action2Type.FullName) as IAction3;
            resourceAction.SetAction(action2);
            if (customDataType != null)
                resourceAction.CustomDataTypeUI = assembly.CreateInstance(customDataType.FullName) as ICustomDataType;
            ResourceActionProperties properties = new ResourceActionProperties();
            properties.SetActionProperties(action2.PropertySet);
            resourceAction.Properties = properties;

            PolicyType[] supportedPolicyTypes = null;
            RunAt[] execLocations = null;

            if (actionInstallerType != null)
            {
                ActionInstaller installer = assembly.CreateInstance(actionInstallerType.FullName) as ActionInstaller;

                if(installer.ExecuteLocations != null)
                {
                    execLocations = new RunAt[installer.ExecuteLocations.Count];
                    installer.ExecuteLocations.CopyTo(execLocations, 0);
                }

                if (installer.SupportedPolicyTypes != null)
                {
                    supportedPolicyTypes = new PolicyType[installer.SupportedPolicyTypes.Count];
                    installer.SupportedPolicyTypes.CopyTo(supportedPolicyTypes, 0);
                }

                resourceAction.ImpliesIncident = installer.ImpliesIncident;
                resourceAction.AllowTransparent = installer.AllowsTransparency;
            }

            //default to supporting all
            if (supportedPolicyTypes == null)
				supportedPolicyTypes = new PolicyType[] { PolicyType.ActiveContent, PolicyType.ClientEmail, PolicyType.ClientRemovableMedia, PolicyType.NetworkContentDiscovery, PolicyType.Mta, PolicyType.NetMon };

            resourceAction.SupportedPolicySetting = supportedPolicyTypes;

            //default to supporting all
            if(execLocations == null)
                execLocations = new RunAt[] { RunAt.Both };

            resourceAction.ExecutionTarget = execLocations;
            resourceAction.ExecutionTargetCapabilities = (RunAt[])execLocations.Clone();
            
            return true;
        }