@Override public void deleteBundleDeployment(Subject subject, int bundleDeploymentId) throws Exception { BundleDeployment doomed = this.entityManager.find(BundleDeployment.class, bundleDeploymentId); if (null == doomed) { return; } checkDeployBundleAuthz(subject, doomed.getBundleVersion().getBundle().getId(), doomed.getDestination() .getGroup().getId()); // only allow deployments to be deleted if they are not started or finished if (BundleDeploymentStatus.PENDING == doomed.getStatus() || BundleDeploymentStatus.SUCCESS == doomed.getStatus() || BundleDeploymentStatus.FAILURE == doomed.getStatus() || BundleDeploymentStatus.MIXED == doomed.getStatus()) { // change the pointer like in the linked list (ie. when removing B from A -> B -> C, it should result // in following situation: A -> C) Query q = entityManager.createNamedQuery(BundleDeployment.QUERY_UPDATE_FOR_DEPLOYMENT_REMOVE); q.setParameter("bundleId", doomed.getId()); q.executeUpdate(); entityManager.flush(); entityManager.remove(doomed); } else { throw new IllegalArgumentException("Can not delete deployment with status [" + doomed.getStatus() + "]"); } }
deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]"; } else { String liveVersion = liveDeployment.getBundleVersion().getVersion(); if (liveVersion.equals(version)) {
BundleVersion bundleVersion = bundleDeployment.getBundleVersion();
BundleType bundleType = bundleDeployment.getBundleVersion().getBundle().getBundleType(); ResourceType resourceType = bundleType.getResourceType(); Set<Resource> resources = inventoryManager.getResourcesWithType(resourceType);
checkDeployBundleAuthz(subject, liveDeployment.getBundleVersion().getBundle().getId(), liveDeployment .getDestination().getGroup().getId()); .deepCopy(false); BundleDeployment revertDeployment = bundleManager.createBundleDeploymentInNewTrans(subject, prevDeployment .getBundleVersion().getId(), bundleDestinationId, name, desc, config);
checkDeployBundleAuthz(subject, newDeployment.getBundleVersion().getBundle().getId(), group.getId());
checkDeployBundleAuthz(subject, liveDeployment.getBundleVersion().getBundle().getId(), liveDeployment .getDestination().getGroup().getId()); bvc.addFilterId(liveDeployment.getBundleVersion().getId()); bvc.fetchBundle(true); // will eagerly fetch the bundle type PageList<BundleVersion> bvs = bundleManager.findBundleVersionsByCriteria(subject, bvc); rtc.addFilterBundleTypeId(liveDeployment.getBundleVersion().getBundle().getBundleType().getId()); PageList<ResourceType> rts = resourceTypeManager.findResourceTypesByCriteria(subject, rtc); liveDeployment.getBundleVersion().getBundle().getBundleType().setResourceType(rts.get(0));
+ bundleDeployment.getBundleVersion().getId()); bundleFilesDir.mkdirs();
BundleType bundleType = bundleDeployment.getBundleVersion().getBundle().getBundleType(); ResourceType resourceType = bundleType.getResourceType(); Set<Resource> resources = inventoryManager.getResourcesWithType(resourceType);
bundle.getBundleType().setResourceType(resourceType); deployment.getBundleVersion().setBundle(bundle); deployment.getDestination().setBundle(bundle);