Пример #1
0
        private static void HandlePlugInMultiFunctionAggregation(
            ConfigurationCompiler configuration,
            XmlElement element)
        {
            var functionNames = DOMExtensions.GetRequiredAttribute(element, "function-names");
            var forgeClassName = DOMExtensions.GetOptionalAttribute(element, "forge-class");

            var nodeEnumerator = DOMElementEnumerator.Create(element.ChildNodes);
            IDictionary<string, object> additionalProps = null;
            while (nodeEnumerator.MoveNext()) {
                XmlElement subElement = nodeEnumerator.Current;
                if (subElement.Name == "init-arg") {
                    var name = DOMExtensions.GetRequiredAttribute(subElement, "name");
                    var value = DOMExtensions.GetRequiredAttribute(subElement, "value");
                    if (additionalProps == null) {
                        additionalProps = new Dictionary<string, object>();
                    }

                    additionalProps.Put(name, value);
                }
            }

            var config = new ConfigurationCompilerPlugInAggregationMultiFunction(
                functionNames.SplitCsv(),
                forgeClassName);
            config.AdditionalConfiguredProperties = additionalProps;
            configuration.AddPlugInAggregationMultiFunction(config);
        }
Пример #2
0
        private static void HandleByteCode(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var codegen = compiler.ByteCode;
            ParseOptionalBoolean(element, "include-debugsymbols", v => codegen.IncludeDebugSymbols = v);
            ParseOptionalBoolean(element, "include-comments", v => codegen.IncludeComments = v);
            ParseOptionalBoolean(element, "attach-epl", v => codegen.AttachEPL = v);
            ParseOptionalBoolean(element, "attach-module-epl", v => codegen.AttachModuleEPL = v);
            ParseOptionalBoolean(element, "instrumented", v => codegen.Instrumented = v);
            ParseOptionalBoolean(element, "allow-subscriber", v => codegen.AllowSubscriber = v);

            ParseOptionalAccessMod(element, "access-modifier-context", v => codegen.AccessModifierContext = v);
            ParseOptionalAccessMod(element, "access-modifier-event-type", v => codegen.AccessModifierEventType = v);
            ParseOptionalAccessMod(element, "access-modifier-expression", v => codegen.AccessModifierExpression = v);
            ParseOptionalAccessMod(element, "access-modifier-named-window", v => codegen.AccessModifierNamedWindow = v);
            ParseOptionalAccessMod(element, "access-modifier-script", v => codegen.AccessModifierScript = v);
            ParseOptionalAccessMod(element, "access-modifier-table", v => codegen.AccessModifierTable = v);
            ParseOptionalAccessMod(element, "access-modifier-variable", v => codegen.AccessModifierVariable = v);

            var busModifierEventType = DOMExtensions.GetOptionalAttribute(element, "bus-modifier-event-type");
            if (busModifierEventType != null) {
                try {
                    codegen.BusModifierEventType = EnumHelper.Parse<EventTypeBusModifier>(busModifierEventType.Trim());
                }
                catch (Exception t) {
                    throw new ConfigurationException(t.Message, t);
                }
            }
        }
Пример #3
0
        private static void HandleSerdeSettings(
            ConfigurationCompiler configuration,
            XmlElement parentElement)
        {
            String text = DOMExtensions.GetOptionalAttribute(parentElement, "enable-serializable");
            if (text != null) {
                configuration.Serde.IsEnableSerializable = bool.Parse(text);
            }

            text = DOMExtensions.GetOptionalAttribute(parentElement, "enable-externalizable");
            if (text != null) {
                configuration.Serde.IsEnableExternalizable = bool.Parse(text);
            }

            text = DOMExtensions.GetOptionalAttribute(parentElement, "enable-extended-builtin");
            if (text != null) {
                configuration.Serde.IsEnableExtendedBuiltin = bool.Parse(text);
            }

            text = DOMExtensions.GetOptionalAttribute(parentElement, "enable-serialization-fallback");
            if (text != null) {
                configuration.Serde.IsEnableSerializationFallback = bool.Parse(text);
            }

            var nodeEnumerator = DOMElementEnumerator.Create(parentElement.ChildNodes);
            while (nodeEnumerator.MoveNext()) {
                var subElement = nodeEnumerator.Current;
                if (subElement.Name == "serde-provider-factory") {
                    text = DOMExtensions.GetRequiredAttribute(subElement, "class");
                    configuration.Serde.AddSerdeProviderFactory(text);
                }
            }
        }
