Ejemplo n.º 1
0
		public StringResultObject InstallGalleryApplication(string webAppId, List<DeploymentParameter> updatedValues)
		{
			StringResultObject result = new StringResultObject();

			try
			{
				WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
				//
				string applicationPath = module.InstallApplication(webAppId, updatedValues);
				//
				if (!String.IsNullOrEmpty(applicationPath))
				{
					result.Value = applicationPath;
					result.IsSuccess = true;
				}
			}
			catch (Exception ex)
			{
				result.IsSuccess = false;
				result.AddError(GalleryErrors.PackageInstallationError, ex);
			}
			//
			return result;
		}
Ejemplo n.º 2
0
        public override StringResultObject SetZooEnvironmentVariable(string siteId, string appName, string envName, string envValue)
        {
            StringResultObject result = new StringResultObject();

            try
            {
                using (ServerManager srvman = webObjectsSvc.GetServerManager())
                {
                    webObjectsSvc.SetZooEnvironmentVariable(srvman, siteId, appName, envName, envValue);
                }

                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.AddError("Exception", e);
            }

            return result;
        }
Ejemplo n.º 3
0
        public void InstallApplication(
            int UserId,
            string webAppId,
            List <DeploymentParameter> updatedParameters,
            string languageId,
            ref StringResultObject result)
        {
            WpiHelper wpi = GetWpiHelper(UserId);

            // convert list of DeploymentParameter to list of WpiUpdatedDeploymentParameter
            List <WpiUpdatedDeploymentParameter> updatedWpiParameters = new List <WpiUpdatedDeploymentParameter>();

            foreach (DeploymentParameter updatedParameter in updatedParameters)
            {
                updatedWpiParameters.Add(
                    new WpiUpdatedDeploymentParameter
                {
                    Name          = updatedParameter.Name,
                    Value         = updatedParameter.Value,
                    WellKnownTags = (DeploymentWellKnownTag)updatedParameter.WellKnownTags
                }
                    );
            }

            Log.WriteStart("Application installation starting");
            string log;
            string failedMessage;
            bool   success = wpi.InstallApplication(
                webAppId,
                updatedWpiParameters,
                languageId,
                InstallStatusUpdatedHandler, InstallCompleteHandler,
                out log,
                out failedMessage);

            result.Value     = log;
            result.IsSuccess = success;

            // add log files to result value
            try
            {
                StringBuilder sb        = new StringBuilder();
                string[]      filePaths = Directory.GetFiles(wpi.GetLogFileDirectory());
                foreach (string filePath in filePaths)
                {
                    using (StreamReader streamReader = new StreamReader(filePath))
                    {
                        string fileContent =
                            SecurityElement.Escape(StringUtils.CleanupASCIIControlCharacters(streamReader.ReadToEnd()));
                        sb.AppendLine().AppendLine(filePath).AppendLine(fileContent);
                    }
                }

                result.Value += sb.ToString();
            }
            catch (Exception)
            {
            }


            if (!success)
            {
                result.AddError(failedMessage, null);
            }

            // don`t reuse wpi helper after installation
            DeleteWpiHelper(UserId);
        }
Ejemplo n.º 4
0
        public override StringResultObject SetZooConsoleEnabled(string siteId, string appName)
        {
            StringResultObject result = new StringResultObject();

            try
            {
                using (ServerManager srvman = webObjectsSvc.GetServerManager())
                {
                    webObjectsSvc.SetZooConsoleEnabled(srvman, siteId, appName);
                }

                result.IsSuccess = true;
            }
            catch (Exception e)
            {
                result.AddError("Exception", e);
            }

            return result;
        }