예제 #1
0
        // what are the dependencies that the given deployment provides to other modules?
        public static EPDeploymentDependencyProvided GetDependenciesProvided(
            string selfDeploymentId,
            EPServicesPath paths,
            DeploymentLifecycleService deploymentLifecycleService)
        {
            DeploymentInternal selfDeployment = deploymentLifecycleService.GetDeploymentById(selfDeploymentId);

            if (selfDeployment == null)
            {
                return(null);
            }

            IList <EPDeploymentDependencyProvided.Item> dependencies = new List <EPDeploymentDependencyProvided.Item>(4);
            string moduleName = selfDeployment.ModuleProvider.ModuleName;

            HandleProvided(selfDeployment.PathNamedWindows, EPObjectType.NAMEDWINDOW, paths.NamedWindowPathRegistry, moduleName, dependencies, name => name);
            HandleProvided(selfDeployment.PathTables, EPObjectType.TABLE, paths.TablePathRegistry, moduleName, dependencies, name => name);
            HandleProvided(selfDeployment.PathVariables, EPObjectType.VARIABLE, paths.VariablePathRegistry, moduleName, dependencies, name => name);
            HandleProvided(selfDeployment.PathContexts, EPObjectType.CONTEXT, paths.ContextPathRegistry, moduleName, dependencies, name => name);
            HandleProvided(selfDeployment.PathEventTypes, EPObjectType.EVENTTYPE, paths.EventTypePathRegistry, moduleName, dependencies, name => name);
            HandleProvided(selfDeployment.PathExprDecls, EPObjectType.EXPRESSION, paths.ExprDeclaredPathRegistry, moduleName, dependencies, name => name);
            HandleProvided(selfDeployment.PathScripts, EPObjectType.SCRIPT, paths.ScriptPathRegistry, moduleName, dependencies, SCRIPT_OBJECTNAME);
            HandleProvided(
                selfDeployment.PathClassProvideds,
                EPObjectType.CLASSPROVIDED,
                paths.ClassProvidedPathRegistry,
                moduleName,
                dependencies,
                name => name);

            foreach (ModuleIndexMeta objectName in selfDeployment.PathIndexes)
            {
                EventTableIndexMetadata indexMetadata = GetIndexMetadata(objectName, moduleName, paths);
                if (indexMetadata == null)
                {
                    continue;
                }

                EventTableIndexMetadataEntry meta = indexMetadata.GetIndexEntryByName(objectName.IndexName);
                if (meta != null && meta.ReferringDeployments != null && meta.ReferringDeployments.Length > 0)
                {
                    ISet <string> referred = new HashSet <string>(Arrays.AsList(meta.ReferringDeployments));
                    referred.Remove(selfDeploymentId);
                    if (!referred.IsEmpty())
                    {
                        dependencies.Add(new EPDeploymentDependencyProvided.Item(EPObjectType.INDEX, INDEX_OBJECTNAME.Invoke(objectName), referred));
                    }
                }
            }

            return(new EPDeploymentDependencyProvided(dependencies));
        }
예제 #2
0
 private void CheckDeploymentIdsExist(
     ISet <string> deploymentIds,
     DeploymentLifecycleService deploymentLifecycleService)
 {
     foreach (string deploymentId in deploymentIds)
     {
         DeploymentInternal deployment = deploymentLifecycleService.GetDeploymentById(deploymentId);
         if (deployment == null)
         {
             throw new EPStageException("Deployment '" + deploymentId + "' was not found");
         }
     }
 }
예제 #3
0
        public static EPDeployment ToDeployment(
            DeploymentLifecycleService deploymentLifecycleService,
            string deploymentId)
        {
            var deployed = deploymentLifecycleService.GetDeploymentById(deploymentId);
            if (deployed == null) {
                return null;
            }

            var stmts = deployed.Statements;
            var copy = new EPStatement[stmts.Length];
            Array.Copy(stmts, 0, copy, 0, stmts.Length);
            return new EPDeployment(
                deploymentId,
                deployed.ModuleProvider.ModuleName,
                deployed.ModulePropertiesCached,
                copy,
                CollectionUtil.CopyArray(deployed.DeploymentIdDependencies),
                DateTimeHelper.TimeFromMillis(deployed.LastUpdateDate));
        }
