public ApiRegions getApiRegions()

in src/main/java/org/apache/sling/feature/maven/mojos/apis/RegionSupport.java [78:124]


    public ApiRegions getApiRegions(final Feature feature) throws MojoExecutionException {
        ApiRegions regions = new ApiRegions();

        final ApiRegions sourceRegions;
        try {
            sourceRegions = ApiRegions.getApiRegions(feature);
        } catch (final IllegalArgumentException iae) {
            throw new MojoExecutionException(iae.getMessage(), iae);
        }
        if (sourceRegions != null) {
            // calculate all api-regions first, taking the inheritance in account
            for (final ApiRegion r : sourceRegions.listRegions()) {
                if (r.getParent() != null && !this.incrementalApis) {
                    for (final ApiExport exp : r.getParent().listExports()) {
                        r.add(exp);
                    }
                }
                if (isRegionIncluded(r.getName())) {
                    log.debug("API Region " + r.getName()
                            + " will not processed due to the configured include/exclude list");
                    regions.add(r);
                }
            }

            if (regions.isEmpty()) {
                log.info("Feature file " + feature.getId().toMvnId()
                        + " has no included api regions, no API JAR will be created");
                regions = null;
            }
        } else {
            // create exports on the fly
            regions.add(new ApiRegion(ApiRegion.GLOBAL) {

                @Override
                public ApiExport getExportByName(final String name) {
                    ApiExport exp = super.getExportByName(name);
                    if (exp == null) {
                        exp = new ApiExport(name);
                        this.add(exp);
                    }
                    return exp;
                }
            });
        }

        return regions;
    }