Package org.rhq.plugins.postgres.util

Examples of org.rhq.plugins.postgres.util.PostgresqlConfFile


        "max_fsm_pages", "log_destination", "redirect_stderr", "stats_start_collector", "stats_block_level",
        "stats_row_level", "autovacuum" };

    protected PostgresqlConfFile getConfigurationFile() throws IOException {
        File configFile = getConfigurationFileObject();
        return new PostgresqlConfFile(configFile);
    }
View Full Code Here


    public Configuration loadResourceConfiguration() throws Exception {
        Configuration config = new Configuration();
        ConfigurationDefinition configDef = resourceContext.getResourceType().getResourceConfigurationDefinition();

        // Persisted settings - obtained by reading postgresql.conf.
        PostgresqlConfFile confFile = getConfigurationFile();
        for (String propName : CONFIG_FILE_PROPERTIES) {
            String value = confFile.getProperty(propName);
            PropertyDefinitionSimple propDef = configDef.getPropertyDefinitionSimple(propName);
            PropertySimple prop = createProperty(value, propDef);
            config.put(prop);
        }
View Full Code Here

                    String value = getPostgresParameterValue(prop, pd);
                    parameters.put(prop.getName(), value);
                }
            }

            PostgresqlConfFile confFile = getConfigurationFile();
            confFile.setProperties(parameters);
        } catch (IOException e) {
            LOG.error("Unable to update postgres configuration file", e);
        }

        report.setStatus(ConfigurationUpdateStatus.SUCCESS);
View Full Code Here

                continue;
            }

            File pgData = new File(pgDataPath);
            String configFilePath = getConfigFilePath(procInfo);
            PostgresqlConfFile confFile = null;

            if (!pgData.exists()) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("PostgreSQL data directory ("
                        + pgData
                        + ") does not exist or is not readable. "
                        + "Make sure the user the RHQ Agent is running as has read permissions on the directory and its parent directory.");
                }
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("PostgreSQL data directory: " + pgData);
                }

                File postgresConfFile = (configFilePath != null) ? new File(configFilePath) : new File(pgData,
                    PostgresServerComponent.DEFAULT_CONFIG_FILE_NAME);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("PostgreSQL configuration file: " + postgresConfFile);
                }

                if (!postgresConfFile.exists()) {
                    LOG.warn("PostgreSQL configuration file (" + postgresConfFile + ") does not exist.");
                } else {
                    try {
                        confFile = new PostgresqlConfFile(postgresConfFile);
                    } catch (IOException e) {
                        LOG.warn("Could not load PostgreSQL configuration file [" + postgresConfFile + "]: " + e);
                    }
                }
            }

            Configuration pluginConfig = context.getDefaultPluginConfiguration();

            pluginConfig.put(new PropertySimple(PGDATA_DIR_CONFIGURATION_PROPERTY, pgData));
            pluginConfig.put(new PropertySimple(CONFIG_FILE_CONFIGURATION_PROPERTY, configFilePath));

            if (confFile != null) {
                String port = confFile.getPort();
                if (port != null) {
                    // Override the default (5432) from the descriptor.
                    pluginConfig.put(new PropertySimple(PORT_CONFIGURATION_PROPERTY, port));
                }
                List<String> listenAddresses = confFile.getPropertyList("listen_addresses");
                if (listenAddresses.size() > 0) {
                    String listenAddress = listenAddresses.get(0).trim();
                    if ("*".equals(listenAddress)) {
                        listenAddress = "127.0.0.1";
                    }
View Full Code Here

TOP

Related Classes of org.rhq.plugins.postgres.util.PostgresqlConfFile

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.