
function Retriever()
{

	
	this.callbackAfterRetrieval = null;

	this.remoteObject = null; 
	
	
	this.setRemoteObject = function(obj)
	{
		this.remoteObject = obj;
	}

	this.setCallbackAfterRetrieval = function(callback)
	{
		this.callbackAfterRetrieval = callback;
	}

	this.instantiateCaller = function()
	{
	
		var successCallback = function(mo, mr) 
		{
			Retriever.getSingleton().callbackAfterRetrieval(mo);
		};
		
		var loadingCallback = function()
		{
			
		}

		var failureCallback = function(reason)
		{
			alert("Retriever : " + reason);
		}
		
		var cGroup = new RPCallbackGroup(successCallback, loadingCallback, failureCallback);
		
		var caller = new RPCaller(cGroup, this.remoteObject);

		return caller;

	}

	/*  Let this be an abstract method. Call the desired remote method of remoteObject to retrieve de content, here.*/
	this.retrieve = function(url)
	{
		
	}

	Retriever.singleton = this;

	Retriever.getSingleton = function()
	{
		return Retriever.singleton;
	}

}
