示例#1
0
            protected override bool GetChanges(CloudRuntimePackage package, out Dictionary <string, string> changes)
            {
                bool succeed = base.GetChanges(package, out changes);

                changes[Resources.RuntimeVersionPrimaryKey] = package.Version;
                return(succeed);
            }
示例#2
0
 protected virtual bool GetChanges(CloudRuntimePackage package, out Dictionary <string, string> changes)
 {
     changes = new Dictionary <string, string>();
     changes[Resources.RuntimeTypeKey] = package.Runtime.ToString().ToLower();
     changes[Resources.RuntimeUrlKey]  = package.PackageUri.ToString();
     return(true);
 }
示例#3
0
            protected override bool GetChanges(CloudRuntimePackage package, out Dictionary <string, string> changes)
            {
                base.GetChanges(package, out changes);

                Debug.Assert(changes.ContainsKey(Resources.RuntimeTypeKey), "Cache runtime should be added before calling this method");
                Debug.Assert(changes.ContainsKey(Resources.RuntimeUrlKey), "Cache runtime should be added before calling this method");

                changes[Resources.CacheRuntimeVersionKey] = package.Version;

                return(true);
            }
示例#4
0
        public virtual void ApplyRuntime(CloudRuntimePackage package, WorkerRole workerRole)
        {
            Dictionary <string, string> changes;

            if (this.GetChanges(package, out changes))
            {
                ApplyRoleXmlChanges(changes, workerRole);
            }

            ApplyScaffoldingChanges(package);
        }
        /// <summary>
        /// Create a cloud runtime application, essentialy this is a tuple of runtime X package X role
        /// </summary>
        /// <param name="cloudRuntime">The runtime in the tuple</param>
        /// <param name="cloudRuntimePackage">The package in the tuple</param>
        /// <param name="role">The role to apply the package to</param>
        /// <returns>The tuple, use the apply method to apply the runtime as specified</returns>
        public static CloudRuntimeApplicator CreateCloudRuntimeApplicator(CloudRuntime cloudRuntime, CloudRuntimePackage cloudRuntimePackage, WorkerRole role)
        {
            CloudRuntimeApplicator applicator = new CloudRuntimeApplicator
            {
                Runtime = cloudRuntime,
                Package = cloudRuntimePackage,
                WorkerRole = role
            };

            return applicator;
        }
示例#6
0
        public virtual bool ValidateMatch(CloudRuntimePackage runtime, out string warningText)
        {
            warningText = null;
            bool result = this.Match(runtime);

            if (!result)
            {
                warningText = this.GenerateWarningText(runtime);
            }

            return(result);
        }
示例#7
0
            protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
            {
                string rootPath = CommonUtilities.GetServiceRootPath(FilePath);

                if (CloudServiceProject.Components.StartupTaskExists(RoleName, Resources.CacheStartupCommand))
                {
                    CloudServiceProject.Components.SetStartupTaskVariable(
                        RoleName,
                        Resources.CacheRuntimeUrl,
                        package.PackageUri.ToString(),
                        Resources.CacheStartupCommand);
                }
                else
                {
                    Variable emulated = new Variable
                    {
                        name = Resources.EmulatedKey,
                        RoleInstanceValue = new RoleInstanceValueElement
                        {
                            xpath = "/RoleEnvironment/Deployment/@emulated"
                        }
                    };
                    Variable cacheRuntimeUrl = new Variable
                    {
                        name  = Resources.CacheRuntimeUrl,
                        value = package.PackageUri.ToString()
                    };

                    CloudServiceProject.Components.AddStartupTask(
                        RoleName,
                        Resources.CacheStartupCommand,
                        ExecutionContext.elevated,
                        emulated,
                        cacheRuntimeUrl);
                }
            }
示例#8
0
        protected virtual void ApplyScaffoldingChanges(CloudRuntimePackage package)
        {

        }
示例#9
0
 public abstract bool Match(CloudRuntimePackage runtime);
        /// <summary>
        /// Create a cloud runtime application, essentialy this is a tuple of runtime X package X role
        /// </summary>
        /// <param name="cloudRuntime">The runtime in the tuple</param>
        /// <param name="cloudRuntimePackage">The package in the tuple</param>
        /// <param name="role">The role to apply the package to</param>
        /// <returns>The tuple, use the apply method to apply the runtime as specified</returns>
        public static CloudRuntimeApplicator CreateCloudRuntimeApplicator(CloudRuntime cloudRuntime, CloudRuntimePackage cloudRuntimePackage, WorkerRole role)
        {
            CloudRuntimeApplicator applicator = new CloudRuntimeApplicator
            {
                Runtime    = cloudRuntime,
                Package    = cloudRuntimePackage,
                WorkerRole = role
            };

            return(applicator);
        }
