Index: /trunk/zoo-project/HISTORY.txt
===================================================================
--- /trunk/zoo-project/HISTORY.txt	(revision 557)
+++ /trunk/zoo-project/HISTORY.txt	(revision 558)
@@ -2,4 +2,5 @@
   * Add Orfeo Toolbox support for applications as a service
   * Add the otb2zcfg utility to produce zcfg for otb applications
+  * Add OTB Application Observer to have progress status updates
   * Fix maxOccurs handling
   * Fix gesture of downloaded inputs when multiple values are given
Index: /trunk/zoo-project/LICENSE
===================================================================
--- /trunk/zoo-project/LICENSE	(revision 557)
+++ /trunk/zoo-project/LICENSE	(revision 558)
@@ -9,5 +9,5 @@
 ------------------
 
-Copyright (c) 2009-2013 GeoLabs SARL
+Copyright (c) 2009-2015 GeoLabs SARL
 Copyright 2010-2011 Fondazione Edmund Mach. All rights reserved.
 
@@ -29,4 +29,19 @@
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
+
+ZOO-Kernel OTB Support
+----------------------
+
+Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+See OTBCopyright.txt for details.
+
+Some parts of this code are derived from ITK. See ITKCopyright.txt
+for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.  See the above copyright notices for more information.
+
+See Ref: http://hg.orfeo-toolbox.org/OTB/ Copyright
 
 ZOO-API License
Index: /trunk/zoo-project/zoo-kernel/otbZooWatcher.cxx
===================================================================
--- /trunk/zoo-project/zoo-kernel/otbZooWatcher.cxx	(revision 558)
+++ /trunk/zoo-project/zoo-kernel/otbZooWatcher.cxx	(revision 558)
@@ -0,0 +1,70 @@
+/*=========================================================================
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+  Some parts of this code are derived from ITK. See ITKCopyright.txt
+  for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+  See Ref: http://hg.orfeo-toolbox.org/OTB/file/f93358065d51/Copyright
+
+=========================================================================*/
+#include "otbZooWatcher.h"
+#include "service_internal.h"
+
+ZooWatcher
+::ZooWatcher()
+{
+}
+
+ZooWatcher
+::ZooWatcher(itk::ProcessObject* process,
+	     const char *comment)
+  : otb::FilterWatcherBase(process, comment)
+{
+}
+
+ZooWatcher
+::ZooWatcher(itk::ProcessObject* process,
+	     const std::string& comment)
+  : otb::FilterWatcherBase(process, comment.c_str())
+{
+}
+
+void
+ZooWatcher
+::ShowProgress()
+{
+  if (m_Process)
+    {
+      int progressPercent = static_cast<int>(m_Process->GetProgress() * 100);
+      updateStatus(m_Conf,progressPercent,m_Comment.c_str());
+    }
+}
+
+void
+ZooWatcher
+::StartFilter()
+{
+  m_TimeProbe.Start();
+}
+
+void
+ZooWatcher
+::EndFilter()
+{
+  m_TimeProbe.Stop();
+  std::ostringstream elapsedTime;
+  elapsedTime.precision(1);
+  elapsedTime << m_TimeProbe.GetMean();
+
+  std::cerr << " (OTB Execution: "
+            << elapsedTime.str()
+            << " seconds)"
+            << std::endl;
+}
Index: /trunk/zoo-project/zoo-kernel/otbZooWatcher.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/otbZooWatcher.h	(revision 558)
+++ /trunk/zoo-project/zoo-kernel/otbZooWatcher.h	(revision 558)
@@ -0,0 +1,69 @@
+/*=========================================================================
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+  Some parts of this code are derived from ITK. See ITKCopyright.txt
+  for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+  See Ref: http://hg.orfeo-toolbox.org/OTB/ Copyright
+
+=========================================================================*/
+#ifndef __zooOtbWatcher_h
+#define __zooOtbWatcher_h
+
+#include "otbFilterWatcherBase.h"
+#include "service.h"
+
+class /*ITK_EXPORT*/ ZooWatcher : public otb::FilterWatcherBase
+{
+public:
+
+  /** Constructor. Takes a ProcessObject to monitor and an optional
+   * comment string that is prepended to each event message. */
+  ZooWatcher(itk::ProcessObject* process,
+                        const char *comment = "");
+
+  ZooWatcher(itk::ProcessObject* process,
+                        const std::string& comment = "");
+
+  /** Default constructor */
+  ZooWatcher();
+
+  /** Get/Set/Free Configuration maps */
+  void SetConf(maps **conf)
+  {
+    m_Conf=dupMaps(conf);
+  }
+  const maps& GetConf() const
+  {
+    return *m_Conf;
+  }
+  void FreeConf(){
+    freeMaps(&m_Conf);
+    free(m_Conf);
+  }
+protected:
+
+  /** Callback method to show the ProgressEvent */
+  virtual void ShowProgress();
+
+  /** Callback method to show the StartEvent */
+  virtual void StartFilter();
+
+  /** Callback method to show the EndEvent */
+  virtual void EndFilter();
+
+private:
+
+  /** Main conf maps */
+  maps* m_Conf;
+
+};
+
+#endif
Index: /trunk/zoo-project/zoo-kernel/service_internal_otb.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 557)
+++ /trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 558)
@@ -21,11 +21,40 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
+ *
+ * See Ref: http://hg.orfeo-toolbox.org/OTB/ Copyright
+ * Some parts of this code are derived from ITK. See ITKCopyright.txt for 
+ * details.
  */
 
 #include "service_internal_otb.h"
