Package org.rhq.plugins.modcluster.config

Examples of org.rhq.plugins.modcluster.config.ModClusterBeanFile


    public void TestSimpleBeanModClusterConfig() {
        try {
            URL testConfigURL = getClass().getResource("/xml_config/mod_cluster-jboss-beans.xml");
            File testFile = new File(testConfigURL.toURI());

            ModClusterBeanFile config = new ModClusterBeanFile("org.jboss.modcluster.ha.HAModClusterService", testFile);
            config.setPropertyValue("processStatusFrequency", "4");
            config.setPropertyValue("test", "5");
            config.setPropertyValue("test", "123");

            config.setPropertyValue("test", null);
            config.setPropertyValue("processStatusFrequency", null);

            config.saveConfigurationFile();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here


    public void TestBeanWithDependenciesModClusterConfig() {
        try {
            URL testConfigURL = getClass().getResource("/xml_config/mod_cluster-jboss-beans.xml");
            File testFile = new File(testConfigURL.toURI());

            ModClusterBeanFile config = new ModClusterBeanFile("org.jboss.modcluster.ha.HAModClusterService",
                "org.jboss.modcluster.config.ha.HAModClusterConfig", testFile);
            config.setPropertyValue("processStatusFrequency", "4");
            config.setPropertyValue("test", "5");
            config.setPropertyValue("test", "123");

            config.setPropertyValue("test", null);
            config.setPropertyValue("processStatusFrequency", null);
            config.saveConfigurationFile();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        Configuration configuration = new Configuration();
        ConfigurationDefinition configurationDefinition = this.resourceContext.getResourceType()
            .getResourceConfigurationDefinition();

        try {
            ModClusterBeanFile modClusterBeanFile = this.getModClusterBeanFileInstance();

            for (PropertyDefinition property : configurationDefinition.getPropertyDefinitions().values()) {
                if (property instanceof PropertyDefinitionSimple) {
                    String value = modClusterBeanFile.getPropertyValue(property.getName());
                    if (value != null) {
                        configuration.put(new PropertySimple(property.getName(), value));
                    } else {
                        PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) property;
                        configuration.put(new PropertySimple(property.getName(), propertyDefinitionSimple
View Full Code Here

        // assume we succeed - we'll set to failure if we can't set all properties
        report.setStatus(ConfigurationUpdateStatus.SUCCESS);

        try {
            ModClusterBeanFile modClusterBeanFile = this.getModClusterBeanFileInstance();

            for (String key : report.getConfiguration().getSimpleProperties().keySet()) {
                PropertySimple property = report.getConfiguration().getSimple(key);
                if (property != null) {
                    try {
                        PropertyDefinitionSimple def = configurationDefinition.getPropertyDefinitionSimple(property
                            .getName());
                        if (!(ignoreReadOnly && def.isReadOnly())) {
                            modClusterBeanFile.setPropertyValue(property.getName(), property.getStringValue());
                        }
                    } catch (Exception e) {
                        property.setErrorMessage(ThrowableUtil.getStackAsString(e));
                        report.setErrorMessage("Failed setting resource configuration. " + e.getMessage());
                        log.info("Failure setting MBean Resource configuration value for " + key, e);
                    }
                }
            }

            modClusterBeanFile.saveConfigurationFile();
        } catch (Exception e) {
            report.setErrorMessage("Failed to save the resource configuration to file. " + e.getMessage());
            log.debug("Unable to save mod_cluster configuration file.", e);
        }
    }
View Full Code Here

        String fileName = this.getModClusterConfigFile();

        if (pluginConfig.getSimple(DEPENDENCY_BEAN_CLASS_NAME_PROPERTY) != null) {
            String dependencyBeanClassName = pluginConfig.getSimple(DEPENDENCY_BEAN_CLASS_NAME_PROPERTY)
                .getStringValue();
            return new ModClusterBeanFile(beanClassName, dependencyBeanClassName, fileName);
        }

        return new ModClusterBeanFile(beanClassName, fileName);
    }
View Full Code Here

TOP

Related Classes of org.rhq.plugins.modcluster.config.ModClusterBeanFile

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.