/// <summary>
        /// Retrieves the list of rules from the viewstate rather than constantly
        /// re-reading the configuration file.
        /// </summary>
        /// <param name="savedState"></param>
        /// <remarks></remarks>
        /// <history>
        ///     [jbrinkman]	5/28/2007  Created
        /// </history>
        protected override void LoadViewState(object savedState)
        {
            var myState = (object[])savedState;

            if ((myState[0] != null))
            {
                base.LoadViewState(myState[0]);
            }
            if ((myState[1] != null))
            {
                var configRules = new List <RequestFilterRule>();

                //Deserialize into RewriterConfiguration
                var xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(Convert.ToString(myState[1]));
                var nodesList = xmlDocument.SelectNodes("/ArrayOfRequestFilterRule/RequestFilterRule");
                if (nodesList != null)
                {
                    foreach (XmlNode node in nodesList)
                    {
                        var rule = CBO.DeserializeObject <RequestFilterRule>(XmlReader.Create(new StringReader(node.OuterXml)));
                        configRules.Add(rule);
                    }
                }

                Rules = configRules;
            }
        }
Ejemplo n.º 2
0
 public override void ReadManifest(XPathNavigator manifestNav)
 {
     SkinControl = CBO.DeserializeObject <SkinControlInfo>(new StringReader(manifestNav.InnerXml));
     if (Log.Valid)
     {
         Log.AddInfo(Util.MODULE_ReadSuccess);
     }
 }
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            //Load the JavaScript Library from the manifest
            _library         = CBO.DeserializeObject <JavaScriptLibrary>(new StringReader(manifestNav.InnerXml));
            _library.Version = Package.Version;

            if (Log.Valid)
            {
                Log.AddInfo(Util.LIBRARY_ReadSuccess);
            }
        }
Ejemplo n.º 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadManifest method reads the manifest file for the Module compoent.
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            // Load the Desktop Module from the manifest
            this._desktopModule = CBO.DeserializeObject <DesktopModuleInfo>(new StringReader(manifestNav.InnerXml));

            // Allow a <component type="Module"> (i.e. a DesktopModule) to have its own friendlyname / description.
            // This allows multiple DesktopModules in one Package, allowing large MVC packages which share one assembly
            // but have many functions.
            if (this._desktopModule.FriendlyName == null || this._desktopModule.FriendlyName.Trim().Length == 0)
            {
                this._desktopModule.FriendlyName = this.Package.FriendlyName;
            }

            if (this._desktopModule.Description == null || this._desktopModule.Description.Trim().Length == 0)
            {
                this._desktopModule.Description = this.Package.Description;
            }

            this._desktopModule.Version            = Globals.FormatVersion(this.Package.Version, "00", 4, ".");
            this._desktopModule.CompatibleVersions = Null.NullString;
            this._desktopModule.Dependencies       = Null.NullString;
            this._desktopModule.Permissions        = Null.NullString;
            if (string.IsNullOrEmpty(this._desktopModule.BusinessControllerClass))
            {
                this._desktopModule.SupportedFeatures = 0;
            }

            this._eventMessage = this.ReadEventMessageNode(manifestNav);

            // Load permissions (to add)
            foreach (XPathNavigator moduleDefinitionNav in manifestNav.Select("desktopModule/moduleDefinitions/moduleDefinition"))
            {
                string friendlyName = Util.ReadElement(moduleDefinitionNav, "friendlyName");
                foreach (XPathNavigator permissionNav in moduleDefinitionNav.Select("permissions/permission"))
                {
                    var permission = new PermissionInfo();
                    permission.PermissionCode = Util.ReadAttribute(permissionNav, "code");
                    permission.PermissionKey  = Util.ReadAttribute(permissionNav, "key");
                    permission.PermissionName = Util.ReadAttribute(permissionNav, "name");
                    ModuleDefinitionInfo moduleDefinition = this._desktopModule.ModuleDefinitions[friendlyName];
                    if (moduleDefinition != null)
                    {
                        moduleDefinition.Permissions.Add(permission.PermissionKey, permission);
                    }
                }
            }

            if (this.Log.Valid)
            {
                this.Log.AddInfo(Util.MODULE_ReadSuccess);
            }
        }
