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

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


      LOG.debug("Cannot update default value on " + propertyDefinition //$NON-NLS-1$
          + ", because default value's type (" + metaType //$NON-NLS-1$
          + ") is not simple or enum."); //$NON-NLS-1$
      return;
    }
    PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
    if (metaType.isSimple()) {
      SimpleValue defaultSimpleValue = (SimpleValue) defaultValue;
      Serializable value = defaultSimpleValue.getValue();
      propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
    } else { // defaultValueMetaType.isEnum()
      EnumValue defaultEnumValue = (EnumValue) defaultValue;
      Serializable value = defaultEnumValue.getValue();
      propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
    }
  }
View Full Code Here


        AbstractPropertyMap defaultConfigurationParentMap) throws InvalidPluginDescriptorException {
        String description = parseMultiValue(simpleProperty.getDescription(), simpleProperty.getLongDescription());
        String displayName = (simpleProperty.getDisplayName() != null) ? simpleProperty.getDisplayName() : StringUtils
            .deCamelCase(simpleProperty.getName());

        PropertyDefinitionSimple property = new PropertyDefinitionSimple(simpleProperty.getName(), description,
            simpleProperty.isRequired(), translatePropertyType(simpleProperty.getType()));

        property.setReadOnly(simpleProperty.isReadOnly());
        property.setSummary(simpleProperty.isSummary());
        property.setActivationPolicy(translateActivationPolicy(simpleProperty.getActivationPolicy()));
        property.setConstraints(translateContraints(simpleProperty.getConstraint()));
        property.setDisplayName(displayName);
        property.setDefaultValue(simpleProperty.getDefaultValue());
        property.setUnits(MetricsMetadataParser.getMeasurementUnits(simpleProperty.getUnits(), null));

        String initialValue = simpleProperty.getInitialValue();
        if ((defaultConfigurationParentMap != null) && (initialValue != null)) {
            defaultConfigurationParentMap.put(new PropertySimple(simpleProperty.getName(), initialValue));
        }

        // Load the enumeration of options
        if (simpleProperty.getPropertyOptions() != null) {
            parsePropertyOptions(property, simpleProperty.getPropertyOptions());
        }

        if (simpleProperty.getOptionSource() != null) {
            PropertyOptionsSource optionsSource = new PropertyOptionsSource();
            OptionSource source = simpleProperty.getOptionSource();
            optionsSource.setTarget(source.getTarget().toString());
            optionsSource.setLinkToTarget(source.isLinkToTarget());
            if (source.getFilter() != null && source.getFilter().length() > 40) {
                throw new IllegalArgumentException("Filter expression must be less than 40 chars long");
            }
            optionsSource.setFilter(source.getFilter());
            ExpressionScope expressionScope = source.getExpressionScope();
            if (expressionScope != null) {
                optionsSource.setExpressionScope(PropertyOptionsSource.ExpressionScope.fromValue(expressionScope
                    .value()));
            }
            String expression = source.getExpression();
            if (expression == null || expression.isEmpty())
                throw new IllegalArgumentException("Expression must not be empty");
            if (expression.length() > 400)
                throw new IllegalArgumentException("Expression must be less than 400 chars long");
            optionsSource.setExpression(expression);
            property.setOptionsSource(optionsSource);
        }

        return property;
    }
View Full Code Here

        String name = PROP_NAME;
        String description = "The drift detection definition name";
        boolean required = true;
        PropertySimpleType type = PropertySimpleType.STRING;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Drift Definition Name");
        pd.setReadOnly(readOnly);
        pd.setSummary(true);
        pd.setOrder(0);
        pd.setAllowCustomEnumeratedValue(false);
        pd.setConfigurationDefinition(configDef);

        RegexConstraint constraint = new RegexConstraint();
        constraint.setDetails(PROP_NAME_REGEX_PATTERN);
        pd.addConstraints(constraint);

        return pd;
    }
View Full Code Here

        String name = PROP_DESCRIPTION;
        String description = "A description of the drift detection definition or template";
        boolean required = false;
        PropertySimpleType type = PropertySimpleType.STRING;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Drift Definition Description");
        pd.setSummary(true);
        pd.setOrder(1);
        pd.setAllowCustomEnumeratedValue(false);
        pd.setConfigurationDefinition(configDef);

        return pd;
    }
