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

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


    public void testListOfMapsPropertyConversion() throws Exception {
        ConfigurationDefinition def = new ConfigurationDefinition("null", null);
        PropertyDefinitionList listDef =
            new PropertyDefinitionList("list", "list descr", true, new PropertyDefinitionMap("map", "map descr", true,
                new PropertyDefinitionSimple("prop1", "prop1 descr", true, PropertySimpleType.BOOLEAN),
                new PropertyDefinitionSimple("prop2", "prop2 descr", false, PropertySimpleType.PASSWORD)));
        def.put(listDef);

        Configuration config = new Configuration();
        PropertyList list =
            new PropertyList("list", new PropertyMap("map", new PropertySimple("prop1", "value1"), new PropertySimple(
View Full Code Here


        assertNotNull(prop, "Could not find the expected property");

        assertEquals(propDef.getClass(), PropertyDefinitionSimple.class, "Unexpected type of the property definition");
        assertEquals(prop.getClass(), PropertySimple.class, "Unexpecetd type of the property");

        PropertyDefinitionSimple simpleDef = (PropertyDefinitionSimple) propDef;
        PropertySimple simpleProp = (PropertySimple) prop;

        assertEquals(simpleDef.getType(), PropertySimpleType.INTEGER, "Unexpected type of the simple property definition");
        assertEquals(simpleProp.getIntegerValue(), Integer.valueOf(42), "Unexpected value of the simple property");
    }
View Full Code Here

        PropertyList listProp = (PropertyList) prop;

        PropertyDefinition memberDef = listDef.getMemberDefinition();
        assertEquals(memberDef.getClass(), PropertyDefinitionSimple.class, "Unexpected type of the list member property definition");

        PropertyDefinitionSimple memberSimpleDef = (PropertyDefinitionSimple) memberDef;
        assertEquals(memberSimpleDef.getName(), "member");
        assertEquals(memberSimpleDef.getType(), PropertySimpleType.INTEGER);

        assertEquals(listProp.getList().size(), 3, "Unexpected number of list members");

        for(int i = 0; i < 3; ++i) {
            Property memberProp = listProp.getList().get(i);
View Full Code Here

        assertEquals(m1Def.getClass(), PropertyDefinitionSimple.class);
        assertEquals(m2Def.getClass(), PropertyDefinitionSimple.class);
        assertEquals(m1Prop.getClass(), PropertySimple.class);
        assertEquals(m2Prop.getClass(), PropertySimple.class);

        PropertyDefinitionSimple m1SimpleDef = (PropertyDefinitionSimple) m1Def;
        PropertyDefinitionSimple m2SimpleDef = (PropertyDefinitionSimple) m2Def;
        PropertySimple m1SimpleProp = (PropertySimple) m1Prop;
        PropertySimple m2SimpleProp = (PropertySimple) m2Prop;

        assertEquals(m1SimpleDef.getName(), "m1");
        assertEquals(m2SimpleDef.getName(), "m2");
        assertEquals(m1SimpleDef.getType(), PropertySimpleType.INTEGER);
        assertEquals(m2SimpleDef.getType(), PropertySimpleType.STRING);

        assertEquals(m1SimpleProp.getName(), "m1");
        assertEquals(m2SimpleProp.getName(), "m2");
        assertEquals(m1SimpleProp.getIntegerValue(), Integer.valueOf(1));
        assertEquals(m2SimpleProp.getStringValue(), "v");
View Full Code Here

        PropertyDefinitionList listDef = (PropertyDefinitionList) def.get("list");
        PropertyList listProp = (PropertyList) conf.get("list");

        PropertyDefinitionMap mapDef = (PropertyDefinitionMap) listDef.getMemberDefinition();
        PropertyDefinitionSimple m1Def = (PropertyDefinitionSimple) mapDef.get("m1");
        PropertyDefinitionSimple m2Def = (PropertyDefinitionSimple) mapDef.get("m2");

        assertEquals(mapDef.getName(), "map");
        assertEquals(m1Def.getType(), PropertySimpleType.INTEGER);
        assertEquals(m2Def.getType(), PropertySimpleType.STRING);

        assertEquals(listProp.getList().size(), 2, "Unexpected number of maps in the list");

        PropertyMap firstMapValue = (PropertyMap) listProp.getList().get(0);
        PropertyMap secondMapValue = (PropertyMap) listProp.getList().get(1);
View Full Code Here

        // check the validity of the plugin config definition
        ConfigurationDescriptor pluginConfigXml = descriptor.getPluginConfiguration();
        assert pluginConfigXml != null : "should have parsed the plugin config";
        ConfigurationDefinition configDef = ConfigurationMetadataParser.parse("test", pluginConfigXml);
        assert configDef != null : "should have parsed the plugin config properties";
        PropertyDefinitionSimple propDef = configDef.getPropertyDefinitionSimple("bundleprop1");
        assert propDef != null : "missing a simple property definition";
    }
View Full Code Here

        ConfigurationDefinition configDef = null;
        if (recipeContext.getReplacementVariables() != null) {
            configDef = new ConfigurationDefinition("replacementVariables", null);
            for (String replacementVar : recipeContext.getReplacementVariables()) {
                PropertyDefinitionSimple prop = new PropertyDefinitionSimple(replacementVar,
                    "Needed by bundle recipe.", false, PropertySimpleType.STRING);
                prop.setDisplayName(replacementVar);
                prop.setDefaultValue(recipeContext.getReplacementVariableDefaultValues().get(replacementVar));
                configDef.put(prop);
            }
        }

        RecipeParseResults results = new RecipeParseResults(bundleMetadata, configDef, bundleFileNames);
View Full Code Here

        PropertySimple propertySimple = propertySetComponent.getProperty();
        if (propertySimple == null)
            // This means the 'propertyExpressionString' request parameter was not specified, which means this is
            // the initial display of the main configSet page, which means there's nothing for us to render.
            return;
        PropertyDefinitionSimple propertyDefinitionSimple = propertySetComponent.getPropertyDefinition();

        addPropertyDisplayNameAndDescription(propertySetComponent, propertyDefinitionSimple, propertySimple);

        boolean configReadOnly = propertySetComponent.getReadOnly() != null && propertySetComponent.getReadOnly();
        boolean propIsReadOnly = PropertyRenderingUtility.isReadOnly(propertyDefinitionSimple.isReadOnly(),
            propertyDefinitionSimple.isRequired(), null, configReadOnly,false);
        HtmlPanelGroup setAllToSameValueControlPanel = null;
        if (!propIsReadOnly) {
            // NOTE: We'll add children to the below panel a bit later when we know the id's of the inputs.
            FacesComponentUtility.addVerbatimText(propertySetComponent, "<table class='"
                + CssStyleClasses.MEMBER_PROPERTIES_TABLE + "'><tr><td align='center'>");
View Full Code Here

            //don't include the readonly properties in the configuration editor
            if (prop.isReadOnly()) {
                continue;
            }

            PropertyDefinitionSimple pd = prop.createPropertyDefinition();

            def.put(pd);

            switch (prop) {

            ///////////////////////////////////
            // General Configuration Properties

            case BASE_URL:
                pd.setDescription(MSG.view_admin_systemSettings_BaseURL_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_BaseURL_name());
                pd.setPropertyGroupDefinition(generalGroup);
                pd.setDefaultValue("http://localhost:7080");
                break;
            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());
                pd.setDisplayName(MSG.view_admin_systemSettings_HttpProxyUsername_name());
                pd.setPropertyGroupDefinition(proxyGroup);
                pd.setDefaultValue(null);
                break;

            case HTTP_PROXY_SERVER_PASSWORD:
                pd.setDescription(MSG.view_admin_systemSettings_HttpProxyPassword_desc());
                pd.setDisplayName(MSG.view_admin_systemSettings_HttpProxyPassword_name());
                pd.setPropertyGroupDefinition(proxyGroup);
                pd.setDefaultValue(null);
                break;

            }


View Full Code Here

    private void addItemsForPropertyRecursively(PropertyDefinition propertyDefinition, Property property,
        boolean oddRow, List<FormItem> fields) {
        List<FormItem> fieldsForThisProperty;

        if (propertyDefinition instanceof PropertyDefinitionSimple) {
            final PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
            PropertySimple propertySimple = (PropertySimple) property;
            fieldsForThisProperty = buildFieldsForPropertySimple(propertyDefinition, propertyDefinitionSimple,
                propertySimple);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            ///@TODO
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.