// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/exception/ExtensionInitializationException.java
// public class ExtensionInitializationException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public ExtensionInitializationException(String message) {
//         super(message);
//     }
// 
//     public ExtensionInitializationException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ExtensionInitializationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }
// 
// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/resolver/locale/LocaleResolverFactory.java
// public class LocaleResolverFactory {
// 
//     private static volatile LocaleResolver localeResolver;
// 
//     private LocaleResolverFactory() {
//     }
// 
//     /**
//      * Gets the configured extension locale resolver
//      * 
//      * @return The extension configured locale resolver
//      */
//     public static LocaleResolver getLocaleResolver() {
//         return localeResolver;
//     }
// 
//     /**
//      * Sets the configured extension locale resolver
//      * 
//      * @param localeResolver
//      *            The configured extension locale resolver
//      */
//     public static void setLocaleResolver(LocaleResolver localeResolver) {
//         LocaleResolverFactory.localeResolver = localeResolver;
//     }
// 
// }
// 
// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/resolver/locale/StandaloneLocaleResolver.java
// public class StandaloneLocaleResolver implements LocaleResolver {
// 
//     /**
//      * See {@link LocaleResolver#getLocale()}
//      */
//     @Override
//     public Locale getLocale() {
//         return Locale.getDefault();
//     }
// 
// }


import java.io.IOException;
import java.net.URL;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.byteslounge.cdi.exception.ExtensionInitializationException;
import com.byteslounge.cdi.resolver.locale.LocaleResolverFactory;
import com.byteslounge.cdi.resolver.locale.StandaloneLocaleResolver;
/*
 * Copyright 2014 byteslounge.com (Gonçalo Marques).
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package com.byteslounge.cdi.configuration;




/**
 * Defines the global application configuration.
 * 
 * @author Gonçalo Marques
 * @since 1.0.0
 */
public enum ExtensionConfiguration {

    INSTANCE;

    private static final String EXTENSION_PROPERTIES_FILE = "CDIProperties.properties";
    private Logger logger;
    private String resourceBundleDefaultBaseName;

    private ExtensionConfiguration() {
        logger = LoggerFactory.getLogger(ExtensionConfiguration.class);
        LocaleResolverFactory.setLocaleResolver(new StandaloneLocaleResolver());
        URL url = ExtensionConfiguration.class.getClassLoader().getResource(EXTENSION_PROPERTIES_FILE);
        if (url != null) {
            Properties properties = new Properties();
            try {
                properties.load(url.openStream());
                setResourceBundleDefaultBaseName(properties.getProperty(ExtensionInitializer.DEFAULT_RESOURCE_BUNDLE_BASE_NAME_PARAM));
            } catch (IOException e) {
// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/exception/ExtensionInitializationException.java
// public class ExtensionInitializationException extends RuntimeException {
// 
//     private static final long serialVersionUID = 1L;
// 
//     public ExtensionInitializationException(String message) {
//         super(message);
//     }
// 
//     public ExtensionInitializationException(Throwable cause) {
//         super(cause);
//     }
// 
//     public ExtensionInitializationException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }
// 
// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/resolver/locale/LocaleResolverFactory.java
// public class LocaleResolverFactory {
// 
//     private static volatile LocaleResolver localeResolver;
// 
//     private LocaleResolverFactory() {
//     }
// 
//     /**
//      * Gets the configured extension locale resolver
//      * 
//      * @return The extension configured locale resolver
//      */
//     public static LocaleResolver getLocaleResolver() {
//         return localeResolver;
//     }
// 
//     /**
//      * Sets the configured extension locale resolver
//      * 
//      * @param localeResolver
//      *            The configured extension locale resolver
//      */
//     public static void setLocaleResolver(LocaleResolver localeResolver) {
//         LocaleResolverFactory.localeResolver = localeResolver;
//     }
// 
// }
// 
// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/resolver/locale/StandaloneLocaleResolver.java
// public class StandaloneLocaleResolver implements LocaleResolver {
// 
//     /**
//      * See {@link LocaleResolver#getLocale()}
//      */
//     @Override
//     public Locale getLocale() {
//         return Locale.getDefault();
//     }
// 
// }


// Path: cdi-properties-main/src/main/java/com/byteslounge/cdi/configuration/ExtensionConfiguration.java
import java.io.IOException;
import java.net.URL;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.byteslounge.cdi.exception.ExtensionInitializationException;
import com.byteslounge.cdi.resolver.locale.LocaleResolverFactory;
import com.byteslounge.cdi.resolver.locale.StandaloneLocaleResolver;

/*
 * Copyright 2014 byteslounge.com (Gonçalo Marques).
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package com.byteslounge.cdi.configuration;




/**
 * Defines the global application configuration.
 * 
 * @author Gonçalo Marques
 * @since 1.0.0
 */
public enum ExtensionConfiguration {

    INSTANCE;

    private static final String EXTENSION_PROPERTIES_FILE = "CDIProperties.properties";
    private Logger logger;
    private String resourceBundleDefaultBaseName;

    private ExtensionConfiguration() {
        logger = LoggerFactory.getLogger(ExtensionConfiguration.class);
        LocaleResolverFactory.setLocaleResolver(new StandaloneLocaleResolver());
        URL url = ExtensionConfiguration.class.getClassLoader().getResource(EXTENSION_PROPERTIES_FILE);
        if (url != null) {
            Properties properties = new Properties();
            try {
                properties.load(url.openStream());
                setResourceBundleDefaultBaseName(properties.getProperty(ExtensionInitializer.DEFAULT_RESOURCE_BUNDLE_BASE_NAME_PARAM));
            } catch (IOException e) {
                throw new ExtensionInitializationException("Error while loading CDI Properties configuration file", e);