Created
March 16, 2016 19:48
-
-
Save fbricon/d96354b617d2042da045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.jboss.tools.openshift.core.server.behavior; | |
import org.eclipse.wst.server.core.IModule; | |
import org.eclipse.wst.server.core.IServerAttributes; | |
import org.jboss.ide.eclipse.as.wtp.core.server.behavior.ISubsystemController; | |
import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities; | |
import org.jboss.tools.as.core.internal.modules.ModuleDeploymentPrefsUtil; | |
import org.jboss.tools.as.core.server.controllable.subsystems.internal.ModuleDeployPathController; | |
import org.jboss.tools.openshift.core.server.OpenShiftServerUtils; | |
public class OpenShiftEapDeployPathController extends ModuleDeployPathController implements ISubsystemController, IOpenShiftModuleFinder { | |
interface IOpenShiftModuleFinder { | |
IModule getProjectModule(IServer server); | |
} | |
public OpenShiftEapDeployPathController() { | |
super(); | |
} | |
@Override | |
protected ModuleDeploymentPrefsUtil createModuleDeploymentPrefsUtil() { | |
return new OpenShiftModuleDeploymentPrefsUtil(this); | |
} | |
public IModule getProjectModule(IServer server) { | |
return OpenShiftServerUtils.findProjectModule(OpenShiftServerUtils.getDeployProject(server)); | |
} | |
public static class OpenShiftModuleDeploymentPrefsUtil extends ModuleDeploymentPrefsUtil { | |
OpenShiftModuleDeploymentPrefsUtil(IOpenShiftModuleFinder moduleFinder) { | |
this.moduleFinder = moduleFinder; | |
} | |
// We must override the presumed name given to the module upon publish if it is our magic project | |
protected String getOutputNameFromSettings(IServerAttributes server, IModule module) { | |
String ret = super.getOutputNameFromSettings(server, module); | |
if( ret == null && module.equals(moduleFinder.getProjectModule(server))) { | |
String suffix = ServerModelUtilities.getDefaultSuffixForModule(module); | |
ret = "ROOT" + suffix; | |
} | |
return ret; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment