/** * Return the key to use for the given server type. * * @param type the server type * @param isLocalhost true if the server is local * @return the key */ private String getKey(IServerType type, boolean isLocalhost) { return type.getId() + "|" + isLocalhost + "|"; }
/** * Sort two server types. * * @param s1 the first server type * @param s2 the second server type * @return a negative number if the first element is less than the * second element; the value <code>0</code> if the first element is * equal to the second element; and a positive number if the first * element is greater than the second element */ protected int compareServerTypes(IServerType s1, IServerType s2) { IRuntimeType r1 = s1.getRuntimeType(); IRuntimeType r2 = s2.getRuntimeType(); if (r1 != null && r2 != null) { if (isSameFamily(s1.getName(), r1.getVersion(), s2.getName(), r2.getVersion())) return compareVersions(r1.getVersion(), r2.getVersion()); } return s1.getName().compareToIgnoreCase(s2.getName()); } }
/** * Get a server of the given type. */ protected IServerWorkingCopy getServer() { if (serverType == null || runtime == null || !serverType.hasRuntime()) return null; IServerWorkingCopy server = (IServerWorkingCopy) serverCache.get(runtime); if (server != null) return server; try { server = serverType.createServer(null, null, runtime, null); if (server != null) { server.setHost("localhost"); ServerUtil.setServerDefaultName(server); serverCache.put(runtime, server); return server; } } catch (CoreException ce) { Trace.trace(Trace.SEVERE, "Error creating server", ce); } return null; }
protected boolean matchesServerType(IServerType st) { String text = st.getDescription(); if (wordMatches(text)) return true; if (st.getRuntimeType() != null && matchesRuntimeType(st.getRuntimeType())) return true; return false; }
for (int j=0; j<rts.length; j++) if (st == null || st.getRuntimeType() == null) break; org.eclipse.wst.server.core.IRuntime rt = rts[j]; String serverTypeRuntimeTypeId = st.getRuntimeType().getId(); if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId)) if (!fids.contains(st.getId())) fids.add(st.getId());
protected boolean include(IServerType serverType) { if (serverTypeId != null && !serverType.getId().startsWith(serverTypeId)) return false; IRuntimeType runtimeType = serverType.getRuntimeType(); if (runtimeType == null) return false; String moduleTypeId = null; if (moduleType != null) moduleTypeId = moduleType.getId(); if (includeIncompatibleVersions) { if (!ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), moduleTypeId, null)) return false; } else { String moduleVersion = null; if (moduleType != null) moduleVersion = moduleType.getVersion(); if (!ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), moduleTypeId, moduleVersion)) return false; } if (localhost || serverType.supportsRemoteHosts()) return true; return false; }
IServerWorkingCopy server = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER); if (server != null) { if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) { ServerWorkingCopy swc = (ServerWorkingCopy) server; try { sub = getWizardFragment(server.getServerType().getId()); if (sub != null) list.add(sub);
protected static IServerType getCompatibleServerType(IRuntimeType runtimeType) { List list = new ArrayList(); IServerType[] serverTypes = ServerCore.getServerTypes(); int size = serverTypes.length; for (int i = 0; i < size; i++) { IRuntimeType rt = serverTypes[i].getRuntimeType(); if (rt != null && rt.equals(runtimeType)) list.add(serverTypes[i]); } if (list.size() == 1) return (IServerType) list.get(0); return null; }
if (server != null && server.getServerType() != null && server.getServerType().hasRuntime()) { final IRuntime runtime = server.getRuntime(); createLabel(toolkit, composite, Messages.serverEditorOverviewRuntime); IRuntimeType runtimeType = server.getServerType().getRuntimeType(); runtimes = ServerUIPlugin.getRuntimes(runtimeType); if (server != null && server.getServerType() != null && server.getServerType().hasServerConfiguration()) { createLabel(toolkit, composite, Messages.serverEditorOverviewServerConfigurationPath); if (serverType.supportsLaunchMode(ILaunchManager.RUN_MODE) || serverType.supportsLaunchMode(ILaunchManager.DEBUG_MODE) || serverType.supportsLaunchMode(ILaunchManager.PROFILE_MODE)) { ILaunchConfigurationType launchType = ((ServerType) serverType).getLaunchConfigurationType(); if (launchType != null && launchType.isPublic()) {
/** * */ protected String getTextImpl(Object element) { IServerType type = (IServerType) element; return notNull(type.getName()); } }
protected void updateRuntimeCombo(IServerType serverType) { if (serverType == null || !serverType.hasRuntime() || server == null) { if (runtimeLabel != null) { runtimeLabel.setEnabled(false); IRuntimeType runtimeType = serverType.getRuntimeType(); boolean showRuntime = ServerUIPlugin.getRuntimes(runtimeType).length >=1; runtimeCombo.setEnabled(showRuntime);
for (int i = 0; i < size && !found; i++) { IServerType type = serverTypes[i]; IModuleType[] moduleTypes = type.getRuntimeType().getModuleTypes(); if (type.supportsLaunchMode(launchMode) && ServerUtil.isSupportedModule(moduleTypes, module.getModuleType())) { found = true;
/** * Returns a server, from the cache if possible and otherwise by creating * * @param type the server type * @param isLocalhost true if the server is local * @param monitor a progress monitor * @return a server working copy * @throws CoreException if anything goes wrong */ public IServerWorkingCopy getServer(IServerType type, boolean isLocalhost, IProgressMonitor monitor) throws CoreException { IServerWorkingCopy server = getCachedServer(type, isLocalhost); if (server != null) return server; server = type.createServer(null, null, (IRuntime)null, monitor); cache.put(getKey(type, isLocalhost), server); return server; }
ServerUtil.setServerDefaultName(server); if (serverType.hasRuntime() && server.getRuntime() == null) { runtime = null; updateRuntimes(serverType); setRuntime(getDefaultRuntime()); if (server.getServerType() != null && server.getServerType().hasServerConfiguration() && !runtime.getLocation().isEmpty()) ((ServerWorkingCopy)server).importRuntimeConfiguration(runtime, null);
protected void handleServer() { boolean option = false; if (serverType != null && serverType.hasRuntime()) option = true; createServer.setVisible(option); if (option && createServer.getSelection()) { IServerWorkingCopy server = getServer(); taskModel.putObject(TaskModel.TASK_SERVER, server); } else taskModel.putObject(TaskModel.TASK_SERVER, null); taskModel.putObject(TaskModel.TASK_RUNTIME, runtime); wizard.update(); }
public void selectionChanged(SelectionChangedEvent event) { Object obj = getSelection(event.getSelection()); if (obj instanceof IServerType) { selection = (IServerType) obj; setDescription(selection.getDescription()); } else { selection = null; setDescription(""); } listener.serverTypeSelected(selection); } });
IRuntimeType thisServerTypeRuntimeType = thisServerType.getRuntimeType(); if (thisServerTypeRuntimeType != null && thisServerType.getId().equals(preferredServerFactoryId)) if (thisServerType != null) IRuntimeType thisServerTypeRuntimeType = thisServerType.getRuntimeType(); if (sRuntimeType != null && thisServerTypeRuntimeType != null && thisServerTypeRuntimeType.getId().equals(sRuntimeType.getId()))
if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) { ServerWorkingCopy swc = (ServerWorkingCopy) server; if (swc != null && runtime != null && runtime.getLocation() != null && !runtime.getLocation().isEmpty()) { runtimeLocation = null; WizardFragment sub = getWizardFragment(server.getServerType().getId()); if (sub != null) list.add(sub);
protected boolean hasRuntime(IServerType serverType) { return hasRuntime(serverType.getRuntimeType()); }
@Override public void setDefaults(IProgressMonitor monitor) { super.setDefaults(monitor); String typeName = CloudFoundryBrandingExtensionPoint.getServerDisplayName(serverTypeId); if (typeName == null || typeName.trim().length() == 0) { typeName = getServer().getServerType().getName(); } String name = typeName; int i = 2; while (ServerPlugin.isNameInUse(getServerWorkingCopy().getOriginal(), name)) { name = NLS.bind("{0} ({1})", new String[] { typeName, String.valueOf(i) }); //$NON-NLS-1$ i++; } getServerWorkingCopy().setName(name); getServerWorkingCopy().setHost("Cloud"); //$NON-NLS-1$ setAttribute("auto-publish-setting", 1); //$NON-NLS-1$ }