Пример #4
0
        private static void HandleStreamSelection(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var nodeEnumerator = DOMElementEnumerator.Create(element.ChildNodes);
            while (nodeEnumerator.MoveNext()) {
                XmlElement subElement = nodeEnumerator.Current;
                if (subElement.Name == "stream-selector") {
                    var valueText = DOMExtensions.GetRequiredAttribute(subElement, "value");
                    if (valueText == null) {
                        throw new ConfigurationException("No value attribute supplied for stream-selector element");
                    }

                    StreamSelector defaultSelector;
                    if (valueText.ToUpperInvariant().Trim() == "ISTREAM") {
                        defaultSelector = StreamSelector.ISTREAM_ONLY;
                    }
                    else if (valueText.ToUpperInvariant().Trim() == "RSTREAM") {
                        defaultSelector = StreamSelector.RSTREAM_ONLY;
                    }
                    else if (valueText.ToUpperInvariant().Trim() == "IRSTREAM") {
                        defaultSelector = StreamSelector.RSTREAM_ISTREAM_BOTH;
                    }
                    else {
                        throw new ConfigurationException(
                            "Value attribute for stream-selector element invalid, " +
                            "expected one of the following keywords: istream, irstream, rstream");
                    }

                    compiler.StreamSelection.DefaultStreamSelector = defaultSelector;
                }
            }
        }
Пример #5
0
 private static void HandlePlugInAggregation(
     ConfigurationCompiler configuration,
     XmlElement element)
 {
     var name = DOMExtensions.GetRequiredAttribute(element, "name");
     var forgeClassName = DOMExtensions.GetRequiredAttribute(element, "forge-class");
     configuration.AddPlugInAggregationFunctionForge(name, forgeClassName);
 }
Пример #6
0
 private static void HandlePlugInEnumMethod(
     ConfigurationCompiler configuration,
     XmlElement element)
 {
     String methodName = DOMExtensions.GetRequiredAttribute(element, "method-name");
     String forgeClassName = DOMExtensions.GetRequiredAttribute(element, "forge-class");
     configuration.AddPlugInEnumMethod(methodName, forgeClassName);
 }
Пример #7
0
 private static void HandleScripts(
     ConfigurationCompiler compiler,
     XmlElement element)
 {
     var defaultDialect = DOMExtensions.GetOptionalAttribute(element, "default-dialect");
     if (defaultDialect != null) {
         compiler.Scripts.DefaultDialect = defaultDialect;
     }
 }
Пример #8
0
 private static void HandlePlugInPatternObserver(
     ConfigurationCompiler configuration,
     XmlElement element)
 {
     var @namespace = DOMExtensions.GetRequiredAttribute(element, "namespace");
     var name = DOMExtensions.GetRequiredAttribute(element, "name");
     var forgeClassName = DOMExtensions.GetRequiredAttribute(element, "forge-class");
     configuration.AddPlugInPatternObserver(@namespace, name, forgeClassName);
 }
Пример #9
0
 private static void HandlePlugInVirtualDW(
     ConfigurationCompiler configuration,
     XmlElement element)
 {
     var @namespace = DOMExtensions.GetRequiredAttribute(element, "namespace");
     var name = DOMExtensions.GetRequiredAttribute(element, "name");
     var forgeClassName = DOMExtensions.GetRequiredAttribute(element, "forge-class");
     var config = DOMExtensions.GetOptionalAttribute(element, "config");
     configuration.AddPlugInVirtualDataWindow(@namespace, name, forgeClassName, config);
 }
Пример #10
0
        private static void HandleScripts(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var defaultDialect = DOMExtensions.GetOptionalAttribute(element, "default-dialect");
            if (defaultDialect != null) {
                compiler.Scripts.DefaultDialect = defaultDialect;
            }

            ParseOptionalBoolean(element, "enabled", b => compiler.Scripts.IsEnabled = b);

        }
