Esempio n. 1
0
        private UndeploymentResult UndeployRemoveInternal(String deploymentId, UndeploymentOptions options)
        {
            using (_iLock.Acquire())
            {
                var info = _deploymentStateService.GetDeployment(deploymentId);
                if (info == null)
                {
                    throw new DeploymentNotFoundException("Deployment by id '" + deploymentId + "' could not be found");
                }

                UndeploymentResult result = info.State == DeploymentState.DEPLOYED
                    ? UndeployRemoveInternal(info, options)
                    : new UndeploymentResult(deploymentId, Collections.GetEmptyList <DeploymentInformationItem>());
                _deploymentStateService.Remove(deploymentId);
                return(result);
            }
        }
Esempio n. 2
0
        private UndeploymentResult UndeployInternalLockTaken(
            string deploymentId,
            UndeploymentOptions undeploymentOptions)
        {
            DeploymentInformation info = _deploymentStateService.GetDeployment(deploymentId);

            if (info == null)
            {
                throw new DeploymentNotFoundException("Deployment by id '" + deploymentId + "' could not be found");
            }
            if (info.State == DeploymentState.UNDEPLOYED)
            {
                throw new DeploymentStateException(
                          "Deployment by id '" + deploymentId + "' is already in undeployed state");
            }

            UndeploymentResult result = UndeployRemoveInternal(info, undeploymentOptions);
            var updated = new DeploymentInformation(
                deploymentId, info.Module, info.AddedDate, DateTimeEx.GetInstance(_timeZone),
                new DeploymentInformationItem[0], DeploymentState.UNDEPLOYED);

            _deploymentStateService.AddUpdateDeployment(updated);
            return(result);
        }