コード例 #1
0
ファイル: ViewsManager.cs プロジェクト: t1b1c/lwas
        public ViewsManager(string aConfigFile, IStorageAgent anAgent, IExpressionsManager expressionsManager)
        {
            if (String.IsNullOrEmpty(aConfigFile))
            {
                throw new ArgumentNullException("aConfigFile");
            }
            if (null == anAgent)
            {
                throw new ArgumentNullException("anAgent");
            }
            if (null == expressionsManager)
            {
                throw new ArgumentNullException("expressionsManager");
            }

            configFile = aConfigFile;
            agent      = anAgent;
            this.ExpressionsManager = expressionsManager;

            this.Views     = new ViewsCollection(this);
            this.Tables    = new TablesCollection(this);
            this.Relations = new RelationsCollection(this);

            LoadConfiguration();
        }
コード例 #2
0
ファイル: BasicToken.cs プロジェクト: t1b1c/lwas
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == config) throw new ArgumentNullException("config");
            IConfigurationElement element = config as IConfigurationElement;
            if (null == element) throw new ArgumentException("config must be an IConfigurationElement");

            if (element.Elements.ContainsKey("source"))
            {
                IConfigurationElement sourceElement = element.GetElementReference("source");

                if (sourceElement.Attributes.ContainsKey("id"))
                {
                    if (null == manager) throw new ArgumentNullException("manager");

                    this.Source = manager.FindControl(sourceElement.GetAttributeReference("id").Value.ToString());
                    if (null == this.Source)
                        this.Source = sourceElement.GetAttributeReference("id").Value;
                    if (sourceElement.Attributes.ContainsKey("member"))
                        this.Member = sourceElement.GetAttributeReference("member").Value.ToString();
                }
                else
                {
                    if (sourceElement.Attributes.ContainsKey("value"))
                        this.Source = sourceElement.GetAttributeReference("value").Value;
                }
            }
        }
コード例 #3
0
ファイル: ParameterToken.cs プロジェクト: t1b1c/lwas
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }
            if (null == manager)
            {
                throw new ArgumentNullException("manager");
            }

            IConfigurationElement tokenElement = config as IConfigurationElement;

            if (null == tokenElement)
            {
                throw new ArgumentException("config is not an IConfigurationElement");
            }
            if (!tokenElement.Elements.ContainsKey("source"))
            {
                throw new ConfigurationException("Bad views token configuration: 'source' element not found");
            }
            IConfigurationElement sourceElement = tokenElement.GetElementReference("source");

            if (!sourceElement.Attributes.ContainsKey("parameter"))
            {
                throw new ConfigurationException("Bad views token configuration: 'source' element has no 'parameter' attribute");
            }
            this.ParameterName = sourceElement.GetAttributeReference("parameter").Value.ToString();
        }
コード例 #4
0
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }
            if (null == manager)
            {
                throw new ArgumentNullException("manager");
            }

            IConfigurationElement tokenElement = config as IConfigurationElement;

            if (null == tokenElement)
            {
                throw new ArgumentException("config is not an IConfigurationElement");
            }
            if (!tokenElement.Elements.ContainsKey("source"))
            {
                throw new ConfigurationException("Bad views field token configuration: 'source' element not found");
            }
            IConfigurationElement sourceElement = tokenElement.GetElementReference("source");

            Make(sourceElement, manager);
        }
コード例 #5
0
ファイル: Expression.cs プロジェクト: t1b1c/lwas
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == manager)
            {
                throw new ArgumentNullException("manager");
            }
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }
            IConfigurationElement element = config as IConfigurationElement;

            if (null == element)
            {
                throw new ArgumentException("config must be an IConfigurationElement");
            }

            if (element.Elements.ContainsKey("operands"))
            {
                foreach (IConfigurationElement operandElement in element.GetElementReference("operands").Elements.Values)
                {
                    string type  = operandElement.GetAttributeReference("type").Value.ToString();
                    IToken token = manager.Token(type);
                    if (null == token)
                    {
                        throw new InvalidOperationException(string.Format("Cannot make the type '{0}'", type));
                    }

                    token.Make(operandElement, manager);
                    this.Operands.Add(token);
                }
            }
        }
