class StandardEnvironmentFacadeFactory implements EnvironmentFacadeFactory {

    @SuppressWarnings("unchecked")
    @Override
    public EnvironmentFacade createEnvironmentFacade(final ConfiguredObject<?> parent)
    {
        final FileBasedSettings settings = (FileBasedSettings)parent;
        final String storeLocation = settings.getStorePath();

        StandardEnvironmentConfiguration sec = new StandardEnvironmentConfiguration()
        {
            @Override
            public String getName()
            {
                return parent.getName();
            }

            @Override
            public String getStorePath()
            {
                return storeLocation;
            }

            @Override
            public CacheMode getCacheMode()
            {
                return BDBUtils.getCacheMode(parent);
            }

            @Override
            public Map<String, String> getParameters()
            {
                return BDBUtils.getEnvironmentConfigurationParameters(parent);
            }

            @Override
            public <T> T getFacadeParameter(final Class<T> clazz, final String parameterName, final T defaultValue)
            {
                return BDBUtils.getContextValue(parent, clazz, parameterName, defaultValue);
            }

            @Override
            public <T> T getFacadeParameter(final Class<T> paremeterClass, final Type type, final String parameterName, final T defaultValue)
            {
                return BDBUtils.getContextValue(parent, paremeterClass, type, parameterName, defaultValue);
            }
        };

        return new StandardEnvironmentFacade(sec);
    }

}