예제 #1
0
        public ExpressionScriptProvided Resolve(
            string name,
            int numParameters)
        {
            var key = new NameAndParamNum(name, numParameters);

            // try self-originated protected types first
            ExpressionScriptProvided localExpr = _locals.Scripts.Get(key);
            if (localExpr != null) {
                return localExpr;
            }

            try {
                var expression = _path.GetAnyModuleExpectSingle(
                    new NameAndParamNum(name, numParameters),
                    _moduleUses);
                if (expression != null) {
                    if (!_isFireAndForget &&
                        !NameAccessModifierExtensions.Visible(
                        expression.First.Visibility,
                        expression.First.ModuleName,
                        _moduleName)) {
                        return null;
                    }

                    _moduleDependencies.AddPathScript(key, expression.Second);
                    return expression.First;
                }
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.SCRIPT, name, e);
            }

            return null;
        }
예제 #2
0
        public ExpressionDeclItem Resolve(string name)
        {
            // try self-originated protected types first
            ExpressionDeclItem localExpr = _locals.Expressions.Get(name);
            if (localExpr != null) {
                return localExpr;
            }

            try {
                var expression = _path.GetAnyModuleExpectSingle(name, _moduleUses);
                if (expression != null) {
                    if (!_isFireAndForget && !NameAccessModifierExtensions.Visible(
                        expression.First.Visibility,
                        expression.First.ModuleName,
                        _moduleName)) {
                        return null;
                    }

                    _moduleDependencies.AddPathExpression(name, expression.Second);
                    return expression.First;
                }
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.EXPRDECL, name, e);
            }

            return null;
        }
        public ContextMetaData GetContextInfo(string contextName)
        {
            // try self-originated protected types first
            ContextMetaData localContext = locals.Contexts.Get(contextName);
            if (localContext != null) {
                return localContext;
            }

            try {
                Pair<ContextMetaData, string> pair = path.GetAnyModuleExpectSingle(contextName, moduleUses);
                if (pair != null) {
                    if (!isFireAndForget &&
                        !NameAccessModifierExtensions.Visible(
                            pair.First.ContextVisibility,
                            pair.First.ContextModuleName,
                            moduleName)) {
                        return null;
                    }

                    moduleDependencies.AddPathContext(contextName, pair.Second);
                    return pair.First;
                }
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.CONTEXT, contextName, e);
            }

            return null;
        }
        public NamedWindowMetaData Resolve(string namedWindowName)
        {
            // try self-originated protected types first
            var localNamedWindow = locals.NamedWindows.Get(namedWindowName);
            if (localNamedWindow != null) {
                return localNamedWindow;
            }

            try {
                var pair = path.GetAnyModuleExpectSingle(namedWindowName, moduleUses);
                if (pair != null) {
                    if (!isFireAndForget &&
                        !NameAccessModifierExtensions.Visible(
                        pair.First.EventType.Metadata.AccessModifier,
                        pair.First.NamedWindowModuleName,
                        moduleName)) {
                        return null;
                    }

                    moduleDependencies.AddPathNamedWindow(namedWindowName, pair.Second);
                    return pair.First;
                }
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.NAMEDWINDOW, namedWindowName, e);
            }

            return null;
        }
        public TableMetaData Resolve(string tableName)
        {
            TableMetaData metaData = compileTimeRegistry.GetTable(tableName);
            if (metaData != null) {
                return metaData;
            }

            try {
                var data = pathTables.GetAnyModuleExpectSingle(tableName, moduleUses);
                if (data != null) {
                    if (!isFireAndForget && 
                        !NameAccessModifierExtensions.Visible(
                        data.First.TableVisibility,
                        data.First.TableModuleName,
                        moduleName)) {
                        return null;
                    }

                    moduleDependencies.AddPathTable(tableName, data.Second);
                    return data.First;
                }
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.TABLE, tableName, e);
            }

            return null;
        }
예제 #6
0
        public static EventType Resolve(
            EventTypeMetadata metadata,
            EventTypeNameResolver publics,
            IDictionary<string, EventType> locals,
            PathRegistry<string, EventType> path)
        {
            EventTypeSPI type;
            // public can only see public
            if (metadata.AccessModifier == NameAccessModifier.PRECONFIGURED) {
                type = (EventTypeSPI) publics.GetTypeByName(metadata.Name);

                // for create-schema the type may be defined by the same module
                if (type == null) {
                    type = (EventTypeSPI) locals.Get(metadata.Name);
                }
            }
            else if (metadata.AccessModifier == NameAccessModifier.PUBLIC ||
                     metadata.AccessModifier == NameAccessModifier.INTERNAL) {
                // path-visibility can be provided as local
                var local = locals.Get(metadata.Name);
                if (local != null) {
                    if (local.Metadata.AccessModifier == NameAccessModifier.PUBLIC ||
                        local.Metadata.AccessModifier == NameAccessModifier.INTERNAL) {
                        return (EventTypeSPI) local;
                    }
                }

                try {
                    var pair = path.GetAnyModuleExpectSingle(
                        metadata.Name,
                        Collections.SingletonSet(metadata.ModuleName));
                    type = (EventTypeSPI) pair?.First;
                }
                catch (PathException e) {
                    throw new EPException(e.Message, e);
                }
            }
            else {
                type = (EventTypeSPI) locals.Get(metadata.Name);
            }

            if (type == null) {
                throw new EPException(
                    "Failed to find event type '" +
                    metadata.Name +
                    "' among public types, modules-in-path or the current module itself");
            }

            return type;
        }
예제 #7
0
        private EventType FindTypeMayNull(string eventTypeName)
        {
            var eventType = eventTypeRepositoryPreconfigured.GetTypeByName(eventTypeName);
            if (eventType != null) {
                return eventType;
            }

            try {
                eventType = pathEventTypes.GetAnyModuleExpectSingle(eventTypeName, null).First;
            }
            catch (PathException ex) {
                throw new EPException("Failed to obtain event type '" + eventTypeName + "': " + ex.Message, ex);
            }

            return eventType;
        }
예제 #8
0
        public EventType GetTypeByName(string typeName)
        {
            var localType = locals.Get(typeName);
            if (localType != null) {
                return localType;
            }

            var publicType = publics.GetTypeByName(typeName);
            if (publicType != null) {
                return publicType;
            }

            try {
                var pair = path.GetAnyModuleExpectSingle(typeName, null);
                return pair?.First;
            }
            catch (PathException e) {
                throw new EPException("Event type name '" + typeName + "' is ambiguous: " + e.Message, e);
            }
        }
        private VariableMetaData ResolvePath(string variableName)
        {
            try {
                var pair = _pathVariables.GetAnyModuleExpectSingle(variableName, _moduleUses);
                if (pair == null) {
                    return null;
                }

                if (!_isFireAndForget &&
                    !NameAccessModifierExtensions.Visible(
                        pair.First.VariableVisibility,
                        pair.First.VariableModuleName,
                        _moduleName)) {
                    return null;
                }

                _moduleDependencies.AddPathVariable(variableName, pair.Second);
                return pair.First;
            }
            catch (PathException e) {
                throw CompileTimeResolverUtil.MakePathAmbiguous(PathRegistryObjectType.VARIABLE, variableName, e);
            }
        }