@SuppressWarnings("unchecked") protected void updateStoppedDeploymentTypes(ProfileDeployment deployment, ManagedDeployment md) { String deploymentName = deployment.getName(); // Try to get the cached deployment type Collection<String> deploymentTypes = deployment .getTransientAttachments().getAttachment(DEPLOYMENT_TYPES, Collection.class); if(deploymentTypes != null) { md.setTypes(new HashSet<String>(deploymentTypes)); } else { int i = deploymentName.lastIndexOf("."); if(i != -1 && (i + 1) < deploymentName.length()) { String guessedType = deploymentName.substring(i + 1, deploymentName.length()); if(guessedType.endsWith("/")) guessedType = guessedType.substring(0, guessedType.length() -1 ); md.setTypes(new HashSet<String>(1)); md.addType(guessedType); } } }
String transientURL = d.getTransientAttachments().getAttachment(TRANSIENT_DEPLOYMENT_URL_KEY, String.class); if(transientURL != null && transientURL.equals(name))
if(md.getTypes() != null && md.getTypes().isEmpty() == false) if(deployment.getTransientAttachments().hasAttachment(DEPLOYMENT_TYPES) == false) deployment.getTransientAttachments().putAttachment(DEPLOYMENT_TYPES, md.getTypes());
protected boolean doPrepare(ProfileModificationResponse response) { try { final String name = getDeploymentName(); final URL url = getDeploymentID().getContentURL(); if(url == null) { return false; } // final VirtualFile vf = VFS.getChild(url); // Create the deployment directly final ProfileDeployment deployment = deploymentFactory.createDeployment(vf, new TransientDeploymentMetaData(name)); deployment.getDeploymentInfo().setFlag(ProfileDeploymentFlag.LOCKED); // Attach original deployment url for resolving deployment names deployment.getTransientAttachments().putAttachment(TransientProfileActivator.TRANSIENT_DEPLOYMENT_URL_KEY, url.toExternalForm()); getProfile().addDeployment(deployment); // Notify response.fireModificationEvent(ProfileModificationEvent.create(ProfileModificationType.ADD, getProfile().getKey())); } catch(Exception e) { response.setFailure(e); return false; } return true; }