public void RegisterIndex(
            IndexCompileTimeKey indexKey,
            IndexDetail indexDetail)
        {
            EventTableIndexMetadata indexMetadata = null;
            if (indexKey.IsNamedWindow) {
                NamedWindowMetaData localNamedWindow = moduleNamedWindows.Get(indexKey.InfraName);
                if (localNamedWindow != null) {
                    indexMetadata = localNamedWindow.IndexMetadata;
                }
                else {
                    if (indexKey.Visibility == NameAccessModifier.PUBLIC) {
                        NamedWindowMetaData pathNamedWindow = pathNamedWindows.GetWithModule(
                            indexKey.InfraName,
                            indexKey.InfraModuleName);
                        if (pathNamedWindow != null) {
                            indexMetadata = pathNamedWindow.IndexMetadata;
                        }
                    }
                }

                if (indexMetadata == null) {
                    throw new EPException("Failed to find named window '" + indexKey.InfraName + "'");
                }
            }
            else {
                TableMetaData localTable = moduleTables.Get(indexKey.InfraName);
                if (localTable != null) {
                    indexMetadata = localTable.IndexMetadata;
                }
                else {
                    if (indexKey.Visibility == NameAccessModifier.PUBLIC) {
                        TableMetaData pathTable = pathTables.GetWithModule(
                            indexKey.InfraName,
                            indexKey.InfraModuleName);
                        if (pathTable != null) {
                            indexMetadata = pathTable.IndexMetadata;
                        }
                    }
                }

                if (indexMetadata == null) {
                    throw new EPException("Failed to find table '" + indexKey.InfraName + "'");
                }
            }

            try {
                indexMetadata.AddIndexExplicit(
                    false,
                    indexDetail.IndexMultiKey,
                    indexKey.IndexName,
                    indexKey.InfraModuleName,
                    indexDetail.QueryPlanIndexItem,
                    "");
            }
            catch (ExprValidationException ex) {
                throw new EPException(ex.Message, ex);
            }
        }
Esempio n. 2
0
        public void NewIndex(
            IndexCompileTimeKey key,
            IndexDetailForge detail)
        {
            var existing = Indexes.Get(key);
            if (existing != null) {
                throw new IllegalStateException("A duplicate index has been encountered for key '" + key + "'");
            }

            Indexes.Put(key, detail);
        }