JBoss Tools SVN: r41606 - branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:52:11 -0400 (Thu, 31 May 2012)
New Revision: 41606
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
Log:
[JBIDE-11213] removed warning if OpenShift app-name matches project name in workspace
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-31 23:26:48 UTC (rev 41605)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-31 23:52:11 UTC (rev 41606)
@@ -25,8 +25,6 @@
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
import org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -847,18 +845,9 @@
return ValidationStatus.error(
"An application with the same name already exists on OpenShift.");
}
- if (isExistingProject(applicationName)) {
- return ValidationStatus
- .warning("A project already exists with the same application name. This can cause problems when importing.");
- }
return ValidationStatus.ok();
}
- private boolean isExistingProject(String name) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- return project.exists();
- }
-
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
12 years, 6 months
JBoss Tools SVN: r41605 - trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:26:48 -0400 (Thu, 31 May 2012)
New Revision: 41605
Added:
trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/SSHUserConfigTest.java
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftTestSuite.java
Log:
[JBIDE-12031] now allowing keys id_rsa or libra_id_rsa (depending on the user to have a <home>/.ssh/config with libra-keys or not)
Modified: trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftTestSuite.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftTestSuite.java 2012-05-31 23:24:34 UTC (rev 41604)
+++ trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftTestSuite.java 2012-05-31 23:26:48 UTC (rev 41605)
@@ -17,7 +17,8 @@
@RunWith(Suite.class)
@SuiteClasses({
OpenShiftMavenProfileTests.class,
- EmbedCartridgeStrategyTest.class
+ EmbedCartridgeStrategyTest.class,
+ SSHUserConfigTest.class
})
/**
Added: trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/SSHUserConfigTest.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/SSHUserConfigTest.java (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/SSHUserConfigTest.java 2012-05-31 23:26:48 UTC (rev 41605)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
+import org.junit.Test;
+
+import com.openshift.client.OpenShiftException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class SSHUserConfigTest {
+
+ @Test
+ public void shouldDetectIdentityFile() throws OpenShiftException, IOException {
+ String config =
+ "# comment\n" +
+ "Host *.redhat.com\n" +
+ " IdentityFile ~/.ssh/id_rsa_redhat\n" +
+ " VerifyHostKeyDNS yes\n" +
+ " StrictHostKeyChecking no\n" +
+ "\n" +
+ "# comment\n" +
+ "Host *.dev.rhcloud.com\n" +
+ " IdentityFile ~/.ssh/libra_id_rsa_dev\n" +
+ " VerifyHostKeyDNS yes\n" +
+ " StrictHostKeyChecking no\n" +
+ " UserKnownHostsFile ~/.ssh/libra_known_hosts\n";
+ SSHUserConfig sshUserConfig = getSSHUserConfig(config, createConfigFile(config));
+ assertEquals("~/.ssh/libra_id_rsa_dev", sshUserConfig.getLibraIdentityFile());
+ }
+
+ @Test
+ public void shouldNotDetectIdentityFile() throws OpenShiftException, IOException {
+ String config =
+ "# comment\n" +
+ "Host *.redhat.com\n" +
+ " IdentityFile ~/.ssh/id_rsa_redhat\n" +
+ " VerifyHostKeyDNS yes\n" +
+ " StrictHostKeyChecking no\n" +
+ "\n" +
+ "# comment\n" +
+ "Host *.jboss.org\n" +
+ " IdentityFile ~/.ssh/libra_id_rsa_dev\n" +
+ " VerifyHostKeyDNS yes\n" +
+ " StrictHostKeyChecking no\n" +
+ " UserKnownHostsFile ~/.ssh/libra_known_hosts\n";
+ SSHUserConfig sshUserConfig = getSSHUserConfig(config, createConfigFile(config));
+ assertNull(sshUserConfig.getLibraIdentityFile());
+ }
+
+ private SSHUserConfig getSSHUserConfig(String configFileContent, File sshConfigFile) throws FileNotFoundException {
+ return new SSHUserConfig(sshConfigFile);
+ }
+
+ private File createConfigFile(String configFileContent) throws FileNotFoundException {
+ final File configFile =
+ new File(FileUtils.getSystemTmpFolder(), String.valueOf(System.currentTimeMillis()));
+ FileUtils.writeTo(configFileContent, configFile);
+ return configFile;
+ }
+}
Property changes on: trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/SSHUserConfigTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 6 months
JBoss Tools SVN: r41604 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:24:34 -0400 (Thu, 31 May 2012)
New Revision: 41604
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
Log:
[JBIDE-11213] removed warning if OpenShift app-name matches project name in workspace
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-31 23:24:22 UTC (rev 41603)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-31 23:24:34 UTC (rev 41604)
@@ -25,8 +25,6 @@
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
import org.eclipse.core.databinding.validation.MultiValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -847,18 +845,9 @@
return ValidationStatus.error(
"An application with the same name already exists on OpenShift.");
}
- if (isExistingProject(applicationName)) {
- return ValidationStatus
- .warning("A project already exists with the same application name. This can cause problems when importing.");
- }
return ValidationStatus.ok();
}
- private boolean isExistingProject(String name) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- return project.exists();
- }
-
@Override
public IObservableList getTargets() {
WritableList targets = new WritableList();
12 years, 6 months
JBoss Tools SVN: r41603 - /.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-05-31 19:24:22 -0400 (Thu, 31 May 2012)
New Revision: 41603
Removed:
org.jboss.tools.hibernate.ui.bot.test/
Log:
delete ui.bot.test project from repo root
12 years, 6 months
JBoss Tools SVN: r41602 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:17:33 -0400 (Thu, 31 May 2012)
New Revision: 41602
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
Log:
[JBIDE-12031] now allowing keys id_rsa or libra_id_rsa (depending on the user to have a <home>/.ssh/config with libra-keys or not)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java 2012-05-31 23:16:19 UTC (rev 41601)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java 2012-05-31 23:17:33 UTC (rev 41602)
@@ -155,6 +155,7 @@
public static final void writeTo(String content, File destination) throws FileNotFoundException {
PrintWriter writer = new PrintWriter(destination);
+ writer.write(content);
writer.flush();
writer.close();
}
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java 2012-05-31 23:17:33 UTC (rev 41602)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.openshift.client.OpenShiftException;
+
+/**
+ * A class that parses the user ssh configuration and retrieves the
+ * <tt>IdentityFile</tt> setting from a <tt>Host</tt> block that is configuring
+ * the OpenShift application (<tt>rhcloud.com</tt>) PaaS.
+ *
+ * @author Andre Dietisheim
+ */
+public class SSHUserConfig {
+
+ private static final String VALUE_LIBRA_SSH_HOST = "rhcloud.com";
+ private static final String KEY_CONFIGBLOCK_HOST_START = "Host ";
+ private static final String KEY_CONFIGBLOCK_HOST_END = "\n";
+ private static final Pattern IDENTITYFILE_PATTERN = Pattern.compile(".+IdentityFile (.+)");
+ private static final String CONFIG_FILENAME = "config";
+ private File configFile;
+
+ public SSHUserConfig(String sshHome) {
+ this(new File(sshHome, CONFIG_FILENAME));
+ }
+
+ public SSHUserConfig(File configFile) {
+ this.configFile = configFile;
+ }
+
+ public boolean exists() {
+ return FileUtils.canRead(configFile);
+ }
+
+ public File getFile() {
+ return configFile;
+ }
+
+ public boolean hasLibraIdentifyFile() throws OpenShiftException {
+ return getLibraIdentityFile() != null;
+ }
+
+ public String getLibraIdentityFile() throws OpenShiftException {
+ if (!exists()) {
+ return null;
+ }
+
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(configFile));
+ for (String data = reader.readLine(); data != null; data = reader.readLine()) {
+ if (!data.startsWith(KEY_CONFIGBLOCK_HOST_START)
+ || !data.endsWith(VALUE_LIBRA_SSH_HOST)) {
+ continue;
+ }
+
+ for (data = reader.readLine(); data != null; reader.readLine()) {
+ if (data.equals(KEY_CONFIGBLOCK_HOST_END)) {
+ continue;
+ }
+
+ Matcher matcher = IDENTITYFILE_PATTERN.matcher(data);
+ if (!matcher.find()
+ || matcher.groupCount() < 1) {
+ continue;
+ }
+
+ return matcher.group(1);
+ }
+ }
+ return null;
+ } catch (IOException e) {
+ throw new OpenShiftException("Could not read file {0}", configFile);
+ } finally {
+ try {
+ if (reader != null) {
+ reader.close();
+ }
+ } catch (IOException e) {
+ // ignore THIS IS INTENTIONAL
+ }
+ }
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2012-05-31 23:16:19 UTC (rev 41601)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2012-05-31 23:17:33 UTC (rev 41602)
@@ -54,6 +54,7 @@
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import com.openshift.client.OpenShiftException;
@@ -123,7 +124,7 @@
}
Button browseButton = new Button(container, SWT.PUSH);
- browseButton.setText("Browse");
+ browseButton.setText("Browse...");
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseButton);
browseButton.addSelectionListener(onBrowse());
@@ -150,10 +151,10 @@
public void widgetSelected(SelectionEvent e) {
try {
- if (pageModel.libraPublicKeyExists()) {
+ if (pageModel.publicKeyExists()) {
MessageDialog.openInformation(getShell(),
"Libra Key already present",
- "You already have a key at \"" + pageModel.getLibraPublicKey() + "\". Please move it or use it.");
+ "You already have a key at \"" + pageModel.getPublicKey() + "\". Please move it or use it.");
return;
}
@@ -220,7 +221,7 @@
@Override
protected void setupWizardPageSupport(DataBindingContext dbc) {
- ParametrizableWizardPageSupport.create(IStatus.ERROR, this, dbc);
+ ParametrizableWizardPageSupport.create(IStatus.ERROR | IStatus.CANCEL, this, dbc);
}
private class SSHKeyValidator implements IValidator {
@@ -232,10 +233,14 @@
|| !FileUtils.canRead((String) value)) {
return ValidationStatus.error("You have to provide a valid ssh public key");
}
- if (!isKeyKnownToSsh((String) value)) {
+ if (pageModel.hasConfiguredFixedPrivateKeys()) {
return ValidationStatus.warning(
- NLS.bind("Could not find the private portion for your public key. "
- + "Make sure it is listed in the ssh2 preferences.", value));
+ NLS.bind("Your SSH config ({0}) contains fixed keys for OpenShift servers. " +
+ "This can override any Eclipse specific SSH key preferences.", new SSHUserConfig(pageModel.getSSH2Home()).getFile()));
+ } else if (!isKeyKnownToSsh((String) value)) {
+ return ValidationStatus.warning(
+ NLS.bind("Could not find the private portion for your public key in the preferences. "
+ + "Make sure it is listed in the ssh2 preferences.", value));
}
return ValidationStatus.ok();
}
@@ -244,14 +249,15 @@
if (StringUtils.isEmpty(publicKeyPath)) {
return false;
}
- for (String preferencesKey : SshPrivateKeysPreferences.getKeys()) {
+ for (String preferencesKey : pageModel.getPrivateKeysFromPreferences()) {
try {
File privateKey = SshPrivateKeysPreferences.getKeyFile(preferencesKey);
if (privateKey == null
|| !FileUtils.canRead(privateKey)) {
continue;
}
- if (publicKeyPath.startsWith(privateKey.getAbsolutePath() + ".")) {
+ if (publicKeyPath.startsWith(privateKey.getAbsolutePath() + ".")
+ || publicKeyPath.startsWith(privateKey.getPath() + ".")) {
return true;
}
} catch (FileNotFoundException e) {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-05-31 23:16:19 UTC (rev 41601)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-05-31 23:17:33 UTC (rev 41602)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
import com.openshift.client.IDomain;
import com.openshift.client.IOpenShiftSSHKey;
@@ -35,8 +36,10 @@
*/
public class NewDomainWizardPageModel extends ObservableUIPojo {
- public static final String LIBRA_KEY = "libra_id_rsa";
+ public static final String ID_RSA_FILENAME = "id_rsa";
+ public static final String LIBRA_ID_RSA_FILENAME = "libra_id_rsa";
private static final String PUBLIC_KEY_SUFFIX = ".pub";
+ private static final String KEYS_SEPARATOR = ",";
private static final String SSHKEY_DEFAULT_NAME = "jbosstools"; //$NON-NLS-1$
@@ -53,21 +56,22 @@
}
public void initSshKey() throws OpenShiftException {
- if (!libraPublicKeyExists()) {
+ if (!publicKeyExists()) {
return;
}
- File libraPublicKey = getLibraPublicKey();
+ File libraPublicKey = getPublicKey();
setSshKey(libraPublicKey.getAbsolutePath());
}
+
/**
* Returns the file of the libra public key. It is not checking if the file exists.
*
* @return the libra public key
* @throws OpenShiftException
*/
- public File getLibraPublicKey() throws OpenShiftException {
- File libraPrivateKey = getLibraPrivateKey();
+ public File getPublicKey() throws OpenShiftException {
+ File libraPrivateKey = getPrivateKey();
return new File(libraPrivateKey.getParent(), getPublicKeyPath(libraPrivateKey.getName()));
}
@@ -75,30 +79,39 @@
return privateKeyPath + PUBLIC_KEY_SUFFIX;
}
- public File getLibraPrivateKey() throws OpenShiftException {
- String ssh2Home = getSSH2Home();
- File ssh2HomeFile = new File(ssh2Home);
- if (!FileUtils.canRead(ssh2HomeFile)) {
- try {
- ssh2HomeFile.createNewFile();
- } catch(IOException e) {
- throw new OpenShiftException("Could not create ssh2 home directory at {0}", ssh2Home);
- }
+ public File getPrivateKey() throws OpenShiftException {
+ String ssh2Home = checkedGetSSH2Home();
+ ensureSSHHomeExists(ssh2Home);
+ if (hasConfiguredFixedPrivateKeys()) {
+ return new File(ssh2Home, LIBRA_ID_RSA_FILENAME);
+ } else {
+ return new File(ssh2Home, ID_RSA_FILENAME);
}
-
- return new File(ssh2Home, LIBRA_KEY);
}
- private String getSSH2Home() throws OpenShiftException {
- Preferences preferences = JSchCorePlugin.getPlugin().getPluginPreferences();
- String ssh2Home = preferences.getString(IConstants.KEY_SSH2HOME);
+ private String checkedGetSSH2Home() throws OpenShiftException {
+ String ssh2Home = getSSH2Home();
if (ssh2Home == null
|| ssh2Home.trim().length() == 0) {
throw new OpenShiftException("Could not determine your ssh2 home directory");
}
return ssh2Home;
}
+
+ public String getSSH2Home() {
+ return JSchCorePlugin.getPlugin().getPluginPreferences().getString(IConstants.KEY_SSH2HOME);
+ }
+ public boolean hasConfiguredFixedPrivateKeys() {
+ try {
+ SSHUserConfig sshUserConfig = new SSHUserConfig(checkedGetSSH2Home());
+ return sshUserConfig.hasLibraIdentifyFile();
+ } catch (OpenShiftException e) {
+ return false;
+ }
+ }
+
+
public String getDomainId() {
return this.domainId;
}
@@ -123,25 +136,25 @@
return sshKey;
}
- public boolean libraPublicKeyExists() throws OpenShiftException {
- return FileUtils.canRead(getLibraPublicKey());
+ public boolean publicKeyExists() throws OpenShiftException {
+ return FileUtils.canRead(getPublicKey());
}
public void createLibraKeyPair(String passPhrase) throws FileNotFoundException, OpenShiftException {
- File libraPublicKey = getLibraPublicKey();
+ File libraPublicKey = getPublicKey();
if (libraPublicKey.canRead()) {
// key already exists
return;
}
- createSSHHome(getSSH2Home());
- File libraPrivateKey = getLibraPrivateKey();
+ ensureSSHHomeExists(checkedGetSSH2Home());
+ File libraPrivateKey = getPrivateKey();
SSHKeyPair keyPair = SSHKeyPair.create(passPhrase, libraPrivateKey.getAbsolutePath(), libraPublicKey.getAbsolutePath());
setFilePermissions(libraPrivateKey);
addToPrivateKeysPreferences(keyPair);
setSshKey(keyPair.getPublicKeyPath());
}
- private void createSSHHome(String ssh2Home)
+ private void ensureSSHHomeExists(String ssh2Home)
throws OpenShiftException {
File ssh2HomeFile = new File(ssh2Home);
if (FileUtils.canRead(ssh2HomeFile)) {
@@ -171,6 +184,17 @@
file.setWritable(true, true);
}
+ public String[] getPrivateKeysFromPreferences() {
+ String privateKeys =
+ JSchCorePlugin.getPlugin().getPluginPreferences().getString(IConstants.KEY_PRIVATEKEY);
+ if (privateKeys != null
+ && privateKeys.trim().length() > 0) {
+ return privateKeys.split(KEYS_SEPARATOR);
+ } else {
+ return new String[0];
+ }
+ }
+
private void addToPrivateKeysPreferences(SSHKeyPair keyPair) {
Preferences preferences = JSchCorePlugin.getPlugin().getPluginPreferences();
String privateKeys = preferences.getString(IConstants.KEY_PRIVATEKEY);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2012-05-31 23:16:19 UTC (rev 41601)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2012-05-31 23:17:33 UTC (rev 41602)
@@ -10,34 +10,21 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
public class PassphraseDialog extends InputDialog {
public PassphraseDialog(Shell shell) {
super(shell
, "New ssh key"
- , "Please pick a passphrase for your new ssh key pair"
+ , "Please pick a passphrase for your new ssh key pair. A passphrase is recommended but not required."
, null
- , new PassphraseValidator());
+ , null);
}
protected int getInputTextStyle() {
return SWT.SINGLE | SWT.BORDER | SWT.PASSWORD;
}
-
- private static class PassphraseValidator implements IInputValidator {
-
- @Override
- public String isValid(String input) {
- if (StringUtils.isEmpty(input)) {
- return "You have to provide a pass phrase";
- }
- return null;
- }
- }
}
12 years, 6 months
JBoss Tools SVN: r41601 - in branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:16:19 -0400 (Thu, 31 May 2012)
New Revision: 41601
Added:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
Log:
[JBIDE-12031] now allowing keys id_rsa or libra_id_rsa (depending on the user to have a <home>/.ssh/config with libra-keys or not)
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java 2012-05-31 23:00:52 UTC (rev 41600)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/FileUtils.java 2012-05-31 23:16:19 UTC (rev 41601)
@@ -155,6 +155,7 @@
public static final void writeTo(String content, File destination) throws FileNotFoundException {
PrintWriter writer = new PrintWriter(destination);
+ writer.write(content);
writer.flush();
writer.close();
}
Added: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java (rev 0)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java 2012-05-31 23:16:19 UTC (rev 41601)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.openshift.client.OpenShiftException;
+
+/**
+ * A class that parses the user ssh configuration and retrieves the
+ * <tt>IdentityFile</tt> setting from a <tt>Host</tt> block that is configuring
+ * the OpenShift application (<tt>rhcloud.com</tt>) PaaS.
+ *
+ * @author Andre Dietisheim
+ */
+public class SSHUserConfig {
+
+ private static final String VALUE_LIBRA_SSH_HOST = "rhcloud.com";
+ private static final String KEY_CONFIGBLOCK_HOST_START = "Host ";
+ private static final String KEY_CONFIGBLOCK_HOST_END = "\n";
+ private static final Pattern IDENTITYFILE_PATTERN = Pattern.compile(".+IdentityFile (.+)");
+ private static final String CONFIG_FILENAME = "config";
+ private File configFile;
+
+ public SSHUserConfig(String sshHome) {
+ this(new File(sshHome, CONFIG_FILENAME));
+ }
+
+ public SSHUserConfig(File configFile) {
+ this.configFile = configFile;
+ }
+
+ public boolean exists() {
+ return FileUtils.canRead(configFile);
+ }
+
+ public File getFile() {
+ return configFile;
+ }
+
+ public boolean hasLibraIdentifyFile() throws OpenShiftException {
+ return getLibraIdentityFile() != null;
+ }
+
+ public String getLibraIdentityFile() throws OpenShiftException {
+ if (!exists()) {
+ return null;
+ }
+
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(configFile));
+ for (String data = reader.readLine(); data != null; data = reader.readLine()) {
+ if (!data.startsWith(KEY_CONFIGBLOCK_HOST_START)
+ || !data.endsWith(VALUE_LIBRA_SSH_HOST)) {
+ continue;
+ }
+
+ for (data = reader.readLine(); data != null; reader.readLine()) {
+ if (data.equals(KEY_CONFIGBLOCK_HOST_END)) {
+ continue;
+ }
+
+ Matcher matcher = IDENTITYFILE_PATTERN.matcher(data);
+ if (!matcher.find()
+ || matcher.groupCount() < 1) {
+ continue;
+ }
+
+ return matcher.group(1);
+ }
+ }
+ return null;
+ } catch (IOException e) {
+ throw new OpenShiftException("Could not read file {0}", configFile);
+ } finally {
+ try {
+ if (reader != null) {
+ reader.close();
+ }
+ } catch (IOException e) {
+ // ignore THIS IS INTENTIONAL
+ }
+ }
+ }
+}
Property changes on: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/SSHUserConfig.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2012-05-31 23:00:52 UTC (rev 41600)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2012-05-31 23:16:19 UTC (rev 41601)
@@ -54,6 +54,7 @@
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import com.openshift.client.OpenShiftException;
@@ -123,7 +124,7 @@
}
Button browseButton = new Button(container, SWT.PUSH);
- browseButton.setText("Browse");
+ browseButton.setText("Browse...");
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseButton);
browseButton.addSelectionListener(onBrowse());
@@ -150,10 +151,10 @@
public void widgetSelected(SelectionEvent e) {
try {
- if (pageModel.libraPublicKeyExists()) {
+ if (pageModel.publicKeyExists()) {
MessageDialog.openInformation(getShell(),
"Libra Key already present",
- "You already have a key at \"" + pageModel.getLibraPublicKey() + "\". Please move it or use it.");
+ "You already have a key at \"" + pageModel.getPublicKey() + "\". Please move it or use it.");
return;
}
@@ -220,7 +221,7 @@
@Override
protected void setupWizardPageSupport(DataBindingContext dbc) {
- ParametrizableWizardPageSupport.create(IStatus.ERROR, this, dbc);
+ ParametrizableWizardPageSupport.create(IStatus.ERROR | IStatus.CANCEL, this, dbc);
}
private class SSHKeyValidator implements IValidator {
@@ -232,10 +233,14 @@
|| !FileUtils.canRead((String) value)) {
return ValidationStatus.error("You have to provide a valid ssh public key");
}
- if (!isKeyKnownToSsh((String) value)) {
+ if (pageModel.hasConfiguredFixedPrivateKeys()) {
return ValidationStatus.warning(
- NLS.bind("Could not find the private portion for your public key. "
- + "Make sure it is listed in the ssh2 preferences.", value));
+ NLS.bind("Your SSH config ({0}) contains fixed keys for OpenShift servers. " +
+ "This can override any Eclipse specific SSH key preferences.", new SSHUserConfig(pageModel.getSSH2Home()).getFile()));
+ } else if (!isKeyKnownToSsh((String) value)) {
+ return ValidationStatus.warning(
+ NLS.bind("Could not find the private portion for your public key in the preferences. "
+ + "Make sure it is listed in the ssh2 preferences.", value));
}
return ValidationStatus.ok();
}
@@ -244,14 +249,15 @@
if (StringUtils.isEmpty(publicKeyPath)) {
return false;
}
- for (String preferencesKey : SshPrivateKeysPreferences.getKeys()) {
+ for (String preferencesKey : pageModel.getPrivateKeysFromPreferences()) {
try {
File privateKey = SshPrivateKeysPreferences.getKeyFile(preferencesKey);
if (privateKey == null
|| !FileUtils.canRead(privateKey)) {
continue;
}
- if (publicKeyPath.startsWith(privateKey.getAbsolutePath() + ".")) {
+ if (publicKeyPath.startsWith(privateKey.getAbsolutePath() + ".")
+ || publicKeyPath.startsWith(privateKey.getPath() + ".")) {
return true;
}
} catch (FileNotFoundException e) {
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-05-31 23:00:52 UTC (rev 41600)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-05-31 23:16:19 UTC (rev 41601)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.SSHUserConfig;
import com.openshift.client.IDomain;
import com.openshift.client.IOpenShiftSSHKey;
@@ -35,8 +36,10 @@
*/
public class NewDomainWizardPageModel extends ObservableUIPojo {
- public static final String LIBRA_KEY = "libra_id_rsa";
+ public static final String ID_RSA_FILENAME = "id_rsa";
+ public static final String LIBRA_ID_RSA_FILENAME = "libra_id_rsa";
private static final String PUBLIC_KEY_SUFFIX = ".pub";
+ private static final String KEYS_SEPARATOR = ",";
private static final String SSHKEY_DEFAULT_NAME = "jbosstools"; //$NON-NLS-1$
@@ -53,21 +56,22 @@
}
public void initSshKey() throws OpenShiftException {
- if (!libraPublicKeyExists()) {
+ if (!publicKeyExists()) {
return;
}
- File libraPublicKey = getLibraPublicKey();
+ File libraPublicKey = getPublicKey();
setSshKey(libraPublicKey.getAbsolutePath());
}
+
/**
* Returns the file of the libra public key. It is not checking if the file exists.
*
* @return the libra public key
* @throws OpenShiftException
*/
- public File getLibraPublicKey() throws OpenShiftException {
- File libraPrivateKey = getLibraPrivateKey();
+ public File getPublicKey() throws OpenShiftException {
+ File libraPrivateKey = getPrivateKey();
return new File(libraPrivateKey.getParent(), getPublicKeyPath(libraPrivateKey.getName()));
}
@@ -75,30 +79,39 @@
return privateKeyPath + PUBLIC_KEY_SUFFIX;
}
- public File getLibraPrivateKey() throws OpenShiftException {
- String ssh2Home = getSSH2Home();
- File ssh2HomeFile = new File(ssh2Home);
- if (!FileUtils.canRead(ssh2HomeFile)) {
- try {
- ssh2HomeFile.createNewFile();
- } catch(IOException e) {
- throw new OpenShiftException("Could not create ssh2 home directory at {0}", ssh2Home);
- }
+ public File getPrivateKey() throws OpenShiftException {
+ String ssh2Home = checkedGetSSH2Home();
+ ensureSSHHomeExists(ssh2Home);
+ if (hasConfiguredFixedPrivateKeys()) {
+ return new File(ssh2Home, LIBRA_ID_RSA_FILENAME);
+ } else {
+ return new File(ssh2Home, ID_RSA_FILENAME);
}
-
- return new File(ssh2Home, LIBRA_KEY);
}
- private String getSSH2Home() throws OpenShiftException {
- Preferences preferences = JSchCorePlugin.getPlugin().getPluginPreferences();
- String ssh2Home = preferences.getString(IConstants.KEY_SSH2HOME);
+ private String checkedGetSSH2Home() throws OpenShiftException {
+ String ssh2Home = getSSH2Home();
if (ssh2Home == null
|| ssh2Home.trim().length() == 0) {
throw new OpenShiftException("Could not determine your ssh2 home directory");
}
return ssh2Home;
}
+
+ public String getSSH2Home() {
+ return JSchCorePlugin.getPlugin().getPluginPreferences().getString(IConstants.KEY_SSH2HOME);
+ }
+ public boolean hasConfiguredFixedPrivateKeys() {
+ try {
+ SSHUserConfig sshUserConfig = new SSHUserConfig(checkedGetSSH2Home());
+ return sshUserConfig.hasLibraIdentifyFile();
+ } catch (OpenShiftException e) {
+ return false;
+ }
+ }
+
+
public String getDomainId() {
return this.domainId;
}
@@ -123,25 +136,25 @@
return sshKey;
}
- public boolean libraPublicKeyExists() throws OpenShiftException {
- return FileUtils.canRead(getLibraPublicKey());
+ public boolean publicKeyExists() throws OpenShiftException {
+ return FileUtils.canRead(getPublicKey());
}
public void createLibraKeyPair(String passPhrase) throws FileNotFoundException, OpenShiftException {
- File libraPublicKey = getLibraPublicKey();
+ File libraPublicKey = getPublicKey();
if (libraPublicKey.canRead()) {
// key already exists
return;
}
- createSSHHome(getSSH2Home());
- File libraPrivateKey = getLibraPrivateKey();
+ ensureSSHHomeExists(checkedGetSSH2Home());
+ File libraPrivateKey = getPrivateKey();
SSHKeyPair keyPair = SSHKeyPair.create(passPhrase, libraPrivateKey.getAbsolutePath(), libraPublicKey.getAbsolutePath());
setFilePermissions(libraPrivateKey);
addToPrivateKeysPreferences(keyPair);
setSshKey(keyPair.getPublicKeyPath());
}
- private void createSSHHome(String ssh2Home)
+ private void ensureSSHHomeExists(String ssh2Home)
throws OpenShiftException {
File ssh2HomeFile = new File(ssh2Home);
if (FileUtils.canRead(ssh2HomeFile)) {
@@ -171,6 +184,17 @@
file.setWritable(true, true);
}
+ public String[] getPrivateKeysFromPreferences() {
+ String privateKeys =
+ JSchCorePlugin.getPlugin().getPluginPreferences().getString(IConstants.KEY_PRIVATEKEY);
+ if (privateKeys != null
+ && privateKeys.trim().length() > 0) {
+ return privateKeys.split(KEYS_SEPARATOR);
+ } else {
+ return new String[0];
+ }
+ }
+
private void addToPrivateKeysPreferences(SSHKeyPair keyPair) {
Preferences preferences = JSchCorePlugin.getPlugin().getPluginPreferences();
String privateKeys = preferences.getString(IConstants.KEY_PRIVATEKEY);
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2012-05-31 23:00:52 UTC (rev 41600)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2012-05-31 23:16:19 UTC (rev 41601)
@@ -10,34 +10,21 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
public class PassphraseDialog extends InputDialog {
public PassphraseDialog(Shell shell) {
super(shell
, "New ssh key"
- , "Please pick a passphrase for your new ssh key pair"
+ , "Please pick a passphrase for your new ssh key pair. A passphrase is recommended but not required."
, null
- , new PassphraseValidator());
+ , null);
}
protected int getInputTextStyle() {
return SWT.SINGLE | SWT.BORDER | SWT.PASSWORD;
}
-
- private static class PassphraseValidator implements IInputValidator {
-
- @Override
- public String isValid(String input) {
- if (StringUtils.isEmpty(input)) {
- return "You have to provide a pass phrase";
- }
- return null;
- }
- }
}
12 years, 6 months
JBoss Tools SVN: r41600 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:00:52 -0400 (Thu, 31 May 2012)
New Revision: 41600
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
increased timeouts (3min until dialog when waiting for application)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java 2012-05-31 23:00:03 UTC (rev 41599)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java 2012-05-31 23:00:52 UTC (rev 41600)
@@ -32,7 +32,7 @@
*/
public class WaitForApplicationJob extends AbstractDelegatingMonitorJob {
- private static final int APP_REACHABLE_TIMEOUT = 1 * 60 * 1000;
+ private static final int APP_REACHABLE_TIMEOUT = 3 * 60 * 1000;
private IApplication application;
private Shell shell;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-31 23:00:03 UTC (rev 41599)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-31 23:00:52 UTC (rev 41600)
@@ -58,8 +58,8 @@
*/
public abstract class OpenShiftExpressApplicationWizard extends Wizard implements IImportWizard, INewWizard {
- private static final int APP_CREATE_TIMEOUT = 5 * 60 * 1000;
- private static final int APP_WAIT_TIMEOUT = 5 * 60 * 1000;
+ private static final int APP_CREATE_TIMEOUT = 6 * 60 * 1000;
+ private static final int APP_WAIT_TIMEOUT = 10 * 60 * 1000;
private static final long EMBED_CARTRIDGES_TIMEOUT = 2 * 60 * 1000;
private static final int IMPORT_TIMEOUT = 1 * 60 * 1000;
12 years, 6 months
JBoss Tools SVN: r41599 - in branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-05-31 19:00:03 -0400 (Thu, 31 May 2012)
New Revision: 41599
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
increased timeouts when creating app (as discussed with max: 3 minutes until dialog when waiting etc.)
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java 2012-05-31 21:31:24 UTC (rev 41598)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java 2012-05-31 23:00:03 UTC (rev 41599)
@@ -32,7 +32,7 @@
*/
public class WaitForApplicationJob extends AbstractDelegatingMonitorJob {
- private static final int APP_REACHABLE_TIMEOUT = 1 * 60 * 1000;
+ private static final int APP_REACHABLE_TIMEOUT = 3 * 60 * 1000;
private IApplication application;
private Shell shell;
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-31 21:31:24 UTC (rev 41598)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-31 23:00:03 UTC (rev 41599)
@@ -58,8 +58,8 @@
*/
public abstract class OpenShiftExpressApplicationWizard extends Wizard implements IImportWizard, INewWizard {
- private static final int APP_CREATE_TIMEOUT = 5 * 60 * 1000;
- private static final int APP_WAIT_TIMEOUT = 5 * 60 * 1000;
+ private static final int APP_CREATE_TIMEOUT = 6 * 60 * 1000;
+ private static final int APP_WAIT_TIMEOUT = 10 * 60 * 1000;
private static final long EMBED_CARTRIDGES_TIMEOUT = 2 * 60 * 1000;
private static final int IMPORT_TIMEOUT = 1 * 60 * 1000;
12 years, 6 months
JBoss Tools SVN: r41598 - branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-05-31 17:31:24 -0400 (Thu, 31 May 2012)
New Revision: 41598
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
Log:
Fixed - JBIDE-12006
Users in the OpenShift Explorer view should be lazily loaded
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31 21:25:25 UTC (rev 41597)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31 21:31:24 UTC (rev 41598)
@@ -41,16 +41,16 @@
private boolean rememberPassword;
private boolean connected;
private boolean alreadyPromptedForPassword;
-
- public UserDelegate(String username, String password) {
+ private boolean passwordLoaded = false;
+
+ public UserDelegate(String username) {
this.username = username;
- this.password = password;
- this.rememberPassword = (password != null);
this.setConnected(false);
}
-
+
public UserDelegate(IUser user, boolean rememberPassword) {
setDelegate(user);
+ this.passwordLoaded = true;
this.rememberPassword = rememberPassword;
}
@@ -69,15 +69,30 @@
this.username = delegate.getRhlogin();
this.password = delegate.getPassword();
this.setConnected(true);
- }
+ }
public String getUsername() {
return username;
}
public String getPassword() {
+ if (!this.passwordLoaded) {
+ loadPassword();
+ }
return password;
}
-
+
+ /**
+ * Attempts to load the password from the secure storage, only at first
+ * time it is called.
+ */
+ private void loadPassword() {
+ if (!passwordLoaded) {
+ this.password = UserModel.getDefault().getPasswordFromSecureStorage(username);
+ this.rememberPassword = (password != null);
+ this.passwordLoaded = true;
+ }
+ }
+
public boolean isRememberPassword() {
return rememberPassword;
}
@@ -99,7 +114,10 @@
*/
public boolean checkForPassword() {
if(delegate == null) {
- if( username != null && password != null ) {
+ if(!passwordLoaded) {
+ loadPassword();
+ }
+ if(username != null && password != null) {
if( checkCurrentCredentials() )
return true;
}
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-31 21:25:25 UTC (rev 41597)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-31 21:31:24 UTC (rev 41598)
@@ -149,8 +149,7 @@
OpenShiftUIActivator.PLUGIN_ID);
String[] users = pref.get();
for (int i = 0; i < users.length; i++) {
- String password = getPasswordFromSecureStorage(users[i]);
- addUser(new UserDelegate(users[i], password));
+ addUser(new UserDelegate(users[i]));
}
}
12 years, 6 months
JBoss Tools SVN: r41597 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-05-31 17:25:25 -0400 (Thu, 31 May 2012)
New Revision: 41597
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
Log:
Fixed - JBIDE-12006
Users in the OpenShift Explorer view should be lazily loaded
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31 21:19:30 UTC (rev 41596)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31 21:25:25 UTC (rev 41597)
@@ -41,16 +41,16 @@
private boolean rememberPassword;
private boolean connected;
private boolean alreadyPromptedForPassword;
-
- public UserDelegate(String username, String password) {
+ private boolean passwordLoaded = false;
+
+ public UserDelegate(String username) {
this.username = username;
- this.password = password;
- this.rememberPassword = (password != null);
this.setConnected(false);
}
-
+
public UserDelegate(IUser user, boolean rememberPassword) {
setDelegate(user);
+ this.passwordLoaded = true;
this.rememberPassword = rememberPassword;
}
@@ -69,15 +69,30 @@
this.username = delegate.getRhlogin();
this.password = delegate.getPassword();
this.setConnected(true);
- }
+ }
public String getUsername() {
return username;
}
public String getPassword() {
+ if (!this.passwordLoaded) {
+ loadPassword();
+ }
return password;
}
-
+
+ /**
+ * Attempts to load the password from the secure storage, only at first
+ * time it is called.
+ */
+ private void loadPassword() {
+ if (!passwordLoaded) {
+ this.password = UserModel.getDefault().getPasswordFromSecureStorage(username);
+ this.rememberPassword = (password != null);
+ this.passwordLoaded = true;
+ }
+ }
+
public boolean isRememberPassword() {
return rememberPassword;
}
@@ -99,7 +114,10 @@
*/
public boolean checkForPassword() {
if(delegate == null) {
- if( username != null && password != null ) {
+ if(!passwordLoaded) {
+ loadPassword();
+ }
+ if(username != null && password != null) {
if( checkCurrentCredentials() )
return true;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-31 21:19:30 UTC (rev 41596)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-31 21:25:25 UTC (rev 41597)
@@ -149,8 +149,7 @@
OpenShiftUIActivator.PLUGIN_ID);
String[] users = pref.get();
for (int i = 0; i < users.length; i++) {
- String password = getPasswordFromSecureStorage(users[i]);
- addUser(new UserDelegate(users[i], password));
+ addUser(new UserDelegate(users[i]));
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-05-31 21:19:30 UTC (rev 41596)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java 2012-05-31 21:25:25 UTC (rev 41597)
@@ -74,7 +74,7 @@
return new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if(!wizardModel.isNewProject() && isUseDefaultRepoPath()) {
+ if(isUseDefaultRepoPath()) {
final IProject project = wizardModel.getProject();
if(project != null && project.exists()) {
setRepositoryPath(project.getLocation().toOSString());
12 years, 6 months