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

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


                DeploymentProperties props = new DeploymentProperties(0, patch.getIdentityName(),
                    version, patch.getDescription(), DestinationComplianceMode.full);

                ConfigurationDefinition config = new ConfigurationDefinition("wildfly-patch", null);
                PropertyDefinitionSimple patchIdProp = new PropertyDefinitionSimple("patchId", "The ID of the patch",
                    true,
                    PropertySimpleType.STRING);
                patchIdProp.setDefaultValue(patch.getId());
                patchIdProp.setReadOnly(true);
                PropertyDefinitionSimple patchTypeProp = new PropertyDefinitionSimple("patchType",
                    "The type of the patch",
                    true, PropertySimpleType.STRING);
                patchTypeProp.setDefaultValue(patch.getType().toString());
                patchTypeProp.setReadOnly(true);

                config.put(patchIdProp);
                config.put(patchTypeProp);
                addCommonProperties(config);

                parseResults = new RecipeParseResults(props, config, null);
                fileName = patch.getId();
                recipe = patch.getContents();
            } else if (patchInfo.is(PatchBundle.class)) {
                PatchBundle patchBundle = patchInfo.as(PatchBundle.class);

                Patch lastPatch = null;
                StringBuilder allPatchIds = new StringBuilder();

                for (PatchBundle.Element p : patchBundle) {
                    lastPatch = p.getPatch();
                    allPatchIds.append(p.getPatch().getId()).append("#");
                }
                allPatchIds.replace(allPatchIds.length() - 1, allPatchIds.length(), "");

                if (lastPatch == null) {
                    throw new UnknownRecipeException("Not a Wildfly patch");
                }

                DeploymentProperties props = new DeploymentProperties(0, lastPatch.getIdentityName(),
                    lastPatch.getTargetVersion(), lastPatch.getDescription(), DestinationComplianceMode.full);

                ConfigurationDefinition config = new ConfigurationDefinition("wildfly-patch", null);
                PropertyDefinitionSimple allPatchIdsProp = new PropertyDefinitionSimple("allPatchIds",
                    "Hash-separated list of all individual patches the patch bundle is composed of.", true,
                    PropertySimpleType.STRING);
                allPatchIdsProp.setDefaultValue(allPatchIds.toString());
                allPatchIdsProp.setReadOnly(true);
                PropertyDefinitionSimple patchTypeProp = new PropertyDefinitionSimple("patchType",
                    "The type of the patch", true, PropertySimpleType.STRING);
                patchTypeProp.setDefaultValue("patch-bundle");
                patchTypeProp.setReadOnly(true);

                config.put(allPatchIdsProp);
                config.put(patchTypeProp);
                addCommonProperties(config);
View Full Code Here


        return new BundleDistributionInfo(recipe, parseResults, patchFiles);
    }

    void addCommonProperties(ConfigurationDefinition config) {
        PropertyDefinitionSimple overrideProp = new PropertyDefinitionSimple("override",
            "The value is a comma-separated list of the miscellaneous items in the patch that can be overridden on the server whether the item reports a conflict or not.",
            false, PropertySimpleType.LONG_STRING);
        PropertyDefinitionSimple overrideAllProp = new PropertyDefinitionSimple("override-all",
            "The argument does not expect any value and is optional. The default is 'false'. It signifies to bypass any content verification on the miscellaneous items changed by the patch.",
            false, PropertySimpleType.BOOLEAN);
        PropertyDefinitionSimple overrideModules = new PropertyDefinitionSimple("override-modules",
            "The argument does not expect any value and is optional. The default is 'false'. It signifies to bypass any content verification on the modules and OSGi bundles affected by the patch.",
            false, PropertySimpleType.LONG_STRING);
        PropertyDefinitionSimple preserve = new PropertyDefinitionSimple("preserve",
            "The value is a comma-separated list of the miscellaneous items that must be preserved and not modified by applying or rolling back a patch.",
            false, PropertySimpleType.LONG_STRING);
        PropertyDefinitionSimple restart = new PropertyDefinitionSimple("restart",
            "This only applies if the server being deployed to is running. When true, the server is stopped before the patch application and started back up afterwards.",
        true, PropertySimpleType.BOOLEAN);
        restart.setDefaultValue(Boolean.toString(true));
        PropertyDefinitionSimple takeOver = new PropertyDefinitionSimple("takeOver",
            "Set this to true ONLY in cases where you want this destination to become the new originating destination for the patch deployments to the servers in the resource group. Each server can have at most 1 originating destination for its patch deployments at a time. As an example, you might want to use this in cases where a destination that was used for prior patch deployments was deleted, yet the target servers weren't purged and thus still relate to the deleted destination as their originating destination.",
            true, PropertySimpleType.BOOLEAN);
        takeOver.setDefaultValue(Boolean.toString(false));

        config.put(overrideProp);
        config.put(overrideAllProp);
        config.put(overrideModules);
        config.put(preserve);
View Full Code Here

    }

    @Override
    public ConfigurationDefinition getImportConfigurationDefinition() {
        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.",
                true, PropertySimpleType.BOOLEAN);
        updateAllSchedules.setDefaultValue(Boolean.toString(UPDATE_SCHEDULES_DEFAULT));
        def.put(updateAllSchedules);

        PropertyDefinitionSimple metricName =
            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);

        PropertyDefinitionMap metricUpdateOverride =
            new PropertyDefinitionMap(METRIC_UPDATE_OVERRIDE_PROPERTY, null, true, metricName, resourceTypeName,
View Full Code Here

    @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;
View Full Code Here

                replaceListProperty(exList, newList);
            } else { // simple property or map-property
                replaceProperty(existingProperty, newProperty);
            }
        } else if (existingProperty instanceof PropertyDefinitionSimple) {
            PropertyDefinitionSimple existingPDS = (PropertyDefinitionSimple) existingProperty;

            if (newProperty instanceof PropertyDefinitionSimple) {
                PropertyDefinitionSimple newPDS = (PropertyDefinitionSimple) newProperty;

                existingPDS.setType(newPDS.getType());

                // handle <property-options>?
                List<PropertyDefinitionEnumeration> existingOptions = existingPDS.getEnumeratedValues();
                List<PropertyDefinitionEnumeration> newOptions = newPDS.getEnumeratedValues();

                List<PropertyDefinitionEnumeration> toPersist = missingInFirstList(existingOptions, newOptions);
                List<PropertyDefinitionEnumeration> toDelete = missingInFirstList(newOptions, existingOptions);
                List<PropertyDefinitionEnumeration> changed = intersection(existingOptions, newOptions);

                // sync the enumerated values and then merge the changes into the PDS, I think this
                // solves previous issues with orderIndex values.
                // First remove obsolete values
                for (PropertyDefinitionEnumeration pde : toDelete) {
                    existingPDS.removeEnumeratedValues(pde);
                }

                // save new ones
                for (PropertyDefinitionEnumeration pde : toPersist) {
                    existingPDS.addEnumeratedValues(pde);
                    entityManager.persist(pde);
                }

                // update others
                for (PropertyDefinitionEnumeration pde : changed) {
                    for (PropertyDefinitionEnumeration nPde : newOptions) {
                        if (nPde.equals(pde)) {
                            pde.setValue(nPde.getValue());
                            pde.setName(nPde.getName());
                        }
                    }
                }
                existingPDS = entityManager.merge(existingPDS);

                // handle <constraint> [0..*]

                Set<Constraint> exCon = existingPDS.getConstraints();
                if (exCon.size() > 0) {
                    for (Constraint con : exCon) {
                        con.setPropertyDefinitionSimple(null);
                        entityManager.remove(con);
                    }

                    existingPDS.getConstraints().clear(); // clear out existing
                }

                for (Constraint con : newPDS.getConstraints()) {
                    existingPDS.addConstraints(con);
                }

                // handle <defaultValue> [0..1]
                existingPDS.setDefaultValue(newPDS.getDefaultValue());

                // handle <c:source>
                existingPDS.setOptionsSource(newPDS.getOptionsSource());
            } else {
                // other type
                replaceProperty(existingProperty, newProperty);
            }
        }
