[jbosstools-commits] JBoss Tools SVN: r35376 - branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Oct 5 12:37:27 EDT 2011


Author: koen.aers at jboss.com
Date: 2011-10-05 12:37:27 -0400 (Wed, 05 Oct 2011)
New Revision: 35376

Modified:
   branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
   branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
Log:
JBIDE-9750

Modified: branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
===================================================================
--- branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java	2011-10-05 16:35:04 UTC (rev 35375)
+++ branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java	2011-10-05 16:37:27 UTC (rev 35376)
@@ -331,6 +331,9 @@
 		serverNameText.removeModifyListener(serverNameTextListener);
 		serverPortText.removeModifyListener(serverPortTextListener);
 		serverDeployerText.removeModifyListener(serverDeployerTextListener);		
+		useCredentialsButton.removeSelectionListener(useCredentialsButtonSelectionListener);
+		userNameText.removeModifyListener(userNameTextListener);
+		passwordText.removeModifyListener(passwordTextListener);
 	}
 	
 	private void updateControls() {
@@ -454,15 +457,30 @@
 		serverPortText.addModifyListener(serverPortTextListener);
 		serverDeployerText.addModifyListener(serverDeployerTextListener);
 		useCredentialsButton.addSelectionListener(useCredentialsButtonSelectionListener);
+		userNameText.addModifyListener(userNameTextListener);
+		passwordText.addModifyListener(passwordTextListener);
 	}
 	
 	private SelectionListener useCredentialsButtonSelectionListener = new SelectionAdapter() {		
 		public void widgetSelected(SelectionEvent event) {
 			userNameText.setEnabled(useCredentialsButton.getSelection());
 			passwordText.setEnabled(useCredentialsButton.getSelection());
+			deploymentInfo.setUseCredentials(useCredentialsButton.getSelection());
 		}
 	};
 		
+	private ModifyListener userNameTextListener = new ModifyListener() {		
+		public void modifyText(ModifyEvent event) {
+			deploymentInfo.setUserName(userNameText.getText());
+		}
+	};
+	
+	private ModifyListener passwordTextListener = new ModifyListener() {		
+		public void modifyText(ModifyEvent event) {
+			deploymentInfo.setPassword(passwordText.getText());
+		}
+	};
+	
 	private ModifyListener serverNameTextListener = new ModifyListener() {		
 		public void modifyText(ModifyEvent event) {
 			deploymentInfo.setServerName(serverNameText.getText());

Modified: branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java
===================================================================
--- branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java	2011-10-05 16:35:04 UTC (rev 35375)
+++ branches/jbosstools-3.2.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/ProcessArchiveDeployer.java	2011-10-05 16:37:27 UTC (rev 35376)
@@ -13,6 +13,7 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.SWT;
 import org.jbpm.gd.common.util.Base64Converter;
+import org.jbpm.gd.jpdl.Logger;
 import org.jbpm.gd.jpdl.editor.JpdlEditor;
 
 public class ProcessArchiveDeployer {
@@ -44,7 +45,7 @@
 		if (url == null) return false;
 		URLConnection connection = openConnection(url);
 		if (connection == null) return false;
-		connection.setDoOutput(true);
+		prepareConnection(connection);
 		String response = receiveData(connection);
 		if (response == null) {
 			return false;
@@ -146,8 +147,14 @@
 			showFileNotFoundException();
 			return null;
 		} catch (IOException e) {
-			showReceiveDataException();
-			return null;
+			if (e.getMessage().contains("401")) {
+				showNotAuthorizedException();
+				return null;
+			} else {
+				Logger.logError("Unexpected IOException", e);
+				showReceiveDataException();
+				return null;
+			}
 		}
 		
 	}
@@ -177,6 +184,18 @@
 		dialog.open();
 	}
 
+	private void showNotAuthorizedException() {
+		MessageDialog dialog = new MessageDialog(
+				jpdlEditor.getSite().getShell(), 
+				"Authorization Failed", 
+				null,
+				"The used credentials are not allowed to establish a connection to the server.",
+				SWT.ICON_ERROR, 
+				new String[] { "OK" }, 
+				0);
+		dialog.open();
+	}
+
 	private void showFileNotFoundException() {
 		MessageDialog dialog = new MessageDialog(
 				jpdlEditor.getSite().getShell(), 



More information about the jbosstools-commits mailing list