示例#11
0
        public virtual void ApplyRuntime(CloudRuntimePackage package, WorkerRole workerRole)
        {
            Dictionary<string, string> changes;
            if (this.GetChanges(package, out changes))
            {
                ApplyRoleXmlChanges(changes, workerRole);
            }

            ApplyScaffoldingChanges(package);
        }
示例#12
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
     JavaScriptPackageHelpers.EnsurePackageJsonExists(this.FilePath, this.RoleName);
     JavaScriptPackageHelpers.TrySetEngineVersion(this.FilePath, GetEngineKey(), package.Version);
 }
示例#13
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     // here is where we would put in semver semantics
     return(string.Equals(this.Version, runtime.Version, StringComparison.OrdinalIgnoreCase));
 }
示例#14
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return this.Version.Equals(runtime.Version, StringComparison.OrdinalIgnoreCase);
 }
示例#15
0
 protected virtual bool GetChanges(CloudRuntimePackage package, out Dictionary<string, string> changes)
 {
     changes = new Dictionary<string, string>();
     changes[Resources.RuntimeTypeKey] = package.Runtime.ToString().ToLower();
     changes[Resources.RuntimeUrlKey] = package.PackageUri.ToString();
     return true;
 }
示例#16
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return(string.Format(Resources.CacheVersionWarningText, package.Version, this.RoleName,
                          this.Version));
 }
示例#17
0
 protected virtual void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
示例#18
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return(this.Version.Equals(runtime.Version, StringComparison.OrdinalIgnoreCase));
 }
示例#19
0
 public abstract bool Match(CloudRuntimePackage runtime);
示例#20
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
     JavaScriptPackageHelpers.EnsurePackageJsonExists(this.FilePath, this.RoleName);
     JavaScriptPackageHelpers.TrySetEngineVersion(this.FilePath, GetEngineKey(), package.Version);
 }
示例#21
0
        public virtual bool ValidateMatch(CloudRuntimePackage runtime, out string warningText)
        {
            warningText = null;
            bool result = this.Match(runtime);
            if (!result)
            {
                warningText = this.GenerateWarningText(runtime);
            }

            return result;
        }
示例#22
0
            protected override bool GetChanges(CloudRuntimePackage package, out Dictionary<string, string> changes)
            {
                base.GetChanges(package, out changes);

                Debug.Assert(changes.ContainsKey(Resources.RuntimeTypeKey), "Cache runtime should be added before calling this method");
                Debug.Assert(changes.ContainsKey(Resources.RuntimeUrlKey), "Cache runtime should be added before calling this method");

                changes[Resources.CacheRuntimeVersionKey] = package.Version;

                return true;
            }
示例#23
0
 protected abstract string GenerateWarningText(CloudRuntimePackage package);
示例#24
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return true;
 }
示例#25
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     // here is where we would put in semver semantics
     return string.Equals(this.Version, runtime.Version, StringComparison.OrdinalIgnoreCase);
 }
示例#26
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary<string, string> changes)
 {
     changes = null;
     return false;
 }
示例#27
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary<string, string> changes)
 {
     bool succeed = base.GetChanges(package, out changes);
     changes[Resources.RuntimeVersionPrimaryKey] = package.Version;
     return succeed;
 }
示例#28
0
 protected abstract string GenerateWarningText(CloudRuntimePackage package);
示例#29
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return string.Format(Resources.CacheVersionWarningText, package.Version, this.RoleName,
         this.Version);
 }
示例#30
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return(true);
 }
示例#31
0
            protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
            {
                string rootPath = GeneralUtilities.GetServiceRootPath(FilePath);

                if (CloudServiceProject.Components.StartupTaskExists(RoleName, Resources.CacheStartupCommand))
                {
                    CloudServiceProject.Components.SetStartupTaskVariable(
                        RoleName,
                        Resources.CacheRuntimeUrl,
                        package.PackageUri.ToString(),
                        Resources.CacheStartupCommand);
                }
                else
                {
                    Variable emulated = new Variable
                    {
                        name = Resources.EmulatedKey,
                        RoleInstanceValue = new RoleInstanceValueElement
                        {
                            xpath = "/RoleEnvironment/Deployment/@emulated"
                        }
                    };
                    Variable cacheRuntimeUrl = new Variable
                    {
                        name = Resources.CacheRuntimeUrl,
                        value = package.PackageUri.ToString()
                    };

                    CloudServiceProject.Components.AddStartupTask(
                        RoleName,
                        Resources.CacheStartupCommand,
                        ExecutionContext.elevated,
                        emulated,
                        cacheRuntimeUrl);
                }
            }
示例#32
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return(null);
 }
示例#33
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return null;
 }
示例#34
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary <string, string> changes)
 {
     changes = null;
     return(false);
 }
示例#35
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
示例#36
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }