当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationSetting类代码示例

本文整理汇总了Java中org.oscm.app.domain.ConfigurationSetting的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationSetting类的具体用法?Java ConfigurationSetting怎么用?Java ConfigurationSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConfigurationSetting类属于org.oscm.app.domain包,在下文中一共展示了ConfigurationSetting类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encryptedSettingsWithPrefix

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
/**
 * Encrypts all configuration settings with the _crypt: prefix with the new
 * method.
 * 
 * @throws ConfigurationException
 */
private void encryptedSettingsWithPrefix() throws ConfigurationException {
    String csSQL = "SELECT cs FROM ConfigurationSetting cs WHERE cs.settingKey like '%"
            + CRYPT_KEY_SUFFIX + "' OR cs.settingKey like '%"
            + CRYPT_KEY_SUFFIX_PASS + "'";
    TypedQuery<ConfigurationSetting> csQuery = em.createQuery(csSQL,
            ConfigurationSetting.class);
    List<ConfigurationSetting> csList = csQuery.getResultList();

    for (ConfigurationSetting cs : csList) {
        String value = cs.getSettingValue();
        if (value != null && value.startsWith(CRYPT_PREFIX)) {
            value = value.substring(CRYPT_PREFIX.length());
            cs.setDecryptedValue(value);
        }
    }

    em.flush();
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:25,代码来源:PasswordSetup.java

示例2: getProxyConfigurationSetting

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public String getProxyConfigurationSetting(PlatformConfigurationKey key)
        throws ConfigurationException {

    LOGGER.debug("Retrieving proxy configuration setting for key {}",
            key.name());
    Query query = em
            .createNamedQuery("ConfigurationSetting.getForProxyKey");
    query.setParameter("key", key.name());
    try {
        ConfigurationSetting result = (ConfigurationSetting) query
                .getSingleResult();
        return result.getDecryptedValue();
    } catch (NoResultException e) {
        if (key.name().equals(APP_SUSPEND)) {
            return "";
        } else {
            LOGGER.warn("No entry found for key {}", key.name());
            throw new ConfigurationException(String.format(
                    "No configuration setting found for key '%s'",
                    key.name()), key.name());
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:25,代码来源:APPConfigurationServiceBean.java

示例3: getControllerOrganizations

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public HashMap<String, String> getControllerOrganizations() {

    LOGGER.debug("Retrieving configured controllers");
    HashMap<String, String> result = new HashMap<>();
    Query query = em
            .createNamedQuery("ConfigurationSetting.getControllersForKey");
    query.setParameter("key",
            ControllerConfigurationKey.BSS_ORGANIZATION_ID.name());
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting currentCs = (ConfigurationSetting) entry;
        result.put(currentCs.getControllerId(),
                currentCs.getSettingValue());
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:18,代码来源:APPConfigurationServiceBean.java

示例4: storeAppConfigurationSettings

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void storeAppConfigurationSettings(HashMap<String, String> settings) throws ConfigurationException, GeneralSecurityException {

    LOGGER.debug("Storing configuration settings for APP platform");
    if (settings == null) {
        throw new IllegalArgumentException("All parameters must be set");
    }
    Query query = em
            .createNamedQuery("ConfigurationSetting.getForController");
    query.setParameter("controllerId", PROXY_ID);
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting setting = (ConfigurationSetting) entry;
        String key = setting.getSettingKey();
        if (settings.containsKey(key)) {
            if (settings.get(key) == null) {
                em.remove(setting);
            } else {
                setting.setDecryptedValue(settings.get(key));
                em.persist(setting);
            }
        }
        settings.remove(key);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:26,代码来源:APPConfigurationServiceBean.java

示例5: getControllerConfigurationSettings

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public HashMap<String, Setting> getControllerConfigurationSettings(
        String controllerId) throws ConfigurationException {

    LOGGER.debug("Retrieving configuration settings for controller '{}'",
            controllerId);
    HashMap<String, Setting> result = new HashMap<>();
    if (controllerId != null) {
        Query query = em
                .createNamedQuery("ConfigurationSetting.getForController");
        query.setParameter("controllerId", controllerId);
        List<?> resultList = query.getResultList();
        for (Object entry : resultList) {
            ConfigurationSetting currentCs = (ConfigurationSetting) entry;
            result.put(currentCs.getSettingKey(),
                    new Setting(currentCs.getSettingKey(),
                            currentCs.getDecryptedValue()));
        }
    }
    ControllerConfigurationKey[] keys = ControllerConfigurationKey.values();
    StringBuffer missing = new StringBuffer();
    for (int i = 0; i < keys.length; i++) {
        if (keys[i].isMandatory() && !result.containsKey(keys[i].name())) {
            if (missing.length() > 0) {
                missing.append(", ");
            }
            missing.append(keys[i].name());
        }
    }
    if (missing.length() > 0) {
        throw new ConfigurationException(
                "The controller configuration is missing the following parameter(s): "
                        + missing.toString(),
                missing.toString());
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:38,代码来源:APPConfigurationServiceBean.java

示例6: storeControllerOrganizations

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void storeControllerOrganizations(
        HashMap<String, String> controllerOrganizations) {

    LOGGER.debug("Storing configured controllers");
    Query query = em
            .createNamedQuery("ConfigurationSetting.getControllersForKey");
    query.setParameter("key",
            ControllerConfigurationKey.BSS_ORGANIZATION_ID.name());
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting currentCs = (ConfigurationSetting) entry;
        String cId = currentCs.getControllerId();
        if (controllerOrganizations.containsKey(cId)) {
            String value = controllerOrganizations.get(cId);
            if (value == null || value.trim().length() == 0) {
                em.remove(currentCs);
            } else {
                currentCs.setSettingValue(value);
                em.persist(currentCs);
            }
            controllerOrganizations.remove(cId);
        }
    }
    for (String key : controllerOrganizations.keySet()) {
        if (controllerOrganizations.get(key) != null
                && controllerOrganizations.get(key).trim().length() > 0) {
            ConfigurationSetting newSetting = new ConfigurationSetting();
            newSetting.setControllerId(key);
            newSetting.setSettingKey(
                    ControllerConfigurationKey.BSS_ORGANIZATION_ID.name());
            newSetting.setSettingValue(controllerOrganizations.get(key));
            em.persist(newSetting);
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:37,代码来源:APPConfigurationServiceBean.java

示例7: getAllProxyConfigurationSettings

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public HashMap<String, Setting> getAllProxyConfigurationSettings()
        throws ConfigurationException {
    LOGGER.debug("Retrieving all configuration settings for proxy");
    HashMap<String, Setting> result = new HashMap<>();
    Query query = em.createNamedQuery("ConfigurationSetting.getAllProxy");
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting currentCs = (ConfigurationSetting) entry;
        result.put(currentCs.getSettingKey(), new Setting(
                currentCs.getSettingKey(), currentCs.getDecryptedValue()));
    }
    PlatformConfigurationKey[] keys = PlatformConfigurationKey.values();
    StringBuffer missing = new StringBuffer();
    for (int i = 0; i < keys.length; i++) {
        if (keys[i].isMandatory() && !result.containsKey(keys[i].name())) {
            if (missing.length() > 0) {
                missing.append(", ");
            }
            missing.append(keys[i].name());
        }
    }
    if (missing.length() > 0) {
        throw new ConfigurationException(
                "The configuration is missing the following parameter(s): "
                        + missing.toString(),
                missing.toString());
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:31,代码来源:APPConfigurationServiceBean.java

示例8: getProxyConfigurationSettings

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public HashMap<String, Setting> getProxyConfigurationSettings()
        throws ConfigurationException {
    LOGGER.debug("Retrieving all configuration settings for proxy");
    HashMap<String, Setting> result = new HashMap<>();
    Query query = em.createNamedQuery("ConfigurationSetting.getAllProxy");
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting currentCs = (ConfigurationSetting) entry;
        result.put(currentCs.getSettingKey(), new Setting(
                currentCs.getSettingKey(), currentCs.getDecryptedValue()));
    }
    PlatformConfigurationKey[] keys = PlatformConfigurationKey.values();
    StringBuffer missing = new StringBuffer();
    for (int i = 0; i < keys.length; i++) {
        if (keys[i].isMandatory() && !result.containsKey(keys[i].name())) {
            if (missing.length() > 0) {
                missing.append(", ");
            }
            missing.append(keys[i].name());
        }
    }
    if (missing.length() > 0) {
        throw new ConfigurationException(
                "The configuration is missing the following parameter(s): "
                        + missing.toString(),
                missing.toString());
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:31,代码来源:APPConfigurationServiceBean.java

示例9: storeControllerConfigurationSettings

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void storeControllerConfigurationSettings(String controllerId,
        HashMap<String, Setting> settings) throws ConfigurationException {

    LOGGER.debug("Storing configuration settings for controller '{}'",
            controllerId);
    if (controllerId == null || settings == null) {
        throw new IllegalArgumentException("All parameters must be set");
    }
    Query query = em
            .createNamedQuery("ConfigurationSetting.getForController");
    query.setParameter("controllerId", controllerId);
    List<?> resultList = query.getResultList();
    for (Object entry : resultList) {
        ConfigurationSetting setting = (ConfigurationSetting) entry;
        String key = setting.getSettingKey();
        if (settings.containsKey(key)) {
            if (settings.get(key) == null
                    || settings.get(key).getValue() == null) {
                em.remove(setting);
            } else {
                setting.setDecryptedValue(settings.get(key).getValue());
                em.persist(setting);
            }
            settings.remove(key);
        }
    }
    for (String newKey : settings.keySet()) {
        ConfigurationSetting newSetting = new ConfigurationSetting();
        newSetting.setControllerId(controllerId);
        newSetting.setSettingKey(newKey);
        newSetting.setDecryptedValue(settings.get(newKey) != null
                ? settings.get(newKey).getValue() : null);
        em.persist(newSetting);
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:37,代码来源:APPConfigurationServiceBean.java

示例10: getKeyFilePath

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
public String getKeyFilePath() throws ConfigurationException {
    TypedQuery<ConfigurationSetting> query = em.createNamedQuery(
            "ConfigurationSetting.getForProxyKey",
            ConfigurationSetting.class);
    query.setParameter("key", KEY_PATH);

    ConfigurationSetting setting;
    try {
        setting = query.getSingleResult();
    } catch (NoResultException e) {
        throw new ConfigurationException("Setting for keyfile is not set");
    }

    return setting.getSettingValue();
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:16,代码来源:APPConfigurationServiceBean.java

示例11: createConfigSetting

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
/**
 * Creates and persists a configuration setting.
 * 
 * @param key
 * @param value
 * @throws Exception
 */
private void createConfigSetting(final String key, final String value)
        throws Exception {
    runTX(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
            String val = value == null ? "testValue" : value;
            ConfigurationSetting cs = new ConfigurationSetting();
            cs.setSettingKey(key);
            cs.setSettingValue(val);
            em.persist(cs);
            return null;
        }
    });
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:22,代码来源:PasswordSetupIT.java

示例12: createContorllerConfigSetting

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
/**
 * Creates and persists a controller specific configuration setting.
 * 
 * @param controllerId
 * @param settingKey
 * @param value
 * @throws Exception
 */
private void createContorllerConfigSetting(final String controllerId,
        final String settingKey, final String value) throws Exception {
    runTX(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
            ConfigurationSetting cs = new ConfigurationSetting();
            cs.setControllerId(controllerId);
            cs.setSettingKey(settingKey);
            cs.setSettingValue(value);
            em.persist(cs);
            return null;
        }
    });
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:23,代码来源:PasswordSetupIT.java

示例13: createConfigSetting

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
/**
 * Creates and persists a configuration setting.
 * 
 * @param key
 * @param value
 * @throws Exception
 */
private void createConfigSetting(final String key, final String value)
        throws Exception {
    runTX(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
            String val = value == null ? "testValue" : value;
            ConfigurationSetting cs = new ConfigurationSetting();
            cs.setSettingKey(key);
            cs.setDecryptedValue(val);
            em.persist(cs);
            return null;
        }
    });
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:22,代码来源:APPConfigurationServiceIT.java

示例14: createContorllerConfigSetting

import org.oscm.app.domain.ConfigurationSetting; //导入依赖的package包/类
/**
 * Creates and persists a controller specific configuration setting.
 * 
 * @param controllerId
 * @param settingKey
 * @param value
 * @throws Exception
 */
private void createContorllerConfigSetting(final String controllerId,
        final String settingKey, final String value) throws Exception {
    runTX(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
            ConfigurationSetting cs = new ConfigurationSetting();
            cs.setControllerId(controllerId);
            cs.setSettingKey(settingKey);
            cs.setDecryptedValue(value);
            em.persist(cs);
            return null;
        }
    });
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:23,代码来源:APPConfigurationServiceIT.java


注:本文中的org.oscm.app.domain.ConfigurationSetting类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。