Exemple #1
0
 public static DeploymentInternal From(
     string deploymentId,
     EPStatement[] statements,
     ISet<string> deploymentIdDependencies,
     DeployerModulePaths modulePaths,
     DeployerModuleEPLObjects moduleEPLObjects,
     ModuleProviderCLPair moduleProvider)
 {
     var deploymentIdDependenciesArray = deploymentIdDependencies.ToArray();
     return new DeploymentInternal(
         deploymentId,
         statements,
         deploymentIdDependenciesArray,
         modulePaths.PathNamedWindows.ToArray(),
         modulePaths.PathTables.ToArray(),
         modulePaths.PathVariables.ToArray(),
         modulePaths.PathContexts.ToArray(),
         modulePaths.PathEventTypes.ToArray(),
         modulePaths.PathExprDecl.ToArray(),
         modulePaths.PathScripts.ToArray(),
         moduleEPLObjects.ModuleIndexes.ToArray(),
         modulePaths.PathClassProvideds.ToArray(),
         moduleProvider.ModuleProvider,
         moduleProvider.ModuleProvider.ModuleProperties,
         modulePaths.DeploymentTypes,
         DateTimeHelper.CurrentTimeMillis);
 }
 public DeployerRolloutInitResult(
     ISet<string> deploymentIdDependencies,
     DeployerModuleEPLObjects moduleEPLObjects,
     DeployerModulePaths modulePaths,
     string moduleName)
 {
     DeploymentIdDependencies = deploymentIdDependencies;
     ModuleEPLObjects = moduleEPLObjects;
     ModulePaths = modulePaths;
     ModuleName = moduleName;
 }
Exemple #3
0
        internal static EPStatement[] DeployStatements(
            int rolloutItemNumber,
            IList <StatementLightweight> lightweights,
            bool recovery,
            DeployerModulePaths modulePaths,
            ModuleProviderCLPair provider,
            string deploymentId,
            EPRuntimeSPI epRuntime)
        {
            var statements = new EPStatement[lightweights.Count];
            var count      = 0;

            foreach (var lightweight in lightweights)
            {
                EPStatementSPI stmt;
                try {
                    stmt = DeployerHelperStatement.DeployStatement(recovery, lightweight, epRuntime);
                }
                catch (Exception ex) {
                    try {
                        ReverseDeployment(deploymentId, modulePaths.DeploymentTypes, lightweights, statements, provider, epRuntime.ServicesContext);
                    }
                    catch (Exception udex) {
                        log.Warn(udex.Message, udex);
                    }

                    throw new EPDeployException("Failed to deploy: " + ex.Message, ex, rolloutItemNumber);
                }

                statements[count++] = stmt;

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get()
                    .QaEngineManagementStmtStarted(
                        epRuntime.URI,
                        deploymentId,
                        lightweight.StatementContext.StatementId,
                        stmt.Name,
                        (string)stmt.GetProperty(StatementProperty.EPL),
                        epRuntime.EventService.CurrentTime);
                }
            }

            return(statements);
        }
Exemple #4
0
        public static DeployerModuleStatementLightweights InitializeStatements(
            int rolloutItemNumber,
            bool recovery,
            DeployerModuleEPLObjects moduleEPLObjects,
            DeployerModulePaths modulePaths,
            string moduleName,
            ModuleProviderCLPair moduleProvider,
            string deploymentId,
            int statementIdFirstStatement,
            StatementUserObjectRuntimeOption userObjectResolverRuntime,
            StatementNameRuntimeOption statementNameResolverRuntime,
            StatementSubstitutionParameterOption substitutionParameterResolver,
            EPServicesContext services)
        {
            // get module statements
            IList <StatementProvider> statementResources;

            try {
                statementResources = moduleProvider.ModuleProvider.Statements;
            }
            catch (Exception e) {
                throw new EPException(e);
            }

            // initialize all statements
            IList <StatementLightweight> lightweights = new List <StatementLightweight>();
            IDictionary <int, IDictionary <int, object> > substitutionParameters;
            ISet <string> statementNames    = new HashSet <string>();
            var           moduleIncidentals = moduleEPLObjects.Incidentals;

            try {
                var statementId = statementIdFirstStatement;
                foreach (var statement in statementResources)
                {
                    var lightweight = InitStatement(
                        recovery,
                        moduleName,
                        statement,
                        deploymentId,
                        statementId,
                        moduleEPLObjects.EventTypeResolver,
                        moduleIncidentals,
                        statementNameResolverRuntime,
                        userObjectResolverRuntime,
                        moduleProvider.ClassLoader,
                        services);
                    lightweights.Add(lightweight);
                    statementId++;

                    var statementName = lightweight.StatementContext.StatementName;
                    if (statementNames.Contains(statementName))
                    {
                        throw new EPDeployException(
                                  "Duplicate statement name provide by statement name resolver for statement name '" + statementName + "'",
                                  rolloutItemNumber);
                    }

                    statementNames.Add(statementName);
                }

                // set parameters
                substitutionParameters = SetSubstitutionParameterValues(rolloutItemNumber, deploymentId, lightweights, substitutionParameterResolver);
            }
            catch (Exception) {
                DeployerHelperResolver.ReverseDeployment(deploymentId, modulePaths.DeploymentTypes, lightweights, new EPStatement[0], moduleProvider, services);
                throw;
            }

            return(new DeployerModuleStatementLightweights(statementIdFirstStatement, lightweights, substitutionParameters));
        }