private List buildResourceRefs()

in src/main/java/org/apache/maven/plugins/ear/GenerateApplicationXmlMojo.java [407:444]


    private List<ResourceRef> buildResourceRefs() throws EarPluginException {
        final List<ResourceRef> result = new ArrayList<>();
        if (resourceRefs == null) {
            return result;
        }
        try {
            getLog().debug("Resources found");
            StringSearchInterpolator ssi = new StringSearchInterpolator();
            ValueSource vs = new MapBasedValueSource(project.getProperties());
            ssi.addValueSource(vs);

            // TODO: Check if this is a good idea hard code that here? Better idea?
            final PlexusConfiguration[] allResourceRefEntries = resourceRefs.getChildren("resourceRef");

            getLog().debug("allResourceRefEntries length: " + allResourceRefEntries.length);
            for (PlexusConfiguration resEntry : allResourceRefEntries) {
                getLog().debug("Resources resEntry:" + resEntry.getName());

                final String childResRefName = interpolate(
                        ssi, resEntry.getChild(ResourceRef.RESOURCE_REF_NAME).getValue());
                final String childResType = interpolate(
                        ssi, resEntry.getChild(ResourceRef.RESOURCE_TYPE).getValue());
                final String childResRefAuth = interpolate(
                        ssi, resEntry.getChild(ResourceRef.RESOURCE_AUTH).getValue());
                final String childResRefLookupName = interpolate(
                        ssi, resEntry.getChild(ResourceRef.LOOKUP_NAME).getValue());

                try {
                    result.add(new ResourceRef(childResRefName, childResType, childResRefAuth, childResRefLookupName));
                } catch (IllegalArgumentException e) {
                    throw new EarPluginException("Invalid resource-ref [" + resEntry + "]", e);
                }
            }
            return result;
        } catch (InterpolationException e) {
            throw new EarPluginException("Interpolation exception:", e);
        }
    }