Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 486295
Collapse All | Expand All

(-)src/org/eclipse/cft/server/ui/internal/wizards/CloudFoundryApplicationWizardPage.java (-25 / +28 lines)
Lines 29-35 Link Here
29
import java.util.regex.Pattern;
29
import java.util.regex.Pattern;
30
30
31
import org.eclipse.cft.server.core.ApplicationDeploymentInfo;
31
import org.eclipse.cft.server.core.ApplicationDeploymentInfo;
32
import org.eclipse.cft.server.core.internal.ApplicationUrlLookupService;
33
import org.eclipse.cft.server.core.internal.CloudApplicationURL;
32
import org.eclipse.cft.server.core.internal.CloudApplicationURL;
34
import org.eclipse.cft.server.core.internal.CloudFoundryPlugin;
33
import org.eclipse.cft.server.core.internal.CloudFoundryPlugin;
35
import org.eclipse.cft.server.core.internal.CloudFoundryServer;
34
import org.eclipse.cft.server.core.internal.CloudFoundryServer;
Lines 40-50 Link Here
40
import org.eclipse.cft.server.core.internal.client.CloudFoundryApplicationModule;
39
import org.eclipse.cft.server.core.internal.client.CloudFoundryApplicationModule;
41
import org.eclipse.cft.server.ui.internal.CloudFoundryImages;
40
import org.eclipse.cft.server.ui.internal.CloudFoundryImages;
42
import org.eclipse.cft.server.ui.internal.CloudUiUtil;
41
import org.eclipse.cft.server.ui.internal.CloudUiUtil;
42
import org.eclipse.cft.server.ui.internal.CloudUiUtil.UniqueSubdomain;
43
import org.eclipse.cft.server.ui.internal.Messages;
43
import org.eclipse.cft.server.ui.internal.Messages;
44
import org.eclipse.cft.server.ui.internal.PartChangeEvent;
44
import org.eclipse.cft.server.ui.internal.PartChangeEvent;
45
import org.eclipse.cft.server.ui.internal.UIPart;
45
import org.eclipse.cft.server.ui.internal.UIPart;
46
import org.eclipse.cft.server.ui.internal.WizardPartChangeEvent;
46
import org.eclipse.cft.server.ui.internal.WizardPartChangeEvent;
47
import org.eclipse.cft.server.ui.internal.CloudUiUtil.UniqueSubdomain;
48
import org.eclipse.core.runtime.IStatus;
47
import org.eclipse.core.runtime.IStatus;
49
import org.eclipse.core.runtime.Status;
48
import org.eclipse.core.runtime.Status;
50
import org.eclipse.jface.resource.ImageDescriptor;
49
import org.eclipse.jface.resource.ImageDescriptor;
Lines 332-361 Link Here
332
		
331
		
333
		if (workingCopy != null) {
332
		if (workingCopy != null) {
334
			CloudApplicationURL cloudUrl = null;
333
			CloudApplicationURL cloudUrl = null;
335
			// if there is a valid manifest, we need to check if the saved host and domain is already used
334
336
			if (hasManifest) {
335
			if (hasManifest) {
337
				List<String> urls = workingCopy.getUris();
336
				
338
			    String url = urls != null && !urls.isEmpty() ? urls.get(0) : null;
337
				// If we have a manifest, the validation of the host name should be performed on the deploy wizard page rather than the application wizard page. 
339
			    if (url != null) {
338
				// This is because the application deployment name may vary independently from the application host name. - Bug 486295
340
			    	try {
339
				
341
				    	ApplicationUrlLookupService urllookup = ApplicationUrlLookupService.getCurrentLookup(server);
340
//				List<String> urls = workingCopy.getUris();
342
				    	CloudApplicationURL appUrl = urllookup.getCloudApplicationURL(url);
341
//			    String url = urls != null && !urls.isEmpty() ? urls.get(0) : null;
343
					
342
//			    if (url != null) {
344
				    	// Message saying that the host name from the manifest is already taken. 
343
//			    	try {
345
				    	String customMessage = Messages.bind(Messages.CloudFoundryApplicationWizardPage_ERROR_INITIAL_HOSTNAME_TAKEN, appUrl.getSubdomain(), appUrl.getDomain());
344
//				    	ApplicationUrlLookupService urllookup = ApplicationUrlLookupService.getCurrentLookup(server);
346
				    	// 	Validate it and get the status
345
//				    	CloudApplicationURL appUrl = urllookup.getCloudApplicationURL(url);
347
				    	
346
//					
348
				    	HostnameValidationResult vr = CloudUiUtil.validateHostname(appUrl, server, getContainer(), customMessage);
347
//				    	// Message saying that the host name from the manifest is already taken. 
349
				    	status = vr.getStatus();
348
//				    	String customMessage = Messages.bind(Messages.CloudFoundryApplicationWizardPage_ERROR_INITIAL_HOSTNAME_TAKEN, appUrl.getSubdomain(), appUrl.getDomain());
350
					
349
//				    	// 	Validate it and get the status
351
				    	if (status != null && status.isOK()) {
350
//				    	
352
				    		cloudUrl = appUrl;
351
//				    	HostnameValidationResult vr = CloudUiUtil.validateHostname(appUrl, server, getContainer(), customMessage);
353
				    	}
352
//				    	status = vr.getStatus();
354
			    	} catch (Throwable ce) {
353
//					
355
	
354
//				    	if (status != null && status.isOK()) {
356
						CloudFoundryPlugin.logError(ce);
355
//				    		cloudUrl = appUrl;
357
					}
356
//				    	}
358
			    }
357
//			    	} catch (Throwable ce) {
358
//	
359
//						CloudFoundryPlugin.logError(ce);
360
//					}
361
//			    }
359
			} else {
362
			} else {
360
				// IFF there is no manifest, then we will do the hostname validation AND suggest a new unique name
363
				// IFF there is no manifest, then we will do the hostname validation AND suggest a new unique name
361
				List<String> urls = workingCopy.getUris();
364
				List<String> urls = workingCopy.getUris();

Return to bug 486295