Package org.apache.cloudstack.framework.config.impl

Examples of org.apache.cloudstack.framework.config.impl.ConfigurationVO


        Long accountId = cmd.getAccountId();
        CallContext.current().setEventDetails(
                " Name: " + name + " New Value: "
                        + (((name.toLowerCase()).contains("password")) ? "*****" : (((value == null) ? "" : value))));
        // check if config value exists
        ConfigurationVO config = _configDao.findByName(name);
        String catergory = null;

        // FIX ME - All configuration parameters are not moved from config.java to configKey
        if (config == null) {
            if ( _configDepot.get(name) == null ) {
                s_logger.warn("Probably the component manager where configuration variable " + name + " is defined needs to implement Configurable interface");
                throw new InvalidParameterValueException("Config parameter with name " + name + " doesn't exist");
            }
            catergory = _configDepot.get(name).category();
        } else {
            catergory = config.getCategory();
        }

        if (value == null) {
            return _configDao.findByName(name);
        }
View Full Code Here


        }
    }

    private String validateConfigurationValue(String name, String value, String scope) {

        ConfigurationVO cfg = _configDao.findByName(name);
        if (cfg == null) {
            s_logger.error("Missing configuration variable " + name + " in configuration table");
            return "Invalid configuration variable.";
        }

        String configScope = cfg.getScope();
        if (scope != null) {
            if (!configScope.contains(scope)) {
                s_logger.error("Invalid scope id provided for the parameter " + name);
                return "Invalid scope id provided for the parameter " + name;
            }
View Full Code Here

    @Override
    @Before
    public void setUp() {
        ComponentContext.initComponentsLifeCycle();

        ConfigurationVO configVO = new ConfigurationVO("200", "200", "200", "200", "200", "200");
        Mockito.when(configDao.findByName(Matchers.anyString())).thenReturn(configVO);

        Mockito.when(offDao.persist(Matchers.any(NetworkOfferingVO.class))).thenReturn(new NetworkOfferingVO());
        Mockito.when(offDao.persist(Matchers.any(NetworkOfferingVO.class), Matchers.anyMap())).thenReturn(new NetworkOfferingVO());
        Mockito.when(mapDao.persist(Matchers.any(NetworkOfferingServiceMapVO.class))).thenReturn(new NetworkOfferingServiceMapVO());
View Full Code Here

    StoragePoolVO storage = null;

    @Before
    @DB
    public void setup() throws Exception {
        ConfigurationVO cfg = configDao.findByName(Config.VmAllocationAlgorithm.key());
        if (cfg == null) {
            ConfigurationVO configVO = new ConfigurationVO("test", "DEFAULT", "test", Config.VmAllocationAlgorithm.key(), "userdispersing", null);
            configDao.persist(configVO);
        }
        ComponentContext.initComponentsLifeCycle();

    }
View Full Code Here

        throw new CloudRuntimeException("Comparing ConfigKey to " + obj.toString());
    }

    public T value() {
        if (_value == null || isDynamic()) {
            ConfigurationVO vo = s_depot != null ? s_depot.global().findById(key()) : null;
            _value = valueOf(vo != null ? vo.getValue() : defaultValue());
        }

        return _value;
    }
View Full Code Here

        return false;
    }

    @Override
    public String getValue(String name) {
        ConfigurationVO config = findByName(name);
        return (config == null) ? null : config.getValue();
    }
View Full Code Here

    @Override
    @DB
    public String getValueAndInitIfNotExist(String name, String category, String initValue, String desc) {
        String returnValue = initValue;
        try {
            ConfigurationVO config = findByName(name);
            if (config != null) {
                if (config.getValue() != null) {
                    returnValue = config.getValue();
                } else {
                    update(name, category, initValue);
                }
            } else {
                if (category.equals("Hidden") || category.equals("Secure")) {
                    initValue = DBEncryptionUtil.encrypt(initValue);
                }
                ConfigurationVO newConfig = new ConfigurationVO(category, "DEFAULT", "management-server", name, initValue, desc);
                persist(newConfig);
            }
            return returnValue;
        } catch (Exception e) {
            s_logger.warn("Unable to update Configuration Value", e);
View Full Code Here

         * There is no query filter now. It is derived from ldap.user.object and ldap.search.group.principle
         */
//        ConfigurationVO cvo = _configDao.findByName(LDAPParams.queryfilter.toString());
//        _configDao.update(cvo.getName(),cvo.getCategory(),getQueryFilter());

        ConfigurationVO cvo = _configDao.findByName("ldap.basedn");
        _configDao.update(cvo.getName(), cvo.getCategory(), getSearchBase());

        /**
         * There is no ssl now. it is derived from the presence of trust store and password
         */
//        cvo = _configDao.findByName(LDAPParams.usessl.toString());
//        _configDao.update(cvo.getName(),cvo.getCategory(),getUseSSL().toString());

        cvo = _configDao.findByName("ldap.bind.principal");
        _configDao.update(cvo.getName(), cvo.getCategory(), getBindDN());

        cvo = _configDao.findByName("ldap.bind.password");
        _configDao.update(cvo.getName(), cvo.getCategory(), getBindPassword());

        cvo = _configDao.findByName("ldap.truststore");
        _configDao.update(cvo.getName(), cvo.getCategory(), getTrustStore());

        cvo = _configDao.findByName("ldap.truststore.password");
        _configDao.update(cvo.getName(), cvo.getCategory(), getTrustStorePassword());

        return true;
    }
View Full Code Here

        Integer apiPort = null; // api port, null by default
        final SearchCriteria<ConfigurationVO> sc = _configDao.createSearchCriteria();
        sc.addAnd("name", SearchCriteria.Op.EQ, Config.IntegrationAPIPort.key());
        final List<ConfigurationVO> values = _configDao.search(sc, null);
        if ((values != null) && (values.size() > 0)) {
            final ConfigurationVO apiPortConfig = values.get(0);
            if (apiPortConfig.getValue() != null) {
                apiPort = Integer.parseInt(apiPortConfig.getValue());
            }
        }

        final Map<String, String> configs = _configDao.getConfiguration();
        final String strSnapshotLimit = configs.get(Config.ConcurrentSnapshotsThresholdPerHost.key());
View Full Code Here

        if (scope != null && !scope.isEmpty()) {
            // Populate values corresponding the resource id
            List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
            for (ConfigurationVO param : result.first()) {
                ConfigurationVO configVo = _configDao.findByName(param.getName());
                configVo.setValue(_configDepot.get(param.getName()).valueIn(id).toString());
                configVOList.add(configVo);
    }

            return new Pair<List<? extends Configuration>, Integer>(configVOList, configVOList.size());
        }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.framework.config.impl.ConfigurationVO

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.