Examples of ConfigurationTemplate


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

        this.resourceNameMap.put(getResourceTypeId(), resourceName);
    }

    public String getSelectedTemplateName() {
        if (this.selectedTemplateName == null) {
            ConfigurationTemplate defaultTemplate = getConfigurationDefinition().getDefaultTemplate();
            this.selectedTemplateName = (defaultTemplate != null) ? defaultTemplate.getName() : null;
        }

        return selectedTemplateName;
    }
View Full Code Here

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

    private Configuration createPluginConfiguration(Subject user) {
        ConfigurationDefinition pluginConfigDefinition = this.configurationManager
            .getPluginConfigurationDefinitionForResourceType(user, getResourceTypeId());
        Configuration pluginConfig = null;
        if (pluginConfigDefinition != null) {
            ConfigurationTemplate pluginConfigTemplate = pluginConfigDefinition.getDefaultTemplate();
            pluginConfig = (pluginConfigTemplate != null) ? pluginConfigTemplate.createConfiguration()
                : new Configuration();
            ConfigurationUtility.normalizeConfiguration(pluginConfig, pluginConfigDefinition);
        }

        return pluginConfig;
View Full Code Here

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

        ConfigurationDefinition configurationDefinition = this.packageType.getDeploymentConfigurationDefinition();
        return configurationDefinition;
    }

    protected Configuration lookupConfiguration() {
        ConfigurationTemplate deployTimeConfigurationTemplates = null;
        ConfigurationDefinition configDef = getConfigurationDefinition();
        if (configDef != null) {
            deployTimeConfigurationTemplates = configDef.getDefaultTemplate();
        }

        Configuration deployTimeConfiguration = (deployTimeConfigurationTemplates != null) ? deployTimeConfigurationTemplates
            .createConfiguration()
            : new Configuration();
        return deployTimeConfiguration;
    }
View Full Code Here

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

        DefaultImportConfigurationDescriptor ret = null;

        ConfigurationDefinition def = synchronizer.getImporter().getImportConfigurationDefinition();

        if (def != null) {
            ConfigurationTemplate template = def.getDefaultTemplate();
            if (template != null) {
                ret = DefaultImportConfigurationDescriptor.create(ConfigurationInstanceDescriptorUtil
                    .createConfigurationInstance(def, template.getConfiguration()));
            }
        }

        return ret;
    }
View Full Code Here

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

    private void lookupConfigurationAndDef() {
        this.configurationDefinition = lookupConfigurationDefinition();
        if (this.configurationDefinition != null) {
            this.configuration = lookupConfiguration();
            ConfigurationTemplate defaultTemplate = this.configurationDefinition.getDefaultTemplate();
            this.selectedTemplateName = (defaultTemplate != null) ? defaultTemplate.getName() : null;
        }
    }
View Full Code Here

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

        return pluginConfigDefinition;
    }

    @NotNull
    protected Configuration lookupConfiguration() {
        ConfigurationTemplate pluginConfigTemplate;
        if (this.selectedTemplateName != null) {
            pluginConfigTemplate = getConfigurationDefinition().getTemplate(this.selectedTemplateName);
            if (pluginConfigTemplate == null) {
                throw new IllegalStateException("A template named '" + this.selectedTemplateName
                    + "' does not exist for " + getType() + " resource connection properties.");
            }
        } else {
            pluginConfigTemplate = getConfigurationDefinition().getDefaultTemplate();
        }

        configuration = (pluginConfigTemplate != null) ? pluginConfigTemplate.createConfiguration()
            : new Configuration();

        return configuration;
    }
View Full Code Here

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

        }

        for (String name : toRemove) {
            log.debug("Removing template [" + name + "]");

            ConfigurationTemplate template = existingTemplates.remove(name);
            entityManager.remove(template);
        }

        for (String name : templatesToUpdate) {
            log.debug("Updating template [" + name + "]");

            updateTemplate(existingDefinition.getTemplate(name), newTemplates.get(name));
        }

        for (String name : newTemplates.keySet()) {
            // add completely new templates
            if (!existingTemplates.containsKey(name)) {
                log.debug("Adding template [" + name + "]");

                ConfigurationTemplate newTemplate = newTemplates.get(name);

                // we need to set a valid configurationDefinition, where we will live on.
                newTemplate.setConfigurationDefinition(existingDefinition);

                entityManager.persist(newTemplate);
                existingTemplates.put(name, newTemplate);
            }
        }
View Full Code Here

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

*/
public abstract class TestConfigurationFactory {
    public static ConfigurationDefinition createConfigurationDefinition() {
        ConfigurationDefinition configurationDefinition = new ConfigurationDefinition("TestConfig", "a test config");

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

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

        PropertyDefinitionSimple simplePropDef;
View Full Code Here

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

            // reset the configuration - make it null if there is no config for the new type
            if (cst.getContentSourceConfigurationDefinition() == null) {
                newContentSource.setConfiguration(null);
            } else {
                ConfigurationTemplate defaultTemplate = cst.getContentSourceConfigurationDefinition()
                    .getDefaultTemplate();

                if (defaultTemplate != null) {
                    newContentSource.setConfiguration(defaultTemplate.createConfiguration());
                } else {
                    newContentSource.setConfiguration(new Configuration());
                }
            }
View Full Code Here

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

     * @return a new copy of the default plugin configuration
     */
    public Configuration getDefaultPluginConfiguration() {
        ConfigurationDefinition definition = resourceType.getPluginConfigurationDefinition();
        if (definition != null) {
            ConfigurationTemplate template = definition.getDefaultTemplate();
            if (template != null) {
                return template.getConfiguration().deepCopy();
            }
        }

        return new Configuration(); // there is no default plugin config available, return an empty one
    }
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.