Ejemplo n.º 5
0
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            DesktopModule = CBO.DeserializeObject <DesktopModuleInfo>(new StringReader(manifestNav.InnerXml));
            DesktopModule.FriendlyName = Package.FriendlyName;
            DesktopModule.Description  = Package.Description;
            DesktopModule.Version      = Globals.FormatVersion(Package.Version);
            //DesktopModule.IsPremium = false;
            //DesktopModule.IsAdmin = false;
            DesktopModule.CompatibleVersions = Null.NullString;
            DesktopModule.Dependencies       = Null.NullString;
            DesktopModule.Permissions        = Null.NullString;
            if (string.IsNullOrEmpty(DesktopModule.BusinessControllerClass))
            {
                DesktopModule.SupportedFeatures = 0;
            }
            XPathNavigator eventMessageNav = manifestNav.SelectSingleNode("eventMessage");

            if (eventMessageNav != null)
            {
                EventMessage                  = new EventQueue.EventMessage();
                EventMessage.Priority         = MessagePriority.High;
                EventMessage.ExpirationDate   = DateTime.Now.AddYears(-1);
                EventMessage.SentDate         = System.DateTime.Now;
                EventMessage.Body             = "";
                EventMessage.ProcessorType    = Util.ReadElement(eventMessageNav, "processorType", Log, Util.EVENTMESSAGE_TypeMissing);
                EventMessage.ProcessorCommand = Util.ReadElement(eventMessageNav, "processorCommand", Log, Util.EVENTMESSAGE_CommandMissing);
                foreach (XPathNavigator attributeNav in eventMessageNav.Select("attributes/*"))
                {
                    EventMessage.Attributes.Add(attributeNav.Name, attributeNav.Value);
                }
            }
            foreach (XPathNavigator moduleDefinitionNav in manifestNav.Select("desktopModule/moduleDefinitions/moduleDefinition"))
            {
                string friendlyName = Util.ReadElement(moduleDefinitionNav, "friendlyName");
                foreach (XPathNavigator permissionNav in moduleDefinitionNav.Select("permissions/permission"))
                {
                    PermissionInfo permission = new PermissionInfo();
                    permission.PermissionCode = Util.ReadAttribute(permissionNav, "code");
                    permission.PermissionKey  = Util.ReadAttribute(permissionNav, "key");
                    permission.PermissionName = Util.ReadAttribute(permissionNav, "name");
                    ModuleDefinitionInfo moduleDefinition = DesktopModule.ModuleDefinitions[friendlyName];
                    if (moduleDefinition != null)
                    {
                        moduleDefinition.Permissions.Add(permission.PermissionKey, permission);
                    }
                }
            }
            if (Log.Valid)
            {
                Log.AddInfo(Util.MODULE_ReadSuccess);
            }
        }
Ejemplo n.º 6
0
        protected override void LoadViewState(object savedState)
        {
            var myState = (object[])savedState;

            if ((myState[0] != null))
            {
                base.LoadViewState(myState[0]);
            }
            if ((myState[1] != null))
            {
                var config = new RewriterConfiguration();

                //Deserialize into RewriterConfiguration
                var xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(Convert.ToString(myState[1]));
                config = CBO.DeserializeObject <RewriterConfiguration>(xmlDocument);
                Rules  = config.Rules;
            }
        }
        protected override void LoadViewState(object savedState)
        {
            var myState = (object[])savedState;

            if ((myState[0] != null))
            {
                base.LoadViewState(myState[0]);
            }
            if ((myState[1] != null))
            {
                var aliasCount = (int)myState[1];
                Aliases.Clear();
                for (int i = 0; i <= aliasCount - 1; i++)
                {
                    string aliasString = Convert.ToString(myState[i + 2]);
                    var    sr          = new StringReader(aliasString);
                    Aliases.Add(CBO.DeserializeObject <PortalAliasInfo>(sr));
                }
            }
        }
Ejemplo n.º 8
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadManifest method reads the manifest file for the Module compoent.
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            // Load the Desktop Module from the manifest
            this._desktopModule = CBO.DeserializeObject <DesktopModuleInfo>(new StringReader(manifestNav.InnerXml));

            this._desktopModule.FriendlyName       = this.Package.FriendlyName;
            this._desktopModule.Description        = this.Package.Description;
            this._desktopModule.Version            = Globals.FormatVersion(this.Package.Version, "00", 4, ".");
            this._desktopModule.CompatibleVersions = Null.NullString;
            this._desktopModule.Dependencies       = Null.NullString;
            this._desktopModule.Permissions        = Null.NullString;
            if (string.IsNullOrEmpty(this._desktopModule.BusinessControllerClass))
            {
                this._desktopModule.SupportedFeatures = 0;
            }

            this._eventMessage = this.ReadEventMessageNode(manifestNav);

            // Load permissions (to add)
            foreach (XPathNavigator moduleDefinitionNav in manifestNav.Select("desktopModule/moduleDefinitions/moduleDefinition"))
            {
                string friendlyName = Util.ReadElement(moduleDefinitionNav, "friendlyName");
                foreach (XPathNavigator permissionNav in moduleDefinitionNav.Select("permissions/permission"))
                {
                    var permission = new PermissionInfo();
                    permission.PermissionCode = Util.ReadAttribute(permissionNav, "code");
                    permission.PermissionKey  = Util.ReadAttribute(permissionNav, "key");
                    permission.PermissionName = Util.ReadAttribute(permissionNav, "name");
                    ModuleDefinitionInfo moduleDefinition = this._desktopModule.ModuleDefinitions[friendlyName];
                    if (moduleDefinition != null)
                    {
                        moduleDefinition.Permissions.Add(permission.PermissionKey, permission);
                    }
                }
            }

            if (this.Log.Valid)
            {
                this.Log.AddInfo(Util.MODULE_ReadSuccess);
            }
        }