-#include <vector>
-#include <string>
 
 using namespace otb::Wrapper;
+
+class MyCommand : public itk::Command
+{
+ public:
+  itkNewMacro( MyCommand );
+ public:
+
+  void Execute(itk::Object *caller, const itk::EventObject & event)
+  {
+    Execute( (const itk::Object *)caller, event);
+  }
+ 
+  void Execute(const itk::Object * object, const itk::EventObject & event)
+  {
+    const AddProcessToWatchEvent* eventToWatch = dynamic_cast< const AddProcessToWatchEvent*> ( &event );
+    std::string m_CurrentDescription = eventToWatch->GetProcessDescription();
+    std::cerr << "err_service_zooo start ccalled." << m_CurrentDescription << std::endl;
+    ZooWatcher * watch = new ZooWatcher(eventToWatch->GetProcess(),
+					eventToWatch->GetProcessDescription());
+    watch->SetConf(&m_Conf);
+    m_WatcherList.push_back(watch);
+  }
+
+
+
+};
+
 
 std::string ReplaceAll(std::string str, const std::string& from, const std::string& to) {
@@ -42,4 +71,6 @@
   maps* inputs=*real_inputs;
   maps* outputs=*real_outputs;
+  map* tmp0=getMapFromMaps(*main_conf,"lenv","cwd");
+  char *ntmp=tmp0->value;
   map* tmp=NULL;
   int res=-1;
@@ -68,6 +99,9 @@
 	  res=-1;
 	}else{
+	  // Create Observer on AddProcessToWatchEvent
+	  m_Conf=m;
+	  MyCommand::Pointer myCommand = MyCommand::New();
+	  m_Application->AddObserver(AddProcessToWatchEvent(), myCommand);
 	  char tmpS[1024];
-	  sprintf(tmpS, "The OTB Application %s was loaded correctly.", (*it).c_str());
 	  const std::vector<std::string> appKeyList = m_Application->GetParametersKeys(true);
 	  for (unsigned int i = 0; i < appKeyList.size(); i++){
@@ -80,4 +114,8 @@
 	      if(test==NULL){
 		test=getMapFromMaps(inputs,paramKey.c_str(),"inRequest");
+		map* tmpPath=getMapFromMaps(m,"main","tmpPath");
+		map* tmpSid=getMapFromMaps(m,"lenv","usid");
+		char tmp[1024];
+		map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
 		if(test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){
 		  test=getMapFromMaps(inputs,paramKey.c_str(),"value");
@@ -96,8 +134,4 @@
 		    else if (strncasecmp(test->value,"double",6)==0)
 		      outPixType = ImagePixelType_double;
-		    map* tmpPath=getMapFromMaps(m,"main","tmpPath");
-		    map* tmpSid=getMapFromMaps(m,"lenv","sid");
-		    char tmp[1024];
-		    map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
 		    char* ext="tiff";
 		    if(tmpVal!=NULL){
@@ -122,8 +156,4 @@
 		}else{
 		  if(type == ParameterType_OutputVectorData){
-		      map* tmpPath=getMapFromMaps(m,"main","tmpPath");
-		      map* tmpSid=getMapFromMaps(m,"lenv","sid");
-		      char tmp[1024];
-		      map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
 		      char* ext="json";
 		      if(tmpVal!=NULL){
@@ -146,8 +176,4 @@
 		  else
 		    if(type == ParameterType_OutputFilename){
-		      map* tmpPath=getMapFromMaps(m,"main","tmpPath");
-		      map* tmpSid=getMapFromMaps(m,"lenv","sid");
-		      char tmp[1024];
-		      map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
 		      char* ext="txt";
 		      if(tmpVal!=NULL){
@@ -355,4 +381,12 @@
     }
   }
+
+  for (unsigned int i = 0; i < m_WatcherList.size(); i++){
+    m_WatcherList[i]->FreeConf();
+    delete m_WatcherList[i];
+    m_WatcherList[i] = NULL;
+  }
+  m_WatcherList.clear();
+
   return res;
 }
Index: /trunk/zoo-project/zoo-kernel/service_internal_otb.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_otb.h	(revision 557)
+++ /trunk/zoo-project/zoo-kernel/service_internal_otb.h	(revision 558)
@@ -31,4 +31,6 @@
 #include "otbWrapperApplicationRegistry.h"
 #include "otbWrapperInputImageListParameter.h"
+#include "otbWrapperAddProcessToWatchEvent.h"
+#include "otbZooWatcher.h"
 #include "service_internal.h"
 #include "service.h"
@@ -38,5 +40,10 @@
 #include <direct.h>
 #endif
+#include <vector>
+#include <string>
 
+typedef std::vector<ZooWatcher *> WatcherListType;
+WatcherListType m_WatcherList;
+maps* m_Conf;
 int zoo_otb_support(maps**,map*,service*,maps**,maps**);
 
