Author: adietish
Date: 2012-05-24 09:20:19 -0400 (Thu, 24 May 2012)
New Revision: 41353
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/EmbedCartridgesJob.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/CreateApplicationOperation.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/EmbedCartridgesOperation.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
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/portforward/RemoteOpenShiftApplicationConfigurationTab.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationDebuggingLaunchConfigurationDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/AbstractDelegatingMonitorJob.java
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/messages/OpenShiftExpressUIMessages.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java
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/ApplicationConfigurationWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeStrategyAdapter.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IEmbedCartridgesWizardPageModel.java
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/OpenShiftExpressApplicationWizardModel.java
Log:
[JBIDE-11314] corrected bugs, moved EmbedCartridgesOperation to job. getting timeout app
creation dialog ("continue" or "close")
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/CreateApplicationOperation.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/CreateApplicationOperation.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/CreateApplicationOperation.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.core;
-
-import java.net.SocketTimeoutException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
-import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
-import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-
-import com.openshift.client.ApplicationScale;
-import com.openshift.client.IApplication;
-import com.openshift.client.ICartridge;
-import com.openshift.client.IGearProfile;
-import com.openshift.client.OpenShiftApplicationNotAvailableException;
-import com.openshift.client.OpenShiftException;
-
-/**
- * @author Xavier Coulon
- * @author Andre Dietisheim
- */
-public class CreateApplicationOperation {
-
- private UserDelegate user;
-
- public CreateApplicationOperation(UserDelegate user) {
- this.user = user;
- }
-
- public IApplication execute(final String name, final ICartridge cartridge, final
ApplicationScale scale,
- final IGearProfile gearProfile, final IProgressMonitor monitor)
- throws OpenShiftApplicationNotAvailableException, OpenShiftException {
- if (user == null) {
- throw new OpenShiftException(OpenShiftExpressUIMessages.CANNOT_CREATE_NO_USER);
- }
-
- monitor.setTaskName(NLS.bind(OpenShiftExpressUIMessages.CREATING_APPLICATION, name));
- Logger.debug(NLS.bind(OpenShiftExpressUIMessages.CREATING_APPLICATION, name));
- return createApplication(name, cartridge, scale, gearProfile, monitor);
- }
-
- private IApplication createApplication(final String name, final ICartridge cartridge,
- final ApplicationScale scale, final IGearProfile gearProfile, final IProgressMonitor
monitor)
- throws OpenShiftException {
- monitor.setTaskName(NLS.bind(OpenShiftExpressUIMessages.CREATING_APPLICATION, name));
- Logger.debug(NLS.bind(OpenShiftExpressUIMessages.CREATING_APPLICATION, name));
- return user.createApplication(name, cartridge, scale, gearProfile);
- }
-}
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/EmbedCartridgesOperation.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/EmbedCartridgesOperation.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/EmbedCartridgesOperation.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * 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.core;
-
-import java.net.SocketTimeoutException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import com.openshift.client.IApplication;
-import com.openshift.client.IEmbeddableCartridge;
-import com.openshift.client.IEmbeddedCartridge;
-import com.openshift.client.OpenShiftException;
-
-/**
- * An operation that embeds/removes cartridges from a given application.
- *
- * @author Andre Dietisheim
- */
-public class EmbedCartridgesOperation {
-
- private IApplication application;
-
- public EmbedCartridgesOperation(IApplication application) {
- this.application = application;
- }
-
- /**
- * Embeds and removes cartridges from the given application so that it
- * matches the given list of enabled cartridges.
- *
- * @param selectedCartridges
- * @param monitor
- * @return
- * @throws SocketTimeoutException
- * @throws OpenShiftException
- */
- public List<IEmbeddedCartridge> execute(final List<IEmbeddableCartridge>
selectedCartridges,
- final IProgressMonitor monitor)
- throws SocketTimeoutException, OpenShiftException {
- if (selectedCartridges == null) {
- return Collections.emptyList();
- }
-
- removeEmbeddedCartridges(
- getRemovedCartridges(selectedCartridges, application.getEmbeddedCartridges()),
application);
- return addEmbeddedCartridges(
- getAddedCartridges(selectedCartridges, application.getEmbeddedCartridges()),
application);
- }
-
- private void removeEmbeddedCartridges(List<IEmbeddableCartridge>
cartridgesToRemove, final IApplication application)
- throws OpenShiftException, SocketTimeoutException {
- if (cartridgesToRemove.isEmpty()) {
- return;
- }
- Collections.sort(cartridgesToRemove, new CartridgeAddRemovePriorityComparator());
- for (IEmbeddableCartridge cartridgeToRemove : cartridgesToRemove) {
- final IEmbeddedCartridge embeddedCartridge =
application.getEmbeddedCartridge(cartridgeToRemove);
- if (embeddedCartridge != null) {
- embeddedCartridge.destroy();
- }
- }
- }
-
- private List<IEmbeddedCartridge>
addEmbeddedCartridges(List<IEmbeddableCartridge> cartridgesToAdd,
- final IApplication application)
- throws OpenShiftException, SocketTimeoutException {
- if (cartridgesToAdd.isEmpty()) {
- return Collections.emptyList();
- }
- Collections.sort(cartridgesToAdd, new CartridgeAddRemovePriorityComparator());
- return application.addEmbeddableCartridges(cartridgesToAdd);
- }
-
- private List<IEmbeddableCartridge>
getAddedCartridges(List<IEmbeddableCartridge> selectedCartridges,
- List<IEmbeddedCartridge> embeddedCartridges) {
- List<IEmbeddableCartridge> cartridgesToAdd = new
ArrayList<IEmbeddableCartridge>();
- for (IEmbeddableCartridge cartridge : selectedCartridges) {
- if (!embeddedCartridges.contains(cartridge)) {
- cartridgesToAdd.add(cartridge);
- }
- }
- return cartridgesToAdd;
- }
-
- private List<IEmbeddableCartridge>
getRemovedCartridges(List<IEmbeddableCartridge> selectedCartridges,
- List<IEmbeddedCartridge> embeddedCartridges) {
- List<IEmbeddableCartridge> cartridgesToRemove = new
ArrayList<IEmbeddableCartridge>();
- for (IEmbeddableCartridge cartridge : embeddedCartridges) {
- if (!selectedCartridges.contains(cartridge)) {
- cartridgesToRemove.add(cartridge);
- }
- }
- return cartridgesToRemove;
- }
-
- private static class CartridgeAddRemovePriorityComparator implements
Comparator<IEmbeddableCartridge> {
-
- @Override
- public int compare(IEmbeddableCartridge thisCartridge, IEmbeddableCartridge
thatCartridge) {
- // mysql has to be added/removed before phpmyadmin
- if (thisCartridge.equals(IEmbeddableCartridge.MYSQL_51)) {
- return -1;
- } else if (thatCartridge.equals(IEmbeddableCartridge.MYSQL_51)) {
- return 1;
- } else if (thisCartridge.equals(IEmbeddableCartridge.POSTGRESQL_84)) {
- return -1;
- } else if (thatCartridge.equals(IEmbeddableCartridge.POSTGRESQL_84)) {
- return 1;
- } else if (thisCartridge.equals(IEmbeddableCartridge.MONGODB_20)) {
- return -1;
- } else if (thatCartridge.equals(IEmbeddableCartridge.MONGODB_20)) {
- return 1;
- }
- return 0;
- }
- }
-
-}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.behaviour;
-import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -43,7 +42,6 @@
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftPasswordStorageKey;
import org.osgi.service.prefs.BackingStoreException;
import com.openshift.client.IApplication;
@@ -391,9 +389,6 @@
} catch(OpenShiftException ose) {
Logger.error(NLS.bind("Could not find application for server {0}",
server.getName()));
return null;
- } catch(SocketTimeoutException ose) {
- Logger.error(NLS.bind("Could not find application for server {0}",
server.getName()));
- return null;
}
}
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-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.console;
-import java.net.SocketTimeoutException;
import java.util.List;
import org.eclipse.jface.window.Window;
@@ -143,20 +142,20 @@
* @throws SocketTimeoutException
*/
public IDomain createDomain(String id)
- throws OpenShiftException, SocketTimeoutException {
+ throws OpenShiftException {
if(checkForPassword()) {
return delegate.createDomain(id);
}
return null;
}
public IApplication getApplicationByName(String arg0)
- throws OpenShiftException, SocketTimeoutException {
+ throws OpenShiftException {
if(checkForPassword() && delegate.hasDomain()) {
return delegate.getDefaultDomain().getApplicationByName(arg0);
}
return null;
}
- public List<IApplication> getApplications() throws OpenShiftException,
SocketTimeoutException {
+ public List<IApplication> getApplications() throws OpenShiftException {
if(checkForPassword() && delegate.hasDomain()) {
return delegate.getDefaultDomain().getApplications();
}
@@ -177,14 +176,14 @@
return null;
}
- public List<ICartridge> getStandaloneCartridgeNames() throws OpenShiftException,
SocketTimeoutException {
+ public List<ICartridge> getStandaloneCartridgeNames() throws OpenShiftException {
if(checkForPassword()) {
return delegate.getConnection().getStandaloneCartridges();
}
return null;
}
- public IDomain getDefaultDomain() throws OpenShiftException, SocketTimeoutException {
+ public IDomain getDefaultDomain() throws OpenShiftException {
if(checkForPassword()) {
return delegate.getDefaultDomain();
}
@@ -192,28 +191,28 @@
}
public List<IEmbeddableCartridge> getEmbeddableCartridges()
- throws OpenShiftException, SocketTimeoutException {
+ throws OpenShiftException {
if(checkForPassword()) {
return delegate.getConnection().getEmbeddableCartridges();
}
return null;
}
- public boolean hasApplication(String name) throws OpenShiftException,
SocketTimeoutException {
+ public boolean hasApplication(String name) throws OpenShiftException {
if(checkForPassword()) {
return delegate.getDefaultDomain().hasApplicationByName(name);
}
return false;
}
- public boolean hasApplicationOfType(ICartridge type) throws OpenShiftException,
SocketTimeoutException {
+ public boolean hasApplicationOfType(ICartridge type) throws OpenShiftException {
if(hasDomain()) {
return delegate.getDefaultDomain().hasApplicationByCartridge(type);
}
return false;
}
- public boolean hasDomain() throws OpenShiftException, SocketTimeoutException {
+ public boolean hasDomain() throws OpenShiftException {
if(checkForPassword()) {
return delegate.hasDomain();
}
@@ -222,12 +221,12 @@
public boolean isValid() throws OpenShiftException {
if(checkForPassword()) {
- return true;//delegate.isValid();
+ return true;
}
return false;
}
- public void refresh() throws OpenShiftException, SocketTimeoutException {
+ public void refresh() throws OpenShiftException {
if(checkForPassword()) {
delegate.refresh();
}
@@ -247,11 +246,11 @@
this.connected = connected;
}
- public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws
SocketTimeoutException, OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
+ public IOpenShiftSSHKey getSSHKeyByPublicKey(String publicKey) throws
OpenShiftUnknonwSSHKeyTypeException, OpenShiftException {
return delegate.getSSHKeyByPublicKey(publicKey);
}
- public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws
OpenShiftException, SocketTimeoutException {
+ public IOpenShiftSSHKey putSSHKey(String name, ISSHPublicKey key) throws
OpenShiftException {
return delegate.putSSHKey(name, key);
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationConfigurationTab.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationConfigurationTab.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationConfigurationTab.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.portforward;
-import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.Map;
@@ -22,8 +21,6 @@
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchTab;
-import org.eclipse.jdt.internal.debug.ui.launcher.AbstractJavaMainTab;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.layout.GridDataFactory;
@@ -171,8 +168,6 @@
}
} catch (OpenShiftException e) {
Logger.error("Failed to retrieve applications from user", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to retrieve applications from user", e);
}
return false;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationDebuggingLaunchConfigurationDelegate.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationDebuggingLaunchConfigurationDelegate.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/portforward/RemoteOpenShiftApplicationDebuggingLaunchConfigurationDelegate.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.portforward;
-import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
@@ -83,8 +80,6 @@
}
} catch (OpenShiftException e) {
Logger.error("Failed to retrieve applications from user", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to retrieve applications from user", e);
}
return null;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.action;
-import java.net.SocketTimeoutException;
-
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
@@ -65,10 +63,6 @@
Logger.warn("Failed to retrieve User domain, prompting for creation", e);
// let's use the domain creation wizard, then.
domainWizard = new NewDomainDialog(user);
- } catch (SocketTimeoutException e) {
- Logger.warn("Failed to retrieve User domain, prompting for creation", e);
- // let's use the domain creation wizard, then.
- domainWizard = new NewDomainDialog(user);
}
return domainWizard;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.action;
-import java.net.SocketTimeoutException;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -54,8 +52,6 @@
}
} catch (OpenShiftException e) {
Logger.warn("Failed to retrieve User domain, prompting for creation", e);
- } catch (SocketTimeoutException e) {
- Logger.warn("Failed to retrieve User domain, prompting for creation", e);
}
}
}
@@ -113,12 +109,7 @@
}
} catch (OpenShiftException e) {
Logger.warn(
- "Failed to retrieve User domain, prompting for creation",
- e);
- } catch (SocketTimeoutException e) {
- Logger.warn(
- "Failed to retrieve User domain, prompting for creation",
- e);
+ "Failed to retrieve User domain, prompting for creation", e);
}
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.action;
-import java.net.SocketTimeoutException;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -70,8 +68,6 @@
});
} catch (OpenShiftException e) {
Logger.error("Failed to refresh element", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to refresh element", e);
} finally {
monitor.done();
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/AbstractDelegatingMonitorJob.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/AbstractDelegatingMonitorJob.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/AbstractDelegatingMonitorJob.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -37,5 +37,5 @@
return delegatingMonitor;
}
- protected abstract IStatus doRun(DelegatingProgressMonitor monitor);
+ protected abstract IStatus doRun(IProgressMonitor monitor);
}
\ No newline at end of file
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.job;
+
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
+
+import com.openshift.client.ApplicationScale;
+import com.openshift.client.IApplication;
+import com.openshift.client.ICartridge;
+import com.openshift.client.IGearProfile;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class CreateApplicationJob extends AbstractDelegatingMonitorJob {
+
+ private UserDelegate user;
+ private String name;
+ private ICartridge cartridge;
+ private ApplicationScale scale;
+ private IGearProfile gear;
+ private IApplication application;
+ private ReentrantLock lock = new ReentrantLock();
+
+ public CreateApplicationJob(final String name, final ICartridge cartridge, final
ApplicationScale scale,
+ final IGearProfile gear, UserDelegate user) {
+ super(NLS.bind(OpenShiftExpressUIMessages.CREATING_APPLICATION, name));
+ this.name = name;
+ this.cartridge = cartridge;
+ this.scale = scale;
+ this.gear = gear;
+ this.user = user;
+ }
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) {
+ try {
+ lock.lock();
+ this.application = user.createApplication(name, cartridge, scale, gear);
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ OpenShiftExpressUIMessages.COULD_NOT_CREATE_APPLICATION, e, name);
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ public IApplication getApplication() {
+ try {
+ lock.lock();
+ return application;
+ } finally {
+ lock.unlock();
+ }
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/CreateApplicationJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/EmbedCartridgesJob.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/EmbedCartridgesJob.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/EmbedCartridgesJob.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * 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.job;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
+
+import com.openshift.client.IApplication;
+import com.openshift.client.IEmbeddableCartridge;
+import com.openshift.client.IEmbeddedCartridge;
+import com.openshift.client.OpenShiftException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class EmbedCartridgesJob extends AbstractDelegatingMonitorJob {
+
+ private List<IEmbeddableCartridge> selectedCartridges;
+ private IApplication application;
+ private List<IEmbeddedCartridge> addedCartridges;
+
+ public EmbedCartridgesJob(List<IEmbeddableCartridge> selectedCartridges,
IApplication application) {
+ super(NLS.bind(OpenShiftExpressUIMessages.ADDING_REMOVING_CARTRIDGES,
application.getName()));
+ this.selectedCartridges = selectedCartridges;
+ this.application = application;
+ }
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) {
+ try {
+ removeEmbeddedCartridges(
+ getRemovedCartridges(selectedCartridges, application.getEmbeddedCartridges()),
application);
+ this.addedCartridges = addEmbeddedCartridges(
+ getAddedCartridges(selectedCartridges, application.getEmbeddedCartridges()),
application);
+ return Status.OK_STATUS;
+ } catch (OpenShiftException e) {
+ return OpenShiftUIActivator.createErrorStatus("Could not embed cartridges for
application {0}", e,
+ application.getName());
+ }
+ }
+
+ public List<IEmbeddedCartridge> getAddedCartridges() {
+ return addedCartridges;
+ }
+
+ private void removeEmbeddedCartridges(List<IEmbeddableCartridge>
cartridgesToRemove, final IApplication application)
+ throws OpenShiftException {
+ if (cartridgesToRemove.isEmpty()) {
+ return;
+ }
+ Collections.sort(cartridgesToRemove, new CartridgeAddRemovePriorityComparator());
+ for (IEmbeddableCartridge cartridgeToRemove : cartridgesToRemove) {
+ final IEmbeddedCartridge embeddedCartridge =
application.getEmbeddedCartridge(cartridgeToRemove);
+ if (embeddedCartridge != null) {
+ embeddedCartridge.destroy();
+ }
+ }
+ }
+
+ private List<IEmbeddedCartridge>
addEmbeddedCartridges(List<IEmbeddableCartridge> cartridgesToAdd,
+ final IApplication application) throws OpenShiftException {
+ if (cartridgesToAdd.isEmpty()) {
+ return Collections.emptyList();
+ }
+ Collections.sort(cartridgesToAdd, new CartridgeAddRemovePriorityComparator());
+ return application.addEmbeddableCartridges(cartridgesToAdd);
+ }
+
+ private List<IEmbeddableCartridge>
getAddedCartridges(List<IEmbeddableCartridge> selectedCartridges,
+ List<IEmbeddedCartridge> embeddedCartridges) {
+ List<IEmbeddableCartridge> cartridgesToAdd = new
ArrayList<IEmbeddableCartridge>();
+ for (IEmbeddableCartridge cartridge : selectedCartridges) {
+ if (!embeddedCartridges.contains(cartridge)) {
+ cartridgesToAdd.add(cartridge);
+ }
+ }
+ return cartridgesToAdd;
+ }
+
+ private List<IEmbeddableCartridge>
getRemovedCartridges(List<IEmbeddableCartridge> selectedCartridges,
+ List<IEmbeddedCartridge> embeddedCartridges) {
+ List<IEmbeddableCartridge> cartridgesToRemove = new
ArrayList<IEmbeddableCartridge>();
+ for (IEmbeddableCartridge cartridge : embeddedCartridges) {
+ if (!selectedCartridges.contains(cartridge)) {
+ cartridgesToRemove.add(cartridge);
+ }
+ }
+ return cartridgesToRemove;
+ }
+
+ private static class CartridgeAddRemovePriorityComparator implements
Comparator<IEmbeddableCartridge> {
+
+ @Override
+ public int compare(IEmbeddableCartridge thisCartridge, IEmbeddableCartridge
thatCartridge) {
+ // mysql has to be added/removed before phpmyadmin
+ if (thisCartridge.equals(IEmbeddableCartridge.MYSQL_51)) {
+ return -1;
+ } else if (thatCartridge.equals(IEmbeddableCartridge.MYSQL_51)) {
+ return 1;
+ } else if (thisCartridge.equals(IEmbeddableCartridge.POSTGRESQL_84)) {
+ return -1;
+ } else if (thatCartridge.equals(IEmbeddableCartridge.POSTGRESQL_84)) {
+ return 1;
+ } else if (thisCartridge.equals(IEmbeddableCartridge.MONGODB_20)) {
+ return -1;
+ } else if (thatCartridge.equals(IEmbeddableCartridge.MONGODB_20)) {
+ return 1;
+ }
+ return 0;
+ }
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/EmbedCartridgesJob.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/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-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/job/WaitForApplicationJob.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -12,6 +12,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -19,22 +20,19 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.common.ui.DelegatingProgressMonitor;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.client.IApplication;
import com.openshift.client.OpenShiftException;
-import com.openshift.client.OpenShiftTimeoutException;
/**
* @author Andre Dietisheim
*/
public class WaitForApplicationJob extends AbstractDelegatingMonitorJob {
-// private static final int APP_REACHABLE_TIMEOUT = 180 * 1000;
- private static final int APP_REACHABLE_TIMEOUT = 1 * 1000;
+ private static final int APP_REACHABLE_TIMEOUT = 180 * 1000;
private IApplication application;
private Shell shell;
@@ -45,7 +43,7 @@
}
@Override
- protected IStatus doRun(DelegatingProgressMonitor monitor) {
+ protected IStatus doRun(IProgressMonitor monitor) {
Logger.debug(OpenShiftExpressUIMessages.WAITING_FOR_REACHABLE);
try {
while (!application.waitForAccessible(APP_REACHABLE_TIMEOUT)) {
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -15,14 +15,17 @@
}
public static String CANNOT_CREATE_NO_USER;
+ public static String CREATING_APPLICATION;
+ public static String COULD_NOT_CREATE_APPLICATION;
public static String OPERATION_CANCELLED;
- public static String CREATING_APPLICATION;
public static String WAITING_FOR_REACHABLE;
public static String APPLICATION_NOT_ANSWERING;
public static String APPLICATION_NOT_ANSWERING_CONTINUE_WAITING;
public static String BTN_KEEP_WAITING;
public static String BTN_CLOSE_WIZARD;
+ public static String ADDING_REMOVING_CARTRIDGES;
+
public static String TAIL_SERVER_LOG_ACTION;
public static String CREATE_OR_EDIT_DOMAIN_ACTION;
public static String DELETE_DOMAIN_ACTION;
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties 2012-05-24
13:20:19 UTC (rev 41353)
@@ -1,12 +1,20 @@
CANNOT_CREATE_NO_USER=Could not create application, have no valid user credentials
-CREATING_APPLICATION=Creating application \"{0}\"...
+CREATING_APPLICATION=Creating application "{0}"...
+COULD_NOT_CREATE_APPLICATION=Could not create application "{0}"
OPERATION_CANCELLED=Operation was cancelled by user.
-WAITING_FOR_REACHABLE=Waiting for application \"{0}\" to become reachable...
-APPLICATION_NOT_ANSWERING=The application "{0}" did not answer in a reasonable
amount of time. This can happen periodically and will just take an extra minute or two to
propagate depending on where you are in the world.\nOnce you are able to access your
application in a browser, you can then clone your git repository.\nIf you can''t
get your application running in the browser, you can also try destroying and recreating
the application as well using this Wizard.\n\nIf this doesn''t work for you, let
us know in the forums or in IRC and we''ll make sure to get you up and
running.\n\nForums\: https\://www.redhat.com/openshift/forums/express\n\nIRC\: \#openshift
(on Freenode)
+WAITING_FOR_REACHABLE=Waiting for application "{0}" to become reachable...
+APPLICATION_NOT_ANSWERING=The application "{0}" did not answer in a reasonable
amount of time. \
+This can happen periodically and will just take an extra minute or two to propagate
depending on where you are in the world.\n\
+Once you are able to access your application in a browser, you can then clone your git
repository.\n\
+If you can''t get your application running in the browser, you can also try
destroying and recreating the application as well using this Wizard.\n\n\
+If this doesn''t work for you, let us know in the forums or in IRC and
we''ll make sure to get you up and running.\n\nForums\: \
+https\://www.redhat.com/openshift/forums/express\n\nIRC\: \#openshift (on Freenode)
APPLICATION_NOT_ANSWERING_CONTINUE_WAITING=Application "{0}" did not answer so
far.\n\nDo you want to continue to wait for it?
BTN_KEEP_WAITING=Keep waiting
BTN_CLOSE_WIZARD=Close wizard
+ADDING_REMOVING_CARTRIDGES=Adding/removing cartridges for application "{0}"...
+
TAIL_SERVER_LOG_ACTION=Tail files
#
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.viewer;
-import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -141,8 +140,6 @@
}
} catch(OpenShiftException e) {
errors.put(parentElement, e);
- } catch(SocketTimeoutException e) {
- errors.put(parentElement, e);
}
return children;
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.viewer.property;
-import java.net.SocketTimeoutException;
-
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;
@@ -64,8 +62,6 @@
}
} catch (OpenShiftException e) {
Logger.error("Could not get selected object's property '" + id +
"'.", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Could not get selected object's property '" + id +
"'.", e);
}
return null;
}
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-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -11,7 +11,6 @@
package org.jboss.tools.openshift.express.internal.ui.wizard;
import java.lang.reflect.InvocationTargetException;
-import java.net.SocketTimeoutException;
import java.util.Collection;
import java.util.List;
@@ -39,7 +38,6 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.PageChangingEvent;
import org.eclipse.jface.fieldassist.AutoCompleteField;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecoration;
@@ -307,7 +305,7 @@
BeanProperties.list(ApplicationConfigurationWizardPageModel.PROPERTY_GEAR_PROFILES).observe(pageModel),
new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER),
new UpdateListStrategy().setConverter(new GearProfileToStringConverter()));
-
+
final ISWTObservableValue selectedGearProfileComboObservable =
WidgetProperties.selection().observe(gearProfilesCombo);
final IObservableValue selectedGearProfileModelObservable = BeanProperties.value(
@@ -649,7 +647,7 @@
@Override
protected void onPageActivated(final DataBindingContext dbc) {
- if (checkForDomainExistance()) {
+ if (ensureHasDomain()) {
new Thread() {
public void run() {
Display.getDefault().asyncExec(new Runnable() {
@@ -658,10 +656,8 @@
enableApplicationWidgets(pageModel.isUseExistingApplication());
createExistingAppNameContentAssist();
// this is needed because of weird issues with UI
- // not
- // reacting to model changes while wizard runnable
- // is
- // run. We force another update
+ // not reacting to model changes while wizard
+ // runnable is run. We force another update
dbc.updateModels();
}
});
@@ -670,20 +666,12 @@
}
}
- @Override
- protected void onPageWillGetActivated(Direction direction, PageChangingEvent event,
DataBindingContext dbc) {
- if (direction == Direction.BACKWARDS) {
- return;
- }
- // event.doit = checkForDomainExistance();
- }
-
/**
* Checks that the user has a domain, opens the creation dialog in case he
* hasn't, closes the wizard if the user does not create a domain (required
* for any application creation). Otherwise, returns true.
*/
- private boolean checkForDomainExistance() {
+ private boolean ensureHasDomain() {
try {
final UserDelegate user = this.pageModel.getUser();
if (user != null && !user.hasDomain()) {
@@ -703,9 +691,6 @@
} catch (OpenShiftException e) {
Logger.error("Failed to refresh OpenShift account info", e);
return false;
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to refresh OpenShift account info", e);
- return false;
}
return true;
}
@@ -806,9 +791,6 @@
if (!pageModel.hasApplication(appName)) {
return ValidationStatus.error(NLS.bind("The application \"{0}\" does
not exist.", appName));
}
- } catch (SocketTimeoutException e) {
- return ValidationStatus.error(NLS.bind("The application \"{0}\"
existance could not be verified.",
- appName));
} catch (OpenShiftException e) {
return ValidationStatus.error(NLS.bind("The application \"{0}\"
existance could not be verified.",
appName));
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -17,10 +17,8 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.internal.core.CartridgeNameComparator;
-import org.jboss.tools.openshift.express.internal.core.CreateApplicationOperation;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
@@ -396,7 +394,7 @@
return getSelectedEmbeddableCartridges().contains(cartridge);
}
- public boolean hasApplication(String applicationName) throws SocketTimeoutException,
OpenShiftException {
+ public boolean hasApplication(String applicationName) throws OpenShiftException {
return getUser().hasApplication(applicationName);
}
@@ -404,16 +402,4 @@
public IDomain getDomain() throws SocketTimeoutException, OpenShiftException {
return wizardModel.getUser().getDefaultDomain();
}
-
- @Override
- public IApplication createJenkinsApplication(String name, IProgressMonitor monitor)
throws OpenShiftException {
- IApplication application =
- new CreateApplicationOperation(getUser()).execute(
- name,
- ICartridge.JENKINS_14,
- ApplicationScale.NO_SCALE,
- IGearProfile.SMALL,
- monitor);
- return application;
- }
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import java.net.SocketTimeoutException;
import java.util.Collections;
import java.util.List;
@@ -44,8 +43,6 @@
getUser().refresh();
} catch (OpenShiftException e) {
Logger.error("Failed to refresh User's account", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to refresh User's account", e);
}
}
@@ -58,8 +55,6 @@
return user.getApplications();
} catch (OpenShiftException e) {
Logger.error("Failed to retrieve User's applications", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Failed to retrieve User's applications", e);
}
return Collections.emptyList();
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPageModel.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPageModel.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -40,8 +40,6 @@
}
} catch (OpenShiftException e) {
Logger.error("Fail to retrieve OpenShift domain", e);
- } catch (SocketTimeoutException e) {
- Logger.error("Fail to retrieve OpenShift domain", e);
}
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeStrategyAdapter.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeStrategyAdapter.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeStrategyAdapter.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -13,10 +13,6 @@
import java.net.SocketTimeoutException;
import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
@@ -31,12 +27,17 @@
import org.jboss.tools.openshift.express.internal.core.EmbedCartridgeStrategy;
import
org.jboss.tools.openshift.express.internal.core.EmbedCartridgeStrategy.EmbeddableCartridgeDiff;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.job.AbstractDelegatingMonitorJob;
+import org.jboss.tools.openshift.express.internal.ui.job.CreateApplicationJob;
+import org.jboss.tools.openshift.express.internal.ui.job.WaitForApplicationJob;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import
org.jboss.tools.openshift.express.internal.ui.utils.StringUtils.ToStringConverter;
+import com.openshift.client.ApplicationScale;
import com.openshift.client.IApplication;
import com.openshift.client.ICartridge;
import com.openshift.client.IEmbeddableCartridge;
+import com.openshift.client.IGearProfile;
import com.openshift.client.OpenShiftException;
/**
@@ -51,6 +52,9 @@
*/
public class EmbedCartridgeStrategyAdapter implements ICheckStateListener {
+ private static final int APP_CREATE_TIMEOUT = 2 * 60 * 1000;
+ private static final int APP_WAIT_TIMEOUT = 2 * 60 * 1000;
+
private IEmbedCartridgesWizardPageModel pageModel;
private IWizardPage wizardPage;
@@ -83,7 +87,7 @@
}
}
}
-
+
} catch (OpenShiftException e) {
OpenShiftUIActivator.log("Could not process embeddable cartridges", e);
} catch (SocketTimeoutException e) {
@@ -147,25 +151,21 @@
private void createJenkinsApplication(final ICartridge cartridge) {
final String name = openJenkinsApplicationDialog();
try {
- WizardUtils.runInWizard(new Job(NLS.bind("Creating application
\"{0}\"...", name)) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- IApplication application = pageModel.createJenkinsApplication(name, monitor);
- openLogDialog(application);
- return Status.OK_STATUS;
- } catch (Exception e) {
- try {
- // TODO: unselect failed embeddable cartridge
- // pageModel.unselectEmbeddedCartridges(cartridge);
- } catch (Exception ex) {
- OpenShiftUIActivator.log(ex);
- }
- return OpenShiftUIActivator.createErrorStatus("Could not create application
{0}", e);
- }
- }
+ CreateApplicationJob createJob =
+ new CreateApplicationJob(name, ICartridge.JENKINS_14, ApplicationScale.NO_SCALE,
+ IGearProfile.SMALL, pageModel.getUser());
+ WizardUtils.runInWizard(
+ createJob, createJob.getDelegatingProgressMonitor(), getContainer(),
APP_CREATE_TIMEOUT);
- }, getContainer());
+ if (createJob.getResult().isOK()) {
+ IApplication application = createJob.getApplication();
+ openLogDialog(application);
+
+ AbstractDelegatingMonitorJob job = new WaitForApplicationJob(application,
getShell());
+ WizardUtils.runInWizard(
+ job, job.getDelegatingProgressMonitor(), getContainer(), APP_WAIT_TIMEOUT);
+ }
+
} catch (Exception e) {
// ignore
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPage.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -10,13 +10,10 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.TimeUnit;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeanProperties;
@@ -39,23 +36,23 @@
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Table;
import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.job.EmbedCartridgesJob;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IEmbeddedCartridge;
-import com.openshift.client.OpenShiftException;
/**
* @author André Dietisheim
*/
public class EmbedCartridgeWizardPage extends AbstractOpenShiftWizardPage {
+ private static final long EMBED_CARTRIDGES_TIMEOUT = 2 * 60 * 1000;
private EmbedCartridgeWizardPageModel pageModel;
private CheckboxTableViewer viewer;
@@ -84,23 +81,26 @@
ViewerProperties.checkedElements(IEmbeddableCartridge.class).observe(viewer),
BeanProperties.set(
EmbedCartridgeWizardPageModel.PROPERTY_SELECTED_EMBEDDABLE_CARTRIDGES)
- .observe(pageModel));;
+ .observe(pageModel));
+ ;
// strategy has to be attached after the binding, so that the binding
// can still add the checked cartridge and the strategy can correct
viewer.addCheckStateListener(new EmbedCartridgeStrategyAdapter(pageModel, this));
-
-// hiding buttons for now:
https://issues.jboss.org/browse/JBIDE-10399
-// Button checkAllButton = new Button(embedGroup, SWT.PUSH);
-// checkAllButton.setText("Embed A&ll");
-// GridDataFactory.fillDefaults()
-// .hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.CENTER).applyTo(checkAllButton);
-// checkAllButton.addSelectionListener(onCheckAll());
-// Button uncheckAllButton = new Button(embedGroup, SWT.PUSH);
-// uncheckAllButton.setText("Embed N&one");
-// GridDataFactory.fillDefaults()
-// .hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.CENTER).applyTo(uncheckAllButton);
-// uncheckAllButton.addSelectionListener(onUncheckAll());
+ // hiding buttons for now:
https://issues.jboss.org/browse/JBIDE-10399
+ // Button checkAllButton = new Button(embedGroup, SWT.PUSH);
+ // checkAllButton.setText("Embed A&ll");
+ // GridDataFactory.fillDefaults()
+ // .hint(110, SWT.DEFAULT).align(SWT.FILL,
+ // SWT.CENTER).applyTo(checkAllButton);
+ // checkAllButton.addSelectionListener(onCheckAll());
+
+ // Button uncheckAllButton = new Button(embedGroup, SWT.PUSH);
+ // uncheckAllButton.setText("Embed N&one");
+ // GridDataFactory.fillDefaults()
+ // .hint(110, SWT.DEFAULT).align(SWT.FILL,
+ // SWT.CENTER).applyTo(uncheckAllButton);
+ // uncheckAllButton.addSelectionListener(onUncheckAll());
}
protected CheckboxTableViewer createTable(Composite tableContainer) {
@@ -112,17 +112,17 @@
CheckboxTableViewer viewer = new CheckboxTableViewer(table);
viewer.setComparer(new EqualityComparer());
viewer.setContentProvider(new ArrayContentProvider());
-
- viewer.setSorter(new ViewerSorter(){
+ viewer.setSorter(new ViewerSorter() {
+
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- if(e1 instanceof IEmbeddableCartridge && e2 instanceof
IEmbeddableCartridge){
- return
((IEmbeddableCartridge)e1).getName().compareTo(((IEmbeddableCartridge)e2).getName());
+ if (e1 instanceof IEmbeddableCartridge && e2 instanceof IEmbeddableCartridge)
{
+ return ((IEmbeddableCartridge) e1).getName().compareTo(((IEmbeddableCartridge)
e2).getName());
}
return super.compare(viewer, e1, e2);
}
-
+
});
createTableColumn("Embeddable Cartridge", 1, new CellLabelProvider() {
@@ -144,34 +144,34 @@
layout.setColumnData(column.getColumn(), new ColumnWeightData(weight, true));
}
-// private SelectionListener onCheckAll() {
-// return new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// viewer.setAllChecked(true);
-// try {
-// addJenkinsCartridge(IEmbeddedCartridge.JENKINS_14);
-// } catch (OpenShiftException ex) {
-// OpenShiftUIActivator.log("Could not select jenkins cartridge", ex);
-// } catch (SocketTimeoutException ex) {
-// OpenShiftUIActivator.log("Could not select jenkins cartridge", ex);
-// }
-// }
-//
-// };
-// }
+ // private SelectionListener onCheckAll() {
+ // return new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // viewer.setAllChecked(true);
+ // try {
+ // addJenkinsCartridge(IEmbeddedCartridge.JENKINS_14);
+ // } catch (OpenShiftException ex) {
+ // OpenShiftUIActivator.log("Could not select jenkins cartridge", ex);
+ // } catch (SocketTimeoutException ex) {
+ // OpenShiftUIActivator.log("Could not select jenkins cartridge", ex);
+ // }
+ // }
+ //
+ // };
+ // }
-// private SelectionListener onUncheckAll() {
-// return new SelectionAdapter() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// viewer.setAllChecked(false);
-// }
-//
-// };
-// }
+ // private SelectionListener onUncheckAll() {
+ // return new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // viewer.setAllChecked(false);
+ // }
+ //
+ // };
+ // }
@Override
protected void onPageActivated(DataBindingContext dbc) {
@@ -216,7 +216,8 @@
@Override
public void run() {
try {
- Set<IEmbeddableCartridge> selectedEmbeddableCartridges =
pageModel.refreshSelectedEmbeddedCartridges();
+ Set<IEmbeddableCartridge> selectedEmbeddableCartridges = pageModel
+ .refreshSelectedEmbeddedCartridges();
viewer.setCheckedElements(
selectedEmbeddableCartridges.toArray());
} catch (Exception e) {
@@ -237,40 +238,22 @@
}
public boolean processCartridges() {
- final ArrayBlockingQueue<Boolean> queue = new
ArrayBlockingQueue<Boolean>(1);
try {
- WizardUtils.runInWizard(
- new Job(NLS.bind("Adding/Removing embedded cartridges for application
{0}...",
- pageModel.getApplication().getName())) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- List<IEmbeddedCartridge> addedCartridges = pageModel.embedCartridges();
- openLogDialog(addedCartridges);
- queue.offer(true);
- } catch (OpenShiftException e) {
- safeRefreshSelectedEmbeddedCartridges();
- queue.offer(false);
- return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- NLS.bind("Could not embed cartridges to application {0}",
- pageModel.getApplication().getName()), e);
- } catch (SocketTimeoutException e) {
- safeRefreshSelectedEmbeddedCartridges();
- queue.offer(false);
- return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- NLS.bind("Could not embed cartridges to application {0}",
- pageModel.getApplication().getName()), e);
- }
- return Status.OK_STATUS;
- }
- }, getContainer());
- return queue.poll(10, TimeUnit.SECONDS);
+ EmbedCartridgesJob job = new EmbedCartridgesJob(
+ new
ArrayList<IEmbeddableCartridge>(pageModel.getSelectedEmbeddableCartridges()),
+ pageModel.getApplication());
+ IStatus result = WizardUtils.runInWizard(job, job.getDelegatingProgressMonitor(),
getContainer(), EMBED_CARTRIDGES_TIMEOUT);
+ if (!result.isOK()) {
+ safeRefreshSelectedEmbeddedCartridges();
+ } else {
+ openLogDialog(job.getAddedCartridges());
+ }
+ return result.isOK();
} catch (Exception e) {
return false;
}
}
-
+
private void openLogDialog(final List<IEmbeddedCartridge> cartridges) {
if (cartridges.size() == 0) {
return;
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -16,18 +16,13 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.express.internal.core.CreateApplicationOperation;
-import org.jboss.tools.openshift.express.internal.core.EmbedCartridgesOperation;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
-import com.openshift.client.ApplicationScale;
import com.openshift.client.IApplication;
import com.openshift.client.ICartridge;
import com.openshift.client.IDomain;
import com.openshift.client.IEmbeddableCartridge;
-import com.openshift.client.IEmbeddedCartridge;
-import com.openshift.client.IGearProfile;
import com.openshift.client.OpenShiftException;
/**
@@ -131,28 +126,9 @@
return getSelectedEmbeddableCartridges();
}
- /**
- * Embeds/removes the cartridges that were added/removed in this wizard
- * page.
- *
- * @return the cartridges that were added (embedded).
- * @throws OpenShiftException
- * @throws SocketTimeoutException
- */
- public List<IEmbeddedCartridge> embedCartridges() throws OpenShiftException,
SocketTimeoutException {
- return new EmbedCartridgesOperation(getApplication())
- .execute(new ArrayList<IEmbeddableCartridge>(selectedCartridges), null);
- }
-
@Override
- public IApplication createJenkinsApplication(String name, IProgressMonitor monitor)
throws OpenShiftException {
- IApplication application =
- new CreateApplicationOperation(wizardModel.getUser()).execute(
- name,
- ICartridge.JENKINS_14,
- ApplicationScale.NO_SCALE,
- IGearProfile.SMALL,
- monitor);
- return application;
+ public UserDelegate getUser() {
+ return wizardModel.getUser();
}
+
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IEmbedCartridgesWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IEmbedCartridgesWizardPageModel.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IEmbedCartridgesWizardPageModel.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -13,9 +13,8 @@
import java.net.SocketTimeoutException;
import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
-import com.openshift.client.IApplication;
import com.openshift.client.IDomain;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.OpenShiftException;
@@ -38,7 +37,6 @@
public boolean isSelected(IEmbeddableCartridge cartridge) throws OpenShiftException,
SocketTimeoutException;
public IDomain getDomain() throws SocketTimeoutException, OpenShiftException;
-
- public IApplication createJenkinsApplication(String name, IProgressMonitor monitor)
throws OpenShiftException, SocketTimeoutException;
+ public UserDelegate getUser();
}
\ No newline at end of file
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-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -12,7 +12,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.net.SocketTimeoutException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@@ -24,7 +23,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -38,20 +36,19 @@
import org.jboss.tools.common.ui.DelegatingProgressMonitor;
import org.jboss.tools.common.ui.JobUtils;
import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.openshift.express.internal.core.EmbedCartridgesOperation;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
import org.jboss.tools.openshift.express.internal.ui.job.AbstractDelegatingMonitorJob;
+import org.jboss.tools.openshift.express.internal.ui.job.CreateApplicationJob;
+import org.jboss.tools.openshift.express.internal.ui.job.EmbedCartridgesJob;
import org.jboss.tools.openshift.express.internal.ui.job.WaitForApplicationJob;
import com.openshift.client.IApplication;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IEmbeddedCartridge;
-import com.openshift.client.OpenShiftEndpointException;
import com.openshift.client.OpenShiftException;
-import com.openshift.client.OpenShiftTimeoutException;
/**
* @author Andre Dietisheim
@@ -61,6 +58,7 @@
private static final int APP_CREATE_TIMEOUT = 2 * 60 * 1000;
private static final int APP_WAIT_TIMEOUT = 2 * 60 * 1000;
+ private static final long EMBED_CARTRIDGES_TIMEOUT = 2 * 60 * 1000;
private static final int IMPORT_TIMEOUT = 1 * 60 * 1000;
private final boolean skipCredentialsPage;
@@ -187,81 +185,37 @@
private boolean createApplication() {
try {
- final String applicationName = wizardModel.getApplicationName();
- AbstractDelegatingMonitorJob job =
- new AbstractDelegatingMonitorJob(
- NLS.bind("Creating application \"{0}\"...",applicationName))
{
-
- @Override
- protected IStatus doRun(DelegatingProgressMonitor monitor) {
- try {
- getWizardModel().createApplication(delegatingMonitor);
- return Status.OK_STATUS;
- } catch (OpenShiftEndpointException e) {
- // TODO: refresh user
- return OpenShiftUIActivator.createErrorStatus(
- "Could not create application \"{0}\": {1}",
- e, applicationName, e.getRestResponseMessages());
- } catch (OpenShiftTimeoutException e) {
- // TODO: refresh user
- return OpenShiftUIActivator.
- createCancelStatus("Could not create application {0}. Connection
timeouted", applicationName);
- } catch (OpenShiftException e) {
- // TODO: refresh user
- return OpenShiftUIActivator.createErrorStatus(
- "Could not create application \"{0}\"", e,
applicationName);
- }
- }
- };
+ CreateApplicationJob job = new CreateApplicationJob(
+ wizardModel.getApplicationName()
+ , wizardModel.getApplicationCartridge()
+ , wizardModel.getApplicationScale()
+ , wizardModel.getApplicationGearProfile()
+ , wizardModel.getUser());
IStatus status = WizardUtils.runInWizard(
job, job.getDelegatingProgressMonitor(), getContainer(), APP_CREATE_TIMEOUT);
+ wizardModel.setApplication(job.getApplication());
return status.isOK();
} catch (Exception e) {
return false;
}
}
- private boolean addRemoveCartridges(final IApplication application,
- final Set<IEmbeddableCartridge> selectedCartridges) {
- try {
- final String applicationName = application.getName();
- IStatus status = WizardUtils.runInWizard(
- new Job(NLS.bind("Adding selected embedded cartridges for application
{0}...", applicationName)) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (selectedCartridges != null && !selectedCartridges.isEmpty()) {
- final List<IEmbeddedCartridge> embeddedCartridges =
- new EmbedCartridgesOperation(application).execute(
- new ArrayList<IEmbeddableCartridge>(selectedCartridges)
- , monitor);
- openCreationLogDialog(embeddedCartridges);
- }
- } catch (OpenShiftEndpointException e) {
- // TODO: refresh user
- return OpenShiftUIActivator.createErrorStatus(NLS.bind(
- "Could not embed cartridges to application {0}: {1}",
applicationName,
- e.getRestResponseMessages()));
- } catch (OpenShiftException e) {
- return OpenShiftUIActivator.createErrorStatus(NLS.bind(
- "Could not embed cartridges to application {0}", getWizardModel()
- .getApplication().getName()), e);
- } catch (SocketTimeoutException e) {
- return OpenShiftUIActivator.createErrorStatus(NLS.bind(
- "Could not embed cartridges to application {0}", getWizardModel()
- .getApplication().getName()), e);
- }
- return Status.OK_STATUS;
- }
- }, getContainer());
- return status.isOK();
- } catch (Exception e) {
- return false;
- }
+ private boolean addRemoveCartridges(final IApplication application,final
Set<IEmbeddableCartridge> selectedCartridges) {
+ try {
+ EmbedCartridgesJob job = new EmbedCartridgesJob(
+ new
ArrayList<IEmbeddableCartridge>(wizardModel.getSelectedEmbeddableCartridges()),
+ wizardModel.getApplication());
+ IStatus result = WizardUtils.runInWizard(job, job.getDelegatingProgressMonitor(),
getContainer(), EMBED_CARTRIDGES_TIMEOUT);
+ if (result.isOK()) {
+ openLogDialog(job.getAddedCartridges());
+ }
+ return result.isOK();
+ } catch (Exception e) {
+ return false;
+ }
}
- private void openCreationLogDialog(final List<IEmbeddedCartridge>
embeddableCartridges) {
+ private void openLogDialog(final List<IEmbeddedCartridge> embeddableCartridges) {
if (embeddableCartridges == null
|| embeddableCartridges.isEmpty()) {
return;
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-05-24
13:11:26 UTC (rev 41352)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-05-24
13:20:19 UTC (rev 41353)
@@ -20,7 +20,6 @@
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.egit.core.EGitUtils;
-import org.jboss.tools.openshift.express.internal.core.CreateApplicationOperation;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
@@ -34,7 +33,6 @@
import com.openshift.client.ICartridge;
import com.openshift.client.IEmbeddableCartridge;
import com.openshift.client.IGearProfile;
-import com.openshift.client.OpenShiftApplicationNotAvailableException;
import com.openshift.client.OpenShiftException;
public class OpenShiftExpressApplicationWizardModel extends ObservableUIPojo implements
IOpenShiftExpressWizardModel {
@@ -372,19 +370,6 @@
}
}
- public IApplication createApplication(IProgressMonitor monitor) throws
OpenShiftApplicationNotAvailableException,
- OpenShiftException {
- IApplication application =
- new CreateApplicationOperation(getUser()).execute(
- getApplicationName(),
- getApplicationCartridge(),
- getApplicationScale(),
- getApplicationGearProfile(),
- monitor);
- setApplication(application);
- return application;
- }
-
@Override
public Set<IEmbeddableCartridge> getSelectedEmbeddableCartridges() {
@SuppressWarnings("unchecked")