コード例 #6
0
ファイル: ViewsManager.cs プロジェクト: t1b1c/lwas
        public ViewsManager(XmlReader reader, IExpressionsManager expressionsManager)
        {
            if (null == expressionsManager)
            {
                throw new ArgumentNullException("expressionsManager");
            }
            if (null == reader)
            {
                throw new ArgumentNullException("reader");
            }

            this.ExpressionsManager = expressionsManager;

            this.Views     = new ViewsCollection(this);
            this.Tables    = new TablesCollection(this);
            this.Relations = new RelationsCollection(this);

            XElement root = XDocument.ReadFrom(reader) as XElement;

            if (null == root)
            {
                throw new ArgumentException("Failed to load the root element");
            }
            FromXml(root);
        }
コード例 #7
0
ファイル: FieldToken.cs プロジェクト: t1b1c/lwas
        protected virtual void Make(IConfigurationElement sourceElement, IExpressionsManager manager)
        {
            if (null == sourceElement) throw new ArgumentNullException("sourceElement");
            if (null == manager) throw new ArgumentNullException("manager");

            if (!sourceElement.Attributes.ContainsKey("field")) throw new ConfigurationException("Bad views field token configuration: 'source' element has no 'field' attribute");
            this.FieldName = sourceElement.GetAttributeReference("field").Value.ToString();
        }
コード例 #8
0
ファイル: XmlExtensions.cs プロジェクト: t1b1c/lwas
        public static void FromXml(this IExpression expression, XElement element, IExpressionsManager expressionsManager)
        {
            if (null == expression) throw new ArgumentNullException("expression");
            if (null == element) throw new ArgumentNullException("element");
            if (null == expressionsManager) throw new ArgumentNullException("expressionsManager");

            Configuration config = new Configuration();
            IConfigurationElement configElement = config.AddSection("expression extensions").AddElement("expression");
            configElement.ReadXml(element.CreateReader());

            expression.Make(configElement, expressionsManager);
        }
コード例 #9
0
ファイル: FieldToken.cs プロジェクト: t1b1c/lwas
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == config) throw new ArgumentNullException("config");
            if (null == manager) throw new ArgumentNullException("manager");

            IConfigurationElement tokenElement = config as IConfigurationElement;
            if (null == tokenElement) throw new ArgumentException("config is not an IConfigurationElement");
            if (!tokenElement.Elements.ContainsKey("source")) throw new ConfigurationException("Bad views field token configuration: 'source' element not found");
            IConfigurationElement sourceElement = tokenElement.GetElementReference("source");

            Make(sourceElement, manager);
        }
コード例 #10
0
        public static IExpression Expression(this IExpressionsManager manager, XElement element)
        {
            Configuration         config        = new Configuration();
            IConfigurationElement configElement = config.AddSection("expression extensions").AddElement("expression");

            configElement.ReadXml(element.CreateReader());
            IExpression expression = manager.Token(configElement.GetAttributeReference("type").Value.ToString()) as IExpression;

            if (null != expression)
            {
                expression.Make(configElement, manager);
            }
            return(expression);
        }
コード例 #11
0
ファイル: ViewsManager.cs プロジェクト: t1b1c/lwas
        public ViewsManager(XmlReader reader, IExpressionsManager expressionsManager)
        {
            if (null == expressionsManager) throw new ArgumentNullException("expressionsManager");
            if (null == reader) throw new ArgumentNullException("reader");

            this.ExpressionsManager = expressionsManager;

            this.Views = new ViewsCollection(this);
            this.Tables = new TablesCollection(this);
            this.Relations = new RelationsCollection(this);

            XElement root = XDocument.ReadFrom(reader) as XElement;
            if (null == root) throw new ArgumentException("Failed to load the root element");
            FromXml(root);
        }
コード例 #12
0
ファイル: ViewsManager.cs プロジェクト: t1b1c/lwas
        public ViewsManager(string aConfigFile, IStorageAgent anAgent, IExpressionsManager expressionsManager)
        {
            if (String.IsNullOrEmpty(aConfigFile)) throw new ArgumentNullException("aConfigFile");
            if (null == anAgent) throw new ArgumentNullException("anAgent");
            if (null == expressionsManager) throw new ArgumentNullException("expressionsManager");

            configFile = aConfigFile;
            agent = anAgent;
            this.ExpressionsManager = expressionsManager;

            this.Views = new ViewsCollection(this);
            this.Tables = new TablesCollection(this);
            this.Relations = new RelationsCollection(this);

            LoadConfiguration();
        }
