public PropertyDefinitionSimple createPropertyDefinition() { return new PropertyDefinitionSimple(internalName, null, requiringValue, type); }
ConfigurationDefinition def = new ConfigurationDefinition("MetricTemplateImportConfiguration", null); PropertyDefinitionSimple updateAllSchedules = new PropertyDefinitionSimple( UPDATE_ALL_SCHEDULES_PROPERTY, "If set to true, all the metric templates will update all the existing schedules on corresponding resources.", new PropertyDefinitionSimple(METRIC_NAME_PROPERTY, "The name of the metric", true, PropertySimpleType.STRING); PropertyDefinitionSimple resourceTypeName = new PropertyDefinitionSimple(RESOURCE_TYPE_NAME_PROPERTY, "The name of the resource type defining the metric", true, PropertySimpleType.STRING); PropertyDefinitionSimple resourceTypePlugin = new PropertyDefinitionSimple(RESOURCE_TYPE_PLUGIN_PROPERTY, "The name of the plugin defining the resource type that defines the metric", true, PropertySimpleType.STRING); PropertyDefinitionSimple updateSchedules = new PropertyDefinitionSimple(UPDATE_SCHEDULES_PROPERTY, "Whether to update the schedules of this metric on existing resources", true, PropertySimpleType.BOOLEAN);
@Override public ConfigurationDefinition getImportConfigurationDefinition() { ConfigurationDefinition def = new ConfigurationDefinition("SystemSettingsConfiguration", null); PropertyDefinitionSimple props = new PropertyDefinitionSimple( PROPERTIES_TO_IMPORT_PROPERTY, "The names of the properties that should be imported. Note that these are the INTERNAL names as used in the RHQ database." + " If you include any property that stores a password (such as CAM_LDAP_BIND_PW)," + " you need to make sure the values are OBFUSCATED. You can obtain an obfuscated value of your" + " password by running the \"rhq-encode-password.(sh|bat)\" script located in the \"bin\" directory" + " of your RHQ server installation.", true, PropertySimpleType.STRING); props.setDefaultValue(DEFAULT_IMPORTED_PROPERTIES_LIST); def.put(props); ConfigurationUtility.initializeDefaultTemplate(def); return def; }
private static PropertyDefinitionSimple createExcludePattern(boolean readOnly) { String name = PROP_PATTERN; String description = "Pathname pattern that must match for the items in the directory path to be excluded."; boolean required = false; PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Pattern"); pd.setReadOnly(readOnly); pd.setSummary(true); pd.setOrder(1); pd.setAllowCustomEnumeratedValue(false); return pd; }
private static PropertyDefinitionSimple createExcludePath(boolean readOnly) { String name = PROP_PATH; String description = "A file system directory path that is relative to (a sub-directory of) the base directory of the drift definition. The default is '.', the base directory itself. Note that '/' and './' will be normalized to '.' for consistent handling."; boolean required = true; PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Path"); pd.setReadOnly(readOnly); pd.setSummary(true); pd.setOrder(0); pd.setAllowCustomEnumeratedValue(false); return pd; }
private static PropertyDefinitionSimple createDescription(ConfigurationDefinition configDef) { 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; }
private static PropertyDefinitionSimple createEnabled(ConfigurationDefinition configDef) { 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; }
private static PropertyDefinitionSimple createAttached(ConfigurationDefinition configDef, boolean readOnly) { String name = PROP_ATTACHED; String description = "A flag that indicates whether or not the definition is attached to the template from " + "which it is created. When a template is updated, the changes will be propagated to any attached " + "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; }
private static PropertyDefinitionSimple createPinned(ConfigurationDefinition configDef, boolean readOnly) { String name = PROP_PINNED; String description = "If set, pins the snapshot that the agent uses for comparing files during drift " + "detection. Normally, the agent compares those files being monitored for drift against the latest " + "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; }
private static PropertyDefinitionSimple createInterval(ConfigurationDefinition configDef) { String name = PROP_INTERVAL; 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; }
private static PropertyDefinitionSimple createBasedirValueName(boolean readOnly) { String name = PROP_BASEDIR_VALUENAME; String description = "The name of the value as found in the context."; boolean required = true; PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Value Name"); pd.setReadOnly(readOnly); pd.setSummary(true); pd.setOrder(1); pd.setAllowCustomEnumeratedValue(false); RegexConstraint constraint = new RegexConstraint(); constraint.setDetails(PROP_BASEDIR_PATH_REGEX_PATTERN); pd.addConstraints(constraint); return pd; }
private static PropertyDefinitionSimple createIncludePattern(boolean readOnly) { String name = PROP_PATTERN; String description = "Pathname pattern that must match for the items in the directory path to be included. '*' matches zero or more characters, '?' matches one character. For example, '*.txt' (no quotes) will match text files in the filter's path directory. '**/*.txt' will match text files in any subdirectory below the filter's path directory."; boolean required = false; PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Pattern"); pd.setReadOnly(readOnly); pd.setSummary(true); pd.setOrder(1); pd.setAllowCustomEnumeratedValue(false); RegexConstraint constraint = new RegexConstraint(); constraint.setDetails(PROP_FILTER_PATTERN_REGEX_PATTERN); pd.addConstraints(constraint); return pd; }
PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Drift Handling Mode"); pd.setReadOnly(false);
private static PropertyDefinitionSimple createBasedirValueContext(boolean readOnly) { String name = PROP_BASEDIR_VALUECONTEXT; String description = "Identifies where the named value can be found."; boolean required = true; PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Value Context"); pd.setReadOnly(readOnly); pd.setSummary(true); pd.setOrder(0); PropertyDefinitionEnumeration pcEnum = new PropertyDefinitionEnumeration( BaseDirValueContext.pluginConfiguration.name(), BaseDirValueContext.pluginConfiguration.name()); pcEnum.setOrderIndex(0); PropertyDefinitionEnumeration rcEnum = new PropertyDefinitionEnumeration( BaseDirValueContext.resourceConfiguration.name(), BaseDirValueContext.resourceConfiguration.name()); rcEnum.setOrderIndex(1); PropertyDefinitionEnumeration mtEnum = new PropertyDefinitionEnumeration(BaseDirValueContext.measurementTrait .name(), BaseDirValueContext.measurementTrait.name()); mtEnum.setOrderIndex(2); PropertyDefinitionEnumeration fsEnum = new PropertyDefinitionEnumeration(BaseDirValueContext.fileSystem.name(), BaseDirValueContext.fileSystem.name()); fsEnum.setOrderIndex(3); ArrayList<PropertyDefinitionEnumeration> pdEnums = new ArrayList<PropertyDefinitionEnumeration>(4); pdEnums.add(pcEnum); pdEnums.add(rcEnum); pdEnums.add(mtEnum); pdEnums.add(fsEnum); pd.setEnumeratedValues(pdEnums, false); return pd; }
private static PropertyDefinitionSimple createName(ConfigurationDefinition configDef, boolean readOnly) { 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; }
private static PropertyDefinitionSimple createIncludePath(boolean readOnly) { String name = PROP_PATH; String description = "A file system directory path that is relative to (a sub-directory of) the base directory of the drift definition. The default is '.', the base directory itself. Note that '/' and './' will be normalized to '.' for consistent handling."; boolean required = false; PropertySimpleType type = PropertySimpleType.STRING; PropertyDefinitionSimple pd = new PropertyDefinitionSimple(name, description, required, type); pd.setDisplayName("Path"); pd.setReadOnly(readOnly); pd.setSummary(true); pd.setOrder(0); pd.setAllowCustomEnumeratedValue(false); pd.setDefaultValue("."); RegexConstraint constraint = new RegexConstraint(); constraint.setDetails(PROP_FILTER_PATH_REGEX_PATTERN); pd.addConstraints(constraint); return pd; }
.deCamelCase(simpleProperty.getName()); PropertyDefinitionSimple property = new PropertyDefinitionSimple(simpleProperty.getName(), description, simpleProperty.isRequired(), translatePropertyType(simpleProperty.getType()));