Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
            }
Exemplo n.º 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);
            }
        /// <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;
        }
Exemplo n.º 5
0
        public virtual void ApplyRuntime(CloudRuntimePackage package, WorkerRole workerRole)
        {
            Dictionary <string, string> changes;

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

            ApplyScaffoldingChanges(package);
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
            protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
            {
                string rootPath = General.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);
                }
            }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return(string.Format(Resources.CacheVersionWarningText, package.Version, this.RoleName,
                          this.Version));
 }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
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));
 }
Exemplo n.º 12
0
 protected abstract string GenerateWarningText(CloudRuntimePackage package);
Exemplo n.º 13
0
 public abstract bool Match(CloudRuntimePackage runtime);
Exemplo n.º 14
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
Exemplo n.º 15
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return this.Version.Equals(runtime.Version, StringComparison.OrdinalIgnoreCase);
 }
Exemplo n.º 16
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary<string, string> changes)
 {
     changes = null;
     return false;
 }
Exemplo n.º 17
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return null;
 }
Exemplo n.º 18
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return true;
 }
Exemplo n.º 19
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;
            }
Exemplo n.º 20
0
            protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
            {
                string rootPath = General.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);
                }
            }
Exemplo n.º 21
0
 protected virtual void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
Exemplo n.º 22
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return string.Format(Resources.PHPVersionWarningText, package.Version, this.RoleName,
         this.Version);
 }
Exemplo n.º 23
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;
 }
Exemplo n.º 24
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);
 }
Exemplo n.º 25
0
 protected virtual void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
Exemplo n.º 26
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return(true);
 }
Exemplo n.º 27
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
     JavaScriptPackageHelpers.EnsurePackageJsonExists(this.FilePath, this.RoleName);
     JavaScriptPackageHelpers.TrySetEngineVersion(this.FilePath, GetEngineKey(), package.Version);
 }
Exemplo n.º 28
0
 protected override bool GetChanges(CloudRuntimePackage package, out Dictionary <string, string> changes)
 {
     changes = null;
     return(false);
 }
Exemplo n.º 29
0
 public override bool Match(CloudRuntimePackage runtime)
 {
     return(this.Version.Equals(runtime.Version, StringComparison.OrdinalIgnoreCase));
 }
Exemplo n.º 30
0
 public abstract bool Match(CloudRuntimePackage runtime);
Exemplo n.º 31
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
     JavaScriptPackageHelpers.EnsurePackageJsonExists(this.FilePath, this.RoleName);
     JavaScriptPackageHelpers.TrySetEngineVersion(this.FilePath, GetEngineKey(), package.Version);
 }
Exemplo n.º 32
0
 protected abstract string GenerateWarningText(CloudRuntimePackage package);
Exemplo n.º 33
0
 protected override string GenerateWarningText(CloudRuntimePackage package)
 {
     return(null);
 }
Exemplo n.º 34
0
        /// <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);
        }
Exemplo n.º 35
0
 protected override void ApplyScaffoldingChanges(CloudRuntimePackage package)
 {
 }
Exemplo n.º 36
0
        public virtual void ApplyRuntime(CloudRuntimePackage package, WorkerRole workerRole)
        {
            Dictionary<string, string> changes;
            if (this.GetChanges(package, out changes))
            {
                ApplyRoleXmlChanges(changes, workerRole);
            }

            ApplyScaffoldingChanges(package);
        }