コード例 #13
0
        protected virtual void Make(IConfigurationElement sourceElement, IExpressionsManager manager)
        {
            if (null == sourceElement)
            {
                throw new ArgumentNullException("sourceElement");
            }
            if (null == manager)
            {
                throw new ArgumentNullException("manager");
            }

            if (!sourceElement.Attributes.ContainsKey("field"))
            {
                throw new ConfigurationException("Bad views field token configuration: 'source' element has no 'field' attribute");
            }
            this.FieldName = sourceElement.GetAttributeReference("field").Value.ToString();
        }
コード例 #14
0
        protected override void Make(IConfigurationElement sourceElement, IExpressionsManager manager)
        {
            if (null == sourceElement)
            {
                throw new ArgumentNullException("sourceElement");
            }
            if (null == manager)
            {
                throw new ArgumentNullException("manager");
            }

            if (!sourceElement.Attributes.ContainsKey("view"))
            {
                throw new ConfigurationException("Bad view as token configuration: 'source' element has no 'view' attribute");
            }
            this.ViewName = sourceElement.GetAttributeReference("view").Value.ToString();

            base.Make(sourceElement, manager);
        }
コード例 #15
0
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }
            IConfigurationElement element = config as IConfigurationElement;

            if (null == element)
            {
                throw new ArgumentException("config must be an IConfigurationElement");
            }

            if (element.Elements.ContainsKey("source"))
            {
                IConfigurationElement sourceElement = element.GetElementReference("source");

                if (sourceElement.Attributes.ContainsKey("id"))
                {
                    if (null == manager)
                    {
                        throw new ArgumentNullException("manager");
                    }

                    this.Source = manager.FindControl(sourceElement.GetAttributeReference("id").Value.ToString());
                    if (null == this.Source)
                    {
                        this.Source = sourceElement.GetAttributeReference("id").Value;
                    }
                    if (sourceElement.Attributes.ContainsKey("member"))
                    {
                        this.Member = sourceElement.GetAttributeReference("member").Value.ToString();
                    }
                }
                else
                {
                    if (sourceElement.Attributes.ContainsKey("value"))
                    {
                        this.Source = sourceElement.GetAttributeReference("value").Value;
                    }
                }
            }
        }
コード例 #16
0
ファイル: Expression.cs プロジェクト: t1b1c/lwas
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == manager) throw new ArgumentNullException("manager");
            if (null == config)throw new ArgumentNullException("config");
            IConfigurationElement element = config as IConfigurationElement;
            if (null == element) throw new ArgumentException("config must be an IConfigurationElement");

            if (element.Elements.ContainsKey("operands"))
            {
                foreach (IConfigurationElement operandElement in element.GetElementReference("operands").Elements.Values)
                {
                    string type = operandElement.GetAttributeReference("type").Value.ToString();
                    IToken token = manager.Token(type);
                    if (null == token) throw new InvalidOperationException(string.Format("Cannot make the type '{0}'", type));

                    token.Make(operandElement, manager);
                    this.Operands.Add(token);
                }
            }
        }
コード例 #17
0
        public static void FromXml(this IExpression expression, XElement element, IExpressionsManager expressionsManager)
        {
            if (null == expression)
            {
                throw new ArgumentNullException("expression");
            }
            if (null == element)
            {
                throw new ArgumentNullException("element");
            }
            if (null == expressionsManager)
            {
                throw new ArgumentNullException("expressionsManager");
            }

            Configuration         config        = new Configuration();
            IConfigurationElement configElement = config.AddSection("expression extensions").AddElement("expression");

            configElement.ReadXml(element.CreateReader());

            expression.Make(configElement, expressionsManager);
        }
コード例 #18
0
ファイル: Database.cs プロジェクト: t1b1c/lwas
 public Database(string name, string viewsKey, IStorageAgent agent, IExpressionsManager expressionsManager)
 {
     this.Name = name;
     this.ViewsKey = viewsKey;
     this.ViewsManager = new ViewsManager(viewsKey, agent, expressionsManager);
 }
コード例 #19
0
ファイル: Token.cs プロジェクト: t1b1c/lwas
 public virtual void Make(IConfigurationType config, IExpressionsManager manager)
 {
 }
