Example usage for org.apache.commons.configuration Configuration getString

List of usage examples for org.apache.commons.configuration Configuration getString

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getString.

Prototype

String getString(String key);

Source Link

Document

Get a string associated with the given configuration key.

Usage

From source file:com.salesmanager.core.util.FileUtil.java

public static String getMediaPath() {
    Configuration conf = PropertiesUtil.getConfiguration();
    return conf.getString("core.bin.mediapath");
}

From source file:edu.lternet.pasta.token.TokenManagerTest.java

/**
 * @throws java.lang.Exception/*w w w.ja  v a2s  .c om*/
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {

    ConfigurationListener.configure();
    Configuration options = ConfigurationListener.getOptions();

    if (options == null) {
        fail("Failed to load the DataPortal properties file: 'dataportal.properties'");
    } else {
        uid = options.getString("tokenmanager.uid");
        if (uid == null) {
            fail("No value found for DataPortal property: 'tokenmanager.uid'");
        }
        token = options.getString("tokenmanager.token");
        if (token == null) {
            fail("No value found for DataPortal property: 'tokenmanager.token'");
        }
        if (!testToken.equals(token)) {
            fail("DataPortal property 'token' does not match test token");
        }
    }

}

From source file:com.salesmanager.core.util.FileUtil.java

public static String getDefaultCataloguePageUrl(MerchantStore store, HttpServletRequest request)
        throws Exception {

    String storeDomain = ReferenceUtil.getUnSecureDomain(store);

    Configuration conf = PropertiesUtil.getConfiguration();
    String shop = conf.getString("core.salesmanager.catalog.url");

    return new StringBuilder().append(storeDomain).append(shop).toString();
}

From source file:com.salesmanager.core.util.FileUtil.java

/**
 * Download files path (absolute path)//from  w ww  .java2 s  .  co m
 * @return
 */
public static String getDownloadFilePath() {
    Configuration config = PropertiesUtil.getConfiguration();
    String downloadPath = config.getString("core.download.path");
    return downloadPath;
}

From source file:es.bsc.vmm.ascetic.rest.rest.GenericVmManagerRestV1Test.java

private static void initializeAttributesFromConfigFile() {
    Configuration conf = Config.INSTANCE.getConfiguration();
    testImageUrl = conf.getString("testingImageUrl");
    testImageId = conf.getString("testingImageId");
    testImageName = conf.getString("testingImageName");
    testDeploymentBaseUrl = conf.getString("testingDeploymentBaseUrl");
}

From source file:com.wingnest.blueprints.impls.jpa.internal.wrappers.EntityManagerFactoryWrapper.java

@SuppressWarnings("rawtypes")
private static Map getProperties(Configuration configuration) {
    Iterator<String> it = configuration.getKeys(BLUEPRINTS_JPAGRAPH_PERSISTENCE_UNIT_PROPERTIES);
    Properties props = new Properties();
    while (it.hasNext()) {
        String key = it.next();//  ww  w  .  j  a  v  a  2  s.  c  o  m
        String newkey = key.substring(BLUEPRINTS_JPAGRAPH_PERSISTENCE_UNIT_PROPERTIES.length() + 1)
                .replaceAll("\\.\\.", ".");
        String value = configuration.getString(key);
        props.put(newkey, value);
        logger.debug("EntityManagerFactory getProperties : key = " + newkey + ", value = " + value);
    }
    return props;
}

From source file:com.salesmanager.core.util.FileUtil.java

public static ContentCategoryType getContentCategoryType(String fileContentType) {
    Configuration config = PropertiesUtil.getConfiguration();
    String imageContentTypes = config.getString("core.bin.images.contenttypes");
    String flashContentType = config.getString("core.shockwaveformat");
    String filesContentType = config.getString("core.bin.files.contenttypes");
    if (fileContentType == null || fileContentType.trim() == "") {
        return ContentCategoryType.INVALID;
    }//from w ww.  jav  a  2  s.  c o m
    if (imageContentTypes.toLowerCase().contains(fileContentType.toLowerCase())) {
        return ContentCategoryType.IMAGE;
    } else if (flashContentType.toLowerCase().equals(fileContentType.toLowerCase())) {
        return ContentCategoryType.FLASH;
    } else if (filesContentType.toLowerCase().contains(filesContentType.toLowerCase())) {
        return ContentCategoryType.FILE;
    } else {
        return ContentCategoryType.INVALID;
    }
}

From source file:com.salesmanager.core.util.FileUtil.java

public static String getStoreLogoPath(int merchantId, String storeLogo) {

    Configuration config = PropertiesUtil.getConfiguration();
    return new StringBuffer().append(IMAGE_PATH).append(config.getString("core.store.brandingsuri"))
            .append(merchantId).append("/header/").append(storeLogo).toString();

}

From source file:com.salesmanager.core.util.FileUtil.java

/**
 * Absolute file path/*from  w ww .  j a v  a  2  s .  c o m*/
 * @return
 */
public static String getBrandingFilePath() {
    Configuration config = PropertiesUtil.getConfiguration();
    return new StringBuilder().append(getMediaPath()).append(config.getString("core.branding.cart.filefolder"))
            .toString();
}

From source file:com.salesmanager.core.util.FileUtil.java

/**
 * Absolute file path/*from w  w w  .  j ava 2s  . c om*/
 * @return
 */
public static String getProductFilePath() {
    Configuration config = PropertiesUtil.getConfiguration();
    return new StringBuilder().append(getMediaPath()).append(config.getString("core.product.image.filefolder"))
            .toString();
}