Example #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);
            }
Example #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);
 }
Example #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);
            }
Example #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;
        }
Example #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);
        }
Example #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);
                }
            }
Example #8
0
        protected virtual void ApplyScaffoldingChanges(CloudRuntimePackage package)
        {

        }
Example #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);
        }
Example #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);
        }
Example #12
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
     JavaScriptPackageHelpers.EnsurePackageJsonExists(this.FilePath, this.RoleName);
     JavaScriptPackageHelpers.TrySetEngineVersion(this.FilePath, GetEngineKey(), package.Version);
 }
Example #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));
 }
Example #14
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return this.Version.Equals(runtime.Version, StringComparison.OrdinalIgnoreCase);
 }
Example #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;
 }
Example #16
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return(string.Format(Resources.CacheVersionWarningText, package.Version, this.RoleName,
                          this.Version));
 }
Example #17
0
 protected virtual void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
Example #18
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return(this.Version.Equals(runtime.Version, StringComparison.OrdinalIgnoreCase));
 }
Example #19
0
 public abstract bool Match(CloudRuntimePackage runtime);
Example #20
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
     JavaScriptPackageHelpers.EnsurePackageJsonExists(this.FilePath, this.RoleName);
     JavaScriptPackageHelpers.TrySetEngineVersion(this.FilePath, GetEngineKey(), package.Version);
 }
Example #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;
        }
Example #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;
            }
Example #23
0
 protected abstract string GenerateWarningText(CloudRuntimePackage package);
Example #24
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return true;
 }
Example #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);
 }
Example #26
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary<string, string> changes)
 {
     changes = null;
     return false;
 }
Example #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;
 }
Example #28
0
 protected abstract string GenerateWarningText(CloudRuntimePackage package);
Example #29
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return string.Format(Resources.CacheVersionWarningText, package.Version, this.RoleName,
         this.Version);
 }
Example #30
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return(true);
 }
Example #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);
                }
            }
Example #32
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return(null);
 }
Example #33
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return null;
 }
Example #34
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary <string, string> changes)
 {
     changes = null;
     return(false);
 }
Example #35
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
Example #36
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }