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

Examples of org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint


                    Long longMin = (intDetails.getMinimum() != null) ? new Long(intDetails.getMinimum().toString())
                        : null;
                    Long longMax = (intDetails.getMaximum() != null) ? new Long(intDetails.getMaximum().toString())
                        : null;

                    IntegerRangeConstraint ic = new IntegerRangeConstraint(longMin, longMax);
                    toConstraints.add(ic);
                } else if (constraint instanceof RegexConstraintType) {
                    RegexConstraintType regexDetails = (RegexConstraintType) constraint;

                    RegexConstraint rc = new RegexConstraint();
View Full Code Here


    @NotNull
    public static Validator createValidator(Constraint constraint) {
        Validator validator;
        if (constraint instanceof IntegerRangeConstraint) {
            IntegerRangeConstraint integerRangeConstraint = (IntegerRangeConstraint) constraint;
            LongRangeValidator longRangeValidator = new LongRangeValidator();
            Long minValue = integerRangeConstraint.getMinimum();
            if (minValue != null) {
                longRangeValidator.setMinimum(minValue);
            }

            Long maxValue = integerRangeConstraint.getMaximum();
            if (maxValue != null) {
                longRangeValidator.setMaximum(maxValue);
            }

            validator = longRangeValidator;
View Full Code Here

        Set<Constraint> constraints = propertyDefinition.getConstraints();
        if (constraints != null) {
            for (Constraint constraint : constraints) {
                if (constraint instanceof IntegerRangeConstraint) {
                    IntegerRangeConstraint integerConstraint = ((IntegerRangeConstraint) constraint);
                    IntegerRangeValidator validator = new IntegerRangeValidator();
                    if (integerConstraint.getMinimum() != null) {
                        validator.setMin(integerConstraint.getMinimum().intValue());
                    } else {
                        validator.setMin(Integer.MIN_VALUE);
                    }
                    if (integerConstraint.getMaximum() != null) {
                        validator.setMax(integerConstraint.getMaximum().intValue());
                    } else {
                        validator.setMax(Integer.MAX_VALUE);
                    }

                    validators.add(validator);
View Full Code Here

            PropertyDefinitionSimple propDef = config.getPropertyDefinitionSimple("secureJnpPort");
            Set<Constraint> constraints = propDef.getConstraints();
            assert constraints.size() == 2 : "Expected to get 2 constraints, but got " + constraints.size();
            for (Constraint co : constraints) {
                if (co instanceof IntegerRangeConstraint) {
                    IntegerRangeConstraint irc = (IntegerRangeConstraint) co;
                    assert irc.getMinimum() == 5; // TODO change when JBNADM-1597 is being worked on
                    assert irc.getMaximum() == 0;
                } else if (co instanceof FloatRangeConstraint) {
                    FloatRangeConstraint frc = (FloatRangeConstraint) co;
                    assert frc != null;
                    assert frc.getMaximum() == 0.0; // TODO change when JBNADM-1597 is being worked on
                    assert frc.getMinimum() == 5.0;
View Full Code Here

                    assert found == optionVals.length;
                    Set<Constraint> constraints = pds.getConstraints();
                    assert constraints.size() == 2;
                    for (Constraint constraint : constraints) {
                        if (constraint instanceof IntegerRangeConstraint) {
                            IntegerRangeConstraint irc = (IntegerRangeConstraint) constraint;
                            assert irc != null : "Integer-constraint was null, but should not be";
                            // See JBNADM-1596/97
                            assert irc.getDetails().equals("-2#10");
                            // TODO (ips, 3/31/10): The below is a workaround for IntegerRangeConstraint.onLoad() not being called by Hibernate.
                            irc.setDetails(irc.getDetails());
                            assert irc.getMaximum() == 10;
                            assert irc.getMinimum() == -2;
                        } else if (constraint instanceof FloatRangeConstraint) {
                            FloatRangeConstraint frc = (FloatRangeConstraint) constraint;
                            assert frc != null : "Float-constraint was null, but should not be";
                            // See JBNADM-1596/97
                            assert frc.getDetails().equals("10.0#5.0");
View Full Code Here

            case AGENT_MAX_QUIET_TIME_ALLOWED:
                pd.setDescription(MSG.view_admin_systemSettings_AgentMaxQuietTimeAllowed_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_AgentMaxQuietTimeAllowed_name());
                pd.setPropertyGroupDefinition(generalGroup);
                // don't allow less than 3m which is 3 * the ping interval, anything less risks unwanted backfill
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(3), null));
                pd.setDefaultValue("5");
                break;
            case RHQ_SESSION_TIMEOUT:
                pd.setDescription(MSG.view_admin_systemSettings_RHQSessionTimeout_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_RHQSessionTimeout_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("1");
                break;
            case AGENT_AUTO_UPDATE_ENABLED:
                pd.setDescription(MSG.view_admin_systemSettings_EnableAgentAutoUpdate_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_EnableAgentAutoUpdate_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue("true");
                break;
            case DEBUG_MODE_ENABLED:
                pd.setDescription(MSG.view_admin_systemSettings_EnableDebugMode_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_EnableDebugMode_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue("false");
                break;
            case LOGIN_WITHOUT_ROLES_ENABLED:
                pd.setDescription(MSG.view_admin_systemSettings_EnableLoginWithoutRoles_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_EnableLoginWithoutRoles_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue("true");
                break;
            case EXPERIMENTAL_FEATURES_ENABLED:
                pd.setDescription(MSG.view_admin_systemSettings_EnableExperimentalFeatures_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_EnableExperimentalFeatures_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue("false");
                break;
            case REMOTE_SSH_USERNAME_DEFAULT:
                pd.setDescription(MSG.view_admin_systemSettings_RemoteSshUsernameDefault_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_RemoteSshUsernameDefault_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue(null);
                break;
            case REMOTE_SSH_PASSWORD_DEFAULT:
                pd.setDescription(MSG.view_admin_systemSettings_RemoteSshPasswordDefault_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_RemoteSshPasswordDefault_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue(null);
                break;

            ////////////////////////////////////////
            // Data Manager Configuration Properties

            case DATA_MAINTENANCE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_DataMaintenance_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_DataMaintenance_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("1");
                break;

            case AVAILABILITY_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_AvailabilityPurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_AvailabilityPurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("365");
                break;

            case ALERT_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_AlertPurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_AlertPurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("31");
                break;

            case TRAIT_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_TraitPurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_TraitPurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("365");
                break;

            case RT_DATA_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_RtDataPurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_RtDataPurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("31");
                break;

            case EVENT_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_EventPurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_EventPurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("14");
                break;

            case DRIFT_FILE_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_DriftFilePurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_DriftFilePurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("31");
                break;

            case OPERATION_HISTORY_PURGE_PERIOD:
                pd.setDescription(MSG.view_admin_systemSettings_OperationHistoryPurge_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_OperationHistoryPurge_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(0), null));
                pd.setDefaultValue("0");
                break;

            case DATA_REINDEX_NIGHTLY:
                pd.setDescription(MSG.view_admin_systemSettings_DataReindex_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_DataReindex_name());
                pd.setPropertyGroupDefinition(dataManagerGroup);
                pd.setDefaultValue("false");
                break;

            //////////////////////////////////////////////
            // Automatic Baseline Configuration Properties

            case BASE_LINE_FREQUENCY:
                pd.setDescription(MSG.view_admin_systemSettings_BaselineFrequency_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_BaselineFrequency_name());
                pd.setPropertyGroupDefinition(baselineGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(0), null));
                pd.setDefaultValue("3");
                break;

            case BASE_LINE_DATASET:
                pd.setDescription(MSG.view_admin_systemSettings_BaselineDataSet_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_BaselineDataSet_name());
                pd.setPropertyGroupDefinition(baselineGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), Long.valueOf(14))); // can't do more than 14 days since our 1h table doesn't hold more
                pd.setDefaultValue("7");
                break;

            ////////////////////////////////
            // LDAP Configuration Properties

            case LDAP_BASED_JAAS_PROVIDER:
                pd.setDescription(MSG.view_admin_systemSettings_JAASProvider_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_JAASProvider_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("false");
                break;

            case LDAP_NAMING_PROVIDER_URL:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPUrl_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPUrl_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("ldap://localhost");
                break;

            case USE_SSL_FOR_LDAP:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPProtocol_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPProtocol_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("false");
                break;

            case LDAP_LOGIN_PROPERTY:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPLoginProperty_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPLoginProperty_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("cn");
                break;

            case LDAP_FILTER:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPFilter_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPFilter_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("");
                break;

            case LDAP_GROUP_FILTER:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPGroupFilter_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupFilter_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("objectclass=groupOfNames");
                break;

            case LDAP_GROUP_PAGING:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPGroupUsePaging_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupUsePaging_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("false");
                break;

            case LDAP_GROUP_QUERY_PAGE_SIZE:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPGroupPageSize_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupPageSize_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(1), null));
                pd.setDefaultValue("1000");
                break;

            case LDAP_GROUP_MEMBER:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPGroupMember_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupMember_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("member");
                break;

            case LDAP_GROUP_USE_POSIX:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPGroupUsePosixGroup_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPGroupUsePosixGroup_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("false");
                break;

            case LDAP_BASE_DN:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPBaseDN_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPBaseDN_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("o=RedHat,c=US");
                break;

            case LDAP_BIND_DN:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPBindDN_desc());
                pd.setDisplayName(MSG.common_title_username());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("");
                break;

            case LDAP_BIND_PW:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPBindPW_desc());
                pd.setDisplayName(MSG.common_title_password());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("");
                break;

            case LDAP_FOLLOW_REFERRALS:
                pd.setDescription(MSG.view_admin_systemSettings_LDAPFollowReferrals_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_LDAPFollowReferrals_name());
                pd.setPropertyGroupDefinition(ldapGroup);
                pd.setDefaultValue("false");
                break;

            ///////////////////////////////////////////
            // Drift Server Configuration Properties //
            ///////////////////////////////////////////

            case ACTIVE_DRIFT_PLUGIN:
                pd.setDescription(MSG.view_admin_systemSettings_ActiveDriftServerPlugin_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_ActiveDriftServerPlugin_name());
                pd.setPropertyGroupDefinition(driftGroup);

                List<PropertyDefinitionEnumeration> options = new ArrayList<PropertyDefinitionEnumeration>();
                for (Map.Entry<String, String> entry : driftPlugins.entrySet()) {
                    options.add(new PropertyDefinitionEnumeration(entry.getValue(), entry.getKey()));
                }

                pd.setEnumeratedValues(options, false);
                break;
            /*
             * Proxy Server Settings
             */
            case HTTP_PROXY_SERVER_HOST:
                pd.setDescription(MSG.view_admin_systemSettings_HttpProxyHost_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_HttpProxyHost_name());
                pd.setPropertyGroupDefinition(proxyGroup);
                pd.setDefaultValue(null);
                break;

            case HTTP_PROXY_SERVER_PORT:
                pd.setDescription(MSG.view_admin_systemSettings_HttpProxyPort_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_HttpProxyPort_name());
                pd.setPropertyGroupDefinition(proxyGroup);
                pd.addConstraints(new IntegerRangeConstraint(Long.valueOf(0), Long.valueOf(65535)));
                pd.setDefaultValue("0");
                break;

            case HTTP_PROXY_SERVER_USERNAME:
                pd.setDescription(MSG.view_admin_systemSettings_HttpProxyUsername_desc());
View Full Code Here

        boolean bothRangeFound = false;

        for (Constraint c : simple.getConstraints()) {
            assert c instanceof IntegerRangeConstraint : "serverProperty31 loaded with invalid constraint of class: "
                + c.getClass();
            IntegerRangeConstraint ic = (IntegerRangeConstraint) c;
            if ((ic.getMinimum() != null) && (ic.getMaximum() == null)) {
                assert ic.getMinimum().compareTo((long) 0) == 0 : "serverProperty31 minimum integer range read incorrectly with no maximum range";
                noMaxRangeFound = true;
            } else if ((ic.getMinimum() == null) && (ic.getMaximum() != null)) {
                assert ic.getMaximum().compareTo((long) 100) == 0 : "serverProperty31 maximum integer range read incorrectly with no minimum range";
                noMinRangeFound = true;
            } else if ((ic.getMinimum() != null) && (ic.getMaximum() != null)) {
                assert ic.getMinimum().compareTo((long) 20) == 0 : "serverProperty31 minimum integer range read incorrectly with maximum range";
                assert ic.getMaximum().compareTo((long) 80) == 0 : "serverProperty31 maximum integer range read incorrectly with minimum range";
                bothRangeFound = true;
            } else {
                assert false : "serverProperty31 loaded with unexpected integer range";
            }
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.definition.constraint.IntegerRangeConstraint

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.