View Full Code Here

        String name = PROP_ENABLED;
        String description = "Enables or disables the drift definition";
        boolean required = true;
        PropertySimpleType type = PropertySimpleType.BOOLEAN;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Enabled");
        pd.setReadOnly(false);
        pd.setSummary(true);
        pd.setOrder(2);
        pd.setAllowCustomEnumeratedValue(false);
        pd.setConfigurationDefinition(configDef);
        pd.setDefaultValue(String.valueOf(DEFAULT_ENABLED));
        return pd;
    }
View Full Code Here

            + "definitions. Furthermore, if you pin an existing template to a snapshot, then attached definitions will "
            + "become pinned as well. Finally, if you delete a template, attached definitions will also be deleted.";
        boolean required = true;
        PropertySimpleType type = PropertySimpleType.BOOLEAN;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Attached to Template");
        pd.setDefaultValue("true");
        pd.setOrder(3);
        pd.setReadOnly(readOnly);
        pd.setConfigurationDefinition(configDef);

        return pd;
    }
View Full Code Here

            + "configuration change, or something similar.  With this setting drift is only reported " //
            + " for inspection, in drift snapshot views.";
        boolean required = true;
        PropertySimpleType type = PropertySimpleType.STRING;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Drift Handling Mode");
        pd.setReadOnly(false);
        pd.setSummary(true);
        pd.setOrder(4);
        pd.setConfigurationDefinition(configDef);

        PropertyDefinitionEnumeration normalEnum = new PropertyDefinitionEnumeration(DriftHandlingMode.normal.name(),
            DriftHandlingMode.normal.name());
        normalEnum.setOrderIndex(0);

        PropertyDefinitionEnumeration plannedEnum = new PropertyDefinitionEnumeration(DriftHandlingMode.plannedChanges
            .name(), DriftHandlingMode.plannedChanges.name());
        plannedEnum.setOrderIndex(1);

        ArrayList<PropertyDefinitionEnumeration> pdEnums = new ArrayList<PropertyDefinitionEnumeration>(2);
        pdEnums.add(normalEnum);
        pdEnums.add(plannedEnum);
        pd.setEnumeratedValues(pdEnums, false);
        pd.setDefaultValue(DEFAULT_DRIFT_HANDLING_MODE.name());

        return pd;
    }
View Full Code Here

            + "snapshot. If you pin a snapshot, the agent will use that pinned version to compare against files "
            + "being monitored for drift";
        boolean required = true;
        PropertySimpleType type = PropertySimpleType.BOOLEAN;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Pinned");
        pd.setDefaultValue("false");
        pd.setOrder(5);
        pd.setReadOnly(readOnly);
        pd.setConfigurationDefinition(configDef);

        return pd;
    }
View Full Code Here

        String description = "The frequency in seconds in which drift detection should run. Defaults to 1800 seconds (i.e. 30 minutes). This value must be" +
                "higher than (or equal to) agent's interval.";
        boolean required = false;
        PropertySimpleType type = PropertySimpleType.LONG;

        PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type);
        pd.setDisplayName("Interval");
        pd.setReadOnly(false);
        pd.setSummary(true);
        pd.setOrder(6);
        pd.setAllowCustomEnumeratedValue(false);
        pd.setConfigurationDefinition(configDef);
        pd.setDefaultValue(String.valueOf(DEFAULT_INTERVAL));
        return pd;
    }
View Full Code Here

    private static PropertyDefinitionMap createBasedir(ConfigurationDefinition configDef, boolean readOnly) {
        String name = PROP_BASEDIR;
        String description = "The root directory from which snapshots will be generated during drift monitoring.";
        boolean required = true;

        PropertyDefinitionSimple valueContext = createBasedirValueContext(readOnly);
        PropertyDefinitionSimple valueName = createBasedirValueName(readOnly);

        PropertyDefinitionMap pd = new PropertyDefinitionMap(name, description, required, valueContext, valueName);
        pd.setDisplayName("Base Directory");
        pd.setReadOnly(readOnly);
        pd.setSummary(true);
View Full Code Here

TOP

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

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.