Examples of ConfigurationTemplate


Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        }
    }

    private static ConfigurationTemplate parseTemplate(ConfigurationTemplateDescriptor templateDescriptor)
        throws InvalidPluginDescriptorException {
        ConfigurationTemplate template = new ConfigurationTemplate(templateDescriptor.getName(),
            templateDescriptor.getDescription());
        Configuration templateConfiguration = new Configuration();
        template.setConfiguration(templateConfiguration);

        parseProperties(templateDescriptor, templateConfiguration, null);
        return template;
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

     * for it, this method is a no-op and will return immediately.
     *
     * @param configDef the configuration definition whose default template is to be created and set
     */
    public static void initializeDefaultTemplate(ConfigurationDefinition configDef) {
        ConfigurationTemplate defaultTemplate = configDef.getDefaultTemplate();
        if (defaultTemplate == null) {
            Configuration defaultConfig = createDefaultConfiguration(configDef);
            // not everything should have a default template - only stuff that has default values
            if (!defaultConfig.getProperties().isEmpty()) {
                defaultTemplate = new ConfigurationTemplate(ConfigurationTemplate.DEFAULT_TEMPLATE_NAME,
                    ConfigurationTemplate.DEFAULT_TEMPLATE_NAME);
                defaultTemplate.setDefault(true);
                defaultTemplate.setConfiguration(defaultConfig);
                configDef.putTemplate(defaultTemplate);
            }
        }
        return;
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

     * @return copy of the resource's default plugin configuration
     */
    private Configuration createDefaultPluginConfiguration() {
        ConfigurationDefinition definition = resourceType.getPluginConfigurationDefinition();
        if (definition != null) {
            ConfigurationTemplate template = definition.getDefaultTemplate();
            if (template != null) {
                return template.getConfiguration().deepCopy();
            }
        }

        // There is no default plugin config template defined - return an empty one.
        return new Configuration();
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        try {
            ConfigurationDefinition pluginConfigDefinition = LookupUtil.getConfigurationManager()
                .getPluginConfigurationDefinitionForResourceType(getSessionSubject(), newResourceTypeId);
            Configuration pluginConfig = null;
            if (pluginConfigDefinition != null) {
                ConfigurationTemplate pluginConfigTemplate = pluginConfigDefinition.getDefaultTemplate();
                pluginConfig = (pluginConfigTemplate != null) ? pluginConfigTemplate.createConfiguration()
                    : new Configuration();

                // TODO GH: Is this still necessary now that we don't blow up on non-normalized configs
                // ConfigurationUtility.normalizeConfiguration(pluginConfig, pluginConfigDefinition);
            }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        try {
            ConfigurationDefinition pluginConfigDefinition = LookupUtil.getConfigurationManager()
                .getPluginConfigurationDefinitionForResourceType(getSessionSubject(), newResourceTypeId);
            Configuration pluginConfig = null;
            if (pluginConfigDefinition != null) {
                ConfigurationTemplate pluginConfigTemplate = pluginConfigDefinition.getDefaultTemplate();
                pluginConfig = (pluginConfigTemplate != null) ? pluginConfigTemplate.createConfiguration()
                    : new Configuration();

                // TODO GH: Is this still necessary now that we don't blow up on non-normalized configs
                // ConfigurationUtility.normalizeConfiguration(pluginConfig, pluginConfigDefinition);
            }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

public abstract class TestConfigurationFactory {

    public static ConfigurationDefinition createConfigurationDefinition() {
        ConfigurationDefinition configDef = new ConfigurationDefinition("TestConfig", "a test config");

        ConfigurationTemplate defaultTemplate = new ConfigurationTemplate(ConfigurationTemplate.DEFAULT_TEMPLATE_NAME, "default template");
        configDef.putTemplate(defaultTemplate);
        Configuration defaultConfiguration = new Configuration();
        defaultTemplate.setConfiguration(defaultConfiguration);

        Map<String, PropertyDefinition> propertyDefinitions = new HashMap<String, PropertyDefinition>();
        configDef.setPropertyDefinitions(propertyDefinitions);

        int orderIndex = 0;
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

                assert bv.getConfigurationDefinition().get(propName4).isRequired() == false;
                assert bv.getConfigurationDefinition().getPropertyDefinitionSimple(propName4).getType() == PropertySimpleType.STRING;
                assert bv.getRecipe().equals(recipe);

                // make sure the default template is correct
                ConfigurationTemplate defaultTemplate = bv.getConfigurationDefinition().getDefaultTemplate();
                Configuration defaultConfig = defaultTemplate.getConfiguration();
                assert defaultConfig.getProperties().size() == 3; // prop2 is not required and has no default, thus is missing
                PropertySimple prop1 = defaultConfig.getSimple(propName1);
                PropertySimple prop2 = defaultConfig.getSimple(propName2);
                PropertySimple prop3 = defaultConfig.getSimple(propName3);
                PropertySimple prop4 = defaultConfig.getSimple(propName4);
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        }
        return defaults;
    }

    private Configuration createDefaultConfiguration(ConfigurationDefinition def) {
        ConfigurationTemplate defaultTemplate = def.getDefaultTemplate();
        return (defaultTemplate != null) ? defaultTemplate.createConfiguration() : new Configuration();
    }
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

        criteria.setPageControl(PageControl.getUnlimitedInstance());
        List<Resource> resources = resourceMgr.findResourcesByCriteria(subjectMgr.getOverlord(), criteria);

        for (Resource resource : resources) {
            boolean modified = false;
            ConfigurationTemplate template = updateReport.getConfigurationDefinition().getDefaultTemplate();
            Configuration templateConfiguration = template.getConfiguration();

            for (PropertyDefinition propertyDef : updateReport.getNewPropertyDefinitions()) {
                if (propertyDef.isRequired()) {
                    Property templateProperty = templateConfiguration.get(propertyDef.getName());
                    if (templateProperty == null) {
View Full Code Here

Examples of org.rhq.core.domain.configuration.definition.ConfigurationTemplate

    }

    @Override
    @NotNull
    protected Configuration lookupConfiguration() {
        ConfigurationTemplate resourceConfigTemplate;

        // If the input is not present, nullify the previous selected template name if it was set
        if (selectedTemplateNameInput != null) {
            selectedTemplateName = (String) selectedTemplateNameInput.getValue();
        } else {
            selectedTemplateName = null;
        }

        if ((this.selectedTemplateName != null) && !selectedTemplateName.equals("")) {
            resourceConfigTemplate = getConfigurationDefinition().getTemplate(this.selectedTemplateName);
            if (resourceConfigTemplate == null) {
                throw new IllegalStateException("A template named '" + this.selectedTemplateName
                    + "' does not exist for " + getResourceType() + " resource configurations.");
            }
        } else {
            resourceConfigTemplate = getConfigurationDefinition().getDefaultTemplate();
        }

        Configuration resourceConfig = (resourceConfigTemplate != null) ? resourceConfigTemplate.createConfiguration()
            : new Configuration();
        ConfigurationUtility.normalizeConfiguration(resourceConfig, getConfigurationDefinition());

        return resourceConfig;
    }
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.