Author: adietish
Date: 2012-04-30 11:19:30 -0400 (Mon, 30 Apr 2012)
New Revision: 40648
Modified:
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
Log:
[JBIDE-11715] adding key to OpenShift when creating a domain. Storing new key with a
default name "jbosstools"
Modified:
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
---
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30
15:19:06 UTC (rev 40647)
+++
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-04-30
15:19:30 UTC (rev 40648)
@@ -19,7 +19,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.viewer.ConnectToOpenShiftWizard;
@@ -29,8 +28,11 @@
import com.openshift.client.IDomain;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IGearProfile;
+import com.openshift.client.IOpenShiftSSHKey;
+import com.openshift.client.ISSHPublicKey;
import com.openshift.client.IUser;
import com.openshift.client.OpenShiftException;
+import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
public class UserDelegate {
private IUser delegate;
@@ -232,4 +234,12 @@
public void setConnected(boolean connected) {
this.connected = connected;
}
+
+ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws
SocketTimeoutException, OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ return delegate.getSSHKeyByPublicKey(publicKey);
+ }
+
+ public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws
OpenShiftException, SocketTimeoutException {
+ return delegate.putSSHKey(name, key);
+ }
}
Modified:
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
---
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30
15:19:06 UTC (rev 40647)
+++
branches/jbosstools-3.3.0.Beta3/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2012-04-30
15:19:30 UTC (rev 40648)
@@ -17,11 +17,11 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jsch.internal.core.IConstants;
import org.eclipse.jsch.internal.core.JSchCorePlugin;
-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 com.openshift.client.IDomain;
+import com.openshift.client.IOpenShiftSSHKey;
import com.openshift.client.ISSHPublicKey;
import com.openshift.client.OpenShiftException;
import com.openshift.client.SSHKeyPair;
@@ -35,6 +35,8 @@
public static final String LIBRA_KEY = "libra_id_rsa";
private static final String PUBLIC_KEY_SUFFIX = ".pub";
+ private static final String SSHKEY_DEFAULT_NAME = "jbosstools"; //$NON-NLS-1$
+
public static final String PROPERTY_DOMAIN_ID = "domainId";
public static final String PROPERTY_SSHKEY = "sshKey";
@@ -99,7 +101,12 @@
}
public void createDomain() throws OpenShiftException, IOException {
- IDomain domain = user.createDomain(domainId);
+ user.createDomain(domainId);
+ ISSHPublicKey sshKey = loadSshKey();
+ IOpenShiftSSHKey sshKeyResource = user.getSSHKeyByPublicKey(sshKey.getPublicKey());
+ if (sshKeyResource == null) {
+ user.putSSHKey(SSHKEY_DEFAULT_NAME, sshKey);
+ }
}
public String getSshKey() {
Show replies by date