Package org.rhq.core.domain.common.composite

Examples of org.rhq.core.domain.common.composite.SystemSettings


        }
    }

    @Override
    public SystemSettings getObfuscatedSystemSettings(boolean includePrivateSettings) {
        SystemSettings ret = getCachedObfuscatedSettings();

        return includePrivateSettings ? ret : removePrivateSettings(ret);
    }
View Full Code Here


    public void setAnySystemSetting(SystemSetting setting, String value) {
        if (SystemSetting.LAST_SYSTEM_CONFIG_UPDATE_TIME == setting) {
            return;
        }

        SystemSettings settings = getUnmaskedSystemSettings(true);
        settings.put(setting, value);
        setAnySystemSettings(settings, true, true);
    }
View Full Code Here

        settings.put(setting, value);
        setAnySystemSettings(settings, true, true);
    }

    private SystemSettings removePrivateSettings(SystemSettings settings) {
        SystemSettings cleansed = new SystemSettings(settings);
        for (SystemSetting s : SystemSetting.values()) {
            if (!s.isPublic()) {
                cleansed.remove(s);
            }
        }
        return cleansed;
    }
View Full Code Here

    public void setSystemConfiguration(Subject subject, Properties properties, boolean skipValidation) throws Exception {
        Map<String, String> map = toMap(properties);

        transformToSystemSettingsFormat(map);

        SystemSettings settings = SystemSettings.fromMap(map);

        setAnySystemSettings(settings, skipValidation, false);
    }
View Full Code Here

        throws InvalidSystemConfigurationException {
        Map<String, String> map = toMap(properties);

        transformToSystemSettingsFormat(map);

        SystemSettings settings = SystemSettings.fromMap(map);
        for (Map.Entry<SystemSetting, String> e : settings.entrySet()) {
            SystemSetting prop = e.getKey();
            String value = e.getValue();

            verifyNewSystemConfigurationProperty(prop, value, settings);
        }
View Full Code Here

        }
    }

    @Override
    public boolean isLdapAuthorizationEnabled() {
        SystemSettings settings = getUnmaskedSystemSettings(true);

        String ldapAuthValue = settings.get(SystemSetting.LDAP_BASED_JAAS_PROVIDER);

        boolean ldapAuth = ldapAuthValue == null ? false : Boolean.valueOf(ldapAuthValue);

        String groupFilter = settings.get(SystemSetting.LDAP_GROUP_FILTER);
        String groupMember = settings.get(SystemSetting.LDAP_GROUP_MEMBER);

        return ldapAuth
            && (((groupFilter != null) && groupFilter.trim().length() > 0) || ((groupMember != null) && groupMember
                .trim().length() > 0));
    }
View Full Code Here

    private synchronized SystemSettings getCachedSettings() {
        if (cachedSystemSettings == null) {
            loadSystemConfigurationCache();
        }

        return new SystemSettings(cachedSystemSettings);
    }
View Full Code Here

    private synchronized SystemSettings getCachedObfuscatedSettings() {
        if (cachedSystemSettings == null) {
            loadSystemConfigurationCache();
        }

        return new SystemSettings(cachedObfuscatedSystemSettings);
    }
View Full Code Here

        return new SystemSettings(cachedObfuscatedSystemSettings);
    }

    private void fillCache(Collection<SystemConfiguration> configs) {
        SystemSettings settings = new SystemSettings();

        for (SystemConfiguration config : configs) {
            SystemSetting prop = SystemSetting.getByInternalName(config.getPropertyKey());
            if (prop == null) {
                LOG.warn("The database contains unknown system configuration setting [" + config.getPropertyKey()
                    + "].");
                continue;
            }

            if (config.getPropertyValue() == null) {
                // for some reason, the configuration is not found in the DB, so fallback to the persisted default.
                // if there isn't even a persisted default, just use an empty string.
                String defaultValue = config.getDefaultPropertyValue();
                defaultValue = transformSystemConfigurationPropertyFromDb(prop, defaultValue, true);
                settings.put(prop, defaultValue);
            } else {
                String value = config.getPropertyValue();
                value = transformSystemConfigurationPropertyFromDb(prop, value, true);
                settings.put(prop, value);
            }
        }

        settings.setDriftPlugins(getDriftServerPlugins());

        synchronized (this) {
            //only update the caches if the settings were actually changed
            if (cachedSystemSettings == null
                || !safeEquals(cachedSystemSettings.get(SystemSetting.LAST_SYSTEM_CONFIG_UPDATE_TIME),
                    settings.get(SystemSetting.LAST_SYSTEM_CONFIG_UPDATE_TIME))) {
                cachedSystemSettings = settings;

                cachedObfuscatedSystemSettings = new SystemSettings(settings);
                for (Map.Entry<SystemSetting, String> entry : cachedObfuscatedSystemSettings.entrySet()) {
                    String value = entry.getValue();
                    if (value != null && entry.getKey().getType() == PropertySimpleType.PASSWORD) {
                        entry.setValue(PicketBoxObfuscator.encode(value));
                    }
View Full Code Here

    }

    @Override
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public void setClusterSettings(Subject subject, StorageClusterSettings clusterSettings) {
        SystemSettings settings = new SystemSettings();
        settings.put(SystemSetting.STORAGE_CQL_PORT, Integer.toString(clusterSettings.getCqlPort()));
        settings.put(SystemSetting.STORAGE_GOSSIP_PORT, Integer.toString(clusterSettings.getGossipPort()));
        if (clusterSettings.getAutomaticDeployment() != null) {
            settings.put(SystemSetting.STORAGE_AUTOMATIC_DEPLOYMENT,
                Boolean.toString(clusterSettings.getAutomaticDeployment()));
        }
        if (clusterSettings.getUsername() != null) {
            settings.put(SystemSetting.STORAGE_USERNAME, clusterSettings.getUsername());
        }
        if (clusterSettings.getPasswordHash() != null) {
            this.updateStorageClusterCredentials(clusterSettings);
            settings.put(SystemSetting.STORAGE_PASSWORD, clusterSettings.getPasswordHash());
        }
        if (clusterSettings.getRegularSnapshots() != null) {
            RegularSnapshots rs = clusterSettings.getRegularSnapshots();
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS, Boolean.toString(rs.getEnabled()));
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_SCHEDULE, rs.getSchedule());
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION, rs.getRetention());
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_RETENTION_COUNT, Integer.toString(rs.getCount()));
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION, rs.getDeletion());
            settings.put(SystemSetting.STORAGE_REGULAR_SNAPSHOTS_DELETION_LOCATION, rs.getLocation());
        }
        systemManager.setStorageClusterSettings(subject, settings);
        LookupUtil.getStorageNodeManager().scheduleSnapshotManagement(subject, clusterSettings);

    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.common.composite.SystemSettings

Copyright © 2018 www.massapicom. 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.