Examples of MutableSettings


Examples of org.apache.cocoon.configuration.MutableSettings

     * Otherwise a new root settings object with the running mode is instantiated.
     */
    protected MutableSettings createMutableSettingsInstance() {
        final Settings parentSettings = getParentSettings();
        if (parentSettings == null) {
            return new MutableSettings(getRunningMode());
        }

        return new MutableSettings(parentSettings);
    }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

     * @return A new Settings object
     */
    protected MutableSettings createSettings() {
        final String mode = getRunningMode();
        // create an empty settings objects
        final MutableSettings s = createMutableSettingsInstance();
        // create the initial properties
        final Properties properties = new Properties();

        // invoke pre initialization hook
        preInit(s, properties);

        // check for property providers
        if (this.beanFactory != null && this.beanFactory.containsBean(PropertyProvider.ROLE) ) {
            try {
                final PropertyProvider provider = (PropertyProvider) this.beanFactory.getBean(PropertyProvider.ROLE);
                final Properties providedProperties = provider.getProperties(s, mode, this.getNameForPropertyProvider());
                if (providedProperties != null) {
                    properties.putAll(providedProperties);
                }
            } catch (Exception ignore) {
                this.logger.warn("Unable to get properties from provider.", ignore);
                this.logger.warn("Continuing initialization.");
            }
        }

        // add aditional directories
        if (this.directories != null) {
            final Iterator i = directories.iterator();
            while (i.hasNext()) {
                final String directory = (String) i.next();
                // now read all properties from the properties directory
                ResourceUtils.readProperties(directory, properties, getResourceLoader(), this.resourceFilter, this.logger);
                // read all properties from the mode dependent directory
                ResourceUtils.readProperties(directory + '/' + mode, properties, getResourceLoader(), this.resourceFilter, this.logger);
            }
        }

        // add additional properties
        if (this.additionalProperties != null) {
            PropertyHelper.replaceAll(this.additionalProperties, s);
            properties.putAll(this.additionalProperties);
        }

        // now overwrite with system properties
        try {
            properties.putAll(System.getProperties());
        } catch (SecurityException se) {
            // we ignore this
        }

        // invoke post initialization hook
        postInit(s, properties);

        PropertyHelper.replaceAll(properties, getParentSettings());
        // configure settings
        s.configure(properties);
        s.makeReadOnly();

        return s;
    }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

        return servletContextSettings;
    }

    @Override
    protected MutableSettings createSettings() {
        final MutableSettings s = super.createSettings();

        // first init the work-directory for the logger.
        // this is required if we are running inside a war file!
        File workDir = new File(s.getWorkDirectory());
        workDir.mkdirs();
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Using work-directory " + workDir);
        }

        File cacheDir = new File(s.getCacheDirectory());
        cacheDir.mkdirs();
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Using cache-directory " + cacheDir);
        }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

     * Otherwise a new root settings object with the running mode is instantiated.
     */
    protected MutableSettings createMutableSettingsInstance() {
        final Settings parentSettings = getParentSettings();
        if (parentSettings == null) {
            return new MutableSettings(getRunningMode());
        }

        return new MutableSettings(parentSettings);
    }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

     * @return A new Settings object
     */
    protected MutableSettings createSettings() {
        final String mode = getRunningMode();
        // create an empty settings objects
        final MutableSettings s = createMutableSettingsInstance();
        // create the initial properties
        final Properties properties = new Properties();

        // invoke pre initialization hook
        preInit(s, properties);

        // check for property providers
        if (this.beanFactory != null && this.beanFactory.containsBean(PropertyProvider.ROLE) ) {
            try {
                final PropertyProvider provider = (PropertyProvider) this.beanFactory.getBean(PropertyProvider.ROLE);
                final Properties providedProperties = provider.getProperties(s, mode, this.getNameForPropertyProvider());
                if (providedProperties != null) {
                    properties.putAll(providedProperties);
                }
            } catch (Exception ignore) {
                this.logger.warn("Unable to get properties from provider.", ignore);
                this.logger.warn("Continuing initialization.");
            }
        }

        // add aditional directories
        if (this.directories != null) {
            final Iterator i = directories.iterator();
            while (i.hasNext()) {
                final String directory = (String) i.next();
                // now read all properties from the properties directory
                ResourceUtils.readProperties(directory, properties, getResourceLoader(), this.logger);
                // read all properties from the mode dependent directory
                ResourceUtils.readProperties(directory + '/' + mode, properties, getResourceLoader(), this.logger);
            }
        }

        // add additional properties
        if (this.additionalProperties != null) {
            PropertyHelper.replaceAll(this.additionalProperties, s);
            properties.putAll(this.additionalProperties);
        }

        // now overwrite with system properties
        try {
            properties.putAll(System.getProperties());
        } catch (SecurityException se) {
            // we ignore this
        }

        // invoke post initialization hook
        postInit(s, properties);

        PropertyHelper.replaceAll(properties, getParentSettings());
        // configure settings
        s.configure(properties);
        s.makeReadOnly();

        return s;
    }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

            }
        }
    }

    protected MutableSettings createSettings() {
        final MutableSettings s = super.createSettings();

        // first init the work-directory for the logger.
        // this is required if we are running inside a war file!
        File workDir = new File(s.getWorkDirectory());
        workDir.mkdirs();
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Using work-directory " + workDir);
        }

        File cacheDir = new File(s.getCacheDirectory());
        cacheDir.mkdirs();
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Using cache-directory " + cacheDir);
        }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

     * Otherwise a new root settings object with the running mode is instantiated.
     */
    protected MutableSettings createMutableSettingsInstance() {
        final Settings parentSettings = getParentSettings();
        if (parentSettings == null) {
            return new MutableSettings(getRunningMode());
        }

        return new MutableSettings(parentSettings);
    }