Ejemplo n.º 9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The ReadManifest method reads the manifest file for the Module compoent.
        /// </summary>
        /// <history>
        ///     [cnurse]	01/15/2008  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void ReadManifest(XPathNavigator manifestNav)
        {
            //Load the Desktop Module from the manifest
            _desktopModule = CBO.DeserializeObject <DesktopModuleInfo>(new StringReader(manifestNav.InnerXml));

            _desktopModule.FriendlyName       = Package.FriendlyName;
            _desktopModule.Description        = Package.Description;
            _desktopModule.Version            = Globals.FormatVersion(Package.Version);
            _desktopModule.CompatibleVersions = Null.NullString;
            _desktopModule.Dependencies       = Null.NullString;
            _desktopModule.Permissions        = Null.NullString;
            if (string.IsNullOrEmpty(_desktopModule.BusinessControllerClass))
            {
                _desktopModule.SupportedFeatures = 0;
            }
            XPathNavigator eventMessageNav = manifestNav.SelectSingleNode("eventMessage");

            if (eventMessageNav != null)
            {
                _eventMessage                  = new EventMessage();
                _eventMessage.Priority         = MessagePriority.High;
                _eventMessage.ExpirationDate   = DateTime.Now.AddYears(-1);
                _eventMessage.SentDate         = DateTime.Now;
                _eventMessage.Body             = "";
                _eventMessage.ProcessorType    = Util.ReadElement(eventMessageNav, "processorType", Log, Util.EVENTMESSAGE_TypeMissing);
                _eventMessage.ProcessorCommand = Util.ReadElement(eventMessageNav, "processorCommand", Log, Util.EVENTMESSAGE_CommandMissing);
                foreach (XPathNavigator attributeNav in eventMessageNav.Select("attributes/*"))
                {
                    var attribName  = attributeNav.Name;
                    var attribValue = attributeNav.Value;
                    if (attribName == "upgradeVersionsList")
                    {
                        if (!String.IsNullOrEmpty(attribValue))
                        {
                            string[] upgradeVersions = attribValue.Split(',');
                            attribValue = ""; foreach (string version in upgradeVersions)
                            {
                                Version upgradeVersion = null;
                                try
                                {
                                    upgradeVersion = new Version(version);
                                }
                                catch (FormatException)
                                {
                                    Log.AddWarning(string.Format(Util.MODULE_InvalidVersion, version));
                                }

                                if (upgradeVersion != null && upgradeVersion > Package.InstalledVersion)
                                {
                                    attribValue += version + ",";
                                }
                            }
                            attribValue = attribValue.TrimEnd(',');
                        }
                    }
                    _eventMessage.Attributes.Add(attribName, attribValue);
                }
            }

            //Load permissions (to add)
            foreach (XPathNavigator moduleDefinitionNav in manifestNav.Select("desktopModule/moduleDefinitions/moduleDefinition"))
            {
                string friendlyName = Util.ReadElement(moduleDefinitionNav, "friendlyName");
                foreach (XPathNavigator permissionNav in moduleDefinitionNav.Select("permissions/permission"))
                {
                    var permission = new PermissionInfo();
                    permission.PermissionCode = Util.ReadAttribute(permissionNav, "code");
                    permission.PermissionKey  = Util.ReadAttribute(permissionNav, "key");
                    permission.PermissionName = Util.ReadAttribute(permissionNav, "name");
                    ModuleDefinitionInfo moduleDefinition = _desktopModule.ModuleDefinitions[friendlyName];
                    if (moduleDefinition != null)
                    {
                        moduleDefinition.Permissions.Add(permission.PermissionKey, permission);
                    }
                }
            }
            if (Log.Valid)
            {
                Log.AddInfo(Util.MODULE_ReadSuccess);
            }
        }