define([ 
"require",
"dojo/_base/array", 
"dojo/_base/declare", 
"dojo/_base/lang", 
"dojo/string",
"dojo/when",
"obnogen/service/com/obno/core/ConfigurationService"
], function(require, array, declare, lang, string, when, ConfigurationService) {

	var module = declare("obno.core.Configuration", null, {
		
		getContext: function(){
			if (!module.cfg){
				return "";
			}
			return module.cfg.context;				
		},
		
		getValidateSSOTokenBeforeXHR: function(){
			if (!module.cfg){
				return false;
			}
			return true === module.cfg.validateSSOTokenBeforeXHR;
		}
		
	});
	
	var load = function(){
		if (!module.cfg){
			var svc = new ConfigurationService();
			dojox.rpc._sync = true;
			when(svc.queryConfiguration(), 
				 function(ret){
					var cfg = ret[0];
					module.cfg = cfg;
				 }, 
				 function(){
					module.cfg = {context: ""};
				 }
			);			
			delete dojox.rpc._sync;
		}
		
	};
	
	load();

	return module;

});