View Full Code Here

Examples of org.apache.cocoon.configuration.MutableSettings

     * @return A new Settings object
     */
    protected MutableSettings createSettings() {
        final String mode = getRunningMode();
        // create an empty settings objects
        final MutableSettings s = createMutableSettingsInstance();
        // create the initial properties
        final Properties properties = new Properties();

        // invoke pre initialization hook
        preInit(s, properties);

        // check for property providers
        if (this.beanFactory != null && this.beanFactory.containsBean(PropertyProvider.ROLE) ) {
            try {
                final PropertyProvider provider = (PropertyProvider) this.beanFactory.getBean(PropertyProvider.ROLE);
                final Properties providedProperties = provider.getProperties(s, mode, this.getNameForPropertyProvider());
                if (providedProperties != null) {
                    properties.putAll(providedProperties);
                }
            } catch (Exception ignore) {
                this.logger.warn("Unable to get properties from provider.", ignore);
                this.logger.warn("Continuing initialization.");
            }
        }

        // add aditional directories
        if (this.directories != null) {
            final Iterator i = directories.iterator();
            while (i.hasNext()) {
                final String directory = (String) i.next();
                // now read all properties from the properties directory
                ResourceUtils.readProperties(directory, properties, getResourceLoader(), this.resourceFilter, this.logger);
                // read all properties from the mode dependent directory
                ResourceUtils.readProperties(directory + '/' + mode, properties, getResourceLoader(), this.resourceFilter, this.logger);
            }
        }

        // add additional properties
        if (this.additionalProperties != null) {
            PropertyHelper.replaceAll(this.additionalProperties, s);
            properties.putAll(this.additionalProperties);
        }

        // now overwrite with system properties
        try {
            properties.putAll(System.getProperties());
        } catch (SecurityException se) {
            // we ignore this
        }

        // invoke post initialization hook
        postInit(s, properties);

        PropertyHelper.replaceAll(properties, getParentSettings());
        // configure settings
        s.configure(properties);
        s.makeReadOnly();

        return s;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.