/** * Returns if class is in compile classpath. * @param all True if all of them must be there. * @param clazz fully qualified class name. * @return True if present, false otherwise. */ public boolean isClassInCompileClasspath(boolean all, String... clazz) { if (all) { return hasAllClasses(clazz); } else { return hasAnyClass(clazz); } }
protected Probe discoverSpringBootHealthCheck(Integer initialDelay, Integer period, Integer timeout, Integer failureTh, Integer successTh) { try { if (getContext().getProjectClassLoaders().isClassInCompileClasspath(true, REQUIRED_CLASSES)) { Properties properties = SpringBootUtil.getSpringBootApplicationProperties(getContext().getProjectClassLoaders().getCompileClassLoader()); return buildProbe(properties, initialDelay, period, timeout, failureTh, successTh); } } catch (Exception ex) { log.error("Error while reading the spring-boot configuration", ex); } return null; }
protected String detectDefaultDashboard() { String dashboard = getConfig(Config.metricsDashboard); if (StringUtils.isNotBlank(dashboard)) { return dashboard; } if (getContext().getProjectClassLoaders().isClassInCompileClasspath(false,"org.apache.camel.CamelContext")) { return "camel-routes.json"; } return "kubernetes-pods.json"; }
private InputStream loadPluginResource(String iconRef) { InputStream answer = Thread.currentThread().getContextClassLoader().getResourceAsStream(iconRef); if (answer == null) { answer = getContext().getProjectClassLoaders().getCompileClassLoader().getResourceAsStream(iconRef); } if (answer == null) { answer = this.getClass().getResourceAsStream(iconRef); } return answer; }
@Override public ProjectClassLoaders getProjectClassLoaders() { return new ProjectClassLoaders(MavenUtil.getCompileClassLoader(getProject()) ); }
if (cls.isClassInCompileClasspath(false, "io.fabric8.funktion.runtime.Main") || getContext().hasDependency( "io.fabric8.funktion", null)) { return "funktion"; if (cls.isClassInCompileClasspath(false, "org.apache.camel.CamelContext")) { return "camel"; cls.isClassInCompileClasspath(false, "org.springframework.boot.SpringApplication")) { return "spring-boot"; if (cls.isClassInCompileClasspath(false, "org.springframework.core.Constants")) { return "spring"; if (cls.isClassInCompileClasspath(false, "org.vertx.java.core.Handler", "io.vertx.core.Handler")) { return "vertx";
protected int getPort() { final Properties properties = ThorntailUtil.getThorntailProperties(getContext().getProjectClassLoaders().getCompileClassLoader()); properties.putAll(System.getProperties()); if (properties.containsKey("thorntail.http.port")) { return Integer.parseInt((String) properties.get("thorntail.http.port")); } return Configs.asInt(getConfig(Config.port)); }