Пример #11
0
 private static void HandleLogging(
     ConfigurationCompiler compiler,
     XmlElement element)
 {
     var nodeEnumerator = DOMElementEnumerator.Create(element.ChildNodes);
     while (nodeEnumerator.MoveNext()) {
         XmlElement subElement = nodeEnumerator.Current;
         if (subElement.Name == "code") {
             ParseRequiredBoolean(subElement, "enabled", b => compiler.Logging.EnableCode = b);
         } else if (subElement.Name == "audit-directory") {
             compiler.Logging.AuditDirectory = DOMExtensions.GetRequiredAttribute(subElement, "value");
         }
     }
 }
Пример #12
0
        private static void HandleExecution(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var filterServiceMaxFilterWidthStr =
                DOMExtensions.GetOptionalAttribute(element, "filter-service-max-filter-width");
            if (filterServiceMaxFilterWidthStr != null) {
                compiler.Execution.FilterServiceMaxFilterWidth = int.Parse(filterServiceMaxFilterWidthStr);
            }

            ParseOptionalBoolean(
                element,
                "enable-declared-expr-value-cache",
                b => compiler.Execution.EnabledDeclaredExprValueCache = b);
        }
Пример #13
0
        private static void HandleViewResources(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var nodeEnumerator = DOMElementEnumerator.Create(element.ChildNodes);
            while (nodeEnumerator.MoveNext()) {
                XmlElement subElement = nodeEnumerator.Current;
                if (subElement.Name == "iterable-unbound") {
                    var valueText = DOMExtensions.GetRequiredAttribute(subElement, "enabled");
                    var value = bool.Parse(valueText);
                    compiler.ViewResources.IterableUnbound = value;
                }

                if (subElement.Name == "outputlimitopt") {
                    ParseRequiredBoolean(subElement, "enabled", b => compiler.ViewResources.OutputLimitOpt = b);
                }
            }
        }
Пример #14
0
        private static void HandleExpression(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var integerDivision = DOMExtensions.GetOptionalAttribute(element, "integer-division");
            if (integerDivision != null) {
                var isIntegerDivision = bool.Parse(integerDivision);
                compiler.Expression.IntegerDivision = isIntegerDivision;
            }

            var divZero = DOMExtensions.GetOptionalAttribute(element, "division-by-zero-is-null");
            if (divZero != null) {
                var isDivZero = bool.Parse(divZero);
                compiler.Expression.DivisionByZeroReturnsNull = isDivZero;
            }

            var udfCache = DOMExtensions.GetOptionalAttribute(element, "udf-cache");
            if (udfCache != null) {
                var isUdfCache = bool.Parse(udfCache);
                compiler.Expression.UdfCache = isUdfCache;
            }

            var extendedAggregationStr = DOMExtensions.GetOptionalAttribute(element, "extended-agg");
            if (extendedAggregationStr != null) {
                var extendedAggregation = bool.Parse(extendedAggregationStr);
                compiler.Expression.ExtendedAggregation = extendedAggregation;
            }

            var duckTypingStr = DOMExtensions.GetOptionalAttribute(element, "ducktyping");
            if (duckTypingStr != null) {
                compiler.Expression.DuckTyping = bool.Parse(duckTypingStr);
            }

            var mathContextStr = DOMExtensions.GetOptionalAttribute(element, "math-context");
            if (mathContextStr != null) {
                try {
                    compiler.Expression.MathContext = new MathContext(mathContextStr);
                }
                catch (ArgumentException) {
                    throw new ConfigurationException("Failed to parse '" + mathContextStr + "' as a MathContext");
                }
            }
        }