View Full Code Here

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==7 : "Expected 7 props but got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla","For testing");
        definition.put(new PropertyDefinitionSimple("bool1","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool2","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool3","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool4","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool5","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool6","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool7","A boolean",true, PropertySimpleType.BOOLEAN));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==3 : "Expected 3 errors, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n ");
View Full Code Here

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==1 : "Expected 1 props but got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla","For testing");
        definition.put(new PropertyDefinitionSimple("bool1","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("bool2","A boolean",true, PropertySimpleType.BOOLEAN));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==1 : "Expected 1 error, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n ");
View Full Code Here

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==2 : "Expected 2 props but got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla","For testing");
        definition.put(new PropertyDefinitionSimple("bool1","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("optional","null string",false, PropertySimpleType.STRING));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==0 : "Expected 0 error, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n ");
View Full Code Here

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==3 : "Expected 3 props but got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla","For testing");
        definition.put(new PropertyDefinitionSimple("bool1","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("optional","null string",false, PropertySimpleType.STRING));
        // We define Inner as a simple property, but the user supplied a map
        definition.put(new PropertyDefinitionSimple("Inner","null string",false, PropertySimpleType.STRING));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==1 : "Expected 1 error, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n ");
View Full Code Here

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==3 : "Expected 3 props but got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla","For testing");
        definition.put(new PropertyDefinitionSimple("bool1","A boolean",true, PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("optional","null string",false, PropertySimpleType.STRING));
        // We define Inner as a list property, but the user supplied a simple one
        definition.put(new PropertyDefinitionList("Inner","Bla",true,
            new PropertyDefinitionSimple("Inner","fasel",true,PropertySimpleType.STRING)));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==1 : "Expected 1 error, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n ");
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.