Author: rob.stryker(a)jboss.com
Date: 2011-10-12 10:57:03 -0400 (Wed, 12 Oct 2011)
New Revision: 35573
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
Log:
JBIDE-9793 - removed NPE for server trying to start, updated one of the data models to
have a hashmap, log an error, etc
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java 2011-10-12
14:44:01 UTC (rev 35572)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressBehaviourDelegate.java 2011-10-12
14:57:03 UTC (rev 35573)
@@ -3,6 +3,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.IJBossBehaviourDelegate;
@@ -56,8 +57,7 @@
@Override
public IStatus canChangeState(String launchMode) {
- // TODO Auto-generated method stub
- return null;
+ return Status.CANCEL_STATUS;
}
@Override
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2011-10-12
14:44:01 UTC (rev 35572)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2011-10-12
14:57:03 UTC (rev 35573)
@@ -5,7 +5,9 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerAttributes;
+import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
import org.jboss.ide.eclipse.as.core.util.ServerCreationUtils;
@@ -94,7 +96,8 @@
*/
public static IServer createAS7OpenshiftServer(
String host, String username, String password,
- String domain, String app, String sourceOrBinary,
+ String domain, String app,
+ String sourceOrBinary,
String localRuntimeHomeDir) throws CoreException {
IServer server = createServerAndRuntime(IJBossToolingConstants.AS_70,
IJBossToolingConstants.SERVER_AS_70,
@@ -138,15 +141,16 @@
* @throws CoreException
*/
public static IServer fillServerWithOpenshiftDetails(IServer server,
- String host, String username, String password,
- String domain, String app, String sourceOrBinary) throws CoreException {
+ String host, String username, String password, String domain, String app,
+ String mode) throws CoreException {
IServerWorkingCopy wc = server.createWorkingCopy();
wc.setHost(host);
+ wc.setAttribute(IDeployableServer.SERVER_MODE, "openshift");
wc.setAttribute(ATTRIBUTE_USERNAME, username);
wc.setAttribute(ATTRIBUTE_PASSWORD, password);
wc.setAttribute(ATTRIBUTE_DOMAIN, domain);
wc.setAttribute(ATTRIBUTE_APPLICATION, app);
- wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, sourceOrBinary);
+ wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, mode);
return wc.save(true, new NullProgressMonitor());
}
@@ -160,5 +164,9 @@
public static IServer createServer(IRuntime runtime, String serverID) throws
CoreException {
return ServerCreationUtils.createServer2(runtime, serverID);
}
+
+ public static IServer createServer(IRuntime runtime, IServerType serverType, String
serverName) throws CoreException {
+ return ServerCreationUtils.createServer2(runtime, serverType, serverName);
+ }
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-12
14:44:01 UTC (rev 35572)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-12
14:57:03 UTC (rev 35573)
@@ -15,6 +15,7 @@
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.core.resources.IProject;
@@ -51,23 +52,33 @@
*/
public class ServerAdapterWizardModel extends ObservableUIPojo {
- private IUser user;
- private IApplication application;
+ private HashMap<String, Object> dataModel = new HashMap<String, Object>();
+ private static final String USER = "user";
+ private static final String APPLICATION = "application";
+
+ public void setProperty(String key, Object value) {
+ dataModel.put(key, value);
+ }
+
+ public Object getProperty(String key) {
+ return dataModel.get(key);
+ }
+
public void setUser(IUser user) {
- this.user = user;
+ dataModel.put(USER, user);
}
public IUser getUser() {
- return user;
+ return (IUser) dataModel.get(USER);
}
public IApplication getApplication() {
- return application;
+ return (IApplication)dataModel.get(APPLICATION);
}
public void setApplication(IApplication application) {
- this.application = application;
+ dataModel.put(APPLICATION, application);
}
public void importProject(File projectFolder, IProgressMonitor monitor) throws
OpenshiftException, CoreException, InterruptedException {
@@ -97,8 +108,8 @@
public File cloneRepository(IProgressMonitor monitor) throws URISyntaxException,
OpenshiftException,
InvocationTargetException,
InterruptedException {
- File destination = getDestinationDirectory(application);
- cloneRepository(application.getGitUri(), destination, monitor);
+ File destination = getDestinationDirectory(getApplication());
+ cloneRepository(getApplication().getGitUri(), destination, monitor);
return destination;
}