public static CamelQuarkusExtension read()

in tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/CamelQuarkusExtension.java [44:104]


    public static CamelQuarkusExtension read(Path runtimePomXmlPath) {
        try (Reader runtimeReader = Files.newBufferedReader(runtimePomXmlPath, StandardCharsets.UTF_8)) {
            final MavenXpp3Reader rxppReader = new MavenXpp3Reader();
            final Model runtimePom = rxppReader.read(runtimeReader);
            final List<Dependency> deps = runtimePom.getDependencies();

            final String aid = runtimePom.getArtifactId();
            String camelComponentArtifactId = null;
            if (deps != null && !deps.isEmpty()) {
                Optional<Dependency> artifact = deps.stream()
                        .filter(dep ->

                        "org.apache.camel".equals(dep.getGroupId()) &&
                                ("compile".equals(dep.getScope()) || dep.getScope() == null))
                        .findFirst();
                if (artifact.isPresent()) {
                    camelComponentArtifactId = CqCatalog.toCamelComponentArtifactIdBase(artifact.get().getArtifactId());
                }
            }
            final Properties props = runtimePom.getProperties() != null ? runtimePom.getProperties() : new Properties();

            String name = props.getProperty("title");
            if (name == null) {
                name = CqUtils.getNameBase(runtimePom.getName());
            }

            final String version = CqUtils.getVersion(runtimePom);
            final boolean nativeSupported = !runtimePomXmlPath.getParent().getParent().getParent().getFileName().toString()
                    .endsWith("-jvm");
            final String extensionStatus = props.getProperty("quarkus.metadata.status");
            final ExtensionStatus status = extensionStatus == null ? ExtensionStatus.of(nativeSupported)
                    : ExtensionStatus.valueOf(extensionStatus);
            final boolean unlisted = !nativeSupported
                    || Boolean.parseBoolean(props.getProperty("quarkus.metadata.unlisted", "false"));
            final boolean deprecated = Boolean.parseBoolean(props.getProperty("quarkus.metadata.deprecated", "false"));

            final String rawKind = (String) props.get(CAMEL_QUARKUS_KIND);
            final Kind kind = rawKind == null ? null : Kind.valueOf(rawKind);

            return new CamelQuarkusExtension(
                    runtimePomXmlPath,
                    camelComponentArtifactId,
                    (String) props.get(CAMEL_QUARKUS_JVM_SINCE),
                    (String) props.get(CAMEL_QUARKUS_NATIVE_SINCE),
                    aid,
                    name,
                    runtimePom.getDescription(),
                    props.getProperty("label"),
                    version,
                    nativeSupported,
                    status,
                    unlisted,
                    deprecated,
                    deps == null ? Collections.emptyList() : Collections.unmodifiableList(deps),
                    kind,
                    props.getProperty("cq.quarkus.aws.client.baseName"),
                    props.getProperty("cq.quarkus.aws.client.fqClassName"));
        } catch (IOException | XmlPullParserException e) {
            throw new RuntimeException("Could not read " + runtimePomXmlPath, e);
        }
    }