Search in sources :

Example 16 with Deployer

use of org.craftercms.studio.api.v2.deployment.Deployer in project studio by craftercms.

the class SiteServiceImpl method deleteSite.

@Override
@ValidateParams
public boolean deleteSite(@ValidateStringParam(name = "siteId") String siteId) {
    boolean success = true;
    logger.debug("Deleting site:" + siteId);
    try {
        enablePublishing(siteId, false);
    } catch (SiteNotFoundException e) {
        success = false;
        logger.error("Failed to stop publishing for site:" + siteId, e);
    }
    try {
        logger.debug("Deleting Deployer targets");
        deployer.deleteTargets(siteId);
    } catch (Exception e) {
        success = false;
        logger.error("Failed to delete the Deployer target for sites:" + siteId, e);
    }
    try {
        success = success && destroySitePreviewContext(siteId);
    } catch (Exception e) {
        success = false;
        logger.error("Failed to destroy the preview context for site:" + siteId, e);
    }
    try {
        logger.debug("Deleting repo");
        contentRepository.deleteSite(siteId);
    } catch (Exception e) {
        success = false;
        logger.error("Failed to delete the repository for site:" + siteId, e);
    }
    try {
        // delete database records
        logger.debug("Deleting database records");
        SiteFeed siteFeed = getSite(siteId);
        siteFeedMapper.deleteSite(siteId);
        dependencyService.deleteSiteDependencies(siteId);
        deploymentService.deleteDeploymentDataForSite(siteId);
        objectStateService.deleteObjectStatesForSite(siteId);
        objectMetadataManager.deleteObjectMetadataForSite(siteId);
        dmPageNavigationOrderService.deleteSequencesForSite(siteId);
        contentRepository.deleteGitLogForSite(siteId);
        contentRepository.removeRemoteRepositoriesForSite(siteId);
        auditServiceInternal.deleteAuditLogForSite(siteFeed.getId());
        insertDeleteSiteAuditLog(siteId, siteFeed.getName());
    } catch (Exception e) {
        success = false;
        logger.error("Failed to delete the database for site:" + siteId, e);
    }
    return success;
}
Also used : SiteFeed(org.craftercms.studio.api.v1.dal.SiteFeed) SiteNotFoundException(org.craftercms.studio.api.v1.exception.SiteNotFoundException) SiteConfigNotFoundException(org.craftercms.studio.api.v1.service.site.SiteConfigNotFoundException) ServiceLayerException(org.craftercms.studio.api.v1.exception.ServiceLayerException) SiteCreationException(org.craftercms.studio.api.v1.exception.SiteCreationException) MissingPluginParameterException(org.craftercms.studio.api.v2.exception.MissingPluginParameterException) IOException(java.io.IOException) RemoteRepositoryNotFoundException(org.craftercms.studio.api.v1.exception.repository.RemoteRepositoryNotFoundException) UserNotFoundException(org.craftercms.studio.api.v1.exception.security.UserNotFoundException) InvalidRemoteUrlException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteUrlException) DeployerTargetException(org.craftercms.studio.api.v1.exception.DeployerTargetException) RestServiceException(org.craftercms.commons.rest.RestServiceException) SiteAlreadyExistsException(org.craftercms.studio.api.v1.exception.SiteAlreadyExistsException) GroupAlreadyExistsException(org.craftercms.studio.api.v1.exception.security.GroupAlreadyExistsException) DocumentException(org.dom4j.DocumentException) EntitlementException(org.craftercms.commons.entitlements.exception.EntitlementException) BlueprintNotFoundException(org.craftercms.studio.api.v1.exception.BlueprintNotFoundException) SiteNotFoundException(org.craftercms.studio.api.v1.exception.SiteNotFoundException) CryptoException(org.craftercms.commons.crypto.CryptoException) RemoteRepositoryNotBareException(org.craftercms.studio.api.v1.exception.repository.RemoteRepositoryNotBareException) InvalidRemoteRepositoryCredentialsException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryCredentialsException) InvalidRemoteRepositoryException(org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryException) ValidateParams(org.craftercms.commons.validation.annotations.param.ValidateParams)

Aggregations

Deployer (org.apache.axis2.deployment.Deployer)12 DeploymentException (org.apache.axis2.deployment.DeploymentException)11 Artifact (org.wso2.carbon.application.deployer.config.Artifact)10 CappFile (org.wso2.carbon.application.deployer.config.CappFile)10 File (java.io.File)9 DeploymentFileData (org.apache.axis2.deployment.repository.util.DeploymentFileData)7 IOException (java.io.IOException)6 LibraryArtifactDeployer (org.apache.synapse.deployers.LibraryArtifactDeployer)6 AbstractSynapseArtifactDeployer (org.apache.synapse.deployers.AbstractSynapseArtifactDeployer)5 CryptoException (org.craftercms.commons.crypto.CryptoException)4 EntitlementException (org.craftercms.commons.entitlements.exception.EntitlementException)4 RestServiceException (org.craftercms.commons.rest.RestServiceException)4 SiteFeed (org.craftercms.studio.api.v1.dal.SiteFeed)4 BlueprintNotFoundException (org.craftercms.studio.api.v1.exception.BlueprintNotFoundException)4 DeployerTargetException (org.craftercms.studio.api.v1.exception.DeployerTargetException)4 ServiceLayerException (org.craftercms.studio.api.v1.exception.ServiceLayerException)4 SiteAlreadyExistsException (org.craftercms.studio.api.v1.exception.SiteAlreadyExistsException)4 SiteCreationException (org.craftercms.studio.api.v1.exception.SiteCreationException)4 SiteNotFoundException (org.craftercms.studio.api.v1.exception.SiteNotFoundException)4 InvalidRemoteRepositoryCredentialsException (org.craftercms.studio.api.v1.exception.repository.InvalidRemoteRepositoryCredentialsException)4