예제 #4
0
        public static string DetermineDeploymentIdCheckExists(
            int rolloutItemNumber,
            DeploymentOptions optionsMayNull,
            DeploymentLifecycleService deploymentLifecycleService)
        {
            string deploymentId;

            if (optionsMayNull == null || optionsMayNull.DeploymentId == null)
            {
                deploymentId = Guid.NewGuid().ToString();
            }
            else
            {
                deploymentId = optionsMayNull.DeploymentId;
            }

            if (deploymentLifecycleService.GetDeploymentById(deploymentId) != null)
            {
                throw new EPDeployDeploymentExistsException("Deployment by id '" + deploymentId + "' already exists", rolloutItemNumber);
            }

            return(deploymentId);
        }
예제 #5
0
        // what are the dependencies that the given deployment consumes from other modules?
        public static EPDeploymentDependencyConsumed GetDependenciesConsumed(
            string selfDeploymentId,
            EPServicesPath paths,
            DeploymentLifecycleService deploymentLifecycleService)
        {
            var selfDeployment = deploymentLifecycleService.GetDeploymentById(selfDeploymentId);

            if (selfDeployment == null)
            {
                return(null);
            }

            string[] consumedDeploymentIds = selfDeployment.DeploymentIdDependencies;
            var      consumed = new List <EPDeploymentDependencyConsumed.Item>(4);

            foreach (string providerDeploymentId in consumedDeploymentIds)
            {
                var providingDeployment = deploymentLifecycleService.GetDeploymentById(providerDeploymentId);
                if (providingDeployment == null)
                {
                    continue;
                }

                string moduleName = providingDeployment.ModuleProvider.ModuleName;
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathNamedWindows,
                    EPObjectType.NAMEDWINDOW,
                    paths.NamedWindowPathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathTables,
                    EPObjectType.TABLE,
                    paths.TablePathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathVariables,
                    EPObjectType.VARIABLE,
                    paths.VariablePathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathContexts,
                    EPObjectType.CONTEXT,
                    paths.ContextPathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathEventTypes,
                    EPObjectType.EVENTTYPE,
                    paths.EventTypePathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathExprDecls,
                    EPObjectType.EXPRESSION,
                    paths.ExprDeclaredPathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathScripts,
                    EPObjectType.SCRIPT,
                    paths.ScriptPathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    SCRIPT_OBJECTNAME);
                HandleConsumed(
                    providerDeploymentId,
                    providingDeployment.PathClassProvideds,
                    EPObjectType.CLASSPROVIDED,
                    paths.ClassProvidedPathRegistry,
                    moduleName,
                    selfDeploymentId,
                    consumed,
                    name => name);

                foreach (ModuleIndexMeta objectName in providingDeployment.PathIndexes)
                {
                    EventTableIndexMetadata indexMetadata = GetIndexMetadata(objectName, moduleName, paths);
                    if (indexMetadata == null)
                    {
                        continue;
                    }

                    EventTableIndexMetadataEntry meta = indexMetadata.GetIndexEntryByName(objectName.IndexName);
                    if (meta != null && meta.ReferringDeployments != null && meta.ReferringDeployments.Length > 0)
                    {
                        bool found = false;
                        foreach (string dep in meta.ReferringDeployments)
                        {
                            if (dep.Equals(selfDeploymentId))
                            {
                                found = true;
                                break;
                            }
                        }

                        if (found)
                        {
                            consumed.Add(
                                new EPDeploymentDependencyConsumed.Item(providerDeploymentId, EPObjectType.INDEX, INDEX_OBJECTNAME.Invoke(objectName)));
                        }
                    }
                }
            }

            return(new EPDeploymentDependencyConsumed(consumed));
        }