Пример #1
0
        private static DeploymentInternal Deploy(
            bool recovery,
            string deploymentId,
            int statementIdFirstStatement,
            EPCompiled compiled,
            StatementNameRuntimeOption statementNameResolverRuntime,
            StatementUserObjectRuntimeOption userObjectResolverRuntime,
            StatementSubstitutionParameterOption substitutionParameterResolver,
            DeploymentClassLoaderOption deploymentClassLoaderOption,
            EPRuntimeSPI epRuntime)
        {
            // set variable local version
            epRuntime.ServicesContext.VariableManagementService.SetLocalVersion();

            try {
                return(DeploySafe(
                           recovery,
                           deploymentId,
                           statementIdFirstStatement,
                           compiled,
                           statementNameResolverRuntime,
                           userObjectResolverRuntime,
                           substitutionParameterResolver,
                           deploymentClassLoaderOption,
                           epRuntime));
            }
            catch (EPDeployException) {
                throw;
            }
            catch (Exception ex) {
                throw new EPDeployException(ex.Message, ex, -1);
            }
        }
Пример #2
0
        public static ClassLoader GetClassLoader(
            int rolloutItemNumber,
            DeploymentClassLoaderOption deploymentClassLoaderOption,
            EPServicesContext servicesContext)
        {
            ClassLoader deploymentClassLoader = servicesContext.ClassLoaderParent;

            if (deploymentClassLoaderOption != null)
            {
                deploymentClassLoader = deploymentClassLoaderOption(
                    new DeploymentClassLoaderContext(
                        servicesContext.ClassLoaderParent,
                        servicesContext.ConfigSnapshot));
                if (deploymentClassLoader == null)
                {
                    throw new EPDeployException("Deployment classloader option returned a null value for the classloader", rolloutItemNumber);
                }
            }

            return(deploymentClassLoader);
        }
Пример #3
0
 public static DeploymentInternal DeployRecover(
     string deploymentId,
     int statementIdFirstStatement,
     EPCompiled compiled,
     StatementNameRuntimeOption statementNameResolverRuntime,
     StatementUserObjectRuntimeOption userObjectResolverRuntime,
     StatementSubstitutionParameterOption substitutionParameterResolver,
     DeploymentClassLoaderOption deploymentClassLoaderOption,
     EPRuntimeSPI epRuntime)
 {
     return(Deploy(
                true,
                deploymentId,
                statementIdFirstStatement,
                compiled,
                statementNameResolverRuntime,
                userObjectResolverRuntime,
                substitutionParameterResolver,
                deploymentClassLoaderOption,
                epRuntime));
 }
Пример #4
0
 /// <summary>
 ///     Sets the deployment class loader options.
 /// </summary>
 /// <param name="deploymentClassLoaderOption">deployment options</param>
 /// <returns>itself</returns>
 public DeploymentOptions WithDeploymentClassLoaderOption(
     DeploymentClassLoaderOption deploymentClassLoaderOption)
 {
     DeploymentClassLoaderOption = deploymentClassLoaderOption;
     return this;
 }
Пример #5
0
        private static DeploymentInternal DeploySafe(
            bool recovery,
            string deploymentId,
            int statementIdFirstStatement,
            EPCompiled compiled,
            StatementNameRuntimeOption statementNameResolverRuntime,
            StatementUserObjectRuntimeOption userObjectResolverRuntime,
            StatementSubstitutionParameterOption substitutionParameterResolver,
            DeploymentClassLoaderOption deploymentClassLoaderOption,
            EPRuntimeSPI epRuntime)
        {
            var services = epRuntime.ServicesContext;
            var deploymentClassLoader = DeployerHelperResolver.GetClassLoader(-1, deploymentClassLoaderOption, services);
            var moduleProvider        = ModuleProviderUtil.Analyze(compiled, deploymentClassLoader, services.ClassProvidedPathRegistry);

            if (moduleProvider.ClassLoader is ClassProvidedImportClassLoader)
            {
                ((ClassProvidedImportClassLoader)moduleProvider.ClassLoader).Imported = moduleProvider.ModuleProvider.ModuleDependencies.PathClasses;
            }

            var moduleName = moduleProvider.ModuleProvider.ModuleName;

            // resolve external dependencies
            var moduleDependencies       = moduleProvider.ModuleProvider.ModuleDependencies;
            var deploymentIdDependencies = ResolveDependencies(-1, moduleDependencies, services);

            // initialize EPL objects defined by module
            var moduleEPLObjects = InitializeEPLObjects(moduleProvider, deploymentId, services);

            // determine staged EPL object overlap
            ValidateStagedEPLObjects(moduleEPLObjects, moduleProvider.ModuleProvider.ModuleName, -1, epRuntime.StageService);

            // add EPL objects defined by module to path
            var modulePaths = UpdatePath(-1, moduleEPLObjects, moduleName, deploymentId, services);

            // obtain statement lightweights
            var stmtLightweights = InitializeStatements(
                -1,
                recovery,
                moduleEPLObjects,
                modulePaths,
                moduleName,
                moduleProvider,
                deploymentId,
                statementIdFirstStatement,
                userObjectResolverRuntime,
                statementNameResolverRuntime,
                substitutionParameterResolver,
                services);

            // start statements depending on context association
            var statements = DeployStatements(
                -1, stmtLightweights.Lightweights, recovery, modulePaths, moduleProvider, deploymentId, epRuntime);

            // add dependencies
            AddPathDependencies(deploymentId, moduleDependencies, services);

            // keep statement and deployment
            var deployed = DeploymentInternal.From(
                deploymentId,
                statements,
                deploymentIdDependencies,
                modulePaths,
                moduleEPLObjects,
                moduleProvider);

            services.DeploymentLifecycleService.AddDeployment(deploymentId, deployed);

            // register for recovery
            if (!recovery)
            {
                var recoveryInformation = GetRecoveryInformation(deployed);
                services.DeploymentRecoveryService.Add(
                    deploymentId,
                    statementIdFirstStatement,
                    compiled,
                    recoveryInformation.StatementUserObjectsRuntime,
                    recoveryInformation.StatementNamesWhenProvidedByAPI,
                    stmtLightweights.SubstitutionParameters);
            }

            return(deployed);
        }