Package org.rhq.core.domain.configuration.definition

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


  public static Configuration convertManagedObjectToConfiguration(
      Map<String, ManagedProperty> managedProperties,
      Map<String, PropertySimple> customProps, ResourceType resourceType) {
    Configuration config = new Configuration();
    ConfigurationDefinition configDef = resourceType
        .getResourceConfigurationDefinition();
    Map<String, PropertyDefinition> propDefs = configDef
        .getPropertyDefinitions();
    Set<String> propNames = managedProperties.keySet();
    for (String propName : propNames) {
      PropertyDefinition propertyDefinition = propDefs.get(propName);
      ManagedProperty managedProperty = managedProperties.get(propName);
View Full Code Here


    }
    return config;
  }

  public static void convertConfigurationToManagedProperties(Map<String, ManagedProperty> managedProperties, Configuration configuration, ResourceType resourceType, String prefix) {
    ConfigurationDefinition configDefinition = resourceType.getResourceConfigurationDefinition();
    for (ManagedProperty managedProperty : managedProperties.values()) {
      String propertyName = managedProperty.getName();
      if (prefix != null) {
        propertyName = prefix + "." + propertyName; //$NON-NLS-1$
      }
      PropertyDefinition propertyDefinition = configDefinition.get(propertyName);
      if (propertyDefinition == null) {
        // The managed property is not defined in the configuration
        continue;
      }
      populateManagedPropertyFromProperty(managedProperty,propertyDefinition, configuration);
View Full Code Here

        // Since our properties are can be added at parent resource creation time, we have to make sure they are added.
        if (report.getStatus() == CreateResourceStatus.SUCCESS) {
            // Now we have to send this as an update, so the properties are created properly
            ConfigurationUpdateReport updateReport = new ConfigurationUpdateReport(report.getResourceConfiguration());
            ConfigurationDefinition configDef = report.getResourceType().getResourceConfigurationDefinition();
            Address address = new Address(getAddress());
            address.add(report.getPluginConfiguration().getSimpleValue("path"),report.getUserSpecifiedResourceName());
            ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef, getASConnection(), address);
            delegate.updateResourceConfiguration(updateReport);
View Full Code Here

        type.setDiscoveryInterval(descriptor.getDiscoveryInterval());

        type.setCreationData(descriptor.isIsCreationType());

        ConfigurationDescriptor configurationDescriptor = descriptor.getConfiguration();
        ConfigurationDefinition configurationDefinition = ConfigurationMetadataParser.parse(descriptor.getName(),
            configurationDescriptor);
        type.setDeploymentConfigurationDefinition(configurationDefinition);

        return type;
    }
View Full Code Here

        if (configurationName==null) {
            throw new IllegalArgumentException("ConfigurationName must not be null");
        }

        ConfigurationDefinition configurationDefinition = new ConfigurationDefinition(configurationName,
            descriptor.getNotes());
        configurationDefinition.setConfigurationFormat(getConfigurationFormat(descriptor));

        if (configurationDefinition.getConfigurationFormat() == RAW) {
            return configurationDefinition;
        }

        for (ConfigurationTemplateDescriptor templateDescriptor : descriptor.getTemplate()) {
            configurationDefinition.putTemplate(parseTemplate(templateDescriptor));
        }

        ConfigurationTemplate defaultTemplate = initDefaultTemplate(configurationDefinition);
        configurationDefinition.putTemplate(defaultTemplate);

        Configuration defaultConfiguration = defaultTemplate.getConfiguration();
        parseProperties(descriptor, defaultConfiguration, configurationDefinition);
        ConfigurationUtility.normalizeConfiguration(defaultConfiguration, configurationDefinition);
View Full Code Here

     * Returns a copy of the {@link #getResourceType() resource type}'s default plugin configuration.
     *
     * @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();
            }
        }

View Full Code Here

    }

    @NotNull
    protected Configuration loadResourceConfiguration(Resource resource) throws Exception {
        ResourceType resourceType = resource.getResourceType();
        ConfigurationDefinition resourceConfigDef = resourceType.getResourceConfigurationDefinition();
        assertNotNull(resourceConfigDef, "No resource config is defined for ResourceType " + resourceType + ".");
        System.out.println("=== Loading Resource config for " + resource + "...");
        ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(resource);
        long timeoutMillis = 5000;
        ConfigurationFacet configurationFacet = resourceContainer.createResourceComponentProxy(
View Full Code Here

    @NotNull
    protected ConfigurationUpdateReport updateResourceConfiguration(Resource resource, Configuration resourceConfig)
        throws Exception {
        ResourceType resourceType = resource.getResourceType();
        ConfigurationDefinition resourceConfigDef = resourceType.getResourceConfigurationDefinition();
        assertNotNull(resourceConfigDef, "No resource config is defined for ResourceType " + resourceType + ".");
        System.out.println("=== Updating Resource config for " + resource + "...");
        ResourceContainer resourceContainer = this.pluginContainer.getInventoryManager().getResourceContainer(resource);
        long timeoutMillis = 5000;
        ConfigurationFacet configurationFacet = resourceContainer.createResourceComponentProxy(
View Full Code Here

    private static final String TEMPLATE_ENGINE_ATTRIBUTE = "templateEngine";

    @Nullable
    public ConfigurationDefinition getConfigurationDefinition() {
        //noinspection UnnecessaryLocalVariable
        ConfigurationDefinition configDef = FacesComponentUtility.getExpressionAttribute(this,
            CONFIGURATION_DEFINITION_ATTRIBUTE, ConfigurationDefinition.class);
        return configDef;
    }
View Full Code Here

    }
   

    private ResourceType createResourceType() throws Exception {
        ResourceType resourceType = new ResourceType("RHQ Storage Node", "RHQStorage", ResourceCategory.SERVER, null);
        ConfigurationDefinition pluginConfigurationDefinition = new ConfigurationDefinition("config", null);
        pluginConfigurationDefinition.put(new PropertyDefinitionSimple("host", null, true, PropertySimpleType.STRING));
        resourceType.setPluginConfigurationDefinition(pluginConfigurationDefinition);
        getEntityManager().persist(resourceType);

        return resourceType;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.definition.ConfigurationDefinition

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.