private void readSlingProperties()

in src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java [396:436]


    private void readSlingProperties(final File propsFile, final int mode) throws MojoExecutionException {
        if (propsFile.exists()) {
            File tmp = null;
            try {
                tmp = File.createTempFile("sling", "props");
                mavenFileFilter.copyFile(propsFile, tmp, true, project, Collections.EMPTY_LIST, true,
                        System.getProperty("file.encoding"), mavenSession);
                final Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
                if ( mode == 0 ) {
                    if ( this.slingProperties == null ) {
                        this.slingProperties = loadedProps;
                    } else {
                        this.copyProperties(loadedProps, this.slingProperties);
                    }
                    filterProperties(this.slingProperties);
                } else if ( mode == 1 ) {
                    if ( this.slingWebappProperties == null ) {
                        this.slingWebappProperties = loadedProps;
                    } else {
                        this.copyProperties(loadedProps, this.slingWebappProperties);
                    }
                    filterProperties(this.slingWebappProperties);
                } else {
                    if ( this.slingStandaloneProperties == null ) {
                        this.slingStandaloneProperties = loadedProps;
                    } else {
                        this.copyProperties(loadedProps, this.slingStandaloneProperties);
                    }
                    filterProperties(this.slingStandaloneProperties);
                }
            } catch (IOException e) {
                throw new MojoExecutionException("Unable to create filtered properties file", e);
            } catch (MavenFilteringException e) {
                throw new MojoExecutionException("Unable to create filtered properties file", e);
            } finally {
                if (tmp != null) {
                    tmp.delete();
                }
            }
        }
    }