Salome HOME
Porting SALOME KERNEL to CMake
[modules/kernel.git] / src / Launcher / Launcher_Job.hxx
index 853ca7953a9edd65a5001f66bc6816873313ebb3..bbff80f54a2a2f1d48085d95a21806130a5731a2 100644 (file)
@@ -1,27 +1,28 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author: AndrĂ© RIBES - EDF R&D
 
+// Author: AndrĂ© RIBES - EDF R&D
+//
 #ifndef _LAUNCHER_JOB_HXX_
 #define _LAUNCHER_JOB_HXX_
 
-#include <SALOMEconfig.h>
+#include "Launcher_Utils.hxx"
 #include "ResourcesManager.hxx"
 
 #include <stdlib.h>
@@ -30,6 +31,7 @@
 
 #include <string>
 #include <list>
+#include <map>
 #include <iostream>
 #include <sstream>
 #include <algorithm>
 #include <Batch/Batch_EmulationException.hxx>
 #endif
 
+#include <libxml/parser.h>
+
 namespace Launcher
 {
-  class Job
+  class LAUNCHER_EXPORT Job
   {
     public:
       Job();
@@ -60,8 +64,9 @@ namespace Launcher
 
       virtual void setResourceDefinition(const ParserResourcesType & resource_definition);
       ParserResourcesType getResourceDefinition();
-      
+
       // Common parameters
+      void setJobName(const std::string & job_name);
       virtual void setJobFile(const std::string & job_file);
       void setWorkDirectory(const std::string & work_directory);
       void setLocalDirectory(const std::string & local_directory);
@@ -73,6 +78,7 @@ namespace Launcher
       void setQueue(const std::string & queue);
       void setEnvFile(const std::string & env_file);
 
+      std::string getJobName();
       std::string getJobFile();
       std::string getWorkDirectory();
       std::string getLocalDirectory();
@@ -83,9 +89,15 @@ namespace Launcher
       resourceParams getResourceRequiredParams();
       std::string getQueue();
       std::string getEnvFile();
-      
+      std::string getJobType();
+
       std::string updateJobState();
 
+      void addSpecificParameter(const std::string & name,
+                                  const std::string & value);
+      const std::map<std::string, std::string> & getSpecificParameters();
+      virtual void checkSpecificParameters();
+
       // Checks
       void checkMaximumDuration(const std::string & maximum_duration);
       void checkResourceRequiredParams(const resourceParams & resource_required_params);
@@ -94,18 +106,27 @@ namespace Launcher
       long convertMaximumDuration(const std::string & maximum_duration);
       std::string getLaunchDate();
 
+      // Xml method
+      void addToXmlDocument(xmlNodePtr root_node);
+
+      void stopJob();
+      void removeJob();
+
       // Abstract class
       virtual void update_job() = 0;
 
     protected:
       int _number;
 
+      std::string _job_type;
+
       std::string _state;
       std::string _launch_date;
       std::string _env_file;
 
       ParserResourcesType _resource_definition;
 
+      std::string _job_name;
       std::string _job_file;
       std::string _job_file_name;
       std::string _job_file_name_complete;
@@ -115,6 +136,7 @@ namespace Launcher
       std::string _result_directory;
       std::list<std::string> _in_files;
       std::list<std::string> _out_files;
+      std::map<std::string, std::string> _specific_parameters;
       std::string _maximum_duration;
       long _maximum_duration_in_second;
       resourceParams _resource_required_params;