protected MavenProject getProject() { if (buildContext != null) { return buildContext.getProject(); } return null; }
private boolean debugEnabled() { MavenProject project = getContext().getProject(); if (project != null) { String value = project.getProperties().getProperty(ENABLE_DEBUG_MAVEN_PROPERTY); if (isTrueFlag(value)) { return true; }; } return isTrueFlag(System.getProperty(ENABLE_DEBUG_MAVEN_PROPERTY)); }
private boolean debugEnabled() { MavenProject project = getContext().getProject(); if (project != null) { String value = project.getProperties().getProperty(ENABLE_DEBUG_MAVEN_PROPERTY); if (isTrueFlag(value)) { return true; }; } return isTrueFlag(System.getProperty(ENABLE_DEBUG_MAVEN_PROPERTY)); }
private Optional<Xpp3Dom> getElement(String... path) { Plugin plugin = getContext().getProject().getPlugin("io.fabric8:fabric8-maven-plugin"); if (plugin == null) { getLog().warn("Unable to find the fabric8-maven-plugin in the project, weird..."); return Optional.absent(); } Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); if (configuration == null) { return Optional.absent(); } String[] roots = new String[]{"enricher", "config", "vertx-health-check"}; List<String> absolute = new ArrayList<>(); absolute.addAll(Arrays.asList(roots)); absolute.addAll(Arrays.asList(path)); Xpp3Dom root = configuration; for (String key : absolute) { root = root.getChild(key); if (root == null) { return Optional.absent(); } } return Optional.of(root); }
private void addArtifactsWithYaml(EnricherContext buildContext, Set<URL> artifactSet, String dependencyYaml) { Set<Artifact> artifacts = isIncludeTransitive() ? buildContext.getProject().getArtifacts() : buildContext.getProject().getDependencyArtifacts(); for (Artifact artifact : artifacts) { if (Artifact.SCOPE_COMPILE.equals(artifact.getScope()) && "jar".equals(artifact.getType())) { File file = artifact.getFile(); try { URL url = new URL("jar:" + file.toURI().toURL() + "!/" + dependencyYaml); artifactSet.add(url); } catch (MalformedURLException e) { getLog().debug("Failed to create URL for %s: %s", file, e); } } } // lets look on the current plugin classpath too if (isIncludePlugin()) { Enumeration<URL> resources = null; try { resources = getClass().getClassLoader().getResources(dependencyYaml); } catch (IOException e) { getLog().error("Could not find %s on the classpath: %s", dependencyYaml, e); } if (resources != null) { while (resources.hasMoreElements()) { URL url = resources.nextElement(); artifactSet.add(url); } } } }
public BaseEnricher(EnricherContext buildContext, String name) { this.buildContext = buildContext; // Pick the configuration which is for us this.config = new EnricherConfig(buildContext.getProject().getProperties(), name, buildContext.getConfig()); this.log = new PrefixedLogger(name, buildContext.getLog()); this.name = name; }
private Optional<String> getStringValue(String attribute, boolean readiness) { String specific = getSpecificPropertyName(readiness, attribute); String generic = VERTX_HEALTH + attribute; // Check if we have the specific user property. String property = getContext().getProject().getProperties().getProperty(specific); if (property != null) { return Optional.of(property).transform(TRIM); } property = getContext().getProject().getProperties().getProperty(generic); if (property != null) { return Optional.of(property).transform(TRIM); } String[] specificPath = new String[]{ readiness ? "readiness" : "liveness", attribute }; Optional<String> config = getValueFromConfig(specificPath).transform(TRIM); if (!config.isPresent()) { // Generic path. return getValueFromConfig(attribute).transform(TRIM); } else { return config; } }
public DefaultControllerEnricher(EnricherContext buildContext) { super(buildContext, "fmp-controller"); HandlerHub handlers = new HandlerHub(buildContext.getProject()); rcHandler = handlers.getReplicationControllerHandler(); rsHandler = handlers.getReplicaSetHandler(); deployHandler = handlers.getDeploymentHandler(); statefulSetHandler = handlers.getStatefulSetHandler(); daemonSetHandler = handlers.getDaemonSetHandler(); jobHandler = handlers.getJobHandler(); }
protected Probe buildProbe(Properties springBootProperties, Integer initialDelay, Integer period, Integer timeout) { SpringBootConfigurationHelper propertyHelper = new SpringBootConfigurationHelper(SpringBootUtil.getSpringBootVersion(getContext().getProject())); Integer managementPort = PropertiesHelper.getInteger(springBootProperties, propertyHelper.getManagementPortPropertyKey()); boolean usingManagementPort = managementPort != null;