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

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


        }
        return subjects;
    }

    private boolean isLdapAuthenticationEnabled() {
        SystemSettings systemSettings = systemManager.getUnmaskedSystemSettings(true);
        String value = systemSettings.get(SystemSetting.LDAP_BASED_JAAS_PROVIDER);
        return (value != null) ? Boolean.valueOf(value) : false;
    }
View Full Code Here


        String value = systemSettings.get(SystemSetting.LDAP_BASED_JAAS_PROVIDER);
        return (value != null) ? Boolean.valueOf(value) : false;
    }

    private boolean isLdapAuthorizationEnabled() {
        SystemSettings systemSettings = systemManager.getUnmaskedSystemSettings(true);
        String groupFilter = systemSettings.get(SystemSetting.LDAP_GROUP_FILTER);
        String groupMember = systemSettings.get(SystemSetting.LDAP_GROUP_MEMBER);
        return ((groupFilter != null) && (groupFilter.trim().length() > 0))
            || ((groupMember != null) && (groupMember.trim().length() > 0));
    }
View Full Code Here

        try {
            SystemManagerLocal systemManager = LookupUtil.getSystemManager();
            MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
                .getMeasurementDefinitionManager();

            SystemSettings beforeSystemSettings = systemManager.getUnmaskedSystemSettings(false);
            MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
            criteria.setPageControl(PageControl.getUnlimitedInstance());
            criteria.fetchResourceType(true);

            List<MeasurementDefinition> beforeMeasurementDefinitions = measurementDefinitionManager
                .findMeasurementDefinitionsByCriteria(freshUser(), criteria);

            synchronizationManager.importAllSubsystems(freshUser(), export.getExportFile(), null);

            //this is to work around BZ 735810
            systemManager.loadSystemConfigurationCache();

            SystemSettings afterSystemSettings = systemManager.getUnmaskedSystemSettings(false);
            List<MeasurementDefinition> afterMeasurementDefinitions = measurementDefinitionManager
                .findMeasurementDefinitionsByCriteria(freshUser(), criteria);

            assertEquals("System settings unexpectedly differ", beforeSystemSettings, afterSystemSettings);
View Full Code Here

                exportData.close();
            }

            //now check that everything got imported according to the changed configuration
            SystemManagerLocal systemManager = LookupUtil.getSystemManager();
            SystemSettings settings = systemManager.getUnmaskedSystemSettings(false);

            assertEquals(settings.get(SystemSetting.BASE_URL), "http://testing.domain:7080");

            MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
                .getMeasurementDefinitionManager();
            MeasurementDefinitionCriteria crit = new MeasurementDefinitionCriteria();
            crit.addFilterResourceTypeName(RESOURCE_TYPE_NAME);
View Full Code Here

        setup(true);

        try {
            //let's read the original values from the database, so that we know what to compare against
            SystemManagerLocal systemManager = LookupUtil.getSystemManager();
            SystemSettings settings = systemManager.getUnmaskedSystemSettings(false);

            String originalBaseUrl = settings.get(SystemSetting.BASE_URL);

            MeasurementDefinitionManagerLocal measurementDefinitionManager = LookupUtil
                .getMeasurementDefinitionManager();
            MeasurementDefinitionCriteria crit = new MeasurementDefinitionCriteria();
            crit.addFilterResourceTypeName(RESOURCE_TYPE_NAME);
            crit.addFilterName(METRIC_NAME);
            MeasurementDefinition distroNameDef = measurementDefinitionManager.findMeasurementDefinitionsByCriteria(
                freshUser(), crit).get(0);

            long originalInterval = distroNameDef.getDefaultInterval();

            //now modify the default configuration in the export file
            String exportXML = getExportData();

            exportXML = updateSystemSettingsImportConfiguration(exportXML);
            exportXML = updateMetricTemplatesImportConfiguration(exportXML);

            InputStream exportData = createCompressedStream(exportXML);

            //let's just use the default configs so that we don't apply the changes suggested in
            //the changed default configs created above
            ImportConfiguration systemSettingsConfiguration = new ImportConfiguration(
                SystemSettingsSynchronizer.class.getName(), new SystemSettingsSynchronizer().getImporter()
                    .getImportConfigurationDefinition().getDefaultTemplate().createConfiguration());
            ImportConfiguration metricTemplatesConfiguration = new ImportConfiguration(
                MetricTemplateSynchronizer.class.getName(), new MetricTemplateSynchronizer().getImporter()
                    .getImportConfigurationDefinition().getDefaultTemplate().createConfiguration());

            try {
                synchronizationManager.importAllSubsystems(freshUser(), exportData,
                    Arrays.asList(systemSettingsConfiguration, metricTemplatesConfiguration));
            } finally {
                exportData.close();
            }

            //now check that we import using the manually create configurations, not the inlined ones
            settings = systemManager.getUnmaskedSystemSettings(false);

            assertEquals(settings.get(SystemSetting.BASE_URL), originalBaseUrl);

            measurementDefinitionManager = LookupUtil.getMeasurementDefinitionManager();
            distroNameDef = measurementDefinitionManager.findMeasurementDefinitionsByCriteria(freshUser(), crit).get(0);

            //the definition should have been updated by the data from the export file
View Full Code Here

    /**
     * Returns true if LDAP authentication is enabled, or false otherwise.
     */
    public Boolean checkLdapConfiguredStatus() throws RuntimeException {
        try {
            SystemSettings systemSettings = systemManager.getUnmaskedSystemSettings(true);
            String value = systemSettings.get(SystemSetting.LDAP_BASED_JAAS_PROVIDER);
            boolean result = (value != null) ? Boolean.valueOf(value) : false;
            return result;
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

    }

    @Override
    public String getSessionTimeout() throws RuntimeException {
        try {
            SystemSettings systemSettings = systemManager.getUnmaskedSystemSettings(true);
            String sessionTimeout = systemSettings.get(SystemSetting.RHQ_SESSION_TIMEOUT);
            return sessionTimeout;
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here

    @Deprecated
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public Properties getSystemConfiguration(Subject subject) {
        Properties copy = new Properties();

        SystemSettings settings = getUnmaskedSystemSettings(true);
        for (Map.Entry<SystemSetting, String> e : settings.entrySet()) {
            //transform the value back to the database format, because that's
            //what this method always returned.
            //Leave the password fields as they are though, because now (as of 4.10)
            //the passwords are stored obfuscated, but are kept clear in memory.
            //The legacy behavior was to store the values in clear text, too,
View Full Code Here

    }

    @Override
    @RequiredPermission(Permission.MANAGE_SETTINGS)
    public SystemSettings getSystemSettings(Subject subject) {
        SystemSettings ret = new SystemSettings();
        SystemSettings unmasked = getUnmaskedSystemSettings(true);

        for (Map.Entry<SystemSetting, String> entry : unmasked.entrySet()) {
            if (entry.getKey().isPublic()) {
                if (entry.getKey().getType() == PropertySimpleType.PASSWORD) {
                    entry.setValue(PropertySimple.MASKED_VALUE);
                }
View Full Code Here

        return ret;
    }

    @Override
    public SystemSettings getUnmaskedSystemSettings(boolean includePrivateSettings) {
        SystemSettings ret = getCachedSettings();

        return includePrivateSettings ? ret : removePrivateSettings(ret);
    }
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.