Index: trunk/zoo-project/zoo-kernel/service_internal_otb.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 632)
+++ trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 640)
@@ -28,6 +28,13 @@
 
 #include "service_internal_otb.h"
+#include "response_print.h"
+#include "server_internal.h"
 
 using namespace otb::Wrapper;
+
+/**
+ * Global OTB counter 
+ */
+int otbCounter=0;
 
 /**
@@ -148,5 +155,5 @@
 	  for (unsigned int i = 0; i < appKeyList.size(); i++){
 	    const std::string paramKey(appKeyList[i]);
-	    std::vector<std::string> values;
+	    fprintf(stderr,"%s %d %s !\n",__FILE__,__LINE__,paramKey.c_str());
 	    Parameter::Pointer param = m_Application->GetParameterByKey(paramKey);
 	    ParameterType type = m_Application->GetParameterType(paramKey);
@@ -154,4 +161,5 @@
 	      map* test=getMapFromMaps(inputs,paramKey.c_str(),"cache_file");
 	      if(test==NULL){
+		fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,paramKey.c_str());
 		test=getMapFromMaps(inputs,paramKey.c_str(),"inRequest");
 		map* tmpPath=getMapFromMaps(m,"main","tmpPath");
@@ -160,5 +168,5 @@
 		map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
 		maps* tmpMaps=getMaps(outputs,paramKey.c_str());
-		if(test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){
+		if(tmpMaps!=NULL && test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){
 		  test=getMapFromMaps(inputs,paramKey.c_str(),"value");
 		  if(type == ParameterType_OutputImage){
@@ -187,12 +195,9 @@
 			    ext="jpeg";
 		    }
-		    sprintf(tmp,"%s/%s_%s.%s",tmpPath->value,s->name,tmpSid->value,ext);
+		    sprintf(tmp,"%s/%s_%d_%s.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext);
+		    otbCounter++;
 		    m_Application->SetParameterString(paramKey, tmp);
 		    setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp);
 		    dynamic_cast<OutputImageParameter *> (param.GetPointer())->SetPixelType(outPixType);
-		  }
-		  else{ 
-		    if(test!=NULL && test->value!=NULL)
-		      m_Application->SetParameterString(paramKey, test->value);
 		  }
 		}else{
@@ -212,5 +217,6 @@
 			      ext="kml";
 		      }
-		      sprintf(tmp,"%s/%s_%s.%s",tmpPath->value,s->name,tmpSid->value,ext);
+		      sprintf(tmp,"%s/%s_%d_%s.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext);
+		      otbCounter++;
 		      m_Application->SetParameterString(paramKey, tmp);
 		      setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp);
@@ -234,5 +240,5 @@
 				if(strncasecmp(tmpVal->value,"application/vnd.google-earth.kmz",32)==0){
 				  ext="kmz";
-				  sprintf(tmp,"%s/%s_%sxt.%s",tmpPath->value,s->name,tmpSid->value,ext);
+				  sprintf(tmp,"%s/%s_%d_%sxt.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext);
 				  m_Application->SetParameterString(paramKey, tmp);
 				  setMapInMaps(outputs,paramKey.c_str(),"expected_generated_file",tmp);
@@ -240,12 +246,37 @@
 
 		      }
-		      sprintf(tmp,"%s/%s_%s.%s",tmpPath->value,s->name,tmpSid->value,ext);
+		      sprintf(tmp,"%s/%s_%d_%s.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext);
+		      otbCounter++;
 		      m_Application->SetParameterString(paramKey, tmp);
 		      setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp);
 		    }
-
+		    else{
+		      test=getMapFromMaps(inputs,paramKey.c_str(),"value");
+		      if(test!=NULL && type!=ParameterType_ListView){
+			m_Application->SetParameterString(paramKey, test->value);
+		      }
+		      else
+			if(type==ParameterType_ListView){
+			  std::vector<std::string> values;
+			  values.push_back(test->value);
+			  map* tmpLength=getMapFromMaps(inputs,paramKey.c_str(),"length");
+			  if(tmpLength!=NULL){
+			    int len=atoi(tmpLength->value);
+			    for(int k=1;k<len;k++){
+			      char tmp[15];
+			      sprintf(tmp,"cache_file_%d",k);
+			      map* tmpVal=getMapFromMaps(inputs,paramKey.c_str(),tmp);
+			      if(tmpVal!=NULL){
+				values.push_back(tmpVal->value);
+			      }
+			    }
+			  }
+			  dynamic_cast<ListViewParameter *> (param.GetPointer())->SetSelectedItems(values);
+			}
+		    }
 		}
 	      }else{
 		if(type == ParameterType_InputImageList){
+		  std::vector<std::string> values;
 		  values.push_back(test->value);
 		  map* tmpPath=getMapFromMaps(inputs,paramKey.c_str(),"length");