Пример #15
0
        private static void HandlePlugInSingleRow(
            ConfigurationCompiler configuration,
            XmlElement element)
        {
            var name = element.Attributes.GetNamedItem("name").InnerText;
            var functionClassName = element.Attributes.GetNamedItem("function-class").InnerText;
            var functionMethodName = element.Attributes.GetNamedItem("function-method").InnerText;
            var valueCache = ConfigurationCompilerPlugInSingleRowFunction.ValueCacheEnum.DISABLED;
            var filterOptimizable = ConfigurationCompilerPlugInSingleRowFunction.FilterOptimizableEnum.ENABLED;
            var valueCacheStr = DOMExtensions.GetOptionalAttribute(element, "value-cache");
            if (valueCacheStr != null) {
                valueCache =
                    EnumHelper.Parse<ConfigurationCompilerPlugInSingleRowFunction.ValueCacheEnum>(valueCacheStr);
            }

            var filterOptimizableStr = DOMExtensions.GetOptionalAttribute(element, "filter-optimizable");
            if (filterOptimizableStr != null) {
                filterOptimizable =
                    EnumHelper.Parse<ConfigurationCompilerPlugInSingleRowFunction.FilterOptimizableEnum>(
                        filterOptimizableStr);
            }

            var rethrowExceptionsStr = DOMExtensions.GetOptionalAttribute(element, "rethrow-exceptions");
            var rethrowExceptions = false;
            if (rethrowExceptionsStr != null) {
                rethrowExceptions = bool.Parse(rethrowExceptionsStr);
            }

            var eventTypeName = DOMExtensions.GetOptionalAttribute(element, "event-type-name");
            configuration.AddPlugInSingleRowFunction(
                new ConfigurationCompilerPlugInSingleRowFunction(
                    name,
                    functionClassName,
                    functionMethodName,
                    valueCache,
                    filterOptimizable,
                    rethrowExceptions,
                    eventTypeName));
        }
Пример #16
0
        private static void HandleLogging(
            ConfigurationCompiler compiler,
            XmlElement element)
        {
            var nodeEnumerator = DOMElementEnumerator.Create(element.ChildNodes);
            while (nodeEnumerator.MoveNext()) {
                XmlElement subElement = nodeEnumerator.Current;
                switch (subElement.Name) {
                    case "code":
                        ParseRequiredBoolean(subElement, "enabled", b => compiler.Logging.EnableCode = b);
                        break;

                    case "audit-directory":
                        compiler.Logging.AuditDirectory = DOMExtensions.GetRequiredAttribute(subElement, "value");
                        break;

                    case "filter-plan":
                        ParseRequiredBoolean(subElement, "enabled", b => compiler.Logging.IsEnableFilterPlan = b);
                        break;
                }
            }
        }
Пример #17
0
        /// <summary>
        ///     Configure the compiler section from a provided element
        /// </summary>
        /// <param name="compiler">compiler section</param>
        /// <param name="compilerElement">element</param>
        public static void DoConfigure(
            ConfigurationCompiler compiler,
            XmlElement compilerElement)
        {
            var eventTypeNodeEnumerator = DOMElementEnumerator.Create(compilerElement.ChildNodes);
            while (eventTypeNodeEnumerator.MoveNext()) {
                XmlElement element = eventTypeNodeEnumerator.Current;
                var nodeName = element.Name;
                switch (nodeName) {
                    case "plugin-view":
                        HandlePlugInView(compiler, element);
                        break;

                    case "plugin-virtualdw":
                        HandlePlugInVirtualDW(compiler, element);
                        break;

                    case "plugin-aggregation-function":
                        HandlePlugInAggregation(compiler, element);
                        break;

                    case "plugin-aggregation-multifunction":
                        HandlePlugInMultiFunctionAggregation(compiler, element);
                        break;

                    case "plugin-singlerow-function":
                        HandlePlugInSingleRow(compiler, element);
                        break;

                    case "plugin-pattern-guard":
                        HandlePlugInPatternGuard(compiler, element);
                        break;

                    case "plugin-pattern-observer":
                        HandlePlugInPatternObserver(compiler, element);
                        break;

                    case "bytecode":
                        HandleByteCode(compiler, element);
                        break;

                    case "logging":
                        HandleLogging(compiler, element);
                        break;

                    case "stream-selection":
                        HandleStreamSelection(compiler, element);
                        break;

                    case "language":
                        HandleLanguage(compiler, element);
                        break;

                    case "scripts":
                        HandleScripts(compiler, element);
                        break;

                    case "expression":
                        HandleExpression(compiler, element);
                        break;

                    case "execution":
                        HandleExecution(compiler, element);
                        break;

                    case "view-resources":
                        HandleViewResources(compiler, element);
                        break;
                }
            }
        }
Пример #18
0
 private static void HandleLanguage(
     ConfigurationCompiler compiler,
     XmlElement element)
 {
     ParseOptionalBoolean(element, "sort-using-collator", b => compiler.Language.SortUsingCollator = b);
 }