private void abortIfApplicationAlreadyDeployed(ResourceType resourceType, File archiveFile) throws Exception {
String archiveFileName = archiveFile.getName();
KnownDeploymentTypes deploymentType = ConversionUtils.getDeploymentType(resourceType);
String deploymentTypeString = deploymentType.getType();
ManagementView managementView = profileServiceConnection.getManagementView();
managementView.load();
Set<ManagedDeployment> managedDeployments = managementView.getDeploymentsForType(deploymentTypeString);
for (ManagedDeployment managedDeployment : managedDeployments) {
if (managedDeployment.getSimpleName().equals(archiveFileName))
throw new IllegalArgumentException("An application named '" + archiveFileName
+ "' is already deployed.");