コード例 #20
0
        private TransitPoint CreateTransitPoint(WebPartManager manager, IConfigurationElement element, IExpressionsManager expressionsManager)
        {
            bool         valid        = false;
            TransitPoint transitPoint = new TransitPoint();

            if (element.Attributes.ContainsKey("id"))
            {
                valid = true;
                transitPoint.Chronicler = (ReflectionServices.FindControlEx(element.GetAttributeReference("id").Value.ToString(), manager) as IChronicler);
            }
            if (element.Attributes.ContainsKey("member"))
            {
                transitPoint.Member = element.GetAttributeReference("member").Value.ToString();
            }
            if (element.Attributes.ContainsKey("value"))
            {
                valid = true;
                transitPoint.Value = element.GetAttributeReference("value").Value;
            }
            if (element.Elements.ContainsKey("expression"))
            {
                valid = true;

                IConfigurationElement expressionElement = element.GetElementReference("expression");
                IExpression           expression        = expressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression;
                if (null == expression)
                {
                    throw new InvalidOperationException("Token is not an IExpression");
                }
                expression.Make(expressionElement, expressionsManager);
                transitPoint.Expression = expression;
            }

            if (!valid)
            {
                transitPoint = null;
            }

            return(transitPoint);
        }
コード例 #21
0
ファイル: BaseViewsToken.cs プロジェクト: t1b1c/lwas
 public abstract void Make(IConfigurationType config, IExpressionsManager manager);
コード例 #22
0
ファイル: Database.cs プロジェクト: t1b1c/lwas
 public Database(string name, string viewsKey, IStorageAgent agent, IExpressionsManager expressionsManager)
 {
     this.Name         = name;
     this.ViewsKey     = viewsKey;
     this.ViewsManager = new ViewsManager(viewsKey, agent, expressionsManager);
 }
コード例 #23
0
        private TransitPoint CreateTransitPoint(WebPartManager manager, IConfigurationElement element, IExpressionsManager expressionsManager)
        {
            bool valid = false;
            TransitPoint transitPoint = new TransitPoint();
            if (element.Attributes.ContainsKey("id"))
            {
                valid = true;
                transitPoint.Chronicler = (ReflectionServices.FindControlEx(element.GetAttributeReference("id").Value.ToString(), manager) as IChronicler);
            }
            if (element.Attributes.ContainsKey("member"))
            {
                transitPoint.Member = element.GetAttributeReference("member").Value.ToString();
            }
            if (element.Attributes.ContainsKey("value"))
            {
                valid = true;
                transitPoint.Value = element.GetAttributeReference("value").Value;
            }
            if (element.Elements.ContainsKey("expression"))
            {
                valid = true;

                IConfigurationElement expressionElement = element.GetElementReference("expression");
                IExpression expression = expressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression;
                if (null == expression) throw new InvalidOperationException("Token is not an IExpression");
                expression.Make(expressionElement, expressionsManager);
                transitPoint.Expression = expression;
            }

            if (!valid)
                transitPoint = null;

            return transitPoint;
        }
コード例 #24
0
ファイル: ParameterToken.cs プロジェクト: t1b1c/lwas
        public override void Make(IConfigurationType config, IExpressionsManager manager)
        {
            if (null == config) throw new ArgumentNullException("config");
            if (null == manager) throw new ArgumentNullException("manager");

            IConfigurationElement tokenElement = config as IConfigurationElement;
            if (null == tokenElement) throw new ArgumentException("config is not an IConfigurationElement");
            if (!tokenElement.Elements.ContainsKey("source")) throw new ConfigurationException("Bad views token configuration: 'source' element not found");
            IConfigurationElement sourceElement = tokenElement.GetElementReference("source");
            if (!sourceElement.Attributes.ContainsKey("parameter")) throw new ConfigurationException("Bad views token configuration: 'source' element has no 'parameter' attribute");
            this.ParameterName = sourceElement.GetAttributeReference("parameter").Value.ToString();
        }
コード例 #25
0
ファイル: BaseViewsToken.cs プロジェクト: t1b1c/lwas
 public abstract void Make(IConfigurationType config, IExpressionsManager manager);
コード例 #26
0
ファイル: ViewToken.cs プロジェクト: t1b1c/lwas
        protected override void Make(IConfigurationElement sourceElement, IExpressionsManager manager)
        {
            if (null == sourceElement) throw new ArgumentNullException("sourceElement");
            if (null == manager) throw new ArgumentNullException("manager");

            if (!sourceElement.Attributes.ContainsKey("view")) throw new ConfigurationException("Bad view as token configuration: 'source' element has no 'view' attribute");
            this.ViewName = sourceElement.GetAttributeReference("view").Value.ToString();

            base.Make(sourceElement, manager);
        }
コード例 #27
0
ファイル: Token.cs プロジェクト: t1b1c/lwas
 public virtual void Make(IConfigurationType config, IExpressionsManager manager)
 {
 }