コード例 #1
0
        public void MergeFrom(VariableRepositoryPreconfigured other)
        {
            foreach (var entry in other.Metadata) {
                if (Metadata.ContainsKey(entry.Key)) {
                    continue;
                }

                Metadata.Put(entry.Key, entry.Value);
            }
        }
コード例 #2
0
ファイル: VariableUtil.cs プロジェクト: lanicon/nesper
        public static void ConfigureVariables(
            VariableRepositoryPreconfigured repo,
            IDictionary<string, ConfigurationCommonVariable> variables,
            ImportService importService,
            EventBeanTypedEventFactory eventBeanTypedEventFactory,
            EventTypeRepositoryImpl eventTypeRepositoryPreconfigured,
            BeanEventTypeFactory beanEventTypeFactory)
        {
            foreach (var entry in variables) {
                string variableName = entry.Key.Trim();
                if (repo.GetMetadata(variableName) != null) {
                    continue;
                }

                VariableMetaData meta;
                try {
                    var variableType = ClassIdentifierWArray.ParseSODA(entry.Value.VariableType);
                    meta = GetTypeInfo(
                        variableName,
                        null,
                        NameAccessModifier.PRECONFIGURED,
                        null,
                        null,
                        null,
                        variableType,
                        true,
                        entry.Value.IsConstant,
                        entry.Value.IsConstant,
                        entry.Value.InitializationValue,
                        importService,
                        ExtensionClassEmpty.INSTANCE,
                        eventBeanTypedEventFactory,
                        eventTypeRepositoryPreconfigured,
                        beanEventTypeFactory);
                }
                catch (Exception t) {
                    throw new ConfigurationException("Error configuring variable '" + entry.Key + "': " + t.Message, t);
                }

                repo.AddVariable(entry.Key, meta);
            }
        }