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

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


        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


        // now check the upgrades
        PropertyDefinitionSimple prop1 = (PropertyDefinitionSimple) updatedConfigDef.get("prop1");
        assert prop1 != null;
        assert prop1.getEnumeratedValues().size() == 0 : "Found an option value. ";
        PropertyOptionsSource source = prop1.getOptionsSource();
        assert source != null : "PropertyOptionSource was not persisted";
        assert source.getFilter() == null : "Assumed filter to be null, but was " + source.getFilter();

        PropertyDefinitionSimple prop2 = (PropertyDefinitionSimple) updatedConfigDef.get("prop2");
        assert prop2 != null;
        assert prop2.getEnumeratedValues().size() == 1;
        assert prop2.getOptionsSource() != null;
View Full Code Here

     */
    private void handlePDS(final Subject subject, Resource resource, Resource baseResource, PropertyDefinitionSimple pds) {

        if (pds.getOptionsSource() != null) {
            // evaluate the source parameters
            PropertyOptionsSource pos = pds.getOptionsSource();
            PropertyOptionsSource.TargetType tt = pos.getTargetType();
            String expression = pos.getExpression();
            PropertyOptionsSource.ExpressionScope expressionScope = pos.getExpressionScope();
            String filter = pos.getFilter();
            Pattern filterPattern = null;
            if (filter != null)
                filterPattern = Pattern.compile(filter);

            if (tt == PropertyOptionsSource.TargetType.RESOURCE || tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
View Full Code Here

TOP

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

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.