public static IServerWorkingCopy createServerForRuntime(IRuntime runtime) { for (IServerType serverType : ServerCore.getServerTypes()) { if (serverType.getRuntimeType().equals(runtime.getRuntimeType())) { try { return serverType.createServer("server", null, runtime, null); } catch (CoreException e) { } } } return null; }
/** * Check if the server type is a Cloud Foundry-based server type * * @param serverType * @return true if it is a Cloud Foundry server type */ public static boolean isCloudFoundryServerType(IServerType serverType) { if (serverType != null) { String serverId = serverType.getId(); return CloudFoundryBrandingExtensionPoint.getServerTypeIds().contains(serverId); } return false; }
@Test public void testServerHomeSet() { assertNotNull(typeId); IServerType type = ServerCore.findServerType(typeId); if (type != null) { if (type.getRuntimeType() == null) fail("Server type " + typeId + " does not have an associated runtime"); String rtType = type.getRuntimeType().getId(); if (rtType == null) { fail("Runtime type for servertype " + typeId + " has a null id."); } assertTrue(Arrays.asList(IJBossToolingConstants.ALL_JBOSS_RUNTIMES).contains(rtType)); } else { IRuntimeType t = ServerCore.findRuntimeType(typeId); assertNotNull(t); assertTrue(Arrays.asList(IJBossToolingConstants.ALL_JBOSS_RUNTIMES).contains(typeId)); } }
private static String getDriverPath(String jbossASLocation, IServerType serverType) throws IOException { Pair pair = SERVER_DRIVER_LOCATION.get(serverType.getId()); String loc = pair.loc; IPath p = new Path(jbossASLocation).append(loc); File f = p.toFile().getCanonicalFile(); if (f.isDirectory()) { File[] fileList = f.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name.endsWith(".jar")) { // $NON-NLS-1$ //$NON-NLS-2$ return true; } return false; } }); if (fileList != null && fileList.length > 0) { return fileList[0].getCanonicalPath(); } } return f.getCanonicalPath(); }
private static boolean usesH2(IServerType serverType) { return SERVER_DRIVER_LOCATION.get(serverType.getId()) != null && SERVER_DRIVER_LOCATION.get(serverType.getId()).type == H2_TYPE; }